Merge branch 'feature/pbs' into release/2021-10-22

This commit is contained in:
Patrick Fic
2021-10-18 22:12:16 -07:00
11 changed files with 91 additions and 2 deletions

View File

@@ -199,7 +199,7 @@ export function AccountingReceivablesTableComponent({
<Card
extra={
<Space wrap>
{!bodyshop.cdk_dealerid && (
{!bodyshop.cdk_dealerid && !bodyshop.pbs_serialnumber && (
<JobsExportAllButton
jobIds={selectedJobs}
disabled={transInProgress || selectedJobs.length === 0}

View File

@@ -37,7 +37,7 @@ export function JobsCloseExportButton({
const handleQbxml = async () => {
//Check if it's a CDK setup.
if (bodyshop.cdk_dealerid) {
if (bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber) {
history.push(`/manage/dms?jobId=${jobId}`);
return;
}

View File

@@ -203,6 +203,14 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) {
</LayoutFormRow>
</>
)}
{bodyshop.pbs_serialnumber && (
<>
<DataLabel label={t("bodyshop.labels.dms.pbs_serialnumber")}>
{form.getFieldValue("pbs_serialnumber")}
</DataLabel>
</>
)}
<LayoutFormRow header={t("bodyshop.labels.responsibilitycenters.costs")}>
<Form.List name={["md_responsibility_centers", "costs"]}>
{(fields, { add, remove }) => {

View File

@@ -96,6 +96,8 @@ export const QUERY_BODYSHOP = gql`
cdk_configuration
md_estimators
md_ded_notes
pbs_configuration
pbs_serialnumber
employees {
id
active
@@ -188,6 +190,8 @@ export const UPDATE_SHOP = gql`
cdk_configuration
md_estimators
md_ded_notes
pbs_configuration
pbs_serialnumber
employees {
id
first_name

View File

@@ -0,0 +1,4 @@
-- Could not auto-generate a down migration.
-- Please write an appropriate down migration for the SQL below:
-- alter table "public"."bodyshops" add column "pbs_configuration" jsonb
-- null default jsonb_build_object();

View File

@@ -0,0 +1,2 @@
alter table "public"."bodyshops" add column "pbs_configuration" jsonb
null default jsonb_build_object();

View File

@@ -0,0 +1,4 @@
-- Could not auto-generate a down migration.
-- Please write an appropriate down migration for the SQL below:
-- alter table "public"."bodyshops" add column "pbs_serialnumber" text
-- null;

View File

@@ -0,0 +1,2 @@
alter table "public"."bodyshops" add column "pbs_serialnumber" text
null;

View File

@@ -0,0 +1,21 @@
const path = require("path");
require("dotenv").config({
path: path.resolve(
process.cwd(),
`.env.${process.env.NODE_ENV || "development"}`
),
});
const CdkBase = require("../web-sockets/web-socket");
const IMEX_PBS_USER = process.env.IMEX_PBS_USER,
IMEX_PBS_PASSWORD = process.env.IMEX_PBS_PASSWORD;
const PBS_CREDENTIALS = {
password: IMEX_PBS_PASSWORD,
username: IMEX_PBS_USER,
};
exports.PBS_CREDENTIALS = PBS_CREDENTIALS;
// const cdkDomain =
// process.env.NODE_ENV === "production"
// ? "https://3pa.dmotorworks.com"
// : "https://uat-3pa.dmotorworks.com";

View File

@@ -0,0 +1,35 @@
const path = require("path");
require("dotenv").config({
path: path.resolve(
process.cwd(),
`.env.${process.env.NODE_ENV || "development"}`
),
});
const GraphQLClient = require("graphql-request").GraphQLClient;
const soap = require("soap");
const queries = require("../../graphql-client/queries");
const CdkBase = require("../../web-sockets/web-socket");
//const { CDK_CREDENTIALS, CheckCdkResponseForError } = require("./cdk-wsdl");
//const CalcualteAllocations = require("./cdk-calculate-allocations").default;
const moment = require("moment");
exports.default = async function (socket, jobid) {
socket.logEvents = [];
socket.recordid = jobid;
try {
CdkBase.createLogEvent(
socket,
"DEBUG",
`Received Job export request for id ${jobid}`
);
} catch (error) {
CdkBase.createLogEvent(
socket,
"ERROR",
`Error encountered in PbsJobExport. ${error}`
);
}
};

View File

@@ -17,6 +17,7 @@ const CdkCalculateAllocations =
require("../cdk/cdk-calculate-allocations").default;
const { isArray } = require("lodash");
const logger = require("../utils/logger");
const PbsExportJob = require("../accounting/pbs/pbs-job-export");
io.use(function (socket, next) {
try {
@@ -57,6 +58,7 @@ io.on("connection", (socket) => {
});
});
///CDK
socket.on("cdk-export-job", (jobid) => {
CdkJobExport(socket, jobid);
});
@@ -94,6 +96,13 @@ io.on("connection", (socket) => {
callback(allocations);
});
//END CDK
//PBS
socket.on("pbs-export-job", (jobid) => {
PbsExportJob(socket, jobid);
});
//End PBS
socket.on("disconnect", () => {
createLogEvent(socket, "DEBUG", `User disconnected.`);