From e5930fba43054aed4302c41c3b3fcf2ee3c0db5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?LML=E4=B8=B6?= Date: Thu, 30 May 2024 13:20:26 +0800 Subject: [PATCH] =?UTF-8?q?=E7=82=B9=E6=A3=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/busi/spot/IMesSpotCheckOrderService.java | 15 +++++++- .../busi/spot/MesSpotCheckOrderController.java | 35 +++++++++++++++++ .../busi/MesInputDefectRecordService.java | 4 +- .../serviceimpl/busi/MesNcProcessingService.java | 1 + .../busi/MesShippingLoadingCheckService.java | 45 ++++++++++++++++++---- .../busi/MesSortShippingCheckService.java | 8 ++-- .../serviceimpl/busi/MesSpotCheckOrderService.java | 15 ++++++++ 7 files changed, 109 insertions(+), 14 deletions(-) diff --git a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/spot/IMesSpotCheckOrderService.java b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/spot/IMesSpotCheckOrderService.java index c9d4e9f..e2b939d 100644 --- a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/spot/IMesSpotCheckOrderService.java +++ b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/spot/IMesSpotCheckOrderService.java @@ -3,9 +3,11 @@ package cn.estsh.i3plus.ext.mes.pcn.api.busi.spot; import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesSpotCheckOrderModel; import cn.estsh.i3plus.pojo.base.bean.ListPager; import cn.estsh.i3plus.pojo.base.common.Pager; +import cn.estsh.i3plus.pojo.mes.bean.MesEquipmentSpotCheck; import cn.estsh.i3plus.pojo.mes.bean.MesSpotCheckOrder; import io.swagger.annotations.ApiOperation; -import org.apache.poi.ss.formula.functions.T; + +import java.util.List; /** * @Description : @@ -27,6 +29,17 @@ public interface IMesSpotCheckOrderService { @ApiOperation("查询点检单") ListPager querySpotCheckOrder(MesSpotCheckOrder spotCheckOrder, Pager pager); + /** + * 、 + * 查询点检单 + * + * @param spotCheckOrder + * @param pager + * @return + */ + @ApiOperation("查询设备点检") + List queryEquipmentSpotCheck(MesEquipmentSpotCheck spotCheckOrder); + /** * 查询点检单明细 diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/spot/MesSpotCheckOrderController.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/spot/MesSpotCheckOrderController.java index b7a2a74..bb80ede 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/spot/MesSpotCheckOrderController.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/spot/MesSpotCheckOrderController.java @@ -5,6 +5,7 @@ import cn.estsh.i3plus.ext.mes.pcn.api.busi.spot.IMesSpotCheckOrderService; import cn.estsh.i3plus.ext.mes.pcn.pojo.constant.MesCommonConstant; import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesSpotCheckOrderModel; import cn.estsh.i3plus.pojo.base.common.Pager; +import cn.estsh.i3plus.pojo.mes.bean.MesEquipmentSpotCheck; import cn.estsh.i3plus.pojo.mes.bean.MesSpotCheckOrder; import cn.estsh.impp.framework.boot.auth.AuthUtil; import cn.estsh.impp.framework.boot.exception.ImppBusiException; @@ -28,6 +29,39 @@ public class MesSpotCheckOrderController { private IMesSpotCheckOrderService spotCheckOrderService; + @GetMapping("/query-equipment-spot") + @ApiOperation(value = "查询设备点检") + public ResultBean queryEquipmentSpotCheck(MesEquipmentSpotCheck spotCheckOrder) { + + try { + + spotCheckOrder.setOrganizeCode(AuthUtil.getOrganizeCode()); + return ResultBean.success("查询成功").setResultList(spotCheckOrderService.queryEquipmentSpotCheck(spotCheckOrder)); + } catch (ImppBusiException imppException) { + return ResultBean.fail(imppException); + } catch (Exception e) { + return ImppExceptionBuilder.newInstance().buildExceptionResult(e); + } + } + + @PostMapping("/insert") + @ApiOperation(value = "新增点检单") + public ResultBean insert(@RequestBody MesSpotCheckOrder bean) { + + try { + + if (StringUtils.isEmpty(bean)) { + throw new ImppBusiException("点检单不能为空"); + } + bean.setOrganizeCode(AuthUtil.getOrganizeCode()); + return ResultBean.success("扫描产品条码成功").setResultObject(spotCheckOrderService.insert(bean)); + } catch (ImppBusiException imppException) { + return ResultBean.fail(imppException); + } catch (Exception e) { + return ImppExceptionBuilder.newInstance().buildExceptionResult(e); + } + } + @GetMapping("/query-pager") @ApiOperation(value = "查询点检单") public ResultBean querySpotCheckOrderByPager(MesSpotCheckOrder spotCheckOrder, Pager pager) { @@ -81,6 +115,7 @@ public class MesSpotCheckOrderController { } } + @PostMapping("/query-equip-info") @ApiOperation(value = "开始点检-查询设备数据") public ResultBean queryEquipInfo(@RequestBody MesSpotCheckOrderModel model) { 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 2780dba..031a74e 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 @@ -299,7 +299,7 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService detail.setDefectTypeId(defectType.getId()); detail.setId(null); detail.setOrganizeCode(org); - detail.setPid(model.getPartInspection().getId()); + detail.setPid(partInspection.getId()); ConvertBean.serviceModelInitialize(detail, AuthUtil.getSessionUser().getUserName()); } @@ -512,7 +512,7 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService //若不存在则提示条码不存在 if (StringUtils.isEmpty(produceSn)) { - throw new ImppBusiException(String.format("【%s】此条码不存在,请检查数据", serialNumber)); + throw new ImppBusiException(String.format("【%s】此条码不存在saveCheck,请检查数据", serialNumber)); } //根据条码状态判断 是不是已下线条码 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 f0cfc68..40eeb34 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 @@ -357,6 +357,7 @@ public class MesNcProcessingService implements IMesNcProcessingService { reworkTask.setReworkedQty(model.getPartInspection().getQty()); reworkTask.setSn(model.getPartInspection().getSn()); reworkTask.setReworkOrder(rework); + reworkTask.setStatus(MesExtEnumUtil.REWORK_TASK_STATUS.CREATE.getValue()); reworkTask.setPartNo(model.getPartInspection().getPartNo()); reworkTask.setPartInspectionId(model.getPartInspection().getId()); reworkTask.setOrganizeCode(org); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesShippingLoadingCheckService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesShippingLoadingCheckService.java index 553c960..a181b60 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesShippingLoadingCheckService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesShippingLoadingCheckService.java @@ -5,6 +5,7 @@ import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesShippingLoadingCheckService; import cn.estsh.i3plus.ext.mes.pcn.pojo.constant.MesCommonConstant; import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesShippingLoadingCheckModel; import cn.estsh.i3plus.platform.common.convert.ConvertBean; +import cn.estsh.i3plus.platform.common.tool.TimeTool; import cn.estsh.i3plus.pojo.base.bean.DdlPackBean; import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil; import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack; @@ -20,6 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.StringUtils; +import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -81,7 +83,7 @@ public class MesShippingLoadingCheckService implements IMesShippingLoadingCheckS //查询最近扫描完成的装车单号 DdlPackBean recentlyOrderPackBean = DdlPackBean.getDdlPackBean(loadingList.organizeCode); - DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.LOADING_ORDER_STATUS.SHIPPING.getValue(), "status", recentlyOrderPackBean); + DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.MES_LOADING_STATUS.SCANNED.getValue(), "status", recentlyOrderPackBean); DdlPreparedPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.DESC.getValue()}, new String[]{"modifyDatetime"}, recentlyOrderPackBean); MesLoadingList recentlyVehiclesOrder = vehiclesOrderRepository.getByProperty(recentlyOrderPackBean); @@ -107,11 +109,17 @@ public class MesShippingLoadingCheckService implements IMesShippingLoadingCheckS public MesLoadingList queryLoadingOrderNoByAutoPushOrder(String shippingGroupNo, String org) { + List statusList = new ArrayList<>(); + statusList.add(MesExtEnumUtil.MES_LOADING_STATUS.CREATE.getValue()); + statusList.add(MesExtEnumUtil.MES_LOADING_STATUS.PUBLISH.getValue()); + statusList.add(MesExtEnumUtil.MES_LOADING_STATUS.CREATE_ASN.getValue()); + statusList.add(MesExtEnumUtil.MES_LOADING_STATUS.LOADING.getValue()); + //查询最近需要扫描的装车单号 DdlPackBean orderPackBean = DdlPackBean.getDdlPackBean(org); // DdlPreparedPack.getStringEqualPack(shippingGroupNo, "partShippingGroupCode", orderPackBean); - DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.LOADING_ORDER_STATUS.CREATE.getValue(), "status", orderPackBean); - DdlPreparedPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.DESC.getValue()}, new String[]{"seq"}, orderPackBean); + DdlPreparedPack.getInPackList(statusList, "status", orderPackBean); + DdlPreparedPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.ASC.getValue()}, new String[]{"seq"}, orderPackBean); MesLoadingList loadingList = vehiclesOrderRepository.getByProperty(orderPackBean); return loadingList; @@ -147,7 +155,14 @@ public class MesShippingLoadingCheckService implements IMesShippingLoadingCheckS //根据是否启动记忆判断 若启用记忆,则根据保存数据库 if (loadingList.getIsEnableMemory() == MesCommonConstant.TRUE_INTEGER) { - loadingList.setStatus(MesExtEnumUtil.LOADING_ORDER_STATUS.LOADING.getValue()); + //若装车单状态为创建或发布已生成ASN 则写入开始扫描时间 + if (loadingList.getStatus() == MesExtEnumUtil.MES_LOADING_STATUS.CREATE.getValue() || + loadingList.getStatus() == MesExtEnumUtil.MES_LOADING_STATUS.PUBLISH.getValue() || + loadingList.getStatus() == MesExtEnumUtil.MES_LOADING_STATUS.CREATE_ASN.getValue()) { + loadingList.setStartScanTime(TimeTool.getNowTime(true)); + } + + loadingList.setStatus(MesExtEnumUtil.MES_LOADING_STATUS.LOADING.getValue()); ConvertBean.serviceModelUpdate(loadingList, AuthUtil.getSessionUser().getUserName()); vehiclesOrderRepository.save(loadingList); @@ -179,8 +194,15 @@ public class MesShippingLoadingCheckService implements IMesShippingLoadingCheckS //全部扫描完成 if (count.intValue() == model.getDetailList().size()) { + //若装车单状态为创建或发布已生成ASN 则写入开始扫描时间 + if (loadingList.getStatus() == MesExtEnumUtil.MES_LOADING_STATUS.CREATE.getValue() || + loadingList.getStatus() == MesExtEnumUtil.MES_LOADING_STATUS.PUBLISH.getValue() || + loadingList.getStatus() == MesExtEnumUtil.MES_LOADING_STATUS.CREATE_ASN.getValue()) { + loadingList.setStartScanTime(TimeTool.getNowTime(true)); + } + loadingList.setEndScanTime(TimeTool.getNowTime(true)); //装车单主表 - loadingList.setStatus(MesExtEnumUtil.LOADING_ORDER_STATUS.LOADED.getValue()); + loadingList.setStatus(MesExtEnumUtil.MES_LOADING_STATUS.SCANNED.getValue()); ConvertBean.serviceModelUpdate(loadingList, AuthUtil.getSessionUser().getUserName()); //装车单明细 @@ -215,9 +237,16 @@ public class MesShippingLoadingCheckService implements IMesShippingLoadingCheckS } //校验装车单状态 必须是未装车条码 - if (loadingList.getStatus() != MesExtEnumUtil.LOADING_ORDER_STATUS.CREATE.getValue() && loadingList.getStatus() != MesExtEnumUtil.LOADING_ORDER_STATUS.LOADING.getValue()) { - throw new ImppBusiException(String.format("【%s】此装车单状态为【%s】,请选择状态为【%s】或状态【%s】的装车单", loadingList.getOrderCode(), - MesExtEnumUtil.LOADING_ORDER_STATUS.valueOfDescription(loadingList.getStatus()), MesExtEnumUtil.LOADING_ORDER_STATUS.CREATE.getDescription(), MesExtEnumUtil.LOADING_ORDER_STATUS.LOADING.getDescription())); + if (loadingList.getStatus() != MesExtEnumUtil.MES_LOADING_STATUS.CREATE.getValue() && + loadingList.getStatus() != MesExtEnumUtil.MES_LOADING_STATUS.PUBLISH.getValue() && + loadingList.getStatus() != MesExtEnumUtil.MES_LOADING_STATUS.CREATE_ASN.getValue() && + loadingList.getStatus() != MesExtEnumUtil.MES_LOADING_STATUS.LOADING.getValue()) { + throw new ImppBusiException(String.format("【%s】此装车单状态为【%s】,请选择状态为【%s】或状态【%s】或状态【%s】或状态【%s】的装车单", loadingList.getOrderCode(), + MesExtEnumUtil.MES_LOADING_STATUS.valueOfDescription(loadingList.getStatus()), + MesExtEnumUtil.MES_LOADING_STATUS.CREATE.getDescription(), + MesExtEnumUtil.MES_LOADING_STATUS.PUBLISH.getDescription(), + MesExtEnumUtil.MES_LOADING_STATUS.CREATE_ASN.getDescription(), + MesExtEnumUtil.MES_LOADING_STATUS.LOADING.getDescription())); } return loadingList; } diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesSortShippingCheckService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesSortShippingCheckService.java index d961b78..c992454 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesSortShippingCheckService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesSortShippingCheckService.java @@ -96,9 +96,11 @@ public class MesSortShippingCheckService implements IMesSortShippingCheckService if (orderManagement.getIsFirstInstall() == MesCommonConstant.TRUE_INTEGER) { //若没进行装车校验,则提示【%s】此发运单对应的【%s】此装车单状态为【%s】,请选择状态为【%s】的数据 - if (loadingList.getStatus() != MesExtEnumUtil.LOADING_DETAIL_ORDER_STATUS.LOADED.getValue()) { - throw new ImppBusiException(String.format("【%s】此发运单对应的【%s】此装车单状态为【%s】,请选择状态为【%s】的数据!", shippingOrderManagement.getShippingCode(), - loadingList.getOrderCode(), MesExtEnumUtil.LOADING_ORDER_STATUS.valueOfDescription(loadingList.getStatus()), MesExtEnumUtil.LOADING_ORDER_STATUS.LOADED.getDescription())); + if (loadingList.getStatus() != MesExtEnumUtil.MES_LOADING_STATUS.SCANNED.getValue()) { + throw new ImppBusiException(String.format("【%s】此发运单对应的【%s】此装车单状态为【%s】,请选择状态为【%s】的数据!", + shippingOrderManagement.getShippingCode(), loadingList.getOrderCode(), + MesExtEnumUtil.MES_LOADING_STATUS.valueOfDescription(loadingList.getStatus()), + MesExtEnumUtil.MES_LOADING_STATUS.SCANNED.getDescription())); } } } diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesSpotCheckOrderService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesSpotCheckOrderService.java index c345e33..3e3492e 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesSpotCheckOrderService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesSpotCheckOrderService.java @@ -69,6 +69,7 @@ public class MesSpotCheckOrderService implements IMesSpotCheckOrderService { private MesEquipmentSpotCheckPartRepository equipmentSpotCheckPartRepository; + @Override public ListPager querySpotCheckOrder(MesSpotCheckOrder spotCheckOrder, Pager pager) { @@ -83,6 +84,20 @@ public class MesSpotCheckOrderService implements IMesSpotCheckOrderService { } @Override + public List queryEquipmentSpotCheck(MesEquipmentSpotCheck bean) { + + DdlPackBean packBean = DdlPackBean.getDdlPackBean(bean.getOrganizeCode(), bean.getIsValid()); + DdlPreparedPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.DESC.getValue()}, new String[]{"createDatetime"}, packBean); + DdlPreparedPack.getStringEqualPack(bean.getSpotCheckCode(), "spotCheckCode", packBean); + DdlPreparedPack.getStringLikerPack(bean.getSpotCheckName(), "spotCheckName", packBean); + DdlPreparedPack.getStringEqualPack(bean.getWorkCenterCode(), "workCenterCode", packBean); + DdlPreparedPack.getStringEqualPack(bean.getWorkCellCode(), "workCellCode", packBean); + + + return equipmentSpotCheckRepository.findByHqlWhere(packBean); + } + + @Override public MesSpotCheckOrderModel scanProduceSn(MesSpotCheckOrderModel model, String org) { //校验点检单