ARMS Uploader

This commit is contained in:
Patrick Fic
2022-02-07 13:31:51 -08:00
parent 1221f35162
commit c936d354b2
16 changed files with 440 additions and 175 deletions

View File

@@ -72,6 +72,9 @@
<setting name="EmsExportPath" serializeAs="String"> <setting name="EmsExportPath" serializeAs="String">
<value>C:\CIECA\MITCHELL\EXPORT</value> <value>C:\CIECA\MITCHELL\EXPORT</value>
</setting> </setting>
<setting name="ArmsExportPath" serializeAs="String">
<value>c:\program files\armsbusinesssolutions\repairorderpumpagentservice\export</value>
</setting>
</BodyshopPartner.Properties.Settings> </BodyshopPartner.Properties.Settings>
</userSettings> </userSettings>
</configuration> </configuration>

View File

@@ -189,7 +189,7 @@
<Compile Include="Utils\LoginHelpers.cs" /> <Compile Include="Utils\LoginHelpers.cs" />
<Compile Include="Utils\Notifications.cs" /> <Compile Include="Utils\Notifications.cs" />
<Compile Include="Utils\OEConnection.cs" /> <Compile Include="Utils\OEConnection.cs" />
<Compile Include="Utils\PaintScaleConfig.cs" /> <Compile Include="Utils\ScheduledTaskConfig.cs" />
<Compile Include="Utils\PowerModeEventHandler.cs" /> <Compile Include="Utils\PowerModeEventHandler.cs" />
<Compile Include="Utils\PPGMixData.cs" /> <Compile Include="Utils\PPGMixData.cs" />
<Compile Include="Utils\Queries\JobsQueries.cs" /> <Compile Include="Utils\Queries\JobsQueries.cs" />
@@ -255,6 +255,9 @@
<Generator>PublicResXFileCodeGenerator</Generator> <Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput> <LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource> </EmbeddedResource>
<None Include="Utils\Scripts\ArmsExport.ps1">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Utils\Scripts\PaintScaleExport.ps1"> <None Include="Utils\Scripts\PaintScaleExport.ps1">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None> </None>

View File

@@ -150,6 +150,15 @@ namespace BodyshopPartner.Properties {
} }
} }
/// <summary>
/// Looks up a localized string similar to ARMS Export Path.
/// </summary>
public static string Label_ArmsExportPath {
get {
return ResourceManager.GetString("Label_ArmsExportPath", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Auto-start Monitors. /// Looks up a localized string similar to Auto-start Monitors.
/// </summary> /// </summary>
@@ -159,6 +168,15 @@ namespace BodyshopPartner.Properties {
} }
} }
/// <summary>
/// Looks up a localized string similar to Browse ARMS Export Path.
/// </summary>
public static string Label_BrowseArmsExportPath {
get {
return ResourceManager.GetString("Label_BrowseArmsExportPath", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Browse for EMS Export Path. /// Looks up a localized string similar to Browse for EMS Export Path.
/// </summary> /// </summary>
@@ -186,6 +204,15 @@ namespace BodyshopPartner.Properties {
} }
} }
/// <summary>
/// Looks up a localized string similar to (Re)configure ARMS Export.
/// </summary>
public static string Label_ConfigureArmsExport {
get {
return ResourceManager.GetString("Label_ConfigureArmsExport", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to (Re)Configure Paint Scale Task. /// Looks up a localized string similar to (Re)Configure Paint Scale Task.
/// </summary> /// </summary>

View File

@@ -147,9 +147,15 @@
<data name="Label_AddMonitoringPath" xml:space="preserve"> <data name="Label_AddMonitoringPath" xml:space="preserve">
<value>Add Path</value> <value>Add Path</value>
</data> </data>
<data name="Label_ArmsExportPath" xml:space="preserve">
<value>ARMS Export Path</value>
</data>
<data name="Label_AutoStartMonitor" xml:space="preserve"> <data name="Label_AutoStartMonitor" xml:space="preserve">
<value>Auto-start Monitors</value> <value>Auto-start Monitors</value>
</data> </data>
<data name="Label_BrowseArmsExportPath" xml:space="preserve">
<value>Browse ARMS Export Path</value>
</data>
<data name="Label_BrowseForEmsExport" xml:space="preserve"> <data name="Label_BrowseForEmsExport" xml:space="preserve">
<value>Browse for EMS Export Path</value> <value>Browse for EMS Export Path</value>
</data> </data>
@@ -159,6 +165,9 @@
<data name="Label_BrowsePaintScalePath" xml:space="preserve"> <data name="Label_BrowsePaintScalePath" xml:space="preserve">
<value>Browse Paint Scale Path</value> <value>Browse Paint Scale Path</value>
</data> </data>
<data name="Label_ConfigureArmsExport" xml:space="preserve">
<value>(Re)configure ARMS Export</value>
</data>
<data name="Label_ConfigurePaintScale" xml:space="preserve"> <data name="Label_ConfigurePaintScale" xml:space="preserve">
<value>(Re)Configure Paint Scale Task</value> <value>(Re)Configure Paint Scale Task</value>
</data> </data>

View File

@@ -164,5 +164,17 @@ namespace BodyshopPartner.Properties {
this["EmsExportPath"] = value; this["EmsExportPath"] = value;
} }
} }
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("c:\\program files\\armsbusinesssolutions\\repairorderpumpagentservice\\export")]
public string ArmsExportPath {
get {
return ((string)(this["ArmsExportPath"]));
}
set {
this["ArmsExportPath"] = value;
}
}
} }
} }

