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; }