fix: repair shadow candidate planning and site runtime errors

This commit is contained in:
zgw
2026-09-09 09:57:28 +08:00
parent 1a34d72cbb
commit 0bd47e2b2c
27 changed files with 788 additions and 203 deletions

View File

@@ -32,6 +32,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<!-- Conservative subset valid in either Legacy project-count branch. Ranking remains in the planner. -->
<select id="countInboundEligibleSpace" resultType="int">
select count(*)
<include refid="inboundEligibleSpaces"/>
and cargo.space_id = #{spaceId}
</select>
<select id="selectInboundEligibleSpaces" resultType="string">
select cargo.space_id
<include refid="inboundEligibleSpaces"/>
order by cargo.space_id
</select>
<sql id="inboundEligibleSpaces">
from alg.shadow_inbound_request_snapshot input
join alg.cargo_space_snapshot cargo
on cargo.warehouse_id = input.warehouse_id
@@ -39,11 +50,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where input.warehouse_id = #{warehouseId} and input.snapshot_generation = #{generation}
and input.task_no = #{taskNo} and input.tray_no = #{trayNo}
and input.predicate_version = 1 and input.detail_count &gt; 0
and input.field_group_count = 1 and input.product_scope_count = 1
and input.field_group_count &gt; 0 and input.product_scope_count &gt; 0
and input.tray_job_count = 1 and input.legacy_scope_complete = 1
and nullif(ltrim(rtrim(input.project_no)), '') is not null
and input.project_no not in ('999', 'COMMON')
and cargo.space_id = #{spaceId} and cargo.space_status = '1' and cargo.locked = 'N'
and cargo.space_status = '1' and cargo.locked = 'N'
and nullif(ltrim(rtrim(cargo.tray_code)), '') is null
and cargo.this_cargo_area in ('A', 'C')
and nullif(ltrim(rtrim(cargo.lane_code)), '') is not null
@@ -68,7 +79,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
or exists (select 1 from alg.inventory_item_snapshot stock
where stock.warehouse_id = lane.warehouse_id
and stock.snapshot_generation = lane.snapshot_generation and stock.space_id = lane.space_id)))
or exists (
or (input.field_group_count = 1 and exists (
select 1 from alg.cargo_space_snapshot resident
join alg.inventory_item_snapshot stock
on stock.warehouse_id = resident.warehouse_id and stock.snapshot_generation = resident.snapshot_generation
@@ -77,8 +88,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and resident.lane_code = cargo.lane_code and resident.space_status = '2'
and resident.this_cargo_area in ('A', 'C')
and stock.project_no = input.project_no
and stock.spare1 = input.spare1 and stock.spare2 = input.spare2 and stock.spare3 = input.spare3))
</select>
and stock.spare1 = input.spare1 and stock.spare2 = input.spare2 and stock.spare3 = input.spare3)))
</sql>
<sql id="outboundCandidatePredicate">
item.warehouse_id = #{warehouseId}
@@ -130,6 +141,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select top (201)
item.stock_id as stockId, item.tray_code as trayNo, item.space_id as spaceId,
item.project_no as projectNo, item.product_no as productId,
item.spare1, item.spare2, item.spare3, item.voltage, item.phase,
item.tray_job_count as trayJobCount,
item.quantity - item.out_quantity as availableQuantity,
(select count(*) from alg.inventory_item_snapshot trayItem