Browse Source

Merge remote-tracking branch 'origin/master'

master
刘忱 2 years ago
parent
commit
0b1bd5204f
  1. 10
      win-module-wms/win-module-wms-api/src/main/java/com/win/module/wms/enums/ErrorCodeConstants.java
  2. 103
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/util/JobUtils.java

10
win-module-wms/win-module-wms-api/src/main/java/com/win/module/wms/enums/ErrorCodeConstants.java

@ -132,6 +132,7 @@ public interface ErrorCodeConstants {
ErrorCode WAREHOUSE_CODE_NOT_EXISTS = new ErrorCode(1_033_000_002, "code不存在"); ErrorCode WAREHOUSE_CODE_NOT_EXISTS = new ErrorCode(1_033_000_002, "code不存在");
ErrorCode WAREHOUSE_AVAIABLE_NOT_EXISTS = new ErrorCode(1_033_000_003, "是否可用不存在"); ErrorCode WAREHOUSE_AVAIABLE_NOT_EXISTS = new ErrorCode(1_033_000_003, "是否可用不存在");
ErrorCode WAREHOUSE_IMPORT_LIST_IS_EMPTY = new ErrorCode(1_033_000_004, "导入仓库不能为空"); ErrorCode WAREHOUSE_IMPORT_LIST_IS_EMPTY = new ErrorCode(1_033_000_004, "导入仓库不能为空");
ErrorCode WAREHOUSE_STOCK_EXCEPTION = new ErrorCode(1_033_000_005, "库存问题【{}】");
//月台ErrorCode //月台ErrorCode
ErrorCode DOCK_NOT_EXISTS = new ErrorCode(1_000_034_000, "月台(收货口)不存在"); ErrorCode DOCK_NOT_EXISTS = new ErrorCode(1_000_034_000, "月台(收货口)不存在");
ErrorCode DOCK_CODE_NOT_EXISTS = new ErrorCode(1_000_034_001, "code不存在"); ErrorCode DOCK_CODE_NOT_EXISTS = new ErrorCode(1_000_034_001, "code不存在");
@ -173,6 +174,9 @@ public interface ErrorCodeConstants {
ErrorCode LOCATION_ITEMCODE_AND_LOCATIONCODE_NOT_EXISTS = new ErrorCode(1_000_037_012, "未查找到零件item_code库位location_code对应的上架策略"); ErrorCode LOCATION_ITEMCODE_AND_LOCATIONCODE_NOT_EXISTS = new ErrorCode(1_000_037_012, "未查找到零件item_code库位location_code对应的上架策略");
ErrorCode LOCATION_HANDLE_TOLOCATIONCODE_AND_RECOMMEND_TOLOCATIONCODECODE_INCONFORMITY = new ErrorCode(1_000_037_013, "实际库位与任务推荐的目标库位不一致"); ErrorCode LOCATION_HANDLE_TOLOCATIONCODE_AND_RECOMMEND_TOLOCATIONCODECODE_INCONFORMITY = new ErrorCode(1_000_037_013, "实际库位与任务推荐的目标库位不一致");
ErrorCode LOCATION_DISABLE_NEGATIVE = new ErrorCode(1_000_037_014, "库位不允许负库存"); ErrorCode LOCATION_DISABLE_NEGATIVE = new ErrorCode(1_000_037_014, "库位不允许负库存");
ErrorCode LOCATION_EXCEPTION = new ErrorCode(1_000_037_015, "库位问题:【{}】");
ErrorCode LOCATION_INVENTORY_EXCEPTION = new ErrorCode(1_000_037_016, "库存问题:【{}】");
ErrorCode LOCATION_NOT_CUST = new ErrorCode(1_000_037_017, "【{}】不是客户寄售库");
//车间ErrorCode //车间ErrorCode
ErrorCode WORKSHOP_NOT_EXISTS = new ErrorCode(1_038_000_000, "车间不存在"); ErrorCode WORKSHOP_NOT_EXISTS = new ErrorCode(1_038_000_000, "车间不存在");
ErrorCode WORKSHOP_CODE_EXISTS = new ErrorCode(1_039_000_001, "code已存在"); ErrorCode WORKSHOP_CODE_EXISTS = new ErrorCode(1_039_000_001, "code已存在");
@ -805,9 +809,11 @@ public interface ErrorCodeConstants {
ErrorCode SWITCH_NOT_EXISTS = new ErrorCode(1_000_166_000, "单据开关不存在"); ErrorCode SWITCH_NOT_EXISTS = new ErrorCode(1_000_166_000, "单据开关不存在");
//企业ErrorCode //企业ErrorCode
ErrorCode ENTERPRISE_NOT_EXISTS = new ErrorCode(1_000_167_000, "企业不存在"); ErrorCode ENTERPRISE_NOT_EXISTS = new ErrorCode(1_000_167_000, "企业不存在");
//"订单行"+ poLine + "的已发货数量" + shippedQty + "+计划数量" + qty + "大于订单数量" + orderQty ErrorCode
ErrorCode AMOUNT_EXCEPTION = new ErrorCode(1_000_400_000, "数量问题:【{}】");
//UOM ErrorCode //UOM ErrorCode
ErrorCode BATCH_EXCEPTION = new ErrorCode(1_000_400_000, "批次问题:【{}】");
ErrorCode UOM_EXCEPTION = new ErrorCode(1_000_401_000, "单位问题:【{}】"); ErrorCode UOM_EXCEPTION = new ErrorCode(1_000_401_000, "单位问题:【{}】");
ErrorCode MANAGEMENTPRECISION_EXCEPTION = new ErrorCode(1_000_402_000, "管理精度问题:【{}】");
ErrorCode QTY_EXCEPTION = new ErrorCode(1_000_403_000, "数量问题:【{}】");
} }

103
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/util/JobUtils.java

@ -4,7 +4,6 @@ import cn.hutool.core.exceptions.UtilException;
import cn.hutool.json.JSONObject; import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.win.framework.common.exception.ErrorCode;
import com.win.module.wms.controller.rule.vo.RuleRespVO; import com.win.module.wms.controller.rule.vo.RuleRespVO;
import com.win.module.wms.dal.dataobject.balance.BalanceDO; import com.win.module.wms.dal.dataobject.balance.BalanceDO;
import com.win.module.wms.dal.dataobject.businesstype.BusinesstypeDO; import com.win.module.wms.dal.dataobject.businesstype.BusinesstypeDO;
@ -103,7 +102,7 @@ public class JobUtils {
Map recordMap = recordJsonObject.get("record", Map.class); Map recordMap = recordJsonObject.get("record", Map.class);
resList.add(recordMap); resList.add(recordMap);
} catch (Exception e) { } catch (Exception e) {
throw new UtilException("数据解析异常,请重试!", e); log.error("数据解析异常,请重试!", e);
} }
} }
@ -127,13 +126,13 @@ public class JobUtils {
if ("TRUE".equals(allowBiggerQty)) { if ("TRUE".equals(allowBiggerQty)) {
result = true; result = true;
} else { } else {
throw new UtilException("实际数量" + handleQty + " 不允许大于推荐数量" + recommendQty); throw exception(QTY_EXCEPTION,"实际数量" + handleQty + " 不允许大于推荐数量" + recommendQty);
} }
} else if (handleQty.compareTo(recommendQty) == -1) { } else if (handleQty.compareTo(recommendQty) == -1) {
if ("TRUE".equals(allowSmallerQty)) { if ("TRUE".equals(allowSmallerQty)) {
result = true; result = true;
} else { } else {
throw new UtilException("实际数量" + handleQty + " 不允许小于推荐数量" + recommendQty); throw exception(QTY_EXCEPTION,"实际数量" + handleQty + " 不允许小于推荐数量" + recommendQty);
} }
} else if (handleQty.compareTo(recommendQty) == 0) { } else if (handleQty.compareTo(recommendQty) == 0) {
result = true; result = true;
@ -154,23 +153,22 @@ public class JobUtils {
if ("TRUE".equals(allowModifyBatch)) { if ("TRUE".equals(allowModifyBatch)) {
result = true; result = true;
} else { } else {
throw new UtilException("实际数量" + jobDetailBatch + " 不允许大于推荐数量" + recordDetailBatch); throw exception(QTY_EXCEPTION,"实际数量" + jobDetailBatch + " 不允许大于推荐数量" + recordDetailBatch);
} }
} else if (jobDetailBatch.compareTo(recordDetailBatch) == -1) { } else if (jobDetailBatch.compareTo(recordDetailBatch) == -1) {
if ("TRUE".equals(allowModifyBatch)) { if ("TRUE".equals(allowModifyBatch)) {
result = true; result = true;
} else { } else {
throw new UtilException("实际数量" + jobDetailBatch + " 不允许小于推荐数量" + recordDetailBatch); throw exception(QTY_EXCEPTION,"实际数量" + jobDetailBatch + " 不允许小于推荐数量" + recordDetailBatch);
} }
} }
if (jobDetailBatch.compareTo(recordDetailBatch) == 0) { if (jobDetailBatch.compareTo(recordDetailBatch) == 0) {
result = true; result = true;
} else { } else {
if ("TRUE".equals(allowModifyBatch)) { if ("TRUE".equals(allowModifyBatch)) {
result = true; result = true;
} else { } else {
throw new UtilException("实际批次" + jobDetailBatch + " 与任务推荐批次" + recordDetailBatch + "不一致"); throw exception(BATCH_EXCEPTION,"实际批次" + jobDetailBatch + " 与任务推荐批次" + recordDetailBatch + "不一致");
} }
} }
return result; return result;
@ -319,12 +317,12 @@ public class JobUtils {
} }
} }
}else { }else {
throw new UtilException("物料代码" + pitemCode + "无效"); throw exception(ITEMBASIC_EXCEPTION,"物料代码" + pitemCode + "无效");
} }
if (ifInStatus == true) { if (ifInStatus == true) {
return true; return true;
} else { } else {
throw new UtilException("物料" + pitemCode + "的状态" + itembasicDO.getStatus() + "与业务类型" + throw exception(ITEMBASIC_EXCEPTION,"物料" + pitemCode + "的状态" + itembasicDO.getStatus() + "与业务类型" +
businesstypeDO.getName() + "的物料状态" + businesstypeDO.getItemStatuses() + "不一致"); businesstypeDO.getName() + "的物料状态" + businesstypeDO.getItemStatuses() + "不一致");
} }
} }
@ -342,12 +340,12 @@ public class JobUtils {
} }
} }
else { else {
throw new UtilException("库位" + plocationCode + "无效"); throw exception(LOCATION_EXCEPTION,"库位" + plocationCode + "无效");
} }
if (ifInLocationType == true) { if (ifInLocationType == true) {
return true; return true;
} else { } else {
throw new UtilException("入库库位" + plocationCode + "的库位类型" + locationDO.getType() + "与业务类型" + throw exception(LOCATION_EXCEPTION,"入库库位" + plocationCode + "的库位类型" + locationDO.getType() + "与业务类型" +
businesstypeDO.getName() + "的入库库位类型" + businesstypeDO.getInLocationTypes() + "不一致"); businesstypeDO.getName() + "的入库库位类型" + businesstypeDO.getInLocationTypes() + "不一致");
} }
} }
@ -365,12 +363,12 @@ public class JobUtils {
} }
} }
else { else {
throw new UtilException("库位" + plocationCode + "无效"); throw exception(LOCATION_EXCEPTION,"库位" + plocationCode + "无效");
} }
if (ifOutLocationType == true) { if (ifOutLocationType == true) {
return true; return true;
} else { } else {
throw new UtilException("出库库位" + plocationCode + "的库位类型" + locationDO.getType() + "与业务类型与业务类型" + throw exception(LOCATION_EXCEPTION,"出库库位" + plocationCode + "的库位类型" + locationDO.getType() + "与业务类型与业务类型" +
businesstypeDO.getName() + "的出库库位类型" + businesstypeDO.getOutLocationTypes() + "不一致"); businesstypeDO.getName() + "的出库库位类型" + businesstypeDO.getOutLocationTypes() + "不一致");
} }
} }
@ -387,12 +385,12 @@ public class JobUtils {
} }
} }
else { else {
throw new UtilException("入库库存状态" + pinventoryStatus + "为空"); throw exception(WAREHOUSE_STOCK_EXCEPTION,"入库库存状态" + pinventoryStatus + "为空");
} }
if (ifInInventoryStatuses == true) { if (ifInInventoryStatuses == true) {
return true; return true;
} else { } else {
throw new UtilException("入库库存状态" + pinventoryStatus + "与业务类型" + throw exception(LOCATION_INVENTORY_EXCEPTION,"入库库存状态" + pinventoryStatus + "与业务类型" +
businesstypeDO.getName() + "的入库库存状态" + businesstypeDO.getInInventoryStatuses() + "不一致"); businesstypeDO.getName() + "的入库库存状态" + businesstypeDO.getInInventoryStatuses() + "不一致");
} }
} }
@ -409,12 +407,12 @@ public class JobUtils {
} }
} }
else { else {
throw new UtilException("出库库存状态" + pinventoryStatus + "为空"); throw exception(LOCATION_INVENTORY_EXCEPTION,"出库库存状态" + pinventoryStatus + "为空");
} }
if (ifOutInventoryStatuses == true) { if (ifOutInventoryStatuses == true) {
return true; return true;
} else { } else {
throw new UtilException("出库库存状态" + pinventoryStatus + "与业务类型" + throw exception(LOCATION_INVENTORY_EXCEPTION,"出库库存状态" + pinventoryStatus + "与业务类型" +
businesstypeDO.getName() + "的出库库存状态" + businesstypeDO.getOutInventoryStatuses() + "不一致"); businesstypeDO.getName() + "的出库库存状态" + businesstypeDO.getOutInventoryStatuses() + "不一致");
} }
} }
@ -463,28 +461,28 @@ public class JobUtils {
if ("{\"ManagementPrecision\":\"BY_QUANTITY\"}".equals(managementtRule.getConfiguration())) { if ("{\"ManagementPrecision\":\"BY_QUANTITY\"}".equals(managementtRule.getConfiguration())) {
balanceDO = balanceService.selectNumber(itemcode, inventoryStatus, locationcode); balanceDO = balanceService.selectNumber(itemcode, inventoryStatus, locationcode);
if(balanceDO == null){ if(balanceDO == null){
throw new UtilException( "物品代码" + itemcode + "库存状态" + inventoryStatus + "在" + locationcode + "库位中未查找到库存记录"); throw exception(MANAGEMENTPRECISION_EXCEPTION, "物品代码" + itemcode + "库存状态" + inventoryStatus + "在" + locationcode + "库位中未查找到库存记录");
}else { }else {
return balanceDO; return balanceDO;
} }
}else if ("{\"ManagementPrecision\":\"BY_BATCH\"}".equals(managementtRule.getConfiguration())) { }else if ("{\"ManagementPrecision\":\"BY_BATCH\"}".equals(managementtRule.getConfiguration())) {
balanceDO = balanceService.selectBatch(itemcode, batch, inventoryStatus, locationcode); balanceDO = balanceService.selectBatch(itemcode, batch, inventoryStatus, locationcode);
if(balanceDO == null){ if(balanceDO == null){
throw new UtilException( "物品代码" + itemcode + "批次" + batch + "库存状态" + inventoryStatus + "在" + locationcode + "库位中未查找到库存记录"); throw exception(MANAGEMENTPRECISION_EXCEPTION, "物品代码" + itemcode + "批次" + batch + "库存状态" + inventoryStatus + "在" + locationcode + "库位中未查找到库存记录");
}else { }else {
return balanceDO; return balanceDO;
} }
}else if("{\"ManagementPrecision\":\"BY_PACKAGING\"}".equals(managementtRule.getConfiguration())) { }else if("{\"ManagementPrecision\":\"BY_PACKAGING\"}".equals(managementtRule.getConfiguration())) {
balanceDO = balanceService.selectPackaging(itemcode, packingnumber, batch, inventoryStatus, locationcode); balanceDO = balanceService.selectPackaging(itemcode, packingnumber, batch, inventoryStatus, locationcode);
if(balanceDO == null){ if(balanceDO == null){
throw new UtilException( "物品代码" + itemcode + "箱码" + packingnumber + "批次" + batch + "库存状态" + inventoryStatus + "在" + locationcode + "库位中未查找到库存记录"); throw exception(MANAGEMENTPRECISION_EXCEPTION,"物品代码" + itemcode + "箱码" + packingnumber + "批次" + batch + "库存状态" + inventoryStatus + "在" + locationcode + "库位中未查找到库存记录");
}else { }else {
return balanceDO; return balanceDO;
} }
}else if("{\"ManagementPrecision\":\"BY_UNIQUE_ID\"}".equals(managementtRule.getConfiguration())) { }else if("{\"ManagementPrecision\":\"BY_UNIQUE_ID\"}".equals(managementtRule.getConfiguration())) {
balanceDO = balanceService.selectUniqueId(packingnumber, locationcode, inventoryStatus); balanceDO = balanceService.selectUniqueId(packingnumber, locationcode, inventoryStatus);
if(balanceDO == null){ if(balanceDO == null){
throw new UtilException( "唯一码" + packingnumber + "库存状态" + inventoryStatus + "在" + locationcode + "库位中未查找到库存记录"); throw exception(MANAGEMENTPRECISION_EXCEPTION, "唯一码" + packingnumber + "库存状态" + inventoryStatus + "在" + locationcode + "库位中未查找到库存记录");
}else { }else {
return balanceDO; return balanceDO;
} }
@ -557,12 +555,12 @@ public class JobUtils {
* @return * @return
* @author lianhongxi * @author lianhongxi
*/ */
public String LocaltionExist(String itemcode, String packingnumber, String batch, String locationcode, List<String> inventoryStatus, BigDecimal requstqty) { public boolean warehouseStockExist(String itemcode, String packingnumber, String batch, String locationcode, List<String> inventoryStatus, BigDecimal requstqty) {
BigDecimal enableqty = CountLocaltion(itemcode, packingnumber, batch, locationcode, inventoryStatus); BigDecimal enableqty = CountLocaltion(itemcode, packingnumber, batch, locationcode, inventoryStatus);
if (requstqty.compareTo(enableqty) > 0) { if (requstqty.compareTo(enableqty) > 0) {
throw exception(new ErrorCode(1256, "请求数量" + requstqty + "大于库存数量" + enableqty)); throw exception(WAREHOUSE_STOCK_EXCEPTION, "请求数量" + requstqty + "大于库存数量" + enableqty);
} else { } else {
return "成功"; return true;
} }
} }
@ -579,41 +577,40 @@ public class JobUtils {
} }
//库存不应该存在 //库存不应该存在
public List<BalanceDO> locationNoExist(String itemcode, String packingnumber, String locationcode, List<String> inventoryStatus) { public List<BalanceDO> warehouseStocknNotExist(String itemcode, String packingnumber, String locationcode, List<String> inventoryStatus) {
RuleRespVO managementtRule = ruleService.management(null, null, null, null, null, null, itemcode, null, null, RuleRespVO managementtRule = ruleService.management(null, null, null, null, null, null, itemcode, null, null,
null, locationcode, null, null); null, locationcode, null, null);
List<BalanceDO> balanceDO = null; List<BalanceDO> balanceDO = null;
if ("{\"ManagementPrecision\":\"BY_UNIQUE_ID\"}".equals(managementtRule.getConfiguration())) { if ("{\"ManagementPrecision\":\"BY_UNIQUE_ID\"}".equals(managementtRule.getConfiguration())) {
balanceDO = balanceService.selectUniqueId(packingnumber, locationcode, inventoryStatus); balanceDO = balanceService.selectUniqueId(packingnumber, locationcode, inventoryStatus);
return balanceDO; return balanceDO;
} else { }else {
throw exception(new ErrorCode(1256, "校验通过")); return null;
} }
} }
//查询库位BQ-QL //查询库位BQ-QL
public String selectlocation(String code) { public boolean selectlocation(String code) {
QueryWrapper queryWrapper = new QueryWrapper(); QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.eq("code", code); queryWrapper.eq("code", code);
queryWrapper.eq("available", "TRUE");
LocationDO locationDO = locationMapper.selectOne(queryWrapper); LocationDO locationDO = locationMapper.selectOne(queryWrapper);
if (locationDO == null && "TRUE".equals(locationDO.getAvailable())) { if (locationDO == null) {
return "TURE"; return true;
} else { } else {
return "FALSE"; return false;
} }
} }
//从库位未被其他任务占用,有可用库存 //从库位未被其他任务占用,有可用库存
public String locationExistnew(String itemcode, String packingnumber, String batch, String fromlocationcode, List<String> inventoryStatus, BigDecimal requstqty) { public boolean locationUsable(String itemcode, String packingnumber, String batch, String fromlocationcode, List<String> inventoryStatus, BigDecimal requstqty) {
if (fromlocationcode.isEmpty()) { if (fromlocationcode.isEmpty()) {
return "不需要其他校验"; return true;
} }
String Yesorno = selectlocation(fromlocationcode); if (selectlocation(fromlocationcode)) {
if ("TURE".equals(Yesorno)) { return warehouseStockExist(itemcode, packingnumber, batch, fromlocationcode, inventoryStatus, requstqty);
String END = LocaltionExist(itemcode, packingnumber, batch, fromlocationcode, inventoryStatus, requstqty);
return END;
} else { } else {
return "效验通过"; throw exception(LOCATION_NOT_CUST,fromlocationcode);
} }
} }
@ -666,11 +663,7 @@ public class JobUtils {
*/ */
public List<BalanceDO> numAndJobIsSame(String itemCode, String packingNumber, String batch, String locationCode, List<String> inventoryStatus) { public List<BalanceDO> numAndJobIsSame(String itemCode, String packingNumber, String batch, String locationCode, List<String> inventoryStatus) {
List<BalanceDO> balanceDOList = new ArrayList<>(); List<BalanceDO> balanceDOList = new ArrayList<>();
try { balanceDOList = selectlocationReturnManagementAccuracy(itemCode, packingNumber, batch, locationCode, inventoryStatus);
balanceDOList = selectlocationReturnManagementAccuracy(itemCode, packingNumber, batch, locationCode, inventoryStatus);
} catch (Exception e) {
throw exception(new ErrorCode(1256, "接口调用异常,请重试"));
}
return balanceDOList; return balanceDOList;
} }
@ -687,12 +680,8 @@ public class JobUtils {
* @return * @return
*/ */
public List<BalanceDO> fromInventoryEffective(String itemCode, String packingNumber, String batch, String locationCode, List<String> inventoryStatus) { public List<BalanceDO> fromInventoryEffective(String itemCode, String packingNumber, String batch, String locationCode, List<String> inventoryStatus) {
List<BalanceDO> balanceDOList = new ArrayList<>(); List<BalanceDO> balanceDOList = new ArrayList();
try { balanceDOList = selectlocationReturnManagementAccuracy(itemCode, packingNumber, batch, locationCode, inventoryStatus);
balanceDOList = selectlocationReturnManagementAccuracy(itemCode, packingNumber, batch, locationCode, inventoryStatus);
} catch (Exception e) {
throw exception(new ErrorCode(1256, "接口调用异常,请重试"));
}
return balanceDOList; return balanceDOList;
} }
@ -729,16 +718,10 @@ public class JobUtils {
*/ */
public Boolean fromInventoryEffectiveCustomer(String locationCode, String itemCode, String packingNumber, String batch, List<String> inventoryStatus) { public Boolean fromInventoryEffectiveCustomer(String locationCode, String itemCode, String packingNumber, String batch, List<String> inventoryStatus) {
Boolean returnRes = false; Boolean returnRes = false;
List<BalanceDO> balanceDOList = new ArrayList<>(); if (selectlocation(locationCode)) {
try { fromInventoryEffective(itemCode, packingNumber, batch, locationCode, inventoryStatus);
String restlt = selectlocation(locationCode); } else{
if ("TURE".equals(restlt)) { return returnRes;
fromInventoryEffective(itemCode, packingNumber, batch, locationCode, inventoryStatus);
} else if ("FALSE".equals(restlt)) {
return returnRes;
}
} catch (Exception e) {
throw exception(new ErrorCode(1256, "接口调用异常,请重试"));
} }
return true; return true;
} }

Loading…
Cancel
Save