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.pojo.base.enumutil.CommonEnumUtil;
import cn.estsh.i3plus.pojo.mes.model.StationRequestBean;
import cn.estsh.i3plus.pojo.mes.model.StepResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

/**
 * @Description : 验证发运队列生产模式工步
 * @Author : wangjie
 **/
@Slf4j
@Service("mesShippingRfidRouteModeCheckStepService")
public class MesShippingRfidRouteModeCheckStepService extends BaseStepService {

    @Autowired
    private IMesProductionProcessContextStepService productionProcessContextStepService;

    @Override
    public StepResult execute(StationRequestBean reqBean) {

        StepResult stepResult = StepResult.getSuccessComplete();

        //获取发运RFID生产模式
        String routeMode = productionProcessContextStepService.getShippingRfidRouteModeContext(reqBean);

        //判断是否人工模式
        Boolean isManualMode = !StringUtils.isEmpty(routeMode) && routeMode.equals(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValueStr());
        if (isManualMode) stepResult.isCompleted(false);

        return stepResult;

    }

}
