2 Commits 626fd61bc4 ... 6515795172

Autor SHA1 Mensagem Data
  zhangliwen 6515795172 1.更新api 1 ano atrás
  zhangliwen 7714bc9c89 1. 增加运行时长同步任务 1 ano atrás
46 arquivos alterados com 2927 adições e 1503 exclusões
  1. BIN
      Lib/SCADA.CommonCtrl.dll
  2. 218 460
      SCADA_DAQ.DAL/DBSchema.cs
  3. 424 424
      SCADA_DAQ.DAL/LocalDB.cs
  4. 1 1
      SCADA_DAQ.DAL/LocalDB.tt
  5. 6 0
      SCADA_DAQ.Plugin.Tailg/App.config
  6. BIN
      SCADA_DAQ.Plugin.Tailg/Data/LocalApp.zip
  7. BIN
      SCADA_DAQ.Plugin.Tailg/Data/QwPlatform.zip
  8. 496 0
      SCADA_DAQ.Plugin.Tailg/Env.cs
  9. 83 0
      SCADA_DAQ.Plugin.Tailg/LocalResource.Designer.cs
  10. 127 0
      SCADA_DAQ.Plugin.Tailg/LocalResource.resx
  11. 55 0
      SCADA_DAQ.Plugin.Tailg/Properties/AssemblyInfo.cs
  12. 71 0
      SCADA_DAQ.Plugin.Tailg/Properties/Resources.Designer.cs
  13. 117 0
      SCADA_DAQ.Plugin.Tailg/Properties/Resources.resx
  14. 30 0
      SCADA_DAQ.Plugin.Tailg/Properties/Settings.Designer.cs
  15. 7 0
      SCADA_DAQ.Plugin.Tailg/Properties/Settings.settings
  16. 140 0
      SCADA_DAQ.Plugin.Tailg/SCADA_DAQ.Plugin.Tailg.csproj
  17. 1 0
      SCADA_DAQ.Plugin.Tailg/Service/00 此目录存放自定义后台服务.txt
  18. 35 0
      SCADA_DAQ.Plugin.Tailg/Service/CustomerServiceConfig.cs
  19. 265 0
      SCADA_DAQ.Plugin.Tailg/Service/WebApiService.cs
  20. 1 0
      SCADA_DAQ.Service/App.config
  21. 3 3
      SCADA_DAQ.Service/SCADA_DAQ.Service.csproj
  22. 102 0
      SCADA_DAQ/Customer/Jobs/SyncRunTime.cs
  23. 2 0
      SCADA_DAQ/Customer/Machines/SampleMachine.cs
  24. 120 80
      SCADA_DAQ/Customer/Machines/ScannerMachine.cs
  25. 0 302
      SCADA_DAQ/Customer/Models/AlarmTable/AddAlarmTable.cs
  26. 0 14
      SCADA_DAQ/Customer/Models/AlarmTable/AlarmTableModel.cs
  27. 0 21
      SCADA_DAQ/Customer/Models/AlarmTable/QueryAlarmTableModel.cs
  28. 3 1
      SCADA_DAQ/Customer/Models/DeviceMap/DeviceMapModel.cs
  29. 12 8
      SCADA_DAQ/Customer/Models/MotorcycleTypeManagement/MotorcycleTypeModel.cs
  30. 15 7
      SCADA_DAQ/Customer/Models/ProductionLineManagement/AddProductionLineManagementModel.cs
  31. 3 0
      SCADA_DAQ/Customer/Models/ProductionLineManagement/ProductionLineManagementModel.cs
  32. 153 0
      SCADA_DAQ/Customer/Models/ProductionLineManagement/ProductionLineStateModel.cs
  33. 8 4
      SCADA_DAQ/Customer/Models/ProductionLineManagement/ProductionManagementStation.cs
  34. 9 5
      SCADA_DAQ/Customer/Models/ProductionLineManagement/QueryProductionLineManagementModel.cs
  35. 39 27
      SCADA_DAQ/Customer/Models/TaskManagement/QueryTaskModel.cs
  36. 16 14
      SCADA_DAQ/Customer/Models/TaskManagement/TaskManagementModel.cs
  37. 247 110
      SCADA_DAQ/Customer/Service/CustomerService.cs
  38. 7 9
      SCADA_DAQ/Customer/Service/CustomerServiceConfig.cs
  39. 1 0
      SCADA_DAQ/Customer/UctFrmCodeScanningGun.xaml
  40. 20 10
      SCADA_DAQ/Customer/UctFrmCodeScanningGun.xaml.cs
  41. 20 3
      SCADA_DAQ/Customer/UctFrmMotorcycleTypeManagement.xaml.cs
  42. 11 0
      SCADA_DAQ/Customer/UctFrmProductionLineManagement.xaml.cs
  43. 3 0
      SCADA_DAQ/Env.cs
  44. 5 0
      SCADA_DAQ/SCADA_DAQ.csproj
  45. 45 0
      SCADA_DAQ/SystemControl.cs
  46. 6 0
      SCADA_DAQ3.0.sln

BIN
Lib/SCADA.CommonCtrl.dll


Diferenças do arquivo suprimidas por serem muito extensas
+ 218 - 460
SCADA_DAQ.DAL/DBSchema.cs


Diferenças do arquivo suprimidas por serem muito extensas
+ 424 - 424
SCADA_DAQ.DAL/LocalDB.cs


+ 1 - 1
SCADA_DAQ.DAL/LocalDB.tt

@@ -25,7 +25,7 @@
     // IDB db=new SQLDB("127.0.0.1,1433","EICP","sa","123456");
     // IDB db=new OracleDB("127.0.0.1:1521","EICP","sa","123456");
     // IDB db=new MySQLDB("127.0.0.1:3306","EICP","sa","123456");
-    string dataPath=@$"{projectPath}\SCADA_DAQ\bin\Debug\net47\Data";
+    string dataPath=@$"{projectPath}\SCADA_DAQ\bin\52台铃产线生产管理系统\net47\Data";
     IDB db=new SQLiteDB(dataPath,"LocalApp.db");
 #>
 using System;

+ 6 - 0
SCADA_DAQ.Plugin.Tailg/App.config

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+    <startup> 
+        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7" />
+    </startup>
+</configuration>

BIN
SCADA_DAQ.Plugin.Tailg/Data/LocalApp.zip


BIN
SCADA_DAQ.Plugin.Tailg/Data/QwPlatform.zip


+ 496 - 0
SCADA_DAQ.Plugin.Tailg/Env.cs

@@ -0,0 +1,496 @@
+using ControlzEx.Theming;
+using DIL;
+using SCADA.CommonCtrl.WpfControl;
+using SCADA.CommonCtrl.WpfHelper;
+using SCADA.CommonLib;
+using SCADA.CommonLib.Data.DIL;
+using SCADA.CommonLib.Data.DIL.Sqlite;
+using SCADA.CommonLib.Helper;
+using SCADA_DAQ.Plugin.Core.License;
+using SysManage.User;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.IO;
+using System.Linq;
+using System.Reflection;
+using System.Windows;
+using System.Windows.Media;
+
+namespace SCADA_DAQ.Plugin.Tailg
+{
+    class Env
+    {
+        // SQLite
+        public static DILDB DAL = null;
+
+        // SQL Server
+        public static SqlSchema.DIL.DILDB SgIDAL = new SqlSchema.DIL.DILDB("127.0.0.1", "TL_DB", "sa", "M+123456");
+        //public static SqlSchema.DIL.DILDB SgIDAL = new SqlSchema.DIL.DILDB(@"10.255.254.250", "TL_DB", "sa", "M+123456");
+
+
+        public static bool EnvInitFinish = false;
+        public static User NewUser;
+
+        public static Schedual Schedual { get; internal set; } = Schedual.Instance;
+
+        internal static LicenseInfo LicenseInfo;
+
+        public static DateTime StartTime { get; set; }
+        public static int StartTick { get; internal set; }
+
+        public static AutoSaveParameterItem<string> ProductTitle { get; set; }
+
+        public static AutoSaveParameterItem<string> ProductName { get; set; }
+
+        public static AutoSaveParameterItem<string> CompanyName { get; set; }
+
+        public static AutoSaveParameterItem<string> AuthorInfo { get; set; }
+
+        public static AutoSaveParameterItem<string> MainDllName { get; set; }
+
+        public static DataBaseConfig CurrentDbConfig { get; set; }
+
+        public static AutoSaveParameterItem<DatabaseSelector> CurrentDataBase { get; set; }
+
+        public static DataBaseConfig SysDBConfig { get; set; }
+
+        public static AutoSaveParameterItem<DatabaseSelector> SysDataBase { get; set; }
+
+        public static DataBaseConfig AlarmDBConfig { get; set; }
+
+        public static AutoSaveParameterItem<DatabaseSelector> AlarmDataBase { get; set; }
+
+        public static AutoSaveParameterItem<ObservableCollection<DataBaseConfig>> DataBaseResource { get; set; }
+
+        public static AutoSaveParameterItem<string> DefaultUserName { get; set; }
+
+        public static AutoSaveParameterItem<string> WebServerAddress = AutoSaveParameterItem.Create("App.WebServer", "www.skdscada.com");
+
+        public static AutoSaveParameterItem<bool> DataBaseNeedRest { get; set; } = AutoSaveParameterItem.Create("App.DatabaseNeedRest", false);
+
+        /// <summary>
+        /// 产量个数
+        /// </summary>
+        public static AutoSaveParameterItem<int> TotalOutputPcs { get; set; } = AutoSaveParameterItem.Create("App.TotalOutputPcs", 0);
+
+        /// <summary>
+        /// 产量
+        /// </summary>
+        public static AutoSaveParameterItem<decimal> TotalOutputQty { get; set; } = AutoSaveParameterItem.Create("App.TotalOutputQty", 0m);
+
+        #region 系统设置
+
+        public static AutoSaveParameterItem<string> ComputerId;
+
+        public static AutoSaveParameterItem<string> ComputerTag;
+
+        public static AutoSaveParameterItem<int> RESTfulPort;
+
+        public static AutoSaveParameterItem<int> RPCPort;
+
+        public static AutoSaveParameterItem<bool> SingleModel;
+
+        public static AutoSaveParameterItem<SCADA.CommonLib.LoggerHelper.LogLevel> LogLevel;
+
+        public static AutoSaveParameterItem<bool> AutoCycle;
+
+        public static AutoSaveParameterItem<int> CycleTime;
+
+        public static AutoSaveParameterItem<int> DataExpireDay;
+
+        #endregion
+        #region 主题配置
+        public static AutoSaveParameterItem<string> ThemeName;
+
+        public static AutoSaveParameterItem<string> ThemeColor;
+
+        public static AutoSaveParameterItem<WindowModel> WindowModel;
+
+        public static AutoSaveParameterItem<SCADA.CommonCtrl.WpfControl.WindowStyle> WindowStyle;
+        #endregion
+
+        public static AutoSaveParameterItem<string> Language;
+        /// <summary>
+        /// 设备配置文件
+        /// </summary>
+        public static AutoSaveParameterItem<string> DeviceConfigFilePath;
+
+        public static void ParameterInit()
+        {
+            ProductTitle = AutoSaveParameterItem.Create("App.MainTitle", ApplicationHelper.GetProductTitle(), true);
+            ProductTitle.DisplayName = "窗口标题";
+
+            ProductName = AutoSaveParameterItem.Create("App.ProductName", "EICP", true);
+            ProductName.DisplayName = "产品名称";
+
+            CompanyName = AutoSaveParameterItem.Create("App.CompanyName", "", true);
+            CompanyName.DisplayName = "公司名称";
+
+            AuthorInfo = AutoSaveParameterItem.Create("App.AuthorInfo", System.Windows.Forms.Application.CompanyName, true);
+            AuthorInfo.DisplayName = "作者信息";
+
+            DefaultUserName = AutoSaveParameterItem.Create("App.DefualtUserName", "Operator", true);
+            DefaultUserName.DisplayName = "默认用户";
+
+            ComputerId = AutoSaveParameterItem.Create("App.ComputerId", "", true);
+            ComputerId.IsReadOnly = true;
+            ComputerId.DisplayName = "本机ID";
+
+            ComputerTag = AutoSaveParameterItem.Create("App.ComputerTag", "", true);
+            ComputerTag.IsReadOnly = true;
+
+
+            RESTfulPort = AutoSaveParameterItem.Create("App.RESTfulPort", 7888);
+            RESTfulPort.DisplayName = "网页端口";
+
+            RPCPort = AutoSaveParameterItem.Create("App.RPCPort", 7880);
+            RPCPort.DisplayName = "本地端口";
+
+            SingleModel = AutoSaveParameterItem.Create("App.SingleModel", true);
+            SingleModel.DisplayName = "单例模式";
+
+            LogLevel = AutoSaveParameterItem.Create("App.LogLevel", SCADA.CommonLib.LoggerHelper.LogLevel.All);
+
+            AutoCycle = AutoSaveParameterItem.Create("App.AutoCycle", false);
+            AutoCycle.DisplayName = "页面自动循环";
+
+            CycleTime = AutoSaveParameterItem.Create("App.CycleTime", 5);
+
+            CycleTime.IsEnableBinding = new System.Windows.Data.Binding("Value")
+            {
+                Source = AutoCycle
+            };
+            CycleTime.Unit = "秒";
+
+            CurrentDataBase = AutoSaveParameterItem.Create("App.DataBaseConfig", new DatabaseSelector()
+            { CurrentDataBaseConfig = "Default" });
+
+            SysDataBase = AutoSaveParameterItem.Create("App.DataBaseConfig.System", new DatabaseSelector()
+            { CurrentDataBaseConfig = "SysDB" });
+
+            AlarmDataBase = AutoSaveParameterItem.Create("App.DataBaseConfig.Alarm", new DatabaseSelector()
+            { CurrentDataBaseConfig = "AlarmDB" });
+            DataBaseResource = AutoSaveParameterItem.Create("App.DataBaseResource",
+                        new ObservableCollection<DataBaseConfig>()
+                        {
+                            new DataBaseConfig()
+                            {
+                                ResourceName="Default",
+                                DBType = DatabaseType.Sqlite,
+                                FilePath = @"Data\QwPlatform.db"
+                            },
+                            new DataBaseConfig()
+                            {
+                                ResourceName="AlarmDB",
+                                DBType = DatabaseType.Sqlite,
+                                FilePath = @"Data\QwPlatform.db"
+                            },
+                            new DataBaseConfig()
+                            {
+                                ResourceName="SysDB",
+                                DBType = DatabaseType.Sqlite,
+                                FilePath = @"Data\LocalApp.db"
+                            },
+                        }, true);
+
+            dataBaseConfigInit(DataBaseResource, CurrentDataBase.Value, out var currentconfig);
+            dataBaseConfigInit(DataBaseResource, SysDataBase.Value, out var sysConfig);
+            dataBaseConfigInit(DataBaseResource, AlarmDataBase.Value, out var alarmConfig);
+            CurrentDbConfig = currentconfig;
+            AlarmDBConfig = alarmConfig;
+            SysDBConfig = sysConfig;
+            void dataBaseConfigInit(ObservableCollection<DataBaseConfig> srouce, DatabaseSelector selector, out DataBaseConfig config)
+            {
+                config = DataBaseResource.Value.FirstOrDefault(t => t.ResourceName == selector?.CurrentDataBaseConfig);
+                selector.DataBaseConfigResource = DataBaseResource.Value;
+                if (config == null)
+                {
+                    config = DataBaseResource.Value.FirstOrDefault();
+                    selector.CurrentDataBaseConfig = config.ResourceName;
+                }
+                selector.DataBaseConfig = config;
+            }
+
+
+            DataExpireDay = AutoSaveParameterItem.Create($"App.DataExpireDay", 30);
+            DataExpireDay.DisplayName = "数据过期时间(天)";
+
+            ThemeName = AutoSaveParameterItem.Create("App.ThemeName", "Light");
+            ThemeName.StringType = StringType.IsLimited;
+            ThemeName.ShowButton = false;
+            ThemeName.ItemsSource = new Dictionary<string, string>
+                        {
+                            { "Light", "Light" }, { "Dark", "Dark" }
+                        };
+
+            ThemeColor = AutoSaveParameterItem.Create("App.ThemeColor", "Blue");
+            ThemeColor.StringType = StringType.IsLimited;
+            ThemeColor.ShowButton = false;
+
+            WindowModel = AutoSaveParameterItem.Create("App.WindowModel", SCADA.CommonCtrl.WpfControl.WindowModel.Classical);
+            WindowModel.DisplayName = "窗口模式";
+
+
+            WindowStyle = AutoSaveParameterItem.Create("App.WindowStyle", SCADA.CommonCtrl.WpfControl.WindowStyle.Aero);
+            WindowStyle.DisplayName = "窗口样式";
+
+            DeviceConfigFilePath = AutoSaveParameterItem.Create("DeviceConfigFilePath", "DeviceCfg.xml");
+            DeviceConfigFilePath.StringType = StringType.IsFilePath;
+            DeviceConfigFilePath.DisplayName = "设备配置文件";
+
+            Language = AutoSaveParameterItem.Create("App.Language", "zh-cn");
+            Language.StringType = StringType.IsLimited;
+            Language.ItemsSource = new Dictionary<string, string>()
+            {
+                {"中文(简体)","zh-cn" },
+                {"中文(繁体)","zh-tw" },
+                {"English(US)","en-us" },
+                {"Deutsch","de-de" },
+                {"Руская","ru-ru" },
+                {"日本語","ja-jp" },
+                {"한국어","ko-kr" },
+                {"ภาษาไทย","th-th"}
+            };
+
+            ThemeColor.PropertyChanged += Theme_PropertyChanged;
+            ThemeName.PropertyChanged += Theme_PropertyChanged;
+            if (Application.Current != null)
+            {
+                ThemeColor.ItemsSource = new List<string>() {
+                 "Red", "Green", "Blue", "Purple", "Orange", "Lime", "Emerald", "Teal", "Cyan", "Cobalt", "Indigo", "Violet", "Pink", "Magenta", "Crimson", "Amber", "Yellow", "Brown", "Olive", "Steel", "Mauve", "Taupe", "Sienna"
+                }.ToDictionary(t => t, t => t);
+            }
+
+            bool neeRestDatabase = DataBaseNeedRest.Value;
+
+            void dbInit(DataBaseConfig dataBaseConfig, Type dbType, out BaseDB dilDb)
+            {
+                dilDb = null;
+                try
+                {
+                    if (dataBaseConfig.DBType == DatabaseType.Sqlite && typeof(SQLiteDB).IsAssignableFrom(dbType))   //如果是sqlite数据库就检查数据库的状态
+                    {
+                        string dbInfo = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, dataBaseConfig.FilePath);
+                        dilDb = (BaseDB)Activator.CreateInstance(dbType, Path.GetDirectoryName(dbInfo), Path.GetFileName(dataBaseConfig.FilePath),
+                            dataBaseConfig.UserName,
+                            dataBaseConfig.Password);
+                        CheckDataBase(dilDb, Path.Combine(dilDb.ServerName, dilDb.DatabaseInfo), dataBaseConfig.NeedReset || DataBaseNeedRest.Value);
+                        dataBaseConfig.NeedReset = false;
+                    }
+                    else
+                    {
+                        dilDb = (BaseDB)Activator.CreateInstance(dbType, dataBaseConfig.DatabaseServer, dataBaseConfig.DataBaseName, dataBaseConfig.UserName, dataBaseConfig.Password);
+                    }
+                }
+                catch (Exception)
+                {
+
+                }
+            }
+            dbInit(CurrentDbConfig, typeof(DILDB), out BaseDB currentDB);
+            dbInit(SysDBConfig, typeof(LocalDB.DIL.DILDB), out BaseDB sysDB);
+            dbInit(AlarmDBConfig, typeof(SqlSchema.DIL.DILDB), out BaseDB alarmDB);
+
+            DAL = (DILDB)currentDB;
+            GlobalEnv.Instance.GlobalDB = currentDB;
+            GlobalEnv.Instance.AlarmDB = alarmDB;
+            GlobalEnv.Instance.LocalAppDB = sysDB;
+
+            //dbInit(SysDBConfig, typeof(LocalDB.DIL.DILDB), out localDB);
+
+
+            //LocalDB.DIL.DILDB localdb = new LocalDB.DIL.DILDB($"{AppDomain.CurrentDomain.BaseDirectory}Data", "LocalApp.db");
+            //CheckDataBase(localdb, Path.Combine(localdb.ServerName, localdb.DatabaseInfo), false);
+            //GlobalEnv.Instance.LocalAppDB = localdb;
+
+
+            NewUser = new User(DAL)
+            {
+                UserName = "Admin",
+                PassWordReviseHandler = () =>
+                {
+                    var passWordRevise = new FrmUserLogin(new PasswordReviseViewModel(NewUser));
+                    ((BaseMainWindow)Application.Current.MainWindow).ShowChildWindow(passWordRevise);
+                },
+
+                TryLoginHandler = () =>
+                {
+                    if (NewUser.IsLogged == false)
+                    {
+                        FrmUserLogin frmUserLog = new FrmUserLogin(new UserLoginViewModel(NewUser));
+                        ((BaseMainWindow)Application.Current.MainWindow).ShowChildWindow(frmUserLog);
+                    }
+                    else
+                    {
+                        (Application.Current as IApp).ShowToast($"{LanguageHelper.GetStringByKey("SysCfg_CurrentUser")}{NewUser.UserName}", ControlStyle.Info);
+                    }
+                },
+                MidCheckHandler = () =>
+                {
+                    var frmUserLog = new FrmUserLogin(new UserLoginViewModel(NewUser));
+                    if (NewUser.IsLogged == false)
+                    {
+                        ((BaseMainWindow)Application.Current.MainWindow).ShowChildWindow(frmUserLog);
+                        return NewUser.IsLogged;
+                    }
+                    else
+                    {
+                        return NewUser.IsLogged;
+                    }
+                }
+            };
+            GlobalEnv.Instance.User = NewUser;
+            Language.PropertyChanged += Language_PropertyChanged;
+            EnvInitFinish = true;
+        }
+
+        private static void dataBaseInit(bool v, DataBaseConfig dataBaseConfig, object config, DatabaseSelector databaseSelector, object selector)
+        {
+            throw new NotImplementedException();
+        }
+
+        static Env()
+        {
+            //XmlUserConfig.Create();
+        }
+
+        private static void Language_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
+        {
+            SetLanguage();
+        }
+
+        public static void SetLanguage()
+        {
+            try
+            {
+                List<ResourceDictionary> dictionaryList = new List<ResourceDictionary>();
+                foreach (ResourceDictionary dictionary in Application.Current.Resources.MergedDictionaries)
+                {
+                    dictionaryList.Add(dictionary);
+                }
+                string requestedCulture = $@"{Language.Value}.xaml";
+                ResourceDictionary resourceDictionary = dictionaryList.FirstOrDefault(d => d?.Source?.Segments.Last() == requestedCulture);
+                Application.Current.Resources.MergedDictionaries.Remove(resourceDictionary);
+                Application.Current.Resources.MergedDictionaries.Add(resourceDictionary);
+                LanguageHelper.CurrentLanguageDictionary = resourceDictionary;
+                LanguageHelper.DefaultLanguageDictionary = dictionaryList.FirstOrDefault(d => d?.Source?.Segments.Last() == @"zh-cn.xaml");
+            }
+            catch (Exception ex)
+            {
+                System.Diagnostics.Trace.TraceError($"{ex}");
+            }
+        }
+
+        private static void Theme_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
+        {
+            SetTheme();
+        }
+
+        public static void SetTheme()
+        {
+            try
+            {
+                ThemeManager.Current.ChangeTheme(Application.Current, $"{ThemeName.Value}.{ThemeColor.Value}");
+            }
+            catch (Exception ex)
+            {
+                System.Diagnostics.Trace.TraceError($"{ex}");
+            }
+        }
+
+        public static void SetFont()
+        {
+            AutoSaveParameterItem<string> DefaultFont = AutoSaveParameterItem.Create("App.DefaultFont", "Microsoft YaHei UI");
+            AutoSaveParameterItem<double> DefaultFontSize = AutoSaveParameterItem.Create("App.DefaultFontSize", 14d);
+            AutoSaveParameterItem<int> DefaultFontWeight = AutoSaveParameterItem.Create("App.DefaultFontWeight", 400);
+
+            Application.Current.Resources["DefaultFontWeight"] = FontWeight.FromOpenTypeWeight(DefaultFontWeight.Value);
+            Application.Current.Resources["DefaultFontSize"] = DefaultFontSize.Value;
+            Application.Current.Resources["DefaultFont"] = new FontFamily(DefaultFont.Value);
+        }
+
+
+        private static void CheckDataBase(BaseDB db, string databasepath, bool dataBaseNeedRest)
+        {
+            if (dataBaseNeedRest)   //用户设置了重置数据库
+            {
+                System.Diagnostics.Trace.TraceInformation($"用户请求重置数据库,数据库开始重置");
+                if (ReleseDatabase())
+                {
+                    DataBaseNeedRest.Value = false;   //数据库重置成功
+                }
+            }
+            else
+            {
+                if (File.Exists(databasepath))
+                {
+                    object dt = db.ExecuteScalar("PRAGMA integrity_check");
+                    if ($"{dt}".ToUpper() == "OK")
+                    {
+                        System.Diagnostics.Debug.WriteLine($"{databasepath} 数据库检测正常");
+                    }
+                    else
+                    {
+                        Application.Current.Dispatcher.Invoke(new Action(() =>
+                        {
+                            if (MessageBox.Show(Application.Current?.MainWindow, LanguageHelper.GetStringByKey("SysCfg_DatabaseIsDamageTip"), LanguageHelper.SysCfg_Wran, MessageBoxButton.OK) == MessageBoxResult.OK)
+                            {
+                                System.Diagnostics.Trace.TraceWarning($"检测到本地数据库已损坏,开始重置数据库");
+                                _ = ReleseDatabase();
+                            }
+                        }));
+
+                    }
+                }
+                else
+                {
+                    ReleseDatabase();
+                }
+            }
+
+
+            bool ReleseDatabase()
+            {
+                try
+                {
+                    if (File.Exists(databasepath))
+                    {
+                        File.Move(databasepath, $"{databasepath}.{DateTime.Now:yyyyMMddHHmmss}");
+                    }
+                    var assembly = Assembly.GetEntryAssembly();
+                    Stream res = null;
+                    if (Path.GetFileName(databasepath).ToUpper() == "LOCALAPP.DB")
+                    {
+                        res = new MemoryStream(LocalResource.LocalApp);
+                    }
+                    else if (Path.GetFileName(databasepath).ToUpper() == "QWPLATFORM.DB")
+                    {
+                        res = new MemoryStream(LocalResource.QwPlatform);
+                    }
+                    if (res == null) return true;
+                    using (res)
+                    {
+                        FileHelper.EnsureDirectoryExist(databasepath);
+                        byte[] save = ZipHelper.UnZip(res)[0];
+                        using (FileStream fsObj = new FileStream(databasepath, FileMode.Create))
+                        {
+                            fsObj.Write(save, 0, save.Length);
+                            fsObj.Close();
+                        }
+                    }
+                    System.Diagnostics.Debug.WriteLine($"{databasepath} 数据库修复成功");
+                    return true;
+                }
+                catch (Exception ex)
+                {
+                    System.Diagnostics.Trace.Fail($"{databasepath} 数据库修复失败,{ex}");
+                    //_ = MessageBox.Show(Application.Current?.MainWindow, ex.ToString(), LanguageHelper.GetStringByKey("SysCfg_DatabaseRepairFail"));
+                }
+                return false;
+            }
+        }
+    
+    }
+}
+

