From 2b91b242113bd10f1be241d19ab154e9ad6506cd Mon Sep 17 00:00:00 2001
From: wangfei <3597712270@qq.com>
Date: 星期二, 10 六月 2025 14:18:00 +0800
Subject: [PATCH] 国际化命名

---
 hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/service/impl/BigStorageGlassInfoServiceImpl.java |  116 +++++++++++++++++++++++++++++++++------------------------
 1 files changed, 67 insertions(+), 49 deletions(-)

diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/service/impl/BigStorageGlassInfoServiceImpl.java b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/service/impl/BigStorageGlassInfoServiceImpl.java
index 5b683fa..e24376a 100644
--- a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/service/impl/BigStorageGlassInfoServiceImpl.java
+++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/service/impl/BigStorageGlassInfoServiceImpl.java
@@ -9,19 +9,18 @@
 import com.mes.bigstorage.entity.BigStorageGlassInfo;
 import com.mes.bigstorage.entity.BigStorageGlassRelationInfo;
 import com.mes.bigstorage.entity.dto.BigStorageDTO;
-import com.mes.bigstorage.entity.dto.BigStorageRelationDTO;
-import com.mes.bigstorage.entity.dto.BigStorageSequenceDTO;
 import com.mes.bigstorage.mapper.BigStorageGlassInfoMapper;
 import com.mes.bigstorage.service.BigStorageCageDetailsService;
 import com.mes.bigstorage.service.BigStorageCageService;
 import com.mes.bigstorage.service.BigStorageGlassInfoService;
 import com.mes.bigstorage.service.BigStorageGlassRelationInfoService;
 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.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;
@@ -47,30 +46,46 @@
     BigStorageCageDetailsService bigStorageCageDetailsService;
     @Resource
     BigStorageGlassRelationInfoService bigStorageGlassRelationInfoService;
-    @Value("${mes.slotWidth}")
-    private Integer slotWidth;
-    @Value("${mes.glassGap}")
-    private Integer glassGap;
+    @Resource
+    SysConfigService sysConfigService;
+//    @Value("${mes.slotWidth}")
+//    private Integer slotWidth;
+//    @Value("${mes.glassGap}")
+//    private Integer glassGap;
+//    @Value("${mes.outCarMaxSize}")
+//    private Integer outCarMaxSize;
 
     @Override
