生产更新:同步已提交的海外仓分析及业务修复(2026-10-16) #27
+9
@@ -9,6 +9,7 @@ import org.apache.ibatis.annotations.Select;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
@Mapper
|
||||
public interface InventoryPositionMapper extends BaseMapper<InventoryPosition> {
|
||||
@@ -17,6 +18,14 @@ public interface InventoryPositionMapper extends BaseMapper<InventoryPosition> {
|
||||
List<InventoryPosition> listBalance(@Param("customerId") String customerId,
|
||||
@Param("balanceId") Long balanceId);
|
||||
|
||||
@Select({"<script>",
|
||||
"SELECT p.* FROM ll_inventory_position p JOIN ll_inventory_balance b ON b.id=p.balance_id",
|
||||
"WHERE b.customer_id=#{customerId} AND p.balance_id IN",
|
||||
"<foreach collection='balanceIds' item='id' open='(' separator=',' close=')'>#{id}</foreach>",
|
||||
"ORDER BY p.balance_id,p.pallet_no,p.batch_no", "</script>"})
|
||||
List<InventoryPosition> listBalances(@Param("customerId") String customerId,
|
||||
@Param("balanceIds") Collection<Long> balanceIds);
|
||||
|
||||
@Select("SELECT * FROM ll_inventory_position WHERE id=#{positionId} AND customer_id=#{customerId} LIMIT 1")
|
||||
InventoryPosition findTenantPosition(@Param("customerId") String customerId,
|
||||
@Param("positionId") Long positionId);
|
||||
|
||||
+11
-6
@@ -253,10 +253,13 @@ public class RelabelApplicationService implements WalletResultHandler {
|
||||
.gt(InventoryBalance::getAvailablePackages, 0)
|
||||
.like(StringUtils.hasText(inboundCode), InventoryBalance::getInboundCode, trim(inboundCode))
|
||||
.orderByDesc(InventoryBalance::getUpdatedAt));
|
||||
List<RelabelResponses.InventoryCandidate> result = new java.util.ArrayList<>(balances.stream().map(balance -> {
|
||||
List<RelabelResponses.InventoryPosition> positions = inventoryPositions.listBalance(customerId, balance.getId())
|
||||
Map<Long, List<InventoryPosition>> positionsByBalance = balances.isEmpty() ? Map.of()
|
||||
: inventoryPositions.listBalances(customerId, balances.stream().map(InventoryBalance::getId).toList())
|
||||
.stream().filter(position -> value(position.getAvailablePackages()) > 0)
|
||||
.map(position -> new RelabelResponses.InventoryPosition(position.getId(), position.getPalletNo(),
|
||||
.collect(Collectors.groupingBy(InventoryPosition::getBalanceId, LinkedHashMap::new, Collectors.toList()));
|
||||
List<RelabelResponses.InventoryCandidate> result = new java.util.ArrayList<>(balances.stream().map(balance -> {
|
||||
List<RelabelResponses.InventoryPosition> positions = positionsByBalance.getOrDefault(balance.getId(), List.of())
|
||||
.stream().map(position -> new RelabelResponses.InventoryPosition(position.getId(), position.getPalletNo(),
|
||||
position.getBatchNo(), position.getWarehouseLocationCode(), value(position.getAvailablePackages())))
|
||||
.toList();
|
||||
long available = positions.stream().mapToLong(RelabelResponses.InventoryPosition::availablePackages).sum();
|
||||
@@ -298,14 +301,16 @@ public class RelabelApplicationService implements WalletResultHandler {
|
||||
cartonLines.stream().mapToLong(line -> value(line.getRelabelledQuantity())
|
||||
+ returnCartons.completedSkuQuantity(carton.getId(), line.getSkuCode())).sum());
|
||||
long reserved = returnCartons.relabelReservedQuantity(carton.getId());
|
||||
List<String> mergedCartonMarks = StringUtils.hasText(carton.getSourceReturnNo()) ? List.of()
|
||||
: returnPackingTraces.listCartonHistory(customerId, carton.getCartonMark()).stream()
|
||||
.filter(history -> carton.getCartonMark().equals(history.sourceCartonMark()))
|
||||
.map(history -> history.targetCartonMark()).distinct().toList();
|
||||
result.add(new RelabelResponses.InventoryCandidate(null, null, carton.getSourceReturnNo(),
|
||||
null, carton.getOverseasWarehouseId(), null, null, carton.getDestinationWarehouseCode(),
|
||||
carton.getDestinationWarehouseName(), skuCodes, productNames, availablePackages, 0, List.of(),
|
||||
"PARCEL".equals(carton.getSourceUnitType()) ? "RETURN_PARCEL" : "RETURN_CARTON", carton.getId(), carton.getCartonMark(), cartonSkus, relabelledPackages,
|
||||
com.baiyue.lastleg.returnreceipt.service.ReturnRelabelProgress.status(value(carton.getTotalQuantity()), relabelledPackages, reserved), relabelledPackages, reserved, java.util.Set.of("MERGED", "OUTBOUNDED").contains(carton.getStatus()) ? 0L : value(carton.getTotalQuantity()), carton.getStatus(), carton.getRelabelNo(),
|
||||
returnPackingTraces.listCartonHistory(customerId, carton.getCartonMark()).stream()
|
||||
.filter(history -> carton.getCartonMark().equals(history.sourceCartonMark()))
|
||||
.map(history -> history.targetCartonMark()).distinct().toList(), returnCartons.hasOutbound(carton.getId()),
|
||||
mergedCartonMarks, returnCartons.hasOutbound(carton.getId()),
|
||||
skuConversionRows.listCarton(customerId, carton.getId()).stream()
|
||||
.map(com.baiyue.lastleg.returnreceipt.dto.ReturnInventoryResponses.SkuConversion::from).toList(), physicalSkus, cartonAvailable));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user