+ 83 - 0
SCADA_DAQ.Plugin.Tailg/LocalResource.Designer.cs

@@ -0,0 +1,83 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     此代码由工具生成。
+//     运行时版本:4.0.30319.42000
+//
+//     对此文件的更改可能会导致不正确的行为,并且如果
+//     重新生成代码,这些更改将会丢失。
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace SCADA_DAQ {
+    using System;
+    
+    
+    /// <summary>
+    ///   一个强类型的资源类,用于查找本地化的字符串等。
+    /// </summary>
+    // 此类是由 StronglyTypedResourceBuilder
+    // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
+    // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
+    // (以 /str 作为命令选项),或重新生成 VS 项目。
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+    internal class LocalResource {
+        
+        private static global::System.Resources.ResourceManager resourceMan;
+        
+        private static global::System.Globalization.CultureInfo resourceCulture;
+        
+        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+        internal LocalResource() {
+        }
+        
+        /// <summary>
+        ///   返回此类使用的缓存的 ResourceManager 实例。
+        /// </summary>
+        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+        internal static global::System.Resources.ResourceManager ResourceManager {
+            get {
+                if (object.ReferenceEquals(resourceMan, null)) {
+                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SCADA_DAQ.LocalResource", typeof(LocalResource).Assembly);
+                    resourceMan = temp;
+                }
+                return resourceMan;
+            }
+        }
+        
+        /// <summary>
+        ///   重写当前线程的 CurrentUICulture 属性,对
+        ///   使用此强类型资源类的所有资源查找执行重写。
+        /// </summary>
+        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+        internal static global::System.Globalization.CultureInfo Culture {
+            get {
+                return resourceCulture;
+            }
+            set {
+                resourceCulture = value;
+            }
+        }
+        
+        /// <summary>
+        ///   查找 System.Byte[] 类型的本地化资源。
+        /// </summary>
+        internal static byte[] LocalApp {
+            get {
+                object obj = ResourceManager.GetObject("LocalApp", resourceCulture);
+                return ((byte[])(obj));
+            }
+        }
+        
+        /// <summary>
+        ///   查找 System.Byte[] 类型的本地化资源。
+        /// </summary>
+        internal static byte[] QwPlatform {
+            get {
+                object obj = ResourceManager.GetObject("QwPlatform", resourceCulture);
+                return ((byte[])(obj));
+            }
+        }
+    }
+}

+ 127 - 0
SCADA_DAQ.Plugin.Tailg/LocalResource.resx

@@ -0,0 +1,127 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
+  <data name="LocalApp" type="System.Resources.ResXFileRef, System.Windows.Forms">
+    <value>data\localapp.zip;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </data>
+  <data name="QwPlatform" type="System.Resources.ResXFileRef, System.Windows.Forms">
+    <value>data\qwplatform.zip;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </data>
+</root>

+ 55 - 0
SCADA_DAQ.Plugin.Tailg/Properties/AssemblyInfo.cs