-    public BigStorageDTO queryBigStorageTargetSlot(String glassId) {
+    public BigStorageDTO queryBigStorageTargetSlot(String engineerId, Integer temperingLayoutId, Integer temperingFeedSequence) {
         //鎸夌収鐜荤拑淇℃伅鑾峰彇鍏崇郴琛ㄦ槸鍚︽湁瀵瑰簲鐨勫叧绯�
         BigStorageGlassRelationInfo relationInfoOne = bigStorageGlassRelationInfoService.getOne(new LambdaQueryWrapper<BigStorageGlassRelationInfo>()
-                .eq(BigStorageGlassRelationInfo::getGlassId, glassId));
+                .eq(BigStorageGlassRelationInfo::getEngineerId, engineerId)
+                .eq(BigStorageGlassRelationInfo::getTemperingLayoutId, temperingLayoutId)
+                .eq(BigStorageGlassRelationInfo::getTemperingFeedSequence, temperingFeedSequence)
+        );
         if (relationInfoOne == null) {
             //鐞嗙墖绗煎叧绯昏〃涓病鏈夊搴旂殑鏁版嵁锛屾煡鐪嬬悊鐗囩铏氭嫙浣嶇疆琛ㄦ槸鍚︽湁鏈伐绋嬩笅鐨勬墍鏈夌幓鐠冭櫄鎷熶俊鎭�
-            BigStorageGlassInfo bigStorageGlassInfo = this.getOne(new LambdaQueryWrapper<BigStorageGlassInfo>().eq(BigStorageGlassInfo::getGlassId, glassId));
+            BigStorageGlassInfo bigStorageGlassInfo = this.getOne(new LambdaQueryWrapper<BigStorageGlassInfo>()
+                    .eq(BigStorageGlassInfo::getEngineerId, engineerId)
+                    .eq(BigStorageGlassInfo::getTemperingLayoutId, temperingLayoutId)
+                    .eq(BigStorageGlassInfo::getTemperingFeedSequence, temperingFeedSequence));
             if (null == bigStorageGlassInfo) {
                 //铏氭嫙浣嶇疆琛ㄦ病鏈夋湰宸ョ▼涓嬬殑鎵�鏈夌幓鐠冭櫄鎷熶俊鎭紝鎸夌収鐜荤拑id鐢熸垚鏈伐绋嬩笅鎵�鏈夌幓鐠冪殑铏氭嫙淇℃伅
-                generateBigStorageGlassInfo(glassId);
-                bigStorageGlassInfo = this.getOne(new LambdaQueryWrapper<BigStorageGlassInfo>().eq(BigStorageGlassInfo::getGlassId, glassId));
+                generateBigStorageGlassInfo(engineerId, temperingLayoutId);
+                bigStorageGlassInfo = this.getOne(new LambdaQueryWrapper<BigStorageGlassInfo>()
+                        .eq(BigStorageGlassInfo::getEngineerId, engineerId)
+                        .eq(BigStorageGlassInfo::getTemperingLayoutId, temperingLayoutId)
+                        .eq(BigStorageGlassInfo::getTemperingFeedSequence, temperingFeedSequence));
             }
             //鎸夌収铏氭嫙浣嶇疆鍜屽ぇ鐞嗙墖绗肩幇鏈夊彲鐢ㄦ牸瀛愮敓鎴愬叧绯昏〃
             bigStorageSlotPair(bigStorageGlassInfo);
             //鍏崇郴琛ㄨ幏鍙栧疄闄呬綅缃�
             relationInfoOne = bigStorageGlassRelationInfoService.getOne(new LambdaQueryWrapper<BigStorageGlassRelationInfo>()
-                    .eq(BigStorageGlassRelationInfo::getGlassId, glassId));
+                    .eq(BigStorageGlassRelationInfo::getEngineerId, engineerId)
+                    .eq(BigStorageGlassRelationInfo::getTemperingLayoutId, temperingLayoutId)
+                    .eq(BigStorageGlassRelationInfo::getTemperingFeedSequence, temperingFeedSequence));
         }
+        Integer slotWidth = sysConfigService.queryConfigValue(ConstSysConfig.VERTICAL_SLOT_WIDTH);
         BigStorageCageDetails bigStorageCageDetails = bigStorageCageDetailsService.getOne(new LambdaQueryWrapper<BigStorageCageDetails>()
                 .eq(BigStorageCageDetails::getSlot, relationInfoOne.getSlot()).in(BigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL_ZERO)
                 .orderByDesc(BigStorageCageDetails::getSequence).last("limit 1"));
