diff --git a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/until/job/JobUtils.java b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/until/job/JobUtils.java index 3d01ccc9..fd03e3f6 100644 --- a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/until/job/JobUtils.java +++ b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/until/job/JobUtils.java @@ -103,22 +103,16 @@ public class JobUtils { /** * 数量与任务是否一致(可配置) + * author:yejiaxing * - * @return List + * @param recommendQty 任务参数 + * @param handleQty 记录参数 + * @param allowBiggerQty + * @param allowSmallerQty + * @return */ - public static boolean numAndJobIsSame(List param) { + public static boolean numAndJobIsSame(BigDecimal recommendQty, BigDecimal handleQty, String allowBiggerQty, BigDecimal allowSmallerQty) { boolean result = false; - // 任务参数 - Map jobMap = (Map) param.get(0).get("details"); - BigDecimal recommendQty = new BigDecimal(Integer.parseInt(jobMap.get("qty").toString())); - - // 记录参数 - Map recordMap = (Map) param.get(1).get("details"); - BigDecimal handleQty = new BigDecimal(Integer.parseInt(recordMap.get("qty").toString())); - - String allowBiggerQty = (String) jobMap.get("allowBiggerQty"); - String allowSmallerQty = (String) jobMap.get("allowBiggerQty"); - // 验证数据 if (handleQty.compareTo(recommendQty) == 1) { if ("TRUE".equals(allowBiggerQty)) { @@ -138,12 +132,48 @@ public class JobUtils { return result; } + /** + * @param jobDetailBatch // 任务参数 + * @param recordDetailBatch // 记录参数 + * @param allowModifyBatch + * @return + */ + public static boolean batchAndJobIsSame(BigDecimal jobDetailBatch, BigDecimal recordDetailBatch, String allowModifyBatch) { + boolean result = false; + // 验证数据 + if (jobDetailBatch.compareTo(recordDetailBatch) == 1) { + if ("TRUE".equals(allowModifyBatch)) { + result = true; + } else { + throw new UtilException("实际数量" + jobDetailBatch + " 不允许大于推荐数量" + recordDetailBatch); + } + } else if (jobDetailBatch.compareTo(recordDetailBatch) == -1) { + if ("TRUE".equals(allowModifyBatch)) { + result = true; + } else { + throw new UtilException("实际数量" + jobDetailBatch + " 不允许小于推荐数量" + recordDetailBatch); + } + } + + if (jobDetailBatch.compareTo(recordDetailBatch) == 0) { + result = true; + } else { + if ("TRUE".equals(allowModifyBatch)) { + result = true; + } else { + throw new UtilException("实际批次" + jobDetailBatch + " 与任务推荐批次" + recordDetailBatch + "不一致"); + } + } + return result; + } + /** * 校验物料有效,状态正确 - * @author chenfang + * * @param itemCode 物品代码 * @return 物品基本信息列表 * @author chenfang + * @author chenfang */ public ItembasicDO itemCodeExist(String itemCode) { ItembasicDO itembasicDO = itembasicService.selectItembasic(itemCode); @@ -156,10 +186,11 @@ public class JobUtils { /** * 校验供应商有效,状态正确 - * @author chenfang + * * @param supplierCode 代码 * @return 供应商列表 * @author chenfang + * @author chenfang */ public SupplierDO supplierExist(String supplierCode) { SupplierDO supplierDO = supplierService.selectSupplier(supplierCode); @@ -192,10 +223,11 @@ public class JobUtils { * 从库位号有效,状态正确,开关正确 * 到库位号有效,状态正确,开关正确 * 共用同一个方法 - * @author chenfang + * * @param locationCode 库位 * @return 库位信息 * @author chenfang + * @author chenfang */ public LocationDO selectLocationExist(String locationCode) { LocationDO locationDO = locationService.selectLocation(locationCode); @@ -220,10 +252,11 @@ public class JobUtils { /** * 零件库位关系有效 - * @author chenfang + * * @param pitemCode 物品代码 * @return 上架策略信息 * @author chenfang + * @author chenfang */ public RuleRespVO selectLocationAndModRelation(String pitemCode) { RuleRespVO grounding = ruleService.grounding(null, null, null, null, null, null, pitemCode, null, null, null, null, null, null); @@ -351,13 +384,14 @@ public class JobUtils { /** * TB-------TB1 * 查询库存返回管理精度 - * @author lianhongxi - * @param itemcode 零件号 - * @param packingnumber 包装号 - * @param batch 批次 - * @param locationcode 库位号 + * + * @param itemcode 零件号 + * @param packingnumber 包装号 + * @param batch 批次 + * @param locationcode 库位号 * @param inventoryStatus 入库库存状态 * @return + * @author lianhongxi */ public List selectlocation(String itemcode, String packingnumber, String batch, String locationcode, String inventoryStatus) { RuleRespVO managementtRule = ruleService.management(null, null, null, null, null, null, itemcode, null, null, @@ -381,13 +415,14 @@ public class JobUtils { /** * 跟据管理模式查询预计库存 * TB-----TB3-----TEO----TEO1 - * @author lianhongxi - * @param itemcode 零件号 - * @param packingnumber 包装号 - * @param batch 批次 - * @param locationcode 库位号 + * + * @param itemcode 零件号 + * @param packingnumber 包装号 + * @param batch 批次 + * @param locationcode 库位号 * @param inventoryStatus 入库库存状态 * @return + * @author lianhongxi */ public List selectLocatioNew(String itemcode, String packingnumber, String batch, String locationcode, String inventoryStatus) { RuleRespVO managementtRule = ruleService.management(null, null, null, null, null, null, itemcode, null, null, @@ -409,13 +444,14 @@ public class JobUtils { /** * 查询可用库存 * TB----TB3 - * @author lianhongxi - * @param itemcode 零件号 - * @param packingnumber 包装号 - * @param batch 批次 - * @param locationcode 库位好 + * + * @param itemcode 零件号 + * @param packingnumber 包装号 + * @param batch 批次 + * @param locationcode 库位好 * @param inventoryStatus 入库库存状态 * @return + * @author lianhongxi */ public BigDecimal CountLocaltion(String itemcode, String packingnumber, String batch, String locationcode, String inventoryStatus) { List balanceDO = selectlocation(itemcode, packingnumber, batch, locationcode, inventoryStatus); @@ -428,14 +464,15 @@ public class JobUtils { /** * 请求库存校验是否有库存余额 - * @author lianhongxi - * @param itemcode 零件号 - * @param packingnumber 包装号 - * @param batch 批次 - * @param locationcode 库位好 + * + * @param itemcode 零件号 + * @param packingnumber 包装号 + * @param batch 批次 + * @param locationcode 库位好 * @param inventoryStatus 入库库存状态 - * @param requstqty 请求数量 + * @param requstqty 请求数量 * @return + * @author lianhongxi */ public String LocaltionExist(String itemcode, String packingnumber, String batch, String locationcode, String inventoryStatus, BigDecimal requstqty) { BigDecimal enableqty = CountLocaltion(itemcode, packingnumber, batch, locationcode, inventoryStatus); @@ -500,19 +537,20 @@ public class JobUtils { /** * 根据管理模式查询预计出库存 * TEO----TEO1 - * @author lianhongxi - * @param pitemcode 零件号 - * @param ppackingnumber 包装号 - * @param pbatch 批次 + * + * @param pitemcode 零件号 + * @param ppackingnumber 包装号 + * @param pbatch 批次 * @param pinventorystatus 入库库存状态 - * @param plocationcode 库位号 + * @param plocationcode 库位号 * @return + * @author lianhongxi */ - public List selectExpectort(String pitemcode, String ppackingnumber, String pbatch, String pinventorystatus, String plocationcode){ + public List selectExpectort(String pitemcode, String ppackingnumber, String pbatch, String pinventorystatus, String plocationcode) { RuleRespVO management = ruleService.management(null, null, null, null, null, null, pitemcode, null, null, null, plocationcode, null, null); List expectoutDO = null; - if(management != null){ + if (management != null) { String[] splits = management.getConfiguration().split("\""); for (String split : splits) { if ("{\"ManagementPrecision\":\"BY_QUANTITY\"}".equals(management.getConfiguration())) { @@ -526,9 +564,80 @@ public class JobUtils { } return expectoutDO; } - }else { + } else { throw exception(RULE_NOT_EXISTS); } return expectoutDO; } + + /** + * 数量与任务是否一致(可配置) + * author:yejiaxing + * + * @param itemCode + * @param packingNumber + * @param batch + * @param locationCode + * @param inventoryStatus + * @return + */ + public List numAndJobIsSame(String itemCode, String packingNumber, String batch, String locationCode, String inventoryStatus) { + List balanceDOList = new ArrayList<>(); + try { + balanceDOList = selectlocation(itemCode, packingNumber, batch, locationCode, inventoryStatus); + } catch (Exception e) { + throw exception(new ErrorCode(1256, "接口调用异常,请重试")); + } + return balanceDOList; + } + + + /** + * 从库存有效,状态正确 + * author:yejiaxing + * + * @param itemCode + * @param packingNumber + * @param batch + * @param locationCode + * @param inventoryStatus + * @return + */ + public List fromInventoryEffective(String itemCode, String packingNumber, String batch, String locationCode, String inventoryStatus) { + List balanceDOList = new ArrayList<>(); + try { + balanceDOList = selectlocation(itemCode, packingNumber, batch, locationCode, inventoryStatus); + } catch (Exception e) { + throw exception(new ErrorCode(1256, "接口调用异常,请重试")); + } + return balanceDOList; + } + + /** + * 从库存有效,状态正确(使用客户寄售库) + * author:yejiaxing + * + * @param itemCode + * @param packingNumber + * @param batch + * @param locationCode + * @param inventoryStatus + * @return + */ + public Boolean fromInventoryEffectiveCustomer(String locationCode, String itemCode, String packingNumber, String batch, String inventoryStatus) { + Boolean returnRes = false; + List balanceDOList = new ArrayList<>(); + try { + String restlt = selectlocation(locationCode); + if ("TURE".equals(restlt)) { + fromInventoryEffective(itemCode, packingNumber, batch, locationCode, inventoryStatus); + } else if ("FALSE".equals(restlt)) { + return returnRes; + } + } catch (Exception e) { + throw exception(new ErrorCode(1256, "接口调用异常,请重试")); + } + return true; + } + }