fix(oms):出库排名OMS端数据源改为跨库查WMS出库表,修复查询结果恒为空

OMS库出库单状态从不流转(预约/执行单全部status=1,无"已出库"数据),原SQL按执行出库单status=9过滤导致查不出任何数据;改为跨库取WMS出库表NGWL_TEST_WMS.stock_out_order/out_material_detail(与OMS库存查询跨库join material_base_info同一模式),口径与WMS端/outboundRankApi完全一致:已出库及之后状态(9,12,13)+明细level=1主行+按出库单创建时间筛选,两边页面数字一致;接口路径/参数/返回结构均不变,其余文件仅更新注释中的数据源说明
This commit is contained in:
rcx
2026-09-01 09:10:59 +08:00
parent bf96f5f005
commit 1300a4e1f8
6 changed files with 29 additions and 28 deletions
@@ -5,16 +5,19 @@
<mapper namespace="com.mhd.oms.domain.outboundRank.repository.mapper.ExecutionOutboundRankMapper">
<!--
出库排名统计公共查询条件(OMS 执行出库链路
数据源:执行出库明细 execution_out_material_detail(a,仅 level=1 主行防重复) join 执行出库单 execution_stock_out_order(b)
口径:b.status = 9已出库(OMS 状态枚举 1~11,排除已取消(10)/已关闭(11),无 12/13);
日期按执行出库单创建时间 b.create_time
出库排名统计公共查询条件(OMS 端,跨库取 WMS 出库数据
数据源:WMS 库出库明细 NGWL_TEST_WMS.out_material_detail(a,仅 level=1 主行防重复)
join WMS 库出库单 NGWL_TEST_WMS.stock_out_order(b)
说明:OMS 库出库单状态不流转(无"已出库"数据),"已出库"状态的真实数据在 WMS 库,
故跨库取数(与 OMS 库存查询跨库 join NGWL_TEST_WMS.material_base_info 同一模式),
口径与 WMS 端 /outboundRankApi 完全一致,两边数字一致;
条件:b.status in (9已出库,12已复核,13已交接),排除已取消(10)/已关闭(11);
日期按出库单创建时间 b.create_time
-->
<sql id="outboundRankConditions">
a.del_flag = 1
and a.level = 1
and b.del_flag = 1
and b.status = 9
and b.status in (9, 12, 13)
<if test="topOrganizationId != null">
and b.top_organization_id = #{topOrganizationId}
</if>
@@ -33,6 +36,12 @@
<if test="lineName != null and lineName != ''">
and b.line_name like concat('%', #{lineName}, '%')
</if>
<if test="materialCode != null and materialCode != ''">
and a.material_code like concat('%', #{materialCode}, '%')
</if>
<if test="materialName != null and materialName != ''">
and a.material_name like concat('%', #{materialName}, '%')
</if>
<if test="createTimeStart != null and createTimeStart != ''">
and date_format(b.create_time,'%Y-%m-%d') &gt;= #{createTimeStart}
</if>
@@ -42,8 +51,8 @@
</sql>
<sql id="outboundRankFrom">
from execution_out_material_detail a
join execution_stock_out_order b on a.out_order_number = b.out_order_number and b.del_flag = 1
from NGWL_TEST_WMS.out_material_detail a
join NGWL_TEST_WMS.stock_out_order b on a.out_order_number = b.out_order_number and b.del_flag = 1
</sql>
<!-- 商品出库排名列表 -->
@@ -60,12 +69,6 @@
<include refid="outboundRankFrom"/>
<where>
<include refid="outboundRankConditions"/>
<if test="materialCode != null and materialCode != ''">
and a.material_code like concat('%', #{materialCode}, '%')
</if>
<if test="materialName != null and materialName != ''">
and a.material_name like concat('%', #{materialName}, '%')
</if>
</where>
GROUP BY a.material_code
order by salesQuantity desc
@@ -99,12 +102,6 @@
<include refid="outboundRankFrom"/>
<where>
<include refid="outboundRankConditions"/>
<if test="materialCode != null and materialCode != ''">
and a.material_code like concat('%', #{materialCode}, '%')
</if>
<if test="materialName != null and materialName != ''">
and a.material_name like concat('%', #{materialName}, '%')
</if>
</where>
</select>