@@ -91,14 +106,24 @@
         if (null == relationInfoBefore) {
             //琛ㄧず搴忓彿娌℃湁鎴栬��  搴忓彿涓�1鍙堜笉鏄涓�鍧楁潵鐨� 鏂板紑涓�鏍�
             storageCage = bigStorageCageService.getOne(new LambdaQueryWrapper<BigStorageCage>()
-                    .eq(BigStorageCage::getEnableState, Const.SLOT_ON).eq(BigStorageCage::getRemainWidth, slotWidth).last("limit 1"));
+                    .eq(BigStorageCage::getEnableState, Const.SLOT_ON).eq(BigStorageCage::getRemainWidth, slotWidth)
+                    .le(BigStorageCage::getMinThickness, bigStorageCageDetails.getThickness())
+                    .ge(BigStorageCage::getMaxThickness, bigStorageCageDetails.getThickness())
+                    .orderByAsc(BigStorageCage::getMaxThickness)
+                    .orderByAsc(BigStorageCage::getSlot).last("limit 1"));
         } else {
             BigStorageCageDetails beforeGlass = bigStorageCageDetailsService.getOne(new LambdaQueryWrapper<BigStorageCageDetails>()
-                    .in(BigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL_ZERO).eq(BigStorageCageDetails::getGlassId, relationInfoBefore.getGlassId())
+                    .in(BigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL_ZERO)
+                    .eq(BigStorageCageDetails::getEngineerId, relationInfoBefore.getEngineerId())
+                    .eq(BigStorageCageDetails::getTemperingLayoutId, relationInfoBefore.getTemperingLayoutId())
+                    .eq(BigStorageCageDetails::getTemperingFeedSequence, relationInfoBefore.getTemperingFeedSequence())
             );
             if (null == beforeGlass) {
                 storageCage = bigStorageCageService.getOne(new LambdaQueryWrapper<BigStorageCage>()
-                        .eq(BigStorageCage::getEnableState, Const.SLOT_ON).eq(BigStorageCage::getRemainWidth, slotWidth).last("limit 1"));
+                        .eq(BigStorageCage::getEnableState, Const.SLOT_ON).eq(BigStorageCage::getRemainWidth, slotWidth)
+                        .le(BigStorageCage::getMinThickness, bigStorageCageDetails.getThickness())
+                        .ge(BigStorageCage::getMaxThickness, bigStorageCageDetails.getThickness())
+                        .orderByAsc(BigStorageCage::getMaxThickness).orderByAsc(BigStorageCage::getSlot).last("limit 1"));
             } else {
                 storageCage = bigStorageCageService.getOne(new LambdaQueryWrapper<BigStorageCage>()
                         .eq(BigStorageCage::getEnableState, Const.SLOT_ON).eq(BigStorageCage::getSlot, beforeGlass.getSlot()));
@@ -113,47 +138,23 @@
         return storageDTO;
     }
 
-    public void dispatchBigStorageSlot() {
-        //todo:鑾峰彇绗煎唴鍗曟牸宸茬粡鍒伴綈鐨勭幓鐠冩牸瀛愪俊鎭�
-        List<BigStorageRelationDTO> virtualList = bigStorageCageDetailsService.queryIsAllNeedDispatchVirtualSlot();
-        if (CollectionUtil.isEmpty(virtualList)) {
-            log.info("娌℃湁闇�瑕佽皟搴︾殑鏍煎瓙");
-        }
-        for (BigStorageRelationDTO dto : virtualList) {
-            List<BigStorageSequenceDTO> sequenceDTOList = bigStorageCageDetailsService.dispatchBigStorageGlassInfo(dto);
-            if (CollectionUtil.isEmpty(sequenceDTOList) || sequenceDTOList.size() == 1) {
-                continue;
-            }
-            int sequence = 0;
-            int startSlot = 0;
-            int targetSlot = 0;
-            for (BigStorageSequenceDTO item : sequenceDTOList) {
-                if (item.getMinSequence() == sequence + 1) {
-                    //鐢熸垚璋冨害浠诲姟
-                    startSlot = item.getSlot();
-                    break;
-                }
-                sequence = item.getMaxSequence();
-                targetSlot = item.getSlot();
-            }
-        }
-        //
-    }
-
     @Override
-    public void generateBigStorageGlassInfo(String glassId) {
-        GlassInfo glassInfo = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>().eq(GlassInfo::getGlassId, glassId));
+    public void generateBigStorageGlassInfo(String engineerId, int temperingLayoutId) {
         List<BigStorageGlassInfo> list = this.list(new LambdaQueryWrapper<BigStorageGlassInfo>()
-                .eq(BigStorageGlassInfo::getEngineerId, glassInfo.getEngineerId()).eq(BigStorageGlassInfo::getTemperingLayoutId, glassInfo.getTemperingLayoutId()));
+                .eq(BigStorageGlassInfo::getEngineerId, engineerId).eq(BigStorageGlassInfo::getTemperingLayoutId, temperingLayoutId));
         if (CollectionUtil.isNotEmpty(list)) {
             return;
         }
