ziwen 2 years ago
parent
commit
c6fee4ef48
2 changed files with 13 additions and 11 deletions
  1. 12 11
      controller/contract/pre_register.go
  2. 1 0
      models/fms/contract_pre_payment.go

+ 12 - 11
controller/contract/pre_register.go

@@ -966,17 +966,17 @@ func (rg *PreRegisterController) Save(c *gin.Context) {
 			v.SellerGroupName = sellerItem.GroupName
 			v.SellerTeamId = sellerItem.TeamId
 			v.SellerTeamName = sellerItem.TeamName
-			invoiceUpdateCols = append(invoiceUpdateCols,"SellerId","SellerName","SellerGroupId",
-				"SellerGroupName","SellerTeamId","SellerTeamName")
+			invoiceUpdateCols = append(invoiceUpdateCols, "SellerId", "SellerName", "SellerGroupId",
+				"SellerGroupName", "SellerTeamId", "SellerTeamName")
 		}
 
 		// 新增开票到款记录
 		if v.ContractInvoiceId != 0 {
 			//更新
 			invoiceHandleType = 1
-			invoiceUpdateCols = append(invoiceUpdateCols, "OriginAmount","CurrencyUnit",
-				"InvoiceDate","Remark","ServiceProductId","StartDate","EndDate","ModifyTime")
-		}else {
+			invoiceUpdateCols = append(invoiceUpdateCols, "OriginAmount", "CurrencyUnit",
+				"InvoiceDate", "Remark", "ServiceProductId", "StartDate", "EndDate", "ModifyTime")
+		} else {
 			//新增
 			invoiceHandleType = 2
 		}
@@ -984,6 +984,7 @@ func (rg *PreRegisterController) Save(c *gin.Context) {
 
 		//预登记列表
 		pp := &fms.ContractPreRegister{
+			PreRegisterId:      req.PreRegisterId,
 			ContractRegisterId: ob.ContractRegisterId,
 			CompanyName:        req.CompanyName,
 			InvoiceType:        req.RegisterType,
@@ -1029,13 +1030,13 @@ func (rg *PreRegisterController) Save(c *gin.Context) {
 			pp.ArriveAmount = a
 		}
 
-		// 新增开票到款记录
-		if e = pp.Create(); e != nil {
-			resp.FailMsg("操作失败", "新增预登记失败, Err: "+e.Error(), c)
-			return
-		}
+		// 更新预登记列表
+		//if e = pp.Create(); e != nil {
+		//	resp.FailMsg("操作失败", "新增预登记失败, Err: "+e.Error(), c)
+		//	return
+		//}
 	}
-	if e = fms.UpdateContractRegisterPre(ob, updateCols, serviceList,invoiceList, invoiceUpdateCols, invoiceHandleType); e != nil {
+	if e = fms.UpdateContractRegisterPre(ob, updateCols, serviceList, invoiceList, invoiceUpdateCols, invoiceHandleType); e != nil {
 		resp.FailMsg("操作失败", "新增合同及套餐失败, Err: "+e.Error(), c)
 		return
 	}

+ 1 - 0
models/fms/contract_pre_payment.go

@@ -195,6 +195,7 @@ type PreRegisterSaveReqItem struct {
 
 // PreRegisterSaveReq 预登记保存请求体
 type PreRegisterSaveReq struct {
+	PreRegisterId      int                      `json:"pre_register_id" description:"预登记ID"`
 	ContractRegisterId int                      `json:"contract_register_id" binding:"required,gte=1" description:"登记ID"`
 	CompanyName        string                   `json:"company_name" binding:"required" description:"客户名称"`
 	StartDate          string                   `json:"start_date" binding:"required" description:"约定开始日期"`