From 55984cee69223b008f04b7f1c0465ff3371a49fb Mon Sep 17 00:00:00 2001 From: "xiangwei.zhang" <752558143@qq.com> Date: Sat, 14 Sep 2024 15:50:22 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A4=E6=96=AD=E5=8F=AF=E7=96=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pcn/api/busi/IMesInputDefectRecordService.java | 7 ++++ .../busi/MesInputDefectRecordController.java | 29 ++++++++++++++ .../busi/MesInputDefectRecordService.java | 44 ++++++++++++++++++++++ 3 files changed, 80 insertions(+) diff --git a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesInputDefectRecordService.java b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesInputDefectRecordService.java index bbe797e..3f93913 100644 --- a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesInputDefectRecordService.java +++ b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesInputDefectRecordService.java @@ -3,6 +3,7 @@ package cn.estsh.i3plus.ext.mes.pcn.api.busi; import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesPartInspectionInputModel; import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesPartInspectionViewModel; import cn.estsh.i3plus.pojo.mes.bean.MesPartTypeDefect; +import cn.estsh.i3plus.pojo.mes.bean.MesProduceSn; import cn.estsh.i3plus.pojo.mes.bean.nc.MesPartInspectionDetail; import io.swagger.annotations.ApiOperation; @@ -28,6 +29,12 @@ public interface IMesInputDefectRecordService { @ApiOperation(value = "完成质检") void savePartInspection(MesPartInspectionInputModel model, String org); + @ApiOperation(value = "客退品") + MesProduceSn customerBack(String organizeCode, String sn, String userName); + + @ApiOperation(value = "客退品提交") + void customerBackCommit(String organizeCode, String sn, String userName); + @ApiOperation(value = "可疑品录入") void saveSusPartInspection(MesPartInspectionInputModel model, String org); } 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 087936c..8e83dd8 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 @@ -5,6 +5,7 @@ import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesInputDefectRecordService; import cn.estsh.i3plus.ext.mes.pcn.pojo.constant.MesCommonConstant; import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesPartInspectionInputModel; import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesPartInspectionViewModel; +import cn.estsh.i3plus.pojo.mes.bean.MesProduceSn; import cn.estsh.impp.framework.boot.auth.AuthUtil; import cn.estsh.impp.framework.boot.exception.ImppBusiException; import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder; @@ -87,5 +88,33 @@ public class MesInputDefectRecordController { } } + @PostMapping("/customerBack") + @ApiOperation(value = "客退品") + public ResultBean customerBack(@RequestBody MesPartInspectionInputModel model) { + try { +// inputDefectRecordService.savePartInspection(model, "CK01"); + MesProduceSn mesProduceSn = inputDefectRecordService.customerBack(model.getOrganizeCode(), model.getSn(), model.getUserInfo()); + return ResultBean.success("客退品已完成,请继续").setResultObject(mesProduceSn); + } catch (ImppBusiException imppException) { + return ResultBean.fail(imppException); + } catch (Exception e) { + return ImppExceptionBuilder.newInstance().buildExceptionResult(e); + } + } + + @PostMapping("/customerBackCommit") + @ApiOperation(value = "客退品提交") + public ResultBean customerBackCommit(@RequestBody MesPartInspectionInputModel model) { + + try { +// inputDefectRecordService.savePartInspection(model, "CK01"); + inputDefectRecordService.customerBackCommit(model.getOrganizeCode(), model.getSn(), model.getUserInfo()); + return ResultBean.success("客退品提交已完成,请继续"); + } catch (ImppBusiException imppException) { + return ResultBean.fail(imppException); + } catch (Exception e) { + return ImppExceptionBuilder.newInstance().buildExceptionResult(e); + } + } } 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 a8572bf..424f70c 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 @@ -4,6 +4,7 @@ import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesProdOrgExtService; import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesConfigService; import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesInputDefectRecordService; import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProduceSnExtService; +import cn.estsh.i3plus.ext.mes.pcn.apiservice.util.MesPcnException; import cn.estsh.i3plus.ext.mes.pcn.pojo.constant.MesCommonConstant; import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesPartInspectionInputModel; import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesPartInspectionViewModel; @@ -28,6 +29,8 @@ import cn.estsh.impp.framework.boot.exception.ImppBusiException; import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder; import cn.estsh.impp.framework.boot.util.ResultBean; import cn.estsh.impp.framework.boot.util.ValidatorBean; +import com.codepoetics.protonpack.collectors.CollectorUtils; +import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -97,6 +100,9 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService @Autowired private MesProductVersionRepository productVersionRepository; + @Autowired + private MesProduceSnLogRepository produceSnLogRepository; + @Override public MesPartInspectionViewModel queryPartInspection(MesPartInspectionInputModel inputModel, String org) { @@ -902,4 +908,42 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService moveRepository.save(move); } + @ApiOperation(value = "客退品查询") + public MesProduceSn customerBack(String organizeCode, String sn, String userName) { + List produceSnList = produceSnExtService.getProduceSnList(organizeCode, sn); + if (CollectionUtils.isEmpty(produceSnList)) { + MesPcnException.throwFlowException("条码不存在"); + } + MesProduceSn mesProduceSn = produceSnList.get(0); + + + return mesProduceSn; + } + + @ApiOperation(value = "客退品提交") + public void customerBackCommit(String organizeCode, String sn, String userName) { + + List produceSnList = produceSnExtService.getProduceSnList(organizeCode, sn); + if (CollectionUtils.isEmpty(produceSnList)) { + MesPcnException.throwFlowException("条码不存在"); + } + MesProduceSn produceSn = produceSnList.get(0); + + MesProduceSnLog produceSnLog = new MesProduceSnLog(); + + if (Objects.equals(produceSn.getSnStatus(), MesExtEnumUtil.PRODUCE_SN_STATUS.OFFLINE.getValue())) { + MesPcnException.throwFlowException("条码状态不为已发运"); + } + produceSn.setSnStatus(MesExtEnumUtil.PRODUCE_SN_STATUS.OFFLINE.getValue()); + ConvertBean.serviceModelUpdate(produceSn, userName); + produceSnExtService.update(produceSn); + + produceSnLog.setProductSn(produceSn.getProductSn()); + produceSnLog.setCustSn(produceSn.getCustSn()); + produceSnLog.setOriProductSn(null); + produceSnLog.setBeforeSnStatus(MesExtEnumUtil.PRODUCE_SN_STATUS.SHIPPED.getValue()); + produceSnLog.setAfterSnStatus(MesExtEnumUtil.PRODUCE_SN_STATUS.OFFLINE.getValue()); + ConvertBean.serviceModelInitialize(produceSnLog, userName); + produceSnLogRepository.save(produceSnLog); + } }