+        Integer slotWidth = sysConfigService.queryConfigValue(ConstSysConfig.VERTICAL_SLOT_WIDTH);
+//        Integer glassGap = sysConfigService.queryConfigValue(ConstSysConfig.VERTICAL_GLASS_GAP);
+        Integer outCarMaxSize = sysConfigService.queryConfigValue(ConstSysConfig.VERTICAL_OUT_CAR_SIZE);
 //        Engineering engineering = engineeringMapper.selectOne(new LambdaQueryWrapper<Engineering>()
 //                .eq(Engineering::getEngineerId, glassInfo.getEngineerId()));
         //鑾峰彇鐜荤拑鐨勫伐绋媔d锛屾寜鐓у伐绋媔d鑾峰彇宸ョ▼涓嬬殑鎵�鏈夌幓鐠冧俊鎭�
         List<GlassInfo> glassInfoList = glassInfoService.list(new LambdaQueryWrapper<GlassInfo>()
-                .eq(GlassInfo::getEngineerId, glassInfo.getEngineerId())
+                .eq(GlassInfo::getEngineerId, engineerId)
                 .orderByAsc(GlassInfo::getTemperingLayoutId).orderByAsc(GlassInfo::getTemperingFeedSequence));
+        Integer glassGap = getGlassGapByThickness(glassInfoList.get(0).getThickness());
         Map<Integer, List<GlassInfo>> trmperingIdMap = glassInfoList.stream().collect(Collectors.groupingBy(GlassInfo::getTemperingLayoutId));
         List<BigStorageGlassInfo> bigStorageGlassInfoList = new ArrayList<>();
         //鏂瑰紡涓�锛氬皢鐜荤拑鎸夌増鍥俱�佺増搴� 渚濇鐢熸垚铏氭嫙鏍煎瓙淇℃伅锛屾牸瀛愪竴鐩村線鍚庣疮鍔�
@@ -163,7 +164,7 @@
             int slotSequence = 1;
             for (GlassInfo item : v) {
                 int maxLength = (int) Math.max(item.getWidth(), item.getHeight());
-                if (remainWidth > maxLength) {
+                if (remainWidth > maxLength && slotSequence <= outCarMaxSize) {
                     remainWidth = remainWidth - maxLength - glassGap;
                 } else {
                     slotNumber = slotNumber + 1;
@@ -186,8 +187,12 @@
     @Override
     public int bigStorageSlotPair(BigStorageGlassInfo bigStorageGlassInfo) {
         //鑾峰彇鎵�鏈夌┖闂插彲鐢ㄧ殑鏍煎瓙鍙�
+        Integer slotWidth = sysConfigService.queryConfigValue(ConstSysConfig.VERTICAL_SLOT_WIDTH);
         BigStorageCage storageCage = bigStorageCageService.getOne(new LambdaQueryWrapper<BigStorageCage>()
-                .eq(BigStorageCage::getEnableState, Const.SLOT_ON).eq(BigStorageCage::getRemainWidth, slotWidth).last("limit 1"));
+                .eq(BigStorageCage::getEnableState, Const.SLOT_ON).eq(BigStorageCage::getRemainWidth, slotWidth)
+                .le(BigStorageCage::getMinThickness, bigStorageGlassInfo.getThickness())
+                .ge(BigStorageCage::getMaxThickness, bigStorageGlassInfo.getThickness())
+                .orderByAsc(BigStorageCage::getMaxThickness).orderByAsc(BigStorageCage::getSlot).last("limit 1"));
         Assert.isTrue(null != storageCage, "娌℃湁绌轰綑鐨勭瀛愬瓨鏀剧幓鐠�");
         Integer slot = storageCage.getSlot();
         //鑾峰彇璇ュ伐绋嬪悓涓�娴佺▼鍗″悓涓�杞︾殑鐜荤拑淇℃伅
@@ -210,5 +215,18 @@
     }
 
 
+    private Integer getGlassGapByThickness(Double thickness) {
+        int sysKey = 0;
+        if (thickness >= 12 ) {
+            sysKey = ConstSysConfig.VERTICAL_GLASS_GAP_12;
+        } else if (thickness == 8) {
+            sysKey = ConstSysConfig.VERTICAL_GLASS_GAP_8;
+        } else if (thickness == 10) {
+            sysKey = ConstSysConfig.VERTICAL_GLASS_GAP_10;
+        } else {
+            sysKey = ConstSysConfig.VERTICAL_GLASS_GAP;
+        }
+        return sysConfigService.queryConfigValue(sysKey);
+    }
 }
 

--
Gitblit v1.8.0