清账明细单反写清账单已认领金额按照凭证类型DZ来判断

This commit is contained in:
yuxueliang0813 2025-07-08 10:38:53 +08:00
parent 38e2721ee4
commit 488b84fb88
1 changed files with 6 additions and 37 deletions

View File

@ -188,37 +188,6 @@ public class ClearDetailBillOperation extends AbstractOperationServicePlugIn imp
return "ok";
}
private boolean checkAmount(DynamicObject prinfo){
//未清金额+账扣金额+尾差金额本次核销金额合计
BigDecimal billtotal = BigDecimal.ZERO;
BigDecimal a1 = prinfo.getBigDecimal("shjh_unclaimamount");//未清金额
BigDecimal a2 = prinfo.getBigDecimal("shjh_deductionamount");//账扣金额
BigDecimal a3 = prinfo.getBigDecimal("shjh_diffamount");//尾差金额
if(a1 != null){
billtotal = billtotal.add(a1);
}
if(a2 != null){
billtotal = billtotal.add(a2);
}
if(a3 != null){
billtotal = billtotal.add(a3);
}
//获取分录本次核销金额合计
BigDecimal entrytotal = BigDecimal.ZERO;
DynamicObjectCollection doc = prinfo.getDynamicObjectCollection("shjh_details");//获取分录
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"));//累计分录本次核销金额
}
}
//本次核销金额合计-账扣-尾差 >=0 才允许提交
if(billtotal.compareTo(entrytotal) >= 0 && entrytotal.compareTo(JhzjUtils.addTwoAmount(a2,a3)) >= 0){
//校验通过返回true
return true;
}
return false;
}
/**
* 操作执行完毕事务提交之后触发此事件
* 插件可以在此事件处理操作后续事情与操作事务无关
@ -335,12 +304,12 @@ public class ClearDetailBillOperation extends AbstractOperationServicePlugIn imp
//获取清账单收款金额
BigDecimal q3 = clearBillInfo.getBigDecimal("shjh_receamount");
//获取清账单的本次核销金额合计
BigDecimal entrytotal = BigDecimal.ZERO;
// BigDecimal entrytotal = BigDecimal.ZERO;
BigDecimal entrynegatetotal = BigDecimal.ZERO;//获取清账单中对应的已认领收款金额
for (int i = 0; i < cleardoc.size(); i++) {
clearEntryInfo = cleardoc.get(i);
entrytotal = entrytotal.add(clearEntryInfo.getBigDecimal("shjh_e_cursettle"));
if(clearEntryInfo.getBigDecimal("shjh_e_cursettle").signum() == -1){
// entrytotal = entrytotal.add(clearEntryInfo.getBigDecimal("shjh_e_cursettle"));
if(isDZvourcherType(clearEntryInfo.getString("shjh_e_pzlx"))){
entrynegatetotal = entrynegatetotal.add(clearEntryInfo.getBigDecimal("shjh_e_cursettle"));
}
}
@ -350,7 +319,7 @@ public class ClearDetailBillOperation extends AbstractOperationServicePlugIn imp
// }
// //已认领收款金额=本次核销金额合计-账扣-尾差
// clearBillInfo.set("shjh_claimamount", entrytotal.subtract(q1).subtract(q2));
//已认领收款金额=分录负数金额合计的绝对值
//已认领收款金额=分录凭证类型DZ负数金额合计的绝对值
clearBillInfo.set("shjh_claimamount", entrynegatetotal.abs());
//未认领收款金额=收款金额-已认领收款金额
clearBillInfo.set("shjh_unclaimamount", q3.subtract(clearBillInfo.getBigDecimal("shjh_claimamount")));
@ -395,7 +364,7 @@ public class ClearDetailBillOperation extends AbstractOperationServicePlugIn imp
clearEntryInfo = cleardoc.get(i);
if(idsets.contains(clearEntryInfo.getString("shjh_e_detailentryid"))){
cleardoc.remove(clearEntryInfo);
}else if(clearEntryInfo.getBigDecimal("shjh_e_cursettle").signum() == -1){
}else if(isDZvourcherType(clearEntryInfo.getString("shjh_e_pzlx"))){
entrynegatetotal = entrynegatetotal.add(clearEntryInfo.getBigDecimal("shjh_e_cursettle"));
}
// else{
@ -412,7 +381,7 @@ public class ClearDetailBillOperation extends AbstractOperationServicePlugIn imp
clearBillInfo.set("shjh_diffamount",q2);
//已认领收款金额=本次核销金额合计-账扣-尾差
// clearBillInfo.set("shjh_claimamount", entrytotal.subtract(q1).subtract(q2));
//已认领收款金额=分录负数金额合计的绝对值
//已认领收款金额=分录凭证类型DZ负数金额合计的绝对值
clearBillInfo.set("shjh_claimamount", entrynegatetotal.abs());
//未认领收款金额=收款金额-已认领收款金额
clearBillInfo.set("shjh_unclaimamount", JhzjUtils.reduceTwoAmount(clearBillInfo.getBigDecimal("shjh_receamount"),