Commit c7059fb9 hc

fix:获取料箱信息方法修改

1 个父辈 1085ac77
...@@ -8,6 +8,7 @@ import com.neotel.smfcore.common.utils.StringUtils; ...@@ -8,6 +8,7 @@ import com.neotel.smfcore.common.utils.StringUtils;
import com.neotel.smfcore.core.barcode.enums.BARCODE_STATUS; import com.neotel.smfcore.core.barcode.enums.BARCODE_STATUS;
import com.neotel.smfcore.core.barcode.service.manager.IBarcodeManager; import com.neotel.smfcore.core.barcode.service.manager.IBarcodeManager;
import com.neotel.smfcore.core.barcode.service.po.Barcode; import com.neotel.smfcore.core.barcode.service.po.Barcode;
import com.neotel.smfcore.core.barcode.utils.CodeResolve;
import com.neotel.smfcore.core.device.enums.OP; import com.neotel.smfcore.core.device.enums.OP;
import com.neotel.smfcore.core.device.enums.OP_STATUS; import com.neotel.smfcore.core.device.enums.OP_STATUS;
import com.neotel.smfcore.core.device.util.DataCache; import com.neotel.smfcore.core.device.util.DataCache;
...@@ -62,6 +63,13 @@ public class BoxHandleUtil { ...@@ -62,6 +63,13 @@ public class BoxHandleUtil {
BoxHandleUtil.taskService = service; BoxHandleUtil.taskService = service;
} }
private static CodeResolve codeResolve;
@Autowired
public void setCodeResolve(CodeResolve resolve) {
BoxHandleUtil.codeResolve = resolve;
}
/** /**
* key 为料箱号 * key 为料箱号
...@@ -369,113 +377,117 @@ public class BoxHandleUtil { ...@@ -369,113 +377,117 @@ public class BoxHandleUtil {
String platsize = ""; String platsize = "";
int boxAllCount = 0; int boxAllCount = 0;
int boxRemainingCount = 0; int boxRemainingCount = 0;
String boxStr = ""; ;
String msg = ""; String msg = "";
String boxStr = "";
List<List<Integer>> boxPartitionCounts = new ArrayList<>(); List<List<Integer>> boxPartitionCounts = new ArrayList<>();
if (StringUtils.isNotBlank(code)) { if (StringUtils.isNotBlank(code)) {
if (code.startsWith("C07") || code.startsWith("C13") || code.startsWith("C15")) { if (code.startsWith("C07") || code.startsWith("C13") || code.startsWith("C15")) {
String endStr = code.substring(code.length() - 1); //得到是A、B面
boxStr = getBoxStr(code, false);
if (boxSideMap.get(boxStr) != null) {
endStr = boxSideMap.get(boxStr);
} else {
boxSideMap.put(boxStr, endStr);
}
//1、获取料箱的 //1、获取料箱的
Barcode barcode = barcodeManager.findByBarcode(boxStr); Barcode barcode = codeResolve.resolveOneValideBarcode(code);
if (barcode != null) { if (barcode != null) {
boxStr = barcode.getBarcode();
String endStr = code.substring(code.length() - 1); //得到是A、B面
if (boxSideMap.get(boxStr) != null) {
endStr = boxSideMap.get(boxStr);
} else {
boxSideMap.put(boxStr, endStr);
}
List<Barcode> subCodeList = barcode.getSubCodeList(); List<Barcode> subCodeList = barcode.getSubCodeList();
if (subCodeList != null && !subCodeList.isEmpty()) { if (subCodeList == null){
if (boxAllCountMap.get(boxStr) == null) { subCodeList = new ArrayList<>();
boxAllCountMap.put(boxStr, subCodeList.size()); }
//if (subCodeList != null && !subCodeList.isEmpty()) {
if (boxAllCountMap.get(boxStr) == null) {
boxAllCountMap.put(boxStr, subCodeList.size());
}
//进行库位分组
Map<String, Long> allCountMap = subCodeList.stream().collect(Collectors.groupingBy(Barcode::getPosName, Collectors.counting()));
//得到需要出库的数量
Map<String, Long> needOutCountMap = new HashMap<>();
List<Barcode> outSubCodeList = subCodeList.stream().filter(s -> s.isOut()).collect(Collectors.toList());
if (outSubCodeList != null && !outSubCodeList.isEmpty()) {
needOutCountMap = outSubCodeList.stream().collect(Collectors.groupingBy(Barcode::getPosName, Collectors.counting()));
}
List<Integer> partition1 = new ArrayList<>();
partition1.add(getCountByPartition(needOutCountMap, boxStr + "-01"));
partition1.add(getCountByPartition(allCountMap, boxStr + "-01"));
partition1.add(1);
List<Integer> partition2 = new ArrayList<>();
partition2.add(getCountByPartition(needOutCountMap, boxStr + "-02"));
partition2.add(getCountByPartition(allCountMap, boxStr + "-02"));
partition2.add(2);
List<Integer> partition3 = new ArrayList<>();
partition3.add(getCountByPartition(needOutCountMap, boxStr + "-03"));
partition3.add(getCountByPartition(allCountMap, boxStr + "-03"));
partition3.add(3);
List<Integer> partition4 = new ArrayList<>();
partition4.add(getCountByPartition(needOutCountMap, boxStr + "-04"));
partition4.add(getCountByPartition(allCountMap, boxStr + "-04"));
partition4.add(4);
List<Integer> partition5 = new ArrayList<>();
partition5.add(getCountByPartition(needOutCountMap, boxStr + "-05"));
partition5.add(getCountByPartition(allCountMap, boxStr + "-05"));
partition5.add(5);
List<Integer> partition6 = new ArrayList<>();
partition6.add(getCountByPartition(needOutCountMap, boxStr + "-06"));
partition6.add(getCountByPartition(allCountMap, boxStr + "-06"));
partition6.add(6);
//根据箱子面展示不同的隔扣
if (boxStr.startsWith("C07")) {
platsize = "7";
if ("A".equals(endStr)) {
boxPartitionCounts.add(partition2);
boxPartitionCounts.add(partition4);
boxPartitionCounts.add(partition6);
boxPartitionCounts.add(partition1);
boxPartitionCounts.add(partition3);
boxPartitionCounts.add(partition5);
} else {
boxPartitionCounts.add(partition5);
boxPartitionCounts.add(partition3);
boxPartitionCounts.add(partition1);
boxPartitionCounts.add(partition6);
boxPartitionCounts.add(partition4);
boxPartitionCounts.add(partition2);
} }
//进行库位分组 } else if (boxStr.startsWith("C13")) {
Map<String, Long> allCountMap = subCodeList.stream().collect(Collectors.groupingBy(Barcode::getPosName, Collectors.counting())); platsize = "13";
if ("A".equals(endStr)) {
//得到需要出库的数量 boxPartitionCounts.add(partition1);
Map<String, Long> needOutCountMap = new HashMap<>(); boxPartitionCounts.add(partition2);
List<Barcode> outSubCodeList = subCodeList.stream().filter(s -> s.isOut()).collect(Collectors.toList()); boxPartitionCounts.add(partition3);
if (outSubCodeList != null && !outSubCodeList.isEmpty()) { } else {
needOutCountMap = outSubCodeList.stream().collect(Collectors.groupingBy(Barcode::getPosName, Collectors.counting())); boxPartitionCounts.add(partition3);
boxPartitionCounts.add(partition2);
boxPartitionCounts.add(partition1);
} }
} else if (boxStr.startsWith("C15")) {
List<Integer> partition1 = new ArrayList<>(); platsize = "15";
partition1.add(getCountByPartition(needOutCountMap, boxStr + "-01")); if ("A".equals(endStr)) {
partition1.add(getCountByPartition(allCountMap, boxStr + "-01")); boxPartitionCounts.add(partition1);
partition1.add(1); boxPartitionCounts.add(partition2);
boxPartitionCounts.add(partition3);
List<Integer> partition2 = new ArrayList<>(); } else {
partition2.add(getCountByPartition(needOutCountMap, boxStr + "-02")); boxPartitionCounts.add(partition3);
partition2.add(getCountByPartition(allCountMap, boxStr + "-02")); boxPartitionCounts.add(partition2);
partition2.add(2); boxPartitionCounts.add(partition1);
List<Integer> partition3 = new ArrayList<>();
partition3.add(getCountByPartition(needOutCountMap, boxStr + "-03"));
partition3.add(getCountByPartition(allCountMap, boxStr + "-03"));
partition3.add(3);
List<Integer> partition4 = new ArrayList<>();
partition4.add(getCountByPartition(needOutCountMap, boxStr + "-04"));
partition4.add(getCountByPartition(allCountMap, boxStr + "-04"));
partition4.add(4);
List<Integer> partition5 = new ArrayList<>();
partition5.add(getCountByPartition(needOutCountMap, boxStr + "-05"));
partition5.add(getCountByPartition(allCountMap, boxStr + "-05"));
partition5.add(5);
List<Integer> partition6 = new ArrayList<>();
partition6.add(getCountByPartition(needOutCountMap, boxStr + "-06"));
partition6.add(getCountByPartition(allCountMap, boxStr + "-06"));
partition6.add(6);
//根据箱子面展示不同的隔扣
if (boxStr.startsWith("C07")) {
platsize = "7";
if ("A".equals(endStr)) {
boxPartitionCounts.add(partition2);
boxPartitionCounts.add(partition4);
boxPartitionCounts.add(partition6);
boxPartitionCounts.add(partition1);
boxPartitionCounts.add(partition3);
boxPartitionCounts.add(partition5);
} else {
boxPartitionCounts.add(partition5);
boxPartitionCounts.add(partition3);
boxPartitionCounts.add(partition1);
boxPartitionCounts.add(partition6);
boxPartitionCounts.add(partition4);
boxPartitionCounts.add(partition2);
}
} else if (boxStr.startsWith("C13")) {
platsize = "13";
if ("A".equals(endStr)) {
boxPartitionCounts.add(partition1);
boxPartitionCounts.add(partition2);
boxPartitionCounts.add(partition3);
} else {
boxPartitionCounts.add(partition3);
boxPartitionCounts.add(partition2);
boxPartitionCounts.add(partition1);
}
} else if (boxStr.startsWith("C15")) {
platsize = "15";
if ("A".equals(endStr)) {
boxPartitionCounts.add(partition1);
boxPartitionCounts.add(partition2);
boxPartitionCounts.add(partition3);
} else {
boxPartitionCounts.add(partition3);
boxPartitionCounts.add(partition2);
boxPartitionCounts.add(partition1);
}
} }
boxAllCount = boxAllCountMap.get(boxStr) == null ? 0 : boxAllCountMap.get(boxStr);
boxRemainingCount = subCodeList.size();
} }
boxAllCount = boxAllCountMap.get(boxStr) == null ? 0 : boxAllCountMap.get(boxStr);
boxRemainingCount = subCodeList.size();
} }
} }
//}
} }
resultMap.put("platsize", platsize); resultMap.put("platsize", platsize);
resultMap.put("boxPartitionCounts", boxPartitionCounts); resultMap.put("boxPartitionCounts", boxPartitionCounts);
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!