forked from I3-YF/i3plus-mes-pcn-yfai
工步弹框
parent
17a2254f3a
commit
2af9d8f125
@ -0,0 +1,78 @@
|
|||||||
|
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.step;
|
||||||
|
|
||||||
|
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.IShippingDispatchService;
|
||||||
|
import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.function.IFsmModuleFunctionService;
|
||||||
|
import cn.estsh.i3plus.pojo.base.enumutil.MesPcnEnumUtil;
|
||||||
|
import cn.estsh.i3plus.pojo.mes.bean.MesProdRouteOptParam;
|
||||||
|
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 lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description : 客制化弹框会话工步
|
||||||
|
* @Author : wangjie
|
||||||
|
**/
|
||||||
|
@Slf4j
|
||||||
|
@Service("mesCustomDialogStepService")
|
||||||
|
public class MesCustomDialogStepService extends BaseStepService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IFsmModuleFunctionService fsmModuleFunctionService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IShippingDispatchService shippingDispatchService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void title(StationRequestBean reqBean) {
|
||||||
|
this.sendMessage(reqBean, new StationResultBean().resultObj(MesPcnExtConstWords.STEP_DISABLE_SCAN), String.format("工步: %s", reqBean.getStepName()), MesPcnEnumUtil.STATION_BUSI_TYPE.STEP_TITLE, MesPcnEnumUtil.STATION_DATA_TYPE.TITLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public StepResult execute(StationRequestBean reqBean) {
|
||||||
|
|
||||||
|
StationResultBean resultBean = new StationResultBean();
|
||||||
|
|
||||||
|
StepResult stepResult = StepResult.getSuccessComplete();
|
||||||
|
|
||||||
|
//弹框已经关闭
|
||||||
|
if (reqBean.getStepDialogStatus()) {
|
||||||
|
reqBean.setStepDialogStatus(false);
|
||||||
|
return stepSuccessCompleteAndSendMsgReturn(reqBean, resultBean, stepResult, "弹框会话关闭!");
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取工步参数
|
||||||
|
Optional<Map<String, MesProdRouteOptParam>> stepParamMap = getStepParams(reqBean);
|
||||||
|
|
||||||
|
String customPageName = (null != stepParamMap && stepParamMap.isPresent() && stepParamMap.get().containsKey(MesPcnExtConstWords.CUSTOM_PAGE_NAME)) ? stepParamMap.get().get(MesPcnExtConstWords.CUSTOM_PAGE_NAME).getParamValue() : null;
|
||||||
|
|
||||||
|
if (StringUtils.isEmpty(customPageName)) stepExpSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(), String.format("弹框会话工步未配置工步参数[%s]!", MesPcnExtConstWords.CUSTOM_PAGE_NAME));
|
||||||
|
|
||||||
|
//获取工步弹框需要渲染的数据
|
||||||
|
Object stepDialogContext = fsmModuleFunctionService.stepDialogDispatch(reqBean);
|
||||||
|
|
||||||
|
//没有数据返回NULL则默认不需要弹框, 无须渲染动态数据时无须重写stepDialogDispatch方法且接口方法已默认返回true可以直接弹框
|
||||||
|
if (null == stepDialogContext) return stepResult;
|
||||||
|
|
||||||
|
//发送弹框数据
|
||||||
|
this.sendMessage(reqBean, resultBean.busiType(MesPcnEnumUtil.STATION_BUSI_TYPE.CUSTOM_COMPONENT.getValue()).dataType(MesPcnEnumUtil.STATION_DATA_TYPE.CUSTOM_DIALOG.getValue()).customPageName(customPageName).resultObj(stepDialogContext));
|
||||||
|
|
||||||
|
//清除剩余扫描队列
|
||||||
|
shippingDispatchService.clearScanQueue(reqBean);
|
||||||
|
|
||||||
|
//结束线程
|
||||||
|
stepSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.PROCESS.getValue()), "弹框会话开启!");
|
||||||
|
|
||||||
|
return stepResult;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue