diff --git a/main/java/shjh/jhzj7/fi/fi/plugin/operate/PayBillSubmitOperation.java b/main/java/shjh/jhzj7/fi/fi/plugin/operate/PayBillSubmitOperation.java index 47266f3..acede09 100644 --- a/main/java/shjh/jhzj7/fi/fi/plugin/operate/PayBillSubmitOperation.java +++ b/main/java/shjh/jhzj7/fi/fi/plugin/operate/PayBillSubmitOperation.java @@ -159,6 +159,9 @@ public class PayBillSubmitOperation extends AbstractOperationServicePlugIn imple break; } } + }else { + IT_ITEM.put("LIFNR", "");//供应商或债权人的帐号 + IT_ITEM.put("KUNNR", number);//员工客户账号 } } } diff --git a/main/java/shjh/jhzj7/fi/fi/plugin/operate/RecBillSaveOperation.java b/main/java/shjh/jhzj7/fi/fi/plugin/operate/RecBillSaveOperation.java index 9ba4b5e..2200ea6 100644 --- a/main/java/shjh/jhzj7/fi/fi/plugin/operate/RecBillSaveOperation.java +++ b/main/java/shjh/jhzj7/fi/fi/plugin/operate/RecBillSaveOperation.java @@ -70,6 +70,36 @@ public class RecBillSaveOperation extends AbstractOperationServicePlugIn impleme DynamicObjectCollection collection = rule.getDynamicObjectCollection("entryentity"); for (DynamicObject entry : collection) { if (rulename.equals(entry.getString("e_rulesname"))) { + /* + * 1.收款入账中心按规则生单,收款单保存时触发 + * 2.匹配的规则分录行中"取规则得映射表客户"为true,按照收款入账中心的对方户名去映射表过滤客户 + * 3若没有,取"4000042_不明确客户"为默认值,携带到收款单的收款人名称,id字段, + * 4.并且将对方户名携带到收款单备注字段中 + */ + long payer = bill.getLong("payer");//付款人id + if (payer == 0) { + boolean shjhEGetcustomer = entry.getBoolean("shjh_e_getcustomer"); + if (shjhEGetcustomer) { + String oppunit = beiIntelpay.getString("oppunit");//收款入账中心的对方户名 + bill.set("shjh_dfhm", oppunit);//收款单备注字段 + QFilter qFilter = new QFilter("shjh_dfhm", QCP.equals, oppunit); + DynamicObject shjhDfhmcust = BusinessDataServiceHelper.loadSingle("shjh_dfhmcust", qFilter.toArray()); + if (null != shjhDfhmcust) { + DynamicObject shjhCustomer = shjhDfhmcust.getDynamicObject("shjh_customer"); + if (null != shjhCustomer) { + bill.set("payer", shjhCustomer.getPkValue());//付款人id + bill.set("payername", shjhCustomer.getString("name"));//付款人名称 + } + }else { + QFilter qFilter1 = new QFilter("number", QCP.equals, "4000042"); + DynamicObject bdCustomer = BusinessDataServiceHelper.loadSingle("bd_customer", qFilter1.toArray()); + if (null != bdCustomer) { + bill.set("payer", bdCustomer.getPkValue());//付款人id + bill.set("payername", bdCustomer.getString("name"));//付款人名称 + } + } + } + } DynamicObject shjhBizbig = (DynamicObject) bill.get("shjh_bizebig"); if (null == shjhBizbig) { bill.set("shjh_bizebig", entry.getDynamicObject("shjh_e_bizbig")); diff --git a/main/java/shjh/jhzj7/fi/fi/plugin/operate/VoucherAuditOperation.java b/main/java/shjh/jhzj7/fi/fi/plugin/operate/VoucherAuditOperation.java index 194f01f..0aa79bd 100644 --- a/main/java/shjh/jhzj7/fi/fi/plugin/operate/VoucherAuditOperation.java +++ b/main/java/shjh/jhzj7/fi/fi/plugin/operate/VoucherAuditOperation.java @@ -1,14 +1,22 @@ package shjh.jhzj7.fi.fi.plugin.operate; +import kd.bos.dataentity.OperateOption; import kd.bos.dataentity.entity.DynamicObject; +import kd.bos.entity.operate.OperateOptionConst; +import kd.bos.entity.operate.result.OperationResult; import kd.bos.entity.plugin.AbstractOperationServicePlugIn; import kd.bos.entity.plugin.args.AfterOperationArgs; +import kd.bos.logging.Log; +import kd.bos.logging.LogFactory; import kd.bos.servicehelper.BusinessDataServiceHelper; +import kd.bos.servicehelper.operation.OperationServiceHelper; import kd.sdk.plugin.Plugin; public class VoucherAuditOperation extends AbstractOperationServicePlugIn implements Plugin { //凭证审核操作插件,该插件完成凭证上游收付款单推送sap操作 + private static final Log logger = LogFactory.getLog(VoucherAuditOperation.class); + private static final String recbillName = "cas_recbill";//收款单 private static final String paybillName = "cas_paybill";//付款单 private static final String intbillName = "cim_intbill_revenue";//预提记账处理单 @@ -22,6 +30,15 @@ public class VoucherAuditOperation extends AbstractOperationServicePlugIn implem long sourcebillid;//凭证的来源单据ID String sourcebilltype;//凭证的来源单据类型 DynamicObject bizbillinfo;//业务单据对象,收付款单 + OperateOption operateOption = OperateOption.create(); + // 不执行警告级别校验器 + operateOption.setVariableValue(OperateOptionConst.IGNOREWARN, String.valueOf(true)); + // 不显示交互提示,自动执行到底 + operateOption.setVariableValue(OperateOptionConst.IGNOREINTERACTION, String.valueOf(true)); + // 全部校验通过才保存 + operateOption.setVariableValue(OperateOptionConst.STRICTVALIDATION, String.valueOf(true)); + //同一个用户在多个界面操作同一张,也不允许操作 + operateOption.setVariableValue(OperateOptionConst.MUTEX_ISSTRICT, String.valueOf(true)); for (DynamicObject pzinfo : dos) { //重新加载凭证对象 pzinfo = BusinessDataServiceHelper.loadSingle(pzinfo.getPkValue(), pzinfo.getDataEntityType().getName(), "id,billno,sourcebill,sourcebilltype"); @@ -33,6 +50,14 @@ public class VoucherAuditOperation extends AbstractOperationServicePlugIn implem }else if(paybillName.equals(sourcebilltype)){ bizbillinfo = BusinessDataServiceHelper.loadSingle(sourcebillid,paybillName); //TODO 执行付款单推送sap操作,并反馈操作执行结果 + DynamicObject[] billArray = new DynamicObject[]{bizbillinfo}; + OperationResult operationResult = OperationServiceHelper.executeOperate("pushsap", paybillName, billArray, operateOption); + // 可以根据需要处理 operationResult,例如检查是否成功、获取返回值等 + if (operationResult.isSuccess()) { + logger.info("执行 pushsap 成功,单据编号:" + bizbillinfo.getPkValue()); + } else { + logger.error(operationResult.getMessage()); + } }else if(intbillName.equals(sourcebilltype)){ bizbillinfo = BusinessDataServiceHelper.loadSingle(sourcebillid,intbillName); //TODO 执行预提记账处理单推送sap操作,并反馈操作执行结果