|
@@ -58,7 +58,7 @@ func DrugStockManagerApiRegistRouters() {
|
58
|
58
|
//beego.Router("/api/drugreturn/config", &StockDrugApiController{}, "get:GetAllSalesReturnConfig")
|
59
|
59
|
//
|
60
|
60
|
////库存查询
|
61
|
|
- //beego.Router("/api/drugstock/query", &StockDrugApiController{}, "get:GetQueryInfo")
|
|
61
|
+ beego.Router("/api/drugstock/query", &StockDrugApiController{}, "get:GetDrugQueryInfo")
|
62
|
62
|
//
|
63
|
63
|
//beego.Router("/api/drugstock/detail", &StockDrugApiController{}, "get:GetDetailInfo")
|
64
|
64
|
//
|
|
@@ -89,7 +89,7 @@ func (c *StockDrugApiController) CreateDrugWarehouse() {
|
89
|
89
|
timeArr := strings.Split(timeStr, "-")
|
90
|
90
|
total, _ := service.FindAllWarehouseTotal(adminUserInfo.CurrentOrgId)
|
91
|
91
|
total = total + 1
|
92
|
|
- warehousing_order := "RKD" + strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + timeArr[0] + timeArr[1] + timeArr[2] + "000" + strconv.FormatInt(total, 10)
|
|
92
|
+ warehousing_order := "YPRKD" + strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + timeArr[0] + timeArr[1] + timeArr[2] + "000" + strconv.FormatInt(total, 10)
|
93
|
93
|
operation_time := time.Now().Unix()
|
94
|
94
|
creater := adminUserInfo.AdminUser.Id
|
95
|
95
|
warehousing := models.DrugWarehouse{
|
|
@@ -144,6 +144,14 @@ func (c *StockDrugApiController) CreateDrugWarehouse() {
|
144
|
144
|
price, _ := strconv.ParseFloat(items["price"].(string), 64)
|
145
|
145
|
total := float64(warehousing_count) * price
|
146
|
146
|
|
|
147
|
+ if items["retail_price"] == nil || reflect.TypeOf(items["retail_price"]).String() != "string" {
|
|
148
|
+ utils.ErrorLog("retail_price")
|
|
149
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
150
|
+ return
|
|
151
|
+ }
|
|
152
|
+ retail_price, _ := strconv.ParseFloat(items["retail_price"].(string), 64)
|
|
153
|
+ retail_price_total := float64(warehousing_count) * retail_price
|
|
154
|
+
|
147
|
155
|
var productDates int64
|
148
|
156
|
var expiryDates int64
|
149
|
157
|
|
|
@@ -208,6 +216,8 @@ func (c *StockDrugApiController) CreateDrugWarehouse() {
|
208
|
216
|
Type: types,
|
209
|
217
|
Manufacturer: manufacturer_id,
|
210
|
218
|
Dealer: dealer_id,
|
|
219
|
+ RetailPrice: retail_price,
|
|
220
|
+ RetailTotalPrice: retail_price_total,
|
211
|
221
|
}
|
212
|
222
|
warehousingInfo = append(warehousingInfo, warehouseInfo)
|
213
|
223
|
|
|
@@ -520,6 +530,14 @@ func (c *StockDrugApiController) EditDrugWarehouse() {
|
520
|
530
|
price, _ := strconv.ParseFloat(items["price"].(string), 64)
|
521
|
531
|
total := float64(warehousing_count) * price
|
522
|
532
|
|
|
533
|
+ if items["retail_price"] == nil || reflect.TypeOf(items["retail_price"]).String() != "string" {
|
|
534
|
+ utils.ErrorLog("retail_price")
|
|
535
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
536
|
+ return
|
|
537
|
+ }
|
|
538
|
+ retail_price, _ := strconv.ParseFloat(items["retail_price"].(string), 64)
|
|
539
|
+ retail_price_total := float64(warehousing_count) * retail_price
|
|
540
|
+
|
523
|
541
|
var productDates int64
|
524
|
542
|
var expiryDates int64
|
525
|
543
|
|
|
@@ -592,6 +610,8 @@ func (c *StockDrugApiController) EditDrugWarehouse() {
|
592
|
610
|
Type: types,
|
593
|
611
|
Manufacturer: manufacturer_id,
|
594
|
612
|
Dealer: dealer_id,
|
|
613
|
+ RetailPrice: retail_price,
|
|
614
|
+ RetailTotalPrice: retail_price_total,
|
595
|
615
|
}
|
596
|
616
|
warehousingInfo = append(warehousingInfo, warehouseInfo)
|
597
|
617
|
|
|
@@ -614,6 +634,8 @@ func (c *StockDrugApiController) EditDrugWarehouse() {
|
614
|
634
|
Type: types,
|
615
|
635
|
Manufacturer: manufacturer_id,
|
616
|
636
|
Dealer: dealer_id,
|
|
637
|
+ RetailPrice: retail_price,
|
|
638
|
+ RetailTotalPrice: retail_price_total,
|
617
|
639
|
}
|
618
|
640
|
upDateWarehousingInfo = append(upDateWarehousingInfo, warehouseInfo)
|
619
|
641
|
}
|
|
@@ -701,7 +723,7 @@ func (c *StockDrugApiController) CreateDrugSalesReturn() {
|
701
|
723
|
timeArr := strings.Split(timeStr, "-")
|
702
|
724
|
total, _ := service.FindAllSalesReturnTotal(adminUserInfo.CurrentOrgId)
|
703
|
725
|
total = total + 1
|
704
|
|
- orderNumber := "THD" + strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + timeArr[0] + timeArr[1] + timeArr[2] + "000" + strconv.FormatInt(total, 10)
|
|
726
|
+ orderNumber := "YPTHD" + strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + timeArr[0] + timeArr[1] + timeArr[2] + "000" + strconv.FormatInt(total, 10)
|
705
|
727
|
|
706
|
728
|
salesReturn := models.DrugSalesReturn{
|
707
|
729
|
OrderNumber: orderNumber,
|
|
@@ -748,24 +770,39 @@ func (c *StockDrugApiController) CreateDrugSalesReturn() {
|
748
|
770
|
|
749
|
771
|
return
|
750
|
772
|
}
|
751
|
|
-
|
752
|
773
|
count, _ := strconv.ParseInt(return_count, 10, 64)
|
753
|
|
- price, _ := strconv.ParseFloat(items["price"].(string), 10)
|
|
774
|
+
|
|
775
|
+ if items["price"] == nil || reflect.TypeOf(items["price"]).String() != "string" {
|
|
776
|
+ utils.ErrorLog("price")
|
|
777
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
778
|
+ return
|
|
779
|
+ }
|
|
780
|
+ price, _ := strconv.ParseFloat(items["price"].(string), 64)
|
754
|
781
|
total := float64(count) * price
|
755
|
782
|
|
|
783
|
+ if items["retail_price"] == nil || reflect.TypeOf(items["retail_price"]).String() != "string" {
|
|
784
|
+ utils.ErrorLog("retail_price")
|
|
785
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
786
|
+ return
|
|
787
|
+ }
|
|
788
|
+ retail_price, _ := strconv.ParseFloat(items["retail_price"].(string), 64)
|
|
789
|
+ retail_price_total := float64(count) * retail_price
|
|
790
|
+
|
756
|
791
|
salesReturnInfo := &models.DrugSalesReturnInfo{
|
757
|
|
- OrderNumber: salesReturn.OrderNumber,
|
758
|
|
- SalesReturnId: salesReturn.ID,
|
759
|
|
- DrugId: drug_id,
|
760
|
|
- Count: count,
|
761
|
|
- Price: price,
|
762
|
|
- Total: total,
|
763
|
|
- Status: 1,
|
764
|
|
- Ctime: ctime,
|
765
|
|
- OrgId: adminUserInfo.CurrentOrgId,
|
766
|
|
- Type: types,
|
767
|
|
- Manufacturer: manufacturer_id,
|
768
|
|
- Dealer: dealer_id,
|
|
792
|
+ OrderNumber: salesReturn.OrderNumber,
|
|
793
|
+ SalesReturnId: salesReturn.ID,
|
|
794
|
+ DrugId: drug_id,
|
|
795
|
+ Count: count,
|
|
796
|
+ Price: price,
|
|
797
|
+ Total: total,
|
|
798
|
+ Status: 1,
|
|
799
|
+ Ctime: ctime,
|
|
800
|
+ OrgId: adminUserInfo.CurrentOrgId,
|
|
801
|
+ Type: types,
|
|
802
|
+ Manufacturer: manufacturer_id,
|
|
803
|
+ Dealer: dealer_id,
|
|
804
|
+ RetailPrice: retail_price,
|
|
805
|
+ RetailTotalPrice: retail_price_total,
|
769
|
806
|
}
|
770
|
807
|
|
771
|
808
|
salesReturnInfos = append(salesReturnInfos, salesReturnInfo)
|
|
@@ -776,7 +813,7 @@ func (c *StockDrugApiController) CreateDrugSalesReturn() {
|
776
|
813
|
errs := service.CreateDrugSalesReturnInfo(salesReturnInfos)
|
777
|
814
|
if errs != nil {
|
778
|
815
|
utils.ErrorLog(errs.Error())
|
779
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateStockInFail)
|
|
816
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateReturnFail)
|
780
|
817
|
return
|
781
|
818
|
}
|
782
|
819
|
|
|
@@ -865,8 +902,10 @@ func (this *StockDrugApiController) DeleteDrugSalesReturnInfo() {
|
865
|
902
|
}
|
866
|
903
|
func (this *StockDrugApiController) GetDrugSalesReturnInfoList() {
|
867
|
904
|
id, _ := this.GetInt64("id", 0)
|
868
|
|
- list, _ := service.FindAllDrugSalesReturnInfoById(id)
|
869
|
|
- salesReturn, _ := service.FindAllDrugSalesReturnById(id)
|
|
905
|
+ adminUserInfo := this.GetAdminUserInfo()
|
|
906
|
+
|
|
907
|
+ list, _ := service.FindAllDrugSalesReturnInfoById(id, adminUserInfo.CurrentOrgId)
|
|
908
|
+ salesReturn, _ := service.FindAllDrugSalesReturnById(id, adminUserInfo.CurrentOrgId)
|
870
|
909
|
|
871
|
910
|
this.ServeSuccessJSON(map[string]interface{}{
|
872
|
911
|
"list": list,
|
|
@@ -948,36 +987,61 @@ func (c *StockDrugApiController) EditDrugReturnInfo() {
|
948
|
987
|
}
|
949
|
988
|
id := int64(items["id"].(float64))
|
950
|
989
|
|
|
990
|
+ if items["price"] == nil || reflect.TypeOf(items["price"]).String() != "string" {
|
|
991
|
+ utils.ErrorLog("price")
|
|
992
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
993
|
+ return
|
|
994
|
+ }
|
|
995
|
+
|
|
996
|
+ price, _ := strconv.ParseFloat(items["price"].(string), 64)
|
|
997
|
+ total := float64(count) * price
|
|
998
|
+
|
|
999
|
+ if items["retail_price"] == nil || reflect.TypeOf(items["retail_price"]).String() != "string" {
|
|
1000
|
+ utils.ErrorLog("retail_price")
|
|
1001
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
1002
|
+ return
|
|
1003
|
+ }
|
|
1004
|
+ retail_price, _ := strconv.ParseFloat(items["retail_price"].(string), 64)
|
|
1005
|
+ retail_price_total := float64(count) * retail_price
|
|
1006
|
+
|
951
|
1007
|
if id == 0 {
|
952
|
1008
|
returnInfo := &models.DrugSalesReturnInfo{
|
953
|
|
- DrugId: drug_id,
|
954
|
|
- Count: count,
|
955
|
|
- Status: 1,
|
956
|
|
- Ctime: ctime,
|
957
|
|
- OrgId: adminUserInfo.CurrentOrgId,
|
958
|
|
- OrderNumber: sales.OrderNumber,
|
959
|
|
- SalesReturnId: sales.ID,
|
960
|
|
- Mtime: time.Now().Unix(),
|
961
|
|
- Type: types,
|
962
|
|
- Manufacturer: manufacturer_id,
|
963
|
|
- Dealer: dealer_id,
|
|
1009
|
+ DrugId: drug_id,
|
|
1010
|
+ Count: count,
|
|
1011
|
+ Status: 1,
|
|
1012
|
+ Ctime: ctime,
|
|
1013
|
+ OrgId: adminUserInfo.CurrentOrgId,
|
|
1014
|
+ OrderNumber: sales.OrderNumber,
|
|
1015
|
+ SalesReturnId: sales.ID,
|
|
1016
|
+ Mtime: time.Now().Unix(),
|
|
1017
|
+ Type: types,
|
|
1018
|
+ Manufacturer: manufacturer_id,
|
|
1019
|
+ Dealer: dealer_id,
|
|
1020
|
+ RetailPrice: retail_price,
|
|
1021
|
+ RetailTotalPrice: retail_price_total,
|
|
1022
|
+ Total: total,
|
|
1023
|
+ Price: price,
|
964
|
1024
|
}
|
965
|
1025
|
returnInfos = append(returnInfos, returnInfo)
|
966
|
1026
|
|
967
|
1027
|
} else {
|
968
|
1028
|
returnInfo := &models.DrugSalesReturnInfo{
|
969
|
|
- ID: id,
|
970
|
|
- DrugId: drug_id,
|
971
|
|
- Count: count,
|
972
|
|
- Status: 1,
|
973
|
|
- Ctime: ctime,
|
974
|
|
- OrgId: adminUserInfo.CurrentOrgId,
|
975
|
|
- OrderNumber: sales.OrderNumber,
|
976
|
|
- SalesReturnId: sales.ID,
|
977
|
|
- Mtime: time.Now().Unix(),
|
978
|
|
- Type: types,
|
979
|
|
- Manufacturer: manufacturer_id,
|
980
|
|
- Dealer: dealer_id,
|
|
1029
|
+ ID: id,
|
|
1030
|
+ DrugId: drug_id,
|
|
1031
|
+ Count: count,
|
|
1032
|
+ Status: 1,
|
|
1033
|
+ Ctime: ctime,
|
|
1034
|
+ OrgId: adminUserInfo.CurrentOrgId,
|
|
1035
|
+ OrderNumber: sales.OrderNumber,
|
|
1036
|
+ SalesReturnId: sales.ID,
|
|
1037
|
+ Mtime: time.Now().Unix(),
|
|
1038
|
+ Type: types,
|
|
1039
|
+ Manufacturer: manufacturer_id,
|
|
1040
|
+ Dealer: dealer_id,
|
|
1041
|
+ RetailPrice: retail_price,
|
|
1042
|
+ RetailTotalPrice: retail_price_total,
|
|
1043
|
+ Total: total,
|
|
1044
|
+ Price: price,
|
981
|
1045
|
}
|
982
|
1046
|
upDateReturnInfos = append(upDateReturnInfos, returnInfo)
|
983
|
1047
|
}
|
|
@@ -997,7 +1061,7 @@ func (c *StockDrugApiController) EditDrugReturnInfo() {
|
997
|
1061
|
|
998
|
1062
|
if errs != nil {
|
999
|
1063
|
utils.ErrorLog(errs.Error())
|
1000
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateStockInFail)
|
|
1064
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateReturnFail)
|
1001
|
1065
|
return
|
1002
|
1066
|
}
|
1003
|
1067
|
|
|
@@ -1030,7 +1094,7 @@ func (c *StockDrugApiController) CreateDrugWarehouseOut() {
|
1030
|
1094
|
warehousing_out_order := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + timeArr[0] + timeArr[1] + timeArr[2] + "000"
|
1031
|
1095
|
number, _ := strconv.ParseInt(warehousing_out_order, 10, 64)
|
1032
|
1096
|
number = number + total
|
1033
|
|
- warehousing_out_order = "CKD" + strconv.FormatInt(number, 10)
|
|
1097
|
+ warehousing_out_order = "YPCKD" + strconv.FormatInt(number, 10)
|
1034
|
1098
|
operation_time := time.Now().Unix()
|
1035
|
1099
|
creater := adminUserInfo.AdminUser.Id
|
1036
|
1100
|
|
|
@@ -1083,9 +1147,17 @@ func (c *StockDrugApiController) CreateDrugWarehouseOut() {
|
1083
|
1147
|
}
|
1084
|
1148
|
price, _ := strconv.ParseFloat(items["price"].(string), 64)
|
1085
|
1149
|
|
|
1150
|
+ if items["retail_price"] == nil || reflect.TypeOf(items["retail_price"]).String() != "string" {
|
|
1151
|
+ utils.ErrorLog("retail_price")
|
|
1152
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
1153
|
+ return
|
|
1154
|
+ }
|
|
1155
|
+ retail_price, _ := strconv.ParseFloat(items["retail_price"].(string), 64)
|
|
1156
|
+
|
1086
|
1157
|
count, _ := strconv.ParseInt(items["count"].(string), 10, 64)
|
1087
|
1158
|
|
1088
|
1159
|
total := float64(count) * price
|
|
1160
|
+ retail_price_total := float64(count) * retail_price
|
1089
|
1161
|
remark := items["remark"].(string)
|
1090
|
1162
|
|
1091
|
1163
|
warehouseOutInfo := &models.DrugWarehouseOutInfo{
|
|
@@ -1102,6 +1174,8 @@ func (c *StockDrugApiController) CreateDrugWarehouseOut() {
|
1102
|
1174
|
Type: types,
|
1103
|
1175
|
Manufacturer: manufacturer_id,
|
1104
|
1176
|
Dealer: dealer_id,
|
|
1177
|
+ RetailPrice: retail_price,
|
|
1178
|
+ RetailTotalPrice: retail_price_total,
|
1105
|
1179
|
}
|
1106
|
1180
|
warehousingOutInfo = append(warehousingOutInfo, warehouseOutInfo)
|
1107
|
1181
|
|
|
@@ -1112,7 +1186,7 @@ func (c *StockDrugApiController) CreateDrugWarehouseOut() {
|
1112
|
1186
|
info, _ := service.FindLastDrugWarehousingOutInfo(warehouseOut.WarehouseOutOrderNumber)
|
1113
|
1187
|
if errs != nil {
|
1114
|
1188
|
utils.ErrorLog(errs.Error())
|
1115
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateStockInFail)
|
|
1189
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateStockOutFail)
|
1116
|
1190
|
return
|
1117
|
1191
|
}
|
1118
|
1192
|
|
|
@@ -1203,8 +1277,9 @@ func (this *StockDrugApiController) DeleteDrugWarehouseOutInfo() {
|
1203
|
1277
|
}
|
1204
|
1278
|
func (c *StockDrugApiController) GetDrugWarehouseOutInfoList() {
|
1205
|
1279
|
id, _ := c.GetInt64("id", 0)
|
1206
|
|
- warehouseOutInfo, _ := service.FindDrugWarehouseOutInfoById(id)
|
1207
|
|
- warehouseOut, _ := service.FindDrugWareHouseOutById(id)
|
|
1280
|
+ adminInfo := c.GetAdminUserInfo()
|
|
1281
|
+ warehouseOutInfo, _ := service.FindDrugWarehouseOutInfoById(id, adminInfo.CurrentOrgId)
|
|
1282
|
+ warehouseOut, _ := service.FindDrugWareHouseOutById(id, adminInfo.CurrentOrgId)
|
1208
|
1283
|
c.ServeSuccessJSON(map[string]interface{}{
|
1209
|
1284
|
"list": warehouseOutInfo,
|
1210
|
1285
|
"info": warehouseOut,
|
|
@@ -1234,7 +1309,7 @@ func (c *StockDrugApiController) EditDrugWarehouseOut() {
|
1234
|
1309
|
return
|
1235
|
1310
|
}
|
1236
|
1311
|
|
1237
|
|
- warehouseOut, _ := service.FindDrugWareHouseOutById(id)
|
|
1312
|
+ warehouseOut, _ := service.FindDrugWareHouseOutById(id, adminUserInfo.CurrentOrgId)
|
1238
|
1313
|
|
1239
|
1314
|
tempWarehouseOut := models.DrugWarehouseOut{
|
1240
|
1315
|
ID: warehouseOut.ID,
|
|
@@ -1285,7 +1360,16 @@ func (c *StockDrugApiController) EditDrugWarehouseOut() {
|
1285
|
1360
|
}
|
1286
|
1361
|
price, _ := strconv.ParseFloat(items["price"].(string), 64)
|
1287
|
1362
|
|
|
1363
|
+ if items["retail_price"] == nil || reflect.TypeOf(items["retail_price"]).String() != "string" {
|
|
1364
|
+ utils.ErrorLog("retail_price")
|
|
1365
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
1366
|
+ return
|
|
1367
|
+ }
|
|
1368
|
+ retail_price, _ := strconv.ParseFloat(items["retail_price"].(string), 64)
|
|
1369
|
+
|
1288
|
1370
|
total := float64(count) * price
|
|
1371
|
+ retail_price_total := float64(count) * retail_price
|
|
1372
|
+
|
1289
|
1373
|
remark := items["remark"].(string)
|
1290
|
1374
|
|
1291
|
1375
|
if items["id"] == nil || reflect.TypeOf(items["id"]).String() != "float64" {
|
|
@@ -1312,6 +1396,8 @@ func (c *StockDrugApiController) EditDrugWarehouseOut() {
|
1312
|
1396
|
Dealer: dealer_id,
|
1313
|
1397
|
IsSys: 0,
|
1314
|
1398
|
SysRecordTime: 0,
|
|
1399
|
+ RetailPrice: retail_price,
|
|
1400
|
+ RetailTotalPrice: retail_price_total,
|
1315
|
1401
|
}
|
1316
|
1402
|
warehousingOutInfo = append(warehousingOutInfo, warehouseOutInfo)
|
1317
|
1403
|
|
|
@@ -1348,6 +1434,8 @@ func (c *StockDrugApiController) EditDrugWarehouseOut() {
|
1348
|
1434
|
Dealer: dealer_id,
|
1349
|
1435
|
IsSys: is_sys,
|
1350
|
1436
|
SysRecordTime: sys_record_time,
|
|
1437
|
+ RetailPrice: retail_price,
|
|
1438
|
+ RetailTotalPrice: retail_price_total,
|
1351
|
1439
|
}
|
1352
|
1440
|
upDateWarehouseOutInfos = append(upDateWarehouseOutInfos, warehouseOutInfo)
|
1353
|
1441
|
}
|
|
@@ -1367,7 +1455,7 @@ func (c *StockDrugApiController) EditDrugWarehouseOut() {
|
1367
|
1455
|
|
1368
|
1456
|
if errs != nil {
|
1369
|
1457
|
utils.ErrorLog(errs.Error())
|
1370
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateStockInFail)
|
|
1458
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateStockOutFail)
|
1371
|
1459
|
return
|
1372
|
1460
|
}
|
1373
|
1461
|
|
|
@@ -1447,17 +1535,37 @@ func (c *StockDrugApiController) CreateDrugCancelStock() {
|
1447
|
1535
|
|
1448
|
1536
|
count, _ := strconv.ParseInt(return_count, 10, 64)
|
1449
|
1537
|
|
|
1538
|
+ if items["price"] == nil || reflect.TypeOf(items["price"]).String() != "string" {
|
|
1539
|
+ utils.ErrorLog("price")
|
|
1540
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
1541
|
+ return
|
|
1542
|
+ }
|
|
1543
|
+ price, _ := strconv.ParseFloat(items["price"].(string), 64)
|
|
1544
|
+ total := float64(count) * price
|
|
1545
|
+
|
|
1546
|
+ if items["retail_price"] == nil || reflect.TypeOf(items["retail_price"]).String() != "string" {
|
|
1547
|
+ utils.ErrorLog("retail_price")
|
|
1548
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
1549
|
+ return
|
|
1550
|
+ }
|
|
1551
|
+ retail_price, _ := strconv.ParseFloat(items["retail_price"].(string), 64)
|
|
1552
|
+ retail_price_total := float64(count) * retail_price
|
|
1553
|
+
|
1450
|
1554
|
cancelStockInfo := &models.DrugCancelStockInfo{
|
1451
|
|
- OrderNumber: cancelStock.OrderNumber,
|
1452
|
|
- CancelStockId: cancelStock.ID,
|
1453
|
|
- DrugId: drug_id,
|
1454
|
|
- Count: count,
|
1455
|
|
- Status: 1,
|
1456
|
|
- Ctime: ctime,
|
1457
|
|
- OrgId: adminUserInfo.CurrentOrgId,
|
1458
|
|
- Type: types,
|
1459
|
|
- Manufacturer: manufacturer_id,
|
1460
|
|
- Dealer: dealer_id,
|
|
1555
|
+ OrderNumber: cancelStock.OrderNumber,
|
|
1556
|
+ CancelStockId: cancelStock.ID,
|
|
1557
|
+ DrugId: drug_id,
|
|
1558
|
+ Count: count,
|
|
1559
|
+ Status: 1,
|
|
1560
|
+ Ctime: ctime,
|
|
1561
|
+ OrgId: adminUserInfo.CurrentOrgId,
|
|
1562
|
+ Type: types,
|
|
1563
|
+ Manufacturer: manufacturer_id,
|
|
1564
|
+ Dealer: dealer_id,
|
|
1565
|
+ Total: total,
|
|
1566
|
+ RetailPrice: retail_price,
|
|
1567
|
+ RetailTotalPrice: retail_price_total,
|
|
1568
|
+ Price: price,
|
1461
|
1569
|
}
|
1462
|
1570
|
cancelStockInfos = append(cancelStockInfos, cancelStockInfo)
|
1463
|
1571
|
|
|
@@ -1478,9 +1586,10 @@ func (c *StockDrugApiController) CreateDrugCancelStock() {
|
1478
|
1586
|
}
|
1479
|
1587
|
func (c *StockDrugApiController) GetDrugCancelStockInfoList() {
|
1480
|
1588
|
id, _ := c.GetInt64("id", 0)
|
|
1589
|
+ adminUserInfo := c.GetAdminUserInfo()
|
1481
|
1590
|
|
1482
|
|
- cancelStockInfoList, _ := service.FindDrugCancelStockInfoById(id)
|
1483
|
|
- info, _ := service.FindCancelStockById(id)
|
|
1591
|
+ cancelStockInfoList, _ := service.FindDrugCancelStockInfoById(id, adminUserInfo.CurrentOrgId)
|
|
1592
|
+ info, _ := service.FindCancelStockById(id, adminUserInfo.CurrentOrgId)
|
1484
|
1593
|
|
1485
|
1594
|
c.ServeSuccessJSON(map[string]interface{}{
|
1486
|
1595
|
"list": cancelStockInfoList,
|
|
@@ -1633,6 +1742,24 @@ func (c *StockDrugApiController) EditDrugCancelStock() {
|
1633
|
1742
|
|
1634
|
1743
|
count, _ := strconv.ParseInt(items["count"].(string), 10, 64)
|
1635
|
1744
|
|
|
1745
|
+ //count, _ := strconv.ParseInt(return_count, 10, 64)
|
|
1746
|
+
|
|
1747
|
+ if items["price"] == nil || reflect.TypeOf(items["price"]).String() != "string" {
|
|
1748
|
+ utils.ErrorLog("price")
|
|
1749
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
1750
|
+ return
|
|
1751
|
+ }
|
|
1752
|
+ price, _ := strconv.ParseFloat(items["price"].(string), 64)
|
|
1753
|
+ total := float64(count) * price
|
|
1754
|
+
|
|
1755
|
+ if items["retail_price"] == nil || reflect.TypeOf(items["retail_price"]).String() != "string" {
|
|
1756
|
+ utils.ErrorLog("retail_price")
|
|
1757
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
1758
|
+ return
|
|
1759
|
+ }
|
|
1760
|
+ retail_price, _ := strconv.ParseFloat(items["retail_price"].(string), 64)
|
|
1761
|
+ retail_price_total := float64(count) * retail_price
|
|
1762
|
+
|
1636
|
1763
|
if items["id"] == nil || reflect.TypeOf(items["id"]).String() != "float64" {
|
1637
|
1764
|
utils.ErrorLog("id")
|
1638
|
1765
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
@@ -1642,34 +1769,42 @@ func (c *StockDrugApiController) EditDrugCancelStock() {
|
1642
|
1769
|
|
1643
|
1770
|
if id == 0 {
|
1644
|
1771
|
cancelStockInfo := &models.DrugCancelStockInfo{
|
1645
|
|
- DrugId: drug_id,
|
1646
|
|
- Count: count,
|
1647
|
|
- Status: 1,
|
1648
|
|
- Ctime: ctime,
|
1649
|
|
- OrgId: adminUserInfo.CurrentOrgId,
|
1650
|
|
- OrderNumber: cancelStock.OrderNumber,
|
1651
|
|
- CancelStockId: cancelStock.ID,
|
1652
|
|
- Mtime: time.Now().Unix(),
|
1653
|
|
- Type: types,
|
1654
|
|
- Manufacturer: manufacturer_id,
|
1655
|
|
- Dealer: dealer_id,
|
|
1772
|
+ DrugId: drug_id,
|
|
1773
|
+ Count: count,
|
|
1774
|
+ Status: 1,
|
|
1775
|
+ Ctime: ctime,
|
|
1776
|
+ OrgId: adminUserInfo.CurrentOrgId,
|
|
1777
|
+ OrderNumber: cancelStock.OrderNumber,
|
|
1778
|
+ CancelStockId: cancelStock.ID,
|
|
1779
|
+ Mtime: time.Now().Unix(),
|
|
1780
|
+ Type: types,
|
|
1781
|
+ Manufacturer: manufacturer_id,
|
|
1782
|
+ Dealer: dealer_id,
|
|
1783
|
+ RetailPrice: retail_price,
|
|
1784
|
+ RetailTotalPrice: retail_price_total,
|
|
1785
|
+ Price: price,
|
|
1786
|
+ Total: total,
|
1656
|
1787
|
}
|
1657
|
1788
|
cancelStockInfos = append(cancelStockInfos, cancelStockInfo)
|
1658
|
1789
|
|
1659
|
1790
|
} else {
|
1660
|
1791
|
cancelStockInfo := &models.DrugCancelStockInfo{
|
1661
|
|
- ID: id,
|
1662
|
|
- DrugId: drug_id,
|
1663
|
|
- Count: count,
|
1664
|
|
- Status: 1,
|
1665
|
|
- Ctime: ctime,
|
1666
|
|
- OrgId: adminUserInfo.CurrentOrgId,
|
1667
|
|
- OrderNumber: cancelStock.OrderNumber,
|
1668
|
|
- CancelStockId: cancelStock.ID,
|
1669
|
|
- Mtime: time.Now().Unix(),
|
1670
|
|
- Type: types,
|
1671
|
|
- Manufacturer: manufacturer_id,
|
1672
|
|
- Dealer: dealer_id,
|
|
1792
|
+ ID: id,
|
|
1793
|
+ DrugId: drug_id,
|
|
1794
|
+ Count: count,
|
|
1795
|
+ Status: 1,
|
|
1796
|
+ Ctime: ctime,
|
|
1797
|
+ OrgId: adminUserInfo.CurrentOrgId,
|
|
1798
|
+ OrderNumber: cancelStock.OrderNumber,
|
|
1799
|
+ CancelStockId: cancelStock.ID,
|
|
1800
|
+ Mtime: time.Now().Unix(),
|
|
1801
|
+ Type: types,
|
|
1802
|
+ Manufacturer: manufacturer_id,
|
|
1803
|
+ Dealer: dealer_id,
|
|
1804
|
+ RetailPrice: retail_price,
|
|
1805
|
+ RetailTotalPrice: retail_price_total,
|
|
1806
|
+ Price: price,
|
|
1807
|
+ Total: total,
|
1673
|
1808
|
}
|
1674
|
1809
|
upDateCancelStockInfos = append(upDateCancelStockInfos, cancelStockInfo)
|
1675
|
1810
|
}
|
|
@@ -1689,7 +1824,7 @@ func (c *StockDrugApiController) EditDrugCancelStock() {
|
1689
|
1824
|
|
1690
|
1825
|
if errs != nil {
|
1691
|
1826
|
utils.ErrorLog(errs.Error())
|
1692
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateStockInFail)
|
|
1827
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateCancelStockFail)
|
1693
|
1828
|
return
|
1694
|
1829
|
}
|
1695
|
1830
|
|
|
@@ -1703,11 +1838,13 @@ func (c *StockDrugApiController) GetAllConfig() {
|
1703
|
1838
|
adminUserInfo := c.GetAdminUserInfo()
|
1704
|
1839
|
manufacturer, _ := service.FindAllManufacturer(adminUserInfo.CurrentOrgId)
|
1705
|
1840
|
dealer, _ := service.FindAllDealer(adminUserInfo.CurrentOrgId)
|
|
1841
|
+ stockIns, _ := service.FindStockInNumber(adminUserInfo.CurrentOrgId)
|
1706
|
1842
|
drugs, _ := service.GetDrugs(adminUserInfo.CurrentOrgId)
|
1707
|
1843
|
c.ServeSuccessJSON(map[string]interface{}{
|
1708
|
1844
|
"manufacturer": manufacturer,
|
1709
|
1845
|
"dealer": dealer,
|
1710
|
1846
|
"drugs": drugs,
|
|
1847
|
+ "numbers": stockIns,
|
1711
|
1848
|
})
|
1712
|
1849
|
}
|
1713
|
1850
|
|
|
@@ -1724,3 +1861,20 @@ func (c *StockDrugApiController) GetAllDrugStock() {
|
1724
|
1861
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
1725
|
1862
|
}
|
1726
|
1863
|
}
|
|
1864
|
+
|
|
1865
|
+func (c *StockDrugApiController) GetDrugQueryInfo() {
|
|
1866
|
+ page, _ := c.GetInt64("page", -1)
|
|
1867
|
+ limit, _ := c.GetInt64("limit", -1)
|
|
1868
|
+ keyword := c.GetString("keyword")
|
|
1869
|
+
|
|
1870
|
+ adminUserInfo := c.GetAdminUserInfo()
|
|
1871
|
+ list, total, err := service.FindAllStockInfo(adminUserInfo.CurrentOrgId, page, limit, keyword)
|
|
1872
|
+ if err == nil {
|
|
1873
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
1874
|
+ "list": list,
|
|
1875
|
+ "total": total,
|
|
1876
|
+ })
|
|
1877
|
+ } else {
|
|
1878
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
1879
|
+ }
|
|
1880
|
+}
|