From 11348964e4ae2e460eaec5ee6f75dd7bd1daafff Mon Sep 17 00:00:00 2001 From: "jhforever.wang@estsh.com" Date: Tue, 18 Feb 2025 14:07:31 +0800 Subject: [PATCH] =?UTF-8?q?=2045151=20PCN:=E7=94=B5=E5=AD=90=E5=8C=96?= =?UTF-8?q?=E6=A3=80=E9=AA=8C=E6=93=8D=E4=BD=9C=E4=BC=9A=E7=AA=81=E7=84=B6?= =?UTF-8?q?=E9=80=80=E5=87=BA=E7=99=BB=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pcn/api/busi/IMesInputDefectRecordService.java | 5 +- .../mes/pcn/api/busi/IMesNcProcessingService.java | 12 +- .../busi/MesInputDefectRecordController.java | 22 +-- .../controller/busi/MesNcProcessingController.java | 15 +- .../busi/MesInputDefectRecordService.java | 211 ++++++++++----------- 5 files changed, 125 insertions(+), 140 deletions(-) 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 3f93913..6a1b4d1 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 @@ -4,7 +4,6 @@ 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; import java.util.List; @@ -20,14 +19,14 @@ public interface IMesInputDefectRecordService { @ApiOperation(value = "查询页面信息") - MesPartInspectionViewModel queryPartInspection(MesPartInspectionInputModel model, String org); + MesPartInspectionViewModel queryPartInspection(MesPartInspectionInputModel model); @ApiOperation(value = "零件类型缺陷类型对应关系信息") List queryPartTypeDefect(String serialNumber, String defectLocation, boolean flg, Integer frontBack, String org); @ApiOperation(value = "完成质检") - void savePartInspection(MesPartInspectionInputModel model, String org); + void savePartInspection(MesPartInspectionInputModel model); @ApiOperation(value = "客退品") MesProduceSn customerBack(String organizeCode, String sn, String userName); diff --git a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesNcProcessingService.java b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesNcProcessingService.java index 8472b8e..93df197 100644 --- a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesNcProcessingService.java +++ b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesNcProcessingService.java @@ -20,21 +20,19 @@ import java.util.List; **/ public interface IMesNcProcessingService { - @ApiOperation(value = "查询NC-零件检测-单据") - public ListPager queryPartInspectionByPager(MesPartInspection partInspection, Pager pager); + ListPager queryPartInspectionByPager(MesPartInspection partInspection, Pager pager); @ApiOperation(value = "查询NC-零件检测-单据") - public MesNcProcessingModel queryPartInspection(MesPartInspection partInspection); + MesNcProcessingModel queryPartInspection(MesPartInspection partInspection); @ApiOperation(value = "查询责任人") - public List queryPerson(String org); + List queryPerson(String org); @ApiOperation(value = "查询标记不良的物料及批次") - public ListPager queryPartLot(String partNo, String lot, String org, Pager pager); + ListPager queryPartLot(String partNo, String lot, String org, Pager pager); @ApiOperation(value = "NC处理") - public void saveNc(MesNcProcessingInputModel model, String org, boolean isOrder); - + void saveNc(MesNcProcessingInputModel model, String org, boolean isOrder); } 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 2d41c6f..6891cd8 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 @@ -7,7 +7,6 @@ import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesPartInspectionInputModel; import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesPartInspectionViewModel; import cn.estsh.i3plus.platform.common.tool.MathOperation; 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; import cn.estsh.impp.framework.boot.util.ResultBean; @@ -35,8 +34,8 @@ public class MesInputDefectRecordController { public ResultBean queryPartInspection(@RequestBody MesPartInspectionInputModel model) { try { - String organizeCode = !StringUtils.isEmpty(model.getOrganizeCode()) ? model.getOrganizeCode() : AuthUtil.getOrganize().getOrganizeCode(); - MesPartInspectionViewModel result = inputDefectRecordService.queryPartInspection(model, organizeCode); + ValidatorBean.checkNotNull(model.getOrganizeCode(), "工厂不能为空"); + MesPartInspectionViewModel result = inputDefectRecordService.queryPartInspection(model); String msg = "查询成功"; 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面图片未维护"; @@ -50,16 +49,14 @@ public class MesInputDefectRecordController { @GetMapping("/query-part-type-defect") @ApiOperation(value = "查询零件类型缺陷类型对应关系") - public ResultBean queryPartTypeDefect(String partNo, String defectLocation, boolean flg, Integer frontBack,String organizeCode) { + public ResultBean queryPartTypeDefect(String partNo, String defectLocation, boolean flg, Integer frontBack, String organizeCode) { try { - // 数据校验 ValidatorBean.checkNotNull(partNo, "物料号不能为空"); ValidatorBean.checkNotNull(defectLocation, "位置不能为空"); ValidatorBean.checkNotNull(frontBack, "正反面不能为空"); - -// return ResultBean.success("查询成功").setResultList(inputDefectRecordService.queryPartTypeDefect(partNo, defectLocationCode, flg, frontBack, "2031")); - return ResultBean.success("查询成功").setResultList(inputDefectRecordService.queryPartTypeDefect(partNo, defectLocation, flg, frontBack,!StringUtils.isEmpty(organizeCode)?organizeCode:AuthUtil.getOrganizeCode())); + ValidatorBean.checkNotNull(organizeCode, "工厂不能为空"); + return ResultBean.success("查询成功").setResultList(inputDefectRecordService.queryPartTypeDefect(partNo, defectLocation, flg, frontBack, organizeCode)); } catch (ImppBusiException imppException) { return ResultBean.fail(imppException); } catch (Exception e) { @@ -72,15 +69,14 @@ public class MesInputDefectRecordController { public ResultBean savePartInspection(@RequestBody MesPartInspectionInputModel model) { try { - + ValidatorBean.checkNotNull(model.getOrganizeCode(), "工厂不能为空"); + ValidatorBean.checkNotNull(model.getUserInfo(), "操作人不能为空"); if (StringUtils.isEmpty(model.getSn()) && (StringUtils.isEmpty(model.getPartNo()) || StringUtils.isEmpty(model.getLotNo()) || StringUtils.isEmpty(model.getQty()) || MathOperation.compareTo(model.getQty(), new Double(0)) == 0)) { - throw new ImppBusiException("条码为空或零件号+批次+数量为空"); } -// inputDefectRecordService.savePartInspection(model, "CK01"); - inputDefectRecordService.savePartInspection(model, !StringUtils.isEmpty(model.getOrganizeCode())?model.getOrganizeCode():AuthUtil.getOrganizeCode()); + inputDefectRecordService.savePartInspection(model); return ResultBean.success("质检已完成,请继续"); } catch (ImppBusiException imppException) { return ResultBean.fail(imppException); @@ -94,7 +90,6 @@ public class MesInputDefectRecordController { 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) { @@ -109,7 +104,6 @@ public class MesInputDefectRecordController { 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) { 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 cdf87d5..6e6d121 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 @@ -8,7 +8,6 @@ import cn.estsh.i3plus.pojo.base.bean.ListPager; import cn.estsh.i3plus.pojo.base.common.Pager; import cn.estsh.i3plus.pojo.mes.bean.nc.MesPartInspection; import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil; -import cn.estsh.impp.framework.boot.auth.AuthUtil; import cn.estsh.impp.framework.boot.exception.ImppBusiException; import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder; import cn.estsh.impp.framework.boot.util.ResultBean; @@ -36,7 +35,7 @@ public class MesNcProcessingController { public ResultBean queryPartInspectionByPager(MesPartInspection partInspection, Pager pager) { try { - + ValidatorBean.checkNotNull(partInspection.getOrganizeCode(), "工厂不能为空"); partInspection.setOrganizeCode(partInspection.getOrganizeCode()); ListPager partInspectionListPager = ncProcessingService.queryPartInspectionByPager(partInspection, pager); return ResultBean.success("查询成功").setListPager(partInspectionListPager); @@ -52,8 +51,7 @@ public class MesNcProcessingController { public ResultBean queryPartInspection(MesPartInspection partInspection) { try { - - partInspection.setOrganizeCode(!StringUtils.isEmpty(partInspection.getOrganizeCode())?partInspection.getOrganizeCode():AuthUtil.getOrganizeCode()); + ValidatorBean.checkNotNull(partInspection.getOrganizeCode(), "工厂不能为空"); return ResultBean.success("查询成功").setResultObject(ncProcessingService.queryPartInspection(partInspection)); } catch (ImppBusiException imppException) { return ResultBean.fail(imppException); @@ -67,8 +65,8 @@ public class MesNcProcessingController { public ResultBean queryPerson(String organizeCode) { try { - - return ResultBean.success("查询成功").setResultList(ncProcessingService.queryPerson(!StringUtils.isEmpty(organizeCode)?organizeCode:AuthUtil.getOrganizeCode())); + ValidatorBean.checkNotNull(organizeCode, "工厂不能为空"); + return ResultBean.success("查询成功").setResultList(ncProcessingService.queryPerson(organizeCode)); } catch (ImppBusiException imppException) { return ResultBean.fail(imppException); } catch (Exception e) { @@ -82,7 +80,8 @@ public class MesNcProcessingController { public ResultBean saveNc(@RequestBody MesNcProcessingInputModel model) { try { - // 数据校验 + ValidatorBean.checkNotNull(model.getOrganizeCode(), "工厂不能为空"); + ValidatorBean.checkNotNull(model.getUserName(), "操作人不能为空"); ValidatorBean.checkNotNull(model.getPartInspection(), "单据不能为空"); ValidatorBean.checkNotNull(model.getPartInspectionDetailList(), "单据明细不能为空"); if (model.getType() == MesExtEnumUtil.NC_TYPE.REWORK.getValue() @@ -102,7 +101,7 @@ public class MesNcProcessingController { if (CollectionUtils.isEmpty(model.getPartInspectionDetailList())) { throw new ImppBusiException("不存在可疑信息,请检查数据"); } - ncProcessingService.saveNc(model, !StringUtils.isEmpty(model.getOrganizeCode())? model.getOrganizeCode() : AuthUtil.getOrganizeCode(), false); + ncProcessingService.saveNc(model, model.getOrganizeCode(), false); return ResultBean.success("NC处理成功"); } 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/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 9ecfd93..f9ba448 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 @@ -28,7 +28,6 @@ import cn.estsh.i3plus.pojo.mes.bean.rework.MesReworkTaskDetail; import cn.estsh.i3plus.pojo.mes.model.GenSerialNoModel; import cn.estsh.i3plus.pojo.mes.repository.*; import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil; -import cn.estsh.impp.framework.boot.auth.AuthUtil; import cn.estsh.impp.framework.boot.exception.ImppBusiException; import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder; import cn.estsh.impp.framework.boot.util.ResultBean; @@ -43,7 +42,6 @@ import org.springframework.util.StringUtils; import java.util.*; import java.util.stream.Collectors; -import java.util.stream.Stream; /** * @Description : @@ -131,54 +129,54 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService private MesPartProdGroupRepository mesPartProdGroupRao; @Override - public MesPartInspectionViewModel queryPartInspection(MesPartInspectionInputModel inputModel, String org) { + public MesPartInspectionViewModel queryPartInspection(MesPartInspectionInputModel model) { //检查物料 MesPart part; //获取NC-零件检测-单据 MesPartInspection partInspection = null; - Integer sourceType = null; - if (!StringUtils.isEmpty(inputModel.getSn())) { + Integer sourceType; + if (!StringUtils.isEmpty(model.getSn())) { // 数据校验 - ValidatorBean.checkNotNull(inputModel.getFrontBack(), "正反面不能为空"); + ValidatorBean.checkNotNull(model.getFrontBack(), "正反面不能为空"); //检查条码 - MesProduceSn produceSn = checkProduceSn(inputModel.getSn(), org); + MesProduceSn produceSn = checkProduceSn(model.getSn(), model.getOrganizeCode()); //获取NC-零件检测-单据 - partInspection = getPartInspection(produceSn,inputModel, org); + partInspection = getPartInspection(produceSn, model, model.getOrganizeCode()); //检查物料 - part = checkPart(produceSn, org); + part = checkPart(produceSn, model.getOrganizeCode()); sourceType = MesExtEnumUtil.PART_INSPECTION_SOURCE_TYPE.SINGLE.getValue(); } else { // 数据校验 - ValidatorBean.checkNotNull(inputModel.getPartNo(), "物料不能为空"); - ValidatorBean.checkNotNull(inputModel.getLotNo(), "批次不能为空"); - ValidatorBean.checkNotNull(inputModel.getFrontBack(), "正反面不能为空"); - ValidatorBean.checkNotNull(inputModel.getQty(), "数量不能为空"); + ValidatorBean.checkNotNull(model.getPartNo(), "物料不能为空"); + ValidatorBean.checkNotNull(model.getLotNo(), "批次不能为空"); + ValidatorBean.checkNotNull(model.getFrontBack(), "正反面不能为空"); + ValidatorBean.checkNotNull(model.getQty(), "数量不能为空"); //检查物料 - part = checkPartByPartNo(inputModel.getPartNo(), org); + part = checkPartByPartNo(model.getPartNo(), model.getOrganizeCode()); //获取NC-零件检测-单据 - if(!Objects.isNull(inputModel.getId())){ - partInspection = getPartInspectionByPartAndLot(inputModel, org); + if(!Objects.isNull(model.getId())){ + partInspection = getPartInspectionByPartAndLot(model, model.getOrganizeCode()); } sourceType = MesExtEnumUtil.PART_INSPECTION_SOURCE_TYPE.LOT.getValue(); } //检查零件类型与图片对应关系 - MesPartTypePicture partTypePicture = checkPartTypePicture(part, org); + MesPartTypePicture partTypePicture = checkPartTypePicture(part, model.getOrganizeCode()); //构造返回信息 - MesPartInspectionViewModel model = getModel(partInspection, part, partTypePicture, inputModel, sourceType, org); - model.setSourceType(sourceType); - model.setTransferFlg(inputModel.isTransferFlg()); + MesPartInspectionViewModel result = getModel(partInspection, part, partTypePicture, model, sourceType); + result.setSourceType(sourceType); + result.setTransferFlg(model.isTransferFlg()); - return model; + return result; } /** @@ -235,12 +233,11 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService * 完成质检-保存不良记录 * * @param model - * @param org */ @Override - public void savePartInspection(MesPartInspectionInputModel model, String org) { + public void savePartInspection(MesPartInspectionInputModel model) { - MesProduceSn produceSn = getProduceSn(model.getSn(), org); + MesProduceSn produceSn = getProduceSn(model.getSn(), model.getOrganizeCode()); if (null != produceSn && StringUtils.isEmpty(model.getPartNo())) model.setPartNo(produceSn.getPartNo()); //武汉 会输入客户条码 boolean isWorkOrderQcStatus=false; @@ -248,7 +245,7 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService model.setCustSn(produceSn.getCustSn()); model.setSn(produceSn.getProductSn()); //排序产线 更新工单的 qcStatus - MesWorkCenter centerDb = prodOrgExtService.getWorkCenterDb(org, produceSn.getWorkCenterCode()); + MesWorkCenter centerDb = prodOrgExtService.getWorkCenterDb(model.getOrganizeCode(), produceSn.getWorkCenterCode()); if (!StringUtil.isEmpty(centerDb)){ isWorkOrderQcStatus= centerDb.getCenterType() == MesExtEnumUtil.WORK_CENTER_TYPE.SORT.getValue(); } @@ -258,14 +255,14 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService model.getPartInspection().setQmsSync(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue()); } if(!Objects.isNull(model.getPart())){ - model.setPart(mesPartService.getMesPartSapByPartNo(model.getPart().getPartNo(), org)); + model.setPart(mesPartService.getMesPartSapByPartNo(model.getPart().getPartNo(), model.getOrganizeCode())); } // 是否头零件模式 boolean headModel = true; if (!StringUtil.isEmpty(model.getSn())) { // 判断是头零件还是散件 查询加工记录 - DdlPackBean productionPackBean = DdlPackBean.getDdlPackBean(org); + DdlPackBean productionPackBean = DdlPackBean.getDdlPackBean(model.getOrganizeCode()); DdlPreparedPack.getStringEqualPack(model.getSn(), "productSn", productionPackBean); DdlPreparedPack.getNumNOEqualPack(MesExtEnumUtil.REPORT_STATUS.REPORT_STATUS_30.getValue(), "reportStatus", productionPackBean); DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.MES_REPORT_TYPE.CUSTOMER_SUPPLY_MOVE.getValue(), "reportType", productionPackBean); @@ -277,19 +274,19 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService // 如果是散件模式,需要查询出对应明细 List mesPartModels = new ArrayList<>(); if (!headModel) { - DdlPackBean partPackBean = DdlPackBean.getDdlPackBean(org); + DdlPackBean partPackBean = DdlPackBean.getDdlPackBean(model.getOrganizeCode()); DdlPreparedPack.getStringEqualPack(model.getSn(), "workOrderNo", partPackBean); List workOrderParts = workOrderPartRepository.findByHqlWhere(partPackBean); if (!CollectionUtils.isEmpty(workOrderParts)) { - DdlPackBean partProdBean = DdlPackBean.getDdlPackBean(org); + DdlPackBean partProdBean = DdlPackBean.getDdlPackBean(model.getOrganizeCode()); DdlPreparedPack.getStringEqualPack(produceSn.getWorkCenterCode(), "workCenterCode", partProdBean); List mesPartProdGroupList = mesPartProdGroupRao.findByHqlTopWhere(partProdBean, 1); for (MesWorkOrderPart workOrderPart : workOrderParts) { - MesPart partInfo = mesPartService.getMesPartByPartNo(workOrderPart.getPartNo(), org); + MesPart partInfo = mesPartService.getMesPartByPartNo(workOrderPart.getPartNo(), model.getOrganizeCode()); String esd = partInfo.getEsd(); // 查询移库规则 - DdlPackBean movePackBean = DdlPackBean.getDdlPackBean(org); + DdlPackBean movePackBean = DdlPackBean.getDdlPackBean(model.getOrganizeCode()); DdlPreparedPack.getStringEqualPack(esd, "srcType", movePackBean); DdlPreparedPack.getStringEqualPack(mesPartProdGroupList.get(0).getPartProdGroupCode(), "code", movePackBean); List moveRules = mesMoveRuleRepository.findByHqlWhere(movePackBean); @@ -314,7 +311,7 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService //若检验单为空,则生成新的单据并合格 if (StringUtils.isEmpty(model.getPartInspection())) { - partInspection = createPartInspection(model, MesExtEnumUtil.PART_INSPECTION_STATUS.QUALIFIED.getValue(), org); + partInspection = createPartInspection(model, MesExtEnumUtil.PART_INSPECTION_STATUS.QUALIFIED.getValue(), model.getOrganizeCode()); if (model.getOptType() != null && model.getOptType() == 2) { partInspection.setRefundFlag(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()); } @@ -323,14 +320,14 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService if (model.getSourceType() == MesExtEnumUtil.PART_INSPECTION_SOURCE_TYPE.SINGLE.getValue()) { checkProduceSn(produceSn, model.getSn()); produceSn.setQcStatus(MesExtEnumUtil.PRODUCE_QC_STATUS.QUALIFIED.getValue()); - ConvertBean.serviceModelInitialize(produceSn, AuthUtil.getSessionUser().getUserName()); + ConvertBean.serviceModelInitialize(produceSn, model.getUserInfo()); produceSnExtService.update(produceSn); //更新工单对应qcStatus if(isWorkOrderQcStatus){ - MesWorkOrder workOrder = getWorkOrder(org,produceSn.getWorkOrderNo()); + MesWorkOrder workOrder = getWorkOrder(model.getOrganizeCode(), produceSn.getWorkOrderNo()); if (!StringUtil.isEmpty(workOrder)){ workOrder.setQcStatus(MesExtEnumUtil.PRODUCE_QC_STATUS.QUALIFIED.getValue()); - ConvertBean.serviceModelUpdate(workOrder, AuthUtil.getSessionUser().getUserName()); + ConvertBean.serviceModelUpdate(workOrder, model.getUserInfo()); workOrderRepository.update(workOrder); } } @@ -341,7 +338,7 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService //原单据不合格 现合格 if (model.getPartInspection().getInspectionStatus() == MesExtEnumUtil.PART_INSPECTION_STATUS.FAIL.getValue()) { model.getPartInspection().setInspectionStatus(MesExtEnumUtil.PART_INSPECTION_STATUS.QUALIFIED.getValue()); - ConvertBean.serviceModelUpdate(model.getPartInspection(), AuthUtil.getSessionUser().getUserName()); + ConvertBean.serviceModelUpdate(model.getPartInspection(), model.getUserInfo()); if (model.getOptType() != null && model.getOptType() == 2) { model.getPartInspection().setRefundFlag(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()); @@ -349,13 +346,13 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService partInspectionRepository.save(model.getPartInspection()); //查询当前单据明细 - List resultDetailList = queryResultDetailList(model, org); + List resultDetailList = queryResultDetailList(model, model.getOrganizeCode()); List defectTypeNoExitList = new ArrayList<>(); for (MesPartInspectionDetail detail : model.getPartInspectionDetailList()) { //根据页面上选择的位置 查询位置,若不存在则提示 位置不存在,请检查数据 - DdlPackBean packBean = DdlPackBean.getDdlPackBean(org); + DdlPackBean packBean = DdlPackBean.getDdlPackBean(model.getOrganizeCode()); DdlPreparedPack.getStringEqualPack(detail.getDefectLocation(), "defectTypeCode", packBean); DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.DEFECT_CATEGORY.POSITION.getValue(), "defectType", packBean); MesDefectType defectType = defectTypeRepository.getByProperty(packBean); @@ -367,10 +364,10 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService detail.setDefectTypeId(defectType.getId()); detail.setId(null); - detail.setOrganizeCode(org); + detail.setOrganizeCode(model.getOrganizeCode()); detail.setPid(model.getPartInspection().getId()); setSystemSyncStatus(detail); - ConvertBean.serviceModelInitialize(detail, AuthUtil.getSessionUser().getUserName()); + ConvertBean.serviceModelInitialize(detail, model.getUserInfo()); } if (!CollectionUtils.isEmpty(defectTypeNoExitList)) { @@ -383,37 +380,37 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService if (model.getSourceType() == MesExtEnumUtil.PART_INSPECTION_SOURCE_TYPE.SINGLE.getValue()) { checkProduceSn(produceSn, model.getSn()); produceSn.setQcStatus(MesExtEnumUtil.PRODUCE_QC_STATUS.QUALIFIED.getValue()); - ConvertBean.serviceModelInitialize(produceSn, AuthUtil.getSessionUser().getUserName()); + ConvertBean.serviceModelInitialize(produceSn, model.getUserInfo()); produceSnExtService.update(produceSn); //更新工单对应qcStatus if(isWorkOrderQcStatus){ - MesWorkOrder workOrder = getWorkOrder(org,produceSn.getWorkOrderNo()); + MesWorkOrder workOrder = getWorkOrder(model.getOrganizeCode(), produceSn.getWorkOrderNo()); if (!StringUtil.isEmpty(workOrder)){ workOrder.setQcStatus(MesExtEnumUtil.PRODUCE_QC_STATUS.QUALIFIED.getValue()); - ConvertBean.serviceModelUpdate(workOrder, AuthUtil.getSessionUser().getUserName()); + ConvertBean.serviceModelUpdate(workOrder, model.getUserInfo()); workOrderRepository.update(workOrder); } } } //移库 String srcLocate; - MesMove mesMove = getMesMove(model, org); + MesMove mesMove = getMesMove(model, model.getOrganizeCode()); if(!Objects.isNull(mesMove)){ srcLocate = mesMove.getUmlgo(); }else{ - srcLocate= configService.getCfgValue(org, "UMLGO"); + srcLocate= configService.getCfgValue(model.getOrganizeCode(), "UMLGO"); } if (model.getOptType() != 2) { if (!headModel && !CollectionUtils.isEmpty(mesPartModels) && mesPartModels.size() > 0) { for (MesPartModel mesPartModel : mesPartModels) { //移库 - MesMove move = createMove(model, srcLocate, mesPartModel.getLocateNo(), org, null == produceSn ? model.getWorkCenterCode() : produceSn.getWorkCenterCode(),mesPartModel.getPartNo()); + MesMove move = createMove(model, srcLocate, mesPartModel.getLocateNo(), model.getOrganizeCode(), null == produceSn ? model.getWorkCenterCode() : produceSn.getWorkCenterCode(),mesPartModel.getPartNo()); moveRepository.save(move); } } else { //移库 - MesMove move = createMove(model, srcLocate, configService.getCfgValue(org, "LGORT"), org, null == produceSn ? model.getWorkCenterCode() : produceSn.getWorkCenterCode()); + MesMove move = createMove(model, srcLocate, configService.getCfgValue(model.getOrganizeCode(), "LGORT"), model.getOrganizeCode(), null == produceSn ? model.getWorkCenterCode() : produceSn.getWorkCenterCode()); moveRepository.save(move); } @@ -422,9 +419,9 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService } if (model.isTransferFlg() && model.getSourceType() == MesExtEnumUtil.PART_INSPECTION_SOURCE_TYPE.SINGLE.getValue()) { //电子化检验 - String target = configService.getCfgValue(org, "LGORT"); + String target = configService.getCfgValue(model.getOrganizeCode(), "LGORT"); - DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(org); + DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(model.getOrganizeCode()); DdlPreparedPack.getStringEqualPack(model.getPartNo(), "partNo", ddlPackBean); MesProductVersion version = productVersionRepository.getByProperty(ddlPackBean); @@ -436,13 +433,13 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService model.setPartInspection(partInspection); } if (!headModel && !CollectionUtils.isEmpty(mesPartModels) && mesPartModels.size() > 0) { - String locateNo = getDestLocateNo(model, org); + String locateNo = getDestLocateNo(model, model.getOrganizeCode()); for (MesPartModel mesPartModel : mesPartModels) { - MesMove move = createMove(model,locateNo , mesPartModel.getLocateNo(), org, null == produceSn ? model.getWorkCenterCode() : produceSn.getWorkCenterCode(), mesPartModel.getPartNo()); + MesMove move = createMove(model,locateNo , mesPartModel.getLocateNo(), model.getOrganizeCode(), null == produceSn ? model.getWorkCenterCode() : produceSn.getWorkCenterCode(), mesPartModel.getPartNo()); moveRepository.save(move); } } else { - MesMove move = createMove(model, getDestLocateNo(model, org), target, org, null == produceSn ? model.getWorkCenterCode() : produceSn.getWorkCenterCode()); + MesMove move = createMove(model, getDestLocateNo(model, model.getOrganizeCode()), target, model.getOrganizeCode(), null == produceSn ? model.getWorkCenterCode() : produceSn.getWorkCenterCode()); moveRepository.save(move); } } @@ -454,7 +451,7 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService if (StringUtils.isEmpty(model.getPartInspection())) { - partInspection = createPartInspection(model, MesExtEnumUtil.PART_INSPECTION_STATUS.FAIL.getValue(), org); + partInspection = createPartInspection(model, MesExtEnumUtil.PART_INSPECTION_STATUS.FAIL.getValue(), model.getOrganizeCode()); if (model.getOptType() != null && model.getOptType() == 2) { partInspection.setRefundFlag(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()); @@ -466,7 +463,7 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService for (MesPartInspectionDetail detail : model.getPartInspectionDetailList()) { //根据页面上选择的位置 查询位置,若不存在则提示 位置不存在,请检查数据 - DdlPackBean packBean = DdlPackBean.getDdlPackBean(org); + DdlPackBean packBean = DdlPackBean.getDdlPackBean(model.getOrganizeCode()); DdlPreparedPack.getStringEqualPack(detail.getDefectLocation(), "defectTypeCode", packBean); DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.DEFECT_CATEGORY.POSITION.getValue(), "defectType", packBean); MesDefectType defectType = defectTypeRepository.getByProperty(packBean); @@ -478,10 +475,10 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService detail.setDefectTypeId(defectType.getId()); detail.setId(null); - detail.setOrganizeCode(org); + detail.setOrganizeCode(model.getOrganizeCode()); detail.setPid(partInspection.getId()); setSystemSyncStatus(detail); - ConvertBean.serviceModelInitialize(detail, AuthUtil.getSessionUser().getUserName()); + ConvertBean.serviceModelInitialize(detail, model.getUserInfo()); } if (!CollectionUtils.isEmpty(defectTypeNoExitList)) { @@ -494,7 +491,7 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService //若是扫描条码 则判定条码可疑 if (model.getSourceType() == MesExtEnumUtil.PART_INSPECTION_SOURCE_TYPE.SINGLE.getValue()) { //已创建返修单 - DdlPackBean reworkPackBean = DdlPackBean.getDdlPackBean(org); + DdlPackBean reworkPackBean = DdlPackBean.getDdlPackBean(model.getOrganizeCode()); DdlPreparedPack.getStringEqualPack(model.getSn(), "sn", reworkPackBean); DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.REWORK_TASK_STATUS.FINISH.getValue(), "status", reworkPackBean); @@ -502,14 +499,14 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService int count = reworkTaskRepository.findByHqlWhereCount(reworkPackBean); if (count > 0) { // 如果是批次还需要移库 - DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(org); + DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(model.getOrganizeCode()); DdlPreparedPack.getStringEqualPack(model.getPartNo(), "partNo", ddlPackBean); MesProductVersion version = productVersionRepository.getByProperty(ddlPackBean); - String srcNo = configService.getCfgValue(org, "LGORT"); + String srcNo = configService.getCfgValue(model.getOrganizeCode(), "LGORT"); if (version != null) { srcNo = version.getReceiveInventoryPoint(); } - String destLocateNo = getDestLocateNo(model, org); + String destLocateNo = getDestLocateNo(model, model.getOrganizeCode()); if(!Objects.equals(srcNo, destLocateNo)) { throw new ImppBusiException(String.format("【%s】该条码需要完成质检,再重新录入电子化检验", model.getSn())); } @@ -517,14 +514,14 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService checkProduceSn(produceSn, model.getSn()); produceSn.setQcStatus(MesExtEnumUtil.PRODUCE_QC_STATUS.SUSPICIOUS.getValue()); - ConvertBean.serviceModelInitialize(produceSn, AuthUtil.getSessionUser().getUserName()); + ConvertBean.serviceModelInitialize(produceSn, model.getUserInfo()); produceSnExtService.update(produceSn); //更新工单对应qcStatus if(isWorkOrderQcStatus){ - MesWorkOrder workOrder = getWorkOrder(org,produceSn.getWorkOrderNo()); + MesWorkOrder workOrder = getWorkOrder(model.getOrganizeCode(), produceSn.getWorkOrderNo()); if (!StringUtil.isEmpty(workOrder)){ workOrder.setQcStatus(MesExtEnumUtil.PRODUCE_QC_STATUS.SUSPICIOUS.getValue()); - ConvertBean.serviceModelUpdate(workOrder, AuthUtil.getSessionUser().getUserName()); + ConvertBean.serviceModelUpdate(workOrder, model.getUserInfo()); workOrderRepository.update(workOrder); } } @@ -533,9 +530,9 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService // srcLocateNo = getDestLocateNo(model, org); } if (Objects.isNull(srcLocateNo)) { - srcLocateNo = configService.getCfgValue(org, "LGORT"); + srcLocateNo = configService.getCfgValue(model.getOrganizeCode(), "LGORT"); - DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(org); + DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(model.getOrganizeCode()); DdlPreparedPack.getStringEqualPack(model.getPartNo(), "partNo", ddlPackBean); MesProductVersion version = productVersionRepository.getByProperty(ddlPackBean); @@ -546,7 +543,7 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService String workCenterCode; if (model.getSourceType() == MesExtEnumUtil.PART_INSPECTION_SOURCE_TYPE.SINGLE.getValue()) { if (null == produceSn || StringUtils.isEmpty(produceSn.getProcessCode())) { - List workCenterPartRelationList = getWorkCenterPartRelation(org, model.getPartNo()); + List workCenterPartRelationList = getWorkCenterPartRelation(model.getOrganizeCode(), model.getPartNo()); if (CollectionUtils.isEmpty(workCenterPartRelationList) || workCenterPartRelationList.size() > 1 || StringUtils.isEmpty(workCenterPartRelationList.get(0).getWorkCenterCode())) { throw new ImppBusiException(String.format("条码[%s]未查询到有效的来源库位!", model.getSn())); } @@ -558,7 +555,7 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService workCenterCode = model.getWorkCenterCode(); } - MesWorkCenter workCenter = prodOrgExtService.getWorkCenterDb(org, workCenterCode); + MesWorkCenter workCenter = prodOrgExtService.getWorkCenterDb(model.getOrganizeCode(), workCenterCode); if (null == workCenter) throw new ImppBusiException(String.format("条码[%s]查询来源库位时获取的生产线代码[%s]信息不存在!", model.getSn(), workCenterCode)); if (StringUtils.isEmpty(workCenter.getRawLocate())) throw new ImppBusiException(String.format("条码[%s]查询来源库位时获取的生产线代码[%s]信息未维护[材料库位]!", model.getSn(), workCenterCode)); srcLocateNo = workCenter.getRawLocate(); @@ -568,20 +565,20 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService if (model.getOptType() != 2) { //移库 //移库 - String dest = configService.getCfgValue(org, "UMLGO"); + String dest = configService.getCfgValue(model.getOrganizeCode(), "UMLGO"); if (model.getSourceType() == MesExtEnumUtil.PART_INSPECTION_SOURCE_TYPE.SINGLE.getValue()){ - String destLocateNo = getDestLocateNo(model, org); + String destLocateNo = getDestLocateNo(model, model.getOrganizeCode()); if (!StringUtils.isEmpty(destLocateNo) && Objects.equals(dest, destLocateNo)) { return; } } if (!headModel && !CollectionUtils.isEmpty(mesPartModels) && mesPartModels.size() > 0) { for (MesPartModel mesPartModel : mesPartModels) { - MesMove move = createMove(model, mesPartModel.getLocateNo(), dest, org, null == produceSn ? model.getWorkCenterCode() : produceSn.getWorkCenterCode(),mesPartModel.getPartNo()); + MesMove move = createMove(model, mesPartModel.getLocateNo(), dest, model.getOrganizeCode(), null == produceSn ? model.getWorkCenterCode() : produceSn.getWorkCenterCode(), mesPartModel.getPartNo()); moveRepository.save(move); } } else{ - MesMove move = createMove(model, srcLocateNo, dest, org, null == produceSn ? model.getWorkCenterCode() : produceSn.getWorkCenterCode()); + MesMove move = createMove(model, srcLocateNo, dest, model.getOrganizeCode(), null == produceSn ? model.getWorkCenterCode() : produceSn.getWorkCenterCode()); moveRepository.save(move); } @@ -590,19 +587,19 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService } else { model.getPartInspection().setInspectionStatus(MesExtEnumUtil.PART_INSPECTION_STATUS.FAIL.getValue()); - ConvertBean.serviceModelUpdate(model.getPartInspection(), AuthUtil.getSessionUser().getUserName()); + ConvertBean.serviceModelUpdate(model.getPartInspection(), model.getUserInfo()); if (model.getOptType() != null && model.getOptType() == 2) { model.getPartInspection().setRefundFlag(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()); } partInspectionRepository.save(model.getPartInspection()); //查询当前单据明细 - List resultDetailList = queryResultDetailList(model, org); + List resultDetailList = queryResultDetailList(model, model.getOrganizeCode()); List defectTypeNoExitList = new ArrayList<>(); for (MesPartInspectionDetail detail : model.getPartInspectionDetailList()) { //根据页面上选择的位置 查询位置,若不存在则提示 位置不存在,请检查数据 - DdlPackBean packBean = DdlPackBean.getDdlPackBean(org); + DdlPackBean packBean = DdlPackBean.getDdlPackBean(model.getOrganizeCode()); DdlPreparedPack.getStringEqualPack(detail.getDefectLocation(), "defectTypeCode", packBean); DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.DEFECT_CATEGORY.POSITION.getValue(), "defectType", packBean); MesDefectType defectType = defectTypeRepository.getByProperty(packBean); @@ -614,10 +611,10 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService detail.setDefectTypeId(defectType.getId()); detail.setId(null); - detail.setOrganizeCode(org); + detail.setOrganizeCode(model.getOrganizeCode()); detail.setPid(model.getPartInspection().getId()); setSystemSyncStatus(detail); - ConvertBean.serviceModelInitialize(detail, AuthUtil.getSessionUser().getUserName()); + ConvertBean.serviceModelInitialize(detail, model.getUserInfo()); } if (!CollectionUtils.isEmpty(defectTypeNoExitList)) { @@ -628,7 +625,7 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService if (model.getSourceType() == MesExtEnumUtil.PART_INSPECTION_SOURCE_TYPE.SINGLE.getValue()) { //已创建返修单 - DdlPackBean reworkPackBean = DdlPackBean.getDdlPackBean(org); + DdlPackBean reworkPackBean = DdlPackBean.getDdlPackBean(model.getOrganizeCode()); DdlPreparedPack.getStringEqualPack(model.getSn(), "sn", reworkPackBean); DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.REWORK_TASK_STATUS.FINISH.getValue(), "status", reworkPackBean); @@ -636,14 +633,14 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService int count = reworkTaskRepository.findByHqlWhereCount(reworkPackBean); if (count > 0) { // 如果是批次还需要移库 - DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(org); + DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(model.getOrganizeCode()); DdlPreparedPack.getStringEqualPack(model.getPartNo(), "partNo", ddlPackBean); MesProductVersion version = productVersionRepository.getByProperty(ddlPackBean); - String srcNo = configService.getCfgValue(org, "LGORT"); + String srcNo = configService.getCfgValue(model.getOrganizeCode(), "LGORT"); if (version != null) { srcNo = version.getReceiveInventoryPoint(); } - String destLocateNo = getDestLocateNo(model, org); + String destLocateNo = getDestLocateNo(model, model.getOrganizeCode()); if (!Objects.equals(srcNo, destLocateNo)) { throw new ImppBusiException(String.format("【%s】该条码需要完成质检,再重新录入电子化检验", model.getSn())); } @@ -651,14 +648,14 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService checkProduceSn(produceSn, model.getSn()); produceSn.setQcStatus(MesExtEnumUtil.PRODUCE_QC_STATUS.SUSPICIOUS.getValue()); - ConvertBean.serviceModelInitialize(produceSn, AuthUtil.getSessionUser().getUserName()); + ConvertBean.serviceModelInitialize(produceSn, model.getUserInfo()); produceSnExtService.update(produceSn); //更新工单对应qcStatus if(isWorkOrderQcStatus){ - MesWorkOrder workOrder = getWorkOrder(org,produceSn.getWorkOrderNo()); + MesWorkOrder workOrder = getWorkOrder(model.getOrganizeCode(), produceSn.getWorkOrderNo()); if (!StringUtil.isEmpty(workOrder)){ workOrder.setQcStatus(MesExtEnumUtil.PRODUCE_QC_STATUS.SUSPICIOUS.getValue()); - ConvertBean.serviceModelUpdate(workOrder, AuthUtil.getSessionUser().getUserName()); + ConvertBean.serviceModelUpdate(workOrder, model.getUserInfo()); workOrderRepository.update(workOrder); } } @@ -668,9 +665,9 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService //移库 if (model.getOptType() != 2) { - String srcLocateNo = configService.getCfgValue(org, "LGORT"); + String srcLocateNo = configService.getCfgValue(model.getOrganizeCode(), "LGORT"); - DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(org); + DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(model.getOrganizeCode()); DdlPreparedPack.getStringEqualPack(model.getPartNo(), "partNo", ddlPackBean); MesProductVersion version = productVersionRepository.getByProperty(ddlPackBean); @@ -678,9 +675,9 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService srcLocateNo = version.getReceiveInventoryPoint(); } //移库 - String dest = configService.getCfgValue(org, "UMLGO"); + String dest = configService.getCfgValue(model.getOrganizeCode(), "UMLGO"); if (model.getSourceType() == MesExtEnumUtil.PART_INSPECTION_SOURCE_TYPE.SINGLE.getValue()){ - String destLocateNo = getDestLocateNo(model, org); + String destLocateNo = getDestLocateNo(model, model.getOrganizeCode()); if (!StringUtils.isEmpty(destLocateNo) && Objects.equals(dest, destLocateNo)) { return; } @@ -688,11 +685,11 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService if (!headModel && !CollectionUtils.isEmpty(mesPartModels) && mesPartModels.size() > 0) { for (MesPartModel mesPartModel : mesPartModels) { //移库 - MesMove move = createMove(model, mesPartModel.getLocateNo(), dest, org, null == produceSn ? model.getWorkCenterCode() : produceSn.getWorkCenterCode(),mesPartModel.getPartNo()); + MesMove move = createMove(model, mesPartModel.getLocateNo(), dest, model.getOrganizeCode(), null == produceSn ? model.getWorkCenterCode() : produceSn.getWorkCenterCode(),mesPartModel.getPartNo()); moveRepository.save(move); } } else{ - MesMove move = createMove(model, srcLocateNo, dest, org, null == produceSn ? model.getWorkCenterCode() : produceSn.getWorkCenterCode()); + MesMove move = createMove(model, srcLocateNo, dest, model.getOrganizeCode(), null == produceSn ? model.getWorkCenterCode() : produceSn.getWorkCenterCode()); moveRepository.save(move); } @@ -797,7 +794,7 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService resultDetailList.forEach(k -> { k.setIsDeleted(MesCommonConstant.TRUE_INTEGER); setSystemSyncStatus(k); - ConvertBean.serviceModelUpdate(model.getPartInspection(), AuthUtil.getSessionUser().getUserName()); + ConvertBean.serviceModelUpdate(model.getPartInspection(), model.getUserInfo()); }); return resultDetailList; @@ -944,10 +941,9 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService partInspection.setWorkCenterCode(model.getWorkCenterCode()); partInspection.setShiftCode(model.getShiftCode()); partInspection.setSourceType(model.getSourceType()); -// ConvertBean.serviceModelInitialize(partInspection, AuthUtil.getSessionUser().getUserName()); //42984 初检创建时修改人和修改时间不能赋值 partInspection.setCreateDatetime(TimeTool.getNowTime(true)); - partInspection.setCreateUser(AuthUtil.getSessionUser().getUserName()); + partInspection.setCreateUser(model.getUserInfo()); partInspection.setIsValid(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()); partInspection.setIsDeleted(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue()); return partInspection; @@ -1123,29 +1119,28 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService return alarmConfigList; } - private MesPartInspectionViewModel getModel(MesPartInspection partInspection, MesPart part,MesPartTypePicture partTypePicture, MesPartInspectionInputModel inputModel , - Integer sourceType, String org) { + private MesPartInspectionViewModel getModel(MesPartInspection partInspection, MesPart part, MesPartTypePicture partTypePicture, MesPartInspectionInputModel model, Integer sourceType) { - Integer frontBack = inputModel.getFrontBack(); + Integer frontBack = model.getFrontBack(); List detailList = new ArrayList<>(); if (!StringUtils.isEmpty(partInspection) && partInspection.getInspectionStatus() != MesExtEnumUtil.PART_INSPECTION_STATUS.QUALIFIED.getValue()) { - detailList = checkPartInspectionDetail(partInspection, org); + detailList = checkPartInspectionDetail(partInspection, model.getOrganizeCode()); if(!CollectionUtils.isEmpty(detailList)){ //判断是否返工完成 - checkReworkFinished(org, detailList); + checkReworkFinished(model.getOrganizeCode(), detailList); } } //位置 - List locationConfigList = checkLocationConfig(org); + List locationConfigList = checkLocationConfig(model.getOrganizeCode()); List locationCodeList = locationConfigList.stream().map(k -> k.getDefectLocation()).collect(Collectors.toList()); //查询零件类型缺陷类型对应关系 - List partTypeDefectList = checkPartTypeDefect(part, org); + List partTypeDefectList = checkPartTypeDefect(part, model.getOrganizeCode()); List partTypeDefectCodeList = partTypeDefectList.stream().map(k -> k.getDefectTypeCode()).collect(Collectors.toList()); //查询预警数量 - List alarmConfigList = queryDefectAlarmConfigByLocationCodeList(part, frontBack, locationCodeList, partTypeDefectCodeList, org); + List alarmConfigList = queryDefectAlarmConfigByLocationCodeList(part, frontBack, locationCodeList, partTypeDefectCodeList, model.getOrganizeCode()); //根据不良类型+位置 若有数据,则表示需要标黄 Map> alarmConfigMap = alarmConfigList.stream().collect(Collectors.groupingBy(MesDefectWarnConfig::getDefectLocation)); @@ -1167,17 +1162,17 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService } }); - MesPartInspectionViewModel model = new MesPartInspectionViewModel(); - model.setPart(part); + MesPartInspectionViewModel result = new MesPartInspectionViewModel(); + result.setPart(part); if (!StringUtils.isEmpty(partInspection) && partInspection.getInspectionStatus() == MesExtEnumUtil.PART_INSPECTION_STATUS.FAIL.getValue() && partInspection.getNcStatus() == MesExtEnumUtil.PART_INSPECTION_NC_STATUS.CREATE.getValue()) { - model.setPartInspectionDetailList(detailList); - model.setPartInspection(partInspection); + result.setPartInspectionDetailList(detailList); + result.setPartInspection(partInspection); } - model.setPartTypePicture(partTypePicture); - model.setLocationConfigList(locationConfigList); - model.setMesDefectWarnConfigList(alarmConfigList); - return model; + result.setPartTypePicture(partTypePicture); + result.setLocationConfigList(locationConfigList); + result.setMesDefectWarnConfigList(alarmConfigList); + return result; }