Commit 1ce3e891 by yubin

页面修改

parent 45790555
......@@ -237,9 +237,23 @@ public class OutboundOrdersServiceImpl implements IOutboundOrdersService {
.collect(Collectors.toList());
hasLocKeys.sort((k1, k2) -> {
Long qty1 = inventoryGroupMap.get(k1).stream().mapToLong(inv -> Optional.ofNullable(inv.getQuantity()).orElse(0L)).sum();
Long qty2 = inventoryGroupMap.get(k2).stream().mapToLong(inv -> Optional.ofNullable(inv.getQuantity()).orElse(0L)).sum();
return Long.compare(qty2, qty1);
// 处理k1的最后入库时间:转时间戳,null则用极小值(确保无入库时间的排在最前面)
Long time1 = inventoryGroupMap.get(k1).stream()
.map(inv -> Optional.ofNullable(inv.getLastInboundTime())
// 无入库时间时,用Long.MIN_VALUE(比所有正常时间戳都小)
.map(Date::getTime) // 将Date转成毫秒级时间戳(Long)
.orElse(Long.MIN_VALUE))
.max(Long::compare) // 取该key下所有库存的最晚入库时间(业务合理)
.orElse(Long.MIN_VALUE); // 若该key无库存数据,也兜底为极小值
// 处理k2的最后入库时间(逻辑同k1)
Long time2 = inventoryGroupMap.get(k2).stream()
.map(inv -> Optional.ofNullable(inv.getLastInboundTime())
.map(Date::getTime)
.orElse(Long.MIN_VALUE))
.max(Long::compare)
.orElse(Long.MIN_VALUE);
return Long.compare(time1, time2);
});
for (String hasLocKey : hasLocKeys) {
......@@ -392,7 +406,8 @@ public class OutboundOrdersServiceImpl implements IOutboundOrdersService {
* @return 剩余未扣减数量
*/
private Long deductByInventoryGroup(String inventoryKey, Long deductQty, String updateUser, Date updateTime,
Map<String, List<Inventory>> inventoryGroupMap, Map<String, Inventory> toUpdateInventoryMap,
Map<String, List<Inventory>> inventoryGroupMap,
Map<String, Inventory> toUpdateInventoryMap,
List<Map<String, Object>> tempDeductRecords) {
List<Inventory> invList = inventoryGroupMap.getOrDefault(inventoryKey, new ArrayList<>());
if (CollectionUtils.isEmpty(invList)) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论