From 36560566f181add979c4085112e1861f8b2ceba1 Mon Sep 17 00:00:00 2001 From: jun Date: Wed, 30 Oct 2024 20:14:09 +0800 Subject: [PATCH] =?UTF-8?q?43590=20=E5=BC=80=E5=85=B3=E7=8F=AD=E7=AE=A1?= =?UTF-8?q?=E7=90=86=EF=BC=9A=E6=8E=A5=E7=8F=AD=E6=97=B6--90002=20?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E5=BC=82=E5=B8=B8:=E5=AF=B9=E8=B1=A1?= =?UTF-8?q?=E4=B8=BA=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../busi/MesPullingOrderInfoController.java | 2 +- .../base/MesProdShiftRecordServiceImpl.java | 34 +++++++++++++--------- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesPullingOrderInfoController.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesPullingOrderInfoController.java index 3a68523..8fcbd00 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesPullingOrderInfoController.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesPullingOrderInfoController.java @@ -57,7 +57,7 @@ public class MesPullingOrderInfoController { throw new ImppBusiException("拉动单号不能为空"); } mesPullingOrderInfoService.doMesPullingOrderInfoScan(mesPullingOrderInfo, !StringUtils.isEmpty(mesPullingOrderInfo.getModifyUser())?mesPullingOrderInfo.getModifyUser(): AuthUtil.getSessionUser().getUserName()); - return ResultBean.success("拉动单扫描成功") + return ResultBean.success(String.format("拉动单【%s】扫描成功",mesPullingOrderInfo.getPullingOrderNo())) .setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()); } catch (ImppBusiException e) { return ResultBean.fail(e).build(); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesProdShiftRecordServiceImpl.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesProdShiftRecordServiceImpl.java index 4e1abe9..f415084 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesProdShiftRecordServiceImpl.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesProdShiftRecordServiceImpl.java @@ -1,10 +1,11 @@ package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.base; +import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesEquipmentExtService; import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesProdShiftRecordService; +import cn.estsh.i3plus.ext.mes.pcn.apiservice.util.MesPcnException; import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords; import cn.estsh.i3plus.platform.common.convert.ConvertBean; import cn.estsh.i3plus.platform.common.exception.ImppExceptionEnum; -import cn.estsh.i3plus.platform.common.util.MesConstWords; import cn.estsh.i3plus.pojo.base.bean.DdlPackBean; import cn.estsh.i3plus.pojo.base.bean.ListPager; import cn.estsh.i3plus.pojo.base.common.Pager; @@ -13,12 +14,16 @@ import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil; import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack; import cn.estsh.i3plus.pojo.base.util.StringUtil; import cn.estsh.i3plus.pojo.mes.bean.*; -import cn.estsh.i3plus.pojo.mes.repository.*; +import cn.estsh.i3plus.pojo.mes.repository.MesConfigRepository; +import cn.estsh.i3plus.pojo.mes.repository.MesDowntimeRecordRepository; +import cn.estsh.i3plus.pojo.mes.repository.MesProdShiftRecordRepository; +import cn.estsh.i3plus.pojo.mes.repository.MesWcEquipmentRepository; import cn.estsh.impp.framework.boot.auth.AuthUtil; import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; import org.springframework.util.StringUtils; import java.util.List; @@ -37,16 +42,19 @@ public class MesProdShiftRecordServiceImpl implements IMesProdShiftRecordService @Autowired private MesProdShiftRecordRepository mesProdShiftRecordRDao; + @Autowired private MesConfigRepository configRepository; + @Autowired private MesDowntimeRecordRepository mesDowntimeRecordRDao; - @Autowired - private MesEquipmentRepository mesEquipmentRDao; @Autowired private MesWcEquipmentRepository wcEquipmentRepository; + @Autowired + private IMesEquipmentExtService mesEquipmentExtService; + @Override public ListPager queryMesProdShiftRecordByPager(MesProdShiftRecord bean, Pager pager) { @@ -129,16 +137,12 @@ public class MesProdShiftRecordServiceImpl implements IMesProdShiftRecordService List wcEquipmentDbList = wcEquipmentRepository.findByProperty( new String[]{MesPcnExtConstWords.ORGANIZE_CODE, MesPcnExtConstWords.IS_DELETED, MesPcnExtConstWords.IS_VALID, MesPcnExtConstWords.WORK_CENTER_CODE}, new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), item.getWorkCenterCode()}); - + if (CollectionUtils.isEmpty(wcEquipmentDbList)) { + MesPcnException.throwMesBusiException("产线【%s】工位设备信息不存在", item.getWorkCenterCode()); + } for (MesWcEquipment mesWcEquipment : wcEquipmentDbList) { - MesEquipment mesEquipment = mesEquipmentRDao.getByProperty( - new String[]{MesConstWords.ORGANIZE_CODE, MesPcnExtConstWords.EQUIPMENT_CODE, MesConstWords.IS_DELETED, MesConstWords.IS_VALID}, - new Object[]{organizeCode, mesWcEquipment.getEquipmentCode(), - CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), - CommonEnumUtil.IS_VAILD.VAILD.getValue()}); - DdlPackBean ddlPackBeanDowntime = DdlPackBean.getDdlPackBean(organizeCode); - DdlPreparedPack.getStringEqualPack(mesEquipment.getEquipmentCode(), "equipmentCode", ddlPackBeanDowntime); + DdlPreparedPack.getStringEqualPack(mesWcEquipment.getEquipmentCode(), "equipmentCode", ddlPackBeanDowntime); if (!StringUtil.isEmpty(reason)) { DdlPreparedPack.getStringEqualPack(reason, "reasonCode", ddlPackBeanDowntime); } @@ -146,7 +150,11 @@ public class MesProdShiftRecordServiceImpl implements IMesProdShiftRecordService DdlPreparedPack.getStringEqualPack(type, "reasonTypeCode", ddlPackBeanDowntime); } MesDowntimeRecord mesDowntimeRecordDao = mesDowntimeRecordRDao.getByProperty(ddlPackBeanDowntime); - if (StringUtil.isEmpty(mesDowntimeRecordDao)) { + if (Objects.isNull(mesDowntimeRecordDao)) { + MesEquipment mesEquipment = mesEquipmentExtService.getMesEquipment(organizeCode, mesWcEquipment.getEquipmentCode()); + if (Objects.isNull(mesEquipment)) { + MesPcnException.throwMesBusiException("设备【%s】信息不存在", mesWcEquipment.getEquipmentCode()); + } //新增设备停机记录 MesDowntimeRecord mesDowntimeRecord = new MesDowntimeRecord(); mesDowntimeRecord.setOrganizeCode(organizeCode);