demand: tms-客户账单管理-财务开票处理-重复开票记录问题修复

committer: heyu
This commit is contained in:
aike 2025-11-12 10:37:38 +08:00
parent 034d61d724
commit 0b90432a1b
3 changed files with 62 additions and 20 deletions

View File

@ -72,6 +72,14 @@ public class MonthlyCustomerShipmentStatVO implements Serializable {
@Excel(name = "陆运实际重量")
private BigDecimal landWeight;
/* 海运票数 */
@Excel(name = "海运票数")
private Integer seaTickets;
/* 海运实际重量 */
@Excel(name = "海运实际重量")
private BigDecimal seaWeight;
/* 进口票数 */
@Excel(name = "进口票数")
private Integer importTickets;

View File

@ -100,7 +100,17 @@
select a.id, a.apply_seq_no, a.apply_date, a.apply_man_code, a.apply_site_code, a.customer_code, a.customer_name, a.settle_bill_no, a.settle_bill_name, a.apply_money, a.invoice_type, a.openbill_scope, a.company_name, a.company_tax_no, a.company_tel, a.company_address, a.invioce_remark, a.bank_name, a.bank_acc_no, a.contact, a.phone, a.real_tax_type, a.orig_open_money, a.add_tax_rate, a.add_open_money, a.open_money_max, a.open_money, ch.invoice_no, a.reced_money, a.payment_status, a.invoice_status, a.invoice_status_desc, a.recieve_address, a.email, a.file_path, a.remark, a.bl_audit, a.audit_date, a.audit_man_code, a.audit_site_code, a.audit_note, a.op_man_code, a.op_date, a.op_site_code, a.open_ch_id, a.open_ch_status, a.open_ch_status_desc, a.open_com_code, a.bl_delay, a.delay_op_man_code, a.delay_op_date, ch.saler_company_name, a.del_flag, a.create_by, a.create_time, a.update_by, a.update_time, a.create_site, a.update_site
from emis_settle_invoice_record a
left join emis_settle_invoice_ch_record ch on a.apply_seq_no = ch.apply_seq_no and ch.del_flag = '0'
left join (
select ch1.*
from emis_settle_invoice_ch_record ch1
inner join (
select apply_seq_no, max(id) as max_id
from emis_settle_invoice_ch_record
where del_flag = '0'
group by apply_seq_no
) ch2 on ch1.apply_seq_no = ch2.apply_seq_no and ch1.id = ch2.max_id
where ch1.del_flag = '0'
) ch on a.apply_seq_no = ch.apply_seq_no
<where>
@ -261,7 +271,17 @@
op_user.emp_name as op_man_name,
delay_op_user.emp_name as delay_op_man_name
from emis_settle_invoice_record a
left join emis_settle_invoice_ch_record ch on a.apply_seq_no = ch.apply_seq_no and ch.del_flag = '0'
left join (
select ch1.*
from emis_settle_invoice_ch_record ch1
inner join (
select apply_seq_no, max(id) as max_id
from emis_settle_invoice_ch_record
where del_flag = '0'
group by apply_seq_no
) ch2 on ch1.apply_seq_no = ch2.apply_seq_no and ch1.id = ch2.max_id
where ch1.del_flag = '0'
) ch on a.apply_seq_no = ch.apply_seq_no
left join sys_user apply_user on a.apply_man_code = apply_user.emp_code
left join sys_user audit_user on a.audit_man_code = audit_user.emp_code
left join sys_user op_user on a.op_man_code = op_user.emp_code
@ -387,7 +407,17 @@
<select id="selectInvoiceRecordListByBillCodes" parameterType="java.util.List" resultMap="EmisSettleInvoiceRecordResult">
select distinct a.id, a.apply_seq_no, a.apply_date, a.apply_man_code, a.apply_site_code, a.customer_code, a.customer_name, a.settle_bill_no, a.settle_bill_name, a.apply_money, a.invoice_type, a.openbill_scope, a.company_name, a.company_tax_no, a.company_tel, a.company_address, a.invioce_remark, a.bank_name, a.bank_acc_no, a.contact, a.phone, a.real_tax_type, a.orig_open_money, a.add_tax_rate, a.add_open_money, a.open_money_max, a.open_money, ch.invoice_no, a.reced_money, a.payment_status, a.invoice_status, a.invoice_status_desc, a.recieve_address, a.email, a.file_path, a.remark, a.bl_audit, a.audit_date, a.audit_man_code, a.audit_site_code, a.audit_note, a.op_man_code, a.op_date, a.op_site_code, a.open_ch_id, a.open_ch_status, a.open_ch_status_desc, a.open_com_code, a.bl_delay, a.delay_op_man_code, a.delay_op_date, ch.saler_company_name, a.del_flag, a.create_by, a.create_time, a.update_by, a.update_time, a.create_site, a.update_site
from emis_settle_invoice_record a
left join emis_settle_invoice_ch_record ch on a.apply_seq_no = ch.apply_seq_no and ch.del_flag = '0'
left join (
select ch1.*
from emis_settle_invoice_ch_record ch1
inner join (
select apply_seq_no, max(id) as max_id
from emis_settle_invoice_ch_record
where del_flag = '0'
group by apply_seq_no
) ch2 on ch1.apply_seq_no = ch2.apply_seq_no and ch1.id = ch2.max_id
where ch1.del_flag = '0'
) ch on a.apply_seq_no = ch.apply_seq_no
where a.del_flag = '0'
and exists (
select 1 from emis_settle_invoice_rel rel
@ -472,7 +502,17 @@
<select id="selectEmisSettleInvoiceRecordById" parameterType="Long" resultMap="EmisSettleInvoiceRecordResult">
select a.id, a.apply_seq_no, a.apply_date, a.apply_man_code, a.apply_site_code, a.customer_code, a.customer_name, a.settle_bill_no, a.settle_bill_name, a.apply_money, a.invoice_type, a.openbill_scope, a.company_name, a.company_tax_no, a.company_tel, a.company_address, a.invioce_remark, a.bank_name, a.bank_acc_no, a.contact, a.phone, a.real_tax_type, a.orig_open_money, a.add_tax_rate, a.add_open_money, a.open_money_max, a.open_money, a.invoice_no, a.invoice_status, a.invoice_status_desc, a.recieve_address, a.email, a.file_path, a.remark, a.bl_audit, a.audit_date, a.audit_man_code, a.audit_site_code, a.audit_note, a.op_man_code, a.op_date, a.op_site_code, a.open_ch_id, a.open_ch_status, a.open_ch_status_desc, a.open_com_code, a.bl_delay, a.delay_op_man_code, a.delay_op_date, ch.saler_company_name, a.del_flag, a.create_by, a.create_time, a.update_by, a.update_time, a.create_site, a.update_site
from emis_settle_invoice_record a
left join emis_settle_invoice_ch_record ch on a.apply_seq_no = ch.apply_seq_no and ch.del_flag = '0'
left join (
select ch1.*
from emis_settle_invoice_ch_record ch1
inner join (
select apply_seq_no, max(id) as max_id
from emis_settle_invoice_ch_record
where del_flag = '0'
group by apply_seq_no
) ch2 on ch1.apply_seq_no = ch2.apply_seq_no and ch1.id = ch2.max_id
where ch1.del_flag = '0'
) ch on a.apply_seq_no = ch.apply_seq_no
where a.id = #{id}
</select>

View File

@ -4004,10 +4004,12 @@
IFNULL(SUM(CASE WHEN a.send_country = '0086' AND tl.trans_type = '1' THEN a.bill_weight ELSE 0 END), 0) AS expressWeight,
SUM(CASE WHEN a.send_country = '0086' AND tl.trans_type = '2' THEN 1 ELSE 0 END) AS airTickets,
IFNULL(SUM(CASE WHEN a.send_country = '0086' AND tl.trans_type = '2' THEN a.bill_weight ELSE 0 END), 0) AS airWeight,
SUM(CASE WHEN a.send_country = '0086' AND tl.trans_type = '3' THEN 1 ELSE 0 END) AS landTickets,
IFNULL(SUM(CASE WHEN a.send_country = '0086' AND tl.trans_type = '3' THEN a.bill_weight ELSE 0 END), 0) AS landWeight,
SUM(CASE WHEN a.receive_country = '0086' AND tl.trans_type IN ('1', '2', '3') THEN 1 ELSE 0 END) AS importTickets,
IFNULL(SUM(CASE WHEN a.receive_country = '0086' AND tl.trans_type IN ('1', '2', '3') THEN a.bill_weight ELSE 0 END), 0) AS importWeight
SUM(CASE WHEN a.send_country = '0086' AND tl.trans_type in ('3','5') THEN 1 ELSE 0 END) AS landTickets,
IFNULL(SUM(CASE WHEN a.send_country = '0086' AND tl.trans_type in ('3','5') THEN a.bill_weight ELSE 0 END), 0) AS landWeight,
SUM(CASE WHEN a.send_country = '0086' AND tl.trans_type = '4' THEN 1 ELSE 0 END) AS seaTickets,
IFNULL(SUM(CASE WHEN a.send_country = '0086' AND tl.trans_type = '4' THEN a.bill_weight ELSE 0 END), 0) AS seaWeight,
SUM(CASE WHEN a.receive_country = '0086' THEN 1 ELSE 0 END) AS importTickets,
IFNULL(SUM(CASE WHEN a.receive_country = '0086' THEN a.bill_weight ELSE 0 END), 0) AS importWeight
FROM emis_waybill a
LEFT JOIN emis_trans_line tl ON a.trans_line_type = tl.line_code AND tl.del_flag = '0'
LEFT JOIN emis_customer_user cu ON a.customer_code = cu.customer_code AND cu.del_flag = '0'
@ -4017,7 +4019,6 @@
AND a.order_status!='2'
AND a.cust_no IS NOT NULL
AND a.cust_no != ''
-- AND cu.customer_type = '2'
<!-- 剔除问题件类型为面单删除、出口虚拟单、返货虚拟单的运单 -->
AND NOT EXISTS (
SELECT 1 FROM emis_waybill_problem_info ewpi
@ -4142,19 +4143,12 @@
SELECT 1 FROM emis_trans_line tl
WHERE tl.line_code = a.trans_line_type
AND tl.del_flag = '0'
AND tl.trans_type = #{transType}
<if test="transType == '1'">
AND a.send_country = '0086'
</if>
<if test="transType == '2'">
AND a.send_country = '0086'
</if>
<if test="transType == '3'">
AND a.send_country = '0086'
</if>
<if test="transType == 'import'">
AND a.receive_country = '0086'
AND tl.trans_type IN ('1', '2', '3')
</if>
<if test="transType != 'import'">
AND FIND_IN_SET(tl.trans_type, #{transType})
AND a.send_country = '0086'
</if>
)
</if>