From 9904e51eb93ebe23a618604f711c6bc8f7da107d Mon Sep 17 00:00:00 2001 From: liuchen864 <23082234@qq.com> Date: Thu, 21 Dec 2023 17:43:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A8=E8=8D=90=E5=BA=93=E4=BD=8D=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E5=92=8C=E6=A0=A1=E9=AA=8C=E5=BA=93=E4=BD=8D=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E4=BF=AE=E6=94=B9bug=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/location/LocationServiceImpl.java | 91 +++++++++++++------ .../wms/service/rule/RuleServiceImpl.java | 3 +- 2 files changed, 64 insertions(+), 30 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 99e4ddb2..ebc01bc9 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 @@ -414,44 +414,77 @@ public class LocationServiceImpl implements LocationService { public List> validateLocationAndItem(List locationValidateVOList) { List> result = new ArrayList<>(); for(LocationValidateVO locationValidateVO : locationValidateVOList) { - LocationDO locationDO = locationMapper.selectByCode(locationValidateVO.getLocationCode()); List ruleRespVOList = ruleService.getGroundingList(locationValidateVO.getItemCode(), locationValidateVO.getInventoryStatus()); boolean validateResult = false; String msg = ""; - for(RuleRespVO ruleRespVO : ruleRespVOList) { - JSONObject jsonObject = JSONUtil.parseObj(ruleRespVO.getConfiguration()); - 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(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); } - if ("TRUE".equals(enableMixLot) && !locationValidateVO.getBatch().equals(balanceDO.getBatch())) { - flag2 = false; - if(!msg.contains("不能混批次;")) { - msg = msg + "不能混批次;"; - } + 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); } - if ("TRUE".equals(enableMixStatus) && !locationValidateVO.getInventoryStatus().equals(balanceDO.getInventoryStatus())) { - flag2 = false; - if(!msg.contains("不能混状态;")) { - msg = msg + "不能混状态;"; + 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; + } + 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(flag2) { - flag1 = true; + if (flag1) { + validateResult = true; + msg = ""; + break; } } - 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 26a794aa..06158d9a 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 @@ -588,7 +588,8 @@ public class RuleServiceImpl implements RuleService { for (int i = 0; i < conditionArray.size(); i++) { JSONObject conditionObject = conditionArray.getJSONObject(i); for (String key : paramsMap.keySet()) { - if (key.equals(conditionObject.get("ParamCode")) && conditionObject.get("ParamCode") != null) { + String conditionParamValue = conditionObject.getStr("Value"); + if (conditionParamValue != null && !conditionParamValue.isEmpty() && key.equals(conditionObject.getStr("ParamCode"))) { boolean result2 = this.checkCondition(conditionObject, key, paramsMap.get(key)); if (!result2) { result1 = false;