From 79a5fbbb1ec0c6ddfe297b16a82d47dbfd64afd0 Mon Sep 17 00:00:00 2001 From: jun Date: Mon, 8 Jul 2024 19:01:22 +0800 Subject: [PATCH] =?UTF-8?q?41794=20MES-PDA=EF=BC=9A=E7=82=B9=E6=A3=80-?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=82=B9=E6=A3=80=E5=8D=95=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E6=B1=87=E6=80=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/busi/spot/IMesSpotCheckOrderService.java | 11 ++++++ .../busi/spot/MesSpotCheckOrderController.java | 13 +++++++ .../serviceimpl/busi/MesSpotCheckOrderService.java | 33 +++++++++++++++--- .../pcn/pojo/model/MesEquipmentSpotCheckModel.java | 40 ++++++++++++++++++++++ 4 files changed, 92 insertions(+), 5 deletions(-) create mode 100644 modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/model/MesEquipmentSpotCheckModel.java 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 e2b939d..81efbaf 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 @@ -1,5 +1,6 @@ package cn.estsh.i3plus.ext.mes.pcn.api.busi.spot; +import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesEquipmentSpotCheckModel; 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; @@ -34,6 +35,16 @@ public interface IMesSpotCheckOrderService { * 查询点检单 * * @param spotCheckOrder + * @return + */ + @ApiOperation("查询设备点检") + List findEquipmentSpotCheck(MesEquipmentSpotCheck spotCheckOrder); + + /** + * 、 + * 查询点检单 + * + * @param spotCheckOrder * @param pager * @return */ 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 bb80ede..e64ea76 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 @@ -28,6 +28,19 @@ public class MesSpotCheckOrderController { @Autowired private IMesSpotCheckOrderService spotCheckOrderService; + @GetMapping("/find-equipment-spot") + @ApiOperation(value = "查询设备点检") + public ResultBean queryEquipmentSpotCheckMap(MesEquipmentSpotCheck spotCheckOrder) { + try { + spotCheckOrder.setOrganizeCode(AuthUtil.getOrganizeCode()); + return ResultBean.success("查询成功").setResultList(spotCheckOrderService.findEquipmentSpotCheck(spotCheckOrder)); + } catch (ImppBusiException imppException) { + return ResultBean.fail(imppException); + } catch (Exception e) { + return ImppExceptionBuilder.newInstance().buildExceptionResult(e); + } + } + @GetMapping("/query-equipment-spot") @ApiOperation(value = "查询设备点检") 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 8298823..15fcb1b 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 @@ -2,6 +2,7 @@ package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi; 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.MesEquipmentSpotCheckModel; import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesSpotCheckOrderModel; import cn.estsh.i3plus.icloud.core.sdk.ICoreUtilCloud; import cn.estsh.i3plus.mes.pcn.api.iservice.busi.ISyncFuncService; @@ -32,10 +33,7 @@ import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; import org.springframework.util.StringUtils; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.stream.Collectors; /** @@ -89,6 +87,30 @@ public class MesSpotCheckOrderService implements IMesSpotCheckOrderService { } @Override + public List findEquipmentSpotCheck(MesEquipmentSpotCheck spotCheckOrder) { + List mesEquipmentSpotCheckList = queryEquipmentSpotCheck(spotCheckOrder); + if(CollectionUtils.isEmpty(mesEquipmentSpotCheckList)){ + return null; + } + Map> mesEquipmentSpotCheckMap = mesEquipmentSpotCheckList.stream().collect(Collectors.groupingBy(MesEquipmentSpotCheck::getEquipCode)); + List mesEquipmentSpotCheckModelList = new ArrayList<>(); + for (Map.Entry> mesEquipmentSpotCheckEntry : mesEquipmentSpotCheckMap.entrySet()) { + MesEquipmentSpotCheck next = mesEquipmentSpotCheckEntry.getValue().iterator().next(); + MesEquipmentSpotCheckModel mesEquipmentSpotCheckModel = new MesEquipmentSpotCheckModel(); + BeanUtils.copyProperties(next,mesEquipmentSpotCheckModel); + Map> listMap = mesEquipmentSpotCheckEntry.getValue().stream().collect(Collectors.groupingBy(MesEquipmentSpotCheck::getSpotCheckOrderType)); + for (Map.Entry> entry : listMap.entrySet()) { + MesEquipmentSpotCheckModel.MesEquipmentSpotCheckDataModel mesEquipmentSpotCheckDataModel = new MesEquipmentSpotCheckModel.MesEquipmentSpotCheckDataModel(); + mesEquipmentSpotCheckDataModel.setSpotCheckOrderType(entry.getKey()); + mesEquipmentSpotCheckDataModel.setSpotCheckList(entry.getValue()); + mesEquipmentSpotCheckModel.getSpotCheckDataModelList().add(mesEquipmentSpotCheckDataModel); + } + mesEquipmentSpotCheckModelList.add(mesEquipmentSpotCheckModel); + } + return mesEquipmentSpotCheckModelList; + } + + @Override public List queryEquipmentSpotCheck(MesEquipmentSpotCheck bean) { DdlPackBean packBean = DdlPackBean.getDdlPackBean(bean.getOrganizeCode(), bean.getIsValid()); @@ -97,7 +119,8 @@ public class MesSpotCheckOrderService implements IMesSpotCheckOrderService { DdlPreparedPack.getStringLikerPack(bean.getSpotCheckName(), "spotCheckName", packBean); DdlPreparedPack.getStringEqualPack(bean.getWorkCenterCode(), "workCenterCode", packBean); DdlPreparedPack.getStringEqualPack(bean.getWorkCellCode(), "workCellCode", packBean); - + DdlPreparedPack.getStringEqualPack(bean.getEquipCode(), "equipCode", packBean); + DdlPreparedPack.getNumEqualPack(bean.getSpotCheckOrderType(), "spotCheckOrderType", packBean); return equipmentSpotCheckRepository.findByHqlWhere(packBean); } diff --git a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/model/MesEquipmentSpotCheckModel.java b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/model/MesEquipmentSpotCheckModel.java new file mode 100644 index 0000000..ef32452 --- /dev/null +++ b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/model/MesEquipmentSpotCheckModel.java @@ -0,0 +1,40 @@ +package cn.estsh.i3plus.ext.mes.pcn.pojo.model; + +import cn.estsh.i3plus.pojo.mes.bean.MesEquipmentSpotCheck; +import io.swagger.annotations.ApiParam; +import lombok.Data; + +import java.util.ArrayList; +import java.util.List; + +/** + * @Description : 设备点检Model + * @Reference : + * @Author : junsheng.li + * @CreateDate 2024/7/8 17:37 + * @Modify: + **/ +@Data +public class MesEquipmentSpotCheckModel { + + @ApiParam("设备Code") + private String equipCode; + + @ApiParam("设备名称") + private String equipName; + + @ApiParam("点检单类型") + private List spotCheckDataModelList = new ArrayList<>(); + + @Data + public static class MesEquipmentSpotCheckDataModel { + @ApiParam("点检单类型") + private Integer spotCheckOrderType; + + @ApiParam("设备点检") + List spotCheckList; + + public MesEquipmentSpotCheckDataModel() { + } + } +} \ No newline at end of file