采购计划超链接采购需求,设置流程参与人插件
This commit is contained in:
parent
e14e64e967
commit
d23dad6142
|
@ -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<Long> calcUserIds(AgentExecution execution) {
|
||||
List<Long> 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<Long> 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<Long> 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<Long> 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"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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("",);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -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<String, Object> customParams = this.getView().getFormShowParameter().getCustomParams();
|
||||
if (customParams.isEmpty()) {
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue