XMLWAN vor 3 Jahren
Ursprung
Commit
52f2787524

+ 1 - 1
conf/app.conf Datei anzeigen

@@ -1,5 +1,5 @@
1 1
 appname = 血透
2
-httpport = 9531
2
+httpport = 9529
3 3
 runmode = dev
4 4
 
5 5
 #

+ 379 - 2
controllers/self_drug_api_congtroller.go Datei anzeigen

@@ -69,6 +69,14 @@ func SelfDrugRouters() {
69 69
 	beego.Router("/api/drug/deletedrugdamage", &SelfDrugApiController{}, "Get:DeleteDrugDamage")
70 70
 	beego.Router("/api/drug/getdrugdamageprint", &SelfDrugApiController{}, "Get:GetDrugDamagePrint")
71 71
 	beego.Router("/api/drug/warehouseinfobyid", &SelfDrugApiController{}, "Get:GetWarehoseInfoById")
72
+	beego.Router("/api/drug/savedruginventory", &SelfDrugApiController{}, "Post:SaveDrugInventory")
73
+	beego.Router("/api/drug/getdruginventorylist", &SelfDrugApiController{}, "Get:GetDrugInventoryList")
74
+	beego.Router("/api/drug/savedrugcheckinventory", &SelfDrugApiController{}, "Get:SaveDrugCheckInventory")
75
+	beego.Router("/api/drug/getdruginventorydetail", &SelfDrugApiController{}, "Get:GetDrugInventoryDetail")
76
+	beego.Router("/api/drug/modifyinventory", &SelfDrugApiController{}, "Get:ModifyInventory")
77
+	beego.Router("/api/drug/deletedruginventory", &SelfDrugApiController{}, "Delete:DeleteDrugInventory")
78
+	beego.Router("/api/drug/getdruginventoryprintlist", &SelfDrugApiController{}, "Get:GetDrugInventoryPrintList")
79
+	beego.Router("/api/drug/getinventorydetaillist", &SelfDrugApiController{}, "Get:GetDrugInventoryDetailList")
72 80
 }
73 81
 
74 82
 func (this *SelfDrugApiController) GetCurrentPatient() {
@@ -1391,8 +1399,7 @@ func (this *SelfDrugApiController) GetDrugDamageList() {
1391 1399
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "更新设备失败")
1392 1400
 		return
1393 1401
 	}
1394
-	fmt.Println("list232332", list)
1395
-	fmt.Println("total", total)
1402
+
1396 1403
 	this.ServeSuccessJSON(map[string]interface{}{
1397 1404
 		"total":      total,
1398 1405
 		"list":       list,
@@ -1554,3 +1561,373 @@ func (this *SelfDrugApiController) GetWarehoseInfoById() {
1554 1561
 		"list": list,
1555 1562
 	})
1556 1563
 }