View File

@@ -38,5 +38,8 @@
<Setting Name="EmsExportPath" Type="System.String" Scope="User"> <Setting Name="EmsExportPath" Type="System.String" Scope="User">
<Value Profile="(Default)">C:\CIECA\MITCHELL\EXPORT</Value> <Value Profile="(Default)">C:\CIECA\MITCHELL\EXPORT</Value>
</Setting> </Setting>
<Setting Name="ArmsExportPath" Type="System.String" Scope="User">
<Value Profile="(Default)">c:\program files\armsbusinesssolutions\repairorderpumpagentservice\export</Value>
</Setting>
</Settings> </Settings>
</SettingsFile> </SettingsFile>

View File

@@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
@@ -30,6 +31,7 @@ query ENTEGRAL_EXPORT($bodyshopid: uuid!, $start: timestamptz!, $end: timestampt
actual_completion actual_completion
actual_delivery actual_delivery
date_exported date_exported
actual_in
ins_co_nm ins_co_nm
ins_addr1 ins_addr1
ins_addr2 ins_addr2
@@ -163,9 +165,9 @@ query ENTEGRAL_EXPORT($bodyshopid: uuid!, $start: timestamptz!, $end: timestampt
logger.Debug(RoNumber); logger.Debug(RoNumber);
RepairOrders.Add(new ARMSRoDataModel() RepairOrders.Add(new ARMSRoDataModel()
{ {
ShopShortName = int.Parse(data.bodyshops_by_pk.entegral_id?.Value), ShopShortName = data.bodyshops_by_pk.entegral_id?.Value,
RO = int.Parse(RoNumber), RO = int.Parse(RoNumber),
TransType = "Z", //TODO*** Finish this status mapping. TransType = job.actual_completion?.Value == null ? "Z" : "C", //TODO*** Finish this status mapping.
ShopLongName = data.bodyshops_by_pk.shopname?.Value, ShopLongName = data.bodyshops_by_pk.shopname?.Value,
EstimatorID = job.est_ct_ln, EstimatorID = job.est_ct_ln,
EstimatorName = $"{job.est_ct_fn} {job.est_ct_ln}", EstimatorName = $"{job.est_ct_fn} {job.est_ct_ln}",
@@ -175,8 +177,10 @@ query ENTEGRAL_EXPORT($bodyshopid: uuid!, $start: timestamptz!, $end: timestampt
CustomerStreet = job.ownr_addr1?.Value, CustomerStreet = job.ownr_addr1?.Value,
CustomerCity = job.ownr_city?.Value, CustomerCity = job.ownr_city?.Value,
CustomerState = job.ownr_st?.Value, CustomerState = job.ownr_st?.Value,
CustomerZip = job.ownr_ph1?.Value, CustomerZip = job.ownr_zip?.Value,
RetWhslCustomer = "R", CustomerPhone1 = job.ownr_ph1?.Value,
CustomerPhone2 = job.ownr_ph2?.Value,
//RetWhslCustomer = "R",
Year = int.Parse(job.v_model_yr?.Value ?? 0), //TODO STRIP TO 2 NUMBERS Year = int.Parse(job.v_model_yr?.Value ?? 0), //TODO STRIP TO 2 NUMBERS
Make = job.v_make_desc?.Value, Make = job.v_make_desc?.Value,
Model = job.v_model_desc?.Value, Model = job.v_model_desc?.Value,
@@ -191,8 +195,11 @@ query ENTEGRAL_EXPORT($bodyshopid: uuid!, $start: timestamptz!, $end: timestampt
ClaimType = "N/A", ClaimType = "N/A",
Claim = job.clm_no?.Value, Claim = job.clm_no?.Value,
DateOpened = job.date_open?.Value,// ? job.date_open : null, DateOpened = job.date_open?.Value,// ? job.date_open : null,
EstComplete = job.date_open?.Value,
//DateofLoss = job.loss_date?.Value,// ? job.loss_date : null, //DateofLoss = job.loss_date?.Value,// ? job.loss_date : null,
PromiseDate = job.scheduled_completion, PromiseDate = job.scheduled_completion,
CarComplete = job.actual_completion,
CarinShop = job.actual_in,
CustPickup = job.actual_delivery, CustPickup = job.actual_delivery,
DateClosed = job.date_invoiced, DateClosed = job.date_invoiced,
BodyRate = job.rate_lab, BodyRate = job.rate_lab,
@@ -201,33 +208,35 @@ query ENTEGRAL_EXPORT($bodyshopid: uuid!, $start: timestamptz!, $end: timestampt
StructuralRate = job.rate_las, StructuralRate = job.rate_las,
PMRate = job.rate_mapa, PMRate = job.rate_mapa,
BMRate = job.rate_mash, BMRate = job.rate_mash,
RevisedTotalsBodyHours = job.job_totals?.rates?.lab?.hours?.Value, RevisedTotalsBodyHours = (Decimal?)job.job_totals?.rates?.lab?.hours?.Value,
RevisedTotalsRefinishHours = job.job_totals?.rates?.lar?.hours?.Value, RevisedTotalsRefinishHours = (Decimal?)job.job_totals?.rates?.lar?.hours?.Value,
RevisedTotalsMechanicalHours = job.job_totals?.rates?.lam?.hours?.Value, RevisedTotalsMechanicalHours = (Decimal?)job.job_totals?.rates?.lam?.hours?.Value,
RevisedTotalsStructuralHours = job.job_totals?.rates?.las?.hours?.Value, RevisedTotalsStructuralHours = (Decimal?)job.job_totals?.rates?.las?.hours?.Value,
RevisedTotalsPartsTotal = job.job_totals?.pars?.parts?.total?.amount?.Value/100, RevisedTotalsPartsTotal = ((Decimal?)job.job_totals?.parts?.parts?.total?.amount?.Value) / 100,
RevisedTotalsSubletTotal = job.job_totals?.pars?.sublets?.total?.amount?.Value / 100, RevisedTotalsSubletTotal = ((Decimal?)job.job_totals?.parts?.sublets?.total?.amount?.Value) / 100,
RevisedTotalsBodyLaborTotal = job.job_totals?.rates?.lab?.total?.amount?.Value/100, RevisedTotalsBodyLaborTotal = ((Decimal?)job.job_totals?.rates?.lab?.total?.amount?.Value) / 100,
RevisedTotalsRefinishLaborTotal = job.job_totals?.rates?.lar?.total?.amount?.Value / 100, RevisedTotalsRefinishLaborTotal = ((Decimal?)job.job_totals?.rates?.lar?.total?.amount?.Value) / 100,
RevisedTotalsMechanicalLaborTotal = job.job_totals?.rates?.lam?.total?.amount?.Value / 100, RevisedTotalsMechanicalLaborTotal = ((Decimal?)job.job_totals?.rates?.lam?.total?.amount?.Value) / 100,
RevisedTotalsStructuralLaborTotal = job.job_totals?.rates?.las?.total?.amount?.Value / 100, RevisedTotalsStructuralLaborTotal = ((Decimal?)job.job_totals?.rates?.las?.total?.amount?.Value) / 100,
RevisedTotalsPMTotal = job.job_totals?.rates?.mapa?.total?.amount?.Value / 100, RevisedTotalsPMTotal = ((Decimal?)job.job_totals?.rates?.mapa?.total?.amount?.Value) / 100,
RevisedTotalsBMTotal = job.job_totals?.rates?.mash?.total?.amount?.Value / 100, RevisedTotalsBMTotal = ((Decimal?)job.job_totals?.rates?.mash?.total?.amount?.Value) / 100,
RevisedTotalsSalesTaxTotal = (job.job_totals?.totals?.federal_tax?.amount?.Value + job.job_totals?.totals?.state_tax?.amount?.Value) /100, RevisedTotalsSalesTaxTotal = ((Decimal?)(job.job_totals?.totals?.federal_tax?.amount?.Value + job.job_totals?.totals?.state_tax?.amount?.Value)) / 100,
RevisedTotalsGrossTotal = job.job_totals?.totals?.total_repairs?.amount?.Value /100, RevisedTotalsGrossTotal = ((Decimal?)job.job_totals?.totals?.total_repairs?.amount?.Value) / 100,
RevisedTotalsDeductibleTotal = job.ded_amt?.Value, RevisedTotalsDeductibleTotal = (Decimal?)job.ded_amt?.Value,
// RevisedTotalsDepreciationTotal = job.job_totals?.rates?.lab?.hours?.Value, // RevisedTotalsDepreciationTotal = job.job_totals?.rates?.lab?.hours?.Value,
TotalLossYN = job.tlos_ind, TotalLossYN = job.tlos_ind,
BodyTechName = job.employee_body_rel?.Value == null ? "" : $"{job.employee_body_rel?.first_name?.Value} {job.employee_body_rel?.last_name?.Value}", BodyTechName = job.employee_body_rel?.Value == null ? "" : $"{job.employee_body_rel?.first_name?.Value} {job.employee_body_rel?.last_name?.Value}",
Vehiclecolor = job.v_color?.Value, Vehiclecolor = job.v_color?.Value,
PaintTechID = job.employee_refinish_rel?.Value == null ? "" : job.employee_refinish_rel?.employee_number?.Value, PaintTechID = job.employee_refinish_rel?.Value == null ? "" : job.employee_refinish_rel?.employee_number?.Value,
PaintTechName = job.employee_refinish_rel?.Value == null ? "" : $"{job.employee_refinish_rel?.first_name?.Value} {job.employee_refinish_rel?.last_name?.Value}", PaintTechName = job.employee_refinish_rel?.Value == null ? "" : $"{job.employee_refinish_rel?.first_name?.Value} {job.employee_refinish_rel?.last_name?.Value}",
ProductionStageCode = "33" //TODO ADD THE REST OF THE CODE ProductionStageCode = (job.actual_delivery?.Value != null || job.date_invoiced != null) ? "8D" : "33",
Vehiclescheduledindate = job.scheduled_in?.Value
}); });
} }
Directory.CreateDirectory(Properties.Settings.Default.ArmsExportPath);
engine.WriteFile("Output.Txt", RepairOrders); engine.WriteFile($"{Properties.Settings.Default.ArmsExportPath}\\{DateTime.Now.ToString("MMdd")}{data.bodyshops_by_pk.entegral_id?.Value}.txt", RepairOrders);
} }
catch (Exception ex) catch (Exception ex)
{ {

View File

@@ -7,24 +7,13 @@ using FileHelpers;
namespace BodyshopPartner.Utils namespace BodyshopPartner.Utils
{ {
[FixedLengthRecord()] [FixedLengthRecord()]
public class ARMSRoDataModel public class ARMSRoDataModel
{ {
[FieldFixedLength(5)]
public int CustId;
[FieldFixedLength(30)]
[FieldTrim(TrimMode.Both)]
public string Name;
[FieldFixedLength(8)] [FieldFixedLength(8)]
[FieldConverter(ConverterKind.Date, "ddMMyyyy")] public string ShopShortName;
public DateTime? AddedDate;
[FieldFixedLength(8)]
public int ShopShortName;
[FieldFixedLength(8)] [FieldFixedLength(8)]
public int RO; public int RO;
[FieldFixedLength(1)] [FieldFixedLength(1)]
@@ -52,9 +41,9 @@ namespace BodyshopPartner.Utils
[FieldFixedLength(11)] [FieldFixedLength(11)]
public String CustomerZip; public String CustomerZip;
[FieldFixedLength(10)] [FieldFixedLength(10)]
public int CustomerPhone1; public String CustomerPhone1;
[FieldFixedLength(10)] [FieldFixedLength(10)]
public int CustomerPhone2; public String CustomerPhone2;
[FieldFixedLength(35)] [FieldFixedLength(35)]
public String CustomerSource; public String CustomerSource;
[FieldFixedLength(1)] [FieldFixedLength(1)]
@@ -92,9 +81,9 @@ namespace BodyshopPartner.Utils
[FieldFixedLength(11)] [FieldFixedLength(11)]
public String InsuranceZip; public String InsuranceZip;
[FieldFixedLength(10)] [FieldFixedLength(10)]
public int InsurancePhone; public String InsurancePhone;
[FieldFixedLength(10)] [FieldFixedLength(10)]
public int InsuranceFax; public String InsuranceFax;
[FieldFixedLength(4)] [FieldFixedLength(4)]
public String ClaimType; public String ClaimType;
@@ -132,7 +121,7 @@ namespace BodyshopPartner.Utils
[FieldFixedLength(35)] [FieldFixedLength(35)]
public String InsuranceAgentFirstName; public String InsuranceAgentFirstName;
[FieldFixedLength(10)] [FieldFixedLength(10)]
public int InsAgentPhone; public String InsAgentPhone;
[FieldFixedLength(8)] [FieldFixedLength(8)]
[FieldConverter(ConverterKind.Date, "ddMMyyyy")] [FieldConverter(ConverterKind.Date, "ddMMyyyy")]
@@ -183,184 +172,250 @@ namespace BodyshopPartner.Utils
public DateTime? DateClosed; public DateTime? DateClosed;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? BodyRate; public Decimal? BodyRate;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? RefinishRate; public Decimal? RefinishRate;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? MechanicalRate; public Decimal? MechanicalRate;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? StructuralRate; public Decimal? StructuralRate;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? PMRate; public Decimal? PMRate;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? BMRate; public Decimal? BMRate;
[FieldFixedLength(7)] [FieldFixedLength(7)]
public Double? RetailWholesaleTaxRate; public Decimal? RetailWholesaleTaxRate;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? StorageRateperDay; public Decimal? StorageRateperDay;
[FieldFixedLength(3)] [FieldFixedLength(3)]
public Double? DaysStored; public Decimal? DaysStored;
[FieldFixedLength(5)] [FieldFixedLength(5)]
public Double? BodyHours; public Decimal? BodyHours;
[FieldFixedLength(5)] [FieldFixedLength(5)]
public Double? RefinishHours; public Decimal? RefinishHours;
[FieldFixedLength(5)] [FieldFixedLength(5)]
public Double? MechanicalHours; public Decimal? MechanicalHours;
[FieldFixedLength(5)] [FieldFixedLength(5)]
public Double? StructuralHours; public Decimal? StructuralHours;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? PartsTotal; [FieldConverter(typeof(MoneyConverter))]
public Decimal? PartsTotal;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? SubletTotal; [FieldConverter(typeof(MoneyConverter))]
public Decimal? SubletTotal;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? BodyLaborTotal; [FieldConverter(typeof(MoneyConverter))]
public Decimal? BodyLaborTotal;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? RefinishLaborTotal; [FieldConverter(typeof(MoneyConverter))]
public Decimal? RefinishLaborTotal;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? MechanicalLaborTotal; [FieldConverter(typeof(MoneyConverter))]
public Decimal? MechanicalLaborTotal;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? StructuralLaborTotal; [FieldConverter(typeof(MoneyConverter))]
public Decimal? StructuralLaborTotal;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? MiscellaneousChargeTotal; [FieldConverter(typeof(MoneyConverter))]
public Decimal? MiscellaneousChargeTotal;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? PMTotal; [FieldConverter(typeof(MoneyConverter))]
public Decimal? PMTotal;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? BMTotal; [FieldConverter(typeof(MoneyConverter))]
public Decimal? BMTotal;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? MiscTotal; [FieldConverter(typeof(MoneyConverter))]
public Decimal? MiscTotal;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? TowingTotal; [FieldConverter(typeof(MoneyConverter))]
public Decimal? TowingTotal;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? StorageTotal; [FieldConverter(typeof(MoneyConverter))]
public Decimal? StorageTotal;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? DetailTotal; [FieldConverter(typeof(MoneyConverter))]
public Decimal? DetailTotal;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? SalesTaxTotal; [FieldConverter(typeof(MoneyConverter))]
public Decimal? SalesTaxTotal;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? GrossTotal; [FieldConverter(typeof(MoneyConverter))]
public Decimal? GrossTotal;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? DeductibleTotal; [FieldConverter(typeof(MoneyConverter))]
public Decimal? DeductibleTotal;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? DepreciationTotal; [FieldConverter(typeof(MoneyConverter))]
public Decimal? DepreciationTotal;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? Discount; [FieldConverter(typeof(MoneyConverter))]
public Decimal? Discount;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? CustomerPay; [FieldConverter(typeof(MoneyConverter))]
public Decimal? CustomerPay;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? InsurancePay; [FieldConverter(typeof(MoneyConverter))]
public Decimal? InsurancePay;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? Deposit; [FieldConverter(typeof(MoneyConverter))]
public Decimal? Deposit;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? AmountDue; [FieldConverter(typeof(MoneyConverter))]
public Decimal? AmountDue;
[FieldFixedLength(5)] [FieldFixedLength(5)]
public Double? SupplementBodyHours; public Decimal? SupplementBodyHours;
[FieldFixedLength(5)] [FieldFixedLength(5)]
public Double? SupplementRefinishHours; public Decimal? SupplementRefinishHours;
[FieldFixedLength(5)] [FieldFixedLength(5)]
public Double? SupplementMechanicalHours; public Decimal? SupplementMechanicalHours;
[FieldFixedLength(5)] [FieldFixedLength(5)]
public Double? SupplementStructuralHours; public Decimal? SupplementStructuralHours;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? SupplementPartsTotal; [FieldConverter(typeof(MoneyConverter))]
public Decimal? SupplementPartsTotal;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? SupplementSubletTotal; [FieldConverter(typeof(MoneyConverter))]
public Decimal? SupplementSubletTotal;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? SupplementBodyLaborTotal; [FieldConverter(typeof(MoneyConverter))]
public Decimal? SupplementBodyLaborTotal;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? SupplementRefinishLaborTotal; [FieldConverter(typeof(MoneyConverter))]
public Decimal? SupplementRefinishLaborTotal;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? SupplementMechanicalLaborTotal; [FieldConverter(typeof(MoneyConverter))]
public Decimal? SupplementMechanicalLaborTotal;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? SupplementStructuralLaborTotal; [FieldConverter(typeof(MoneyConverter))]
public Decimal? SupplementStructuralLaborTotal;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? SupplementMiscellaneousChargeTotal; [FieldConverter(typeof(MoneyConverter))]
public Decimal? SupplementMiscellaneousChargeTotal;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? SupplementPMTotal; [FieldConverter(typeof(MoneyConverter))]
public Decimal? SupplementPMTotal;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? SupplementBMTotal; [FieldConverter(typeof(MoneyConverter))]
public Decimal? SupplementBMTotal;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? SupplementMiscTotal; [FieldConverter(typeof(MoneyConverter))]
public Decimal? SupplementMiscTotal;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? SupplementTowingTotal; [FieldConverter(typeof(MoneyConverter))]
public Decimal? SupplementTowingTotal;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? SupplementStorageTotal; [FieldConverter(typeof(MoneyConverter))]
public Decimal? SupplementStorageTotal;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? SupplementDetailTotal; [FieldConverter(typeof(MoneyConverter))]
public Decimal? SupplementDetailTotal;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? SupplementSalesTaxTotal; [FieldConverter(typeof(MoneyConverter))]
public Decimal? SupplementSalesTaxTotal;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? SupplementGrossTotal; [FieldConverter(typeof(MoneyConverter))]
public Decimal? SupplementGrossTotal;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? SupplementDeductibleTotal; [FieldConverter(typeof(MoneyConverter))]
public Decimal? SupplementDeductibleTotal;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? SupplementDepreciationTotal; [FieldConverter(typeof(MoneyConverter))]
public Decimal? SupplementDepreciationTotal;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? SupplementDiscount; [FieldConverter(typeof(MoneyConverter))]
public Decimal? SupplementDiscount;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? SupplementCustomerPay; [FieldConverter(typeof(MoneyConverter))]
public Decimal? SupplementCustomerPay;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? SupplementInsurancePay; [FieldConverter(typeof(MoneyConverter))]
public Decimal? SupplementInsurancePay;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? SupplementDeposit; [FieldConverter(typeof(MoneyConverter))]
public Decimal? SupplementDeposit;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? SupplementAmountDue; [FieldConverter(typeof(MoneyConverter))]
public Decimal? SupplementAmountDue;
[FieldFixedLength(5)] [FieldFixedLength(5)]
public Double? RevisedTotalsBodyHours; public Decimal? RevisedTotalsBodyHours;
[FieldFixedLength(5)] [FieldFixedLength(5)]
public Double? RevisedTotalsRefinishHours; public Decimal? RevisedTotalsRefinishHours;
[FieldFixedLength(5)] [FieldFixedLength(5)]
public Double? RevisedTotalsMechanicalHours; public Decimal? RevisedTotalsMechanicalHours;
[FieldFixedLength(5)] [FieldFixedLength(5)]
public Double? RevisedTotalsStructuralHours; public Decimal? RevisedTotalsStructuralHours;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? RevisedTotalsPartsTotal; [FieldConverter(typeof(MoneyConverter))]
public Decimal? RevisedTotalsPartsTotal;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? RevisedTotalsSubletTotal; [FieldConverter(typeof(MoneyConverter))]
public Decimal? RevisedTotalsSubletTotal;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? RevisedTotalsBodyLaborTotal; [FieldConverter(typeof(MoneyConverter))]
public Decimal? RevisedTotalsBodyLaborTotal;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? RevisedTotalsRefinishLaborTotal; [FieldConverter(typeof(MoneyConverter))]
public Decimal? RevisedTotalsRefinishLaborTotal;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? RevisedTotalsMechanicalLaborTotal; [FieldConverter(typeof(MoneyConverter))]
public Decimal? RevisedTotalsMechanicalLaborTotal;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? RevisedTotalsStructuralLaborTotal; [FieldConverter(typeof(MoneyConverter))]
public Decimal? RevisedTotalsStructuralLaborTotal;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? RevisedTotalsMiscellaneousChargeTotal; [FieldConverter(typeof(MoneyConverter))]
public Decimal? RevisedTotalsMiscellaneousChargeTotal;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? RevisedTotalsPMTotal; [FieldConverter(typeof(MoneyConverter))]
public Decimal? RevisedTotalsPMTotal;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? RevisedTotalsBMTotal; [FieldConverter(typeof(MoneyConverter))]
public Decimal? RevisedTotalsBMTotal;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? RevisedTotalsMiscTotal; [FieldConverter(typeof(MoneyConverter))]
public Decimal? RevisedTotalsMiscTotal;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? RevisedTotalsTowingTotal; [FieldConverter(typeof(MoneyConverter))]
public Decimal? RevisedTotalsTowingTotal;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? RevisedTotalsStorageTotal; [FieldConverter(typeof(MoneyConverter))]
public Decimal? RevisedTotalsStorageTotal;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? RevisedTotalsDetailTotal; [FieldConverter(typeof(MoneyConverter))]
public Decimal? RevisedTotalsDetailTotal;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? RevisedTotalsSalesTaxTotal; [FieldConverter(typeof(MoneyConverter))]
public Decimal? RevisedTotalsSalesTaxTotal;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? RevisedTotalsGrossTotal; [FieldConverter(typeof(MoneyConverter))]
public Decimal? RevisedTotalsGrossTotal;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? RevisedTotalsDeductibleTotal; [FieldConverter(typeof(MoneyConverter))]
public Decimal? RevisedTotalsDeductibleTotal;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? RevisedTotalsDepreciationTotal; [FieldConverter(typeof(MoneyConverter))]
public Decimal? RevisedTotalsDepreciationTotal;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? RevisedTotalsDiscount; [FieldConverter(typeof(MoneyConverter))]
public Decimal? RevisedTotalsDiscount;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? RevisedTotalsCustomerPay; [FieldConverter(typeof(MoneyConverter))]
public Decimal? RevisedTotalsCustomerPay;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? RevisedTotalsInsurancePay; [FieldConverter(typeof(MoneyConverter))]
public Decimal? RevisedTotalsInsurancePay;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? RevisedTotalsDeposit; [FieldConverter(typeof(MoneyConverter))]
public Decimal? RevisedTotalsDeposit;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? RevisedTotalsAmountDue; [FieldConverter(typeof(MoneyConverter))]
public Decimal? RevisedTotalsAmountDue;
[FieldFixedLength(2)] [FieldFixedLength(2)]
public int ProductionStatus; public int ProductionStatus;
@@ -382,11 +437,11 @@ namespace BodyshopPartner.Utils
[FieldFixedLength(50)] [FieldFixedLength(50)]
public String InScreenCommentsLine2; public String InScreenCommentsLine2;
[FieldFixedLength(4)] [FieldFixedLength(4)]
public int CustomerPhone2Extension; public string CustomerPhone2Extension;
[FieldFixedLength(10)] [FieldFixedLength(10)]
public int CustomerPhone3; public String CustomerPhone3;
[FieldFixedLength(4)] [FieldFixedLength(4)]
public int CustomerPhone3Extension; public string CustomerPhone3Extension;
[FieldFixedLength(60)] [FieldFixedLength(60)]
public String CustomerFileComments; public String CustomerFileComments;
[FieldFixedLength(10)] [FieldFixedLength(10)]
@@ -422,7 +477,7 @@ namespace BodyshopPartner.Utils
[FieldFixedLength(80)] [FieldFixedLength(80)]
public String CustomerEmail; public String CustomerEmail;
[FieldFixedLength(12)] [FieldFixedLength(12)]
public Double? GSTTax; public Decimal? GSTTax;
[FieldFixedLength(3)] [FieldFixedLength(3)]
public String RepairDelayStatusCode; public String RepairDelayStatusCode;
[FieldFixedLength(80)] [FieldFixedLength(80)]
@@ -443,3 +498,21 @@ namespace BodyshopPartner.Utils
} }
public class MoneyConverter : ConverterBase
{
private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
public override object StringToField(string from)
{
return Convert.ToDecimal(Decimal.Parse(from) / 100);
}
public override string FieldToString(object fieldValue)
{
if (fieldValue == null) return "";
return ((Decimal)(fieldValue ?? 0)).ToString("#.##");
}
};

View File

@@ -1,39 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Win32.TaskScheduler;
namespace BodyshopPartner.Utils
{
public static class PaintScaleConfig
{
private static string workingDirectory = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
public static void RegisterScheduledTask()
{
try
{
Microsoft.Win32.TaskScheduler.Task existingTask = TaskService.Instance.FindTask("ImEX Online Partner - Paint Scale Connection");
if(existingTask != null)
{
TaskService.Instance.RootFolder.DeleteTask("ImEX Online Partner - Paint Scale Connection");
}
Microsoft.Win32.TaskScheduler.Task newTask = TaskService.Instance.AddTask("ImEX Online Partner - Paint Scale Connection", QuickTriggerType.Hourly, "powershell.exe", @"-ExecutionPolicy Bypass -File " + workingDirectory + @"\Utils\Scripts\PaintScaleExport.ps1");
newTask.Run();
}
catch(Exception ex)
{
logger.Error(ex, "Error when trying to register scheduled task.");
}
}
}
}

View File

@@ -0,0 +1,61 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Win32.TaskScheduler;
namespace BodyshopPartner.Utils
{
public static class ScheduledTaskConfig
{
private static string workingDirectory = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
public static void RegisterPaintScale()
{
try
{
Microsoft.Win32.TaskScheduler.Task existingTask = TaskService.Instance.FindTask("ImEX Online Partner - Paint Scale Connection");
if (existingTask != null)
{
TaskService.Instance.RootFolder.DeleteTask("ImEX Online Partner - Paint Scale Connection");
}
Microsoft.Win32.TaskScheduler.Task newTask = TaskService.Instance.AddTask("ImEX Online Partner - Paint Scale Connection", QuickTriggerType.Hourly, "powershell.exe", @"-ExecutionPolicy Bypass -File " + workingDirectory + @"\Utils\Scripts\PaintScaleExport.ps1");
newTask.Run();
}
catch (Exception ex)
{
logger.Error(ex, "Error when trying to register scheduled task.");
}
}
public static void RegisterArms()
{
try
{
Microsoft.Win32.TaskScheduler.Task existingTask = TaskService.Instance.FindTask("ImEX Online Partner - ARMS");
if (existingTask != null)
{
TaskService.Instance.RootFolder.DeleteTask("ImEX Online Partner - ARMS");
}
Microsoft.Win32.TaskScheduler.Task newTask = TaskService.Instance.AddTask("ImEX Online Partner - ARMS", QuickTriggerType.Daily, "powershell.exe", @"-ExecutionPolicy Bypass -File " + workingDirectory + @"\Utils\Scripts\ArmsExport.ps1");
newTask.Run();
}
catch (Exception ex)
{
logger.Error(ex, "Error when trying to register scheduled task.");
}
}
}
}

View File

@@ -0,0 +1,38 @@
#Verify that the partner is running. If not, strat it.
if((Get-Process -Name ImEXOnlinePartner -ErrorAction SilentlyContinue) -eq $null){
& "$Env:USERPROFILE\AppData\Local\ImEXOnlinePartner\ImEXOnlinePartner.exe"
}
$PSversion = $PSVersionTable.PSVersion.Major
function v2 {
# Post request to the partner to trigger the export.
Invoke-WebRequest -Uri http://localhost:1337/arms/rodata/ -Method POST
#Start the Arms Uploader.
#Start-Process -FilePath "C:\ImEX\Applications\ARMSUploader\ROUpload.exe"
}
function v1 {
WebRequest = [System.Net.WebRequest]::Create("http://localhost:1337/arms/rodata/")
WebRequest.Method = "POST"
WebRequest.ContentType = "application/json"
Response = $WebRequest.GetResponse()
ResponseStream = $Response.GetResponseStream()
ReadStream = New-Object System.IO.StreamReader $ResponseStream
#Data=$ReadStream.ReadToEnd()
#Start the Arms Uploader.
Start-Process -FilePath "C:\ImEX\Applications\ARMSUploader\ROUpload.exe"
}
Switch ($PSversion) {
1 {v1}
2 {v1}
4 {v2}
5 {v2}
6 {v2}
7 {v2}
}

View File

@@ -74,7 +74,7 @@ namespace BodyshopPartner.Utils
mgr.CreateShortcutForThisExe(); mgr.CreateShortcutForThisExe();
Utils.UpdateHandler.RestoreSettings(); Utils.UpdateHandler.RestoreSettings();
Utils.UpdateHandler.ToggleStartWithWindows(Properties.Settings.Default.StartWithWindows); Utils.UpdateHandler.ToggleStartWithWindows(Properties.Settings.Default.StartWithWindows);
Utils.PaintScaleConfig.RegisterScheduledTask(); Utils.ScheduledTaskConfig.RegisterPaintScale();
}, },
onAppUninstall: v => onAppUninstall: v =>
{ {

View File

@@ -218,6 +218,38 @@ namespace BodyshopPartner.ViewModels
} }
} }
private ICommand _browseForArmsPathPathCommand;
public ICommand BrowseForArmsPathPathCommand
{
get
{
if (_browseForArmsPathPathCommand == null)
{
_browseForArmsPathPathCommand = new RelayCommand(
p => true,
p => BrowseForArmsPath()
);
}
return _browseForArmsPathPathCommand;
}
}
private ICommand _configureArmsExportCommand;
public ICommand ConfigureArmsExportCommand
{
get
{
if (_configureArmsExportCommand == null)
{
_configureArmsExportCommand = new RelayCommand(
p => true,
p => Utils.ScheduledTaskConfig.RegisterArms()
); ;
}
return _configureArmsExportCommand;
}
}
private ICommand _installUpdatesCommand; private ICommand _installUpdatesCommand;
public ICommand InstallUpdatesCommand public ICommand InstallUpdatesCommand
{ {

View File

@@ -256,6 +256,19 @@ namespace BodyshopPartner.ViewModels
} }
}
public void BrowseForArmsPath()
{
var dialog = new Ookii.Dialogs.Wpf.VistaFolderBrowserDialog();
dialog.SelectedPath = Properties.Settings.Default.ArmsExportPath;
if (dialog.ShowDialog().GetValueOrDefault())
{
Properties.Settings.Default.ArmsExportPath = dialog.SelectedPath;
Properties.Settings.Default.Save();
}
} }
public void StopAllFolderMonitors() public void StopAllFolderMonitors()
@@ -362,7 +375,8 @@ namespace BodyshopPartner.ViewModels
public void ConfigurePaintScale() public void ConfigurePaintScale()
{ {
Utils.PaintScaleConfig.RegisterScheduledTask(); Utils.ScheduledTaskConfig.RegisterPaintScale();
} }
} }
} }

View File

@@ -11,7 +11,7 @@
xmlns:tb="http://www.hardcodet.net/taskbar" xmlns:tb="http://www.hardcodet.net/taskbar"
mc:Ignorable="d" mc:Ignorable="d"
Title="{x:Static p:Resources.Title_Main}" Title="{x:Static p:Resources.Title_Main}"
Height="650" Height="800"
Width="800" Width="800"
TextElement.Foreground="{DynamicResource MaterialDesignBody}" TextElement.Foreground="{DynamicResource MaterialDesignBody}"
TextElement.FontWeight="Regular" TextElement.FontWeight="Regular"
@@ -162,9 +162,17 @@
<Button Command="{Binding BrowseForPaintScalePathCommand, UpdateSourceTrigger=PropertyChanged}" <Button Command="{Binding BrowseForPaintScalePathCommand, UpdateSourceTrigger=PropertyChanged}"
Margin="8" Margin="8"
Content="{x:Static p:Resources.Label_BrowsePaintScalePath}" /> Content="{x:Static p:Resources.Label_BrowsePaintScalePath}" />
<Button Command="{Binding BrowseForArmsPathPathCommand, UpdateSourceTrigger=PropertyChanged}"
Margin="8"
Content="{x:Static p:Resources.Label_BrowseArmsExportPath}" />
<Button Command="{Binding ConfigurePaintScaleCommand, UpdateSourceTrigger=PropertyChanged}" <Button Command="{Binding ConfigurePaintScaleCommand, UpdateSourceTrigger=PropertyChanged}"
Margin="8" Margin="8"
Content="{x:Static p:Resources.Label_ConfigurePaintScale}" /> Content="{x:Static p:Resources.Label_ConfigurePaintScale}" />
<Button Command="{Binding ConfigureArmsExportCommand, UpdateSourceTrigger=PropertyChanged}"
Margin="8"
Content="{x:Static p:Resources.Label_ConfigureArmsExport}" />
<!--<Button Command="{Binding TestCommand}" <!--<Button Command="{Binding TestCommand}"
Margin="8" Margin="8"
Content="OE Test" />--> Content="OE Test" />-->
@@ -254,6 +262,11 @@
Path=PaintScalePath}" Path=PaintScalePath}"
materialDesign:HintAssist.Hint="{x:Static p:Resources.Label_PaintScalePath}" materialDesign:HintAssist.Hint="{x:Static p:Resources.Label_PaintScalePath}"
TextChanged="PaintScalePath_TextChanged" /> TextChanged="PaintScalePath_TextChanged" />
<TextBox DockPanel.Dock="Top"
Text="{Binding Source={x:Static properties:Settings.Default},
Path=ArmsExportPath}"
materialDesign:HintAssist.Hint="{x:Static p:Resources.Label_ArmsExportPath}"
TextChanged="ArmsExportPath_TextChanged" />
<TextBox Height="Auto" <TextBox Height="Auto"
materialDesign:HintAssist.Hint="{x:Static p:Resources.Label_InteractionLog}" materialDesign:HintAssist.Hint="{x:Static p:Resources.Label_InteractionLog}"
Text="{Binding HttpServerLog}" Text="{Binding HttpServerLog}"

View File

@@ -48,6 +48,13 @@ namespace BodyshopPartner.Views
Properties.Settings.Default.PaintScalePath = ((System.Windows.Controls.TextBox)sender).Text; Properties.Settings.Default.PaintScalePath = ((System.Windows.Controls.TextBox)sender).Text;
Properties.Settings.Default.Save(); Properties.Settings.Default.Save();
} }
private void ArmsExportPath_TextChanged(object sender, TextChangedEventArgs e)
{
Properties.Settings.Default.ArmsExportPath = ((System.Windows.Controls.TextBox)sender).Text;
Properties.Settings.Default.Save();
}
private void EmsExportPath_TextChanged(object sender, TextChangedEventArgs e) private void EmsExportPath_TextChanged(object sender, TextChangedEventArgs e)
{ {
Properties.Settings.Default.EmsExportPath = ((System.Windows.Controls.TextBox)sender).Text; Properties.Settings.Default.EmsExportPath = ((System.Windows.Controls.TextBox)sender).Text;