From 5ae1b71ab6b57140d46e6a8b9e606bb4a390ce27 Mon Sep 17 00:00:00 2001
From: Lius <Lius2225@163.com>
Date: 星期一, 03 三月 2025 11:11:46 +0800
Subject: [PATCH] webservice接口

---
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java |  116 +++++++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 87 insertions(+), 29 deletions(-)

diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java
index e3e5503..6c195c4 100644
--- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java
@@ -1,6 +1,5 @@
 package org.jeecg.modules.mdc.service.impl;
 
-import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -9,6 +8,7 @@
 import org.jeecg.common.api.dto.message.MessageDTO;
 import org.jeecg.common.constant.CommonConstant;
 import org.jeecg.common.system.api.ISysBaseAPI;
+import org.jeecg.common.system.vo.DictModel;
 import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.mdc.dto.MdcEquDepDto;
 import org.jeecg.modules.mdc.dto.MdcEquProDto;
@@ -29,10 +29,7 @@
 import org.jeecg.modules.system.entity.SysDepart;
 import org.jeecg.modules.system.mapper.MdcEquipmentDepartMapper;
 import org.jeecg.modules.system.mapper.MdcProductionEquipmentMapper;
-import org.jeecg.modules.system.service.IMdcProductionService;
-import org.jeecg.modules.system.service.IMdcUserProductionService;
-import org.jeecg.modules.system.service.ISysDepartService;
-import org.jeecg.modules.system.service.ISysUserDepartService;
+import org.jeecg.modules.system.service.*;
 import org.springframework.cache.annotation.CacheEvict;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -67,8 +64,6 @@
     @Resource
     private IMdcProductionService mdcProductionService;
     @Resource
-    private IControlSystemService controlSystemService;
-    @Resource
     private IEquipmentWorkLineService equipmentWorkLineService;
     @Resource
     private IMdcDriveTypeParamConfigService mdcDriveTypeParamConfigService;
@@ -77,9 +72,6 @@
 
     @Resource
     private IEquipmentLogService equipmentLogService;
-
-    @Resource
-    private IEquipmentBaseInfoService equipmentBaseInfoService;
 
     @Resource
     private ISysBaseAPI sysBaseApi;
@@ -93,6 +85,11 @@
     @Resource
     private IMdcOverrunAlarmService mdcOverrunAlarmService;
 
