Add models & fix glass flag not getting detected.
This commit is contained in:
@@ -279,6 +279,61 @@ async function DecodeLinFile(extensionlessFilePath) {
|
||||
let records = await dbf.readRecords();
|
||||
let joblines = records
|
||||
.map((record) => {
|
||||
try {
|
||||
console.log(
|
||||
"Trying pick",
|
||||
_.pick(record, [
|
||||
"LINE_NO",
|
||||
"LINE_IND",
|
||||
// "LINE_REF",
|
||||
// "TRAN_CODE",
|
||||
"DB_REF",
|
||||
"UNQ_SEQ",
|
||||
// "WHO_PAYS",
|
||||
"LINE_DESC",
|
||||
"PART_TYPE",
|
||||
// "PART_DESCJ",
|
||||
"PRT_DSMK_M",
|
||||
"OEM_PARTNO",
|
||||
// "PRICE_INC",
|
||||
// "ALT_PART_I",
|
||||
// "TAX_PART",
|
||||
"DB_PRICE",
|
||||
"ACT_PRICE",
|
||||
"PART_QTY",
|
||||
"PRICE_J",
|
||||
"GLASS_FLAG",
|
||||
// "CERT_PART",
|
||||
// "ALT_CO_ID",
|
||||
// "ALT_PARTNO",
|
||||
// "ALT_OVERRD",
|
||||
// "ALT_PARTM",
|
||||
// "PRT_DSMK_P",
|
||||
|
||||
// "MOD_LBR_TY",
|
||||
// "DB_HRS",
|
||||
// "MOD_LB_HRS",
|
||||
// "LBR_INC",
|
||||
// "LBR_OP",
|
||||
// "LBR_HRS_J",
|
||||
// "LBR_TYP_J",
|
||||
// "LBR_OP_J",
|
||||
// "PAINT_STG",
|
||||
// "PAINT_TONE",
|
||||
// "LBR_TAX",
|
||||
// "LBR_AMT",
|
||||
// "MISC_AMT",
|
||||
// "MISC_SUBLT",
|
||||
// "MISC_TAX",
|
||||
// "BETT_TYPE",
|
||||
// "BETT_PCTG",
|
||||
// "BETT_AMT",
|
||||
// "BETT_TAX",
|
||||
])
|
||||
);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
return _.transform(
|
||||
_.pick(record, [
|
||||
"LINE_NO",
|
||||
@@ -300,6 +355,7 @@ async function DecodeLinFile(extensionlessFilePath) {
|
||||
"ACT_PRICE",
|
||||
"PART_QTY",
|
||||
"PRICE_J",
|
||||
"GLASS_FLAG",
|
||||
// "CERT_PART",
|
||||
// "ALT_CO_ID",
|
||||
// "ALT_PARTNO",
|
||||
@@ -326,15 +382,16 @@ async function DecodeLinFile(extensionlessFilePath) {
|
||||
// "BETT_PCTG",
|
||||
// "BETT_AMT",
|
||||
// "BETT_TAX",
|
||||
"GLASS_FLAG",
|
||||
]),
|
||||
function (result, val, key) {
|
||||
//Required because unq_seq gets pulled as a numeric instaed of a string.
|
||||
|
||||
console.log(result, val, key);
|
||||
if (key === "UNQ_SEQ") {
|
||||
return (result[key.toLowerCase()] = val.toString());
|
||||
result[key.toLowerCase()] = val.toString();
|
||||
return;
|
||||
}
|
||||
return (result[key.toLowerCase()] = val);
|
||||
result[key.toLowerCase()] = val;
|
||||
return;
|
||||
}
|
||||
);
|
||||
})
|
||||
@@ -395,6 +452,14 @@ async function DecodeLinFile(extensionlessFilePath) {
|
||||
log.info(`Jobline '${jobline.line_desc}' ignored due to wheel repair.`);
|
||||
jobline.ignore = true;
|
||||
}
|
||||
//RPS-46 Ignore NA Line Items.
|
||||
if (
|
||||
jobline.part_type === "PAN" &&
|
||||
jobline.price_j === true &&
|
||||
jobline.db_price === 0
|
||||
) {
|
||||
jobline.ignore = true;
|
||||
}
|
||||
|
||||
//RPS-39 - OEM ON OEM SAVINGS
|
||||
if (
|
||||
@@ -424,15 +489,6 @@ async function DecodeLinFile(extensionlessFilePath) {
|
||||
// jobline.db_price = jobline.act_price;
|
||||
// }
|
||||
|
||||
//RPS-46 Ignore NA Line Items.
|
||||
if (
|
||||
jobline.part_type === "PAN" &&
|
||||
jobline.price_j === true &&
|
||||
jobline.db_price === 0
|
||||
) {
|
||||
jobline.ignore = true;
|
||||
}
|
||||
|
||||
//Update as per Norm from Rod & Waldo - Only Recycled Glass should count towards RPS, not A/M or OEM
|
||||
if (jobline.glass_flag && jobline.part_type !== "PAL") {
|
||||
jobline.ignore = true;
|
||||
|
||||
Reference in New Issue
Block a user