From f4f17906d195195585852f1824b829263ba219f2 Mon Sep 17 00:00:00 2001
From: zhoushihao <zsh19950802@163.com>
Date: 星期一, 21 四月 2025 10:09:09 +0800
Subject: [PATCH] 1、中空配置参数由配置yml文件改为数据库配置表获取

---
 hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowBigStorageCageServiceImpl.java       |   11 ++++-
 hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassOutRelationInfoServiceImpl.java |   18 +++++---
 hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/job/OpcHollowRemoveTask.java                                   |    3 +
 hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageHollowTask.java                           |   51 ++++++++++++++++---------
 hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassRelationInfoServiceImpl.java    |   24 ++++++++----
 5 files changed, 70 insertions(+), 37 deletions(-)

diff --git a/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowBigStorageCageServiceImpl.java b/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowBigStorageCageServiceImpl.java
index 45774e9..91fac5f 100644
--- a/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowBigStorageCageServiceImpl.java
+++ b/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowBigStorageCageServiceImpl.java
@@ -7,6 +7,7 @@
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.github.yulichang.wrapper.MPJLambdaWrapper;
 import com.mes.common.config.Const;
+import com.mes.common.config.ConstSysConfig;
 import com.mes.hollow.entity.HollowBigStorageCage;
 import com.mes.hollow.entity.HollowBigStorageCageDetails;
 import com.mes.hollow.entity.dto.FlowCardVirtualSlotDTO;
@@ -16,7 +17,7 @@
 import com.mes.hollow.mapper.HollowGlassRelationInfoMapper;
 import com.mes.hollow.service.HollowBigStorageCageDetailsService;
 import com.mes.hollow.service.HollowBigStorageCageService;
