|
@@ -580,19 +580,8 @@ func HisDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseout *mo
|
580
|
580
|
var maxNumber int64 = 0
|
581
|
581
|
var minNumber int64 = 0
|
582
|
582
|
|
583
|
|
- //fmt.Println("deliver_number23332323232333232323233232323232",deliver_number)
|
584
|
583
|
maxNumber = deliver_number / drup.MinNumber
|
585
|
|
-
|
586
|
|
- if deliver_number <= drup.MinNumber {
|
587
|
|
- minNumber = deliver_number % drup.MinNumber
|
588
|
|
- } else {
|
589
|
|
- minNumber = deliver_number
|
590
|
|
- }
|
591
|
|
-
|
592
|
|
- if deliver_number <= drup.MinNumber && warehouse.StockMaxNumber == 0 {
|
593
|
|
- minNumber = deliver_number
|
594
|
|
- }
|
595
|
|
-
|
|
584
|
+ minNumber = deliver_number % drup.MinNumber
|
596
|
585
|
if warehouse.StockMaxNumber == 0 && drup.MaxUnit == drup.MinUnit {
|
597
|
586
|
minNumber = maxNumber
|
598
|
587
|
}
|
|
@@ -604,21 +593,21 @@ func HisDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseout *mo
|
604
|
593
|
}
|
605
|
594
|
|
606
|
595
|
warehouse.StockMaxNumber = warehouse.StockMaxNumber - maxNumber
|
607
|
|
- //fmt.Println("最大单位23323232323232332323233232323",warehouse.StockMaxNumber)
|
|
596
|
+
|
608
|
597
|
if warehouse.StockMaxNumber < 0 {
|
609
|
598
|
warehouse.StockMaxNumber = 0
|
610
|
599
|
}
|
|
600
|
+ if warehouse.StockMinNumber < 0 {
|
|
601
|
+ warehouse.StockMinNumber = 0
|
|
602
|
+ }
|
611
|
603
|
|
612
|
604
|
warehouse.Mtime = time.Now().Unix()
|
613
|
|
- //fmt.Println("最小单位2323223233232233233232323232323323232",warehouse.StockMinNumber)
|
614
|
|
- //fmt.Println("最小换算量233232332322323322332323232332323223",minNumber)
|
|
605
|
+
|
615
|
606
|
if warehouse.StockMinNumber < minNumber {
|
616
|
607
|
warehouse.StockMaxNumber = warehouse.StockMaxNumber - 1
|
617
|
608
|
warehouse.StockMinNumber = warehouse.StockMinNumber + drup.MinNumber - minNumber
|
618
|
609
|
} else {
|
619
|
|
- //fmt.Println("hhhhhhhhhhhhhhhhhhhhhhhhh",warehouse.StockMinNumber,minNumber)
|
620
|
610
|
warehouse.StockMinNumber = warehouse.StockMinNumber - minNumber
|
621
|
|
- //fmt.Println("我的魏2232332322323323",warehouse.StockMinNumber)
|
622
|
611
|
}
|
623
|
612
|
|
624
|
613
|
if drup.MaxUnit != drup.MinUnit {
|
|
@@ -1054,6 +1043,7 @@ func ConsumablesDeliveryTotal(orgID int64, patient_id int64, record_time int64,
|
1054
|
1043
|
GoodTypeId: item.GoodTypeId,
|
1055
|
1044
|
GoodId: item.GoodId,
|
1056
|
1045
|
Count: item.Count,
|
|
1046
|
+ ProjectId: item.ProjectId,
|
1057
|
1047
|
}
|
1058
|
1048
|
|
1059
|
1049
|
ConsumablesDelivery(orgID, patient_id, record_time, &prepare, &out, newCount)
|
|
@@ -1116,6 +1106,7 @@ func ConsumablesDelivery(orgID int64, patient_id int64, record_time int64, goods
|
1116
|
1106
|
Price: info.PackingPrice,
|
1117
|
1107
|
ExpiryDate: warehouse.ExpiryDate,
|
1118
|
1108
|
ProductDate: warehouse.ProductDate,
|
|
1109
|
+ ProjectId: goods.ProjectId,
|
1119
|
1110
|
}
|
1120
|
1111
|
warehouseOutInfo.Count = count
|
1121
|
1112
|
|
|
@@ -1141,6 +1132,7 @@ func ConsumablesDelivery(orgID int64, patient_id int64, record_time int64, goods
|
1141
|
1132
|
GoodId: goods.GoodId,
|
1142
|
1133
|
GoodTypeId: goods.GoodTypeId,
|
1143
|
1134
|
Count: count,
|
|
1135
|
+ ProjectId: goods.ProjectId,
|
1144
|
1136
|
}
|
1145
|
1137
|
//查询当天耗材是否已经存在数据
|
1146
|
1138
|
_, errcode := GetAutoMaticReduceDetail(orgID, patient_id, record_time, goods.GoodId, goods.GoodTypeId)
|
|
@@ -1174,6 +1166,7 @@ func ConsumablesDelivery(orgID int64, patient_id int64, record_time int64, goods
|
1174
|
1166
|
WarehouseOutOrderNumber: warehouseOut.WarehouseOutOrderNumber,
|
1175
|
1167
|
IsSys: 1,
|
1176
|
1168
|
PatientId: patient_id,
|
|
1169
|
+ ProjectId: goods.ProjectId,
|
1177
|
1170
|
}
|
1178
|
1171
|
//查询流水是否存在
|
1179
|
1172
|
exsit, errflow := GetStockFlowIsExsit(warehouse.ID, patient_id, record_time, goods.GoodId)
|
|
@@ -1209,6 +1202,7 @@ func ConsumablesDelivery(orgID int64, patient_id int64, record_time int64, goods
|
1209
|
1202
|
IsSys: 1,
|
1210
|
1203
|
PatientId: patient_id,
|
1211
|
1204
|
ReturnCount: exsit.Count + (exsit.Count + deliver_number),
|
|
1205
|
+ ProjectId: goods.ProjectId,
|
1212
|
1206
|
}
|
1213
|
1207
|
|
1214
|
1208
|
errFour := UpdatedStockFlowOne(flow, warehouse.ID, patient_id, record_time, goods.GoodId)
|
|
@@ -1241,6 +1235,7 @@ func ConsumablesDelivery(orgID int64, patient_id int64, record_time int64, goods
|
1241
|
1235
|
WarehouseOutOrderNumber: warehouseOut.WarehouseOutOrderNumber,
|
1242
|
1236
|
IsSys: 1,
|
1243
|
1237
|
PatientId: patient_id,
|
|
1238
|
+ ProjectId: goods.ProjectId,
|
1244
|
1239
|
}
|
1245
|
1240
|
//查询流水是否存在
|
1246
|
1241
|
exsit, errflow := GetStockFlowIsExsit(warehouse.ID, patient_id, record_time, goods.GoodId)
|
|
@@ -1275,6 +1270,7 @@ func ConsumablesDelivery(orgID int64, patient_id int64, record_time int64, goods
|
1275
|
1270
|
IsSys: 1,
|
1276
|
1271
|
PatientId: patient_id,
|
1277
|
1272
|
ReturnCount: exsit.Count + (exsit.Count + deliver_number),
|
|
1273
|
+ ProjectId: goods.ProjectId,
|
1278
|
1274
|
}
|
1279
|
1275
|
//UpdatedStockFlow(flow)
|
1280
|
1276
|
UpdatedStockFlowOne(flow, warehouse.ID, patient_id, record_time, goods.GoodId)
|
|
@@ -1327,6 +1323,7 @@ func ConsumablesDelivery(orgID int64, patient_id int64, record_time int64, goods
|
1327
|
1323
|
Price: info.PackingPrice,
|
1328
|
1324
|
ExpiryDate: warehouse.ExpiryDate,
|
1329
|
1325
|
ProductDate: warehouse.ProductDate,
|
|
1326
|
+ ProjectId: goods.ProjectId,
|
1330
|
1327
|
}
|
1331
|
1328
|
warehouseOutInfo.Count = stock_number
|
1332
|
1329
|
|
|
@@ -1362,6 +1359,7 @@ func ConsumablesDelivery(orgID int64, patient_id int64, record_time int64, goods
|
1362
|
1359
|
WarehouseOutOrderNumber: warehouseOut.WarehouseOutOrderNumber,
|
1363
|
1360
|
IsSys: 1,
|
1364
|
1361
|
PatientId: patient_id,
|
|
1362
|
+ ProjectId: goods.ProjectId,
|
1365
|
1363
|
}
|
1366
|
1364
|
//查询流水是否存在
|
1367
|
1365
|
exsit, errflows := GetStockFlowIsExsit(warehouse.ID, patient_id, record_time, goods.GoodId)
|
|
@@ -1394,6 +1392,7 @@ func ConsumablesDelivery(orgID int64, patient_id int64, record_time int64, goods
|
1394
|
1392
|
IsSys: 1,
|
1395
|
1393
|
PatientId: patient_id,
|
1396
|
1394
|
ReturnCount: exsit.Count + (exsit.Count + deliver_number),
|
|
1395
|
+ ProjectId: goods.ProjectId,
|
1397
|
1396
|
}
|
1398
|
1397
|
//UpdatedStockFlow(flow)
|
1399
|
1398
|
UpdatedStockFlowOne(flow, warehouse.ID, patient_id, record_time, goods.GoodId)
|
|
@@ -1429,6 +1428,7 @@ func ConsumablesDelivery(orgID int64, patient_id int64, record_time int64, goods
|
1429
|
1428
|
WarehouseOutOrderNumber: warehouseOut.WarehouseOutOrderNumber,
|
1430
|
1429
|
IsSys: 1,
|
1431
|
1430
|
PatientId: patient_id,
|
|
1431
|
+ ProjectId: goods.ProjectId,
|
1432
|
1432
|
}
|
1433
|
1433
|
//查询流水是否存在
|
1434
|
1434
|
exsit, errflows := GetStockFlowIsExsit(warehouse.ID, patient_id, record_time, goods.GoodId)
|
|
@@ -1460,6 +1460,7 @@ func ConsumablesDelivery(orgID int64, patient_id int64, record_time int64, goods
|
1460
|
1460
|
WarehouseOutOrderNumber: warehouseOut.WarehouseOutOrderNumber,
|
1461
|
1461
|
IsSys: 1,
|
1462
|
1462
|
PatientId: patient_id,
|
|
1463
|
+ ProjectId: goods.ProjectId,
|
1463
|
1464
|
}
|
1464
|
1465
|
//UpdatedStockFlow(flow)
|
1465
|
1466
|
UpdatedStockFlowOne(flow, warehouse.ID, patient_id, record_time, goods.GoodId)
|