From df7b45186c399ca529ea24202d13722cf8f8f025 Mon Sep 17 00:00:00 2001
From: zf <27208084@qq.com>
Date: Thu, 12 Jan 2023 15:00:36 +0800
Subject: [PATCH] 增加查库内空托盘接口listEmptyContainerInLocation

---
 jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/location/controller/LocationController.java    | 56 ++++++++++++++++++++++++++------------------------------
 jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/location/mapper/LocationMapper.java            |  4 +++-
 jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/location/mapper/xml/LocationMapper.xml         | 32 ++++++++++++++++++++++++++++++++
 jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/location/service/ILocationService.java         |  4 ++++
 jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/location/service/impl/LocationServiceImpl.java |  8 ++++++++
 5 files changed, 73 insertions(+), 31 deletions(-)
 create mode 100644 jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/location/mapper/xml/LocationMapper.xml

diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/location/controller/LocationController.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/location/controller/LocationController.java
index 2544fa9..043c46c 100644
--- a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/location/controller/LocationController.java
+++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/location/controller/LocationController.java
@@ -1,48 +1,31 @@
 package org.jeecg.modules.wms.config.location.controller;
 
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import org.apache.shiro.authz.annotation.RequiresPermissions;
-import org.jeecg.common.api.vo.Result;
-import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.common.system.util.JwtUtil;
-import org.jeecg.common.util.oConvertUtils;
-
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
-
-import org.jeecg.modules.wms.config.container.entity.Container;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.common.system.base.controller.JeecgController;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.system.util.JwtUtil;
 import org.jeecg.modules.wms.config.location.entity.BatchLocation;
 import org.jeecg.modules.wms.config.location.entity.Location;
 import org.jeecg.modules.wms.config.location.service.ILocationService;
 import org.jeecg.utils.StringUtils;
 import org.jeecg.utils.constant.QuantityConstant;
-import org.jeecgframework.poi.excel.ExcelImportUtil;
-import org.jeecgframework.poi.excel.def.NormalExcelConstants;
-import org.jeecgframework.poi.excel.entity.ExportParams;
-import org.jeecgframework.poi.excel.entity.ImportParams;
-import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
-import org.jeecg.common.system.base.controller.JeecgController;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.MultipartHttpServletRequest;
 import org.springframework.web.servlet.ModelAndView;
