diff --git a/CA节点审批拒绝/AegChangeReject_mxJPO.java b/CA节点审批拒绝/AegChangeReject_mxJPO.java new file mode 100644 index 0000000..a178f5e --- /dev/null +++ b/CA节点审批拒绝/AegChangeReject_mxJPO.java @@ -0,0 +1,55 @@ +import com.dassault_systemes.enovia.enterprisechangemgt.common.ChangeAction; +import com.matrixone.apps.domain.util.ContextUtil; +import com.matrixone.apps.domain.util.MapList; +import com.matrixone.apps.domain.util.MqlUtil; +import matrix.db.Context; + +import java.util.Map; +import java.util.logging.Logger; + +public class AegChangeReject_mxJPO { + + private static final Logger LOGGER = Logger.getLogger(AegChangeReject_mxJPO.class.getName()); + + public void setAffectItemState(Context context, String[] args) throws Exception { + String inboxTaskId = args[0]; + String ApprovalStatus = args[1]; + LOGGER.info("inboxTaskId ==> " + inboxTaskId); + LOGGER.info("ApprovalStatus ==> " + ApprovalStatus); + + String getProjectType = "print bus " + inboxTaskId + " select from[Route Task].to.to[Object Route].from.type dump |"; + String projectType = MqlUtil.mqlCommand(context, getProjectType); + + if("Change Action".equals(projectType) && "Reject".equals(ApprovalStatus)){ + String getProjectId = "print bus " + inboxTaskId + " select from[Route Task].to.to[Object Route].from.id dump |"; + String projectId = MqlUtil.mqlCommand(context, getProjectId); + + if(!"".equals(projectId)){ + ChangeAction changeAction = new ChangeAction(projectId); + MapList mapList = changeAction.getAffectedItems(context); + + for (int i = 0; i < mapList.size(); i++) { + Map map = (Map) mapList.get(i); + + String affectItemId = (String) map.get("id"); + String affectItemCurrent = (String) map.get("current"); + LOGGER.info("affectItemId ==> " + affectItemId); + LOGGER.info("affectItemCurrent ==> " + affectItemCurrent); + +// for (String key : map.keySet()){ +// LOGGER.info("key : " + key + " , value : " + map.get(key)); +// } + + if(!"RELEASED".equals(affectItemCurrent)){ + String updateAffectState = "modify bus " + affectItemId + " current IN_WORK"; + LOGGER.info("updateAffectState ==> " + updateAffectState); + + ContextUtil.pushContext(context); + MqlUtil.mqlCommand(context, updateAffectState); + ContextUtil.popContext(context); + } + } + } + } + } +} diff --git a/CA节点审批拒绝/modify.mql b/CA节点审批拒绝/modify.mql new file mode 100644 index 0000000..fa01af9 --- /dev/null +++ b/CA节点审批拒绝/modify.mql @@ -0,0 +1,10 @@ +add bus "eService Trigger Program Parameters" "AEGAttributeApprovalStatusModify" "AEGAttributeApprovalStatusModifyUpdateCurrent" + policy "Business Rule" + vault "eService Administration" + "eService Program Argument 1" "${OBJECTID}" + "eService Program Argument 2" "${ATTRVALUE}" + "eService Program Name" "AegChangeReject" + "eService Sequence Number" 1 + "eService Method Name" "setAffectItemState" + current Active; +modify attribute 'Approval Status' add trigger Modify Action emxTriggerManager input AEGAttributeApprovalStatusModify; \ No newline at end of file