|
@@ -78,6 +78,7 @@ func SelfDrugRouters() {
|
78
|
78
|
beego.Router("/api/drug/getdruginventoryprintlist", &SelfDrugApiController{}, "Get:GetDrugInventoryPrintList")
|
79
|
79
|
beego.Router("/api/drug/getinventorydetaillist", &SelfDrugApiController{}, "Get:GetDrugInventoryDetailList")
|
80
|
80
|
beego.Router("/api/drug/savedrugproofinventory", &SelfDrugApiController{}, "Get:SaveDrugProofInventory")
|
|
81
|
+ beego.Router("/api/drug/getdrugwarehouseinfototal", &StockManagerApiController{}, "Get:GetDrugWarehouseInfoTotal")
|
81
|
82
|
}
|
82
|
83
|
|
83
|
84
|
func (this *SelfDrugApiController) GetCurrentPatient() {
|
|
@@ -959,7 +960,7 @@ func (this *SelfDrugApiController) PostSearchDrugWarehouseList() {
|
959
|
960
|
}
|
960
|
961
|
|
961
|
962
|
func (this *SelfDrugApiController) SaveDrugPrice() {
|
962
|
|
- fmt.Println("999999999999999999999")
|
|
963
|
+
|
963
|
964
|
timeLayout := "2006-01-02"
|
964
|
965
|
loc, _ := time.LoadLocation("Local")
|
965
|
966
|
dataBody := make(map[string]interface{}, 0)
|
|
@@ -1020,12 +1021,12 @@ func (this *SelfDrugApiController) SaveDrugPrice() {
|
1020
|
1021
|
}
|
1021
|
1022
|
manufacturer := items["manufacturer"].(string)
|
1022
|
1023
|
|
1023
|
|
- //if items["specification_name"] == nil || reflect.TypeOf(items["specification_name"]).String() != "string" {
|
1024
|
|
- // utils.ErrorLog("specification_name")
|
1025
|
|
- // this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
1026
|
|
- // return
|
1027
|
|
- //}
|
1028
|
|
- //specification_name := items["specification_name"].(string)
|
|
1024
|
+ if items["specification_name"] == nil || reflect.TypeOf(items["specification_name"]).String() != "string" {
|
|
1025
|
+ utils.ErrorLog("specification_name")
|
|
1026
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
1027
|
+ return
|
|
1028
|
+ }
|
|
1029
|
+ specification_name := items["specification_name"].(string)
|
1029
|
1030
|
|
1030
|
1031
|
if items["remark"] == nil || reflect.TypeOf(items["remark"]).String() != "string" {
|
1031
|
1032
|
utils.ErrorLog("remark")
|
|
@@ -1048,13 +1049,6 @@ func (this *SelfDrugApiController) SaveDrugPrice() {
|
1048
|
1049
|
}
|
1049
|
1050
|
last_price, _ := strconv.ParseFloat(items["last_price"].(string), 64)
|
1050
|
1051
|
|
1051
|
|
- if items["count"] == nil || reflect.TypeOf(items["count"]).String() != "float64" {
|
1052
|
|
- utils.ErrorLog("count")
|
1053
|
|
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
1054
|
|
- return
|
1055
|
|
- }
|
1056
|
|
- count := int64(items["count"].(float64))
|
1057
|
|
-
|
1058
|
1052
|
if items["new_price"] == nil || reflect.TypeOf(items["new_price"]).String() != "string" {
|
1059
|
1053
|
utils.ErrorLog("new_price")
|
1060
|
1054
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
@@ -1090,9 +1084,8 @@ func (this *SelfDrugApiController) SaveDrugPrice() {
|
1090
|
1084
|
|
1091
|
1085
|
drugAdjust := models.XtDrugAdjustPrice{
|
1092
|
1086
|
DrugName: drug_name,
|
1093
|
|
- SpecificationName: "",
|
|
1087
|
+ SpecificationName: specification_name,
|
1094
|
1088
|
WarehousingUnit: warehousing_unit,
|
1095
|
|
- Count: count,
|
1096
|
1089
|
LastPrice: last_price,
|
1097
|
1090
|
RetailPrice: retail_price,
|
1098
|
1091
|
NewPrice: new_price,
|
|
@@ -1200,7 +1193,8 @@ func (this *SelfDrugApiController) SaveCheckDrugPrice() {
|
1200
|
1193
|
list, _ := service.GetDrugAdjuestPrice(ids)
|
1201
|
1194
|
for _, item := range list {
|
1202
|
1195
|
drug := models.BaseDrugLib{
|
1203
|
|
- RetailPrice: item.RetailPrice,
|
|
1196
|
+ RetailPrice: item.NewPrice,
|
|
1197
|
+ LastPrice: item.NewPrice,
|
1204
|
1198
|
}
|
1205
|
1199
|
service.UpdateBaseDrugOne(drug, item.DrugId)
|
1206
|
1200
|
}
|
|
@@ -1222,7 +1216,6 @@ func (this *SelfDrugApiController) SaveDrugDamage() {
|
1222
|
1216
|
for _, item := range tableData {
|
1223
|
1217
|
items := item.(map[string]interface{})
|
1224
|
1218
|
drug_name := items["drug_name"].(string)
|
1225
|
|
- fmt.Println("durg_nae232333223332232323323223232323", drug_name)
|
1226
|
1219
|
if items["drug_name"] == nil || reflect.TypeOf(items["drug_name"]).String() != "string" {
|
1227
|
1220
|
utils.ErrorLog("drug_name")
|
1228
|
1221
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
@@ -1361,6 +1354,26 @@ func (this *SelfDrugApiController) SaveDrugDamage() {
|
1361
|
1354
|
orgId := this.GetAdminUserInfo().CurrentOrgId
|
1362
|
1355
|
Creater := this.GetAdminUserInfo().AdminUser.Id
|
1363
|
1356
|
|
|
1357
|
+ if items["stock_max_number"] == nil || reflect.TypeOf(items["stock_max_number"]).String() != "float64" {
|
|
1358
|
+ utils.ErrorLog("stock_max_number")
|
|
1359
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
1360
|
+ return
|
|
1361
|
+ }
|
|
1362
|
+ stock_max_number := int64(items["stock_max_number"].(float64))
|
|
1363
|
+
|
|
1364
|
+ if items["stock_min_number"] == nil || reflect.TypeOf(items["stock_min_number"]).String() != "float64" {
|
|
1365
|
+ utils.ErrorLog("stock_min_number")
|
|
1366
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
1367
|
+ return
|
|
1368
|
+ }
|
|
1369
|
+ stock_min_number := int64(items["stock_min_number"].(float64))
|
|
1370
|
+
|
|
1371
|
+ if items["total"] == nil || reflect.TypeOf(items["total"]).String() != "string" {
|
|
1372
|
+ utils.ErrorLog("total")
|
|
1373
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
1374
|
+ return
|
|
1375
|
+ }
|
|
1376
|
+ total := items["total"].(string)
|
1364
|
1377
|
drugDamage := models.XtDrugDamage{
|
1365
|
1378
|
DrugName: drug_name,
|
1366
|
1379
|
SpecificationName: specification_name,
|
|
@@ -1388,6 +1401,9 @@ func (this *SelfDrugApiController) SaveDrugDamage() {
|
1388
|
1401
|
ProductDate: product_date,
|
1389
|
1402
|
WarehousingInfoId: warehousing_info_id,
|
1390
|
1403
|
DrugOriginPlace: drug_origin_place,
|
|
1404
|
+ StockMaxNumber: stock_max_number,
|
|
1405
|
+ StockMinNumber: stock_min_number,
|
|
1406
|
+ Total: total,
|
1391
|
1407
|
}
|
1392
|
1408
|
|
1393
|
1409
|
err := service.CreateDrugDamage(drugDamage)
|
|
@@ -1408,7 +1424,7 @@ func (this *SelfDrugApiController) GetDrugDamageList() {
|
1408
|
1424
|
fmt.Println(err)
|
1409
|
1425
|
orgId := this.GetAdminUserInfo().CurrentOrgId
|
1410
|
1426
|
keyword := this.GetString("keyword")
|
1411
|
|
- fmt.Println("keywoer2r2r32rwrwr", keyword)
|
|
1427
|
+
|
1412
|
1428
|
start_time := this.GetString("start_time")
|
1413
|
1429
|
end_time := this.GetString("end_time")
|
1414
|
1430
|
var startTime int64
|
|
@@ -1482,6 +1498,29 @@ func (this *SelfDrugApiController) SaveDrugDamagePrice() {
|
1482
|
1498
|
dealerList, _ := service.GetAllDealerList(adminUserInfo.CurrentOrgId)
|
1483
|
1499
|
var manufacturer_id int64
|
1484
|
1500
|
var dealer_id int64
|
|
1501
|
+ timeStr := time.Now().Format("2006-01-02")
|
|
1502
|
+ timeArr := strings.Split(timeStr, "-")
|
|
1503
|
+ total, _ := service.FindAllDrugWarehouseOut(adminUserInfo.CurrentOrgId)
|
|
1504
|
+
|
|
1505
|
+ total = total + 1
|
|
1506
|
+ warehousing_out_order := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + timeArr[0] + timeArr[1] + timeArr[2] + "000"
|
|
1507
|
+ number, _ := strconv.ParseInt(warehousing_out_order, 10, 64)
|
|
1508
|
+ number = number + total
|
|
1509
|
+ warehousing_out_order = "YPCKD" + strconv.FormatInt(number, 10)
|
|
1510
|
+ operation_time := time.Now().Unix()
|
|
1511
|
+ creater := adminUserInfo.AdminUser.Id
|
|
1512
|
+
|
|
1513
|
+ warehouseOut := models.DrugWarehouseOut{
|
|
1514
|
+ WarehouseOutOrderNumber: warehousing_out_order,
|
|
1515
|
+ OperationTime: operation_time,
|
|
1516
|
+ OrgId: adminUserInfo.CurrentOrgId,
|
|
1517
|
+ Creater: creater,
|
|
1518
|
+ Ctime: ctime,
|
|
1519
|
+ Status: 1,
|
|
1520
|
+ WarehouseOutTime: time.Now().Unix(),
|
|
1521
|
+ Type: 1,
|
|
1522
|
+ }
|
|
1523
|
+ service.AddSigleDrugWarehouseOut(&warehouseOut)
|
1485
|
1524
|
for _, item := range list {
|
1486
|
1525
|
for _, it := range manufacturerList {
|
1487
|
1526
|
if item.Manufacturer == it.ManufacturerName {
|
|
@@ -1495,29 +1534,6 @@ func (this *SelfDrugApiController) SaveDrugDamagePrice() {
|
1495
|
1534
|
}
|
1496
|
1535
|
}
|
1497
|
1536
|
|
1498
|
|
- timeStr := time.Now().Format("2006-01-02")
|
1499
|
|
- timeArr := strings.Split(timeStr, "-")
|
1500
|
|
- total, _ := service.FindAllDrugWarehouseOut(adminUserInfo.CurrentOrgId)
|
1501
|
|
-
|
1502
|
|
- total = total + 1
|
1503
|
|
- warehousing_out_order := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + timeArr[0] + timeArr[1] + timeArr[2] + "000"
|
1504
|
|
- number, _ := strconv.ParseInt(warehousing_out_order, 10, 64)
|
1505
|
|
- number = number + total
|
1506
|
|
- warehousing_out_order = "YPCKD" + strconv.FormatInt(number, 10)
|
1507
|
|
- operation_time := time.Now().Unix()
|
1508
|
|
- creater := adminUserInfo.AdminUser.Id
|
1509
|
|
-
|
1510
|
|
- warehouseOut := models.DrugWarehouseOut{
|
1511
|
|
- WarehouseOutOrderNumber: warehousing_out_order,
|
1512
|
|
- OperationTime: operation_time,
|
1513
|
|
- OrgId: adminUserInfo.CurrentOrgId,
|
1514
|
|
- Creater: creater,
|
1515
|
|
- Ctime: ctime,
|
1516
|
|
- Status: 1,
|
1517
|
|
- WarehouseOutTime: time.Now().Unix(),
|
1518
|
|
- Type: 1,
|
1519
|
|
- }
|
1520
|
|
-
|
1521
|
1537
|
warehouseOutInfo := models.XtDrugWarehouseOutInfo{
|
1522
|
1538
|
WarehouseOutOrderNumber: warehouseOut.WarehouseOutOrderNumber,
|
1523
|
1539
|
WarehouseOutId: warehouseOut.ID,
|
|
@@ -1563,9 +1579,14 @@ func (this *SelfDrugApiController) SaveDrugDamagePrice() {
|
1563
|
1579
|
IsSys: 0,
|
1564
|
1580
|
}
|
1565
|
1581
|
service.CreateWareHouseOutInfo(&warehouseOutInfo)
|
1566
|
|
- service.AddSigleDrugWarehouseOut(&warehouseOut)
|
1567
|
1582
|
service.CreateDrugFlowOne(drugflow)
|
1568
|
1583
|
|
|
1584
|
+ info, _ := service.GetDrugByWarehouseInfo(item.WarehousingInfoId)
|
|
1585
|
+ //扣减库存
|
|
1586
|
+ warehouseInfo := models.XtDrugWarehouseInfo{
|
|
1587
|
+ StockMaxNumber: info.StockMaxNumber - info.StockMaxNumber,
|
|
1588
|
+ }
|
|
1589
|
+ service.UpdateDrugWarehouseingInfo(item.WarehousingInfoId, warehouseInfo)
|
1569
|
1590
|
}
|
1570
|
1591
|
this.ServeSuccessJSON(map[string]interface{}{
|
1571
|
1592
|
"damage": damage,
|
|
@@ -1585,6 +1606,10 @@ func (this *SelfDrugApiController) GetDrugModifyPrice() {
|
1585
|
1606
|
func (this *SelfDrugApiController) ModifyDrugPrice() {
|
1586
|
1607
|
|
1587
|
1608
|
drug_name := this.GetString("drug_name")
|
|
1609
|
+ specification_name := this.GetString("specification_name")
|
|
1610
|
+ warehousing_unit := this.GetString("warehousing_unit")
|
|
1611
|
+ manufacturer := this.GetString("manufacturer")
|
|
1612
|
+ number := this.GetString("number")
|
1588
|
1613
|
retailPrice := this.GetString("retail_price")
|
1589
|
1614
|
retail_price, _ := strconv.ParseFloat(retailPrice, 64)
|
1590
|
1615
|
newPrice := this.GetString("new_price")
|
|
@@ -1592,12 +1617,18 @@ func (this *SelfDrugApiController) ModifyDrugPrice() {
|
1592
|
1617
|
count, _ := this.GetInt64("count")
|
1593
|
1618
|
remark := this.GetString("remark")
|
1594
|
1619
|
id, _ := this.GetInt64("id")
|
|
1620
|
+ drug_id, _ := this.GetInt64("drug_id")
|
1595
|
1621
|
adjustPrice := models.XtDrugAdjustPrice{
|
1596
|
|
- DrugName: drug_name,
|
1597
|
|
- Count: count,
|
1598
|
|
- RetailPrice: retail_price,
|
1599
|
|
- NewPrice: new_price,
|
1600
|
|
- Remark: remark,
|
|
1622
|
+ DrugName: drug_name,
|
|
1623
|
+ Count: count,
|
|
1624
|
+ RetailPrice: retail_price,
|
|
1625
|
+ NewPrice: new_price,
|
|
1626
|
+ Remark: remark,
|
|
1627
|
+ SpecificationName: specification_name,
|
|
1628
|
+ WarehousingUnit: warehousing_unit,
|
|
1629
|
+ Manufacturer: manufacturer,
|
|
1630
|
+ Number: number,
|
|
1631
|
+ DrugId: drug_id,
|
1601
|
1632
|
}
|
1602
|
1633
|
err := service.ModifyDrugPrice(id, adjustPrice)
|
1603
|
1634
|
fmt.Println(err)
|
|
@@ -1631,7 +1662,7 @@ func (this *SelfDrugApiController) ModifyDrugDamage() {
|
1631
|
1662
|
id, _ := this.GetInt64("id")
|
1632
|
1663
|
drug_id, _ := this.GetInt64("drug_id")
|
1633
|
1664
|
drug_name := this.GetString("drug_name")
|
1634
|
|
- //drug_origin_place := this.GetString("drug_origin_place")
|
|
1665
|
+ drug_origin_place := this.GetString("drug_origin_place")
|
1635
|
1666
|
lastPrice := this.GetString("last_price")
|
1636
|
1667
|
last_price, _ := strconv.ParseFloat(lastPrice, 64)
|
1637
|
1668
|
newPrice := this.GetString("new_price")
|
|
@@ -1643,7 +1674,9 @@ func (this *SelfDrugApiController) ModifyDrugDamage() {
|
1643
|
1674
|
remark := this.GetString("remark")
|
1644
|
1675
|
count, _ := this.GetInt64("count")
|
1645
|
1676
|
warehousing_unit := this.GetString("warehousing_unit")
|
1646
|
|
-
|
|
1677
|
+ stock_max_number, _ := this.GetInt64("stock_max_number")
|
|
1678
|
+ stock_min_number, _ := this.GetInt64("stock_min_number")
|
|
1679
|
+ warehousing_info_id, _ := this.GetInt64("warehousing_info_id")
|
1647
|
1680
|
damage := models.XtDrugDamage{
|
1648
|
1681
|
DrugName: drug_name,
|
1649
|
1682
|
SpecificationName: "",
|
|
@@ -1657,6 +1690,10 @@ func (this *SelfDrugApiController) ModifyDrugDamage() {
|
1657
|
1690
|
Remark: remark,
|
1658
|
1691
|
DrugId: drug_id,
|
1659
|
1692
|
Number: number,
|
|
1693
|
+ StockMaxNumber: stock_max_number,
|
|
1694
|
+ StockMinNumber: stock_min_number,
|
|
1695
|
+ WarehousingInfoId: warehousing_info_id,
|
|
1696
|
+ DrugOriginPlace: drug_origin_place,
|
1660
|
1697
|
}
|
1661
|
1698
|
err := service.ModifyDrugDamage(id, damage)
|
1662
|
1699
|
fmt.Println(err)
|
|
@@ -1969,6 +2006,190 @@ func (this *SelfDrugApiController) SaveDrugCheckInventory() {
|
1969
|
2006
|
}
|
1970
|
2007
|
err = service.UpdateDrugInventory(ids, inventory)
|
1971
|
2008
|
fmt.Println(err)
|
|
2009
|
+
|
|
2010
|
+ list, _ := service.GetDrugInventoryListByIds(ids)
|
|
2011
|
+
|
|
2012
|
+ adminUserInfo := this.GetAdminUserInfo()
|
|
2013
|
+ var stock_total int64
|
|
2014
|
+ var proof_count int64
|
|
2015
|
+ var maxNumber int64
|
|
2016
|
+ var minNumber int64
|
|
2017
|
+ for _, item := range list {
|
|
2018
|
+
|
|
2019
|
+ //查询库存信息
|
|
2020
|
+ drug, _ := service.GetDrugDetailByDrugId(item.DrugId)
|
|
2021
|
+
|
|
2022
|
+ //查询库存
|
|
2023
|
+ info, _ := service.GetDrugWareInfoById(item.WarehouseInfoId)
|
|
2024
|
+
|
|
2025
|
+ //获取最晚的库存数量
|
|
2026
|
+ lastInfo, _ := service.GetLastDrugWarehouseInfo(item.DrugId)
|
|
2027
|
+ firstInfo, _ := service.GetFirstDrugWarehouseInfo(item.DrugId)
|
|
2028
|
+ stock_total = info.StockMaxNumber*drug.MinNumber + info.StockMinNumber
|
|
2029
|
+ proof_count = item.StockMaxNumber*drug.MinNumber + item.StockMinNumber
|
|
2030
|
+
|
|
2031
|
+ //判断 如果库存数量 大于盘点库存,则出库
|
|
2032
|
+ if stock_total > proof_count {
|
|
2033
|
+ minNumber = (stock_total - proof_count) % drug.MinNumber
|
|
2034
|
+ maxNumber = (stock_total - proof_count) / drug.MinNumber
|
|
2035
|
+
|
|
2036
|
+ ctime := time.Now().Unix()
|
|
2037
|
+
|
|
2038
|
+ timeStr := time.Now().Format("2006-01-02")
|
|
2039
|
+ timeArr := strings.Split(timeStr, "-")
|
|
2040
|
+ total, _ := service.FindAllDrugWarehouseOut(adminUserInfo.CurrentOrgId)
|
|
2041
|
+
|
|
2042
|
+ total = total + 1
|
|
2043
|
+ warehousing_out_order := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + timeArr[0] + timeArr[1] + timeArr[2] + "000"
|
|
2044
|
+ number, _ := strconv.ParseInt(warehousing_out_order, 10, 64)
|
|
2045
|
+ number = number + total
|
|
2046
|
+ warehousing_out_order = "YPCKD" + strconv.FormatInt(number, 10)
|
|
2047
|
+ operation_time := time.Now().Unix()
|
|
2048
|
+ creater := adminUserInfo.AdminUser.Id
|
|
2049
|
+
|
|
2050
|
+ warehouseOut := models.DrugWarehouseOut{
|
|
2051
|
+ WarehouseOutOrderNumber: warehousing_out_order,
|
|
2052
|
+ OperationTime: operation_time,
|
|
2053
|
+ OrgId: adminUserInfo.CurrentOrgId,
|
|
2054
|
+ Creater: creater,
|
|
2055
|
+ Ctime: ctime,
|
|
2056
|
+ Status: 1,
|
|
2057
|
+ WarehouseOutTime: ctime,
|
|
2058
|
+ Type: 1,
|
|
2059
|
+ }
|
|
2060
|
+
|
|
2061
|
+ warehouseOutInfo := models.DrugWarehouseOutInfo{
|
|
2062
|
+ WarehouseOutOrderNumber: warehouseOut.WarehouseOutOrderNumber,
|
|
2063
|
+ WarehouseOutId: warehouseOut.ID,
|
|
2064
|
+ DrugId: firstInfo.DrugId,
|
|
2065
|
+ Count: maxNumber,
|
|
2066
|
+ Price: firstInfo.Price,
|
|
2067
|
+ TotalPrice: firstInfo.TotalPrice,
|
|
2068
|
+ Status: 1,
|
|
2069
|
+ Ctime: ctime,
|
|
2070
|
+ Remark: item.Remark,
|
|
2071
|
+ OrgId: adminUserInfo.CurrentOrgId,
|
|
2072
|
+ Type: 1,
|
|
2073
|
+ Manufacturer: firstInfo.Manufacturer,
|
|
2074
|
+ Dealer: firstInfo.Dealer,
|
|
2075
|
+ RetailPrice: firstInfo.RetailPrice,
|
|
2076
|
+ RetailTotalPrice: firstInfo.RetailTotalPrice,
|
|
2077
|
+ CountUnit: drug.MaxUnit,
|
|
2078
|
+ ExpiryDate: firstInfo.ExpiryDate,
|
|
2079
|
+ ProductDate: firstInfo.ProductDate,
|
|
2080
|
+ Number: firstInfo.Number,
|
|
2081
|
+ BatchNumber: firstInfo.BatchNumber,
|
|
2082
|
+ IsSys: 0,
|
|
2083
|
+ WarehouseInfoId: firstInfo.ID,
|
|
2084
|
+ }
|
|
2085
|
+
|
|
2086
|
+ drugflow := models.DrugFlow{
|
|
2087
|
+ WarehouseOutId: warehouseOut.ID,
|
|
2088
|
+ WarehouseOutOrderNumber: warehousing_out_order,
|
|
2089
|
+ DrugId: firstInfo.DrugId,
|
|
2090
|
+ Number: firstInfo.Number,
|
|
2091
|
+ ProductDate: firstInfo.ProductDate,
|
|
2092
|
+ ExpireDate: firstInfo.ExpiryDate,
|
|
2093
|
+ Count: maxNumber,
|
|
2094
|
+ Price: firstInfo.Price,
|
|
2095
|
+ Status: 1,
|
|
2096
|
+ Ctime: ctime,
|
|
2097
|
+ UserOrgId: adminUserInfo.CurrentOrgId,
|
|
2098
|
+ Manufacturer: firstInfo.Manufacturer,
|
|
2099
|
+ Dealer: firstInfo.Dealer,
|
|
2100
|
+ BatchNumber: firstInfo.BatchNumber,
|
|
2101
|
+ MaxUnit: drug.MaxUnit,
|
|
2102
|
+ ConsumableType: 2,
|
|
2103
|
+ IsEdit: 1,
|
|
2104
|
+ Creator: adminUserInfo.AdminUser.Id,
|
|
2105
|
+ IsSys: 0,
|
|
2106
|
+ }
|
|
2107
|
+
|
|
2108
|
+ service.AddSigleDrugWarehouseOut(&warehouseOut)
|
|
2109
|
+ service.CreateDrugWarehouseOutInfo(warehouseOutInfo)
|
|
2110
|
+ service.CreateDrugFlowOne(drugflow)
|
|
2111
|
+
|
|
2112
|
+ }
|
|
2113
|
+
|
|
2114
|
+ //判断 如果库存数量 小于于盘点库存,则入库
|
|
2115
|
+ if stock_total < proof_count {
|
|
2116
|
+
|
|
2117
|
+ maxNumber = (proof_count - stock_total) / drug.MinNumber
|
|
2118
|
+ minNumber = (proof_count - stock_total) % drug.MinNumber
|
|
2119
|
+ ctime := time.Now().Unix()
|
|
2120
|
+
|
|
2121
|
+ timeStr := time.Now().Format("2006-01-02")
|
|
2122
|
+ timeArr := strings.Split(timeStr, "-")
|
|
2123
|
+ total, _ := service.FindAllWarehouseTotalOne(adminUserInfo.CurrentOrgId)
|
|
2124
|
+ total = total + 1
|
|
2125
|
+ fmt.Println("total2323232323232", total)
|
|
2126
|
+ warehousing_order := "YPRKD" + strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + timeArr[0] + timeArr[1] + timeArr[2] + "000" + strconv.FormatInt(total, 10)
|
|
2127
|
+
|
|
2128
|
+ operation_time := time.Now().Unix()
|
|
2129
|
+ creater := adminUserInfo.AdminUser.Id
|
|
2130
|
+ warehousing := models.DrugWarehouse{
|
|
2131
|
+ WarehousingOrder: warehousing_order,
|
|
2132
|
+ OperationTime: operation_time,
|
|
2133
|
+ OrgId: adminUserInfo.CurrentOrgId,
|
|
2134
|
+ Creater: creater,
|
|
2135
|
+ Ctime: ctime,
|
|
2136
|
+ Status: 1,
|
|
2137
|
+ WarehousingTime: ctime,
|
|
2138
|
+ Type: 1,
|
|
2139
|
+ }
|
|
2140
|
+
|
|
2141
|
+ warehouseInfo := models.DrugWarehouseInfo{
|
|
2142
|
+ WarehousingOrder: warehousing.WarehousingOrder,
|
|
2143
|
+ WarehousingId: warehousing.ID,
|
|
2144
|
+ DrugId: lastInfo.DrugId,
|
|
2145
|
+ Number: lastInfo.Number,
|
|
2146
|
+ ProductDate: lastInfo.ProductDate,
|
|
2147
|
+ ExpiryDate: lastInfo.ExpiryDate,
|
|
2148
|
+ WarehousingCount: lastInfo.WarehousingCount,
|
|
2149
|
+ Price: lastInfo.Price,
|
|
2150
|
+ TotalPrice: lastInfo.TotalPrice,
|
|
2151
|
+ Status: 1,
|
|
2152
|
+ Ctime: ctime,
|
|
2153
|
+ Remark: item.Remark,
|
|
2154
|
+ OrgId: adminUserInfo.CurrentOrgId,
|
|
2155
|
+ Type: 1,
|
|
2156
|
+ Manufacturer: lastInfo.Manufacturer,
|
|
2157
|
+ Dealer: lastInfo.Dealer,
|
|
2158
|
+ StockMaxNumber: maxNumber,
|
|
2159
|
+ StockMinNumber: minNumber,
|
|
2160
|
+ RetailTotalPrice: lastInfo.RetailTotalPrice,
|
|
2161
|
+ BatchNumber: lastInfo.BatchNumber,
|
|
2162
|
+ MaxUnit: drug.MaxUnit,
|
|
2163
|
+ MinUnit: drug.MinUnit,
|
|
2164
|
+ }
|
|
2165
|
+
|
|
2166
|
+ drugflow := models.DrugFlow{
|
|
2167
|
+ WarehousingOrder: warehousing.WarehousingOrder,
|
|
2168
|
+ WarehousingId: warehousing.ID,
|
|
2169
|
+ DrugId: lastInfo.DrugId,
|
|
2170
|
+ Number: lastInfo.Number,
|
|
2171
|
+ ProductDate: lastInfo.ProductDate,
|
|
2172
|
+ ExpireDate: lastInfo.ExpiryDate,
|
|
2173
|
+ Count: maxNumber,
|
|
2174
|
+ Price: lastInfo.Price,
|
|
2175
|
+ Status: 1,
|
|
2176
|
+ Ctime: ctime,
|
|
2177
|
+ UserOrgId: adminUserInfo.CurrentOrgId,
|
|
2178
|
+ Manufacturer: lastInfo.Manufacturer,
|
|
2179
|
+ Dealer: lastInfo.Dealer,
|
|
2180
|
+ BatchNumber: lastInfo.BatchNumber,
|
|
2181
|
+ MaxUnit: drug.MaxUnit,
|
|
2182
|
+ MinUnit: drug.MinUnit,
|
|
2183
|
+ ConsumableType: 1,
|
|
2184
|
+ IsEdit: 1,
|
|
2185
|
+ Creator: adminUserInfo.AdminUser.Id,
|
|
2186
|
+ IsSys: 0,
|
|
2187
|
+ }
|
|
2188
|
+ service.AddSigleDrugWarehouse(&warehousing)
|
|
2189
|
+ service.CreateDrugWarehouseInfo(warehouseInfo)
|
|
2190
|
+ service.CreateDrugFlowOne(drugflow)
|
|
2191
|
+ }
|
|
2192
|
+ }
|
1972
|
2193
|
returnData := make(map[string]interface{}, 0)
|
1973
|
2194
|
returnData["msg"] = "ok"
|
1974
|
2195
|
this.ServeSuccessJSON(returnData)
|
|
@@ -2006,6 +2227,10 @@ func (this *SelfDrugApiController) ModifyInventory() {
|
2006
|
2227
|
last_price, _ := strconv.ParseFloat(lastPrice, 64)
|
2007
|
2228
|
count, _ := this.GetInt64("count")
|
2008
|
2229
|
drug_origin_place := this.GetString("drug_origin_place")
|
|
2230
|
+
|
|
2231
|
+ stock_max_number, _ := this.GetInt64("stock_max_number")
|
|
2232
|
+ stock_min_number, _ := this.GetInt64("stock_min_number")
|
|
2233
|
+ warehouse_info_id, _ := this.GetInt64("warehouse_info_id")
|
2009
|
2234
|
inventory := models.XtDrugInventory{
|
2010
|
2235
|
DrugName: drug_name,
|
2011
|
2236
|
SpecificationName: specification_name,
|
|
@@ -2020,6 +2245,9 @@ func (this *SelfDrugApiController) ModifyInventory() {
|
2020
|
2245
|
Number: number,
|
2021
|
2246
|
Total: total,
|
2022
|
2247
|
DrugOriginPlace: drug_origin_place,
|
|
2248
|
+ StockMaxNumber: stock_max_number,
|
|
2249
|
+ StockMinNumber: stock_min_number,
|
|
2250
|
+ WarehouseInfoId: warehouse_info_id,
|
2023
|
2251
|
}
|
2024
|
2252
|
err := service.ModifyDrugInventory(id, inventory)
|
2025
|
2253
|
if err != nil {
|
|
@@ -2086,19 +2314,19 @@ func (this *SelfDrugApiController) SaveDrugProofInventory() {
|
2086
|
2314
|
warehousing_unit := this.GetString("warehousing_unit")
|
2087
|
2315
|
remark := this.GetString("remark")
|
2088
|
2316
|
//total := this.GetString("total")
|
2089
|
|
- prof_count, _ := this.GetInt64("prof_count")
|
2090
|
|
-
|
|
2317
|
+ proof_count, _ := this.GetInt64("proof_count")
|
|
2318
|
+ fmt.Println("pof_count2222222", proof_count)
|
2091
|
2319
|
inventory := models.XtDrugInventory{
|
2092
|
2320
|
WarehouseInfoId: warehouse_info_id,
|
2093
|
|
- ProofCount: prof_count,
|
|
2321
|
+ ProofCount: proof_count,
|
2094
|
2322
|
WarehousingUnit: warehousing_unit,
|
2095
|
2323
|
Remark: remark,
|
2096
|
2324
|
}
|
2097
|
|
- err := service.UpdateDrugProofInventory(warehouse_info_id, &inventory)
|
|
2325
|
+ err := service.UpdateDrugProofInventory(id, &inventory)
|
2098
|
2326
|
info := models.XtDrugWarehouseInfo{
|
2099
|
|
- StockMaxNumber: prof_count,
|
|
2327
|
+ StockMaxNumber: proof_count,
|
2100
|
2328
|
}
|
2101
|
|
- service.UpdateDrugWarehouseInfoById(id, &info)
|
|
2329
|
+ service.UpdateDrugWarehouseInfoById(warehouse_info_id, &info)
|
2102
|
2330
|
if err != nil {
|
2103
|
2331
|
this.ServeFailJsonSend(enums.ErrorCodeDataException, "更新设备失败")
|
2104
|
2332
|
return
|
|
@@ -2108,3 +2336,13 @@ func (this *SelfDrugApiController) SaveDrugProofInventory() {
|
2108
|
2336
|
"inventory": inventory,
|
2109
|
2337
|
})
|
2110
|
2338
|
}
|
|
2339
|
+
|
|
2340
|
+func (this *StockManagerApiController) GetDrugWarehouseInfoTotal() {
|
|
2341
|
+
|
|
2342
|
+ id, _ := this.GetInt64("id")
|
|
2343
|
+ list, _ := service.GetDrugWarehouseInfoTotal(id)
|
|
2344
|
+
|
|
2345
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
2346
|
+ "list": list,
|
|
2347
|
+ })
|
|
2348
|
+}
|