IO-233 CDK Get Makes & Taxes calculation.
This commit is contained in:
@@ -4,6 +4,7 @@ import { useTranslation } from "react-i18next";
|
|||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
|
import Dinero from "dinero.js";
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
//currentUser: selectCurrentUser
|
//currentUser: selectCurrentUser
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
@@ -29,11 +30,13 @@ export function DmsAllocationsSummary({ socket, bodyshop, jobId }) {
|
|||||||
title: t("jobs.fields.dms.sale"),
|
title: t("jobs.fields.dms.sale"),
|
||||||
dataIndex: "sale",
|
dataIndex: "sale",
|
||||||
key: "sale",
|
key: "sale",
|
||||||
|
render: (text, record) => Dinero(record.sale).toFormat(),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t("jobs.fields.dms.cost"),
|
title: t("jobs.fields.dms.cost"),
|
||||||
dataIndex: "cost",
|
dataIndex: "cost",
|
||||||
key: "cost",
|
key: "cost",
|
||||||
|
render: (text, record) => Dinero(record.cost).toFormat(),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t("jobs.fields.dms.sale_dms_acctnumber"),
|
title: t("jobs.fields.dms.sale_dms_acctnumber"),
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { Modal, Button, Table } from "antd";
|
import { Modal, Button, Table, Input } from "antd";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
//currentUser: selectCurrentUser
|
//currentUser: selectCurrentUser
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
@@ -14,26 +16,96 @@ export default connect(mapStateToProps, mapDispatchToProps)(DmsCdkMakes);
|
|||||||
|
|
||||||
export function DmsCdkMakes({ bodyshop, form, socket }) {
|
export function DmsCdkMakes({ bodyshop, form, socket }) {
|
||||||
const [makesList, setMakesList] = useState([]);
|
const [makesList, setMakesList] = useState([]);
|
||||||
|
const [searchText, setSearchText] = useState("");
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const [visible, setVisible] = useState(false);
|
const [visible, setVisible] = useState(false);
|
||||||
|
const [selectedModel, setSelectedModel] = useState(null);
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const columns = [
|
||||||
|
{
|
||||||
|
title: t("jobs.fields.dms.makeFullName"),
|
||||||
|
dataIndex: "makeFullName",
|
||||||
|
key: "makeFullName",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t("jobs.fields.dms.modelFullName"),
|
||||||
|
dataIndex: "modelFullName",
|
||||||
|
key: "modelFullName",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t("jobs.fields.dms.makeCode"),
|
||||||
|
dataIndex: "makeCode",
|
||||||
|
key: "makeCode",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t("jobs.fields.dms.modelCode"),
|
||||||
|
dataIndex: "modelCode",
|
||||||
|
key: "modelCode",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const filteredMakes =
|
||||||
|
searchText !== "" && searchText
|
||||||
|
? makesList.filter(
|
||||||
|
(make) =>
|
||||||
|
searchText
|
||||||
|
.split(" ")
|
||||||
|
.some((v) =>
|
||||||
|
make.makeFullName.toLowerCase().includes(v.toLowerCase())
|
||||||
|
) ||
|
||||||
|
searchText
|
||||||
|
.split(" ")
|
||||||
|
.some((v) =>
|
||||||
|
make.modelFullName.toLowerCase().includes(v.toLowerCase())
|
||||||
|
)
|
||||||
|
)
|
||||||
|
: makesList;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Modal visible={visible} onCancel={() => setVisible(false)}>
|
<Modal width={"90%"} visible={visible} onCancel={() => setVisible(false)}>
|
||||||
{JSON.stringify(makesList, null, 2)}
|
<Table
|
||||||
<Table loading={loading} data={makesList} />
|
title={() => (
|
||||||
|
<Input.Search
|
||||||
|
onSearch={(val) => setSearchText(val)}
|
||||||
|
placeholder={t("general.labels.search")}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
columns={columns}
|
||||||
|
loading={loading}
|
||||||
|
id="id"
|
||||||
|
dataSource={filteredMakes}
|
||||||
|
onRow={(record) => {
|
||||||
|
return {
|
||||||
|
onClick: setSelectedModel(record),
|
||||||
|
};
|
||||||
|
}}
|
||||||
|
rowSelection={{
|
||||||
|
onSelect: (record, selected, ...props) => {
|
||||||
|
console.log(
|
||||||
|
"🚀 ~ file: dms-cdk-makes.component.jsx ~ line 85 ~ record, selected, ...props",
|
||||||
|
record,
|
||||||
|
selected,
|
||||||
|
...props
|
||||||
|
);
|
||||||
|
|
||||||
|
setSelectedModel(record);
|
||||||
|
},
|
||||||
|
|
||||||
|
type: "radio",
|
||||||
|
selectedRowKeys: [selectedModel && selectedModel.id],
|
||||||
|
}}
|
||||||
|
/>
|
||||||
</Modal>
|
</Modal>
|
||||||
<Button
|
<Button
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setVisible(true);
|
setVisible(true);
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
socket.emit(
|
socket.emit("cdk-get-makes", bodyshop.cdk_dealerid, (makes) => {
|
||||||
"cdk-get-makes",
|
console.log("Called back", makes);
|
||||||
(bodyshop.cdk_dealerid,
|
setMakesList(makes);
|
||||||
(makes) => {
|
setLoading(false);
|
||||||
setMakesList(makes);
|
});
|
||||||
setLoading(false);
|
|
||||||
})
|
|
||||||
);
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Get Makes
|
Get Makes
|
||||||
|
|||||||
@@ -2336,6 +2336,25 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) {
|
|||||||
>
|
>
|
||||||
<Input />
|
<Input />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
{bodyshop.cdk_dealerid && (
|
||||||
|
<Form.Item
|
||||||
|
label={t("bodyshop.fields.responsibilitycenter_dms_acctnumber")}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
//message: t("general.validation.required"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
name={[
|
||||||
|
"md_responsibility_centers",
|
||||||
|
"taxes",
|
||||||
|
"federal",
|
||||||
|
"dms_acctnumber",
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Input />
|
||||||
|
</Form.Item>
|
||||||
|
)}
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("bodyshop.fields.responsibilitycenter_rate")}
|
label={t("bodyshop.fields.responsibilitycenter_rate")}
|
||||||
rules={[
|
rules={[
|
||||||
@@ -2415,6 +2434,25 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) {
|
|||||||
>
|
>
|
||||||
<Input />
|
<Input />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
{bodyshop.cdk_dealerid && (
|
||||||
|
<Form.Item
|
||||||
|
label={t("bodyshop.fields.responsibilitycenter_dms_acctnumber")}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
//message: t("general.validation.required"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
name={[
|
||||||
|
"md_responsibility_centers",
|
||||||
|
"taxes",
|
||||||
|
"state",
|
||||||
|
"dms_acctnumber",
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Input />
|
||||||
|
</Form.Item>
|
||||||
|
)}
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("bodyshop.fields.responsibilitycenter_rate")}
|
label={t("bodyshop.fields.responsibilitycenter_rate")}
|
||||||
rules={[
|
rules={[
|
||||||
@@ -2506,6 +2544,25 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) {
|
|||||||
>
|
>
|
||||||
<InputNumber precision={2} />
|
<InputNumber precision={2} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
{bodyshop.cdk_dealerid && (
|
||||||
|
<Form.Item
|
||||||
|
label={t("bodyshop.fields.responsibilitycenter_dms_acctnumber")}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
//message: t("general.validation.required"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
name={[
|
||||||
|
"md_responsibility_centers",
|
||||||
|
"taxes",
|
||||||
|
"local",
|
||||||
|
"dms_acctnumber",
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Input />
|
||||||
|
</Form.Item>
|
||||||
|
)}
|
||||||
</LayoutFormRow>
|
</LayoutFormRow>
|
||||||
<LayoutFormRow header={<div>AR</div>}>
|
<LayoutFormRow header={<div>AR</div>}>
|
||||||
{/* <Form.Item
|
{/* <Form.Item
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
import DmsActions from "./dms.types";
|
|
||||||
|
|
||||||
export const endLoading = (options) => ({
|
|
||||||
// type: DmsActions.END_LOADING,
|
|
||||||
payload: options,
|
|
||||||
});
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
import DmsActionTypes from "./dms.types";
|
|
||||||
|
|
||||||
const INITIAL_STATE = {
|
|
||||||
eventLog: [],
|
|
||||||
};
|
|
||||||
|
|
||||||
const dmsReducer = (state = INITIAL_STATE, action) => {
|
|
||||||
switch (action.type) {
|
|
||||||
// case ApplicationActionTypes.SET_SELECTED_HEADER:
|
|
||||||
// return {
|
|
||||||
// ...state,
|
|
||||||
// selectedHeader: action.payload,
|
|
||||||
// };
|
|
||||||
|
|
||||||
default:
|
|
||||||
return state;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export default dmsReducer;
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
import { all, call } from "redux-saga/effects";
|
|
||||||
//import DmsActionTypes from "./dms.types";
|
|
||||||
|
|
||||||
export function* onCalculateScheduleLoad() {
|
|
||||||
// yield takeLatest(
|
|
||||||
// DmsActionTypes.CALCULATE_SCHEDULE_LOAD,
|
|
||||||
// calculateScheduleLoad
|
|
||||||
// );
|
|
||||||
}
|
|
||||||
export function* calculateScheduleLoad({ payload: end }) {}
|
|
||||||
|
|
||||||
export function* dmsSagas() {
|
|
||||||
yield all([call()]);
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
import { createSelector } from "reselect";
|
|
||||||
|
|
||||||
const selectDms = (state) => state.dms;
|
|
||||||
|
|
||||||
export const selectEventLog = createSelector(
|
|
||||||
[selectDms],
|
|
||||||
(dms) => dms.eventLog
|
|
||||||
);
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
const DmsActionTypes = {
|
|
||||||
ADD_EVENT: "ADD_EVENT",
|
|
||||||
};
|
|
||||||
export default DmsActionTypes;
|
|
||||||
@@ -23,6 +23,30 @@ exports.default = async function (socket, jobid) {
|
|||||||
const job = await QueryJobData(socket, jobid);
|
const job = await QueryJobData(socket, jobid);
|
||||||
const { bodyshop } = job;
|
const { bodyshop } = job;
|
||||||
|
|
||||||
|
const taxAllocations = {
|
||||||
|
local: {
|
||||||
|
center: bodyshop.md_responsibility_centers.taxes.local.name,
|
||||||
|
sale: Dinero(job.job_totals.totals.local_tax),
|
||||||
|
cost: Dinero(),
|
||||||
|
profitCenter: bodyshop.md_responsibility_centers.taxes.local,
|
||||||
|
costCenter: bodyshop.md_responsibility_centers.taxes.local,
|
||||||
|
},
|
||||||
|
state: {
|
||||||
|
center: bodyshop.md_responsibility_centers.taxes.state.name,
|
||||||
|
sale: Dinero(job.job_totals.totals.state_tax),
|
||||||
|
cost: Dinero(),
|
||||||
|
profitCenter: bodyshop.md_responsibility_centers.taxes.state,
|
||||||
|
costCenter: bodyshop.md_responsibility_centers.taxes.state,
|
||||||
|
},
|
||||||
|
federal: {
|
||||||
|
center: bodyshop.md_responsibility_centers.taxes.federal.name,
|
||||||
|
sale: Dinero(job.job_totals.totals.federal_tax),
|
||||||
|
cost: Dinero(),
|
||||||
|
profitCenter: bodyshop.md_responsibility_centers.taxes.federal,
|
||||||
|
costCenter: bodyshop.md_responsibility_centers.taxes.federal,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
const profitCenterHash = job.joblines.reduce((acc, val) => {
|
const profitCenterHash = job.joblines.reduce((acc, val) => {
|
||||||
//Check the Parts Assignment
|
//Check the Parts Assignment
|
||||||
if (val.profitcenter_part) {
|
if (val.profitcenter_part) {
|
||||||
@@ -55,28 +79,44 @@ exports.default = async function (socket, jobid) {
|
|||||||
bill_val.billlines.map((line_val) => {
|
bill_val.billlines.map((line_val) => {
|
||||||
if (!bill_acc[line_val.cost_center])
|
if (!bill_acc[line_val.cost_center])
|
||||||
bill_acc[line_val.cost_center] = Dinero();
|
bill_acc[line_val.cost_center] = Dinero();
|
||||||
|
const lineDinero = Dinero({
|
||||||
|
amount: Math.round((line_val.actual_cost || 0) * 100),
|
||||||
|
})
|
||||||
|
.multiply(line_val.quantity)
|
||||||
|
.multiply(bill_val.is_credit_memo ? -1 : 1);
|
||||||
|
|
||||||
|
bill_acc[line_val.cost_center] =
|
||||||
|
bill_acc[line_val.cost_center].add(lineDinero);
|
||||||
|
|
||||||
|
//Add appropriate tax amounts.
|
||||||
|
const {
|
||||||
|
applicable_taxes: { local, state, federal },
|
||||||
|
} = line_val;
|
||||||
|
if (local) {
|
||||||
|
taxAllocations.local.cost = taxAllocations.local.cost.add(
|
||||||
|
lineDinero.percentage(bill_val.local_tax_rate || 0)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (state) {
|
||||||
|
taxAllocations.state.cost = taxAllocations.state.cost.add(
|
||||||
|
lineDinero.percentage(bill_val.state_tax_rate || 0)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (federal) {
|
||||||
|
taxAllocations.federal.cost = taxAllocations.federal.cost.add(
|
||||||
|
lineDinero.percentage(bill_val.federal_tax_rate || 0)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
bill_acc[line_val.cost_center] = bill_acc[line_val.cost_center].add(
|
|
||||||
Dinero({
|
|
||||||
amount: Math.round((line_val.actual_cost || 0) * 100),
|
|
||||||
})
|
|
||||||
.multiply(line_val.quantity)
|
|
||||||
.multiply(bill_val.is_credit_memo ? -1 : 1)
|
|
||||||
);
|
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
return bill_acc;
|
return bill_acc;
|
||||||
}, {});
|
}, {});
|
||||||
console.log(
|
|
||||||
"🚀 ~ file: dms-allocations-summary.component.jsx ~ line 69 ~ costCenterHash",
|
|
||||||
costCenterHash
|
|
||||||
);
|
|
||||||
|
|
||||||
return _.union(
|
const jobAllocations = _.union(
|
||||||
Object.keys(profitCenterHash),
|
Object.keys(profitCenterHash),
|
||||||
Object.keys(costCenterHash)
|
Object.keys(costCenterHash)
|
||||||
).map((key) => {
|
).map((key) => {
|
||||||
console.log("Key", key);
|
|
||||||
const profitCenter = bodyshop.md_responsibility_centers.profits.find(
|
const profitCenter = bodyshop.md_responsibility_centers.profits.find(
|
||||||
(c) => c.name === key
|
(c) => c.name === key
|
||||||
);
|
);
|
||||||
@@ -86,16 +126,23 @@ exports.default = async function (socket, jobid) {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
center: key,
|
center: key,
|
||||||
sale: profitCenterHash[key]
|
sale: profitCenterHash[key] ? profitCenterHash[key] : Dinero(),
|
||||||
? profitCenterHash[key].toFormat()
|
cost: costCenterHash[key] ? costCenterHash[key] : Dinero(),
|
||||||
: Dinero().toFormat(),
|
|
||||||
cost: costCenterHash[key]
|
|
||||||
? costCenterHash[key].toFormat()
|
|
||||||
: Dinero().toFormat(),
|
|
||||||
profitCenter,
|
profitCenter,
|
||||||
costCenter,
|
costCenter,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
return [
|
||||||
|
...jobAllocations,
|
||||||
|
...Object.keys(taxAllocations)
|
||||||
|
.filter(
|
||||||
|
(key) =>
|
||||||
|
taxAllocations[key].sale.getAmount() > 0 ||
|
||||||
|
taxAllocations[key].cost.getAmount() > 0
|
||||||
|
)
|
||||||
|
.map((key) => taxAllocations[key]),
|
||||||
|
];
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
CdkBase.createLogEvent(
|
CdkBase.createLogEvent(
|
||||||
socket,
|
socket,
|
||||||
|
|||||||
@@ -13,11 +13,8 @@ const CdkWsdl = require("./cdk-wsdl").default;
|
|||||||
const logger = require("../utils/logger");
|
const logger = require("../utils/logger");
|
||||||
const Dinero = require("dinero.js");
|
const Dinero = require("dinero.js");
|
||||||
const _ = require("lodash");
|
const _ = require("lodash");
|
||||||
const {
|
const { CDK_CREDENTIALS, CheckCdkResponseForError } = require("./cdk-wsdl");
|
||||||
CDK_CREDENTIALS,
|
const { performance } = require("perf_hooks");
|
||||||
CheckCdkResponseForError,
|
|
||||||
checkIndividualResult,
|
|
||||||
} = require("./cdk-wsdl");
|
|
||||||
|
|
||||||
exports.default = async function (socket, cdk_dealerid) {
|
exports.default = async function (socket, cdk_dealerid) {
|
||||||
try {
|
try {
|
||||||
@@ -26,9 +23,7 @@ exports.default = async function (socket, cdk_dealerid) {
|
|||||||
"DEBUG",
|
"DEBUG",
|
||||||
`Getting makes and models list from CDK.`
|
`Getting makes and models list from CDK.`
|
||||||
);
|
);
|
||||||
const t = await GetCdkMakes(socket, cdk_dealerid);
|
return await GetCdkMakes(socket, cdk_dealerid);
|
||||||
console.log(t);
|
|
||||||
return [];
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
CdkBase.createLogEvent(
|
CdkBase.createLogEvent(
|
||||||
socket,
|
socket,
|
||||||
@@ -42,11 +37,13 @@ async function GetCdkMakes(socket, cdk_dealerid) {
|
|||||||
CdkBase.createLogEvent(socket, "TRACE", `{1} Begin GetCDkMakes WSDL Call`);
|
CdkBase.createLogEvent(socket, "TRACE", `{1} Begin GetCDkMakes WSDL Call`);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const soapClientVehicleSearch = await soap.createClientAsync(
|
const soapClientVehicleInsert = await soap.createClientAsync(
|
||||||
CdkWsdl.VehicleSearch
|
CdkWsdl.VehicleInsert
|
||||||
);
|
);
|
||||||
|
const start = performance.now();
|
||||||
|
|
||||||
const soapResponseVehicleSearch =
|
const soapResponseVehicleSearch =
|
||||||
await soapClientVehicleSearch.getVehIdsAsync(
|
await soapClientVehicleInsert.getMakeModelAsync(
|
||||||
{
|
{
|
||||||
arg0: CDK_CREDENTIALS,
|
arg0: CDK_CREDENTIALS,
|
||||||
arg1: { id: cdk_dealerid },
|
arg1: { id: cdk_dealerid },
|
||||||
@@ -58,22 +55,23 @@ async function GetCdkMakes(socket, cdk_dealerid) {
|
|||||||
const [
|
const [
|
||||||
result, //rawResponse, soapheader, rawRequest
|
result, //rawResponse, soapheader, rawRequest
|
||||||
] = soapResponseVehicleSearch;
|
] = soapResponseVehicleSearch;
|
||||||
|
const end = performance.now();
|
||||||
CdkBase.createLogEvent(
|
CdkBase.createLogEvent(
|
||||||
socket,
|
socket,
|
||||||
"TRACE",
|
"TRACE",
|
||||||
`soapResponseVehicleSearch.searchIDsByVINAsync Result ${JSON.stringify(
|
`soapClientVehicleInsert.getMakeModelAsync Result Length ${
|
||||||
result,
|
result.return.length
|
||||||
null,
|
} and took ${end - start}ms`
|
||||||
2
|
|
||||||
)}`
|
|
||||||
);
|
);
|
||||||
const DmsVehicle = result && result.return && result.return[0];
|
|
||||||
return DmsVehicle;
|
return result.return.map((element, index) => {
|
||||||
|
return { id: index, ...element };
|
||||||
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
CdkBase.createLogEvent(
|
CdkBase.createLogEvent(
|
||||||
socket,
|
socket,
|
||||||
"ERROR",
|
"ERROR",
|
||||||
`Error in CalculateDmsVid - ${JSON.stringify(error, null, 2)}`
|
`Error in GetCdkMakes - ${JSON.stringify(error, null, 2)}`
|
||||||
);
|
);
|
||||||
throw new Error(error);
|
throw new Error(error);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,11 +11,7 @@ const queries = require("../graphql-client/queries");
|
|||||||
const CdkBase = require("../web-sockets/web-socket");
|
const CdkBase = require("../web-sockets/web-socket");
|
||||||
const CdkWsdl = require("./cdk-wsdl").default;
|
const CdkWsdl = require("./cdk-wsdl").default;
|
||||||
const logger = require("../utils/logger");
|
const logger = require("../utils/logger");
|
||||||
const {
|
const { CDK_CREDENTIALS, CheckCdkResponseForError } = require("./cdk-wsdl");
|
||||||
CDK_CREDENTIALS,
|
|
||||||
CheckCdkResponseForError,
|
|
||||||
checkIndividualResult,
|
|
||||||
} = require("./cdk-wsdl");
|
|
||||||
|
|
||||||
exports.default = async function (socket, jobid) {
|
exports.default = async function (socket, jobid) {
|
||||||
socket.logEvents = [];
|
socket.logEvents = [];
|
||||||
|
|||||||
@@ -82,6 +82,7 @@ exports.default = {
|
|||||||
CustomerInsertUpdate: `${cdkDomain}/pip-customer/services/CustomerInsertUpdate?wsdl`,
|
CustomerInsertUpdate: `${cdkDomain}/pip-customer/services/CustomerInsertUpdate?wsdl`,
|
||||||
CustomerSearch: `${cdkDomain}/pip-customer/services/CustomerSearch?wsdl`,
|
CustomerSearch: `${cdkDomain}/pip-customer/services/CustomerSearch?wsdl`,
|
||||||
VehicleSearch: `${cdkDomain}/pip-vehicle/services/VehicleSearch?wsdl`,
|
VehicleSearch: `${cdkDomain}/pip-vehicle/services/VehicleSearch?wsdl`,
|
||||||
|
VehicleInsert: `${cdkDomain}/pip-vehicle/services/VehicleInsertUpdate?wsdl`,
|
||||||
};
|
};
|
||||||
|
|
||||||
// The following login credentials will be used for all PIPs and all environments (User Acceptance Testing and Production).
|
// The following login credentials will be used for all PIPs and all environments (User Acceptance Testing and Production).
|
||||||
|
|||||||
@@ -1002,6 +1002,7 @@ exports.GET_CDK_ALLOCATIONS = `
|
|||||||
cost_center
|
cost_center
|
||||||
id
|
id
|
||||||
quantity
|
quantity
|
||||||
|
applicable_taxes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
joblines(where: { removed: { _eq: false } }) {
|
joblines(where: { removed: { _eq: false } }) {
|
||||||
|
|||||||
@@ -64,8 +64,16 @@ io.on("connection", (socket) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
socket.on("cdk-get-makes", async (cdk_dealerid, callback) => {
|
socket.on("cdk-get-makes", async (cdk_dealerid, callback) => {
|
||||||
const makes = await CdkGetMakes(socket, cdk_dealerid);
|
try {
|
||||||
callback(makes);
|
const makes = await CdkGetMakes(socket, cdk_dealerid);
|
||||||
|
callback(makes);
|
||||||
|
} catch (error) {
|
||||||
|
createLogEvent(
|
||||||
|
socket,
|
||||||
|
"ERROR",
|
||||||
|
`Error in cdk-get-makes WS call. ${JSON.stringify(error, null, 2)}`
|
||||||
|
);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
socket.on("cdk-calculate-allocations", async (jobid, callback) => {
|
socket.on("cdk-calculate-allocations", async (jobid, callback) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user