ziwen 2 years ago
parent
commit
1bc8c64cc9
2 changed files with 7 additions and 3 deletions
  1. 7 1
      controller/contract/register.go
  2. 0 2
      models/fms/contract_register.go

+ 7 - 1
controller/contract/register.go

@@ -348,13 +348,19 @@ func (rg *RegisterController) Add(c *gin.Context) {
 			AmountRemark:       fmt.Sprint("新增", fms.ContractInvoiceKeyNameMap[opType], "金额", ia, "元"),
 		})
 
-		// 删除并新增登记
 		ob := new(fms.ContractInvoice)
 		if e := v.Create(); e != nil {
 			resp.FailData("日期格式有误", "Err:"+e.Error(), c)
 			return
 		}
 
+		//最后删除预到款记录
+		e = ppItem.Delete()
+		if e != nil {
+			resp.FailMsg("删除预到款记录失败", "Err:"+e.Error(), c)
+			return
+		}
+
 		// 开票到款汇总
 		go fmsService.SummaryInvoicePaymentByContractRegisterId(ob.ContractRegisterId)
 

+ 0 - 2
models/fms/contract_register.go

@@ -472,7 +472,5 @@ func CreateContractRegisterAndServicesAndPayMent(item *ContractRegister, service
 		//}
 	}
 
-	sql := `DELETE FROM contract_pre_payment WHERE pre_pay_id = ?`
-	tx.Exec(sql, prePayId)
 	return
 }