|
@@ -2119,20 +2119,28 @@ func (rg *RegisterController) Import(c *gin.Context) {
|
|
|
return
|
|
|
}
|
|
|
rowRegister.RegisterStatus = fms.ContractRegisterStatusIng
|
|
|
- lastInvoices := make([]*fms.ContractInvoice, 0)
|
|
|
+ rowInvoiceList := make([]*fms.ContractInvoice, 0)
|
|
|
// 过滤信息不完整的开票到款
|
|
|
for l := range rowInvoices {
|
|
|
- if rowInvoices[l].ContractCode != "" && rowInvoices[l].SellerId > 0 {
|
|
|
- lastInvoices = append(lastInvoices, rowInvoices[l])
|
|
|
+ if rowInvoices[l].ContractCode != "" {
|
|
|
+ if rowInvoices[l].OriginAmount <= 0 || rowInvoices[l].SellerId == 0 {
|
|
|
+ resp.Fail(fmt.Sprintf("第%d行开票信息必填项不完整", i+1), c)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ rowInvoiceList = append(rowInvoiceList, rowInvoices[l])
|
|
|
}
|
|
|
}
|
|
|
for l := range rowPayments {
|
|
|
if rowPayments[l].ContractCode != "" {
|
|
|
- lastInvoices = append(lastInvoices, rowPayments[l])
|
|
|
+ if rowPayments[l].OriginAmount <= 0 {
|
|
|
+ resp.Fail(fmt.Sprintf("第%d行到款信息必填项不完整", i+1), c)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ rowInvoiceList = append(rowInvoiceList, rowPayments[l])
|
|
|
}
|
|
|
}
|
|
|
// 新增登记、套餐、开票到款信息
|
|
|
- newId, e := fms.CreateImportContractRegister(rowRegister, rowServices, lastInvoices)
|
|
|
+ newId, e := fms.CreateImportContractRegister(rowRegister, rowServices, rowInvoiceList)
|
|
|
if e != nil {
|
|
|
resp.FailData(fmt.Sprintf("第%d行导入失败", i+1), "新增导入登记失败, Err: "+e.Error(), c)
|
|
|
return
|