PrintLotProcessAction.java

package com.mycim.webapp.actions.lot.printlotprocess;

import com.fa.sesa.exception.Assert;
import com.fa.sesa.exception.Errors;
import com.fa.sesa.threadlocal.LocalContext;
import com.mycim.framework.logging.Logger;
import com.mycim.framework.logging.LoggerFactory;
import com.mycim.framework.utils.lang.StringUtils;
import com.mycim.framework.utils.lang.collections.MapUtils;
import com.mycim.framework.utils.lang.math.NumberUtils;
import com.mycim.valueobject.MessageIdList;
import com.mycim.valueobject.ObjectList;
import com.mycim.valueobject.bas.NamedObject;
import com.mycim.valueobject.prp.ContextValue;
import com.mycim.valueobject.prp.Operation;
import com.mycim.valueobject.sys.Facility;
import com.mycim.valueobject.wip.Lot;
import com.mycim.webapp.WebUtils;
import com.mycim.webapp.actions.WipSetupAction;
import com.mycim.webapp.actions.security.LoginAction;
import com.mycim.webapp.forms.PrintLotProcessForm;
import com.mycim.webapp.forms.lot.LotInfoForm;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author shijie.deng
 * @version 6.0.0
 * @date 2019/11/4
 **/
public class PrintLotProcessAction extends WipSetupAction {
    private static final Logger logger = LoggerFactory.getLogger(LoginAction.class);

    @Override
    public ActionForward init(ActionMapping mapping, ActionForm form, HttpServletRequest request,
                              HttpServletResponse response) throws Exception {
        PrintLotProcessForm theform = (PrintLotProcessForm) form;
        theform.setLotId("");
        return mapping.getInputForward();
    }


    public ActionForward openPrintWindow(ActionMapping mapping, PrintLotProcessForm form, HttpServletRequest request) {
        Assert.isFalse(StringUtils.isBlank(form.getLotId()),
                       Errors.create().key(MessageIdList.SHIPLOT_ENTER_LOTID).content("Please enter lot Id!").build());
        Lot lot = lotQueryService.getLot(form.getLotId(), LocalContext.getFacilityRrn());
        Assert.isFalse(lot == null || lot.getLotRrn() < 1,
                       Errors.create().key(MessageIdList.LOT_LOTRRN_NOT_FOUND).content("Cannot find Lot!").build());

        //将flow信息插入报表中间表
        long lotRrn = lot.getLotRrn();
        String flowSeq = form.getFlowSeq();
        //1.解析flowSeq
        String operationSeq = StringUtils.substringAfter(flowSeq, ".");
        String routeSeq = StringUtils.substringBefore(flowSeq, ".");
        String reworkRouteId = WebUtils.getParameter("reworkRouteId", request);

        Integer processVersion = lot.getProcessVersion();
        /*Long    operationRrn   = lot.getOperationRrn();
        List<Map<String, Object>> viewProcessInfo = prpService.getProcessAllMainStepInfo(lot.getProcessRrn(),
                                                                                         processVersion);*/
        // reconstruct 支线
        List<Map<String, Object>> allProcessStep = prpService
                .getProcessAllStepInfo(lot.getProcessRrn(), processVersion, null, null, new Long(99999), null, null, 0);
        /*List<Map<String, Object>> allProcessStep = prpService.getProcessAllStepInfoIncludeSpecialNoContext(
                lot.getProcessRrn(), lot.getProcessVersion(), lotRrn, lot.getProductRrn());*/
        List<Map<String, Object>> viewProcessInfo = buildViewProcessInfo4Skip(allProcessStep, lot, "treeallwithspecial",
                                                                              reworkRouteId, operationSeq, routeSeq);
        prpService.insertFlowDataForLotPrint(viewProcessInfo, lot.getLotRrn());

        //获取报表服务器地址
        Facility facility = sysService.getFacility(LocalContext.getFacilityRrn());
        form.setRptServer(facility.getRptServer());
        return mapping.getInputForward();
    }

