From d23dad614248ad9708bc3e5b041821adee3fa38e Mon Sep 17 00:00:00 2001 From: weiyunlong Date: Thu, 12 Dec 2024 10:25:38 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=87=E8=B4=AD=E8=AE=A1=E5=88=92=E8=B6=85?= =?UTF-8?q?=E9=93=BE=E6=8E=A5=E9=87=87=E8=B4=AD=E9=9C=80=E6=B1=82,?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E6=B5=81=E7=A8=8B=E5=8F=82=E4=B8=8E=E4=BA=BA?= =?UTF-8?q?=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repc/iwork/IWorkParticipantPlugin.java | 60 +++++++++++++++++-- .../rebm/formplugin/PurPlanFormPlugin.java | 57 ++++++++++++++++++ .../rebm/opplugin/PurapplyAuditOPPlugin.java | 30 ++++++++++ .../listplugin/ContractSummaryListPlugin.java | 5 ++ 4 files changed, 147 insertions(+), 5 deletions(-) create mode 100644 main/java/shkd/repc/rebm/formplugin/PurPlanFormPlugin.java create mode 100644 main/java/shkd/repc/rebm/opplugin/PurapplyAuditOPPlugin.java diff --git a/main/java/shkd/repc/iwork/IWorkParticipantPlugin.java b/main/java/shkd/repc/iwork/IWorkParticipantPlugin.java index f845d94..6faecf0 100644 --- a/main/java/shkd/repc/iwork/IWorkParticipantPlugin.java +++ b/main/java/shkd/repc/iwork/IWorkParticipantPlugin.java @@ -2,6 +2,8 @@ package shkd.repc.iwork; import kd.bos.dataentity.entity.DynamicObject; import kd.bos.dataentity.entity.DynamicObjectCollection; +import kd.bos.logging.Log; +import kd.bos.logging.LogFactory; import kd.bos.orm.query.QCP; import kd.bos.orm.query.QFilter; import kd.bos.servicehelper.BusinessDataServiceHelper; @@ -11,8 +13,20 @@ import kd.bos.workflow.engine.extitf.IWorkflowPlugin; import java.util.List; +/** + * 设置流程参与人插件 + */ public class IWorkParticipantPlugin implements IWorkflowPlugin { + private static final Log logger = LogFactory.getLog(IWorkParticipantPlugin.class); + + /** + * recon_contractbill(合同)-印章管理员 + * recon_payreqbill(付款申请)-资金出纳和园区会计 + * recon_designchgbill(涉及变更) 供应商:designunit(设计单位) + * recon_chgauditorderbill(工程指令) 供应商:construnit(施工单位) + * recon_rewarddeductbill(奖励扣款) 供应商存在分录:rewarddeductentry(奖惩单分录) 供应商:entry_supplier(供应商) + */ @Override public List calcUserIds(AgentExecution execution) { List currentApprover = execution.getCurrentApprover(); // 获取当前节点的审批人 @@ -21,11 +35,6 @@ public class IWorkParticipantPlugin implements IWorkflowPlugin { String entityNumber = execution.getEntityNumber(); // 单据实体编码 DynamicObject entity = BusinessDataServiceHelper.loadSingle(businessKey, entityNumber); - - //recon_designchgbill(涉及变更) 供应商:designunit(设计单位) - //recon_chgauditorderbill(工程指令) 供应商:construnit(施工单位) - //recon_rewarddeductbill(奖励扣款) 供应商存在分录:rewarddeductentry(奖惩单分录) 供应商:entry_supplier(供应商) - if (entity != null) { switch (entityNumber) { case "recon_designchgbill": @@ -37,6 +46,12 @@ public class IWorkParticipantPlugin implements IWorkflowPlugin { case "recon_rewarddeductbill": getApprovers(entity, currentApprover, "rewarddeductentry", "entry_supplier"); break; + case "recon_contractbill": + handleContractBill(entity, currentApprover); + break; + case "recon_payreqbill": + handlePayReqBill(entity, currentApprover); + break; default: // 处理未定义的实体编码的情况(可选) break; @@ -115,4 +130,39 @@ public class IWorkParticipantPlugin implements IWorkflowPlugin { } } + private void handleContractBill(DynamicObject entity, List currentApprover) { + String partyatype = entity.getString("partyatype"); // 甲方类别 + if ("qeug_recon_developer".equals(partyatype)) { + DynamicObject dynamicObject = entity.getDynamicObject("multitypepartya"); // 甲方 + addApprover(currentApprover, dynamicObject, "qeug_userfield2", "印章管理员"); + } + } + + private void handlePayReqBill(DynamicObject entity, List currentApprover) { + DynamicObject contractbill = entity.getDynamicObject("contractbill"); // 付款申请_获取选择的合同 + if (contractbill != null) { + contractbill = BusinessDataServiceHelper.loadSingle(contractbill.getPkValue(), "recon_contractbill"); + String partyatype1 = contractbill.getString("partyatype"); // 甲方类别 + if ("qeug_recon_developer".equals(partyatype1)) { + DynamicObject dynamicObject = contractbill.getDynamicObject("multitypepartya"); // 甲方 + addApprover(currentApprover, dynamicObject, "qeug_userfield", "园区会计"); + addApprover(currentApprover, dynamicObject, "qeug_userfield1", "资金出纳"); + + } + } + } + + private void addApprover(List currentApprover, DynamicObject dynamicObject, String field, String role) { + if (dynamicObject != null) { + dynamicObject = BusinessDataServiceHelper.loadSingle(dynamicObject.getPkValue(), "qeug_recon_developer"); + DynamicObject approver = dynamicObject.getDynamicObject(field); + if (approver != null) { + Long id = approver.getLong("id"); + currentApprover.add(id); + logger.info("添加参与人(" + role + "):" + id + " " + approver.getString("name")); + } + } + } + + } diff --git a/main/java/shkd/repc/rebm/formplugin/PurPlanFormPlugin.java b/main/java/shkd/repc/rebm/formplugin/PurPlanFormPlugin.java new file mode 100644 index 0000000..bef3b5b --- /dev/null +++ b/main/java/shkd/repc/rebm/formplugin/PurPlanFormPlugin.java @@ -0,0 +1,57 @@ +package shkd.repc.rebm.formplugin; + +import kd.bos.bill.AbstractBillPlugIn; +import kd.bos.bill.BillShowParameter; +import kd.bos.bill.OperationStatus; +import kd.bos.dataentity.entity.DynamicObject; +import kd.bos.dataentity.entity.DynamicObjectCollection; +import kd.bos.form.ShowType; +import kd.bos.form.control.EntryGrid; +import kd.bos.form.events.HyperLinkClickEvent; +import kd.bos.form.events.HyperLinkClickListener; +import kd.bos.orm.query.QCP; +import kd.bos.orm.query.QFilter; +import kd.bos.servicehelper.BusinessDataServiceHelper; + +import java.util.EventObject; + +public class PurPlanFormPlugin extends AbstractBillPlugIn implements HyperLinkClickListener { + + @Override + public void registerListener(EventObject e) { + super.registerListener(e); + + //集中--明细中---采购计划编号 点击事件监听单据体 + EntryGrid billentry = this.getView().getControl("qeug_cgxuentryss"); + billentry.addHyperClickListener(this); + } + + @Override + public void hyperLinkClick(HyperLinkClickEvent hyperLinkClickEvent) { + String clickEventFieldName = hyperLinkClickEvent.getFieldName(); + if ("qeug_qxbillno".equals(clickEventFieldName)) { + int rowIndex = hyperLinkClickEvent.getRowIndex(); + DynamicObjectCollection billentry = this.getModel().getDataEntity(Boolean.TRUE).getDynamicObjectCollection("qeug_cgxuentryss"); + if (billentry.size() > 0) { + String qeug_qxbillno = billentry.get(rowIndex).getString("qeug_qxbillno"); + showPurplan("recon_settleplanbill", qeug_qxbillno); + } + } + + } + + private void showPurplan(String formId, String shkd_purplanno) { + if (shkd_purplanno != null) { + DynamicObject object = BusinessDataServiceHelper.loadSingle(formId, new QFilter[]{new QFilter("qeug_billno", QCP.equals, shkd_purplanno)}); + if (null != object) { + BillShowParameter params = new BillShowParameter(); + params.setFormId(formId); + params.setPkId(object.getPkValue()); + params.getOpenStyle().setShowType(ShowType.MainNewTabPage); + params.setHasRight(true); + params.setStatus(OperationStatus.VIEW); + this.getView().showForm(params); + } + } + } +} diff --git a/main/java/shkd/repc/rebm/opplugin/PurapplyAuditOPPlugin.java b/main/java/shkd/repc/rebm/opplugin/PurapplyAuditOPPlugin.java new file mode 100644 index 0000000..a84811d --- /dev/null +++ b/main/java/shkd/repc/rebm/opplugin/PurapplyAuditOPPlugin.java @@ -0,0 +1,30 @@ +package shkd.repc.rebm.opplugin; + +import kd.bos.dataentity.entity.DynamicObject; +import kd.bos.dataentity.entity.DynamicObjectCollection; +import kd.bos.entity.plugin.AbstractOperationServicePlugIn; +import kd.bos.entity.plugin.args.AfterOperationArgs; + +/** + * 采购需求单 + * qeug_purchaseapplybill + */ +public class PurapplyAuditOPPlugin extends AbstractOperationServicePlugIn { + + @Override + public void afterExecuteOperationTransaction(AfterOperationArgs e) { + super.afterExecuteOperationTransaction(e); + String operationKey = e.getOperationKey(); + if ("audit".equals(operationKey)) { + DynamicObject[] dataEntities = e.getDataEntities(); + DynamicObject dataEntity = dataEntities[0]; + DynamicObjectCollection collection = dataEntity.getDynamicObjectCollection("qeug_entryentity"); + if (collection.isEmpty()) { + DynamicObject add = collection.addNew(); +// add.set("",); + } + + } + + } +} diff --git a/main/java/shkd/repc/recon/listplugin/ContractSummaryListPlugin.java b/main/java/shkd/repc/recon/listplugin/ContractSummaryListPlugin.java index 151fb26..314149a 100644 --- a/main/java/shkd/repc/recon/listplugin/ContractSummaryListPlugin.java +++ b/main/java/shkd/repc/recon/listplugin/ContractSummaryListPlugin.java @@ -6,6 +6,7 @@ import kd.bos.dataentity.entity.DynamicObject; import kd.bos.entity.datamodel.ListSelectedRow; import kd.bos.entity.datamodel.ListSelectedRowCollection; import kd.bos.entity.filter.FilterParameter; +import kd.bos.form.IFormView; import kd.bos.form.events.*; import kd.bos.form.operate.FormOperate; import kd.bos.list.BillList; @@ -109,6 +110,10 @@ public class ContractSummaryListPlugin extends AbstractListPlugin implements ILi public void setFilter(SetFilterEvent e) { super.setFilter(e); +// IFormView parentView = this.getView().getParentView(); +// parentView.getFormShowParameter().getFormId(); +// parentView.getModel().getValue() +// e.getQFilters().add() Map customParams = this.getView().getFormShowParameter().getCustomParams(); if (customParams.isEmpty()) { return;