|
@@ -40,25 +40,6 @@ func SecondaryOrderApiRegistRouters() {
|
40
|
40
|
beego.Router("/api/secondary/byliinit", &SecondaryOrderApiController{}, "get:Byliinit") //初始化旧数据
|
41
|
41
|
beego.Router("/api/secondary/getcreaterid", &SecondaryOrderApiController{}, "get:GetCreaterId") //获取当前登录的人的id
|
42
|
42
|
|
43
|
|
- beego.Router("/api/secondary/getcode", &SecondaryOrderApiController{}, "get:GetStoreCode") //获取仓库编码
|
44
|
|
- beego.Router("/api/secondary/updatestatus", &SecondaryOrderApiController{}, "get:UpdateStatus") //修改仓库状态
|
45
|
|
- beego.Router("/api/secondary/deletestorehouse", &SecondaryOrderApiController{}, "get:DeleteStorehouse") //删除仓库
|
46
|
|
- beego.Router("/api/secondary/isstorehousename", &SecondaryOrderApiController{}, "get:IsStorehouseName") //仓库名称是否重复
|
47
|
|
- beego.Router("/api/secondary/isstorehouseaddress", &SecondaryOrderApiController{}, "get:IsStorehouseAddress") //仓库地址是否重复
|
48
|
|
- beego.Router("/api/secondary/storehouselist", &SecondaryOrderApiController{}, "get:StorehouseList") //分页
|
49
|
|
- beego.Router("/api/secondary/addstorehouse", &SecondaryOrderApiController{}, "post:AddStorehouse") //新增仓库
|
50
|
|
- beego.Router("/api/secondary/updatestorehouse", &SecondaryOrderApiController{}, "post:UpdateStorehouse") //修改
|
51
|
|
- beego.Router("/api/secondary/getonestorehouse", &SecondaryOrderApiController{}, "get:GetOneStorehouse") //查一条仓库的信息
|
52
|
|
- beego.Router("/api/secondary/getallstorehousename", &SecondaryOrderApiController{}, "get:GetAllStorehouseName") //获取当前机构的所有可用仓库名称
|
53
|
|
- beego.Router("/api/secondary/findstorehouseconfig", &SecondaryOrderApiController{}, "get:FindStorehouseConfig") //查询该机构的仓库配置
|
54
|
|
- beego.Router("/api/secondary/updateinfo", &SecondaryOrderApiController{}, "get:UpdateInfo") //更改耗材自动入库仓库
|
55
|
|
- beego.Router("/api/secondary/updateoutinfo", &SecondaryOrderApiController{}, "get:UpdateOutInfo") //更改耗材自动出库仓库
|
56
|
|
- beego.Router("/api/secondary/updatedruginfo", &SecondaryOrderApiController{}, "get:UpdateDrugInfo") //更改药品自动入库仓库
|
57
|
|
- beego.Router("/api/secondary/updatedrugout", &SecondaryOrderApiController{}, "get:UpdateDrugOut") //更改药品自动出库仓库
|
58
|
|
- beego.Router("/api/secondary/getusername", &SecondaryOrderApiController{}, "get:GetuserName") //获取仓库管理员信息
|
59
|
|
- beego.Router("/api/secondary/byliinit", &SecondaryOrderApiController{}, "get:Byliinit") //初始化旧数据
|
60
|
|
- beego.Router("/api/secondary/getcreaterid", &SecondaryOrderApiController{}, "get:GetCreaterId")
|
61
|
|
-
|
62
|
43
|
beego.Router("/api/seconde/getsencondegoodlist", &SecondaryOrderApiController{}, "Get:GetSencondeGoodList")
|
63
|
44
|
beego.Router("/api/senconde/savesencondorder", &SecondaryOrderApiController{}, "Post:SaveSencondOrder")
|
64
|
45
|
beego.Router("/api/senconde/getallsecondeorderlist", &SecondaryOrderApiController{}, "Get:GetAllSecondeOrderList")
|
|
@@ -1538,7 +1519,7 @@ func (this *SecondaryOrderApiController) ReturnCheckSecondOrder() {
|
1538
|
1519
|
outList, _ := service.GetStoreWarehouseOutList(item.ProjectId, item.ID, item.UserOrgId)
|
1539
|
1520
|
for _, it := range outList {
|
1540
|
1521
|
//回退库存
|
1541
|
|
- service.ModifyStoreWarehouseById(it.WarehouseInfotId, item.Count)
|
|
1522
|
+ service.ModifyStoreWarehouseById(it.WarehouseInfotId, it.Count)
|
1542
|
1523
|
|
1543
|
1524
|
//获取入库单
|
1544
|
1525
|
storeWareing, _ := service.GetStoreWarehouseById(item.WarehouseId, it.OrgId)
|
|
@@ -1785,6 +1766,22 @@ func (this *SecondaryOrderApiController) UpdateInfo() {
|
1785
|
1766
|
}
|
1786
|
1767
|
id, _ := this.GetInt64("id")
|
1787
|
1768
|
err = service.UpdateInfo(orgId, id)
|
|
1769
|
+
|
|
1770
|
+ //查询默认仓库
|
|
1771
|
+ houseConfig, _ := service.GetAllStoreHouseConfig(orgId)
|
|
1772
|
+
|
|
1773
|
+ list, _ := service.GetAllGoodList(orgId)
|
|
1774
|
+ for _, item := range list {
|
|
1775
|
+ var sum_count int64
|
|
1776
|
+ var sum_in_count int64
|
|
1777
|
+ goodList, _ := service.GetGoodSumCountByStoreId(houseConfig.StorehouseOutInfo, item.ID, orgId)
|
|
1778
|
+ for _, it := range goodList {
|
|
1779
|
+ sum_count += it.StockCount
|
|
1780
|
+ sum_in_count += it.WarehousingCount
|
|
1781
|
+ }
|
|
1782
|
+ service.UpdateGoodByGoodId(item.ID, sum_count, sum_in_count, orgId)
|
|
1783
|
+ }
|
|
1784
|
+
|
1788
|
1785
|
if err != nil {
|
1789
|
1786
|
this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
|
1790
|
1787
|
return
|
|
@@ -1809,6 +1806,22 @@ func (this *SecondaryOrderApiController) UpdateOutInfo() {
|
1809
|
1806
|
}
|
1810
|
1807
|
id, _ := this.GetInt64("id")
|
1811
|
1808
|
err = service.UpdateOutInfo(orgId, id)
|
|
1809
|
+
|
|
1810
|
+ //查询默认仓库
|
|
1811
|
+ houseConfig, _ := service.GetAllStoreHouseConfig(orgId)
|
|
1812
|
+
|
|
1813
|
+ list, _ := service.GetAllGoodList(orgId)
|
|
1814
|
+ for _, item := range list {
|
|
1815
|
+ var sum_count int64
|
|
1816
|
+ var sum_in_count int64
|
|
1817
|
+ goodList, _ := service.GetGoodSumCountByStoreId(houseConfig.StorehouseOutInfo, item.ID, orgId)
|
|
1818
|
+ for _, it := range goodList {
|
|
1819
|
+ sum_count += it.StockCount
|
|
1820
|
+ sum_in_count += it.WarehousingCount
|
|
1821
|
+ }
|
|
1822
|
+ service.UpdateGoodByGoodId(item.ID, sum_count, sum_in_count, orgId)
|
|
1823
|
+ }
|
|
1824
|
+
|
1812
|
1825
|
if err != nil {
|
1813
|
1826
|
this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
|
1814
|
1827
|
return
|
|
@@ -1832,7 +1845,30 @@ func (this *SecondaryOrderApiController) UpdateDrugInfo() {
|
1832
|
1845
|
return
|
1833
|
1846
|
}
|
1834
|
1847
|
id, _ := this.GetInt64("id")
|
|
1848
|
+
|
1835
|
1849
|
err = service.UpdateDrugInfo2(orgId, id)
|
|
1850
|
+
|
|
1851
|
+ //查询默认仓库
|
|
1852
|
+ houseConfig, _ := service.GetAllStoreHouseConfig(orgId)
|
|
1853
|
+ baseDrug, _ := service.GetAllBaseDrugList(orgId)
|
|
1854
|
+
|
|
1855
|
+ for _, item := range baseDrug {
|
|
1856
|
+ var sum_drug_count int64
|
|
1857
|
+ var sum_drug_in_count int64
|
|
1858
|
+
|
|
1859
|
+ //查询默认仓库剩余多少库存
|
|
1860
|
+ list, _ := service.GetDrugSumCountByStorehouseId(houseConfig.DrugStorehouseOut, orgId, item.ID)
|
|
1861
|
+ for _, it := range list {
|
|
1862
|
+ if it.MaxUnit == item.MaxUnit {
|
|
1863
|
+ it.StockMaxNumber = it.StockMaxNumber * item.MinNumber
|
|
1864
|
+ it.WarehousingCount = it.WarehousingCount * item.MinNumber
|
|
1865
|
+ }
|
|
1866
|
+ sum_drug_count += it.StockMaxNumber + it.StockMinNumber
|
|
1867
|
+ sum_drug_in_count += it.WarehousingCount
|
|
1868
|
+ }
|
|
1869
|
+ service.UpdateMedicalSumCount(item.ID, sum_drug_count, sum_drug_in_count, orgId)
|
|
1870
|
+ }
|
|
1871
|
+
|
1836
|
1872
|
if err != nil {
|
1837
|
1873
|
this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
|
1838
|
1874
|
return
|
|
@@ -1857,6 +1893,28 @@ func (this *SecondaryOrderApiController) UpdateDrugOut() {
|
1857
|
1893
|
}
|
1858
|
1894
|
id, _ := this.GetInt64("id")
|
1859
|
1895
|
err = service.UpdateDrugOut(orgId, id)
|
|
1896
|
+
|
|
1897
|
+ //查询默认仓库
|
|
1898
|
+ houseConfig, _ := service.GetAllStoreHouseConfig(orgId)
|
|
1899
|
+ baseDrug, _ := service.GetAllBaseDrugList(orgId)
|
|
1900
|
+
|
|
1901
|
+ for _, item := range baseDrug {
|
|
1902
|
+ var sum_drug_count int64
|
|
1903
|
+ var sum_drug_in_count int64
|
|
1904
|
+
|
|
1905
|
+ //查询默认仓库剩余多少库存
|
|
1906
|
+ list, _ := service.GetDrugSumCountByStorehouseId(houseConfig.DrugStorehouseOut, orgId, item.ID)
|
|
1907
|
+ for _, it := range list {
|
|
1908
|
+ if it.MaxUnit == item.MaxUnit {
|
|
1909
|
+ it.StockMaxNumber = it.StockMaxNumber * item.MinNumber
|
|
1910
|
+ it.WarehousingCount = it.WarehousingCount * item.MinNumber
|
|
1911
|
+ }
|
|
1912
|
+ sum_drug_count += it.StockMaxNumber + it.StockMinNumber
|
|
1913
|
+ sum_drug_in_count += it.WarehousingCount
|
|
1914
|
+ }
|
|
1915
|
+ service.UpdateMedicalSumCount(item.ID, sum_drug_count, sum_drug_in_count, orgId)
|
|
1916
|
+ }
|
|
1917
|
+
|
1860
|
1918
|
if err != nil {
|
1861
|
1919
|
this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
|
1862
|
1920
|
return
|