+    @Resource
+    private IEquipmentXYZService equipmentXYZService;
+
+    @Resource
+    private ISysDictService sysDictService;
 
     @Override
     public Map<String, String> getDepNamesByEquipmentIds(List<String> equipmentIds) {
@@ -326,25 +323,35 @@
         List<MdcEquipmentMonitor> result = this.baseMapper.checkStatusFromEquipmentIds(equipmentIds);
         if (result != null && !result.isEmpty()) {
             for (MdcEquipmentMonitor mdcEquipmentMonitor : result) {
-                if (mdcEquipmentMonitor.getOporation() != null) {
-                    switch (mdcEquipmentMonitor.getOporation()) {
-                        case 1:
-                        case 2:
-                            mdcEquipmentMonitor.setOporationDict("寰呮満");
-                            break;
-                        case 3:
-                            mdcEquipmentMonitor.setOporationDict("杩愯");
-                            break;
-                        case 22:
-                            mdcEquipmentMonitor.setOporationDict("鎶ヨ");
-                            break;
-                        default:
-                            mdcEquipmentMonitor.setOporationDict("鍏虫満");
-                            break;
+                if (mdcEquipmentMonitor.getEquipmentStatus() == 0) {
+                    if (mdcEquipmentMonitor.getOporation() != null) {
+                        switch (mdcEquipmentMonitor.getOporation()) {
+                            case 1:
+                            case 2:
+                                mdcEquipmentMonitor.setOporationDict("寰呮満");
+                                break;
+                            case 3:
+                                mdcEquipmentMonitor.setOporationDict("杩愯");
+                                break;
+                            case 22:
+                                mdcEquipmentMonitor.setOporationDict("鎶ヨ");
+                                break;
+                            default:
+                                mdcEquipmentMonitor.setOporationDict("鍏虫満");
+                                break;
+                        }
+                    } else {
+                        mdcEquipmentMonitor.setOporationDict("鍏虫満");
+                        mdcEquipmentMonitor.setOporation(0);
                     }
                 } else {
-                    mdcEquipmentMonitor.setOporationDict("鍏虫満");
-                    mdcEquipmentMonitor.setOporation(0);
+                    List<DictModel> dictList = sysDictService.queryEnableDictItemsByCode(CommonConstant.DICT_EQUIPMENT_STATUS);
+                    for (DictModel dictModel : dictList) {
+                        if (Integer.valueOf(dictModel.getValue()).equals(mdcEquipmentMonitor.getEquipmentStatus())) {
+                            mdcEquipmentMonitor.setOporationDict(dictModel.getLabel());
+                            mdcEquipmentMonitor.setOporation(88);
+                        }
+                    }
                 }
             }
         }
@@ -369,13 +376,16 @@
         String saveTableName = mdcEquipmentDetailedDto.getSaveTableName();
         Map<String, Object> mapData = equipmentWorkLineService.getDataList(saveTableName);
         if (mapData != null) {
-            Map<String, Object> runData = new LinkedHashMap<>();
+//            Map<String, Object> runData = new LinkedHashMap<>();
+            List<Map<String, Object>> runData = new ArrayList<>();
             //鑾峰彇 MDC 椹卞姩瀵瑰簲鐨勫睍绀哄弬鏁�   骞舵牴鎹甼ey 鎷艰浠� workData  鏌ヨ鐨勬暟鎹�
             List<MdcDriveTypeParamConfig> mdcDriveTypeParamList = mdcDriveTypeParamConfigService.getShowDriveParam(mdcEquipmentDetailedDto.getDriveType());
             if (mdcDriveTypeParamList != null && !mdcDriveTypeParamList.isEmpty()) {
                 for (MdcDriveTypeParamConfig mdcDriveTypeParamConfig : mdcDriveTypeParamList) {
+                    Map<String, Object> map = new LinkedHashMap<>();
                     String englishName = mdcDriveTypeParamConfig.getEnglishName();
                     String chineseName = mdcDriveTypeParamConfig.getChineseName();
+                    map.put("key", chineseName);
                     if (mapData.containsKey(englishName)) {
                         Object object = mapData.get(englishName);
                         String value = "";
@@ -433,11 +443,45 @@
                         } else {
                             value = object == null ? "" : object.toString();
                         }
-                        runData.put(chineseName, value);
+                        map.put("value", value);
+                        runData.add(map);
+                        if ("spindlebeilv".equals(englishName) && !"".equals(value)) {
+                            result.put("spindlebeilv", value);
+                        }
+                        if ("feedbeilv".equals(englishName) && !"".equals(value)) {
+                            result.put("feedbeilv", value);
+                        }
+                        if ("spindleload".equals(englishName) && !"".equals(value)) {
+                            result.put("spindleload", value);
+                        }
+                        if ("rapidfeed".equals(englishName) && !"".equals(value)) {
+                            result.put("rapidfeed", value);
+                        }
                     }
                 }
             }
             result.put("runData", runData);
+
+            // 鏌ヨ鍧愭爣淇℃伅
+            if (!"ZUOLAN".equals(mdcEquipmentDetailedDto.getDriveType()) && !"CurrentState".equals(mdcEquipmentDetailedDto.getDriveType())) {
+                EquipmentXYZ equipmentXYZ = equipmentXYZService.getByEquipmentId(mdcEquipmentDetailedDto.getEquipmentId());
+                if (equipmentXYZ != null) {
+                    Map<String, Object> map = new HashMap<>();
+                    map.put("xmachine", equipmentXYZ.getXMachine());
+                    map.put("ymachine", equipmentXYZ.getYMachine());
+                    map.put("zmachine", equipmentXYZ.getZMachine());
+                    map.put("amachine", equipmentXYZ.getAMachine());
+                    map.put("bmachine", equipmentXYZ.getBMachine());
+
+                    map.put("xabsolute", equipmentXYZ.getXAbsolute());
+                    map.put("yabsolute", equipmentXYZ.getYAbsolute());
+                    map.put("zabsolute", equipmentXYZ.getZAbsolute());
+                    map.put("aabsolute", equipmentXYZ.getAAbsolute());
+                    map.put("babsolute", equipmentXYZ.getBAbsolute());
+                    result.put("xyzList", map);
+                }
+            }
+
         }
         return result;
     }
@@ -561,6 +605,9 @@
         }
         if (StringUtils.isNotEmpty(mdcEquipment.getEquipmentName())) {
             queryWrapper.like(MdcEquipment::getEquipmentName, mdcEquipment.getEquipmentName());
+        }
+        if (mdcEquipment.getEquipmentStatus() != null) {
+            queryWrapper.eq(MdcEquipment::getEquipmentStatus, mdcEquipment.getEquipmentStatus());
         }
         if (!allEquipments.isEmpty()) {
             queryWrapper.in(MdcEquipment::getEquipmentId, allEquipments);
@@ -858,4 +905,15 @@
         return list.stream().map(MdcEquipment::getEquipmentId).collect(Collectors.toList());
     }
 
+    /**
+     * 鏍规嵁浜х嚎id鑾峰彇璁惧鐘舵�佸垪琛�
+     *
+     * @param workshopId
+     * @return
+     */
+    @Override
+    public List<MdcEquipmentMonitor> getEquipmentMonitorList(String workshopId) {
+        return this.baseMapper.getEquipmentMonitorList(workshopId);
+    }
+
 }

--
Gitblit v1.9.3