feat(B06): 구조물 잔토에 터파기 토질을 이어받아 사토 갈래(ea/rr/br)를 채움
B08 이 구조물터파기에서 이미 판정한 토질(`design.ground_type`, 품셈 9-13 3구분)을 잔토 측점값에 함께 실어 준다. **새 근거를 만드는 것이 아니라 이어받는 것**이라 두 자리가 같은 판정을 쓴다(두 벌로 짜면 갈린다). - `structure_spoil_points[].ground_type` (soil→ea · ripping_rock→rr · blasting_rock→br). 옛 이름(`ground`)·라벨(`ground_label`)도 함께 받는다. - ⚠ **섞여서 못 고른 구조물은 `null`** 로 오고 그 몫은 갈래 없이 담겨 `ground_unknown_m3` 로 드러난다 — 임의로 토사로 몰지 않는다. - ⚠ 한계는 그대로 넘어온다: 「터파기 깊이가 암반 경계선보다 깊은지」는 안 본다 (터파기 토질에 이미 있던 한계이고 새로 생기는 것이 아니다). 시험 8건(갈래별로 담김·못 고른 몫은 「모름」으로 남음 포함). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -394,6 +394,21 @@ function applyCollectedStoneDeduction(residuals: HaulResidual[], deduction: numb
|
||||
*
|
||||
* 돌려주는 값은 **실제로 더한 양(㎥)**. 받을 사토 잔량이 하나도 없으면 0 이다.
|
||||
*/
|
||||
/**
|
||||
* 터파기 토질 문자열 → 잔량의 지반 갈래 칸. 모르면 `null`(그 몫은 「지반 모름」으로 남는다).
|
||||
* 받는 말은 B08 의 품셈 9-13 3구분과 우리 내부 이름 둘 다 받는다.
|
||||
*/
|
||||
function groundBucket(ground: string | null | undefined): "ea_m3" | "rr_m3" | "br_m3" | null {
|
||||
const text = (ground ?? "").trim();
|
||||
if (!text) return null;
|
||||
if (text === "토사" || text === "soil" || text === "ea") return "ea_m3";
|
||||
if (text === "암절취" || text === "리핑암" || text === "ripping_rock" || text === "rr") {
|
||||
return "rr_m3";
|
||||
}
|
||||
if (text === "발파암" || text === "blasting_rock" || text === "br") return "br_m3";
|
||||
return null;
|
||||
}
|
||||
|
||||
function newSpoilResidual(fromM: number, toM: number, volumeM3: number): HaulResidual {
|
||||
// 잔토를 담을 사토 잔량이 없을 때 **새로 세운다**(2026-09-09 확정 ㉰).
|
||||
// ⚠ 지반유형 안분·자연방토는 0 이다 — 어느 지반에서 나온 흙인지 모르고, **실어 내는** 흙이다.
|
||||
@@ -430,7 +445,14 @@ function newSpoilResidual(fromM: number, toM: number, volumeM3: number): HaulRes
|
||||
function applyStructureSpoil(
|
||||
residuals: HaulResidual[],
|
||||
amount: number | null,
|
||||
points: Array<{ chainage_m: number; spoil_m3: number }> | null,
|
||||
points: Array<{
|
||||
chainage_m: number;
|
||||
spoil_m3: number;
|
||||
/** B08 이 보내는 이름은 `ground_type`(soil·ripping_rock·blasting_rock). 옛 이름·라벨도 받는다. */
|
||||
ground_type?: string | null;
|
||||
ground_label?: string | null;
|
||||
ground?: string | null;
|
||||
}> | null,
|
||||
): number {
|
||||
const spoilsOf = (): HaulResidual[] => residuals.filter((residual) => residual.kind === "spoil");
|
||||
|
||||
@@ -445,12 +467,13 @@ function applyStructureSpoil(
|
||||
const covering = spoils.find(
|
||||
(residual) => chainage >= residual.from_m - 1e-9 && chainage <= residual.to_m + 1e-9,
|
||||
);
|
||||
if (covering) {
|
||||
covering.volume_m3 += value;
|
||||
} else {
|
||||
// 그 자리를 품는 사토가 없다 — 그 측점에 사토를 새로 세워 담는다.
|
||||
residuals.push(newSpoilResidual(chainage, chainage, value));
|
||||
}
|
||||
// 터파기 토질이 함께 오면 **그 갈래로 담는다** — B08 이 이미 판정한 값을 이어받는 것이라
|
||||
// 새 근거를 만드는 것이 아니다. 안 오면 갈래 없이 담겨 「지반 모름」으로 남는다.
|
||||
const bucket = groundBucket(point?.ground_type ?? point?.ground ?? point?.ground_label);
|
||||
const target = covering ?? newSpoilResidual(chainage, chainage, 0);
|
||||
if (!covering) residuals.push(target);
|
||||
target.volume_m3 += value;
|
||||
if (bucket) target[bucket] += value;
|
||||
added += value;
|
||||
}
|
||||
return added;
|
||||
@@ -487,7 +510,16 @@ export function computeHaulPlan(
|
||||
collected_stone_deduction_m3?: number | null;
|
||||
structure_spoil_m3?: number | null;
|
||||
/** 측점별 구조물 잔토 — 오면 **이쪽이 이긴다**(그 자리 잔량에 얹어 운반거리를 맞춘다). */
|
||||
structure_spoil_points?: Array<{ chainage_m: number; spoil_m3: number }> | null;
|
||||
structure_spoil_points?: Array<{
|
||||
chainage_m: number;
|
||||
spoil_m3: number;
|
||||
/** 그 터파기의 토질 — B08 이 `design.ground_type` 으로 이미 판정한 값(품셈 9-13 3구분).
|
||||
* **새 근거를 만드는 것이 아니라 이어받는 것**이다. 섞여서 못 고른 구조물은 `null` 로
|
||||
* 오고, 그 몫은 「지반 모름」(`ground_unknown_m3`)으로 남는다. */
|
||||
ground_type?: string | null;
|
||||
ground_label?: string | null;
|
||||
ground?: string | null;
|
||||
}> | null;
|
||||
},
|
||||
): HaulPlan | null {
|
||||
const points = result.points;
|
||||
|
||||
Reference in New Issue
Block a user