优化
This commit is contained in:
+6
@@ -60,6 +60,12 @@ public interface InventoryCommandMapper {
|
||||
@Param("sourceIdentity") String sourceIdentity,
|
||||
@Param("skuCode") String skuCode);
|
||||
|
||||
@Select("SELECT p.* FROM ll_inventory_position p JOIN ll_inventory_balance b ON b.id=p.balance_id " +
|
||||
"WHERE p.customer_id=#{customerId} AND b.inbound_order_id=#{inboundOrderId} " +
|
||||
"AND p.available_packages>0 ORDER BY p.id FOR UPDATE")
|
||||
List<InventoryPosition> lockInboundAvailablePositions(@Param("customerId") String customerId,
|
||||
@Param("inboundOrderId") Long inboundOrderId);
|
||||
|
||||
@Select("SELECT p.* FROM ll_inventory_position p JOIN ll_inventory_balance b ON b.id=p.balance_id " +
|
||||
"WHERE p.customer_id=#{customerId} AND b.inbound_order_id=#{inboundOrderId} " +
|
||||
"AND p.hold_packages>0 ORDER BY p.id FOR UPDATE")
|
||||
|
||||
+11
@@ -142,6 +142,17 @@ public class InventoryCommandService {
|
||||
});
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void holdInboundOrderInventory(String customerId, String operatorId, long inboundOrderId,
|
||||
String businessOrderNo, String remark) {
|
||||
for (InventoryPosition position : commands.lockInboundAvailablePositions(customerId, inboundOrderId)) {
|
||||
long packages = value(position.getAvailablePackages());
|
||||
if (packages == 0) continue;
|
||||
hold(customerId, operatorId, new InventoryCommandRequests.Move(position.getId(), packages,
|
||||
businessOrderNo, null, null, "ORDER_HOLD:" + inboundOrderId + ":" + position.getId(), remark));
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void releaseInboundOrderHold(String customerId, String operatorId, long inboundOrderId,
|
||||
String businessOrderNo, String remark) {
|
||||
|
||||
Reference in New Issue
Block a user