diff --git a/src/main/java/com/yem/wm/es/storagetrans/form/StorageTransEdit.java b/src/main/java/com/yem/wm/es/storagetrans/form/StorageTransEdit.java index 04261c0e..d602d6bd 100644 --- a/src/main/java/com/yem/wm/es/storagetrans/form/StorageTransEdit.java +++ b/src/main/java/com/yem/wm/es/storagetrans/form/StorageTransEdit.java @@ -16,7 +16,6 @@ import kd.bos.dataentity.entity.OrmLocaleValue; import kd.bos.entity.datamodel.IDataModel; import kd.bos.entity.datamodel.events.*; import kd.bos.entity.property.EntryProp; -import kd.bos.exception.KDBizException; import kd.bos.form.*; import kd.bos.form.control.AttachmentPanel; import kd.bos.form.control.events.UploadListener; @@ -39,7 +38,6 @@ import kd.bos.util.StringUtils; import java.math.BigDecimal; import java.math.RoundingMode; import java.util.*; -import java.util.concurrent.TimeUnit; import static com.yem.wm.es.contactbook.op.ContactBookSaveOp.uploadAttachmentPanel; import static com.yem.wm.es.salesorder.from.SalesOrderEdit.carryReportCategoryAndHsCode; @@ -705,40 +703,64 @@ public class StorageTransEdit extends AbstractBillPlugIn implements BeforeF7Sele // } // } // } - - BigDecimal attcount = dataEntity.getBigDecimal("yem_attcount"); - if (attcount.compareTo(BigDecimal.ZERO) == 0) { - throw new KDBizException("未上传客户汇款水单附件,不能进行信保确认!"); - } - - 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); - if (csrCreditLine != null && customer != null) { + 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); // 信保金额(美元) 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"); + 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) { // 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"), usacreditamt.setScale(2, RoundingMode.HALF_UP), - balance.setScale(2, RoundingMode.HALF_UP)); -// this.getView().showConfirm(message, MessageBoxOptions.YesNo, confirmCallBackListener); - this.getView().showErrorNotification(message); - e.setCancel(true); - } else { - dataEntity.set("yem_creditbackstatus", "A"); - view.showSuccessNotification("信保确认成功"); - SaveServiceHelper.save(new DynamicObject[]{dataEntity}); + balance.setScale(2, RoundingMode.HALF_UP))); + } + BigDecimal attcount = dataEntity.getBigDecimal("yem_attcount"); + if (attcount.compareTo(BigDecimal.ZERO) == 0) { + sb.append(String.format("未上传客户汇款水单附件,不能进行信保确认!\n\r")); + } + if (csrCreditLine != null && customer != null) { + } 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)) { diff --git a/src/main/java/com/yem/wm/es/storagetrans/form/StorageTransEdit_xbs.java b/src/main/java/com/yem/wm/es/storagetrans/form/StorageTransEdit_xbs.java index 8eea217b..877de7ac 100644 --- a/src/main/java/com/yem/wm/es/storagetrans/form/StorageTransEdit_xbs.java +++ b/src/main/java/com/yem/wm/es/storagetrans/form/StorageTransEdit_xbs.java @@ -54,35 +54,7 @@ public class StorageTransEdit_xbs extends AbstractBillPlugIn { IDataModel model = this.getModel(); IFormView view = this.getView(); 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()); - } } }