IO-117 PBS WIP
This commit is contained in:
@@ -119,33 +119,35 @@ export function DmsPostForm({ bodyshop, socket, job }) {
|
|||||||
</Form.Item>
|
</Form.Item>
|
||||||
</LayoutFormRow>
|
</LayoutFormRow>
|
||||||
|
|
||||||
<LayoutFormRow style={{ justifyContent: "center" }} grow>
|
{bodyshop.cdk_dealerid && (
|
||||||
<Form.Item
|
<LayoutFormRow style={{ justifyContent: "center" }} grow>
|
||||||
name="dms_make"
|
<Form.Item
|
||||||
label={t("jobs.fields.dms.dms_make")}
|
name="dms_make"
|
||||||
rules={[
|
label={t("jobs.fields.dms.dms_make")}
|
||||||
{
|
rules={[
|
||||||
required: true,
|
{
|
||||||
},
|
required: true,
|
||||||
]}
|
},
|
||||||
>
|
]}
|
||||||
<Input disabled />
|
>
|
||||||
</Form.Item>
|
<Input disabled />
|
||||||
<Form.Item
|
</Form.Item>
|
||||||
name="dms_model"
|
<Form.Item
|
||||||
label={t("jobs.fields.dms.dms_model")}
|
name="dms_model"
|
||||||
rules={[
|
label={t("jobs.fields.dms.dms_model")}
|
||||||
{
|
rules={[
|
||||||
required: true,
|
{
|
||||||
},
|
required: true,
|
||||||
]}
|
},
|
||||||
>
|
]}
|
||||||
<Input disabled />
|
>
|
||||||
</Form.Item>
|
<Input disabled />
|
||||||
|
</Form.Item>
|
||||||
|
|
||||||
<DmsCdkMakes form={form} socket={socket} job={job} />
|
<DmsCdkMakes form={form} socket={socket} job={job} />
|
||||||
<DmsCdkMakesRefetch />
|
<DmsCdkMakesRefetch />
|
||||||
</LayoutFormRow>
|
</LayoutFormRow>
|
||||||
|
)}
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="story"
|
name="story"
|
||||||
label={t("jobs.fields.dms.story")}
|
label={t("jobs.fields.dms.story")}
|
||||||
@@ -157,6 +159,7 @@ export function DmsPostForm({ bodyshop, socket, job }) {
|
|||||||
>
|
>
|
||||||
<Input.TextArea maxLength={240} />
|
<Input.TextArea maxLength={240} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
<Divider />
|
<Divider />
|
||||||
<Form.List name={["payers"]}>
|
<Form.List name={["payers"]}>
|
||||||
{(fields, { add, remove }) => {
|
{(fields, { add, remove }) => {
|
||||||
|
|||||||
@@ -46,12 +46,16 @@ import {
|
|||||||
} from "../../redux/application/application.selectors";
|
} from "../../redux/application/application.selectors";
|
||||||
import { setModalContext } from "../../redux/modals/modals.actions";
|
import { setModalContext } from "../../redux/modals/modals.actions";
|
||||||
import { signOutStart } from "../../redux/user/user.actions";
|
import { signOutStart } from "../../redux/user/user.actions";
|
||||||
import { selectCurrentUser } from "../../redux/user/user.selectors";
|
import {
|
||||||
|
selectBodyshop,
|
||||||
|
selectCurrentUser,
|
||||||
|
} from "../../redux/user/user.selectors";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
currentUser: selectCurrentUser,
|
currentUser: selectCurrentUser,
|
||||||
recentItems: selectRecentItems,
|
recentItems: selectRecentItems,
|
||||||
selectedHeader: selectSelectedHeader,
|
selectedHeader: selectSelectedHeader,
|
||||||
|
bodyshop: selectBodyshop,
|
||||||
});
|
});
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
@@ -69,6 +73,7 @@ const mapDispatchToProps = (dispatch) => ({
|
|||||||
function Header({
|
function Header({
|
||||||
handleMenuClick,
|
handleMenuClick,
|
||||||
currentUser,
|
currentUser,
|
||||||
|
bodyshop,
|
||||||
selectedHeader,
|
selectedHeader,
|
||||||
signOutStart,
|
signOutStart,
|
||||||
setBillEnterContext,
|
setBillEnterContext,
|
||||||
@@ -77,6 +82,7 @@ function Header({
|
|||||||
setReportCenterContext,
|
setReportCenterContext,
|
||||||
recentItems,
|
recentItems,
|
||||||
}) {
|
}) {
|
||||||
|
console.log("🚀 ~ file: header.component.jsx ~ line 85 ~ bodyshop", bodyshop);
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -237,16 +243,26 @@ function Header({
|
|||||||
{t("menus.header.accounting-receivables")}
|
{t("menus.header.accounting-receivables")}
|
||||||
</Link>
|
</Link>
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
<Menu.Item key="payables">
|
{!(
|
||||||
<Link to="/manage/accounting/payables">
|
(bodyshop && bodyshop.cdk_dealerid) ||
|
||||||
{t("menus.header.accounting-payables")}
|
(bodyshop && bodyshop.pbs_serialnumber)
|
||||||
</Link>
|
) && (
|
||||||
</Menu.Item>
|
<Menu.Item key="payables">
|
||||||
<Menu.Item key="payments">
|
<Link to="/manage/accounting/payables">
|
||||||
<Link to="/manage/accounting/payments">
|
{t("menus.header.accounting-payables")}
|
||||||
{t("menus.header.accounting-payments")}
|
</Link>
|
||||||
</Link>
|
</Menu.Item>
|
||||||
</Menu.Item>
|
)}
|
||||||
|
{!(
|
||||||
|
(bodyshop && bodyshop.cdk_dealerid) ||
|
||||||
|
(bodyshop && bodyshop.pbs_serialnumber)
|
||||||
|
) && (
|
||||||
|
<Menu.Item key="payments">
|
||||||
|
<Link to="/manage/accounting/payments">
|
||||||
|
{t("menus.header.accounting-payments")}
|
||||||
|
</Link>
|
||||||
|
</Menu.Item>
|
||||||
|
)}
|
||||||
<Menu.Item key="export-logs">
|
<Menu.Item key="export-logs">
|
||||||
<Link to="/manage/accounting/exportlogs">
|
<Link to="/manage/accounting/exportlogs">
|
||||||
{t("menus.header.export-logs")}
|
{t("menus.header.export-logs")}
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ export function JobsCloseAutoAllocate({ bodyshop, joblines, form, disabled }) {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const overlay = bodyshop.cdk_dealerid && (
|
const overlay = (bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber) && (
|
||||||
<Menu onClick={handleMenuClick}>
|
<Menu onClick={handleMenuClick}>
|
||||||
{bodyshop.md_responsibility_centers.dms_defaults.map((mapping) => (
|
{bodyshop.md_responsibility_centers.dms_defaults.map((mapping) => (
|
||||||
<Menu.Item key={mapping.name}>{mapping.name}</Menu.Item>
|
<Menu.Item key={mapping.name}>{mapping.name}</Menu.Item>
|
||||||
@@ -69,7 +69,7 @@ export function JobsCloseAutoAllocate({ bodyshop, joblines, form, disabled }) {
|
|||||||
</Menu>
|
</Menu>
|
||||||
);
|
);
|
||||||
|
|
||||||
return bodyshop.cdk_dealerid ? (
|
return bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber ? (
|
||||||
<Dropdown overlay={overlay}>
|
<Dropdown overlay={overlay}>
|
||||||
<Button disabled={disabled}>{t("jobs.actions.dmsautoallocate")}</Button>
|
<Button disabled={disabled}>{t("jobs.actions.dmsautoallocate")}</Button>
|
||||||
</Dropdown>
|
</Dropdown>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Input, PageHeader, Space, Spin } from "antd";
|
import { Input, Space, Spin } from "antd";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
|
|||||||
@@ -120,7 +120,11 @@ export function DmsContainer({ bodyshop, setBreadcrumbs, setSelectedHeader }) {
|
|||||||
if (loading) return <LoadingSpinner />;
|
if (loading) return <LoadingSpinner />;
|
||||||
if (error) return <AlertComponent message={error.message} type="error" />;
|
if (error) return <AlertComponent message={error.message} type="error" />;
|
||||||
|
|
||||||
if (!jobId || !bodyshop.cdk_dealerid || !(data && data.jobs_by_pk))
|
if (
|
||||||
|
!jobId ||
|
||||||
|
!(bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber) ||
|
||||||
|
!(data && data.jobs_by_pk)
|
||||||
|
)
|
||||||
return <Result status="404" />;
|
return <Result status="404" />;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -208,7 +208,7 @@ export function JobsCloseComponent({ job, bodyshop, jobRO }) {
|
|||||||
>
|
>
|
||||||
<DateTimePicker disabled={jobRO} />
|
<DateTimePicker disabled={jobRO} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
{bodyshop.cdk_dealerid && (
|
{(bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber) && (
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("jobs.fields.kmin")}
|
label={t("jobs.fields.kmin")}
|
||||||
name="kmin"
|
name="kmin"
|
||||||
@@ -221,7 +221,7 @@ export function JobsCloseComponent({ job, bodyshop, jobRO }) {
|
|||||||
<InputNumber precision={0} disabled={jobRO} />
|
<InputNumber precision={0} disabled={jobRO} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
)}
|
)}
|
||||||
{bodyshop.cdk_dealerid && (
|
{(bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber) && (
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("jobs.fields.kmout")}
|
label={t("jobs.fields.kmout")}
|
||||||
name="kmout"
|
name="kmout"
|
||||||
|
|||||||
@@ -207,14 +207,9 @@
|
|||||||
- shopid
|
- shopid
|
||||||
- useremail
|
- useremail
|
||||||
filter:
|
filter:
|
||||||
bodyshop:
|
user:
|
||||||
associations:
|
authid:
|
||||||
_and:
|
_eq: X-Hasura-User-Id
|
||||||
- active:
|
|
||||||
_eq: true
|
|
||||||
- user:
|
|
||||||
authid:
|
|
||||||
_eq: X-Hasura-User-Id
|
|
||||||
update_permissions:
|
update_permissions:
|
||||||
- role: user
|
- role: user
|
||||||
permission:
|
permission:
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"aws-sdk": "^2.1023.0",
|
"aws-sdk": "^2.1023.0",
|
||||||
|
"axios": "^0.24.0",
|
||||||
"bluebird": "^3.7.2",
|
"bluebird": "^3.7.2",
|
||||||
"body-parser": "^1.18.3",
|
"body-parser": "^1.18.3",
|
||||||
"cloudinary": "^1.27.1",
|
"cloudinary": "^1.27.1",
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ require("dotenv").config({
|
|||||||
`.env.${process.env.NODE_ENV || "development"}`
|
`.env.${process.env.NODE_ENV || "development"}`
|
||||||
),
|
),
|
||||||
});
|
});
|
||||||
const CdkBase = require("../web-sockets/web-socket");
|
|
||||||
|
|
||||||
const IMEX_PBS_USER = process.env.IMEX_PBS_USER,
|
const IMEX_PBS_USER = process.env.IMEX_PBS_USER,
|
||||||
IMEX_PBS_PASSWORD = process.env.IMEX_PBS_PASSWORD;
|
IMEX_PBS_PASSWORD = process.env.IMEX_PBS_PASSWORD;
|
||||||
@@ -19,3 +18,13 @@ exports.PBS_CREDENTIALS = PBS_CREDENTIALS;
|
|||||||
// process.env.NODE_ENV === "production"
|
// process.env.NODE_ENV === "production"
|
||||||
// ? "https://3pa.dmotorworks.com"
|
// ? "https://3pa.dmotorworks.com"
|
||||||
// : "https://uat-3pa.dmotorworks.com";
|
// : "https://uat-3pa.dmotorworks.com";
|
||||||
|
|
||||||
|
const pbsDomain = `https://partnerhub.pbsdealers.com/json/reply`;
|
||||||
|
exports.PBS_ENDPOINTS = {
|
||||||
|
AccountGet: `${pbsDomain}/AccountGet`,
|
||||||
|
ContactGet: `${pbsDomain}/ContactGet`,
|
||||||
|
VehicleGet: `${pbsDomain}/VehicleGet`,
|
||||||
|
AccountingPostingChange: `${pbsDomain}/AccountingPostingChange`,
|
||||||
|
ContactChange: `${pbsDomain}/ContactChange`,
|
||||||
|
VehicleChange: `${pbsDomain}/VehicleChange`,
|
||||||
|
};
|
||||||
|
|||||||
@@ -6,16 +6,15 @@ require("dotenv").config({
|
|||||||
),
|
),
|
||||||
});
|
});
|
||||||
const GraphQLClient = require("graphql-request").GraphQLClient;
|
const GraphQLClient = require("graphql-request").GraphQLClient;
|
||||||
const soap = require("soap");
|
const axios = require("axios").default;
|
||||||
const queries = require("../../graphql-client/queries");
|
const queries = require("../../graphql-client/queries");
|
||||||
const CdkBase = require("../../web-sockets/web-socket");
|
const { PBS_ENDPOINTS, PBS_CREDENTIALS } = require("./pbs-constants");
|
||||||
|
|
||||||
//const { CDK_CREDENTIALS, CheckCdkResponseForError } = require("./cdk-wsdl");
|
//const { CDK_CREDENTIALS, CheckCdkResponseForError } = require("./cdk-wsdl");
|
||||||
//const CalcualteAllocations = require("./cdk-calculate-allocations").default;
|
//const CalcualteAllocations = require("./cdk-calculate-allocations").default;
|
||||||
|
const CdkBase = require("../../web-sockets/web-socket");
|
||||||
|
|
||||||
const moment = require("moment");
|
exports.default = async function (socket, { txEnvelope, jobid }) {
|
||||||
|
|
||||||
exports.default = async function (socket, jobid) {
|
|
||||||
socket.logEvents = [];
|
socket.logEvents = [];
|
||||||
socket.recordid = jobid;
|
socket.recordid = jobid;
|
||||||
|
|
||||||
@@ -25,6 +24,18 @@ exports.default = async function (socket, jobid) {
|
|||||||
"DEBUG",
|
"DEBUG",
|
||||||
`Received Job export request for id ${jobid}`
|
`Received Job export request for id ${jobid}`
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const JobData = await QueryJobData(socket, jobid);
|
||||||
|
socket.JobData = JobData;
|
||||||
|
|
||||||
|
//Upsert the contact information as per Wafaa's Email.
|
||||||
|
CdkBase.createLogEvent(
|
||||||
|
socket,
|
||||||
|
"DEBUG",
|
||||||
|
`Upserting contact information to DMS for ${socket.JobData.ownr_fn} ${socket.JobData.ownr_ln} ${socket.JobData.ownr_co_nm}`
|
||||||
|
);
|
||||||
|
const ownerRef = await UpsertContactData(socket);
|
||||||
|
await UpsertVehicleData(socket, ownerRef.ReferenceId);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
CdkBase.createLogEvent(
|
CdkBase.createLogEvent(
|
||||||
socket,
|
socket,
|
||||||
@@ -33,3 +44,277 @@ exports.default = async function (socket, jobid) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
async function CheckForErrors(socket, response) {
|
||||||
|
if (response.WasSuccessful) {
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
CdkBase.createLogEvent(
|
||||||
|
socket,
|
||||||
|
"ERROR",
|
||||||
|
`Error received from DMS:. ${response.Message}`
|
||||||
|
);
|
||||||
|
CdkBase.createLogEvent(
|
||||||
|
socket,
|
||||||
|
"TRACE",
|
||||||
|
`Error received from DMS:. ${JSON.stringify(response)}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function QueryJobData(socket, jobid) {
|
||||||
|
CdkBase.createLogEvent(socket, "DEBUG", `Querying job data for id ${jobid}`);
|
||||||
|
const client = new GraphQLClient(process.env.GRAPHQL_ENDPOINT, {});
|
||||||
|
const result = await client
|
||||||
|
.setHeaders({ Authorization: `Bearer ${socket.handshake.auth.token}` })
|
||||||
|
.request(queries.QUERY_JOBS_FOR_PBS_EXPORT, { id: jobid });
|
||||||
|
CdkBase.createLogEvent(
|
||||||
|
socket,
|
||||||
|
"TRACE",
|
||||||
|
`Job data query result ${JSON.stringify(result, null, 2)}`
|
||||||
|
);
|
||||||
|
return result.jobs_by_pk;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function UpsertContactData(socket) {
|
||||||
|
try {
|
||||||
|
const { data: ContactChangeResponse } = await axios.post(
|
||||||
|
PBS_ENDPOINTS.ContactChange,
|
||||||
|
{
|
||||||
|
ContactInfo: {
|
||||||
|
// Id: socket.JobData.owner.id,
|
||||||
|
ContactId: socket.JobData.owner.id,
|
||||||
|
SerialNumber: socket.JobData.bodyshop.pbs_serialnumber,
|
||||||
|
Code: socket.JobData.owner.accountingid,
|
||||||
|
...(socket.JobData.ownr_co_nm
|
||||||
|
? {
|
||||||
|
//LastName: socket.JobData.ownr_ln,
|
||||||
|
FirstName: socket.JobData.ownr_co_nm,
|
||||||
|
IsBusiness: true,
|
||||||
|
}
|
||||||
|
: {
|
||||||
|
LastName: socket.JobData.ownr_ln,
|
||||||
|
FirstName: socket.JobData.ownr_fn,
|
||||||
|
IsBusiness: false,
|
||||||
|
}),
|
||||||
|
|
||||||
|
//Salutation: "String",
|
||||||
|
//MiddleName: "String",
|
||||||
|
//ContactName: "String",
|
||||||
|
IsInactive: false,
|
||||||
|
|
||||||
|
//ApartmentNumber: "String",
|
||||||
|
Address: socket.JobData.ownr_addr1,
|
||||||
|
City: socket.JobData.ownr_city,
|
||||||
|
//County: socket.JobData.ownr_addr1,
|
||||||
|
State: socket.JobData.ownr_st,
|
||||||
|
ZipCode: socket.JobData.ownr_zip,
|
||||||
|
//BusinessPhone: "String",
|
||||||
|
//BusinessPhoneExt: "String",
|
||||||
|
HomePhone: socket.JobData.ownr_ph2,
|
||||||
|
CellPhone: socket.JobData.ownr_ph1,
|
||||||
|
//BusinessPhoneRawReverse: "String",
|
||||||
|
//HomePhoneRawReverse: "String",
|
||||||
|
//CellPhoneRawReverse: "String",
|
||||||
|
//FaxNumber: "String",
|
||||||
|
EmailAddress: socket.JobData.ownr_ea,
|
||||||
|
//Notes: "String",
|
||||||
|
//CriticalMemo: "String",
|
||||||
|
//BirthDate: "0001-01-01T00:00:00.0000000Z",
|
||||||
|
// Gender: "String",
|
||||||
|
// DriverLicense: "String",
|
||||||
|
//PreferredContactMethods: ["String"],
|
||||||
|
// LastUpdate: "0001-01-01T00:00:00.0000000Z",
|
||||||
|
// CustomFields: [{ Key: "String", Value: "String", Type: "String" }],
|
||||||
|
// FleetType: "String",
|
||||||
|
// CommunicationPreferences: {
|
||||||
|
// Email: "String",
|
||||||
|
// Phone: "String",
|
||||||
|
// TextMessage: "String",
|
||||||
|
// Letter: "String",
|
||||||
|
// Preferred: "String",
|
||||||
|
// },
|
||||||
|
// SalesRepRef: "00000000000000000000000000000000",
|
||||||
|
// Language: "String",
|
||||||
|
// PayableAccount: "String",
|
||||||
|
// ReceivableAccount: "String",
|
||||||
|
// IsStatic: false,
|
||||||
|
// PrimaryImageRef: "00000000000000000000000000000000",
|
||||||
|
// PayableAccounts: [{ SerialNumber: "String", Account: "String" }],
|
||||||
|
// ReceivableAccounts: [{ SerialNumber: "String", Account: "String" }],
|
||||||
|
// ManufacturerLoyaltyNumber: "String",
|
||||||
|
},
|
||||||
|
IsAsynchronous: false,
|
||||||
|
// UserRequest: "String",
|
||||||
|
// UserRef: "00000000000000000000000000000000",
|
||||||
|
},
|
||||||
|
{ auth: PBS_CREDENTIALS }
|
||||||
|
);
|
||||||
|
CheckForErrors(socket, ContactChangeResponse);
|
||||||
|
return ContactChangeResponse;
|
||||||
|
} catch (error) {
|
||||||
|
CdkBase.createLogEvent(
|
||||||
|
socket,
|
||||||
|
"ERROR",
|
||||||
|
`Error in UpsertContactData - ${error}`
|
||||||
|
);
|
||||||
|
throw new Error(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function UpsertVehicleData(socket, ownerRef) {
|
||||||
|
try {
|
||||||
|
const { data: VehicleChangeResponse } = await axios.post(
|
||||||
|
PBS_ENDPOINTS.VehicleChange,
|
||||||
|
{
|
||||||
|
VehicleInfo: {
|
||||||
|
//Id: "string/00000000-0000-0000-0000-000000000000",
|
||||||
|
//VehicleId: "00000000000000000000000000000000",
|
||||||
|
SerialNumber: socket.JobData.bodyshop.pbs_serialnumber,
|
||||||
|
//StockNumber: "String",
|
||||||
|
VIN: socket.JobData.v_vin,
|
||||||
|
LicenseNumber: socket.JobData.plate_no,
|
||||||
|
//FleetNumber: "String",
|
||||||
|
//Status: "String",
|
||||||
|
OwnerRef: ownerRef, // "00000000000000000000000000000000",
|
||||||
|
//ModelNumber: "String",
|
||||||
|
Make: socket.JobData.v_make_desc,
|
||||||
|
Model: socket.JobData.v_model_desc,
|
||||||
|
//Trim: "String",
|
||||||
|
//VehicleType: "String",
|
||||||
|
Year: socket.JobData.v_model_yr,
|
||||||
|
Odometer: socket.JobData.kmin,
|
||||||
|
ExteriorColor: {
|
||||||
|
Code: socket.JobData.v_color,
|
||||||
|
//Description: "String",
|
||||||
|
},
|
||||||
|
// InteriorColor: { Code: "String", Description: "String" },
|
||||||
|
//Engine: "String",
|
||||||
|
// Cylinders: "String",
|
||||||
|
// Transmission: "String",
|
||||||
|
// DriveWheel: "String",
|
||||||
|
// Fuel: "String",
|
||||||
|
// Weight: 0,
|
||||||
|
// InServiceDate: "0001-01-01T00:00:00.0000000Z",
|
||||||
|
// LastServiceDate: "0001-01-01T00:00:00.0000000Z",
|
||||||
|
// LastServiceMileage: 0,
|
||||||
|
// Lot: "String",
|
||||||
|
// LotDescription: "String",
|
||||||
|
// Category: "String",
|
||||||
|
// Options: [
|
||||||
|
// {
|
||||||
|
// Group: "String",
|
||||||
|
// Code: "String",
|
||||||
|
// Description: "String",
|
||||||
|
// AdditionalInfo: "String",
|
||||||
|
// Price: 0,
|
||||||
|
// Cost: 0,
|
||||||
|
// Residual: 0,
|
||||||
|
// },
|
||||||
|
// ],
|
||||||
|
// Refurbishments: [
|
||||||
|
// {
|
||||||
|
// ReferenceNumber: "String",
|
||||||
|
// Description: "String",
|
||||||
|
// Price: 0,
|
||||||
|
// Cost: 0,
|
||||||
|
// Date: "0001-01-01T00:00:00.0000000Z",
|
||||||
|
// ApplicationModel: "String",
|
||||||
|
// },
|
||||||
|
// ],
|
||||||
|
// Order: {
|
||||||
|
// InvoiceNumber: "String",
|
||||||
|
// Price: 0,
|
||||||
|
// Status: "String",
|
||||||
|
// Eta: "String",
|
||||||
|
// EstimatedCost: 0,
|
||||||
|
// OrderDate: "String",
|
||||||
|
// StatusDate: "String",
|
||||||
|
// IgnitionKeyCode: "String",
|
||||||
|
// DoorKeyCode: "String",
|
||||||
|
// Description: "String",
|
||||||
|
// LocationStatus: "String",
|
||||||
|
// LocationStatusDate: "0001-01-01T00:00:00.0000000Z",
|
||||||
|
// },
|
||||||
|
// MSR: 0,
|
||||||
|
// BaseMSR: 0,
|
||||||
|
// Retail: 0,
|
||||||
|
// DateReceived: "0001-01-01T00:00:00.0000000Z",
|
||||||
|
// InternetPrice: 0,
|
||||||
|
// Lotpack: 0,
|
||||||
|
// Holdback: 0,
|
||||||
|
// InternetNotes: "String",
|
||||||
|
// Notes: "String",
|
||||||
|
// CriticalMemo: "String",
|
||||||
|
// IsCertified: false,
|
||||||
|
// LastSaleDate: "0001-01-01T00:00:00.0000000Z",
|
||||||
|
// LastUpdate: "0001-01-01T00:00:00.0000000Z",
|
||||||
|
// AppraisedValue: 0,
|
||||||
|
// Warranties: [
|
||||||
|
// {
|
||||||
|
// Type: "String",
|
||||||
|
// CompanyName: "String",
|
||||||
|
// CoveragePlan: "String",
|
||||||
|
// Description: "String",
|
||||||
|
// Price: 0,
|
||||||
|
// Cost: 0,
|
||||||
|
// Term: "String",
|
||||||
|
// Deductible: 0,
|
||||||
|
// PolicyNumber: "String",
|
||||||
|
// StartDate: "String",
|
||||||
|
// StartMileage: 0,
|
||||||
|
// ExpirationDate: "String",
|
||||||
|
// ExpirationMileage: 0,
|
||||||
|
// },
|
||||||
|
// ],
|
||||||
|
// Freight: 0,
|
||||||
|
// Air: 0,
|
||||||
|
// Inventory: 0,
|
||||||
|
// IsInactive: false,
|
||||||
|
// CustomFields: [{ Key: "String", Value: "String", Type: "String" }],
|
||||||
|
// FloorPlanCode: "String",
|
||||||
|
// FloorPlanAmount: 0,
|
||||||
|
// Insurance: {
|
||||||
|
// Company: "String",
|
||||||
|
// Policy: "String",
|
||||||
|
// ExpiryDate: "0001-01-01T00:00:00.0000000Z",
|
||||||
|
// AgentName: "String",
|
||||||
|
// AgentPhoneNumber: "String",
|
||||||
|
// },
|
||||||
|
// Body: "String",
|
||||||
|
// ShortVIN: "String",
|
||||||
|
// AdditionalDrivers: ["00000000000000000000000000000000"],
|
||||||
|
// OrderDetails: { Distributor: "String" },
|
||||||
|
// PrimaryImageRef: "00000000000000000000000000000000",
|
||||||
|
// Hold: {
|
||||||
|
// VehicleRef: "00000000000000000000000000000000",
|
||||||
|
// HoldFrom: "0001-01-01T00:00:00.0000000Z",
|
||||||
|
// HoldUntil: "0001-01-01T00:00:00.0000000Z",
|
||||||
|
// UserRef: "00000000000000000000000000000000",
|
||||||
|
// ContactRef: "00000000000000000000000000000000",
|
||||||
|
// Comments: "String",
|
||||||
|
// },
|
||||||
|
// SeatingCapacity: "String",
|
||||||
|
// DeliveryDate: "0001-01-01T00:00:00.0000000Z",
|
||||||
|
// WarrantyExpiry: "0001-01-01T00:00:00.0000000Z",
|
||||||
|
// IsConditionallySold: false,
|
||||||
|
// SalesDivision: 0,
|
||||||
|
// StyleRef: "String",
|
||||||
|
},
|
||||||
|
IsAsynchronous: false,
|
||||||
|
// UserRequest: "String",
|
||||||
|
// UserRef: "00000000000000000000000000000000",
|
||||||
|
},
|
||||||
|
{ auth: PBS_CREDENTIALS }
|
||||||
|
);
|
||||||
|
CheckForErrors(socket, VehicleChangeResponse);
|
||||||
|
return VehicleChangeResponse;
|
||||||
|
} catch (error) {
|
||||||
|
CdkBase.createLogEvent(
|
||||||
|
socket,
|
||||||
|
"ERROR",
|
||||||
|
`Error in UpsertVehicleData - ${error}`
|
||||||
|
);
|
||||||
|
throw new Error(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -239,6 +239,94 @@ query QUERY_JOBS_FOR_CDK_EXPORT($id: uuid!) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports.QUERY_JOBS_FOR_PBS_EXPORT = `
|
||||||
|
query QUERY_JOBS_FOR_PBS_EXPORT($id: uuid!) {
|
||||||
|
jobs_by_pk(id: $id) {
|
||||||
|
id
|
||||||
|
job_totals
|
||||||
|
date_invoiced
|
||||||
|
ro_number
|
||||||
|
clm_total
|
||||||
|
clm_no
|
||||||
|
invoice_allocation
|
||||||
|
ownerid
|
||||||
|
ownr_ln
|
||||||
|
ownr_fn
|
||||||
|
ownr_addr1
|
||||||
|
ownr_addr2
|
||||||
|
ownr_ph1
|
||||||
|
ownr_ph2
|
||||||
|
ownr_zip
|
||||||
|
ownr_city
|
||||||
|
ownr_ctry
|
||||||
|
ownr_st
|
||||||
|
ownr_ea
|
||||||
|
ins_co_nm
|
||||||
|
job_totals
|
||||||
|
rate_la1
|
||||||
|
rate_la2
|
||||||
|
rate_la3
|
||||||
|
rate_la4
|
||||||
|
rate_laa
|
||||||
|
rate_lab
|
||||||
|
rate_lad
|
||||||
|
rate_lae
|
||||||
|
rate_laf
|
||||||
|
rate_lag
|
||||||
|
rate_lam
|
||||||
|
rate_lar
|
||||||
|
rate_las
|
||||||
|
rate_lau
|
||||||
|
rate_ma2s
|
||||||
|
rate_ma2t
|
||||||
|
rate_ma3s
|
||||||
|
rate_mabl
|
||||||
|
rate_macs
|
||||||
|
rate_mahw
|
||||||
|
rate_mapa
|
||||||
|
rate_mash
|
||||||
|
rate_matd
|
||||||
|
class
|
||||||
|
ca_bc_pvrt
|
||||||
|
plate_no
|
||||||
|
plate_st
|
||||||
|
v_vin
|
||||||
|
v_model_yr
|
||||||
|
v_model_desc
|
||||||
|
v_make_desc
|
||||||
|
v_color
|
||||||
|
ca_customer_gst
|
||||||
|
bodyshop {
|
||||||
|
id
|
||||||
|
md_ro_statuses
|
||||||
|
md_responsibility_centers
|
||||||
|
accountingconfig
|
||||||
|
pbs_serialnumber
|
||||||
|
pbs_configuration
|
||||||
|
}
|
||||||
|
owner {
|
||||||
|
id
|
||||||
|
accountingid
|
||||||
|
}
|
||||||
|
joblines(where:{removed: {_eq:false}}) {
|
||||||
|
id
|
||||||
|
line_desc
|
||||||
|
part_type
|
||||||
|
act_price
|
||||||
|
mod_lb_hrs
|
||||||
|
mod_lbr_ty
|
||||||
|
part_qty
|
||||||
|
op_code_desc
|
||||||
|
profitcenter_labor
|
||||||
|
profitcenter_part
|
||||||
|
db_ref
|
||||||
|
prt_dsmk_p
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ const CdkCalculateAllocations =
|
|||||||
require("../cdk/cdk-calculate-allocations").default;
|
require("../cdk/cdk-calculate-allocations").default;
|
||||||
const { isArray } = require("lodash");
|
const { isArray } = require("lodash");
|
||||||
const logger = require("../utils/logger");
|
const logger = require("../utils/logger");
|
||||||
const PbsExportJob = require("../accounting/pbs/pbs-job-export");
|
const PbsExportJob = require("../accounting/pbs/pbs-job-export").default;
|
||||||
|
|
||||||
io.use(function (socket, next) {
|
io.use(function (socket, next) {
|
||||||
try {
|
try {
|
||||||
@@ -99,6 +99,17 @@ io.on("connection", (socket) => {
|
|||||||
//END CDK
|
//END CDK
|
||||||
|
|
||||||
//PBS
|
//PBS
|
||||||
|
socket.on("pbs-calculate-allocations", async (jobid, callback) => {
|
||||||
|
const allocations = await CdkCalculateAllocations(socket, jobid);
|
||||||
|
createLogEvent(socket, "DEBUG", `Allocations calculated.`);
|
||||||
|
createLogEvent(
|
||||||
|
socket,
|
||||||
|
"TRACE",
|
||||||
|
`Allocations calculated. ${JSON.stringify(allocations, null, 2)}`
|
||||||
|
);
|
||||||
|
|
||||||
|
callback(allocations);
|
||||||
|
});
|
||||||
socket.on("pbs-export-job", (jobid) => {
|
socket.on("pbs-export-job", (jobid) => {
|
||||||
PbsExportJob(socket, jobid);
|
PbsExportJob(socket, jobid);
|
||||||
});
|
});
|
||||||
|
|||||||
12
yarn.lock
12
yarn.lock
@@ -646,6 +646,13 @@ axios@^0.21.4:
|
|||||||
dependencies:
|
dependencies:
|
||||||
follow-redirects "^1.14.0"
|
follow-redirects "^1.14.0"
|
||||||
|
|
||||||
|
axios@^0.24.0:
|
||||||
|
version "0.24.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/axios/-/axios-0.24.0.tgz#804e6fa1e4b9c5288501dd9dff56a7a0940d20d6"
|
||||||
|
integrity sha512-Q6cWsys88HoPgAaFAVUb0WpPk0O8iTeisR9IMqy9G8AbO4NlpVknrnQS03zzF9PGAWgO3cgletO3VjV/P7VztA==
|
||||||
|
dependencies:
|
||||||
|
follow-redirects "^1.14.4"
|
||||||
|
|
||||||
balanced-match@^1.0.0:
|
balanced-match@^1.0.0:
|
||||||
version "1.0.2"
|
version "1.0.2"
|
||||||
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee"
|
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee"
|
||||||
@@ -1743,6 +1750,11 @@ follow-redirects@^1.14.0:
|
|||||||
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.4.tgz#838fdf48a8bbdd79e52ee51fb1c94e3ed98b9379"
|
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.4.tgz#838fdf48a8bbdd79e52ee51fb1c94e3ed98b9379"
|
||||||
integrity sha512-zwGkiSXC1MUJG/qmeIFH2HBJx9u0V46QGUe3YR1fXG8bXQxq7fLj0RjLZQ5nubr9qNJUZrH+xUcwXEoXNpfS+g==
|
integrity sha512-zwGkiSXC1MUJG/qmeIFH2HBJx9u0V46QGUe3YR1fXG8bXQxq7fLj0RjLZQ5nubr9qNJUZrH+xUcwXEoXNpfS+g==
|
||||||
|
|
||||||
|
follow-redirects@^1.14.4:
|
||||||
|
version "1.14.5"
|
||||||
|
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.5.tgz#f09a5848981d3c772b5392309778523f8d85c381"
|
||||||
|
integrity sha512-wtphSXy7d4/OR+MvIFbCVBDzZ5520qV8XfPklSN5QtxuMUJZ+b0Wnst1e1lCDocfzuCkHqj8k0FpZqO+UIaKNA==
|
||||||
|
|
||||||
forever-agent@~0.6.1:
|
forever-agent@~0.6.1:
|
||||||
version "0.6.1"
|
version "0.6.1"
|
||||||
resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91"
|
resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91"
|
||||||
|
|||||||
Reference in New Issue
Block a user