diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesInputDefectRecordService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesInputDefectRecordService.java index 3858bcf..d034854 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesInputDefectRecordService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesInputDefectRecordService.java @@ -783,8 +783,8 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService DdlPackBean packBean = DdlPackBean.getDdlPackBean(org); DdlPreparedPack.getStringEqualPack(produceSn.getProductSn(), "sn", packBean); if (!StringUtils.isEmpty(inputModel.getWorkCellCode())) { - DdlPreparedPack.getNumEqualPack(inputModel.getWorkCenterCode(), "workCenterCode", packBean); - DdlPreparedPack.getNumEqualPack(inputModel.getWorkCellCode(), "workCellCode", packBean); + DdlPreparedPack.getStringEqualPack(inputModel.getWorkCenterCode(), "workCenterCode", packBean); + DdlPreparedPack.getStringEqualPack(inputModel.getWorkCellCode(), "workCellCode", packBean); } DdlPreparedPack.getNumEqualPack(refundFlag, "refundFlag", packBean); DdlPreparedPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.DESC.getValue()}, new String[]{"createDatetime"}, packBean); @@ -1416,19 +1416,22 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService detail.setSystemSyncDatetime(MesPcnExtConstWords.EMPTY); } - - private Integer getWorkCellType(String organizeCode, String workCenterCode, String workCellCode) { DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode); DdlPreparedPack.getStringEqualPack(workCenterCode, "workCenterCode", packBean); - DdlPreparedPack.getNumNOEqualPack(workCellCode, "workCellCode", packBean); + DdlPreparedPack.getStringEqualPack(workCellCode, "workCellCode", packBean); MesWorkCell workCell = workCellRDao.getByProperty(packBean); MesExtEnumUtil.MES_PART_INSPECTION_TYPE type = null; if (workCell != null) { + if (workCell.getType() == null) { + MesPcnException.throwFlowException(String.format("工位【%s】未维护工位类型,请检查数据", workCellCode)); + } if (workCell.getType() == MesExtEnumUtil.MES_WORK_CELL_TYPE.PRODUCT_CELL.getValue()) { type = MesExtEnumUtil.MES_PART_INSPECTION_TYPE.ONLINE_CHECK; } else if (workCell.getType() == MesExtEnumUtil.MES_WORK_CELL_TYPE.GP12_CELL.getValue()) { type = MesExtEnumUtil.MES_PART_INSPECTION_TYPE.GP12_CHECK; + } else { + MesPcnException.throwFlowException(String.format("工位【%s】维护了不支持的工位类型,请检查数据", workCellCode)); } } return type != null ? type.getValue() : null; @@ -1453,23 +1456,25 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService Map> typeMapInspection = inspectionList.stream().collect(Collectors.groupingBy(MesPartInspection::getInspectionType)); if (mesPart.getSlcGateQty() != null) { - List inspections = typeMapInspection.get(MesExtEnumUtil.MES_PART_INSPECTION_TYPE.ONLINE_CHECK.getValue()); + List inspections = typeMapInspection.get(MesExtEnumUtil.MES_PART_INSPECTION_TYPE.GP12_CHECK.getValue()); final int checkCount = inspections == null ? 0 : inspections.size(); if (mesPart.getSlcGateQty() == 1) { if (checkCount == 0) { - MesPcnException.throwFlowException("物料【%s】的SLC GATE 数量为1,至少需要一次GP12!检验", partNo); + MesPcnException.throwFlowException(String.format("物料【%s】的SLC GATE 数量为1,至少需要一次GP12检验!", partNo)); } } else if (mesPart.getSlcGateQty() == 2) { Set opUser = inspections != null ? inspections.stream().map(MesPartInspection::getCreateUser).collect(Collectors.toSet()) : new HashSet<>(); if (opUser.size() != 2) { - MesPcnException.throwFlowException("物料【%s】的SLC GATE 数量为2,需要2次不同创建人的GP12检验!", partNo); + MesPcnException.throwFlowException(String.format("物料【%s】的SLC GATE 数量为2,需要2次不同创建人的GP12检验!", partNo)); } } - } else if (mesPart.getOlGateQty() != null) { + } + + if (mesPart.getOlGateQty() != null) { List inspections = typeMapInspection.get(MesExtEnumUtil.MES_PART_INSPECTION_TYPE.ONLINE_CHECK.getValue()); final int checkCount = inspections == null ? 0 : inspections.size(); if (mesPart.getSlcGateQty() == 1 && checkCount == 0) { - MesPcnException.throwFlowException("物料【%s】的SLC GATE 数量为1,至少需要一次在线检验!", partNo); + MesPcnException.throwFlowException(String.format("物料【%s】的SLC GATE 数量为1,至少需要一次在线检验!", partNo)); } } }