Add delete DMS wip.
This commit is contained in:
@@ -113,10 +113,7 @@ async function GetDepartmentId({ apiName, debug = false, SubscriptionMeta }) {
|
||||
console.log("===========");
|
||||
console.log(
|
||||
JSON.stringify(
|
||||
SubscriptionMeta.apiDmsInfo.map((a) => ({
|
||||
name: a.name,
|
||||
departments: a.departments.map((d) => d.id)
|
||||
})),
|
||||
SubscriptionMeta.apiDmsInfo,
|
||||
null,
|
||||
4
|
||||
)
|
||||
@@ -346,28 +343,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 Accounts GL WIP",
|
||||
apiName: "CDK Drive Post Accounting 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 Accounts GL WIP",
|
||||
apiName: "CDK Drive Post Accounting 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 Accounts GL WIP",
|
||||
apiName: "CDK Drive Post Accounting GL",
|
||||
},
|
||||
QueryErrorWip: {
|
||||
url: isProduction
|
||||
? "https://api.fortellis.io/cdk/drive/glpost/errWIP"
|
||||
: "https://api.fortellis.io/cdk-test/drive/glpost/errWIP",
|
||||
type: "get",
|
||||
apiName: "CDK Drive Post Accounts GL WIP",
|
||||
apiName: "CDK Drive Post Accounting GL",
|
||||
},
|
||||
ServiceHistoryInsert: {
|
||||
url: isProduction
|
||||
|
||||
@@ -296,20 +296,20 @@ async function FortellisSelectedCustomer({ socket, redisHelpers, selectedCustome
|
||||
|
||||
await QueryDmsErrWip({ socket, redisHelpers, JobData });
|
||||
|
||||
// const DmsError = await QueryDmsErrWip({ socket, redisHelpers, JobData });
|
||||
// socket.DmsError = await QueryDmsErrWip(socket);
|
||||
const DmsError = await QueryDmsErrWip({ socket, redisHelpers, JobData });
|
||||
// //Delete the transaction
|
||||
// CdkBase.createLogEvent(socket, "DEBUG", `{ 6.2 } Deleting Transaction ID ${ socket.DMSTransHeader.transID } `);
|
||||
// socket.DmsBatchTxnPost = await DeleteDmsWip(socket);
|
||||
CreateFortellisLogEvent(socket, "DEBUG", `{{ 6.2 } Deleting Transaction ID ${socket.DMSTransHeader.transID}`);
|
||||
|
||||
// socket.DmsError.errMsg
|
||||
// .split("|")
|
||||
// .map(
|
||||
// (e) =>
|
||||
// e !== null &&
|
||||
// e !== "" &&
|
||||
// CdkBase.createLogEvent(socket, "ERROR", `Error(s) encountered in posting transaction.${ e } `)
|
||||
// );
|
||||
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} `)
|
||||
);
|
||||
}
|
||||
} else {
|
||||
//Posting transaction failed.
|
||||
@@ -318,12 +318,15 @@ async function FortellisSelectedCustomer({ socket, redisHelpers, selectedCustome
|
||||
"ERROR",
|
||||
`DMS Batch Return code was not successful: ${DMSBatchTxn.rtnCode} - ${DMSBatchTxn.sendline}`
|
||||
);
|
||||
await InsertFailedExportLog({ socket, JobData, error: `DMS Batch Return code was not successful: ${DMSBatchTxn.rtnCode} - ${DMSBatchTxn.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
|
||||
stack: error.stack,
|
||||
data: error.errorData
|
||||
});
|
||||
await InsertFailedExportLog({ socket, JobData, error });
|
||||
} finally {
|
||||
@@ -1015,12 +1018,13 @@ async function InsertDmsStartWip({ socket, redisHelpers, JobData }) {
|
||||
// "rtnCode": "",
|
||||
// "sendline": "",
|
||||
// "groupName": "",
|
||||
srcCo: JobData.bodyshop.cdk_configuration.srcco,
|
||||
srcJrnl: txEnvelope.journal,
|
||||
transID: "",
|
||||
userID: JobData.bodyshop.cdk_configuration.cashierid,
|
||||
userName: "BSMS"
|
||||
}
|
||||
"srcCo": JobData.bodyshop.cdk_configuration.srcco,
|
||||
"srcJrnl": txEnvelope.journal,
|
||||
"transID": "",
|
||||
"userID": "csr" || JobData.bodyshop.cdk_configuration.cashierid,
|
||||
"userName": "BSMS"
|
||||
},
|
||||
|
||||
});
|
||||
return result;
|
||||
} catch (error) {
|
||||
@@ -1234,11 +1238,12 @@ async function QueryDmsErrWip({ socket, redisHelpers, JobData }) {
|
||||
socket,
|
||||
jobid: JobData.id,
|
||||
requestPathParams: DMSTransHeader.transID,
|
||||
body: {}
|
||||
body: {
|
||||
}
|
||||
});
|
||||
return result;
|
||||
} catch (error) {
|
||||
handleFortellisApiError(socket, error, "PostDmsBatchWip", {
|
||||
handleFortellisApiError(socket, error, "QueryDmsErrWip", {
|
||||
transId: DMSTransHeader?.transID,
|
||||
jobId: JobData.id
|
||||
});
|
||||
@@ -1246,36 +1251,33 @@ async function QueryDmsErrWip({ socket, redisHelpers, JobData }) {
|
||||
}
|
||||
}
|
||||
|
||||
// async function DeleteDmsWip(socket) {
|
||||
// try {
|
||||
// const soapClientAccountingGLInsertUpdate = await soap.createClientAsync(CdkWsdl.AccountingGLInsertUpdate);
|
||||
async function DeleteDmsWip({ socket, redisHelpers, JobData }) {
|
||||
|
||||
// const soapResponseAccountingGLInsertUpdate = await soapClientAccountingGLInsertUpdate.doPostBatchWIPAsync({
|
||||
// arg0: CDK_CREDENTIALS,
|
||||
// arg1: { dealerId: socket.JobData.bodyshop.cdk_dealerid },
|
||||
// arg2: {
|
||||
// postWIP: { opCode: "D", transID: socket.DMSTransHeader.transID }
|
||||
// }
|
||||
// });
|
||||
let DMSTransHeader;
|
||||
try {
|
||||
DMSTransHeader = await redisHelpers.getSessionTransactionData(socket.id, getTransactionType(JobData.id), FortellisCacheEnums.DMSTransHeader);
|
||||
|
||||
// const [result, rawResponse, , rawRequest] = soapResponseAccountingGLInsertUpdate;
|
||||
|
||||
// CdkBase.createXmlEvent(socket, rawRequest, `soapClientAccountingGLInsertUpdate.doPostBatchWIPAsync request.`);
|
||||
|
||||
// CdkBase.createLogEvent(
|
||||
// socket,
|
||||
// "SILLY",
|
||||
// `soapClientAccountingGLInsertUpdate.doPostBatchWIPAsync Result ${JSON.stringify(result, null, 2)}`
|
||||
// );
|
||||
// CdkBase.createXmlEvent(socket, rawResponse, `soapClientAccountingGLInsertUpdate.doPostBatchWIPAsync response.`);
|
||||
// CheckCdkResponseForError(socket, soapResponseAccountingGLInsertUpdate);
|
||||
// const PostResult = result && result.return;
|
||||
// return PostResult;
|
||||
// } catch (error) {
|
||||
// CdkBase.createLogEvent(socket, "ERROR", `Error in PostDmsBatchWip - ${error}`);
|
||||
// throw new Error(error);
|
||||
// }
|
||||
// }
|
||||
const result = await MakeFortellisCall({
|
||||
...FortellisActions.PostBatchWip,
|
||||
headers: {},
|
||||
redisHelpers,
|
||||
socket,
|
||||
jobid: JobData.id,
|
||||
body: {
|
||||
"opCode": "D",
|
||||
"transID": DMSTransHeader.transID
|
||||
}
|
||||
});
|
||||
return result;
|
||||
} catch (error) {
|
||||
handleFortellisApiError(socket, error, "DeleteDmsWip", {
|
||||
transId: DMSTransHeader?.transID,
|
||||
jobId: JobData.id
|
||||
});
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
async function MarkJobExported({ socket, jobid }) {
|
||||
CreateFortellisLogEvent(socket, "ERROR", `Marking job as exported for id ${jobid}`);
|
||||
|
||||
Reference in New Issue
Block a user