35 lines
1013 B
JavaScript
35 lines
1013 B
JavaScript
function isFixedPart(row, num) {
|
||
return Boolean(row.JdlSummary) && num(row.CalcIndex) === 1;
|
||
}
|
||
|
||
function exportUnitPart(row, code, index, map, source, num, next) {
|
||
const fixed = isFixedPart(row, num);
|
||
const code1 = fixed
|
||
? source(0, { ...row, Code: "UNIT-PART-" + next() })
|
||
: map.get(num(row.LinkIndex) + ":" + row.Code);
|
||
return {
|
||
F_CODE: code,
|
||
F_SEQ: String(index + 1),
|
||
F_CODE1: code1,
|
||
F_DES: row.Name,
|
||
F_SIZE: row.Size,
|
||
F_UNIT: row.Unite,
|
||
F_QQTY: fixed ? (["%", "%"].includes(row.Unite) ? 100 : 1) : num(row.GN),
|
||
F_MPRICE: num(fixed ? row.GC : row.GU),
|
||
F_LPRICE: num(fixed ? row.NC : row.NU),
|
||
F_EPRICE: num(fixed ? row.JC : row.JU) + num(fixed ? row.SC : row.SU),
|
||
F_MCOST: num(row.GC),
|
||
F_LCOST: num(row.NC),
|
||
F_ECOST: num(row.JC) + num(row.SC),
|
||
F_SPROPER: "0",
|
||
F_LOADBM: "T",
|
||
F_SAVEBM: "T",
|
||
F_SRATE: 0,
|
||
F_KWAN: "0",
|
||
F_CLASS: "0",
|
||
F_ORICODE: "00000000000",
|
||
};
|
||
}
|
||
|
||
module.exports = { isFixedPart, exportUnitPart };
|