费用所属年月 排程合并增加log输出

This commit is contained in:
yuxueliang0813 2025-07-03 19:03:47 +08:00
parent 1bb70c4b58
commit 887d2f761c
2 changed files with 17 additions and 4 deletions

View File

@ -179,8 +179,13 @@ public class PaybillOperation extends AbstractOperationServicePlugIn implements
public static JSONArray buildBody(DynamicObject bill) {
bill = BusinessDataServiceHelper.loadSingle(bill.getPkValue(), "cas_paybill");
JSONArray body = new JSONArray();
// 付款明细
//付款单-付款明细分录
DynamicObjectCollection Lists = bill.getDynamicObjectCollection("entry");
//付款单-业务日期 bizdate
Date billbizdate = bill.getDate("bizdate");
//付款单-费用所属年月 shjh_fyssny
Date fyssnydate = bill.getDate("shjh_fyssny");
for (DynamicObject obj : Lists) {
JSONObject jsonObject = new JSONObject();
Double e_actamt = Double.valueOf(String.valueOf(obj.getBigDecimal("e_actamt"))); // 含税金额_实付金额
@ -189,9 +194,16 @@ public class PaybillOperation extends AbstractOperationServicePlugIn implements
jsonObject.put("FM_ClaimAmt", e_actamt);
jsonObject.put("FM_ExcluAmt", excluamt);//未税金额
jsonObject.put("FM_VatAmt", taxamt);
Date entrybizdate = obj.getDate("entrybizdate");
// Date 对象转换为 LocalDate 对象
LocalDate localDate = entrybizdate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
LocalDate localDate;
if(fyssnydate != null){
//费用所属年月不为空时推送给费控的年月按此日期来
localDate = fyssnydate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
}else{
localDate = billbizdate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
}
// 提取年份
int year = localDate.getYear();
// 提取月份

View File

@ -20,7 +20,6 @@ import kd.sdk.plugin.Plugin;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
/**
* 排程单据合并/解除
@ -112,6 +111,7 @@ public class SchedulebillMergeOperation extends AbstractOperationServicePlugIn i
//排程任务池列表界面上增加一键合并按钮点击后将来源系统为sap的按照合并规则进行合并 并将合并状态置为true
String operationKey = e.getOperationKey();
if ("shjh_pcbillhb".equals(operationKey)) {
log.info("shjh_pcbillhb 排程合并操作开始");
DynamicObject[] dataEntities = e.getDataEntities();
// 提前加载所有 bill 对象
DynamicObject[] loadedBills = loadAllBills(dataEntities);
@ -171,6 +171,7 @@ public class SchedulebillMergeOperation extends AbstractOperationServicePlugIn i
}
sb.append("单据编号为").append(billno).append("的单据:生成合并单").append(key).append("成功\n ");
}
log.info(sb.toString());//将最终结果log输出
OperateErrorInfo operateErrorInfo = new OperateErrorInfo();
operateErrorInfo.setMessage(sb.toString());
operateErrorInfo.setErrorLevel(ErrorLevel.Error.name());