1564
+
1565
+func (this *SelfDrugApiController) SaveDrugInventory() {
1566
+
1567
+	timeLayout := "2006-01-02"
1568
+	loc, _ := time.LoadLocation("Local")
1569
+	dataBody := make(map[string]interface{}, 0)
1570
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
1571
+	fmt.Println(err)
1572
+
1573
+	tableData, _ := dataBody["tableData"].([]interface{})
1574
+	fmt.Println("999939433443", tableData)
1575
+	if len(tableData) > 0 {
1576
+		for _, item := range tableData {
1577
+			items := item.(map[string]interface{})
1578
+			drug_name := items["drug_name"].(string)
1579
+			fmt.Println("durg_nae232333223332232323323223232323", drug_name)
1580
+			if items["drug_name"] == nil || reflect.TypeOf(items["drug_name"]).String() != "string" {
1581
+				utils.ErrorLog("drug_name")
1582
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1583
+				return
1584
+			}
1585
+
1586
+			if items["retail_price"] == nil || reflect.TypeOf(items["retail_price"]).String() != "string" {
1587
+				utils.ErrorLog("retail_price")
1588
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1589
+				return
1590
+			}
1591
+			retail_price, _ := strconv.ParseFloat(items["retail_price"].(string), 64)
1592
+
1593
+			if items["warehousing_order"] == nil || reflect.TypeOf(items["warehousing_order"]).String() != "string" {
1594
+				utils.ErrorLog("warehousing_order")
1595
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1596
+				return
1597
+			}
1598
+			warehousing_order := items["warehousing_order"].(string)
1599
+
1600
+			if items["dealer"] == nil || reflect.TypeOf(items["dealer"]).String() != "string" {
1601
+				utils.ErrorLog("dealer")
1602
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1603
+				return
1604
+			}
1605
+			dealer := items["dealer"].(string)
1606
+
1607
+			if items["manufacturer"] == nil || reflect.TypeOf(items["manufacturer"]).String() != "string" {
1608
+				utils.ErrorLog("manufacturer")
1609
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1610
+				return
1611
+			}
1612
+			manufacturer := items["manufacturer"].(string)
1613
+
1614
+			if items["specification_name"] == nil || reflect.TypeOf(items["specification_name"]).String() != "string" {
1615
+				utils.ErrorLog("specification_name")
1616
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1617
+				return
1618
+			}
1619
+			specification_name := items["specification_name"].(string)
1620
+
1621
+			if items["remark"] == nil || reflect.TypeOf(items["remark"]).String() != "string" {
1622
+				utils.ErrorLog("remark")
1623
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1624
+				return
1625
+			}
1626
+			remark := items["remark"].(string)
1627
+
1628
+			if items["warehousing_unit"] == nil || reflect.TypeOf(items["warehousing_unit"]).String() != "string" {
1629
+				utils.ErrorLog("warehousing_unit")
1630
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1631
+				return
1632
+			}
1633
+			warehousing_unit := items["warehousing_unit"].(string)
1634
+
1635
+			if items["last_price"] == nil || reflect.TypeOf(items["last_price"]).String() != "string" {
1636
+				utils.ErrorLog("last_price")
1637
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1638
+				return
1639
+			}
1640
+			last_price, _ := strconv.ParseFloat(items["last_price"].(string), 64)
1641
+
1642
+			if items["count"] == nil || reflect.TypeOf(items["count"]).String() != "float64" {
1643
+				utils.ErrorLog("count")
1644
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1645
+				return
1646
+			}
1647
+			count := int64(items["count"].(float64))
1648
+
1649
+			if items["new_price"] == nil || reflect.TypeOf(items["new_price"]).String() != "string" {
1650
+				utils.ErrorLog("new_price")
1651
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1652
+				return
1653
+			}
1654
+			new_price, _ := strconv.ParseFloat(items["new_price"].(string), 64)
1655
+
1656
+			if items["drug_id"] == nil || reflect.TypeOf(items["drug_id"]).String() != "float64" {
1657
+				utils.ErrorLog("drug_id")
1658
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1659
+				return
1660
+			}
1661
+			drug_id := int64(items["drug_id"].(float64))
1662
+
1663
+			if items["start_time"] == nil || reflect.TypeOf(items["start_time"]).String() != "string" {
1664
+				utils.ErrorLog("start_time")
1665
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1666
+				return
1667
+			}
1668
+			var startTime int64
1669
+			start_time := items["start_time"].(string)
1670
+			if len(start_time) > 0 {
1671
+				theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
1672
+				if err != nil {
1673
+					fmt.Println(err)
1674
+					this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1675
+					return
1676
+				}
1677
+				startTime = theTime.Unix()
1678
+			}
1679
+
1680
+			if items["product_date"] == nil || reflect.TypeOf(items["product_date"]).String() != "float64" {
1681
+				utils.ErrorLog("product_date")
1682
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1683
+				return
1684
+			}
1685
+			product_date := int64(items["product_date"].(float64))
1686
+			if items["expiry_date"] == nil || reflect.TypeOf(items["expiry_date"]).String() != "float64" {
1687
+				utils.ErrorLog("expiry_date")
1688
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1689
+				return
1690
+			}
1691
+			expiry_date := int64(items["expiry_date"].(float64))
1692
+			orgId := this.GetAdminUserInfo().CurrentOrgId
1693
+			Creater := this.GetAdminUserInfo().AdminUser.Id
1694
+
1695
+			if items["number"] == nil || reflect.TypeOf(items["number"]).String() != "string" {
1696
+				utils.ErrorLog("number")
1697
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1698
+				return
1699
+			}
1700
+
1701
+			numbers := items["number"].(string)
1702
+
1703
+			if items["batch_number"] == nil || reflect.TypeOf(items["batch_number"]).String() != "string" {
1704
+				utils.ErrorLog("batch_number")
1705
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1706
+				return
1707
+			}
1708
+
1709
+			batch_number := items["batch_number"].(string)
1710
+
1711
+			inventory := models.XtDrugInventory{
1712
+
1713
+				DrugName:          drug_name,
1714
+				SpecificationName: specification_name,
1715
+				WarehousingUnit:   warehousing_unit,
1716
+				Count:             count,
1717
+				LastPrice:         last_price,
1718
+				RetailPrice:       retail_price,
1719
+				NewPrice:          new_price,
1720
+				Manufacturer:      manufacturer,
1721
+				Dealer:            dealer,
1722
+				Remark:            remark,
1723
+				DrugId:            drug_id,
1724
+				UserOrgId:         orgId,
1725
+				Ctime:             time.Now().Unix(),
1726
+				Mtime:             0,
1727
+				Status:            1,
1728
+				WarehousingOrder:  warehousing_order,
1729
+				LicenseNumber:     "",
1730
+				StartTime:         startTime,
1731
+				Creater:           Creater,
1732
+				Checker:           0,
1733
+				CheckerStatus:     2,
1734
+				CheckerTime:       0,
1735
+				ExpiryDate:        expiry_date,
1736
+				ProductDate:       product_date,
1737
+				Number:            numbers,
1738
+				BatchNumber:       batch_number,
1739
+			}
1740
+			err = service.CreateDrugInventory(inventory)
1741
+			fmt.Println(err)
1742
+		}
1743
+	}
1744
+	this.ServeSuccessJSON(map[string]interface{}{
1745
+		"msg": "msg",
1746
+	})
1747
+}
1748
+
1749
+func (this *SelfDrugApiController) GetDrugInventoryList() {
1750
+	timeLayout := "2006-01-02"
1751
+	loc, _ := time.LoadLocation("Local")
1752
+	dataBody := make(map[string]interface{}, 0)
1753
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
1754
+	fmt.Println(err)
1755
+	orgId := this.GetAdminUserInfo().CurrentOrgId
1756
+	keyword := this.GetString("keyword")
1757
+	fmt.Println("keywoer2r2r32rwrwr", keyword)
1758
+	start_time := this.GetString("start_time")
1759
+	end_time := this.GetString("end_time")
1760
+	var startTime int64
1761
+	if len(start_time) > 0 {
1762
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
1763
+		if err != nil {
1764
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1765
+			return
1766
+		}
1767
+		startTime = theTime.Unix()
1768
+	}
1769
+	var endTime int64
1770
+	if len(end_time) > 0 {
1771
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
1772
+		if err != nil {
1773
+			utils.ErrorLog(err.Error())
1774
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1775
+			return
1776
+		}
1777
+		endTime = theTime.Unix()
1778
+	}
1779
+
1780
+	limit, _ := this.GetInt64("limit")
1781
+	page, _ := this.GetInt64("page")
1782
+	list, total, err := service.GetDrugInventoryList(keyword, page, limit, orgId, startTime, endTime)
1783
+	fmt.Println("list23232323223", list)
1784
+	doctorList, _ := service.GetAllDoctorThree(orgId)
1785
+	if err != nil {
1786
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "更新设备失败")
1787
+		return
1788
+	}
1789
+
1790
+	this.ServeSuccessJSON(map[string]interface{}{
1791
+		"total":      total,
1792
+		"list":       list,
1793
+		"doctorList": doctorList,
1794
+	})
1795
+}
1796
+
1797
+func (this *SelfDrugApiController) SaveDrugCheckInventory() {
1798
+
1799
+	timeLayout := "2006-01-02"
1800
+	loc, _ := time.LoadLocation("Local")
1801
+	dataBody := make(map[string]interface{}, 0)
1802
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
1803
+	fmt.Println(err)
1804
+	idstr := this.GetString("ids")
1805
+	ids := strings.Split(idstr, ",")
1806
+	check_time := this.GetString("check_time")
1807
+	var checkTime int64
1808
+	if len(check_time) > 0 {
1809
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", check_time+" 00:00:00", loc)
1810
+		if err != nil {
1811
+			fmt.Println(err)
1812
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1813
+			return
1814
+		}
1815
+		checkTime = theTime.Unix()
1816
+	}
1817
+	checker, _ := this.GetInt64("checker")
1818
+	inventory := models.XtDrugInventory{
1819
+		Checker:       checker,
1820
+		CheckerStatus: 1,
1821
+		CheckerTime:   checkTime,
1822
+	}
1823
+	err = service.UpdateDrugInventory(ids, inventory)
1824
+	fmt.Println(err)
1825
+	returnData := make(map[string]interface{}, 0)
1826
+	returnData["msg"] = "ok"
1827
+	this.ServeSuccessJSON(returnData)
1828
+}
1829
+
1830
+func (this *SelfDrugApiController) GetDrugInventoryDetail() {
1831
+
1832
+	id, _ := this.GetInt64("id")
1833
+	detail, err := service.GetDrugInventoryDetail(id)
1834
+	if err != nil {
1835
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "更新设备失败")
1836
+		return
1837
+	}
1838
+
1839
+	this.ServeSuccessJSON(map[string]interface{}{
1840
+		"detail": detail,
1841
+	})
1842
+}
1843
+
1844
+func (this *SelfDrugApiController) ModifyInventory() {
1845
+
1846
+	id, _ := this.GetInt64("id")
1847
+	drug_id, _ := this.GetInt64("drug_id")
1848
+	drug_name := this.GetString("drug_name")
1849
+	specification_name := this.GetString("specification_name")
1850
+	retailPrice := this.GetString("retail_price")
1851
+	retail_price, _ := strconv.ParseFloat(retailPrice, 64)
1852
+	warehousing_order := this.GetString("warehousing_order")
1853
+	number := this.GetString("number")
1854
+	manufacturer := this.GetString("manufacturer")
1855
+	remark := this.GetString("remark")
1856
+	warehousing_unit := this.GetString("warehousing_unit")
1857
+	total, _ := this.GetInt64("total")
1858
+	lastPrice := this.GetString("last_price")
1859
+	last_price, _ := strconv.ParseFloat(lastPrice, 64)
1860
+	count, _ := this.GetInt64("count")
1861
+	drug_origin_place := this.GetString("drug_origin_place")
1862
+	inventory := models.XtDrugInventory{
1863
+		DrugName:          drug_name,
1864
+		SpecificationName: specification_name,
1865
+		WarehousingUnit:   warehousing_unit,
1866
+		Count:             count,
1867
+		LastPrice:         last_price,
1868
+		RetailPrice:       retail_price,
1869
+		Manufacturer:      manufacturer,
1870
+		Remark:            remark,
1871
+		DrugId:            drug_id,
1872
+		WarehousingOrder:  warehousing_order,
1873
+		Number:            number,
1874
+		Total:             total,
1875
+		DrugOriginPlace:   drug_origin_place,
1876
+	}
1877
+	err := service.ModifyDrugInventory(id, inventory)
1878
+	if err != nil {
1879
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "更新设备失败")
1880
+		return
1881
+	}
1882
+
1883
+	this.ServeSuccessJSON(map[string]interface{}{
1884
+		"inventory": inventory,
1885
+	})
1886
+}
1887
+
1888
+func (this *SelfDrugApiController) DeleteDrugInventory() {
1889
+
1890
+	id, _ := this.GetInt64("id")
1891
+	err := service.DeleteDrugInventory(id)
1892
+	fmt.Println(err)
1893
+	returnData := make(map[string]interface{}, 0)
1894
+	returnData["msg"] = "ok"
1895
+	this.ServeSuccessJSON(returnData)
1896
+}
1897
+
1898
+func (this *SelfDrugApiController) GetDrugInventoryPrintList() {
1899
+
1900
+	ids := this.GetString("ids")
1901
+
1902
+	idssplit := strings.Split(ids, ",")
1903
+	list, err := service.GetDrugInventoryPrintList(idssplit)
1904
+	if err != nil {
1905
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "更新设备失败")
1906
+		return
1907
+	}
1908
+
1909
+	this.ServeSuccessJSON(map[string]interface{}{
1910
+		"list": list,
1911
+	})
1912
+}
1913
+
1914
+func (this *SelfDrugApiController) GetDrugInventoryDetailList() {
1915
+
1916
+	keyword := this.GetString("keyword")
1917
+	limit, _ := this.GetInt64("limit")
1918
+	page, _ := this.GetInt64("page")
1919
+	orgId := this.GetAdminUserInfo().CurrentOrgId
1920
+	list, total, err := service.GetDrugInventoryDetailList(keyword, page, limit, orgId)
1921
+	fmt.Println("list23232323223", list)
1922
+	doctorList, _ := service.GetAllDoctorThree(orgId)
1923
+	if err != nil {
1924
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "更新设备失败")
1925
+		return
1926
+	}
1927
+
1928
+	this.ServeSuccessJSON(map[string]interface{}{
1929
+		"total":      total,
1930
+		"list":       list,
1931
+		"doctorList": doctorList,
1932
+	})
1933
+}

