fix: improve shadow diagnostic matching
This commit is contained in:
@@ -7,6 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<select id="selectInboundInput" resultType="com.ruoyi.algorithm.shadow.ShadowInboundReference">
|
||||
select top (1)
|
||||
job.job_id as requestId,
|
||||
job.warehouse_id as warehouseId,
|
||||
job.tray_code as trayNo,
|
||||
coalesce(nullif(ltrim(rtrim(detail.spare4)), ''),
|
||||
nullif(ltrim(rtrim(stock.spare4)), '')) as projectNo,
|
||||
@@ -25,7 +26,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
select detail.stockout_detail_id as requestId,
|
||||
detail.warehouse_id as warehouseId,
|
||||
nullif(ltrim(rtrim(detail.spare4)), '') as projectNo,
|
||||
detail.product_id as productId
|
||||
detail.product_id as productId,
|
||||
convert(varchar(40), (select max(snapshot.synchronized_at)
|
||||
from alg.inventory_item_snapshot snapshot
|
||||
where snapshot.warehouse_id = detail.warehouse_id), 126)
|
||||
as snapshotSynchronizedAt,
|
||||
(select count(*)
|
||||
from bas_stock live
|
||||
where live.warehouse_id = detail.warehouse_id
|
||||
and live.stock_status = '1'
|
||||
and live.product_status = '1'
|
||||
and live.quantity > live.out_quantity
|
||||
and (NULLIF(LTRIM(RTRIM(detail.product_id)), '') IS NULL
|
||||
OR live.product_id = NULLIF(LTRIM(RTRIM(detail.product_id)), ''))) as liveMatchCount,
|
||||
(select count(*)
|
||||
from alg.inventory_item_snapshot snapshot
|
||||
where snapshot.warehouse_id = detail.warehouse_id
|
||||
and snapshot.project_no = nullif(ltrim(rtrim(detail.spare4)), '')
|
||||
and (NULLIF(LTRIM(RTRIM(detail.product_id)), '') IS NULL
|
||||
OR snapshot.product_no = NULLIF(LTRIM(RTRIM(detail.product_id)), '')))
|
||||
as shadowMatchCount
|
||||
from out_stockout_detail detail
|
||||
where detail.stockout_detail_id = #{stockoutDetailId}
|
||||
</select>
|
||||
@@ -37,7 +57,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
stock.cargo_space_id as spaceId,
|
||||
stock.warehouse_id as warehouseId,
|
||||
nullif(ltrim(rtrim(stock.spare4)), '') as projectNo,
|
||||
stock.product_id as productId
|
||||
stock.product_id as productId,
|
||||
convert(varchar(40), (select max(snapshot.synchronized_at)
|
||||
from alg.inventory_item_snapshot snapshot
|
||||
where snapshot.warehouse_id = stock.warehouse_id), 126)
|
||||
as snapshotSynchronizedAt,
|
||||
(select count(*)
|
||||
from bas_stock live
|
||||
where live.stock_id = stock.stock_id
|
||||
and live.stock_status = '1'
|
||||
and live.product_status = '1'
|
||||
and live.quantity > live.out_quantity) as liveMatchCount,
|
||||
(select count(*)
|
||||
from alg.inventory_item_snapshot snapshot
|
||||
where snapshot.stock_id = stock.stock_id
|
||||
and snapshot.warehouse_id = stock.warehouse_id) as shadowMatchCount
|
||||
from bas_stock stock
|
||||
where stock.stock_id = #{stockId}
|
||||
and stock.stock_status = '1'
|
||||
|
||||
Reference in New Issue
Block a user