package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi.step;

import cn.estsh.i3plus.ext.mes.pcn.api.base.bu.IMesBusiConfigService;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IPackageExtService;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IProduceSnExtService;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IProduceSnRepairService;
import cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi.station.SxPutPalletModuleService;
import cn.estsh.i3plus.ext.mes.pcn.pojo.bean.*;
import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesPackDetailOrBigPackDetailModel;
import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesPackageOrBigPackageModel;
import cn.estsh.i3plus.ext.mes.pcn.pojo.model.SxPutPalletModuleModel;
import cn.estsh.i3plus.ext.mes.pcn.pojo.model.SxPutPalletPlcDataModel;
import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords;
import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtEnumUtil;
import cn.estsh.i3plus.mes.pcn.serviceimpl.base.BaseStepService;
import cn.estsh.i3plus.mes.pcn.util.LocaleUtil;
import cn.estsh.i3plus.platform.common.tool.TimeTool;
import cn.estsh.i3plus.pojo.base.enumutil.MesPcnEnumUtil;
import cn.estsh.i3plus.pojo.mes.bean.MesPackageDetail;
import cn.estsh.i3plus.pojo.mes.model.StationRequestBean;
import cn.estsh.i3plus.pojo.mes.model.StationResultBean;
import cn.estsh.i3plus.pojo.mes.model.StepResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @Description : 工步业务-本体装托人工模式校验包装条码工步
 * @Reference :
 * @Author : wangjie
 * @CreateDate : 2019-07-11
 * @Modify:
 **/
@Slf4j
@Service("sxPutPalletCheckPackageNoStepService")
public class SxPutPalletCheckPackageNoStepService extends BaseStepService {

    @Autowired
    private SxPutPalletModuleService putPalletModuleService;

    @Autowired
    private IPackageExtService packageExtService;

    @Autowired
    private IProduceSnExtService produceSnExtService;

    @Autowired
    private IProduceSnRepairService produceSnRepairService;

    @Autowired
    private IMesBusiConfigService busiConfigService;

