|
@@ -1848,6 +1848,9 @@ func BloodHisDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseou
|
1848
|
1848
|
AddDrugCount(advice.DrugId, orgID, storeConfig.DrugStorehouseOut, drugflow.Count)
|
1849
|
1849
|
}
|
1850
|
1850
|
|
|
1851
|
+ fmt.Println("libai", out_count)
|
|
1852
|
+ fmt.Println("cancel", cancel_count)
|
|
1853
|
+ fmt.Println("deliver_number", deliver_number)
|
1851
|
1854
|
if deliver_number < (out_count - cancel_count) {
|
1852
|
1855
|
operation_time := time.Now().Unix()
|
1853
|
1856
|
|
|
@@ -2002,7 +2005,7 @@ func GetSigleDrugWarehouseOutInfoOne(patient_id int64, advice_date int64, orgid
|
2002
|
2005
|
|
2003
|
2006
|
func UpdateSingleDrugWarehouseOutInfoSix(patient_id int64, advice_date int64, orgid int64, info *models.DrugWarehouseOutInfo, advice_id int64) error {
|
2004
|
2007
|
|
2005
|
|
- err := XTWriteDB().Model(&models.XtDrugWarehouseOutInfo{}).Where("patient_id = ? and sys_record_time = ? and org_id = ? and advice_id = ?", patient_id, advice_date, orgid, advice_id).Update(map[string]interface{}{"count": info.Count, "price": info.Price, "total_price": info.TotalPrice, "product_date": info.ProductDate, "expiry_date": info.ExpiryDate, "remark": info.Remark, "dealer": info.Dealer, "manufacturer": info.Manufacturer, "retail_price": info.RetailPrice, "number": info.Number, "batch_number": info.BatchNumber, "count_unit": info.CountUnit, "warehouse_info_id": info.WarehouseInfoId, "storehouse_id": info.StorehouseId}).Error
|
|
2008
|
+ err := XTWriteDB().Model(&models.XtDrugWarehouseOutInfo{}).Where("patient_id = ? and sys_record_time = ? and org_id = ? and advice_id = ? and status= 1", patient_id, advice_date, orgid, advice_id).Update(map[string]interface{}{"count": info.Count, "price": info.Price, "total_price": info.TotalPrice, "product_date": info.ProductDate, "expiry_date": info.ExpiryDate, "remark": info.Remark, "dealer": info.Dealer, "manufacturer": info.Manufacturer, "retail_price": info.RetailPrice, "number": info.Number, "batch_number": info.BatchNumber, "count_unit": info.CountUnit, "warehouse_info_id": info.WarehouseInfoId, "storehouse_id": info.StorehouseId}).Error
|
2006
|
2009
|
return err
|
2007
|
2010
|
}
|
2008
|
2011
|
|
|
@@ -2083,7 +2086,7 @@ func FindDrugCancelStock(return_date int64, org_id int64) (*models.DrugCancelSto
|
2083
|
2086
|
|
2084
|
2087
|
stock := models.DrugCancelStock{}
|
2085
|
2088
|
var err error
|
2086
|
|
- err = XTReadDB().Where("return_date = ? and org_id = ? and status = 1", return_date, org_id).Find(&stock).Error
|
|
2089
|
+ err = XTReadDB().Where("return_time = ? and org_id = ? and status = 1", return_date, org_id).Find(&stock).Error
|
2087
|
2090
|
if err == gorm.ErrRecordNotFound {
|
2088
|
2091
|
return nil, err
|
2089
|
2092
|
}
|
|
@@ -2096,7 +2099,7 @@ func FindDrugCancelStock(return_date int64, org_id int64) (*models.DrugCancelSto
|
2096
|
2099
|
func FindLastDrugCancelStock(advice_date int64, org_id int64) (models.DrugCancelStock, error) {
|
2097
|
2100
|
|
2098
|
2101
|
cancelStock := models.DrugCancelStock{}
|
2099
|
|
- err := XTReadDB().Where("return_date = ? and org_id = ? and status = 1", advice_date, org_id).Find(&cancelStock).Error
|
|
2102
|
+ err := XTReadDB().Where("return_time = ? and org_id = ? and status = 1", advice_date, org_id).Find(&cancelStock).Error
|
2100
|
2103
|
return cancelStock, err
|
2101
|
2104
|
}
|
2102
|
2105
|
|
|
@@ -2127,15 +2130,19 @@ func UpdateHisPrescriptionProjectStatus(project_id int64, record_time int64, use
|
2127
|
2130
|
}
|
2128
|
2131
|
|
2129
|
2132
|
// 药品自动出库 递归方式
|
2130
|
|
-func HisSettleDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseout *models.DrugWarehouseOut, drup *models.BaseDrugLib, advice *models.HisDoctorAdviceInfo) (err error) {
|
|
2133
|
+func HisSettleDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseout *models.DrugWarehouseOut, drup *models.BaseDrugLib, advice *models.HisDoctorAdviceInfo, prescribingCount float64) (err error) {
|
2131
|
2134
|
|
2132
|
2135
|
// 判断处方里药品单位是拆零单位还是包装单位, 如果是包装单位,则根据规格,将包装数量转为拆零数量
|
2133
|
2136
|
var deliver_number int64 = 0
|
|
2137
|
+ var deliver_number_one int64 = 0
|
2134
|
2138
|
var stock_number int64 = 0
|
2135
|
2139
|
|
2136
|
2140
|
prescribingNumber_temp := strconv.FormatFloat(math.Abs(prescribingNumber), 'f', 0, 64)
|
2137
|
2141
|
count, _ := strconv.ParseInt(prescribingNumber_temp, 10, 64)
|
2138
|
2142
|
|
|
2143
|
+ prescribingCount_temp := strconv.FormatFloat(math.Abs(prescribingCount), 'f', 0, 64)
|
|
2144
|
+ prescribe_count, _ := strconv.ParseInt(prescribingCount_temp, 10, 64)
|
|
2145
|
+
|
2139
|
2146
|
var drug_price float64
|
2140
|
2147
|
if advice.PrescribingNumberUnit == drup.MaxUnit {
|
2141
|
2148
|
deliver_number = count * drup.MinNumber
|
|
@@ -2145,6 +2152,14 @@ func HisSettleDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseo
|
2145
|
2152
|
|
2146
|
2153
|
}
|
2147
|
2154
|
|
|
2155
|
+ if advice.PrescribingNumberUnit == drup.MaxUnit {
|
|
2156
|
+ deliver_number_one = prescribe_count * drup.MinNumber
|
|
2157
|
+
|
|
2158
|
+ } else {
|
|
2159
|
+ deliver_number_one = prescribe_count
|
|
2160
|
+
|
|
2161
|
+ }
|
|
2162
|
+
|
2148
|
2163
|
if advice.PrescribingNumberUnit == drup.MaxUnit {
|
2149
|
2164
|
drug_price = drup.RetailPrice
|
2150
|
2165
|
}
|
|
@@ -2162,7 +2177,8 @@ func HisSettleDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseo
|
2162
|
2177
|
// 如果没有对应的库存,则报错
|
2163
|
2178
|
storeConfig, _ := GetAllStoreHouseConfig(advice.UserOrgId)
|
2164
|
2179
|
lastWarehouse, _ := FindLastDrugWarehousingInfoByID(advice.DrugId, storeConfig.DrugStorehouseOut)
|
2165
|
|
- if lastWarehouse.StockMinNumber >= drup.MinNumber {
|
|
2180
|
+
|
|
2181
|
+ if lastWarehouse.StockMinNumber >= drup.MinNumber && lastWarehouse.MaxUnit != lastWarehouse.MinUnit {
|
2166
|
2182
|
var stockMax int64
|
2167
|
2183
|
var stockMin int64
|
2168
|
2184
|
stockMax = lastWarehouse.StockMinNumber / drup.MinNumber
|
|
@@ -2174,7 +2190,6 @@ func HisSettleDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseo
|
2174
|
2190
|
warehouse, err := FindLastDrugWarehousingInfoByID(advice.DrugId, storeConfig.DrugStorehouseOut)
|
2175
|
2191
|
|
2176
|
2192
|
if err != nil {
|
2177
|
|
-
|
2178
|
2193
|
return err
|
2179
|
2194
|
}
|
2180
|
2195
|
// 将该批次的剩余库存数量转换为拆零数量
|
|
@@ -2196,8 +2211,8 @@ func HisSettleDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseo
|
2196
|
2211
|
}
|
2197
|
2212
|
|
2198
|
2213
|
// 当库存数量大于或等于出库数量的话,则正常出库该批次
|
2199
|
|
- fmt.Println("stock_nbumber3223323232", stock_number)
|
2200
|
|
- fmt.Println("deliver_number", deliver_number)
|
|
2214
|
+ fmt.Println("剩余库存2332233223232323", stock_number)
|
|
2215
|
+ fmt.Println("出库数量233232332323232", deliver_number)
|
2201
|
2216
|
if stock_number >= deliver_number {
|
2202
|
2217
|
|
2203
|
2218
|
var maxNumber int64 = 0
|
|
@@ -2235,41 +2250,83 @@ func HisSettleDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseo
|
2235
|
2250
|
|
2236
|
2251
|
warehouse.Mtime = time.Now().Unix()
|
2237
|
2252
|
|
2238
|
|
- fmt.Println("minnU目标而332322323323233223323223我", minNumber)
|
2239
|
|
- fmt.Println("max_number232232332232322wo", maxNumber)
|
2240
|
|
- fmt.Println(" warehouse.StockMinNumber", warehouse.StockMinNumber)
|
|
2253
|
+ //fmt.Println("minnU目标而332322323323233223323223我", minNumber)
|
|
2254
|
+ //fmt.Println("max_number232232332232322wo", maxNumber)
|
|
2255
|
+ //fmt.Println(" warehouse.StockMinNumber", warehouse.StockMinNumber)
|
2241
|
2256
|
|
2242
|
|
- if warehouse.StockMinNumber < minNumber {
|
|
2257
|
+ if warehouse.MaxUnit != warehouse.MinUnit {
|
|
2258
|
+ if warehouse.StockMinNumber < minNumber {
|
2243
|
2259
|
|
2244
|
|
- warehouse.StockMaxNumber = warehouse.StockMaxNumber - 1
|
2245
|
|
- if warehouse.MaxUnit != warehouse.MinUnit {
|
2246
|
|
- warehouse.StockMinNumber = warehouse.StockMinNumber + drup.MinNumber - minNumber
|
2247
|
|
- }
|
2248
|
|
- } else {
|
2249
|
|
- if minNumber > 0 {
|
2250
|
|
- if (warehouse.StockMinNumber - minNumber) >= 0 {
|
2251
|
|
- warehouse.StockMinNumber = warehouse.StockMinNumber - minNumber
|
|
2260
|
+ warehouse.StockMaxNumber = warehouse.StockMaxNumber - 1
|
|
2261
|
+ if warehouse.MaxUnit != warehouse.MinUnit {
|
|
2262
|
+ warehouse.StockMinNumber = warehouse.StockMinNumber + drup.MinNumber - minNumber
|
2252
|
2263
|
}
|
|
2264
|
+ } else {
|
|
2265
|
+ if minNumber > 0 {
|
|
2266
|
+ if (warehouse.StockMinNumber - minNumber) >= 0 {
|
|
2267
|
+ warehouse.StockMinNumber = warehouse.StockMinNumber - minNumber
|
|
2268
|
+ }
|
2253
|
2269
|
|
2254
|
|
- }
|
|
2270
|
+ }
|
2255
|
2271
|
|
2256
|
|
- if minNumber == 0 && maxNumber != 1 && warehouse.StockMaxNumber <= 0 {
|
2257
|
|
- if warehouse.StockMinNumber > 0 {
|
2258
|
|
- if warehouse.StockMinNumber-deliver_number >= 0 {
|
|
2272
|
+ if minNumber == 0 && maxNumber != 1 && warehouse.StockMaxNumber <= 0 {
|
|
2273
|
+ if warehouse.StockMinNumber > 0 {
|
|
2274
|
+ if warehouse.StockMinNumber-deliver_number >= 0 {
|
|
2275
|
+ warehouse.StockMinNumber = warehouse.StockMinNumber - deliver_number
|
|
2276
|
+ }
|
|
2277
|
+
|
|
2278
|
+ }
|
|
2279
|
+
|
|
2280
|
+ }
|
|
2281
|
+
|
|
2282
|
+ if maxNumber == 1 && minNumber == 0 && drup.MaxUnit != drup.MinUnit {
|
|
2283
|
+ if (warehouse.StockMinNumber - deliver_number) >= 0 {
|
2259
|
2284
|
warehouse.StockMinNumber = warehouse.StockMinNumber - deliver_number
|
2260
|
2285
|
}
|
2261
|
2286
|
|
2262
|
2287
|
}
|
2263
|
2288
|
|
2264
|
2289
|
}
|
2265
|
|
-
|
2266
|
2290
|
}
|
2267
|
2291
|
|
2268
|
|
- if maxNumber == 1 && minNumber == 0 && drup.MaxUnit != drup.MinUnit {
|
2269
|
|
- if (warehouse.StockMinNumber - deliver_number) >= 0 {
|
2270
|
|
- warehouse.StockMinNumber = warehouse.StockMinNumber - deliver_number
|
|
2292
|
+ if warehouse.MinUnit == warehouse.MaxUnit {
|
|
2293
|
+ //fmt.Println("minNUMBER233223233223322323",minNumber)
|
|
2294
|
+ //fmt.Println("warehouse.StockMinNumber",warehouse.StockMinNumber)
|
|
2295
|
+ //fmt.Println("warehouse.StockMaxNumber",warehouse.StockMaxNumber)
|
|
2296
|
+ if warehouse.StockMaxNumber > 0 && warehouse.StockMinNumber == 0 && warehouse.StockMaxNumber >= minNumber {
|
|
2297
|
+ warehouse.StockMaxNumber = warehouse.StockMaxNumber - minNumber
|
|
2298
|
+
|
2271
|
2299
|
}
|
2272
|
2300
|
|
|
2301
|
+ if warehouse.StockMaxNumber == 0 && warehouse.StockMinNumber > 0 && warehouse.StockMinNumber >= minNumber {
|
|
2302
|
+ warehouse.StockMinNumber = warehouse.StockMinNumber - minNumber
|
|
2303
|
+ }
|
|
2304
|
+
|
|
2305
|
+ if warehouse.StockMaxNumber > 0 && warehouse.StockMinNumber > 0 && (warehouse.StockMaxNumber+warehouse.StockMinNumber) > minNumber {
|
|
2306
|
+
|
|
2307
|
+ var out_false int64 = 0
|
|
2308
|
+ if warehouse.StockMinNumber >= minNumber {
|
|
2309
|
+ warehouse.StockMinNumber = warehouse.StockMinNumber - minNumber
|
|
2310
|
+ out_false = 1
|
|
2311
|
+ }
|
|
2312
|
+ fmt.Println("out_false233223233223wo", out_false)
|
|
2313
|
+ if warehouse.StockMinNumber < minNumber && out_false == 0 {
|
|
2314
|
+
|
|
2315
|
+ var over_total int64
|
|
2316
|
+ over_total = warehouse.StockMinNumber
|
|
2317
|
+ warehouse.StockMinNumber = 0
|
|
2318
|
+ warehouse.StockMaxNumber = warehouse.StockMaxNumber - (minNumber - over_total)
|
|
2319
|
+ }
|
|
2320
|
+ }
|
|
2321
|
+
|
|
2322
|
+ //if warehouse.StockMaxNumber < minNumber && warehouse.StockMaxNumber < minNumber && (warehouse.StockMaxNumber + warehouse.StockMinNumber) > minNumber {
|
|
2323
|
+ // var over_count int64
|
|
2324
|
+ // over_count = warehouse.StockMinNumber
|
|
2325
|
+ // warehouse.StockMinNumber = 0
|
|
2326
|
+ // warehouse.StockMaxNumber = warehouse.StockMaxNumber - (minNumber -over_count)
|
|
2327
|
+ //
|
|
2328
|
+ //}
|
|
2329
|
+
|
2273
|
2330
|
}
|
2274
|
2331
|
|
2275
|
2332
|
if drup.MaxUnit != drup.MinUnit {
|
|
@@ -2330,7 +2387,7 @@ func HisSettleDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseo
|
2330
|
2387
|
|
2331
|
2388
|
//查询今日该药品该患者是否有出库数据
|
2332
|
2389
|
lastDrugOutInfo, _ := GetNewDrugWarehouseOutInfoSix(advice.DrugId, advice.PatientId, advice.RecordDate, advice.UserOrgId, advice.ID, warehouse.ID)
|
2333
|
|
-
|
|
2390
|
+ fmt.Println("lastDrugOutInfo0000000293293292392392393293239239", lastDrugOutInfo)
|
2334
|
2391
|
if lastDrugOutInfo.ID == 0 {
|
2335
|
2392
|
errOne := AddSigleDrugWarehouseOutInfo(warehouseOutInfo)
|
2336
|
2393
|
if errOne != nil {
|
|
@@ -2345,7 +2402,10 @@ func HisSettleDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseo
|
2345
|
2402
|
if lastDrugOutInfo.CountUnit == drup.MinUnit {
|
2346
|
2403
|
his_count = lastDrugOutInfo.Count
|
2347
|
2404
|
}
|
|
2405
|
+ fmt.Println("deliver_numberwode8888888823832832832832832832823823-------------------------", deliver_number)
|
|
2406
|
+ fmt.Println("his_countnide-------------------------------------------------------", his_count)
|
2348
|
2407
|
if deliver_number != his_count {
|
|
2408
|
+ //warehouseOutInfo.Count = deliver_number_one
|
2349
|
2409
|
errThree := UpdateSigleDrugWarehouseOutInfo(lastDrugOutInfo.ID, warehouseOutInfo)
|
2350
|
2410
|
if errThree != nil {
|
2351
|
2411
|
return errThree
|
|
@@ -2367,11 +2427,11 @@ func HisSettleDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseo
|
2367
|
2427
|
cancel_count += item.Count
|
2368
|
2428
|
}
|
2369
|
2429
|
|
2370
|
|
- fmt.Println("deliver_number", deliver_number)
|
|
2430
|
+ fmt.Println("deliver_number_one", deliver_number)
|
2371
|
2431
|
fmt.Println("out_count", out_count)
|
2372
|
2432
|
fmt.Println("cancel_count", cancel_count)
|
2373
|
2433
|
//如果本次出库数据大于历史出库数据 新增1条流水
|
2374
|
|
- if deliver_number > (out_count - cancel_count) {
|
|
2434
|
+ if deliver_number_one > (out_count - cancel_count) {
|
2375
|
2435
|
drugflow := models.DrugFlow{
|
2376
|
2436
|
WarehouseOutOrderNumber: warehouseout.WarehouseOutOrderNumber,
|
2377
|
2437
|
WarehouseOutId: warehouseout.ID,
|
|
@@ -2379,7 +2439,7 @@ func HisSettleDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseo
|
2379
|
2439
|
Number: warehouse.Number,
|
2380
|
2440
|
ProductDate: warehouse.ProductDate,
|
2381
|
2441
|
ExpireDate: warehouse.ExpiryDate,
|
2382
|
|
- Count: deliver_number - (out_count - cancel_count), //按最小单位计算,
|
|
2442
|
+ Count: deliver_number_one - (out_count - cancel_count), //按最小单位计算,
|
2383
|
2443
|
Price: warehouse.RetailPrice,
|
2384
|
2444
|
Status: 1,
|
2385
|
2445
|
Ctime: time.Now().Unix(),
|
|
@@ -2450,7 +2510,7 @@ func HisSettleDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseo
|
2450
|
2510
|
}
|
2451
|
2511
|
|
2452
|
2512
|
//如果本次出库数据小于历史出库数据 新增1条退库流水
|
2453
|
|
- if deliver_number < (out_count - cancel_count) {
|
|
2513
|
+ if deliver_number_one < (out_count - cancel_count) {
|
2454
|
2514
|
|
2455
|
2515
|
operation_time := time.Now().Unix()
|
2456
|
2516
|
|
|
@@ -2484,9 +2544,9 @@ func HisSettleDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseo
|
2484
|
2544
|
|
2485
|
2545
|
manufactureName, _ := GetManufactureById(warehouse.Manufacturer)
|
2486
|
2546
|
dealer, _ := GetDealerById(warehouse.Dealer)
|
2487
|
|
- cancelInfo, _ := GetLastDrugCancelStockById(advice.UserOrgId)
|
|
2547
|
+ //cancelInfo, _ := GetLastDrugCancelStockById(advice.UserOrgId)
|
2488
|
2548
|
cancelStockInfo := models.DrugCancelStockInfo{
|
2489
|
|
- OrderNumber: cancelInfo.OrderNumber,
|
|
2549
|
+ OrderNumber: lastDrugCancelStock.OrderNumber,
|
2490
|
2550
|
CancelStockId: lastDrugCancelStock.ID,
|
2491
|
2551
|
DrugId: advice.DrugId,
|
2492
|
2552
|
Count: (out_count - cancel_count) - deliver_number,
|
|
@@ -2658,17 +2718,21 @@ func HisSettleDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseo
|
2658
|
2718
|
OrderId: warehouseout.OrderId,
|
2659
|
2719
|
}
|
2660
|
2720
|
//查询是否存在出库数据
|
2661
|
|
- _, errCode := GetSigleDrugWarehouseOutInfo(advice.PatientId, advice.AdviceDate, orgID)
|
2662
|
|
- if errCode == gorm.ErrRecordNotFound {
|
|
2721
|
+
|
|
2722
|
+ lastDrugOutInfoTwo, _ := GetNewDrugWarehouseOutInfoSix(advice.DrugId, advice.PatientId, advice.RecordDate, advice.UserOrgId, advice.ID, warehouse.ID)
|
|
2723
|
+ //_, errCode := GetSigleDrugWarehouseOutInfo(advice.PatientId, advice.AdviceDate, orgID)
|
|
2724
|
+ //fmt.Println("errcoedee232233223233232323232323233223232323322323232323232323",errCode)
|
|
2725
|
+ if lastDrugOutInfoTwo.ID == 0 {
|
2663
|
2726
|
|
2664
|
2727
|
errOne := AddSigleDrugWarehouseOutInfo(warehouseOutInfo)
|
2665
|
2728
|
if errOne != nil {
|
2666
|
2729
|
return errOne
|
2667
|
2730
|
}
|
2668
|
2731
|
}
|
2669
|
|
- if errCode == nil {
|
|
2732
|
+ if lastDrugOutInfoTwo.ID > 0 {
|
2670
|
2733
|
|
2671
|
2734
|
lastDrugOutInfo, _ := GetSigleDrugWarehouseOutInfoOne(advice.PatientId, advice.AdviceDate, orgID)
|
|
2735
|
+ fmt.Println("中国人民肌肤32323223332332232322323喔", lastDrugOutInfo)
|
2672
|
2736
|
var his_count int64
|
2673
|
2737
|
if lastDrugOutInfo.CountUnit == drup.MaxUnit {
|
2674
|
2738
|
his_count = lastDrugOutInfo.Count * drup.MinNumber
|
|
@@ -2676,7 +2740,10 @@ func HisSettleDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseo
|
2676
|
2740
|
if lastDrugOutInfo.CountUnit == drup.MinUnit {
|
2677
|
2741
|
his_count = lastDrugOutInfo.Count
|
2678
|
2742
|
}
|
|
2743
|
+ fmt.Println("deliver_number3232323232wowooww", deliver_number)
|
|
2744
|
+ fmt.Println("his_count99999992i2222wo", his_count)
|
2679
|
2745
|
if deliver_number != his_count {
|
|
2746
|
+
|
2680
|
2747
|
errThree := UpdateSingleDrugWarehouseOutInfoSix(advice.PatientId, advice.AdviceDate, orgID, warehouseOutInfo, advice.ID)
|
2681
|
2748
|
if errThree != nil {
|
2682
|
2749
|
return errThree
|
|
@@ -2727,6 +2794,9 @@ func HisSettleDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseo
|
2727
|
2794
|
cancel_count += item.Count
|
2728
|
2795
|
}
|
2729
|
2796
|
|
|
2797
|
+ fmt.Println("出库数量", deliver_number)
|
|
2798
|
+ fmt.Println("out_coutn233232322323wo", cancel_count)
|
|
2799
|
+ fmt.Println("out_count99988233232", out_count)
|
2730
|
2800
|
//如果本次出库数据大于历史出库数据 新增1条流水
|
2731
|
2801
|
if deliver_number > (out_count - cancel_count) {
|
2732
|
2802
|
|
|
@@ -2768,6 +2838,7 @@ func HisSettleDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseo
|
2768
|
2838
|
}
|
2769
|
2839
|
|
2770
|
2840
|
if deliver_number < (out_count - cancel_count) {
|
|
2841
|
+ fmt.Println("即那里3232232323")
|
2771
|
2842
|
operation_time := time.Now().Unix()
|
2772
|
2843
|
|
2773
|
2844
|
ctime := time.Now().Unix()
|
|
@@ -2880,8 +2951,9 @@ func HisSettleDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseo
|
2880
|
2951
|
|
2881
|
2952
|
advice.PrescribingNumber = float64(prescribingNumber_two_temp)
|
2882
|
2953
|
advice.PrescribingNumberUnit = drup.MinUnit
|
|
2954
|
+ fmt.Println("剩余库存9999999233232", overPlusNumber)
|
2883
|
2955
|
|
2884
|
|
- HisSettleDrugDeliverInfo(orgID, overPlusNumber, warehouseout, drup, advice)
|
|
2956
|
+ HisSettleDrugDeliverInfo(orgID, overPlusNumber, warehouseout, drup, advice, prescribingCount)
|
2885
|
2957
|
}
|
2886
|
2958
|
|
2887
|
2959
|
return
|