feat:新增可用库存查询Mapper接口及SQL

This commit is contained in:
zhouz
2026-07-22 09:43:09 +08:00
parent 4d8110fa26
commit 6c8020d1c3
2 changed files with 50 additions and 0 deletions

View File

@@ -9,4 +9,38 @@
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
<select id="selectAvailableInventory"
resultType="cn.code.nl.module.wms.controller.admin.iostorinv.vo.AvailableInventoryVO">
SELECT
gp.vehicle_code AS vehicleCode,
gp.pcsn AS pcsn,
gp.material_code AS materialCode,
gp.material_id AS materialId,
gp.qty AS qty,
gp.frozen_qty AS frozenQty,
(gp.qty - gp.frozen_qty) AS availableQty,
gp.qty_unit_id AS qtyUnitId,
gp.qty_unit_name AS qtyUnitName,
gp.ext_code AS extCode,
gp.ext_type AS extType,
gp.ext_dtl_code AS extDtlCode,
sa.stor_id AS storId,
sa.stor_code AS storCode,
sa.stor_name AS storName
FROM wms_group_plate gp
INNER JOIN wms_structattr sa
ON gp.vehicle_code = sa.storagevehicle_code
WHERE sa.stor_id = #{storId}
AND gp.status = '可用'
AND (gp.qty - gp.frozen_qty) > 0
<if test="materialCode != null and materialCode != ''">
AND gp.material_code = #{materialCode}
</if>
<if test="pcsn != null and pcsn != ''">
AND gp.pcsn = #{pcsn}
</if>
<if test="vehicleCode != null and vehicleCode != ''">
AND gp.vehicle_code = #{vehicleCode}
</if>
</select>
</mapper>