Added PFM parsing support.
This commit is contained in:
@@ -34,6 +34,7 @@ namespace BodyshopUploader.Utils.Decoder
|
||||
ParseVehFile(ref ret, _dir);
|
||||
ParsePfhFile(ref ret, _dir);
|
||||
ParsePflFile(ref ret, _dir);
|
||||
ParsePfmFile(ref ret, _dir);
|
||||
//ParseStlFile(ref ret, _dir); //Contains information about the total amounts of the estimate.
|
||||
//ParseTtlFile(ref ret, _dir);
|
||||
//ParseLinFile(ref ret, _dir);
|
||||
@@ -210,6 +211,8 @@ namespace BodyshopUploader.Utils.Decoder
|
||||
|
||||
j.owner = new JObject();
|
||||
j.owner.data = ownerRoot;
|
||||
reader.Dispose();
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -361,7 +364,7 @@ namespace BodyshopUploader.Utils.Decoder
|
||||
|
||||
|
||||
|
||||
|
||||
reader.Dispose();
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -418,7 +421,7 @@ namespace BodyshopUploader.Utils.Decoder
|
||||
//j.adj_strdis = readValues[16];//ADJ_STRDIS
|
||||
//j.adj_btr_in = readValues[17];//ADJ_BTR_IN
|
||||
//j.tax_predis = readValues[18];//TAX_PREDIS
|
||||
|
||||
reader.Dispose();
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -532,7 +535,7 @@ namespace BodyshopUploader.Utils.Decoder
|
||||
//j.lbr_tx_ty5 = readValues[14];//LBR_TX_TY5
|
||||
//j.lbr_tx_in5 = readValues[15];//LBR_TX_IN5
|
||||
|
||||
|
||||
reader.Dispose();
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -545,6 +548,135 @@ namespace BodyshopUploader.Utils.Decoder
|
||||
}
|
||||
}
|
||||
|
||||
public static void ParsePfmFile(ref dynamic j, string RootFilePath)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(j.ciecaid.Value))
|
||||
{
|
||||
return;
|
||||
}
|
||||
logger.Trace(@"Parsing PFM at: {0}{1}", RootFilePath, j.ciecaid.Value);
|
||||
|
||||
int retryNumber = 0;
|
||||
while (retryNumber < 11)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (Stream fis = File.Open(RootFilePath + j.ciecaid.Value + ".pfm", FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
|
||||
{
|
||||
//"CAL_LBRMAX may have null values. had to be removed becauase dbf reader expects 0 and not null.
|
||||
var reader = new DBFReader(fis);
|
||||
reader.SetSelectFields(new string[] { "MATL_TYPE",
|
||||
"CAL_CODE",
|
||||
"CAL_DESC",
|
||||
"CAL_MAXDLR",
|
||||
"CAL_PRIP",
|
||||
|
||||
"CAL_SECP",
|
||||
"MAT_CALP",
|
||||
"CAL_PRETHR",
|
||||
"CAL_PSTTHR",
|
||||
"CAL_THRAMT",
|
||||
|
||||
"CAL_LBRMIN",
|
||||
|
||||
"CAL_LBRRTE",
|
||||
"CAL_OPCODE",
|
||||
|
||||
"TAX_IND",
|
||||
"MAT_TAXP",
|
||||
"MAT_ADJP",
|
||||
"MAT_TX_TY1",
|
||||
"MAT_TX_IN1",
|
||||
"MAT_TX_TY2",
|
||||
"MAT_TX_IN2",
|
||||
"MAT_TX_TY3",
|
||||
"MAT_TX_IN3",
|
||||
"MAT_TX_TY4",
|
||||
"MAT_TX_IN4",
|
||||
"MAT_TX_TY5",
|
||||
"MAT_TX_IN5"
|
||||
});
|
||||
for (int i = 0; i < reader.RecordCount; i++)
|
||||
{
|
||||
var readValues = reader.NextRecord();
|
||||
switch (readValues[0].ToString())//Case switch on MATL_TYPE to assign correctly.
|
||||
{
|
||||
case "MAPA":
|
||||
j.rate_mapa = readValues[11];
|
||||
j.tax_paint_mat_rt = readValues[14];
|
||||
break;
|
||||
case "MASH":
|
||||
j.rate_mash = readValues[11];
|
||||
break;
|
||||
case "MAHW":
|
||||
j.rate_mahw = readValues[11];
|
||||
j.tax_levies_rt = readValues[14];
|
||||
break;
|
||||
case "MA2S":
|
||||
j.rate_ma2s = readValues[11];
|
||||
break;
|
||||
case "MA2T":
|
||||
j.rate_ma2t = readValues[11];
|
||||
break;
|
||||
case "MA3S":
|
||||
j.rate_ma3s = readValues[11];
|
||||
break;
|
||||
case "MACS":
|
||||
j.rate_macs = readValues[11];
|
||||
break;
|
||||
case "MABL":
|
||||
j.rate_mabl = readValues[11];
|
||||
break;
|
||||
default:
|
||||
logger.Error("Unknown type value present in PFM file. {0}:{1}", readValues[0].ToString(), readValues[2]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: There was additional logic in paradox here around the mxdlr being > 0 which it always appears to be.
|
||||
|
||||
//j.matl_type = readValues[0];//MATL_TYPE
|
||||
//j.cal_code = readValues[1];//CAL_CODE
|
||||
//j.cal_desc = readValues[2];//CAL_DESC
|
||||
//j.cal_maxdlr = readValues[3];//CAL_MAXDLR
|
||||
//j.cal_prip = readValues[4];//CAL_PRIP
|
||||
//j.cal_secp = readValues[5];//CAL_SECP
|
||||
//j.mat_calp = readValues[6];//MAT_CALP
|
||||
//j.cal_prethr = readValues[7];//CAL_PRETHR
|
||||
//j.cal_pstthr = readValues[8];//CAL_PSTTHR
|
||||
//j.cal_thramt = readValues[9];//CAL_THRAMT
|
||||
//j.cal_lbrmin = readValues[10];//CAL_LBRMIN
|
||||
//j.cal_lbrrte = readValues[11];//CAL_LBRRTE
|
||||
//j.cal_opcode = readValues[12];//CAL_OPCODE
|
||||
//j.tax_ind = readValues[13];//TAX_IND
|
||||
//j.mat_taxp = readValues[14];//MAT_TAXP
|
||||
//j.mat_adjp = readValues[15];//MAT_ADJP
|
||||
//j.mat_tx_ty1 = readValues[16];//MAT_TX_TY1
|
||||
//j.mat_tx_in1 = readValues[17];//MAT_TX_IN1
|
||||
//j.mat_tx_ty2 = readValues[18];//MAT_TX_TY2
|
||||
//j.mat_tx_in2 = readValues[19];//MAT_TX_IN2
|
||||
//j.mat_tx_ty3 = readValues[20];//MAT_TX_TY3
|
||||
//j.mat_tx_in3 = readValues[21];//MAT_TX_IN3
|
||||
//j.mat_tx_ty4 = readValues[22];//MAT_TX_TY4
|
||||
//j.mat_tx_in4 = readValues[23];//MAT_TX_IN4
|
||||
//j.mat_tx_ty5 = readValues[24];//MAT_TX_TY5
|
||||
//j.mat_tx_in5 = readValues[25];//MAT_TX_IN5
|
||||
|
||||
|
||||
|
||||
reader.Dispose();
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
logger.Trace(ex, "Unable to open PFM file. Retrying. ");
|
||||
retryNumber++;
|
||||
Thread.Sleep(3000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void ParseVehFile(ref dynamic j, string RootFilePath)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(j.ciecaid.Value)) { return; }
|
||||
|
||||
Reference in New Issue
Block a user