feat(est-test): 현재데이타 갱신(Main Data·선택파일)
- 원본 0x10e12c8 규칙: 노임·자재·유류·표준·기계·환율, 품명/규격/단위 맞춤, 단가미갱신 표시 - 서버 /api/main-data 가 원본 설치 main.estx 를 원천으로 제공 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -7,6 +7,9 @@ const http = require("node:http"),
|
||||
const { importEstx, table: dbisamTable } = require("./import-estx.cjs");
|
||||
const { readXls } = require("./xls-read.cjs");
|
||||
const bookStore = require("./book-store.cjs");
|
||||
const mainDataPath =
|
||||
process.env.EST_MAIN_DATA || "C:/Dasansoft/Est Plus 2/Data/ProjectData/main.estx";
|
||||
let mainData = null;
|
||||
const exchange = require("./exchange.cjs");
|
||||
const { exportEstx } = require("./export-estx.cjs");
|
||||
const jdl = require("./jdl.cjs");
|
||||
@@ -89,6 +92,7 @@ const allowed = new Set([
|
||||
"native-global-vars.js",
|
||||
"native-new-estimate.js",
|
||||
"native-book.js",
|
||||
"native-data-update.js",
|
||||
"native-wonga-tools.js",
|
||||
"native-estimate-print.js",
|
||||
"native-xml-check.js",
|
||||
@@ -251,6 +255,26 @@ const server = http.createServer(async (req, res) => {
|
||||
reply(res, 200, importEstx(bytes, name));
|
||||
return;
|
||||
}
|
||||
if (req.method === "GET" && url.pathname === "/api/main-data") {
|
||||
// 현재데이타 갱신 원천 Main Data(원본 설치 main.estx = BufDat\Main\Main_1) — 갱신에 쓰는 표만
|
||||
if (!mainData) {
|
||||
const project = importEstx(fs.readFileSync(mainDataPath), "Main");
|
||||
const keys = [
|
||||
"LaborcDat",
|
||||
"StuffcDat",
|
||||
"SilJukDat",
|
||||
"MachTitleDat",
|
||||
"MachMainDat",
|
||||
"MachGijunDat",
|
||||
];
|
||||
mainData = {
|
||||
name: "Main",
|
||||
tables: Object.fromEntries(keys.map((k) => [k, project.tables[k] || []])),
|
||||
};
|
||||
}
|
||||
reply(res, 200, mainData);
|
||||
return;
|
||||
}
|
||||
if (req.method === "GET" && url.pathname.startsWith("/api/book")) {
|
||||
// 품셈 보기(원본 BookData) — /api/book · /api/book/<책>/tree · /text/<pkid> · /search?q=&mode=title|body|keyword
|
||||
const [, book, what, id] = url.pathname.slice(1).split("/").slice(1);
|
||||
|
||||
Reference in New Issue
Block a user