出库单按规则生成;

This commit is contained in:
王奎兴
2026-08-08 17:47:59 +08:00
parent 6a0818350a
commit 993746ee41
5 changed files with 218 additions and 41 deletions
@@ -548,4 +548,54 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
)
</select>
<!-- 跨4张入库单表查询指定前缀+组织+仓库的所有入库单号(取最大序号+1,防止删单后单号重复) -->
<select id="getMaxStockOutOrderByPrefixAndOrgAndWarehouse" resultType="java.lang.String">
SELECT out_order_number FROM reserve_stock_out_order
WHERE out_order_number LIKE concat(#{prefix}, '%')
AND del_flag = 1
<if test="organizationId != null">
AND organization_id = #{organizationId}
</if>
<if test="warehouseId != null">
AND warehouse_id = #{warehouseId}
</if>
UNION ALL
SELECT out_order_number FROM reservation_stock_out_order
WHERE out_order_number LIKE concat(#{prefix}, '%')
AND del_flag = 1
<if test="organizationId != null">
AND organization_id = #{organizationId}
</if>
<if test="warehouseId != null">
AND warehouse_id = #{warehouseId}
</if>
UNION ALL
SELECT out_order_number FROM execution_stock_out_order
WHERE out_order_number LIKE concat(#{prefix}, '%')
AND del_flag = 1
<if test="organizationId != null">
AND organization_id = #{organizationId}
</if>
<if test="warehouseId != null">
AND warehouse_id = #{warehouseId}
</if>
UNION ALL
SELECT out_order_number FROM NGWL_TEST_WMS.stock_out_order
WHERE out_order_number LIKE concat(#{prefix}, '%')
AND del_flag = 1
<if test="organizationId != null">
AND organization_id = #{organizationId}
</if>
<if test="warehouseId != null">
AND warehouse_id = #{warehouseId}
</if>
</select>
</mapper>