IO-223 ARMS WIP
This commit is contained in:
@@ -100,7 +100,7 @@ export function JobsAvailableContainer({
|
|||||||
}
|
}
|
||||||
//IO-539 Check for Parts Rate on PAL for SGI use case.
|
//IO-539 Check for Parts Rate on PAL for SGI use case.
|
||||||
await CheckTaxRates(estData.est_data, bodyshop);
|
await CheckTaxRates(estData.est_data, bodyshop);
|
||||||
console.log(estData);
|
|
||||||
const newTotals = (
|
const newTotals = (
|
||||||
await Axios.post("/job/totals", {
|
await Axios.post("/job/totals", {
|
||||||
job: {
|
job: {
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ exports.default = async (req, res) => {
|
|||||||
});
|
});
|
||||||
const ret = jobs.map((job) => {
|
const ret = jobs.map((job) => {
|
||||||
const transId = uuid(); // Can this actually be the job id?
|
const transId = uuid(); // Can this actually be the job id?
|
||||||
|
|
||||||
return {
|
return {
|
||||||
RqUID: transId,
|
RqUID: transId,
|
||||||
DocumentInfo: {
|
DocumentInfo: {
|
||||||
@@ -781,16 +782,17 @@ exports.default = async (req, res) => {
|
|||||||
logger.log("arms-end-shop-extract", "DEBUG", "api", bodyshop.id, {
|
logger.log("arms-end-shop-extract", "DEBUG", "api", bodyshop.id, {
|
||||||
shopname: bodyshop.shopname,
|
shopname: bodyshop.shopname,
|
||||||
});
|
});
|
||||||
console.log(
|
const abc = ret[1];
|
||||||
new Buffer.from(
|
deleteNullKeys(abc);
|
||||||
`${process.env.ENTEGRAL_USER}:${process.env.ENTEGRAL_PASSWORD}`
|
|
||||||
).toString("base64")
|
|
||||||
);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const entegralSoapClient = await soap.createClientAsync(
|
const entegralSoapClient = await soap.createClientAsync(
|
||||||
entegralEndpoint,
|
entegralEndpoint,
|
||||||
{
|
{
|
||||||
|
ignoredNamespaces: true,
|
||||||
|
wsdl_options: {
|
||||||
|
useEmptyTag: true,
|
||||||
|
},
|
||||||
wsdl_headers: {
|
wsdl_headers: {
|
||||||
Authorization: `Basic ${new Buffer.from(
|
Authorization: `Basic ${new Buffer.from(
|
||||||
`${process.env.ENTEGRAL_USER}:${process.env.ENTEGRAL_PASSWORD}`
|
`${process.env.ENTEGRAL_USER}:${process.env.ENTEGRAL_PASSWORD}`
|
||||||
@@ -807,15 +809,15 @@ exports.default = async (req, res) => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const entegralResponse =
|
const entegralResponse =
|
||||||
await entegralSoapClient.RepairOrderFolderAddRqAsync(ret[0]);
|
await entegralSoapClient.RepairOrderFolderAddRqAsync(abc);
|
||||||
|
|
||||||
const [result, rawResponse, , rawRequest] = entegralResponse;
|
const [result, rawResponse, , rawRequest] = entegralResponse;
|
||||||
console.log("🚀 ~ file: arms.js ~ line 806 ~ result", result);
|
console.log("🚀 ~ file: arms.js ~ line 806 ~ result", result);
|
||||||
|
res.json(result);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
|
res.json(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
res.json(ret);
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
//Error at the shop level.
|
//Error at the shop level.
|
||||||
logger.log("arms-error-shop", "ERROR", "api", bodyshop.id, {
|
logger.log("arms-error-shop", "ERROR", "api", bodyshop.id, {
|
||||||
@@ -844,6 +846,7 @@ exports.default = async (req, res) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
function GetSupplementNumber(joblines) {
|
function GetSupplementNumber(joblines) {
|
||||||
|
return 0;
|
||||||
return _.max(joblines.map((jl) => jl.line_ind));
|
return _.max(joblines.map((jl) => jl.line_ind));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -853,10 +856,10 @@ function GetDocumentstatus(job, bodyshop) {
|
|||||||
return "V";
|
return "V";
|
||||||
case bodyshop.md_ro_statuses.default_invoiced:
|
case bodyshop.md_ro_statuses.default_invoiced:
|
||||||
case bodyshop.md_ro_statuses.default_exported:
|
case bodyshop.md_ro_statuses.default_exported:
|
||||||
return "V";
|
return "Z";
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return "0";
|
return "O";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -866,3 +869,24 @@ function GetRepairStatusCode(job) {
|
|||||||
function GetProductionStageCode(job) {
|
function GetProductionStageCode(job) {
|
||||||
return "33";
|
return "33";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isEmpty(obj) {
|
||||||
|
for (var key in obj) return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function deleteNullKeys(app) {
|
||||||
|
for (var key in app) {
|
||||||
|
if (app[key] !== null && typeof app[key] === "object") {
|
||||||
|
deleteNullKeys(app[key]);
|
||||||
|
|
||||||
|
if (isEmpty(app[key])) {
|
||||||
|
delete app[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (app[key] === null) {
|
||||||
|
delete app[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user