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

import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionProcessContextStepService;
import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.BaseStepService;
import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.IStepService;
import cn.estsh.i3plus.pojo.mes.model.StationRequestBean;
import cn.estsh.i3plus.pojo.mes.model.StepResult;
import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
import cn.estsh.impp.framework.boot.util.SpringContextsUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Description : 装配件匹配工步
 * @Author : wangjie
 **/
@Slf4j
@Service("mesAssemblyMatchStepService")
public class MesAssemblyMatchStepService extends BaseStepService {

    @Autowired
    private IMesProductionProcessContextStepService productionProcessContextStepService;

    @Override
    public StepResult execute(StationRequestBean reqBean) {

        //排序线 装配件匹配工步
        if (MesExtEnumUtil.WORK_CENTER_TYPE.SORT.getValue() == productionProcessContextStepService.getCenterType(reqBean)) return ((IStepService) SpringContextsUtil.getBean("mesAssemblyMatchSortStepService")).executeInState(reqBean);

        //非排序线 装配件匹配工步
        return ((IStepService) SpringContextsUtil.getBean("mesAssemblyMatchNosortStepService")).executeInState(reqBean);

    }

}