    public ActionForward openDrawboardWin(ActionMapping mapping, PrintLotProcessForm form, HttpServletRequest request) {
        // 获取报表服务器地址
        Facility facility = sysService.getFacility(LocalContext.getFacilityRrn());
        form.setRptServer(facility.getRptServer());
        return mapping.findForward("drawboard");
    }

    public ActionForward openRuncardDrawboardWin(ActionMapping mapping, PrintLotProcessForm form,
                                                 HttpServletRequest request) {
        // 获取报表服务器地址
        Facility facility = sysService.getFacility(LocalContext.getFacilityRrn());
        form.setRptServer(facility.getRptServer());
        return mapping.findForward("runCardDrawboard");
    }

    public Map<String, Object> getProdAndProcessByLot(LotInfoForm theform) {

        Map<String, Object> map = new HashMap<String, Object>();

        Lot lot = lotQueryService.getLot(theform.getLotId(), LocalContext.getFacilityRrn());
        Assert.isFalse(lot == null || lot.getLotRrn() < 1,
                       Errors.create().key(MessageIdList.LOT_LOTRRN_NOT_FOUND).content("Cannot Find Lot!").build());
        map.put("productId", lot.getProductId());
        map.put("processId", lot.getProcessId());
        map.put("processVersion", lot.getProcessVersion());
        map.put("routeId", lot.getRouteId());
        map.put("flowSeq", lot.getFlowSeq());
        map.put("executionRrn", lot.getExecutionRrn());
        map.put("lotRrn", lot.getLotRrn());
        return map;
    }

