ソースを参照

Merge remote-tracking branch 'origin/20211122' into 20211122

mainqaq 3 年 前
コミット
2413e4e6da
共有3 個のファイルを変更した53 個の追加20 個の削除を含む
  1. 38 13
      controllers/supply_order_api_contorller.go
  2. 9 7
      models/supply.models.go
  3. 6 0
      service/supply_service.go

+ 38 - 13
controllers/supply_order_api_contorller.go ファイルの表示

@@ -1416,21 +1416,42 @@ func (this *SupplyOrderApiController) GetAllGoodOderList() {
1416 1416
 func (this *SupplyOrderApiController) GetGoodOrderDetail() {
1417 1417
 
1418 1418
 	id, _ := this.GetInt64("id")
1419
+	ids := this.GetString("ids")
1419 1420
 	orgId := this.GetAdminUserInfo().CurrentOrgId
1420
-	out, err := service.GetGoodOrderDetail(id, orgId)
1421
-	list, _ := service.GetSupplyWarehouseOutById(id, orgId)
1422
-	drugList, _ := service.GetSupplyDrugList(orgId)
1423
-	goodList, _ := service.GetSupplyGoodList(orgId)
1424
-	if err == nil {
1425
-		this.ServeSuccessJSON(map[string]interface{}{
1426
-			"out":      out,
1427
-			"list":     list,
1428
-			"goodList": goodList,
1429
-			"drugList": drugList,
1430
-		})
1431
-	} else {
1432
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1421
+	if len(ids) == 0 {
1422
+		out, err := service.GetGoodOrderDetail(id, orgId)
1423
+		list, _ := service.GetSupplyWarehouseOutById(id, orgId)
1424
+		drugList, _ := service.GetSupplyDrugList(orgId)
1425
+		goodList, _ := service.GetSupplyGoodList(orgId)
1426
+		if err == nil {
1427
+			this.ServeSuccessJSON(map[string]interface{}{
1428
+				"out":      out,
1429
+				"list":     list,
1430
+				"goodList": goodList,
1431
+				"drugList": drugList,
1432
+			})
1433
+		} else {
1434
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1435
+		}
1436
+	}
1437
+	if len(ids) > 0 {
1438
+		idArray := strings.Split(ids, ",")
1439
+		out, err := service.GetGoodOrderDetail(id, orgId)
1440
+		list, _ := service.GetSupplyWarehouseOutByIdOne(id, orgId, idArray)
1441
+		drugList, _ := service.GetSupplyDrugList(orgId)
1442
+		goodList, _ := service.GetSupplyGoodList(orgId)
1443
+		if err == nil {
1444
+			this.ServeSuccessJSON(map[string]interface{}{
1445
+				"out":      out,
1446
+				"list":     list,
1447
+				"goodList": goodList,
1448
+				"drugList": drugList,
1449
+			})
1450
+		} else {
1451
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1452
+		}
1433 1453
 	}
1454
+
1434 1455
 }
1435 1456
 
1436 1457
 func (this *SupplyOrderApiController) UpdateGoodOrder() {
@@ -2676,6 +2697,8 @@ func (this *SupplyOrderApiController) ModefyGoodOrder() {
2676 2697
 	//获取购货单的数据
2677 2698
 	goodOrder, _ := service.GetAllGoodOrderById(id, orgId)
2678 2699
 	drugList, _ := service.GetSupplyDrugList(orgId)
2700
+	//获取已有关联的退货单
2701
+	cancelList, _ := service.GetSupplyCancelWarehouse(id, orgId)
2679 2702
 	//查询是否存在退货单
2680 2703
 	_, errcode := service.GetSupplyCancelOrderById(id, orgId)
2681 2704
 	//无退库单
@@ -2710,6 +2733,7 @@ func (this *SupplyOrderApiController) ModefyGoodOrder() {
2710 2733
 		service.UpdateGoodSupplyFlow(id, orgId)
2711 2734
 		if err == nil {
2712 2735
 			this.ServeSuccessJSON(map[string]interface{}{
2736
+				"cancelList":   cancelList,
2713 2737
 				"purcaseOrder": purcaseOrder,
2714 2738
 				"goodOrder":    goodOrder,
2715 2739
 				"drugList":     drugList,
@@ -2721,6 +2745,7 @@ func (this *SupplyOrderApiController) ModefyGoodOrder() {
2721 2745
 		}
2722 2746
 	} else if errcode == nil {
2723 2747
 		this.ServeSuccessJSON(map[string]interface{}{
2748
+			"cancelList":   cancelList,
2724 2749
 			"purcaseOrder": purcaseOrder,
2725 2750
 			"goodOrder":    goodOrder,
2726 2751
 			"drugList":     drugList,

+ 9 - 7
models/supply.models.go ファイルの表示

@@ -391,10 +391,11 @@ func (VmSpSupplierWarehouseCancel) TableName() string {
391 391
 }
392 392
 
393 393
 type VmSpSupplierWarehousingOutOrder struct {
394
-	ProjectId      int64 `gorm:"column:project_id" json:"project_id" form:"project_id"`
395
-	IsSource       int64 `gorm:"column:is_source" json:"is_source" form:"is_source"`
396
-	Count          int64 `gorm:"column:count" json:"count" form:"count"`
397
-	WarehouseOutId int64 `gorm:"column:warehouse_out_id" json:"warehouse_out_id" form:"warehouse_out_id"`
394
+	ProjectId      int64  `gorm:"column:project_id" json:"project_id" form:"project_id"`
395
+	IsSource       int64  `gorm:"column:is_source" json:"is_source" form:"is_source"`
396
+	Count          int64  `gorm:"column:count" json:"count" form:"count"`
397
+	WarehouseOutId int64  `gorm:"column:warehouse_out_id" json:"warehouse_out_id" form:"warehouse_out_id"`
398
+	SupplyUnit     string `gorm:"column:supply_unit" json:"supply_unit" form:"supply_unit"`
398 399
 }
399 400
 
400 401
 func (VmSpSupplierWarehousingOutOrder) TableName() string {
@@ -402,9 +403,10 @@ func (VmSpSupplierWarehousingOutOrder) TableName() string {
402 403
 }
403 404
 
404 405
 type VmSpSupplierWarehousingCancelOrder struct {
405
-	ProjectId int64 `gorm:"column:project_id" json:"project_id" form:"project_id"`
406
-	IsSource  int64 `gorm:"column:is_source" json:"is_source" form:"is_source"`
407
-	Count     int64 `gorm:"column:count" json:"count" form:"count"`
406
+	ProjectId  int64  `gorm:"column:project_id" json:"project_id" form:"project_id"`
407
+	IsSource   int64  `gorm:"column:is_source" json:"is_source" form:"is_source"`
408
+	Count      int64  `gorm:"column:count" json:"count" form:"count"`
409
+	SupplyUnit string `gorm:"column:supply_unit" json:"supply_unit" form:"supply_unit"`
408 410
 }
409 411
 
410 412
 func (VmSpSupplierWarehousingCancelOrder) TableName() string {

+ 6 - 0
service/supply_service.go ファイルの表示

@@ -427,6 +427,12 @@ func GetSupplyWarehouseOutById(id int64, user_org_id int64) (order []*models.SpS
427 427
 	return order, err
428 428
 }
429 429
 
430
+func GetSupplyWarehouseOutByIdOne(id int64, user_org_id int64, ids []string) (order []*models.SpSupplierWarehousingOutOrder, err error) {
431
+
432
+	err = XTReadDB().Where("warehouse_out_id = ? and status = 1 and user_org_id = ? and project_id in(?)", id, user_org_id, ids).Find(&order).Error
433
+	return order, err
434
+}
435
+
430 436
 func GetAllGoodOderList(check_id int64, keyword string, page int64, limit int64, startime int64, endtime int64, orgid int64) (out []*models.VmSupplierWarehouseOut, total int64, err error) {
431 437
 	db := XTReadDB().Model(&out).Where("sgj_xt.xt_supplier_warehouse_out.status = 1")
432 438
 	likeKey := "%" + keyword + "%"