-import com.alibaba.fastjson.JSON;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import org.jeecg.common.aspect.annotation.AutoLog;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.Arrays;
+import java.util.List;
 
  /**
  * @Description: 库位管理
@@ -84,6 +67,19 @@ public class LocationController extends JeecgController<Location, ILocationServi
 		return Result.OK(pageList);
 	}
 
+	 @ApiOperation(value="库位管理-分页查询放空托的库位", notes="分页查询放空托的库位")
+	 @GetMapping(value = "/listEmptyContainerInLocation")
+	 public Result<IPage<Location>> listEmptyContainerInLocation(Location location,
+																   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+																   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+																   HttpServletRequest req) {
+		 Page<Location> page = new Page<Location>(pageNo, pageSize);
+		 String warehouseCode = JwtUtil.getWarehouseCodeByToken(req);
+		 location.setWarehouseCode(warehouseCode);
+		 IPage<Location> pageList = locationService.listEmptyContainerInLocation(page, location);
+		 return Result.OK(pageList);
+	 }
+
 	/**
 	 * 添加
 	 *
diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/location/mapper/LocationMapper.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/location/mapper/LocationMapper.java
index bdebe71..a033eb3 100644
--- a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/location/mapper/LocationMapper.java
+++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/location/mapper/LocationMapper.java
@@ -2,6 +2,7 @@ package org.jeecg.modules.wms.config.location.mapper;
 
 import java.util.List;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import org.apache.ibatis.annotations.Param;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.jeecg.modules.wms.config.location.entity.Location;
@@ -9,7 +10,7 @@ import org.jeecg.modules.wms.config.location.entity.Location;
 /**
  * @Description: 库位管理
  * @Author: jeecg-boot
- * @Date:   2022-10-27
+ * @Date: 2022-10-27
  * @Version: V1.0
  */
 public interface LocationMapper extends BaseMapper<Location> {
@@ -19,4 +20,5 @@ public interface LocationMapper extends BaseMapper<Location> {
 
     int getFirstRowOfZone(@Param("warehouseCode") String warehouseCode, @Param("locationType") String locationType);
 
+    IPage<Location> listEmptyContainerInLocation(IPage<?> page, @Param("location") Location location);
 }
diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/location/mapper/xml/LocationMapper.xml b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/location/mapper/xml/LocationMapper.xml
new file mode 100644
index 0000000..7bbca81
--- /dev/null
+++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/location/mapper/xml/LocationMapper.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.jeecg.modules.wms.config.location.mapper.LocationMapper">
+
+    <select id="getAllLocation" resultType="org.jeecg.modules.wms.config.location.entity.Location"></select>
+    <select id="getFirstRowOfZone" resultType="java.lang.Integer"></select>
+    <select id="listEmptyContainerInLocation" parameterType="org.jeecg.modules.wms.config.location.entity.Location"
+            resultType="org.jeecg.modules.wms.config.location.entity.Location">
+        SELECT *
+        FROM location t
+        <where>
+            AND t.warehouse_code = #{location.warehouseCode}
+            AND t.status='empty'
+            AND t.container_code !=''
+            AND t.container_code is not NULL
+            AND t.container_code NOT in (SELECT h.container_code from task_header h WHERE status &lt; 100 AND warehouse_code=#{location.warehouseCode})
+            and t.`code` in(select cc.location_code from container cc where cc.`status`='empty' and cc.warehouse_code =#{location.warehouseCode})
+            <if test="location.zoneCode != null and location.zoneCode !=''">
+                and t.zone_code = #{location.zoneCode}
+            </if>
+            <if test="location.containerCode != null and location.containerCode !=''">
+                and t.container_code = #{location.containerCode}
+            </if>
+            <if test="location.code != null and location.code !=''">
+                and t.`code` = #{location.code}
+            </if>
+            <if test="location.roadWay != null and location.roadWay !=''">
+                and t.`road_way` = #{location.roadWay}
+            </if>
+        </where>
+    </select>
+</mapper>
diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/location/service/ILocationService.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/location/service/ILocationService.java
index 61e94a2..1a5390d 100644
--- a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/location/service/ILocationService.java
+++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/location/service/ILocationService.java
@@ -1,5 +1,7 @@
 package org.jeecg.modules.wms.config.location.service;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.IService;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.modules.wms.config.location.entity.BatchLocation;
@@ -42,4 +44,6 @@ public interface ILocationService extends IService<Location> {
     Result batchAdd(BatchLocation batchLocation);
 
     LocationInfo getAllLocation(String type);
+
+    IPage<Location> listEmptyContainerInLocation(Page<Location> page, Location location);
 }
diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/location/service/impl/LocationServiceImpl.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/location/service/impl/LocationServiceImpl.java
index 572466c..76a5da7 100644
--- a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/location/service/impl/LocationServiceImpl.java
+++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/location/service/impl/LocationServiceImpl.java
@@ -2,7 +2,10 @@ package org.jeecg.modules.wms.config.location.service.impl;
 
 import com.aliyun.oss.ServiceException;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.apache.ibatis.annotations.Param;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.modules.wms.config.location.entity.BatchLocation;
 import org.jeecg.modules.wms.config.location.entity.Location;
@@ -351,6 +354,11 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i
         return null;
     }
 
+    @Override
+    public IPage<Location> listEmptyContainerInLocation(Page page, Location location) {
+        return locationMapper.listEmptyContainerInLocation(page,  location);
+    }
+
     private boolean getOutSideCanMove(Location location) {
         Location locaiton2 = getInsideNear(location);
         if (locaiton2.getStatus().equals(QuantityConstant.STATUS_LOCATION_LOCK)) {
--
libgit2 0.22.2