    private List<Map<String, Object>> buildViewProcessInfo4Skip(List<Map<String, Object>> viewProcessInfo, Lot lot,
                                                                String type, String reworkRouteId,
                                                                String targetOperationSeq, String targetRouteSeq) {
        List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
        List<Map<String, Object>> reworkList = new ArrayList<Map<String, Object>>();
        Long routeRrn = lot.getRouteRrn();
        String operationSeq = lot.getOperationSeq();
        boolean opreationFlag = false;
        Long operationRrn;
        operationRrn = lot.getOperationRrn();
        long lotRrn = lot.getLotRrn();
        long productRrn = lot.getProductRrn();
        long processRrn = lot.getProcessRrn();
        int processVersion = lot.getProcessVersion();
        Map<String, Map<String, Object>> contextValues = new HashMap<>();
        buildOperationContextToValueMap(lot.getProductRrn(), lot.getProcessRrn(), lot.getProcessVersion(),
                                        contextValues);
        buildProcessOperationContextToValueMap(productRrn, processRrn, processVersion, contextValues);
        buildStageContextToValueMap(productRrn, processRrn, processVersion, contextValues);
        buildFlowSeqContextToValueMap(productRrn, processRrn, processVersion, contextValues);
        buildRecipeContextToValueMap(productRrn, lot.getProductVersion(), processRrn, processVersion, contextValues);
        for (int i = 0; i < viewProcessInfo.size(); i++) {
            Map<String, Object> mainProStep = viewProcessInfo.get(i);
            Long tempOperationRrn = MapUtils.getLong(mainProStep, "operationRrn");
            Long tempRouteRrn = MapUtils.getLong(mainProStep, "routeRrn");
            String isMain = MapUtils.getString(mainProStep, "isMain");
            mainProStep.put("linkId", StringUtils.equals(isMain, "0") ? isMain : null);
            String stepSeq = MapUtils.getString(mainProStep, "operationRouteSeq");
            String stepNumber = MapUtils.getLong(mainProStep, "processRrn") + "." +
                    MapUtils.getIntValue(mainProStep, "processVersion") + "." +
                    MapUtils.getLong(mainProStep, "routeStepRrn") + "|" + MapUtils.getLong(mainProStep, "routeRrn") +
                    "." + MapUtils.getIntValue(mainProStep, "routeVersion") + "." +
                    MapUtils.getLong(mainProStep, "operationStepRrn");
            mainProStep.put("stepNumber", stepNumber);
            mainProStep.put("stepPath", stepNumber);
            mainProStep.put("routeSeq", MapUtils.getString(mainProStep, "routeProcessSeq"));
            mainProStep.put("operationSeq", MapUtils.getString(mainProStep, "operationRouteSeq"));
            mainProStep.put("productRrn", lot.getProductRrn());
            mainProStep.put("lotRrn", lot.getLotRrn());
            mainProStep.put("reSeq", MapUtils.getString(mainProStep, "flowSeq"));

            Map<String, Object> stepContextValueByLot = contextValues
                    .get(buildKeyByProductAndLot(lotRrn, productRrn, processRrn, processVersion, tempRouteRrn,
                                                 tempOperationRrn));
            Map<String, Object> stepContextValue = contextValues
                    .get(buildKeyByProduct(productRrn, processRrn, processVersion, tempRouteRrn, tempOperationRrn));

            String polluctionLevel = MapUtils.getString(stepContextValueByLot, "polluctionLevel");
            mainProStep.put("polluctionLevel", StringUtils.isNotBlank(polluctionLevel) ? polluctionLevel : MapUtils
                    .getString(stepContextValue, "polluctionLevel", StringUtils.EMPTY));

            String operationDesc = MapUtils.getString(stepContextValueByLot, "operationDesc");
            mainProStep.put("operationDesc", StringUtils.isNotBlank(operationDesc) ? operationDesc : MapUtils
                    .getString(stepContextValue, "operationDesc", StringUtils.EMPTY));

            String stageId = MapUtils.getString(stepContextValueByLot, "stageId");
            mainProStep.put("stageId", StringUtils.isNotBlank(stageId) ? stageId : MapUtils
                    .getString(stepContextValue, "stageId", StringUtils.EMPTY));

            String recipeId = MapUtils.getString(stepContextValueByLot, "recipeId");
            mainProStep.put("recipeId", StringUtils.isNotBlank(recipeId) ? recipeId : MapUtils
                    .getString(stepContextValue, "recipeId", StringUtils.EMPTY));

            String flowSeq = MapUtils.getString(stepContextValueByLot, "flowSeq");
            flowSeq = StringUtils.isNotBlank(flowSeq) ? flowSeq : MapUtils
                    .getString(stepContextValue, "flowSeq", StringUtils.EMPTY);
            mainProStep.put("flowSeq", flowSeq);

            //String flowSeq         = MapUtils.getString(mainProStep, "flowSeq");
            String temOperationSeq = StringUtils.substringAfter(flowSeq, ".");
            String temRouteSeq = StringUtils.substringBefore(flowSeq, ".");
            if (NumberUtils.toInt(temRouteSeq) > NumberUtils.toInt(targetRouteSeq)) {
                list.add(mainProStep);
            } else if (NumberUtils.toInt(temRouteSeq) == NumberUtils.toInt(targetRouteSeq) &&
                    NumberUtils.toInt(temOperationSeq) >= NumberUtils.toInt(targetOperationSeq)) {
                list.add(mainProStep);
            }
        }
        /*if (!opreationFlag && StringUtils.isNotBlank(reworkRouteId)) {//当前工步不在主流程中,查询返工
            for (int i = 0; i < viewProcessInfo.size(); i++) {
                Map<String, Object> mainProStep = viewProcessInfo.get(i);
                List                reworkinfo  = buildReworkWflInfo(mainProStep);
                if (reworkRouteIdIsMatch(reworkinfo, reworkRouteId)) {
                    reworkinfo = filterReworkinfoByType(reworkinfo, type, routeRrn, operationRrn,
                                                        operationSeq);
                    if (!reworkList.containsAll(reworkinfo)) {
                        reworkList.addAll(reworkinfo);
                    }
                }
            }
            list.addAll(reworkList);
            return list;
        }*/
        return list;
    }

