|
@@ -1109,7 +1109,7 @@ func (c *HisApiController) CreateHisPrescription() {
|
1109
|
1109
|
return
|
1110
|
1110
|
}
|
1111
|
1111
|
|
1112
|
|
- if adminInfo.CurrentOrgId == 10215 || adminInfo.CurrentOrgId == 10164 || adminInfo.CurrentOrgId == 3877 || adminInfo.CurrentOrgId == 9671 {
|
|
1112
|
+ if adminInfo.CurrentOrgId == 10215 || adminInfo.CurrentOrgId == 10164 || adminInfo.CurrentOrgId == 3877 {
|
1113
|
1113
|
if prescribing_number > batch_number_all_count {
|
1114
|
1114
|
c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
|
1115
|
1115
|
return
|
|
@@ -1126,7 +1126,7 @@ func (c *HisApiController) CreateHisPrescription() {
|
1126
|
1126
|
c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
|
1127
|
1127
|
return
|
1128
|
1128
|
}
|
1129
|
|
- if adminInfo.CurrentOrgId == 10215 || adminInfo.CurrentOrgId == 10164 || adminInfo.CurrentOrgId == 3877 || adminInfo.CurrentOrgId == 9671 {
|
|
1129
|
+ if adminInfo.CurrentOrgId == 10215 || adminInfo.CurrentOrgId == 10164 || adminInfo.CurrentOrgId == 3877 {
|
1130
|
1130
|
if num > batch_number_all_count {
|
1131
|
1131
|
c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
|
1132
|
1132
|
return
|
|
@@ -1195,7 +1195,7 @@ func (c *HisApiController) CreateHisPrescription() {
|
1195
|
1195
|
c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
|
1196
|
1196
|
return
|
1197
|
1197
|
}
|
1198
|
|
- if adminInfo.CurrentOrgId == 10215 || adminInfo.CurrentOrgId == 10164 || adminInfo.CurrentOrgId == 3877 || adminInfo.CurrentOrgId == 9671 {
|
|
1198
|
+ if adminInfo.CurrentOrgId == 10215 || adminInfo.CurrentOrgId == 10164 || adminInfo.CurrentOrgId == 3877 {
|
1199
|
1199
|
if prescribing_number > batch_number_all_count {
|
1200
|
1200
|
c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
|
1201
|
1201
|
return
|
|
@@ -1213,7 +1213,7 @@ func (c *HisApiController) CreateHisPrescription() {
|
1213
|
1213
|
c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
|
1214
|
1214
|
return
|
1215
|
1215
|
}
|
1216
|
|
- if adminInfo.CurrentOrgId == 10215 || adminInfo.CurrentOrgId == 10164 || adminInfo.CurrentOrgId == 3877 || adminInfo.CurrentOrgId == 9671 {
|
|
1216
|
+ if adminInfo.CurrentOrgId == 10215 || adminInfo.CurrentOrgId == 10164 || adminInfo.CurrentOrgId == 3877 {
|
1217
|
1217
|
if prescribing_number > batch_number_all_count {
|
1218
|
1218
|
c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
|
1219
|
1219
|
return
|
|
@@ -2563,89 +2563,164 @@ func (c *HisApiController) DeletePrescription() {
|
2563
|
2563
|
manufacturer, _ := service.GetManufactureById(info.Manufacturer)
|
2564
|
2564
|
deaerler, _ := service.GetDealerById(info.Dealer)
|
2565
|
2565
|
|
2566
|
|
- //查询今日该患者开了多少耗材
|
2567
|
|
- //projectList, _ := service.GetHisPrepscritionByPatientId(info.PatientId, item.ProjectId, info.SysRecordTime)
|
2568
|
|
- //
|
2569
|
2566
|
var total_count int64
|
2570
|
|
- //var cha_count int64
|
2571
|
|
- //for _, item := range projectList {
|
2572
|
|
- // count, _ := strconv.ParseInt(item.Count, 10, 64)
|
2573
|
|
- // total_count += count
|
2574
|
|
- //}
|
2575
|
2567
|
count, _ := strconv.ParseInt(item.Count, 10, 64)
|
2576
|
2568
|
total_count += count
|
2577
|
|
- //回退库存
|
2578
|
|
- service.UpDateWarehouseInfoByStockDelete(info.WarehouseInfotId, total_count, info.PatientId, info.SysRecordTime, item.ProjectId)
|
|
2569
|
+
|
2579
|
2570
|
goodList, _ := service.GetSumGoodList(c.GetAdminUserInfo().CurrentOrgId, houseConfig.StorehouseOutInfo, item.ProjectId)
|
2580
|
2571
|
var flush_count int64
|
2581
|
2572
|
for _, it := range goodList {
|
2582
|
2573
|
flush_count += it.StockCount
|
2583
|
2574
|
}
|
2584
|
2575
|
if info.ID > 0 {
|
2585
|
|
- cancelStockInfo := models.CancelStockInfo{
|
2586
|
|
- GoodId: item.ProjectId,
|
2587
|
|
- CancelStockId: cancel.ID,
|
2588
|
|
- GoodTypeId: good.GoodTypeId,
|
2589
|
|
- Count: prescribingNumber,
|
2590
|
|
- Price: info.Price,
|
2591
|
|
- Total: 0,
|
2592
|
|
- ProductDate: info.ProductDate,
|
2593
|
|
- ExpiryDate: info.ExpiryDate,
|
2594
|
|
- Ctime: time.Now().Unix(),
|
2595
|
|
- Status: 1,
|
2596
|
|
- OrgId: c.GetAdminUserInfo().CurrentOrgId,
|
2597
|
|
- OrderNumber: cancel.OrderNumber,
|
2598
|
|
- Type: 0,
|
2599
|
|
- Dealer: deaerler.DealerName,
|
2600
|
|
- Manufacturer: manufacturer.ManufacturerName,
|
2601
|
|
- Number: info.Number,
|
2602
|
|
- RegisterAccount: "",
|
2603
|
|
- Remark: "",
|
2604
|
|
- WarehouseInfoId: info.WarehouseInfotId,
|
2605
|
|
- PatientId: info.PatientId,
|
2606
|
|
- RecordDate: info.SysRecordTime,
|
2607
|
|
- StorehouseId: houseConfig.StorehouseOutInfo,
|
2608
|
|
- IsCheck: 1,
|
|
2576
|
+ if info.Count >= total_count {
|
|
2577
|
+
|
|
2578
|
+ //回退库存
|
|
2579
|
+ service.UpDateWarehouseInfoByStockDelete(info.WarehouseInfotId, total_count, info.PatientId, info.SysRecordTime, item.ProjectId)
|
|
2580
|
+ cancelStockInfo := models.CancelStockInfo{
|
|
2581
|
+ GoodId: item.ProjectId,
|
|
2582
|
+ CancelStockId: cancel.ID,
|
|
2583
|
+ GoodTypeId: good.GoodTypeId,
|
|
2584
|
+ Count: prescribingNumber,
|
|
2585
|
+ Price: info.Price,
|
|
2586
|
+ Total: 0,
|
|
2587
|
+ ProductDate: info.ProductDate,
|
|
2588
|
+ ExpiryDate: info.ExpiryDate,
|
|
2589
|
+ Ctime: time.Now().Unix(),
|
|
2590
|
+ Status: 1,
|
|
2591
|
+ OrgId: c.GetAdminUserInfo().CurrentOrgId,
|
|
2592
|
+ OrderNumber: cancel.OrderNumber,
|
|
2593
|
+ Type: 0,
|
|
2594
|
+ Dealer: deaerler.DealerName,
|
|
2595
|
+ Manufacturer: manufacturer.ManufacturerName,
|
|
2596
|
+ Number: info.Number,
|
|
2597
|
+ RegisterAccount: "",
|
|
2598
|
+ Remark: "",
|
|
2599
|
+ WarehouseInfoId: info.WarehouseInfotId,
|
|
2600
|
+ PatientId: info.PatientId,
|
|
2601
|
+ RecordDate: info.SysRecordTime,
|
|
2602
|
+ StorehouseId: houseConfig.StorehouseOutInfo,
|
|
2603
|
+ IsCheck: 1,
|
|
2604
|
+ }
|
|
2605
|
+
|
|
2606
|
+ service.CreateCancelStockInfoOne(&cancelStockInfo)
|
|
2607
|
+
|
|
2608
|
+ cancelInfo, _ := service.GetLastCancelStockInfoByGoodId(item.ProjectId)
|
|
2609
|
+
|
|
2610
|
+ flow := models.VmStockFlow{
|
|
2611
|
+ WarehousingId: info.WarehouseInfotId,
|
|
2612
|
+ GoodId: item.ProjectId,
|
|
2613
|
+ Number: info.Number,
|
|
2614
|
+ LicenseNumber: info.LicenseNumber,
|
|
2615
|
+ Count: prescribingNumber,
|
|
2616
|
+ UserOrgId: c.GetAdminUserInfo().CurrentOrgId,
|
|
2617
|
+ PatientId: item.PatientId,
|
|
2618
|
+ SystemTime: info.SysRecordTime,
|
|
2619
|
+ ConsumableType: 7,
|
|
2620
|
+ IsSys: 0,
|
|
2621
|
+ WarehousingOrder: "",
|
|
2622
|
+ WarehouseOutId: info.WarehouseOutId,
|
|
2623
|
+ WarehouseOutOrderNumber: info.WarehouseOutOrderNumber,
|
|
2624
|
+ IsEdit: 0,
|
|
2625
|
+ CancelStockId: cancel.ID,
|
|
2626
|
+ CancelOrderNumber: cancel.OrderNumber,
|
|
2627
|
+ Manufacturer: manufacturer.ID,
|
|
2628
|
+ Dealer: 0,
|
|
2629
|
+ Creator: c.GetAdminUserInfo().CurrentOrgId,
|
|
2630
|
+ UpdateCreator: 0,
|
|
2631
|
+ Status: 1,
|
|
2632
|
+ Ctime: time.Now().Unix(),
|
|
2633
|
+ Mtime: 0,
|
|
2634
|
+ Price: info.Price,
|
|
2635
|
+ WarehousingDetailId: info.WarehouseInfotId,
|
|
2636
|
+ WarehouseOutDetailId: info.ID,
|
|
2637
|
+ CancelOutDetailId: cancelInfo.ID,
|
|
2638
|
+ ProductDate: info.ProductDate,
|
|
2639
|
+ ExpireDate: info.ExpiryDate,
|
|
2640
|
+ StorehouseId: houseConfig.StorehouseOutInfo,
|
|
2641
|
+ OverCount: flush_count,
|
|
2642
|
+ }
|
|
2643
|
+ service.CreateStockFlowOne(flow)
|
|
2644
|
+
|
|
2645
|
+ //退库数量增加
|
|
2646
|
+ service.UpdateSumAddCancelCount(c.GetAdminUserInfo().CurrentOrgId, item.ProjectId, houseConfig.StorehouseOutInfo, total_count)
|
|
2647
|
+ //出库数量减少
|
|
2648
|
+ service.UpdateSumCount(c.GetAdminUserInfo().CurrentOrgId, houseConfig.StorehouseOutInfo, item.ProjectId, total_count)
|
2609
|
2649
|
}
|
2610
|
2650
|
|
2611
|
|
- service.CreateCancelStockInfoOne(&cancelStockInfo)
|
2612
|
|
-
|
2613
|
|
- cancelInfo, _ := service.GetLastCancelStockInfoByGoodId(item.ProjectId)
|
2614
|
|
-
|
2615
|
|
- flow := models.VmStockFlow{
|
2616
|
|
- WarehousingId: info.WarehouseInfotId,
|
2617
|
|
- GoodId: item.ProjectId,
|
2618
|
|
- Number: info.Number,
|
2619
|
|
- LicenseNumber: info.LicenseNumber,
|
2620
|
|
- Count: prescribingNumber,
|
2621
|
|
- UserOrgId: c.GetAdminUserInfo().CurrentOrgId,
|
2622
|
|
- PatientId: item.PatientId,
|
2623
|
|
- SystemTime: info.SysRecordTime,
|
2624
|
|
- ConsumableType: 7,
|
2625
|
|
- IsSys: 0,
|
2626
|
|
- WarehousingOrder: "",
|
2627
|
|
- WarehouseOutId: info.WarehouseOutId,
|
2628
|
|
- WarehouseOutOrderNumber: info.WarehouseOutOrderNumber,
|
2629
|
|
- IsEdit: 0,
|
2630
|
|
- CancelStockId: cancel.ID,
|
2631
|
|
- CancelOrderNumber: cancel.OrderNumber,
|
2632
|
|
- Manufacturer: manufacturer.ID,
|
2633
|
|
- Dealer: 0,
|
2634
|
|
- Creator: c.GetAdminUserInfo().CurrentOrgId,
|
2635
|
|
- UpdateCreator: 0,
|
2636
|
|
- Status: 1,
|
2637
|
|
- Ctime: time.Now().Unix(),
|
2638
|
|
- Mtime: 0,
|
2639
|
|
- Price: info.Price,
|
2640
|
|
- WarehousingDetailId: info.WarehouseInfotId,
|
2641
|
|
- WarehouseOutDetailId: info.ID,
|
2642
|
|
- CancelOutDetailId: cancelInfo.ID,
|
2643
|
|
- ProductDate: info.ProductDate,
|
2644
|
|
- ExpireDate: info.ExpiryDate,
|
2645
|
|
- StorehouseId: houseConfig.StorehouseOutInfo,
|
2646
|
|
- OverCount: flush_count,
|
|
2651
|
+ if info.Count < total_count {
|
|
2652
|
+ //回退库存
|
|
2653
|
+ service.UpDateWarehouseInfoByStockDelete(info.WarehouseInfotId, info.Count, info.PatientId, info.SysRecordTime, item.ProjectId)
|
|
2654
|
+ cancelStockInfo := models.CancelStockInfo{
|
|
2655
|
+ GoodId: item.ProjectId,
|
|
2656
|
+ CancelStockId: cancel.ID,
|
|
2657
|
+ GoodTypeId: good.GoodTypeId,
|
|
2658
|
+ Count: info.Count,
|
|
2659
|
+ Price: info.Price,
|
|
2660
|
+ Total: 0,
|
|
2661
|
+ ProductDate: info.ProductDate,
|
|
2662
|
+ ExpiryDate: info.ExpiryDate,
|
|
2663
|
+ Ctime: time.Now().Unix(),
|
|
2664
|
+ Status: 1,
|
|
2665
|
+ OrgId: c.GetAdminUserInfo().CurrentOrgId,
|
|
2666
|
+ OrderNumber: cancel.OrderNumber,
|
|
2667
|
+ Type: 0,
|
|
2668
|
+ Dealer: deaerler.DealerName,
|
|
2669
|
+ Manufacturer: manufacturer.ManufacturerName,
|
|
2670
|
+ Number: info.Number,
|
|
2671
|
+ RegisterAccount: "",
|
|
2672
|
+ Remark: "",
|
|
2673
|
+ WarehouseInfoId: info.WarehouseInfotId,
|
|
2674
|
+ PatientId: info.PatientId,
|
|
2675
|
+ RecordDate: info.SysRecordTime,
|
|
2676
|
+ StorehouseId: houseConfig.StorehouseOutInfo,
|
|
2677
|
+ IsCheck: 1,
|
|
2678
|
+ }
|
|
2679
|
+
|
|
2680
|
+ service.CreateCancelStockInfoOne(&cancelStockInfo)
|
|
2681
|
+
|
|
2682
|
+ cancelInfo, _ := service.GetLastCancelStockInfoByGoodId(item.ProjectId)
|
|
2683
|
+
|
|
2684
|
+ flow := models.VmStockFlow{
|
|
2685
|
+ WarehousingId: info.WarehouseInfotId,
|
|
2686
|
+ GoodId: item.ProjectId,
|
|
2687
|
+ Number: info.Number,
|
|
2688
|
+ LicenseNumber: info.LicenseNumber,
|
|
2689
|
+ Count: info.Count,
|
|
2690
|
+ UserOrgId: c.GetAdminUserInfo().CurrentOrgId,
|
|
2691
|
+ PatientId: item.PatientId,
|
|
2692
|
+ SystemTime: info.SysRecordTime,
|
|
2693
|
+ ConsumableType: 7,
|
|
2694
|
+ IsSys: 0,
|
|
2695
|
+ WarehousingOrder: "",
|
|
2696
|
+ WarehouseOutId: info.WarehouseOutId,
|
|
2697
|
+ WarehouseOutOrderNumber: info.WarehouseOutOrderNumber,
|
|
2698
|
+ IsEdit: 0,
|
|
2699
|
+ CancelStockId: cancel.ID,
|
|
2700
|
+ CancelOrderNumber: cancel.OrderNumber,
|
|
2701
|
+ Manufacturer: manufacturer.ID,
|
|
2702
|
+ Dealer: 0,
|
|
2703
|
+ Creator: c.GetAdminUserInfo().CurrentOrgId,
|
|
2704
|
+ UpdateCreator: 0,
|
|
2705
|
+ Status: 1,
|
|
2706
|
+ Ctime: time.Now().Unix(),
|
|
2707
|
+ Mtime: 0,
|
|
2708
|
+ Price: info.Price,
|
|
2709
|
+ WarehousingDetailId: info.WarehouseInfotId,
|
|
2710
|
+ WarehouseOutDetailId: info.ID,
|
|
2711
|
+ CancelOutDetailId: cancelInfo.ID,
|
|
2712
|
+ ProductDate: info.ProductDate,
|
|
2713
|
+ ExpireDate: info.ExpiryDate,
|
|
2714
|
+ StorehouseId: houseConfig.StorehouseOutInfo,
|
|
2715
|
+ OverCount: flush_count,
|
|
2716
|
+ }
|
|
2717
|
+ service.CreateStockFlowOne(flow)
|
|
2718
|
+
|
|
2719
|
+ //退库数量增加
|
|
2720
|
+ service.UpdateSumAddCancelCount(c.GetAdminUserInfo().CurrentOrgId, item.ProjectId, houseConfig.StorehouseOutInfo, info.Count)
|
|
2721
|
+ //出库数量减少
|
|
2722
|
+ service.UpdateSumCount(c.GetAdminUserInfo().CurrentOrgId, houseConfig.StorehouseOutInfo, item.ProjectId, info.Count)
|
2647
|
2723
|
}
|
2648
|
|
- service.CreateStockFlowOne(flow)
|
2649
|
2724
|
|
2650
|
2725
|
//查询已出库数量
|
2651
|
2726
|
dialysisInfo, _ := service.GetGoodDialysisOutInfoSix(c.GetAdminUserInfo().CurrentOrgId, info.PatientId, info.SysRecordTime, item.ProjectId)
|
|
@@ -2655,16 +2730,11 @@ func (c *HisApiController) DeletePrescription() {
|
2655
|
2730
|
service.UpdateAutoGood(c.GetAdminUserInfo().CurrentOrgId, info.PatientId, info.SysRecordTime, item.ProjectId, item.ID, prescribingNumber)
|
2656
|
2731
|
}
|
2657
|
2732
|
|
2658
|
|
- if prescribingNumber == dialysisInfo.Count {
|
|
2733
|
+ if prescribingNumber >= dialysisInfo.Count {
|
2659
|
2734
|
//删除出库表
|
2660
|
2735
|
service.DeleteAutoRedeceDetailTen(c.GetAdminUserInfo().CurrentOrgId, info.PatientId, info.SysRecordTime, item.ProjectId)
|
2661
|
2736
|
}
|
2662
|
2737
|
|
2663
|
|
- //退库数量增加
|
2664
|
|
- service.UpdateSumAddCancelCount(c.GetAdminUserInfo().CurrentOrgId, item.ProjectId, houseConfig.StorehouseOutInfo, total_count)
|
2665
|
|
- //出库数量减少
|
2666
|
|
- service.UpdateSumCount(c.GetAdminUserInfo().CurrentOrgId, houseConfig.StorehouseOutInfo, item.ProjectId, total_count)
|
2667
|
|
-
|
2668
|
2738
|
//更新库存
|
2669
|
2739
|
service.UpdateSumGood(c.GetAdminUserInfo().CurrentOrgId, houseConfig.StorehouseOutInfo, item.ProjectId, flush_count)
|
2670
|
2740
|
|
|
@@ -2969,77 +3039,156 @@ func (c *HisApiController) DeleteProject() {
|
2969
|
3039
|
manufacturer, _ := service.GetManufactureById(info.Manufacturer)
|
2970
|
3040
|
deaerler, _ := service.GetDealerById(info.Dealer)
|
2971
|
3041
|
if info.ID > 0 {
|
2972
|
|
- cancelStockInfo := models.CancelStockInfo{
|
2973
|
|
- GoodId: project.ProjectId,
|
2974
|
|
- CancelStockId: cancel.ID,
|
2975
|
|
- GoodTypeId: good.GoodTypeId,
|
2976
|
|
- Count: prescribingNumber,
|
2977
|
|
- Price: info.Price,
|
2978
|
|
- Total: 0,
|
2979
|
|
- ProductDate: info.ProductDate,
|
2980
|
|
- ExpiryDate: info.ExpiryDate,
|
2981
|
|
- Ctime: time.Now().Unix(),
|
2982
|
|
- Status: 1,
|
2983
|
|
- OrgId: adminInfo.CurrentOrgId,
|
2984
|
|
- OrderNumber: cancel.OrderNumber,
|
2985
|
|
- Type: 0,
|
2986
|
|
- Dealer: deaerler.DealerName,
|
2987
|
|
- Manufacturer: manufacturer.ManufacturerName,
|
2988
|
|
- Number: info.Number,
|
2989
|
|
- RegisterAccount: "",
|
2990
|
|
- Remark: "",
|
2991
|
|
- WarehouseInfoId: info.WarehouseInfotId,
|
2992
|
|
- PatientId: info.PatientId,
|
2993
|
|
- RecordDate: info.SysRecordTime,
|
2994
|
|
- StorehouseId: houseConfig.StorehouseOutInfo,
|
2995
|
|
- IsCheck: 1,
|
2996
|
|
- }
|
2997
|
|
-
|
2998
|
|
- service.CreateCancelStockInfoOne(&cancelStockInfo)
|
2999
|
|
-
|
3000
|
3042
|
cancelInfo, _ := service.GetLastCancelStockInfoByGoodId(project.ProjectId)
|
|
3043
|
+ if info.Count >= prescribingNumber {
|
|
3044
|
+ cancelStockInfo := models.CancelStockInfo{
|
|
3045
|
+ GoodId: project.ProjectId,
|
|
3046
|
+ CancelStockId: cancel.ID,
|
|
3047
|
+ GoodTypeId: good.GoodTypeId,
|
|
3048
|
+ Count: prescribingNumber,
|
|
3049
|
+ Price: info.Price,
|
|
3050
|
+ Total: 0,
|
|
3051
|
+ ProductDate: info.ProductDate,
|
|
3052
|
+ ExpiryDate: info.ExpiryDate,
|
|
3053
|
+ Ctime: time.Now().Unix(),
|
|
3054
|
+ Status: 1,
|
|
3055
|
+ OrgId: adminInfo.CurrentOrgId,
|
|
3056
|
+ OrderNumber: cancel.OrderNumber,
|
|
3057
|
+ Type: 0,
|
|
3058
|
+ Dealer: deaerler.DealerName,
|
|
3059
|
+ Manufacturer: manufacturer.ManufacturerName,
|
|
3060
|
+ Number: info.Number,
|
|
3061
|
+ RegisterAccount: "",
|
|
3062
|
+ Remark: "",
|
|
3063
|
+ WarehouseInfoId: info.WarehouseInfotId,
|
|
3064
|
+ PatientId: info.PatientId,
|
|
3065
|
+ RecordDate: info.SysRecordTime,
|
|
3066
|
+ StorehouseId: houseConfig.StorehouseOutInfo,
|
|
3067
|
+ IsCheck: 1,
|
|
3068
|
+ }
|
|
3069
|
+
|
|
3070
|
+ service.CreateCancelStockInfoOne(&cancelStockInfo)
|
|
3071
|
+ //回退库存
|
|
3072
|
+ service.UpDateWarehouseInfoByStockDelete(info.WarehouseInfotId, prescribingNumber, info.PatientId, info.SysRecordTime, project.ProjectId)
|
|
3073
|
+ //退库数量增加
|
|
3074
|
+ service.UpdateSumAddCancelCount(adminInfo.CurrentOrgId, project.ProjectId, houseConfig.StorehouseOutInfo, prescribingNumber)
|
|
3075
|
+ //出库数量减少
|
|
3076
|
+ service.UpdateSumCount(adminInfo.CurrentOrgId, houseConfig.StorehouseOutInfo, project.ProjectId, prescribingNumber)
|
|
3077
|
+ }
|
|
3078
|
+ if info.Count < prescribingNumber {
|
|
3079
|
+ cancelStockInfo := models.CancelStockInfo{
|
|
3080
|
+ GoodId: project.ProjectId,
|
|
3081
|
+ CancelStockId: cancel.ID,
|
|
3082
|
+ GoodTypeId: good.GoodTypeId,
|
|
3083
|
+ Count: info.Count,
|
|
3084
|
+ Price: info.Price,
|
|
3085
|
+ Total: 0,
|
|
3086
|
+ ProductDate: info.ProductDate,
|
|
3087
|
+ ExpiryDate: info.ExpiryDate,
|
|
3088
|
+ Ctime: time.Now().Unix(),
|
|
3089
|
+ Status: 1,
|
|
3090
|
+ OrgId: adminInfo.CurrentOrgId,
|
|
3091
|
+ OrderNumber: cancel.OrderNumber,
|
|
3092
|
+ Type: 0,
|
|
3093
|
+ Dealer: deaerler.DealerName,
|
|
3094
|
+ Manufacturer: manufacturer.ManufacturerName,
|
|
3095
|
+ Number: info.Number,
|
|
3096
|
+ RegisterAccount: "",
|
|
3097
|
+ Remark: "",
|
|
3098
|
+ WarehouseInfoId: info.WarehouseInfotId,
|
|
3099
|
+ PatientId: info.PatientId,
|
|
3100
|
+ RecordDate: info.SysRecordTime,
|
|
3101
|
+ StorehouseId: houseConfig.StorehouseOutInfo,
|
|
3102
|
+ IsCheck: 1,
|
|
3103
|
+ }
|
|
3104
|
+
|
|
3105
|
+ service.CreateCancelStockInfoOne(&cancelStockInfo)
|
|
3106
|
+ //回退库存
|
|
3107
|
+ service.UpDateWarehouseInfoByStockDelete(info.WarehouseInfotId, info.Count, info.PatientId, info.SysRecordTime, project.ProjectId)
|
|
3108
|
+ //退库数量增加
|
|
3109
|
+ service.UpdateSumAddCancelCount(adminInfo.CurrentOrgId, project.ProjectId, houseConfig.StorehouseOutInfo, info.Count)
|
|
3110
|
+ //出库数量减少
|
|
3111
|
+ service.UpdateSumCount(adminInfo.CurrentOrgId, houseConfig.StorehouseOutInfo, project.ProjectId, info.Count)
|
|
3112
|
+ }
|
3001
|
3113
|
|
3002
|
|
- //回退库存
|
3003
|
|
- service.UpDateWarehouseInfoByStockDelete(info.WarehouseInfotId, prescribingNumber, info.PatientId, info.SysRecordTime, project.ProjectId)
|
3004
|
3114
|
goodList, _ := service.GetSumGoodList(adminInfo.CurrentOrgId, houseConfig.StorehouseOutInfo, project.ProjectId)
|
3005
|
3115
|
var over_count int64
|
3006
|
3116
|
for _, it := range goodList {
|
3007
|
3117
|
over_count += it.StockCount
|
3008
|
3118
|
}
|
3009
|
|
- flow := models.VmStockFlow{
|
3010
|
|
- WarehousingId: info.WarehouseInfotId,
|
3011
|
|
- GoodId: project.ProjectId,
|
3012
|
|
- Number: info.Number,
|
3013
|
|
- LicenseNumber: info.LicenseNumber,
|
3014
|
|
- Count: prescribingNumber,
|
3015
|
|
- UserOrgId: adminInfo.CurrentOrgId,
|
3016
|
|
- PatientId: project.PatientId,
|
3017
|
|
- SystemTime: info.SysRecordTime,
|
3018
|
|
- ConsumableType: 7,
|
3019
|
|
- IsSys: 0,
|
3020
|
|
- WarehousingOrder: "",
|
3021
|
|
- WarehouseOutId: info.WarehouseOutId,
|
3022
|
|
- WarehouseOutOrderNumber: info.WarehouseOutOrderNumber,
|
3023
|
|
- IsEdit: 0,
|
3024
|
|
- CancelStockId: cancel.ID,
|
3025
|
|
- CancelOrderNumber: cancel.OrderNumber,
|
3026
|
|
- Manufacturer: manufacturer.ID,
|
3027
|
|
- Dealer: 0,
|
3028
|
|
- Creator: adminInfo.AdminUser.Id,
|
3029
|
|
- UpdateCreator: 0,
|
3030
|
|
- Status: 1,
|
3031
|
|
- Ctime: time.Now().Unix(),
|
3032
|
|
- Mtime: 0,
|
3033
|
|
- Price: info.Price,
|
3034
|
|
- WarehousingDetailId: info.WarehouseInfotId,
|
3035
|
|
- WarehouseOutDetailId: info.ID,
|
3036
|
|
- CancelOutDetailId: cancelInfo.ID,
|
3037
|
|
- ProductDate: info.ProductDate,
|
3038
|
|
- ExpireDate: info.ExpiryDate,
|
3039
|
|
- StorehouseId: houseConfig.StorehouseOutInfo,
|
3040
|
|
- OverCount: over_count,
|
|
3119
|
+ if info.Count >= prescribingNumber {
|
|
3120
|
+ flow := models.VmStockFlow{
|
|
3121
|
+ WarehousingId: info.WarehouseInfotId,
|
|
3122
|
+ GoodId: project.ProjectId,
|
|
3123
|
+ Number: info.Number,
|
|
3124
|
+ LicenseNumber: info.LicenseNumber,
|
|
3125
|
+ Count: prescribingNumber,
|
|
3126
|
+ UserOrgId: adminInfo.CurrentOrgId,
|
|
3127
|
+ PatientId: project.PatientId,
|
|
3128
|
+ SystemTime: info.SysRecordTime,
|
|
3129
|
+ ConsumableType: 7,
|
|
3130
|
+ IsSys: 0,
|
|
3131
|
+ WarehousingOrder: "",
|
|
3132
|
+ WarehouseOutId: info.WarehouseOutId,
|
|
3133
|
+ WarehouseOutOrderNumber: info.WarehouseOutOrderNumber,
|
|
3134
|
+ IsEdit: 0,
|
|
3135
|
+ CancelStockId: cancel.ID,
|
|
3136
|
+ CancelOrderNumber: cancel.OrderNumber,
|
|
3137
|
+ Manufacturer: manufacturer.ID,
|
|
3138
|
+ Dealer: 0,
|
|
3139
|
+ Creator: adminInfo.AdminUser.Id,
|
|
3140
|
+ UpdateCreator: 0,
|
|
3141
|
+ Status: 1,
|
|
3142
|
+ Ctime: time.Now().Unix(),
|
|
3143
|
+ Mtime: 0,
|
|
3144
|
+ Price: info.Price,
|
|
3145
|
+ WarehousingDetailId: info.WarehouseInfotId,
|
|
3146
|
+ WarehouseOutDetailId: info.ID,
|
|
3147
|
+ CancelOutDetailId: cancelInfo.ID,
|
|
3148
|
+ ProductDate: info.ProductDate,
|
|
3149
|
+ ExpireDate: info.ExpiryDate,
|
|
3150
|
+ StorehouseId: houseConfig.StorehouseOutInfo,
|
|
3151
|
+ OverCount: over_count,
|
|
3152
|
+ }
|
|
3153
|
+ service.CreateStockFlowOne(flow)
|
|
3154
|
+ }
|
|
3155
|
+
|
|
3156
|
+ if info.Count < prescribingNumber {
|
|
3157
|
+ flow := models.VmStockFlow{
|
|
3158
|
+ WarehousingId: info.WarehouseInfotId,
|
|
3159
|
+ GoodId: project.ProjectId,
|
|
3160
|
+ Number: info.Number,
|
|
3161
|
+ LicenseNumber: info.LicenseNumber,
|
|
3162
|
+ Count: info.Count,
|
|
3163
|
+ UserOrgId: adminInfo.CurrentOrgId,
|
|
3164
|
+ PatientId: project.PatientId,
|
|
3165
|
+ SystemTime: info.SysRecordTime,
|
|
3166
|
+ ConsumableType: 7,
|
|
3167
|
+ IsSys: 0,
|
|
3168
|
+ WarehousingOrder: "",
|
|
3169
|
+ WarehouseOutId: info.WarehouseOutId,
|
|
3170
|
+ WarehouseOutOrderNumber: info.WarehouseOutOrderNumber,
|
|
3171
|
+ IsEdit: 0,
|
|
3172
|
+ CancelStockId: cancel.ID,
|
|
3173
|
+ CancelOrderNumber: cancel.OrderNumber,
|
|
3174
|
+ Manufacturer: manufacturer.ID,
|
|
3175
|
+ Dealer: 0,
|
|
3176
|
+ Creator: adminInfo.AdminUser.Id,
|
|
3177
|
+ UpdateCreator: 0,
|
|
3178
|
+ Status: 1,
|
|
3179
|
+ Ctime: time.Now().Unix(),
|
|
3180
|
+ Mtime: 0,
|
|
3181
|
+ Price: info.Price,
|
|
3182
|
+ WarehousingDetailId: info.WarehouseInfotId,
|
|
3183
|
+ WarehouseOutDetailId: info.ID,
|
|
3184
|
+ CancelOutDetailId: cancelInfo.ID,
|
|
3185
|
+ ProductDate: info.ProductDate,
|
|
3186
|
+ ExpireDate: info.ExpiryDate,
|
|
3187
|
+ StorehouseId: houseConfig.StorehouseOutInfo,
|
|
3188
|
+ OverCount: over_count,
|
|
3189
|
+ }
|
|
3190
|
+ service.CreateStockFlowOne(flow)
|
3041
|
3191
|
}
|
3042
|
|
- service.CreateStockFlowOne(flow)
|
3043
|
3192
|
|
3044
|
3193
|
//查询已出库数量
|
3045
|
3194
|
dialysisInfo, _ := service.GetGoodDialysisOutInfoSix(adminInfo.CurrentOrgId, info.PatientId, info.SysRecordTime, project.ProjectId)
|
|
@@ -3048,18 +3197,12 @@ func (c *HisApiController) DeleteProject() {
|
3048
|
3197
|
//改变数量
|
3049
|
3198
|
service.UpdateAutoGood(adminInfo.CurrentOrgId, info.PatientId, info.SysRecordTime, project.ProjectId, id, prescribingNumber)
|
3050
|
3199
|
}
|
3051
|
|
- fmt.Println("prescribingNumber", prescribingNumber)
|
3052
|
|
- fmt.Println("Count2332333223qw", dialysisInfo.Count)
|
3053
|
|
- if prescribingNumber == dialysisInfo.Count {
|
|
3200
|
+
|
|
3201
|
+ if prescribingNumber >= dialysisInfo.Count {
|
3054
|
3202
|
//删除出库表
|
3055
|
3203
|
service.DeleteAutoRedeceDetailTen(adminInfo.CurrentOrgId, info.PatientId, info.SysRecordTime, project.ProjectId)
|
3056
|
3204
|
}
|
3057
|
3205
|
|
3058
|
|
- //退库数量增加
|
3059
|
|
- service.UpdateSumAddCancelCount(adminInfo.CurrentOrgId, project.ProjectId, houseConfig.StorehouseOutInfo, prescribingNumber)
|
3060
|
|
- //出库数量减少
|
3061
|
|
- service.UpdateSumCount(adminInfo.CurrentOrgId, houseConfig.StorehouseOutInfo, project.ProjectId, prescribingNumber)
|
3062
|
|
-
|
3063
|
3206
|
//更新剩余库存
|
3064
|
3207
|
service.UpdateSumGood(adminInfo.CurrentOrgId, houseConfig.StorehouseOutInfo, project.ProjectId, over_count)
|
3065
|
3208
|
|