@@ -0,0 +1,55 @@
+using System.Reflection;
+using System.Resources;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Windows;
+
+// 有关程序集的一般信息由以下
+// 控制。更改这些特性值可修改
+// 与程序集关联的信息。
+[assembly: AssemblyTitle("SCADA_DAQ.Plugin.Tailg")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("SCADA_DAQ.Plugin.Tailg")]
+[assembly: AssemblyCopyright("Copyright ©  2023")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// 将 ComVisible 设置为 false 会使此程序集中的类型
+//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
+//请将此类型的 ComVisible 特性设置为 true。
+[assembly: ComVisible(false)]
+
+//若要开始生成可本地化的应用程序,请设置
+//.csproj 文件中的 <UICulture>CultureYouAreCodingWith</UICulture>
+//例如,如果您在源文件中使用的是美国英语,
+//使用的是美国英语,请将 <UICulture> 设置为 en-US。  然后取消
+//对以下 NeutralResourceLanguage 特性的注释。  更新
+//以下行中的“en-US”以匹配项目文件中的 UICulture 设置。
+
+//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
+
+
+[assembly: ThemeInfo(
+    ResourceDictionaryLocation.None, //主题特定资源词典所处位置
+                                     //(未在页面中找到资源时使用,
+                                     //或应用程序资源字典中找到时使用)
+    ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置
+                                              //(未在页面中找到资源时使用,
+                                              //、应用程序或任何主题专用资源字典中找到时使用)
+)]
+
+
+// 程序集的版本信息由下列四个值组成: 
+//
+//      主版本
+//      次版本
+//      生成号
+//      修订号
+//
+//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
+//通过使用 "*",如下所示:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 71 - 0
SCADA_DAQ.Plugin.Tailg/Properties/Resources.Designer.cs

@@ -0,0 +1,71 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     此代码由工具生成。
+//     运行时版本: 4.0.30319.42000
+//
+//     对此文件的更改可能导致不正确的行为,如果
+//     重新生成代码,则所做更改将丢失。
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace SCADA_DAQ.Plugin.Tailg.Properties
+{
+
+
+    /// <summary>
+    ///   强类型资源类,用于查找本地化字符串等。
+    /// </summary>
+    // 此类是由 StronglyTypedResourceBuilder
+    // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
+    // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
+    // (以 /str 作为命令选项),或重新生成 VS 项目。
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+    internal class Resources
+    {
+
+        private static global::System.Resources.ResourceManager resourceMan;
+
+        private static global::System.Globalization.CultureInfo resourceCulture;
+
+        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+        internal Resources()
+        {
+        }
+
+        /// <summary>
+        ///   返回此类使用的缓存 ResourceManager 实例。
+        /// </summary>
+        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+        internal static global::System.Resources.ResourceManager ResourceManager
+        {
+            get
+            {
+                if ((resourceMan == null))
+                {
+                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SCADA_DAQ.Plugin.Tailg.Properties.Resources", typeof(Resources).Assembly);
+                    resourceMan = temp;
+                }
+                return resourceMan;
+            }
+        }
+
+        /// <summary>
+        ///   重写当前线程的 CurrentUICulture 属性,对
+        ///   使用此强类型资源类的所有资源查找执行重写。
+        /// </summary>
+        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+        internal static global::System.Globalization.CultureInfo Culture
+        {
+            get
+            {
+                return resourceCulture;
+            }
+            set
+            {
+                resourceCulture = value;
+            }
+        }
+    }
+}

+ 117 - 0
SCADA_DAQ.Plugin.Tailg/Properties/Resources.resx

@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+</root>

+ 30 - 0
SCADA_DAQ.Plugin.Tailg/Properties/Settings.Designer.cs

@@ -0,0 +1,30 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     This code was generated by a tool.
+//     Runtime Version:4.0.30319.42000
+//
+//     Changes to this file may cause incorrect behavior and will be lost if
+//     the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace SCADA_DAQ.Plugin.Tailg.Properties
+{
+
+
+    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
+    internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
+    {
+
+        private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+        public static Settings Default
+        {
+            get
+            {
+                return defaultInstance;
+            }
+        }
+    }
+}

+ 7 - 0
SCADA_DAQ.Plugin.Tailg/Properties/Settings.settings

@@ -0,0 +1,7 @@
+<?xml version='1.0' encoding='utf-8'?>
+<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
+  <Profiles>
+    <Profile Name="(Default)" />
+  </Profiles>
+  <Settings />
+</SettingsFile>

+ 140 - 0
SCADA_DAQ.Plugin.Tailg/SCADA_DAQ.Plugin.Tailg.csproj

@@ -0,0 +1,140 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{6EB3A51D-A4AF-4981-B8C1-C6F9ECFF14E4}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <RootNamespace>SCADA_DAQ.Plugin.Tailg</RootNamespace>
+    <AssemblyName>SCADA_DAQ.Plugin.Tailg</AssemblyName>
+    <TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+    <WarningLevel>4</WarningLevel>
+    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
+    <Deterministic>true</Deterministic>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup>
+    <StartupObject />
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="ControlzEx">
+      <HintPath>..\Lib\ControlzEx.dll</HintPath>
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="NPOI">
+      <HintPath>..\Lib\NPOI.dll</HintPath>
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="NPOI.OOXML">
+      <HintPath>..\Lib\NPOI.OOXML.dll</HintPath>
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="NPOI.OpenXml4Net">
+      <HintPath>..\Lib\NPOI.OpenXml4Net.dll</HintPath>
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="NPOI.OpenXmlFormats">
+      <HintPath>..\Lib\NPOI.OpenXmlFormats.dll</HintPath>
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="SCADA">
+      <HintPath>..\Lib\SCADA.dll</HintPath>
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="SCADA.CommonCtrl">
+      <HintPath>..\Lib\SCADA.CommonCtrl.dll</HintPath>
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="SCADA.CommonLib">
+      <HintPath>..\Lib\SCADA.CommonLib.dll</HintPath>
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="SCADA_DAQ.Plugin.Core, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\Lib\SCADA_DAQ.Plugin.Core.dll</HintPath>
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="System" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Windows.Forms" />
+    <Reference Include="System.Xml" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="System.Net.Http" />
+    <Reference Include="System.Xaml">
+      <RequiredTargetFramework>4.0</RequiredTargetFramework>
+    </Reference>
+    <Reference Include="WindowsBase" />
+    <Reference Include="PresentationCore" />
+    <Reference Include="PresentationFramework" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Env.cs" />
+    <Compile Include="LocalResource.Designer.cs" />
+    <Compile Include="Service\WebApiService.cs" />
+    <Compile Include="Service\CustomerServiceConfig.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Properties\AssemblyInfo.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Properties\Resources.Designer.cs">
+      <AutoGen>True</AutoGen>
+      <DesignTime>True</DesignTime>
+      <DependentUpon>Resources.resx</DependentUpon>
+    </Compile>
+    <Compile Include="Properties\Settings.Designer.cs">
+      <AutoGen>True</AutoGen>
+      <DependentUpon>Settings.settings</DependentUpon>
+      <DesignTimeSharedInput>True</DesignTimeSharedInput>
+    </Compile>
+    <EmbeddedResource Include="LocalResource.resx">
+      <SubType>Designer</SubType>
+    </EmbeddedResource>
+    <EmbeddedResource Include="Properties\Resources.resx">
+      <Generator>ResXFileCodeGenerator</Generator>
+      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
+    </EmbeddedResource>
+    <None Include="Properties\Settings.settings">
+      <Generator>SettingsSingleFileGenerator</Generator>
+      <LastGenOutput>Settings.Designer.cs</LastGenOutput>
+    </None>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="App.config" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\SCADA_DAQ.DAL\SCADA_DAQ.DAL.csproj">
+      <Project>{483009ad-8213-4c71-a0ae-1e8d6f7af8ec}</Project>
+      <Name>SCADA_DAQ.DAL</Name>
+      <Private>False</Private>
+    </ProjectReference>
+  </ItemGroup>
+  <ItemGroup>
+    <Resource Include="Service\00 此目录存放自定义后台服务.txt" />
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+</Project>

+ 1 - 0
SCADA_DAQ.Plugin.Tailg/Service/00 此目录存放自定义后台服务.txt

@@ -0,0 +1 @@
+

+ 35 - 0
SCADA_DAQ.Plugin.Tailg/Service/CustomerServiceConfig.cs

@@ -0,0 +1,35 @@
+using SCADA.CommonLib;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SCADA_DAQ.Plugin.Tailg.Service
+{
+    /// <summary>
+    /// 参数
+    /// </summary>
+    public class CustomerServiceConfig:ObservableObject
+    {
+
+		//private int _MyProperty;
+		//[AutoViewProperty("test")]
+		///// <summary>
+		///// 
+		///// </summary>
+		//public int MyProperty
+		//{
+		//	get { return _MyProperty; }
+		//	set
+		//	{
+		//		if (value != _MyProperty)
+		//		{
+		//			_MyProperty = value;
+		//			OnPropertyChanged(nameof(MyProperty));
+		//		}
+		//	}
+		//}
+
+	}
+}

+ 265 - 0
SCADA_DAQ.Plugin.Tailg/Service/WebApiService.cs

@@ -0,0 +1,265 @@
+using SCADA.CommonLib;
+using SCADA.CommonLib.Service;
+using SCADA_DAQ.Plugin.Tailg.Service;
+using SCADA_DAQ.Plugin.Tailg;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Windows.Forms;
+using System.Text.RegularExpressions;
+using System.Data;
+using SCADA.CommonLib.Data.DIL;
+
+namespace SCADA_DAQ.Plugin.Tailg.Service
+{
+    /// <summary>
+    /// 看板API服务
+    /// </summary>
+    [DisplayName("看板API服务")]
+    public class WebApiService : BaseService
+    {
+
+        // 静态缓存时长/s
+        private static int staticCacheDuration = 5;
+        // 静态缓存
+        private Dictionary<string, Dictionary<string, object>> StaticCache =
+            new Dictionary<string, Dictionary<string, object>>()
+        {
+            { "GetExceptionData", new Dictionary<string, object>(){ {"Time",DateTime.Now}, { "Cache", null} } },
+            { "GetTodayOutput", new Dictionary<string, object>(){ { "Time", DateTime.Now }, { "Cache", null} } },
+            { "GetMonthOutput", new Dictionary<string, object>(){ { "Time", DateTime.Now }, { "Cache", null} } },
+            { "GetPerCapitaOutputPerHour", new Dictionary<string, object>(){ { "Time", DateTime.Now }, { "Cache", null} } }
+        };
+
+
+        private static WebApiService _instance;
+        private CustomerServiceConfig _customerServiceConfig;
+        /// <summary>
+        /// 
+        /// </summary>
+        public override ObservableObject ServiceConfig
+        {
+            get => _customerServiceConfig;
+            set { _customerServiceConfig = (CustomerServiceConfig)value; }
+        }
+
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public static WebApiService Instance { get => _instance ?? (_instance = new WebApiService()); }
+
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public override Type ConfigType => typeof(CustomerServiceConfig);
+
+
+        private WebApiService()
+        {
+            if (_instance == null)
+            {
+                _instance = this;
+            }
+        }
+
+
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <returns></returns>
+        public override bool Start()
+        {
+            RpcService.GetInstance().Regiseter(this);   //将服务中方法注册到RPC服务器,可以给WebApi调用
+                                                        //Env.Schedual.DateTimeChanged += Schedual_DateTimeChanged;
+
+            // 创建定时任务
+            //CreateTask(GetData, );
+            return base.Start();
+        }
+
+        ///// <summary>
+        ///// 定时器
+        ///// </summary>
+        ///// <param name="sender"></param>
+        ///// <param name="e"></param>
+        //private void Schedual_DateTimeChanged(object sender, DateTimeChangedArgs e)
+        //{
+        //    if (e.TimeFlag.Second % 1 == 0)
+        //    {
+
+        //    }
+        //}
+
+
+
+        /// <summary>
+        /// PDA扫码获取产品信息
+        /// </summary>
+        /// <param name="barcode"></param>
+        /// <returns></returns>
+        public object GetData(string barcode)
+        {
+            return new object();
+        }
+
+        /// <summary>
+        /// PDA提交产品信息
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
+        public bool SubmitData(object model)
+        {
+            return true;
+        }
+
+        /// <summary>
+        /// PDA查询历史提交记录
+        /// </summary>
+        /// <param name="count"></param>
+        /// <param name="skip"></param>
+        /// <param name="filter"></param>
+        /// <returns></returns>
+        public object GetHistoryData(int count, int skip, string filter)
+        {
+            return new object();
+        }
+
+
+        /// <summary>
+        /// 获取当日异常数据
+        /// </summary>
+        /// <returns></returns>
+        public RpcResponse<object> GetExceptionData()
+        {
+            // 返回静态缓存
+            var timespan = (DateTime.Now - (DateTime)StaticCache["GetExceptionData"]["Time"]).TotalSeconds;
+            if (timespan < staticCacheDuration)
+                return new RpcResponse<object>() { Data = StaticCache["GetExceptionData"]["Cache"], Message = null };
+
+            Dictionary<string, string> workShopMap = new Dictionary<string, string>()
+            {
+                { "一车间","W01"}, {"二车间","W02"}, {"三车间","W03"}, {"四车间","W04"},
+                { "五车间","W05"}, {"六车间","W06"}, {"七车间","W07"}, {"八车间","W08"},
+            };
+            Dictionary<string, string> productionLineMap = new Dictionary<string, string>()
+            {
+                { "产线1号","P01"}, {"产线2号","P02"}, {"产线3号","P03"}, {"产线4号","P04"},
+                { "产线5号","P05"}, {"产线6号","P06"}, {"产线7号","P07"}, {"产线8号","P08"},
+            };
+
+            var sql = $"SELECT LEFT(Device_Str, 3) 车间号, SUBSTRING(Device_Str,4,4) 产线号, " +
+                $"AlarmType_Str AS 异常类型, COUNT(*) AS 次数, SUM(Duration_Int) 时长 " +
+                $"FROM V_Base_AlarmLog WHERE DATEDIFF(dd, CreateTime_Dt, GETDATE())= 0 " +
+                $"AND LEN(AlarmType_Str)>0 GROUP BY Device_Str, AlarmType_Str";
+            var dt = Env.SgIDAL.ReadDataTable(sql);
+            foreach (DataRow dr in dt.Rows)
+            {
+                dr["车间号"] = workShopMap[dr["车间号"].ToString()];
+                dr["产线号"] = productionLineMap[dr["产线号"].ToString()];
+            }
+
+            // 设置静态缓存
+            StaticCache["GetExceptionData"] = new Dictionary<string, object>()
+                { { "Time", DateTime.Now}, { "Cache", dt} };
+            return new RpcResponse<object>() { Data = dt, Message = null };
+        }
+
+
+        /// <summary>
+        /// 获取当天产量
+        /// </summary>
+        /// <returns></returns>
+        public RpcResponse<object> GetTodayOutput()
+        {
+            // 返回静态缓存
+            var timespan = (DateTime.Now - (DateTime)StaticCache["GetTodayOutput"]["Time"]).TotalSeconds;
+            if (timespan < staticCacheDuration)
+                return new RpcResponse<object>() { Data = StaticCache["GetTodayOutput"]["Cache"], Message = null };
+
+            var sql = $"SELECT WorkShopId_Str AS 车间号, ProductionLineId_Str AS 产线号, COUNT(*) AS 产量 " +
+                $"FROM APP_TaiLing_ProductionRecord WHERE DATEDIFF(dd, EndTime_Dt, GETDATE())= 0 " +
+                $"GROUP BY WorkShopId_Str, ProductionLineId_Str";
+            var dt = Env.SgIDAL.ReadDataTable(sql);
+
+            // 设置静态缓存
+            StaticCache["GetTodayOutput"] = new Dictionary<string, object>()
+                { { "Time", DateTime.Now}, { "Cache", dt} };
+            return new RpcResponse<object>() { Data = dt, Message = null };
+        }
+
+
+        /// <summary>
+        /// 获取月度产量
+        /// </summary>
+        /// <returns></returns>
+        public RpcResponse<object> GetMonthOutput()
+        {
+            // 返回静态缓存
+            var timespan = (DateTime.Now - (DateTime)StaticCache["GetMonthOutput"]["Time"]).TotalSeconds;
+            if (timespan < staticCacheDuration)
+                return new RpcResponse<object>() { Data = StaticCache["GetMonthOutput"]["Cache"], Message = null };
+
+            var sql = $"SELECT YEAR(StartTime_Dt) AS 年份, MONTH(StartTime_Dt) AS 月份, " +
+                $"WorkShopId_Str AS 车间号, ProductionLineId_Str AS 产线号, COUNT(*) AS 产量 " +
+                $"FROM APP_TaiLing_ProductionRecord " +
+                $"GROUP BY YEAR(StartTime_Dt), MONTH(StartTime_Dt), WorkShopId_Str, ProductionLineId_Str";
+            var dt = Env.SgIDAL.ReadDataTable(sql);
+
+            // 设置静态缓存
+            StaticCache["GetMonthOutput"] = new Dictionary<string, object>()
+                { { "Time", DateTime.Now}, { "Cache", dt} };
+            return new RpcResponse<object>() { Data = dt, Message = null };
+        }
+
+
+        /// <summary>
+        /// 获取人均小时产出率
+        /// </summary>
+        /// <returns></returns>
+        public RpcResponse<object> GetPerCapitaOutputPerHour()
+        {
+            // 返回静态缓存
+            var timespan = (DateTime.Now - (DateTime)StaticCache["GetPerCapitaOutputPerHour"]["Time"]).TotalSeconds;
+            if (timespan < staticCacheDuration)
+                return new RpcResponse<object>() { Data = StaticCache["GetPerCapitaOutputPerHour"]["Cache"], Message = null };
+
+            // 三表联查,人均小时产出率直接用sql算出来
+            var sql = "SELECT tb1.年份, tb1.月份, tb1.车间号, tb1.产线号, tb1.时长, tb2.产量, tb3.NumberOfPeople_Int AS 人数, " +
+                "CONVERT(DECIMAL(13,3),3600.0*tb2.产量/tb3.NumberOfPeople_Int/tb1.时长) AS 人均小时产出率 " +
+                "FROM((SELECT YEAR(StartTime_Dt) AS 年份, MONTH(StartTime_Dt) AS 月份, " +
+                "WorkShopId_Str AS 车间号, ProductionLineId_Str AS 产线号, SUM(DurationSec_Int) AS 时长 " +
+                "FROM APP_TaiLing_ProductionLineStateRecord " +
+                "WHERE ProductionLineState_Str = 'Running' " +
+                "GROUP BY YEAR(StartTime_Dt), MONTH(StartTime_Dt), WorkShopId_Str, ProductionLineId_Str) AS tb1 " +
+                "LEFT JOIN(SELECT YEAR(StartTime_Dt) AS 年份, MONTH(StartTime_Dt) AS 月份, " +
+                "WorkShopId_Str AS 车间号, ProductionLineId_Str AS 产线号, COUNT(*) AS 产量 " +
+                "FROM APP_TaiLing_ProductionRecord " +
+                "GROUP BY YEAR(StartTime_Dt), MONTH(StartTime_Dt), WorkShopId_Str, ProductionLineId_Str) AS tb2 " +
+                "ON tb1.年份 = tb2.年份 AND tb1.月份 = tb2.月份 AND tb1.车间号 = tb2.车间号 AND tb1.产线号 = tb2.产线号) " +
+                "LEFT JOIN APP_TaiLing_ProductionLineManagement AS tb3 " +
+                "ON tb1.车间号 = tb3.WorkShopId_Str AND tb1.产线号 = tb3.ProductionLineId_Str";
+            var dt = Env.SgIDAL.ReadDataTable(sql);
+
+            // 设置静态缓存
+            StaticCache["GetPerCapitaOutputPerHour"] = new Dictionary<string, object>()
+                { { "Time", DateTime.Now}, { "Cache", dt} };
+            return new RpcResponse<object>() { Data = dt, Message = null };
+        }
+
+
+
+
+        /// <summary>
+        /// 停止服务
+        /// </summary>
+        /// <returns></returns>
+        public override bool Stop()
+        {
+            //Env.Schedual.DateTimeChanged -= Schedual_DateTimeChanged;  // 销毁定时器
+            return base.Stop();
+        }
+    }
+}

+ 1 - 0
SCADA_DAQ.Service/App.config

@@ -6,6 +6,7 @@
 
   <runtime>
     <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+		<probing privatePath="SystemLibs;plugin"/>
       <dependentAssembly>
         <assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" culture="neutral"/>
         <bindingRedirect oldVersion="0.0.0.0-2.0.14.0" newVersion="2.0.14.0"/>

+ 3 - 3
SCADA_DAQ.Service/SCADA_DAQ.Service.csproj

@@ -54,12 +54,12 @@
     <Reference Include="SCADA.CommonLib">
       <HintPath>..\Lib\SCADA.CommonLib.dll</HintPath>
     </Reference>
-    <Reference Include="SCADA_DAQ.Plugin.Core">
-      <HintPath>..\Lib\SCADA_DAQ.Plugin.Core.dll</HintPath>
-    </Reference>
     <Reference Include="SCADA_DAQ.Plugin.Machine">
       <HintPath>..\Lib\SCADA_DAQ.Plugin.Machine.dll</HintPath>
     </Reference>
+    <Reference Include="SCADA_DAQ.Plugin.MachineUI">
+      <HintPath>..\Lib\SCADA_DAQ.Plugin.MachineUI.dll</HintPath>
+    </Reference>
     <Reference Include="System.Data.SQLite">
       <HintPath>..\Lib\System.Data.SQLite.dll</HintPath>
     </Reference>

+ 102 - 0
SCADA_DAQ/Customer/Jobs/SyncRunTime.cs

@@ -0,0 +1,102 @@
+using log4net;
+using NPOI.SS.Formula.Functions;
+using NPOI.XWPF.UserModel;
+using Quartz;
+using SCADA.CommonLib;
+using SCADA.CommonLib.Data.DIL;
+using SCADA.CommonLib.Helper;
+using SCADA.CommonLib.Scheduler;
+using SCADA_DAQ.Customer.Models.ProductionLineManagement;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Xml.Linq;
+using static System.Net.Mime.MediaTypeNames;
+
+namespace SCADA_DAQ.Customer.Jobs
+{
+    /// <summary>
+    /// 同步运行时间任务
+    /// 弃用,加到Systemcontrol里
+    /// </summary>
+    [DisplayName("同步运行时间任务")]
+    public class SyncRunTime : BaseJob
+    {
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public SyncRunTime() : base()
+        {
+
+        }
+
+        /// <summary>
+        /// 执行策略
+        /// </summary>
+        public override string ExcutePolicy { get => "0 * * * * ?"; }  //每分钟同步运行时长
+
+        /// <summary>
+        /// 任务名称
+        /// </summary>
+        public override string JobName => "SyncRunTime";
+
+        /// <summary>
+        /// 参数类
+        /// </summary>
+        public override Type JobParameterType { get; set; } = typeof(CustomerJobConfig);
+
+        /// <summary>
+        /// 任务执行
+        /// </summary>
+        protected override Func<IJobExecutionContext,ILog, JobExcuteFinishEventArgs> ExcuteHandler => (context,log) =>
+        {
+            var para = (CustomerJobConfig)JobServer.JobParameters[context.JobDetail.Key.ToString()];
+            var excuteMsg =new JobExcuteFinishEventArgs();
+            //TODO:这里执行需要的逻辑
+
+            //var localValue = Env.LocalDAL.SysApp_DayStatistics?.GetTopOne($"DayStartTime_Dt='{DateTime.Now.Date.Format()}'", "Value_Dec", "DayStartTime_Dt desc");
+            //if (localValue == null)
+            //    localValue = 0;
+
+            
+            //var filterStr = $"ProductionLineId_Str='{CustomerEnv.ProductionLineConfigValue.ProductionLineId}' " +
+            //            $"AND WorkShopId_Str='{CustomerEnv.ProductionLineConfigValue.WorkShopId}' " +
+            //            $"AND DATEDIFF(dd, StartTime_Dt, GETDATE())=0";
+            //ProductionLineStateModel tableInfo = null;
+            //if (Env.SgIDAL.APP_TaiLing_ProductionLineStateRecord != null && Env.SgIDAL.APP_TaiLing_ProductionLineStateRecord.Exist(filterStr))
+            //{
+            //    tableInfo = Env.SgIDAL.APP_TaiLing_ProductionLineStateRecord?
+            //        .GetData<ProductionLineStateModel>(filterStr)
+            //        .OrderBy(t => t.ID).Last();
+            //}
+            //else
+            //{
+            //    tableInfo = null;
+            //}
+
+            //if (tableInfo == null)
+            //{
+            //    Env.SgIDAL.APP_TaiLing_ProductionLineStateRecord?.Insert(
+            //        new UpdateItem("ProductionLineId_Str", CustomerEnv.ProductionLineConfigValue.ProductionLineId),
+            //        new UpdateItem("WorkShopId_Str", CustomerEnv.ProductionLineConfigValue.WorkShopId),
+            //        new UpdateItem("ProductionLineState_Str", "Running"),
+            //        new UpdateItem("StartTime_Dt", DateTime.Now.Date.Format()),
+            //        new UpdateItem("EndTime_Dt", DateTime.Now.AddDays(1).Date.Format()),
+            //        new UpdateItem("DurationSec_Int", localValue)
+            //        );
+            //}
+            //else
+            //{
+            //    Env.SgIDAL.APP_TaiLing_ProductionLineStateRecord?.Update(filterStr,
+            //        new UpdateItem("DurationSec_Int", localValue));
+            //}
+
+            excuteMsg.IsSuccess= true;
+            return excuteMsg;
+        };
+    }
+}

+ 2 - 0
SCADA_DAQ/Customer/Machines/SampleMachine.cs

@@ -3,6 +3,7 @@ using SCADA;
 using SCADA.CommonLib;
 using SCADA.CommonLib.Data.DIL;
 using SCADA.Drive;
+using SCADA_DAQ.Plugin.Machine;
 using SCADA_DAQ.Plugin.Machine.Device;
 using System;
 using System.Collections.ObjectModel;
@@ -34,6 +35,7 @@ namespace SCADA_DAQ.Customer.Machines
             // Env.DAL.Base_AlarmCode.GetData<DBModel.Base_AlarmCode>()?
             // .Select(t => new Alarm() { AlarmCode = t.AlarmCode_Str, Desc = t.AlarmDesc_Str })?
             // .ToLookup(t => t.AlarmCode).ToDictionary(t => t.Key, t => t.First());
+
         }
 
         ///// <summary>

+ 120 - 80
SCADA_DAQ/Customer/Machines/ScannerMachine.cs

