From 3a9634e2baae27bf2457617c740cfcc38bde39b6 Mon Sep 17 00:00:00 2001
From: TanYibin <5491541@qq.com>
Date: Sat, 7 Oct 2023 16:59:04 +0800
Subject: [PATCH] 库位分配逻辑优化:多高度立库库位分配时,低库位用尽后可存放到高一级库位上

---
 huaheng-wms-core/src/main/java/org/jeecg/modules/system/controller/SysDictController.java               |  2 --
 huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/wcs/service/LocationAllocationServiceImpl.java | 15 ++++++++-------
 huaheng-wms-core/src/main/java/org/jeecg/utils/ConvertUtils.java                                        |  1 -
 huaheng-wms-core/src/main/java/org/jeecg/utils/support/Convert.java                                     |  1 -
 4 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/system/controller/SysDictController.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/system/controller/SysDictController.java
index 8e198a3..3f868a7 100644
--- a/huaheng-wms-core/src/main/java/org/jeecg/modules/system/controller/SysDictController.java
+++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/system/controller/SysDictController.java
@@ -102,7 +102,6 @@ public class SysDictController {
      * @param       req
      * @return
      */
-    @SuppressWarnings("unchecked")
     @RequestMapping(value = "/treeList", method = RequestMethod.GET)
     public Result<List<SysDictTree>> treeList(SysDict sysDict, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
         @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
@@ -295,7 +294,6 @@ public class SysDictController {
      * 【接口签名验证】
      * 根据表名——显示字段-存储字段 pid 加载树形数据
      */
-    @SuppressWarnings("unchecked")
     @RequestMapping(value = "/loadTreeData", method = RequestMethod.GET)
     public Result<List<TreeSelectModel>> loadTreeData(@RequestParam(name = "pid") String pid, @RequestParam(name = "pidField") String pidField,
         @RequestParam(name = "tableName") String tbname, @RequestParam(name = "text") String text, @RequestParam(name = "code") String code,
diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/wcs/service/LocationAllocationServiceImpl.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/wcs/service/LocationAllocationServiceImpl.java
index e280579..00cd2a4 100644
--- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/wcs/service/LocationAllocationServiceImpl.java
+++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/wcs/service/LocationAllocationServiceImpl.java
@@ -120,10 +120,10 @@ public class LocationAllocationServiceImpl implements LocationAllocationService 
         for (Integer roadWay : roadWays) {
             LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery();
             locationLambdaQueryWrapper.eq(Location::getZoneCode, zoneCode).eq(Location::getWarehouseCode, warehouseCode).eq(Location::getRoadWay, roadWay)
-                .eq(Location::getStatus, QuantityConstant.STATUS_LOCATION_EMPTY).eq(Location::getHigh, high)
+                .eq(Location::getStatus, QuantityConstant.STATUS_LOCATION_EMPTY).ge(Location::getHigh, high)
                 .eq(StringUtils.isNotEmpty(materialAreaCode), Location::getMaterialAreaCode, materialAreaCode)
                 .in(Location::getLocationTypeCode, locationTypeCodeList).eq(Location::getContainerCode, QuantityConstant.EMPTY_STRING)
-                .orderByAsc(true, Location::getLayer).orderByAsc(true, Location::getId);
+                .orderByAsc(true, Location::getHigh).orderByAsc(true, Location::getLayer).orderByAsc(true, Location::getId);
             Page<Location> page = new Page<Location>(1, searchNumber);
             IPage page1 = locationService.page(page, locationLambdaQueryWrapper);
             List<Location> totalLocationList = page1.getRecords();
@@ -143,7 +143,7 @@ public class LocationAllocationServiceImpl implements LocationAllocationService 
             .eq(Location::getStatus, QuantityConstant.STATUS_LOCATION_EMPTY).ge(Location::getHigh, high)
             .eq(StringUtils.isNotEmpty(materialAreaCode), Location::getMaterialAreaCode, materialAreaCode).eq(Location::getRowFlag, QuantityConstant.ROW_OUT)
             .in(Location::getLocationTypeCode, locationTypeCodeList).eq(Location::getContainerCode, QuantityConstant.EMPTY_STRING)
-            .orderByAsc(true, Location::getLayer).orderByAsc(true, Location::getId);
+            .orderByAsc(true, Location::getHigh).orderByAsc(true, Location::getLayer).orderByAsc(true, Location::getId);
         Page<Location> page = new Page<Location>(1, searchNumber);
         IPage iPage = locationService.page(page, locationLambda);
         List<Location> locationList = iPage.getRecords();
@@ -163,7 +163,7 @@ public class LocationAllocationServiceImpl implements LocationAllocationService 
                 .eq(Location::getStatus, QuantityConstant.STATUS_LOCATION_EMPTY).ge(Location::getHigh, high)
                 .eq(StringUtils.isNotEmpty(materialAreaCode), Location::getMaterialAreaCode, materialAreaCode).eq(Location::getRowFlag, QuantityConstant.ROW_IN)
                 .in(Location::getLocationTypeCode, locationTypeCodeList).eq(Location::getContainerCode, QuantityConstant.EMPTY_STRING)
-                .orderByAsc(true, Location::getLayer).orderByAsc(true, Location::getId);
+                .orderByAsc(true, Location::getHigh).orderByAsc(true, Location::getLayer).orderByAsc(true, Location::getId);
             page = new Page<Location>(1, searchNumber);
             iPage = locationService.page(page, locationLambda);
             locationList = iPage.getRecords();
@@ -203,7 +203,7 @@ public class LocationAllocationServiceImpl implements LocationAllocationService 
                 .eq(Location::getStatus, QuantityConstant.STATUS_LOCATION_EMPTY).ge(Location::getHigh, high)
                 .eq(StringUtils.isNotEmpty(materialAreaCode), Location::getMaterialAreaCode, materialAreaCode)
                 .in(Location::getLocationTypeCode, locationTypeCodeList).eq(Location::getContainerCode, QuantityConstant.EMPTY_STRING)
-                .orderByAsc(true, Location::getLayer).orderByAsc(true, Location::getId);
+                .orderByAsc(true, Location::getHigh).orderByAsc(true, Location::getLayer).orderByAsc(true, Location::getId);
             Page<Location> page = new Page<Location>(1, 10);
             IPage page1 = locationService.page(page, locationLambdaQueryWrapper);
             List<Location> totalLocationList = page1.getRecords();
@@ -220,8 +220,9 @@ public class LocationAllocationServiceImpl implements LocationAllocationService 
         LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery();
         locationLambdaQueryWrapper.eq(Location::getZoneCode, zoneCode).eq(Location::getWarehouseCode, warehouseCode).eq(Location::getRoadWay, roadWay)
             .eq(Location::getStatus, QuantityConstant.STATUS_LOCATION_EMPTY).ge(Location::getHigh, high)
-            .eq(StringUtils.isNotEmpty(materialAreaCode), Location::getMaterialAreaCode, materialAreaCode).in(Location::getLocationTypeCode, locationTypeCodeList)
-            .eq(Location::getContainerCode, QuantityConstant.EMPTY_STRING).orderByAsc(true, Location::getLayer).orderByAsc(true, Location::getId);
+            .eq(StringUtils.isNotEmpty(materialAreaCode), Location::getMaterialAreaCode, materialAreaCode)
+            .in(Location::getLocationTypeCode, locationTypeCodeList).eq(Location::getContainerCode, QuantityConstant.EMPTY_STRING)
+            .orderByAsc(true, Location::getHigh).orderByAsc(true, Location::getLayer).orderByAsc(true, Location::getId);
         // 单伸位逻辑简单,只需要找到一个空闲库位
         Page page = new Page<Location>(1, 1);
         IPage iPage = locationService.page(page, locationLambdaQueryWrapper);
diff --git a/huaheng-wms-core/src/main/java/org/jeecg/utils/ConvertUtils.java b/huaheng-wms-core/src/main/java/org/jeecg/utils/ConvertUtils.java
index 2d2bec1..47337b9 100644
--- a/huaheng-wms-core/src/main/java/org/jeecg/utils/ConvertUtils.java
+++ b/huaheng-wms-core/src/main/java/org/jeecg/utils/ConvertUtils.java
@@ -492,7 +492,6 @@ public class ConvertUtils {
             return defaultValue;
         }
         if (clazz.isAssignableFrom(value.getClass())) {
-            @SuppressWarnings("unchecked")
             E myE = (E)value;
             return myE;
         }
diff --git a/huaheng-wms-core/src/main/java/org/jeecg/utils/support/Convert.java b/huaheng-wms-core/src/main/java/org/jeecg/utils/support/Convert.java
index e4dd30b..e47b1d6 100644
--- a/huaheng-wms-core/src/main/java/org/jeecg/utils/support/Convert.java
+++ b/huaheng-wms-core/src/main/java/org/jeecg/utils/support/Convert.java
@@ -492,7 +492,6 @@ public class Convert {
             return defaultValue;
         }
         if (clazz.isAssignableFrom(value.getClass())) {
-            @SuppressWarnings("unchecked")
             E myE = (E)value;
             return myE;
         }
--
libgit2 0.22.2