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

import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.BaseStepService;
import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.IStepService;
import cn.estsh.i3plus.pojo.base.enumutil.MesPcnEnumUtil;
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 cn.estsh.impp.framework.boot.util.SpringContextsUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
/**
 * @Description : 裁片工单保存加工结果工步【非排序】
 * @Author : wangjie
 **/
@Slf4j
@Service("mesWorkOrderCutSaveStepService")
public class MesWorkOrderCutSaveStepService extends BaseStepService {

    @Override
    public StepResult execute(StationRequestBean reqBean) {

        //保存开模记录工步
        ((IStepService) SpringContextsUtil.getBean("mesMouldRecordGenerateStepService")).executeInState(reqBean);

        //保存裁片工单条码工步
        ((IStepService) SpringContextsUtil.getBean("mesWorkOrderCutProductSnSaveStepService")).executeInState(reqBean);

        //生成裁片工单包装条码工步
        ((IStepService) SpringContextsUtil.getBean("mesWorkOrderCutPackageSnSaveStepService")).executeInState(reqBean);

        //生成加工记录工步
        ((IStepService) SpringContextsUtil.getBean("mesProductionRecordGenerateStepService")).executeInState(reqBean);

        //修改裁片工单、工单信息工步
        ((IStepService) SpringContextsUtil.getBean("mesWorkOrderCutWorkOrderSaveStepService")).executeInState(reqBean);

        return stepSuccessCompleteAndSendMsgReturn(reqBean, new StationResultBean().writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.PROCESS.getValue()), "保存加工结果成功!");

    }

}
