diff --git a/common_util/common_util_mass_haul_balance.ts b/common_util/common_util_mass_haul_balance.ts index 81c9b6bb..36cb6f3d 100644 --- a/common_util/common_util_mass_haul_balance.ts +++ b/common_util/common_util_mass_haul_balance.ts @@ -341,6 +341,9 @@ function bandOutline( * ⚠ 순서가 중요하다 — 캔 돌은 **실어 낼 흙 속에 있던 것**이다. 자연방토(운반비를 안 세는 몫) * 에서 먼저 깎으면 **줄어야 할 운반비가 안 줄어든다.** * ⚠ 잔량 하나하나(`residuals`)를 줄인다 — 총량만 줄이면 사토 balloon·운반거리가 안 따라간다. + * ⚠ **토취는 안 건드린다.** 「채집석을 캐 가면 성토에 쓸 흙이 줄어 토취가 는다」는 갈래가 + * 있으나 **근거가 없다** — 근거 없이 금액을 올리지 않는다. 확정되면 이 함수만 고치면 된다. + * ⚠ **순서** — 이 함수는 `applyStructureSpoil` **뒤에** 돈다. 잔토가 담긴 뒤라야 뺄 대상이 있다. * * 돌려주는 값은 **실제로 뺀 양(㎥)**. 사토가 모자라면 받은 값보다 작다. */ @@ -664,8 +667,10 @@ export function computeHaulPlan( residual.index = index + 1; }); - const deductionInput = options?.collected_stone_deduction_m3 ?? null; - const deducted = applyCollectedStoneDeduction(settled, deductionInput); + // ⚠ **순서가 뜻을 가른다 — 「잔토를 더하고 → 공제를 뺀다」**(2026-09-09 확정). + // 유토곡선의 사토는 「현장에 남는 흙 총량」이고 **출처를 안 가린다**. 공제는 그 총량에서 + // 빼는 것이라 **잔토가 담긴 뒤라야 뺄 대상이 있다.** 반대 순서로 두면 사토가 0 인 + // 노선(전 구간 토취)에서 공제가 **영영 안 걸린다** — 두 창 저장분에서 실제로 그랬다. const structureSpoilInput = options?.structure_spoil_m3 ?? null; const structureSpoilPoints = options?.structure_spoil_points ?? null; const structureSpoilAdded = applyStructureSpoil( @@ -673,6 +678,8 @@ export function computeHaulPlan( structureSpoilInput, structureSpoilPoints, ); + const deductionInput = options?.collected_stone_deduction_m3 ?? null; + const deducted = applyCollectedStoneDeduction(settled, deductionInput); const remaining = settled.filter((residual) => residual.volume_m3 > EPSILON); remaining.forEach((residual, index) => { residual.index = index + 1;