@@ -1,5 +1,4 @@
-using DBNames;
-using LiveCharts.Helpers;
+using LiveCharts.Helpers;
 using Microsoft.DwayneNeed.Numerics;
 using Mysqlx.Crud;
 using NPOI.SS.Formula.Functions;
@@ -15,6 +14,7 @@ using SCADA_DAQ.Customer.Models.RecordManagement;
 using SCADA_DAQ.Customer.Models.TaskManagement;
 using SCADA_DAQ.Plugin.Machine;
 using SCADA_DAQ.Plugin.Machine.Device;
+using SqlSchema.DBNames;
 using System;
 using System.Collections;
 using System.Collections.Generic;
@@ -78,7 +78,8 @@ namespace SCADA_DAQ.Customer.Machines
             //    $"AND WorkShopId_Str='{scanItem.WorkShopId}' AND ProductionLineId_Str='{scanItem.ProductionLineId}'");
 
             Init();
-
+            if (lastOrderId == "")
+                Log.Warn("上次生产的工单号数据已丢失");
         }
 
         /// <summary>
@@ -153,10 +154,10 @@ namespace SCADA_DAQ.Customer.Machines
             }
             // 插入数据
             sqliteDAL.APP_TaiLing_ScanRecord.Insert(
-                new UpdateItem(T_Col_Name.APP_TaiLing_ScanRecord.ScannerId_Str, BaseDevice.DeviceID),
-                new UpdateItem(T_Col_Name.APP_TaiLing_ScanRecord.ScanData_Str, e.ReceiveMsg),
-                new UpdateItem(T_Col_Name.APP_TaiLing_ScanRecord.WorkShopId_Str, CustomerEnv.ProductionLineConfigValue.WorkShopId),
-                new UpdateItem(T_Col_Name.APP_TaiLing_ScanRecord.ProductionLineId_Str, CustomerEnv.ProductionLineConfigValue.ProductionLineId)
+                new UpdateItem(DBNames.T_Col_Name.APP_TaiLing_ScanRecord.ScannerId_Str, BaseDevice.DeviceID),
+                new UpdateItem(DBNames.T_Col_Name.APP_TaiLing_ScanRecord.ScanData_Str, e.ReceiveMsg),
+                new UpdateItem(DBNames.T_Col_Name.APP_TaiLing_ScanRecord.WorkShopId_Str, CustomerEnv.ProductionLineConfigValue.WorkShopId),
+                new UpdateItem(DBNames.T_Col_Name.APP_TaiLing_ScanRecord.ProductionLineId_Str, CustomerEnv.ProductionLineConfigValue.ProductionLineId)
             );
 
             
@@ -184,23 +185,26 @@ namespace SCADA_DAQ.Customer.Machines
 
             if (BaseDevice.DeviceID == "上料扫码枪")
             {
-                currentOrderId = scanRecordItem.OrderId;
-                currentMotorcycleTypeName = scanRecordItem.MotorcycleTypeName;
+                currentOrderId = taskInfoItem.OrderId;
+                currentMotorcycleTypeName = taskInfoItem.MotorcycleTypeName;
+                CustomerEnv.CurrentTaskInfo.OrderSequence = taskInfoItem.OrderSequence;
                 CustomerEnv.CurrentTaskInfo.OrderId = currentOrderId;
                 CustomerEnv.CurrentTaskInfo.MotorcycleTypeName = currentMotorcycleTypeName;
                 CustomerEnv.CurrentTaskInfo.CurrentProduction = taskInfoItem.CurrentProduction;
             }
             else if (BaseDevice.DeviceID == "下料扫码枪")
             {
-                lastOrderId = scanRecordItem.OrderId;
-                if (lastOrderId == "")
-                    Log.Warn("上次生产的工单号数据已丢失");
-                CustomerEnv.CurrentTaskInfo.OrderId = scanRecordItem.OrderId;
-                CustomerEnv.CurrentTaskInfo.MotorcycleTypeName = scanRecordItem.MotorcycleTypeName;
+                lastOrderId = taskInfoItem.OrderId;
+                CustomerEnv.CurrentTaskInfo.OrderSequence = taskInfoItem.OrderSequence;
+                CustomerEnv.CurrentTaskInfo.OrderId = taskInfoItem.OrderId;
+                CustomerEnv.CurrentTaskInfo.MotorcycleTypeName = taskInfoItem.MotorcycleTypeName;
                 CustomerEnv.CurrentTaskInfo.CurrentProduction = taskInfoItem.CurrentProduction;
             }
+            
         }
 
+
+        #region 上料
         /// <summary>
         /// 上料
         /// </summary>
@@ -259,6 +263,7 @@ namespace SCADA_DAQ.Customer.Machines
             }
             else if (QRInfo.Count() == 3 && QRInfo[0] == "change")
             {
+                CustomerEnv.CurrentTaskInfo.OrderSequence = -1;
                 CustomerEnv.CurrentTaskInfo.OrderId = "";
                 CustomerEnv.CurrentTaskInfo.MotorcycleTypeName = "";
 
@@ -278,10 +283,11 @@ namespace SCADA_DAQ.Customer.Machines
                         && t.OrderState != "已生产"
                         && t.WorkShopId == CustomerEnv.ProductionLineConfigValue.WorkShopId
                         && t.ProductionLineId == CustomerEnv.ProductionLineConfigValue.ProductionLineId)
-                    .Select(t => t.OrderId).ToList();
-
+                    .ToList();
+                
                 if (taskList == null)
                 {
+                    CustomerEnv.CurrentTaskInfo.OrderSequence = -1;
                     CustomerEnv.CurrentTaskInfo.OrderId = "";
                     CustomerEnv.CurrentTaskInfo.MotorcycleTypeName = "查无工单任务\r\n请先添加工单";
                     Log.Warn("查无工单任务,请先添加工单");
@@ -289,37 +295,43 @@ namespace SCADA_DAQ.Customer.Machines
                 }
                 if (taskList.Count <= 0)
                 {
+                    CustomerEnv.CurrentTaskInfo.OrderSequence = -1;
                     CustomerEnv.CurrentTaskInfo.OrderId = "";
                     CustomerEnv.CurrentTaskInfo.MotorcycleTypeName = "查无工单任务\r\n请先添加工单";
                     Log.Warn("查无工单任务,请先添加工单");
                     return;
                 }
 
+                var OrderSequence = -1;
                 // 工单切换
                 if (lastScanCode != scanMsg)  // 换码
                 {
                     orderIndex = 0;
                     lastScanCode = scanMsg;
                 }
-                if (currentOrderId != taskList[orderIndex])
+                if (currentOrderId != taskList[orderIndex].OrderId)
                 {
-                    currentOrderId = taskList[orderIndex];
+                    currentOrderId = taskList[orderIndex].OrderId;
+                    OrderSequence = taskList[orderIndex].OrderSequence;
                 }
                 else
                 {
                     if (orderIndex < taskList.Count - 1)
                     {
                         orderIndex++;
-                        currentOrderId = taskList[orderIndex];
+                        currentOrderId = taskList[orderIndex].OrderId;
+                        OrderSequence = taskList[orderIndex].OrderSequence;
                     }
                     else
                     {
                         // 循环切换
                         orderIndex = 0;
-                        currentOrderId = taskList[orderIndex];
+                        currentOrderId = taskList[orderIndex].OrderId;
+                        OrderSequence = taskList[orderIndex].OrderSequence;
                     }
                 }
 
+                CustomerEnv.CurrentTaskInfo.OrderSequence = OrderSequence;
                 CustomerEnv.CurrentTaskInfo.OrderId = currentOrderId;
                 CustomerEnv.CurrentTaskInfo.MotorcycleTypeName = currentMotorcycleTypeName;
 
@@ -340,6 +352,69 @@ namespace SCADA_DAQ.Customer.Machines
             CustomerEnv.CurrentTaskInfo.CurrentProduction = taskInfoItem.CurrentProduction;
         }
 
+        /// <summary>
+        /// 上料同步队列
+        /// </summary>
+        public void ImportSyncQueue()
+        {
+            // 出队列
+            ScanRecordModel scanItem = scanQueue.Dequeue() as ScanRecordModel;
+            //CustomerEnv.ScanList.RemoveAt(0);
+
+            // 保存上料记录
+            DAL.APP_TaiLing_ScanRecord.Insert(
+                new UpdateItem(T_Col_Name.APP_TaiLing_ScanRecord.ScannerId_Str, scanItem.ScannerId),
+                new UpdateItem(T_Col_Name.APP_TaiLing_ScanRecord.ScanData_Str, scanItem.ScanData),
+                new UpdateItem(T_Col_Name.APP_TaiLing_ScanRecord.WorkShopId_Str, scanItem.WorkShopId),
+                new UpdateItem(T_Col_Name.APP_TaiLing_ScanRecord.ProductionLineId_Str, scanItem.ProductionLineId),
+                new UpdateItem(T_Col_Name.APP_TaiLing_ScanRecord.ProductId_Str, scanItem.ProductId),
+                new UpdateItem(T_Col_Name.APP_TaiLing_ScanRecord.OrderId_Str, scanItem.OrderId),
+                new UpdateItem(T_Col_Name.APP_TaiLing_ScanRecord.MotorcycleTypeName_Str, scanItem.MotorcycleTypeName)
+            );
+
+            // 产品朔源记录
+            DAL.APP_TaiLing_ProductionRecord.Insert(
+                new UpdateItem(T_Col_Name.APP_TaiLing_ProductionRecord.StartTime_Dt, DateTime.Now.Format()),
+                new UpdateItem(T_Col_Name.APP_TaiLing_ProductionRecord.WorkShopId_Str, scanItem.WorkShopId),
+                new UpdateItem(T_Col_Name.APP_TaiLing_ProductionRecord.ProductionLineId_Str, scanItem.ProductionLineId),
+                new UpdateItem(T_Col_Name.APP_TaiLing_ProductionRecord.ProductId_Str, scanItem.ProductId)
+            );
+
+            // 生产状态为“待生产” 
+            var taskInfo = DAL.APP_TaiLing_TaskManagement.GetData<TaskManagementModel>()?
+                .Where(t => t.OrderId == scanItem.OrderId && t.WorkShopId == scanItem.WorkShopId
+                    && t.ProductionLineId == scanItem.ProductionLineId && t.OrderState == "待生产").ToList();
+            if (taskInfo == null)
+                return;
+            if (taskInfo.Count <= 0)
+                return;
+
+
+            // 开始时间是否为默认值 new DateTime()
+            var firstWorkingTask = taskInfo.Where(t => t.WorkStartTime == new DateTime()).ToList();
+            if (firstWorkingTask.Count > 0)
+            {
+                // 开始时间为默认值
+                // 第一次生产更新开始生产时间和生产状态
+                DAL.APP_TaiLing_TaskManagement.Update($"OrderId_Str='{scanItem.OrderId}' AND WorkShopId_Str='{scanItem.WorkShopId}' AND ProductionLineId_Str='{scanItem.ProductionLineId}'",
+                    new UpdateItem(SqlSchema.DBNames.T_Col_Name.APP_TaiLing_TaskManagement.OrderState_Str, "生产中"),
+                    new UpdateItem(SqlSchema.DBNames.T_Col_Name.APP_TaiLing_TaskManagement.WorkStartTime_Dt, DateTime.Now.Format())
+                );
+            }
+            else
+            {
+                // 非第一次生产更新生产状态
+                DAL.APP_TaiLing_TaskManagement.Update($"OrderId_Str='{scanItem.OrderId}' AND WorkShopId_Str='{scanItem.WorkShopId}' AND ProductionLineId_Str='{scanItem.ProductionLineId}'",
+                    new UpdateItem(SqlSchema.DBNames.T_Col_Name.APP_TaiLing_TaskManagement.OrderState_Str, "生产中")
+                );
+            }
+        }
+
+        #endregion
+
+
+        #region 下料
+
         /// <summary>
         /// 下料
         /// </summary>
