Merged in release/2022-01-28 (pull request #357)

release/2022-01-28

Approved-by: Patrick Fic
This commit is contained in:
Patrick Fic
2022-01-24 21:44:40 +00:00
4 changed files with 41 additions and 28 deletions

View File

@@ -171,7 +171,7 @@ export function JobChecklistForm({
}); });
} }
}; };
console.log(job,{ console.log(job, {
removeFromProduction: true, removeFromProduction: true,
actual_completion: actual_completion:
job && job.actual_completion && moment(job.actual_completion), job && job.actual_completion && moment(job.actual_completion),
@@ -212,7 +212,8 @@ export function JobChecklistForm({
0) / bodyshop.target_touchtime, 0) / bodyshop.target_touchtime,
"days" "days"
)), )),
scheduled_delivery: job && moment(job.scheduled_delivery), scheduled_delivery:
job.scheduled_delivery && moment(job.scheduled_delivery),
}), }),
...(type === "deliver" && { ...(type === "deliver" && {
removeFromProduction: true, removeFromProduction: true,

View File

@@ -65,7 +65,11 @@ exports.default = async function (socket, { txEnvelope, jobid }) {
const JobData = await QueryJobData(socket, jobid); const JobData = await QueryJobData(socket, jobid);
socket.JobData = JobData; socket.JobData = JobData;
CdkBase.createLogEvent(
socket,
"DEBUG",
`Querying the DMS for the Vehicle Record.`
);
//Query for the Vehicle record to get the associated customer. //Query for the Vehicle record to get the associated customer.
socket.DmsVeh = await QueryVehicleFromDms(socket); socket.DmsVeh = await QueryVehicleFromDms(socket);
//Todo: Need to validate the lines and methods below. //Todo: Need to validate the lines and methods below.
@@ -121,7 +125,11 @@ exports.PbsSelectedCustomer = async function PbsSelectedCustomer(
); );
await UpsertVehicleData(socket, ownerRef.ReferenceId); await UpsertVehicleData(socket, ownerRef.ReferenceId);
CdkBase.createLogEvent(socket, "DEBUG", `Inserting account data.`); CdkBase.createLogEvent(socket, "DEBUG", `Inserting account data.`);
CdkBase.createLogEvent(
socket,
"DEBUG",
`Inserting accounting posting data..`
);
await InsertAccountPostingData(socket); await InsertAccountPostingData(socket);
CdkBase.createLogEvent(socket, "DEBUG", `Marking job as exported.`); CdkBase.createLogEvent(socket, "DEBUG", `Marking job as exported.`);

View File

@@ -37,12 +37,15 @@ exports.default = async (req, res) => {
//Query for the List of Bodyshop Clients. //Query for the List of Bodyshop Clients.
logger.log("autohouse-start", "DEBUG", "api", null, null); logger.log("autohouse-start", "DEBUG", "api", null, null);
const { bodyshops } = await client.request(queries.GET_AUTOHOUSE_SHOPS); const { bodyshops } = await client.request(queries.GET_AUTOHOUSE_SHOPS);
639;
const specificShopIds = req.body.bodyshopIds; // ['uuid]
const start = req.body.start; //YYYY-MM-DD
const allxmlsToUpload = []; const allxmlsToUpload = [];
const allErrors = []; const allErrors = [];
try { try {
for (const bodyshop of bodyshops) { for (const bodyshop of specificShopIds
? bodyshops.filter((b) => specificShopIds.includes(b.id))
: bodyshops) {
logger.log("autohouse-start-shop-extract", "DEBUG", "api", bodyshop.id, { logger.log("autohouse-start-shop-extract", "DEBUG", "api", bodyshop.id, {
shopname: bodyshop.shopname, shopname: bodyshop.shopname,
}); });
@@ -52,7 +55,9 @@ exports.default = async (req, res) => {
queries.AUTOHOUSE_QUERY, queries.AUTOHOUSE_QUERY,
{ {
bodyshopid: bodyshop.id, bodyshopid: bodyshop.id,
start: moment().subtract(3, "days").startOf("day"), start: start
? moment(start).startOf("day")
: moment().subtract(3, "days").startOf("day"),
} }
); );
@@ -118,12 +123,12 @@ exports.default = async (req, res) => {
} }
} }
for (const xmlObj of allxmlsToUpload) { // for (const xmlObj of allxmlsToUpload) {
fs.writeFileSync(`./logs/${xmlObj.filename}`, xmlObj.xml); // fs.writeFileSync(`./logs/${xmlObj.filename}`, xmlObj.xml);
} // }
res.json(allxmlsToUpload); // res.json(allxmlsToUpload);
return; // return;
let sftp = new Client(); let sftp = new Client();
sftp.on("error", (errors) => sftp.on("error", (errors) =>

View File

@@ -174,23 +174,22 @@ function createJsonEvent(socket, level, message, json) {
level, level,
message, message,
}); });
logger.log("ws-log-event-json", level, socket.user.email, socket.recordid, {
wsmessage: message,
json
});
if (socket.logEvents && isArray(socket.logEvents)) {
socket.logEvents.push({
timestamp: new Date(),
level,
message,
});
}
// if (level === "ERROR") {
// throw new Error(message);
// }
} }
logger.log("ws-log-event-json", level, socket.user.email, socket.recordid, {
wsmessage: message,
json,
});
if (socket.logEvents && isArray(socket.logEvents)) {
socket.logEvents.push({
timestamp: new Date(),
level,
message,
});
}
// if (level === "ERROR") {
// throw new Error(message);
// }
} }
function createXmlEvent(socket, xml, message, isError = false) { function createXmlEvent(socket, xml, message, isError = false) {