From 2af9d8f12599b57aabbf7a33c396f13e68c0630f Mon Sep 17 00:00:00 2001 From: "jhforever.wang@estsh.com" Date: Thu, 12 Sep 2024 14:33:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=A5=E6=AD=A5=E5=BC=B9=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../step/MesCustomDialogStepService.java | 78 ++++++++++++++++++++++ .../MesProduceSeqCheckCustOrderNoStepService.java | 2 +- .../ext/mes/pcn/pojo/util/MesPcnExtConstWords.java | 3 + 3 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesCustomDialogStepService.java diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesCustomDialogStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesCustomDialogStepService.java new file mode 100644 index 0000000..fc896a1 --- /dev/null +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesCustomDialogStepService.java @@ -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> 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; + + } + +} diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProduceSeqCheckCustOrderNoStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProduceSeqCheckCustOrderNoStepService.java index e10c1a7..86364b1 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProduceSeqCheckCustOrderNoStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProduceSeqCheckCustOrderNoStepService.java @@ -23,7 +23,7 @@ import java.util.*; import java.util.stream.Collectors; /** - * @Description : 生产工单顺序防错工步 【排序客户订单号】 + * @Description : 生产工单顺序防错工步 【排序通用汽车客户订单号】 * @Author : wangjie **/ @Slf4j diff --git a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/util/MesPcnExtConstWords.java b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/util/MesPcnExtConstWords.java index db8ca4e..4ef684c 100644 --- a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/util/MesPcnExtConstWords.java +++ b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/util/MesPcnExtConstWords.java @@ -333,6 +333,9 @@ public class MesPcnExtConstWords { //过程条码默认生成规则 public static final String DEFAULT_SERIAL_NUMBER_RULE = "DEFAULT_SERIAL_NUMBER_RULE"; + // 定制页面名称 + public static final String CUSTOM_PAGE_NAME = "CUSTOM_PAGE_NAME"; + // 定制页面名称(默认 产出零件) public static final String CUSTOM_PAGE_NAME_DEFAULT = "CUSTOM_PAGE_NAME_DEFAULT";