瀏覽代碼

耗材参数

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
 		fmt.Println(project_id)
898
 		fmt.Println(project_id)
899
 		fmt.Println(project.ProjectId)
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
 	if json["total"] != nil && reflect.TypeOf(json["total"]).String() == "string" {
913
 	if json["total"] != nil && reflect.TypeOf(json["total"]).String() == "string" {
908
 		total, _ := json["total"].(string)
914
 		total, _ := json["total"].(string)
952
 		item_id := int64(json["item_id"].(float64))
958
 		item_id := int64(json["item_id"].(float64))
953
 		additionalCharge.ItemId = item_id
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
 	if json["count"] != nil && reflect.TypeOf(json["count"]).String() == "string" {
972
 	if json["count"] != nil && reflect.TypeOf(json["count"]).String() == "string" {
962
 		count, _ := json["count"].(string)
973
 		count, _ := json["count"].(string)

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

1813
 func (c *ManagerCenterApiController) CreateAddition() {
1813
 func (c *ManagerCenterApiController) CreateAddition() {
1814
 	name := c.GetString("name")
1814
 	name := c.GetString("name")
1815
 	code := c.GetString("code")
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
 	if len(name) <= 0 {
1821
 	if len(name) <= 0 {
1819
 		utils.ErrorLog("len(name) == 0")
1822
 		utils.ErrorLog("len(name) == 0")
1821
 		return
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
 	adminUserInfo := c.GetAdminUserInfo()
1833
 	adminUserInfo := c.GetAdminUserInfo()
1831
 
1834
 
1833
 		Name:      name,
1836
 		Name:      name,
1834
 		Code:      code,
1837
 		Code:      code,
1835
 		Status:    1,
1838
 		Status:    1,
1836
-		Price:     price,
1839
+		Price:     price_float,
1837
 		Ctime:     time.Now().Unix(),
1840
 		Ctime:     time.Now().Unix(),
1838
 		Mtime:     time.Now().Unix(),
1841
 		Mtime:     time.Now().Unix(),
1839
 		UserOrgId: adminUserInfo.CurrentOrgId,
1842
 		UserOrgId: adminUserInfo.CurrentOrgId,
1870
 		return
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
 	adminUserInfo := c.GetAdminUserInfo()
1882
 	adminUserInfo := c.GetAdminUserInfo()
1880
 	addition := models.XtHisAddtionConfig{
1883
 	addition := models.XtHisAddtionConfig{

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

1161
 	}
1161
 	}
1162
 	if endtime > 0 {
1162
 	if endtime > 0 {
1163
 		db = db.Preload("QueryWarehouseOutInfo", func(db *gorm.DB) *gorm.DB {
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
 	db = db.Preload("QueryWarehousingInfo", func(db *gorm.DB) *gorm.DB {
1170
 	db = db.Preload("QueryWarehousingInfo", func(db *gorm.DB) *gorm.DB {
1171
 		return db.Where("org_id = ? AND status = 1", orgId)
1171
 		return db.Where("org_id = ? AND status = 1", orgId)
1172
 	})
1172
 	})
1173
+
1173
 	db = db.Preload("QuerySalesReturnInfo", "org_id = ? AND status = 1", orgId)
1174
 	db = db.Preload("QuerySalesReturnInfo", "org_id = ? AND status = 1", orgId)
1174
 
1175
 
1175
 	if startime == 0 || endtime == 0 {
1176
 	if startime == 0 || endtime == 0 {
2091
 	err = db.Where("org_id = ? and status =1", orgid).Find(&goods).Error
2092
 	err = db.Where("org_id = ? and status =1", orgid).Find(&goods).Error
2092
 	return goods, err
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
+}