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:
+1
-1
@@ -11,7 +11,7 @@ import java.math.BigDecimal;
|
||||
/**
|
||||
* 线路出库排名PO
|
||||
*
|
||||
* <p>按日期区间对执行出库单聚合:销售量=SUM(出库数量),交易数=COUNT(DISTINCT 出库单号),金额=SUM(明细总价);
|
||||
* <p>按日期区间对出库单聚合:销售量=SUM(出库数量),交易数=COUNT(DISTINCT 出库单号),金额=SUM(明细总价);
|
||||
* 仅统计带线路的出库单(line_code 为 2026-08-20 新增冗余字段,历史单为空)</p>
|
||||
*
|
||||
* @author rcx
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ import java.math.BigDecimal;
|
||||
/**
|
||||
* 商品出库排名PO
|
||||
*
|
||||
* <p>按日期区间对执行出库明细聚合:销售量=SUM(出库数量),交易数=COUNT(DISTINCT 出库单号),金额=SUM(明细总价)</p>
|
||||
* <p>按日期区间对出库明细聚合:销售量=SUM(出库数量),交易数=COUNT(DISTINCT 出库单号),金额=SUM(明细总价)</p>
|
||||
*
|
||||
* @author rcx
|
||||
* @date 2026-08-31
|
||||
|
||||
+4
-3
@@ -8,7 +8,8 @@ import java.io.Serializable;
|
||||
/**
|
||||
* 出库排名统计入参DTO
|
||||
*
|
||||
* <p>按日期区间统计商品/线路出库量排名,数据源为 OMS 执行出库链路(execution_out_material_detail / execution_stock_out_order)</p>
|
||||
* <p>按日期区间统计商品/线路出库量排名。OMS 库出库单状态不流转(无"已出库"数据),
|
||||
* 数据源跨库取 WMS 库出库表(NGWL_TEST_WMS.stock_out_order / out_material_detail),与 WMS 端 /outboundRankApi 同口径</p>
|
||||
*
|
||||
* @author rcx
|
||||
* @date 2026-08-31
|
||||
@@ -16,10 +17,10 @@ import java.io.Serializable;
|
||||
@Data
|
||||
public class ExecutionOutboundRankDTO {
|
||||
|
||||
@ApiModelProperty("出库日期-开始 yyyy-MM-dd(必填,按执行出库单创建时间统计)")
|
||||
@ApiModelProperty("出库日期-开始 yyyy-MM-dd(必填,按出库单创建时间统计)")
|
||||
private String createTimeStart;
|
||||
|
||||
@ApiModelProperty("出库日期-结束 yyyy-MM-dd(必填,按执行出库单创建时间统计)")
|
||||
@ApiModelProperty("出库日期-结束 yyyy-MM-dd(必填,按出库单创建时间统计)")
|
||||
private String createTimeEnd;
|
||||
|
||||
@ApiModelProperty("商品货号(模糊)")
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ import java.util.List;
|
||||
/**
|
||||
* 出库排名统计应用服务
|
||||
*
|
||||
* <p>负责登录用户组织隔离注入、日期区间校验,统计逻辑在 ExecutionOutboundRankDomainService → ExecutionOutboundRankMapper.xml</p>
|
||||
* <p>负责登录用户组织隔离注入、日期区间校验,统计逻辑在 ExecutionOutboundRankDomainService → ExecutionOutboundRankMapper.xml(跨库取 WMS 出库数据)</p>
|
||||
*
|
||||
* @author rcx
|
||||
* @date 2026-08-31
|
||||
|
||||
+5
-2
@@ -27,8 +27,11 @@ import java.util.List;
|
||||
/**
|
||||
* 出库排名统计Api
|
||||
*
|
||||
* <p>按日期区间筛选,统计商品/线路出库量排名。统计口径:执行出库单创建时间 + 已出库状态(9),
|
||||
* 明细仅取 level=1 主行;销售量=SUM(出库数量)、交易数=COUNT(DISTINCT 出库单号)、金额=SUM(明细总价)</p>
|
||||
* <p>按日期区间筛选,统计商品/线路出库量排名。OMS 库出库单状态不流转(无"已出库"数据),
|
||||
* 数据源跨库取 WMS 库出库表(NGWL_TEST_WMS.stock_out_order / out_material_detail),
|
||||
* 口径与 WMS 端 /outboundRankApi 完全一致,两边数字一致;
|
||||
* 统计条件:出库单创建时间 + 已出库及之后状态(9,12,13),明细仅取 level=1 主行;
|
||||
* 销售量=SUM(出库数量)、交易数=COUNT(DISTINCT 出库单号)、金额=SUM(明细总价)</p>
|
||||
*
|
||||
* @author rcx
|
||||
* @date 2026-08-31
|
||||
|
||||
@@ -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') >= #{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>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user