feat(oms): 出库导入支持指定仓库,校验物料库存归属并按仓过滤批次库存

背景:物料档案全仓共享,此前导入不区分仓库,批次库存"查到哪条算哪条",单据可能取到其他仓库的库存且主表仓库为空。

1. /parseExcel 新增可选参数 warehouseId(前端随文件提交当前页面仓库;不传保持原有行为)
2. 新增 countInventoryByWarehouse 归属校验:物料在指定仓库无库存记录时统一报错"物料[xx]在当前仓库[名]没有库存记录,无法从该仓库出库"
3. getkcId 批次库存查询增加仓库过滤,明细批次/仓库/入库单号均取当前仓库
4. 导入单主表回填当前仓库 warehouseId/Code/Name(此前导入单仓库为空)
5. 出库导入两个入口(reservationStockInOrderApi/executionStockInOrderApi 的 parseExcel)同步支持
6. 库存不足报错补充物料编码,便于定位
This commit is contained in:
rcx
2026-09-02 18:32:12 +08:00
parent 6d7e42bcde
commit c1f483f0a0
10 changed files with 113 additions and 37 deletions
@@ -556,6 +556,14 @@
</select>
<select id="getkcId" resultType="com.mhd.oms.domain.reservationMaterialInventory.repository.po.ReservationMaterialInventoryPO">
select * from "NGWL_TEST_WMS".MATERIAL_INVENTORY where 1 = 1 and DEL_FLAG = 1 and MATERIAL_BASE_INFO_ID = #{id} and ALLOCATION_QUANTITY >= #{q}
<if test="warehouseId != null">
and WAREHOUSE_ID = #{warehouseId}
</if>
</select>
<!-- 出库导入校验:物料在指定仓库是否存在库存记录(存在即视为归属该仓库,不限数量) -->
<select id="countInventoryByWarehouse" resultType="int">
select count(1) from "NGWL_TEST_WMS".MATERIAL_INVENTORY
where 1 = 1 and DEL_FLAG = 1 and MATERIAL_BASE_INFO_ID = #{id} and WAREHOUSE_ID = #{warehouseId}
</select>
<select id="getUserNcCode" parameterType="java.lang.Long" resultType="java.lang.String">
select CUSTOMER_NC_CODE from "NGWL_TEST_USER".USER_SHIPPER where 1 = 1 and DEL_FLAG = 1 and USER_ID = #{id} limit 1