Cleaned up Job Queue, Gql Logs, and fixed issue for audatex Lin Files with PART_DES_J

This commit is contained in:
Patrick Fic
2020-12-03 16:59:10 -08:00
parent 53372cce9f
commit 3324f4c3b4
7 changed files with 74 additions and 46 deletions

View File

@@ -29,6 +29,8 @@ namespace BodyshopPartner.Utils.Decoder
string _dir = Path.GetDirectoryName(FilePath) + @"\";
string system = ParseEnvFile(ref ret, _dir);
ParseAd1File(ref ret, _dir);
ParseAd2File(ref ret, _dir);
ParseVehFile(ref ret, _dir);
@@ -37,11 +39,51 @@ namespace BodyshopPartner.Utils.Decoder
ParsePfmFile(ref ret, _dir);
ParseStlFile(ref ret, _dir);
ParseTtlFile(ref ret, _dir);
ParseLinFile(ref ret, _dir);
ParseLinFile(ref ret, _dir, system);
ParsePfpFile(ref ret, _dir);
return ret;
}
public static string ParseEnvFile(ref dynamic j, string RootFilePath)
{
if (string.IsNullOrWhiteSpace(j.ciecaid.Value))
{
return "M";
}
logger.Trace(@"Parsing Env at: {0}{1}", RootFilePath, j.ciecaid.Value);
int retryNumber = 0;
while (retryNumber < 11)
{
try
{
using (Stream fis = File.Open(RootFilePath + j.ciecaid.Value + ".env", FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
{
var reader = new DBFReader(fis);
reader.SetSelectFields(new string[] { "EST_SYSTEM"
});
var readValues = reader.NextRecord();
reader.Dispose();
return readValues[0].ToString();
}
}
catch (IOException ex)
{
logger.Trace(ex, "Unable to open AD1 file. Retrying. ");
retryNumber++;
Thread.Sleep(3000);
}
}
return "M";
}
public static void ParseAd1File(ref dynamic j, string RootFilePath)
{
if (string.IsNullOrWhiteSpace(j.ciecaid.Value))
@@ -792,7 +834,7 @@ namespace BodyshopPartner.Utils.Decoder
}
}
public static void ParseLinFile(ref dynamic j, string RootFilePath)
public static void ParseLinFile(ref dynamic j, string RootFilePath, string system)
{
if (string.IsNullOrWhiteSpace(j.ciecaid.Value))
{
@@ -818,7 +860,7 @@ namespace BodyshopPartner.Utils.Decoder
"WHO_PAYS",
"LINE_DESC",
"PART_TYPE",
"PART_DESCJ",
system == "M"? "PART_DESCJ" : "PART_DES_J",
"GLASS_FLAG",
"OEM_PARTNO",
"PRICE_INC",
@@ -921,7 +963,7 @@ namespace BodyshopPartner.Utils.Decoder
dynamic lin = new JObject();
//Mising est_seq
lin.line_no = readValues[0];//LINE_NO
lin.line_ind = readValues[1];//LINE_IND
lin.line_ref = readValues[2];//LINE_REF