Browse Source

1.报表逻辑优化

pre-production
zhenghaoyu 2 days ago
parent
commit
e62d3b822b
  1. 36
      blade-service/logpm-report/src/main/java/com/logpm/report/mapper/ReportTimeMapper.xml

36
blade-service/logpm-report/src/main/java/com/logpm/report/mapper/ReportTimeMapper.xml

@ -249,8 +249,11 @@
SELECT SELECT
t1.* t1.*
FROM logpm_trunkline_cars_load_scan 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 LEFT JOIN logpm_trunkline_cars_load_scan t2 ON t1.scan_code = t2.scan_code
WHERE t2.scan_code IS NULL 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 ) 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 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' where lta.create_time > '2024-10-22 00:00:00'
@ -316,8 +319,11 @@
SELECT SELECT
t1.* t1.*
FROM logpm_trunkline_cars_load_scan 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 LEFT JOIN logpm_trunkline_cars_load_scan t2 ON t1.scan_code = t2.scan_code
WHERE t2.scan_code IS NULL 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 ) 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 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' where lta.create_time > '2024-10-22 00:00:00'
@ -2777,7 +2783,16 @@
left join logpm_trunkline_advance lta on lta.id = ltad.advance_id 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_waybill lww on lww.id = ltad.waybill_id
left join logpm_warehouse_warehouse waw on waw.id = ltad.warehouse_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 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' where ltad.create_time > '2024-10-22 00:00:00'
and lww.document_making_time > '2024-10-22 00:00:00' and lww.document_making_time > '2024-10-22 00:00:00'
@ -2879,7 +2894,16 @@
left join logpm_trunkline_advance lta on lta.id = ltad.advance_id 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_waybill lww on lww.id = ltad.waybill_id
left join logpm_warehouse_warehouse waw on waw.id = ltad.warehouse_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 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' where ltad.create_time > '2024-10-22 00:00:00'
and lww.document_making_time > '2024-10-22 00:00:00' and lww.document_making_time > '2024-10-22 00:00:00'

Loading…
Cancel
Save