Browse Source

1.报表逻辑优化

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

48
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'

Loading…
Cancel
Save