-import org.springframework.beans.factory.annotation.Value;
+import com.mes.sysconfig.service.SysConfigService;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -33,13 +34,15 @@
 @Service
 public class HollowBigStorageCageServiceImpl extends ServiceImpl<HollowBigStorageCageMapper, HollowBigStorageCage> implements HollowBigStorageCageService {
 
-    @Value("${mes.slotWidth}")
-    private Integer slotWidth;
+//    @Value("${mes.slotWidth}")
+//    private Integer slotWidth;
 
     @Resource
     private HollowBigStorageCageDetailsService hollowBigStorageCageDetailsService;
     @Resource
     private HollowGlassRelationInfoMapper hollowGlassRelationInfoMapper;
+    @Resource
+    private SysConfigService sysConfigService;
 
     @Override
     public List<HollowBigStorageAndDetailsDTO> queryHollowBigStorageCageDetail(HollowBigStorageDetailsQueryVO query) {
@@ -68,6 +71,7 @@
 
     @Override
     public List<Map<String, Object>> selectBigStorageCageUsage() {
+        Integer slotWidth = sysConfigService.queryConfigValue(ConstSysConfig.HOLLOW_SLOT_WIDTH);
         QueryWrapper<HollowBigStorageCage> wrapper = new QueryWrapper<>();
         wrapper.select("device_id,ROUND(1 - SUM(CASE WHEN remain_width = " + slotWidth + " THEN 1 ELSE 0 END) / COUNT(device_id), 2)*100 AS percentage,SUM(CASE WHEN remain_width = " + slotWidth + " THEN 1 ELSE 0 END) AS count")
                 .groupBy("device_id");
@@ -80,6 +84,7 @@
         hollowBigStorageCageDetailsService.remove(new LambdaQueryWrapper<HollowBigStorageCageDetails>()
                 .eq(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_NEW));
 //        2灏嗙┖鏍煎瓙鐨勫昂瀵哥疆涓哄垵濮嬪昂瀵�
+        Integer slotWidth = sysConfigService.queryConfigValue(ConstSysConfig.HOLLOW_SLOT_WIDTH);
         this.update(new LambdaUpdateWrapper<HollowBigStorageCage>()
                 .set(HollowBigStorageCage::getRemainWidth, slotWidth)
                 .notInSql(HollowBigStorageCage::getSlot, "select distinct slot from hollow_big_storage_cage_details where state in( 100 , 102 , 103 ,104)"));
diff --git a/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassOutRelationInfoServiceImpl.java b/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassOutRelationInfoServiceImpl.java
index 14d0ff2..48244d2 100644
--- a/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassOutRelationInfoServiceImpl.java
+++ b/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassOutRelationInfoServiceImpl.java
@@ -7,6 +7,7 @@
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.mes.common.config.Const;
+import com.mes.common.config.ConstSysConfig;
 import com.mes.glassinfo.entity.GlassInfo;
 import com.mes.glassinfo.service.GlassInfoService;
 import com.mes.hollow.controller.HollowBigStorageCageController;
@@ -24,6 +25,7 @@
 import com.mes.hollowqueue.entity.HollowGlassQueueInfo;
 import com.mes.hollowqueue.service.HollowGlassQueueInfoService;
 import com.mes.largenscreen.entity.PieChartVO;
+import com.mes.sysconfig.service.SysConfigService;
 import com.mes.tools.DateUtil;
 import com.mes.utils.Blank;
 import com.mes.utils.RedisUtil;
@@ -33,7 +35,6 @@
 import freemarker.template.Version;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.BeanUtils;
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -62,15 +63,17 @@
     HollowFormulaDetailsService hollowFormulaDetailsService;
     @Resource
     HollowGlassRelationInfoService hollowGlassRelationInfoService;
+    @Resource
+    SysConfigService sysConfigService;
 
     @Resource
     RedisUtil redisUtil;
 
-    @Value("${mes.glassGap}")
-    private Integer glassGap;
-
-    @Value("${mes.carWidth}")
-    private Integer carWidth;
+//    @Value("${mes.glassGap}")
+//    private Integer glassGap;
+//
+//    @Value("${mes.carWidth}")
+//    private Integer carWidth;
 
     private static final int ID_RATIO = 10;
 
@@ -359,7 +362,8 @@
                 .queryOutGlassList(request.getFlowCardId(), request.getCell());
         int isPairCount = glassInfo.getTotalLayer() * request.getTotalPairQuantity();
         List<HollowGlassQueueInfo> hollowQueues = new ArrayList<>();
-
+        Integer carWidth = sysConfigService.queryConfigValue(ConstSysConfig.HOLLOW_CAR_WIDTH);
+        Integer glassGap = sysConfigService.queryConfigValue(ConstSysConfig.HOLLOW_GLASS_GAP);
         if (930 == request.getCell()) {
             Map<Integer, List<HollowBigStorageCageDetails>> listMap = hollowBigStorageCageDetailsList.stream()
                     .collect(Collectors.groupingBy(HollowBigStorageCageDetails::getHollowSequence));
diff --git a/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassRelationInfoServiceImpl.java b/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassRelationInfoServiceImpl.java
index 75754d3..5b12e1a 100644
--- a/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassRelationInfoServiceImpl.java
+++ b/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassRelationInfoServiceImpl.java
@@ -6,6 +6,7 @@
 import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.mes.common.config.Const;
+import com.mes.common.config.ConstSysConfig;
 import com.mes.glassinfo.entity.GlassInfo;
 import com.mes.glassinfo.service.GlassInfoService;
 import com.mes.hollow.entity.HollowBigStorageCage;
@@ -23,9 +24,9 @@
 import com.mes.hollow.service.HollowBigStorageCageService;
 import com.mes.hollow.service.HollowGlassOutRelationInfoService;
 import com.mes.hollow.service.HollowGlassRelationInfoService;
+import com.mes.sysconfig.service.SysConfigService;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.BeanUtils;
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -55,13 +56,15 @@
     HollowGlassOutRelationInfoService hollowGlassOutRelationInfoService;
     @Resource
     HollowBigStorageCageDetailsService hollowBigStorageCageDetailsService;
-    @Value("${mes.slotWidth}")
-    private Integer slotWidth;
-    @Value("${mes.glassGap}")
-    private Integer glassGap;
-
-    @Value("${mes.outCarMaxSize}")
-    private Integer outCarMaxSize;
+    @Resource
+    SysConfigService sysConfigService;
+//    @Value("${mes.slotWidth}")
+//    private Integer slotWidth;
+//    @Value("${mes.glassGap}")
+//    private Integer glassGap;
+//
+//    @Value("${mes.outCarMaxSize}")
+//    private Integer outCarMaxSize;
 
     @Override
     public HollowBigStorageDTO queryHollowTargetSlot(String flowCardId, double width, double height, int totalLayer, int layer) {
@@ -100,6 +103,7 @@
                     .last("limit 1")
             );
         }
+        Integer slotWidth = sysConfigService.queryConfigValue(ConstSysConfig.HOLLOW_SLOT_WIDTH);
         //璇︽儏琛ㄥ唴鑾峰彇鏈粍鏄惁宸茬粡鏈夌幓鐠冨湪绗煎瓙鍐咃紙0琛ㄧず鎻愬墠鍗犵敤锛�
         int taskCount = hollowGlassOutRelationInfoService.count(new LambdaQueryWrapper<HollowGlassOutRelationInfo>()
                 .eq(HollowGlassOutRelationInfo::getFlowCardId, flowCardId));
@@ -244,6 +248,10 @@
 //        List<HollowBigStorageCage> hollowSlotList = HollowBigStorageCageService.list(new LambdaQueryWrapper<HollowBigStorageCage>()
 //                .eq(HollowBigStorageCage::getEnableState, Const.SLOT_ON).eq(HollowBigStorageCage::getRemainWidth, slotWidth));
         //鏂瑰紡浜岋細灏嗙幓鐠冩寜娴佺▼鍗°�佸昂瀵搞�佺増鍥俱�佺増搴� 锛屼紭鍏堝皢鏍煎瓙鍏ㄩ儴琛ュ叏鍚� 渚濇璁$畻鍚庨潰鐨勬牸瀛愬彿
+
+        Integer slotWidth = sysConfigService.queryConfigValue(ConstSysConfig.HOLLOW_SLOT_WIDTH);
+        Integer glassGap = sysConfigService.queryConfigValue(ConstSysConfig.HOLLOW_GLASS_GAP);
+        Integer outCarMaxSize = sysConfigService.queryConfigValue(ConstSysConfig.HOLLOW_OUT_CAR_SIZE);
         List<HollowGlassRelationInfo> relationInfoList = new ArrayList();
         List<List<HollowGlassRelationInfo>> tempHollowList = new ArrayList<>();
         int slotNumber = 1;
diff --git a/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/job/OpcHollowRemoveTask.java b/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/job/OpcHollowRemoveTask.java
index 8373e0a..f684f6c 100644
--- a/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/job/OpcHollowRemoveTask.java
+++ b/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/job/OpcHollowRemoveTask.java
@@ -43,7 +43,7 @@
         hollowRemoveChildTask("CMJ2.CMJ2.");
     }
 
-      private void hollowRemoveChildTask(String cell) throws Exception {
+    private void hollowRemoveChildTask(String cell) throws Exception {
         ReadWriteEntity requestEntity = miloService.readFromOpcUa(cell + "mesControl");
         if ("0".equals(requestEntity.getValue() + "")) {
             log.info("褰撳墠闄よ啘鏈轰负鍗曟満鐘舵��");
@@ -60,6 +60,7 @@
             log.info("褰撳墠鏈敹鍒扮幓鐠僫d鏁版嵁锛岀粨鏉熶换鍔�");
             return;
         }
+        log.info("褰撳墠闇�瑕侀櫎鑶滅殑鐜荤拑id涓猴細{}", glassIdEntity.getValue() + "");
         //鎸夌収鐜荤拑id鑾峰彇瀵瑰簲鐨勪换鍔d
         HollowGlassFormulaVO detailsVO = hollowFormulaDetailsService.queryFormulaDetailsByGlassId(glassIdEntity.getValue() + "", null, null);
         if (null == detailsVO) {
diff --git a/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageHollowTask.java b/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageHollowTask.java
index 187f923..733c1e3 100644
--- a/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageHollowTask.java
+++ b/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageHollowTask.java
@@ -12,6 +12,7 @@
 import com.mes.bigstoragecagetask.entity.BigStorageCageTask;
 import com.mes.bigstoragecagetask.service.BigStorageCageTaskService;
 import com.mes.common.config.Const;
+import com.mes.common.config.ConstSysConfig;
 import com.mes.damage.entity.Damage;
 import com.mes.damage.service.DamageService;
 import com.mes.glassinfo.entity.GlassInfo;
@@ -32,6 +33,7 @@
 import com.mes.hollowqueue.service.HollowGlassQueueInfoService;
 import com.mes.hollowtask.entity.HollowBigStorageCageHistoryTask;
 import com.mes.hollowtask.service.HollowBigStorageCageHistoryTaskService;
+import com.mes.sysconfig.service.SysConfigService;
 import com.mes.temperingglass.entity.TemperingGlassInfo;
 import com.mes.temperingglass.service.TemperingGlassInfoService;
 import com.mes.utils.RedisUtil;
@@ -39,7 +41,6 @@
 import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
 
@@ -75,6 +76,8 @@
     private HollowGlassQueueInfoService hollowGlassQueueInfoService;
     @Resource
     private HollowGlassOutRelationInfoService hollowGlassOutRelationInfoService;
+    @Resource
+    private SysConfigService sysConfigService;
 
     private static final String BIG_STORAGE_CAGE_IN_TWO_TASK = "big_storage_cage_in_two_task";
     private static final String BIG_STORAGE_CAGE_OUT_TWO_TASK = "big_storage_cage_out_two_task";
@@ -87,22 +90,22 @@
     @Resource
     private RedisUtil redisUtil;
 
-    @Value("${mes.slotWidth}")
-    private Integer slotWidth;
-
-    @Value("${mes.glassGap}")
-    private Integer glassGap;
-
-    @Value("${mes.carWidth}")
-    private Integer carWidth;
-
-    @Value("${mes.outCarMaxSize}")
-    private Integer outCarMaxSize;
-
-    @Value("${mes.slotMaxHeight}")
-    private Integer slotMaxHeight;
-    @Value("${mes.slotMaxthickness}")
-    private Integer slotMaxthickness;
+//    @Value("${mes.slotWidth}")
+//    private Integer slotWidth;
+//
+//    @Value("${mes.glassGap}")
+//    private Integer glassGap;
+//
+//    @Value("${mes.carWidth}")
+//    private Integer carWidth;
+//
+//    @Value("${mes.outCarMaxSize}")
+//    private Integer outCarMaxSize;
+//
+//    @Value("${mes.slotMaxHeight}")
+//    private Integer slotMaxHeight;
+//    @Value("${mes.slotMaxthickness}")
+//    private Integer slotMaxthickness;
 
     @Scheduled(fixedDelay = 1000)
     public void inBigStorageTask() throws Exception {
@@ -166,6 +169,8 @@
             miloService.writeToOpcWord(generateReadWriteEntity("DLP2A.DLP2A.alarmSignal", 8));
             return;
         }
+
+        Integer slotWidth = sysConfigService.queryConfigValue(ConstSysConfig.HOLLOW_SLOT_WIDTH);
         //鎸夌収鐜荤拑鍘氬害鍒嗙粍锛屽垽鏂墿浣欐牸瀛愭槸鍚﹀彲浠ュ瓨鏀�
         Map<Double, Long> thickCountMap = glassInfoList.stream().collect(Collectors.groupingBy(GlassInfo::getThickness, Collectors.counting()));
         for (Map.Entry<Double, Long> entry : thickCountMap.entrySet()) {
@@ -181,6 +186,8 @@
             }
         }
         //瓒呭ぇ灏哄
+        Integer slotMaxHeight = sysConfigService.queryConfigValue(ConstSysConfig.HOLLOW_SLOT_MAX_HEIGHT);
+        Integer slotMaxthickness = sysConfigService.queryConfigValue(ConstSysConfig.HOLLOW_SLOT_MAX_THICKNESS);
         if (slotMaxHeight < Math.min(glassInfoList.get(0).getWidth(), glassInfoList.get(0).getHeight()) || glassInfoList.get(0).getThickness() >= slotMaxthickness) {
             int count = hollowBigStorageCageDetailsService.count(new LambdaQueryWrapper<HollowBigStorageCageDetails>()
                     .eq(HollowBigStorageCageDetails::getSlot, THROUGH_SLOT)
@@ -206,6 +213,8 @@
 
         //璁$畻鐩爣鏍煎瓙
         List<HollowBigStorageCageHistoryTask> historyTasks = new ArrayList<>();
+
+        Integer glassGap = sysConfigService.queryConfigValue(ConstSysConfig.HOLLOW_GLASS_GAP);
         try {
             if (slotMaxHeight > Math.min(glassInfoList.get(0).getWidth(), glassInfoList.get(0).getHeight()) && glassInfoList.get(0).getThickness() < slotMaxthickness) {
                 for (BigStorageCageTask task : inTaskList) {
@@ -777,6 +786,8 @@
                 break;
             }
         }
+
+        Integer slotWidth = sysConfigService.queryConfigValue(ConstSysConfig.HOLLOW_SLOT_WIDTH);
         if (isPair == 0 && isForce != 1) {
             taskType = Const.BIG_STORAGE_AFTER_DISPATCH;
             taskState = Const.GLASS_STATE_SCHEDULE_ING;
@@ -823,7 +834,9 @@
         //浠诲姟鏁版嵁:鑾峰彇杞﹀瓙瀛樻斁鐜荤拑鏈�澶ф暟閲�,鐜荤拑闂撮殧
         List<T> templist = new ArrayList<>();
         //鎵撹溅鍓╀綑灏哄
-        Integer remainWidth = carWidth;
+        Integer remainWidth = sysConfigService.queryConfigValue(ConstSysConfig.HOLLOW_SLOT_WIDTH);
+        Integer outCarMaxSize = sysConfigService.queryConfigValue(ConstSysConfig.HOLLOW_OUT_CAR_SIZE);
+        Integer glassGap = sysConfigService.queryConfigValue(ConstSysConfig.HOLLOW_GLASS_GAP);
         for (T e : list) {
             if (templist.size() >= outCarMaxSize || Math.max((int) e.getWidth(), (int) e.getHeight()) > remainWidth) {
                 break;
@@ -901,6 +914,8 @@
                 .in(HollowBigStorageCageDetails::getSlot, slotList).in(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL));
         Map<Integer, Double> slotRemainMap = new HashMap<>();
         //鏄惁瀛樺湪鏈夋牸瀛愰潪绌虹殑鐜荤拑
+        Integer glassGap = sysConfigService.queryConfigValue(ConstSysConfig.HOLLOW_GLASS_GAP);
+        Integer slotWidth = sysConfigService.queryConfigValue(ConstSysConfig.HOLLOW_SLOT_WIDTH);
         if (CollectionUtils.isNotEmpty(inSlotGlassList)) {
             //瀛樺湪  灏嗘牸瀛愬唴鐨勭幓鐠冨垎鍒繘琛屾洿鏂�
 //            List<HollowBigStorageCage> hollowBigStorageCageList = hollowBigStorageCageService.list(new LambdaQueryWrapper<HollowBigStorageCage>()

--
Gitblit v1.8.0