Initial working ATA scrubbing.

This commit is contained in:
Patrick Fic
2025-07-11 16:13:45 -07:00
parent a1dfcf4457
commit dcc59ab2fe
5 changed files with 20 additions and 13 deletions

View File

@@ -287,7 +287,7 @@ async function DecodeVehFile(extensionlessFilePath) {
// "V_ENGINE",
// "V_COLOR",
// "V_TONE",
"V_STAGE",
"V_STAGE",
// "PAINT_CD1",
// "PAINT_CD2",
// "PAINT_CD3",
@@ -400,7 +400,7 @@ async function DecodePflFile(extensionlessFilePath,) {
let dbf = await DBFFile.open(`${extensionlessFilePath}.PFL`);
let records = await dbf.readRecords();
let pflLines = records.map((record) => {
return _.transform(
return (
_.pick(record, [
"LBR_TYPE", "LBR_DESC", "LBR_RATE"
])
@@ -415,7 +415,7 @@ async function DecodeStlFile(extensionlessFilePath,) {
let dbf = await DBFFile.open(`${extensionlessFilePath}.STL`);
let records = await dbf.readRecords();
let pflLines = records.map((record) => {
return _.transform(
return (
_.pick(record, [
"TTL_TYPECD", "T_AMT", 'T_HRS', "NT_HRS"
])
@@ -431,7 +431,7 @@ async function DecodePfmFile(extensionlessFilePath,) {
let dbf = await DBFFile.open(`${extensionlessFilePath}.PFM`);
let records = await dbf.readRecords();
let pflLines = records.map((record) => {
return _.transform(
return (
_.pick(record, [
"MAT_TYPE", "CAL_PRETHR"
])

View File

@@ -8,7 +8,6 @@ const axios = require("axios");
const TestJson = require("./A.json");
const { BrowserWindow } = require("electron");
async function ScrubEstimate({ job }) {
//TODO: Fetch these from ImEX Online API.
const basicAuthUser = "Imex";
@@ -26,12 +25,14 @@ async function ScrubEstimate({ job }) {
job.sending_entity_id = sendingEntityId;
job.sending_entity_accept_terms_of_use = true;
job.association_switch = "ATAM";
job.rf_ph1 = "R0G 1Z0";
job.rf_zip = "2043792253";
job.rf_zip = "R0G 1Z0";
job.rf_ph1 = "2043792253";
job.g_ttl_amt = job.clm_total;
delete job.clm_total;
console.log("*** ~ ScrubEstimate ~ job:", job);
log.debug("Estimate Scrubber Job Data:", job);
//Build the JSON Form Data
const fileName = `RPSTest-${job.id}-${Date.now()}`;
const formData = new FormData();
@@ -45,11 +46,10 @@ async function ScrubEstimate({ job }) {
},
headers: formData.getHeaders ? formData.getHeaders() : {}
});
console.log("*** ~ handleScrub ~ result:", result.data);
const resultPDFUrl = result?.data?.[0] || `https://www.insurtechtoolkit.com/analysis/${fileName}.pdf`;
console.log("*** ~ handleScrub ~ resultPDFUrl:", resultPDFUrl);
log.debug("Estimate Scrubber Result:", result.data, resultPDFUrl);
const pdfWindow = new BrowserWindow({
webPreferences: {

View File

@@ -6,7 +6,7 @@ import ipcTypes from "../../../ipc.types";
import { selectBodyshop } from "../../../redux/user/user.selectors";
import { useApolloClient } from "@apollo/client";
import { QUERY_JOB_ESTIMATE_SCRUBBER } from "../../../graphql/jobs.queries";
import _ from "lodash";
const { ipcRenderer } = window;
const mapStateToProps = createStructuredSelector({
//currentUser: selectCurrentUser
@@ -17,7 +17,7 @@ const mapDispatchToProps = (dispatch) => ({
});
export default connect(mapStateToProps, mapDispatchToProps)(EstimateScrubberButton);
export function EstimateScrubberButton({ bodyshop, jobid }) {
export function EstimateScrubberButton({ bodyshop, jobid, job }) {
const [loading, setLoading] = useState(false);
const client = useApolloClient();
const handleScrub = async () => {
@@ -45,7 +45,7 @@ export function EstimateScrubberButton({ bodyshop, jobid }) {
};
return (
<Button onClick={handleScrub} loading={loading}>
<Button onClick={handleScrub} disabled={job?.g_bett_amt == null} loading={loading}>
Scrub Estimate with Estimate Scrubber
</Button>
);

View File

@@ -83,7 +83,13 @@ export function JobsDetailOrganism({ selectedJobId, setSelectedJobTargetPc }) {
<Card
title="Estimate Lines"
extra={[<EstimateScrubberButton key="es" jobid={data ? data.jobs_by_pk?.id : null} />]}
extra={[
<EstimateScrubberButton
key="es"
jobid={data ? data.jobs_by_pk?.id : null}
job={data ? data.jobs_by_pk : null}
/>
]}
>
<JobsLinesTableMolecule loading={loading} job={data ? data.jobs_by_pk : {}} />
</Card>

View File

@@ -102,6 +102,7 @@ export const QUERY_JOB_BY_PK = gql`
requires_reimport
created_at
v_mileage
g_bett_amt
joblines(order_by: { line_no: asc }) {
id
line_no