From d1fe987d9d97c76a9713370d85e4ad596c8ebd41 Mon Sep 17 00:00:00 2001 From: yiwenpeng <ywp303@163.com> Date: Wed, 25 Oct 2023 10:44:10 +0800 Subject: [PATCH] feat:批次管控的物料,出库时优先按先进先出规则 --- src/main/java/com/huaheng/api/wcs/service/warecellAllocation/LocationAllocationServiceImpl.java | 24 +++++++++++++++--------- src/main/java/com/huaheng/framework/config/ShiroConfig.java | 10 +++++----- src/main/java/com/huaheng/pc/config/material/domain/Material.java | 2 +- src/main/java/com/huaheng/pc/shipment/shippingCombination/service/ShippingCombinationService.java | 17 +++++++++++++++-- 4 files changed, 36 insertions(+), 17 deletions(-) diff --git a/src/main/java/com/huaheng/api/wcs/service/warecellAllocation/LocationAllocationServiceImpl.java b/src/main/java/com/huaheng/api/wcs/service/warecellAllocation/LocationAllocationServiceImpl.java index ed8501c..044e6f2 100644 --- a/src/main/java/com/huaheng/api/wcs/service/warecellAllocation/LocationAllocationServiceImpl.java +++ b/src/main/java/com/huaheng/api/wcs/service/warecellAllocation/LocationAllocationServiceImpl.java @@ -214,9 +214,11 @@ public class LocationAllocationServiceImpl implements LocationAllocationService } } } + if (locationList != null) { locationList.removeAll(removeLocaationList); } + // 如果没有外侧库位可分配了,再查内侧的库位 if (locationList == null || locationList.isEmpty()) { locationLambda = Wrappers.lambdaQuery(); @@ -245,17 +247,21 @@ public class LocationAllocationServiceImpl implements LocationAllocationService } //频繁库位 - if (frequencyLocation == 1) { - locationLambda.orderByAsc(Location::getFrequencyLocation); //升序 - } else if (frequencyLocation == 2) { - //常用 - locationLambda.ge(Location::getFrequencyLocation, 2);//大于等于2 - locationLambda.orderByAsc(Location::getFrequencyLocation); + //if (frequencyLocation == 1) { + // locationLambda.orderByAsc(Location::getFrequencyLocation); //升序 + //} else if (frequencyLocation == 2) { + // //常用 + // locationLambda.ge(Location::getFrequencyLocation, 2);//大于等于2 + // locationLambda.orderByAsc(Location::getFrequencyLocation); + //} else { + // //不常用 + // locationLambda.orderByDesc(Location::getFrequencyLocation);//倒序 + //} + if (isFlammable) { + locationLambda.last("ORDER BY " + str + ", (CASE WHEN iLayer >= 4 THEN iLayer ELSE iLayer + 10 END) ASC"); } else { - //不常用 - locationLambda.orderByDesc(Location::getFrequencyLocation);//倒序 + locationLambda.orderByAsc(Location::getILayer); } - locationLambda.orderByAsc(Location::getILayer); locationList = locationService.list(locationLambda); removeLocaationList = new ArrayList<>(); diff --git a/src/main/java/com/huaheng/framework/config/ShiroConfig.java b/src/main/java/com/huaheng/framework/config/ShiroConfig.java index 3e0bc21..ee34d4a 100644 --- a/src/main/java/com/huaheng/framework/config/ShiroConfig.java +++ b/src/main/java/com/huaheng/framework/config/ShiroConfig.java @@ -276,11 +276,11 @@ public class ShiroConfig { filterChainDefinitionMap.put("/mobile/receipt/batch/**", "anon"); //todo pda出入库查询,测试后注释 - filterChainDefinitionMap.put("/receipt/receiptHeader/listPda", "anon"); - filterChainDefinitionMap.put("/receipt/receiptDetail/list", "anon"); - filterChainDefinitionMap.put("/task/taskHeader/getTaskByTaskId", "anon"); - filterChainDefinitionMap.put("/task/taskHeader/getTaskByShipmentCode", "anon"); - filterChainDefinitionMap.put("/mobile/inventory/completeTaskListByWMS", "anon"); + //filterChainDefinitionMap.put("/receipt/receiptHeader/listPda", "anon"); + //filterChainDefinitionMap.put("/receipt/receiptDetail/list", "anon"); + //filterChainDefinitionMap.put("/task/taskHeader/getTaskByTaskId", "anon"); + //filterChainDefinitionMap.put("/task/taskHeader/getTaskByShipmentCode", "anon"); + //filterChainDefinitionMap.put("/mobile/inventory/completeTaskListByWMS", "anon"); // 系统权限列表 diff --git a/src/main/java/com/huaheng/pc/config/material/domain/Material.java b/src/main/java/com/huaheng/pc/config/material/domain/Material.java index 780499e..f36b924 100644 --- a/src/main/java/com/huaheng/pc/config/material/domain/Material.java +++ b/src/main/java/com/huaheng/pc/config/material/domain/Material.java @@ -390,7 +390,7 @@ public class Material implements Serializable { private String policy; /** - * 是否批次 (是/否) + * 是否批次 (是 or NULL) */ @TableField(value = "isBatch") private String isBatch; diff --git a/src/main/java/com/huaheng/pc/shipment/shippingCombination/service/ShippingCombinationService.java b/src/main/java/com/huaheng/pc/shipment/shippingCombination/service/ShippingCombinationService.java index 803d1f4..569d367 100644 --- a/src/main/java/com/huaheng/pc/shipment/shippingCombination/service/ShippingCombinationService.java +++ b/src/main/java/com/huaheng/pc/shipment/shippingCombination/service/ShippingCombinationService.java @@ -63,6 +63,9 @@ public class ShippingCombinationService { checkNotEmpty(inventorySts, "出库详情没有物料品质"); Material material = getMaterialByCode(materialCode); String policy = Optional.ofNullable(material.getPolicy()).orElse(""); + String isBatchMaterial = Optional.ofNullable(material.getIsBatch()).orElse(""); + + LambdaQueryWrapper<InventoryDetail> wrapper = Wrappers.lambdaQuery(); wrapper.eq(InventoryDetail::getWarehouseCode, warehouseCode) .eq(InventoryDetail::getCompanyCode, companyCode) @@ -80,6 +83,12 @@ public class ShippingCombinationService { if (isFlatWarehouse) { wrapper.ne(InventoryDetail::getZoneCode, "L"); } + + //批次管控的物料,出库时优先按先进先出规则 + if (StringUtils.isEmpty(isBatchMaterial) || !isBatchMaterial.equals("是")) { + //不是批次批次管控的物料走这里 + wrapper.orderByDesc(InventoryDetail::getQty); + } wrapper.orderByAsc(InventoryDetail::getCreated); List<InventoryDetail> list = inventoryDetailService.list(wrapper); @@ -89,14 +98,14 @@ public class ShippingCombinationService { if (policy.equals("PL") || noticeNo.contains("展会")) { return list; } - return getInventoryWithoutNotice(companyCode, materialCode, inventorySts, receiptCode, containerCode, batch, isFlatWarehouse); + return getInventoryWithoutNotice(companyCode, materialCode, inventorySts, receiptCode, containerCode, batch, isFlatWarehouse, isBatchMaterial); } return list; } // 提取方法,用于构建没有通知单号的查询条件 - private List<InventoryDetail> getInventoryWithoutNotice(String companyCode, String materialCode, String inventorySts, String receiptCode, String containerCode, String batch, boolean isFlatWarehouse) { + private List<InventoryDetail> getInventoryWithoutNotice(String companyCode, String materialCode, String inventorySts, String receiptCode, String containerCode, String batch, boolean isFlatWarehouse, String isBatchMaterial) { LambdaQueryWrapper<InventoryDetail> wrapper = Wrappers.lambdaQuery(); wrapper.eq(InventoryDetail::getMaterialCode, materialCode) .eq(InventoryDetail::getCompanyCode, companyCode) @@ -108,6 +117,10 @@ public class ShippingCombinationService { if (isFlatWarehouse) { wrapper.ne(InventoryDetail::getZoneCode, "L"); } + if (StringUtils.isEmpty(isBatchMaterial) || !isBatchMaterial.equals("是")) { + wrapper.orderByDesc(InventoryDetail::getQty); + } + wrapper.orderByAsc(InventoryDetail::getCreated); return inventoryDetailService.list(wrapper); } -- libgit2 0.22.2