Pārlūkot izejas kodu

Merge branch 'pool_333' into debug

ziwen 1 gadu atpakaļ
vecāks
revīzija
47f192d6aa
1 mainītis faili ar 21 papildinājumiem un 19 dzēšanām
  1. 21 19
      controller/contract/register.go

+ 21 - 19
controller/contract/register.go

@@ -1486,27 +1486,29 @@ func (rg *RegisterController) Invoice(c *gin.Context) {
 					resp.FailMsg("操作失败", "更新到款登记失败, Err:"+e.Error(), c)
 					return
 				}
-				//修改对应到款的销售
-				summaryItem, err := fms.GetInvoicePaymentSummaryByRegisterIdAndInvoiceId(req.ContractRegisterId, req.AmountList[i].InvoiceId)
-				if err != nil {
-					resp.FailMsg("获取汇总数据失败", "修改到款销售时获取汇总数据失败, Err: "+err.Error(), c)
-					return
-				}
-
-				if summaryItem.PaymentId > 0 {
-					paymentItem := fms.ContractInvoice{}
-					paymentItem.ContractInvoiceId = summaryItem.PaymentId
-					paymentItem.SellerId = sellerItem.SellerId
-					paymentItem.SellerName = sellerItem.SellerName
-					paymentItem.SellerGroupId = sellerItem.GroupId
-					paymentItem.SellerGroupName = sellerItem.GroupName
-					paymentItem.SellerTeamId = sellerItem.TeamId
-					paymentItem.SellerTeamName = sellerItem.TeamName
-					e = paymentItem.Update([]string{"SellerId", "SellerName", "SellerGroupId", "SellerGroupName", "SellerTeamId", "SellerTeamName"})
-					if e != nil {
-						resp.FailMsg("更新到款销售失败", "更新到款销售失败, Err: "+e.Error(), c)
+				if req.InvoiceType == fms.ContractInvoiceTypeMake {
+					//修改对应到款的销售
+					summaryItem, err := fms.GetInvoicePaymentSummaryByRegisterIdAndInvoiceId(req.ContractRegisterId, req.AmountList[i].InvoiceId)
+					if err != nil {
+						resp.FailMsg("获取汇总数据失败", "修改到款销售时获取汇总数据失败, Err: "+err.Error(), c)
 						return
 					}
+
+					if summaryItem.PaymentId > 0 {
+						paymentItem := fms.ContractInvoice{}
+						paymentItem.ContractInvoiceId = summaryItem.PaymentId
+						paymentItem.SellerId = sellerItem.SellerId
+						paymentItem.SellerName = sellerItem.SellerName
+						paymentItem.SellerGroupId = sellerItem.GroupId
+						paymentItem.SellerGroupName = sellerItem.GroupName
+						paymentItem.SellerTeamId = sellerItem.TeamId
+						paymentItem.SellerTeamName = sellerItem.TeamName
+						e = paymentItem.Update([]string{"SellerId", "SellerName", "SellerGroupId", "SellerGroupName", "SellerTeamId", "SellerTeamName"})
+						if e != nil {
+							resp.FailMsg("更新到款销售失败", "更新到款销售失败, Err: "+e.Error(), c)
+							return
+						}
+					}
 				}
 
 				noChangeInvoiceIds = append(noChangeInvoiceIds, req.AmountList[i].InvoiceId)