Decoder changes for adjustrite.

This commit is contained in:
Patrick Fic
2022-08-30 15:06:44 -07:00
parent ab3e947e8e
commit 9c3585d107
6 changed files with 322 additions and 246 deletions

View File

@@ -361,16 +361,16 @@
<Version>3.7.2</Version>
</PackageReference>
<PackageReference Include="GraphQL.Client">
<Version>4.0.1</Version>
<Version>5.1.0</Version>
</PackageReference>
<PackageReference Include="GraphQL.Client.Serializer.Newtonsoft">
<Version>4.0.1</Version>
<Version>5.1.0</Version>
</PackageReference>
<PackageReference Include="Hardcodet.NotifyIcon.Wpf">
<Version>1.1.0</Version>
</PackageReference>
<PackageReference Include="MaterialDesignThemes">
<Version>4.2.1</Version>
<Version>4.5.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.CSharp">
<Version>4.7.0</Version>
@@ -405,7 +405,7 @@
<Version>3.1.0</Version>
</PackageReference>
<PackageReference Include="RestSharp">
<Version>107.3.0</Version>
<Version>108.0.1</Version>
</PackageReference>
<PackageReference Include="Simple-HTTP">
<Version>1.0.6</Version>

View File

@@ -100,8 +100,22 @@ namespace BodyshopPartner.Utils.Decoder
{
try
{
using (Stream fis = File.Open(RootFilePath + j.ciecaid.Value + "A.ad1", FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
Stream fis = null;
try
{
fis = File.Open(RootFilePath + j.ciecaid.Value + "A.ad1", FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
}
catch (Exception ex)
{
logger.Warn("*A.ad1 could not be opened.");
}
if (fis == null)
{
fis = File.Open(RootFilePath + j.ciecaid.Value + ".ad1", FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
}
var reader = new DBFReader(fis);
var type = reader.GetType();
@@ -318,8 +332,9 @@ namespace BodyshopPartner.Utils.Decoder
j.owner.data = ownerRoot;
reader.Dispose();
fis.Dispose();
return true;
}
}
catch (IOException ex)
{
@@ -346,8 +361,23 @@ namespace BodyshopPartner.Utils.Decoder
{
try
{
using (Stream fis = File.Open(RootFilePath + j.ciecaid.Value + "B.ad2", FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
Stream fis = null;
try
{
fis = File.Open(RootFilePath + j.ciecaid.Value + "B.ad2", FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
}
catch (Exception ex)
{
logger.Warn("*B.ad2 could not be opened.");
}
if (fis == null)
{
fis = File.Open(RootFilePath + j.ciecaid.Value + ".ad2", FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
}
var reader = new DBFReader(fis);
//RO_AUTH references a memo file and had to be reemoved.
reader.SetSelectFields(new string[] { "CLMT_LN","CLMT_FN","CLMT_TITLE","CLMT_CO_NM","CLMT_ADDR1","CLMT_ADDR2","CLMT_CITY","CLMT_ST","CLMT_ZIP","CLMT_CTRY","CLMT_PH1",
@@ -521,8 +551,9 @@ namespace BodyshopPartner.Utils.Decoder
reader.Dispose();
fis.Dispose();
return true;
}
}
catch (IOException ex)
{
@@ -870,7 +901,22 @@ namespace BodyshopPartner.Utils.Decoder
{
try
{
using (Stream fis = File.Open(RootFilePath + j.ciecaid.Value + "v.veh", FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
Stream fis = null;
try
{
fis = File.Open(RootFilePath + j.ciecaid.Value + "v.veh", FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
}
catch (Exception ex)
{
logger.Warn("*v.veh could not be opened.");
}
if (fis == null)
{
fis = File.Open(RootFilePath + j.ciecaid.Value + ".veh", FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
}
{
dynamic v = new JObject();
//V_Options references a memo file and had to be removed
@@ -949,6 +995,9 @@ namespace BodyshopPartner.Utils.Decoder
j.v_color = readValues[19]?.ToString();
j.kmin = readValues[18];
v.shopid = AppMetaData.ActiveShopId;
reader.Dispose();
fis.Dispose();
}
return true;
}
@@ -1203,7 +1252,8 @@ namespace BodyshopPartner.Utils.Decoder
{
var reader = new DBFReader(fis);
reader.SetSelectFields(new string[] { "G_TTL_AMT","G_BETT_AMT","G_RPD_AMT","G_DED_AMT","G_CUST_AMT","G_AA_AMT","N_TTL_AMT","PREV_NET",
"SUPP_AMT","N_SUPP_AMT","G_UPD_AMT","G_TTL_DISC","G_TAX","GST_AMT", });
"SUPP_AMT",//"N_SUPP_AMT",
"G_UPD_AMT","G_TTL_DISC","G_TAX","GST_AMT", });
var readValues = reader.NextRecord();
dynamic ttl_x = new JObject();
@@ -1217,11 +1267,11 @@ namespace BodyshopPartner.Utils.Decoder
ttl_x.n_ttl_amt = readValues[6];//N_TTL_AMT
ttl_x.prev_net = readValues[7];//PREV_NET
ttl_x.supp_amt = readValues[8];//SUPP_AMT
ttl_x.n_supp_amt = readValues[9];//N_SUPP_AMT
ttl_x.g_upd_amt = readValues[10];//G_UPD_AMT
ttl_x.g_ttl_disc = readValues[11];//G_TTL_DISC
ttl_x.g_tax = readValues[12];//G_TAX
ttl_x.gst_amt = readValues[13];//GST_AMT
// ttl_x.n_supp_amt = readValues[9];//N_SUPP_AMT
ttl_x.g_upd_amt = readValues[9];//G_UPD_AMT
ttl_x.g_ttl_disc = readValues[10];//G_TTL_DISC
ttl_x.g_tax = readValues[11];//G_TAX
ttl_x.gst_amt = readValues[12];//GST_AMT
j.clm_total = Convert.ToDecimal(readValues[0].ToString());

View File

@@ -42,7 +42,7 @@ namespace BodyshopPartner.Utils
Filepath = envfp,
Cieca_Id = job.ciecaid,
Clm_No = job.clm_no,
Owner = job.ownr_fn?.Value + " " + job.ownr_ln?.Value,
Owner = job.ownr_fn?.Value + " " + job.ownr_ln?.Value + " " + job.ownr_co_nm?.Value,
Ins_Co_Nm = job.ins_co_nm?.Value,
Vehicle = job.vehicle.data.v_model_yr.Value + " " + job.vehicle.data.v_make_desc.Value + " " + job.vehicle.data.v_model_desc.Value,

View File

@@ -52,9 +52,12 @@ namespace BodyshopPartner.Utils
{
logger.Error(ex, "Unable to post to IOEVENT.");
}
try
{
var graphQLResponse = await g.SendQueryAsync<dynamic>(r);
logger.Debug("Graphql response:");
logger.Debug("Data: " + graphQLResponse.Data);
logger.Debug("Error: " + graphQLResponse.Errors);
if (graphQLResponse.Errors == null)
{
@@ -88,6 +91,14 @@ namespace BodyshopPartner.Utils
}
}
catch (Exception ex)
{
logger.Error("Error firing GQL query.");
logger.Error(ex);
throw ex;
}
}
}
}
}

View File

@@ -525,6 +525,8 @@ partsOrderLine.jobline?.bett_tax?.Value
writer.Fields[20] = new DBFField("V_OPTIONS", NativeDbType.Char, 20);
writer.Fields[27] = new DBFField("V_MEMO", NativeDbType.Char, 20);
writer.AddRecord(
Job.area_of_impact?.impact_1?.Value,//IMPACT_1,
Job.area_of_impact?.impact_2?.Value,//IMPACT_2,
@@ -546,14 +548,14 @@ partsOrderLine.jobline?.bett_tax?.Value
Job.vehicle?.v_mldgcode?.Value,//V_MLDGCODE,
Job.vehicle?.v_engine?.Value,//V_ENGINE,
Job.vehicle?.v_mileage?.Value,//V_MILEAGE,
Job.vehicle?.v_options?.Value,//V_OPTIONS,
null,//V_OPTIONS,
Job.vehicle?.v_color?.Value,//V_COLOR,
Job.vehicle?.v_tone?.Value,//V_TONE,
Job.vehicle?.v_stage?.Value,//V_STAGE,
Job.vehicle?.v_paint_codes?.paint_cd1?.Value,//PAINT_CD1,
Job.vehicle?.v_paint_codes?.paint_cd2?.Value,//PAINT_CD2,
Job.vehicle?.v_paint_codes?.paint_cd3?.Value,//PAINT_CD3,
Job.vehicle?.v_memo?.Value//V_MEMO,
null,//V_STAGE,
Job.vehicle?.v_paint_codes != null && Job.vehicle?.v_paint_codes?.paint_cd1 != null ? Job.vehicle?.v_paint_codes?.paint_cd1.Value : "",
Job.vehicle?.v_paint_codes != null && Job.vehicle?.v_paint_codes?.paint_cd2 != null ? Job.vehicle?.v_paint_codes?.paint_cd2.Value : "",
Job.vehicle?.v_paint_codes != null && Job.vehicle?.v_paint_codes?.paint_cd3 != null ? Job.vehicle?.v_paint_codes?.paint_cd3.Value : "",
null//V_MEMO,
); ;
writer.Write(fileStream);

View File

@@ -322,7 +322,12 @@ namespace BodyshopPartner.ViewModels
}"
};
try
{
var Data = await Utils.GraphQL.ExecuteQuery(r);
logger.Debug("Bodyshop Query Data");
logger.Debug(JsonConvert.SerializeObject(Data));
if (Data != null)
{
ShopData = Data.bodyshops.ToObject<ObservableCollection<Bodyshop>>();
@@ -334,6 +339,14 @@ namespace BodyshopPartner.ViewModels
Utils.AppMetaData.ShopRegion = ActiveShop?.RegionConfig;
Properties.Settings.Default.LastSelectedShop = ActiveShop.Id ?? null;
Properties.Settings.Default.Save();
}
catch(Exception ex)
{
logger.Error("Error initializing shop.");
logger.Error(ex);
}
}