diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesNcProcessingController.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesNcProcessingController.java index da9fb11..9e6cf8c 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesNcProcessingController.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesNcProcessingController.java @@ -85,8 +85,10 @@ public class MesNcProcessingController { // 数据校验 ValidatorBean.checkNotNull(model.getPartInspection(), "单据不能为空"); ValidatorBean.checkNotNull(model.getPartInspectionDetailList(), "单据明细不能为空"); - if (model.getType() != 10 && model.getType() != 40) { + if (model.getType() == MesExtEnumUtil.NC_TYPE.REWORK.getValue() + || model.getType() == MesExtEnumUtil.NC_TYPE.SCRAP.getValue()) { ValidatorBean.checkNotNull(model.getPerson(), "责任人不能为空"); + ValidatorBean.checkNotNull(model.getInventoryLocationCode(), "区域代码不能为空"); } String description = MesExtEnumUtil.NC_TYPE.valueOfDescription(model.getType()); 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 b1303e5..9eba218 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 @@ -32,10 +32,7 @@ import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; import org.springframework.util.StringUtils; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.stream.Collectors; /** @@ -203,9 +200,17 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService MesPartInspection partInspection; //返工单返修完成,需可疑品移正常库 + if (model.isTransferFlg()) { + String srcLocate = configService.getCfgValue(org, "UMLGO"); + if(!Objects.isNull(model.getPartInspection())){ + MesMove mesMove = getMesMove(model, org); + if(!Objects.isNull(mesMove)){ + srcLocate = mesMove.getUmlgo(); + } + } //移库 - MesMove move = createMove(model, configService.getCfgValue(org, "UMLGO"), configService.getCfgValue(org, "LGORT"), org); + MesMove move = createMove(model,srcLocate,configService.getCfgValue(org, "LGORT"), org); moveRepository.save(move); } @@ -270,9 +275,17 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService ConvertBean.serviceModelInitialize(produceSn, AuthUtil.getSessionUser().getUserName()); produceSnRepository.save(produceSn); } + //移库 + String srcLocate; + MesMove mesMove = getMesMove(model, org); + if(!Objects.isNull(mesMove)){ + srcLocate = mesMove.getUmlgo(); + }else{ + srcLocate= configService.getCfgValue(org, "UMLGO"); + } //移库 - MesMove move = createMove(model, configService.getCfgValue(org, "UMLGO"), configService.getCfgValue(org, "LGORT"), org); + MesMove move = createMove(model,srcLocate,configService.getCfgValue(org, "LGORT"), org); moveRepository.save(move); } } @@ -285,7 +298,7 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService if (StringUtils.isEmpty(model.getPartInspection())) { partInspection = createPartInspection(model, MesExtEnumUtil.PART_INSPECTION_STATUS.FAIL.getValue(), org); - partInspectionRepository.save(partInspection); + model.setPartInspection(partInspectionRepository.save(partInspection)); List defectTypeNoExitList = new ArrayList<>(); for (MesPartInspectionDetail detail : model.getPartInspectionDetailList()) { @@ -381,6 +394,14 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService } } + private MesMove getMesMove(MesPartInspectionInputModel model, String org) { + DdlPackBean packBean = DdlPackBean.getDdlPackBean(org); + DdlPreparedPack.getNumEqualPack(model.getPartInspection().getId(),"partInspectionId",packBean); + DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.MOVE_TYPE.RETURN_MOVE.getValue(),"moveType",packBean); + MesMove mesMove = moveRepository.getByProperty(packBean); + return mesMove; + } + /** * 获取NC-零件检测-单据 * @@ -590,6 +611,7 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService move.setZrsum(zrsum); move.setPostDate(TimeTool.getToday()); move.setPostTime(TimeTool.getTimeShortWithColon()); + move.setPartInspectionId(model.getPartInspection().getId()); move.setMoveType(MesExtEnumUtil.MOVE_TYPE.SUSPICIOUS_MOVE.getValue()); ConvertBean.serviceModelInitialize(move, AuthUtil.getSessionUser().getUserName()); return move; 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 2ca9a9f..5d3a3dd 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 @@ -476,6 +476,7 @@ public class MesNcProcessingService implements IMesNcProcessingService { move.setPostDate(TimeTool.getToday()); move.setPostTime(TimeTool.getTimeShortWithColon()); move.setMoveType(moveType.getValue()); + move.setPartInspectionId(model.getPartInspection().getId()); ConvertBean.serviceModelInitialize(move, AuthUtil.getSessionUser().getUserName()); return move; }