mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 15:18:11 +00:00
leg-aware capacity and wagon sharing
This commit is contained in:
@@ -1103,19 +1103,31 @@ export default function TrainScheduleV2DetailPage() {
|
||||
},
|
||||
{
|
||||
label: "Wagons / load",
|
||||
// Gross: cargo load + the tare of every wagon in the consist — the
|
||||
// weight the locomotive actually hauls.
|
||||
value: `${schedule.trainSet?.wagonCount ?? displayWagonPlan.length} · ${
|
||||
Math.round(
|
||||
((schedule.trainSet?.totalWeightTons ?? 0) +
|
||||
(schedule.trainSet?.wagons ?? []).reduce(
|
||||
(sum, w) => sum + (Number(w.tareWeightTons) || 0),
|
||||
0,
|
||||
)) *
|
||||
100,
|
||||
) / 100
|
||||
}T`,
|
||||
hint: "gross · wagon tare + cargo",
|
||||
// Gross: cargo load + wagon tare — the weight the locomotives
|
||||
// actually haul. Heaviest corridor edge when the server sends it;
|
||||
// plain consist sums over-report a multi-stop train (cross-leg
|
||||
// wagon sharing counts one physical wagon as several slots).
|
||||
value: (() => {
|
||||
const heaviest = schedule.trainSet?.heaviestLeg;
|
||||
const wagonCount =
|
||||
heaviest?.loadedWagonCount ??
|
||||
schedule.trainSet?.wagonCount ??
|
||||
displayWagonPlan.length;
|
||||
const grossTons =
|
||||
heaviest?.grossWeightTons ??
|
||||
Math.round(
|
||||
((schedule.trainSet?.totalWeightTons ?? 0) +
|
||||
(schedule.trainSet?.wagons ?? []).reduce(
|
||||
(sum, w) => sum + (Number(w.tareWeightTons) || 0),
|
||||
0,
|
||||
)) *
|
||||
100,
|
||||
) / 100;
|
||||
return `${wagonCount} · ${grossTons}T`;
|
||||
})(),
|
||||
hint: schedule.trainSet?.heaviestLeg
|
||||
? "heaviest leg · wagon tare + cargo"
|
||||
: "gross · wagon tare + cargo",
|
||||
icon: Weight,
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user