IO-233 WIP CDK
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<babeledit_project be_version="2.7.1" version="1.2">
|
||||
<babeledit_project version="1.2" be_version="2.7.1">
|
||||
<!--
|
||||
|
||||
BabelEdit project file
|
||||
@@ -7550,6 +7550,32 @@
|
||||
<folder_node>
|
||||
<name>dms</name>
|
||||
<children>
|
||||
<folder_node>
|
||||
<name>cdk</name>
|
||||
<children>
|
||||
<concept_node>
|
||||
<name>payers</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
<description></description>
|
||||
<comment></comment>
|
||||
<default_text></default_text>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>es-MX</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>fr-CA</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
</children>
|
||||
</folder_node>
|
||||
<concept_node>
|
||||
<name>cdk_dealerid</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
|
||||
@@ -1,17 +1,21 @@
|
||||
import { Button, Table } from "antd";
|
||||
import React, { useState } from "react";
|
||||
import { Button, Table, Typography } from "antd";
|
||||
import React, { useState, useEffect } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import Dinero from "dinero.js";
|
||||
import { SyncOutlined } from "@ant-design/icons";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
//currentUser: selectCurrentUser
|
||||
bodyshop: selectBodyshop,
|
||||
});
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||
});
|
||||
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
@@ -20,6 +24,15 @@ export default connect(
|
||||
export function DmsAllocationsSummary({ socket, bodyshop, jobId }) {
|
||||
const { t } = useTranslation();
|
||||
const [allocationsSummary, setAllocationsSummary] = useState([]);
|
||||
|
||||
useEffect(() => {
|
||||
if (socket.connected) {
|
||||
socket.emit("cdk-calculate-allocations", jobId, (ack) =>
|
||||
setAllocationsSummary(ack)
|
||||
);
|
||||
}
|
||||
}, [socket, socket.connected, jobId]);
|
||||
|
||||
const columns = [
|
||||
{
|
||||
title: t("jobs.fields.dms.center"),
|
||||
@@ -71,13 +84,45 @@ export function DmsAllocationsSummary({ socket, bodyshop, jobId }) {
|
||||
);
|
||||
}}
|
||||
>
|
||||
Get
|
||||
<SyncOutlined />
|
||||
</Button>
|
||||
)}
|
||||
pagination={{ position: "top", defaultPageSize: 50 }}
|
||||
columns={columns}
|
||||
rowKey="center"
|
||||
dataSource={allocationsSummary}
|
||||
summary={() => {
|
||||
const totals = allocationsSummary.reduce(
|
||||
(acc, val) => {
|
||||
return {
|
||||
totalSale: acc.totalSale.add(Dinero(val.sale)),
|
||||
totalCost: acc.totalCost.add(Dinero(val.cost)),
|
||||
};
|
||||
},
|
||||
{
|
||||
totalSale: Dinero(),
|
||||
totalCost: Dinero(),
|
||||
}
|
||||
);
|
||||
|
||||
return (
|
||||
<Table.Summary.Row>
|
||||
<Table.Summary.Cell>
|
||||
<Typography.Title level={4}>
|
||||
{t("general.labels.totals")}
|
||||
</Typography.Title>
|
||||
</Table.Summary.Cell>
|
||||
<Table.Summary.Cell>
|
||||
{totals.totalSale.toFormat()}
|
||||
</Table.Summary.Cell>
|
||||
<Table.Summary.Cell>
|
||||
{totals.totalCost.toFormat()}
|
||||
</Table.Summary.Cell>
|
||||
<Table.Summary.Cell></Table.Summary.Cell>
|
||||
<Table.Summary.Cell></Table.Summary.Cell>
|
||||
</Table.Summary.Row>
|
||||
);
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
import { DeleteFilled } from "@ant-design/icons";
|
||||
import { Button, Form, Input } from "antd";
|
||||
import {
|
||||
Button,
|
||||
Form,
|
||||
Input,
|
||||
InputNumber,
|
||||
Select,
|
||||
Space,
|
||||
Statistic,
|
||||
} from "antd";
|
||||
import React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
@@ -8,7 +16,8 @@ import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import DmsCdkMakes from "../dms-cdk-makes/dms-cdk-makes.component";
|
||||
import CurrencyInput from "../form-items-formatted/currency-form-item.component";
|
||||
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
|
||||
|
||||
import Dinero from "dinero.js";
|
||||
import { determineDmsType } from "../../pages/dms/dms.container";
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
});
|
||||
@@ -17,11 +26,38 @@ const mapDispatchToProps = (dispatch) => ({
|
||||
});
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(DmsPostForm);
|
||||
|
||||
export function DmsPostForm({ bodyshop, socket, jobId }) {
|
||||
export function DmsPostForm({ bodyshop, socket, job }) {
|
||||
const [form] = Form.useForm();
|
||||
const { t } = useTranslation();
|
||||
|
||||
const handlePayerSelect = (value, index) => {
|
||||
form.setFieldsValue({
|
||||
payers: form.getFieldValue("payers").map((payer, mapIndex) => {
|
||||
if (index !== mapIndex) return payer;
|
||||
const cdkPayer =
|
||||
bodyshop.cdk_configuration.payers &&
|
||||
bodyshop.cdk_configuration.payers.find((i) => i.name === value);
|
||||
|
||||
if (!cdkPayer) return payer;
|
||||
|
||||
return {
|
||||
...cdkPayer,
|
||||
dms_acctnumber: cdkPayer.dms_acctnumber,
|
||||
controlnumber: job && job[cdkPayer.control_type],
|
||||
};
|
||||
}),
|
||||
});
|
||||
};
|
||||
|
||||
const handleFinish = (values) => {
|
||||
socket.emit(`${determineDmsType(bodyshop)}-export-job`, {
|
||||
jobId: job.id,
|
||||
...values,
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<Form form={form} layout="vertical">
|
||||
<Form form={form} layout="vertical" onFinish={handleFinish}>
|
||||
<LayoutFormRow>
|
||||
<Form.Item
|
||||
name="journal"
|
||||
@@ -39,6 +75,32 @@ export function DmsPostForm({ bodyshop, socket, jobId }) {
|
||||
>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name="kmin"
|
||||
label={t("jobs.fields.kmin")}
|
||||
initialValue={job && job.kmin}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<InputNumber disabled />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name="kmout"
|
||||
label={t("jobs.fields.kmout")}
|
||||
initialValue={job && job.kmout}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<InputNumber disabled />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name="dms_make"
|
||||
label={t("jobs.fields.dms.dms_make")}
|
||||
@@ -81,20 +143,30 @@ export function DmsPostForm({ bodyshop, socket, jobId }) {
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Input />
|
||||
<Select
|
||||
onSelect={(value) => handlePayerSelect(value, index)}
|
||||
>
|
||||
{bodyshop.cdk_configuration &&
|
||||
bodyshop.cdk_configuration.payers &&
|
||||
bodyshop.cdk_configuration.payers.map((payer) => (
|
||||
<Select.Option key={payer.name}>
|
||||
{payer.name}
|
||||
</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item
|
||||
label={t("jobs.fields.dms.payer.account")}
|
||||
key={`${index}account`}
|
||||
name={[field.name, "account"]}
|
||||
label={t("jobs.fields.dms.payer.dms_acctnumber")}
|
||||
key={`${index}dms_acctnumber`}
|
||||
name={[field.name, "dms_acctnumber"]}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Input />
|
||||
<Input disabled />
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item
|
||||
@@ -107,8 +179,9 @@ export function DmsPostForm({ bodyshop, socket, jobId }) {
|
||||
},
|
||||
]}
|
||||
>
|
||||
<CurrencyInput />
|
||||
<CurrencyInput min={0} />
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item
|
||||
label={t("jobs.fields.dms.payer.controlnumber")}
|
||||
key={`${index}controlnumber`}
|
||||
@@ -122,6 +195,27 @@ export function DmsPostForm({ bodyshop, socket, jobId }) {
|
||||
<Input />
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item shouldUpdate>
|
||||
{() => {
|
||||
const payers = form.getFieldValue("payers");
|
||||
|
||||
const row = payers && payers[index];
|
||||
|
||||
const cdkPayer =
|
||||
bodyshop.cdk_configuration.payers &&
|
||||
bodyshop.cdk_configuration.payers.find(
|
||||
(i) => i && row && i.name === row.name
|
||||
);
|
||||
|
||||
return (
|
||||
<div>
|
||||
{cdkPayer &&
|
||||
t(`jobs.fields.${cdkPayer.control_type}`)}
|
||||
</div>
|
||||
);
|
||||
}}
|
||||
</Form.Item>
|
||||
|
||||
<DeleteFilled
|
||||
onClick={() => {
|
||||
remove(field.name);
|
||||
@@ -133,18 +227,58 @@ export function DmsPostForm({ bodyshop, socket, jobId }) {
|
||||
<Form.Item>
|
||||
<Button
|
||||
type="dashed"
|
||||
disabled={!(fields.length < 3)}
|
||||
onClick={() => {
|
||||
add();
|
||||
if (fields.length < 3) add();
|
||||
}}
|
||||
style={{ width: "100%" }}
|
||||
>
|
||||
{t("general.actions.add")}
|
||||
{t("dms.actions.addpayer")}
|
||||
</Button>
|
||||
</Form.Item>
|
||||
</div>
|
||||
);
|
||||
}}
|
||||
</Form.List>
|
||||
<Form.Item shouldUpdate>
|
||||
{() => {
|
||||
//Perform Calculation to determine discrepancy.
|
||||
let totalAllocated = Dinero();
|
||||
|
||||
const payers = form.getFieldValue("payers");
|
||||
payers &&
|
||||
payers.forEach((payer) => {
|
||||
totalAllocated = totalAllocated.add(
|
||||
Dinero({ amount: Math.round((payer?.amount || 0) * 100) })
|
||||
);
|
||||
});
|
||||
const discrep = Dinero(job.job_totals.totals.total_repairs).subtract(
|
||||
totalAllocated
|
||||
);
|
||||
return (
|
||||
<Space>
|
||||
<Statistic
|
||||
title={t("jobs.labels.dms.totalallocated")}
|
||||
value={totalAllocated.toFormat()}
|
||||
/>
|
||||
<Statistic
|
||||
title={t("jobs.fields.subtotal")}
|
||||
value={Dinero(job.job_totals.totals.total_repairs).toFormat()}
|
||||
/>
|
||||
<Statistic
|
||||
title={t("jobs.labels.dms.notallocated")}
|
||||
valueStyle={{
|
||||
color: discrep.getAmount() === 0 ? "green" : "red",
|
||||
}}
|
||||
value={discrep.toFormat()}
|
||||
/>
|
||||
<Button disabled={discrep.getAmount() !== 0} htmlType="submit">
|
||||
{t("jobs.actions.dms.post")}
|
||||
</Button>
|
||||
</Space>
|
||||
);
|
||||
}}
|
||||
</Form.Item>
|
||||
</Form>
|
||||
);
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1725,6 +1725,8 @@ export const QUERY_JOB_CLOSE_DETAILS = gql`
|
||||
actual_delivery
|
||||
scheduled_in
|
||||
actual_in
|
||||
kmin
|
||||
kmout
|
||||
joblines(where: { removed: { _eq: false } }) {
|
||||
id
|
||||
removed
|
||||
@@ -1877,98 +1879,15 @@ export const FIND_JOBS_BY_CLAIM = gql`
|
||||
`;
|
||||
|
||||
export const QUERY_JOB_EXPORT_DMS = gql`
|
||||
query QUERY_JOB_CLOSE_DETAILS($id: uuid!) {
|
||||
query QUERY_JOB_EXPORT_DMS($id: uuid!) {
|
||||
jobs_by_pk(id: $id) {
|
||||
ro_number
|
||||
invoice_allocation
|
||||
ins_co_id
|
||||
id
|
||||
ded_amt
|
||||
ded_status
|
||||
depreciation_taxes
|
||||
other_amount_payable
|
||||
towing_payable
|
||||
storage_payable
|
||||
adjustment_bottom_line
|
||||
federal_tax_rate
|
||||
state_tax_rate
|
||||
local_tax_rate
|
||||
tax_tow_rt
|
||||
tax_str_rt
|
||||
tax_paint_mat_rt
|
||||
tax_sub_rt
|
||||
tax_lbr_rt
|
||||
tax_levies_rt
|
||||
parts_tax_rates
|
||||
ro_number
|
||||
po_number
|
||||
clm_no
|
||||
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
|
||||
status
|
||||
date_exported
|
||||
date_invoiced
|
||||
voided
|
||||
scheduled_completion
|
||||
actual_completion
|
||||
scheduled_delivery
|
||||
actual_delivery
|
||||
scheduled_in
|
||||
actual_in
|
||||
bills {
|
||||
id
|
||||
federal_tax_rate
|
||||
local_tax_rate
|
||||
state_tax_rate
|
||||
is_credit_memo
|
||||
billlines {
|
||||
actual_cost
|
||||
cost_center
|
||||
id
|
||||
quantity
|
||||
}
|
||||
}
|
||||
joblines(where: { removed: { _eq: false } }) {
|
||||
id
|
||||
removed
|
||||
tax_part
|
||||
line_desc
|
||||
prt_dsmk_p
|
||||
prt_dsmk_m
|
||||
part_type
|
||||
oem_partno
|
||||
db_price
|
||||
act_price
|
||||
part_qty
|
||||
mod_lbr_ty
|
||||
db_hrs
|
||||
mod_lb_hrs
|
||||
lbr_op
|
||||
lbr_amt
|
||||
op_code_desc
|
||||
profitcenter_labor
|
||||
profitcenter_part
|
||||
prt_dsmk_p
|
||||
}
|
||||
kmin
|
||||
kmout
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//import { useQuery } from "@apollo/client";
|
||||
import { useQuery } from "@apollo/client";
|
||||
import { Button, Col, Result, Row, Select, Space } from "antd";
|
||||
import queryString from "query-string";
|
||||
import React, { useEffect, useState } from "react";
|
||||
@@ -7,14 +7,14 @@ import { connect } from "react-redux";
|
||||
import { useLocation } from "react-router-dom";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import SocketIO from "socket.io-client";
|
||||
//import AlertComponent from "../../components/alert/alert.component";
|
||||
import AlertComponent from "../../components/alert/alert.component";
|
||||
import DmsAllocationsSummary from "../../components/dms-allocations-summary/dms-allocations-summary.component";
|
||||
import DmsCustomerSelector from "../../components/dms-customer-selector/dms-customer-selector.component";
|
||||
import DmsLogEvents from "../../components/dms-log-events/dms-log-events.component";
|
||||
import DmsPostForm from "../../components/dms-post-form/dms-post-form.component";
|
||||
//import LoadingSpinner from "../../components/loading-spinner/loading-spinner.component";
|
||||
import LoadingSpinner from "../../components/loading-spinner/loading-spinner.component";
|
||||
import { auth } from "../../firebase/firebase.utils";
|
||||
//import { QUERY_JOB_EXPORT_DMS } from "../../graphql/jobs.queries";
|
||||
import { QUERY_JOB_EXPORT_DMS } from "../../graphql/jobs.queries";
|
||||
import {
|
||||
setBreadcrumbs,
|
||||
setSelectedHeader,
|
||||
@@ -52,10 +52,10 @@ export function DmsContainer({ bodyshop, setBreadcrumbs, setSelectedHeader }) {
|
||||
const search = queryString.parse(useLocation().search);
|
||||
const { jobId } = search;
|
||||
|
||||
// const { loading, error } = useQuery(QUERY_JOB_EXPORT_DMS, {
|
||||
// variables: { id: jobId },
|
||||
// skip: true, //!jobId,
|
||||
// });
|
||||
const { loading, error, data } = useQuery(QUERY_JOB_EXPORT_DMS, {
|
||||
variables: { id: jobId },
|
||||
skip: !jobId,
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
document.title = t("titles.dms");
|
||||
@@ -73,7 +73,6 @@ export function DmsContainer({ bodyshop, setBreadcrumbs, setSelectedHeader }) {
|
||||
console.log("Connected again.");
|
||||
});
|
||||
socket.on("reconnect", () => {
|
||||
console.log("Connected again.");
|
||||
setLogs((logs) => {
|
||||
return [
|
||||
...logs,
|
||||
@@ -106,44 +105,38 @@ export function DmsContainer({ bodyshop, setBreadcrumbs, setSelectedHeader }) {
|
||||
|
||||
const dmsType = determineDmsType(bodyshop);
|
||||
|
||||
// if (loading) return <LoadingSpinner />;
|
||||
// if (error) return <AlertComponent message={error.message} type="error" />;
|
||||
if (loading) return <LoadingSpinner />;
|
||||
if (error) return <AlertComponent message={error.message} type="error" />;
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Space>
|
||||
<Button
|
||||
onClick={() => {
|
||||
socket.emit(
|
||||
`${dmsType}-export-job`,
|
||||
"752a4f5f-22ab-414b-b182-98d4e62227ef"
|
||||
);
|
||||
}}
|
||||
>
|
||||
Export
|
||||
</Button>
|
||||
<Select
|
||||
placeholder="Log Level"
|
||||
value={logLevel}
|
||||
onChange={(value) => {
|
||||
setLogLevel(value);
|
||||
socket.emit("set-log-level", value);
|
||||
}}
|
||||
>
|
||||
<Select.Option key="TRACE">TRACE</Select.Option>
|
||||
<Select.Option key="DEBUG">DEBUG</Select.Option>
|
||||
<Select.Option key="INFO">INFO</Select.Option>
|
||||
<Select.Option key="WARNING">WARNING</Select.Option>
|
||||
<Select.Option key="ERROR">ERROR</Select.Option>
|
||||
</Select>
|
||||
<Button onClick={() => setLogs([])}>Clear Logs</Button>
|
||||
</Space>
|
||||
<Row gutter={32}>
|
||||
<Col span={18}>
|
||||
<DmsAllocationsSummary socket={socket} jobId={jobId} />
|
||||
<DmsPostForm socket={socket} jobId={jobId} />
|
||||
<DmsPostForm
|
||||
socket={socket}
|
||||
jobId={jobId}
|
||||
job={data && data.jobs_by_pk}
|
||||
/>
|
||||
</Col>
|
||||
<Col span={6}>
|
||||
<Space>
|
||||
<Select
|
||||
placeholder="Log Level"
|
||||
value={logLevel}
|
||||
onChange={(value) => {
|
||||
setLogLevel(value);
|
||||
socket.emit("set-log-level", value);
|
||||
}}
|
||||
>
|
||||
<Select.Option key="TRACE">TRACE</Select.Option>
|
||||
<Select.Option key="DEBUG">DEBUG</Select.Option>
|
||||
<Select.Option key="INFO">INFO</Select.Option>
|
||||
<Select.Option key="WARNING">WARNING</Select.Option>
|
||||
<Select.Option key="ERROR">ERROR</Select.Option>
|
||||
</Select>
|
||||
<Button onClick={() => setLogs([])}>Clear Logs</Button>
|
||||
</Space>
|
||||
<div style={{ maxHeight: "500px", overflowY: "auto" }}>
|
||||
<DmsLogEvents socket={socket} logs={logs} />
|
||||
</div>
|
||||
@@ -155,7 +148,7 @@ export function DmsContainer({ bodyshop, setBreadcrumbs, setSelectedHeader }) {
|
||||
);
|
||||
}
|
||||
|
||||
const determineDmsType = (bodyshop) => {
|
||||
export const determineDmsType = (bodyshop) => {
|
||||
if (bodyshop.cdk_dealerid) return "cdk";
|
||||
else {
|
||||
return "pbs";
|
||||
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
Alert,
|
||||
Divider,
|
||||
PageHeader,
|
||||
InputNumber,
|
||||
} from "antd";
|
||||
import React, { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
@@ -56,6 +57,8 @@ export function JobsCloseComponent({ job, bodyshop, jobRO }) {
|
||||
actual_in: values.actual_in,
|
||||
actual_completion: values.actual_completion,
|
||||
actual_delivery: values.actual_delivery,
|
||||
kmin: values.kmin,
|
||||
kmout: values.kmout,
|
||||
},
|
||||
},
|
||||
refetchQueries: ["QUERY_JOB_CLOSE_DETAILS"],
|
||||
@@ -112,6 +115,8 @@ export function JobsCloseComponent({ job, bodyshop, jobRO }) {
|
||||
actual_delivery: job.actual_delivery
|
||||
? moment(job.actual_delivery)
|
||||
: job.scheduled_delivery && moment(job.scheduled_delivery),
|
||||
kmin: job.kmin,
|
||||
kmout: job.kmout,
|
||||
}}
|
||||
scrollToFirstError
|
||||
>
|
||||
@@ -203,6 +208,45 @@ export function JobsCloseComponent({ job, bodyshop, jobRO }) {
|
||||
>
|
||||
<DateTimePicker disabled={jobRO} />
|
||||
</Form.Item>
|
||||
{bodyshop.cdk_dealerid && (
|
||||
<Form.Item
|
||||
label={t("jobs.fields.kmin")}
|
||||
name="kmin"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
},
|
||||
]}
|
||||
>
|
||||
<InputNumber />
|
||||
</Form.Item>
|
||||
)}
|
||||
{bodyshop.cdk_dealerid && (
|
||||
<Form.Item
|
||||
label={t("jobs.fields.kmout")}
|
||||
name="kmout"
|
||||
dependencies={["kmin"]}
|
||||
hasFeedback
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
},
|
||||
({ getFieldValue }) => ({
|
||||
validator(_, value) {
|
||||
if (!value || getFieldValue("kmin") <= value) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
return Promise.reject(
|
||||
new Error(t("jobs.labels.dms.kmoutnotgreaterthankmin"))
|
||||
);
|
||||
},
|
||||
}),
|
||||
]}
|
||||
>
|
||||
<InputNumber />
|
||||
</Form.Item>
|
||||
)}
|
||||
</LayoutFormRow>
|
||||
<Divider />
|
||||
<JobsCloseLines job={job} />
|
||||
|
||||
@@ -474,6 +474,9 @@
|
||||
"defaultprofitsmapping": "Default Profits Mapping",
|
||||
"deliverchecklist": "Delivery Checklist",
|
||||
"dms": {
|
||||
"cdk": {
|
||||
"payers": "CDK Payers"
|
||||
},
|
||||
"cdk_dealerid": "CDK Dealer ID",
|
||||
"title": "DMS"
|
||||
},
|
||||
|
||||
@@ -474,6 +474,9 @@
|
||||
"defaultprofitsmapping": "",
|
||||
"deliverchecklist": "",
|
||||
"dms": {
|
||||
"cdk": {
|
||||
"payers": ""
|
||||
},
|
||||
"cdk_dealerid": "",
|
||||
"title": ""
|
||||
},
|
||||
|
||||
@@ -474,6 +474,9 @@
|
||||
"defaultprofitsmapping": "",
|
||||
"deliverchecklist": "",
|
||||
"dms": {
|
||||
"cdk": {
|
||||
"payers": ""
|
||||
},
|
||||
"cdk_dealerid": "",
|
||||
"title": ""
|
||||
},
|
||||
|
||||
@@ -23,7 +23,7 @@ exports.default = async function (socket, jobid) {
|
||||
`Received Job export request for id ${jobid}`
|
||||
);
|
||||
//The following values will be stored on the socket to allow callbacks.
|
||||
//let clVFV, clADPV, clADPC;
|
||||
//let DMSVid, DMSVeh, clADPC;
|
||||
const JobData = await QueryJobData(socket, jobid);
|
||||
const DealerId = JobData.bodyshop.cdk_dealerid;
|
||||
CdkBase.createLogEvent(
|
||||
@@ -33,18 +33,18 @@ exports.default = async function (socket, jobid) {
|
||||
);
|
||||
|
||||
//{1} Begin Calculate DMS Vehicle Id
|
||||
socket.clVFV = await CalculateDmsVid(socket, JobData);
|
||||
if (socket.clVFV.newId === "Y") {
|
||||
socket.DMSVid = await CalculateDmsVid(socket, JobData);
|
||||
if (socket.DMSVid.newId === "Y") {
|
||||
//{1.2} This is a new Vehicle ID
|
||||
CdkBase.createLogEvent(
|
||||
socket,
|
||||
"DEBUG",
|
||||
`{1.2} clVFV DMSVid does *not* exist.`
|
||||
`{1.2} DMSVid DMSVid does *not* exist.`
|
||||
);
|
||||
CdkBase.createLogEvent(
|
||||
socket,
|
||||
"TRACE",
|
||||
`{1.2} clVFV: ${JSON.stringify(socket.clVFV, null, 2)}`
|
||||
`{1.2} DMSVid: ${JSON.stringify(socket.DMSVid, null, 2)}`
|
||||
);
|
||||
//Check if DMSCustId is Empty - which it should always be?
|
||||
//{6.6} Should check to see if a customer exists so that we can marry it to the new vehicle.
|
||||
@@ -55,7 +55,7 @@ exports.default = async function (socket, jobid) {
|
||||
);
|
||||
|
||||
//Array
|
||||
const strIDS = await FindCustomerIdFromDms(socket, JobData);
|
||||
const strIDS = await QueryDmsCustomerByName(socket, JobData);
|
||||
if (strIDS && strIDS.length > 0) {
|
||||
CdkBase.createLogEvent(
|
||||
socket,
|
||||
@@ -120,18 +120,22 @@ exports.default = async function (socket, jobid) {
|
||||
);
|
||||
}
|
||||
} else {
|
||||
CdkBase.createLogEvent(socket, "DEBUG", `{1.1} clVFV DMSVid does exist.`);
|
||||
CdkBase.createLogEvent(
|
||||
socket,
|
||||
"DEBUG",
|
||||
`{1.1} DMSVid DMSVid does exist.`
|
||||
);
|
||||
CdkBase.createLogEvent(
|
||||
socket,
|
||||
"TRACE",
|
||||
`{1.1} clVFV: ${JSON.stringify(socket.clVFV, null, 2)}`
|
||||
`{1.1} DMSVid: ${JSON.stringify(socket.DMSVid, null, 2)}`
|
||||
);
|
||||
|
||||
//{2} Begin Find Vehicle in DMS
|
||||
socket.clADPV = await FindVehicleInDms(socket, JobData, socket.clVFV); //TODO: Verify that this should always return a result. If an ID was found previously, it should be correct?
|
||||
socket.DMSVeh = await QueryDmsVehicleById(socket, JobData, socket.DMSVid); //TODO: Verify that this should always return a result. If an ID was found previously, it should be correct?
|
||||
|
||||
//{2.2} Check if the vehicle was found in the DMS.
|
||||
if (socket.clADPV.AppErrorNo === "0") {
|
||||
if (socket.DMSVeh.AppErrorNo === "0") {
|
||||
//Vehicle was found.
|
||||
CdkBase.createLogEvent(
|
||||
socket,
|
||||
@@ -141,7 +145,7 @@ exports.default = async function (socket, jobid) {
|
||||
CdkBase.createLogEvent(
|
||||
socket,
|
||||
"TRACE",
|
||||
`{1.4} clADPV: ${JSON.stringify(socket.clADPV, null, 2)}`
|
||||
`{1.4} DMSVeh: ${JSON.stringify(socket.DMSVeh, null, 2)}`
|
||||
);
|
||||
} else {
|
||||
//Vehicle was not found.
|
||||
@@ -153,7 +157,7 @@ exports.default = async function (socket, jobid) {
|
||||
CdkBase.createLogEvent(
|
||||
socket,
|
||||
"TRACE",
|
||||
`{6.4} clVFV: ${JSON.stringify(socket.clVFV, null, 2)}`
|
||||
`{6.4} DMSVid: ${JSON.stringify(socket.DMSVid, null, 2)}`
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -308,7 +312,7 @@ async function GenerateCustomerNumberFromDms(socket, JobData) {
|
||||
}
|
||||
}
|
||||
|
||||
async function FindCustomerIdFromDms(socket, JobData) {
|
||||
async function QueryDmsCustomerByName(socket, JobData) {
|
||||
const ownerName = `${JobData.ownr_ln},${JobData.ownr_fn}`;
|
||||
CdkBase.createLogEvent(
|
||||
socket,
|
||||
@@ -352,23 +356,24 @@ async function FindCustomerIdFromDms(socket, JobData) {
|
||||
CdkBase.createLogEvent(
|
||||
socket,
|
||||
"ERROR",
|
||||
`Error in FindCustomerIdFromDms - ${JSON.stringify(error, null, 2)}`
|
||||
`Error in QueryDmsCustomerByName - ${JSON.stringify(error, null, 2)}`
|
||||
);
|
||||
throw new Error(error);
|
||||
}
|
||||
}
|
||||
|
||||
async function FindVehicleInDms(socket, JobData, clVFV) {
|
||||
async function QueryDmsVehicleById(socket, JobData, DMSVid) {
|
||||
CdkBase.createLogEvent(
|
||||
socket,
|
||||
"DEBUG",
|
||||
`{2}/{6} Begin Find Vehicle In DMS using clVFV: ${clVFV}`
|
||||
`{2}/{6} Begin Find Vehicle In DMS using DMSVid: ${DMSVid}`
|
||||
);
|
||||
|
||||
try {
|
||||
const soapClientVehicleInsertUpdate = await soap.createClientAsync(
|
||||
CdkWsdl.VehicleInsertUpdate
|
||||
);
|
||||
|
||||
const soapResponseVehicleInsertUpdate =
|
||||
await soapClientVehicleInsertUpdate.readBulkAsync(
|
||||
{
|
||||
@@ -376,7 +381,7 @@ async function FindVehicleInDms(socket, JobData, clVFV) {
|
||||
arg1: { id: JobData.bodyshop.cdk_dealerid },
|
||||
arg2: {
|
||||
fileType: "VEHICLES",
|
||||
vehiclesVehicleId: clVFV.vehiclesVehId,
|
||||
vehiclesVehicleId: DMSVid.vehiclesVehId,
|
||||
},
|
||||
},
|
||||
|
||||
@@ -401,7 +406,7 @@ async function FindVehicleInDms(socket, JobData, clVFV) {
|
||||
CdkBase.createLogEvent(
|
||||
socket,
|
||||
"ERROR",
|
||||
`Error in FindVehicleInDms - ${JSON.stringify(error, null, 2)}`
|
||||
`Error in QueryDmsVehicleById - ${JSON.stringify(error, null, 2)}`
|
||||
);
|
||||
throw new Error(error);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user