demand: tms-客户账单管理-发票作废审核-发票状态不同步发票表状态-回滚

This commit is contained in:
aike 2026-01-27 17:55:22 +08:00
parent 9a5a50293e
commit a2d72a2dab

View File

@ -158,13 +158,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if> </if>
<!-- 批次状态查询: batchStatus=1 在emis_waybill_batch_status中存在, batchStatus=2 在emis_tms_site_batch中不存在, 其他为3 --> <!-- 批次状态查询: batchStatus=1 在emis_waybill_batch_status中存在, batchStatus=2 在emis_tms_site_batch中不存在, 其他为3 -->
<if test="params.batchStatus != null and params.batchStatus == '1'"> <if test="params.batchStatus != null and params.batchStatus == 1">
and EXISTS (SELECT 1 FROM emis_waybill_batch_status ewbs WHERE ewbs.bill_code = a.bill_code AND ewbs.del_flag = '0') and EXISTS (SELECT 1 FROM emis_waybill_batch_status ewbs WHERE ewbs.bill_code = a.bill_code AND ewbs.del_flag = '0')
</if> </if>
<if test="params.batchStatus != null and params.batchStatus == '2'"> <if test="params.batchStatus != null and params.batchStatus == 2">
and NOT EXISTS (SELECT 1 FROM emis_tms_site_batch_dtl etsbd INNER JOIN emis_tms_site_batch etsb ON etsbd.batch_no = etsb.batch_no WHERE etsbd.bill_code = a.bill_code AND etsbd.del_flag = '0' AND etsb.del_flag = '0') and NOT EXISTS (SELECT 1 FROM emis_tms_site_batch_dtl etsbd INNER JOIN emis_tms_site_batch etsb ON etsbd.batch_no = etsb.batch_no WHERE etsbd.bill_code = a.bill_code AND etsbd.del_flag = '0' AND etsb.del_flag = '0')
</if> </if>
<if test="params.batchStatus != null and params.batchStatus == '3'"> <if test="params.batchStatus != null and params.batchStatus == 3">
and ( and (
NOT EXISTS (SELECT 1 FROM emis_waybill_batch_status ewbs WHERE ewbs.bill_code = a.bill_code AND ewbs.del_flag = '0') NOT EXISTS (SELECT 1 FROM emis_waybill_batch_status ewbs WHERE ewbs.bill_code = a.bill_code AND ewbs.del_flag = '0')
AND EXISTS (SELECT 1 FROM emis_tms_site_batch_dtl etsbd INNER JOIN emis_tms_site_batch etsb ON etsbd.batch_no = etsb.batch_no WHERE etsbd.bill_code = a.bill_code AND etsbd.del_flag = '0' AND etsb.del_flag = '0') AND EXISTS (SELECT 1 FROM emis_tms_site_batch_dtl etsbd INNER JOIN emis_tms_site_batch etsb ON etsbd.batch_no = etsb.batch_no WHERE etsbd.bill_code = a.bill_code AND etsbd.del_flag = '0' AND etsb.del_flag = '0')
@ -172,15 +172,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if> </if>
<!-- 成本状态查询: costStatus=1 在emis_waybill_batch_status中存在且所有批次bl_entering=1, costStatus=2 不存在批次bl_entering=1, 其他为3 --> <!-- 成本状态查询: costStatus=1 在emis_waybill_batch_status中存在且所有批次bl_entering=1, costStatus=2 不存在批次bl_entering=1, 其他为3 -->
<if test="params.costStatus != null and params.costStatus == '1'"> <if test="params.costStatus != null and params.costStatus == 1">
and EXISTS (SELECT 1 FROM emis_waybill_batch_status ewbs WHERE ewbs.bill_code = a.bill_code AND ewbs.del_flag = '0') and EXISTS (SELECT 1 FROM emis_waybill_batch_status ewbs WHERE ewbs.bill_code = a.bill_code AND ewbs.del_flag = '0')
and EXISTS (SELECT 1 FROM emis_tms_site_batch_dtl etsbd INNER JOIN emis_tms_site_batch etsb ON etsbd.batch_no = etsb.batch_no WHERE etsbd.bill_code = a.bill_code AND etsbd.del_flag = '0' AND etsb.del_flag = '0') and EXISTS (SELECT 1 FROM emis_tms_site_batch_dtl etsbd INNER JOIN emis_tms_site_batch etsb ON etsbd.batch_no = etsb.batch_no WHERE etsbd.bill_code = a.bill_code AND etsbd.del_flag = '0' AND etsb.del_flag = '0')
and NOT EXISTS (SELECT 1 FROM emis_tms_site_batch_dtl etsbd INNER JOIN emis_tms_site_batch etsb ON etsbd.batch_no = etsb.batch_no WHERE etsbd.bill_code = a.bill_code AND etsbd.del_flag = '0' AND etsb.del_flag = '0' AND (etsb.bl_entering IS NULL OR etsb.bl_entering != '1')) and NOT EXISTS (SELECT 1 FROM emis_tms_site_batch_dtl etsbd INNER JOIN emis_tms_site_batch etsb ON etsbd.batch_no = etsb.batch_no WHERE etsbd.bill_code = a.bill_code AND etsbd.del_flag = '0' AND etsb.del_flag = '0' AND (etsb.bl_entering IS NULL OR etsb.bl_entering != '1'))
</if> </if>
<if test="params.costStatus != null and params.costStatus == '2'"> <if test="params.costStatus != null and params.costStatus == 2">
and NOT EXISTS (SELECT 1 FROM emis_tms_site_batch_dtl etsbd INNER JOIN emis_tms_site_batch etsb ON etsbd.batch_no = etsb.batch_no WHERE etsbd.bill_code = a.bill_code AND etsbd.del_flag = '0' AND etsb.del_flag = '0' AND etsb.bl_entering = '1') and NOT EXISTS (SELECT 1 FROM emis_tms_site_batch_dtl etsbd INNER JOIN emis_tms_site_batch etsb ON etsbd.batch_no = etsb.batch_no WHERE etsbd.bill_code = a.bill_code AND etsbd.del_flag = '0' AND etsb.del_flag = '0' AND etsb.bl_entering = '1')
</if> </if>
<if test="params.costStatus != null and params.costStatus == '3'"> <if test="params.costStatus != null and params.costStatus == 3">
and ( and (
NOT EXISTS (SELECT 1 FROM emis_waybill_batch_status ewbs WHERE ewbs.bill_code = a.bill_code AND ewbs.del_flag = '0') NOT EXISTS (SELECT 1 FROM emis_waybill_batch_status ewbs WHERE ewbs.bill_code = a.bill_code AND ewbs.del_flag = '0')
OR ( OR (