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