|
|
|
@ -2,29 +2,20 @@ package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.step;
|
|
|
|
|
|
|
|
|
|
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.MesEquipVariableCollectContext;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionProcessContext;
|
|
|
|
|
import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.BaseStepService;
|
|
|
|
|
import cn.estsh.i3plus.platform.common.tool.TimeTool;
|
|
|
|
|
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.util.MesExtEnumUtil;
|
|
|
|
|
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.ArrayList;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @Description : 扫描装配件条码工步
|
|
|
|
|
* @Description : 扫描主条码工步
|
|
|
|
|
* @Author : wangjie
|
|
|
|
|
**/
|
|
|
|
|
@Slf4j
|
|
|
|
|
@Service("mesAssemblyScanStepService")
|
|
|
|
|
public class MesAssemblyScanStepService extends BaseStepService {
|
|
|
|
|
@Service("mesProductSnScanStepService")
|
|
|
|
|
public class MesProductSnScanStepService extends BaseStepService {
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private IMesProductionProcessContextStepService productionProcessContextStepService;
|
|
|
|
@ -32,50 +23,15 @@ public class MesAssemblyScanStepService extends BaseStepService {
|
|
|
|
|
@Autowired
|
|
|
|
|
private IMesProductionDispatchContextStepService productionDispatchContextStepService;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public StepResult guide(StationRequestBean reqBean) {
|
|
|
|
|
|
|
|
|
|
productionDispatchContextStepService.doSendStepContextMessage(reqBean);
|
|
|
|
|
|
|
|
|
|
return execSuccessCompleteAndSendGuideReturn(reqBean, new StationResultBean(), "请扫描装配件条码!");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public StepResult execute(StationRequestBean reqBean) {
|
|
|
|
|
|
|
|
|
|
StationResultBean resultBean = new StationResultBean();
|
|
|
|
|
|
|
|
|
|
StepResult stepResult = StepResult.getSuccessComplete();
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isEmpty(reqBean.getScanInfo())) execSendGuideAndThrowEx(reqBean, resultBean, "请扫描装配件条码!");
|
|
|
|
|
|
|
|
|
|
//扫描信息置空
|
|
|
|
|
String scanInfo = reqBean.resetScanInfo(reqBean.getScanInfo());
|
|
|
|
|
|
|
|
|
|
MesProductionProcessContext productionProcessContext = productionProcessContextStepService.getCurCellEquipment(reqBean);
|
|
|
|
|
|
|
|
|
|
//获取生产过程上下文对象有异常信息 抛出异常
|
|
|
|
|
if (!productionProcessContext.getSuccess()) return execNonCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, productionProcessContext.getMessage());
|
|
|
|
|
|
|
|
|
|
//保存设备当前一轮工序待验证的装配件条码信息
|
|
|
|
|
productionDispatchContextStepService.saveScanAssemblySnContext(reqBean, getAssemblySnJson(reqBean, scanInfo));
|
|
|
|
|
|
|
|
|
|
//发送工步内容
|
|
|
|
|
productionDispatchContextStepService.doSendStepContextMessage(reqBean, scanInfo, MesExtEnumUtil.CELL_MESSAGE_SOURCE.SCAN);
|
|
|
|
|
|
|
|
|
|
return execSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, String.format("当前扫描信息装配件条码[%s]!", scanInfo));
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private List<MesEquipVariableCollectContext> getAssemblySnJson(StationRequestBean reqBean, String scanInfo) {
|
|
|
|
|
|
|
|
|
|
List<MesEquipVariableCollectContext> equipVariableCollectContextList = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
equipVariableCollectContextList.add(new MesEquipVariableCollectContext(reqBean.getOrganizeCode(), scanInfo, TimeTool.getNowTime(true)));
|
|
|
|
|
|
|
|
|
|
return equipVariableCollectContextList;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|