    private void buildRecipeContextToValueMap(Long productRrn, Integer productVersion, Long processRrn,
                                              Integer processVersion, Map<String, Map<String, Object>> map) {
        Map<String, Object> obj;
        List<ContextValue> contextValues;
        contextValues = ctxExecService
                .getRecipeContextValueList(productRrn, productVersion, processRrn, processVersion);
        for (ContextValue contextValue : contextValues) {
            String key = buildKeyByProduct(NumberUtils.toLong(contextValue.getContextKey4()),
                                           NumberUtils.toLong(contextValue.getContextKey3()),
                                           NumberUtils.toInt(contextValue.getContextKey11()),
                                           NumberUtils.toLong(contextValue.getContextKey2()),
                                           NumberUtils.toLong(contextValue.getContextKey1()));
            long lotRrn = NumberUtils.toLong(contextValue.getContextKey7());
            if (lotRrn > 0) {
                key = buildKeyByProductAndLot(lotRrn, NumberUtils.toLong(contextValue.getContextKey4()),
                                              NumberUtils.toLong(contextValue.getContextKey3()),
                                              NumberUtils.toInt(contextValue.getContextKey11()),
                                              NumberUtils.toLong(contextValue.getContextKey2()),
                                              NumberUtils.toLong(contextValue.getContextKey1()));
            }
            obj = map.get(key);
            if (obj == null) {
                obj = new HashMap<>();
                map.put(key, obj);
            }

            long recipeRrn = NumberUtils.toLong(contextValue.getResultValue1());
            String recipeId = getInstanceId(recipeRrn);

            obj.put("recipeRrn", recipeRrn);
            obj.put(KEY_RECIPE_ID, recipeId);
            obj.put("recipeDesc", baseService.getInstanceDesc(recipeRrn));
            obj.put("parameter", contextValue.getResultValue2());
            obj.put("yield", contextValue.getResultValue3());
            obj.put("bom", contextValue.getResultValue4());
            obj.put("wiringId", contextValue.getResultValue5());
        }
    }

    private void buildStageContextToValueMap(Long productRrn, Long processRrn, Integer processVersion,
                                             Map<String, Map<String, Object>> map) {
        Map<String, Object> obj;
        List<ContextValue> contextValues;
        contextValues = ctxExecService.getStageContextValueList(productRrn, processRrn, processVersion);
        for (ContextValue contextValue : contextValues) {
            String key = buildKeyByProduct(NumberUtils.toLong(contextValue.getContextKey1()),
                                           NumberUtils.toLong(contextValue.getContextKey2()),
                                           NumberUtils.toInt(contextValue.getContextKey3()),
                                           NumberUtils.toLong(contextValue.getContextKey4()),
                                           NumberUtils.toLong(contextValue.getContextKey6()));
            long lotRrn = NumberUtils.toLong(contextValue.getContextKey8());

            if (lotRrn > 0) {
                key = buildKeyByProductAndLot(lotRrn, NumberUtils.toLong(contextValue.getContextKey1()),
                                              NumberUtils.toLong(contextValue.getContextKey2()),
                                              NumberUtils.toInt(contextValue.getContextKey3()),
                                              NumberUtils.toLong(contextValue.getContextKey4()),
                                              NumberUtils.toLong(contextValue.getContextKey6()));
            }
            obj = map.get(key);
            if (obj == null) {
                obj = new HashMap<>();
                map.put(key, obj);
            }

            obj.put("stageId", contextValue.getResultValue1());
        }
    }