@@ -375,6 +450,7 @@ namespace SCADA_DAQ.Customer.Machines
             {
                 //CustomerEnv.CurrentOrderId = $"请先将“{scanMsg}”绑定车型";
                 //CustomerEnv.CurrentMotorcycleTypeName = "";
+                CustomerEnv.CurrentTaskInfo.OrderSequence = -1;
                 CustomerEnv.CurrentTaskInfo.OrderId = "";
                 CustomerEnv.CurrentTaskInfo.MotorcycleTypeName = $"请先将\r\n“{scanMsg}”\r\n绑定车型";
                 Log.Warn($"请先将“{scanMsg}”绑定车型");
@@ -388,6 +464,13 @@ namespace SCADA_DAQ.Customer.Machines
             CustomerEnv.CurrentTaskInfo.OrderId = currentOrderId;
             CustomerEnv.CurrentTaskInfo.MotorcycleTypeName = currentMotorcycleTypeName;
 
+            var taskInfo = DAL.APP_TaiLing_TaskManagement.GetData<TaskManagementModel>()?
+                .Where(t => t.OrderId == currentOrderId
+                    && t.WorkShopId == CustomerEnv.ProductionLineConfigValue.WorkShopId
+                    && t.ProductionLineId == CustomerEnv.ProductionLineConfigValue.ProductionLineId)
+                .OrderBy(t => t.ID).Last();
+            CustomerEnv.CurrentTaskInfo.OrderSequence = taskInfo.OrderSequence;
+
             // 进队列
             scanQueue.Enqueue(new ScanRecordModel
             {
@@ -406,58 +489,6 @@ namespace SCADA_DAQ.Customer.Machines
             }
         }
 
-
-        /// <summary>
-        /// 上料同步队列
-        /// </summary>
-        public void ImportSyncQueue()
-        {
-            // 出队列
-            ScanRecordModel scanItem = scanQueue.Dequeue() as ScanRecordModel;
-            //CustomerEnv.ScanList.RemoveAt(0);
-
-            // 保存扫码记录
-            DAL.APP_TaiLing_ScanRecord.Insert(
-                new UpdateItem(T_Col_Name.APP_TaiLing_ScanRecord.ScannerId_Str, scanItem.ScannerId),
-                new UpdateItem(T_Col_Name.APP_TaiLing_ScanRecord.ScanData_Str, scanItem.ScanData),
-                new UpdateItem(T_Col_Name.APP_TaiLing_ScanRecord.WorkShopId_Str, scanItem.WorkShopId),
-                new UpdateItem(T_Col_Name.APP_TaiLing_ScanRecord.ProductionLineId_Str, scanItem.ProductionLineId),
-                new UpdateItem(T_Col_Name.APP_TaiLing_ScanRecord.ProductId_Str, scanItem.ProductId),
-                new UpdateItem(T_Col_Name.APP_TaiLing_ScanRecord.OrderId_Str, scanItem.OrderId),
-                new UpdateItem(T_Col_Name.APP_TaiLing_ScanRecord.MotorcycleTypeName_Str, scanItem.MotorcycleTypeName)
-            );
-
-            // 生产状态为“待生产” 
-            var taskInfo = DAL.APP_TaiLing_TaskManagement.GetData<TaskManagementModel>()?
-                .Where(t => t.OrderId == scanItem.OrderId && t.WorkShopId == scanItem.WorkShopId
-                    && t.ProductionLineId == scanItem.ProductionLineId && t.OrderState == "待生产").ToList();
-            if (taskInfo == null)
-                return;
-            if (taskInfo.Count <= 0)
-                return;
-
-
-            // 开始时间是否为默认值 new DateTime()
-            var firstWorkingTask = taskInfo.Where(t => t.WorkStartTime == new DateTime()).ToList();
-            if (firstWorkingTask.Count > 0)
-            {
-                // 开始时间为默认值
-                // 第一次生产更新开始生产时间和生产状态
-                DAL.APP_TaiLing_TaskManagement.Update($"OrderId_Str='{scanItem.OrderId}' AND WorkShopId_Str='{scanItem.WorkShopId}' AND ProductionLineId_Str='{scanItem.ProductionLineId}'",
-                    new UpdateItem(SqlSchema.DBNames.T_Col_Name.APP_TaiLing_TaskManagement.OrderState_Str, "生产中"),
-                    new UpdateItem(SqlSchema.DBNames.T_Col_Name.APP_TaiLing_TaskManagement.WorkStartTime_Dt, DateTime.Now.Format())
-                );
-            }
-            else
-            {
-                // 非第一次生产更新生产状态
-                DAL.APP_TaiLing_TaskManagement.Update($"OrderId_Str='{scanItem.OrderId}' AND WorkShopId_Str='{scanItem.WorkShopId}' AND ProductionLineId_Str='{scanItem.ProductionLineId}'",
-                    new UpdateItem(SqlSchema.DBNames.T_Col_Name.APP_TaiLing_TaskManagement.OrderState_Str, "生产中")
-                );
-            }
-        }
-
-
         /// <summary>
         /// 下料同步队列
         /// </summary>
@@ -467,7 +498,7 @@ namespace SCADA_DAQ.Customer.Machines
             ScanRecordModel scanItem = scanQueue.Dequeue() as ScanRecordModel;
             //CustomerEnv.ScanList.RemoveAt(0);
 
-            // 保存扫码记录
+            // 保存下料记录
             DAL.APP_TaiLing_ScanRecord.Insert(
                 new UpdateItem(T_Col_Name.APP_TaiLing_ScanRecord.ScannerId_Str, scanItem.ScannerId),
                 new UpdateItem(T_Col_Name.APP_TaiLing_ScanRecord.ScanData_Str, scanItem.ScanData),
@@ -484,7 +515,7 @@ namespace SCADA_DAQ.Customer.Machines
                 .OrderBy(t => t.ID).LastOrDefault();
             if (taskInfo == null)
             {
-                Log.Warn($"“{scanItem.OrderId}”-匹配不到该订单,请确认订单信息");
+                Log.Warn($"“{scanItem.OrderId}”-查无生产的订单,请确认订单信息及状态!");
                 return;
             }
 
@@ -494,22 +525,21 @@ namespace SCADA_DAQ.Customer.Machines
             // 更新工单
             // 计数
             DAL.APP_TaiLing_TaskManagement.Update($"OrderId_Str='{scanItem.OrderId}' AND WorkShopId_Str='{scanItem.WorkShopId}' AND ProductionLineId_Str='{scanItem.ProductionLineId}'",
-                new UpdateItem(SqlSchema.DBNames.T_Col_Name.APP_TaiLing_TaskManagement.CurrentProduction_Int, taskInfo.CurrentProduction + 1));
+                new UpdateItem(T_Col_Name.APP_TaiLing_TaskManagement.CurrentProduction_Int, taskInfo.CurrentProduction + 1));
             CustomerEnv.CurrentTaskInfo.CurrentProduction = taskInfo.CurrentProduction + 1;
             //if (tableCacheItem != null)
             //{
             //    tableCacheItem.CurrentProduction++;
             //}
 
-
             if (taskInfo.CurrentProduction + 1 >= taskInfo.ScheduledProduction)
             {
                 // 结束生产 
                 var dateDiff = (DateTime.Now - taskInfo.WorkStartTime).TotalSeconds.ToInt();  // 时间差/s
                 DAL.APP_TaiLing_TaskManagement.Update($"OrderId_Str='{scanItem.OrderId}' AND WorkShopId_Str='{scanItem.WorkShopId}' AND ProductionLineId_Str='{scanItem.ProductionLineId}'",
-                    new UpdateItem(SqlSchema.DBNames.T_Col_Name.APP_TaiLing_TaskManagement.WorkEndTime_Dt, DateTime.Now.Format()),
-                    new UpdateItem(SqlSchema.DBNames.T_Col_Name.APP_TaiLing_TaskManagement.DurationSec_Int, dateDiff),
-                    new UpdateItem(SqlSchema.DBNames.T_Col_Name.APP_TaiLing_TaskManagement.OrderState_Str, "已生产")
+                    new UpdateItem(T_Col_Name.APP_TaiLing_TaskManagement.WorkEndTime_Dt, DateTime.Now.Format()),
+                    new UpdateItem(T_Col_Name.APP_TaiLing_TaskManagement.DurationSec_Int, dateDiff),
+                    new UpdateItem(T_Col_Name.APP_TaiLing_TaskManagement.OrderState_Str, "已生产")
                 );
                 //// 更新API缓存
                 //if (tableCacheItem != null)
@@ -521,6 +551,13 @@ namespace SCADA_DAQ.Customer.Machines
             }
 
 
+            // 更新产品记录
+            DAL.ExecuteNonQuery("UPDATE APP_TaiLing_ProductionRecord SET EndTime_Dt=GETDATE(), " +
+                "DurationSec_Int=DATEDIFF(s, StartTime_Dt, GETDATE()), ModifyTime_Dt=GETDATE() " +
+                $"WHERE ProductId_Str='{scanItem.ProductId}' AND WorkShopId_Str='{scanItem.WorkShopId}' " +
+                $"AND ProductionLineId_Str='{scanItem.ProductionLineId}'");
+
+
             // 切换生产工单
             if (currentOrderId != lastOrderId)
             {
@@ -532,7 +569,7 @@ namespace SCADA_DAQ.Customer.Machines
                 if (oldTaskInfo == "生产中")
                 {
                     DAL.APP_TaiLing_TaskManagement.Update($"OrderId_Str='{lastOrderId}' AND WorkShopId_Str='{scanItem.WorkShopId}' AND ProductionLineId_Str='{scanItem.ProductionLineId}'",
-                        new UpdateItem(SqlSchema.DBNames.T_Col_Name.APP_TaiLing_TaskManagement.OrderState_Str, "待生产"));
+                        new UpdateItem(T_Col_Name.APP_TaiLing_TaskManagement.OrderState_Str, "待生产"));
                     
                     //// 更新API缓存
                     //if (tableCacheItem != null)
@@ -546,6 +583,9 @@ namespace SCADA_DAQ.Customer.Machines
         }
 
 
+        #endregion
+
+
         /// <summary>
         /// 取出缓存表的数据
         /// </summary>

+ 0 - 302
SCADA_DAQ/Customer/Models/AlarmTable/AddAlarmTable.cs

@@ -1,302 +0,0 @@
-using SCADA.CommonLib;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace SCADA_DAQ.Customer.Models.AlarmTable
-{
-    public class AddAlarmTable :ObservableObject
-    {
-
-        /// <summary>
-        /// 
-        /// </summary>
-        public int OrgID
-        {
-            get { return _OrgID; }
-            set
-            {
-                if (value != _OrgID)
-                {
-                    _OrgID = value;
-                    OnPropertyChanged(nameof(OrgID));
-                }
-            }
-        }
-        private int _OrgID;
-
-
-        /// <summary>
-        /// 
-        /// </summary>
-        public string AlarmId
-        {
-            get { return _AlarmId; }
-            set
-            {
-                if (value != _AlarmId)
-                {
-                    _AlarmId = value;
-                    OnPropertyChanged(nameof(AlarmId));
-                }
-            }
-        }
-        private string _AlarmId;
-
-
-        /// <summary>
-        /// 
-        /// </summary>
-        public string Device
-        {
-            get { return _Device; }
-            set
-            {
-                if (value != _Device)
-                {
-                    _Device = value;
-                    OnPropertyChanged(nameof(Device));
-                }
-            }
-        }
-        private string _Device;
-
-
-
-        /// <summary>
-        /// 
-        /// </summary>
-        public string TagName
-        {
-            get { return _TagName; }
-            set
-            {
-                if (value != _TagName)
-                {
-                    _TagName = value;
-                    OnPropertyChanged(nameof(TagName));
-                }
-            }
-        }
-        private string _TagName;
-
-
-        /// <summary>
-        /// 
-        /// </summary>
-        public string AlarmCode
-        {
-            get { return _AlarmCode; }
-            set
-            {
-                if (value != _AlarmCode)
-                {
-                    _AlarmCode = value;
-                    OnPropertyChanged(nameof(AlarmCode));
-                }
-            }
-        }
-        private string _AlarmCode;
-
-
-        /// <summary>
-        /// 
-        /// </summary>
-        public string Helper
-        {
-            get { return _Helper; }
-            set
-            {
-                if (value != _Helper)
-                {
-                    _Helper = value;
-                    OnPropertyChanged(nameof(Helper));
-                }
-            }
-        }
-        private string _Helper;
-
-
-        /// <summary>
-        /// 
-        /// </summary>
-        public string Remark
-        {
-            get { return _Remark; }
-            set
-            {
-                if (value != _Remark)
-                {
-                    _Remark = value;
-                    OnPropertyChanged(nameof(Remark));
-                }
-            }
-        }
-        private string _Remark;
-
-
-        /// <summary>
-        /// 
-        /// </summary>
-        public string TriggedTime
-        {
-            get { return _TriggedTime; }
-            set
-            {
-                if (value != _TriggedTime)
-                {
-                    _TriggedTime = value;
-                    OnPropertyChanged(nameof(TriggedTime));
-                }
-            }
-        }
-        private string _TriggedTime;
-
-
-        /// <summary>
-        /// 
-        /// </summary>
-        public DateTime RecoverTime
-        {
-            get { return _RecoverTime; }
-            set
-            {
-                if (value != _RecoverTime)
-                {
-                    _RecoverTime = value;
-                    OnPropertyChanged(nameof(RecoverTime));
-                }
-            }
-        }
-        private DateTime _RecoverTime;
-
-
-        /// <summary>
-        /// 
-        /// </summary>
-        public string DurationStr
-        {
-            get { return _DurationStr; }
-            set
-            {
-                if (value != _DurationStr)
-                {
-                    _DurationStr = value;
-                    OnPropertyChanged(nameof(DurationStr));
-                }
-            }
-        }
-        private string _DurationStr;
-
-
-        /// <summary>
-        /// 
-        /// </summary>
-        public int DurationInt
-        {
-            get { return _DurationInt; }
-            set
-            {
-                if (value != _DurationInt)
-                {
-                    _DurationInt = value;
-                    OnPropertyChanged(nameof(DurationInt));
-                }
-            }
-        }
-        private int _DurationInt;
-
-
-        /// <summary>
-        /// 
-        /// </summary>
-        public bool IsClosed
-        {
-            get { return _IsClosed; }
-            set
-            {
-                if (value != _IsClosed)
-                {
-                    _IsClosed = value;
-                    OnPropertyChanged(nameof(IsClosed));
-                }
-            }
-        }
-        private bool _IsClosed;
-
-
-        /// <summary>
-        /// 
-        /// </summary>
-        public string CreateUser
-        {
-            get { return _CreateUser; }
-            set
-            {
-                if (value != _CreateUser)
-                {
-                    _CreateUser = value;
-                    OnPropertyChanged(nameof(CreateUser));
-                }
-            }
-        }
-        private string _CreateUser;
-
-
-        /// <summary>
-        /// 
-        /// </summary>
-        public DateTime CreateTime
-        {
-            get { return _CreateTime; }
-            set
-            {
-                if (value != _CreateTime)
-                {
-                    _CreateTime = value;
-                    OnPropertyChanged(nameof(CreateTime));
-                }
-            }
-        }
-        private DateTime _CreateTime;
-
-
-        /// <summary>
-        /// 
-        /// </summary>
-        public DateTime ModifyTime
-        {
-            get { return _ModifyTime; }
-            set
-            {
-                if (value != _ModifyTime)
-                {
-                    _ModifyTime = value;
-                    OnPropertyChanged(nameof(ModifyTime));
-                }
-            }
-        }
-        private DateTime _ModifyTime;
-
-
-        /// <summary>
-        /// 
-        /// </summary>
-        public string ModifyUser
-        {
-            get { return _ModifyUser; }
-            set
-            {
-                if (value != _ModifyUser)
-                {
-                    _ModifyUser = value;
-                    OnPropertyChanged(nameof(ModifyUser));
-                }
-            }
-        }
-        private string _ModifyUser;
-
-    }
-}

+ 0 - 14
SCADA_DAQ/Customer/Models/AlarmTable/AlarmTableModel.cs

@@ -1,14 +0,0 @@
-using SCADA.CommonLib;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace SCADA_DAQ.Customer.Models.AlarmTable
-{
-    public class AlarmTableModel : ObservableObject
-    {
-
-    }
-}

+ 0 - 21
SCADA_DAQ/Customer/Models/AlarmTable/QueryAlarmTableModel.cs

@@ -1,21 +0,0 @@
-using SCADA.CommonLib.CommonModel;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace SCADA_DAQ.Customer.Models.AlarmTable
-{
-    public class QueryAlarmTableModel:BaseQuery
-    {
-        private static SqlSchema.DIL.DILDB DAL = Env.SgIDAL;
-
-
-        public QueryAlarmTableModel() : base(DAL.APP_TaiLing_DeviceManagement)
-        {
-
-        }
-
-    }
-}

+ 3 - 1
SCADA_DAQ/Customer/Models/DeviceMap/DeviceMapModel.cs

@@ -7,7 +7,9 @@ using System.Threading.Tasks;
 
 namespace SCADA_DAQ.Customer.Models.DeviceMap
 {
-    // 设备映射类
+    /// <summary>
+    /// 设备映射类
+    /// </summary>
     public class DeviceMapModel : ObservableObject
     {
 

+ 12 - 8
SCADA_DAQ/Customer/Models/MotorcycleTypeManagement/MotorcycleTypeModel.cs

@@ -38,11 +38,12 @@ namespace SCADA_DAQ.Customer.Models.MotorcycleTypeManagement
 
 
         private string _MotorcycleTypeName;
-        [AutoViewProperty("车型名称", Icon = "")]
-        [Column(T_Col_Name.APP_TaiLing_MotorcycleTypeManagement.MotorcycleTypeName_Str)]
+
         /// <summary>
         /// 车型名称
         /// </summary>
+        [AutoViewProperty("车型名称", Icon = "")]
+        [Column(T_Col_Name.APP_TaiLing_MotorcycleTypeManagement.MotorcycleTypeName_Str)]
         public string MotorcycleTypeName
         {
             get { return _MotorcycleTypeName; }
@@ -58,11 +59,12 @@ namespace SCADA_DAQ.Customer.Models.MotorcycleTypeManagement
 
 
         private string _MotorcycleTypeNumber;
-        [AutoViewProperty("车型编号", Icon = "")]
-        [Column(T_Col_Name.APP_TaiLing_MotorcycleTypeManagement.MotorcycleTypeNumber_Str)]
+
         /// <summary>
         /// 车型编号
         /// </summary>
+        [AutoViewProperty("车型编号", Icon = "")]
+        [Column(T_Col_Name.APP_TaiLing_MotorcycleTypeManagement.MotorcycleTypeNumber_Str)]
         public string MotorcycleTypeNumber
         {
             get { return _MotorcycleTypeNumber; }
@@ -78,11 +80,12 @@ namespace SCADA_DAQ.Customer.Models.MotorcycleTypeManagement
 
 
         private string _MotorcycleTypeSeries;
-        [AutoViewProperty("车型系列", Icon = "")]
-        [Column(T_Col_Name.APP_TaiLing_MotorcycleTypeManagement.MotorcycleTypeSeries_Str)]
+
         /// <summary>
         /// 车型系列
         /// </summary>
+        [AutoViewProperty("车型系列", Icon = "")]
+        [Column(T_Col_Name.APP_TaiLing_MotorcycleTypeManagement.MotorcycleTypeSeries_Str)]
         public string MotorcycleTypeSeries
         {
             get { return _MotorcycleTypeSeries; }
@@ -99,11 +102,12 @@ namespace SCADA_DAQ.Customer.Models.MotorcycleTypeManagement
 
 
         private double _ProductionLineSpeed;
-        [AutoViewProperty("生产线速", Icon = "")]
-        [Column(T_Col_Name.APP_TaiLing_MotorcycleTypeManagement.ProductionLineSpeed_Int)]
+
         /// <summary>
         /// 生产线速
         /// </summary>
+        [AutoViewProperty("生产线速", Icon = "")]
+        [Column(T_Col_Name.APP_TaiLing_MotorcycleTypeManagement.ProductionLineSpeed_Int)]
         public double ProductionLineSpeed
         {
             get { return _ProductionLineSpeed; }

+ 15 - 7
SCADA_DAQ/Customer/Models/ProductionLineManagement/AddProductionLineManagementModel.cs

@@ -8,14 +8,18 @@ using System.Threading.Tasks;
 
 namespace SCADA_DAQ.Customer.Models.ProductionLineManagement
 {
+    /// <summary>
+    /// 添加产线模块
+    /// </summary>
     [Table(nameof(SqlSchema.DBModel.APP_TaiLing_ProductionLineManagement))]
     public class AddProductionLineManagementModel : ObservableObject
     {
-        //private int _ID;
+        
 
         ///// <summary>
         ///// ID
         ///// </summary>
+        //[Column(T_Col_Name.APP_TaiLing_ProductionLineManagement.ID)]
         //public int ID
         //{
         //    get { return _ID; }
@@ -28,11 +32,13 @@ namespace SCADA_DAQ.Customer.Models.ProductionLineManagement
         //        }
         //    }
         //}
+        //private int _ID;
+
 
         /// <summary>
         /// 车间号
         /// </summary>
-        [AutoViewProperty("车间号", Icon = "",IsEnable = false)]
+        [AutoViewProperty("车间号", Icon = "",IsEnable = true)]
         [Column(T_Col_Name.APP_TaiLing_ProductionLineManagement.WorkShopId_Str)]
         public string WorkShopId
         {
@@ -46,12 +52,13 @@ namespace SCADA_DAQ.Customer.Models.ProductionLineManagement
                 }
             }
         }
-        private string _WorkShopId = CustomerEnv.ProductionLineConfigValue?.WorkShopId;
+        //private string _WorkShopId = CustomerEnv.ProductionLineConfigValue?.WorkShopId;
+        private string _WorkShopId;
 
         /// <summary>
         /// 产线号
         /// </summary>
-        [AutoViewProperty("产线号", Icon = "", IsEnable = false)]
+        [AutoViewProperty("产线号", Icon = "", IsEnable = true)]
         [Column(T_Col_Name.APP_TaiLing_ProductionLineManagement.ProductionLineId_Str)]
         public string ProductionLineId
         {
@@ -65,15 +72,16 @@ namespace SCADA_DAQ.Customer.Models.ProductionLineManagement
                 }
             }
         }
-        private string _ProductionLineId = CustomerEnv.ProductionLineConfigValue?.ProductionLineId;
+        //private string _ProductionLineId = CustomerEnv.ProductionLineConfigValue?.ProductionLineId;
+        private string _ProductionLineId;
 
 
         private string _ProductionLineName;
-        [AutoViewProperty("产线名称", Icon = "")]
-        [Column(T_Col_Name.APP_TaiLing_ProductionLineManagement.ProductionLineName_Str)]
         /// <summary>
         /// 产线名称
         /// </summary>
+        [AutoViewProperty("产线名称", Icon = "")]
+        [Column(T_Col_Name.APP_TaiLing_ProductionLineManagement.ProductionLineName_Str)]
         public string ProductionLineName
         {
             get { return _ProductionLineName; }

+ 3 - 0
SCADA_DAQ/Customer/Models/ProductionLineManagement/ProductionLineManagementModel.cs

@@ -9,6 +9,9 @@ using System.Threading.Tasks;
 
 namespace SCADA_DAQ.Customer.Models.ProductionLineManagement
 {
+    /// <summary>
+    /// 产线管理模块
+    /// </summary>
     public class ProductionLineManagementModel : ObservableObject
     {
         private int _ID;

+ 153 - 0
SCADA_DAQ/Customer/Models/ProductionLineManagement/ProductionLineStateModel.cs

@@ -0,0 +1,153 @@
+using SCADA.CommonLib;
+using SqlSchema.DBNames;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SCADA_DAQ.Customer.Models.ProductionLineManagement
+{
+    /// <summary>
+    /// 产线状态模块
+    /// </summary>
+    public class ProductionLineStateModel : ObservableObject
+    {
+
+
+        /// <summary>
+        /// ID
+        /// </summary>
+        [Column(T_Col_Name.APP_TaiLing_ProductionLineStateRecord.ID)]
+        public int ID
+        {
+            get { return _ID; }
+            set
+            {
+                if (value != _ID)
+                {
+                    _ID = value;
+                    OnPropertyChanged(nameof(ID));
+                }
+            }
+        }
+        private int _ID;
+
+
+        /// <summary>
+        /// 产线号
+        /// </summary>
+        [Column(T_Col_Name.APP_TaiLing_ProductionLineStateRecord.ProductionLineId_Str)]
+        public string ProductionLineId
+        {
+            get { return _ProductionLineId; }
+            set
+            {
+                if (value != _ProductionLineId)
+                {
+                    _ProductionLineId = value;
+                    OnPropertyChanged(nameof(ProductionLineId));
+                }
+            }
+        }
+        private string _ProductionLineId;
+
+
+
+        /// <summary>
+        /// 产线状态
+        /// </summary>
+        [Column(T_Col_Name.APP_TaiLing_ProductionLineStateRecord.ProductionLineState_Str)]
+        public string ProductionLineState
+        {
+            get { return _ProductionLineState; }
+            set
+            {
+                if (value != _ProductionLineState)
+                {
+                    _ProductionLineState = value;
+                    OnPropertyChanged(nameof(ProductionLineState));
+                }
+            }
+        }
+        private string _ProductionLineState;
+
+
+        /// <summary>
+        /// 开始时间
+        /// </summary>
+        [Column(T_Col_Name.APP_TaiLing_ProductionLineStateRecord.StartTime_Dt)]
+        public DateTime StartTime
+        {
+            get { return _StartTime; }
+            set
+            {
+                if (value != _StartTime)
+                {
+                    _StartTime = value;
+                    OnPropertyChanged(nameof(StartTime));
+                }
+            }
+        }
+        private DateTime _StartTime;
+
+
+        /// <summary>
+        /// 结束时间
+        /// </summary>
+        [Column(T_Col_Name.APP_TaiLing_ProductionLineStateRecord.EndTime_Dt)]
+        public DateTime EndTime
+        {
+            get { return _EndTime; }
+            set
+            {
+                if (value != _EndTime)
+                {
+                    _EndTime = value;
+                    OnPropertyChanged(nameof(EndTime));
+                }
+            }
+        }
+        private DateTime _EndTime;
+
+
+        /// <summary>
+        /// 时长
+        /// </summary>
+        [Column(T_Col_Name.APP_TaiLing_ProductionLineStateRecord.DurationSec_Int)]
+        public string DurationSec
+        {
+            get { return _DurationSec; }
+            set
+            {
+                if (value != _DurationSec)
+                {
+                    _DurationSec = value;
+                    OnPropertyChanged(nameof(DurationSec));
+                }
+            }
+        }
+        private string _DurationSec;
+
+
+        /// <summary>
+        /// 车间号
+        /// </summary>
+        [Column(T_Col_Name.APP_TaiLing_ProductionLineStateRecord.WorkShopId_Str)]
+        public string WorkShopId
+        {
+            get { return _WorkShopId; }
+            set
+            {
+                if (value != _WorkShopId)
+                {
+                    _WorkShopId = value;
+                    OnPropertyChanged(nameof(WorkShopId));
+                }
+            }
+        }
+        private string _WorkShopId;
+
+
+    }
+}

+ 8 - 4
SCADA_DAQ/Customer/Models/ProductionLineManagement/ProductionManagementStation.cs

@@ -8,13 +8,17 @@ using System.Threading.Tasks;
 
 namespace SCADA_DAQ.Customer.Models.ProductionLineManagement
 {
+    /// <summary>
+    /// 产线工位管理模块
+    /// </summary>
     public class ProductionManagementStation : ObservableObject
     {
         private string _WorkstationName;
-        [AutoViewProperty("工位名称", Icon = "")]
+
         /// <summary>
         /// 
         /// </summary>
+        [AutoViewProperty("工位名称", Icon = "")]
         public string WorkstationName
         {
             get { return _WorkstationName; }
@@ -30,10 +34,10 @@ namespace SCADA_DAQ.Customer.Models.ProductionLineManagement
 
 
         private string _StatusPoint;
-        [AutoViewProperty("状态点位", Icon = "")]
         /// <summary>
         /// 
         /// </summary>
+        [AutoViewProperty("状态点位", Icon = "")]
         public string StatusPoint
         {
             get { return _StatusPoint; }
@@ -49,10 +53,10 @@ namespace SCADA_DAQ.Customer.Models.ProductionLineManagement
 
 
         private string _Head;
-        [AutoViewProperty("负责人", Icon = "")]
         /// <summary>
         /// 
         /// </summary>
+        [AutoViewProperty("负责人", Icon = "")]
         public string Head
         {
             get { return _Head; }
@@ -68,10 +72,10 @@ namespace SCADA_DAQ.Customer.Models.ProductionLineManagement
 
 
         private int _Quantity;
-        [AutoViewProperty("添加数量", Icon = "")]
         /// <summary>
         /// 
         /// </summary>
+        [AutoViewProperty("添加数量", Icon = "")]
         public int Quantity
         {
             get { return _Quantity; }

+ 9 - 5
SCADA_DAQ/Customer/Models/ProductionLineManagement/QueryProductionLineManagementModel.cs

@@ -18,7 +18,9 @@ namespace SCADA_DAQ.Customer.Models.ProductionLineManagement
         // 数据库对象
         private static SqlSchema.DIL.DILDB DAL = Env.SgIDAL;
 
-
+        /// <summary>
+        /// 
+        /// </summary>
         public QueryProductionLineManagementModel() : base(DAL.APP_TaiLing_ProductionLineManagement)
         {
 
@@ -46,8 +48,7 @@ namespace SCADA_DAQ.Customer.Models.ProductionLineManagement
         /// <summary>
         /// 车间号
         /// </summary>
-        private string _WorkShopId = CustomerEnv.ProductionLineConfigValue.WorkShopId;
-        [AutoViewProperty("车间号", Icon = "AlignJustify", IsEnable = false)]
+        [AutoViewProperty("车间号", Icon = "AlignJustify", IsEnable = true)]
         [Query(T_Col_Name.APP_TaiLing_TaskManagement.WorkShopId_Str, QueryOperator.Like)]
         public string WorkShopId
         {
@@ -61,12 +62,13 @@ namespace SCADA_DAQ.Customer.Models.ProductionLineManagement
                 }
             }
         }
+        //private string _WorkShopId = CustomerEnv.ProductionLineConfigValue.WorkShopId;
+        private string _WorkShopId;
 
         /// <summary>
         /// 产线号
         /// </summary>
-        private string _ProductionLineId = CustomerEnv.ProductionLineConfigValue.ProductionLineId;
-        [AutoViewProperty("产线号", Icon = "AlignJustify", IsEnable = false)]
+        [AutoViewProperty("产线号", Icon = "AlignJustify", IsEnable = true)]
         [Query(T_Col_Name.APP_TaiLing_TaskManagement.ProductionLineId_Str, QueryOperator.Like)]
         public string ProductionLineId
         {
@@ -80,6 +82,8 @@ namespace SCADA_DAQ.Customer.Models.ProductionLineManagement
                 }
             }
         }
+        //private string _ProductionLineId = CustomerEnv.ProductionLineConfigValue.ProductionLineId;
+        private string _ProductionLineId ;
 
 
         //private int _ProductionID;

+ 39 - 27
SCADA_DAQ/Customer/Models/TaskManagement/QueryTaskModel.cs

@@ -18,6 +18,9 @@ namespace SCADA_DAQ.Customer.Models.TaskManagement
     {
         private static SqlSchema.DIL.DILDB DAL = Env.SgIDAL;
 
+        /// <summary>
+        /// 
+        /// </summary>
         public QueryTaskModel() : base(DAL.APP_TaiLing_TaskManagement)
         {
 
@@ -26,7 +29,6 @@ namespace SCADA_DAQ.Customer.Models.TaskManagement
         /// <summary>
         /// 车间号
         /// </summary>
-        private string _WorkShopId = CustomerEnv.ProductionLineConfigValue.WorkShopId;
         [AutoViewProperty("车间号", Icon = "AlignJustify", IsEnable =false)]
         [Query(T_Col_Name.APP_TaiLing_TaskManagement.WorkShopId_Str, QueryOperator.Like)]
         public string WorkShopId
@@ -41,11 +43,11 @@ namespace SCADA_DAQ.Customer.Models.TaskManagement
                 }
             }
         }
+        private string _WorkShopId = CustomerEnv.ProductionLineConfigValue.WorkShopId;
 
         /// <summary>
         /// 产线号
         /// </summary>
-        private string _ProductionLineId = CustomerEnv.ProductionLineConfigValue.ProductionLineId;
         [AutoViewProperty("产线号", Icon = "AlignJustify", IsEnable = false)]
         [Query(T_Col_Name.APP_TaiLing_TaskManagement.ProductionLineId_Str, QueryOperator.Like)]
         public string ProductionLineId
@@ -60,30 +62,12 @@ namespace SCADA_DAQ.Customer.Models.TaskManagement
                 }
             }
         }
+        private string _ProductionLineId = CustomerEnv.ProductionLineConfigValue.ProductionLineId;
 
-        /// <summary>
-        /// 批次号
-        /// </summary>
-        private string _OrderId;
-        [AutoViewProperty("批次号", Icon = "AlignJustify")]
-        [Query(T_Col_Name.APP_TaiLing_TaskManagement.OrderId_Str)]
-        public string OrderId
-        {
-            get { return _OrderId; }
-            set
-            {
-                if (value != _OrderId)
-                {
-                    _OrderId = value;
-                    OnPropertyChanged(nameof(OrderId));
-                }
-            }
-        }
 
         /// <summary>
         /// 工单日期
         /// </summary>
-        private DateRange _OrderDatetime = new DateRange(Env.Schedual) { TimeInterval = DateRangeInterval.CurrentDay };
         [AutoViewProperty("工单日期", Icon = "Timetable")]
         [Query(T_Col_Name.APP_TaiLing_TaskManagement.OrderDatetime_Dt)]
         public DateRange OrderDatetime
@@ -98,12 +82,12 @@ namespace SCADA_DAQ.Customer.Models.TaskManagement
                 }
             }
         }
+        private DateRange _OrderDatetime = new DateRange(Env.Schedual) { TimeInterval = DateRangeInterval.CurrentDay };
 
 
         /// <summary>
         /// 开始生产时间
         /// </summary>
-        private DateRange _WorkStartTime = new DateRange(Env.Schedual) { TimeInterval = DateRangeInterval.All };
         [AutoViewProperty("开始生产时间", Icon = "Timetable")]
         [Query(T_Col_Name.APP_TaiLing_TaskManagement.WorkStartTime_Dt)]
         public DateRange WorkStartTime
@@ -118,11 +102,11 @@ namespace SCADA_DAQ.Customer.Models.TaskManagement
                 }
             }
         }
+        private DateRange _WorkStartTime = new DateRange(Env.Schedual) { TimeInterval = DateRangeInterval.All };
 
         /// <summary>
         /// 结束生产时间
         /// </summary>
-        private DateRange _WorkEndTime = new DateRange(Env.Schedual) { TimeInterval = DateRangeInterval.All };
         [AutoViewProperty("结束生产时间", Icon = "Timetable")]
         [Query(T_Col_Name.APP_TaiLing_TaskManagement.WorkEndTime_Dt)]
         public DateRange WorkEndTime
@@ -137,12 +121,36 @@ namespace SCADA_DAQ.Customer.Models.TaskManagement
                 }
             }
         }
