|
@@ -97,6 +97,12 @@ func SupplyOrderApiRegistRouters() {
|
97
|
97
|
beego.Router("api/supply/deletepurchaseorder", &SupplyOrderApiController{}, "Get:DeletePurchaseOrder")
|
98
|
98
|
//删除采购单
|
99
|
99
|
beego.Router("/api/supply/deletegoodorderbyid", &SupplyOrderApiController{}, "Get:DeleteGoodOrderById")
|
|
100
|
+ //删除退货单
|
|
101
|
+ beego.Router("/api/supply/deletereturnorder", &SupplyOrderApiController{}, "Get:DeleteReturnOrder")
|
|
102
|
+ //删除
|
|
103
|
+ beego.Router("/api/supply/deletereturnorderbyid", &SupplyOrderApiController{}, "Get:DeleteReturnOrderById")
|
|
104
|
+ //反审核退货单
|
|
105
|
+ beego.Router("/api/supply/modefyreturnorder", &SupplyOrderApiController{}, "Get:ModefyReturnOrder")
|
100
|
106
|
}
|
101
|
107
|
|
102
|
108
|
//判断前端参数是否为空
|
|
@@ -2047,29 +2053,30 @@ func (this *SupplyOrderApiController) GetGoodOrderCountList() {
|
2047
|
2053
|
drugWarehouseInfo, _ := service.GetLastDrugWarehouse(orgId)
|
2048
|
2054
|
|
2049
|
2055
|
warehouseInfoDetailOne := &models.DrugWarehouseInfo{
|
2050
|
|
- WarehousingOrder: drugWarehouseInfo.WarehousingOrder,
|
2051
|
|
- WarehousingId: drugWarehouseInfo.ID,
|
2052
|
|
- DrugId: item.ProjectId,
|
2053
|
|
- Number: item.SupplyLicenseNumber,
|
2054
|
|
- ProductDate: item.SupplyProductDate,
|
2055
|
|
- ExpiryDate: item.SupplyExpiryDate,
|
2056
|
|
- WarehousingCount: item.Count,
|
2057
|
|
- Price: item.Price,
|
2058
|
|
- TotalPrice: 0,
|
2059
|
|
- Status: 1,
|
2060
|
|
- Ctime: time.Now().Unix(),
|
2061
|
|
- Remark: item.Remark,
|
2062
|
|
- OrgId: orgId,
|
2063
|
|
- Type: 1,
|
2064
|
|
- Manufacturer: item.ManufacturerId,
|
2065
|
|
- Dealer: 0,
|
2066
|
|
- StockMaxNumber: item.Count,
|
2067
|
|
- RetailTotalPrice: 0,
|
2068
|
|
- BatchNumber: item.SupplyBatchNumber,
|
2069
|
|
- MaxUnit: item.SupplyUnit,
|
2070
|
|
- MinUnit: item.SupplyUnit,
|
2071
|
|
- RetailPrice: medical.MinPrice,
|
2072
|
|
- SupplyWarehouseId: id,
|
|
2056
|
+ WarehousingOrder: drugWarehouseInfo.WarehousingOrder,
|
|
2057
|
+ WarehousingId: drugWarehouseInfo.ID,
|
|
2058
|
+ DrugId: item.ProjectId,
|
|
2059
|
+ Number: item.SupplyLicenseNumber,
|
|
2060
|
+ ProductDate: item.SupplyProductDate,
|
|
2061
|
+ ExpiryDate: item.SupplyExpiryDate,
|
|
2062
|
+ WarehousingCount: item.Count,
|
|
2063
|
+ Price: item.Price,
|
|
2064
|
+ TotalPrice: 0,
|
|
2065
|
+ Status: 1,
|
|
2066
|
+ Ctime: time.Now().Unix(),
|
|
2067
|
+ Remark: item.Remark,
|
|
2068
|
+ OrgId: orgId,
|
|
2069
|
+ Type: 1,
|
|
2070
|
+ Manufacturer: item.ManufacturerId,
|
|
2071
|
+ Dealer: 0,
|
|
2072
|
+ StockMaxNumber: item.Count,
|
|
2073
|
+ RetailTotalPrice: 0,
|
|
2074
|
+ BatchNumber: item.SupplyBatchNumber,
|
|
2075
|
+ MaxUnit: item.SupplyUnit,
|
|
2076
|
+ MinUnit: item.SupplyUnit,
|
|
2077
|
+ RetailPrice: medical.MinPrice,
|
|
2078
|
+ SupplyWarehouseId: id,
|
|
2079
|
+ SupplyWarehouseDetailInfo: item.ID,
|
2073
|
2080
|
}
|
2074
|
2081
|
if medical.MaxUnit == medical.MinUnit {
|
2075
|
2082
|
warehouseInfoDetailOne.StockMaxNumber = item.Count
|
|
@@ -2084,27 +2091,28 @@ func (this *SupplyOrderApiController) GetGoodOrderCountList() {
|
2084
|
2091
|
warehouseInfoDetail = append(warehouseInfoDetail, warehouseInfoDetailOne)
|
2085
|
2092
|
|
2086
|
2093
|
drugflow := &models.DrugFlow{
|
2087
|
|
- WarehousingOrder: drugWarehouseInfo.WarehousingOrder,
|
2088
|
|
- WarehousingId: drugWarehouseInfo.ID,
|
2089
|
|
- DrugId: item.ProjectId,
|
2090
|
|
- Number: item.SupplyBatchNumber,
|
2091
|
|
- ProductDate: item.SupplyProductDate,
|
2092
|
|
- ExpireDate: item.SupplyExpiryDate,
|
2093
|
|
- Count: item.Count,
|
2094
|
|
- Price: item.Price,
|
2095
|
|
- Status: 1,
|
2096
|
|
- Ctime: time.Now().Unix(),
|
2097
|
|
- UserOrgId: orgId,
|
2098
|
|
- Manufacturer: item.ManufacturerId,
|
2099
|
|
- Dealer: 0,
|
2100
|
|
- BatchNumber: item.SupplyBatchNumber,
|
2101
|
|
- MaxUnit: item.SupplyUnit,
|
2102
|
|
- MinUnit: item.SupplyUnit,
|
2103
|
|
- ConsumableType: 1,
|
2104
|
|
- IsEdit: 1,
|
2105
|
|
- Creator: checker,
|
2106
|
|
- IsSys: 0,
|
2107
|
|
- SupplyWarehouseId: id,
|
|
2094
|
+ WarehousingOrder: drugWarehouseInfo.WarehousingOrder,
|
|
2095
|
+ WarehousingId: drugWarehouseInfo.ID,
|
|
2096
|
+ DrugId: item.ProjectId,
|
|
2097
|
+ Number: item.SupplyBatchNumber,
|
|
2098
|
+ ProductDate: item.SupplyProductDate,
|
|
2099
|
+ ExpireDate: item.SupplyExpiryDate,
|
|
2100
|
+ Count: item.Count,
|
|
2101
|
+ Price: item.Price,
|
|
2102
|
+ Status: 1,
|
|
2103
|
+ Ctime: time.Now().Unix(),
|
|
2104
|
+ UserOrgId: orgId,
|
|
2105
|
+ Manufacturer: item.ManufacturerId,
|
|
2106
|
+ Dealer: 0,
|
|
2107
|
+ BatchNumber: item.SupplyBatchNumber,
|
|
2108
|
+ MaxUnit: item.SupplyUnit,
|
|
2109
|
+ MinUnit: item.SupplyUnit,
|
|
2110
|
+ ConsumableType: 1,
|
|
2111
|
+ IsEdit: 1,
|
|
2112
|
+ Creator: checker,
|
|
2113
|
+ IsSys: 0,
|
|
2114
|
+ SupplyWarehouseId: id,
|
|
2115
|
+ SupplyWarehouseDetailInfo: item.ID,
|
2108
|
2116
|
}
|
2109
|
2117
|
|
2110
|
2118
|
if medical.MaxUnit == medical.MinUnit {
|
|
@@ -2147,27 +2155,28 @@ func (this *SupplyOrderApiController) GetGoodOrderCountList() {
|
2147
|
2155
|
|
2148
|
2156
|
//入库单表格
|
2149
|
2157
|
warehouseInfo := &models.WarehousingInfo{
|
2150
|
|
- WarehousingOrder: info.WarehousingOrder,
|
2151
|
|
- WarehousingId: info.ID,
|
2152
|
|
- GoodId: item.ProjectId,
|
2153
|
|
- Number: item.SupplyBatchNumber,
|
2154
|
|
- GoodTypeId: good.GoodTypeId,
|
2155
|
|
- ProductDate: item.SupplyProductDate,
|
2156
|
|
- ExpiryDate: item.SupplyExpiryDate,
|
2157
|
|
- WarehousingCount: item.Count,
|
2158
|
|
- Price: item.Price,
|
2159
|
|
- TotalPrice: 0,
|
2160
|
|
- Status: 1,
|
2161
|
|
- Ctime: time.Now().Unix(),
|
2162
|
|
- Remark: item.Remark,
|
2163
|
|
- OrgId: orgId,
|
2164
|
|
- Type: 1,
|
2165
|
|
- Manufacturer: item.ManufacturerId,
|
2166
|
|
- StockCount: item.Count,
|
2167
|
|
- Dealer: good.Dealer,
|
2168
|
|
- LicenseNumber: item.SupplyLicenseNumber,
|
2169
|
|
- PackingPrice: good.PackingPrice,
|
2170
|
|
- SupplyWarehouseId: id,
|
|
2158
|
+ WarehousingOrder: info.WarehousingOrder,
|
|
2159
|
+ WarehousingId: info.ID,
|
|
2160
|
+ GoodId: item.ProjectId,
|
|
2161
|
+ Number: item.SupplyBatchNumber,
|
|
2162
|
+ GoodTypeId: good.GoodTypeId,
|
|
2163
|
+ ProductDate: item.SupplyProductDate,
|
|
2164
|
+ ExpiryDate: item.SupplyExpiryDate,
|
|
2165
|
+ WarehousingCount: item.Count,
|
|
2166
|
+ Price: item.Price,
|
|
2167
|
+ TotalPrice: 0,
|
|
2168
|
+ Status: 1,
|
|
2169
|
+ Ctime: time.Now().Unix(),
|
|
2170
|
+ Remark: item.Remark,
|
|
2171
|
+ OrgId: orgId,
|
|
2172
|
+ Type: 1,
|
|
2173
|
+ Manufacturer: item.ManufacturerId,
|
|
2174
|
+ StockCount: item.Count,
|
|
2175
|
+ Dealer: good.Dealer,
|
|
2176
|
+ LicenseNumber: item.SupplyLicenseNumber,
|
|
2177
|
+ PackingPrice: good.PackingPrice,
|
|
2178
|
+ SupplyWarehouseId: id,
|
|
2179
|
+ SupplyWarehouseDetailInfo: item.ID,
|
2171
|
2180
|
}
|
2172
|
2181
|
warehousingInfo = append(warehousingInfo, warehouseInfo)
|
2173
|
2182
|
}
|
|
@@ -2179,26 +2188,27 @@ func (this *SupplyOrderApiController) GetGoodOrderCountList() {
|
2179
|
2188
|
service.CreatedWarehouseingDetail(item)
|
2180
|
2189
|
warehousinginfo, _ := service.GetLastWarehousingInfo(item.GoodId)
|
2181
|
2190
|
flow := models.VmStockFlow{
|
2182
|
|
- WarehousingOrder: item.WarehousingOrder,
|
2183
|
|
- WarehousingId: item.ID,
|
2184
|
|
- GoodId: item.GoodId,
|
2185
|
|
- Number: item.Number,
|
2186
|
|
- ProductDate: item.ProductDate,
|
2187
|
|
- ExpireDate: item.ExpiryDate,
|
2188
|
|
- Count: item.WarehousingCount,
|
2189
|
|
- Price: item.Price,
|
2190
|
|
- Status: 1,
|
2191
|
|
- Ctime: time.Now().Unix(),
|
2192
|
|
- UserOrgId: orgId,
|
2193
|
|
- Manufacturer: item.Manufacturer,
|
2194
|
|
- Dealer: item.Dealer,
|
2195
|
|
- LicenseNumber: item.LicenseNumber,
|
2196
|
|
- IsEdit: 1,
|
2197
|
|
- Creator: checker,
|
2198
|
|
- SystemTime: record_date,
|
2199
|
|
- ConsumableType: 1,
|
2200
|
|
- WarehousingDetailId: warehousinginfo.ID,
|
2201
|
|
- SupplyWarehouseId: id,
|
|
2191
|
+ WarehousingOrder: item.WarehousingOrder,
|
|
2192
|
+ WarehousingId: item.ID,
|
|
2193
|
+ GoodId: item.GoodId,
|
|
2194
|
+ Number: item.Number,
|
|
2195
|
+ ProductDate: item.ProductDate,
|
|
2196
|
+ ExpireDate: item.ExpiryDate,
|
|
2197
|
+ Count: item.WarehousingCount,
|
|
2198
|
+ Price: item.Price,
|
|
2199
|
+ Status: 1,
|
|
2200
|
+ Ctime: time.Now().Unix(),
|
|
2201
|
+ UserOrgId: orgId,
|
|
2202
|
+ Manufacturer: item.Manufacturer,
|
|
2203
|
+ Dealer: item.Dealer,
|
|
2204
|
+ LicenseNumber: item.LicenseNumber,
|
|
2205
|
+ IsEdit: 1,
|
|
2206
|
+ Creator: checker,
|
|
2207
|
+ SystemTime: record_date,
|
|
2208
|
+ ConsumableType: 1,
|
|
2209
|
+ WarehousingDetailId: warehousinginfo.ID,
|
|
2210
|
+ SupplyWarehouseId: id,
|
|
2211
|
+ SupplyWarehouseDetailInfo: item.ID,
|
2202
|
2212
|
}
|
2203
|
2213
|
service.CreateStockFlowOne(flow)
|
2204
|
2214
|
}
|
|
@@ -2320,6 +2330,13 @@ func (this *SupplyOrderApiController) SaveGoodReturnOrder() {
|
2320
|
2330
|
}
|
2321
|
2331
|
supply_count := int64(items["supply_count"].(float64))
|
2322
|
2332
|
|
|
2333
|
+ if items["count"] == nil || reflect.TypeOf(items["count"]).String() != "float64" {
|
|
2334
|
+ utils.ErrorLog("count")
|
|
2335
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
2336
|
+ return
|
|
2337
|
+ }
|
|
2338
|
+ count := int64(items["count"].(float64))
|
|
2339
|
+
|
2323
|
2340
|
if items["manufacturer_id"] == nil || reflect.TypeOf(items["manufacturer_id"]).String() != "float64" {
|
2324
|
2341
|
utils.ErrorLog("manufacturer_id")
|
2325
|
2342
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
@@ -2454,37 +2471,46 @@ func (this *SupplyOrderApiController) SaveGoodReturnOrder() {
|
2454
|
2471
|
return
|
2455
|
2472
|
}
|
2456
|
2473
|
warehouse_info_id := int64(items["warehouse_info_id"].(float64))
|
|
2474
|
+
|
|
2475
|
+ if items["id"] == nil || reflect.TypeOf(items["id"]).String() != "float64" {
|
|
2476
|
+ utils.ErrorLog("id")
|
|
2477
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
2478
|
+ return
|
|
2479
|
+ }
|
|
2480
|
+ id := int64(items["id"].(float64))
|
2457
|
2481
|
cancelOrder := &models.SpSupplierWarehousingCancelOrder{
|
2458
|
|
- ManufacturerId: manufacturer_id,
|
2459
|
|
- OrderNumber: order_number,
|
2460
|
|
- ProjectId: project_id,
|
2461
|
|
- GoodNumber: good_number,
|
2462
|
|
- IsSource: is_source,
|
2463
|
|
- Count: supply_count,
|
2464
|
|
- Price: price_float,
|
2465
|
|
- Remark: supply_remake,
|
2466
|
|
- RateOfConcession: rate_of_concession_float,
|
2467
|
|
- DiscountAmount: discount_amount_float,
|
2468
|
|
- UserOrgId: orgId,
|
2469
|
|
- Ctime: time.Now().Unix(),
|
2470
|
|
- Status: 1,
|
2471
|
|
- Mtime: 0,
|
2472
|
|
- WarehouseCancelId: order.ID,
|
2473
|
|
- Type: 1,
|
2474
|
|
- ReturnNumber: order.Number,
|
2475
|
|
- WarehouseOutId: warehouse_out_id,
|
2476
|
|
- SupplySpecificationName: supply_specification_name,
|
2477
|
|
- SupplyType: supply_type,
|
2478
|
|
- SupplyTotal: supply_total,
|
2479
|
|
- SupplyManufacturer: supply_manufacturer,
|
2480
|
|
- Name: name,
|
2481
|
|
- SupplyUnit: supply_unit,
|
2482
|
|
- SupplyLicenseNumber: supply_license_number,
|
2483
|
|
- SupplyBatchNumber: supply_batch_number,
|
2484
|
|
- SupplyExpiryDate: supply_expiry_date,
|
2485
|
|
- SupplyProductDate: supply_product_date,
|
2486
|
|
- WarehouseInfoId: warehouse_info_id,
|
2487
|
|
- WarehousingId: warehousing_id,
|
|
2482
|
+ ManufacturerId: manufacturer_id,
|
|
2483
|
+ OrderNumber: order_number,
|
|
2484
|
+ ProjectId: project_id,
|
|
2485
|
+ GoodNumber: good_number,
|
|
2486
|
+ IsSource: is_source,
|
|
2487
|
+ Count: supply_count,
|
|
2488
|
+ Price: price_float,
|
|
2489
|
+ Remark: supply_remake,
|
|
2490
|
+ RateOfConcession: rate_of_concession_float,
|
|
2491
|
+ DiscountAmount: discount_amount_float,
|
|
2492
|
+ UserOrgId: orgId,
|
|
2493
|
+ Ctime: time.Now().Unix(),
|
|
2494
|
+ Status: 1,
|
|
2495
|
+ Mtime: 0,
|
|
2496
|
+ WarehouseCancelId: order.ID,
|
|
2497
|
+ Type: 1,
|
|
2498
|
+ ReturnNumber: order.Number,
|
|
2499
|
+ WarehouseOutId: warehouse_out_id,
|
|
2500
|
+ SupplySpecificationName: supply_specification_name,
|
|
2501
|
+ SupplyType: supply_type,
|
|
2502
|
+ SupplyTotal: supply_total,
|
|
2503
|
+ SupplyManufacturer: supply_manufacturer,
|
|
2504
|
+ Name: name,
|
|
2505
|
+ SupplyUnit: supply_unit,
|
|
2506
|
+ SupplyLicenseNumber: supply_license_number,
|
|
2507
|
+ SupplyBatchNumber: supply_batch_number,
|
|
2508
|
+ SupplyExpiryDate: supply_expiry_date,
|
|
2509
|
+ SupplyProductDate: supply_product_date,
|
|
2510
|
+ WarehouseInfoId: warehouse_info_id,
|
|
2511
|
+ WarehousingId: warehousing_id,
|
|
2512
|
+ SourceCount: count,
|
|
2513
|
+ SupplyWarehouseDetailInfo: id,
|
2488
|
2514
|
}
|
2489
|
2515
|
warehouseCancel = append(warehouseCancel, cancelOrder)
|
2490
|
2516
|
}
|
|
@@ -2626,6 +2652,7 @@ func (this *SupplyOrderApiController) UpdateGoodReturn() {
|
2626
|
2652
|
var updateWarehouseCancel []*models.SpSupplierWarehousingCancelOrder
|
2627
|
2653
|
if dataBody["stockIn"] != nil && reflect.TypeOf(dataBody["stockIn"]).String() == "[]interface {}" {
|
2628
|
2654
|
thisStockIn, _ := dataBody["stockIn"].([]interface{})
|
|
2655
|
+
|
2629
|
2656
|
if len(thisStockIn) > 0 {
|
2630
|
2657
|
for _, item := range thisStockIn {
|
2631
|
2658
|
items := item.(map[string]interface{})
|
|
@@ -2744,6 +2771,7 @@ func (this *SupplyOrderApiController) UpdateGoodReturn() {
|
2744
|
2771
|
|
2745
|
2772
|
if id > 0 {
|
2746
|
2773
|
cancelOrder := &models.SpSupplierWarehousingCancelOrder{
|
|
2774
|
+ ID: id,
|
2747
|
2775
|
ManufacturerId: manufacturer_id,
|
2748
|
2776
|
OrderNumber: order_number,
|
2749
|
2777
|
ProjectId: project_id,
|
|
@@ -2807,7 +2835,7 @@ func (this *SupplyOrderApiController) UpdateGoodReturn() {
|
2807
|
2835
|
}
|
2808
|
2836
|
|
2809
|
2837
|
if len(updateWarehouseCancel) > 0 {
|
2810
|
|
- for _, item := range warehouseCancel {
|
|
2838
|
+ for _, item := range updateWarehouseCancel {
|
2811
|
2839
|
service.UpdateWarehouseCancelOrder(item)
|
2812
|
2840
|
}
|
2813
|
2841
|
}
|
|
@@ -3024,6 +3052,8 @@ func (this *SupplyOrderApiController) CheckReturnOrder() {
|
3024
|
3052
|
Status: 1,
|
3025
|
3053
|
WarehouseOutTime: record_date,
|
3026
|
3054
|
Type: 1,
|
|
3055
|
+ SupplyCancelOutId: id,
|
|
3056
|
+ SupplyWarehouseId: warehouse_out_id,
|
3027
|
3057
|
}
|
3028
|
3058
|
// 查询今日是否存在出库单
|
3029
|
3059
|
_, errcodes := service.GetDrugWarehouseOutById(orgId, record_date)
|
|
@@ -3055,6 +3085,8 @@ func (this *SupplyOrderApiController) CheckReturnOrder() {
|
3055
|
3085
|
BatchNumber: item.SupplyBatchNumber,
|
3056
|
3086
|
IsSys: 0,
|
3057
|
3087
|
WarehouseInfoId: 0,
|
|
3088
|
+ SupplyCancelOutId: id,
|
|
3089
|
+ SupplyWarehouseId: warehouse_out_id,
|
3058
|
3090
|
}
|
3059
|
3091
|
|
3060
|
3092
|
drup, _ := service.FindBaseDrugLibRecord(orgId, item.ProjectId)
|
|
@@ -3063,6 +3095,11 @@ func (this *SupplyOrderApiController) CheckReturnOrder() {
|
3063
|
3095
|
service.AutoDrugDeliverInfoNight(orgId, prescribingNumber, &warehouseOut, &drup, warehouseOutInfo)
|
3064
|
3096
|
}
|
3065
|
3097
|
|
|
3098
|
+ //修改原数据
|
|
3099
|
+ orderInfo := models.SpSupplierWarehousingCancelOrder{
|
|
3100
|
+ SourceCount: item.Count - item.SourceCount,
|
|
3101
|
+ }
|
|
3102
|
+ service.UpdateSupplyCancelById(item.ID, orderInfo)
|
3066
|
3103
|
}
|
3067
|
3104
|
|
3068
|
3105
|
//耗材
|
|
@@ -3094,6 +3131,9 @@ func (this *SupplyOrderApiController) CheckReturnOrder() {
|
3094
|
3131
|
Status: 1,
|
3095
|
3132
|
WarehouseOutTime: record_date,
|
3096
|
3133
|
Type: 1,
|
|
3134
|
+ SupplyCancelOutId: id,
|
|
3135
|
+ SupplyWarehouseId: warehouse_out_id,
|
|
3136
|
+ IsSys: 0,
|
3097
|
3137
|
}
|
3098
|
3138
|
//查询是否生成出库单
|
3099
|
3139
|
_, errcodes := service.FindStockOutByIsSys(orgId, 0, operation_time)
|
|
@@ -3101,12 +3141,13 @@ func (this *SupplyOrderApiController) CheckReturnOrder() {
|
3101
|
3141
|
service.AddSigleWarehouseOut(&warehouseOut)
|
3102
|
3142
|
}
|
3103
|
3143
|
outWarehouse, _ := service.GetlastWarehouseOutById(orgId, record_date)
|
|
3144
|
+ goodObj, _ := service.GetGoodInformationByGoodId(item.ProjectId)
|
3104
|
3145
|
info := &models.WarehouseOutInfo{
|
3105
|
3146
|
WarehouseOutOrderNumber: outWarehouse.WarehouseOutOrderNumber,
|
3106
|
3147
|
WarehouseOutId: outWarehouse.ID,
|
3107
|
3148
|
WarehouseInfotId: 0,
|
3108
|
3149
|
GoodId: item.ProjectId,
|
3109
|
|
- GoodTypeId: 0,
|
|
3150
|
+ GoodTypeId: goodObj.GoodTypeId,
|
3110
|
3151
|
Count: item.Count,
|
3111
|
3152
|
Price: item.Price,
|
3112
|
3153
|
TotalPrice: 0,
|
|
@@ -3121,14 +3162,22 @@ func (this *SupplyOrderApiController) CheckReturnOrder() {
|
3121
|
3162
|
LicenseNumber: item.SupplyLicenseNumber,
|
3122
|
3163
|
ConsumableType: 0,
|
3123
|
3164
|
SupplyCancelOutId: id,
|
|
3165
|
+ OrgId: orgId,
|
|
3166
|
+ SupplyWarehouseId: warehouse_out_id,
|
3124
|
3167
|
}
|
3125
|
3168
|
//出库逻辑
|
3126
|
3169
|
parseDateErr := service.ConsumablesDeliveryNight(orgId, record_date, info, &warehouseOut, item.Count, creater, warehouse_out_id, id)
|
|
3170
|
+
|
3127
|
3171
|
if parseDateErr != nil {
|
3128
|
3172
|
utils.ErrorLog(parseDateErr.Error())
|
3129
|
3173
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateStockInFail)
|
3130
|
3174
|
return
|
3131
|
3175
|
}
|
|
3176
|
+ //更改原退库数据
|
|
3177
|
+ order := models.SpSupplierWarehousingCancelOrder{
|
|
3178
|
+ SourceCount: item.SourceCount - item.Count,
|
|
3179
|
+ }
|
|
3180
|
+ service.UpdateSupplyCancelById(item.ID, order)
|
3132
|
3181
|
}
|
3133
|
3182
|
}
|
3134
|
3183
|
}
|
|
@@ -3171,3 +3220,61 @@ func (this *SupplyOrderApiController) DeleteGoodOrderById() {
|
3171
|
3220
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
3172
|
3221
|
}
|
3173
|
3222
|
}
|
|
3223
|
+
|
|
3224
|
+func (this *SupplyOrderApiController) DeleteReturnOrder() {
|
|
3225
|
+
|
|
3226
|
+ id, _ := this.GetInt64("id")
|
|
3227
|
+ err := service.DeleteReturnOrder(id)
|
|
3228
|
+ if err == nil {
|
|
3229
|
+ returnData := make(map[string]interface{}, 0)
|
|
3230
|
+ returnData["msg"] = "ok"
|
|
3231
|
+ this.ServeSuccessJSON(returnData)
|
|
3232
|
+ return
|
|
3233
|
+ } else {
|
|
3234
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
3235
|
+ }
|
|
3236
|
+}
|
|
3237
|
+
|
|
3238
|
+func (this *SupplyOrderApiController) DeleteReturnOrderById() {
|
|
3239
|
+
|
|
3240
|
+ id, _ := this.GetInt64("id")
|
|
3241
|
+ err := service.DeleteReturnOrderById(id)
|
|
3242
|
+ if err == nil {
|
|
3243
|
+ returnData := make(map[string]interface{}, 0)
|
|
3244
|
+ returnData["msg"] = "ok"
|
|
3245
|
+ this.ServeSuccessJSON(returnData)
|
|
3246
|
+ return
|
|
3247
|
+ } else {
|
|
3248
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
3249
|
+ }
|
|
3250
|
+}
|
|
3251
|
+
|
|
3252
|
+func (this *SupplyOrderApiController) ModefyReturnOrder() {
|
|
3253
|
+ id, _ := this.GetInt64("id")
|
|
3254
|
+ err := service.ModefyReturnOrder(id)
|
|
3255
|
+ orgId := this.GetAdminUserInfo().CurrentOrgId
|
|
3256
|
+ if err == nil {
|
|
3257
|
+ //获取退库单详情
|
|
3258
|
+ list, _ := service.GetSupplyCancelOrderDetail(id, orgId)
|
|
3259
|
+ for _, item := range list {
|
|
3260
|
+
|
|
3261
|
+ //药品
|
|
3262
|
+ if item.IsSource == 2 {
|
|
3263
|
+
|
|
3264
|
+ }
|
|
3265
|
+ //耗材
|
|
3266
|
+ if item.IsSource == 1 {
|
|
3267
|
+
|
|
3268
|
+ //退库
|
|
3269
|
+ info := models.WarehousingInfo{
|
|
3270
|
+ StockCount: item.Count,
|
|
3271
|
+ }
|
|
3272
|
+ //更改库存
|
|
3273
|
+ err := service.UpdateWarehousingInfoById(item.ProjectId, item.WarehouseInfoId, info)
|
|
3274
|
+ fmt.Println(err)
|
|
3275
|
+ }
|
|
3276
|
+ }
|
|
3277
|
+ } else {
|
|
3278
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
3279
|
+ }
|
|
3280
|
+}
|