|
@@ -7457,7 +7457,7 @@ func ConsumablesDeliveryTotal(orgID int64, patient_id int64, record_time int64,
|
7457
|
7457
|
return nil
|
7458
|
7458
|
}
|
7459
|
7459
|
|
7460
|
|
-//耗材出库
|
|
7460
|
+// 耗材出库
|
7461
|
7461
|
func ConsumablesDelivery(orgID int64, patient_id int64, record_time int64, goods *models.DialysisBeforePrepare, warehouseOut *models.WarehouseOut, count int64) (err error) {
|
7462
|
7462
|
|
7463
|
7463
|
//开事务
|
|
@@ -7918,7 +7918,7 @@ func ConsumablesDelivery(orgID int64, patient_id int64, record_time int64, goods
|
7918
|
7918
|
return nil
|
7919
|
7919
|
}
|
7920
|
7920
|
|
7921
|
|
-//耗材出库删除
|
|
7921
|
+// 耗材出库删除
|
7922
|
7922
|
func ConsumablesDeliveryDelete(orgID int64, patient_id int64, record_time int64, good_yc *models.DialysisBeforePrepare, warehouseOut *models.WarehouseOut) (err error) {
|
7923
|
7923
|
|
7924
|
7924
|
// 先根据相关信息查询当天该耗材的出库信息
|
|
@@ -8049,7 +8049,7 @@ func GetWarehouseById(id int64) (models.WarehouseOut, error) {
|
8049
|
8049
|
return out, err
|
8050
|
8050
|
}
|
8051
|
8051
|
|
8052
|
|
-//耗材出库
|
|
8052
|
+// 耗材出库
|
8053
|
8053
|
func ConsumablesDeliveryOne(orgID int64, record_time int64, goods *models.WarehouseOutInfo, warehouseOut *models.WarehouseOut, count int64, creator int64) (err error) {
|
8054
|
8054
|
|
8055
|
8055
|
////开事务
|
|
@@ -8298,7 +8298,7 @@ func ConsumablesDeliveryOne(orgID int64, record_time int64, goods *models.Wareho
|
8298
|
8298
|
return nil
|
8299
|
8299
|
}
|
8300
|
8300
|
|
8301
|
|
-//退库逻辑
|
|
8301
|
+// 退库逻辑
|
8302
|
8302
|
func ConsumablesDeliveryTwo(orgID int64, goods *models.WarehouseOutInfo, count int64) (err error) {
|
8303
|
8303
|
|
8304
|
8304
|
////开事务
|
|
@@ -9354,7 +9354,7 @@ func HisAuToReduce(orgID int64, prescribingNumber float64, warehouseout *models.
|
9354
|
9354
|
return
|
9355
|
9355
|
}
|
9356
|
9356
|
|
9357
|
|
-//采购管理耗材出库逻辑
|
|
9357
|
+// 采购管理耗材出库逻辑
|
9358
|
9358
|
func ConsumablesDeliveryNight(orgID int64, record_time int64, goods *models.WarehouseOutInfo, warehouseOut *models.WarehouseOut, count int64, creator int64, warehouse_out_id int64, cancel_out_id int64) (err error) {
|
9359
|
9359
|
|
9360
|
9360
|
var deliver_number int64 = 0
|
|
@@ -9858,7 +9858,7 @@ func AutoDrugDeliverInfoNight(orgID int64, prescribingNumber int64, warehouseout
|
9858
|
9858
|
return
|
9859
|
9859
|
}
|
9860
|
9860
|
|
9861
|
|
-//调拨出库逻辑
|
|
9861
|
+// 调拨出库逻辑
|
9862
|
9862
|
func ConsumablesDeliveryTwelve(orgID int64, record_time int64, goods *models.WarehouseOutInfo, warehouseOut *models.WarehouseOut, count int64, creator int64, warehouseInfo *models.WarehousingInfo) (err error) {
|
9863
|
9863
|
|
9864
|
9864
|
var deliver_number int64 = 0
|
|
@@ -9880,11 +9880,16 @@ func ConsumablesDeliveryTwelve(orgID int64, record_time int64, goods *models.War
|
9880
|
9880
|
|
9881
|
9881
|
maxNumber = goods.Count
|
9882
|
9882
|
|
9883
|
|
- if warehouse.StockCount < maxNumber {
|
9884
|
|
- return errors.New("库存数量不足")
|
|
9883
|
+ //if warehouse.StockCount < maxNumber {
|
|
9884
|
+ // return errors.New("库存数量不足")
|
|
9885
|
+ //}
|
|
9886
|
+
|
|
9887
|
+ if warehouse.StockCount-maxNumber > 0 {
|
|
9888
|
+ warehouse.StockCount = warehouse.StockCount - maxNumber
|
|
9889
|
+ } else {
|
|
9890
|
+ warehouse.StockCount = warehouse.StockCount
|
9885
|
9891
|
}
|
9886
|
9892
|
|
9887
|
|
- warehouse.StockCount = warehouse.StockCount - maxNumber
|
9888
|
9893
|
warehouse.Mtime = time.Now().Unix()
|
9889
|
9894
|
|
9890
|
9895
|
//扣减库存
|
|
@@ -10090,7 +10095,7 @@ func ConsumablesDeliveryTwelve(orgID int64, record_time int64, goods *models.War
|
10090
|
10095
|
IsCheck: 1,
|
10091
|
10096
|
OverCount: sum_count,
|
10092
|
10097
|
}
|
10093
|
|
- warehouseOutInfo.Count = warehouse.StockCount
|
|
10098
|
+ warehouseOutInfo.Count = stock_number
|
10094
|
10099
|
|
10095
|
10100
|
//查询是否已经生成出库单
|
10096
|
10101
|
info, errcodes := GetStockInRecoredByGoodIdOne(goods.GoodId, goods.GoodTypeId, goods.SysRecordTime, goods.OrgId)
|
|
@@ -10111,7 +10116,7 @@ func ConsumablesDeliveryTwelve(orgID int64, record_time int64, goods *models.War
|
10111
|
10116
|
GoodId: goods.GoodId,
|
10112
|
10117
|
Number: warehouse.Number,
|
10113
|
10118
|
LicenseNumber: goods.LicenseNumber,
|
10114
|
|
- Count: warehouse.StockCount,
|
|
10119
|
+ Count: stock_number,
|
10115
|
10120
|
UserOrgId: goods.OrgId,
|
10116
|
10121
|
PatientId: 0,
|
10117
|
10122
|
SystemTime: record_time,
|
|
@@ -10154,7 +10159,7 @@ func ConsumablesDeliveryTwelve(orgID int64, record_time int64, goods *models.War
|
10154
|
10159
|
GoodTypeId: warehouse.GoodTypeId,
|
10155
|
10160
|
ProductDate: warehouse.ProductDate,
|
10156
|
10161
|
ExpiryDate: warehouse.ExpiryDate,
|
10157
|
|
- WarehousingCount: warehouse.StockCount,
|
|
10162
|
+ WarehousingCount: stock_number,
|
10158
|
10163
|
Price: warehouse.Price,
|
10159
|
10164
|
TotalPrice: 0,
|
10160
|
10165
|
Status: 1,
|
|
@@ -10163,7 +10168,7 @@ func ConsumablesDeliveryTwelve(orgID int64, record_time int64, goods *models.War
|
10163
|
10168
|
OrgId: warehouse.OrgId,
|
10164
|
10169
|
Type: 1,
|
10165
|
10170
|
Manufacturer: warehouse.Manufacturer,
|
10166
|
|
- StockCount: warehouse.StockCount,
|
|
10171
|
+ StockCount: stock_number,
|
10167
|
10172
|
Dealer: warehouse.Dealer,
|
10168
|
10173
|
LicenseNumber: "",
|
10169
|
10174
|
PackingPrice: warehouse.PackingPrice,
|
|
@@ -10179,7 +10184,7 @@ func ConsumablesDeliveryTwelve(orgID int64, record_time int64, goods *models.War
|
10179
|
10184
|
GoodId: goods.GoodId,
|
10180
|
10185
|
Number: warehouse.Number,
|
10181
|
10186
|
LicenseNumber: goods.LicenseNumber,
|
10182
|
|
- Count: warehouse.StockCount,
|
|
10187
|
+ Count: stock_number,
|
10183
|
10188
|
UserOrgId: goods.OrgId,
|
10184
|
10189
|
PatientId: goods.PatientId,
|
10185
|
10190
|
SystemTime: record_time,
|
|
@@ -10283,12 +10288,16 @@ func AutoDrugDeliverInfoTwelve(orgID int64, prescribingNumber int64, warehouseou
|
10283
|
10288
|
|
10284
|
10289
|
//fmt.Println("warehouse.StockMaxNumber",warehouse.StockMaxNumber)
|
10285
|
10290
|
//fmt.Println("maxNumber9899923323232wo",maxNumber)
|
10286
|
|
- if warehouse.StockMaxNumber < maxNumber {
|
10287
|
10291
|
|
10288
|
|
- return errors.New("库存数量不足")
|
|
10292
|
+ //if warehouse.StockMaxNumber < maxNumber {
|
|
10293
|
+ //
|
|
10294
|
+ // return errors.New("库存数量不足")
|
|
10295
|
+ //}
|
|
10296
|
+
|
|
10297
|
+ if warehouse.StockMaxNumber-maxNumber > 0 {
|
|
10298
|
+ warehouse.StockMaxNumber = warehouse.StockMaxNumber - maxNumber
|
10289
|
10299
|
}
|
10290
|
10300
|
|
10291
|
|
- warehouse.StockMaxNumber = warehouse.StockMaxNumber - maxNumber
|
10292
|
10301
|
warehouse.Mtime = time.Now().Unix()
|
10293
|
10302
|
|
10294
|
10303
|
if warehouse.StockMinNumber < minNumber {
|
|
@@ -11286,7 +11295,7 @@ func AutoDrugDeliverInfoTwentyOne(orgID int64, prescribingNumber int64, warehous
|
11286
|
11295
|
return
|
11287
|
11296
|
}
|
11288
|
11297
|
|
11289
|
|
-//耗材手动出库
|
|
11298
|
+// 耗材手动出库
|
11290
|
11299
|
func ConsumablesDeliveryThirty(orgID int64, record_time int64, goods *models.WarehouseOutInfo, warehouseOut *models.WarehouseOut, count int64, creator int64) (err error) {
|
11291
|
11300
|
|
11292
|
11301
|
var deliver_number int64 = 0
|
|
@@ -12205,7 +12214,7 @@ func FindDrugWarehouseInfoFlushCountByStorehouse(drug_id int64, orgid int64, sto
|
12205
|
12214
|
return info, err
|
12206
|
12215
|
}
|
12207
|
12216
|
|
12208
|
|
-//结算出库
|
|
12217
|
+// 结算出库
|
12209
|
12218
|
func HisSettleDrugsDelivery(orgID int64, creater int64, advice *models.HisDoctorAdviceInfo, order_id int64) (err error) {
|
12210
|
12219
|
|
12211
|
12220
|
// 1.判断药品是否来自专用字典的药品库
|
|
@@ -12286,7 +12295,7 @@ func HisSettleDrugsDelivery(orgID int64, creater int64, advice *models.HisDoctor
|
12286
|
12295
|
return
|
12287
|
12296
|
}
|
12288
|
12297
|
|
12289
|
|
-//耗材结算出库
|
|
12298
|
+// 耗材结算出库
|
12290
|
12299
|
func ConsumableSettleDelivery(orgID int64, patient_id int64, record_time int64, goods *models.DialysisBeforePrepare, warehouseOut *models.WarehouseOut, creator int64, order_id int64) (err error) {
|
12291
|
12300
|
|
12292
|
12301
|
var deliver_number int64 = 0
|
|
@@ -12713,7 +12722,7 @@ func ConsumableSettleDelivery(orgID int64, patient_id int64, record_time int64,
|
12713
|
12722
|
return nil
|
12714
|
12723
|
}
|
12715
|
12724
|
|
12716
|
|
-//保存处方出库
|
|
12725
|
+// 保存处方出库
|
12717
|
12726
|
func ConsumablePrescriptionDelivery(orgID int64, patient_id int64, record_time int64, goods *models.DialysisBeforePrepare, warehouseOut *models.WarehouseOut, creator int64, count int64) (err error) {
|
12718
|
12727
|
|
12719
|
12728
|
var deliver_number int64 = 0
|