1.订舱通知单额度确认效验修改
This commit is contained in:
ljw 2024-11-20 17:53:07 +08:00
parent 7d9aa70b93
commit e85ae88a64
2 changed files with 48 additions and 54 deletions

View File

@ -16,7 +16,6 @@ import kd.bos.dataentity.entity.OrmLocaleValue;
import kd.bos.entity.datamodel.IDataModel; import kd.bos.entity.datamodel.IDataModel;
import kd.bos.entity.datamodel.events.*; import kd.bos.entity.datamodel.events.*;
import kd.bos.entity.property.EntryProp; import kd.bos.entity.property.EntryProp;
import kd.bos.exception.KDBizException;
import kd.bos.form.*; import kd.bos.form.*;
import kd.bos.form.control.AttachmentPanel; import kd.bos.form.control.AttachmentPanel;
import kd.bos.form.control.events.UploadListener; import kd.bos.form.control.events.UploadListener;
@ -39,7 +38,6 @@ import kd.bos.util.StringUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.util.*; import java.util.*;
import java.util.concurrent.TimeUnit;
import static com.yem.wm.es.contactbook.op.ContactBookSaveOp.uploadAttachmentPanel; import static com.yem.wm.es.contactbook.op.ContactBookSaveOp.uploadAttachmentPanel;
import static com.yem.wm.es.salesorder.from.SalesOrderEdit.carryReportCategoryAndHsCode; import static com.yem.wm.es.salesorder.from.SalesOrderEdit.carryReportCategoryAndHsCode;
@ -705,40 +703,64 @@ public class StorageTransEdit extends AbstractBillPlugIn implements BeforeF7Sele
// } // }
// } // }
// } // }
int rowCount = model.getEntryRowCount("yem_creditdetail");
BigDecimal attcount = dataEntity.getBigDecimal("yem_attcount"); StringBuilder sb = new StringBuilder();
if (attcount.compareTo(BigDecimal.ZERO) == 0) { for (int i = 0; i < rowCount; i++) {
throw new KDBizException("未上传客户汇款水单附件,不能进行信保确认!"); BigDecimal preamt_cd = (BigDecimal) model.getValue("yem_preamt_cd", i);
} BigDecimal stcreditpreamt_cd = (BigDecimal) model.getValue("yem_stcreditpreamt_cd", i);
preamt_cd = preamt_cd.setScale(2, RoundingMode.HALF_UP);
DynamicObject customer = dataEntity.getDynamicObject("yem_customer"); stcreditpreamt_cd = stcreditpreamt_cd.setScale(2, RoundingMode.HALF_UP);
DynamicObject method = TotalUtil.getSettlementMethod(dataEntity);
DynamicObject company = dataEntity.getDynamicObject("yem_company.yem_erporg");
String swiftCode = TotalUtil.getSwiftCode(dataEntity);
DynamicObject csrCreditLine = TotalUtil.getCsrCreditLine(customer, method, company, swiftCode);
if (csrCreditLine != null && customer != null) {
// 信保金额美元 // 信保金额美元
BigDecimal usacreditamt = dataEntity.getBigDecimal("yem_usacreditamt"); BigDecimal usacreditamt = dataEntity.getBigDecimal("yem_usacreditamt");
DynamicObject customer = dataEntity.getDynamicObject("yem_customer");
DynamicObject method = TotalUtil.getSettlementMethod(dataEntity);
DynamicObject company = dataEntity.getDynamicObject("yem_company.yem_erporg");
String swiftCode = TotalUtil.getSwiftCode(dataEntity);
DynamicObject csrCreditLine = TotalUtil.getCsrCreditLine(customer, method, company, swiftCode);
// 剩余限额 // 剩余限额
BigDecimal balance = csrCreditLine.getBigDecimal("yem_balance"); BigDecimal balance = csrCreditLine.getBigDecimal("yem_balance");
if (stcreditpreamt_cd.compareTo(preamt_cd) < 0) {
sb.append(String.format("信保明细第 %s 行,订舱预收金额 %s 不允许小于系统预收金额 %s ", i + 1, stcreditpreamt_cd.setScale(2, RoundingMode.HALF_UP), preamt_cd.setScale(2, RoundingMode.HALF_UP)));
sb.append("\n\r");
}
int creditdate1_cd = (int) model.getValue("yem_creditdate1_cd", i);//信保天数1
BigDecimal paymentamt1_cd = (BigDecimal) model.getValue("yem_paymentamt1_cd", i);//应收款金额1
BigDecimal paymentamt1_cdbase = (BigDecimal) model.getValue("yem_paymentamt1_cdbase", i);//应收款金额1本位币
if (creditdate1_cd == 0) {
sb.append(String.format("信保明细第 %s 行信保天数1必填\n\r", i + 1));
}
if (YEM.isEmpty(paymentamt1_cd)) {
sb.append(String.format("信保明细第 %s 行应收款金额1必填\n\r", i + 1));
}
if (YEM.isEmpty(paymentamt1_cdbase)) {
sb.append(String.format("信保明细第 %s 行应收款金额1本位币必填\n\r", i + 1));
}
if (usacreditamt.compareTo(balance) > 0) { if (usacreditamt.compareTo(balance) > 0) {
// ConfirmCallBackListener confirmCallBackListener = new ConfirmCallBackListener("creditInsuranceConfirms", this); // ConfirmCallBackListener confirmCallBackListener = new ConfirmCallBackListener("creditInsuranceConfirms", this);
String message = String.format("当前客户:[ %s ] 本次订舱投保总额为 [ %s ] ,剩余限额为 [ %s ] ,已超额,不允许进行信保确认!", // this.getView().showConfirm(message, MessageBoxOptions.YesNo, confirmCallBackListener);
sb.append(String.format("当前客户:[ %s ] 本次订舱投保总额为 [ %s ] ,剩余限额为 [ %s ] ,已超额,不允许进行信保确认!\n\r" ,
customer.getString("name"), customer.getString("name"),
usacreditamt.setScale(2, RoundingMode.HALF_UP), usacreditamt.setScale(2, RoundingMode.HALF_UP),
balance.setScale(2, RoundingMode.HALF_UP)); balance.setScale(2, RoundingMode.HALF_UP)));
// this.getView().showConfirm(message, MessageBoxOptions.YesNo, confirmCallBackListener); }
this.getView().showErrorNotification(message); BigDecimal attcount = dataEntity.getBigDecimal("yem_attcount");
e.setCancel(true); if (attcount.compareTo(BigDecimal.ZERO) == 0) {
} else { sb.append(String.format("未上传客户汇款水单附件,不能进行信保确认!\n\r"));
dataEntity.set("yem_creditbackstatus", "A"); }
view.showSuccessNotification("信保确认成功"); if (csrCreditLine != null && customer != null) {
SaveServiceHelper.save(new DynamicObject[]{dataEntity}); } else {
sb.append(String.format("当前客户不存在信保额度申请,不允许进行信保确认\n\r"));
// view.showErrorNotification("当前客户不存在信保额度申请,不允许进行信保确认");
} }
} else {
view.showErrorNotification("当前客户不存在信保额度申请,不允许进行信保确认");
} }
if (sb.length() > 0) {
e.setCancel(true);
view.showErrorNotification(sb.toString());
} else {
dataEntity.set("yem_creditbackstatus", "A");
view.showSuccessNotification("信保确认成功");
SaveServiceHelper.save(new DynamicObject[]{dataEntity});
}
} }
if ("creditunconfirm".equals(operateKey)) { if ("creditunconfirm".equals(operateKey)) {

View File

@ -54,35 +54,7 @@ public class StorageTransEdit_xbs extends AbstractBillPlugIn {
IDataModel model = this.getModel(); IDataModel model = this.getModel();
IFormView view = this.getView(); IFormView view = this.getView();
if ("creditconfirm".equals(operateKey)) { if ("creditconfirm".equals(operateKey)) {
int rowCount = model.getEntryRowCount("yem_creditdetail");
StringBuilder sb = new StringBuilder();
for (int i = 0; i < rowCount; i++) {
BigDecimal preamt_cd = (BigDecimal) model.getValue("yem_preamt_cd", i);
BigDecimal stcreditpreamt_cd = (BigDecimal) model.getValue("yem_stcreditpreamt_cd", i);
preamt_cd = preamt_cd.setScale(2, RoundingMode.HALF_UP);
stcreditpreamt_cd = stcreditpreamt_cd.setScale(2, RoundingMode.HALF_UP);
if (stcreditpreamt_cd.compareTo(preamt_cd) < 0) {
sb.append(String.format("信保明细第 %s 行,订舱预收金额 %s 不允许小于系统预收金额 %s ", i + 1, stcreditpreamt_cd.setScale(2, RoundingMode.HALF_UP), preamt_cd.setScale(2, RoundingMode.HALF_UP)));
sb.append("\n\r");
}
int creditdate1_cd = (int) model.getValue("yem_creditdate1_cd", i);//信保天数1
BigDecimal paymentamt1_cd = (BigDecimal) model.getValue("yem_paymentamt1_cd", i);//应收款金额1
BigDecimal paymentamt1_cdbase = (BigDecimal) model.getValue("yem_paymentamt1_cdbase", i);//应收款金额1本位币
if (creditdate1_cd == 0) {
sb.append(String.format("信保明细第 %s 行信保天数1必填\n\r", i + 1));
}
if (YEM.isEmpty(paymentamt1_cd)) {
sb.append(String.format("信保明细第 %s 行应收款金额1必填\n\r", i + 1));
}
if (YEM.isEmpty(paymentamt1_cdbase)) {
sb.append(String.format("信保明细第 %s 行应收款金额1本位币必填\n\r", i + 1));
}
}
if (sb.length() > 0) {
e.setCancel(true);
view.showErrorNotification(sb.toString());
}
} }
} }