    private void buildFlowSeqContextToValueMap(Long productRrn, Long processRrn, Integer processVersion,
                                               Map<String, Map<String, Object>> map) {
        Map<String, Object> obj;
        List<ContextValue> contextValues;
        contextValues = ctxExecService.getFlowSeqContextValueList(processRrn, processVersion);
        for (ContextValue contextValue : contextValues) {
            long processRrnTemp = NumberUtils.toLong(contextValue.getContextKey1());
            int processVersionTemp = NumberUtils.toInt(contextValue.getContextKey2());
            long routeRrnTemp = NumberUtils.toLong(contextValue.getContextKey3());
            long operationRrnTemp = NumberUtils.toLong(contextValue.getContextKey4());
            long lotRrn = NumberUtils.toLong(contextValue.getContextKey8());

            String key = buildKeyByProduct(productRrn, processRrnTemp, processVersionTemp, routeRrnTemp,
                                           operationRrnTemp);
            if (lotRrn > 0) {
                key = buildKeyByProductAndLot(lotRrn, productRrn, processRrnTemp, processVersionTemp, routeRrnTemp,
                                              operationRrnTemp);
            }

            obj = map.get(key);
            if (obj == null) {
                obj = new HashMap<>();
                map.put(key, obj);
            }

            obj.put("queryContextRrn", contextValue.getContextRrn());
            obj.put("flowSeq", contextValue.getResultValue1());
            obj.put("reworkFlag", contextValue.getResultValue2());
            obj.put("flowSeqStatus", contextValue.getStatus());
        }
    }

    private void buildProcessOperationContextToValueMap(Long productRrn, Long processRrn, Integer processVersion,
                                                        Map<String, Map<String, Object>> map) {
        Map<String, Object> obj;
        List<ContextValue> contextValues;
        contextValues = ctxExecService.getOperationDescContextValueList(productRrn, processRrn, processVersion);
        for (ContextValue contextValue : contextValues) {
            String key = buildKeyByProduct(NumberUtils.toLong(contextValue.getContextKey1()),
                                           NumberUtils.toLong(contextValue.getContextKey2()),
                                           NumberUtils.toInt(contextValue.getContextKey3()),
                                           NumberUtils.toLong(contextValue.getContextKey4()),
                                           NumberUtils.toLong(contextValue.getContextKey5()));
            obj = map.get(key);
            if (obj == null) {
                obj = new HashMap<>();
                map.put(key, obj);
            }

            obj.put("operationDesc", contextValue.getResultValue1());
        }
    }

    private boolean reworkRouteIdIsMatch(List reworkinfo, String reworkRouteId) {
        boolean flag = false;
        if (reworkinfo != null && reworkinfo.size() > 0) {
            Map<String, Object> reworkMap = (Map<String, Object>) reworkinfo.get(0);
            String rkRouteId = MapUtils.getString(reworkMap, "routeId");
            if (StringUtils.equalsIgnoreCase(reworkRouteId, rkRouteId)) {
                flag = true;
            }
        }
        return flag;
    }

    private List<Map<String, Object>> filterReworkinfoByType(List reworkinfo, String type, Long routeRrn,
                                                             Long operationRrn, String operationSeq) {
        List list = new ArrayList();
        for (int i = 0; i < reworkinfo.size(); i++) {
            Map reworkMap = (Map) reworkinfo.get(i);
            list.add(reworkMap);
        }
        return list;
    }


