浏览代码

耗材参数

XMLWAN 4 年前
父节点
当前提交
64de054a30
共有 3 个文件被更改,包括 44 次插入23 次删除
  1. 21 10
      controllers/his_api_controller.go
  2. 15 12
      controllers/manager_center_api_controller.go
  3. 8 1
      service/stock_service.go

+ 21 - 10
controllers/his_api_controller.go 查看文件

@@ -898,11 +898,17 @@ func (c *HisApiController) setProjectWithJSON(project *models.HisPrescriptionPro
898 898
 		fmt.Println(project_id)
899 899
 		fmt.Println(project.ProjectId)
900 900
 	}
901
-	if json["price"] != nil || reflect.TypeOf(json["price"]).String() == "float64" {
902
-		price := int64(json["price"].(float64))
903
-		formatInt_price := strconv.FormatInt(price, 10)
904
-		float_price, _ := strconv.ParseFloat(formatInt_price, 64)
905
-		project.Price = float_price
901
+	//if json["price"] != nil || reflect.TypeOf(json["price"]).String() == "float64" {
902
+	//	//price := int64(json["price"].(float64))
903
+	//	//fmt.Println("price--------------------------",price)
904
+	//	//formatInt_price := strconv.FormatInt(price, 10)
905
+	//	//float_price, _ := strconv.ParseFloat(formatInt_price, 64)
906
+	//	//project.Price = float_price
907
+	//
908
+	//}
909
+	if json["price"] != nil || reflect.TypeOf(json["price"]).String() == "string" {
910
+		price, _ := strconv.ParseFloat(json["price"].(string), 64)
911
+		project.Price = price
906 912
 	}
907 913
 	if json["total"] != nil && reflect.TypeOf(json["total"]).String() == "string" {
908 914
 		total, _ := json["total"].(string)
@@ -952,11 +958,16 @@ func (c *HisApiController) setAddtionWithJSON(additionalCharge *models.HisAdditi
952 958
 		item_id := int64(json["item_id"].(float64))
953 959
 		additionalCharge.ItemId = item_id
954 960
 	}
955
-	if json["price"] != nil || reflect.TypeOf(json["price"]).String() == "float64" {
956
-		price := int64(json["price"].(float64))
957
-		formatInt_price := strconv.FormatInt(price, 10)
958
-		float_price, _ := strconv.ParseFloat(formatInt_price, 64)
959
-		additionalCharge.Price = float_price
961
+	//if json["price"] != nil || reflect.TypeOf(json["price"]).String() == "float64" {
962
+	//	price := int64(json["price"].(float64))
963
+	//	formatInt_price := strconv.FormatInt(price, 10)
964
+	//	float_price, _ := strconv.ParseFloat(formatInt_price, 64)
965
+	//	additionalCharge.Price = float_price
966
+	//}
967
+
968
+	if json["price"] != nil || reflect.TypeOf(json["price"]).String() == "string" {
969
+		price, _ := strconv.ParseFloat(json["price"].(string), 64)
970
+		additionalCharge.Price = price
960 971
 	}
961 972
 	if json["count"] != nil && reflect.TypeOf(json["count"]).String() == "string" {
962 973
 		count, _ := json["count"].(string)

+ 15 - 12
controllers/manager_center_api_controller.go 查看文件

@@ -1813,7 +1813,10 @@ func (c *ManagerCenterApiController) DeleteBaseDrugById() {
1813 1813
 func (c *ManagerCenterApiController) CreateAddition() {
1814 1814
 	name := c.GetString("name")
1815 1815
 	code := c.GetString("code")
1816
-	price, _ := c.GetFloat("price")
1816
+	//price, _ := c.GetFloat("price")
1817
+
1818
+	price := c.GetString("price")
1819
+	price_float, _ := strconv.ParseFloat(price, 64)
1817 1820
 
1818 1821
 	if len(name) <= 0 {
1819 1822
 		utils.ErrorLog("len(name) == 0")
@@ -1821,11 +1824,11 @@ func (c *ManagerCenterApiController) CreateAddition() {
1821 1824
 		return
1822 1825
 	}
1823 1826
 
1824
-	if len(code) <= 0 {
1825
-		utils.ErrorLog("len(code) == 0")
1826
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1827
-		return
1828
-	}
1827
+	//if len(code) <= 0 {
1828
+	//	utils.ErrorLog("len(code) == 0")
1829
+	//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1830
+	//	return
1831
+	//}
1829 1832
 
1830 1833
 	adminUserInfo := c.GetAdminUserInfo()
1831 1834
 
@@ -1833,7 +1836,7 @@ func (c *ManagerCenterApiController) CreateAddition() {
1833 1836
 		Name:      name,
1834 1837
 		Code:      code,
1835 1838
 		Status:    1,
1836
-		Price:     price,
1839
+		Price:     price_float,
1837 1840
 		Ctime:     time.Now().Unix(),
1838 1841
 		Mtime:     time.Now().Unix(),
1839 1842
 		UserOrgId: adminUserInfo.CurrentOrgId,
@@ -1870,11 +1873,11 @@ func (c *ManagerCenterApiController) ModifyAddition() {
1870 1873
 		return
1871 1874
 	}
1872 1875
 
1873
-	if len(code) <= 0 {
1874
-		utils.ErrorLog("len(content_code) == 0")
1875
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1876
-		return
1877
-	}
1876
+	//if len(code) <= 0 {
1877
+	//	utils.ErrorLog("len(content_code) == 0")
1878
+	//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1879
+	//	return
1880
+	//}
1878 1881
 
1879 1882
 	adminUserInfo := c.GetAdminUserInfo()
1880 1883
 	addition := models.XtHisAddtionConfig{

+ 8 - 1
service/stock_service.go 查看文件

@@ -1161,7 +1161,7 @@ func FindAllStockInfo(orgId int64, page int64, limit int64, keyword string, star
1161 1161
 	}
1162 1162
 	if endtime > 0 {
1163 1163
 		db = db.Preload("QueryWarehouseOutInfo", func(db *gorm.DB) *gorm.DB {
1164
-			return db.Where("org_id = ? AND status = 1 and sys_record_time>=? and  sys_record_time<=?", orgId, startime, endtime)
1164
+			return db.Where("org_id = ? AND status = 1 and sys_record_time<=?", orgId, endtime)
1165 1165
 		})
1166 1166
 	}
1167 1167
 
@@ -1170,6 +1170,7 @@ func FindAllStockInfo(orgId int64, page int64, limit int64, keyword string, star
1170 1170
 	db = db.Preload("QueryWarehousingInfo", func(db *gorm.DB) *gorm.DB {
1171 1171
 		return db.Where("org_id = ? AND status = 1", orgId)
1172 1172
 	})
1173
+
1173 1174
 	db = db.Preload("QuerySalesReturnInfo", "org_id = ? AND status = 1", orgId)
1174 1175
 
1175 1176
 	if startime == 0 || endtime == 0 {
@@ -2091,3 +2092,9 @@ func PostSearchStock(keyword string, orgid int64) (goods []*models.GoodsType, er
2091 2092
 	err = db.Where("org_id = ? and status =1", orgid).Find(&goods).Error
2092 2093
 	return goods, err
2093 2094
 }
2095
+
2096
+func GetStockType(orgid int64) (goodstype []*models.GoodsTypeOne, err error) {
2097
+	err = XTReadDB().Where("org_id = ? and status = 1 and (stock_attribute = 2 or stock_attribute = 3)", orgid).
2098
+		Preload("GoodInfo", "org_id = ? and status = 1", orgid).Find(&goodstype).Error
2099
+	return goodstype, err
2100
+}