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 ba628c2..4119470 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 @@ -42,6 +42,7 @@ import org.springframework.util.StringUtils; import java.util.*; import java.util.stream.Collectors; +import java.util.stream.Stream; /** * @Description : @@ -136,7 +137,7 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService //获取NC-零件检测-单据 MesPartInspection partInspection = null; Integer sourceType; - if (!StringUtils.isEmpty(model.getSn())) { + if (!StringUtils.isEmpty(model.getSn()) && StringUtils.isEmpty(model.getLotNo())) { // 数据校验 ValidatorBean.checkNotNull(model.getFrontBack(), "正反面不能为空"); //检查条码 @@ -164,8 +165,11 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService if(!Objects.isNull(model.getId())){ partInspection = getPartInspectionByPartAndLot(model, model.getOrganizeCode()); } - - sourceType = MesExtEnumUtil.PART_INSPECTION_SOURCE_TYPE.LOT.getValue(); + if (!StringUtils.isEmpty(model.getSn())) { + sourceType = MesExtEnumUtil.PART_INSPECTION_SOURCE_TYPE.IMPORT.getValue(); + } else { + sourceType = MesExtEnumUtil.PART_INSPECTION_SOURCE_TYPE.LOT.getValue(); + } } //检查零件类型与图片对应关系 @@ -790,13 +794,15 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService * @return */ private MesPartInspection getPartInspectionByPartAndLot(MesPartInspectionInputModel inputModel, String org) { + + List list = Stream.of(MesExtEnumUtil.PART_INSPECTION_SOURCE_TYPE.LOT.getValue(),MesExtEnumUtil.PART_INSPECTION_SOURCE_TYPE.IMPORT.getValue()).collect(Collectors.toList()); //根据扫描的条码查询条码是否存在 DdlPackBean packBean = DdlPackBean.getDdlPackBean(org); DdlPreparedPack.getNumEqualPack(inputModel.getId(), "id", packBean); DdlPreparedPack.getStringEqualPack(inputModel.getPartNo(), "partNo", packBean); DdlPreparedPack.getStringEqualPack(inputModel.getLotNo(), "lotNo", packBean); DdlPreparedPack.getNegativeNumEqualPack(inputModel.getQty(), "qty", packBean); - DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.PART_INSPECTION_SOURCE_TYPE.LOT.getValue(), "sourceType", packBean); + DdlPreparedPack.getInPackList(list, "sourceType", packBean); DdlPreparedPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.DESC.getValue()}, new String[]{"createDatetime"}, packBean); MesPartInspection partInspection = partInspectionRepository.getByProperty(packBean); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesNcProcessingService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesNcProcessingService.java index 5b6a4fa..064907f 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesNcProcessingService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesNcProcessingService.java @@ -789,7 +789,7 @@ public class MesNcProcessingService implements IMesNcProcessingService { reworkTask.setPartName(model.getPartInspection().getPartName()); reworkTask.setPartInspectionId(model.getPartInspection().getId()); reworkTask.setOrganizeCode(org); - reworkTask.setResponsibleParty(model.getOnlyPerson()); + reworkTask.setResponsibleParty(mesNcPersonModel.getOnlyPerson()); reworkTask.setDisassembleType(MesPcnExtConstWords.ZERO); reworkTask.setLotNo(model.getPartInspection().getLotNo()); reworkTask.setType(model.getPartInspection().getSourceType()); @@ -830,7 +830,7 @@ public class MesNcProcessingService implements IMesNcProcessingService { } else if (type == MesExtEnumUtil.PART_INSPECTION_NC_STATUS.SCRAP.getValue()) { //报废时设置责任人 - model.getPartInspection().setResponsibleParty(model.getOnlyPerson()); + model.getPartInspection().setResponsibleParty(mesNcPersonModel.getOnlyPerson()); //model.getPartInspection().setDefectTypeId(person.getId()); model.getPartInspection().setNcStatus(MesExtEnumUtil.PART_INSPECTION_NC_STATUS.SCRAP.getValue()); model.getPartInspection().setRejectQty(model.getPartInspection().getQty()); @@ -852,7 +852,9 @@ public class MesNcProcessingService implements IMesNcProcessingService { DdlPackBean partyPackBean = DdlPackBean.getDdlPackBean(org); DdlPreparedPack.getStringEqualPack(mesNcPersonModel.getOnlyPerson(), "responsibleParty", partyPackBean); MesOrg mesOrg = mesOrgRDao.getByProperty(partyPackBean); - + if (mesOrg ==null) { + throw new ImppBusiException(String.format("责任人【%s】不存在", mesNcPersonModel.getOnlyPerson())); + } mesPartInspectionPerson.setResponsibleParty(mesOrg.getResponsibleParty()); ConvertBean.serviceModelInitialize(mesPartInspectionPerson, model.getUserName()); personList.add(mesPartInspectionPerson);