diff --git a/emis-biz/src/main/resources/mapper/EmisTmsSiteBatchMapper.xml b/emis-biz/src/main/resources/mapper/EmisTmsSiteBatchMapper.xml index 33c57f579..df1572ce8 100644 --- a/emis-biz/src/main/resources/mapper/EmisTmsSiteBatchMapper.xml +++ b/emis-biz/src/main/resources/mapper/EmisTmsSiteBatchMapper.xml @@ -546,11 +546,21 @@ b.trans_weight, b.pack_num, b.total_waybill_qty, b.total_settlement_weight, b.op_man, b.remark, b.tenant_id, b.del_flag, b.create_by, b.create_time, b.update_by, b.update_time, b.create_site, b.update_site, b.bl_entering, - COALESCE(SUM(d.batch_volume), 0) as total_volume, - COALESCE(SUM(d.batch_parcel_qty), 0) as total_parcel_qty, - COALESCE(SUM(d.batch_weight), 0) as total_weight + CASE + WHEN COALESCE(SUM(d.batch_volume), 0) = 0 THEN COALESCE(w.total_volume, 0) + ELSE COALESCE(SUM(d.batch_volume), 0) + END as total_volume, + CASE + WHEN COALESCE(SUM(d.batch_parcel_qty), 0) = 0 THEN COALESCE(w.parcel_qty, 0) + ELSE COALESCE(SUM(d.batch_parcel_qty), 0) + END as total_parcel_qty, + CASE + WHEN COALESCE(SUM(d.batch_weight), 0) = 0 THEN COALESCE(w.bill_weight, 0) + ELSE COALESCE(SUM(d.batch_weight), 0) + END as total_weight from emis_tms_site_batch b inner join emis_tms_site_batch_dtl d on b.batch_no = d.batch_no + left join emis_waybill w on d.bill_code = w.bill_code and w.del_flag = '0' where b.start_site_code = #{startSiteCode} and b.next_site_code = #{nextSiteCode} and d.bill_code = #{billCode} @@ -563,6 +573,7 @@ b.clearance_res_status, b.declare_res_status, b.dest_country, b.dest_country_name, b.trans_weight, b.pack_num, b.total_waybill_qty, b.total_settlement_weight, b.op_man, b.remark, b.tenant_id, b.del_flag, b.create_by, b.create_time, - b.update_by, b.update_time, b.create_site, b.update_site, b.bl_entering + b.update_by, b.update_time, b.create_site, b.update_site, b.bl_entering, + w.total_volume, w.parcel_qty, w.total_weight \ No newline at end of file