Additional fortellis changes.

This commit is contained in:
Patrick Fic
2025-10-15 15:20:14 -07:00
parent ec30e73b3e
commit c6d083ce02
2 changed files with 62 additions and 40 deletions

View File

@@ -167,6 +167,8 @@ async function MakeFortellisCall({
Authorization: `Bearer ${access_token}`,
"Subscription-Id": SubscriptionMeta.subscriptionId,
"Request-Id": ReqId,
"Content-Type": "application/json",
Accept: "application/json",
...(DepartmentId && { "Department-Id": DepartmentId }),
...headers
}
@@ -178,6 +180,7 @@ async function MakeFortellisCall({
Authorization: `Bearer ${access_token}`,
"Subscription-Id": SubscriptionMeta.subscriptionId,
"Request-Id": ReqId,
Accept: "application/json",
"Department-Id": DepartmentId,
...headers
}
@@ -189,6 +192,8 @@ async function MakeFortellisCall({
Authorization: `Bearer ${access_token}`,
"Subscription-Id": SubscriptionMeta.subscriptionId,
"Request-Id": ReqId,
Accept: "application/json",
"Content-Type": "application/json",
"Department-Id": DepartmentId,
...headers
}
@@ -349,28 +354,28 @@ const FortellisActions = {
? "https://api.fortellis.io/cdk/drive/glpost/startWIP"
: "https://api.fortellis.io/cdk-test/drive/glpost/startWIP",
type: "post",
apiName: "CDK Drive Post Accounting GL"
apiName: "CDK Drive Post Accounts GL"
},
TranBatchWip: {
url: isProduction
? "https://api.fortellis.io/cdk/drive/glpost/transBatchWIP"
: "https://api.fortellis.io/cdk-test/drive/glpost/transBatchWIP",
type: "post",
apiName: "CDK Drive Post Accounting GL"
apiName: "CDK Drive Post Accounts GL"
},
PostBatchWip: {
url: isProduction
? "https://api.fortellis.io/cdk/drive/glpost/postBatchWIP"
: "https://api.fortellis.io/cdk-test/drive/glpost/postBatchWIP",
type: "post",
apiName: "CDK Drive Post Accounting GL"
apiName: "CDK Drive Post Accounts GL"
},
QueryErrorWip: {
url: isProduction
? "https://api.fortellis.io/cdk/drive/glpost/errWIP"
: "https://api.fortellis.io/cdk-test/drive/glpost/errWIP",
? "https://api.fortellis.io/cdk/drive/glpost/errWIP/" //Get requests should have the trailing slash/
: "https://api.fortellis.io/cdk-test/drive/glpost/errWIP/",
type: "get",
apiName: "CDK Drive Post Accounting GL"
apiName: "CDK Drive Post Accounts GL"
},
ServiceHistoryInsert: {
url: isProduction

View File

@@ -252,16 +252,16 @@ async function FortellisSelectedCustomer({ socket, redisHelpers, selectedCustome
CreateFortellisLogEvent(socket, "DEBUG", `{5.1} Creating Transaction with ID ${DMSTransHeader.transID}`);
const DMSBatchTxn = await InsertDmsBatchWip({ socket, redisHelpers, JobData });
await setSessionTransactionData(
socket.id,
getTransactionType(jobid),
FortellisCacheEnums.DMSBatchTxn,
DMSBatchTxn,
defaultFortellisTTL
);
// const DMSBatchTxn = await InsertDmsBatchWip({ socket, redisHelpers, JobData });
// await setSessionTransactionData(
// socket.id,
// getTransactionType(jobid),
// FortellisCacheEnums.DMSBatchTxn,
// DMSBatchTxn,
// defaultFortellisTTL
// );
if (DMSBatchTxn.rtnCode === "0") {
if (DMSTransHeader.rtnCode === "0") {
CreateFortellisLogEvent(socket, "DEBUG", `{6} Attempting to post Transaction with ID ${DMSTransHeader.transID}`);
const DmsBatchTxnPost = await PostDmsBatchWip({ socket, redisHelpers, JobData });
@@ -298,34 +298,36 @@ async function FortellisSelectedCustomer({ socket, redisHelpers, selectedCustome
const DmsError = await QueryDmsErrWip({ socket, redisHelpers, JobData });
// //Delete the transaction
CreateFortellisLogEvent(socket, "DEBUG", `{{ 6.2 } Deleting Transaction ID ${socket.DMSTransHeader.transID}`);
CreateFortellisLogEvent(socket, "DEBUG", `{{ 6.2 } Deleting Transaction ID ${DMSTransHeader.transID}`);
const DmsBatchTxnDelete = await DeleteDmsWip({ socket, redisHelpers, JobData });
DmsError.errMsg
.split("|")
.map(
(e) =>
e !== null &&
e !== "" &&
CreateFortellisLogEvent(socket, "ERROR", `Error(s) encountered in posting transaction.${e} `)
);
DmsError.errMsg.map(
(e) =>
e !== null &&
e !== "" &&
CreateFortellisLogEvent(socket, "ERROR", `Error(s) encountered in posting transaction.${e} `)
);
await InsertFailedExportLog({
socket,
JobData,
error: DmsError.errMsg
});
}
} else {
//Posting transaction failed.
//Creating transaction failed.
CreateFortellisLogEvent(
socket,
"ERROR",
`DMS Batch Return code was not successful: ${DMSBatchTxn.rtnCode} - ${DMSBatchTxn.sendline}`
`DMS Batch Return code was not successful: ${DMSTransHeader.rtnCode} - ${DMSTransHeader.sendline}`
);
await InsertFailedExportLog({
socket,
JobData,
error: `DMS Batch Return code was not successful: ${DMSBatchTxn.rtnCode} - ${DMSBatchTxn.sendline}`
error: `DMS Batch Return code was not successful: ${DMSTransHeader.rtnCode} - ${DMSTransHeader.sendline}`
});
}
} catch (error) {
// CdkBase.createLogEvent(socket, "ERROR", `Error encountered in CdkSelectedCustomer.${ error } `);
CreateFortellisLogEvent(socket, "ERROR", `Error in FortellisSelectedCustomer - ${error} `, {
error: error.message,
stack: error.stack,
@@ -1013,19 +1015,33 @@ async function InsertDmsStartWip({ socket, redisHelpers, JobData }) {
socket,
jobid: JobData.id,
body: {
acctgDate: moment().tz(JobData.bodyshop.timezone).format("YYYY-MM-DD"),
desc: txEnvelope.story && txEnvelope.story.replace(replaceSpecialRegex, ""),
docType: "10",
// acctgDate: moment().tz(JobData.bodyshop.timezone).format("YYYY-MM-DD"),
// desc: txEnvelope.story && txEnvelope.story.replace(replaceSpecialRegex, ""),
// docType: "10",
// m13Flag: "0",
// refer: JobData.ro_number,
// // "rtnCode": "",
// // "sendline": "",
// // "groupName": "",
// srcCo: JobData.bodyshop.cdk_configuration.srcco,
// srcJrnl: txEnvelope.journal,
// transID: "",
// userID: "partprgm" || JobData.bodyshop.cdk_configuration.cashierid,
// userName: "PROGRAM, PARTNER"
acctgDate: "2025-07-07",
desc: "DOCUMENT DESC. OPTIONAL REQUIREMENT",
docType: "3",
m13Flag: "0",
refer: JobData.ro_number,
// "rtnCode": "",
// "sendline": "",
// "groupName": "",
srcCo: JobData.bodyshop.cdk_configuration.srcco,
srcJrnl: txEnvelope.journal,
refer: "707MISC01",
rtnCode: "",
sendline: "",
groupName: "",
srcCo: "77",
srcJrnl: "80",
transID: "",
userID: "csr" || JobData.bodyshop.cdk_configuration.cashierid,
userName: "BSMS"
userID: "partprgm",
userName: "PROGRAM, PARTNER"
}
});
return result;
@@ -1211,7 +1227,8 @@ async function PostDmsBatchWip({ socket, redisHelpers, JobData }) {
jobid: JobData.id,
body: {
opCode: "P",
transID: DMSTransHeader.transID
transID: DMSTransHeader.transID,
transWipReqList: await GenerateTransWips({ socket, redisHelpers, JobData })
}
});
return result;