fix(firstleg): normalize split carton label pools
This commit is contained in:
+15
-1
@@ -151,7 +151,10 @@ public interface InboundSplitSettlementMapper {
|
|||||||
|
|
||||||
@Update("""
|
@Update("""
|
||||||
UPDATE fl_inbound_carton_label
|
UPDATE fl_inbound_carton_label
|
||||||
SET inbound_id=#{childInboundId}, order_id=#{childOrderId}, inbound_code=#{childInboundCode}
|
SET inbound_id=#{childInboundId}, order_id=#{childOrderId}, inbound_code=#{childInboundCode},
|
||||||
|
carton_index=carton_index-#{loadedPackageCount},
|
||||||
|
total_carton_count=#{remainingPackageCount},
|
||||||
|
detail_package_count=LEAST(detail_package_count,#{remainingPackageCount})
|
||||||
WHERE tenant_id=#{accountId} AND inbound_id=#{sourceInboundId} AND batch_status='ACTIVE'
|
WHERE tenant_id=#{accountId} AND inbound_id=#{sourceInboundId} AND batch_status='ACTIVE'
|
||||||
ORDER BY carton_index DESC
|
ORDER BY carton_index DESC
|
||||||
LIMIT #{remainingPackageCount}
|
LIMIT #{remainingPackageCount}
|
||||||
@@ -161,8 +164,19 @@ public interface InboundSplitSettlementMapper {
|
|||||||
@Param("childInboundId") long childInboundId,
|
@Param("childInboundId") long childInboundId,
|
||||||
@Param("childOrderId") long childOrderId,
|
@Param("childOrderId") long childOrderId,
|
||||||
@Param("childInboundCode") String childInboundCode,
|
@Param("childInboundCode") String childInboundCode,
|
||||||
|
@Param("loadedPackageCount") int loadedPackageCount,
|
||||||
@Param("remainingPackageCount") int remainingPackageCount);
|
@Param("remainingPackageCount") int remainingPackageCount);
|
||||||
|
|
||||||
|
@Update("""
|
||||||
|
UPDATE fl_inbound_carton_label
|
||||||
|
SET total_carton_count=#{loadedPackageCount},
|
||||||
|
detail_package_count=LEAST(detail_package_count,#{loadedPackageCount})
|
||||||
|
WHERE tenant_id=#{accountId} AND inbound_id=#{sourceInboundId} AND batch_status='ACTIVE'
|
||||||
|
""")
|
||||||
|
int normalizeLoadedCartonLabels(@Param("accountId") long accountId,
|
||||||
|
@Param("sourceInboundId") long sourceInboundId,
|
||||||
|
@Param("loadedPackageCount") int loadedPackageCount);
|
||||||
|
|
||||||
@Update("""
|
@Update("""
|
||||||
UPDATE fl_inbound_order
|
UPDATE fl_inbound_order
|
||||||
SET package_count = GREATEST(COALESCE(package_count, total_package_count) - #{packageCount}, 0),
|
SET package_count = GREATEST(COALESCE(package_count, total_package_count) - #{packageCount}, 0),
|
||||||
|
|||||||
@@ -186,7 +186,8 @@ public class PdaPickSettlementService {
|
|||||||
orderSplit.remainderChild().orderId(), orderSplit.remainderChild().orderNo(),
|
orderSplit.remainderChild().orderId(), orderSplit.remainderChild().orderNo(),
|
||||||
remainderChildCode, childPackageCount, sequence, "REMAINDER", operatorId, operatorName), "余量子入库单");
|
remainderChildCode, childPackageCount, sequence, "REMAINDER", operatorId, operatorName), "余量子入库单");
|
||||||
splits.transferRemainingCartonLabels(parent.tenantId(), parentInboundId, remainderChildId,
|
splits.transferRemainingCartonLabels(parent.tenantId(), parentInboundId, remainderChildId,
|
||||||
orderSplit.remainderChild().orderId(), remainderChildCode, childPackageCount);
|
orderSplit.remainderChild().orderId(), remainderChildCode, pickedPackageCount, childPackageCount);
|
||||||
|
splits.normalizeLoadedCartonLabels(parent.tenantId(), parentInboundId, pickedPackageCount);
|
||||||
}
|
}
|
||||||
requireAffected(splits.insertBatchWithChildren(batchId, parent.tenantId(), rootInboundId, operationId, parentInboundId,
|
requireAffected(splits.insertBatchWithChildren(batchId, parent.tenantId(), rootInboundId, operationId, parentInboundId,
|
||||||
idempotencyKey, rootVersion, parentAvailable, null, remainderChildId == 0L ? null : remainderChildId,
|
idempotencyKey, rootVersion, parentAvailable, null, remainderChildId == 0L ? null : remainderChildId,
|
||||||
|
|||||||
+2
-1
@@ -67,7 +67,8 @@ class PdaPickSettlementServiceTest {
|
|||||||
eq(1002L), eq("ORDER-REMAINDER"), eq("IN-001-1"), eq(12),
|
eq(1002L), eq("ORDER-REMAINDER"), eq("IN-001-1"), eq(12),
|
||||||
eq(1), eq("REMAINDER"), eq(9L), eq("operator"));
|
eq(1), eq("REMAINDER"), eq(9L), eq("operator"));
|
||||||
verify(splits).transferRemainingCartonLabels(eq(10001L), eq(31L), anyLong(),
|
verify(splits).transferRemainingCartonLabels(eq(10001L), eq(31L), anyLong(),
|
||||||
eq(1002L), eq("IN-001-1"), eq(12));
|
eq(1002L), eq("IN-001-1"), eq(8), eq(12));
|
||||||
|
verify(splits).normalizeLoadedCartonLabels(10001L, 31L, 8);
|
||||||
verify(splits).markSourceLoaded(10001L, 31L, 8, 9L, 3);
|
verify(splits).markSourceLoaded(10001L, 31L, 8, 9L, 3);
|
||||||
verify(allocations).consume(10001L, 31L, 1L, 8);
|
verify(allocations).consume(10001L, 31L, 1L, 8);
|
||||||
verify(warehouse).settle(eq("internal-token"), org.mockito.ArgumentMatchers.argThat(request ->
|
verify(warehouse).settle(eq("internal-token"), org.mockito.ArgumentMatchers.argThat(request ->
|
||||||
|
|||||||
Reference in New Issue
Block a user