From e6fc4345bb82c01a190c16093a175b87573525b7 Mon Sep 17 00:00:00 2001
From: LSH
Date: 星期六, 11 二月 2023 11:16:52 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/common/service/CommonService.java |   26 +++++++++++++++++++-------
 1 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/src/main/java/com/zy/common/service/CommonService.java b/src/main/java/com/zy/common/service/CommonService.java
index 0ca81d5..d27601c 100644
--- a/src/main/java/com/zy/common/service/CommonService.java
+++ b/src/main/java/com/zy/common/service/CommonService.java
@@ -3,16 +3,12 @@
 import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.mapper.EntityWrapper;
 import com.baomidou.mybatisplus.mapper.Wrapper;
-import com.core.common.Arith;
 import com.core.common.Cools;
 import com.core.exception.CoolException;
 import com.zy.asrs.entity.*;
 import com.zy.asrs.service.*;
-import com.zy.asrs.utils.Utils;
-import com.zy.asrs.utils.VersionUtils;
 import com.zy.common.entity.Parameter;
 import com.zy.common.model.LocTypeDto;
-import com.zy.common.model.Shelves;
 import com.zy.common.model.StartupDto;
 import com.zy.common.properties.SlaveProperties;
 import lombok.extern.slf4j.Slf4j;
@@ -51,6 +47,8 @@
     private SlaveProperties slaveProperties;
     @Value("${channel.channelMax}")
     private Integer channelMax;
+    @Value("${channel.equipmentCount}")
+    private Integer equipmentCount;
 
     /**
      * 鐢熸垚宸ヤ綔鍙�
@@ -162,10 +160,10 @@
             } else if (ruleId == 1){  //鎸夋祴璇曡澶囨帓搴忥紝浼樺厛鎺掓弧鍗曞彴璁惧
                 locMast = locMastService.queryFreeLocMast1(curRow, locTypeDto.getLocType1() ,channelMax+1);
             } else if (ruleId == 2){  //鎸夐�氶亾鎺掑簭锛屽潎鍖�鍒嗛厤姣忓彴璁惧
-
-                locMast = locMastService.queryFreeLocMast2(curRow, locTypeDto.getLocType1() );
+                Short locType2 = getLocType2Small(curRow, locTypeDto.getLocType1());
+                locMast = locMastService.queryFreeLocMast2(curRow, locTypeDto.getLocType1() ,locType2);
             } else { //榛樿瑙勫垯
-                locMast = locMastService.queryFreeLocMast(curRow, locTypeDto.getLocType1());
+                locMast = locMastService.queryFreeLocMast2(curRow, locTypeDto.getLocType1(),(short)0);
             }
         }
 
@@ -193,4 +191,18 @@
         return startupDto;
     }
 
+    public Short getLocType2Small(Integer curRow,short locType1){
+        Integer OCount = locMastService.queryFreeLocMastCount(curRow, locType1, (short)1);
+        Short locType2=1;
+        for (int i=2;i<equipmentCount+1;i++){
+            Integer integer =locMastService.queryFreeLocMastCount(curRow, locType1, (short)i);
+            if (OCount<integer){
+                OCount=integer;
+                locType2=(short)i;
+            }
+        }
+
+        return locType2;
+    }
+
 }

--
Gitblit v1.9.1