|
@@ -2229,10 +2229,10 @@ func (this *SupplyOrderApiController) GetGoodOrderCountList() {
|
2229
|
2229
|
SupplyWarehouseId: id,
|
2230
|
2230
|
}
|
2231
|
2231
|
//查询今日是否存在入库单号
|
2232
|
|
- _, errcode := service.GetSingleDrugWarehouseOrder(record_date, orgId)
|
2233
|
|
- if errcode == gorm.ErrRecordNotFound {
|
2234
|
|
- service.AddSigleDrugWarehouse(&warehousing)
|
2235
|
|
- }
|
|
2232
|
+ //_, errcode := service.GetSingleDrugWarehouseOrder(record_date, orgId)
|
|
2233
|
+ //if errcode == gorm.ErrRecordNotFound {
|
|
2234
|
+ service.AddSigleDrugWarehouse(&warehousing)
|
|
2235
|
+ //}
|
2236
|
2236
|
drugWarehouseInfo, _ := service.GetLastDrugWarehouse(orgId)
|
2237
|
2237
|
|
2238
|
2238
|
warehouseInfoDetailOne := &models.DrugWarehouseInfo{
|
|
@@ -2330,10 +2330,10 @@ func (this *SupplyOrderApiController) GetGoodOrderCountList() {
|
2330
|
2330
|
SupplyWarehouseId: id,
|
2331
|
2331
|
}
|
2332
|
2332
|
//查询是否存在入库单
|
2333
|
|
- _, errcose := service.GetSindleWarehouse(record_date, orgId)
|
2334
|
|
- if errcose == gorm.ErrRecordNotFound {
|
2335
|
|
- service.AddSigleWarehouse(&warehousing)
|
2336
|
|
- }
|
|
2333
|
+ //_, errcose := service.GetSindleWarehouse(record_date, orgId)
|
|
2334
|
+ //if errcose == gorm.ErrRecordNotFound {
|
|
2335
|
+ service.AddSigleWarehouse(&warehousing)
|
|
2336
|
+ //}
|
2337
|
2337
|
info, _ := service.GetLastWarehouseInfoByInfo(orgId)
|
2338
|
2338
|
|
2339
|
2339
|
//入库单表格
|
|
@@ -2369,6 +2369,7 @@ func (this *SupplyOrderApiController) GetGoodOrderCountList() {
|
2369
|
2369
|
|
2370
|
2370
|
for _, item := range warehousingInfo {
|
2371
|
2371
|
service.CreatedWarehouseingDetail(item)
|
|
2372
|
+ service.ModifyGoodAddInformation(item.GoodId, item.StockCount, item.OrgId)
|
2372
|
2373
|
warehousinginfo, _ := service.GetLastWarehousingInfo(item.GoodId)
|
2373
|
2374
|
flow := models.VmStockFlow{
|
2374
|
2375
|
WarehousingOrder: item.WarehousingOrder,
|
|
@@ -2397,9 +2398,18 @@ func (this *SupplyOrderApiController) GetGoodOrderCountList() {
|
2397
|
2398
|
}
|
2398
|
2399
|
//创建入库单
|
2399
|
2400
|
errs := service.CreateDrugWarehousingInfoSix(warehouseInfoDetail)
|
2400
|
|
-
|
2401
|
2401
|
//改变入库状态
|
2402
|
|
-
|
|
2402
|
+ for _, items := range warehouseInfoDetail {
|
|
2403
|
+ medical, _ := service.GetBaseDrugMedical(items.DrugId)
|
|
2404
|
+ if items.MaxUnit == medical.MaxUnit {
|
|
2405
|
+ var sum_count int64
|
|
2406
|
+ sum_count = items.WarehousingCount * medical.MinNumber
|
|
2407
|
+ service.ModifyDrugAddInformation(items.DrugId, sum_count, items.OrgId)
|
|
2408
|
+ }
|
|
2409
|
+ if items.MaxUnit == medical.MinUnit {
|
|
2410
|
+ service.ModifyDrugAddInformation(items.DrugId, items.WarehousingCount, items.OrgId)
|
|
2411
|
+ }
|
|
2412
|
+ }
|
2403
|
2413
|
fmt.Println(errs)
|
2404
|
2414
|
for _, items := range drugFlow {
|
2405
|
2415
|
drugWarehouseInfo, _ := service.GetLastDrugWarehouseInfo(items.DrugId)
|
|
@@ -3116,7 +3126,7 @@ func (this *SupplyOrderApiController) ModefyGoodOrder() {
|
3116
|
3126
|
}
|
3117
|
3127
|
}
|
3118
|
3128
|
if it.IsSource == 2 {
|
3119
|
|
- fmt.Println("hh23323233232232332232323232332", it.WarehouseOutId)
|
|
3129
|
+
|
3120
|
3130
|
out, _ := service.GetGoodWarehouseInfoByWarehousingId(it.ProjectId, id, orgId)
|
3121
|
3131
|
if out.ID > 0 {
|
3122
|
3132
|
this.ServeSuccessJSON(map[string]interface{}{
|
|
@@ -3165,16 +3175,34 @@ func (this *SupplyOrderApiController) ModefyGoodOrder() {
|
3165
|
3175
|
if len(goodList) == 0 {
|
3166
|
3176
|
service.UpdateGoodWarehousing(id, orgId)
|
3167
|
3177
|
}
|
|
3178
|
+
|
|
3179
|
+ // 查询入库单
|
|
3180
|
+ drugInfo, _ := service.GetDrugSupplyWarehouseId(id, orgId)
|
|
3181
|
+ if drugInfo.StockMaxNumber > 0 {
|
|
3182
|
+ medical, _ := service.GetBaseDrugMedical(drugInfo.DrugId)
|
|
3183
|
+ var stock_count int64
|
|
3184
|
+ stock_count = drugInfo.StockMaxNumber * medical.MinNumber
|
|
3185
|
+ service.ModifyDrugReduceInformation(drugInfo.DrugId, stock_count, drugInfo.OrgId)
|
|
3186
|
+ }
|
|
3187
|
+ if drugInfo.StockMinNumber > 0 {
|
|
3188
|
+ service.ModifyDrugReduceInformation(drugInfo.DrugId, drugInfo.StockMinNumber, drugInfo.OrgId)
|
|
3189
|
+ }
|
3168
|
3190
|
//删除药品入库单
|
3169
|
3191
|
service.UpdateDrugSupplyWarehousingInfo(id, orgId)
|
|
3192
|
+
|
3170
|
3193
|
//删除入库流水
|
3171
|
3194
|
service.UpdateDrugSupplyFlow(id, orgId)
|
3172
|
3195
|
|
|
3196
|
+ //查寻入库单
|
|
3197
|
+ info, _ := service.GetSupplySupplyWarehouseId(id, orgId)
|
|
3198
|
+ //扣减库存
|
|
3199
|
+ service.ModifyGoodReduceInformation(info.GoodId, info.StockCount, info.OrgId)
|
3173
|
3200
|
//删除耗材入库单
|
3174
|
3201
|
service.UpdateGoodSupplyWarehousingInfo(id, orgId)
|
3175
|
3202
|
|
3176
|
3203
|
//删除耗材入库流水
|
3177
|
3204
|
service.UpdateGoodSupplyFlow(id, orgId)
|
|
3205
|
+
|
3178
|
3206
|
if err == nil {
|
3179
|
3207
|
this.ServeSuccessJSON(map[string]interface{}{
|
3180
|
3208
|
"cancelList": cancelList,
|
|
@@ -3293,7 +3321,7 @@ func (this *SupplyOrderApiController) CheckReturnOrder() {
|
3293
|
3321
|
//获取退库单详情
|
3294
|
3322
|
list, _ := service.GetSupplyCancelOrderDetail(id, orgId)
|
3295
|
3323
|
for _, item := range list {
|
3296
|
|
- fmt.Println("itme.233232323232323232323232323232232332", item.Type)
|
|
3324
|
+
|
3297
|
3325
|
var total_count int64
|
3298
|
3326
|
var prescribing_number_total int64
|
3299
|
3327
|
//药品
|