Browse Source

校验库位物品接口修改。

master
刘忱 2 years ago
parent
commit
3e35ba9f76
  1. 120
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/location/LocationServiceImpl.java
  2. 23
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/rule/RuleServiceImpl.java

120
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<RuleRespVO> ruleRespVOList = ruleService.getGroundingList(locationValidateVO.getItemCode(), locationValidateVO.getInventoryStatus()); List<RuleRespVO> ruleRespVOList = ruleService.getGroundingList(locationValidateVO.getItemCode(), locationValidateVO.getInventoryStatus());
boolean validateResult = false; boolean validateResult = false;
String msg = ""; String msg = "";
if(ruleRespVOList.size() == 1) { for (RuleRespVO ruleRespVO : ruleRespVOList) {
validateResult = true; JSONObject jsonObject = JSONUtil.parseObj(ruleRespVO.getConfiguration());
} else { //增加过滤条件
for (RuleRespVO ruleRespVO : ruleRespVOList) { QueryWrapper<LocationDO> queryWrapper = new QueryWrapper<>();
JSONObject jsonObject = JSONUtil.parseObj(ruleRespVO.getConfiguration()); queryWrapper.eq("available", "TRUE");
//增加过滤条件 queryWrapper.eq("`code`", locationValidateVO.getLocationCode());
QueryWrapper<LocationDO> queryWrapper = new QueryWrapper<>(); List<String> locationTypeList = new ArrayList<>();
queryWrapper.eq("available", "TRUE"); locationTypeList.add("RAW");
queryWrapper.eq("`code`", locationValidateVO.getLocationCode()); locationTypeList.add("SEMI");
List<String> locationTypeList = new ArrayList<>(); locationTypeList.add("FG");
locationTypeList.add("RAW"); queryWrapper.in("`type`", locationTypeList);
locationTypeList.add("SEMI"); String warehouseCode = jsonObject.getStr("WarehouseCode");
locationTypeList.add("FG"); if (!"".equals(warehouseCode)) {
queryWrapper.in("`type`", locationTypeList); queryWrapper.eq("warehouse_code", warehouseCode);
String warehouseCode = jsonObject.getStr("WarehouseCode"); }
if (!"".equals(warehouseCode)) { String areaCode = jsonObject.getStr("AreaCode");
queryWrapper.eq("warehouse_code", warehouseCode); if (!"".equals(areaCode)) {
} queryWrapper.eq("area_code", areaCode);
String areaCode = jsonObject.getStr("AreaCode"); }
if (!"".equals(areaCode)) { String locationGroupCode = jsonObject.getStr("LocationGroupCode");
queryWrapper.eq("area_code", areaCode); if (!"".equals(locationGroupCode)) {
} queryWrapper.eq("location_group_code", locationGroupCode);
String locationGroupCode = jsonObject.getStr("LocationGroupCode"); }
if (!"".equals(locationGroupCode)) { String locationCode = jsonObject.getStr("LocationCode");
queryWrapper.eq("location_group_code", locationGroupCode); if (!"".equals(locationCode)) {
} queryWrapper.eq("`code`", locationCode);
String locationCode = jsonObject.getStr("LocationCode"); }
if (!"".equals(locationCode)) { LocationDO locationDO = locationMapper.selectOne(queryWrapper);
queryWrapper.eq("`code`", locationCode); //查询不到库位
} if (locationDO == null) {
LocationDO locationDO = locationMapper.selectOne(queryWrapper); continue;
//查询不到库位 }
if (locationDO == null) { String enableMixItem = jsonObject.getStr("EnableMixItem");
continue; String enableMixLot = jsonObject.getStr("EnableMixLot");
String enableMixStatus = jsonObject.getStr("EnableMixStatus");
List<BalanceDO> 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"); if ("TRUE".equals(enableMixLot) && !locationValidateVO.getBatch().equals(balanceDO.getBatch())) {
String enableMixLot = jsonObject.getStr("EnableMixLot"); flag2 = false;
String enableMixStatus = jsonObject.getStr("EnableMixStatus"); if (!msg.contains("不能混批次;")) {
List<BalanceDO> balanceDOList = balanceMapper.getBalanceList(null, null, null, null, locationDO.getCode()); msg = msg + "不能混批次;";
//库位上存在物品,判断可以混物品、可以混批次、可以混状态
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 ("TRUE".equals(enableMixStatus) && !locationValidateVO.getInventoryStatus().equals(balanceDO.getInventoryStatus())) {
if (!msg.contains("不能混状态;")) { flag2 = false;
msg = msg + "不能混状态;"; if (!msg.contains("不能混状态;")) {
} msg = msg + "不能混状态;";
}
if (flag2) {
flag1 = true;
} }
} }
if (flag1) { if (flag2) {
validateResult = true; flag1 = true;
msg = "";
break;
} }
} }
if (flag1) {
validateResult = true;
msg = "";
break;
}
} }
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("itemCode", locationValidateVO.getItemCode()); map.put("itemCode", locationValidateVO.getItemCode());

23
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) { for (RuleDO ruleDO : ruleDOList) {
String condition = ruleDO.getCondition(); String condition = ruleDO.getCondition();
if (condition == null || condition.isEmpty()) { if (condition == null || condition.isEmpty()) {
continue;
}
JSONArray conditionArray = JSONUtil.parseArray(condition);
Map<String, String> 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)); ruleRespVOList.add(RuleConvert.INSTANCE.convert(ruleDO));
} else {
JSONArray conditionArray = JSONUtil.parseArray(condition);
Map<String, String> 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; return ruleRespVOList;

Loading…
Cancel
Save