diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/container/service/impl/ContainerServiceImpl.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/container/service/impl/ContainerServiceImpl.java index c0628ee..896e27b 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/container/service/impl/ContainerServiceImpl.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/container/service/impl/ContainerServiceImpl.java @@ -9,6 +9,7 @@ import java.util.stream.Collectors; import javax.annotation.Resource; import javax.transaction.Transactional; +import org.apache.commons.collections4.ListUtils; import org.jeecg.common.api.vo.Result; import org.jeecg.common.exception.JeecgBootException; import org.jeecg.modules.wms.config.container.entity.Container; @@ -173,9 +174,14 @@ public class ContainerServiceImpl extends ServiceImpl<ContainerMapper, Container @Override public List<Container> getContainerListByCodeList(List<String> containerCodeList, String warehouseCode) { - LambdaQueryWrapper<Container> containerLambdaQueryWrapper = Wrappers.lambdaQuery(); - containerLambdaQueryWrapper.in(Container::getCode, containerCodeList).eq(Container::getWarehouseCode, warehouseCode); - return list(containerLambdaQueryWrapper); + List<List<String>> partition = ListUtils.partition(containerCodeList, 2000); + List<Container> containerList = new ArrayList<>(); + for (List<String> code : partition) { + LambdaQueryWrapper<Container> containerLambdaQueryWrapper = Wrappers.lambdaQuery(); + containerLambdaQueryWrapper.in(Container::getCode, code).eq(Container::getWarehouseCode, warehouseCode); + containerList.addAll(list(containerLambdaQueryWrapper)); + } + return containerList; } @Override diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/controller/LocationController.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/controller/LocationController.java index 2f365a2..392ec47 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/controller/LocationController.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/controller/LocationController.java @@ -90,7 +90,9 @@ public class LocationController extends JeecgController<Location, ILocationServi @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) { Page<Location> page = new Page<Location>(pageNo, pageSize); HuahengJwtUtil.setWarehouseCode(req, location); - IPage<Location> pageList = locationService.listEmptyContainerInLocation(page, location); + IPage<Location> pageList = locationService.getContainerInLocation(page, QuantityConstant.STATUS_LOCATION_EMPTY, + QuantityConstant.STATUS_CONTAINER_EMPTY,QuantityConstant.STATUS_CONTAINER_EMPTY,QuantityConstant.DEFAULT_WAREHOUSE, + location.getZoneCode(),location.getContainerCode(),location.getCode(),location.getRoadWay()); return Result.OK(pageList); } @@ -100,7 +102,9 @@ public class LocationController extends JeecgController<Location, ILocationServi @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) { Page<Location> page = new Page<Location>(pageNo, pageSize); HuahengJwtUtil.setWarehouseCode(req, location); - IPage<Location> pageList = locationService.listSomeContainerInLocation(page, location); + IPage<Location> pageList = locationService.getContainerInLocation(page, QuantityConstant.STATUS_LOCATION_EMPTY, + QuantityConstant.STATUS_CONTAINER_EMPTY,QuantityConstant.STATUS_CONTAINER_FILL_SOME,QuantityConstant.DEFAULT_WAREHOUSE, + location.getZoneCode(),location.getContainerCode(),location.getCode(),location.getRoadWay()); return Result.OK(pageList); } @@ -255,13 +259,14 @@ public class LocationController extends JeecgController<Location, ILocationServi @AutoLog(value = "选取在库内的空托盘") @ApiOperation(value = "库位管理-选取在库内的空托盘", notes = "库位管理-选取在库内的空托盘") @GetMapping(value = "/getEmptyContainerInLocation") - public Result getEmptyContainerInLocation(Location location, HttpServletRequest req) { - String warehouseCode = HuahengJwtUtil.getWarehouseCodeByToken(req); - String containerCode = location.getContainerCode(); - String locationCode = location.getCode(); - List<Location> locationList = - locationService.getContainerInLocation(containerCode, QuantityConstant.STATUS_CONTAINER_FILL_EMPTY, locationCode, warehouseCode); - return Result.OK(locationList); + public Result<IPage<Location>> getEmptyContainerInLocation(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); + HuahengJwtUtil.setWarehouseCode(req, location); + IPage<Location> pageList = locationService.getContainerInLocation(page, QuantityConstant.STATUS_LOCATION_EMPTY, + QuantityConstant.STATUS_CONTAINER_EMPTY,QuantityConstant.STATUS_CONTAINER_EMPTY,QuantityConstant.DEFAULT_WAREHOUSE, + location.getZoneCode(),location.getContainerCode(),location.getCode(),location.getRoadWay()); + return Result.OK(pageList); } /** @@ -272,13 +277,14 @@ public class LocationController extends JeecgController<Location, ILocationServi @AutoLog(value = "选取在库内的空托盘组") @ApiOperation(value = "库位管理-选取在库内的空托盘组", notes = "库位管理-选取在库内的空托盘组") @GetMapping(value = "/getManyContainerInLocation") - public Result getManyContainerInLocation(Location location, HttpServletRequest req) { - String warehouseCode = HuahengJwtUtil.getWarehouseCodeByToken(req); - String containerCode = location.getContainerCode(); - String locationCode = location.getCode(); - List<Location> locationList = - locationService.getContainerInLocation(containerCode, QuantityConstant.STATUS_CONTAINER_FILL_MANY, locationCode, warehouseCode); - return Result.OK(locationList); + public Result<IPage<Location>> getManyContainerInLocation(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); + HuahengJwtUtil.setWarehouseCode(req, location); + IPage<Location> pageList = locationService.getContainerInLocation(page, QuantityConstant.STATUS_LOCATION_EMPTY, + QuantityConstant.STATUS_CONTAINER_EMPTY,QuantityConstant.STATUS_CONTAINER_FILL_MANY,QuantityConstant.DEFAULT_WAREHOUSE, + location.getZoneCode(),location.getContainerCode(),location.getCode(),location.getRoadWay()); + return Result.OK(pageList); } /** diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/mapper/LocationMapper.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/mapper/LocationMapper.java index 30391bb..d8b7c10 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/mapper/LocationMapper.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/mapper/LocationMapper.java @@ -1,6 +1,7 @@ package org.jeecg.modules.wms.config.location.mapper; import java.util.List; +import java.util.Map; import com.baomidou.mybatisplus.core.metadata.IPage; import org.apache.ibatis.annotations.Param; @@ -18,5 +19,5 @@ public interface LocationMapper extends BaseMapper<Location> { LocationInfo getAllLocation(Location location); - IPage<Location> listEmptyContainerInLocation(IPage<?> page, @Param("location") Location location); + IPage<Location> getContainerInLocation(IPage<?> page, @Param("map") Map<Object, Object> map); } diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/mapper/xml/LocationMapper.xml b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/mapper/xml/LocationMapper.xml index b85acd7..7af23c7 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/mapper/xml/LocationMapper.xml +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/mapper/xml/LocationMapper.xml @@ -8,36 +8,44 @@ IFNULL(max(layer),0) as maxLayer, IFNULL(max(grid),0) as maxGrid, IFNULL(min(row),0) as minRow - FROM location + FROM location WHERE zone_code = #{zoneCode} <if test="warehouseCode != null and warehouseCode !=''"> - AND warehouse_code = #{warehouseCode} + AND warehouse_code = #{warehouseCode} </if> </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 + + <select id="getContainerInLocation" parameterType="Map" resultType="org.jeecg.modules.wms.config.location.entity.Location"> + SELECT * + FROM location t <where> - AND t.warehouse_code = #{location.warehouseCode} - AND t.status = 'empty' + t.warehouse_code = #{map.warehouseCode} 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 < 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} + AND t.code IN (SELECT cc.location_code FROM container cc WHERE 1 = 1 + <if test="map.containerCodeStatus != null and map.containerCodeStatus !=''"> + AND cc.status = #{map.containerCodeStatus} + </if> + <if test="map.containerCodeFillStatus != null and map.containerCodeFillStatus !=''"> + AND cc.fill_status = #{map.containerCodeFillStatus} + </if> + AND cc.warehouse_code = #{map.warehouseCode}) + <if test="map.locationStatus != null and map.locationStatus !=''"> + and t.status = #{map.locationStatus} + </if> + <if test="map.zoneCode != null and map.zoneCode !=''"> + and t.zone_code = #{map.zoneCode} </if> - <if test="location.containerCode != null and location.containerCode !=''"> - and t.container_code = #{location.containerCode} + <if test="map.containerCode != null and map.containerCode !=''"> + and t.container_code = #{map.containerCode} </if> - <if test="location.code != null and location.code !=''"> - and t.`code` = #{location.code} + <if test="map.locationCode != null and map.locationCode !=''"> + and t.code = #{map.locationCode} </if> - <if test="location.roadWay != null and location.roadWay !=''"> - and t.`road_way` = #{location.roadWay} + <if test="map.roadWay != null and map.roadWay !=''"> + and t.road_way = #{map.roadWay} </if> </where> </select> + </mapper> diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/service/ILocationService.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/service/ILocationService.java index 3f2d5a0..6af5da8 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/service/ILocationService.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/service/ILocationService.java @@ -53,9 +53,8 @@ public interface ILocationService extends IService<Location> { LocationInfo getAllLocation(Location location); - IPage<Location> listEmptyContainerInLocation(Page<Location> page, Location location); - - IPage<Location> listSomeContainerInLocation(Page<Location> page, Location location); + IPage<Location> getContainerInLocation(Page<Location> page, String locationStatus, String containerCodeStatus, String containerCodeFillStatus, + String warehouseCode, String zoneCode, String containerCode, String locationCode, Integer roadWay); /** * 判断系统是否已经有同样的托盘号,如果有证明数据混乱了 diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/service/impl/LocationServiceImpl.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/service/impl/LocationServiceImpl.java index feaa822..14273de 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/service/impl/LocationServiceImpl.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/service/impl/LocationServiceImpl.java @@ -396,23 +396,18 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i } @Override - public IPage<Location> listSomeContainerInLocation(Page<Location> page, Location location) { - List<Location> locationList = - locationService.getContainerInLocation(null, QuantityConstant.STATUS_CONTAINER_FILL_SOME, null, QuantityConstant.DEFAULT_WAREHOUSE); - List<String> locationCode = - locationList.stream().filter(i -> i.getZoneCode().equals(location.getZoneCode())).map(Location::getCode).collect(Collectors.toList()); - // 最多返回2000条数据 - List<List<String>> partition = ListUtils.partition(locationCode, 2000); - for (List<String> strings : partition) { - LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery(); - locationLambdaQueryWrapper.eq(Location::getZoneCode, location.getZoneCode()).in(Location::getCode, strings); - Page<Location> locationPage = locationService.page(page, locationLambdaQueryWrapper); - if (CollectionUtils.isEmpty(Collections.singleton(locationPage))) { - return null; - } - return locationPage; - } - return null; + public IPage<Location> getContainerInLocation(Page<Location> page, String locationStatus, String containerCodeStatus, String containerCodeFillStatus, + String warehouseCode, String zoneCode, String containerCode, String locationCode, Integer roadWay) { + Map<Object, Object> map = new HashMap<>(); + map.put("locationStatus", locationStatus); + map.put("containerCodeStatus", containerCodeStatus); + map.put("containerCodeFillStatus", containerCodeFillStatus); + map.put("warehouseCode", warehouseCode); + map.put("zoneCode", zoneCode); + map.put("containerCode", containerCode); + map.put("locationCode", locationCode); + map.put("roadWay", roadWay); + return locationMapper.getContainerInLocation(page, map); } @Override @@ -451,11 +446,6 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i return locationList; } - @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)) {