feat(wms,oms):库存管理-库存查询新增进货日期、入库日期查询条件,新增进货日期字段贯通收货-上架-库存全链路

需求:OMS/WMS 库存管理-库存查询页增加查询条件:物料分类(后端已支持,无需改动)、
进货日期(新增字段)、入库日期。

一、DDL(sql/20260831_wms_oms_add_purchase_date.sql)
    WMS 收货明细、上架明细、物料库存及 OMS 预留库存共 4 张表新增 PURCHASE_DATE DATE 列,
    附批次明细配置模板、执行前检查与回滚语句;须先执行 DDL 再发布服务。

二、进货日期录入与落库链路(收货→上架→WMS库存→OMS库存)
    1、录入入口为收货批次属性「进货日期」标签(批次规则配置,标签须一字不差),
       ReceiptMaterialDetailImpl 两处标签解析新增分支;
    2、收货明细→上架明细:StockReceiptOrderDomainService 6 处日期拷贝点补 setPurchaseDate(含子项);
    3、上架落库:stockIn/sj 赋值写入 material_inventory;
    4、同步 OMS:MaterialInventoryOmsParamDO 新增字段经 Feign omsEdit 传递,
       写入 reservation_material_inventory;
    5、库存行合并键:批次规则勾选后进货日期参与分行(getParam 映射 + selectListByWhere 全等匹配),
       OMS omsEdit 行匹配同步按进货日期区分,避免不同进货日期误合并到同一行。

三、查询条件(两模块 /list 接口)
    1、进货日期:purchaseDate(单日精确)+ purchaseDateStart/purchaseDateEnd(区间,End 含当天);
    2、入库日期:WMS 新增 createTimeStart/createTimeEnd(按库存行创建时间过滤,与 OMS 现有口径一致);
    3、列表/导出返回新增 purchaseDate 字段,分组查询取 MAX(purchase_date)。

说明:历史库存进货日期为空,按进货日期查询查不到存量数据(无来源可回填),区间查询会排除空值行。
This commit is contained in:
rcx
2026-08-31 13:41:19 +08:00
parent 2d1e4b5912
commit da84b7bb69
26 changed files with 257 additions and 7 deletions
@@ -56,6 +56,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="productionDate" column="production_date" />
<result property="expiryDate" column="expiry_date" />
<result property="inventoryDate" column="inventory_date" />
<result property="purchaseDate" column="purchase_date" />
<result property="batchRefNo" column="batch_ref_no" />
<result property="sheetRefNo" column="sheet_ref_no" />
<result property="boxPalletNo" column="box_pallet_no" />
@@ -138,7 +139,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
IFNULL (sum(a.GROSS_WEIGHT), 0) GROSS_WEIGHT,
IFNULL (sum(a.VOLUME), 0) VOLUME,
a.ext_attr_1, a.ext_attr_2, a.ext_attr_3, a.ext_attr_4,
a.production_date, a.expiry_date, a.inventory_date,
a.production_date, a.expiry_date, a.inventory_date, a.purchase_date,
a.BATCH_REF_NO, a.SHEET_REF_NO, a.BOX_PALLET_NO,nvl(a.unit_name,b.unit_name) as unit_name,
a.bar_code as inv_bar_code,
a.in_order_number,a.lot_number
@@ -280,6 +281,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="expiryDateEnd != null and expiryDateEnd != ''">
and a.expiry_date <![CDATA[ < ]]> DATEADD(DAY, 1, #{expiryDateEnd})
</if>
<if test="purchaseDateStr != null and purchaseDateStr != ''">
AND TO_CHAR(a.purchase_date, 'yyyy-MM-dd') = #{purchaseDateStr}
</if>
<if test="purchaseDateStart != null and purchaseDateStart != ''">
and a.purchase_date >= #{purchaseDateStart}
</if>
<if test="purchaseDateEnd != null and purchaseDateEnd != ''">
and a.purchase_date <![CDATA[ < ]]> DATEADD(DAY, 1, #{purchaseDateEnd})
</if>
</sql>
<!-- 导出排除库存为0:所有维度查询(all/hz/wl/kw/wlkw/wlExpiry)的库存数量均为SUM聚合值,
@@ -367,6 +377,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
MAX(a.unit_name) AS unit_name,
MAX(a.production_date) AS production_date,
MAX(a.inventory_date) AS inventory_date,
MAX(a.purchase_date) AS purchase_date,
MAX(a.batch_ref_no) AS batch_ref_no, MAX(a.sheet_ref_no) AS sheet_ref_no, MAX(a.box_pallet_no) AS box_pallet_no,
MAX(a.bar_code) AS inv_bar_code,
MAX(a.in_order_number) AS in_order_number, MAX(a.lot_number) AS lot_number,
@@ -461,6 +472,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="productionDate" column="production_date" />
<result property="expiryDate" column="expiry_date" />
<result property="inventoryDate" column="inventory_date" />
<result property="purchaseDate" column="purchase_date" />
<result property="extAttr3" column="ext_attr_3" />
<result property="extAttr4" column="ext_attr_4" />
<result property="remark" column="remark" />