+        private DateRange _WorkEndTime = new DateRange(Env.Schedual) { TimeInterval = DateRangeInterval.All };
+
+
+        /// <summary>
+        /// 批次号
+        /// </summary>
+        [AutoViewProperty("批次号", Icon = "AlignJustify")]
+        [Query(T_Col_Name.APP_TaiLing_TaskManagement.OrderId_Str)]
+        public string OrderId
+        {
+            get { return _OrderId; }
+            set
+            {
+                if (value != _OrderId)
+                {
+                    _OrderId = value;
+                    OnPropertyChanged(nameof(OrderId));
+                }
+            }
+        }
+        private string _OrderId;
+
 
         /// <summary>
         /// 工单状态
         /// </summary>
-        private string _OrderState;
-        [AutoViewProperty("工单状态", Icon = "", OptionItemsSource = nameof(OrderStateList), StringType = StringType.IsNotNullOrEmpty)]
+        [AutoViewProperty("工单状态", Icon = "", OptionItemsSource = nameof(OrderStateDic), 
+            StringType = StringType.IsLimited,
+            DisplayMemberPath = "Key",
+            SelectedValuePath = "Value")]
         [Query(T_Col_Name.APP_TaiLing_TaskManagement.OrderState_Str)]
         public string OrderState
         {
@@ -156,9 +164,13 @@ namespace SCADA_DAQ.Customer.Models.TaskManagement
                 }
             }
         }
-        public List<string> OrderStateList { get; set; } = new List<string>()
+        private string _OrderState;
+        /// <summary>
+        /// 
+        /// </summary>
+        public Dictionary<string, string> OrderStateDic { get; set; } = new Dictionary<string, string>()
         {
-           "待生产", "生产中", "已生产"
+            {"全部","" }, {"待生产","待生产" },{"生产中","生产中" },{"已生产","已生产" }
         };
 
 

+ 16 - 14
SCADA_DAQ/Customer/Models/TaskManagement/TaskManagementModel.cs

@@ -8,7 +8,9 @@ using System.Threading.Tasks;
 
 namespace SCADA_DAQ.Customer.Models.TaskManagement
 {
-
+    /// <summary>
+    /// 工单管理模块
+    /// </summary>
     public class TaskManagementModel : ObservableObject
     {
 
@@ -35,7 +37,6 @@ namespace SCADA_DAQ.Customer.Models.TaskManagement
         /// <summary>
         /// 车间号
         /// </summary>
-        private string _WorkShopId;
         [AutoViewProperty("车间号", Icon = "")]
         [Column(T_Col_Name.APP_TaiLing_TaskManagement.WorkShopId_Str)]
         public string WorkShopId
@@ -50,11 +51,11 @@ namespace SCADA_DAQ.Customer.Models.TaskManagement
                 }
             }
         }
+        private string _WorkShopId;
 
         /// <summary>
         /// 产线号
         /// </summary>
-        private string _ProductionLineId;
         [AutoViewProperty("产线号", Icon = "")]
         [Column(T_Col_Name.APP_TaiLing_TaskManagement.ProductionLineId_Str)]
         public string ProductionLineId
@@ -69,11 +70,11 @@ namespace SCADA_DAQ.Customer.Models.TaskManagement
                 }
             }
         }
+        private string _ProductionLineId;
 
         /// <summary>
         /// 批次号
         /// </summary>
-        private string _OrderId;
         [AutoViewProperty("批次号", Icon = "")]
         [Column(T_Col_Name.APP_TaiLing_TaskManagement.OrderId_Str)]
         public string OrderId
@@ -88,11 +89,11 @@ namespace SCADA_DAQ.Customer.Models.TaskManagement
                 }
             }
         }
+        private string _OrderId;
 
         /// <summary>
         /// 工单日期
         /// </summary>
-        private DateTime _OrderDatetime;
         [AutoViewProperty("工单日期", Icon = "")]
         [Column(T_Col_Name.APP_TaiLing_TaskManagement.OrderDatetime_Dt)]
         public DateTime OrderDatetime
@@ -107,11 +108,11 @@ namespace SCADA_DAQ.Customer.Models.TaskManagement
                 }
             }
         }
+        private DateTime _OrderDatetime;
 
         /// <summary>
         /// 工单顺序
         /// </summary>
-        private int _OrderSequence;
         [AutoViewProperty("工单顺序", Icon = "")]
         [Column(T_Col_Name.APP_TaiLing_TaskManagement.OrderSequence_Int)]
         public int OrderSequence
@@ -126,11 +127,11 @@ namespace SCADA_DAQ.Customer.Models.TaskManagement
                 }
             }
         }
+        private int _OrderSequence;
 
         /// <summary>
         /// 计划产量
         /// </summary>
-        private int _ScheduledProduction;
         [AutoViewProperty("计划产量", Icon = "")]
         [Column(T_Col_Name.APP_TaiLing_TaskManagement.ScheduledProduction_Int)]
         public int ScheduledProduction
@@ -145,11 +146,11 @@ namespace SCADA_DAQ.Customer.Models.TaskManagement
                 }
             }
         }
+        private int _ScheduledProduction;
 
         /// <summary>
         /// 当前产量
         /// </summary>
-        private int _CurrentProduction;
         [AutoViewProperty("当前产量", Icon = "")]
         [Column(T_Col_Name.APP_TaiLing_TaskManagement.CurrentProduction_Int)]
         public int CurrentProduction
@@ -164,11 +165,11 @@ namespace SCADA_DAQ.Customer.Models.TaskManagement
                 }
             }
         }
+        private int _CurrentProduction;
 
         /// <summary>
         /// 开始生产时间
         /// </summary>
-        private DateTime _WorkStartTime;
         [AutoViewProperty("开始生产时间", Icon = "")]
         [Column(T_Col_Name.APP_TaiLing_TaskManagement.WorkStartTime_Dt)]
         public DateTime WorkStartTime
@@ -183,11 +184,11 @@ namespace SCADA_DAQ.Customer.Models.TaskManagement
                 }
             }
         }
+        private DateTime _WorkStartTime;
 
         /// <summary>
         /// 结束生产时间
         /// </summary>
-        private DateTime _WorkEndTime;
         [AutoViewProperty("结束生产时间", Icon = "")]
         [Column(T_Col_Name.APP_TaiLing_TaskManagement.WorkEndTime_Dt)]
         public DateTime WorkEndTime
@@ -202,11 +203,11 @@ namespace SCADA_DAQ.Customer.Models.TaskManagement
                 }
             }
         }
+        private DateTime _WorkEndTime;
 
         /// <summary>
         /// 工单状态
         /// </summary>
-        private string _OrderState;
         [AutoViewProperty("工单状态", Icon = "")]
         [Column(T_Col_Name.APP_TaiLing_TaskManagement.OrderState_Str)]
         public string OrderState
@@ -221,11 +222,11 @@ namespace SCADA_DAQ.Customer.Models.TaskManagement
                 }
             }
         }
+        private string _OrderState;
 
         /// <summary>
         /// 车型名称
         /// </summary>
-        private string _MotorcycleTypeName;
         [AutoViewProperty("车型名称", Icon = "")]
         [Column(T_Col_Name.APP_TaiLing_TaskManagement.MotorcycleTypeName_Str)]
         public string MotorcycleTypeName
@@ -240,11 +241,11 @@ namespace SCADA_DAQ.Customer.Models.TaskManagement
                 }
             }
         }
+        private string _MotorcycleTypeName;
 
         /// <summary>
         /// 生产总时长
         /// </summary>
-        private int _DurationSec;
         [AutoViewProperty("生产总时长", Icon = "")]
         [Column(T_Col_Name.APP_TaiLing_TaskManagement.DurationSec_Int)]
         public int DurationSec
@@ -259,8 +260,9 @@ namespace SCADA_DAQ.Customer.Models.TaskManagement
                 }
             }
         }
+        private int _DurationSec;
+
 
-        
 
 
     }

+ 247 - 110
SCADA_DAQ/Customer/Service/CustomerService.cs

@@ -1,18 +1,26 @@
 using ControlzEx.Standard;
+using ControlzEx.Theming;
 using LiveCharts.Helpers;
+using LiveCharts.Wpf;
+using Microsoft.DwayneNeed.Shapes;
 using Microsoft.DwayneNeed.Win32.Gdi32;
+using Microsoft.DwayneNeed.Win32.User32;
 using MySqlX.XDevAPI.Common;
 using NPOI.HSSF.Record;
 using NPOI.SS.Formula.Functions;
 using SCADA;
 using SCADA.Comm;
+using SCADA.CommonCtrl.WpfWindow;
 using SCADA.CommonLib;
+using SCADA.CommonLib.Data.DIL;
 using SCADA.CommonLib.Helper;
 using SCADA.CommonLib.Service;
 using SCADA_DAQ.Customer.Models.DeviceMap;
 using SCADA_DAQ.Customer.Models.NoticeManagement;
+using SCADA_DAQ.Customer.Models.ProductionLineManagement;
 using SCADA_DAQ.Customer.Models.TaskManagement;
 using System;
+using System.Collections;
 using System.Collections.Generic;
 using System.ComponentModel;
 using System.Data;
@@ -38,14 +46,14 @@ namespace SCADA_DAQ.Customer.Service
 
         // 静态缓存时长/s
         private static int staticCacheDuration = 2;
-
-        // 静态缓存持续时间/s
-        private static int taskInfoStaticCacheDuration = 0;
-        private static int outputAndOrderStaticCacheDuration = 0;
-
-        // 静态缓存结果
-        private object taskInfoStaticCache = null;
-        private object OutputAndOrderStaticCache = null;
+        // 静态缓存
+        private Dictionary<string, Dictionary<string, object>> StaticCache = 
+            new Dictionary<string, Dictionary<string, object>>()
+        {
+            { "GetTaskInfo", new Dictionary<string, object>(){ {"Time",DateTime.Now}, { "Cache", null} } },
+            { "GetOutputAndOrder", new Dictionary<string, object>(){ { "Time", DateTime.Now }, { "Cache", null} } },
+            { "GetNoticeInfo", new Dictionary<string, object>(){ { "Time", DateTime.Now }, { "Cache", null} } }
+        };
 
 
         private static CustomerService _instance;
