diff --git a/main/java/shjh/jhzj7/fi/fi/plugin/form/ClearDetailFormPlugin.java b/main/java/shjh/jhzj7/fi/fi/plugin/form/ClearDetailFormPlugin.java index cd2cbdc..c90fe1c 100644 --- a/main/java/shjh/jhzj7/fi/fi/plugin/form/ClearDetailFormPlugin.java +++ b/main/java/shjh/jhzj7/fi/fi/plugin/form/ClearDetailFormPlugin.java @@ -6,7 +6,6 @@ import kd.bos.dataentity.entity.DynamicObjectCollection; import kd.bos.form.CloseCallBack; import kd.bos.form.FormShowParameter; import kd.bos.form.ShowType; -import kd.bos.form.control.Toolbar; import kd.bos.form.control.events.ItemClickEvent; import kd.bos.form.events.ClosedCallBackEvent; import kd.bos.logging.Log; @@ -157,7 +156,8 @@ public class ClearDetailFormPlugin extends AbstractBillPlugIn implements Plugin this.getModel().setValue("shjh_e_text",returnInfo.getString("shjh_e_text"), i);// 文本 this.getModel().setValue("shjh_e_gzdate",returnInfo.getDate("shjh_e_gzdate"), i);// 过账日期 this.getModel().setValue("shjh_e_unsettle",returnInfo.getBigDecimal("shjh_e_unsettle"), i);//未核销金额 -// this.getModel().setValue("shjh_e_cursettle",returnInfo.getBigDecimal("shjh_e_cursettle"), i);//本次核销金额 + //本次核销金额 默认为 未核销金额 + this.getModel().setValue("shjh_e_cursettle",returnInfo.getBigDecimal("shjh_e_unsettle"), i); this.getModel().setValue("shjh_e_year",returnInfo.getString("shjh_e_year"), i);//会计年度 // this.getModel().setValue("shjh_e_qzpztext",returnInfo.getString("shjh_e_qzpztext"), i);// 清账凭证文本 } diff --git a/main/java/shjh/jhzj7/fi/fi/plugin/operate/ClearDetailBillOperation.java b/main/java/shjh/jhzj7/fi/fi/plugin/operate/ClearDetailBillOperation.java index 2c6cf6c..94cfff0 100644 --- a/main/java/shjh/jhzj7/fi/fi/plugin/operate/ClearDetailBillOperation.java +++ b/main/java/shjh/jhzj7/fi/fi/plugin/operate/ClearDetailBillOperation.java @@ -59,12 +59,13 @@ public class ClearDetailBillOperation extends AbstractOperationServicePlugIn imp e.setCancel(true); } //清账明细单【未清金额】+【账扣金额】+【尾差金额】≥【本次核销金额合计】 - if(!checkAmount(prinfo)){ - e.setCancelMessage(billno+"【未清金额】+【账扣】+【尾差】≥【本次核销金额合计】,【本次核销金额合计】-【账扣】-【尾差】>=0,才允许提交"); - e.setCancel(true); - } +// if(!checkAmount(prinfo)){ +// e.setCancelMessage(billno+"【未清金额】+【账扣】+【尾差】≥【本次核销金额合计】,【本次核销金额合计】-【账扣】-【尾差】>=0,才允许提交"); +// e.setCancel(true); +// } + //校验本次核销金额填写是否有误,防止在正数行填写负数,在负数行中填写正数 if(checkEntryAmount(prinfo)){ - e.setCancelMessage(billno+"分录本次核销金额的合计等于0,负数金额合计的绝对值小于等于未清金额,才允许提交"); + e.setCancelMessage(billno+"分录本次核销金额填写有误,合计等于0,负数金额合计的绝对值小于等于未清金额,才允许提交"); e.setCancel(true); } //判断对应的清账单是否已提交,如果是,则不允许提交此明细单 @@ -105,14 +106,21 @@ public class ClearDetailBillOperation extends AbstractOperationServicePlugIn imp private boolean checkEntryAmount(DynamicObject prinfo){ //校验分录本次核销金额的合计等于0 负数金额相加部分的绝对值不能大于未清金额 - BigDecimal entrytotal = BigDecimal.ZERO; - BigDecimal entrynegatetotal = BigDecimal.ZERO; + BigDecimal entrytotal = BigDecimal.ZERO;//本次核销金额合计 + BigDecimal entrynegatetotal = BigDecimal.ZERO;//负数本次核销金额合计 DynamicObjectCollection doc = prinfo.getDynamicObjectCollection("shjh_details");//获取分录 + //校验本次核销金额填写是否有误,防止在正数行填写负数,在负数行中填写正数 + BigDecimal cursettle;//本次核销金额 for (int i = 0; i < doc.size(); i++) { - if(doc.get(i).getBigDecimal("shjh_e_cursettle") != null){ - entrytotal = entrytotal.add(doc.get(i).getBigDecimal("shjh_e_cursettle"));//累计分录本次核销金额 - if(doc.get(i).getBigDecimal("shjh_e_cursettle").signum() == -1){ - entrynegatetotal = entrynegatetotal.add(doc.get(i).getBigDecimal("shjh_e_cursettle")); + cursettle = doc.get(i).getBigDecimal("shjh_e_cursettle"); + if(cursettle != null){ + entrytotal = entrytotal.add(cursettle);//累计分录本次核销金额 + if(cursettle.signum() == -1){ + entrynegatetotal = entrynegatetotal.add(cursettle); + } + if(cursettle.multiply(doc.get(i).getBigDecimal("shjh_e_unsettle")).signum() == -1){ + //当本次核销金额与未核销金额相乘后得出是负数的话,说明金额正负数填写反了 + return true; } } }