|
|
|
@ -1,27 +1,25 @@
|
|
|
|
|
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.step;
|
|
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionCustomContextStepService;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionDispatchContextStepService;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionProcessContextStepService;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionProcessContext;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords;
|
|
|
|
|
import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.BaseStepService;
|
|
|
|
|
import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.IStepService;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.enumutil.MesPcnEnumUtil;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.model.StationKvBean;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.shipping.MesShippingQueue;
|
|
|
|
|
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.i3plus.pojo.mes.repository.seres.shipping.MesCimSeresLastOrderShippingCodeRepository;
|
|
|
|
|
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;
|
|
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @Description : 校验当前扫描的发运单是否为“末单”
|
|
|
|
|
* @Reference :
|
|
|
|
@ -37,51 +35,45 @@ public class MesShippingCheckCimSeresLastOrderShippingCodeStepService extends Ba
|
|
|
|
|
private IMesProductionProcessContextStepService productionProcessContextStepService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private IMesProductionCustomContextStepService productionCustomContextStepService;
|
|
|
|
|
private IMesProductionDispatchContextStepService productionDispatchContextStepService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private MesCimSeresLastOrderShippingCodeRepository mesCimSeresLastOrderShippingCodeRepository;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public StepResult execute(StationRequestBean reqBean) {
|
|
|
|
|
|
|
|
|
|
StationResultBean resultBean = new StationResultBean();
|
|
|
|
|
|
|
|
|
|
StepResult stepResult = StepResult.getSuccessComplete();
|
|
|
|
|
|
|
|
|
|
//获取上下文信息
|
|
|
|
|
MesProductionProcessContext productionProcessContext = productionProcessContextStepService.dispatchCurCellEquipment(reqBean);
|
|
|
|
|
|
|
|
|
|
//配置错误 抛出异常
|
|
|
|
|
if (!productionProcessContext.getSuccess()) {
|
|
|
|
|
stepExpSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(), productionProcessContext.getMessage());
|
|
|
|
|
}
|
|
|
|
|
if (!productionProcessContext.getSuccess()) stepExpSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(), productionProcessContext.getMessage());
|
|
|
|
|
|
|
|
|
|
//存储生产过程上下文对象
|
|
|
|
|
productionProcessContextStepService.dispatchProductionProcessContext(reqBean, productionProcessContext);
|
|
|
|
|
|
|
|
|
|
//扫描信息置空
|
|
|
|
|
String scanInfo = reqBean.resetScanInfo(reqBean.getScanInfo());
|
|
|
|
|
|
|
|
|
|
//验证发运组信息是否有效
|
|
|
|
|
List<StationKvBean> resultList = null;
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isEmpty(scanInfo)) {
|
|
|
|
|
stepSendGuideAndThrowEx(reqBean,
|
|
|
|
|
resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.PROCESS.getValue()),
|
|
|
|
|
"[人工模式]请扫描发运单号!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//发送工步内容
|
|
|
|
|
productionCustomContextStepService.sendStepContextMessage(reqBean, scanInfo, MesExtEnumUtil.CELL_MESSAGE_SOURCE.SCAN);
|
|
|
|
|
//获取上下文发运队列信息
|
|
|
|
|
MesShippingQueue shippingQueue = productionDispatchContextStepService.getShippingQueueContext(reqBean);
|
|
|
|
|
if ((null == shippingQueue || StringUtils.isEmpty(shippingQueue.getRfidSn())))
|
|
|
|
|
return stepDynamicsCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, true,
|
|
|
|
|
MesPcnEnumUtil.STATION_BUSI_TYPE.RUNNING_INFO, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT, "当前未获取到缓存中有效的发运队列,默认跳过发送空托盘!");
|
|
|
|
|
|
|
|
|
|
//判断当前扫描的发运单号是否是“末单”
|
|
|
|
|
DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(reqBean.getOrganizeCode());
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(scanInfo, "shippingCode", ddlPackBean);
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(shippingQueue.getShippingCode(), MesPcnExtConstWords.SHIPPING_CODE, ddlPackBean);
|
|
|
|
|
boolean exitByHql = mesCimSeresLastOrderShippingCodeRepository.isExitByHql(ddlPackBean);
|
|
|
|
|
if (exitByHql) {
|
|
|
|
|
this.sendMessage(reqBean, resultBean.writeDbLog(), String.format("当前发运单号[%s]为末单,即将执行发送空托盘!",
|
|
|
|
|
shippingQueue.getShippingCode()), MesPcnEnumUtil.STATION_BUSI_TYPE.RUNNING_INFO, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT);
|
|
|
|
|
//当前发运单号为“末单”,则调用“向PLC点位发送自定义指令”工步向PLC点位发送用户自定义指令
|
|
|
|
|
return ((IStepService) SpringContextsUtil.getBean("mesSendUserDefinedCmdStepService")).executeInState(reqBean);
|
|
|
|
|
}else {
|
|
|
|
|
return stepSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), null,
|
|
|
|
|
String.format("当前扫描信息发运单号[%s]无须发送末单指令!", scanInfo));
|
|
|
|
|
return stepDynamicsCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, true,
|
|
|
|
|
MesPcnEnumUtil.STATION_BUSI_TYPE.RUNNING_INFO, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT, String.format("当前发运单号[%s]非末单,默认跳过发送空托盘!", shippingQueue.getShippingCode()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|