Refactor PPC to pull out reusable componenets.

This commit is contained in:
Patrick Fic
2025-04-04 09:12:38 -07:00
parent 85fcecf856
commit f3adc76574
17 changed files with 957 additions and 451 deletions

View File

@@ -1,8 +1,6 @@
import { DBFFile, FieldDescriptor } from "dbffile";
import {
deleteEmsFileIfExists,
generatePpcFilePath,
} from "./ppc-generate-file";
import { DBFFile } from "dbffile";
import { envFieldLineDescriptors } from "../util/ems-interface/fielddescriptors/env-field-descriptor";
import { deleteEmsFileIfExists, generatePpcFilePath } from "../util/ems-util";
import { PpcJob } from "./ppc-handler";
const GenerateEnvFile = async (job: PpcJob): Promise<boolean> => {
@@ -20,7 +18,6 @@ const GenerateEnvFile = async (job: PpcJob): Promise<boolean> => {
INCL_VENDR: false,
},
];
//Check if it already exists, delete it if so.
await deleteEmsFileIfExists(generatePpcFilePath(`${job.ciecaid}.ENV`));
@@ -35,157 +32,3 @@ const GenerateEnvFile = async (job: PpcJob): Promise<boolean> => {
};
export default GenerateEnvFile;
//Taken from a set of CCC ems files.
const envFieldLineDescriptors: FieldDescriptor[] = [
{
name: "EST_SYSTEM",
type: "C",
size: 1,
decimalPlaces: 0,
},
{
name: "SW_VERSION",
type: "C",
size: 10,
decimalPlaces: 0,
},
{
name: "DB_VERSION",
type: "C",
size: 12,
decimalPlaces: 0,
},
{
name: "DB_DATE",
type: "D",
size: 8,
decimalPlaces: 0,
},
{
name: "UNQFILE_ID",
type: "C",
size: 8,
decimalPlaces: 0,
},
{
name: "RO_ID",
type: "C",
size: 8,
decimalPlaces: 0,
},
{
name: "ESTFILE_ID",
type: "C",
size: 38,
decimalPlaces: 0,
},
{
name: "SUPP_NO",
type: "C",
size: 3,
decimalPlaces: 0,
},
{
name: "EST_CTRY",
type: "C",
size: 3,
decimalPlaces: 0,
},
{
name: "TOP_SECRET",
type: "C",
size: 80,
decimalPlaces: 0,
},
{
name: "H_TRANS_ID",
type: "C",
size: 9,
decimalPlaces: 0,
},
{
name: "H_CTRL_NO",
type: "C",
size: 9,
decimalPlaces: 0,
},
{
name: "TRANS_TYPE",
type: "C",
size: 1,
decimalPlaces: 0,
},
{
name: "STATUS",
type: "L",
size: 1,
decimalPlaces: 0,
},
{
name: "CREATE_DT",
type: "D",
size: 8,
decimalPlaces: 0,
},
{
name: "CREATE_TM",
type: "C",
size: 6,
decimalPlaces: 0,
},
{
name: "TRANSMT_DT",
type: "D",
size: 8,
decimalPlaces: 0,
},
{
name: "TRANSMT_TM",
type: "C",
size: 6,
decimalPlaces: 0,
},
{
name: "INCL_ADMIN",
type: "L",
size: 1,
decimalPlaces: 0,
},
{
name: "INCL_VEH",
type: "L",
size: 1,
decimalPlaces: 0,
},
{
name: "INCL_EST",
type: "L",
size: 1,
decimalPlaces: 0,
},
{
name: "INCL_PROFL",
type: "L",
size: 1,
decimalPlaces: 0,
},
{
name: "INCL_TOTAL",
type: "L",
size: 1,
decimalPlaces: 0,
},
{
name: "INCL_VENDR",
type: "L",
size: 1,
decimalPlaces: 0,
},
{
name: "EMS_VER",
type: "C",
size: 5,
decimalPlaces: 0,
},
];