Merge pull request 'fix(lastleg): 修复取货车次导致出车记录 S0500' (#39) from hotfix-trip-operations into main
This commit was merged in pull request #39.
This commit is contained in:
+2
-1
@@ -17,12 +17,13 @@ public class TripOperationsRepository {
|
||||
ORDER BY h.record_version LIMIT 1) AS snapshot_json,
|
||||
(SELECT r.details_json FROM ll_fleet_trip_operations_record r WHERE r.trip_no=t.trip_no
|
||||
ORDER BY r.record_version DESC LIMIT 1) AS measured_json
|
||||
FROM ll_fleet_trip t WHERE t.departed_at >= ? AND t.departed_at < ?
|
||||
FROM ll_fleet_trip t WHERE t.trip_purpose='DELIVERY' AND t.departed_at >= ? AND t.departed_at < ?
|
||||
""");
|
||||
var args = new ArrayList<Object>();
|
||||
args.add(LocalDateTime.ofInstant(query.from(), ZoneOffset.UTC)); args.add(LocalDateTime.ofInstant(query.to(), ZoneOffset.UTC));
|
||||
if (query.warehouseId() != null) { sql.append(" AND t.warehouse_id=?"); args.add(query.warehouseId()); }
|
||||
if (query.status() != null && !query.status().isBlank()) { sql.append(" AND t.status=?"); args.add(query.status()); }
|
||||
// 派送统计只消费 DEPART 实载快照;取货与本土卡车使用各自的执行历史,不能混入此投影。
|
||||
// Search by stable business number; vehicle/driver search is applied to the immutable departure snapshot.
|
||||
sql.append(" ORDER BY t.departed_at DESC,t.id DESC LIMIT 5001");
|
||||
return jdbc.query(sql.toString(), (r, i) -> new Departure(r.getString("trip_no"), r.getString("status"),
|
||||
|
||||
Reference in New Issue
Block a user