IO-233 Begin Trans Headers
This commit is contained in:
@@ -149,9 +149,22 @@ async function CdkSelectedCustomer(socket, selectedCustomerId) {
|
||||
CdkBase.createLogEvent(
|
||||
socket,
|
||||
"DEBUG",
|
||||
`{5}Updating Service Vehicle History.`
|
||||
`{5} Updating Service Vehicle History. *** THIS IS CURRENTLY BEING SKIPPED DUE TO AN INCORRECT CASHIER ID PROVIDED BY CDK ***`
|
||||
);
|
||||
await InsertServiceVehicleHistory(socket);
|
||||
//await InsertServiceVehicleHistory(socket);
|
||||
|
||||
CdkBase.createLogEvent(
|
||||
socket,
|
||||
"DEBUG",
|
||||
`{6} Creating Transaction header with Dms Start WIP`
|
||||
);
|
||||
socket.DMSTransHeader = await InsertDmsStartWip(socket);
|
||||
CdkBase.createLogEvent(
|
||||
socket,
|
||||
"DEBUG",
|
||||
`{6} Creating Transaction with ID ${socket.DMSTransHeader.transID}`
|
||||
);
|
||||
socket.DMSBatchTxn = await InsertDmsBatchWip(socket);
|
||||
} catch (error) {
|
||||
CdkBase.createLogEvent(
|
||||
socket,
|
||||
@@ -751,7 +764,7 @@ async function InsertServiceVehicleHistory(socket) {
|
||||
closeDate: moment(socket.JobData.invoice_date).format("YYYY-MM-DD"),
|
||||
closeTime: moment(socket.JobData.invoice_date).format("HH:MM:SS"),
|
||||
comments: socket.txEnvelope.story,
|
||||
cashierID: socket.JobData.bodyshop.cdk_configuration.cashierid, //NEEDS TO BE PROVIDED BY DEALER.
|
||||
cashierID: socket.JobData.bodyshop.cdk_configuration.cashierid,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -797,19 +810,19 @@ async function InsertDmsStartWip(socket) {
|
||||
);
|
||||
|
||||
const soapResponseAccountingGLInsertUpdate =
|
||||
await soapClientAccountingGLInsertUpdate.startWIPAsync({
|
||||
await soapClientAccountingGLInsertUpdate.doStartWIPAsync({
|
||||
arg0: CDK_CREDENTIALS,
|
||||
arg1: { id: socket.JobData.bodyshop.cdk_dealerid },
|
||||
arg1: { dealerId: socket.JobData.bodyshop.cdk_dealerid },
|
||||
arg2: {
|
||||
acctgDate: moment().toISOString(),
|
||||
desc: socket.txEnvelope.story,
|
||||
docType: 7 || 10, //Need to check what this usually would be?
|
||||
docType: 10 || 7, //Need to check what this usually would be? Apparently it is almost always 10 or 7.
|
||||
//1 Cash Receipt , 2 Check, 3 Journal Voucher, 4 Parts invoice, 5 Payable Invoice, 6 Recurring Entry, 7 Repair Order Invoice, 8 Vehicle Purchase Invoice, 9 Vehicle Sale Invoice, 10 Other, 11 Payroll, 12 Finance Charge, 13 FMLR Invoice, 14 Parts Credit Memo, 15 Manufacturer Document, 16 FMLR Credit Memo
|
||||
m13Flag: 0,
|
||||
refer: socket.JobData.ro_number,
|
||||
srcCo: socket.txEnvelope.journal,
|
||||
srcCo: socket.JobData.bodyshop.cdk_configuration.srcco,
|
||||
srcJrnl: socket.txEnvelope.journal,
|
||||
userID: "?", //Where is this coming from?
|
||||
userID: socket.JobData.bodyshop.cdk_configuration.cashierid, //Where is this coming from?
|
||||
//userName: "IMEX",
|
||||
},
|
||||
});
|
||||
@@ -820,13 +833,13 @@ async function InsertDmsStartWip(socket) {
|
||||
CdkBase.createXmlEvent(
|
||||
socket,
|
||||
rawRequest,
|
||||
`soapClientAccountingGLInsertUpdate.startWIPAsync request.`
|
||||
`soapClientAccountingGLInsertUpdate.doStartWIPAsync request.`
|
||||
);
|
||||
|
||||
CdkBase.createLogEvent(
|
||||
socket,
|
||||
"TRACE",
|
||||
`soapClientAccountingGLInsertUpdate.startWIPAsync Result ${JSON.stringify(
|
||||
`soapClientAccountingGLInsertUpdate.doStartWIPAsync Result ${JSON.stringify(
|
||||
result,
|
||||
null,
|
||||
2
|
||||
@@ -835,16 +848,76 @@ async function InsertDmsStartWip(socket) {
|
||||
CdkBase.createXmlEvent(
|
||||
socket,
|
||||
rawResponse,
|
||||
`soapClientAccountingGLInsertUpdate.startWIPAsync response.`
|
||||
`soapClientAccountingGLInsertUpdate.doStartWIPAsync response.`
|
||||
);
|
||||
CheckCdkResponseForError(socket, soapResponseAccountingGLInsertUpdate);
|
||||
const VehicleFromDMS = result && result.return && result.return.vehicle;
|
||||
return VehicleFromDMS;
|
||||
const TransactionHeader = result && result.return;
|
||||
return TransactionHeader;
|
||||
} catch (error) {
|
||||
CdkBase.createLogEvent(
|
||||
socket,
|
||||
"ERROR",
|
||||
`Error in QueryDmsVehicleById - ${error}`
|
||||
`Error in InsertDmsStartWip - ${error}`
|
||||
);
|
||||
throw new Error(error);
|
||||
}
|
||||
}
|
||||
|
||||
async function InsertDmsBatchWip(socket) {
|
||||
try {
|
||||
const soapClientAccountingGLInsertUpdate = await soap.createClientAsync(
|
||||
CdkWsdl.AccountingGLInsertUpdate
|
||||
);
|
||||
|
||||
const soapResponseAccountingGLInsertUpdate =
|
||||
await soapClientAccountingGLInsertUpdate.doTransBatchWIPAsync({
|
||||
arg0: CDK_CREDENTIALS,
|
||||
arg1: { dealerId: socket.JobData.bodyshop.cdk_dealerid },
|
||||
arg2: {
|
||||
acctgDate: moment().toISOString(),
|
||||
desc: socket.txEnvelope.story,
|
||||
docType: 10 || 7, //Need to check what this usually would be? Apparently it is almost always 10 or 7.
|
||||
//1 Cash Receipt , 2 Check, 3 Journal Voucher, 4 Parts invoice, 5 Payable Invoice, 6 Recurring Entry, 7 Repair Order Invoice, 8 Vehicle Purchase Invoice, 9 Vehicle Sale Invoice, 10 Other, 11 Payroll, 12 Finance Charge, 13 FMLR Invoice, 14 Parts Credit Memo, 15 Manufacturer Document, 16 FMLR Credit Memo
|
||||
m13Flag: 0,
|
||||
refer: socket.JobData.ro_number,
|
||||
srcCo: socket.JobData.bodyshop.cdk_configuration.srcco,
|
||||
srcJrnl: socket.txEnvelope.journal,
|
||||
userID: socket.JobData.bodyshop.cdk_configuration.cashierid, //Where is this coming from?
|
||||
//userName: "IMEX",
|
||||
},
|
||||
});
|
||||
|
||||
const [result, rawResponse, , rawRequest] =
|
||||
soapResponseAccountingGLInsertUpdate;
|
||||
|
||||
CdkBase.createXmlEvent(
|
||||
socket,
|
||||
rawRequest,
|
||||
`soapClientAccountingGLInsertUpdate.doTransBatchWIPAsync request.`
|
||||
);
|
||||
|
||||
CdkBase.createLogEvent(
|
||||
socket,
|
||||
"TRACE",
|
||||
`soapClientAccountingGLInsertUpdate.doTransBatchWIPAsync Result ${JSON.stringify(
|
||||
result,
|
||||
null,
|
||||
2
|
||||
)}`
|
||||
);
|
||||
CdkBase.createXmlEvent(
|
||||
socket,
|
||||
rawResponse,
|
||||
`soapClientAccountingGLInsertUpdate.doTransBatchWIPAsync response.`
|
||||
);
|
||||
CheckCdkResponseForError(socket, soapResponseAccountingGLInsertUpdate);
|
||||
const TransactionHeader = result && result.return;
|
||||
return TransactionHeader;
|
||||
} catch (error) {
|
||||
CdkBase.createLogEvent(
|
||||
socket,
|
||||
"ERROR",
|
||||
`Error in InsertDmsBatchWip - ${error}`
|
||||
);
|
||||
throw new Error(error);
|
||||
}
|
||||
|
||||
@@ -180,6 +180,7 @@ query QUERY_JOBS_FOR_CDK_EXPORT($id: uuid!) {
|
||||
md_responsibility_centers
|
||||
accountingconfig
|
||||
cdk_dealerid
|
||||
cdk_configuration
|
||||
}
|
||||
owner {
|
||||
accountingid
|
||||
|
||||
Reference in New Issue
Block a user