@@ -89,26 +97,25 @@ namespace SCADA_DAQ.Customer.Service
         public override bool Start()
         {
             RpcService.GetInstance().Regiseter(this);   //将服务中方法注册到RPC服务器,可以给WebApi调用
-            Env.Schedual.DateTimeChanged += Schedual_DateTimeChanged;
+            //Env.Schedual.DateTimeChanged += Schedual_DateTimeChanged;
+            
+            // 创建定时任务
+            //CreateTask(GetData, );
             return base.Start();
         }
 
-        /// <summary>
-        /// 定时器
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
-        private void Schedual_DateTimeChanged(object sender, DateTimeChangedArgs e)
-        {
-            if (e.TimeFlag.Second % 1 == 0)
-            {
-                if (taskInfoStaticCacheDuration > 0)
-                    taskInfoStaticCacheDuration--;
+        ///// <summary>
+        ///// 定时器
+        ///// </summary>
+        ///// <param name="sender"></param>
+        ///// <param name="e"></param>
+        //private void Schedual_DateTimeChanged(object sender, DateTimeChangedArgs e)
+        //{
+        //    if (e.TimeFlag.Second % 1 == 0)
+        //    {
 
-                if (outputAndOrderStaticCacheDuration > 0)
-                    outputAndOrderStaticCacheDuration--;
-            }
-        }
+        //    }
+        //}
 
 
 
@@ -152,19 +159,17 @@ namespace SCADA_DAQ.Customer.Service
         /// <returns>响应对象</returns>
         public RpcResponse<object> GetTaskInfo(List<string> workShopId, List<string> productionLineId)
         {
-            
             // 判断参数合理性
             if (workShopId == null || productionLineId == null)
                 return new RpcResponse<object>() { Data = null, Message = "paras is empty." };
 
-
             // 禁用动态缓存
             var disableDynamicCache = true;
 
             // 返回静态缓存
-            if (taskInfoStaticCacheDuration > 0)
-                return new RpcResponse<object>() { Data = taskInfoStaticCache, Message = null };
-
+            var timespan = (DateTime.Now - (DateTime)StaticCache["GetTaskInfo"]["Time"]).TotalSeconds;
+            if (timespan < staticCacheDuration)
+                return new RpcResponse<object>() { Data = StaticCache["GetTaskInfo"]["Cache"], Message = null };
 
             List<TaskManagementModel> tableInfo = new List<TaskManagementModel>();
             if (CustomerEnv.TaskInfoCache.Count <= 0 || disableDynamicCache)
@@ -204,7 +209,7 @@ namespace SCADA_DAQ.Customer.Service
             {
                 tableInfo = CustomerEnv.TaskInfoCache;
             }
- 
+
 
             // select多个字段,使用匿名类型
             var result = tableInfo.Select((item) => new
@@ -224,12 +229,138 @@ namespace SCADA_DAQ.Customer.Service
                 CompletionRate = Math.Round((double)item.CurrentProduction / (double)item.ScheduledProduction, 2)
             }).ToList();
 
-            // 启用静态缓存
-            taskInfoStaticCacheDuration = staticCacheDuration;
-            taskInfoStaticCache = result;
+            // 设置静态缓存
+            StaticCache["GetTaskInfo"] = new Dictionary<string, object>()
+                { { "Time", DateTime.Now}, { "Cache", result} };
             return new RpcResponse<object>() { Data = result, Message = null };
         }
 
+        ///// <summary>
+        ///// 获取产量和工单数
+        ///// </summary>
+        ///// <param name="workShopId">车间号</param>
+        ///// <param name="productionLineId">产线号</param>
+        ///// <param name="year">年份</param>
+        ///// <param name="month">月份</param>
+        ///// <returns></returns>
+        //public RpcResponse<object> GetOutputAndOrder(List<string> workShopId, List<string> productionLineId, int year, int month)
+        //{
+        //    // 判断参数合理性
+        //    if (workShopId == null || productionLineId == null)
+        //        return new RpcResponse<object>() { Data = null, Message = "paras is empty." };
+
+        //    // 返回静态缓存
+        //    if (outputAndOrderStaticCacheDuration > 0)
+        //        return new RpcResponse<object>() { Data = OutputAndOrderStaticCache, Message = null };
+
+        //    bool isAllShop = false;  // 是否查询所有车间
+        //    bool isAllLine = false;  // 是否查询所有产线
+        //    bool isAllYear = false;  // 是否查询所有年份
+        //    bool isAllMonth = false;  // 是否查询所有月份
+
+        //    if (workShopId.Count <= 0)
+        //        isAllShop = true;
+        //    if (productionLineId.Count <= 0)
+        //        isAllLine = true;
+        //    if (year <= 0)
+        //        isAllYear = true;
+        //    if (month <= 0)
+        //        isAllMonth = true;
+
+        //    // 查询数据库
+        //    List<TaskManagementModel> tableInfo = DAL.APP_TaiLing_TaskManagement.GetData<TaskManagementModel>();
+        //    //  tableInfo = DAL.APP_TaiLing_TaskManagement.GetData<TaskManagementModel>(t => t.OrderId == "1");
+        //    if (tableInfo == null)
+        //    {
+        //        return new RpcResponse<object>() { Data = null, Message = null };
+        //    }
+
+        //    List<int> yearList = new List<int>(); // 年份列表
+        //    List<object> resList = new List<object>(); // 结果列表
+
+
+        //    if (!isAllShop)
+        //    {
+        //        var workShopIdDic = workShopId.ToLookup(t => t); 
+        //        // workShopId 不为空就查询指定车
+        //        tableInfo = tableInfo.Where(t => workShopIdDic.Contains(t.WorkShopId)).ToList();
+        //    }
+
+        //    if (!isAllLine)
+        //    {
+        //        // productionLineId 不为空就查询指定产线号
+        //        tableInfo = tableInfo.Where(t => productionLineId.IndexOf(t.ProductionLineId) >= 0).ToList();
+        //    }
+
+        //    if (!isAllYear)
+        //    {
+        //        // year>0 就查询指定年份
+        //        tableInfo = tableInfo.Where(t => t.OrderDatetime.Year == year).ToList();
+        //        yearList.Add(year);
+        //    }
+        //    else
+        //    {
+        //        // year<=0 就把记录时间等于year的放到yearList
+        //        yearList = tableInfo.ToLookup(t => t.OrderDatetime.Year).Select(t => t.Key).ToList();
+        //    }
+
+        //    if (!isAllMonth)
+        //    {
+        //        // month>0 就查询指定月份
+        //        var monthgroup = tableInfo.Where(t => t.OrderDatetime.Month == month).
+        //            ToLookup(t => t.OrderDatetime.Year).Select(t => new
+        //            {
+        //                Year = t.Key,
+        //                Month = month,
+        //                Output = t.Sum(p => p.CurrentProduction),
+        //                OrderQuantity = t.Count(),
+        //                TotalDurationSec = t.Sum(p => p.DurationSec)
+        //            });
+        //        // 启用静态缓存
+        //        outputAndOrderStaticCacheDuration = staticCacheDuration;
+        //        OutputAndOrderStaticCache = monthgroup;
+        //        return new RpcResponse<object>() { Data = monthgroup, Message = null };
+        //    }
+
+        //    tableInfo.ToLookup(t => t.OrderDatetime.Year).ForEach(yearData =>
+        //    {
+        //        Dictionary<int, int> yearOutput = new Dictionary<int, int>{
+        //            { 1, 0 },{ 2, 0 },{ 3, 0 },{ 4, 0 },{ 5, 0 },{ 6, 0 },
+        //            { 7, 0 },{ 8, 0 },{ 9, 0 },{ 10, 0 },{ 11, 0 },{ 12, 0 }
+        //        };
+        //        Dictionary<int, int> yearOrderQuantity = new Dictionary<int, int>{
+        //            { 1, 0 },{ 2, 0 },{ 3, 0 },{ 4, 0 },{ 5, 0 },{ 6, 0 },
+        //            { 7, 0 },{ 8, 0 },{ 9, 0 },{ 10, 0 },{ 11, 0 },{ 12, 0 }
+        //        };
+        //        Dictionary<int, int> yearDurationSec = new Dictionary<int, int>{
+        //            { 1, 0 },{ 2, 0 },{ 3, 0 },{ 4, 0 },{ 5, 0 },{ 6, 0 },
+        //            { 7, 0 },{ 8, 0 },{ 9, 0 },{ 10, 0 },{ 11, 0 },{ 12, 0 }
+        //        };
+        //        foreach (var item in yearData.ToLookup(t => t.OrderDatetime.Month))
+        //        {
+        //            yearOutput[item.Key] = item.Sum(t => t.CurrentProduction);
+        //            yearOrderQuantity[item.Key] = item.Count();
+        //            yearDurationSec[item.Key] = item.Sum(t => t.DurationSec);
+        //        }
+        //        resList.Add(new
+        //        {
+        //            Year = yearData.Key,
+        //            Month = 0,
+        //            Output = yearOutput,
+        //            OrderQuantity = yearOrderQuantity,
+        //            TotalDurationSec = yearDurationSec
+        //        });
+
+        //    });
+
+        //    // 启用静态缓存
+        //    outputAndOrderStaticCacheDuration = staticCacheDuration;
+        //    OutputAndOrderStaticCache = resList;
+        //    return new RpcResponse<object>() { Data = resList, Message = null };
+
+        //}
+
+
         /// <summary>
         /// 获取产量和工单数
         /// </summary>
@@ -243,12 +374,12 @@ namespace SCADA_DAQ.Customer.Service
             // 判断参数合理性
             if (workShopId == null || productionLineId == null)
                 return new RpcResponse<object>() { Data = null, Message = "paras is empty." };
-            //if (workShopId.GetType() != typeof(List<string>) || productionLineId.GetType() != typeof(List<string>))
-            //    return new RpcResponse<object>() { Data = null, Message = "paras type is not array." };
 
-            // 返回静态缓存
-            if (outputAndOrderStaticCacheDuration > 0)
-                return new RpcResponse<object>() { Data = OutputAndOrderStaticCache, Message = null };
+            //// 返回静态缓存
+            var timespan = (DateTime.Now - (DateTime)StaticCache["GetOutputAndOrder"]["Time"]).TotalSeconds;
+            if (timespan < staticCacheDuration)
+                return new RpcResponse<object>() { Data = StaticCache["GetOutputAndOrder"]["Cache"], Message = null };
+
 
             bool isAllShop = false;  // 是否查询所有车间
             bool isAllLine = false;  // 是否查询所有产线
@@ -278,15 +409,17 @@ namespace SCADA_DAQ.Customer.Service
 
             if (!isAllShop)
             {
-                var workShopIdDic = workShopId.ToLookup(t => t); 
+                var workShopIdDic = workShopId.ToLookup(t => t);
                 // workShopId 不为空就查询指定车
                 tableInfo = tableInfo.Where(t => workShopIdDic.Contains(t.WorkShopId)).ToList();
             }
+
             if (!isAllLine)
             {
                 // productionLineId 不为空就查询指定产线号
                 tableInfo = tableInfo.Where(t => productionLineId.IndexOf(t.ProductionLineId) >= 0).ToList();
             }
+
             if (!isAllYear)
             {
                 // year>0 就查询指定年份
@@ -297,32 +430,11 @@ namespace SCADA_DAQ.Customer.Service
             {
                 // year<=0 就把记录时间等于year的放到yearList
                 yearList = tableInfo.ToLookup(t => t.OrderDatetime.Year).Select(t => t.Key).ToList();
-                //tableInfo.ForEach(num =>
-                //{
-                //    if (yearList.IndexOf(num.OrderDatetime.Year) < 0)
-                //        yearList.Add(num.OrderDatetime.Year);
-                //});
             }
+
             if (!isAllMonth)
             {
                 // month>0 就查询指定月份
-                //tableInfo = tableInfo.Where(t => t.OrderDatetime.Month == month).ToList();
-                //yearList.ForEach(y =>
-                //{
-                //    //var ytable = tableInfo.Where(t => t.OrderDatetime.Year == y).ToList();
-                //    //int monthOutput = ytable.Sum(n => n.CurrentProduction); // 月度产量
-                //    //int monthDurationSec = ytable.Sum(n => n.DurationSec);  // 月度订单数
-                //    //int monthOrderQuantity = ytable.Count();   // 月度生产总时长
-
-                //    //resList.Add(new
-                //    //{
-                //    //    Year = y,
-                //    //    Month = month,
-                //    //    Output = monthOutput,
-                //    //    OrderQuantity = monthOrderQuantity,
-                //    //    TotalDurationSec = monthDurationSec
-                //    //});
-                //});
                 var monthgroup = tableInfo.Where(t => t.OrderDatetime.Month == month).
                     ToLookup(t => t.OrderDatetime.Year).Select(t => new
                     {
@@ -332,9 +444,9 @@ namespace SCADA_DAQ.Customer.Service
                         OrderQuantity = t.Count(),
                         TotalDurationSec = t.Sum(p => p.DurationSec)
                     });
-                // 启用静态缓存
-                outputAndOrderStaticCacheDuration = staticCacheDuration;
-                OutputAndOrderStaticCache = monthgroup;
+                // 设置静态缓存
+                StaticCache["GetOutputAndOrder"] = new Dictionary<string, object>()
+                    { { "TIme", DateTime.Now}, { "Cache", monthgroup} };
                 return new RpcResponse<object>() { Data = monthgroup, Message = null };
             }
 
@@ -369,52 +481,11 @@ namespace SCADA_DAQ.Customer.Service
 
             });
 
-            // 启用静态缓存
-            outputAndOrderStaticCacheDuration = staticCacheDuration;
-            OutputAndOrderStaticCache = resList;
+            // 设置静态缓存
+            StaticCache["GetOutputAndOrder"] = new Dictionary<string, object>() 
+                { { "Time", DateTime.Now}, { "Cache", resList} };
             return new RpcResponse<object>() { Data = resList, Message = null };
 
-            // month<=0
-            //yearList.ForEach(y =>
-            //{
-            //    Dictionary<int, int> yearOutput = new Dictionary<int, int>{
-            //        { 1, 0 },{ 2, 0 },{ 3, 0 },{ 4, 0 },{ 5, 0 },{ 6, 0 },
-            //        { 7, 0 },{ 8, 0 },{ 9, 0 },{ 10, 0 },{ 11, 0 },{ 12, 0 }
-            //    };
-            //    Dictionary<int, int> yearOrderQuantity = new Dictionary<int, int>{
-            //        { 1, 0 },{ 2, 0 },{ 3, 0 },{ 4, 0 },{ 5, 0 },{ 6, 0 },
-            //        { 7, 0 },{ 8, 0 },{ 9, 0 },{ 10, 0 },{ 11, 0 },{ 12, 0 }
-            //    };
-            //    Dictionary<int, int> yearDurationSec = new Dictionary<int, int>{
-            //        { 1, 0 },{ 2, 0 },{ 3, 0 },{ 4, 0 },{ 5, 0 },{ 6, 0 },
-            //        { 7, 0 },{ 8, 0 },{ 9, 0 },{ 10, 0 },{ 11, 0 },{ 12, 0 }
-            //    };
-            //    for (int i = 1; i <= yearOutput.Keys.Count; i++)   // 字典遍历不能用foreach
-            //    {
-            //        yearOutput[i] = tableInfo.Where(t => t.OrderDatetime.Month == i && t.OrderDatetime.Year == y)
-            //            .Sum(t => t.CurrentProduction);
-            //    }
-            //    for (int i = 1; i <= yearOrderQuantity.Keys.Count; i++)
-            //    {
-            //        yearOrderQuantity[i] = tableInfo.Where(t => t.OrderDatetime.Month == i && t.OrderDatetime.Year == y)
-            //            .Count();
-            //    }
-            //    for (int i = 1; i <= yearDurationSec.Keys.Count; i++)
-            //    {
-            //        yearDurationSec[i] = tableInfo.Where(t => t.OrderDatetime.Month == i && t.OrderDatetime.Year == y)
-            //            .Sum(n => n.DurationSec);
-            //    }
-            //    resList.Add(new
-            //    {
-            //        Year = y,
-            //        Month = 0,
-            //        Output = yearOutput,
-            //        OrderQuantity = yearOrderQuantity,
-            //        TotalDurationSec = yearDurationSec
-            //    });
-            //});
-
-            //return new RpcResponse<object>() { Data = resList, Message = null };
         }
 
 
@@ -425,7 +496,6 @@ namespace SCADA_DAQ.Customer.Service
         public RpcResponse<object> GetProductionLineInfo()
         {
             var tableInfo = CustomerEnv.ProductionLineConfigValue;
-
             return new RpcResponse<object>() { Data = tableInfo, Message = null };
         }
 
@@ -436,22 +506,89 @@ namespace SCADA_DAQ.Customer.Service
         /// <returns></returns>
         public RpcResponse<object> GetNoticeInfo()
         {
+            // 返回静态缓存
+            var timespan = (DateTime.Now - (DateTime)StaticCache["GetNoticeInfo"]["Time"]).TotalSeconds;
+            if (timespan < staticCacheDuration)
+                return new RpcResponse<object>() { Data = StaticCache["GetNoticeInfo"]["Cache"], Message = null };
+
             var nowTime = DateTime.Now;
             // 只获取激活的和在开始结束时间之间的公告
             var tableInfo = DAL.APP_TaiLing_NoticeManagement.GetData<AnnouncementModel>()?
                 .Where(t => t.IsEnable == true && t.StartTime < nowTime && t.EndTime > nowTime).ToList();
 
+            // 设置静态缓存
+            StaticCache["GetNoticeInfo"] = new Dictionary<string, object>()
+                { { "Time", DateTime.Now}, { "Cache", tableInfo} };
             return new RpcResponse<object>() { Data = tableInfo, Message = null };
         }
 
 
