From 8361a745e689c6ba8e89c7ff4de2060f85894ad2 Mon Sep 17 00:00:00 2001 From: jun Date: Tue, 27 Aug 2024 18:51:57 +0800 Subject: [PATCH] =?UTF-8?q?42786=20=E7=94=B5=E5=AD=90=E5=8C=96=E6=A3=80?= =?UTF-8?q?=E9=AA=8C=E8=B4=A8=E6=A3=80=E5=AE=8C=E6=88=90=E5=90=8E=EF=BC=8C?= =?UTF-8?q?=E8=BF=9B=E5=85=A5NC=E5=88=A4=E5=AE=9A=E5=90=8E=E6=9C=AA?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E5=88=A4=E5=AE=9A=E6=93=8D=E4=BD=9C=E4=BA=BA?= =?UTF-8?q?=2042782=20=E8=A3=85=E9=85=8D=E4=BB=B6=E6=9B=BF=E6=8D=A2?= =?UTF-8?q?=EF=BC=8C=E7=9B=AE=E5=89=8D=E6=98=AF=E9=80=89=E6=8B=A9=E5=A4=8D?= =?UTF-8?q?=E9=80=89=E6=A1=86=E5=90=8E=EF=BC=8C=E9=9C=80=E8=A6=81=E6=8C=89?= =?UTF-8?q?=E7=85=A7=E9=A1=BA=E5=BA=8F=E8=BF=9B=E8=A1=8C=E6=89=AB=E6=8F=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mes/pcn/api/base/IMesReworkTaskService.java | 6 +- .../busi/MesInputDefectRecordController.java | 6 +- .../controller/busi/MesReworkTaskController.java | 28 ++++- .../serviceimpl/base/MesReworkTaskServiceImpl.java | 126 ++++++++++++++++++--- .../serviceimpl/busi/MesNcProcessingService.java | 28 ++--- .../MesProductionAssemblyNosortContext.java | 10 ++ .../context/MesProductionAssemblySortContext.java | 17 +++ .../pcn/pojo/model/MesNcProcessingInputModel.java | 5 +- 8 files changed, 183 insertions(+), 43 deletions(-) diff --git a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/base/IMesReworkTaskService.java b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/base/IMesReworkTaskService.java index 15e2a47..c8f5536 100644 --- a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/base/IMesReworkTaskService.java +++ b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/base/IMesReworkTaskService.java @@ -30,16 +30,18 @@ public interface IMesReworkTaskService { @ApiOperation(value = "查询返工单") MesReworkTaskModel queryReworkTaskModel(MesReworkTaskRequestModel requestModel); - void reworkRecord(long detailId); + void reworkRecord(long detailId,String userName,String organizeCode); List assemblyQuery(MesReworkTaskRequestModel requestModel); boolean validateSn(MesReworkTaskRequestModel requestModel); - void assemblySnRepeat(MesReworkTaskRequestModel requestModel); + void doAssemblySnRepeat(MesReworkTaskRequestModel requestModel); void reworkSuccess(MesReworkTaskRequestModel requestModel); MesProduceSnPrintModel doPrint(MesReworkTaskRequestModel requestModel); + @ApiOperation(value = "扫描条码替换装配件") + void doAssemblySnRepeatByScan(MesReworkTaskRequestModel requestModel); } diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesInputDefectRecordController.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesInputDefectRecordController.java index a30bddf..087936c 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesInputDefectRecordController.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesInputDefectRecordController.java @@ -17,6 +17,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.*; +import java.util.Objects; + @RestController @Api(tags = "缺陷记录页面") @RequestMapping(MesCommonConstant.MES_YANFEN + "/defect_record") @@ -34,8 +36,8 @@ public class MesInputDefectRecordController { String organizeCode = !StringUtils.isEmpty(model.getOrganizeCode()) ? model.getOrganizeCode() : AuthUtil.getOrganize().getOrganizeCode(); MesPartInspectionViewModel result = inputDefectRecordService.queryPartInspection(model, organizeCode); String msg = "查询成功"; - if (!StringUtils.isEmpty(model.getFrontBack()) && model.getFrontBack().compareTo(10) == 0 && StringUtils.isEmpty(result.getPartTypePicture().getFrontPictureName())) msg = "A面图片未维护"; - if (!StringUtils.isEmpty(model.getFrontBack()) && model.getFrontBack().compareTo(20) == 0 && StringUtils.isEmpty(result.getPartTypePicture().getBackPictureName())) msg = "B面图片未维护"; + if (!StringUtils.isEmpty(model.getFrontBack()) && model.getFrontBack().compareTo(10) == 0 && (Objects.isNull(result.getPartTypePicture()) || StringUtils.isEmpty(result.getPartTypePicture().getFrontPictureName()))) msg = "A面图片未维护"; + if (!StringUtils.isEmpty(model.getFrontBack()) && model.getFrontBack().compareTo(20) == 0 && (Objects.isNull(result.getPartTypePicture()) || StringUtils.isEmpty(result.getPartTypePicture().getBackPictureName()))) msg = "B面图片未维护"; return ResultBean.success(msg).setResultObject(result); } catch (ImppBusiException imppException) { return ResultBean.fail(imppException); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesReworkTaskController.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesReworkTaskController.java index a3fe3c0..0a27994 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesReworkTaskController.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesReworkTaskController.java @@ -1,15 +1,12 @@ package cn.estsh.i3plus.ext.mes.pcn.apiservice.controller.busi; import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesReworkTaskService; -import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesShiftService; import cn.estsh.i3plus.ext.mes.pcn.pojo.constant.MesCommonConstant; import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesReworkTaskModel; import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesReworkTaskRequestModel; import cn.estsh.i3plus.pojo.base.bean.ListPager; import cn.estsh.i3plus.pojo.base.common.Pager; import cn.estsh.i3plus.pojo.mes.bean.MesProductionAssembly; -import cn.estsh.i3plus.pojo.mes.bean.MesProductionRecord; -import cn.estsh.i3plus.pojo.mes.bean.MesShift; import cn.estsh.i3plus.pojo.mes.bean.rework.MesReworkTask; import cn.estsh.impp.framework.boot.auth.AuthUtil; import cn.estsh.impp.framework.boot.exception.ImppBusiException; @@ -66,10 +63,10 @@ public class MesReworkTaskController { @PostMapping("/reworkRecord") @ApiOperation(value = "返工") - public ResultBean reworkRecord(@RequestBody Long[] inspectionDetailIds) { + public ResultBean reworkRecord(@RequestBody Long[] inspectionDetailIds,String userName,String organizeCode) { try { for (long inspectionDetailId : inspectionDetailIds) { - mesReworkTaskService.reworkRecord(inspectionDetailId); + mesReworkTaskService.reworkRecord(inspectionDetailId,userName,organizeCode); } return ResultBean.success("返工成功"); } catch (ImppBusiException imppException) { @@ -108,7 +105,7 @@ public class MesReworkTaskController { ValidatorBean.checkNotNull(requestModel.getDetailIds(), "缺陷位置id不能为空"); //mesReworkTaskService.validateSn(requestModel); - mesReworkTaskService.assemblySnRepeat(requestModel); + mesReworkTaskService.doAssemblySnRepeat(requestModel); return ResultBean.success("返工成功"); } catch (ImppBusiException imppException) { return ResultBean.fail(imppException); @@ -117,6 +114,25 @@ public class MesReworkTaskController { } } + @GetMapping("/assemblySnRepeat/byScan") + @ApiOperation(value = "扫描条码替换装配件") + public ResultBean doAssemblySnRepeatByScan(MesReworkTaskRequestModel requestModel) { + try { + // 数据校验 + ValidatorBean.checkNotNull(requestModel.getCustSn(), "客户条码不能为空"); + ValidatorBean.checkNotNull(requestModel.getSn(), "替换条码不能为空"); + ValidatorBean.checkNotNull(requestModel.getOrganizeCode(), "工厂代码不能为空"); + ValidatorBean.checkNotNull(requestModel.getDetailIds(), "缺陷位置id不能为空"); + + mesReworkTaskService.doAssemblySnRepeatByScan(requestModel); + return ResultBean.success("替换成功"); + } catch (ImppBusiException imppException) { + return ResultBean.fail(imppException); + } catch (Exception e) { + return ImppExceptionBuilder.newInstance().buildExceptionResult(e); + } + } + @GetMapping("/reworkSuccess") @ApiOperation(value = "返工成功") public ResultBean reworkSuccess(MesReworkTaskRequestModel requestModel) { diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesReworkTaskServiceImpl.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesReworkTaskServiceImpl.java index 2905c7c..3187047 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesReworkTaskServiceImpl.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesReworkTaskServiceImpl.java @@ -1,13 +1,20 @@ package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.base; import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesPartService; +import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesProdOrgExtService; import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesReworkTaskService; import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesTemplateService; +import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesNumberRuleMatchDispatchService; +import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProduceSnExtService; import cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.print.IPrintTemplateStrategyService; import cn.estsh.i3plus.ext.mes.pcn.apiservice.util.MesPcnException; +import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionAssemblyContext; +import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionAssemblyNosortContext; +import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionAssemblySortContext; import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesProduceSnPrintModel; import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesReworkTaskModel; import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesReworkTaskRequestModel; +import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords; import cn.estsh.i3plus.mes.pcn.api.iservice.busi.ISyncFuncService; import cn.estsh.i3plus.platform.common.convert.ConvertBean; import cn.estsh.i3plus.platform.common.tool.TimeTool; @@ -95,6 +102,15 @@ public class MesReworkTaskServiceImpl implements IMesReworkTaskService { @Autowired private MesProductionRecordRepository mesProductionRecordRepository; + @Autowired + private IMesProdOrgExtService prodOrgExtService; + + @Autowired + private IMesNumberRuleMatchDispatchService numberRuleMatchDispatchService; + + @Autowired + private IMesProduceSnExtService produceSnExtService; + @Override public ListPager queryReworkTask(MesReworkTask mesReworkTask, Pager pager) { String organizeCode = !StringUtils.isEmpty(mesReworkTask.getOrganizeCode())?mesReworkTask.getOrganizeCode():AuthUtil.getOrganizeCode(); @@ -156,9 +172,9 @@ public class MesReworkTaskServiceImpl implements IMesReworkTaskService { } @Override - public void reworkRecord(long detailId) { + public void reworkRecord(long detailId,String userName,String organizeCode) { - DdlPackBean packBean = DdlPackBean.getDdlPackBean(AuthUtil.getOrganizeCode()); + DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode); DdlPreparedPack.getNumEqualPack(detailId, "partInspectionDetailId", packBean); List mesReworkTaskDetailList = mesReworkTaskDetailRepository.findByHqlWhere(packBean); @@ -167,7 +183,7 @@ public class MesReworkTaskServiceImpl implements IMesReworkTaskService { } mesReworkTaskDetailList.forEach(mesReworkTaskDetail->{ mesReworkTaskDetail.setStatus(MesExtEnumUtil.REWORK_TASK_DETAIL_STATUS.REWORK_TASK_DETAIL_STATUS_20.getValue()); - ConvertBean.serviceModelUpdate(mesReworkTaskDetail,AuthUtil.getSessionUser().getUserName()); + ConvertBean.serviceModelUpdate(mesReworkTaskDetail,userName); }); mesReworkTaskDetailRepository.saveAll(mesReworkTaskDetailList); @@ -221,6 +237,7 @@ public class MesReworkTaskServiceImpl implements IMesReworkTaskService { } mesReworkTask.setStatus(MesExtEnumUtil.REWORK_TASK_STATUS.FINISH.getValue()); + ConvertBean.serviceModelUpdate(mesReworkTask,requestModel.getUserName()); mesReworkTaskRepository.save(mesReworkTask); } @@ -284,6 +301,81 @@ public class MesReworkTaskServiceImpl implements IMesReworkTaskService { return strategyService.execute(null, mesProduceSnPrintModel, null, null, null, true); } + @Override + public void doAssemblySnRepeatByScan(MesReworkTaskRequestModel requestModel) { + boolean checkResult = true; + //查询装配记录 + requestModel.setAssemblyPartStatus(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_10.getValue()); + List mesProductionAssemblies = assemblyQuery(requestModel); + if (CollectionUtils.isEmpty(mesProductionAssemblies)) MesPcnException.throwFlowException("装配件记录不存在"); + Map mesWorkCenterMap = new HashMap<>(); + //匹配装配件 + for (MesProductionAssembly assembly : mesProductionAssemblies) { + Object context = getContext(requestModel, assembly,mesWorkCenterMap); + //匹配规则 + Map result = numberRuleMatchDispatchService.matchNumberRule(requestModel.getOrganizeCode(), requestModel.getSn(), context); + //匹配成功 + if ((Boolean) result.get(MesPcnExtConstWords.RESULT)){ + // 需要变更之前的记录 + assembly.setAssemblyStatus(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_20.getValue()); + + // 需要新增一条替换条码的记录 + MesProductionAssembly mesProductionRepeatAssembly = new MesProductionAssembly(); + BeanUtils.copyProperties(assembly, mesProductionRepeatAssembly); + mesProductionRepeatAssembly.setAssemblySn(requestModel.getSn()); + mesProductionRepeatAssembly.setAssemblyStatus(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_10.getValue()); + mesProductionRepeatAssembly.setId(null); + mesProductionRepeatAssembly.setIsOrigSn(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue()); + mesProductionRepeatAssembly.setFid(UUID .randomUUID().toString()); + ConvertBean.serviceModelInitialize(mesProductionRepeatAssembly,requestModel.getUserName()); + + assembly.setRepeatAssemblySn(requestModel.getSn()); + // 原装配件记录为已解绑 + ConvertBean.serviceModelUpdate(assembly,requestModel.getUserName()); + mesProductionAssemblyRepository.update(assembly); + // 新装配件记录为已装配 + mesProductionAssemblyRepository.insert(mesProductionRepeatAssembly); + //自制件更新条码状态 + if(MesExtEnumUtil.ASSEMBLY_MATCH_TYPE.MATCH_TYPE_10.getValue() == assembly.getMatchType()){ + List produceSnList = produceSnExtService.getProduceSnList(requestModel.getOrganizeCode(), requestModel.getSn()); + if (CollectionUtils.isEmpty(produceSnList)) MesPcnException.throwFlowException("零件条码[%s]信息不存在!", requestModel.getSn()); + Optional optional = produceSnList.stream().filter(sn->sn.getId().equals(((MesProductionAssemblyContext)context).getProductSnId())).findFirst(); + if (!optional.isPresent()) MesPcnException.throwFlowException("零件条码[%s]信息不存在!", requestModel.getSn()); + // 更新新替换得条码为已装配 + updateNewSn(optional.get(),requestModel.getUserName()); + //更新原条码状态为已拆解 + updateOldSn(assembly); + } + checkResult = false; + break; + } + } + if(checkResult) MesPcnException.throwFlowException("条码信息不存在"); + /** + * 需要更新NC标记后进入的表明细状态为已处理 + */ + for (String detailId : requestModel.getDetailIds().split(",")) { + reworkRecord(Long.parseLong(detailId),requestModel.getUserName(),requestModel.getOrganizeCode()); + } + } + + private Object getContext(MesReworkTaskRequestModel requestModel, MesProductionAssembly mesProductionAssembly,Map mesWorkCenterMap) { + if(StringUtils.isEmpty(mesProductionAssembly.getWorkCenterCode())) MesPcnException.throwFlowException("产线代码不存在"); + Object context = null; + MesWorkCenter workCenterDb = null; + //产线类型 + if(!mesWorkCenterMap.containsKey(mesProductionAssembly.getWorkCenterCode())){ + workCenterDb = prodOrgExtService.getWorkCenterDb(requestModel.getOrganizeCode(), mesProductionAssembly.getWorkCenterCode()); + if(Objects.isNull(workCenterDb)) MesPcnException.throwFlowException("产线【%s】信息不存在", mesProductionAssembly.getWorkCenterCode()); + mesWorkCenterMap.put(mesProductionAssembly.getWorkCenterCode(),workCenterDb); + }else{ + workCenterDb = mesWorkCenterMap.get(mesProductionAssembly.getWorkCenterCode()); + } + if (MesExtEnumUtil.WORK_CENTER_TYPE.SORT.getValue() == workCenterDb.getCenterType()) context = new MesProductionAssemblySortContext().copy(mesProductionAssembly); + else context = new MesProductionAssemblyNosortContext().copy(mesProductionAssembly); + return context; + } + private String doGererateSerialNo(MesPart part,String organizeCode,String userName) { if(StringUtils.isEmpty(part.getProductMatchRule())) MesPcnException.throwMesBusiException("请检查零件信息,零件[%s]信息未维护零件条码编码规则!", part.getPartNo()); return syncFuncService.syncSerialNo( @@ -331,7 +423,7 @@ public class MesReworkTaskServiceImpl implements IMesReworkTaskService { * @param requestModel */ @Override - public void assemblySnRepeat(MesReworkTaskRequestModel requestModel) { + public void doAssemblySnRepeat(MesReworkTaskRequestModel requestModel) { try { // @@ -409,19 +501,21 @@ public class MesReworkTaskServiceImpl implements IMesReworkTaskService { mesProductionAssembly.setRepeatAssemblySn(sn); // 更新新替换得条码为已装配 - updateNewSn(mesProduceSn); + updateNewSn(mesProduceSn,requestModel.getUserName()); // 更新原条码状态为已拆解 + ConvertBean.serviceModelUpdate(mesProductionAssembly,requestModel.getUserName()); updateOldSn(mesProductionAssembly); // 原装配件记录为已解绑 mesProductionAssemblyRepository.update(mesProductionAssembly); // 新装配件记录为已装配 - mesProductionAssemblyRepository.save(mesProductionRepeatAssembly); + ConvertBean.serviceModelInitialize(mesProductionRepeatAssembly,requestModel.getUserName()); + mesProductionAssemblyRepository.insert(mesProductionRepeatAssembly); } /** * 需要更新NC标记后进入的表明细状态为已处理 */ for (String detailId : requestModel.getDetailIds().split(",")) { - reworkRecord(Long.valueOf(detailId)); + reworkRecord(Long.parseLong(detailId),requestModel.getUserName(),requestModel.getOrganizeCode()); } } catch (Exception e) { log.error("替换条码异常", e); @@ -430,9 +524,9 @@ public class MesReworkTaskServiceImpl implements IMesReworkTaskService { } - private void updateNewSn(MesProduceSn mesProduceSn) { + private void updateNewSn(MesProduceSn mesProduceSn,String userName) { mesProduceSn.setSnStatus(MesExtEnumUtil.PRODUCE_SN_STATUS.ASSEMBLY.getValue()); - ConvertBean.serviceModelUpdate(mesProduceSn, mesProduceSn.getCreateUser()); + ConvertBean.serviceModelUpdate(mesProduceSn, userName); mesProduceSnRepository.update(mesProduceSn); } @@ -446,7 +540,7 @@ public class MesReworkTaskServiceImpl implements IMesReworkTaskService { MesPcnException.throwFlowException(String.format("原条码信息不存在【%s】", mesProductionAssembly.getProductSn())); } - ConvertBean.serviceModelUpdate(oldProduceSn, oldProduceSn.getCreateUser()); + ConvertBean.serviceModelUpdate(oldProduceSn, mesProductionAssembly.getModifyUser()); oldProduceSn.setSnStatus(MesExtEnumUtil.PRODUCE_SN_STATUS.ASSEMBLY_BACK.getValue()); mesProduceSnRepository.update(oldProduceSn); } @@ -481,11 +575,8 @@ public class MesReworkTaskServiceImpl implements IMesReworkTaskService { DdlPackBean pictureBean = DdlPackBean.getDdlPackBean(mesReworkTask.getOrganizeCode()); DdlPreparedPack.getStringEqualPack(mesPart.getPartTypeCode(), "partTypeCode", pictureBean); - MesPartTypePicture mesPartTypePicture = mesPartTypePictureRepository.getByProperty(pictureBean); - if (mesPartTypePicture == null) { - throw new ImppBusiException(String.format("图片信息不存在,根据物料号查询[%s]", mesReworkTask.getPartNo())); - } - return mesPartTypePicture; + + return mesPartTypePictureRepository.getByProperty(pictureBean); } private MesReworkTask getMesReworkTask(MesReworkTaskRequestModel requestModel) { @@ -509,14 +600,13 @@ public class MesReworkTaskServiceImpl implements IMesReworkTaskService { DdlPreparedPack.getNumEqualPack(mesReworkTask.getId(), "pid", packBean); DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.REWORK_TASK_DETAIL_STATUS.REWORK_TASK_DETAIL_STATUS_10.getValue(), "status", packBean); - List res = mesReworkTaskDetailRepository.findByHqlWhere(packBean); - - return res; + return mesReworkTaskDetailRepository.findByHqlWhere(packBean); } private void updateMesProduceSn(MesReworkTaskRequestModel requestModel) { MesProduceSn produceSn = checkProduceSn(requestModel.getSn(), requestModel.getOrganizeCode()); produceSn.setQcStatus(MesExtEnumUtil.PRODUCE_QC_STATUS.SCRAP.getValue()); + ConvertBean.serviceModelUpdate(produceSn,requestModel.getUserName()); mesProduceSnRepository.update(produceSn); } 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 2dd6de6..ae5e574 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 @@ -345,7 +345,7 @@ public class MesNcProcessingService implements IMesNcProcessingService { checkProduceSn(sn, model.getSn()); //更新条码质量状态 sn.setQcStatus(MesExtEnumUtil.PRODUCE_QC_STATUS.SUSPICIOUS_TO_QUALIFIED.getValue()); - ConvertBean.serviceModelUpdate(sn, model.getPartInspection().getModifyUser()); + ConvertBean.serviceModelUpdate(sn, model.getUserName()); produceSnExtService.update(sn); } @@ -355,12 +355,12 @@ public class MesNcProcessingService implements IMesNcProcessingService { } model.getPartInspection().setInspectionStatus(MesExtEnumUtil.PART_INSPECTION_STATUS.QUALIFIED.getValue()); model.getPartInspection().setNcStatus(MesExtEnumUtil.PART_INSPECTION_NC_STATUS.NORMAL.getValue()); - ConvertBean.serviceModelUpdate(model.getPartInspection(), model.getPartInspection().getModifyUser()); + ConvertBean.serviceModelUpdate(model.getPartInspection(), model.getUserName()); partInspectionRepository.save(model.getPartInspection()); //移库 转正常、放行:8000移至2000 -// MesMove move = createMove(model, configService.getCfgValue(org, "UMLGO"), areaCode, org); MesMove move = createMove(model, configService.getCfgValue(org, "UMLGO"), configService.getCfgValue(org, "LGORT"), org, null == sn ? workCenterCode : sn.getWorkCenterCode(), MesExtEnumUtil.MOVE_TYPE.NORMAL_MOVE); + ConvertBean.serviceModelInitialize(move,model.getUserName()); moveRepository.save(move); } else if (type == MesExtEnumUtil.NC_TYPE.REWORK.getValue()) { @@ -386,8 +386,8 @@ public class MesNcProcessingService implements IMesNcProcessingService { reworkTask.setResponsibleParty(model.getOnlyPerson()); reworkTask.setLotNo(model.getPartInspection().getLotNo()); reworkTask.setType(model.getPartInspection().getSourceType()); - ConvertBean.serviceModelInitialize(reworkTask, model.getPartInspection().getModifyUser()); - reworkTaskRepository.save(reworkTask); + ConvertBean.serviceModelInitialize(reworkTask, model.getUserName()); + reworkTaskRepository.insert(reworkTask); //生成返工单明细 List taskDetailList = new ArrayList<>(); @@ -398,7 +398,7 @@ public class MesNcProcessingService implements IMesNcProcessingService { taskDetail.setStatus(MesExtEnumUtil.REWORK_TASK_DETAIL_STATUS.REWORK_TASK_DETAIL_STATUS_10.getValue()); taskDetail.setPartInspectionDetailId(detail.getId()); taskDetail.setOrganizeCode(org); - ConvertBean.serviceModelInitialize(taskDetail, model.getPartInspection().getModifyUser()); + ConvertBean.serviceModelInitialize(taskDetail, model.getUserName()); taskDetailList.add(taskDetail); } @@ -408,9 +408,11 @@ public class MesNcProcessingService implements IMesNcProcessingService { model.getPartInspection().setDefectTypeId(person.getId()); model.getPartInspection().setNcStatus(MesExtEnumUtil.PART_INSPECTION_NC_STATUS.REWORK.getValue()); model.getPartInspection().setReworkTaskId(reworkTask.getId()); + ConvertBean.serviceModelUpdate(model.getPartInspection(),model.getUserName()); partInspectionRepository.save(model.getPartInspection()); MesMove move = createMove(model, configService.getCfgValue(org, "UMLGO"), areaCode, org, null == sn ? workCenterCode : sn.getWorkCenterCode(), MesExtEnumUtil.MOVE_TYPE.RETURN_MOVE); + ConvertBean.serviceModelInitialize(move,model.getUserName()); moveRepository.save(move); } else if (type == MesExtEnumUtil.NC_TYPE.SCRAP.getValue()) { @@ -419,7 +421,7 @@ public class MesNcProcessingService implements IMesNcProcessingService { checkProduceSn(sn, model.getSn()); //更新条码质量状态 sn.setQcStatus(MesExtEnumUtil.PRODUCE_QC_STATUS.SCRAP.getValue()); - ConvertBean.serviceModelUpdate(sn, model.getPartInspection().getModifyUser()); + ConvertBean.serviceModelUpdate(sn, model.getUserName()); produceSnExtService.update(sn); } @@ -432,15 +434,16 @@ public class MesNcProcessingService implements IMesNcProcessingService { model.getPartInspection().setDefectTypeId(person.getId()); model.getPartInspection().setNcStatus(MesExtEnumUtil.PART_INSPECTION_NC_STATUS.SCRAP.getValue()); model.getPartInspection().setRejectQty(model.getPartInspection().getQty()); - ConvertBean.serviceModelUpdate(model.getPartInspection(), model.getPartInspection().getModifyUser()); + ConvertBean.serviceModelUpdate(model.getPartInspection(), model.getUserName()); partInspectionRepository.save(model.getPartInspection()); if (isOrder) { MesMove move = createMove(model, source, configService.getCfgValue(org, "SCRAP"), org, null == sn ? workCenterCode : sn.getWorkCenterCode(), MesExtEnumUtil.MOVE_TYPE.SCRAP_MOVE); + ConvertBean.serviceModelInitialize(move,model.getUserName()); moveRepository.save(move); } else { //移库 转报废 根据责任方库区对应关系的主数据,选择哪个责任方,就移动到哪个库区(8000移至8002/8003) MesMove move = createMove(model, configService.getCfgValue(org, "UMLGO"), areaCode, org, null == sn ? workCenterCode : sn.getWorkCenterCode(), MesExtEnumUtil.MOVE_TYPE.SCRAP_MOVE); -// MesMove move = createMove(model, configService.getCfgValue(org, "UMLGO"), configService.getCfgValue(org, "SCRAP"), org); + ConvertBean.serviceModelInitialize(move,model.getUserName()); moveRepository.save(move); } @@ -450,7 +453,7 @@ public class MesNcProcessingService implements IMesNcProcessingService { checkProduceSn(sn, model.getSn()); //更新条码质量状态 sn.setQcStatus(MesExtEnumUtil.PRODUCE_QC_STATUS.QUALIFIED.getValue()); - ConvertBean.serviceModelUpdate(sn, model.getPartInspection().getModifyUser()); + ConvertBean.serviceModelUpdate(sn, model.getUserName()); produceSnExtService.update(sn); } @@ -460,13 +463,13 @@ public class MesNcProcessingService implements IMesNcProcessingService { } model.getPartInspection().setInspectionStatus(MesExtEnumUtil.PART_INSPECTION_STATUS.QUALIFIED.getValue()); model.getPartInspection().setNcStatus(MesExtEnumUtil.PART_INSPECTION_NC_STATUS.RELEASE.getValue()); - ConvertBean.serviceModelUpdate(model.getPartInspection(), model.getPartInspection().getModifyUser()); + ConvertBean.serviceModelUpdate(model.getPartInspection(), model.getUserName()); partInspectionRepository.save(model.getPartInspection()); //移库 转正常、放行:8000移至2000 -// MesMove move = createMove(model, configService.getCfgValue(org, "UMLGO"), areaCode, org); MesMove move = createMove(model, configService.getCfgValue(org, "UMLGO"), configService.getCfgValue(org, "LGORT"), org, null == sn ? workCenterCode : sn.getWorkCenterCode(), MesExtEnumUtil.MOVE_TYPE.NORMAL_MOVE); + ConvertBean.serviceModelInitialize(move,model.getUserName()); moveRepository.save(move); } @@ -531,7 +534,6 @@ public class MesNcProcessingService implements IMesNcProcessingService { move.setPartInspectionId(model.getPartInspection().getId()); move.setProductSn(model.getSn()); move.setWorkCenter(prodOrgExtService.getErpWorkCenterCode(org, workCenterCode)); - ConvertBean.serviceModelInitialize(move, model.getPartInspection().getModifyUser()); return move; } } diff --git a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesProductionAssemblyNosortContext.java b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesProductionAssemblyNosortContext.java index 102e5f5..6fc7c3b 100644 --- a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesProductionAssemblyNosortContext.java +++ b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesProductionAssemblyNosortContext.java @@ -3,6 +3,7 @@ package cn.estsh.i3plus.ext.mes.pcn.pojo.context; import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords; import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil; import cn.estsh.i3plus.pojo.mes.bean.MesAssemblyNosortCfg; +import cn.estsh.i3plus.pojo.mes.bean.MesProductionAssembly; import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil; import io.swagger.annotations.ApiParam; import lombok.Data; @@ -116,4 +117,13 @@ public class MesProductionAssemblyNosortContext extends MesProductionAssemblyCon return this; } + public MesProductionAssemblyNosortContext copy(MesProductionAssembly mesProductionAssembly) { + BeanUtils.copyProperties(mesProductionAssembly, this); + if (StringUtils.isEmpty(this.routeSeq)) this.routeSeq = MesPcnExtConstWords.ZERO; + this.assemblyStatus = MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_30.getValue(); + if (MesExtEnumUtil.ASSEMBLY_MATCH_TYPE.MATCH_TYPE_50.getValue() == this.matchType || MesExtEnumUtil.ASSEMBLY_MATCH_TYPE.MATCH_TYPE_60.getValue() == this.matchType) + this.assemblyStatus = MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_10.getValue(); + return this; + } + } diff --git a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesProductionAssemblySortContext.java b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesProductionAssemblySortContext.java index 10239f7..91b749a 100644 --- a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesProductionAssemblySortContext.java +++ b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesProductionAssemblySortContext.java @@ -146,4 +146,21 @@ public class MesProductionAssemblySortContext extends MesProductionAssemblyConte return this; } + public MesProductionAssemblySortContext copy(MesProductionAssembly productionAssembly) { + + if (null != productionAssembly) BeanUtils.copyProperties(productionAssembly, this); + + if (StringUtils.isEmpty(this.routeSeq)) this.routeSeq = MesPcnExtConstWords.ZERO; + + if (StringUtils.isEmpty(this.isSkip)) this.isSkip = CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(); + + if (this.assemblyStatus.compareTo(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_30.getValue()) == 0 && + (MesExtEnumUtil.ASSEMBLY_MATCH_TYPE.MATCH_TYPE_50.getValue() == this.matchType || MesExtEnumUtil.ASSEMBLY_MATCH_TYPE.MATCH_TYPE_60.getValue() == this.matchType)) + this.assemblyStatus = MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_10.getValue(); + + if (this.assemblyStatus.compareTo(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_30.getValue()) != 0) this.isResetScan = CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(); + + return this; + } + } diff --git a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/model/MesNcProcessingInputModel.java b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/model/MesNcProcessingInputModel.java index 28f0f95..390d34b 100644 --- a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/model/MesNcProcessingInputModel.java +++ b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/model/MesNcProcessingInputModel.java @@ -1,10 +1,10 @@ package cn.estsh.i3plus.ext.mes.pcn.pojo.model; import cn.estsh.i3plus.pojo.mes.bean.MesDefectType; -import cn.estsh.i3plus.pojo.mes.bean.MesPart; import cn.estsh.i3plus.pojo.mes.bean.MesPartSap; import cn.estsh.i3plus.pojo.mes.bean.nc.MesPartInspection; import cn.estsh.i3plus.pojo.mes.bean.nc.MesPartInspectionDetail; +import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiParam; import lombok.Data; @@ -50,5 +50,6 @@ public class MesNcProcessingInputModel { @ApiParam("NC-零件检测-单据") private MesPartInspection partInspection; - + @ApiModelProperty("操作人") + private String userName; }