diff --git a/CA的状态从审批中退到工作中/AegCADemote_mxJPO.java b/CA的状态从审批中退到工作中/AegCADemote_mxJPO.java new file mode 100644 index 0000000..c5888fb --- /dev/null +++ b/CA的状态从审批中退到工作中/AegCADemote_mxJPO.java @@ -0,0 +1,48 @@ +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 AegCADemote_mxJPO { + + private static final Logger LOGGER = Logger.getLogger(AegCADemote_mxJPO.class.getName()); + + public void setAffectItemState(Context context, String[] args) throws Exception { + String changeActionId = args[0]; + LOGGER.info("CAId ==> " + changeActionId); + + String getProjectType = "print bus " + changeActionId + " select type dump |"; + String projectType = MqlUtil.mqlCommand(context, getProjectType); + + if("Change Action".equals(projectType)){ + ChangeAction changeAction = new ChangeAction(changeActionId); + 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..51a34c1 --- /dev/null +++ b/CA的状态从审批中退到工作中/modify.mql @@ -0,0 +1,16 @@ +add bus "eService Trigger Program Parameters" "AEGCADemoteStatusModify" "AEGCADemoteStatusModify" + policy "Business Rule" + vault "eService Administration" + "eService Program Argument 1" "${OBJECTID}" + "eService Program Name" "AegCADemote" + "eService Sequence Number" 1 + "eService Method Name" "setAffectItemState" + current Active; + +modify policy 'Change Action' state 'In Approval' add Trigger Demote Action emxTriggerManager input +'PolicyChangeActionStateInApprovalDemoteAction PolicyChangeActionPromoteDemoteAction AEGCADemoteStatusModify'; + +modify policy 'Change Action' state 'In Approval' add Trigger Demote Action emxTriggerManager input +'PolicyChangeActionStateInApprovalDemoteAction PolicyChangeActionPromoteDemoteAction'; + +