    private void buildOperationContextToValueMap(Long productRrn, Long processRrn, Integer processVersion,
                                                 Map<String, Map<String, Object>> map) {
        Map<String, Object> obj;
        List<ContextValue> contextValues;
        contextValues = ctxExecService.getPollutionLevelContextValueList(productRrn, processRrn, processVersion);
        for (ContextValue contextValue : contextValues) {
            String key = buildKeyByProduct(NumberUtils.toLong(contextValue.getContextKey4()),
                                           NumberUtils.toLong(contextValue.getContextKey3()),
                                           NumberUtils.toInt(contextValue.getContextKey8()),
                                           NumberUtils.toLong(contextValue.getContextKey2()),
                                           NumberUtils.toLong(contextValue.getContextKey1()));
            long lotRrn = NumberUtils.toLong(contextValue.getContextKey7());

            if (lotRrn > 0) {
                key = buildKeyByProductAndLot(lotRrn, NumberUtils.toLong(contextValue.getContextKey4()),
                                              NumberUtils.toLong(contextValue.getContextKey3()),
                                              NumberUtils.toInt(contextValue.getContextKey8()),
                                              NumberUtils.toLong(contextValue.getContextKey2()),
                                              NumberUtils.toLong(contextValue.getContextKey1()));
            }
            obj = map.get(key);
            if (obj == null) {
                obj = new HashMap<>();
                map.put(key, obj);
            }

            obj.put("polluctionLevel", contextValue.getResultValue3());
        }
    }

    private String buildKeyByProduct(Long productRrn, Long processRrn, Integer processVersion, Long routeRrn,
                                     Long operationRrn) {
        StringBuilder keyByProduct = new StringBuilder();
        keyByProduct.append(productRrn).append("|");
        keyByProduct.append(processRrn).append("|");
        keyByProduct.append(processVersion).append("|");
        keyByProduct.append(routeRrn).append("|");
        keyByProduct.append(operationRrn);
        return keyByProduct.toString();
    }

    private String buildKeyByProductAndLot(Long lotRrn, Long productRrn, Long processRrn, Integer processVersion,
                                           Long routeRrn, Long operationRrn) {
        StringBuilder buildKeyByProductAndLot = new StringBuilder();
        buildKeyByProductAndLot.append(lotRrn).append("|");
        buildKeyByProductAndLot.append(productRrn).append("|");
        buildKeyByProductAndLot.append(processRrn).append("|");
        buildKeyByProductAndLot.append(processVersion).append("|");
        buildKeyByProductAndLot.append(routeRrn).append("|");
        buildKeyByProductAndLot.append(operationRrn);
        return buildKeyByProductAndLot.toString();
    }

