|
@@ -1982,6 +1982,7 @@ func (this *SupplyOrderApiController) UpdateGoodOrder() {
|
1982
|
1982
|
err = service.CreateSupplyWarehousOutOrder(item)
|
1983
|
1983
|
}
|
1984
|
1984
|
for _, item := range updateWarehout {
|
|
1985
|
+ service.UpdateGoodWarehouseOutOrder(item)
|
1985
|
1986
|
//查询该商品是否来源于采购订单,如果存在则关联, 如果不存在则取消关联
|
1986
|
1987
|
_, errcode := service.GetGoodIsSource(item.WarehousingId, item.ProjectId, orgId)
|
1987
|
1988
|
if errcode == gorm.ErrRecordNotFound {
|
|
@@ -1989,7 +1990,7 @@ func (this *SupplyOrderApiController) UpdateGoodOrder() {
|
1989
|
1990
|
item.WarehouseInfoId = 0
|
1990
|
1991
|
item.Type = 2
|
1991
|
1992
|
item.OrderNumber = ""
|
1992
|
|
- service.UpdateGoodWarehouseOutOrder(item)
|
|
1993
|
+
|
1993
|
1994
|
//更新采购单
|
1994
|
1995
|
service.ModfySupplyWarehouseOut(item.WarehousingId, orgId)
|
1995
|
1996
|
}
|
|
@@ -2456,12 +2457,12 @@ func (this *SupplyOrderApiController) SaveGoodReturnOrder() {
|
2456
|
2457
|
}
|
2457
|
2458
|
supply_count := int64(items["supply_count"].(float64))
|
2458
|
2459
|
|
2459
|
|
- if items["count"] == nil || reflect.TypeOf(items["count"]).String() != "float64" {
|
|
2460
|
+ if items["count"] == nil || reflect.TypeOf(items["count"]).String() != "string" {
|
2460
|
2461
|
utils.ErrorLog("count")
|
2461
|
2462
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
2462
|
2463
|
return
|
2463
|
2464
|
}
|
2464
|
|
- count := int64(items["count"].(float64))
|
|
2465
|
+ count := items["count"].(string)
|
2465
|
2466
|
|
2466
|
2467
|
if items["manufacturer_id"] == nil || reflect.TypeOf(items["manufacturer_id"]).String() != "float64" {
|
2467
|
2468
|
utils.ErrorLog("manufacturer_id")
|
|
@@ -2604,13 +2605,17 @@ func (this *SupplyOrderApiController) SaveGoodReturnOrder() {
|
2604
|
2605
|
return
|
2605
|
2606
|
}
|
2606
|
2607
|
id := int64(items["id"].(float64))
|
|
2608
|
+
|
|
2609
|
+ deposit_rate := items["deposit_rate"].(string)
|
|
2610
|
+
|
|
2611
|
+ deposit_rate_float, _ := strconv.ParseFloat(deposit_rate, 64)
|
2607
|
2612
|
cancelOrder := &models.SpSupplierWarehousingCancelOrder{
|
2608
|
2613
|
ManufacturerId: manufacturer_id,
|
2609
|
2614
|
OrderNumber: order_number,
|
2610
|
2615
|
ProjectId: project_id,
|
2611
|
2616
|
GoodNumber: good_number,
|
2612
|
2617
|
IsSource: is_source,
|
2613
|
|
- Count: supply_count,
|
|
2618
|
+ Count: count,
|
2614
|
2619
|
Price: price_float,
|
2615
|
2620
|
Remark: supply_remake,
|
2616
|
2621
|
RateOfConcession: rate_of_concession_float,
|
|
@@ -2637,6 +2642,8 @@ func (this *SupplyOrderApiController) SaveGoodReturnOrder() {
|
2637
|
2642
|
WarehousingId: warehousing_id,
|
2638
|
2643
|
SourceCount: count,
|
2639
|
2644
|
SupplyWarehouseDetailInfo: id,
|
|
2645
|
+ SupplyCount: supply_count,
|
|
2646
|
+ DepositRate: deposit_rate_float,
|
2640
|
2647
|
}
|
2641
|
2648
|
warehouseCancel = append(warehouseCancel, cancelOrder)
|
2642
|
2649
|
}
|
|
@@ -2903,6 +2910,20 @@ func (this *SupplyOrderApiController) UpdateGoodReturn() {
|
2903
|
2910
|
}
|
2904
|
2911
|
supply_manufacturer := items["supply_manufacturer"].(string)
|
2905
|
2912
|
|
|
2913
|
+ if items["count"] == nil || reflect.TypeOf(items["count"]).String() != "string" {
|
|
2914
|
+ utils.ErrorLog("count")
|
|
2915
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
2916
|
+ return
|
|
2917
|
+ }
|
|
2918
|
+ count := items["count"].(string)
|
|
2919
|
+
|
|
2920
|
+ if items["deposit_rate"] == nil || reflect.TypeOf(items["deposit_rate"]).String() != "string" {
|
|
2921
|
+ utils.ErrorLog("deposit_rate")
|
|
2922
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
2923
|
+ return
|
|
2924
|
+ }
|
|
2925
|
+ deposit_rate := items["deposit_rate"].(string)
|
|
2926
|
+ deposit_rate_float, _ := strconv.ParseFloat(deposit_rate, 64)
|
2906
|
2927
|
if id > 0 {
|
2907
|
2928
|
cancelOrder := &models.SpSupplierWarehousingCancelOrder{
|
2908
|
2929
|
ID: id,
|
|
@@ -2911,7 +2932,7 @@ func (this *SupplyOrderApiController) UpdateGoodReturn() {
|
2911
|
2932
|
ProjectId: project_id,
|
2912
|
2933
|
GoodNumber: good_number,
|
2913
|
2934
|
IsSource: is_source,
|
2914
|
|
- Count: supply_count,
|
|
2935
|
+ Count: count,
|
2915
|
2936
|
Price: price_float,
|
2916
|
2937
|
Remark: supply_remake,
|
2917
|
2938
|
RateOfConcession: rate_of_concession_float,
|
|
@@ -2931,6 +2952,8 @@ func (this *SupplyOrderApiController) UpdateGoodReturn() {
|
2931
|
2952
|
Name: name,
|
2932
|
2953
|
SupplyUnit: supply_unit,
|
2933
|
2954
|
SupplyLicenseNumber: supply_license_number,
|
|
2955
|
+ SupplyCount: supply_count,
|
|
2956
|
+ DepositRate: deposit_rate_float,
|
2934
|
2957
|
}
|
2935
|
2958
|
updateWarehouseCancel = append(updateWarehouseCancel, cancelOrder)
|
2936
|
2959
|
}
|
|
@@ -2942,7 +2965,7 @@ func (this *SupplyOrderApiController) UpdateGoodReturn() {
|
2942
|
2965
|
ProjectId: project_id,
|
2943
|
2966
|
GoodNumber: good_number,
|
2944
|
2967
|
IsSource: is_source,
|
2945
|
|
- Count: supply_count,
|
|
2968
|
+ Count: count,
|
2946
|
2969
|
Price: price_float,
|
2947
|
2970
|
Remark: supply_remake,
|
2948
|
2971
|
RateOfConcession: rate_of_concession_float,
|
|
@@ -2962,6 +2985,8 @@ func (this *SupplyOrderApiController) UpdateGoodReturn() {
|
2962
|
2985
|
Name: name,
|
2963
|
2986
|
SupplyUnit: supply_unit,
|
2964
|
2987
|
SupplyLicenseNumber: supply_license_number,
|
|
2988
|
+ SupplyCount: supply_count,
|
|
2989
|
+ DepositRate: deposit_rate_float,
|
2965
|
2990
|
}
|
2966
|
2991
|
warehouseCancel = append(warehouseCancel, cancelOrder)
|
2967
|
2992
|
}
|
|
@@ -2992,12 +3017,13 @@ func (this *SupplyOrderApiController) UpdateGoodReturn() {
|
2992
|
3017
|
func (this *SupplyOrderApiController) ModefyGoodOrder() {
|
2993
|
3018
|
|
2994
|
3019
|
id, _ := this.GetInt64("id")
|
|
3020
|
+ warehousing_id, _ := this.GetInt64("warehousing_id")
|
2995
|
3021
|
orgId := this.GetAdminUserInfo().CurrentOrgId
|
2996
|
3022
|
|
2997
|
3023
|
//获取购货订单的数据
|
2998
|
|
- purcaseOrder, _ := service.GetAllPurcaseOrderById(id, orgId)
|
|
3024
|
+ purcaseOrder, _ := service.GetAllPurcaseOrderById(warehousing_id, orgId)
|
2999
|
3025
|
//获取购货单的数据
|
3000
|
|
- goodOrder, _ := service.GetAllGoodOrderById(id, orgId)
|
|
3026
|
+ goodOrder, _ := service.GetAllGoodOrderById(warehousing_id, orgId)
|
3001
|
3027
|
drugList, _ := service.GetSupplyDrugList(orgId)
|
3002
|
3028
|
//获取已有关联的退货单
|
3003
|
3029
|
cancelList, _ := service.GetSupplyCancelWarehouse(id, orgId)
|
|
@@ -3169,10 +3195,10 @@ func (this *SupplyOrderApiController) CheckReturnOrder() {
|
3169
|
3195
|
//判断单位是否相等
|
3170
|
3196
|
if medical.MaxUnit == item.SupplyUnit {
|
3171
|
3197
|
//转化为最小单位
|
3172
|
|
- prescribing_number_total = item.Count * medical.MinNumber
|
|
3198
|
+ prescribing_number_total = item.SupplyCount * medical.MinNumber
|
3173
|
3199
|
}
|
3174
|
3200
|
if medical.MinUnit == item.SupplyUnit {
|
3175
|
|
- prescribing_number_total = item.Count
|
|
3201
|
+ prescribing_number_total = item.SupplyCount
|
3176
|
3202
|
}
|
3177
|
3203
|
|
3178
|
3204
|
//判断单位
|
|
@@ -3247,7 +3273,7 @@ func (this *SupplyOrderApiController) CheckReturnOrder() {
|
3247
|
3273
|
WarehouseOutOrderNumber: lastDrug.WarehouseOutOrderNumber,
|
3248
|
3274
|
WarehouseOutId: lastDrug.ID,
|
3249
|
3275
|
DrugId: item.ProjectId,
|
3250
|
|
- Count: item.Count,
|
|
3276
|
+ Count: item.SupplyCount,
|
3251
|
3277
|
Price: item.Price,
|
3252
|
3278
|
Status: 1,
|
3253
|
3279
|
Ctime: ctime,
|
|
@@ -3269,15 +3295,15 @@ func (this *SupplyOrderApiController) CheckReturnOrder() {
|
3269
|
3295
|
|
3270
|
3296
|
drup, _ := service.FindBaseDrugLibRecord(orgId, item.ProjectId)
|
3271
|
3297
|
if drup.ID > 0 {
|
3272
|
|
- prescribingNumber := item.Count
|
|
3298
|
+ prescribingNumber := item.SupplyCount
|
3273
|
3299
|
service.AutoDrugDeliverInfoNight(orgId, prescribingNumber, &warehouseOut, &drup, warehouseOutInfo)
|
3274
|
3300
|
}
|
3275
|
3301
|
|
3276
|
3302
|
//修改原数据
|
3277
|
|
- orderInfo := models.SpSupplierWarehousingCancelOrder{
|
3278
|
|
- SourceCount: item.Count - item.SourceCount,
|
3279
|
|
- }
|
3280
|
|
- service.UpdateSupplyCancelById(item.ID, orderInfo)
|
|
3303
|
+ /* orderInfo := models.SpSupplierWarehousingCancelOrder{
|
|
3304
|
+ SourceCount: item.SupplyCount - item.SourceCount,
|
|
3305
|
+ }
|
|
3306
|
+ service.UpdateSupplyCancelById(item.ID, orderInfo)*/
|
3281
|
3307
|
}
|
3282
|
3308
|
|
3283
|
3309
|
//耗材
|
|
@@ -3286,7 +3312,7 @@ func (this *SupplyOrderApiController) CheckReturnOrder() {
|
3286
|
3312
|
warehouseOne, _ := service.FindWarehousingInfoTwenTy(item.ProjectId, item.SupplyWarehouseDetailInfo)
|
3287
|
3313
|
|
3288
|
3314
|
// 如果出库数量大于该批次剩余库存数量
|
3289
|
|
- if item.Count > warehouseOne.StockCount {
|
|
3315
|
+ if item.SupplyCount > warehouseOne.StockCount {
|
3290
|
3316
|
|
3291
|
3317
|
goodObj, _ := service.GetGoodInformationByGoodId(item.ProjectId)
|
3292
|
3318
|
this.ServeSuccessJSON(map[string]interface{}{
|
|
@@ -3340,7 +3366,7 @@ func (this *SupplyOrderApiController) CheckReturnOrder() {
|
3340
|
3366
|
WarehouseInfotId: 0,
|
3341
|
3367
|
GoodId: item.ProjectId,
|
3342
|
3368
|
GoodTypeId: goodObj.GoodTypeId,
|
3343
|
|
- Count: item.Count,
|
|
3369
|
+ Count: item.SupplyCount,
|
3344
|
3370
|
Price: item.Price,
|
3345
|
3371
|
TotalPrice: 0,
|
3346
|
3372
|
ProductDate: item.SupplyProductDate,
|
|
@@ -3358,7 +3384,7 @@ func (this *SupplyOrderApiController) CheckReturnOrder() {
|
3358
|
3384
|
SupplyWarehouseId: warehouse_out_id,
|
3359
|
3385
|
}
|
3360
|
3386
|
//出库逻辑
|
3361
|
|
- parseDateErr := service.ConsumablesDeliveryNight(orgId, record_date, info, &warehouseOut, item.Count, creater, warehouse_out_id, id)
|
|
3387
|
+ parseDateErr := service.ConsumablesDeliveryNight(orgId, record_date, info, &warehouseOut, item.SupplyCount, creater, warehouse_out_id, id)
|
3362
|
3388
|
|
3363
|
3389
|
if parseDateErr != nil {
|
3364
|
3390
|
utils.ErrorLog(parseDateErr.Error())
|
|
@@ -3366,10 +3392,10 @@ func (this *SupplyOrderApiController) CheckReturnOrder() {
|
3366
|
3392
|
return
|
3367
|
3393
|
}
|
3368
|
3394
|
//更改原退库数据
|
3369
|
|
- order := models.SpSupplierWarehousingCancelOrder{
|
3370
|
|
- SourceCount: item.SourceCount - item.Count,
|
3371
|
|
- }
|
3372
|
|
- service.UpdateSupplyCancelById(item.ID, order)
|
|
3395
|
+ //order := models.SpSupplierWarehousingCancelOrder{
|
|
3396
|
+ // SourceCount: item.SourceCount - item.SupplyCount,
|
|
3397
|
+ //}
|
|
3398
|
+ //service.UpdateSupplyCancelById(item.ID, order)
|
3373
|
3399
|
}
|
3374
|
3400
|
}
|
3375
|
3401
|
cancel := models.SpSupplierWarehouseCancel{
|
|
@@ -3465,13 +3491,13 @@ func (this *SupplyOrderApiController) ModefyReturnOrder() {
|
3465
|
3491
|
if item.SupplyUnit == base.MaxUnit {
|
3466
|
3492
|
//退库
|
3467
|
3493
|
drugInfo := models.DrugWarehouseInfo{
|
3468
|
|
- StockMaxNumber: item.Count,
|
|
3494
|
+ StockMaxNumber: item.SupplyCount,
|
3469
|
3495
|
}
|
3470
|
3496
|
service.UpdateDrugWasehousring(item.ProjectId, item.SupplyWarehouseDetailInfo, drugInfo)
|
3471
|
3497
|
}
|
3472
|
3498
|
if item.SupplyType == base.MinUnit {
|
3473
|
3499
|
drugInfo := models.DrugWarehouseInfo{
|
3474
|
|
- StockMinNumber: item.Count,
|
|
3500
|
+ StockMinNumber: item.SupplyCount,
|
3475
|
3501
|
}
|
3476
|
3502
|
service.UpdateDrugWasehousringOne(item.ProjectId, item.SupplyWarehouseDetailInfo, drugInfo)
|
3477
|
3503
|
}
|
|
@@ -3483,7 +3509,7 @@ func (this *SupplyOrderApiController) ModefyReturnOrder() {
|
3483
|
3509
|
|
3484
|
3510
|
//退库
|
3485
|
3511
|
info := models.WarehousingInfo{
|
3486
|
|
- StockCount: item.Count,
|
|
3512
|
+ StockCount: item.SupplyCount,
|
3487
|
3513
|
}
|
3488
|
3514
|
//更改库存
|
3489
|
3515
|
err := service.UpdateWarehousingInfoById(item.ProjectId, item.SupplyWarehouseDetailInfo, info)
|