From e47fb46bbf5c463ed67a44235d3ae2b63e186d7a Mon Sep 17 00:00:00 2001
From: Lius <Lius2225@163.com>
Date: 星期一, 04 三月 2024 10:43:33 +0800
Subject: [PATCH] update

---
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentController.java    |   16 ++++++++
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java |   68 ++++++++++++++--------------------
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentService.java         |    6 +++
 3 files changed, 50 insertions(+), 40 deletions(-)

diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentController.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentController.java
index 20bcf7a..d1c20c4 100644
--- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentController.java
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentController.java
@@ -525,4 +525,20 @@
         }
         return Result.OK("鍙嶉鎴愬姛锛�");
     }
+
+
+    @AutoLog(value = "璁惧琛�-閫氳繃杞﹂棿ids鑾峰彇璁惧鏍�")
+    @ApiOperation(value = "璁惧琛�-閫氳繃杞﹂棿ids鑾峰彇璁惧鏍�", notes = "璁惧琛�-閫氳繃杞﹂棿ids鑾峰彇璁惧鏍�")
+    @GetMapping(value = "/loadTreeListByProductionIds")
+    public Result<?> loadTreeListByProductionIds(@RequestParam(name = "ids", required = true) String ids) {
+        Result<List<MdcEquipmentTree>> result = new Result<>();
+        try {
+            List<MdcEquipmentTree> mdcEquipmentTreeList = mdcEquipmentService.loadTreeListByProductionIds(ids);
+            result.setSuccess(true);
+            result.setResult(mdcEquipmentTreeList);
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+        }
+        return result;
+    }
 }
diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentService.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentService.java
index 92c63bd..7230bce 100644
--- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentService.java
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentService.java
@@ -189,4 +189,10 @@
      */
     List<MdcEquipment> exportXlsList(MdcEquipmentVo mdcEquipment);
 
+    /**
+     * 閫氳繃杞﹂棿ids鑾峰彇璁惧鏍�
+     * @param ids
+     * @return
+     */
+    List<MdcEquipmentTree> loadTreeListByProductionIds(String ids);
 }
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 5891439..85dd8df 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
@@ -455,7 +455,7 @@
                             } else {
                                 value = "鏃�";
                             }
-                        }  else if ("alarmContent".equals(englishName)) {
+                        } else if ("alarmContent".equals(englishName)) {
                             if (oporation == 22) {
                                 List<MdcAlarmInfo> mdcAlarmInfo = mdcAlarmInfoService.list(new LambdaQueryWrapper<MdcAlarmInfo>().eq(MdcAlarmInfo::getDriveType, mdcEquipment.getDriveType()).eq(MdcAlarmInfo::getAlarmCode, equipmentLog.getAlarm()).eq(MdcAlarmInfo::getIsUse, 0));
                                 if (mdcAlarmInfo != null && !mdcAlarmInfo.isEmpty()) {
@@ -790,45 +790,6 @@
                     }
                 }
             }
-
-
-//            //鏌ヨ鍗曡〃鏁版嵁
-//            MdcEquipmentDto mdcEquipmentDto = this.baseMapper.getWorkLineLast(saveTableName);
-//            if (mdcEquipmentDto != null) {
-//                MessageDTO messageDTO = new MessageDTO();
-//                messageDTO.setTitle("璁惧杩愯杞�熸姤璀︼紒");
-//                messageDTO.setCategory("棰勮娑堟伅");
-//                messageDTO.setFromUser("admin");
-//                messageDTO.setToUser("admin");
-//                Integer spindlespeed = Integer.valueOf(mdcEquipmentDto.getSpindlespeed());
-//                Integer actualspindlespeed = Integer.valueOf(mdcEquipmentDto.getActualspindlespeed());
-//                if (range.equals(0)) {
-//                    if (spindlespeed > actualspindlespeed) {
-//                        // 瀹為檯鍊煎ぇ浜庤瀹氬��   楂�
-//                        messageDTO.setContent("璁惧缂栧彿涓� [" + mdcEquipment.getEquipmentId() + "] 鐨勮澶囪繍琛岃浆閫熼珮鎶ヨ锛�");
-//                        sysBaseApi.sendSysAnnouncement(messageDTO);
-//                    } else if (spindlespeed < actualspindlespeed) {
-//                        // 瀹為檯鍊煎皬浜庤瀹氬��   浣�
-//                        messageDTO.setContent("璁惧缂栧彿涓� [" + mdcEquipment.getEquipmentId() + "] 鐨勮澶囪繍琛岃浆閫熶綆鎶ヨ锛�");
-//                        sysBaseApi.sendSysAnnouncement(messageDTO);
-//                    }
-//                } else {
-//                    int max = actualspindlespeed + actualspindlespeed * (range / 100);
-//                    int min = actualspindlespeed - actualspindlespeed * (range / 100);
-//                    if (spindlespeed > max || spindlespeed < min) {
-//                        if (spindlespeed > actualspindlespeed) {
-//                            // 瀹為檯鍊煎ぇ浜庤瀹氬��   楂�
-//                            messageDTO.setContent("璁惧缂栧彿涓� [" + mdcEquipment.getEquipmentId() + "] 鐨勮澶囪繍琛岃浆閫熼珮鎶ヨ锛�");
-//                            sysBaseApi.sendSysAnnouncement(messageDTO);
-//                        } else if (spindlespeed < actualspindlespeed) {
-//                            // 瀹為檯鍊煎皬浜庤瀹氬��   浣�
-//                            messageDTO.setContent("璁惧缂栧彿涓� [" + mdcEquipment.getEquipmentId() + "] 鐨勮澶囪繍琛岃浆閫熶綆鎶ヨ锛�");
-//                            sysBaseApi.sendSysAnnouncement(messageDTO);
-//                        }
-//                    }
-//                }
-//
-//            }
         }
 
     }
@@ -849,4 +810,31 @@
         return this.baseMapper.exportXlsList(mdcEquipment);
     }
 
+    /**
+     * 閫氳繃杞﹂棿ids鑾峰彇璁惧鏍�
+     *
+     * @param ids
+     * @return
+     */
+    @Override
+    public List<MdcEquipmentTree> loadTreeListByProductionIds(String ids) {
+        List<String> productionIds = Arrays.asList(ids.split(","));
+        //鑾峰彇鎵�鏈変骇绾挎暟鎹�
+        List<MdcProduction> productionList = mdcProductionService.list(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_0.toString()).orderByAsc(MdcProduction::getProductionOrder));
+        List<String> allProductionIds = new ArrayList<>();
+        //鎵惧埌鎵�鏈変骇绾縤d鐨勪笂绾d
+        if (!productionIds.isEmpty()) {
+            for (String productionId : productionIds) {
+                this.getAllProductionIds(productionList, productionId, allProductionIds);
+            }
+        }
+        //杩囨护浜х嚎鏁版嵁
+        List<MdcProduction> list = productionList.stream().filter((MdcProduction mdcProduction) -> allProductionIds.contains(mdcProduction.getId())).collect(Collectors.toList());
+        //缁勮浜х嚎璁惧鏍�
+        List<MdcEquipmentTree> treeList = FindsEquipmentProductionUtil.wrapEquipmentProductionTreeList(list);
+        //濉厖璁惧鏁版嵁
+        FillEquipmentByProduction(treeList);
+        return treeList;
+    }
+
 }

--
Gitblit v1.9.3