From e62d3b822b36bd8933512e20837491b80095f63e Mon Sep 17 00:00:00 2001 From: zhenghaoyu Date: Thu, 3 Apr 2025 14:30:58 +0800 Subject: [PATCH] =?UTF-8?q?1.=E6=8A=A5=E8=A1=A8=E9=80=BB=E8=BE=91=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../logpm/report/mapper/ReportTimeMapper.xml | 48 ++++++++++++++----- 1 file changed, 36 insertions(+), 12 deletions(-) diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/ReportTimeMapper.xml b/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/ReportTimeMapper.xml index 976703731..191dd1dbf 100644 --- a/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/ReportTimeMapper.xml +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/ReportTimeMapper.xml @@ -246,11 +246,14 @@ left join logpm_warehouse_waybill lww on lww.id = lta.waybill_id left join logpm_warehouse_warehouse waw on waw.id = lta.warehouse_id left join ( - SELECT - t1.* - FROM logpm_trunkline_cars_load_scan t1 - LEFT JOIN logpm_trunkline_cars_load_scan t2 ON t1.scan_code = t2.scan_code AND t1.create_time < t2.create_time - WHERE t2.scan_code IS NULL + SELECT + t1.* + FROM logpm_trunkline_cars_load_scan t1 + LEFT JOIN logpm_trunkline_cars_load_scan t2 ON t1.scan_code = t2.scan_code + AND ((t2.warehouse_id IS NOT NULL AND t1.warehouse_id IS NULL) + OR(t1.warehouse_id IS NOT NULL = t2.warehouse_id IS NOT NULL AND t1.create_time < t2.create_time)) + WHERE + t2.scan_code IS NULL ) ltcls on ltcls.scan_code = lta.order_package_code and ltcls.warehouse_id = lta.warehouse_id and ltcls.type = 1 and ltcls.scan_status != 4 left join logpm_trunkline_cars_load_line ltcll on ltcll.load_id = ltcls.load_id and ltcll.node_id = ltcls.warehouse_id where lta.create_time > '2024-10-22 00:00:00' @@ -316,8 +319,11 @@ SELECT t1.* FROM logpm_trunkline_cars_load_scan t1 - LEFT JOIN logpm_trunkline_cars_load_scan t2 ON t1.scan_code = t2.scan_code AND t1.create_time < t2.create_time - WHERE t2.scan_code IS NULL + LEFT JOIN logpm_trunkline_cars_load_scan t2 ON t1.scan_code = t2.scan_code + AND ((t2.warehouse_id IS NOT NULL AND t1.warehouse_id IS NULL) + OR(t1.warehouse_id IS NOT NULL = t2.warehouse_id IS NOT NULL AND t1.create_time < t2.create_time)) + WHERE + t2.scan_code IS NULL ) ltcls on ltcls.scan_code = lta.order_package_code and ltcls.warehouse_id = lta.warehouse_id and ltcls.type = 1 and ltcls.scan_status != 4 left join logpm_trunkline_cars_load_line ltcll on ltcll.load_id = ltcls.load_id and ltcll.node_id = ltcls.warehouse_id where lta.create_time > '2024-10-22 00:00:00' @@ -2775,10 +2781,19 @@ else '未知' end isOverTime from logpm_trunkline_advance_detail ltad left join logpm_trunkline_advance lta on lta.id = ltad.advance_id - left join logpm_warehouse_waybill lww on lww.id = ltad.waybill_id - left join logpm_warehouse_warehouse waw on waw.id = ltad.warehouse_id - left join logpm_trunkline_cars_load_scan ltcls on ltcls.scan_code = ltad.order_package_code and ltcls.warehouse_id = ltad.warehouse_id and ltcls.type = 1 and ltcls.scan_status != 4 - left join logpm_trunkline_cars_load_line ltcll on ltcll.load_id = ltcls.load_id and ltcll.node_id = ltcls.warehouse_id + left join logpm_warehouse_waybill lww on lww.id = ltad.waybill_id + left join logpm_warehouse_warehouse waw on waw.id = ltad.warehouse_id + left join ( + SELECT + t1.* + FROM logpm_trunkline_cars_load_scan t1 + LEFT JOIN logpm_trunkline_cars_load_scan t2 ON t1.scan_code = t2.scan_code + AND ((t2.warehouse_id IS NOT NULL AND t1.warehouse_id IS NULL) + OR(t1.warehouse_id IS NOT NULL = t2.warehouse_id IS NOT NULL AND t1.create_time < t2.create_time)) + WHERE + t2.scan_code IS NULL + ) ltcls on ltcls.scan_code = ltad.order_package_code and ltcls.warehouse_id = ltad.warehouse_id and ltcls.type = 1 and ltcls.scan_status != 4 + left join logpm_trunkline_cars_load_line ltcll on ltcll.load_id = ltcls.load_id and ltcll.node_id = ltcls.warehouse_id where ltad.create_time > '2024-10-22 00:00:00' and lww.document_making_time > '2024-10-22 00:00:00' and lww.departure_warehouse_id != lww.destination_warehouse_id @@ -2879,7 +2894,16 @@ left join logpm_trunkline_advance lta on lta.id = ltad.advance_id left join logpm_warehouse_waybill lww on lww.id = ltad.waybill_id left join logpm_warehouse_warehouse waw on waw.id = ltad.warehouse_id - left join logpm_trunkline_cars_load_scan ltcls on ltcls.scan_code = ltad.order_package_code and ltcls.warehouse_id = ltad.warehouse_id and ltcls.type = 1 and ltcls.scan_status != 4 + left join ( + SELECT + t1.* + FROM logpm_trunkline_cars_load_scan t1 + LEFT JOIN logpm_trunkline_cars_load_scan t2 ON t1.scan_code = t2.scan_code + AND ((t2.warehouse_id IS NOT NULL AND t1.warehouse_id IS NULL) + OR(t1.warehouse_id IS NOT NULL = t2.warehouse_id IS NOT NULL AND t1.create_time < t2.create_time)) + WHERE + t2.scan_code IS NULL + ) ltcls on ltcls.scan_code = ltad.order_package_code and ltcls.warehouse_id = ltad.warehouse_id and ltcls.type = 1 and ltcls.scan_status != 4 left join logpm_trunkline_cars_load_line ltcll on ltcll.load_id = ltcls.load_id and ltcll.node_id = ltcls.warehouse_id where ltad.create_time > '2024-10-22 00:00:00' and lww.document_making_time > '2024-10-22 00:00:00'