diff --git a/BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj b/BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj index 93ff2f7a..6900f814 100644 --- a/BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj +++ b/BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj @@ -115,6 +115,7 @@ + @@ -309,6 +310,7 @@ + diff --git a/BPASmartClient.CustomResource/Image/容器边框.png b/BPASmartClient.CustomResource/Image/容器边框.png new file mode 100644 index 00000000..ea16001c Binary files /dev/null and b/BPASmartClient.CustomResource/Image/容器边框.png differ diff --git a/BPASmartClient.CustomResource/Pages/Model/ProductionDataHelper.cs b/BPASmartClient.CustomResource/Pages/Model/ProductionDataHelper.cs new file mode 100644 index 00000000..8d58cc7b --- /dev/null +++ b/BPASmartClient.CustomResource/Pages/Model/ProductionDataHelper.cs @@ -0,0 +1,84 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Collections.ObjectModel; +using System.Windows; +using System.IO; +using BPASmartClient.Helper; + +namespace BPASmartClient.CustomResource.Pages.Model +{ + public class ProductionDataHelper where TProductionData : class, new() + { + + + + + + + + + public static string SavePath { get; set; } + private static string FileName = string.Empty; + private static string FilePath = string.Empty; + public static string Alias { get; set; } = string.Empty; + private static string _path + { + get + { + Directory.CreateDirectory(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $"AccessFile\\ProductionData\\{FilePath}")); + return $"{AppDomain.CurrentDomain.BaseDirectory}AccessFile\\ProductionData\\{ FilePath}"; + } + } + public static ObservableCollection productionDatas { get; set; } = new ObservableCollection(); + //public static TProductionData Data { get; set; } = new TProductionData(); + public static void Add(TProductionData production) + { + if (FilePath.Length <= 0) + { + if (Alias.Length <= 0) + FilePath = $"{DateTime.Now.ToString("yyy-MM-dd")}"; + else + FilePath = $"{DateTime.Now.ToString("yyy-MM-dd")}\\{Alias}"; + } + if (FileName.Length <= 0) FileName = $"{DateTime.Now.ToString("HH-mm-ss")}.pry"; + Application.Current.Dispatcher.Invoke(new Action(() => + { + productionDatas.Add(production); + })); + } + + public static bool Save(string path = "") + { + DataRecord dr = new DataRecord(); + if (File.Exists(path)) + { + dr.Save(productionDatas, FileName); + return true; + } + if (SavePath != null && File.Exists(SavePath)) + { + dr.Save(productionDatas, FileName); + return true; + } + + dr.Save(productionDatas, FileName); + return true; + + + } + + public static void End() + { + FileName = string.Empty; + FilePath = string.Empty; + Alias = string.Empty; + } + + + } + + +} diff --git a/BPASmartClient.CustomResource/Pages/View/AlarmView.xaml b/BPASmartClient.CustomResource/Pages/View/AlarmView.xaml index 504777d0..2752d7c7 100644 --- a/BPASmartClient.CustomResource/Pages/View/AlarmView.xaml +++ b/BPASmartClient.CustomResource/Pages/View/AlarmView.xaml @@ -23,11 +23,11 @@ --> - + - + - + @@ -157,7 +157,7 @@ - + diff --git a/BPASmartClient.CustomResource/Pages/View/ProductionDataView.xaml b/BPASmartClient.CustomResource/Pages/View/ProductionDataView.xaml new file mode 100644 index 00000000..a759e41b --- /dev/null +++ b/BPASmartClient.CustomResource/Pages/View/ProductionDataView.xaml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + +