feat:合同提交显示重复的信保额申请
This commit is contained in:
parent
1d11a702a5
commit
c99aa0488a
@ -9,6 +9,7 @@ import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||
import kd.bos.entity.datamodel.IDataModel;
|
||||
import kd.bos.entity.datamodel.events.ChangeData;
|
||||
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
||||
import kd.bos.exception.KDBizException;
|
||||
import kd.bos.form.*;
|
||||
import kd.bos.form.events.MessageBoxClosedEvent;
|
||||
import kd.bos.orm.query.QCP;
|
||||
@ -18,6 +19,7 @@ import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@ -305,7 +307,18 @@ public class TotalUtil {
|
||||
qFilter.and(new QFilter("yem_swiftcode", QCP.equals, swiftCode));
|
||||
}
|
||||
|
||||
return BusinessDataServiceHelper.loadSingle("yem_im_csrcreditline", "id," + selectfields, qFilter.toArray());
|
||||
DynamicObject[] load = BusinessDataServiceHelper.load("yem_im_csrcreditline", "id," + selectfields, qFilter.toArray());
|
||||
if (load.length == 1) {
|
||||
return load[0];
|
||||
}
|
||||
if (load.length > 1) {
|
||||
Set<String> set = new HashSet<>();
|
||||
for (DynamicObject d : load) {
|
||||
set.add(d.getString("billno"));
|
||||
}
|
||||
throw new KDBizException("该客户匹配到多个符合条件的客户信保额度申请,请联系单证处理!" + set);
|
||||
}
|
||||
return null;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
@ -796,20 +796,32 @@ public class SalesOrderSubmitValidator extends AbstractValidator {
|
||||
DynamicObject method = TotalUtil.getSettlementMethod(dataEntity);
|
||||
DynamicObject company = dataEntity.getDynamicObject("yem_company.yem_erporg");
|
||||
String swiftCode = TotalUtil.getSwiftCode(dataEntity);
|
||||
DynamicObject[] csrCreditLine = getCsrCreditLine(customer, method, company, swiftCode);
|
||||
boolean bolean = false;
|
||||
if (YEM.isNotEmpty(csrCreditLine)) {
|
||||
for (DynamicObject loadSingle : csrCreditLine) {
|
||||
BigDecimal balance = loadSingle.getBigDecimal("yem_balance");//yem_suminsured
|
||||
String status = loadSingle.getString("yem_limitstatus");
|
||||
if ("A".equals(status)) {
|
||||
bolean =true;
|
||||
if (total.compareTo(balance) > 0) {
|
||||
this.addWarningMessage(dataEntitie, String.format("当前合同的信保额度{%s}超出其剩余限额{%s},请检查数据!", total, balance));
|
||||
}
|
||||
}
|
||||
DynamicObject[] load = getCsrCreditLine(customer, method, company, swiftCode);
|
||||
DynamicObject csrCreditLine = null;
|
||||
if (YEM.isEmpty(load)) {
|
||||
this.addErrorMessage(dataEntitie, "该客户找不到信保额度申请,不可参与信保!");
|
||||
return;
|
||||
}
|
||||
if (load.length == 1) {
|
||||
csrCreditLine = load[0];
|
||||
}
|
||||
if (load.length > 1) {
|
||||
Set<String> set = new HashSet<>();
|
||||
for (DynamicObject d : load) {
|
||||
set.add(d.getString("billno"));
|
||||
}
|
||||
if (!bolean) {
|
||||
this.addErrorMessage(dataEntitie, "该客户匹配到多个符合条件的客户信保额度申请,请联系单证处理!" + set);
|
||||
return;
|
||||
}
|
||||
|
||||
if (YEM.isNotEmpty(csrCreditLine)) {
|
||||
BigDecimal balance = csrCreditLine.getBigDecimal("yem_balance");//yem_suminsured
|
||||
String status = csrCreditLine.getString("yem_limitstatus");
|
||||
if ("A".equals(status)) {
|
||||
if (total.compareTo(balance) > 0) {
|
||||
this.addWarningMessage(dataEntitie, String.format("当前合同的信保额度{%s}超出其剩余限额{%s},请检查数据!", total, balance));
|
||||
}
|
||||
} else {
|
||||
this.addErrorMessage(dataEntitie, "当前客户信保额度申请失效,请联系单证确认!!");
|
||||
}
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user