浏览代码

fix:修改验证合同金额不生效

zoie 3 月之前
父节点
当前提交
236d462605
共有 1 个文件被更改,包括 8 次插入6 次删除
  1. 8 6
      controllers/Contract.go

+ 8 - 6
controllers/Contract.go

@@ -568,10 +568,10 @@ func Check_NeedToDelete_Product_List(list []string, newList []Contract.ContractP
 	}
 
 	for _, product := range newList {
-		all[product.T_product_id] = fmt.Sprintf("%d-%d", product.Id, product.T_product_total)
+		all[product.T_product_id] = fmt.Sprintf("%d-%d-%f", product.Id, product.T_product_total, product.T_price)
 		_, ok := productMap[product.T_product_id]
 		if !ok {
-			id := fmt.Sprintf("%d-%d", product.Id, product.T_product_id)
+			id := fmt.Sprintf("%d-%d-%f", product.Id, product.T_product_id, product.T_price)
 			needToDelete[id] = product.T_product_out
 		}
 
@@ -880,8 +880,9 @@ func (c *ContractController) VerifyContract_Edit() {
 				T_contract_number: T_number,
 				T_product_id:      product_id,
 				T_product_total:   num,
-				T_product_out:     0, // 已出库数量
-				T_State:           1, // 1-未出库 2-已部分出库 3-已全部出库
+				T_product_out:     0,              // 已出库数量
+				T_price:           float32(price), // 已出库数量
+				T_State:           1,              // 1-未出库 2-已部分出库 3-已全部出库
 			}
 			_, err = ContractProductDao.Add_ContractProduct(contractProduct)
 			if err != nil {
@@ -897,7 +898,8 @@ func (c *ContractController) VerifyContract_Edit() {
 		// 修改产品总数量
 		contractProductId, _ := strconv.Atoi(strings.Split(oldContractProduct, "-")[0])
 		oldNum, _ := strconv.Atoi(strings.Split(oldContractProduct, "-")[1])
-		if oldNum == num && T_number == oldT_number {
+		oldPrice := lib.StringToFloat64TwoDecimal(strings.Split(oldContractProduct, "-")[2])
+		if oldNum == num && T_number == oldT_number && oldPrice == price {
 			continue
 		}
 		cp := Contract.ContractProduct{
@@ -906,7 +908,7 @@ func (c *ContractController) VerifyContract_Edit() {
 			T_product_total:   num,
 			T_price:           float32(price), // 价格
 		}
-		err = ContractProductDao.Update_ContractProduct(cp, "T_product_total", "T_contract_number")
+		err = ContractProductDao.Update_ContractProduct(cp, "T_product_total", "T_contract_number", "T_price")
 		if err != nil {
 			o.Rollback()
 			c.Data["json"] = lib.JSONS{Code: 203, Msg: "修改失败"}