IO-1917 Autohouse handling for DMS.
This commit is contained in:
@@ -216,7 +216,7 @@ server.listen(port, (error) => {
|
|||||||
if (error) throw error;
|
if (error) throw error;
|
||||||
logger.log(
|
logger.log(
|
||||||
`[${process.env.NODE_ENV || "DEVELOPMENT"}] Server running on port ${port}`,
|
`[${process.env.NODE_ENV || "DEVELOPMENT"}] Server running on port ${port}`,
|
||||||
"DEBUG",
|
"INFO",
|
||||||
"api"
|
"api"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -665,6 +665,7 @@ const CreateRepairOrderTag = (job, errorCallback) => {
|
|||||||
const CreateCosts = (job) => {
|
const CreateCosts = (job) => {
|
||||||
//Create a mapping based on AH Requirements
|
//Create a mapping based on AH Requirements
|
||||||
|
|
||||||
|
//For DMS, the keys in the object below are the CIECA part types.
|
||||||
const billTotalsByCostCenters = job.bills.reduce((bill_acc, bill_val) => {
|
const billTotalsByCostCenters = job.bills.reduce((bill_acc, bill_val) => {
|
||||||
//At the bill level.
|
//At the bill level.
|
||||||
bill_val.billlines.map((line_val) => {
|
bill_val.billlines.map((line_val) => {
|
||||||
@@ -731,7 +732,7 @@ const CreateCosts = (job) => {
|
|||||||
}).multiply(job.job_totals.rates.mash.hours)
|
}).multiply(job.job_totals.rates.mash.hours)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
//Uses CIECA Labor types.
|
||||||
const ticketTotalsByCostCenter = job.timetickets.reduce(
|
const ticketTotalsByCostCenter = job.timetickets.reduce(
|
||||||
(ticket_acc, ticket_val) => {
|
(ticket_acc, ticket_val) => {
|
||||||
//At the invoice level.
|
//At the invoice level.
|
||||||
@@ -750,7 +751,43 @@ const CreateCosts = (job) => {
|
|||||||
},
|
},
|
||||||
{}
|
{}
|
||||||
);
|
);
|
||||||
const defaultCosts = job.bodyshop.md_responsibility_centers.defaults.costs;
|
//CIECA STANDARD MAPPING OBJECT.
|
||||||
|
|
||||||
|
const ciecaObj = {
|
||||||
|
ATS: "ATS",
|
||||||
|
LA1: "LA1",
|
||||||
|
LA2: "LA2",
|
||||||
|
LA3: "LA3",
|
||||||
|
LA4: "LA4",
|
||||||
|
LAA: "LAA",
|
||||||
|
LAB: "LAB",
|
||||||
|
LAD: "LAD",
|
||||||
|
LAE: "LAE",
|
||||||
|
LAF: "LAF",
|
||||||
|
LAG: "LAG",
|
||||||
|
LAM: "LAM",
|
||||||
|
LAR: "LAR",
|
||||||
|
LAS: "LAS",
|
||||||
|
LAU: "LAU",
|
||||||
|
PAA: "PAA",
|
||||||
|
PAC: "PAC",
|
||||||
|
PAG: "PAG",
|
||||||
|
PAL: "PAL",
|
||||||
|
PAM: "PAM",
|
||||||
|
PAN: "PAN",
|
||||||
|
PAO: "PAO",
|
||||||
|
PAP: "PAP",
|
||||||
|
PAR: "PAR",
|
||||||
|
PAS: "PAS",
|
||||||
|
TOW: "TOW",
|
||||||
|
MAPA: "MAPA",
|
||||||
|
MASH: "MASH",
|
||||||
|
PASL: "PASL",
|
||||||
|
};
|
||||||
|
const defaultCosts =
|
||||||
|
job.bodyshop.cdk_dealerid || job.bodyshop.pbs_serialnumber
|
||||||
|
? ciecaObj
|
||||||
|
: job.bodyshop.md_responsibility_centers.defaults.costs;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
PartsTotalCost: Object.keys(billTotalsByCostCenters).reduce((acc, key) => {
|
PartsTotalCost: Object.keys(billTotalsByCostCenters).reduce((acc, key) => {
|
||||||
|
|||||||
@@ -611,6 +611,8 @@ exports.AUTOHOUSE_QUERY = `query AUTOHOUSE_EXPORT($start: timestamptz, $bodyshop
|
|||||||
autohouseid
|
autohouseid
|
||||||
md_responsibility_centers
|
md_responsibility_centers
|
||||||
jc_hourly_rates
|
jc_hourly_rates
|
||||||
|
cdk_dealerid
|
||||||
|
pbs_serialnumber
|
||||||
timezone
|
timezone
|
||||||
}
|
}
|
||||||
jobs(where: {_and: [{converted: {_eq: true}}, {updated_at: {_gt: $start}}, {updated_at: {_lte: $end}}, {shopid: {_eq: $bodyshopid}}]}) {
|
jobs(where: {_and: [{converted: {_eq: true}}, {updated_at: {_gt: $start}}, {updated_at: {_lte: $end}}, {shopid: {_eq: $bodyshopid}}]}) {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ const logger = new graylog2.graylog({
|
|||||||
});
|
});
|
||||||
|
|
||||||
function log(message, type, user, record, object) {
|
function log(message, type, user, record, object) {
|
||||||
if (type !== "ioevent")
|
if (type !== "ioevent" && type !== "DEBUG")
|
||||||
console.log(message, {
|
console.log(message, {
|
||||||
type,
|
type,
|
||||||
env: process.env.NODE_ENV || "development",
|
env: process.env.NODE_ENV || "development",
|
||||||
|
|||||||
Reference in New Issue
Block a user