Browse Source

推荐库存修改

master
陈薪名 2 years ago
parent
commit
8f11ce61bc
  1. 4
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/issueRequest/IssueRequestMainServiceImpl.java
  2. 35
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/util/JobUtils.java

4
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/issueRequest/IssueRequestMainServiceImpl.java

@ -690,8 +690,8 @@ public class IssueRequestMainServiceImpl implements IssueRequestMainService {
issueJobDetailDO.setProductionLineCode(item.getProductionLineCode());
issueJobDetailDO.setWorkStationCode(item.getWorkStationCode());
issueJobDetailDO.setOnTheWayLocationCode(issueJobDetailDO.getOnTheWayLocationCode());
issueJobDetailDO.setPackingNumber(balanceDOItem.getPackingNumber());
issueJobDetailDO.setContainerNumber(balanceDOItem.getContainerNumber());
// issueJobDetailDO.setPackingNumber(balanceDOItem.getPackingNumber());
// issueJobDetailDO.setContainerNumber(balanceDOItem.getContainerNumber());
issueJobDetailDO.setBatch(balanceDOItem.getBatch());
issueJobDetailDO.setFromLocationCode(balanceDOItem.getLocationCode());
issueJobDetailDO.setToLocationCode(item.getToLocationCode());

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

@ -32,6 +32,7 @@ import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@ -738,6 +739,19 @@ public class JobUtils {
* @return
*/
public List<BalanceDO> getBalanceByBatchOffShelf(String itemCode, String inventoryStatus, String projectCode, BigDecimal qty, String locationTypes ) {
List<String> locationList = new ArrayList<>();
if (locationTypes != null && !locationTypes.equals("")) {
String[] locationTypesStrs = locationTypes.split(",");
for(int i=0;i<locationTypesStrs.length;i++) {
QueryWrapper qw = new QueryWrapper();
qw.eq("type",locationTypesStrs[i]);
List<LocationDO> locationDOSList = locationMapper.selectList(qw);
locationDOSList.forEach(itemLocation -> {
locationList.add(itemLocation.getCode());
});
}
}
// 批次策略
RuleRespVO ruleRespVOBatch = ruleService.batch(null, null,null,null,null,projectCode,itemCode);
JSONObject jsonObjectBatch = JSONUtil.parseObj(ruleRespVOBatch.getConfiguration());
@ -746,7 +760,7 @@ public class JobUtils {
JSONObject jsonObjectOffShelf = JSONUtil.parseObj(ruleRespVOOffShelf.getConfiguration());
// 查询库存余额
QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.select("item_code", "batch", "SUM(qty) as qty", "packing_number", "container_number", "warehouse_code", "area_code", "location_group_code", "location_code", "produce_date", "arrive_date");
queryWrapper.select("item_code", "batch", "SUM(qty) as qty", "warehouse_code", "area_code", "location_group_code", "location_code", "produce_date", "arrive_date");
if (itemCode != null && !itemCode.equals("")) {
queryWrapper.eq("item_code", itemCode);
} else {
@ -760,6 +774,10 @@ public class JobUtils {
if (qty == null) {
throw exception(BALANCE_QTY_NOT_EXISTS);
}
// 根据库存类型 过滤 查询的库位
if (locationList != null && locationList.size() > 0) {
queryWrapper.in("location_code", locationList);
}
// 根据下架策略 作为查询库存余额条件
// 仓库
if (jsonObjectOffShelf.get("WarehouseCode") != null && !jsonObjectOffShelf.get("WarehouseCode").equals("")) {
@ -788,7 +806,7 @@ public class JobUtils {
}
// 发料包装类型——按 单件
if (jsonObjectOffShelf.get("IssueStorageType") != null && jsonObjectOffShelf.get("IssueStorageType").equals("3")) {
queryWrapper.groupBy("item_code", "batch", "qty", "packing_number", "container_number", "warehouse_code", "area_code", "location_group_code", "location_code", "expire_date", "produce_date", "arrive_date");
queryWrapper.groupBy("item_code", "batch", "qty", "warehouse_code", "area_code", "location_group_code", "location_code", "expire_date", "produce_date", "arrive_date");
}
// 根据批次策略 作为查询库存余额排序
// 批次类型——按 生产时间
@ -860,17 +878,18 @@ public class JobUtils {
}
BigDecimal countQty = new BigDecimal(0.000000);
for (BalanceDO balanceDO: balanceDOList) {
// 根据库位类型进行过滤
if (locationTypes != null && !locationTypes.equals("")) {
if(locationTypes.indexOf(locationService.selectLocation(balanceDO.getLocationCode()).getType()) == -1) {
continue;
}
// 特殊情况 库位为null 跳出循环
if (balanceDO.getLocationCode() == null) {
continue;
}
// 查询 预计出 求和 数量
// TODO: 后续完善 根据 管理精度查询
QueryWrapper queryWrapperExpectout = new QueryWrapper();
queryWrapperExpectout.select("SUM(qty) as qty");
queryWrapperExpectout.eq("item_code", balanceDO.getItemCode());
if (locationList != null && locationList.size() > 0) {
queryWrapperExpectout.in("location_code", locationList);
}
if (balanceDO.getPackingNumber() != null && !balanceDO.getPackingNumber().equals("")) queryWrapperExpectout.eq("packing_number", balanceDO.getPackingNumber());
if (balanceDO.getBatch() != null && !balanceDO.getBatch().equals("")) queryWrapperExpectout.eq("batch", balanceDO.getBatch());
queryWrapperExpectout.groupBy("item_code","packing_number", "batch");
@ -891,7 +910,7 @@ public class JobUtils {
}
}
if (balanceDOListJob == null || balanceDOListJob.size() == 0) {
throw new UtilException("没有找到推荐的库存");
throw new UtilException("物品代码:" + itemCode + " 没有找到推荐的库存");
}
return balanceDOListJob;
}

Loading…
Cancel
Save