fix: 料单智能筛选无效,供货范围的优先级为空时设置最大值(优先级最低)

This commit is contained in:
hwd
2025-10-10 10:43:59 +08:00
parent 81e076508c
commit 09a703e26c

View File

@@ -2504,27 +2504,28 @@ public class MaterialOrderService extends BaseOrderService<MaterialOrder, Long>
}
//确认供应商列表
Integer ind = indMap.getOrDefault(supplierProduct.getSupplier().getId(), null);
Integer supplierProductInd = Optional.ofNullable(supplierProduct.getInd()).orElse(Integer.MAX_VALUE);
if (ind == null) {
if (maxInd == null) {
indMap.put(supplierProduct.getSupplier().getId(), supplierProduct.getInd());
maxInd = supplierProduct.getInd();
indMap.put(supplierProduct.getSupplier().getId(), supplierProductInd);
maxInd = supplierProductInd;
maxIndSupplier = supplierProduct.getSupplier().getId();
} else {
if (indMap.size() >= number && supplierProduct.getInd().compareTo(maxInd) < 0) {
if (indMap.size() >= number && supplierProductInd.compareTo(maxInd) < 0) {
indMap.remove(maxIndSupplier);
indMap.put(supplierProduct.getSupplier().getId(), supplierProduct.getInd());
maxInd = supplierProduct.getInd();
indMap.put(supplierProduct.getSupplier().getId(), supplierProductInd);
maxInd = supplierProductInd;
maxIndSupplier = supplierProduct.getSupplier().getId();
}else if(indMap.size()<number){
indMap.put(supplierProduct.getSupplier().getId(), supplierProduct.getInd());
if (supplierProduct.getInd().compareTo(maxInd)>0){
maxInd = supplierProduct.getInd();
indMap.put(supplierProduct.getSupplier().getId(), supplierProductInd);
if (supplierProductInd.compareTo(maxInd)>0){
maxInd = supplierProductInd;
maxIndSupplier = supplierProduct.getSupplier().getId();
}
}
}
} else if (ind.compareTo(supplierProduct.getInd()) > 0) {
indMap.put(supplierProduct.getSupplier().getId(), supplierProduct.getInd());
} else if (ind.compareTo(supplierProductInd) > 0) {
indMap.put(supplierProduct.getSupplier().getId(), supplierProductInd);
}
}
}