+        ///// <summary>
+        ///// 获取当天产量
+        ///// </summary>
+        ///// <returns></returns>
+        //public RpcResponse<object> GetTodayOutput()
+        //{
+
+        //    var sql = $"SELECT WorkShopId_Str AS 车间号, ProductionLineId_Str AS 产线号, COUNT(*) AS 产量 " +
+        //        $"FROM APP_TaiLing_ProductionRecord WHERE DATEDIFF(dd, EndTime_Dt, GETDATE())= 0 " +
+        //        $"GROUP BY WorkShopId_Str, ProductionLineId_Str";
+        //    var res = DAL.ReadDataTable(sql);
+        //    return new RpcResponse<object>() { Data = res, Message = null };
+        //}
+
+
+        ///// <summary>
+        ///// 获取月度产量
+        ///// </summary>
+        ///// <returns></returns>
+        //public RpcResponse<object> GetMonthOutput()
+        //{
+        //    var sql = $"SELECT YEAR(StartTime_Dt) AS 年份, MONTH(StartTime_Dt) AS 月份, " +
+        //        $"WorkShopId_Str AS 车间号, ProductionLineId_Str AS 产线号, COUNT(*) AS 产量 " +
+        //        $"FROM APP_TaiLing_ProductionRecord " +
+        //        $"GROUP BY YEAR(StartTime_Dt), MONTH(StartTime_Dt), WorkShopId_Str, ProductionLineId_Str";
+        //    var res = DAL.ReadDataTable(sql);
+        //    return new RpcResponse<object>() { Data = res, Message = null };
+        //}
+
+
+        ///// <summary>
+        ///// 获取人均小时产出率
+        ///// </summary>
+        ///// <returns></returns>
+        //public RpcResponse<object> GetPerCapitaOutputPerHour()
+        //{
+
+        //    // 三表联查,人均小时产出率直接用sql算出来
+        //    var sql = "SELECT tb1.年份, tb1.月份, tb1.车间号, tb1.产线号, tb1.时长, tb2.产量, tb3.NumberOfPeople_Int AS 人数, " +
+        //        "CONVERT(DECIMAL(13,3),3600.0*tb2.产量/tb3.NumberOfPeople_Int/tb1.时长) AS 人均小时产出率 " +
+        //        "FROM((SELECT YEAR(StartTime_Dt) AS 年份, MONTH(StartTime_Dt) AS 月份, " +
+        //        "WorkShopId_Str AS 车间号, ProductionLineId_Str AS 产线号, SUM(DurationSec_Int) AS 时长 " +
+        //        "FROM APP_TaiLing_ProductionLineStateRecord " +
+        //        "WHERE ProductionLineState_Str = 'Running' " +
+        //        "GROUP BY YEAR(StartTime_Dt), MONTH(StartTime_Dt), WorkShopId_Str, ProductionLineId_Str) AS tb1 " +
+        //        "LEFT JOIN(SELECT YEAR(StartTime_Dt) AS 年份, MONTH(StartTime_Dt) AS 月份, " +
+        //        "WorkShopId_Str AS 车间号, ProductionLineId_Str AS 产线号, COUNT(*) AS 产量 " +
+        //        "FROM APP_TaiLing_ProductionRecord " +
+        //        "GROUP BY YEAR(StartTime_Dt), MONTH(StartTime_Dt), WorkShopId_Str, ProductionLineId_Str) AS tb2 " +
+        //        "ON tb1.年份 = tb2.年份 AND tb1.月份 = tb2.月份 AND tb1.车间号 = tb2.车间号 AND tb1.产线号 = tb2.产线号) " +
+        //        "LEFT JOIN APP_TaiLing_ProductionLineManagement AS tb3 " +
+        //        "ON tb1.车间号 = tb3.WorkShopId_Str AND tb1.产线号 = tb3.ProductionLineId_Str";
+        //    var res = DAL.ReadDataTable(sql);
+        //    return new RpcResponse<object>() { Data = res, Message = null };
+        //}
+
+
+
+
         /// <summary>
         /// 停止服务
         /// </summary>
         /// <returns></returns>
         public override bool Stop()
         {
-            Env.Schedual.DateTimeChanged -= Schedual_DateTimeChanged;  // 销毁定时器
+            //Env.Schedual.DateTimeChanged -= Schedual_DateTimeChanged;  // 销毁定时器
             return base.Stop();
         }
     }

+ 7 - 9
SCADA_DAQ/Customer/Service/CustomerServiceConfig.cs

@@ -12,13 +12,11 @@ namespace SCADA_DAQ.Customer.Service
     /// </summary>
     public class CustomerServiceConfig:ObservableObject
     {
-
-		private int _MyProperty;
-		[AutoViewProperty("test")]
-		/// <summary>
-		/// 
-		/// </summary>
-		public int MyProperty
+        /// <summary>
+        /// 
+        /// </summary>
+        [AutoViewProperty("test")]
+        public int MyProperty
 		{
 			get { return _MyProperty; }
 			set
@@ -30,6 +28,6 @@ namespace SCADA_DAQ.Customer.Service
 				}
 			}
 		}
-
-	}
+        private int _MyProperty;
+    }
 }

+ 1 - 0
SCADA_DAQ/Customer/UctFrmCodeScanningGun.xaml

@@ -55,6 +55,7 @@
                 <GroupBox Header="产量信息">
                     <TextBlock x:Name="productionInfo" HorizontalAlignment="Center" VerticalAlignment="Top" FontSize="120" Foreground="Black" FontStretch="Normal"/>
                 </GroupBox>
+                <!--<wpfcontrol:Card/>-->
             </Grid>
             <Grid Grid.Row="1">
                 <GroupBox Header="扫码队列">

+ 20 - 10
SCADA_DAQ/Customer/UctFrmCodeScanningGun.xaml.cs

@@ -5,6 +5,7 @@ using NPOI.SS.Formula.Functions;
 using SCADA.BarcodeReader;
 using SCADA.Comm;
 using SCADA.CommonCtrl.WpfControl;
+using SCADA.CommonCtrl.WpfWindow;
 using SCADA.CommonLib;
 using SCADA.CommonLib.Helper;
 using SCADA_DAQ.Customer.Machines;
@@ -24,6 +25,7 @@ using System.Windows.Media;
 using System.Windows.Media.Imaging;
 using System.Windows.Navigation;
 using System.Windows.Shapes;
+using System.Windows.Threading;
 
 namespace SCADA_DAQ.Customer
 {
@@ -33,8 +35,8 @@ namespace SCADA_DAQ.Customer
     [UctMenu("扫码界面", Icon = "看板")]
     public partial class UctFrmCodeScanningGun : BaseUctFrm
     {
-        public ScannerMachine FirstMachinelCodeScanningSun = MachineServer.GetInstance().GetMachine<ScannerMachine>("上料扫码枪");
-        public ScannerMachine SencndMachinelCodeScanningSun = MachineServer.GetInstance().GetMachine<ScannerMachine>("下料扫码枪");
+        private ScannerMachine FirstMachinelCodeScanningSun = MachineServer.GetInstance().GetMachine<ScannerMachine>("上料扫码枪");
+        private ScannerMachine SencndMachinelCodeScanningSun = MachineServer.GetInstance().GetMachine<ScannerMachine>("下料扫码枪");
 
         private List<SolidColorBrush> brushesList = new List<SolidColorBrush>()
         {
@@ -42,6 +44,9 @@ namespace SCADA_DAQ.Customer
         };
         private int brushListIndex = 0;
 
+        /// <summary>
+        /// 
+        /// </summary>
         public UctFrmCodeScanningGun()
         {
             InitializeComponent();
@@ -58,14 +63,20 @@ namespace SCADA_DAQ.Customer
 
 
             Env.Schedual.DateTimeChanged += Schedual_DateTimeChanged;
+
+            //Task.Run(() =>
+            //{
+            //    System.Threading.Thread.Sleep(3000);
+            //    // 应用程序当前线程
+            //    //Application.Current.Dispatcher.Invoke(()=>{ coding });
+            //});
+            
         }
 
         private void Machinel_BarCodeReceived(object sender, BarcodeReceivedEventArgs e)
         {
             Dispatcher.Invoke(() =>
                 {
-                    //OrderInfoText.Text = CustomerEnv.CurrentOrderId + "\r\n" + CustomerEnv.CurrentMotorcycleTypeName;
-                    //OrderInfoText.Text = CustomerEnv.CurrentTaskInfo.OrderId + "\r\n" + CustomerEnv.CurrentTaskInfo.MotorcycleTypeName;
                     TextContent.Text = e.Barcode;
                     TextContent.Background = brushesList[brushListIndex];
                     brushListIndex++;
@@ -74,19 +85,18 @@ namespace SCADA_DAQ.Customer
                         brushListIndex = 0;
                     }
                     TextContentTime.Text = e.TimeStamp.ToLongTimeString();
+                    // 全屏提示、语音播报
+                    FrmShowMessage.ShowMessage(e.Barcode, "扫码成功", SCADA.CommonCtrl.MessageLevel.Info, 3000);
                 });
         }
 
         private void Schedual_DateTimeChanged(object sender, DateTimeChangedArgs e)
         {
-            if(e.TimeFlag.Second % 1 == 0)
+            if (e.TimeFlag.Second % 1 == 0)
             {
                 Dispatcher.Invoke(() =>
                 {
-                    //OrderInfoText.Text = CustomerEnv.CurrentOrderId + "\r\n" + CustomerEnv.CurrentMotorcycleTypeName;
-                    OrderInfoText.Text = CustomerEnv.CurrentTaskInfo.OrderId + "\r\n" + CustomerEnv.CurrentTaskInfo.MotorcycleTypeName;
-
-                    //productionInfo.Text = CustomerEnv.CurrentTaskInfoDic["CurrentProduction"].ToString();
+                    OrderInfoText.Text = CustomerEnv.CurrentTaskInfo.OrderSequence + "\r\n" + CustomerEnv.CurrentTaskInfo.MotorcycleTypeName;
                     productionInfo.Text = CustomerEnv.CurrentTaskInfo.CurrentProduction.ToString();
 
                     // 扫码队列
@@ -97,7 +107,7 @@ namespace SCADA_DAQ.Customer
                     }
                     scanList.Text = textList;
                 });
-                
+
             }
         }
 

+ 20 - 3
SCADA_DAQ/Customer/UctFrmMotorcycleTypeManagement.xaml.cs

@@ -26,14 +26,14 @@ namespace SCADA_DAQ.Customer
     /// <summary>
     /// UctFrmMotorcycleTypeManagement.xaml 的交互逻辑
     /// </summary>
-    [UctMenu("车型管理",Icon ="看板")]
+    [UctMenu("车型管理", Icon = "看板")]
     public partial class UctFrmMotorcycleTypeManagement : BaseUctFrm<QueryMotorcycleTypeModel, AddMotorcycleTypeModel>
     {
 
         public UctFrmMotorcycleTypeManagement()
         {
             InitializeComponent();
-
+            
             CustomerEnv.MotorcycleTypeNameList = Env.SgIDAL.APP_TaiLing_MotorcycleTypeManagement.GetData<MotorcycleTypeModel>()?.Select(t => t.MotorcycleTypeName).ToList();
             CustomerEnv.MotorcycleTypeNameList.Insert(0, null);
 
@@ -49,8 +49,25 @@ namespace SCADA_DAQ.Customer
                 {T_Col_Name.APP_TaiLing_MotorcycleTypeManagement.MotorcycleTypeId_Str, new SmartGridHeaderMapping("整车编码",false,null) },
                 {T_Col_Name.APP_TaiLing_MotorcycleTypeManagement.MotorcycleTypeName_Str, new SmartGridHeaderMapping("车型名称",false,null) }
             };
+            MainGrid.ExportSheetName = "车型管理";  // 导出表的名称
 
-            
+            // 添加工具栏按钮
+            var openBtn = new ToolBarOpenFile();    // 导入按钮
+            openBtn.Click += OpenBtn_Click;
+            ToolBar.Items.Add(openBtn);
+            MainGrid.FileDragDrop += FileDragDrop;
+
+            // 其他种类的按钮
+            //var bt = new ToolBarButton() { ButtonKind = SCADA.CommonCtrl.ButtonKind.UpButton };
+            //bt.Click += Bt_Click;
+            //bt.Title = "11";
+            //ToolBar.Items.Add(bt);
+        }
+
+
+        private void OpenBtn_Click(object sender, ToolBarOpenFile.OpenFileButtonBouseEventArgs e)
+        {
+            ImportFile(e.OpenFileName, MainGrid.ExportSheetName);
         }
 
         private void Schedual_DateTimeChanged(object sender, DateTimeChangedArgs e)

+ 11 - 0
SCADA_DAQ/Customer/UctFrmProductionLineManagement.xaml.cs

@@ -43,6 +43,17 @@ namespace SCADA_DAQ.Customer
             //MainGrid.IsAutoUpdate = true;  //表格更新时允许更新到数据库
             MainGrid.SourceTable = QueryModel.SourceTable;   //指定绑定更新的表
             MainGrid.DataTableColumnLables = SmartGridHeaderMapping.CreateMapping<ProductionLineManagementModel>();
+            MainGrid.ExportSheetName = "产线管理";
+
+            var openBtn = new ToolBarOpenFile();
+            openBtn.Click += OpenBtn_Click;
+            ToolBar.Items.Add(openBtn);
+            MainGrid.FileDragDrop += FileDragDrop;
+        }
+
+        private void OpenBtn_Click(object sender, ToolBarOpenFile.OpenFileButtonBouseEventArgs e)
+        {
+            ImportFile(e.OpenFileName, MainGrid.ExportSheetName);
         }
 
         /// <summary>

+ 3 - 0
SCADA_DAQ/Env.cs

@@ -26,6 +26,8 @@ namespace SCADA_DAQ
     {
         // SQLite
         public static DILDB DAL = null;
+        public static LocalDB.DIL.DILDB LocalDAL = null;   // 系统数据库
+
 
         // SQL Server
         public static SqlSchema.DIL.DILDB SgIDAL = new SqlSchema.DIL.DILDB("127.0.0.1", "TL_DB", "sa", "M+123456");
@@ -296,6 +298,7 @@ namespace SCADA_DAQ
             dbInit(AlarmDBConfig, typeof(SqlSchema.DIL.DILDB), out BaseDB alarmDB);
 
             DAL = (DILDB)currentDB;
+            LocalDAL = (LocalDB.DIL.DILDB)sysDB;   // 系统数据库
             GlobalEnv.Instance.GlobalDB = currentDB;
             GlobalEnv.Instance.AlarmDB = alarmDB;
             GlobalEnv.Instance.LocalAppDB = sysDB;

+ 5 - 0
SCADA_DAQ/SCADA_DAQ.csproj

@@ -66,6 +66,11 @@
   <ItemGroup>
     <ProjectReference Include="..\SCADA_DAQ.DAL\SCADA_DAQ.DAL.csproj" />
     <ProjectReference Include="..\SCADA_DAQ.Language\SCADA_DAQ.Language.csproj" />
+    <ProjectReference Include="..\SCADA_DAQ.Plugin.Tailg\SCADA_DAQ.Plugin.Tailg.csproj">
+      <ReferenceOutputAssembly></ReferenceOutputAssembly>
+      <Private></Private>
+      <CopyLocalSatelliteAssemblies></CopyLocalSatelliteAssemblies>
+    </ProjectReference>
   </ItemGroup>
 
   <ItemGroup>

+ 45 - 0
SCADA_DAQ/SystemControl.cs

@@ -2,9 +2,11 @@
 using DBNames;
 using log4net;
 using SCADA.CommonLib;
+using SCADA.CommonLib.Data.DIL;
 using SCADA.CommonLib.Helper;
 using SCADA_DAQ.Customer;
 using SCADA_DAQ.Customer.Models;
+using SCADA_DAQ.Customer.Models.ProductionLineManagement;
 using SCADA_DAQ.Plugin.Core;
 using SCADA_DAQ.Plugin.Core.License;
 using SCADA_DAQ.Plugin.CoreUI;
@@ -118,6 +120,7 @@ namespace SCADA_DAQ
                 CreateBackGroundTask(ReportOnLine, 10 * 1000 * 60, 10 * 1000, true, "ReportAppInfo");
                 CreateBackGroundTask(Plugin.CoreUI.SystemApp.SystemStatictics.UpdateLastOnLineTime, 1 * 1000 * 60, 10 * 1000, true, "UpdateLastTime");
                 CreateBackGroundTask(Plugin.CoreUI.SystemApp.SystemStatictics.StatisticsRunTime, 30 * 1000, 15 * 1000, true, "StatisticsRunTime");
+                CreateBackGroundTask(SyncRunTime, 60 * 1000, 10 * 1000, true, "SyncRunTime");  // 同步运行时长
             });
 
             initServer = Task.Factory.StartNew(() =>
@@ -435,6 +438,48 @@ namespace SCADA_DAQ
         }
 
 
+        /// <summary>
+        /// 同步运行时长到服务器
+        /// </summary>
+        public void SyncRunTime()
+        {
+            var localValue = Env.LocalDAL.SysApp_DayStatistics?.GetTopOne($"DayStartTime_Dt='{DateTime.Now.Date.Format()}'", "Value_Dec", "DayStartTime_Dt desc");
+            if (localValue == null)
+                localValue = 0;
+
+            var filterStr = $"ProductionLineId_Str='{CustomerEnv.ProductionLineConfigValue.ProductionLineId}' " +
+                        $"AND WorkShopId_Str='{CustomerEnv.ProductionLineConfigValue.WorkShopId}' " +
+                        $"AND DATEDIFF(dd, StartTime_Dt, GETDATE())=0";
+            ProductionLineStateModel tableInfo = null;
+            if (Env.SgIDAL.APP_TaiLing_ProductionLineStateRecord != null && Env.SgIDAL.APP_TaiLing_ProductionLineStateRecord.Exist(filterStr))
+            {
+                tableInfo = Env.SgIDAL.APP_TaiLing_ProductionLineStateRecord?
+                    .GetData<ProductionLineStateModel>(filterStr)
+                    .OrderBy(t => t.ID).Last();
+            }
+            else
+            {
+                tableInfo = null;
+            }
+
+            if (tableInfo == null)
+            {
+                Env.SgIDAL.APP_TaiLing_ProductionLineStateRecord?.Insert(
+                    new UpdateItem("ProductionLineId_Str", CustomerEnv.ProductionLineConfigValue.ProductionLineId),
+                    new UpdateItem("WorkShopId_Str", CustomerEnv.ProductionLineConfigValue.WorkShopId),
+                    new UpdateItem("ProductionLineState_Str", "Running"),
+                    new UpdateItem("StartTime_Dt", DateTime.Now.Date.Format()),
+                    new UpdateItem("EndTime_Dt", DateTime.Now.AddDays(1).Date.Format()),
+                    new UpdateItem("DurationSec_Int", localValue)
+                    );
+            }
+            else
+            {
+                Env.SgIDAL.APP_TaiLing_ProductionLineStateRecord?.Update(filterStr,
+                    new UpdateItem("DurationSec_Int", localValue));
+            }
+        }
+
 
         /// <summary>
         /// 创建一个后台任务

+ 6 - 0
SCADA_DAQ3.0.sln

@@ -55,6 +55,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "x64", "x64", "{78536574-A4A
 		Lib\x64\SQLite.Interop.dll = Lib\x64\SQLite.Interop.dll
 	EndProjectSection
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SCADA_DAQ.Plugin.Tailg", "SCADA_DAQ.Plugin.Tailg\SCADA_DAQ.Plugin.Tailg.csproj", "{6EB3A51D-A4AF-4981-B8C1-C6F9ECFF14E4}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -77,6 +79,10 @@ Global
 		{61B53CB6-CE0D-4367-B118-5C432057B5C6}.Debug|Any CPU.Build.0 = 52台铃产线生产管理系统|Any CPU
 		{61B53CB6-CE0D-4367-B118-5C432057B5C6}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{61B53CB6-CE0D-4367-B118-5C432057B5C6}.Release|Any CPU.Build.0 = Release|Any CPU
+		{6EB3A51D-A4AF-4981-B8C1-C6F9ECFF14E4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{6EB3A51D-A4AF-4981-B8C1-C6F9ECFF14E4}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{6EB3A51D-A4AF-4981-B8C1-C6F9ECFF14E4}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{6EB3A51D-A4AF-4981-B8C1-C6F9ECFF14E4}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE

Alguns arquivos não foram mostrados porque muitos arquivos mudaram nesse diff