|
@@ -103,6 +103,9 @@ func SupplyOrderApiRegistRouters() {
|
103
|
103
|
beego.Router("/api/supply/deletereturnorderbyid", &SupplyOrderApiController{}, "Get:DeleteReturnOrderById")
|
104
|
104
|
//反审核退货单
|
105
|
105
|
beego.Router("/api/supply/modefyreturnorder", &SupplyOrderApiController{}, "Get:ModefyReturnOrder")
|
|
106
|
+
|
|
107
|
+ //获取采购数据
|
|
108
|
+ beego.Router("/api/supply/getgoodorderdetaillist", &SupplyOrderApiController{}, "Get:GetGoodOrderDetailList")
|
106
|
109
|
}
|
107
|
110
|
|
108
|
111
|
//判断前端参数是否为空
|
|
@@ -305,6 +308,7 @@ func (this *SupplyOrderApiController) UpdateSupply() {
|
305
|
308
|
Number: number,
|
306
|
309
|
Bank: bank,
|
307
|
310
|
BankAccount: bankAccount,
|
|
311
|
+ UserOrgId: orgId,
|
308
|
312
|
Status: 1,
|
309
|
313
|
Mtime: time.Now().Unix(),
|
310
|
314
|
Modify: tmodify,
|
|
@@ -962,6 +966,7 @@ func (this *SupplyOrderApiController) GetAllPurchaseOrderList() {
|
962
|
966
|
limit, _ := this.GetInt64("limit")
|
963
|
967
|
orgId := this.GetAdminUserInfo().CurrentOrgId
|
964
|
968
|
list, total, err := service.GetAllPurchaseOrderList(check_id, startTime, endTime, keyword, page, limit, orgId)
|
|
969
|
+
|
965
|
970
|
if err == nil {
|
966
|
971
|
this.ServeSuccessJSON(map[string]interface{}{
|
967
|
972
|
"list": list,
|
|
@@ -1213,8 +1218,11 @@ func (this *SupplyOrderApiController) UpdatePurchaseOrder() {
|
1213
|
1218
|
}
|
1214
|
1219
|
|
1215
|
1220
|
}
|
|
1221
|
+ //查询
|
|
1222
|
+ orderInfo, _ := service.GetSupplyWarehousingOrderInfo(warehousing_id)
|
1216
|
1223
|
this.ServeSuccessJSON(map[string]interface{}{
|
1217
|
1224
|
"warehousingInfo": warehousingInfo,
|
|
1225
|
+ "orderInfo": orderInfo,
|
1218
|
1226
|
})
|
1219
|
1227
|
|
1220
|
1228
|
}
|
|
@@ -1257,6 +1265,7 @@ func (this *SupplyOrderApiController) GetPurchaseOrderDetail() {
|
1257
|
1265
|
baseList, _ := service.GetSupplyDrugList(orgId)
|
1258
|
1266
|
|
1259
|
1267
|
goodList, _ := service.GetSupplyGoodList(orgId)
|
|
1268
|
+
|
1260
|
1269
|
if err == nil {
|
1261
|
1270
|
this.ServeSuccessJSON(map[string]interface{}{
|
1262
|
1271
|
"info": info,
|
|
@@ -1542,6 +1551,7 @@ func (this *SupplyOrderApiController) AddGoodOrder() {
|
1542
|
1551
|
GoodNumber: warehouseOut.GoodNumber,
|
1543
|
1552
|
SupplyManufacturer: supply_manufacturer,
|
1544
|
1553
|
MinPrice: min_price_float,
|
|
1554
|
+ IsWarehosue: 2,
|
1545
|
1555
|
}
|
1546
|
1556
|
warehousingOut = append(warehousingOut, &order)
|
1547
|
1557
|
}
|
|
@@ -1552,20 +1562,25 @@ func (this *SupplyOrderApiController) AddGoodOrder() {
|
1552
|
1562
|
//如果是手动新增的,type 等于2
|
1553
|
1563
|
if item.WarehouseInfoId == 0 {
|
1554
|
1564
|
item.Type = 2
|
|
1565
|
+ service.CreateSupplyWarehousOutOrder(item)
|
1555
|
1566
|
}
|
1556
|
|
- //查询该商品是否来源于采购订单,如果存在则关联, 如果不存在则取消关联
|
1557
|
|
- _, errcode := service.GetGoodIsSource(warehousing_id, item.ProjectId, orgId)
|
1558
|
|
- if errcode == gorm.ErrRecordNotFound {
|
1559
|
|
- item.WarehousingId = 0
|
1560
|
|
- item.WarehouseInfoId = 0
|
1561
|
|
- item.OrderNumber = ""
|
1562
|
|
- item.Type = 2
|
1563
|
|
- err = service.CreateSupplyWarehousOutOrder(item)
|
1564
|
|
- //更新采购单
|
1565
|
|
- service.ModfySupplyWarehouseOut(warehousing_id, orgId)
|
1566
|
|
- }
|
1567
|
|
- if errcode == nil {
|
1568
|
|
- err = service.CreateSupplyWarehousOutOrder(item)
|
|
1567
|
+
|
|
1568
|
+ if item.WarehouseInfoId > 0 {
|
|
1569
|
+ //查询该商品是否来源于采购订单,如果存在则关联, 如果不存在则取消关联
|
|
1570
|
+ _, errcode := service.GetGoodIsSource(warehousing_id, item.ProjectId, orgId)
|
|
1571
|
+
|
|
1572
|
+ if errcode == gorm.ErrRecordNotFound {
|
|
1573
|
+ item.WarehousingId = 0
|
|
1574
|
+ item.WarehouseInfoId = 0
|
|
1575
|
+ item.OrderNumber = ""
|
|
1576
|
+ item.Type = 2
|
|
1577
|
+ err = service.CreateSupplyWarehousOutOrder(item)
|
|
1578
|
+ //更新采购单
|
|
1579
|
+ service.ModfySupplyWarehouseOut(warehousing_id, orgId)
|
|
1580
|
+ }
|
|
1581
|
+ if errcode == nil {
|
|
1582
|
+ err = service.CreateSupplyWarehousOutOrder(item)
|
|
1583
|
+ }
|
1569
|
1584
|
}
|
1570
|
1585
|
|
1571
|
1586
|
}
|
|
@@ -1630,17 +1645,34 @@ func (this *SupplyOrderApiController) GetGoodOrderDetail() {
|
1630
|
1645
|
id, _ := this.GetInt64("id")
|
1631
|
1646
|
ids := this.GetString("ids")
|
1632
|
1647
|
orgId := this.GetAdminUserInfo().CurrentOrgId
|
|
1648
|
+
|
1633
|
1649
|
if len(ids) == 0 {
|
1634
|
1650
|
out, err := service.GetGoodOrderDetail(id, orgId)
|
1635
|
1651
|
list, _ := service.GetSupplyWarehouseOutById(id, orgId)
|
|
1652
|
+ for _, item := range list {
|
|
1653
|
+
|
|
1654
|
+ if item.IsSource == 1 {
|
|
1655
|
+ waresingList, _ := service.GetAllDrugWaresingList(item.ProjectId, orgId)
|
|
1656
|
+ medical, _ := service.GetBaseDrugMedical(item.ProjectId)
|
|
1657
|
+ item.DrugWarehouseInfo = waresingList
|
|
1658
|
+ item.SpBaseDrug = medical
|
|
1659
|
+ }
|
|
1660
|
+ if item.IsSource == 2 {
|
|
1661
|
+ waresingList, _ := service.GetAllGoodWaresingList(item.ProjectId, orgId)
|
|
1662
|
+
|
|
1663
|
+ item.GoodWarehouseInfo = waresingList
|
|
1664
|
+ }
|
|
1665
|
+ }
|
1636
|
1666
|
drugList, _ := service.GetSupplyDrugList(orgId)
|
1637
|
1667
|
goodList, _ := service.GetSupplyGoodList(orgId)
|
|
1668
|
+ supplyList, _ := service.GetSupplierList(orgId)
|
1638
|
1669
|
if err == nil {
|
1639
|
1670
|
this.ServeSuccessJSON(map[string]interface{}{
|
1640
|
|
- "out": out,
|
1641
|
|
- "list": list,
|
1642
|
|
- "goodList": goodList,
|
1643
|
|
- "drugList": drugList,
|
|
1671
|
+ "out": out,
|
|
1672
|
+ "list": list,
|
|
1673
|
+ "goodList": goodList,
|
|
1674
|
+ "drugList": drugList,
|
|
1675
|
+ "supplyList": supplyList,
|
1644
|
1676
|
})
|
1645
|
1677
|
} else {
|
1646
|
1678
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
@@ -1650,14 +1682,29 @@ func (this *SupplyOrderApiController) GetGoodOrderDetail() {
|
1650
|
1682
|
idArray := strings.Split(ids, ",")
|
1651
|
1683
|
out, err := service.GetGoodOrderDetail(id, orgId)
|
1652
|
1684
|
list, _ := service.GetSupplyWarehouseOutByIdOne(id, orgId, idArray)
|
|
1685
|
+ for _, item := range list {
|
|
1686
|
+ if item.IsSource == 1 {
|
|
1687
|
+ waresingList, _ := service.GetAllDrugWaresingList(item.ProjectId, orgId)
|
|
1688
|
+ medical, _ := service.GetBaseDrugMedical(item.ProjectId)
|
|
1689
|
+ item.DrugWarehouseInfo = waresingList
|
|
1690
|
+ item.SpBaseDrug = medical
|
|
1691
|
+ }
|
|
1692
|
+ if item.IsSource == 2 {
|
|
1693
|
+ waresingList, _ := service.GetAllGoodWaresingList(item.ProjectId, orgId)
|
|
1694
|
+
|
|
1695
|
+ item.GoodWarehouseInfo = waresingList
|
|
1696
|
+ }
|
|
1697
|
+ }
|
1653
|
1698
|
drugList, _ := service.GetSupplyDrugList(orgId)
|
1654
|
1699
|
goodList, _ := service.GetSupplyGoodList(orgId)
|
|
1700
|
+ supplyList, _ := service.GetSupplierList(orgId)
|
1655
|
1701
|
if err == nil {
|
1656
|
1702
|
this.ServeSuccessJSON(map[string]interface{}{
|
1657
|
|
- "out": out,
|
1658
|
|
- "list": list,
|
1659
|
|
- "goodList": goodList,
|
1660
|
|
- "drugList": drugList,
|
|
1703
|
+ "out": out,
|
|
1704
|
+ "list": list,
|
|
1705
|
+ "goodList": goodList,
|
|
1706
|
+ "drugList": drugList,
|
|
1707
|
+ "supplyList": supplyList,
|
1661
|
1708
|
})
|
1662
|
1709
|
} else {
|
1663
|
1710
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
@@ -1954,6 +2001,7 @@ func (this *SupplyOrderApiController) UpdateGoodOrder() {
|
1954
|
2001
|
GoodNumber: good_number,
|
1955
|
2002
|
SupplyManufacturer: supply_manufacturer,
|
1956
|
2003
|
MinPrice: min_price_float,
|
|
2004
|
+ IsWarehosue: 2,
|
1957
|
2005
|
}
|
1958
|
2006
|
warehousingOut = append(warehousingOut, &order)
|
1959
|
2007
|
}
|
|
@@ -1981,22 +2029,29 @@ func (this *SupplyOrderApiController) UpdateGoodOrder() {
|
1981
|
2029
|
}
|
1982
|
2030
|
err = service.CreateSupplyWarehousOutOrder(item)
|
1983
|
2031
|
}
|
|
2032
|
+
|
1984
|
2033
|
for _, item := range updateWarehout {
|
1985
|
|
- //查询该商品是否来源于采购订单,如果存在则关联, 如果不存在则取消关联
|
1986
|
|
- _, errcode := service.GetGoodIsSource(item.WarehousingId, item.ProjectId, orgId)
|
1987
|
|
- if errcode == gorm.ErrRecordNotFound {
|
1988
|
|
- item.WarehousingId = 0
|
1989
|
|
- item.WarehouseInfoId = 0
|
1990
|
|
- item.Type = 2
|
1991
|
|
- item.OrderNumber = ""
|
1992
|
|
- service.UpdateGoodWarehouseOutOrder(item)
|
1993
|
|
- //更新采购单
|
1994
|
|
- service.ModfySupplyWarehouseOut(item.WarehousingId, orgId)
|
1995
|
|
- }
|
1996
|
|
- }
|
|
2034
|
+ service.UpdateGoodWarehouseOutOrder(item)
|
|
2035
|
+ }
|
|
2036
|
+ //for _, item := range updateWarehout {
|
|
2037
|
+ // service.UpdateGoodWarehouseOutOrder(item)
|
|
2038
|
+ // //查询该商品是否来源于采购订单,如果存在则关联, 如果不存在则取消关联
|
|
2039
|
+ // _, errcode := service.GetGoodIsSource(item.WarehousingId, item.ProjectId, orgId)
|
|
2040
|
+ // if errcode == gorm.ErrRecordNotFound {
|
|
2041
|
+ // item.WarehousingId = 0
|
|
2042
|
+ // item.WarehouseInfoId = 0
|
|
2043
|
+ // item.Type = 2
|
|
2044
|
+ // item.OrderNumber = ""
|
|
2045
|
+ //
|
|
2046
|
+ // //更新采购单
|
|
2047
|
+ // service.ModfySupplyWarehouseOut(item.WarehousingId, orgId)
|
|
2048
|
+ // }
|
|
2049
|
+ //}
|
|
2050
|
+ list, _ := service.GetSupplyWarehouseOutById(warehose_out_id, orgId)
|
1997
|
2051
|
if err == nil {
|
1998
|
2052
|
this.ServeSuccessJSON(map[string]interface{}{
|
1999
|
|
- "out": out,
|
|
2053
|
+ "out": out,
|
|
2054
|
+ "list": list,
|
2000
|
2055
|
})
|
2001
|
2056
|
} else {
|
2002
|
2057
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
@@ -2026,8 +2081,10 @@ func (this *SupplyOrderApiController) GetAllOrderCountList() {
|
2026
|
2081
|
//获取购货订单的数据
|
2027
|
2082
|
purcaseOrder, _ := service.GetAllPurcaseOrderById(id, orgId)
|
2028
|
2083
|
//获取购货单的数据
|
2029
|
|
- goodOrder, err := service.GetAllGoodOrderById(id, orgId)
|
|
2084
|
+ goodOrder, err := service.GetAllGoodOrderByIdSix(id, orgId)
|
|
2085
|
+ fmt.Println("2323232332232323232332", goodOrder)
|
2030
|
2086
|
drugList, err := service.GetSupplyDrugList(orgId)
|
|
2087
|
+
|
2031
|
2088
|
if err == nil {
|
2032
|
2089
|
this.ServeSuccessJSON(map[string]interface{}{
|
2033
|
2090
|
"purcaseOrder": purcaseOrder,
|
|
@@ -2136,7 +2193,7 @@ func (this *SupplyOrderApiController) GetGoodOrderCountList() {
|
2136
|
2193
|
//获取购货订单的数据
|
2137
|
2194
|
purcaseOrder, _ := service.GetAllPurcaseOrderById(warehousing_id, orgId)
|
2138
|
2195
|
//获取购货单的数据
|
2139
|
|
- goodOrder, _ := service.GetAllGoodOrderByIdTwo(warehousing_id, orgId)
|
|
2196
|
+ goodOrder, _ := service.GetAllGoodOrderByIdTwo(id, orgId)
|
2140
|
2197
|
|
2141
|
2198
|
//查询该购货单是否审核成功
|
2142
|
2199
|
detail, _ := service.GetGoodOrderDetail(id, orgId)
|
|
@@ -2340,6 +2397,9 @@ func (this *SupplyOrderApiController) GetGoodOrderCountList() {
|
2340
|
2397
|
}
|
2341
|
2398
|
//创建入库单
|
2342
|
2399
|
errs := service.CreateDrugWarehousingInfoSix(warehouseInfoDetail)
|
|
2400
|
+
|
|
2401
|
+ //改变入库状态
|
|
2402
|
+
|
2343
|
2403
|
fmt.Println(errs)
|
2344
|
2404
|
for _, items := range drugFlow {
|
2345
|
2405
|
drugWarehouseInfo, _ := service.GetLastDrugWarehouseInfo(items.DrugId)
|
|
@@ -2349,6 +2409,10 @@ func (this *SupplyOrderApiController) GetGoodOrderCountList() {
|
2349
|
2409
|
service.CreateDrugFlowSix(drugFlow)
|
2350
|
2410
|
|
2351
|
2411
|
drugList, _ := service.GetSupplyDrugList(orgId)
|
|
2412
|
+
|
|
2413
|
+ for _, items := range goodOrder {
|
|
2414
|
+ service.UpdateWarehouseingById(items.ID)
|
|
2415
|
+ }
|
2352
|
2416
|
if err == nil {
|
2353
|
2417
|
this.ServeSuccessJSON(map[string]interface{}{
|
2354
|
2418
|
"purcaseOrder": purcaseOrder,
|
|
@@ -2456,12 +2520,12 @@ func (this *SupplyOrderApiController) SaveGoodReturnOrder() {
|
2456
|
2520
|
}
|
2457
|
2521
|
supply_count := int64(items["supply_count"].(float64))
|
2458
|
2522
|
|
2459
|
|
- if items["count"] == nil || reflect.TypeOf(items["count"]).String() != "float64" {
|
|
2523
|
+ if items["count"] == nil || reflect.TypeOf(items["count"]).String() != "string" {
|
2460
|
2524
|
utils.ErrorLog("count")
|
2461
|
2525
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
2462
|
2526
|
return
|
2463
|
2527
|
}
|
2464
|
|
- count := int64(items["count"].(float64))
|
|
2528
|
+ count := items["count"].(string)
|
2465
|
2529
|
|
2466
|
2530
|
if items["manufacturer_id"] == nil || reflect.TypeOf(items["manufacturer_id"]).String() != "float64" {
|
2467
|
2531
|
utils.ErrorLog("manufacturer_id")
|
|
@@ -2604,13 +2668,17 @@ func (this *SupplyOrderApiController) SaveGoodReturnOrder() {
|
2604
|
2668
|
return
|
2605
|
2669
|
}
|
2606
|
2670
|
id := int64(items["id"].(float64))
|
|
2671
|
+
|
|
2672
|
+ deposit_rate := items["deposit_rate"].(string)
|
|
2673
|
+
|
|
2674
|
+ deposit_rate_float, _ := strconv.ParseFloat(deposit_rate, 64)
|
2607
|
2675
|
cancelOrder := &models.SpSupplierWarehousingCancelOrder{
|
2608
|
2676
|
ManufacturerId: manufacturer_id,
|
2609
|
2677
|
OrderNumber: order_number,
|
2610
|
2678
|
ProjectId: project_id,
|
2611
|
2679
|
GoodNumber: good_number,
|
2612
|
2680
|
IsSource: is_source,
|
2613
|
|
- Count: supply_count,
|
|
2681
|
+ Count: count,
|
2614
|
2682
|
Price: price_float,
|
2615
|
2683
|
Remark: supply_remake,
|
2616
|
2684
|
RateOfConcession: rate_of_concession_float,
|
|
@@ -2637,6 +2705,8 @@ func (this *SupplyOrderApiController) SaveGoodReturnOrder() {
|
2637
|
2705
|
WarehousingId: warehousing_id,
|
2638
|
2706
|
SourceCount: count,
|
2639
|
2707
|
SupplyWarehouseDetailInfo: id,
|
|
2708
|
+ SupplyCount: supply_count,
|
|
2709
|
+ DepositRate: deposit_rate_float,
|
2640
|
2710
|
}
|
2641
|
2711
|
warehouseCancel = append(warehouseCancel, cancelOrder)
|
2642
|
2712
|
}
|
|
@@ -2644,12 +2714,17 @@ func (this *SupplyOrderApiController) SaveGoodReturnOrder() {
|
2644
|
2714
|
}
|
2645
|
2715
|
|
2646
|
2716
|
for _, item := range warehouseCancel {
|
|
2717
|
+ if item.SupplyWarehouseDetailInfo > 0 {
|
|
2718
|
+ item.Type = 1
|
|
2719
|
+ } else {
|
|
2720
|
+ item.Type = 2
|
|
2721
|
+ }
|
2647
|
2722
|
service.CreateCancelReturnOrder(item)
|
2648
|
2723
|
//查询该商品在退库单中是否存在
|
2649
|
2724
|
_, errcodes := service.GetSupplyWarehouseOutIsExsit(item.WarehouseOutId, item.ProjectId, orgId)
|
2650
|
2725
|
//如果不存在则情况退库单的关联信息
|
2651
|
2726
|
if errcodes == gorm.ErrRecordNotFound {
|
2652
|
|
- service.ModfySupplyCancel(item.WarehouseCancelId, orgId)
|
|
2727
|
+ service.ModfySupplyCancel(item.WarehouseCancelId, orgId, item.ProjectId)
|
2653
|
2728
|
|
2654
|
2729
|
}
|
2655
|
2730
|
|
|
@@ -2720,12 +2795,14 @@ func (this *SupplyOrderApiController) GetGoodReturnDetail() {
|
2720
|
2795
|
baseList, _ := service.GetSupplyDrugList(orgId)
|
2721
|
2796
|
|
2722
|
2797
|
goodList, _ := service.GetSupplyGoodList(orgId)
|
|
2798
|
+ supplyList, _ := service.GetSupplierList(orgId)
|
2723
|
2799
|
if err == nil {
|
2724
|
2800
|
this.ServeSuccessJSON(map[string]interface{}{
|
2725
|
2801
|
"cancelDetail": detail,
|
2726
|
2802
|
"orderCancelDetail": orderDetail,
|
2727
|
2803
|
"drugList": baseList,
|
2728
|
2804
|
"goodList": goodList,
|
|
2805
|
+ "supplyList": supplyList,
|
2729
|
2806
|
})
|
2730
|
2807
|
} else {
|
2731
|
2808
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
@@ -2903,6 +2980,20 @@ func (this *SupplyOrderApiController) UpdateGoodReturn() {
|
2903
|
2980
|
}
|
2904
|
2981
|
supply_manufacturer := items["supply_manufacturer"].(string)
|
2905
|
2982
|
|
|
2983
|
+ if items["count"] == nil || reflect.TypeOf(items["count"]).String() != "string" {
|
|
2984
|
+ utils.ErrorLog("count")
|
|
2985
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
2986
|
+ return
|
|
2987
|
+ }
|
|
2988
|
+ count := items["count"].(string)
|
|
2989
|
+
|
|
2990
|
+ if items["deposit_rate"] == nil || reflect.TypeOf(items["deposit_rate"]).String() != "string" {
|
|
2991
|
+ utils.ErrorLog("deposit_rate")
|
|
2992
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
2993
|
+ return
|
|
2994
|
+ }
|
|
2995
|
+ deposit_rate := items["deposit_rate"].(string)
|
|
2996
|
+ deposit_rate_float, _ := strconv.ParseFloat(deposit_rate, 64)
|
2906
|
2997
|
if id > 0 {
|
2907
|
2998
|
cancelOrder := &models.SpSupplierWarehousingCancelOrder{
|
2908
|
2999
|
ID: id,
|
|
@@ -2911,7 +3002,7 @@ func (this *SupplyOrderApiController) UpdateGoodReturn() {
|
2911
|
3002
|
ProjectId: project_id,
|
2912
|
3003
|
GoodNumber: good_number,
|
2913
|
3004
|
IsSource: is_source,
|
2914
|
|
- Count: supply_count,
|
|
3005
|
+ Count: count,
|
2915
|
3006
|
Price: price_float,
|
2916
|
3007
|
Remark: supply_remake,
|
2917
|
3008
|
RateOfConcession: rate_of_concession_float,
|
|
@@ -2931,6 +3022,8 @@ func (this *SupplyOrderApiController) UpdateGoodReturn() {
|
2931
|
3022
|
Name: name,
|
2932
|
3023
|
SupplyUnit: supply_unit,
|
2933
|
3024
|
SupplyLicenseNumber: supply_license_number,
|
|
3025
|
+ SupplyCount: supply_count,
|
|
3026
|
+ DepositRate: deposit_rate_float,
|
2934
|
3027
|
}
|
2935
|
3028
|
updateWarehouseCancel = append(updateWarehouseCancel, cancelOrder)
|
2936
|
3029
|
}
|
|
@@ -2942,7 +3035,7 @@ func (this *SupplyOrderApiController) UpdateGoodReturn() {
|
2942
|
3035
|
ProjectId: project_id,
|
2943
|
3036
|
GoodNumber: good_number,
|
2944
|
3037
|
IsSource: is_source,
|
2945
|
|
- Count: supply_count,
|
|
3038
|
+ Count: count,
|
2946
|
3039
|
Price: price_float,
|
2947
|
3040
|
Remark: supply_remake,
|
2948
|
3041
|
RateOfConcession: rate_of_concession_float,
|
|
@@ -2952,7 +3045,7 @@ func (this *SupplyOrderApiController) UpdateGoodReturn() {
|
2952
|
3045
|
Status: 1,
|
2953
|
3046
|
Mtime: 0,
|
2954
|
3047
|
WarehouseCancelId: warehouse_out_id,
|
2955
|
|
- Type: 1,
|
|
3048
|
+ Type: 2,
|
2956
|
3049
|
ReturnNumber: return_number,
|
2957
|
3050
|
WarehouseOutId: warehouse_out_id,
|
2958
|
3051
|
SupplySpecificationName: supply_specification_name,
|
|
@@ -2962,6 +3055,8 @@ func (this *SupplyOrderApiController) UpdateGoodReturn() {
|
2962
|
3055
|
Name: name,
|
2963
|
3056
|
SupplyUnit: supply_unit,
|
2964
|
3057
|
SupplyLicenseNumber: supply_license_number,
|
|
3058
|
+ SupplyCount: supply_count,
|
|
3059
|
+ DepositRate: deposit_rate_float,
|
2965
|
3060
|
}
|
2966
|
3061
|
warehouseCancel = append(warehouseCancel, cancelOrder)
|
2967
|
3062
|
}
|
|
@@ -2970,11 +3065,13 @@ func (this *SupplyOrderApiController) UpdateGoodReturn() {
|
2970
|
3065
|
|
2971
|
3066
|
if len(updateWarehouseCancel) > 0 {
|
2972
|
3067
|
for _, item := range updateWarehouseCancel {
|
|
3068
|
+
|
2973
|
3069
|
service.UpdateWarehouseCancelOrder(item)
|
2974
|
3070
|
}
|
2975
|
3071
|
}
|
2976
|
3072
|
if len(warehouseCancel) > 0 {
|
2977
|
3073
|
for _, item := range warehouseCancel {
|
|
3074
|
+
|
2978
|
3075
|
service.CreateCancelReturnOrder(item)
|
2979
|
3076
|
}
|
2980
|
3077
|
}
|
|
@@ -2992,13 +3089,50 @@ func (this *SupplyOrderApiController) UpdateGoodReturn() {
|
2992
|
3089
|
func (this *SupplyOrderApiController) ModefyGoodOrder() {
|
2993
|
3090
|
|
2994
|
3091
|
id, _ := this.GetInt64("id")
|
|
3092
|
+ warehousing_id, _ := this.GetInt64("warehousing_id")
|
2995
|
3093
|
orgId := this.GetAdminUserInfo().CurrentOrgId
|
2996
|
3094
|
|
2997
|
|
- //获取购货订单的数据
|
2998
|
|
- purcaseOrder, _ := service.GetAllPurcaseOrderById(id, orgId)
|
2999
|
3095
|
//获取购货单的数据
|
3000
|
3096
|
goodOrder, _ := service.GetAllGoodOrderById(id, orgId)
|
|
3097
|
+
|
|
3098
|
+ //判断该订单是否有出库记录
|
|
3099
|
+ for _, it := range goodOrder {
|
|
3100
|
+
|
|
3101
|
+ if it.IsSource == 1 {
|
|
3102
|
+ out, _ := service.GetDrugWarehosueInfoByWarehousingId(it.ProjectId, id, orgId)
|
|
3103
|
+
|
|
3104
|
+ if out.ID > 0 {
|
|
3105
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
3106
|
+ "cancelList": "",
|
|
3107
|
+ "purcaseOrder": "",
|
|
3108
|
+ "goodOrder": "",
|
|
3109
|
+ "drugList": "",
|
|
3110
|
+ "msg": 3,
|
|
3111
|
+ })
|
|
3112
|
+ return
|
|
3113
|
+ }
|
|
3114
|
+ }
|
|
3115
|
+ if it.IsSource == 2 {
|
|
3116
|
+ fmt.Println("hh23323233232232332232323232332", it.WarehouseOutId)
|
|
3117
|
+ out, _ := service.GetGoodWarehouseInfoByWarehousingId(it.ProjectId, id, orgId)
|
|
3118
|
+ if out.ID > 0 {
|
|
3119
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
3120
|
+ "cancelList": "",
|
|
3121
|
+ "purcaseOrder": "",
|
|
3122
|
+ "goodOrder": "",
|
|
3123
|
+ "drugList": "",
|
|
3124
|
+ "msg": 3,
|
|
3125
|
+ })
|
|
3126
|
+ return
|
|
3127
|
+ }
|
|
3128
|
+ }
|
|
3129
|
+ }
|
|
3130
|
+
|
|
3131
|
+ //获取购货订单的数据
|
|
3132
|
+ purcaseOrder, _ := service.GetAllPurcaseOrderById(warehousing_id, orgId)
|
|
3133
|
+
|
3001
|
3134
|
drugList, _ := service.GetSupplyDrugList(orgId)
|
|
3135
|
+
|
3002
|
3136
|
//获取已有关联的退货单
|
3003
|
3137
|
cancelList, _ := service.GetSupplyCancelWarehouse(id, orgId)
|
3004
|
3138
|
//查询是否存在退货单
|
|
@@ -3013,6 +3147,11 @@ func (this *SupplyOrderApiController) ModefyGoodOrder() {
|
3013
|
3147
|
}
|
3014
|
3148
|
err := service.UpdateSupplyGoodOrder(id, out)
|
3015
|
3149
|
|
|
3150
|
+ for _, its := range goodOrder {
|
|
3151
|
+ //改变采购单状态
|
|
3152
|
+ service.UpdateSupplyOrderListById(its.ID)
|
|
3153
|
+ }
|
|
3154
|
+
|
3016
|
3155
|
//查询该订单不是采购入库的数据
|
3017
|
3156
|
list, _ := service.GetDrugSupplyWarehousingById(id, orgId)
|
3018
|
3157
|
if len(list) == 0 {
|
|
@@ -3151,30 +3290,37 @@ func (this *SupplyOrderApiController) CheckReturnOrder() {
|
3151
|
3290
|
//获取退库单详情
|
3152
|
3291
|
list, _ := service.GetSupplyCancelOrderDetail(id, orgId)
|
3153
|
3292
|
for _, item := range list {
|
3154
|
|
-
|
|
3293
|
+ fmt.Println("itme.233232323232323232323232323232232332", item.Type)
|
3155
|
3294
|
var total_count int64
|
3156
|
3295
|
var prescribing_number_total int64
|
3157
|
3296
|
//药品
|
3158
|
3297
|
if item.IsSource == 1 {
|
3159
|
3298
|
|
3160
|
3299
|
//获取药品库存
|
3161
|
|
- info, _ := service.GetDrugTotalCountTwenTy(item.ProjectId, item.SupplyWarehouseDetailInfo)
|
|
3300
|
+ info, _ := service.GetDrugTotalCountTwenTy(item.ProjectId, item.SupplyWarehouseDetailInfo, item.Type)
|
3162
|
3301
|
|
3163
|
3302
|
for _, it := range info {
|
3164
|
|
- total_count += it.StockMaxNumber*it.MinNumber + it.StockMinNumber
|
|
3303
|
+
|
|
3304
|
+ if it.MaxUnit == it.CountUnit {
|
|
3305
|
+ it.StockMaxNumber = it.StockMaxNumber * it.MinNumber
|
|
3306
|
+
|
|
3307
|
+ }
|
|
3308
|
+ total_count += (it.StockMaxNumber + it.StockMinNumber)
|
3165
|
3309
|
}
|
|
3310
|
+
|
3166
|
3311
|
//查询改药品信息
|
3167
|
3312
|
medical, _ := service.GetBaseDrugMedical(item.ProjectId)
|
3168
|
3313
|
|
3169
|
3314
|
//判断单位是否相等
|
3170
|
3315
|
if medical.MaxUnit == item.SupplyUnit {
|
3171
|
3316
|
//转化为最小单位
|
3172
|
|
- prescribing_number_total = item.Count * medical.MinNumber
|
|
3317
|
+ prescribing_number_total = item.SupplyCount * medical.MinNumber
|
3173
|
3318
|
}
|
3174
|
3319
|
if medical.MinUnit == item.SupplyUnit {
|
3175
|
|
- prescribing_number_total = item.Count
|
|
3320
|
+ prescribing_number_total = item.SupplyCount
|
3176
|
3321
|
}
|
3177
|
3322
|
|
|
3323
|
+ fmt.Println("hhhhhadf dafsdfsdfddddfdf", prescribing_number_total)
|
3178
|
3324
|
//判断单位
|
3179
|
3325
|
if total_count == 0 {
|
3180
|
3326
|
goodObj, _ := service.GetDrugByGoodId(item.ProjectId)
|
|
@@ -3215,7 +3361,7 @@ func (this *SupplyOrderApiController) CheckReturnOrder() {
|
3215
|
3361
|
number, _ := strconv.ParseInt(warehousing_out_order, 10, 64)
|
3216
|
3362
|
number = number + total
|
3217
|
3363
|
warehousing_out_order = "YPCKD" + strconv.FormatInt(number, 10)
|
3218
|
|
- operation_time := time.Now().Unix()
|
|
3364
|
+ //operation_time := time.Now().Unix()
|
3219
|
3365
|
creater := this.GetAdminUserInfo().AdminUser.Id
|
3220
|
3366
|
recordDateStr := time.Now().Format("2006-01-02")
|
3221
|
3367
|
recordDate, _ := utils.ParseTimeStringToTime("2006-01-02", recordDateStr)
|
|
@@ -3223,7 +3369,7 @@ func (this *SupplyOrderApiController) CheckReturnOrder() {
|
3223
|
3369
|
record_date := recordDate.Unix()
|
3224
|
3370
|
warehouseOut := models.DrugWarehouseOut{
|
3225
|
3371
|
WarehouseOutOrderNumber: warehousing_out_order,
|
3226
|
|
- OperationTime: operation_time,
|
|
3372
|
+ OperationTime: record_date,
|
3227
|
3373
|
OrgId: orgId,
|
3228
|
3374
|
Creater: creater,
|
3229
|
3375
|
Ctime: ctime,
|
|
@@ -3247,7 +3393,7 @@ func (this *SupplyOrderApiController) CheckReturnOrder() {
|
3247
|
3393
|
WarehouseOutOrderNumber: lastDrug.WarehouseOutOrderNumber,
|
3248
|
3394
|
WarehouseOutId: lastDrug.ID,
|
3249
|
3395
|
DrugId: item.ProjectId,
|
3250
|
|
- Count: item.Count,
|
|
3396
|
+ Count: item.SupplyCount,
|
3251
|
3397
|
Price: item.Price,
|
3252
|
3398
|
Status: 1,
|
3253
|
3399
|
Ctime: ctime,
|
|
@@ -3265,28 +3411,30 @@ func (this *SupplyOrderApiController) CheckReturnOrder() {
|
3265
|
3411
|
WarehouseInfoId: 0,
|
3266
|
3412
|
SupplyCancelOutId: id,
|
3267
|
3413
|
SupplyWarehouseId: warehouse_out_id,
|
|
3414
|
+ SysRecordTime: record_date,
|
|
3415
|
+ IsSource: item.Type,
|
3268
|
3416
|
}
|
3269
|
3417
|
|
3270
|
3418
|
drup, _ := service.FindBaseDrugLibRecord(orgId, item.ProjectId)
|
3271
|
3419
|
if drup.ID > 0 {
|
3272
|
|
- prescribingNumber := item.Count
|
3273
|
|
- service.AutoDrugDeliverInfoNight(orgId, prescribingNumber, &warehouseOut, &drup, warehouseOutInfo)
|
|
3420
|
+ prescribingNumber := item.SupplyCount
|
|
3421
|
+ service.AutoDrugDeliverInfoNight(orgId, prescribingNumber, &warehouseOut, &drup, warehouseOutInfo, warehouse_out_id, id)
|
3274
|
3422
|
}
|
3275
|
3423
|
|
3276
|
3424
|
//修改原数据
|
3277
|
|
- orderInfo := models.SpSupplierWarehousingCancelOrder{
|
3278
|
|
- SourceCount: item.Count - item.SourceCount,
|
3279
|
|
- }
|
3280
|
|
- service.UpdateSupplyCancelById(item.ID, orderInfo)
|
|
3425
|
+ /* orderInfo := models.SpSupplierWarehousingCancelOrder{
|
|
3426
|
+ SourceCount: item.SupplyCount - item.SourceCount,
|
|
3427
|
+ }
|
|
3428
|
+ service.UpdateSupplyCancelById(item.ID, orderInfo)*/
|
3281
|
3429
|
}
|
3282
|
3430
|
|
3283
|
3431
|
//耗材
|
3284
|
3432
|
if item.IsSource == 2 {
|
3285
|
3433
|
// 查询该耗材是否有库存
|
3286
|
|
- warehouseOne, _ := service.FindWarehousingInfoTwenTy(item.ProjectId, item.SupplyWarehouseDetailInfo)
|
|
3434
|
+ warehouseOne, _ := service.FindWarehousingInfoTwenTy(item.ProjectId, item.SupplyWarehouseDetailInfo, item.Type)
|
3287
|
3435
|
|
3288
|
3436
|
// 如果出库数量大于该批次剩余库存数量
|
3289
|
|
- if item.Count > warehouseOne.StockCount {
|
|
3437
|
+ if item.SupplyCount > warehouseOne.StockCount {
|
3290
|
3438
|
|
3291
|
3439
|
goodObj, _ := service.GetGoodInformationByGoodId(item.ProjectId)
|
3292
|
3440
|
this.ServeSuccessJSON(map[string]interface{}{
|
|
@@ -3308,7 +3456,7 @@ func (this *SupplyOrderApiController) CheckReturnOrder() {
|
3308
|
3456
|
number, _ := strconv.ParseInt(warehousing_out_order, 10, 64)
|
3309
|
3457
|
number = number + total
|
3310
|
3458
|
warehousing_out_order = "CKD" + strconv.FormatInt(number, 10)
|
3311
|
|
- operation_time := time.Now().Unix()
|
|
3459
|
+ //operation_time := time.Now().Unix()
|
3312
|
3460
|
creater := this.GetAdminUserInfo().AdminUser.Id
|
3313
|
3461
|
recordDateStr := time.Now().Format("2006-01-02")
|
3314
|
3462
|
recordDate, _ := utils.ParseTimeStringToTime("2006-01-02", recordDateStr)
|
|
@@ -3316,7 +3464,7 @@ func (this *SupplyOrderApiController) CheckReturnOrder() {
|
3316
|
3464
|
record_date := recordDate.Unix()
|
3317
|
3465
|
warehouseOut := models.WarehouseOut{
|
3318
|
3466
|
WarehouseOutOrderNumber: warehousing_out_order,
|
3319
|
|
- OperationTime: operation_time,
|
|
3467
|
+ OperationTime: record_date,
|
3320
|
3468
|
OrgId: orgId,
|
3321
|
3469
|
Creater: creater,
|
3322
|
3470
|
Ctime: ctime,
|
|
@@ -3328,11 +3476,12 @@ func (this *SupplyOrderApiController) CheckReturnOrder() {
|
3328
|
3476
|
IsSys: 0,
|
3329
|
3477
|
}
|
3330
|
3478
|
//查询是否生成出库单
|
3331
|
|
- _, errcodes := service.FindStockOutByIsSys(orgId, 0, operation_time)
|
|
3479
|
+ _, errcodes := service.FindStockOutByIsSys(orgId, 0, record_date)
|
3332
|
3480
|
if errcodes == gorm.ErrRecordNotFound {
|
3333
|
3481
|
service.AddSigleWarehouseOut(&warehouseOut)
|
3334
|
3482
|
}
|
3335
|
3483
|
outWarehouse, _ := service.GetlastWarehouseOutById(orgId, record_date)
|
|
3484
|
+ fmt.Println("232332322332232323", outWarehouse)
|
3336
|
3485
|
goodObj, _ := service.GetGoodInformationByGoodId(item.ProjectId)
|
3337
|
3486
|
info := &models.WarehouseOutInfo{
|
3338
|
3487
|
WarehouseOutOrderNumber: outWarehouse.WarehouseOutOrderNumber,
|
|
@@ -3340,7 +3489,7 @@ func (this *SupplyOrderApiController) CheckReturnOrder() {
|
3340
|
3489
|
WarehouseInfotId: 0,
|
3341
|
3490
|
GoodId: item.ProjectId,
|
3342
|
3491
|
GoodTypeId: goodObj.GoodTypeId,
|
3343
|
|
- Count: item.Count,
|
|
3492
|
+ Count: item.SupplyCount,
|
3344
|
3493
|
Price: item.Price,
|
3345
|
3494
|
TotalPrice: 0,
|
3346
|
3495
|
ProductDate: item.SupplyProductDate,
|
|
@@ -3356,20 +3505,16 @@ func (this *SupplyOrderApiController) CheckReturnOrder() {
|
3356
|
3505
|
SupplyCancelOutId: id,
|
3357
|
3506
|
OrgId: orgId,
|
3358
|
3507
|
SupplyWarehouseId: warehouse_out_id,
|
|
3508
|
+ IsSource: item.Type,
|
3359
|
3509
|
}
|
3360
|
3510
|
//出库逻辑
|
3361
|
|
- parseDateErr := service.ConsumablesDeliveryNight(orgId, record_date, info, &warehouseOut, item.Count, creater, warehouse_out_id, id)
|
|
3511
|
+ parseDateErr := service.ConsumablesDeliveryNight(orgId, record_date, info, &warehouseOut, item.SupplyCount, creater, warehouse_out_id, id)
|
3362
|
3512
|
|
3363
|
3513
|
if parseDateErr != nil {
|
3364
|
3514
|
utils.ErrorLog(parseDateErr.Error())
|
3365
|
3515
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateStockInFail)
|
3366
|
3516
|
return
|
3367
|
3517
|
}
|
3368
|
|
- //更改原退库数据
|
3369
|
|
- order := models.SpSupplierWarehousingCancelOrder{
|
3370
|
|
- SourceCount: item.SourceCount - item.Count,
|
3371
|
|
- }
|
3372
|
|
- service.UpdateSupplyCancelById(item.ID, order)
|
3373
|
3518
|
}
|
3374
|
3519
|
}
|
3375
|
3520
|
cancel := models.SpSupplierWarehouseCancel{
|
|
@@ -3378,7 +3523,7 @@ func (this *SupplyOrderApiController) CheckReturnOrder() {
|
3378
|
3523
|
CheckTime: record_date,
|
3379
|
3524
|
}
|
3380
|
3525
|
err := service.CheckReturnOrder(id, orgId, cancel)
|
3381
|
|
-
|
|
3526
|
+ fmt.Println("3232233232322332232323232323322332232323232323")
|
3382
|
3527
|
if err == nil {
|
3383
|
3528
|
this.ServeSuccessJSON(map[string]interface{}{
|
3384
|
3529
|
"msg": "1",
|
|
@@ -3452,6 +3597,9 @@ func (this *SupplyOrderApiController) DeleteReturnOrderById() {
|
3452
|
3597
|
func (this *SupplyOrderApiController) ModefyReturnOrder() {
|
3453
|
3598
|
id, _ := this.GetInt64("id")
|
3454
|
3599
|
err := service.ModefyReturnOrder(id)
|
|
3600
|
+
|
|
3601
|
+ //获取退库单据日期
|
|
3602
|
+ cancel, _ := service.GetReturnOrderById(id)
|
3455
|
3603
|
orgId := this.GetAdminUserInfo().CurrentOrgId
|
3456
|
3604
|
if err == nil {
|
3457
|
3605
|
//获取退库单详情
|
|
@@ -3465,31 +3613,50 @@ func (this *SupplyOrderApiController) ModefyReturnOrder() {
|
3465
|
3613
|
if item.SupplyUnit == base.MaxUnit {
|
3466
|
3614
|
//退库
|
3467
|
3615
|
drugInfo := models.DrugWarehouseInfo{
|
3468
|
|
- StockMaxNumber: item.Count,
|
|
3616
|
+ StockMaxNumber: item.SupplyCount,
|
3469
|
3617
|
}
|
3470
|
3618
|
service.UpdateDrugWasehousring(item.ProjectId, item.SupplyWarehouseDetailInfo, drugInfo)
|
3471
|
3619
|
}
|
3472
|
|
- if item.SupplyType == base.MinUnit {
|
|
3620
|
+
|
|
3621
|
+ if item.SupplyType == base.MinUnit && base.MaxUnit != base.MinUnit {
|
3473
|
3622
|
drugInfo := models.DrugWarehouseInfo{
|
3474
|
|
- StockMinNumber: item.Count,
|
|
3623
|
+ StockMinNumber: item.SupplyCount,
|
3475
|
3624
|
}
|
3476
|
3625
|
service.UpdateDrugWasehousringOne(item.ProjectId, item.SupplyWarehouseDetailInfo, drugInfo)
|
3477
|
3626
|
}
|
|
3627
|
+
|
3478
|
3628
|
//删除流水
|
3479
|
3629
|
service.DeleteDrugWarehouseOutNight(item.ProjectId, item.WarehouseCancelId)
|
|
3630
|
+ //查询出库订单
|
|
3631
|
+ drugOut, _ := service.GetDrugWarehouseByDate(cancel.RecordDate, orgId)
|
|
3632
|
+
|
|
3633
|
+ drugOutList, _ := service.GetDrugWarehouseByIdList(drugOut.ID, orgId)
|
|
3634
|
+ if len(drugOutList) == 0 {
|
|
3635
|
+ service.UpdateDrugWarehouseById(drugOut.ID)
|
|
3636
|
+ }
|
3480
|
3637
|
}
|
3481
|
3638
|
//耗材
|
3482
|
3639
|
if item.IsSource == 2 {
|
3483
|
|
-
|
|
3640
|
+ fmt.Println("item2332322323232332", item.SupplyCount)
|
3484
|
3641
|
//退库
|
3485
|
3642
|
info := models.WarehousingInfo{
|
3486
|
|
- StockCount: item.Count,
|
|
3643
|
+ StockCount: item.SupplyCount,
|
3487
|
3644
|
}
|
|
3645
|
+
|
3488
|
3646
|
//更改库存
|
3489
|
3647
|
err := service.UpdateWarehousingInfoById(item.ProjectId, item.SupplyWarehouseDetailInfo, info)
|
3490
|
|
- //删除出库记录
|
3491
|
|
- service.DeleteGoodWarehouseOut(item.ProjectId, item.WarehouseCancelId)
|
3492
|
3648
|
fmt.Println(err)
|
|
3649
|
+ //删除出库记录
|
|
3650
|
+ service.DeleteGoodWarehouseOut(item.ProjectId, item.WarehouseCancelId, orgId)
|
|
3651
|
+
|
|
3652
|
+ //查询今日的出库单是
|
|
3653
|
+ out, _ := service.GetWarehouseOutByDate(cancel.RecordDate, orgId)
|
|
3654
|
+ warehouseOutList, _ := service.GetWarehouseOutById(out.ID, orgId)
|
|
3655
|
+ if len(warehouseOutList) == 0 {
|
|
3656
|
+ //删除出库单
|
|
3657
|
+ service.DeleteWarehouseOutById(out.ID)
|
|
3658
|
+ }
|
|
3659
|
+
|
3493
|
3660
|
}
|
3494
|
3661
|
}
|
3495
|
3662
|
} else {
|
|
@@ -3505,3 +3672,74 @@ func (this *SupplyOrderApiController) ModefyReturnOrder() {
|
3505
|
3672
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
3506
|
3673
|
}
|
3507
|
3674
|
}
|
|
3675
|
+
|
|
3676
|
+func (this *SupplyOrderApiController) GetGoodOrderDetailList() {
|
|
3677
|
+ id, _ := this.GetInt64("id")
|
|
3678
|
+ ids := this.GetString("ids")
|
|
3679
|
+ orgId := this.GetAdminUserInfo().CurrentOrgId
|
|
3680
|
+
|
|
3681
|
+ if len(ids) == 0 {
|
|
3682
|
+ out, err := service.GetGoodOrderDetail(id, orgId)
|
|
3683
|
+ list, _ := service.GetSupplyWarehouseOutById(id, orgId)
|
|
3684
|
+ for _, item := range list {
|
|
3685
|
+
|
|
3686
|
+ if item.IsSource == 1 {
|
|
3687
|
+ waresingList, _ := service.GetAllDrugWaresingList(item.ProjectId, orgId)
|
|
3688
|
+ medical, _ := service.GetBaseDrugMedical(item.ProjectId)
|
|
3689
|
+ item.DrugWarehouseInfo = waresingList
|
|
3690
|
+ item.SpBaseDrug = medical
|
|
3691
|
+ }
|
|
3692
|
+ if item.IsSource == 2 {
|
|
3693
|
+ waresingList, _ := service.GetAllGoodWaresingList(item.ProjectId, orgId)
|
|
3694
|
+
|
|
3695
|
+ item.GoodWarehouseInfo = waresingList
|
|
3696
|
+ }
|
|
3697
|
+ }
|
|
3698
|
+ drugList, _ := service.GetSupplyDrugList(orgId)
|
|
3699
|
+ goodList, _ := service.GetSupplyGoodList(orgId)
|
|
3700
|
+ supplyList, _ := service.GetSupplierList(orgId)
|
|
3701
|
+ if err == nil {
|
|
3702
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
3703
|
+ "out": out,
|
|
3704
|
+ "list": list,
|
|
3705
|
+ "goodList": goodList,
|
|
3706
|
+ "drugList": drugList,
|
|
3707
|
+ "supplyList": supplyList,
|
|
3708
|
+ })
|
|
3709
|
+ } else {
|
|
3710
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
3711
|
+ }
|
|
3712
|
+ }
|
|
3713
|
+ if len(ids) > 0 {
|
|
3714
|
+ idArray := strings.Split(ids, ",")
|
|
3715
|
+ out, err := service.GetGoodOrderDetail(id, orgId)
|
|
3716
|
+ list, _ := service.GetSupplyWarehouseOutByIdOne(id, orgId, idArray)
|
|
3717
|
+ for _, item := range list {
|
|
3718
|
+ if item.IsSource == 1 {
|
|
3719
|
+ waresingList, _ := service.GetAllDrugWaresingList(item.ProjectId, orgId)
|
|
3720
|
+ medical, _ := service.GetBaseDrugMedical(item.ProjectId)
|
|
3721
|
+ item.DrugWarehouseInfo = waresingList
|
|
3722
|
+ item.SpBaseDrug = medical
|
|
3723
|
+ }
|
|
3724
|
+ if item.IsSource == 2 {
|
|
3725
|
+ waresingList, _ := service.GetAllGoodWaresingList(item.ProjectId, orgId)
|
|
3726
|
+
|
|
3727
|
+ item.GoodWarehouseInfo = waresingList
|
|
3728
|
+ }
|
|
3729
|
+ }
|
|
3730
|
+ drugList, _ := service.GetSupplyDrugList(orgId)
|
|
3731
|
+ goodList, _ := service.GetSupplyGoodList(orgId)
|
|
3732
|
+ supplyList, _ := service.GetSupplierList(orgId)
|
|
3733
|
+ if err == nil {
|
|
3734
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
3735
|
+ "out": out,
|
|
3736
|
+ "list": list,
|
|
3737
|
+ "goodList": goodList,
|
|
3738
|
+ "drugList": drugList,
|
|
3739
|
+ "supplyList": supplyList,
|
|
3740
|
+ })
|
|
3741
|
+ } else {
|
|
3742
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
3743
|
+ }
|
|
3744
|
+ }
|
|
3745
|
+}
|