    @Override
    public StepResult execute(StationRequestBean reqBean) {
        log.info("SxPutPalletCheckPackageNoStepService[execute] 参数：{}", reqBean);

        StationResultBean resultBean = new StationResultBean();
        String err;

        SxPutPalletPlcDataModel packageNoModel = (SxPutPalletPlcDataModel) putPalletModuleService.doHandleCacheCurExecPackageNo(reqBean, 1, null);
        if (null == packageNoModel) {
            err = LocaleUtil.transferLanguage(reqBean.getUserInfo(), "未缓存包装条码");
            this.sendMessage(reqBean, resultBean, err, MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.EXP_TEXT);
            return StepResult.getNonComplete(err);
        }

        SxPutPalletPlcDataModel curCtNoModel = (SxPutPalletPlcDataModel) putPalletModuleService.doHandleCurCtNo(reqBean, 1, null);
        if (null == curCtNoModel || !curCtNoModel.getBoo()) {
            putPalletModuleService.doHandleCacheCurExecPackageNo(reqBean, 3, null);
            err = LocaleUtil.transferLanguage(reqBean.getUserInfo(), "当前未知容器代码");
            this.sendMessage(reqBean, resultBean, err, MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.EXP_TEXT);
            return StepResult.getNonComplete(err);
        }

        MesPackageOrBigPackageModel pack = new MesPackageOrBigPackageModel();

        //判断是否是净水器产线
        MesBusiConfig mesBusiConfig = busiConfigService.queryBusiConfigeByCfgCode(MesPcnExtConstWords.WATER_PURIFIER_CODE, reqBean.getOrganizeCode());
        boolean iswaterPurifierWorkCenter = false;
        if (mesBusiConfig != null && !StringUtils.isEmpty(mesBusiConfig.getCfgValue())) {
            List<String> workCenterCodeList = Arrays.stream(mesBusiConfig.getCfgValue().split(MesPcnExtConstWords.COMMA)).collect(Collectors.toList());
            if (workCenterCodeList.contains(reqBean.getWorkCenterCode())) {
                iswaterPurifierWorkCenter = true;
            }
        }

        //将检索出的数据放在包装和大包装公用model里
        if (iswaterPurifierWorkCenter) {
            MesOuterPackage packTemp = packageExtService.getBigPackageByPackNo(reqBean.getOrganizeCode(), packageNoModel.getPackageNo());
            if(packTemp == null){
                putPalletModuleService.doHandleCacheCurExecPackageNo(reqBean, 3, null);
                err = String.format(LocaleUtil.transferLanguage(reqBean.getUserInfo(), "包装条码[%s]不存在"), packageNoModel.getPackageNo());
                this.sendMessage(reqBean, resultBean, err, MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.EXP_TEXT);
                return StepResult.getNonComplete(err);
            }
            BeanUtils.copyProperties(packTemp, pack);
        } else {
            MesPackageExt packTemp = packageExtService.getPackageByPackNo(reqBean.getOrganizeCode(), packageNoModel.getPackageNo());
            if (null == packTemp) {
                putPalletModuleService.doHandleCacheCurExecPackageNo(reqBean, 3, null);
                err = String.format(LocaleUtil.transferLanguage(reqBean.getUserInfo(), "包装条码[%s]不存在"), packageNoModel.getPackageNo());
                this.sendMessage(reqBean, resultBean, err, MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.EXP_TEXT);
                return StepResult.getNonComplete(err);
            }
            BeanUtils.copyProperties(packTemp, pack);
        }

        if (StringUtils.isEmpty(pack.getLotNo())) {
            putPalletModuleService.doHandleCacheCurExecPackageNo(reqBean, 3, null);
            err = String.format(LocaleUtil.transferLanguage(reqBean.getUserInfo(), "包装条码[%s]没有批次号,不能装托"), packageNoModel.getPackageNo());
            this.sendMessage(reqBean, resultBean, err, MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.EXP_TEXT);
            return StepResult.getNonComplete(err);
        }

        List<SxPutPalletModuleModel> putPalletModuleModelList = (List<SxPutPalletModuleModel>) putPalletModuleService.doHandlePackageDataByCtNo(reqBean, curCtNoModel.getCtNo(), 1, null);
        if (!CollectionUtils.isEmpty(putPalletModuleModelList) && !putPalletModuleModelList.get(0).getPartNo().equals(pack.getPartNo())) {
            putPalletModuleService.doHandleCacheCurExecPackageNo(reqBean, 3, null);
            err = String.format(LocaleUtil.transferLanguage(reqBean.getUserInfo(), "包装条码[%s]关联的物料编码[%s]与当前已装托的物料编码[%s]不一致,不能装托"),
                    packageNoModel.getPackageNo(), pack.getPartNo(), putPalletModuleModelList.get(0).getPartNo());
            this.sendMessage(reqBean, resultBean, err, MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.EXP_TEXT);
            return StepResult.getNonComplete(err);
        }

        String curPartNo = (String) putPalletModuleService.doHandleCurPartNo(reqBean, 1, null);
        String curWorkOrderNo = (String) putPalletModuleService.doHandleCurWorkOrderNo(reqBean, 1, null);
        Integer curWorkOrderType = (Integer) putPalletModuleService.doHandleCurWorkOrderType(reqBean, 1, null);
        if (MesPcnExtEnumUtil.WORK_ORDER_TYPE.REWORK_ORDER.getValue() != curWorkOrderType) {
            if (!pack.getWorkOrderNo().equals(curWorkOrderNo)) {
                putPalletModuleService.doHandleCacheCurExecPackageNo(reqBean, 3, null);
                err = String.format(LocaleUtil.transferLanguage(reqBean.getUserInfo(), "包装条码[%s]不属于当前选择的工单[%s],不能装托"),
                        packageNoModel.getPackageNo(), curWorkOrderNo);
                this.sendMessage(reqBean, resultBean, err, MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.EXP_TEXT);
                return StepResult.getNonComplete(err);
            }
        }

        if (!pack.getPartNo().equals(curPartNo)) {
            putPalletModuleService.doHandleCacheCurExecPackageNo(reqBean, 3, null);
            err = String.format(LocaleUtil.transferLanguage(reqBean.getUserInfo(), "包装条码[%s]关联的物料号[%s]与当前选择的工单[%s]关联的物料号[%s]不一致,不能装托"),
                    packageNoModel.getPackageNo(), pack.getPartNo(), curWorkOrderNo, curPartNo);
            this.sendMessage(reqBean, resultBean, err, MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.EXP_TEXT);
            return StepResult.getNonComplete(err);
        }

        List<MesPackDetailOrBigPackDetailModel> packageDetailList = new ArrayList<>();

        //将检索出的数据放在包装明细和大包装明细公用model里
        if (iswaterPurifierWorkCenter) {
            List<MesOuterPackageDetail> packageDetailTempList = packageExtService.getBigPackageDetailByPackNo(reqBean.getOrganizeCode(), packageNoModel.getPackageNo());
            if (CollectionUtils.isEmpty(packageDetailTempList)) {
                putPalletModuleService.doHandleCacheCurExecPackageNo(reqBean, 3, null);
                err = String.format(LocaleUtil.transferLanguage(reqBean.getUserInfo(), "包装条码[%s]对应的明细信息不存在,不能装托"), packageNoModel.getPackageNo());
                this.sendMessage(reqBean, resultBean, err, MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.EXP_TEXT);
                return StepResult.getNonComplete(err);
            }
            packageDetailTempList = packageDetailTempList.stream().filter(outerPackageDetail -> outerPackageDetail.getBindStatus() == MesPcnExtEnumUtil.PACKAGE_BIND_STATUS.BINGDING.getValue()).collect(Collectors.toList());
            for (MesOuterPackageDetail mesOuterPackageDetail : packageDetailTempList) {
                MesPackDetailOrBigPackDetailModel packageDetail = new MesPackDetailOrBigPackDetailModel();
                BeanUtils.copyProperties(mesOuterPackageDetail, packageDetail);
                packageDetailList.add(packageDetail);
            }

        } else {
            MesPackageDetail packageDetailTemp = packageExtService.getPackageDetailByPackNo(reqBean.getOrganizeCode(), packageNoModel.getPackageNo());
            if (null == packageDetailTemp) {
                putPalletModuleService.doHandleCacheCurExecPackageNo(reqBean, 3, null);
                err = String.format(LocaleUtil.transferLanguage(reqBean.getUserInfo(), "包装条码[%s]对应的明细信息不存在,不能装托"), packageNoModel.getPackageNo());
                this.sendMessage(reqBean, resultBean, err, MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.EXP_TEXT);
                return StepResult.getNonComplete(err);
            }
            MesPackDetailOrBigPackDetailModel packageDetail = new MesPackDetailOrBigPackDetailModel();
            BeanUtils.copyProperties(packageDetailTemp, packageDetail);
            packageDetailList.add(packageDetail);
        }


        String idStr = pack.getId().toString();
        String lotNo = pack.getLotNo();
        List<String> idStrList = new ArrayList<>();
        for (MesPackDetailOrBigPackDetailModel packageDetail : packageDetailList) {
            MesProduceSnExt produceSnExt = produceSnExtService.getProduceSnExtBySn(reqBean.getOrganizeCode(), packageDetail.getSerialNumber());
            if (null == produceSnExt) {
                putPalletModuleService.doHandleCacheCurExecPackageNo(reqBean, 3, null);
                err = String.format(LocaleUtil.transferLanguage(reqBean.getUserInfo(), "包装条码[%s]关联的产品条码[%s]对应的产品条码信息不存在,不能装托"),
                        packageNoModel.getPackageNo(), packageDetail.getSerialNumber());
                this.sendMessage(reqBean, resultBean, err, MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.EXP_TEXT);
                return StepResult.getNonComplete(err);
            }

            if (MesPcnExtEnumUtil.PRODUCE_SN_QC_STATUS.QUALIFIED.getValue() != produceSnExt.getQcStatus()) {
                putPalletModuleService.doHandleCacheCurExecPackageNo(reqBean, 3, null);
                err = String.format(LocaleUtil.transferLanguage(reqBean.getUserInfo(), "包装条码[%s]关联的产品条码[%s]质量状态为[%s],不能装托"),
                        packageNoModel.getPackageNo(), produceSnExt.getSerialNumber(), MesPcnExtEnumUtil.PRODUCE_SN_QC_STATUS.valueOfDescription(produceSnExt.getQcStatus()));
                this.sendMessage(reqBean, resultBean, err, MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.EXP_TEXT);
                return StepResult.getNonComplete(err);
            }

            if (MesPcnExtEnumUtil.PRODUCE_SN_STATUS.OFFLINE.getValue() != produceSnExt.getSnStatus()) {
                putPalletModuleService.doHandleCacheCurExecPackageNo(reqBean, 3, null);
                err = String.format(LocaleUtil.transferLanguage(reqBean.getUserInfo(), "包装条码[%s]关联的产品条码[%s]状态为[%s],不能装托"),
                        packageNoModel.getPackageNo(), produceSnExt.getSerialNumber(), MesPcnExtEnumUtil.PRODUCE_SN_STATUS.valueOfDescription(produceSnExt.getSnStatus()));
                this.sendMessage(reqBean, resultBean, err, MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.EXP_TEXT);
                return StepResult.getNonComplete(err);
            }
            if (MesPcnExtEnumUtil.WORK_ORDER_TYPE.REWORK_ORDER.getValue() == curWorkOrderType) {

                MesProduceSnRepair produceSnRepair = produceSnRepairService.getProduceSnRepairBySn(reqBean.getOrganizeCode(), packageDetail.getSerialNumber());
                if (null == produceSnRepair) {
                    putPalletModuleService.doHandleCacheCurExecPackageNo(reqBean, 3, null);
                    err = String.format(LocaleUtil.transferLanguage(reqBean.getUserInfo(), "包装条码[%s]对应的产品条码[%s]未关联返工工单[%s],不能装托"),
                            packageNoModel.getPackageNo(), packageDetail.getSerialNumber(), curWorkOrderNo);
                    this.sendMessage(reqBean, resultBean, err, MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.EXP_TEXT);
                    return StepResult.getNonComplete(err);
                }
                if (!produceSnRepair.getWorkOrderNo().equals(curWorkOrderNo)) {
                    putPalletModuleService.doHandleCacheCurExecPackageNo(reqBean, 3, null);
                    err = String.format(LocaleUtil.transferLanguage(reqBean.getUserInfo(), "包装条码[%s]对应的产品条码关联的最新返工工单为[%s],不属于当前选择的返工工单[%s],不能装托"),
                            packageNoModel.getPackageNo(), produceSnRepair.getWorkOrderNo(), curWorkOrderNo);
                    this.sendMessage(reqBean, resultBean, err, MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.EXP_TEXT);
                    return StepResult.getNonComplete(err);
                }
                if (!reqBean.getWorkCenterCode().equals(produceSnRepair.getWorkCenterCode())) {
                    putPalletModuleService.doHandleCacheCurExecPackageNo(reqBean, 3, null);
                    err = String.format(LocaleUtil.transferLanguage(reqBean.getUserInfo(), "包装条码[%s]关联的返工工单类型的产品条码[%s]对应的生产线[%s]与当前生产线[%s]不一致,不能装托"),
                            packageNoModel.getPackageNo(), produceSnRepair.getSerialNumber(), produceSnRepair.getWorkCenterCode(), reqBean.getWorkCenterCode());
                    this.sendMessage(reqBean, resultBean, err, MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.EXP_TEXT);
                    return StepResult.getNonComplete(err);
                }
                if (StringUtils.isEmpty(produceSnRepair.getLotNo())) {
                    putPalletModuleService.doHandleCacheCurExecPackageNo(reqBean, 3, null);
                    err = String.format(LocaleUtil.transferLanguage(reqBean.getUserInfo(), "包装条码[%s]关联的返工工单类型的产品条码[%s]未下线,不能装托"),
                            packageNoModel.getPackageNo(), produceSnRepair.getSerialNumber());
                    this.sendMessage(reqBean, resultBean, err, MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.EXP_TEXT);
                    return StepResult.getNonComplete(err);
                }
                if (!StringUtils.isEmpty(produceSnRepair.getCtNo())) {
                    putPalletModuleService.doHandleCacheCurExecPackageNo(reqBean, 3, null);
                    err = String.format(LocaleUtil.transferLanguage(reqBean.getUserInfo(), "包装条码[%s]已经装托在容器编码[%s]中,操作失败"), packageNoModel.getPackageNo(), produceSnRepair.getCtNo());
                    this.sendMessage(reqBean, resultBean, err, MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.EXP_TEXT);
                    return StepResult.getNonComplete(err);
                }
                idStrList.add(produceSnRepair.getId().toString());
                if(!iswaterPurifierWorkCenter) lotNo = produceSnRepair.getLotNo();
            } else {
                if (!reqBean.getWorkCenterCode().equals(pack.getWorkCenterCode())) {
                    putPalletModuleService.doHandleCacheCurExecPackageNo(reqBean, 3, null);
                    err = String.format(LocaleUtil.transferLanguage(reqBean.getUserInfo(), "包装条码[%s]关联的生产线[%s]与当前生产线[%s]不一致,不能装托"),
                            packageNoModel.getPackageNo(), pack.getWorkCenterCode(), reqBean.getWorkCenterCode());
                    this.sendMessage(reqBean, resultBean, err, MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.EXP_TEXT);
                    return StepResult.getNonComplete(err);
                }
                if (!StringUtils.isEmpty(pack.getCtNo())) {
                    putPalletModuleService.doHandleCacheCurExecPackageNo(reqBean, 3, null);
                    err = String.format(LocaleUtil.transferLanguage(reqBean.getUserInfo(), "包装条码[%s]已经装托在容器编码[%s]中,操作失败"), packageNoModel.getPackageNo(), pack.getCtNo());
                    this.sendMessage(reqBean, resultBean, err, MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.EXP_TEXT);
                    return StepResult.getNonComplete(err);
                }
            }
        }

        if(CollectionUtils.isEmpty(idStrList)) idStrList.add(idStr);

        if (!CollectionUtils.isEmpty(putPalletModuleModelList)) {
            putPalletModuleModelList = putPalletModuleModelList.stream().sorted(Comparator.comparing(SxPutPalletModuleModel::getLotNo).reversed()).collect(Collectors.toList());
            if (TimeTool.stringParseToDate(lotNo, MesPcnExtConstWords.DATE_FORMAT).compareTo(TimeTool.stringParseToDate(putPalletModuleModelList.get(0).getLotNo(), MesPcnExtConstWords.DATE_FORMAT)) < 0) {
                putPalletModuleService.doHandleCacheCurExecPackageNo(reqBean, 3, null);
                err = String.format(LocaleUtil.transferLanguage(reqBean.getUserInfo(), "包装条码[%s]的批次号[%s]早于上一个已装托包装条码的批次号[%s],不能装托"),
                        packageNoModel.getPackageNo(), lotNo, putPalletModuleModelList.get(0).getLotNo());
                this.sendMessage(reqBean, resultBean, err, MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.EXP_TEXT);
                return StepResult.getNonComplete(err);
            }
        }

        SxPutPalletModuleModel model = new SxPutPalletModuleModel();
        model.setIdStr(idStr);
        model.setIdStrList(idStrList);
        model.setWorkOrderType(curWorkOrderType);
        model.setWorkOrderNo(curWorkOrderNo);
        model.setPartNo(pack.getPartNo());
        model.setLotNo(lotNo);
        model.setPackageNo(packageNoModel.getPackageNo());
        model.setCtNo(curCtNoModel.getCtNo());
        model.setScanDatetime(TimeTool.getNowTime(true));
        if (!(Boolean) putPalletModuleService.doHandlePackageDataByCtNo(reqBean, curCtNoModel.getCtNo(), 2, model)) {
            putPalletModuleService.doHandleCacheCurExecPackageNo(reqBean, 3, null);
            err = String.format(LocaleUtil.transferLanguage(reqBean.getUserInfo(), "包装条码[%s]已装托在容器代码[%s]中,请勿重复扫描"), packageNoModel.getPackageNo(), curCtNoModel.getCtNo());
            this.sendMessage(reqBean, resultBean, err, MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.EXP_TEXT);
            return StepResult.getNonComplete(err);
        }

        err = String.format(LocaleUtil.transferLanguage(reqBean.getUserInfo(), "包装条码[%s]装托成功"), packageNoModel.getPackageNo());
        this.sendMessage(reqBean, resultBean, err, MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT);

        String curProdType = (String) putPalletModuleService.doHandleCurProdType(reqBean, 1, null);

        if (!MesPcnExtEnumUtil.PUT_PALLET_PROD_TYPE.AUTO_WORK.getCode().equals(curProdType)) {
            putPalletModuleService.doHandleCacheCurExecPackageNo(reqBean, 3, null);
            return StepResult.getSuccessComplete();
        }

        packageNoModel.setBoo(true);
        putPalletModuleService.doHandleCacheCurExecPackageNo(reqBean, 2, packageNoModel);
        StepResult stepResult = StepResult.getSuccessComplete();
        stepResult.setNextTriggerEvent(MesPcnExtEnumUtil.PUT_PALLET_PROD_TYPE.PLC_WORK.name());
        return stepResult;
    }

}
