From 712fb6b9438e4d4565472a7bb6e258cd4632f399 Mon Sep 17 00:00:00 2001 From: "jhforever.wang@estsh.com" Date: Wed, 15 Jan 2025 23:41:23 +0800 Subject: [PATCH] =?UTF-8?q?44517=20=E8=A3=85=E7=AE=B1=E9=98=B2=E9=94=99?= =?UTF-8?q?=E5=90=8E=E5=90=90=E6=9D=A1=E7=A0=81=E9=9C=80=E6=B1=82=EF=BC=88?= =?UTF-8?q?=E8=8A=9C=E6=B9=96=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../station/function/MesFunctionPackageProgressService.java | 13 ++++++++++--- .../serviceimpl/step/MesPackageNoGenerateStepService.java | 9 ++++++++- .../step/method/IMesPackageNoGenerateStepService.java | 2 +- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/station/function/MesFunctionPackageProgressService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/station/function/MesFunctionPackageProgressService.java index edc54a2..8075b39 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/station/function/MesFunctionPackageProgressService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/station/function/MesFunctionPackageProgressService.java @@ -3,8 +3,8 @@ package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.station.function; import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionCustomContextStepService; import cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.step.method.IMesPackageNoGenerateStepService; import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesPackageDataContext; -import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesProduceSnPrintModel; import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords; +import cn.estsh.i3plus.mes.pcn.actor.shipping.dispatch.IFsmRouteDataService; import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.BaseSwsService; import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.function.IFsmModuleFunctionService; import cn.estsh.i3plus.pojo.base.enumutil.MesPcnEnumUtil; @@ -39,7 +39,11 @@ public class MesFunctionPackageProgressService extends BaseSwsService implements @Autowired private IMesPackageNoGenerateStepService packageNoGenerateStepService; + @Autowired + private IFsmRouteDataService fsmRouteDataService; + @Override + @Transactional(propagation = Propagation.NOT_SUPPORTED) public Object doCustomApiDispatch(StationRequestBean reqBean, StationResultBean resultBean, ButtonDynamicModel buttonDynamicModel) { Map resultMap = new HashMap<>(); @@ -107,10 +111,13 @@ public class MesFunctionPackageProgressService extends BaseSwsService implements try { packageNoGenerateStepService.doForcePrint(reqBean, resultBean, stepResult, packageDataContextList, packageDb); } catch (ImppBusiException e) { - stepResult.msg(e.getMessage()); + stepResult.msg(e.getErrorDetail()); } catch (Exception e) { - stepResult.msg(e.getMessage()); + String error = String.format("生产线[%s]工位[%s]强制打包%s", reqBean.getWorkCenterCode(), reqBean.getWorkCellCode(), fsmRouteDataService.handleFsmCfgOrDefault(reqBean, MesPcnEnumUtil.FSM_CFG.FSM_EXCEPTION_MSG.getCode())); + this.cacheException(reqBean, reqBean.getStepName(), error, e, false); + stepResult.msg(error); } + if (!StringUtils.isEmpty(stepResult.getMsg())) { return packResultMap(reqBean, resultBean, resultMap, String.format("生产线[%s]工位[%s]强制打包失败,%s", reqBean.getWorkCenterCode(), reqBean.getWorkCellCode(), stepResult.getMsg())); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesPackageNoGenerateStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesPackageNoGenerateStepService.java index 0ff1e78..745824e 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesPackageNoGenerateStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesPackageNoGenerateStepService.java @@ -39,6 +39,8 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import org.springframework.util.StringUtils; @@ -474,6 +476,7 @@ public class MesPackageNoGenerateStepService extends BaseStepService implements mesProduceSnPrintModel.getPackageList().addAll(packageList); MesProduceSnPrintModel printModel = null; + try { printModel = strategyService.execute(null, mesProduceSnPrintModel, null, stepResult, reqBean, true); } catch (ImppBusiException e) { @@ -485,7 +488,10 @@ public class MesPackageNoGenerateStepService extends BaseStepService implements this.sendMessage(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.ERROR.getValue()), webMsg, MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.EXP_TEXT); this.cacheException(reqBean, reqBean.getStepName(), webMsg, e, true); foundExThrowNoShowMsg(); - } else MesPcnException.throwBusiException("%s %s!", webMsg, e.toString()); + } else { + this.cacheException(reqBean, reqBean.getStepName(), webMsg, e, false); + MesPcnException.throwBusiException(webMsg); + } } if (CollectionUtils.isEmpty(printModel.getPrintContextList())) return; @@ -503,6 +509,7 @@ public class MesPackageNoGenerateStepService extends BaseStepService implements } @Override + @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = {ImppBusiException.class, Exception.class}) public void doForcePrint(StationRequestBean reqBean, StationResultBean resultBean, StepResult stepResult, List packageDataContextList, MesPackage packageDb) { savePackageDb(reqBean, packageDb, packageDataContextList.size(), true, false); List packageList = new ArrayList<>(); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/method/IMesPackageNoGenerateStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/method/IMesPackageNoGenerateStepService.java index ac30557..1e9b2d6 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/method/IMesPackageNoGenerateStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/method/IMesPackageNoGenerateStepService.java @@ -15,6 +15,6 @@ public interface IMesPackageNoGenerateStepService { MesPackage getMesPackage(String organizeCode, Long packageId); - @Transactional(propagation = Propagation.NESTED, rollbackFor = {ImppBusiException.class, Exception.class}) + void doForcePrint(StationRequestBean reqBean, StationResultBean resultBean, StepResult stepResult, List packageDataContextList, MesPackage packageDb); }