入库单按规则生成;

This commit is contained in:
王奎兴
2026-08-08 16:04:46 +08:00
parent e6aa8d59e2
commit 1b8a75aea5
6 changed files with 419 additions and 17 deletions
@@ -619,4 +619,54 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where in_order_number = #{inOrderNumber} and del_flag = 1
</update>
<!-- 跨4张入库单表查询指定前缀+组织+仓库的所有入库单号(取最大序号+1,防止删单后单号重复) -->
<select id="getMaxStockInOrderByPrefixAndOrgAndWarehouse" resultType="java.lang.String">
SELECT in_order_number FROM NGWL_TEST_OMS.reserve_stock_in_order
WHERE in_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 in_order_number FROM NGWL_TEST_OMS.reservation_stock_in_order
WHERE in_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 in_order_number FROM NGWL_TEST_OMS.execution_stock_in_order
WHERE in_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 in_order_number FROM stock_in_order
WHERE in_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>