From f9f3535125e2ab51d0f8c2d56293bd549a07b54c Mon Sep 17 00:00:00 2001
From: Lius <Lius2225@163.com>
Date: 星期五, 19 四月 2024 15:26:01 +0800
Subject: [PATCH] 设备级设备详细信息

---
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/IMdcHomeServiceImpl.java |   60 +++++++++++++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 51 insertions(+), 9 deletions(-)

diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/IMdcHomeServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/IMdcHomeServiceImpl.java
index dc7a99f..ead8275 100644
--- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/IMdcHomeServiceImpl.java
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/IMdcHomeServiceImpl.java
@@ -1,18 +1,24 @@
 package org.jeecg.modules.mdc.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.StringUtils;
-import org.jeecg.modules.mdc.entity.EquipmentLog;
+import org.jeecg.common.system.vo.DictModel;
+import org.jeecg.modules.mdc.constant.MdcConstant;
+import org.jeecg.modules.mdc.dto.MdcEquipmentDto;
+import org.jeecg.modules.mdc.entity.Equipment;
 import org.jeecg.modules.mdc.entity.MdcEquipment;
 import org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalInfo;
 import org.jeecg.modules.mdc.entity.MdcOverallEquipmentEfficiency;
 import org.jeecg.modules.mdc.mapper.MdcHomeMapper;
-import org.jeecg.modules.mdc.service.IEquipmentLogService;
+import org.jeecg.modules.mdc.service.IEquipmentService;
+import org.jeecg.modules.mdc.service.IEquipmentWorkLineService;
 import org.jeecg.modules.mdc.service.IMdcEquipmentService;
 import org.jeecg.modules.mdc.service.IMdcHomeService;
 import org.jeecg.modules.mdc.util.DateUtils;
 import org.jeecg.modules.mdc.vo.*;
 import org.jeecg.modules.system.entity.MdcProduction;
 import org.jeecg.modules.system.service.IMdcProductionService;
+import org.jeecg.modules.system.service.ISysDictService;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -32,7 +38,13 @@
     private IMdcEquipmentService mdcEquipmentService;
 
     @Resource
-    private IEquipmentLogService equipmentLogService;
+    private IEquipmentService equipmentService;
+
+    @Resource
+    private ISysDictService sysDictService;
+
+    @Resource
+    private IEquipmentWorkLineService equipmentWorkLineService;
 
     @Resource
     private MdcHomeMapper mdcHomeMapper;
@@ -70,11 +82,12 @@
         if (equipmentIdList == null || equipmentIdList.isEmpty()) {
             return result;
         }
-        List<EquipmentLog> logList = equipmentLogService.getEquipmentStatusList(equipmentIdList);
-        if (logList != null && !logList.isEmpty()) {
-            for (EquipmentLog equipmentLog : logList) {
-                if (equipmentLog.getOporation() != null) {
-                    switch (equipmentLog.getOporation()) {
+//        List<EquipmentLog> logList = equipmentLogService.getEquipmentStatusList(equipmentIdList);
+        List<Equipment> equipmentList = equipmentService.list(new LambdaQueryWrapper<Equipment>().in(Equipment::getEquipmentid, equipmentIdList));
+        if (equipmentList != null && !equipmentList.isEmpty()) {
+            for (Equipment equipment : equipmentList) {
+                if (equipment.getOporation() != null) {
+                    switch (equipment.getOporation()) {
                         case 1:
                         case 2:
                             mdcEquipmentStatusVo.setWaitCount(mdcEquipmentStatusVo.getWaitCount() + 1);
@@ -143,6 +156,9 @@
                 }
                 result.add(mdcCommonVo);
             }
+        }
+        if (!result.isEmpty()) {
+            result.sort(Comparator.comparing(MdcCommonVo::getValue).reversed());
         }
         return result;
     }
@@ -248,7 +264,8 @@
         String start = DateUtils.format(DateUtils.toDate(LocalDate.now().plusDays(-7).toString(), DateUtils.STR_DATE), DateUtils.STRDATE);
         String end = DateUtils.format(DateUtils.toDate(LocalDate.now().plusDays(-1).toString(), DateUtils.STR_DATE), DateUtils.STRDATE);
         if (equipmentIdList != null && !equipmentIdList.isEmpty()) {
-            result.put("equipmentIdList", equipmentIdList);
+            List<MdcEquipment> mdcEquipmentList = mdcEquipmentService.list(new LambdaQueryWrapper<MdcEquipment>().in(MdcEquipment::getEquipmentId, equipmentIdList));
+            result.put("mdcEquipmentList", mdcEquipmentList);
             List<MdcEquipmentStatisticalInfo> mdcEquipmentStatisticalInfoList = mdcHomeMapper.getEquipmentSevenUtilizationStatistics(equipmentIdList, start, end);
             List<EquipmentDayUtilizationVo> dataList = new ArrayList<>();
             if (mdcEquipmentStatisticalInfoList != null && !mdcEquipmentStatisticalInfoList.isEmpty()) {
@@ -438,4 +455,29 @@
     public List<MdcEquipment> getEquipmentList(String key) {
         return mdcHomeMapper.getEquipmentList(key);
     }
+
+    @Override
+    public MdcEquipmentDto getEquipmentDetails(String equipmentId) {
+        MdcEquipment mdcEquipment = mdcEquipmentService.getOne(new LambdaQueryWrapper<MdcEquipment>().eq(MdcEquipment::getEquipmentId, equipmentId));
+        List<DictModel> dictModelList = sysDictService.queryEnableDictItemsByCode(MdcConstant.SERIA_TYPE);
+        if (dictModelList != null && !dictModelList.isEmpty()) {
+            for (DictModel dictModel : dictModelList) {
+                if (dictModel.getValue().equals(mdcEquipment.getDriveType())) {
+                    return null;
+                }
+            }
+        }
+        String saveTableName = mdcEquipment.getSaveTableName();
+        MdcEquipmentDto dto = equipmentWorkLineService.getMacingDataList(saveTableName);
+        if ("LSV2".equals(mdcEquipment.getDriveType())) {
+            dto.setSpindlebeilv(dto.getSFeed());
+            dto.setFeedbeilv(dto.getFFeed());
+            dto.setRapidfeed(dto.getRapidfeed());
+            dto.setNCVersion(dto.getNCVersion());
+            dto.setTNCVersion(dto.getTNCVersion());
+            dto.setOPTVersion(dto.getOPTVersion());
+            dto.setPLCVersion(dto.getPLCVersion());
+        }
+        return dto;
+    }
 }

--
Gitblit v1.9.3