+ 179 - 24
controllers/stock_in_api_controller.go Datei anzeigen

@@ -125,6 +125,7 @@ func StockManagerApiRegistRouters() {
125 125
 	beego.Router("/api/stock/getinventoryprintlist", &StockManagerApiController{}, "Get:GetInventoryPrintList")
126 126
 	beego.Router("/api/stock/getinventorydetailprintlist", &StockManagerApiController{}, "Get:GetInventoryDetailPrintList")
127 127
 	beego.Router("/api/drug/deletedrugprice", &StockManagerApiController{}, "Get:DeleteDrugPrice")
128
+	beego.Router("/api/stock/getgoodwarehouselist", &StockManagerApiController{}, "Get:GetGoodWarehouseList")
128 129
 }
129 130
 
130 131
 func (c *StockManagerApiController) CreateWarehouse() {
@@ -5091,13 +5092,6 @@ func (this *StockManagerApiController) SaveReportStock() {
5091 5092
 			}
5092 5093
 			count := int64(items["count"].(float64))
5093 5094
 
5094
-			//if items["new_price"] == nil || reflect.TypeOf(items["new_price"]).String() != "string" {
5095
-			//	utils.ErrorLog("new_price")
5096
-			//	this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5097
-			//	return
5098
-			//}
5099
-			//new_price, _ := strconv.ParseFloat(items["new_price"].(string), 64)
5100
-
5101 5095
 			if items["good_id"] == nil || reflect.TypeOf(items["good_id"]).String() != "float64" {
5102 5096
 				utils.ErrorLog("good_id")
5103 5097
 				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
@@ -5121,6 +5115,34 @@ func (this *StockManagerApiController) SaveReportStock() {
5121 5115
 				}
5122 5116
 				startTime = theTime.Unix()
5123 5117
 			}
5118
+
5119
+			if items["number"] == nil || reflect.TypeOf(items["number"]).String() != "string" {
5120
+				utils.ErrorLog("number")
5121
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5122
+				return
5123
+			}
5124
+			number := items["number"].(string)
5125
+
5126
+			if items["warehousing_info_id"] == nil || reflect.TypeOf(items["warehousing_info_id"]).String() != "float64" {
5127
+				utils.ErrorLog("warehousing_info_id")
5128
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5129
+				return
5130
+			}
5131
+			warehousing_info_id := int64(items["warehousing_info_id"].(float64))
5132
+
5133
+			if items["expiry_date"] == nil || reflect.TypeOf(items["expiry_date"]).String() != "float64" {
5134
+				utils.ErrorLog("expiry_date")
5135
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5136
+				return
5137
+			}
5138
+			expiry_date := int64(items["expiry_date"].(float64))
5139
+
5140
+			if items["product_date"] == nil || reflect.TypeOf(items["product_date"]).String() != "float64" {
5141
+				utils.ErrorLog("product_date")
5142
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5143
+				return
5144
+			}
5145
+			product_date := int64(items["product_date"].(float64))
5124 5146
 			orgId := this.GetAdminUserInfo().CurrentOrgId
5125 5147
 			Creater := this.GetAdminUserInfo().AdminUser.Id
5126 5148
 			reportPrice := models.XtStockReportPrice{
@@ -5130,22 +5152,25 @@ func (this *StockManagerApiController) SaveReportStock() {
5130 5152
 				Count:             count,
5131 5153
 				BuyPrice:          buy_price,
5132 5154
 				PackingPrice:      packing_price,
5133
-				//NewPrice:          new_price,
5134
-				Manufacturer:     manufacturer,
5135
-				Dealer:           dealer,
5136
-				Remark:           remark,
5137
-				GoodId:           good_id,
5138
-				UserOrgId:        orgId,
5139
-				Ctime:            time.Now().Unix(),
5140
-				Mtime:            0,
5141
-				Status:           1,
5142
-				WarehousingOrder: warehousing_order,
5143
-				LicenseNumber:    license_number,
5144
-				StartTime:        startTime,
5145
-				Creater:          Creater,
5146
-				Checker:          0,
5147
-				CheckerStatus:    2,
5148
-				CheckerTime:      0,
5155
+				Manufacturer:      manufacturer,
5156
+				Dealer:            dealer,
5157
+				Remark:            remark,
5158
+				GoodId:            good_id,
5159
+				UserOrgId:         orgId,
5160
+				Ctime:             time.Now().Unix(),
5161
+				Mtime:             0,
5162
+				Status:            1,
5163
+				WarehousingOrder:  warehousing_order,
5164
+				LicenseNumber:     license_number,
5165
+				StartTime:         startTime,
5166
+				Creater:           Creater,
5167
+				Checker:           0,
5168
+				CheckerStatus:     2,
5169
+				CheckerTime:       0,
5170
+				Number:            number,
5171
+				WarehousingInfoId: warehousing_info_id,
5172
+				ExpiryDate:        expiry_date,
5173
+				ProductDate:       product_date,
5149 5174
 			}
5150 5175
 			err := service.CreateReportPrice(&reportPrice)
5151 5176
 			fmt.Println(err)
@@ -5224,6 +5249,118 @@ func (this *StockManagerApiController) SaveCheckDamage() {
5224 5249
 	}
5225 5250
 	err := service.UpdateCheckDamage(ids, reportprice)
5226 5251
 	fmt.Println(err)
5252
+
5253
+	//获取当前核对的数据
5254
+	list, _ := service.GetCheckDamageList(ids)
5255
+
5256
+	ctime := time.Now().Unix()
5257
+	adminUserInfo := this.GetAdminUserInfo()
5258
+
5259
+	warehousing_out_time := this.GetString("warehousing_out_time")
5260
+	warehousingOutDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", warehousing_out_time)
5261
+	if parseDateErr != nil {
5262
+		this.ErrorLog("日期(%v)解析错误:%v", warehousingOutDate, parseDateErr)
5263
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5264
+		return
5265
+	}
5266
+	timeStr := time.Now().Format("2006-01-02")
5267
+	timeArr := strings.Split(timeStr, "-")
5268
+	total, _ := service.FindAllWarehouseOut(adminUserInfo.CurrentOrgId)
5269
+
5270
+	total = total + 1
5271
+	warehousing_out_order := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + timeArr[0] + timeArr[1] + timeArr[2] + "000"
5272
+	number, _ := strconv.ParseInt(warehousing_out_order, 10, 64)
5273
+	number = number + total
5274
+	warehousing_out_order = "CKD" + strconv.FormatInt(number, 10)
5275
+	operation_time := time.Now().Unix()
5276
+	creater := adminUserInfo.AdminUser.Id
5277
+
5278
+	warehouseOut := models.WarehouseOut{
5279
+		WarehouseOutOrderNumber: warehousing_out_order,
5280
+		OperationTime:           operation_time,
5281
+		OrgId:                   adminUserInfo.CurrentOrgId,
5282
+		Creater:                 creater,
5283
+		Ctime:                   ctime,
5284
+		Status:                  1,
5285
+		WarehouseOutTime:        warehousingOutDate.Unix(),
5286
+		Type:                    2,
5287
+	}
5288
+
5289
+	_, errcodes := service.FindStockOutByIsSys(adminUserInfo.CurrentOrgId, 0, operation_time)
5290
+	if errcodes == gorm.ErrRecordNotFound {
5291
+		service.AddSigleWarehouseOut(&warehouseOut)
5292
+	}
5293
+	manufacturerList, _ := service.GetAllManufacturerList(adminUserInfo.CurrentOrgId)
5294
+	dealerList, _ := service.GetAllDealerList(adminUserInfo.CurrentOrgId)
5295
+	var manufacturer_id int64
5296
+	var dealer_id int64
5297
+
5298
+	for _, item := range list {
5299
+		for _, it := range manufacturerList {
5300
+			if item.Manufacturer == it.ManufacturerName {
5301
+				manufacturer_id = it.ID
5302
+			}
5303
+		}
5304
+		for _, its := range dealerList {
5305
+			if item.Dealer == its.DealerName {
5306
+				dealer_id = its.ID
5307
+			}
5308
+		}
5309
+		//插入出库单
5310
+		warehouseOutInfo := &models.WarehouseOutInfo{
5311
+			WarehouseOutOrderNumber: warehouseOut.WarehouseOutOrderNumber,
5312
+			WarehouseOutId:          warehouseOut.ID,
5313
+			GoodId:                  item.GoodId,
5314
+			Count:                   item.Count,
5315
+			Price:                   item.PackingPrice,
5316
+			Status:                  1,
5317
+			Ctime:                   ctime,
5318
+			Remark:                  item.Remark,
5319
+			OrgId:                   adminUserInfo.CurrentOrgId,
5320
+			Type:                    2,
5321
+			Manufacturer:            manufacturer_id,
5322
+			Number:                  item.Number,
5323
+			ExpiryDate:              item.ExpiryDate,
5324
+			ProductDate:             item.ProductDate,
5325
+			Dealer:                  dealer_id,
5326
+			LicenseNumber:           item.LicenseNumber,
5327
+		}
5328
+		errOne := service.AddSigleWarehouseOutInfo(warehouseOutInfo)
5329
+		fmt.Println(errOne)
5330
+
5331
+		flow := models.VmStockFlow{
5332
+			WarehousingId:           0,
5333
+			GoodId:                  item.GoodId,
5334
+			Number:                  item.Number,
5335
+			LicenseNumber:           "",
5336
+			Count:                   item.Count,
5337
+			UserOrgId:               adminUserInfo.CurrentOrgId,
5338
+			PatientId:               0,
5339
+			SystemTime:              time.Now().Unix(),
5340
+			ConsumableType:          5,
5341
+			IsSys:                   0,
5342
+			WarehousingOrder:        "",
5343
+			WarehouseOutId:          warehouseOutInfo.ID,
5344
+			WarehouseOutOrderNumber: warehouseOutInfo.WarehouseOutOrderNumber,
5345
+			IsEdit:                  0,
5346
+			CancelStockId:           0,
5347
+			CancelOrderNumber:       "",
5348
+			Manufacturer:            0,
5349
+			Dealer:                  0,
5350
+			Creator:                 adminUserInfo.AdminUser.Id,
5351
+			UpdateCreator:           0,
5352
+			Status:                  1,
5353
+			Ctime:                   time.Now().Unix(),
5354
+			Mtime:                   0,
5355
+			Price:                   item.PackingPrice,
5356
+			WarehousingDetailId:     0,
5357
+			WarehouseOutDetailId:    0,
5358
+			CancelOutDetailId:       0,
5359
+			ProductDate:             item.ProductDate,
5360
+			ExpireDate:              item.ExpiryDate,
5361
+		}
5362
+		service.CreateStockFlowOne(flow)
5363
+	}
5227 5364
 	this.ServeSuccessJSON(map[string]interface{}{
5228 5365
 		"reportPrice": reportprice,
5229 5366
 	})
@@ -5483,8 +5620,17 @@ func (this *StockManagerApiController) UpdateStockPrice() {
5483 5620
 	id, _ := this.GetInt64("id")
5484 5621
 	newPrice := this.GetString("new_price")
5485 5622
 	new_price, _ := strconv.ParseFloat(newPrice, 64)
5623
+	good_name := this.GetString("good_name")
5624
+	packingPrice := this.GetString("packing_price")
5625
+	packing_price, _ := strconv.ParseFloat(packingPrice, 64)
5626
+	remark := this.GetString("remark")
5627
+	good_id, _ := this.GetInt64("good_id")
5486 5628
 	adjust := models.XtStockAdjustPrice{
5487
-		NewPrice: new_price,
5629
+		NewPrice:     new_price,
5630
+		GoodName:     good_name,
5631
+		PackingPrice: packing_price,
5632
+		Remark:       remark,
5633
+		GoodId:       good_id,
5488 5634
 	}
5489 5635
 	err := service.UpdateStockPrice(adjust, id)
5490 5636
 	fmt.Println(err)
@@ -5624,3 +5770,12 @@ func (this *StockManagerApiController) DeleteDrugPrice() {
5624 5770
 	this.ServeSuccessJSON(returnData)
5625 5771
 	return
5626 5772
 }
5773
+
5774
+func (this *StockManagerApiController) GetGoodWarehouseList() {
5775
+
5776
+	id, _ := this.GetInt64("id")
5777
+	list, _ := service.GetGoodWarehouseList(id)
5778
+	this.ServeSuccessJSON(map[string]interface{}{
5779
+		"list": list,
5780
+	})
5781
+}

+ 1 - 0
models/new_monitor.go Datei anzeigen

@@ -48,6 +48,7 @@ type VMMonitorDialysisOrder struct {
48 48
 	BedID        int64        `gorm:"column:bed_id" json:"bed_id"`
49 49
 	Status       int64        `gorm:"column:status" json:"status"`
50 50
 	DeviceNumber DeviceNumber `gorm:"ForeignKey:BedId" json:"device_number"`
51
+	StartTime    int64        `gorm:"column:start_time" json:"start_time"`
51 52
 }
52 53
 
53 54
 func (VMMonitorDialysisOrder) TableName() string {

+ 70 - 0
models/self_drug_models.go Datei anzeigen

@@ -729,3 +729,73 @@ type XtDrugDamage struct {
729 729
 func (XtDrugDamage) TableName() string {
730 730
 	return "xt_drug_damage"
731 731
 }
732
+
733
+type XtDrugInventory struct {
734
+	ID                int64   `gorm:"column:id" json:"id" form:"id"`
735
+	DrugName          string  `gorm:"column:drug_name" json:"drug_name" form:"drug_name"`
736
+	SpecificationName string  `gorm:"column:specification_name" json:"specification_name" form:"specification_name"`
737
+	WarehousingUnit   string  `gorm:"column:warehousing_unit" json:"warehousing_unit" form:"warehousing_unit"`
738
+	Count             int64   `gorm:"column:count" json:"count" form:"count"`
739
+	LastPrice         float64 `gorm:"column:last_price" json:"last_price" form:"last_price"`
740
+	RetailPrice       float64 `gorm:"column:retail_price" json:"retail_price" form:"retail_price"`
741
+	NewPrice          float64 `gorm:"column:new_price" json:"new_price" form:"new_price"`
742
+	Manufacturer      string  `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
743
+	Dealer            string  `gorm:"column:dealer" json:"dealer" form:"dealer"`
744
+	Remark            string  `gorm:"column:remark" json:"remark" form:"remark"`
745
+	DrugId            int64   `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
746
+	UserOrgId         int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
747
+	Ctime             int64   `gorm:"column:ctime" json:"ctime" form:"ctime"`
748
+	Mtime             int64   `gorm:"column:mtime" json:"mtime" form:"mtime"`
749
+	Status            int64   `gorm:"column:status" json:"status" form:"status"`
750
+	WarehousingOrder  string  `gorm:"column:warehousing_order" json:"warehousing_order" form:"warehousing_order"`
751
+	LicenseNumber     string  `gorm:"column:license_number" json:"license_number" form:"license_number"`
752
+	StartTime         int64   `gorm:"column:start_time" json:"start_time" form:"start_time"`
753
+	Creater           int64   `gorm:"column:creater" json:"creater" form:"creater"`
754
+	Checker           int64   `gorm:"column:checker" json:"checker" form:"checker"`
755
+	CheckerStatus     int64   `gorm:"column:checker_status" json:"checker_status" form:"checker_status"`
756
+	CheckerTime       int64   `gorm:"column:checker_time" json:"checker_time" form:"checker_time"`
757
+	ExpiryDate        int64   `gorm:"column:expiry_date" json:"expiry_date" form:"expiry_date"`
758
+	ProductDate       int64   `gorm:"column:product_date" json:"product_date" form:"product_date"`
759
+	Number            string  `gorm:"column:number" json:"number" form:"number"`
760
+	BatchNumber       string  `gorm:"column:batch_number" json:"batch_number" form:"batch_number"`
761
+	UserName          string  `gorm:"column:user_name" json:"user_name" form:"user_name"`
762
+	Total             int64   `gorm:"column:total" json:"total" form:"total"`
763
+	DrugOriginPlace   string  `gorm:"column:drug_origin_place" json:"drug_origin_place" form:"drug_origin_place"`
764
+}
765
+
766
+func (XtDrugInventory) TableName() string {
767
+	return "xt_drug_inventory"
768
+}
769
+
770
+type VmDrugInventory struct {
771
+	ID                int64   `gorm:"column:id" json:"id" form:"id"`
772
+	DrugName          string  `gorm:"column:drug_name" json:"drug_name" form:"drug_name"`
773
+	SpecificationName string  `gorm:"column:specification_name" json:"specification_name" form:"specification_name"`
774
+	WarehousingUnit   string  `gorm:"column:warehousing_unit" json:"warehousing_unit" form:"warehousing_unit"`
775
+	Count             int64   `gorm:"column:count" json:"count" form:"count"`
776
+	LastPrice         float64 `gorm:"column:last_price" json:"last_price" form:"last_price"`
777
+	RetailPrice       float64 `gorm:"column:retail_price" json:"retail_price" form:"retail_price"`
778
+	NewPrice          float64 `gorm:"column:new_price" json:"new_price" form:"new_price"`
779
+	Manufacturer      string  `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
780
+	Dealer            string  `gorm:"column:dealer" json:"dealer" form:"dealer"`
781
+	Remark            string  `gorm:"column:remark" json:"remark" form:"remark"`
782
+	DrugId            int64   `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
783
+	UserOrgId         int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
784
+	Ctime             int64   `gorm:"column:ctime" json:"ctime" form:"ctime"`
785
+	Mtime             int64   `gorm:"column:mtime" json:"mtime" form:"mtime"`
786
+	Status            int64   `gorm:"column:status" json:"status" form:"status"`
787
+	WarehousingOrder  string  `gorm:"column:warehousing_order" json:"warehousing_order" form:"warehousing_order"`
788
+	Number            string  `gorm:"column:number" json:"number" form:"number"`
789
+	StartTime         int64   `gorm:"column:start_time" json:"start_time" form:"start_time"`
790
+	Creater           int64   `gorm:"column:creater" json:"creater" form:"creater"`
791
+	Checker           int64   `gorm:"column:checker" json:"checker" form:"checker"`
792
+	CheckerStatus     int64   `gorm:"column:checker_status" json:"checker_status" form:"checker_status"`
793
+	CheckerTime       int64   `gorm:"column:checker_time" json:"checker_time" form:"checker_time"`
794
+	MinNumber         int64   `gorm:"column:min_number" json:"min_number" form:"min_number"`
795
+	Dose              float64 `gorm:"column:dose" json:"dose" form:"dose"`
796
+	DoseUnit          string  `gorm:"column:dose_unit" json:"dose_unit" form:"dose_unit"`
797
+	MaxUnit           string  `gorm:"column:max_unit" json:"max_unit" form:"max_unit"`
798
+	MinUnit           string  `gorm:"column:min_unit" json:"min_unit" form:"min_unit"`
799
+	Total             int64   `gorm:"column:total" json:"total" form:"total"`
800
+	DrugOriginPlace   string  `gorm:"column:drug_origin_place" json:"drug_origin_place" form:"drug_origin_place"`
801
+}

+ 4 - 0
models/stock_models.go Datei anzeigen

@@ -941,6 +941,10 @@ type XtStockReportPrice struct {
941 941
 	Checker           int64   `gorm:"column:checker" json:"checker" form:"checker"`
942 942
 	CheckerStatus     int64   `gorm:"column:checker_status" json:"checker_status" form:"checker_status"`
943 943
 	CheckerTime       int64   `gorm:"column:checker_time" json:"checker_time" form:"checker_time"`
944
+	Number            string  `gorm:"column:number" json:"number" form:"number"`
945
+	WarehousingInfoId int64   `gorm:"column:warehousing_info_id" json:"warehousing_info_id" form:"warehousing_info_id"`
946
+	ExpiryDate        int64   `gorm:"column:expiry_date" json:"expiry_date" form:"expiry_date"`
947
+	ProductDate       int64   `gorm:"column:product_date" json:"product_date" form:"product_date"`
944 948
 }
945 949
 
946 950
 func (XtStockReportPrice) TableName() string {

+ 79 - 0
service/self_drug_service.go Datei anzeigen

@@ -933,3 +933,82 @@ func GetWarehoseInfoById(id int64) (info []*models.XtDrugWarehouseInfo, err erro
933 933
 	err = XTReadDB().Model(&info).Where("drug_id=? and status = 1", id).Find(&info).Error
934 934
 	return info, err
935 935
 }
936
+
937
+func CreateDrugInventory(inventory models.XtDrugInventory) error {
938
+
939
+	err := XTWriteDB().Create(&inventory).Error
940
+	return err
941
+}
942
+
943
+func GetDrugInventoryList(keyword string, page int64, limit int64, orgid int64, startime int64, endtime int64) (list []*models.VmDrugInventory, total int64, err error) {
944
+	fmt.Println("startdate", limit, page)
945
+	likeKey := "%" + keyword + "%"
946
+	offset := (page - 1) * limit
947
+	db := XTReadDB().Table("xt_drug_inventory as x").Where("x.status = 1")
948
+	table := XTReadDB().Table("xt_base_drug as t").Where("t.status = 1")
949
+	tab := UserReadDB().Table("sgj_user_admin_role as r").Where("r.status = 1")
950
+	fmt.Println(table, tab)
951
+	if len(keyword) > 0 {
952
+		db = db.Where("x.warehousing_order = ? or r.user_name like ?", keyword, likeKey)
953
+	}
954
+	if orgid > 0 {
955
+		db = db.Where("x.user_org_id = ?", orgid)
956
+	}
957
+	if startime > 0 {
958
+		db = db.Where("x.start_time >=?", startime)
959
+	}
960
+	if endtime > 0 {
961
+		db = db.Where("x.start_time<=?", endtime)
962
+	}
963
+	err = db.Select("x.id,x.drug_name,x.specification_name,x.warehousing_unit,x.count,x.last_price,x.retail_price,x.manufacturer,x.dealer,x.remark,x.drug_id,x.warehousing_order,x.number,x.batch_number,x.start_time,x.creater,x.checker,x.checker_status,x.checker_time,t.dose,t.dose_unit,t.max_unit,t.min_unit").Joins("left join sgj_users.sgj_user_admin_role as r on r.id = x.creater").Joins("left join xt_base_drug as t on t.id =x.drug_id").Count(&total).Offset(offset).Limit(limit).Scan(&list).Error
964
+	return list, total, err
965
+}
966
+
967
+func UpdateDrugInventory(ids []string, inventory models.XtDrugInventory) error {
968
+
969
+	err := XTWriteDB().Model(&inventory).Where("id in(?) and status = 1", ids).Updates(map[string]interface{}{"checker": inventory.Checker, "checker_status": inventory.CheckerStatus, "checker_time": inventory.CheckerTime}).Error
970
+	return err
971
+}
972
+
973
+func GetDrugInventoryDetail(id int64) (models.XtDrugInventory, error) {
974
+
975
+	inventory := models.XtDrugInventory{}
976
+	err := XTReadDB().Model(&inventory).Where("id = ? and status = 1", id).Find(&inventory).Error
977
+	return inventory, err
978
+}
979
+
980
+func ModifyDrugInventory(id int64, info models.XtDrugInventory) error {
981
+
982
+	err := XTWriteDB().Model(&info).Where("id=? and status = 1", id).Updates(map[string]interface{}{"drug_name": info.DrugName, "specification_name": info.SpecificationName, "warehousing_unit": info.WarehousingUnit, "count": info.Count, "last_price": info.LastPrice, "manufacturer": info.Manufacturer, "remark": info.Remark, "drug_id": info.DrugId, "warehousing_order": info.WarehousingOrder, "number": info.Number, "total": info.Number, "drug_origin_place": info.DrugOriginPlace}).Error
983
+	return err
984
+}
985
+
986
+func DeleteDrugInventory(id int64) error {
987
+	inventory := models.XtDrugInventory{}
988
+	err := XTWriteDB().Model(&inventory).Where("id = ? and status = 1", id).Updates(map[string]interface{}{"status": 0}).Error
989
+	return err
990
+}
991
+
992
+func GetDrugInventoryPrintList(ids []string) (info []*models.XtDrugInventory, err error) {
993
+
994
+	err = XTReadDB().Where("id in(?) and status = 1", ids).Find(&info).Error
995
+	return info, err
996
+}
997
+
998
+func GetDrugInventoryDetailList(keyword string, page int64, limit int64, orgid int64) (list []*models.VmDrugInventory, total int64, err error) {
999
+	fmt.Println("startdate", limit, page)
1000
+	likeKey := "%" + keyword + "%"
1001
+	offset := (page - 1) * limit
1002
+	db := XTReadDB().Table("xt_drug_inventory as x").Where("x.status = 1")
1003
+	table := XTReadDB().Table("xt_base_drug as t").Where("t.status = 1")
1004
+	tab := UserReadDB().Table("sgj_user_admin_role as r").Where("r.status = 1")
1005
+	fmt.Println(table, tab)
1006
+	if len(keyword) > 0 {
1007
+		db = db.Where("x.warehousing_order = ? or r.user_name like ?", keyword, likeKey)
1008
+	}
1009
+	if orgid > 0 {
1010
+		db = db.Where("x.user_org_id = ?", orgid)
1011
+	}
1012
+	err = db.Select("x.id,x.drug_name,x.specification_name,x.warehousing_unit,x.count,x.last_price,x.retail_price,x.manufacturer,x.dealer,x.remark,x.drug_id,x.warehousing_order,x.number,x.batch_number,x.start_time,x.creater,x.checker,x.checker_status,x.checker_time,x.total,x.drug_origin_place,t.dose,t.dose_unit,t.max_unit,t.min_unit").Joins("left join sgj_users.sgj_user_admin_role as r on r.id = x.creater").Joins("left join xt_base_drug as t on t.id =x.drug_id").Count(&total).Offset(offset).Limit(limit).Scan(&list).Error
1013
+	return list, total, err
1014
+}

+ 20 - 3
service/stock_service.go Datei anzeigen

@@ -4323,7 +4323,7 @@ func GetAllStockPrice(orgid int64, startime int64, endtime int64, keyword string
4323 4323
 	if orgid > 0 {
4324 4324
 		db = db.Where("x.user_org_id = ?", orgid)
4325 4325
 	}
4326
-	err = db.Select("x.id,x.good_name,x.specification_name,x.warehousing_unit,x.count,x.buy_price,x.packing_price,x.new_price,x.manufacturer,x.dealer,x.remark,x.good_id,x.warehousing_order,x.license_number,x.start_time,x.creater,x.checker,x.checker_status,x.checker_time,t.packing_unit").Joins("left join sgj_users.sgj_user_admin_role as r on r.id = x.creater").Joins("left join xt_good_information as t on t.id =x.good_id").Count(&total).Offset(offset).Limit(limit).Scan(&list).Error
4326
+	err = db.Group("x.id").Select("x.id,x.good_name,x.specification_name,x.warehousing_unit,x.count,x.buy_price,x.packing_price,x.new_price,x.manufacturer,x.dealer,x.remark,x.good_id,x.warehousing_order,x.license_number,x.start_time,x.creater,x.checker,x.checker_status,x.checker_time,t.packing_unit").Joins("left join sgj_users.sgj_user_admin_role as r on r.admin_user_id = x.creater").Joins("left join xt_good_information as t on t.id =x.good_id").Count(&total).Offset(offset).Limit(limit).Scan(&list).Error
4327 4327
 	return list, total, err
4328 4328
 }
4329 4329
 
@@ -4376,7 +4376,7 @@ func GetReportStockList(startime int64, endtime int64, orgid int64, keyword stri
4376 4376
 	if orgid > 0 {
4377 4377
 		db = db.Where("x.user_org_id = ?", orgid)
4378 4378
 	}
4379
-	err = db.Select("x.id,x.good_name,x.specification_name,x.warehousing_unit,x.count,x.buy_price,x.packing_price,x.new_price,x.manufacturer,x.dealer,x.remark,x.good_id,x.warehousing_order,x.license_number,x.start_time,x.creater,x.checker,x.checker_status,x.checker_time,t.packing_unit,r.user_name").Joins("left join sgj_users.sgj_user_admin_role as r on r.admin_user_id = x.creater").Joins("left join xt_good_information as t on t.id =x.good_id").Count(&total).Offset(offset).Limit(limit).Scan(&adjust).Error
4379
+	err = db.Group("x.id").Select("x.id,x.good_name,x.specification_name,x.warehousing_unit,x.count,x.buy_price,x.packing_price,x.new_price,x.manufacturer,x.dealer,x.remark,x.good_id,x.warehousing_order,x.license_number,x.start_time,x.creater,x.checker,x.checker_status,x.checker_time,t.packing_unit,r.user_name").Joins("left join sgj_users.sgj_user_admin_role as r on r.admin_user_id = x.creater").Joins("left join xt_good_information as t on t.id =x.good_id").Count(&total).Offset(offset).Limit(limit).Scan(&adjust).Error
4380 4380
 	return adjust, total, err
4381 4381
 }
4382 4382
 
@@ -4386,6 +4386,12 @@ func UpdateCheckDamage(ids []string, reportPrice models.XtStockReportPrice) erro
4386 4386
 	return err
4387 4387
 }
4388 4388
 
4389
+func GetCheckDamageList(ids []string) (report []*models.XtStockReportPrice, err error) {
4390
+
4391
+	err = XTReadDB().Model(&report).Where("id in(?) and status= 1", ids).Find(&report).Error
4392
+	return report, err
4393
+}
4394
+
4389 4395
 func CreateInentory(inventory models.XtStockInventory) error {
4390 4396
 
4391 4397
 	err = XTWriteDB().Create(&inventory).Error
@@ -4430,7 +4436,7 @@ func GetModifyPriceDetail(id int64) (models.XtStockAdjustPrice, error) {
4430 4436
 
4431 4437
 func UpdateStockPrice(info models.XtStockAdjustPrice, id int64) error {
4432 4438
 
4433
-	err := XTWriteDB().Model(&info).Where("id = ? and status = 1", id).Updates(map[string]interface{}{"new_price": info.NewPrice}).Error
4439
+	err := XTWriteDB().Model(&info).Where("id = ? and status = 1", id).Updates(map[string]interface{}{"new_price": info.NewPrice, "good_name": info.GoodName, "packing_price": info.PackingPrice, "good_id": info.GoodId, "remark": info.Remark}).Error
4434 4440
 	return err
4435 4441
 }
4436 4442
 
@@ -4520,3 +4526,14 @@ func DeleteDrugPrice(id int64) error {
4520 4526
 	err := XTReadDB().Model(&info).Where("id = ? and status = 1", id).Updates(map[string]interface{}{"status": 0}).Error
4521 4527
 	return err
4522 4528
 }
4529
+
4530
+func GetGoodWarehouseList(goodid int64) (models.WarehousingInfo, error) {
4531
+
4532
+	info := models.WarehousingInfo{}
4533
+	db := XTReadDB().Model(&info).Where("status = 1")
4534
+	if goodid > 0 {
4535
+		db = db.Where("good_id = ?", goodid)
4536
+	}
4537
+	err := db.Select("good_id,sum(stock_count) as stock_count").Find(&info).Error
4538
+	return info, err
4539
+}