# Edc2MyspcContainer.java

    package com.mycim.server.edcmyspc;

    import com.fa.sesa.threadlocal.LocalContext;
    import com.mycim.framework.utils.lang.StringUtils;
    import com.mycim.framework.utils.msg.model.Request;
    import com.mycim.server.spc.BaseEdc2SpcContainer;
    import com.mycim.server.spc.manager.SpcManager;
    import com.mycim.valueobject.spc.SpcConfigConstants;
    import com.mycim.valueobject.wip.Lot;
    import org.springframework.beans.factory.annotation.Autowired;

    import java.util.ArrayList;
    import java.util.List;
    import java.util.Map;

    /**
     * @author Johnson.Wang
     * @version 6.0.0
     * @date 2019/11/8
     **/
    public class Edc2MyspcContainer extends BaseEdc2SpcContainer {
        @Autowired
        private SpcManager spcManager;

        @Override
        public List<String> edc2SpcCheck(List<Map> dcolStepInfos, Boolean rtFlag, Boolean isOcapSend) {
            // 按照 converter -> parser -> sender的顺序执行
            String edcType = rtFlag ? SpcConfigConstants.EDC_TYPE_RT : SpcConfigConstants.EDC_TYPE_NORT;
            String edc2MyspcUrl = spcManager
                    .getSpcConfigValue(LocalContext.getFacilityRrn(), SpcConfigConstants.SPC_WS_URL, edcType);
            if (StringUtils.isEmpty(edc2MyspcUrl)) {
                return new ArrayList<>();
            }
            return super.edc2SpcCheck(dcolStepInfos, rtFlag, isOcapSend);
        }

        @Override
        public void edc2SpcCheckForProcess(List<Lot> lots) {
            // 按照 converter -> parser -> sender的顺序执行
            String edc2MyspcUrl = spcManager.getSpcConfigValue(LocalContext.getFacilityRrn(), SpcConfigConstants.SPC_WS_URL,
                                                               SpcConfigConstants.EDC_TYPE_RT);
            if (StringUtils.isEmpty(edc2MyspcUrl)) {
                return;
            }

            List<Request> request = null;
            if (edc2SpcConverter != null) {
                request = edc2SpcConverter.convert(lots);
            }

            List<String> requestList = null;
            if (edc2SpcParser != null) {
                requestList = edc2SpcParser.parser(request);
            }

            if (edc2SpcSender != null) {
                edc2SpcSender.send(requestList, lots);
            }
        }

    }