feat(est): import basic JDL unit details
This commit is contained in:
@@ -259,6 +259,74 @@ function read(bytes, project) {
|
||||
project.tables[table].push(row);
|
||||
byCode.set(row.Code, { row, kind });
|
||||
}
|
||||
let unitPk = 0;
|
||||
const unitWarnings = [];
|
||||
const unitCodes = new Set(rows["unit.txt"].map((r) => r.F_CODE));
|
||||
const partsByUnit = new Map();
|
||||
for (const part of rows["unitpart.txt"]) {
|
||||
if (!partsByUnit.has(part.F_CODE)) partsByUnit.set(part.F_CODE, []);
|
||||
partsByUnit.get(part.F_CODE).push(part);
|
||||
}
|
||||
for (const title of rows["unit.txt"]) {
|
||||
const gc = num(title.F_MPRICE),
|
||||
nc = num(title.F_LPRICE),
|
||||
jc = num(title.F_EPRICE);
|
||||
project.tables.HeadMainDat.push({
|
||||
PkID: ++unitPk,
|
||||
Index: 1,
|
||||
Code: title.F_CODE,
|
||||
TitleCode: title.F_CODE,
|
||||
Name: title.F_DES,
|
||||
Size: title.F_SIZE,
|
||||
Unite: title.F_UNIT,
|
||||
GC: gc,
|
||||
NC: nc,
|
||||
JC: jc,
|
||||
SC: 0,
|
||||
TC: gc + nc + jc,
|
||||
});
|
||||
for (const part of partsByUnit.get(title.F_CODE) || []) {
|
||||
const source = byCode.get(part.F_CODE1);
|
||||
const basic =
|
||||
source &&
|
||||
["", "0"].includes(part.F_SPROPER) &&
|
||||
["", "T"].includes(part.F_LOADBM) &&
|
||||
["", "T"].includes(part.F_SAVEBM) &&
|
||||
!num(part.F_SRATE) &&
|
||||
["", "0"].includes(part.F_KWAN) &&
|
||||
["", "0"].includes(part.F_CLASS);
|
||||
if (!basic) {
|
||||
unitWarnings.push(`일위 ${title.F_CODE}/${part.F_SEQ}: 특수 구성은 원문에만 보존`);
|
||||
continue;
|
||||
}
|
||||
const gc = num(part.F_MCOST),
|
||||
nc = num(part.F_LCOST),
|
||||
jc = num(part.F_ECOST);
|
||||
project.tables.HeadMainDat.push({
|
||||
PkID: ++unitPk,
|
||||
Index: 0,
|
||||
Code: part.F_CODE1,
|
||||
Name: part.F_DES,
|
||||
Size: part.F_SIZE,
|
||||
Unite: part.F_UNIT,
|
||||
LinkIndex: source.kind,
|
||||
CalcIndex: 0,
|
||||
GN: num(part.F_QQTY),
|
||||
GU: num(part.F_MPRICE),
|
||||
NU: num(part.F_LPRICE),
|
||||
JU: num(part.F_EPRICE),
|
||||
SU: 0,
|
||||
GC: gc,
|
||||
NC: nc,
|
||||
JC: jc,
|
||||
SC: 0,
|
||||
TC: gc + nc + jc,
|
||||
TU: num(part.F_MPRICE) + num(part.F_LPRICE) + num(part.F_EPRICE),
|
||||
});
|
||||
}
|
||||
}
|
||||
if (rows["unitpart.txt"].some((r) => !unitCodes.has(r.F_CODE)))
|
||||
unitWarnings.push("부모 일위대가가 없는 상세 행은 원문에만 보존");
|
||||
const headings = new Set();
|
||||
let pk = 0;
|
||||
for (const group of rows["gongjong.txt"]) {
|
||||
@@ -334,6 +402,7 @@ function read(bytes, project) {
|
||||
project.originalJdl = bytes.toString("base64");
|
||||
project.importWarnings = [
|
||||
"JDL 저장 금액을 보존하기 위해 자동계산을 껐습니다. 복잡한 단가산출식·손료/기성 확장 파일은 원문에 보존되며 자동 변환하지 않습니다.",
|
||||
...unitWarnings,
|
||||
];
|
||||
project.calculation = {
|
||||
errors: [],
|
||||
|
||||
Reference in New Issue
Block a user