From 600ca579b3695759f24b326fe2a3be90073f4b2b Mon Sep 17 00:00:00 2001 From: "castle.zang" Date: Fri, 20 Dec 2024 10:24:21 +0800 Subject: [PATCH] =?UTF-8?q?fix=20bug=2044429,=E6=8A=A5=E5=B7=A5=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E4=BF=9D=E5=AD=98=E5=88=B0=E5=8A=A0=E5=B7=A5=E7=BB=93?= =?UTF-8?q?=E6=9E=9C=E6=8A=A5=E8=A1=A8=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../serviceimpl/busi/MesWorkOrderService.java | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesWorkOrderService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesWorkOrderService.java index 881d4a8..be8a7db 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesWorkOrderService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesWorkOrderService.java @@ -295,8 +295,8 @@ public class MesWorkOrderService implements IMesWorkOrderService { // 递归展开 BOM expendBomChild(organizeCode, mesPart.getPartNo(), bomVersion, bomData); - if (bomData.size() == 0) { - MesPcnException.throwMesBusiException("零件号 %s 没找找到 ERP 同步的原始 BOM 数据,请检查接口是否正常!", mesPart.getPartNo()); + if (bomData.isEmpty()) { + throw new ImppBusiException(String.format("零件号 %s 没找找到 ERP 同步的原始 BOM 数据,请检查接口是否正常!",mesPart.getPartNo())); } Iterator iterator = bomData.iterator(); @@ -426,8 +426,7 @@ public class MesWorkOrderService implements IMesWorkOrderService { if (e instanceof ImppBusiException) { msg = ((ImppBusiException) e).getErrorMsg(); } - e.printStackTrace(); - LOGGER.error("条码:{}报工失败", productionRecord.getProductSn(), e); + LOGGER.error("条码:{}报工失败,{}", productionRecord.getProductSn(), e.getMessage()); productionRecordService.updateProductionRecord(organizeCode, userName, productionRecord.getId(), msg); } } @@ -460,8 +459,7 @@ public class MesWorkOrderService implements IMesWorkOrderService { if (e instanceof ImppBusiException) { msg = ((ImppBusiException) e).getErrorMsg(); } - e.printStackTrace(); - LOGGER.error("条码:{}报工失败", productionRecord.getProductSn(), e); + LOGGER.error(String.format("条码:【%s】报工失败,原因:[%s]", productionRecord.getProductSn(), e.getMessage())); productionRecordService.updateProductionRecord(organizeCode, userName, productionRecord.getId(), msg); } @@ -526,7 +524,7 @@ public class MesWorkOrderService implements IMesWorkOrderService { DdlPreparedPack.getStringEqualPack(productionRecord.getPartNo(), "partNo", ddlPackBeanPart); MesPart mesPart = mesPartRDao.getByProperty(ddlPackBeanPart); if (null == mesPart) { - MesPcnException.throwMesBusiException("物料【%s】信息不存在", productionRecord.getPartNo()); + throw new ImppBusiException(String.format("物料【%s】信息不存在", productionRecord.getPartNo())); } List mesBoms = findBomList(organizeCode, mesPart, mesProductVersion.getAlternativePartList()); @@ -697,13 +695,13 @@ public class MesWorkOrderService implements IMesWorkOrderService { DdlPreparedPack.getStringEqualPack(workCenterCode, "workCenterCode", ddlPackBean); MesWorkCenter mesWorkCenter = mesWorkCenterRDao.getByProperty(ddlPackBean); if (Objects.isNull(mesWorkCenter)) { - MesPcnException.throwMesBusiException("产线【%s】不存在", workCenterCode); + throw new ImppBusiException(String.format("产线【%s】不存在",workCenterCode)); } List shiftList = mesShiftService.queryMesShift(organizeCode, workCenterCode); // 如果当前班次是早班 if (CollectionUtils.isEmpty(shiftList)) { - MesPcnException.throwFlowException(String.format("班次信息未维护,产线=%s"), workCenterCode); + throw new ImppBusiException(String.format("班次信息未维护,产线=%s",workCenterCode)); } List shifts = shiftList.stream().filter(mesShift -> Objects.equals(mesShift.getWorkCenterCode(), workCenterCode)).collect(Collectors.toList()); @@ -1132,7 +1130,7 @@ public class MesWorkOrderService implements IMesWorkOrderService { private MesProductVersion getProductVersion(String organizeCode,String partNo,String productVersion) { MesProductVersion mesProductVersion = mesProductVersionService.getMesProductVersion(organizeCode,partNo,productVersion); if (null == mesProductVersion) { - MesPcnException.throwMesBusiException("物料【%s】生产版本【%s】信息不存在", partNo, productVersion); + throw new ImppBusiException(String.format("物料【%s】生产版本【%s】信息不存在", partNo, productVersion)); } return mesProductVersion; }