From f3f7eba817015e3711004759998389849212f7de Mon Sep 17 00:00:00 2001
From: Lius <Lius2225@163.com>
Date: 星期一, 15 一月 2024 15:06:41 +0800
Subject: [PATCH] ZUOLAN设备看板添加字段

---
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java |   54 +++++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 43 insertions(+), 11 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 a4c2b51..83bebd6 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
@@ -35,6 +35,7 @@
 import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.util.*;
@@ -73,6 +74,9 @@
 
     @Resource
     private IEquipmentLogService equipmentLogService;
+
+    @Resource
+    private IEquipmentBaseInfoService equipmentBaseInfoService;
 
     @Override
     public Map<String, String> getDepNamesByEquipmentIds(List<String> equipmentIds) {
@@ -372,6 +376,15 @@
                 mdcEquipmentDto.setSequencenumber(dto.getSequencenumber());
                 mdcEquipmentDto.setExecutingcode(dto.getExecutingcode());
                 mdcEquipmentDto.setProductName(dto.getProductName());
+                if ("LSV2".equals(mdcEquipment.getDriveType())) {
+                    mdcEquipmentDto.setSpindlebeilv(dto.getSFeed());
+                    mdcEquipmentDto.setFeedbeilv(dto.getFFeed());
+                    mdcEquipmentDto.setRapidfeed(dto.getRapidfeed());
+                    mdcEquipmentDto.setNCVersion(dto.getNCVersion());
+                    mdcEquipmentDto.setTNCVersion(dto.getTNCVersion());
+                    mdcEquipmentDto.setOPTVersion(dto.getOPTVersion());
+                    mdcEquipmentDto.setPLCVersion(dto.getPLCVersion());
+                }
 
                 //鑾峰彇 MDC 椹卞姩瀵瑰簲鐨勫睍绀哄弬鏁�   骞舵牴鎹甼ey 鎷艰浠� workData  鏌ヨ鐨勬暟鎹�
                 List<MdcDriveTypeParamConfig> mdcDriveTypeParamList = mdcDriveTypeParamConfigService.getShowDriveParam(mdcEquipment.getDriveType());
@@ -384,15 +397,23 @@
                         if ("CollectTime".equals(englishName)) {
                             Date date = result == null ? null : (Date) result;
                             value = DateUtils.format(date, DateUtils.STR_DATE_TIME_SMALL);
-                        } else {
-                            value = result == null ? null : result.toString();
-                        }
-                        // ZUOLAN璁惧鐢垫祦瀛楁AI01
-                        if ("ZUOLAN".equals(mdcEquipment.getDriveType()) && "AI01".equals(englishName) && oporation == 3) {
+                        } else if ("ZUOLAN".equals(mdcEquipment.getDriveType()) && "AI01".equals(englishName) && oporation == 3) {
+                            // ZUOLAN璁惧鐢垫祦瀛楁AI01
                             value = BigDecimal.valueOf(Math.random() * 15 + 0).setScale(1, RoundingMode.HALF_UP).toString();
-                        }
-                        // 鍏朵粬璁惧鐢垫祦瀛楁
-                        if ("spindle_current".equals(englishName)) {
+                        } else if ("ZUOLAN".equals(mdcEquipment.getDriveType()) && "spindlespeed".equals(englishName) && oporation == 3) {
+                            // ZUOLAN璁惧涓昏酱杞�熷瓧娈祍pindlespeed
+                            value = String.valueOf(((new Random().nextInt(35)) + 1) * 100);
+                        } else if ("ZUOLAN".equals(mdcEquipment.getDriveType()) && "spindleload".equals(englishName) && oporation == 3) {
+                            // ZUOLAN璁惧涓昏酱璐熻嵎瀛楁spindleload
+                            value = String.valueOf(Integer.valueOf(new Random().nextInt(21)));
+                        } else if ("ZUOLAN".equals(mdcEquipment.getDriveType()) && "spindlebeilv".equals(englishName) && oporation == 3) {
+                            // ZUOLAN璁惧涓昏酱鍊嶇巼瀛楁spindlebeilv
+                            value = String.valueOf((new Random().nextInt(13)) * 10);
+                        } else if ("ZUOLAN".equals(mdcEquipment.getDriveType()) && "feedbeilv".equals(englishName) && oporation == 3) {
+                            // ZUOLAN璁惧杩涚粰鍊嶇巼瀛楁feedbeilv
+                            value = String.valueOf((new Random().nextInt(13)) * 10);
+                        } else if ("spindle_current".equals(englishName)) {
+                            // 鍏朵粬璁惧鐢垫祦瀛楁
                             String devicePower = mdcEquipment.getDevicePower();
                             Object spindleload = jsonObject.get("spindleload");
                             BigDecimal load = spindleload == null ? BigDecimal.ZERO : new BigDecimal(spindleload.toString());
@@ -401,19 +422,25 @@
                             } else {
                                 value = "0";
                             }
-                        }
-                        // 鎵煩瀛楁
-                        if ("torque".equals(englishName)) {
+                        } else if ("torque".equals(englishName)) {
+                            // 鎵煩瀛楁
                             MdcTorqueConfig mdcTorqueConfig = mdcTorqueConfigMapper.findLast(mdcEquipment.getEquipmentId());
                             if (mdcTorqueConfig != null) {
                                 value = String.valueOf(mdcTorqueConfig.getTorqueValue());
                             } else {
                                 value = "0";
                             }
+                        } else {
+                            value = result == null ? null : result.toString();
                         }
                         mdcDriveTypeParamConfig.setValue(value);
                     }
                     mdcEquipmentDto.setMdcDriveTypeParamConfigList(mdcDriveTypeParamList);
+                }
+                EquipmentBaseInfo equipmentBaseInfo = equipmentBaseInfoService.getByEquipmentId(mdcEquipment.getEquipmentId());
+                if (equipmentBaseInfo != null) {
+                    mdcEquipmentDto.setMaxAxis(equipmentBaseInfo.getMaxAxis());
+                    mdcEquipmentDto.setValidAxis(equipmentBaseInfo.getValidAxis());
                 }
             }
         }
@@ -668,4 +695,9 @@
         return list.stream().map(MdcEquipment::getEquipmentId).collect(Collectors.toList());
     }
 
+    @Override
+    public IPage<MdcEquipment> pageList(Page<MdcEquipment> page, MdcEquipmentVo mdcEquipment, HttpServletRequest req) {
+        return this.baseMapper.pageList(page, mdcEquipment);
+    }
+
 }

--
Gitblit v1.9.3