    private List<Map<String, Object>> buildReworkWflInfo(Map<String, Object> operationInfo) {
        List<Map<String, Object>> wflInfos = new ArrayList<>();
        long reworkRouteRrn = ctxExecService.getProcessReworkRouteRrn(operationInfo);
        if (reworkRouteRrn > 0) {
            List<String[]> wflTree = prpService.getWorkFlowTree(reworkRouteRrn, new HashMap());

            String routeSeq = "";
            Long routeRrn = reworkRouteRrn;
            String routeId = getInstanceId(reworkRouteRrn);
            String routeDesc = getInstanceDesc(reworkRouteRrn);
            for (int i = 0; i < wflTree.size(); i++) {
                Map<String, Object> wflInfo = new HashMap<String, Object>();
                String[] treeNodes = wflTree.get(i);
                if ("0".equals(treeNodes[7])) {
                    routeSeq = StringUtils.substringBefore(treeNodes[2], "-");
                    routeId = StringUtils.substringAfterLast(treeNodes[2], "---");
                    routeRrn = NumberUtils.createLong(treeNodes[4]);
                    routeDesc = treeNodes[5];
                } else if ("1".equals(treeNodes[7])) {
                    Long productRrn = MapUtils.getLong(operationInfo, "productRrn");
                    wflInfo.put("productRrn", productRrn);
                    wflInfo.put("routeRrn", routeRrn);
                    wflInfo.put("routeSeq", routeSeq);
                    wflInfo.put("routeProcessSeq", routeSeq);
                    wflInfo.put("routeId", routeId);
                    wflInfo.put("routeDesc", routeDesc);
                    wflInfo.put("isRework", "1");
                    wflInfo.put("isMain", "0");
                    Long operationRrn = NumberUtils.createLong(treeNodes[4]);
                    wflInfo.put("operationRrn", operationRrn);
                    String operationSeq = StringUtils.substringBefore(treeNodes[2], "-");
                    wflInfo.put("operationSeq", operationSeq);
                    wflInfo.put("operationRouteSeq", operationSeq);
                    String operationId = StringUtils.substringAfterLast(treeNodes[2], "---");
                    wflInfo.put("operationId", operationId);
                    String operationDesc = StringUtils.substringAfterLast(treeNodes[5], "---");

                    String wflStep = treeNodes[6];
                    wflInfo.put("stepPath", wflStep);
                    Map conditionM = new HashMap();

                    String[] wflStepArray = StringUtils.split(wflStep, ".");
                    // wflInfo.put("processRrn", NumberUtils.toLong(wflStepArray[0], 0));
                    wflInfo.put("processRrn", MapUtils.getLong(operationInfo, "processRrn"));
                    // wflInfo.put("processVersion", NumberUtils.toInt(wflStepArray[1], 0));
                    wflInfo.put("processVersion", MapUtils.getLong(operationInfo, "processVersion"));
                    wflInfo.put("operationRrn", operationRrn);
                    wflInfo.put("operationRouteSeq", operationSeq);
                    wflInfo.put("facilityRrn", LocalContext.getFacilityRrn());

                    wflInfo.put("stepNumber", MapUtils.getString(wflInfo, "stepPath"));
                    // 从情景值查询operationDesc 和 FlowSeq
                    Map<String, Object> flowSeqParam = new HashMap<String, Object>();
                    flowSeqParam.put("facilityRrn", LocalContext.getFacilityRrn());
                    flowSeqParam.put("processRrn", operationInfo.get("processRrn"));
                    flowSeqParam.put("routeRrn", wflInfo.get("routeRrn"));
                    flowSeqParam.put("productRrn", operationInfo.get("productRrn"));
                    flowSeqParam.put("operationRrn", wflInfo.get("operationRrn"));
                    flowSeqParam.put("processVersion", operationInfo.get("processVersion"));
                    flowSeqParam.put("lotRrn", MapUtils.getLong(operationInfo, "lotRrn"));
                    String flowSeq = ctxExecService.getFlowSeqByProcessInfo(flowSeqParam);
                    wflInfo.put("flowSeq", flowSeq);
                    wflInfo.put("reSeq", flowSeq);
                    wflInfo.put("processStepIdVersion", MapUtils.getString(wflInfo, "routeId"));
                    wflInfo.put("operationDesc", ctxExecService.getOperationDescByProcessInfo(flowSeqParam));
                    wflInfo.put("lotRrn", MapUtils.getLong(operationInfo, "lotRrn"));
                    String stageId = ctxExecService.getStageByProcessInfo(wflInfo);
                    if (StringUtils.isNotBlank(stageId)) {
                        wflInfo.put("stageId", stageId);
                    }
                    String recipeId = ctxExecService.getProcessRecipeId(wflInfo);
                    if (StringUtils.isNotBlank(recipeId)) {
                        wflInfo.put("recipeId", recipeId);
                    }
                    String processLocation = ctxExecService.getProcessLocation(wflInfo);
                    wflInfo.put("processLocation", processLocation);
                    // 获取operation上的设备组
                    Operation operation = prpService.getOperation(MapUtils.getLongValue(wflInfo, "operationRrn"));
                    long entityGroupRrn = operation.getEntityGroupRrn();
                    wflInfo.put("eqptGroupId", getInstanceId(entityGroupRrn));
                    NamedObject no = getInstance(new Operation(operationId, getNamedSpace(ObjectList.OPERATION_KEY,
                                                                                          LocalContext
                                                                                                  .getFacilityRrn()),
                                                               ObjectList.OPERATION_KEY));
                    String operationType = (no != null ? no.getObjectType() : StringUtils.EMPTY);
                    wflInfo.put("operationType", operationType);
                    wflInfos.add(wflInfo);
                }
            }
        }

        return wflInfos;
    }

}