清账单自动下推明细单优化判断条件
This commit is contained in:
parent
20e09dace3
commit
2ec1ac69a3
|
|
@ -62,6 +62,21 @@ public class ClearAccountBillOperation extends AbstractOperationServicePlugIn im
|
|||
private static final String pzbName = "shjh_jgqzcust";//结构性清账客户映射表
|
||||
private static final String voucherName = "gl_voucher";//凭证
|
||||
|
||||
private boolean isNeedOperationCheck(String eok){
|
||||
if ("unclearacctount_check".equals(eok)) {
|
||||
return true;
|
||||
}else if ("clearacctount".equals(eok)) {
|
||||
return true;
|
||||
}else if ("invalid".equals(eok)) {
|
||||
return true;
|
||||
}else if ("copyqz".equals(eok)) {
|
||||
return true;
|
||||
}else if ("updatestatus".equals(eok)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 操作校验通过之后,开启事务之前,触发此事件;
|
||||
* 插件可以在此事件,对通过校验的数据,进行整理
|
||||
|
|
@ -71,13 +86,17 @@ public class ClearAccountBillOperation extends AbstractOperationServicePlugIn im
|
|||
super.beforeExecuteOperationTransaction(e);
|
||||
//反清账、作废、复制、修改清账单状态增加校验。
|
||||
String eok = e.getOperationKey();
|
||||
//如果是由后台定时任务触发收款单自动下推清账单时,需要判断操作代码,防止首次保存操作进来,单子还未存数据库,从而load不到
|
||||
if(!isNeedOperationCheck(eok)){
|
||||
return;
|
||||
}
|
||||
DynamicObject[] dos = e.getDataEntities();
|
||||
DynamicObject prinfo;
|
||||
String billno;
|
||||
String billstatus;
|
||||
String clearstatus;
|
||||
for (int i = 0; i < dos.length; i++) {
|
||||
//反审核操作之前系统未把info对象所有属性加载出来,尤其是二开的字段,需要在此处重新load一下
|
||||
//清账、反清账、作废等操作在列表界面触发时系统未把info对象所有属性加载出来,尤其是二开的字段,需要在此处重新load一下
|
||||
prinfo = BusinessDataServiceHelper.loadSingle(dos[i].getPkValue(), dos[i].getDataEntityType().getName(),
|
||||
"id,billno,billstatus,shjh_clearstatus,shjh_pzh,shjh_recebillno,shjh_unclearway,shjh_iscopy,shjh_unclaimamount");
|
||||
billno = prinfo.getString("billno");
|
||||
|
|
@ -326,9 +345,17 @@ public class ClearAccountBillOperation extends AbstractOperationServicePlugIn im
|
|||
String eok = e.getOperationKey();
|
||||
for (int i = 0; i < dos.length; i++) {
|
||||
prinfo = BusinessDataServiceHelper.loadSingle(dos[i].getPkValue(), dos[i].getDataEntityType().getName());
|
||||
//保存操作时判断下推明细单结果,如果未下推成功,则处理,否则按清账按钮原逻辑处理
|
||||
if("save".equals(eok) && "A".equals(prinfo.getString("shjh_pushdetail"))){
|
||||
continue;
|
||||
//保存操作时判断下推明细单结果,如果未下推成功,则先判断是否满足条件再自动下推,否则按清账按钮原逻辑处理
|
||||
if("save".equals(eok)){
|
||||
//清账单【单据状态】=暂存 and【清账状态】=待清账 and 【未认领收款金额】≠0,才允许自动下推。
|
||||
if (!"A".equals(prinfo.getString("billstatus")) || !"B".equals(prinfo.getString("shjh_clearstatus")) ||
|
||||
JhzjUtils.isZERO(prinfo.getBigDecimal("shjh_unclaimamount"))) {
|
||||
continue;
|
||||
}
|
||||
//清账单已下推成功
|
||||
if("A".equals(prinfo.getString("shjh_pushdetail"))){
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
//判断当前清账单是否由收款单补推,如果是,则根据清账单上的被通知人进行通知;否则根据配置表
|
||||
|
|
@ -359,7 +386,9 @@ public class ClearAccountBillOperation extends AbstractOperationServicePlugIn im
|
|||
if (pzbs.length == 0) {
|
||||
//更新清账单下推明细单结果
|
||||
DB.update(DBRoute.of("fi"), updatePushStatus, new Object[]{"B", prinfo.getPkValue()});
|
||||
addErrorInfo(prinfo,"根据结构性清账客户映射表未找到对应通知人,无法下推清账明细单");
|
||||
if(!"save".equals(eok)){
|
||||
addErrorInfo(prinfo,"根据结构性清账客户映射表未找到对应通知人,无法下推清账明细单");
|
||||
}
|
||||
continue;
|
||||
}
|
||||
pzbinfo = BusinessDataServiceHelper.loadSingle(pzbs[0].getLong("id"), pzbName);
|
||||
|
|
|
|||
|
|
@ -16,9 +16,7 @@ import kd.bos.servicehelper.operation.OperationServiceHelper;
|
|||
import kd.sdk.plugin.Plugin;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.security.Timestamp;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue