IO-227 Succesful export of PPG information.
This commit is contained in:
@@ -67,7 +67,7 @@
|
|||||||
<value>True</value>
|
<value>True</value>
|
||||||
</setting>
|
</setting>
|
||||||
<setting name="PaintScalePath" serializeAs="String">
|
<setting name="PaintScalePath" serializeAs="String">
|
||||||
<value />
|
<value>C:\Color\PPGExport</value>
|
||||||
</setting>
|
</setting>
|
||||||
<setting name="EmsExportPath" serializeAs="String">
|
<setting name="EmsExportPath" serializeAs="String">
|
||||||
<value>C:\CIECA\MITCHELL\EXPORT</value>
|
<value>C:\CIECA\MITCHELL\EXPORT</value>
|
||||||
|
|||||||
@@ -188,6 +188,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\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" />
|
||||||
@@ -252,6 +253,9 @@
|
|||||||
<Generator>PublicResXFileCodeGenerator</Generator>
|
<Generator>PublicResXFileCodeGenerator</Generator>
|
||||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
|
<None Include="Utils\Scripts\PaintScaleExport.ps1">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
<Resource Include="Assets\logo1024.png" />
|
<Resource Include="Assets\logo1024.png" />
|
||||||
<Resource Include="Assets\favicon.ico" />
|
<Resource Include="Assets\favicon.ico" />
|
||||||
<Resource Include="favicon.ico" />
|
<Resource Include="favicon.ico" />
|
||||||
@@ -518,6 +522,9 @@
|
|||||||
<PackageReference Include="System.Xml.XDocument">
|
<PackageReference Include="System.Xml.XDocument">
|
||||||
<Version>4.3.0</Version>
|
<Version>4.3.0</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
|
<PackageReference Include="TaskScheduler">
|
||||||
|
<Version>2.9.3</Version>
|
||||||
|
</PackageReference>
|
||||||
<PackageReference Include="ToastNotifications.Messages">
|
<PackageReference Include="ToastNotifications.Messages">
|
||||||
<Version>2.5.1</Version>
|
<Version>2.5.1</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ using System.Windows;
|
|||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("1.0.25.0")]
|
[assembly: AssemblyVersion("1.0.26.0")]
|
||||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||||
//Setting Squirrel Aware Version.
|
//Setting Squirrel Aware Version.
|
||||||
[assembly: AssemblyMetadata("SquirrelAwareVersion", "1")]
|
[assembly: AssemblyMetadata("SquirrelAwareVersion", "1")]
|
||||||
18
BodyshopUploader/Properties/Resources.Designer.cs
generated
18
BodyshopUploader/Properties/Resources.Designer.cs
generated
@@ -186,6 +186,15 @@ namespace BodyshopPartner.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to (Re)Configure Paint Scale Task.
|
||||||
|
/// </summary>
|
||||||
|
public static string Label_ConfigurePaintScale {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("Label_ConfigurePaintScale", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to EMS Export Path.
|
/// Looks up a localized string similar to EMS Export Path.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -222,6 +231,15 @@ namespace BodyshopPartner.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Paint Scale Path.
|
||||||
|
/// </summary>
|
||||||
|
public static string Label_PaintScalePath {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("Label_PaintScalePath", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to QuickBooks File Path.
|
/// Looks up a localized string similar to QuickBooks File Path.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -159,6 +159,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_ConfigurePaintScale" xml:space="preserve">
|
||||||
|
<value>(Re)Configure Paint Scale Task</value>
|
||||||
|
</data>
|
||||||
<data name="Label_EmsExport" xml:space="preserve">
|
<data name="Label_EmsExport" xml:space="preserve">
|
||||||
<value>EMS Export Path</value>
|
<value>EMS Export Path</value>
|
||||||
</data>
|
</data>
|
||||||
@@ -171,6 +174,9 @@
|
|||||||
<data name="Label_MonitorStatus" xml:space="preserve">
|
<data name="Label_MonitorStatus" xml:space="preserve">
|
||||||
<value>Monitor Status</value>
|
<value>Monitor Status</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Label_PaintScalePath" xml:space="preserve">
|
||||||
|
<value>Paint Scale Path</value>
|
||||||
|
</data>
|
||||||
<data name="Label_QbFilePath" xml:space="preserve">
|
<data name="Label_QbFilePath" xml:space="preserve">
|
||||||
<value>QuickBooks File Path</value>
|
<value>QuickBooks File Path</value>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
2
BodyshopUploader/Properties/Settings.Designer.cs
generated
2
BodyshopUploader/Properties/Settings.Designer.cs
generated
@@ -143,7 +143,7 @@ namespace BodyshopPartner.Properties {
|
|||||||
|
|
||||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
[global::System.Configuration.DefaultSettingValueAttribute("")]
|
[global::System.Configuration.DefaultSettingValueAttribute("C:\\Color\\PPGExport")]
|
||||||
public string PaintScalePath {
|
public string PaintScalePath {
|
||||||
get {
|
get {
|
||||||
return ((string)(this["PaintScalePath"]));
|
return ((string)(this["PaintScalePath"]));
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
<Value Profile="(Default)">True</Value>
|
<Value Profile="(Default)">True</Value>
|
||||||
</Setting>
|
</Setting>
|
||||||
<Setting Name="PaintScalePath" Type="System.String" Scope="User">
|
<Setting Name="PaintScalePath" Type="System.String" Scope="User">
|
||||||
<Value Profile="(Default)" />
|
<Value Profile="(Default)">C:\Color\PPGExport</Value>
|
||||||
</Setting>
|
</Setting>
|
||||||
<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>
|
||||||
|
|||||||
@@ -46,4 +46,6 @@ C15C0B6EE335E383F2CEF0EFA32027B7210AA312 ImEXOnlinePartner-1.0.22-full.nupkg 518
|
|||||||
4ACCFC490941BDDE71896FE47E5E4B8ACA293CD8 ImEXOnlinePartner-1.0.24-delta.nupkg 31450
|
4ACCFC490941BDDE71896FE47E5E4B8ACA293CD8 ImEXOnlinePartner-1.0.24-delta.nupkg 31450
|
||||||
187BA94ACAE7FBF770D1D2894FF3A2F13831E7B3 ImEXOnlinePartner-1.0.24-full.nupkg 5303976
|
187BA94ACAE7FBF770D1D2894FF3A2F13831E7B3 ImEXOnlinePartner-1.0.24-full.nupkg 5303976
|
||||||
8E9C189C1D8D768FEA5E3E4B6726C1591F50026D ImEXOnlinePartner-1.0.25-delta.nupkg 58605
|
8E9C189C1D8D768FEA5E3E4B6726C1591F50026D ImEXOnlinePartner-1.0.25-delta.nupkg 58605
|
||||||
F502E648C6A0C95ED82247B106CC2D6CBF14BFA6 ImEXOnlinePartner-1.0.25-full.nupkg 5303888
|
F502E648C6A0C95ED82247B106CC2D6CBF14BFA6 ImEXOnlinePartner-1.0.25-full.nupkg 5303888
|
||||||
|
3E5481B1FFA814BF5BAE995F1CF54A7B9C57AAF7 ImEXOnlinePartner-1.0.26-delta.nupkg 246927
|
||||||
|
83CF6EBEB7A28CCA28633494874C9F3C19ABEF64 ImEXOnlinePartner-1.0.26-full.nupkg 5474941
|
||||||
@@ -79,6 +79,17 @@ namespace BodyshopPartner.Utils
|
|||||||
(req, res, props) => { HandleOec(req, res); }
|
(req, res, props) => { HandleOec(req, res); }
|
||||||
, "POST");
|
, "POST");
|
||||||
|
|
||||||
|
Route.Add("/paintscale/export/", (req, res, props) =>
|
||||||
|
{
|
||||||
|
hlog("Received a Paint Scale Export Request");
|
||||||
|
res.WithCORS();
|
||||||
|
res.Close();
|
||||||
|
}, "OPTIONS");
|
||||||
|
Route.Add("/paintscale/export/",
|
||||||
|
(req, res, props) => {
|
||||||
|
hlog("Received a Paint Scale Export Request");
|
||||||
|
HandlePaintScaleExport(req, res); }
|
||||||
|
, "POST");
|
||||||
|
|
||||||
logger.Trace("Starting HTTP server...");
|
logger.Trace("Starting HTTP server...");
|
||||||
hlog = HttpLogger;
|
hlog = HttpLogger;
|
||||||
@@ -223,14 +234,14 @@ namespace BodyshopPartner.Utils
|
|||||||
{
|
{
|
||||||
//Do the scan
|
//Do the scan
|
||||||
//Add the items to the response list.
|
//Add the items to the response list.
|
||||||
await JobProcessingQueue.UploadJob(new DTO_QueueItem() { FilePath = requestBody.filepath });
|
await JobProcessingQueue.UploadJob(new DTO_QueueItem() { FilePath = requestBody.filepath });
|
||||||
HttpResponse.Add("success", true);
|
HttpResponse.Add("success", true);
|
||||||
}
|
}
|
||||||
catch (Exception Ex)
|
catch (Exception Ex)
|
||||||
{
|
{
|
||||||
logger.Error(Ex, "Error encountered while handling import requests.");
|
logger.Error(Ex, "Error encountered while handling import requests.");
|
||||||
hlog("Error encountered while handling import requests.");
|
hlog("Error encountered while handling import requests.");
|
||||||
HttpResponse.Add("success" , false);
|
HttpResponse.Add("success", false);
|
||||||
HttpResponse.Add("error", Ex.ToString());
|
HttpResponse.Add("error", Ex.ToString());
|
||||||
}
|
}
|
||||||
res.WithCORS().AsText(JsonConvert.SerializeObject(HttpResponse));
|
res.WithCORS().AsText(JsonConvert.SerializeObject(HttpResponse));
|
||||||
@@ -256,7 +267,7 @@ namespace BodyshopPartner.Utils
|
|||||||
body.Close();
|
body.Close();
|
||||||
reader.Close();
|
reader.Close();
|
||||||
|
|
||||||
return JsonConvert.DeserializeObject(s);
|
return JsonConvert.DeserializeObject(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<QbRequestItem> ParseRequest(System.Net.HttpListenerRequest req)
|
public static List<QbRequestItem> ParseRequest(System.Net.HttpListenerRequest req)
|
||||||
@@ -298,6 +309,10 @@ namespace BodyshopPartner.Utils
|
|||||||
return XDocument.Parse(input);
|
return XDocument.Parse(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static async void HandlePaintScaleExport(System.Net.HttpListenerRequest req, System.Net.HttpListenerResponse res)
|
||||||
|
{
|
||||||
|
await Utils.PPGMixData.PushDataToPPG();
|
||||||
|
res.WithCORS().AsText("OK");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
namespace BodyshopPartner.Utils
|
namespace BodyshopPartner.Utils
|
||||||
{
|
{
|
||||||
@@ -17,6 +17,7 @@ namespace BodyshopPartner.Utils
|
|||||||
bodyshops_by_pk(id:$shopid) {
|
bodyshops_by_pk(id:$shopid) {
|
||||||
id
|
id
|
||||||
shopname
|
shopname
|
||||||
|
imexshopid
|
||||||
}
|
}
|
||||||
jobs(where: {_or: [{_and: [{scheduled_in: {_lte: $todayplus5}}, {scheduled_in: {_gte: $today}}]}, {inproduction: {_eq: true}}]}) {
|
jobs(where: {_or: [{_and: [{scheduled_in: {_lte: $todayplus5}}, {scheduled_in: {_gte: $today}}]}, {inproduction: {_eq: true}}]}) {
|
||||||
id
|
id
|
||||||
@@ -37,6 +38,9 @@ namespace BodyshopPartner.Utils
|
|||||||
rate_mapa
|
rate_mapa
|
||||||
rate_lab
|
rate_lab
|
||||||
job_totals
|
job_totals
|
||||||
|
vehicle{
|
||||||
|
v_paint_codes
|
||||||
|
}
|
||||||
labhrs: joblines_aggregate(where: {mod_lbr_ty: {_neq: ""LAR""}, removed: {_eq: false}}) {
|
labhrs: joblines_aggregate(where: {mod_lbr_ty: {_neq: ""LAR""}, removed: {_eq: false}}) {
|
||||||
aggregate {
|
aggregate {
|
||||||
sum {
|
sum {
|
||||||
@@ -81,15 +85,21 @@ namespace BodyshopPartner.Utils
|
|||||||
new XElement("PPG",
|
new XElement("PPG",
|
||||||
new XElement("Header",
|
new XElement("Header",
|
||||||
new XElement("Protocol", new XElement("Message", "PaintShopInterface"), new XElement("Name", "PPG"), new XElement("Version", "1.5.0")),
|
new XElement("Protocol", new XElement("Message", "PaintShopInterface"), new XElement("Name", "PPG"), new XElement("Version", "1.5.0")),
|
||||||
new XElement("Transaction", new XElement("TransactionDate", new DateTime().ToString("yyyy-MM-DDTHH:MM:SS"))),
|
new XElement("Transaction",
|
||||||
new XElement("Product", new XElement("Name", data?.bodyshop_by_pk?.paintshopid))
|
new XElement("TransactionID", null),
|
||||||
|
new XElement("TransactionDate", DateTime.Now.ToString("yyyy-MM-hh:mm:ss"))
|
||||||
|
),
|
||||||
|
new XElement("Product",
|
||||||
|
new XElement("Name", "ImEX Online"),
|
||||||
|
new XElement("Version", null)
|
||||||
|
)
|
||||||
|
|
||||||
),
|
),
|
||||||
new XElement("DataInterface",
|
new XElement("DataInterface",
|
||||||
new XElement("ROData",
|
new XElement("ROData",
|
||||||
new XElement("ShopInfo",
|
new XElement("ShopInfo",
|
||||||
new XElement("ShopID", data?.bodyshop_by_pk?.shopname),
|
new XElement("ShopID", data?.bodyshops_by_pk?.imexshopid?.Value),
|
||||||
new XElement("ShopName", data?.bodyshop_by_pk?.shopname)
|
new XElement("ShopName", data?.bodyshops_by_pk?.shopname?.Value)
|
||||||
),
|
),
|
||||||
new XElement("RepairOrders",
|
new XElement("RepairOrders",
|
||||||
new XElement("ROCount", data?.jobs?.Count)
|
new XElement("ROCount", data?.jobs?.Count)
|
||||||
@@ -99,11 +109,12 @@ namespace BodyshopPartner.Utils
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach(dynamic job in data.jobs)
|
foreach (dynamic job in data.jobs)
|
||||||
{
|
{
|
||||||
doc.Element("PPG").Element("DataInterface").Element("ROData").Element("RepairOrders").Add(new XElement("RO",
|
|
||||||
|
doc.Element("PPG").Element("DataInterface").Element("ROData").Element("RepairOrders").Add(new XElement("RO",
|
||||||
new XElement("RONumber", job.ro_number?.Value),
|
new XElement("RONumber", job.ro_number?.Value),
|
||||||
new XElement("ROStatus", job.status?.Value),
|
new XElement("ROStatus", "Open"),
|
||||||
new XElement("Customer", $"{job.ownr_ln}, {job.ownr_fn}"),
|
new XElement("Customer", $"{job.ownr_ln}, {job.ownr_fn}"),
|
||||||
new XElement("ROPainterNotes", ""),
|
new XElement("ROPainterNotes", ""),
|
||||||
new XElement("LicensePlateNum", job.plate_no?.Value),
|
new XElement("LicensePlateNum", job.plate_no?.Value),
|
||||||
@@ -111,33 +122,31 @@ namespace BodyshopPartner.Utils
|
|||||||
new XElement("ModelYear", job.v_model_yr?.Value),
|
new XElement("ModelYear", job.v_model_yr?.Value),
|
||||||
new XElement("MakeDesc", job.v_make_desc?.Value),
|
new XElement("MakeDesc", job.v_make_desc?.Value),
|
||||||
new XElement("ModelName", job.v_model_desc?.Value),
|
new XElement("ModelName", job.v_model_desc?.Value),
|
||||||
// new XElement("OEMColorCode", job.vehicle?.colorcode),
|
new XElement("OEMColorCode", job.vehicle?.v_paint_codes?.paint_cd1?.Value),
|
||||||
new XElement("RefinishLaborHours", job.larhrs?.aggregate?.sum.mod_lb_hrs?.Value),
|
new XElement("RefinishLaborHours", job.larhrs?.aggregate?.sum.mod_lb_hrs?.Value),
|
||||||
new XElement("InsuranceCompanyName", job.ins_co_nm?.Value),
|
new XElement("InsuranceCompanyName", job.ins_co_nm?.Value),
|
||||||
new XElement("EstimatorName", $"{job.est_ct_ln}, {job.est_ct_fn}"),
|
new XElement("EstimatorName", $"{job.est_ct_ln}, {job.est_ct_fn}"),
|
||||||
new XElement("PaintMaterialsRevenue", 0),
|
new XElement("PaintMaterialsRevenue", ((float)(job.job_totals?.rates?.mapa?.total?.amount?.Value ?? 0)) / 100),
|
||||||
new XElement("PaintMaterialsRate", job.rate_mapa?.Value),
|
new XElement("PaintMaterialsRate", job.rate_mapa?.Value),
|
||||||
new XElement("BodyHours", job.labhrs?.aggregate.sum?.mod_lb_hrs?.Value),
|
new XElement("BodyHours", job.labhrs?.aggregate.sum?.mod_lb_hrs?.Value),
|
||||||
new XElement("BodyLaborRate", job.rate_lab?.Value)
|
new XElement("BodyLaborRate", job.rate_lab?.Value),
|
||||||
//new XElement("TotalCostOfRepairs", job.job_total.totals.subtotal.amount?.Value / 100)
|
new XElement("TotalCostOfRepairs", ((float)(job.job_totals?.totals?.subtotal?.amount?.Value ?? 0)) / 100)
|
||||||
|
|
||||||
|
|
||||||
));
|
));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Directory.CreateDirectory(Properties.Settings.Default.PaintScalePath);
|
||||||
|
|
||||||
doc.Save(@"C:\\VPS\\doc.xml");
|
doc.Save(Properties.Settings.Default.PaintScalePath + @"\PPGPaint.xml");
|
||||||
// doc.Save(Properties.Settings.Default.PaintScalePath);
|
|
||||||
//Ensure all values for strings are escaped.
|
|
||||||
|
|
||||||
//Write the file to the disk and start the timer again.
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
logger.Error(ex);
|
logger.Error(ex, "Error while pushing data to PPG paint scale.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
39
BodyshopUploader/Utils/PaintScaleConfig.cs
Normal file
39
BodyshopUploader/Utils/PaintScaleConfig.cs
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
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.");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
32
BodyshopUploader/Utils/Scripts/PaintScaleExport.ps1
Normal file
32
BodyshopUploader/Utils/Scripts/PaintScaleExport.ps1
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
#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/paintscale/export/ -Method POST
|
||||||
|
}
|
||||||
|
|
||||||
|
function v1 {
|
||||||
|
WebRequest = [System.Net.WebRequest]::Create("http://localhost:1337/paintscale/export/")
|
||||||
|
WebRequest.Method = "POST"
|
||||||
|
WebRequest.ContentType = "application/json"
|
||||||
|
Response = $WebRequest.GetResponse()
|
||||||
|
ResponseStream = $Response.GetResponseStream()
|
||||||
|
ReadStream = New-Object System.IO.StreamReader $ResponseStream
|
||||||
|
#Data=$ReadStream.ReadToEnd()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Switch ($PSversion) {
|
||||||
|
1 {v1}
|
||||||
|
2 {v1}
|
||||||
|
4 {v2}
|
||||||
|
5 {v2}
|
||||||
|
6 {v2}
|
||||||
|
}
|
||||||
@@ -5,6 +5,9 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Squirrel;
|
using Squirrel;
|
||||||
|
using Microsoft.Win32.TaskScheduler;
|
||||||
|
|
||||||
|
|
||||||
namespace BodyshopPartner.Utils
|
namespace BodyshopPartner.Utils
|
||||||
{
|
{
|
||||||
public static class SquirrelAwareHelper
|
public static class SquirrelAwareHelper
|
||||||
@@ -66,13 +69,30 @@ namespace BodyshopPartner.Utils
|
|||||||
Utils.UpdateHandler.ToggleStartWithWindows(true);
|
Utils.UpdateHandler.ToggleStartWithWindows(true);
|
||||||
mgr.CreateShortcutForThisExe();
|
mgr.CreateShortcutForThisExe();
|
||||||
},
|
},
|
||||||
onAppUpdate: v => {
|
onAppUpdate: v =>
|
||||||
|
{
|
||||||
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();
|
||||||
},
|
},
|
||||||
onAppUninstall: v => mgr.RemoveShortcutForThisExe(),
|
onAppUninstall: v =>
|
||||||
|
{
|
||||||
|
mgr.RemoveShortcutForThisExe();
|
||||||
|
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");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
logger.Error(ex, "Error removing task while uninstalling.");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
onFirstRun: () =>
|
onFirstRun: () =>
|
||||||
{
|
{
|
||||||
logger.Info("We've run for the first time.");
|
logger.Info("We've run for the first time.");
|
||||||
|
|||||||
@@ -202,6 +202,22 @@ namespace BodyshopPartner.ViewModels
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ICommand _configurePaintScaleCommand;
|
||||||
|
public ICommand ConfigurePaintScaleCommand
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_configurePaintScaleCommand == null)
|
||||||
|
{
|
||||||
|
_configurePaintScaleCommand = new RelayCommand(
|
||||||
|
p => true,
|
||||||
|
p => ConfigurePaintScale()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return _configurePaintScaleCommand;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private ICommand _installUpdatesCommand;
|
private ICommand _installUpdatesCommand;
|
||||||
public ICommand InstallUpdatesCommand
|
public ICommand InstallUpdatesCommand
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -359,5 +359,10 @@ namespace BodyshopPartner.ViewModels
|
|||||||
Utils.SquirrelAwareHelper.AddHttpExcetion();
|
Utils.SquirrelAwareHelper.AddHttpExcetion();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ConfigurePaintScale()
|
||||||
|
{
|
||||||
|
Utils.PaintScaleConfig.RegisterScheduledTask();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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="600"
|
Height="650"
|
||||||
Width="800"
|
Width="800"
|
||||||
TextElement.Foreground="{DynamicResource MaterialDesignBody}"
|
TextElement.Foreground="{DynamicResource MaterialDesignBody}"
|
||||||
TextElement.FontWeight="Regular"
|
TextElement.FontWeight="Regular"
|
||||||
@@ -162,6 +162,9 @@
|
|||||||
<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 ConfigurePaintScaleCommand, UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
Margin="8"
|
||||||
|
Content="{x:Static p:Resources.Label_ConfigurePaintScale}" />
|
||||||
<!--<Button Command="{Binding TestCommand}"
|
<!--<Button Command="{Binding TestCommand}"
|
||||||
Margin="8"
|
Margin="8"
|
||||||
Content="OE Test" />-->
|
Content="OE Test" />-->
|
||||||
@@ -246,6 +249,11 @@
|
|||||||
Path=EmsExportPath}"
|
Path=EmsExportPath}"
|
||||||
materialDesign:HintAssist.Hint="{x:Static p:Resources.Label_EmsExport}"
|
materialDesign:HintAssist.Hint="{x:Static p:Resources.Label_EmsExport}"
|
||||||
TextChanged="EmsExportPath_TextChanged" />
|
TextChanged="EmsExportPath_TextChanged" />
|
||||||
|
<TextBox DockPanel.Dock="Top"
|
||||||
|
Text="{Binding Source={x:Static properties:Settings.Default},
|
||||||
|
Path=PaintScalePath}"
|
||||||
|
materialDesign:HintAssist.Hint="{x:Static p:Resources.Label_PaintScalePath}"
|
||||||
|
TextChanged="PaintScalePath_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}"
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ namespace BodyshopPartner.Views
|
|||||||
public Main()
|
public Main()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||||
@@ -43,16 +43,15 @@ namespace BodyshopPartner.Views
|
|||||||
Properties.Settings.Default.QuickBooksFilePath = ((System.Windows.Controls.TextBox)sender).Text;
|
Properties.Settings.Default.QuickBooksFilePath = ((System.Windows.Controls.TextBox)sender).Text;
|
||||||
Properties.Settings.Default.Save();
|
Properties.Settings.Default.Save();
|
||||||
}
|
}
|
||||||
|
private void PaintScalePath_TextChanged(object sender, TextChangedEventArgs e)
|
||||||
|
{
|
||||||
|
Properties.Settings.Default.PaintScalePath = ((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;
|
||||||
Properties.Settings.Default.Save();
|
Properties.Settings.Default.Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Button_Click(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
Utils.PPGMixData.PushDataToPPG();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user