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 logpm_trunkline_cars_load_scan 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 (
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
) 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'
and lww.document_making_time > '2024-10-22 00:00:00'
@ -299,14 +305,20 @@
count(lta.waybill_id) openNum,
sum( IF(ltcls.id IS NOT NULL AND ltcll.start_date is not null,1,0) ) startNum,
count(lta.id)-sum( IF(ltcls.id IS NOT NULL AND ltcll.start_date is not null,1,0) ) noOutNum,
sum(if( ltcls.id is null and now() > DATE_ADD( lta.create_time, INTERVAL #{param.hoursTime} HOUR ),1,0)) noOutOverNum,
sum(if( (ltcls.id IS NULL OR ltcll.start_date IS NULL) and now() > DATE_ADD( lta.create_time, INTERVAL #{param.hoursTime} HOUR ),1,0)) noOutOverNum,
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 logpm_trunkline_cars_load_scan 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 (
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
) 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'
and lww.document_making_time > '2024-10-22 00:00:00'
@ -2826,7 +2838,7 @@
</if>
<iftest="param.startDetailType != null and param.startDetailType ==4">
and ltcls.id is null
and now() <= DATE_ADD( ltad.create_time, INTERVAL #{param.hoursTime} HOUR )
and now() > DATE_ADD( ltad.create_time, INTERVAL #{param.hoursTime} HOUR )
</if>
group by ltad.id
</select>
@ -2928,7 +2940,7 @@
</if>
<iftest="param.startDetailType != null and param.startDetailType ==4">
and ltcls.id is null
and now() <= DATE_ADD( ltad.create_time, INTERVAL #{param.hoursTime} HOUR )
and now() > DATE_ADD( ltad.create_time, INTERVAL #{param.hoursTime} HOUR )