清账明细单优化

This commit is contained in:
yuxueliang0813 2025-05-08 15:13:15 +08:00
parent 22d4b28e47
commit b96ca9810f
2 changed files with 21 additions and 13 deletions

View File

@ -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);// 清账凭证文本
}

View File

@ -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;
}
}
}