From 3e35ba9f769ffe355cf51a764034a9fd8f6a2377 Mon Sep 17 00:00:00 2001 From: liuchen864 <23082234@qq.com> Date: Fri, 22 Dec 2023 07:51:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=A1=E9=AA=8C=E5=BA=93=E4=BD=8D=E7=89=A9?= =?UTF-8?q?=E5=93=81=E6=8E=A5=E5=8F=A3=E4=BF=AE=E6=94=B9=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/location/LocationServiceImpl.java | 120 +++++++++--------- .../wms/service/rule/RuleServiceImpl.java | 23 ++-- 2 files changed, 69 insertions(+), 74 deletions(-) diff --git a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/location/LocationServiceImpl.java b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/location/LocationServiceImpl.java index 3617000b..fec191a3 100644 --- a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/location/LocationServiceImpl.java +++ b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/location/LocationServiceImpl.java @@ -417,74 +417,70 @@ public class LocationServiceImpl implements LocationService { List ruleRespVOList = ruleService.getGroundingList(locationValidateVO.getItemCode(), locationValidateVO.getInventoryStatus()); boolean validateResult = false; String msg = ""; - if(ruleRespVOList.size() == 1) { - validateResult = true; - } else { - for (RuleRespVO ruleRespVO : ruleRespVOList) { - JSONObject jsonObject = JSONUtil.parseObj(ruleRespVO.getConfiguration()); - //增加过滤条件 - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("available", "TRUE"); - queryWrapper.eq("`code`", locationValidateVO.getLocationCode()); - List locationTypeList = new ArrayList<>(); - locationTypeList.add("RAW"); - locationTypeList.add("SEMI"); - locationTypeList.add("FG"); - queryWrapper.in("`type`", locationTypeList); - String warehouseCode = jsonObject.getStr("WarehouseCode"); - if (!"".equals(warehouseCode)) { - queryWrapper.eq("warehouse_code", warehouseCode); - } - String areaCode = jsonObject.getStr("AreaCode"); - if (!"".equals(areaCode)) { - queryWrapper.eq("area_code", areaCode); - } - String locationGroupCode = jsonObject.getStr("LocationGroupCode"); - if (!"".equals(locationGroupCode)) { - queryWrapper.eq("location_group_code", locationGroupCode); - } - String locationCode = jsonObject.getStr("LocationCode"); - if (!"".equals(locationCode)) { - queryWrapper.eq("`code`", locationCode); - } - LocationDO locationDO = locationMapper.selectOne(queryWrapper); - //查询不到库位 - if (locationDO == null) { - continue; + for (RuleRespVO ruleRespVO : ruleRespVOList) { + JSONObject jsonObject = JSONUtil.parseObj(ruleRespVO.getConfiguration()); + //增加过滤条件 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("available", "TRUE"); + queryWrapper.eq("`code`", locationValidateVO.getLocationCode()); + List locationTypeList = new ArrayList<>(); + locationTypeList.add("RAW"); + locationTypeList.add("SEMI"); + locationTypeList.add("FG"); + queryWrapper.in("`type`", locationTypeList); + String warehouseCode = jsonObject.getStr("WarehouseCode"); + if (!"".equals(warehouseCode)) { + queryWrapper.eq("warehouse_code", warehouseCode); + } + String areaCode = jsonObject.getStr("AreaCode"); + if (!"".equals(areaCode)) { + queryWrapper.eq("area_code", areaCode); + } + String locationGroupCode = jsonObject.getStr("LocationGroupCode"); + if (!"".equals(locationGroupCode)) { + queryWrapper.eq("location_group_code", locationGroupCode); + } + String locationCode = jsonObject.getStr("LocationCode"); + if (!"".equals(locationCode)) { + queryWrapper.eq("`code`", locationCode); + } + LocationDO locationDO = locationMapper.selectOne(queryWrapper); + //查询不到库位 + if (locationDO == null) { + continue; + } + String enableMixItem = jsonObject.getStr("EnableMixItem"); + String enableMixLot = jsonObject.getStr("EnableMixLot"); + String enableMixStatus = jsonObject.getStr("EnableMixStatus"); + List balanceDOList = balanceMapper.getBalanceList(null, null, null, null, locationDO.getCode()); + //库位上存在物品,判断可以混物品、可以混批次、可以混状态 + boolean flag1 = false; + for (BalanceDO balanceDO : balanceDOList) { + boolean flag2 = true; + if ("TRUE".equals(enableMixItem) && !locationValidateVO.getItemCode().equals(balanceDO.getItemCode())) { + break; } - String enableMixItem = jsonObject.getStr("EnableMixItem"); - String enableMixLot = jsonObject.getStr("EnableMixLot"); - String enableMixStatus = jsonObject.getStr("EnableMixStatus"); - List balanceDOList = balanceMapper.getBalanceList(null, null, null, null, locationDO.getCode()); - //库位上存在物品,判断可以混物品、可以混批次、可以混状态 - boolean flag1 = false; - for (BalanceDO balanceDO : balanceDOList) { - boolean flag2 = true; - if ("TRUE".equals(enableMixItem) && !locationValidateVO.getItemCode().equals(balanceDO.getItemCode())) { - break; - } - if ("TRUE".equals(enableMixLot) && !locationValidateVO.getBatch().equals(balanceDO.getBatch())) { - flag2 = false; - if (!msg.contains("不能混批次;")) { - msg = msg + "不能混批次;"; - } + if ("TRUE".equals(enableMixLot) && !locationValidateVO.getBatch().equals(balanceDO.getBatch())) { + flag2 = false; + if (!msg.contains("不能混批次;")) { + msg = msg + "不能混批次;"; } - if ("TRUE".equals(enableMixStatus) && !locationValidateVO.getInventoryStatus().equals(balanceDO.getInventoryStatus())) { - flag2 = false; - if (!msg.contains("不能混状态;")) { - msg = msg + "不能混状态;"; - } - } - if (flag2) { - flag1 = true; + } + if ("TRUE".equals(enableMixStatus) && !locationValidateVO.getInventoryStatus().equals(balanceDO.getInventoryStatus())) { + flag2 = false; + if (!msg.contains("不能混状态;")) { + msg = msg + "不能混状态;"; } } - if (flag1) { - validateResult = true; - msg = ""; - break; + if (flag2) { + flag1 = true; } } + if (flag1) { + validateResult = true; + msg = ""; + break; + } } Map map = new HashMap<>(); map.put("itemCode", locationValidateVO.getItemCode()); diff --git a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/rule/RuleServiceImpl.java b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/rule/RuleServiceImpl.java index 06158d9a..a722b355 100644 --- a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/rule/RuleServiceImpl.java +++ b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/rule/RuleServiceImpl.java @@ -538,19 +538,18 @@ public class RuleServiceImpl implements RuleService { for (RuleDO ruleDO : ruleDOList) { String condition = ruleDO.getCondition(); if (condition == null || condition.isEmpty()) { + continue; + } + JSONArray conditionArray = JSONUtil.parseArray(condition); + Map params = new HashMap<>(); + if (itemCode != null && !itemCode.isEmpty()) { + params.put("ItemCode", itemCode); + } + if (inventoryStatus != null && !inventoryStatus.isEmpty()) { + params.put("InventoryStatus", inventoryStatus); + } + if (this.forEachParams(params, conditionArray)) { ruleRespVOList.add(RuleConvert.INSTANCE.convert(ruleDO)); - } else { - JSONArray conditionArray = JSONUtil.parseArray(condition); - Map params = new HashMap<>(); - if (itemCode != null && !itemCode.isEmpty()) { - params.put("ItemCode", itemCode); - } - if (inventoryStatus != null && !inventoryStatus.isEmpty()) { - params.put("InventoryStatus", inventoryStatus); - } - if (this.forEachParams(params, conditionArray)) { - ruleRespVOList.add(RuleConvert.INSTANCE.convert(ruleDO)); - } } } return ruleRespVOList;