zly 5 miesięcy temu
rodzic
commit
47aec6ae5e
35 zmienionych plików z 3984 dodań i 1173 usunięć
  1. 3 3
      TeamAAS-VM/App.config
  2. 2 0
      TeamAAS-VM/App.xaml.cs
  3. 4 4
      TeamAAS-VM/Controls/ParameterEdit.xaml
  4. 740 22
      TeamAAS-VM/Core/Management.cs
  5. 19 0
      TeamAAS-VM/Core/PLCs/OPCuaClientPLC.cs
  6. 2 2
      TeamAAS-VM/Data/DatabaseInitializer.cs
  7. 4 0
      TeamAAS-VM/Data/SystemDatabaseService.cs
  8. 23 0
      TeamAAS-VM/Interfaces/IRemoteCommandService.cs
  9. 1 1
      TeamAAS-VM/LogHelper.cs
  10. 26 1
      TeamAAS-VM/Models/CTQ_Data.cs
  11. 15 0
      TeamAAS-VM/Models/DeviceInfo.cs
  12. 103 1
      TeamAAS-VM/Models/PLC/PlcAddressConfig.cs
  13. 191 0
      TeamAAS-VM/Models/PLC/PlcExcelLoad.cs
  14. 23 0
      TeamAAS-VM/Models/Product/ProductModel.cs
  15. 8 0
      TeamAAS-VM/Models/SystemConfiguration.cs
  16. 48 3
      TeamAAS-VM/Resources/Languages/Lang.Designer.cs
  17. 84 84
      TeamAAS-VM/Services/ConfigService.cs
  18. 328 0
      TeamAAS-VM/Services/RemoteCommandService.cs
  19. 9 0
      TeamAAS-VM/TeamAAS-VP.csproj
  20. 193 0
      TeamAAS-VM/ViewModels/AddScrewViewModel.cs
  21. 2 2
      TeamAAS-VM/ViewModels/Home/AddScrewViewModel.cs
  22. 24 3
      TeamAAS-VM/ViewModels/HomeViewModel.cs
  23. 216 24
      TeamAAS-VM/ViewModels/MainWindowViewModel.cs
  24. 21 0
      TeamAAS-VM/ViewModels/Product/ProductParamsViewModel.cs
  25. 12 1
      TeamAAS-VM/ViewModels/SettingViewModel.cs
  26. 121 28
      TeamAAS-VM/ViewModels/User/CardLoginWindowViewModel.cs
  27. 97 43
      TeamAAS-VM/ViewModels/User/LoginViewModel.cs
  28. 76 0
      TeamAAS-VM/Views/AddScrewView.xaml
  29. 288 0
      TeamAAS-VM/Views/AddScrewView.xaml.cs
  30. 0 1
      TeamAAS-VM/Views/Home/AddScrew.xaml
  31. 480 430
      TeamAAS-VM/Views/HomeView.xaml
  32. 212 76
      TeamAAS-VM/Views/MainWindowView.xaml
  33. 24 0
      TeamAAS-VM/Views/Product/ProductParams.xaml
  34. 581 440
      TeamAAS-VM/Views/SettingView.xaml
  35. 4 4
      TeamAAS-VM/Views/User/LoginView.xaml

+ 3 - 3
TeamAAS-VM/App.config

@@ -54,7 +54,7 @@
       <!--日志类的名字-->
       <!--日志类的名字-->
       <level value="ALL" />
       <level value="ALL" />
       <!--定义记录的日志级别-->
       <!--定义记录的日志级别-->
-      <appender-ref ref="WarnAppender" />
+      <appender-ref ref="PlcWarnAppender" />
       <!--记录到哪个介质中去-->
       <!--记录到哪个介质中去-->
     </logger>
     </logger>
     <!--重大错误日志类-->
     <!--重大错误日志类-->
@@ -156,8 +156,8 @@
       </layout>
       </layout>
     </appender>
     </appender>
     <!--警告日志附加介质-->
     <!--警告日志附加介质-->
-    <appender name="WarnAppender" type="log4net.Appender.RollingFileAppender">
-      <param name="File" value="..\\Log\\LogWarn\\" />
+    <appender name="PlcWarnAppender" type="log4net.Appender.RollingFileAppender">
+      <param name="File" value="..\\Log\\LogPlcWarn\\" />
       <param name="AppendToFile" value="true" />
       <param name="AppendToFile" value="true" />
       <param name="MaxFileSize" value="10240" />
       <param name="MaxFileSize" value="10240" />
       <param name="MaxSizeRollBackups" value="100" />
       <param name="MaxSizeRollBackups" value="100" />

+ 2 - 0
TeamAAS-VM/App.xaml.cs

@@ -147,6 +147,7 @@ namespace TeamAAS_VP
             containerRegistry.RegisterSingleton<CardLoginWindowViewModel>();
             containerRegistry.RegisterSingleton<CardLoginWindowViewModel>();
             containerRegistry.RegisterSingleton<TorqueService>();
             containerRegistry.RegisterSingleton<TorqueService>();
 
 
+
             // Register system database service and initializer
             // Register system database service and initializer
             containerRegistry.RegisterSingleton<ISystemDatabaseService, TeamAAS_VP.Data.SystemDatabaseService>();
             containerRegistry.RegisterSingleton<ISystemDatabaseService, TeamAAS_VP.Data.SystemDatabaseService>();
             containerRegistry.RegisterSingleton<IDatabaseInitializer, TeamAAS_VP.Data.DatabaseInitializer>();
             containerRegistry.RegisterSingleton<IDatabaseInitializer, TeamAAS_VP.Data.DatabaseInitializer>();
@@ -216,6 +217,7 @@ namespace TeamAAS_VP
             containerRegistry.RegisterDialog<PlcPointOffserParams>();
             containerRegistry.RegisterDialog<PlcPointOffserParams>();
             containerRegistry.RegisterDialog<PickScrewAccuracyAnalyzer>();
             containerRegistry.RegisterDialog<PickScrewAccuracyAnalyzer>();
             containerRegistry.RegisterDialog<ImagePreviewWindow>();
             containerRegistry.RegisterDialog<ImagePreviewWindow>();
+            containerRegistry.RegisterDialog<AddScrewView,AddScrewViewModel>();
             //**************************************************************************************
             //**************************************************************************************
 
 
             // 注册 SQLSugar 客户端(单例模式)
             // 注册 SQLSugar 客户端(单例模式)

+ 4 - 4
TeamAAS-VM/Controls/ParameterEdit.xaml

@@ -55,16 +55,16 @@
                 <DataGridTextColumn Header="Name"
                 <DataGridTextColumn Header="Name"
                                     MinWidth="80"
                                     MinWidth="80"
                                     Binding="{Binding Name, Mode=TwoWay}" />
                                     Binding="{Binding Name, Mode=TwoWay}" />
-                <DataGridTextColumn Header="Param1"
+                <DataGridTextColumn Header="X下限"
                                     MinWidth="80"
                                     MinWidth="80"
                                     Binding="{Binding Param1, Mode=TwoWay}" />
                                     Binding="{Binding Param1, Mode=TwoWay}" />
-                <DataGridTextColumn Header="Param2"
+                <DataGridTextColumn Header="X上限"
                                     MinWidth="80"
                                     MinWidth="80"
                                     Binding="{Binding Param2, Mode=TwoWay}" />
                                     Binding="{Binding Param2, Mode=TwoWay}" />
-                <DataGridTextColumn Header="Param3"
+                <DataGridTextColumn Header="Y下限"
                                     MinWidth="80"
                                     MinWidth="80"
                                     Binding="{Binding Param3, Mode=TwoWay}" />
                                     Binding="{Binding Param3, Mode=TwoWay}" />
-                <DataGridTextColumn Header="Param4"
+                <DataGridTextColumn Header="Y上限"
                                     MinWidth="80"
                                     MinWidth="80"
                                     Binding="{Binding Param4, Mode=TwoWay}" />
                                     Binding="{Binding Param4, Mode=TwoWay}" />
             </DataGrid.Columns>
             </DataGrid.Columns>

+ 740 - 22
TeamAAS-VM/Core/Management.cs

@@ -1,10 +1,13 @@
 using Cognex.VisionPro.ToolBlock;
 using Cognex.VisionPro.ToolBlock;
+using MahApps.Metro.Controls;
 using NPOI.OpenXmlFormats.Vml;
 using NPOI.OpenXmlFormats.Vml;
+using Opc.Ua;
 using Org.BouncyCastle.Crypto;
 using Org.BouncyCastle.Crypto;
 using Prism.Events;
 using Prism.Events;
 using Prism.Ioc;
 using Prism.Ioc;
 using Prism.Mvvm;
 using Prism.Mvvm;
 using Prism.Regions;
 using Prism.Regions;
+using SqlSugar;
 using System;
 using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
 using System.Collections.ObjectModel;
 using System.Collections.ObjectModel;
@@ -13,13 +16,17 @@ using System.IO;
 using System.IO.Compression;
 using System.IO.Compression;
 using System.Linq;
 using System.Linq;
 using System.Net.Sockets;
 using System.Net.Sockets;
+using System.Security.Claims;
 using System.Text;
 using System.Text;
 using System.Threading;
 using System.Threading;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
+using System.Web;
+using System.Web.UI.WebControls;
 using System.Windows.Media;
 using System.Windows.Media;
 using Team.FFFeederService.Interfaces;
 using Team.FFFeederService.Interfaces;
 using TeamAAS_VP.Core.PLCs;
 using TeamAAS_VP.Core.PLCs;
 using TeamAAS_VP.Core.ScrewDriver;
 using TeamAAS_VP.Core.ScrewDriver;
+using TeamAAS_VP.Data;
 using TeamAAS_VP.Enums;
 using TeamAAS_VP.Enums;
 using TeamAAS_VP.Events;
 using TeamAAS_VP.Events;
 using TeamAAS_VP.Interfaces;
 using TeamAAS_VP.Interfaces;
@@ -1196,6 +1203,7 @@ namespace TeamAAS_VP.Core
                 addressConfig.In_RequestPosition.Address,
                 addressConfig.In_RequestPosition.Address,
                 addressConfig.In_QrCodePhotoRequest.Address,
                 addressConfig.In_QrCodePhotoRequest.Address,
                 addressConfig.In_ScrewTeachExe.Address,
                 addressConfig.In_ScrewTeachExe.Address,
+                addressConfig.In_Screw_checkExe.Address,
                 addressConfig.In_PickINC.Address,
                 addressConfig.In_PickINC.Address,
                 addressConfig.In_Throw.Address,
                 addressConfig.In_Throw.Address,
                 addressConfig.RunMode.Address,
                 addressConfig.RunMode.Address,
@@ -1203,6 +1211,7 @@ namespace TeamAAS_VP.Core
                 addressConfig.ManualMode.Address,
                 addressConfig.ManualMode.Address,
                 addressConfig.ClearMode.Address,
                 addressConfig.ClearMode.Address,
                 addressConfig.Fault.Address,
                 addressConfig.Fault.Address,
+                addressConfig.In_FzCameraPixExe.Address,
             };
             };
             var systemconfig = _configService.GetSystemConfiguration();
             var systemconfig = _configService.GetSystemConfiguration();
             for (int i = 0; i < 10; i++)
             for (int i = 0; i < 10; i++)
@@ -1364,11 +1373,13 @@ namespace TeamAAS_VP.Core
         bool _LastDowmCameraExe = false;
         bool _LastDowmCameraExe = false;
         bool _LastScrewTeachExe = false;
         bool _LastScrewTeachExe = false;
         bool _LastUpCameraPickExe = false;
         bool _LastUpCameraPickExe = false;
+        bool _LastScrewFuJianExe = false;
         bool _LastUpCameraPutExe = false;
         bool _LastUpCameraPutExe = false;
         bool _LastUPCameracheckExe = false;
         bool _LastUPCameracheckExe = false;
         bool _LastFixedCameraPickExe = false;
         bool _LastFixedCameraPickExe = false;
         bool _LastFixedCameraPutExe = false;
         bool _LastFixedCameraPutExe = false;
         bool _LastFixedCameracheckExe = false;
         bool _LastFixedCameracheckExe = false;
+        bool _LastFzCameracheckExe = false;
         bool _LastThrowExe = false;
         bool _LastThrowExe = false;
         bool _LastRunModel = false;
         bool _LastRunModel = false;
         public bool _LastAutoRunning = false;
         public bool _LastAutoRunning = false;
@@ -1383,6 +1394,7 @@ namespace TeamAAS_VP.Core
         Int16 _LastPickINC = 0;
         Int16 _LastPickINC = 0;
         DateTime[] _LastMesCheckTime = new DateTime[10];
         DateTime[] _LastMesCheckTime = new DateTime[10];
         Dictionary<string, string> mes_cc = new Dictionary<string, string>();
         Dictionary<string, string> mes_cc = new Dictionary<string, string>();
+        Dictionary<string, double> Point = new Dictionary<string, double>();
         string[] ProductMainSN { get; set; } = new string[10];//产品主sn
         string[] ProductMainSN { get; set; } = new string[10];//产品主sn
         string[] model_num { get; set; } = new string[10];//产品model_num
         string[] model_num { get; set; } = new string[10];//产品model_num
         string[] wo { get; set; } = new string[10];//产品wo
         string[] wo { get; set; } = new string[10];//产品wo
@@ -1809,11 +1821,6 @@ namespace TeamAAS_VP.Core
                             var visionResult = await _remoteCommandService.ExecutePhotoGetSinglePoint(process, null, new double[] { currentPosition.X, currentPosition.Y, currentPosition.U }, _cts.Token, cameraIndex, num, null, null);
                             var visionResult = await _remoteCommandService.ExecutePhotoGetSinglePoint(process, null, new double[] { currentPosition.X, currentPosition.Y, currentPosition.U }, _cts.Token, cameraIndex, num, null, null);
                             if (visionResult.IsSucceed)
                             if (visionResult.IsSucceed)
                             {
                             {
-
-                                //if ()
-                                //{
-
-                                //}
                                 await plc.WriteNodeAsync(addressConfig.Out_UPCameracheckStatus.Address, (Int16)1);
                                 await plc.WriteNodeAsync(addressConfig.Out_UPCameracheckStatus.Address, (Int16)1);
                                 SendTaskMessage($"点位{cameraIndex}检测OK", MessageLevel.Debug);
                                 SendTaskMessage($"点位{cameraIndex}检测OK", MessageLevel.Debug);
                             }
                             }
@@ -1830,6 +1837,90 @@ namespace TeamAAS_VP.Core
                         }
                         }
                     }
                     }
                 }
                 }
+                //下相机拍照螺丝复检
+                else if (addressConfig.In_Screw_checkExe.Address.Contains(tuple.nodeId))
+                {
+                    Point.Clear();
+                    if (tuple.value is bool state)
+                    {
+                        if (_LastScrewFuJianExe != state)
+                        {
+                            _LastScrewFuJianExe = state;
+                        }
+                        else
+                        {
+                            return;
+                        }
+
+                        if (state)
+                        {
+
+                            SendTaskMessage(Lang.触发相机拍照螺丝复检, MessageLevel.Debug);
+                            //相机的编号
+                            Int16 cameraIndex = plc.ReadNode<Int16>(addressConfig.In_DowmCameraNum.Address);
+                            SendTaskMessage(string.Format(Lang.编号0, cameraIndex), MessageLevel.Info);
+
+                            // 获取流程
+                            var process = _productService.GetCurrentProductProcedureModelById(currentProduct.FixedUpCameraProcedureId);
+                            if (process == null)
+                            {
+                                SendTaskMessage(string.Format(Lang.固定向上相机视觉流程流程ID, currentProduct.FixedUpCameraProcedureId), MessageLevel.Alarm);
+                                await plc.WriteNodeAsync(addressConfig.Out_Screw_check_status.Address, (Int16)2);
+                                return;
+                            }
+
+                            // 获取机器人当前坐标
+                            var robot = _robotService.GetAllRobots().FirstOrDefault();
+                            if (robot == null)
+                            {
+                                SendTaskMessage(Lang.未找到机器人无法执行上相机锁附组装拍照视觉任务, MessageLevel.Alarm);
+                                await plc.WriteNodeAsync(addressConfig.Out_Screw_check_status.Address, (Int16)2);
+                                return;
+
+                            }
+                            var currentPosition = robot.GetRobotPos();
+
+                            // 执行视觉任务
+                            var _cts = new CancellationTokenSource();
+                            ImageParameters imgPara = new ImageParameters();
+                            imgPara.SNCode = productSn;
+                            var visionResult = await _remoteCommandService.ExecutePhotoGetSinglePoint1(process, null, null, _cts.Token, cameraIndex, cameraIndex, null, imgPara);
+                            //string X, Y, U;
+                            if (visionResult.IsSucceed)
+                            {
+                                //披头偏差
+                                //float offsetX = (float)(visionResult.X - currentPosition.X);
+                                //float offsetY = (float)(visionResult.Y - currentPosition.Y);
+                                string[] keys = { "X", "Y", "U" };
+                                double[] values = { visionResult.X, visionResult.Y, visionResult.U };
+                                for (int i = 0; i < keys.Length; i++)
+                                {
+                                    Point.Add(keys[i], values[i]);
+                                }
+
+                                // 2. 生成CSV文件(替换成你的保存路径)
+                                string csvPath = @"D:\视觉检测数据\XYU结果.csv";
+                                // 调用生成方法(appendMode=true 每次拍照新增一行,不会覆盖历史数据)
+                                ExportDictionaryToCsv(Point, csvPath, appendMode: true);
+                                //DowmCameraResults[cameraIndex] = new PointF(offsetX, offsetY);
+                                //ExportDictionaryToCsv1(ProductMainSN[1], visionResult.X, visionResult.Y, visionResult.U);
+
+                                await plc.WriteNodeAsync(addressConfig.Out_Screw_check_status.Address, (Int16)1);
+                                return;
+                            }
+                            else
+                            {
+                                await plc.WriteNodeAsync(addressConfig.Out_Screw_check_status.Address, (Int16)2);
+                                return;
+                            }
+                        }
+                        else
+                        {
+                            SendTaskMessage(Lang.触发下相机拍照信号已关闭, MessageLevel.Alarm);
+                            await plc.WriteNodeAsync(addressConfig.Out_Screw_check_status.Address, (Int16)0);
+                        }
+                    }
+                }
                 // 固定相机取料拍照
                 // 固定相机取料拍照
                 else if (addressConfig.In_FixedCameraPickExe.Address.Contains(tuple.nodeId))
                 else if (addressConfig.In_FixedCameraPickExe.Address.Contains(tuple.nodeId))
                 {
                 {
@@ -1918,6 +2009,213 @@ namespace TeamAAS_VP.Core
                         }
                         }
                     }
                     }
                 }
                 }
+                // 翻转相机检测拍照
+                else if (addressConfig.In_FzCameraPixExe.Address.Contains(tuple.nodeId))
+                {
+                    if (tuple.value is bool state)
+                    {
+                        if (_LastFzCameracheckExe != state)
+                        {
+                            _LastFzCameracheckExe = state;
+                        }
+                        else
+                        {
+                            return;
+                        }
+                        if (state)
+                        {
+                            int i = 5;
+                            SendTaskMessage("触发翻转相机拍照", MessageLevel.Debug);
+                            var code = plc.ReadNode<string>(string.Format(addressConfig.In_Code.Address, 1));
+
+                            string resultphoto = "";
+                            //这里缺少从MES获取产品配方的内容,需要补充
+
+                            _LastMesCheckTime[5] = (await _mesService.GetServerTimeAsync(5, code, 2)).Now;
+                            var stationConfig2 = _configService.GetDeviceInfo(0);
+                            LogHelper.WriteLogMes($"【mes开始QUERY】");
+                            SendTaskMessage($"mes开始QUERY", MessageLevel.Info);
+                            //if (stationConfig2.EnableMES)
+                            //{
+                            //    (bool isSuccess, string response) = await _mesService.StationGetExAsync(code, "", 2);
+                            //    if (isSuccess)
+                            //    {
+                            //        string ProductMainSN_Temp = "";
+                            //        LogHelper.WriteLogMes($"询问mes成功");
+                            //        SendTaskMessage($"询问mes成功:{response}", MessageLevel.Debug);
+                            //        string[] item = response.Split('\n');
+                            //        //获取过度件sn
+                            //        string snItem = item.FirstOrDefault(f => f.Contains("sn="));
+                            //        if (snItem != null)
+                            //        {
+                            //            ProductMainSN_Temp = snItem.Replace("sn=", "").Trim();
+
+                            //            SendTaskMessage($"过度件sn:{ProductMainSN_Temp}", MessageLevel.Info);
+                            //        }
+
+                            //        LogHelper.WriteLogMes($"询问mes成功");
+                            //        SendTaskMessage($"询问mes成功:{response}", MessageLevel.Debug);
+
+                            //        //20260214,螺丝机特别版
+                            //        (bool isSuccess2, string response2) = await _mesService.StationGetAsync(ProductMainSN_Temp, "", 2);//询问mes
+                            //        if (isSuccess2)
+                            //        {
+                            //            LogHelper.WriteLogMes($"询问mes成功");
+                            //            SendTaskMessage($"询问mes成功:{response2}", MessageLevel.Debug);
+
+                            //            string[] items = response2.Split('\n');
+                            //            //获取产品主sn和wo用于后续上传数据使用
+                            //            string snItem2 = items.FirstOrDefault(f => f.Contains("sn="));
+                            //            if (snItem2 != null)
+                            //            {
+                            //                var codesn = snItem2.Replace("sn=", "").Trim();
+                            //                //_productService.CurrentProductCode = codesn;
+                            //                SendTaskMessage($"产品主sn:{codesn}", MessageLevel.Info);
+                            //            }
+                            //            string woItem = item.FirstOrDefault(f => f.Contains("wo="));
+                            //            if (woItem != null)
+                            //            {
+                            //                wo[i] = woItem.Replace("wo=", "").Trim();
+                            //                SendTaskMessage($"工单信息:{wo[i]}", MessageLevel.Info);
+                            //            }
+                            //            string modelItem = item.FirstOrDefault(f => f.Contains("model_num="));
+                            //            if (modelItem != null)
+                            //            {
+                            //                model_num[i] = modelItem.Replace("model_num=", "").Trim();
+                            //                SendTaskMessage($"model_num:{model_num[i]}", MessageLevel.Info);
+                            //            }
+                            //            string colorItem = item.FirstOrDefault(f => f.Contains("color="));
+                            //            if (colorItem != null)
+                            //            {
+                            //                color[i] = colorItem.Replace("color=", "").Trim();
+                            //                SendTaskMessage($"color:{color[i]}", MessageLevel.Info);
+                            //            }
+                            //            string ppidItem = item.FirstOrDefault(f => f.Contains("ppid="));
+                            //            if (ppidItem != null)
+                            //            {
+                            //                ppid[5] = ppidItem.Replace("ppid=", "").Trim();
+                            //                SendTaskMessage($"ppid:{ppid[5]}", MessageLevel.Info);
+                            //            }
+                            //            string revisionItem = item.FirstOrDefault(f => f.Contains("stage="));
+                            //            if (revisionItem != null)
+                            //            {
+                            //                revision[5] = revisionItem.Replace("stage=", "").Trim();
+                            //                SendTaskMessage($"stage:{revision[5]}", MessageLevel.Info);
+                            //            }
+                            //            LogHelper.WriteLogMes($"第二次询问mes成功");
+                            //            SendTaskMessage($"第二次询问mes成功:{response2}", MessageLevel.Debug);
+
+                            //        }
+                            //        else
+                            //        {
+                            //            LogHelper.WriteLogMes($"第二次询问mes失败");
+                            //            SendTaskMessage($"第二次询问mes失败:{response2}", MessageLevel.Error);
+                            //            await plc.WriteNodeAsync(addressConfig.Out_FzCameraPickStatus.Address, (Int16)2);
+                            //            return;
+                            //        }
+                            //    }
+                            //    else
+                            //    {
+                            //        LogHelper.WriteLogMes($"询问mes失败");
+                            //        SendTaskMessage($"询问mes失败:{response}", MessageLevel.Error);
+                            //        await plc.WriteNodeAsync(addressConfig.Out_FzCameraPickStatus.Address, (Int16)2);
+                            //        return;
+                            //    }
+                            //}
+                            //else
+                            //{
+                            //    SendTaskMessage($"mes未启用", MessageLevel.Info);
+                            //}
+
+                            Guid FzCameraProcedureId = currentProduct.FzCameraProcedureId;
+
+                            var FzCameraProcess = _productService.GetCurrentProductProcedureModelById(FzCameraProcedureId);
+                            if (FzCameraProcess == null)
+                            {
+                                SendTaskMessage($"未找到翻转相机视觉流程,流程ID: {FzCameraProcedureId}", MessageLevel.Alarm);
+                                await plc.WriteNodeAsync(addressConfig.Out_FzCameraPickStatus.Address, (Int16)2);
+                                return;
+                            }
+                            SendTaskMessage($"开始执行翻转相机视觉流程", MessageLevel.Debug);
+                            var _cts = new CancellationTokenSource();
+
+                            await _remoteCommandService.SetLightBeforePhoto(FzCameraProcess);
+                            var FzCameraResult = _remoteCommandService.ExecutePhotoGetDistance(FzCameraProcess, null);
+
+                            if (FzCameraResult)
+                            {
+                                SendTaskMessage("翻转相机拍照成功", MessageLevel.Debug);
+                                resultphoto = "Pass";
+                                await plc.WriteNodeAsync(addressConfig.Out_FzCameraPickStatus.Address, (Int16)1);
+
+                            }
+                            else
+                            {
+                                SendTaskMessage("翻转相机拍照失败", MessageLevel.Alarm);
+                                resultphoto = "Fail";
+                                await plc.WriteNodeAsync(addressConfig.Out_FzCameraPickStatus.Address, (Int16)2);
+                            }
+                            if (stationConfig2.SaveCsv)
+                            {
+                                List<DataFormCtq> DFC = new List<DataFormCtq>();
+                                string saveppid = "NA";
+                                string names = currentProduct.Name;
+                                if (stationConfig2.SaveCsvPPID) saveppid = ppid[i];
+                                DateTime servertime = DateTime.Now;
+                                // Dictionary<string, double> adjacentDiffDict1 = GetAdjacentDiffDict(keyData1);
+                                //判断锁付路径字符串是否为空,如果不为空则保存,否则不保存
+                                if (!string.IsNullOrEmpty(stationConfig2.SaveCsvPath))
+                                {
+
+                                    DFC.Add(new DataFormCtq
+                                    {
+                                        PPID = saveppid,
+                                        PROCESS_NAME = stationConfig2.DataInfo.PROCESS_NAME,
+                                        PROCESS_START_TIME = _LastMesCheckTime[5].ToString("yyyy-MM-ddTHH:mm:ss.fffffff") + "+08:00",
+                                        CTQ_NAME = "FzCameraPhoto",
+                                        CTQ_VALUE = 0,
+                                        CTQ_LSL = 0,
+                                        CTQ_USL = 0,
+                                        PROCESS_END_TIME = servertime.ToString("yyyy-MM-ddTHH:mm:ss.fffffff") + "+08:00",
+                                        SUPPLIER_NAME = stationConfig2.DataInfo.SUPPLIER_NAME,
+                                        COMMODITY_TYPE = stationConfig2.DataInfo.COMMODITY_TYPE,
+                                        REVISION = stationConfig2.DataInfo.REVISION + "_" + revision[i],
+                                        WO = "wo",//
+                                        MFG_LOT = stationConfig2.DataInfo.MFG_LOT,//
+                                        MFG_ASSY_LINE = stationConfig2.DataInfo.MFG_ASSY_LINE,
+                                        PROCESS_OUTCOME = resultphoto,
+                                        PROCESS_MACHINE_ID = stationConfig2.DataInfo.PROCESS_MACHINE_ID,
+                                        CTQ_UNIT_OF_MEASURE = "mm",
+                                        ERROR_MESSAGE = "",
+                                        PD_ATTR_01 = _productService.CurrentProductCode,//
+                                        PD_ATTR_02 = "",
+                                        PD_ATTR_03 = "",
+                                        PD_ATTR_04 = code,
+                                        PD_ATTR_05 = "",
+                                    });
+                                    bool recordResult = RecordStationResult(0, DFC, _productService.CurrentProductCode, servertime.Subtract(_LastMesCheckTime[5]).TotalSeconds, _LastMesCheckTime[5], stationConfig2.SaveCsvPath);
+                                    if (recordResult)
+                                    {
+                                        SendTaskMessage($"翻转相机拍照产品记录保存成功", MessageLevel.Debug);
+                                    }
+                                    else
+                                    {
+                                        SendTaskMessage($"{stationConfig2.DeviceName}产品记录保存失败", MessageLevel.Error);
+                                    }
+                                }
+                                else
+                                {
+                                    SendTaskMessage($"{stationConfig2.DeviceName}工位未配置保存路径,无法保存产品记录", MessageLevel.Error);
+                                }
+                            }
+                        }
+                        else
+                        {
+                            SendTaskMessage($"触发翻转相机检测拍照信号已关闭", MessageLevel.Alarm);
+                            await plc.WriteNodeAsync(addressConfig.Out_FzCameraPickStatus.Address, (Int16)0);
+                        }
+                    }
+                }
                 // 开始锁付
                 // 开始锁付
                 else if (addressConfig.In_WorkStart.Address.Contains(tuple.nodeId))
                 else if (addressConfig.In_WorkStart.Address.Contains(tuple.nodeId))
                 {
                 {
@@ -2086,6 +2384,7 @@ namespace TeamAAS_VP.Core
                             {
                             {
                                 dataToMes.Remove($"Pressure{lockResult.Number}");
                                 dataToMes.Remove($"Pressure{lockResult.Number}");
                             }
                             }
+                            lockResult.LockPassed = lastRes;
                             dataToMes.Add($"Torque{lockResult.Number}", $"{lockResult.LockTorque:F2}");
                             dataToMes.Add($"Torque{lockResult.Number}", $"{lockResult.LockTorque:F2}");
                             dataToMes.Add($"Turn{lockResult.Number}", $"{lockResult.LockTurns:F2}");
                             dataToMes.Add($"Turn{lockResult.Number}", $"{lockResult.LockTurns:F2}");
                             dataToMes.Add($"Pressure{lockResult.Number}", $"{lockResult.Pressure:F2}");
                             dataToMes.Add($"Pressure{lockResult.Number}", $"{lockResult.Pressure:F2}");
@@ -2155,18 +2454,49 @@ namespace TeamAAS_VP.Core
                                         plcPoints.Add(item);
                                         plcPoints.Add(item);
                                     }
                                     }
                                 }
                                 }
-                                var point = plcPoints[positionIndex - 1];
-                                if (point == null)
+                                var TempPoint = plcPoints[positionIndex - 1];
+                                if (TempPoint == null)
                                 {
                                 {
                                     SendTaskMessage($"点:{positionIndex}不存在", MessageLevel.Info);
                                     SendTaskMessage($"点:{positionIndex}不存在", MessageLevel.Info);
                                     await plc.WriteNodeAsync(addressConfig.Out_CameraDone.Address, (Int16)2);
                                     await plc.WriteNodeAsync(addressConfig.Out_CameraDone.Address, (Int16)2);
                                     return;
                                     return;
                                 }
                                 }
-                                point = point.Clone();
-                                point.X_Position = UpCameraPutResults[1].X + DowmCameraResults[1].X;
-                                point.Y_Position = UpCameraPutResults[1].Y + DowmCameraResults[1].Y;
-                                SendTaskMessage($"点:{positionIndex},{point.X_Position:F3},{point.Y_Position:F4}", MessageLevel.Info);
-                                await point.WriteToPlcAddress(addressConfig.Out_Screw, plc, positionIndex);
+                                var PositionPoint = TempPoint.Clone();
+                                PositionPoint.X_Position = UpCameraPutResults[1].X + DowmCameraResults[1].X;
+                                PositionPoint.Y_Position = UpCameraPutResults[1].Y + DowmCameraResults[1].Y;
+                                SendTaskMessage($"点:{positionIndex},{PositionPoint.X_Position:F3},{PositionPoint.Y_Position:F4}", MessageLevel.Info);
+                                if (PositionPoint.X_Position == 0 || PositionPoint.Y_Position == 0)
+                                {
+                                    SendTaskMessage("拟合位置为0,请检查", MessageLevel.Error);
+                                    await plc.WriteNodeAsync(addressConfig.Out_CameraDone.Address, (Int16)2);
+                                    return;
+                                }
+                                if (_configService.GetDeviceInfo().EnableXY)
+                                {
+                                    //验证当前锁附点位与设置锁附点位的差值是否超限,超限则报警并停止流程
+                                    //目前验证已OK 缺少切换按钮
+                                    try
+                                    {
+                                        var ScrewLimit = currentProduct.GlobalParamListCollection.FirstOrDefault((p) => p.Number == positionIndex - 1);
+                                        //判断实际偏差与设置的点位差数是否偏差过大
+                                        float XOffsetPoint = Math.Abs(PositionPoint.X_Position - (TempPoint.X_Position + TempPoint.X_Offset));
+                                        float YOffsetPoint = Math.Abs(PositionPoint.Y_Position - (TempPoint.Y_Position + TempPoint.Y_Offset));
+                                        if (!(XOffsetPoint >= float.Parse(ScrewLimit.Param1) && XOffsetPoint <= float.Parse(ScrewLimit.Param2)) ||
+                                            !(YOffsetPoint >= float.Parse(ScrewLimit.Param3) && YOffsetPoint <= float.Parse(ScrewLimit.Param4)))
+                                        {
+                                            SendTaskMessage($"当前锁附点位{positionIndex}与设置锁附点位差值超限,X偏差:{XOffsetPoint},Y偏差{YOffsetPoint}", MessageLevel.Error);
+                                            await plc.WriteNodeAsync(addressConfig.Out_CameraDone.Address, (Int16)2);
+                                            return;
+                                        }
+                                    }
+                                    catch (Exception ex)
+                                    {
+                                        SendTaskMessage($"当前锁附点位与设置锁附点位差值未设置:" + ex.Message, MessageLevel.Error);
+                                        await plc.WriteNodeAsync(addressConfig.Out_CameraDone.Address, (Int16)2);
+                                        return;
+                                    }
+                                }
+                                await PositionPoint.WriteToPlcAddress(addressConfig.Out_Screw, plc, positionIndex);
                             }
                             }
                             //拍2打所有
                             //拍2打所有
                             else if (systemConfig.WorkMode == 2)
                             else if (systemConfig.WorkMode == 2)
@@ -2191,6 +2521,28 @@ namespace TeamAAS_VP.Core
                                     point.X_Position = (float)worldPoint[0];
                                     point.X_Position = (float)worldPoint[0];
                                     point.Y_Position = (float)worldPoint[1];
                                     point.Y_Position = (float)worldPoint[1];
                                     SendTaskMessage($"点:{i},{point.X_Position:F3},{point.Y_Position:F4}", MessageLevel.Info);
                                     SendTaskMessage($"点:{i},{point.X_Position:F3},{point.Y_Position:F4}", MessageLevel.Info);
+                                    if (_configService.GetDeviceInfo().ScrewOverrun)
+                                    {
+                                        try
+                                        {
+                                            var ScrewLimit = currentProduct.GlobalParamListCollection.FirstOrDefault((p) => p.Number == positionIndex - 1);
+                                            //判断实际偏差与设置的点位差数是否偏差过大
+                                            float XOffsetPoint = Math.Abs(localPoint.X - (float)worldPoint[0]);
+                                            float YOffsetPoint = Math.Abs(localPoint.Y - (float)worldPoint[1]);
+                                            if ((XOffsetPoint >= float.Parse(ScrewLimit.Param1) && XOffsetPoint <= float.Parse(ScrewLimit.Param2)) ||
+                                                (YOffsetPoint >= float.Parse(ScrewLimit.Param3) && YOffsetPoint <= float.Parse(ScrewLimit.Param4)))
+                                            {
+                                                SendTaskMessage($"当前锁附点位{i}与设置锁附点位差值超限,X偏差:{XOffsetPoint},Y偏差{YOffsetPoint}", MessageLevel.Error);
+                                                await plc.WriteNodeAsync(addressConfig.Out_CameraDone.Address, (Int16)2);
+                                                return;
+                                            }
+                                        }
+                                        catch (Exception ex)
+                                        {
+                                            SendTaskMessage($"当前锁附点位与设置锁附点位差值超限:" + ex.Message, MessageLevel.Error);
+                                            await plc.WriteNodeAsync(addressConfig.Out_CameraDone.Address, (Int16)2);
+                                        }
+                                    }
                                     await point.WriteToPlcAddress(addressConfig.Out_Screw, plc);
                                     await point.WriteToPlcAddress(addressConfig.Out_Screw, plc);
                                 }
                                 }
                                 await plc.WriteNodeAsync(addressConfig.Out_WorkNum.Address, (Int16)currentProduct.ScrewPoints.Count);
                                 await plc.WriteNodeAsync(addressConfig.Out_WorkNum.Address, (Int16)currentProduct.ScrewPoints.Count);
@@ -2246,7 +2598,7 @@ namespace TeamAAS_VP.Core
                                         await point.WriteToPlcAddress(addressConfig.Out_Screw, plc);
                                         await point.WriteToPlcAddress(addressConfig.Out_Screw, plc);
                                     }
                                     }
                                     await plc.WriteNodeAsync(addressConfig.Out_WorkNum.Address, (Int16)currentProduct.ScrewPoints.Count);
                                     await plc.WriteNodeAsync(addressConfig.Out_WorkNum.Address, (Int16)currentProduct.ScrewPoints.Count);
-                                }                              
+                                }
                             }
                             }
                             await plc.WriteNodeAsync(addressConfig.Out_CameraDone.Address, (Int16)1);
                             await plc.WriteNodeAsync(addressConfig.Out_CameraDone.Address, (Int16)1);
                         }
                         }
@@ -2457,6 +2809,7 @@ namespace TeamAAS_VP.Core
                         }
                         }
                         if (state)
                         if (state)
                         {
                         {
+                            SendAlarmToUi(plc);
                             SendTaskMessage("收到PLC报警", MessageLevel.Error);
                             SendTaskMessage("收到PLC报警", MessageLevel.Error);
                         }
                         }
                         else
                         else
@@ -2543,8 +2896,20 @@ namespace TeamAAS_VP.Core
                                                     return;
                                                     return;
                                                 }
                                                 }
                                             }
                                             }
-                                            SendTaskMessage($"二维码扫码成功:{code}", MessageLevel.Info);
-                                            await plc.WriteNodeAsync(addressConfig.Out_QrCodePhotoResault.Address, (Int16)1);
+
+                                            bool _isSuccess = plc.WriteNode<string>(string.Format(addressConfig.In_Code.Address, 0), code);
+                                            if (_isSuccess)
+                                            {
+                                                SendTaskMessage($"二维码扫码成功:{code}", MessageLevel.Info);
+                                                await plc.WriteNodeAsync(addressConfig.Out_QrCodePhotoResault.Address, (Int16)1);
+                                            }
+                                            else
+                                            {
+                                                SendTaskMessage($"二维码扫码成功:{code}", MessageLevel.Info);
+                                                SendTaskMessage($"发送plc二维码失败:{code}", MessageLevel.Error);
+                                                await plc.WriteNodeAsync(addressConfig.Out_QrCodePhotoResault.Address, (Int16)2);
+                                            }
+
                                         }
                                         }
                                         else
                                         else
                                         {
                                         {
@@ -2568,8 +2933,13 @@ namespace TeamAAS_VP.Core
                                     code = plc.ReadNode<string>(string.Format(addressConfig.In_Code.Address, i));
                                     code = plc.ReadNode<string>(string.Format(addressConfig.In_Code.Address, i));
                                 }
                                 }
 
 
-                                productSn = code;
+                                //if (!(i == 0 || i == 7))
+                                //{
+                                //    return;
+                                //}
 
 
+                                productSn = code;
+                                SendTaskMessage($"收到plc信号{state}", MessageLevel.Debug);
                                 //询问mes
                                 //询问mes
                                 if (state == 1)
                                 if (state == 1)
                                 {
                                 {
@@ -2808,7 +3178,7 @@ namespace TeamAAS_VP.Core
                                                     //产品发生改变并且供料器发生了变化时,需要通知PLC进行取料更改
                                                     //产品发生改变并且供料器发生了变化时,需要通知PLC进行取料更改
                                                     await plc.WriteNodeAsync(addressConfig.Out_ScrewFeederIsChanged.Address, (Int16)1); //不发生改变
                                                     await plc.WriteNodeAsync(addressConfig.Out_ScrewFeederIsChanged.Address, (Int16)1); //不发生改变
                                                     await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)1);
                                                     await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)1);
-
+                                                    return;
                                                 }
                                                 }
                                                 else
                                                 else
                                                 {
                                                 {
@@ -2817,7 +3187,18 @@ namespace TeamAAS_VP.Core
 
 
                                                     //产品发生改变并且供料器发生了变化时,需要通知PLC进行取料更改
                                                     //产品发生改变并且供料器发生了变化时,需要通知PLC进行取料更改
                                                     await plc.WriteNodeAsync(addressConfig.Out_ScrewFeederIsChanged.Address, (Int16)1); //不发生改变
                                                     await plc.WriteNodeAsync(addressConfig.Out_ScrewFeederIsChanged.Address, (Int16)1); //不发生改变
-                                                    await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)2);
+                                                    if (models)
+                                                    {
+                                                        await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)3);
+                                                        SendTaskMessage($"发送plc信号3", MessageLevel.Debug);
+                                                        return;
+                                                    }
+                                                    else
+                                                    {
+                                                        await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)2);
+                                                        SendTaskMessage($"发送plc信号2", MessageLevel.Debug);
+                                                        return;
+                                                    }
                                                 }
                                                 }
                                             }
                                             }
                                             else
                                             else
@@ -2827,7 +3208,18 @@ namespace TeamAAS_VP.Core
 
 
                                                 //产品发生改变并且供料器发生了变化时,需要通知PLC进行取料更改
                                                 //产品发生改变并且供料器发生了变化时,需要通知PLC进行取料更改
                                                 await plc.WriteNodeAsync(addressConfig.Out_ScrewFeederIsChanged.Address, (Int16)1); //不发生改变
                                                 await plc.WriteNodeAsync(addressConfig.Out_ScrewFeederIsChanged.Address, (Int16)1); //不发生改变
-                                                await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)2);
+                                                if (models)
+                                                {
+                                                    await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)3);
+                                                    SendTaskMessage($"发送plc信号3", MessageLevel.Debug);
+                                                    return;
+                                                }
+                                                else
+                                                {
+                                                    await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)2);
+                                                    SendTaskMessage($"发送plc信号2", MessageLevel.Debug);
+                                                    return;
+                                                }
                                             }
                                             }
                                         }
                                         }
                                         LogHelper.WriteLogMes($"【mes结束QUERY】");
                                         LogHelper.WriteLogMes($"【mes结束QUERY】");
@@ -2845,6 +3237,7 @@ namespace TeamAAS_VP.Core
                                         SendTaskMessage($"未启用mes", MessageLevel.Info);
                                         SendTaskMessage($"未启用mes", MessageLevel.Info);
                                         await plc.WriteNodeAsync(addressConfig.Out_ScrewFeederIsChanged.Address, (Int16)1); //不发生改变
                                         await plc.WriteNodeAsync(addressConfig.Out_ScrewFeederIsChanged.Address, (Int16)1); //不发生改变
                                         await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)1);
                                         await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)1);
+                                        SendTaskMessage($"发送plc信号2", MessageLevel.Debug);
                                     }
                                     }
                                 }
                                 }
                                 // 上传本站数据
                                 // 上传本站数据
@@ -2854,6 +3247,7 @@ namespace TeamAAS_VP.Core
                                                 // string productccode = ProductMainSN[i];
                                                 // string productccode = ProductMainSN[i];
                                                 //获取当前工位的配置
                                                 //获取当前工位的配置
                                     var stationConfig = _configService.GetDeviceInfo(i);
                                     var stationConfig = _configService.GetDeviceInfo(i);
+                                    var sysConfig = _configService.GetSystemConfiguration();
                                     SendTaskMessage($"收到{i}:{stationConfig.DeviceName}上传本站数据请求...", MessageLevel.Debug);
                                     SendTaskMessage($"收到{i}:{stationConfig.DeviceName}上传本站数据请求...", MessageLevel.Debug);
                                     //从服务器中获取当前时间
                                     //从服务器中获取当前时间
                                     LogHelper.WriteLogMes($"【从服务器中获取当前时间】");
                                     LogHelper.WriteLogMes($"【从服务器中获取当前时间】");
@@ -2958,7 +3352,7 @@ namespace TeamAAS_VP.Core
                                                 MFG_ASSY_LINE = stationConfig.DataInfo.MFG_ASSY_LINE,
                                                 MFG_ASSY_LINE = stationConfig.DataInfo.MFG_ASSY_LINE,
                                                 PROCESS_OUTCOME = turnRes ? "PASS" : "FAIL",
                                                 PROCESS_OUTCOME = turnRes ? "PASS" : "FAIL",
                                                 PROCESS_MACHINE_ID = stationConfig.DataInfo.PROCESS_MACHINE_ID,
                                                 PROCESS_MACHINE_ID = stationConfig.DataInfo.PROCESS_MACHINE_ID,
-                                                CTQ_UNIT_OF_MEASURE = "圈",
+                                                CTQ_UNIT_OF_MEASURE = "Turn",
                                                 ERROR_MESSAGE = turnRes ? "NA" : "Turn_Spec OOS",
                                                 ERROR_MESSAGE = turnRes ? "NA" : "Turn_Spec OOS",
                                                 PD_ATTR_01 = ProductMainSN[i],
                                                 PD_ATTR_01 = ProductMainSN[i],
                                                 PD_ATTR_02 = midValue,
                                                 PD_ATTR_02 = midValue,
@@ -2986,7 +3380,7 @@ namespace TeamAAS_VP.Core
                                                 MFG_ASSY_LINE = stationConfig.DataInfo.MFG_ASSY_LINE,
                                                 MFG_ASSY_LINE = stationConfig.DataInfo.MFG_ASSY_LINE,
                                                 PROCESS_OUTCOME = pressureRes ? "PASS" : "FAIL",
                                                 PROCESS_OUTCOME = pressureRes ? "PASS" : "FAIL",
                                                 PROCESS_MACHINE_ID = stationConfig.DataInfo.PROCESS_MACHINE_ID,
                                                 PROCESS_MACHINE_ID = stationConfig.DataInfo.PROCESS_MACHINE_ID,
-                                                CTQ_UNIT_OF_MEASURE = "N",
+                                                CTQ_UNIT_OF_MEASURE = "kg",
                                                 ERROR_MESSAGE = pressureRes ? "NA" : "Pressure_Spec OOS",
                                                 ERROR_MESSAGE = pressureRes ? "NA" : "Pressure_Spec OOS",
                                                 PD_ATTR_01 = ProductMainSN[i],
                                                 PD_ATTR_01 = ProductMainSN[i],
                                                 PD_ATTR_02 = midValue,
                                                 PD_ATTR_02 = midValue,
@@ -3060,6 +3454,13 @@ namespace TeamAAS_VP.Core
                                     //上传mes
                                     //上传mes
                                     if (stationConfig.EnableMES)
                                     if (stationConfig.EnableMES)
                                     {
                                     {
+
+                                        //测试使用,强制上传mes为pass
+                                        if (sysConfig.IsMesResult)
+                                        {
+                                            resultToMes.Clear();
+                                        }
+
                                         (bool isSuccess, string response) = await _mesService.SubmitGetExAsync(ProductMainSN[i], "", dataToMes, resultToMes, _LastMesCheckTime[i], serverTimeResult.Now);
                                         (bool isSuccess, string response) = await _mesService.SubmitGetExAsync(ProductMainSN[i], "", dataToMes, resultToMes, _LastMesCheckTime[i], serverTimeResult.Now);
                                         if (isSuccess)
                                         if (isSuccess)
                                         {
                                         {
@@ -3198,10 +3599,182 @@ namespace TeamAAS_VP.Core
                                     LogHelper.WriteLogMes($"【mes结束ADD】");
                                     LogHelper.WriteLogMes($"【mes结束ADD】");
                                     SendTaskMessage($"mes结束ADD", MessageLevel.Info);
                                     SendTaskMessage($"mes结束ADD", MessageLevel.Info);
                                 }
                                 }
+                                //kb 螺丝站位询问mes 具体需求跟plc对接
+                                else if (state == 5)
+                                {
+
+                                    SendTaskMessage($"收到KB Screw站点{i}过站检查请求(当站是否生产)...", MessageLevel.Debug);
+                                    //获取过站时间
+                                    _LastMesCheckTime[i] = (await _mesService.GetServerTimeAsync(i, code, 2)).Now;
+                                    if (_configService.GetDeviceInfo().EnableMES)
+                                    {
+                                        LogHelper.WriteLogMes($"【mes开始QUERY】");
+                                        SendTaskMessage($"mes开始QUERY", MessageLevel.Info);
+
+                                        SendTaskMessage($"基于RFID询问是否过站", MessageLevel.Debug);
+                                        (bool isSuccess, string response) = await _mesService.StationGetExAsync(code, "", 2);
+                                        //如果成功的话就代表跟正常mes询问一样,当前站需工作
+                                        if (isSuccess)
+                                        {
+                                            string ProductMainSN_Temp = "";
+                                            LogHelper.WriteLogMes($"询问mes成功");
+                                            SendTaskMessage($"询问mes成功:{response}", MessageLevel.Debug);
+                                            string[] item = response.Split('\n');
+                                            //获取过度件sn
+                                            string snItem = item.FirstOrDefault(f => f.Contains("sn="));
+                                            if (snItem != null)
+                                            {
+                                                ProductMainSN_Temp = snItem.Replace("sn=", "").Trim();
+                                                SendTaskMessage($"过度件sn:{ProductMainSN_Temp}", MessageLevel.Info);
+                                            }
+
+                                            LogHelper.WriteLogMes($"询问mes成功");
+                                            SendTaskMessage($"询问mes成功:{response}", MessageLevel.Debug);
+
+                                            (bool isSuccess2, string response2) = await _mesService.StationGetAsync(ProductMainSN_Temp, "", 2);//询问mes
+                                            if (isSuccess2)
+                                            {
+
+                                                item = response2.Split('\n');
+                                                snItem = item.FirstOrDefault(f => f.Contains("sn="));
+                                                if (snItem != null)
+                                                {
+                                                    ProductMainSN[i] = snItem.Replace("sn=", "").Trim();
+                                                    if (i == 0)
+                                                    {
+                                                        _productService.CurrentProductCode = ProductMainSN[i];
+                                                    }
+                                                    SendTaskMessage($"产品主sn:{ProductMainSN[i]}", MessageLevel.Info);
+                                                }
+                                                string woItem = item.FirstOrDefault(f => f.Contains("wo="));
+                                                if (woItem != null)
+                                                {
+                                                    wo[i] = woItem.Replace("wo=", "").Trim();
+                                                    SendTaskMessage($"工单信息:{wo[i]}", MessageLevel.Info);
+                                                }
+                                                string modelItem = item.FirstOrDefault(f => f.Contains("model_num="));
+                                                if (modelItem != null)
+                                                {
+                                                    model_num[i] = modelItem.Replace("model_num=", "").Trim();
+                                                    SendTaskMessage($"model_num:{model_num[i]}", MessageLevel.Info);
+                                                }
+                                                string colorItem = item.FirstOrDefault(f => f.Contains("color="));
+                                                if (colorItem != null)
+                                                {
+                                                    color[i] = colorItem.Replace("color=", "").Trim();
+                                                    SendTaskMessage($"color:{color[i]}", MessageLevel.Info);
+                                                }
+                                                string ppidItem = item.FirstOrDefault(f => f.Contains("ppid="));
+                                                if (ppidItem != null)
+                                                {
+                                                    ppid[i] = ppidItem.Replace("ppid=", "").Trim();
+                                                    SendTaskMessage($"ppid:{ppid[i]}", MessageLevel.Info);
+                                                }
+                                                string revisionItem = item.FirstOrDefault(f => f.Contains("stage="));
+                                                if (revisionItem != null)
+                                                {
+                                                    revision[i] = revisionItem.Replace("stage=", "").Trim();
+                                                    SendTaskMessage($"stage:{revision[i]}", MessageLevel.Info);
+                                                }
+
+                                                LogHelper.WriteLogMes($"第二次询问mes成功");
+                                                SendTaskMessage($"第二次询问mes成功:{response2}", MessageLevel.Debug);
+
+                                                //切换产品
+                                                if (i == 0)//i=0时才会切换产品
+                                                {
+                                                    var q = await _systemDatabaseService.QueryProductFromMesAsync(model_num[i], color[i]);
+                                                    if (q != null && !string.IsNullOrEmpty(q.ProductName))
+                                                    {
+                                                        ProductList = new ObservableCollection<ProductModel>(_productService.GetAllProducts());
+                                                        Guid productId = Guid.Empty;
+                                                        foreach (var itt in ProductList)
+                                                        {
+                                                            if (itt.Name == q.ProductName)
+                                                            {
+                                                                productId = itt.ID;
+                                                                break;
+                                                            }
+                                                        }
+                                                        if (currentProduct.ID != productId)
+                                                        {
+                                                            //切换产品
+                                                            await _productService.LoadProductAsync(productId);
+                                                            _productService.SetCurrentProduct(productId);
+                                                            await WriteParameterToPlcExAsync();
+                                                            SendTaskMessage($"切换产品成功", MessageLevel.Debug);
+                                                        }
+                                                    }
+                                                }
+
+                                                //产品发生改变并且供料器发生了变化时,需要通知PLC进行取料更改
+                                                await plc.WriteNodeAsync(addressConfig.Out_ScrewFeederIsChanged.Address, (Int16)1); //不发生改变
+                                                await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)1);
+
+                                            }
+                                            else
+                                            {
+                                                LogHelper.WriteLogMes($"第二次询问mes失败");
+                                                SendTaskMessage($"第二次询问mes失败:{response2}", MessageLevel.Error);
+
+                                                //产品发生改变并且供料器发生了变化时,需要通知PLC进行取料更改
+                                                await plc.WriteNodeAsync(addressConfig.Out_ScrewFeederIsChanged.Address, (Int16)1); //不发生改变
+                                                if (models)
+                                                {
+                                                    await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)3);
+                                                }
+                                                else
+                                                {
+                                                    await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)2);
+                                                }
+                                            }
+                                        }
+                                        else
+                                        {
+                                            LogHelper.WriteLogMes($"询问mes失败");
+                                            SendTaskMessage($"询问mes失败:{response}", MessageLevel.Error);
+
+                                            //产品发生改变并且供料器发生了变化时,需要通知PLC进行取料更改
+                                            await plc.WriteNodeAsync(addressConfig.Out_ScrewFeederIsChanged.Address, (Int16)1); //不发生改变
+
+                                            //表示前面的kb screw站点已经打完螺丝并且过站成功到3d aoi,根据plc的需求直接放行
+                                            if (response.Contains("3D AOI"))
+                                            {
+                                                await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)2);
+                                                return;
+                                            }
+                                            //表示kb组装 站点ng  具体写入型号跟plc对接
+                                            else if (response.Contains("C_KB_Link"))
+                                            {
+                                                await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)5);
+                                                return;
+                                            }
+                                            // 后面还有一些判断条件也需跟当前AE对接
+                                            await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)2);
+                                        }
+
+                                        LogHelper.WriteLogMes($"【mes结束QUERY】");
+                                        SendTaskMessage($"mes结束QUERY", MessageLevel.Info);
+                                    }
+                                    else
+                                    {
+                                        ProductMainSN[i] = DateTime.Now.ToString("yyyyMMddHHmmssfff");
+                                        if (i == 0)
+                                        {
+                                            _productService.CurrentProductCode = ProductMainSN[i];
+                                        }
+
+                                        LogHelper.WriteLogMes($"【未启用mes】");
+                                        SendTaskMessage($"未启用mes", MessageLevel.Info);
+                                        await plc.WriteNodeAsync(addressConfig.Out_ScrewFeederIsChanged.Address, (Int16)1); //不发生改变
+                                        await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)1);
+                                    }
+                                }
                                 else
                                 else
                                 {
                                 {
                                     SendTaskMessage($"{i}过站检查信号:state={state},处理为默认状态", MessageLevel.Alarm);
                                     SendTaskMessage($"{i}过站检查信号:state={state},处理为默认状态", MessageLevel.Alarm);
                                     await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)0);
                                     await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)0);
+                                    return;
                                 }
                                 }
                                // _LastMesCheck[i] = 0;
                                // _LastMesCheck[i] = 0;
                             }
                             }
@@ -3286,7 +3859,9 @@ namespace TeamAAS_VP.Core
             bool mesStatus = IsMesReady();
             bool mesStatus = IsMesReady();
             bool paraStatus = IsParameterReady();
             bool paraStatus = IsParameterReady();
 
 
-            if (connectStatus && mesStatus && paraStatus)
+            var curUser = _systemDatabaseService.GetCurrentUser();
+
+            if (connectStatus && mesStatus && paraStatus && curUser.userPart == UserPart.Operator)
             {
             {
                 return RunDisplayMode.Auto;
                 return RunDisplayMode.Auto;
             }
             }
@@ -3736,6 +4311,97 @@ namespace TeamAAS_VP.Core
         }
         }
         #endregion
         #endregion
 
 
+        #region 拍螺丝数据保存csv
+        /// <summary>
+        /// 通用方法:将存储XYU的字典导出为规范CSV文件
+        /// </summary>
+        /// <param name="dataDict">存储XYU的字典</param>
+        /// <param name="savePath">CSV文件保存路径</param>
+        /// <param name="appendMode">是否追加模式(true=每次运行新增一行,false=覆盖原有文件)</param>
+        /// <param name="decimalPlaces">数值保留的小数位数(默认4位,适配工业视觉精度)</param>
+        static void ExportDictionaryToCsv(Dictionary<string, double> dataDict, string savePath, bool appendMode = false, int decimalPlaces = 4)
+        {
+            // 自动创建目录(避免路径不存在报错)
+            string directory = Path.GetDirectoryName(savePath);
+            if (!Directory.Exists(directory))
+            {
+                Directory.CreateDirectory(directory);
+            }
+
+            // 构建CSV内容
+            StringBuilder csvContent = new StringBuilder();
+
+            // 处理表头:仅当文件不存在/非追加模式时,才写入表头
+            if (!appendMode || !File.Exists(savePath))
+            {
+                csvContent.AppendLine(string.Join(",", dataDict.Keys));
+            }
+
+            // 处理数据行:按指定小数位数格式化数值
+            List<string> formattedValues = new List<string>();
+            foreach (var value in dataDict.Values)
+            {
+                formattedValues.Add(Math.Round(value, decimalPlaces).ToString());
+            }
+            csvContent.AppendLine(string.Join(",", formattedValues));
+
+            // 写入文件:UTF-8带BOM编码,Excel打开无乱码
+            if (appendMode)
+            {
+                // 追加模式:在文件末尾新增内容
+                File.AppendAllText(savePath, csvContent.ToString(), Encoding.UTF8);
+            }
+            else
+            {
+                // 覆盖模式:新建/替换文件
+                File.WriteAllText(savePath, csvContent.ToString(), Encoding.UTF8);
+            }
+        }
+
+        public bool ExportDictionaryToCsv1(string rfid, double x, double y, double u)
+        {
+            try
+            {
+                DateTime dt = DateTime.Now;
+                if (rfid == null || rfid.Count() == 0)
+                {
+                    rfid = dt.ToString("MM-dd-mm");
+                }
+                string path = $"D:\\视觉检测数据XYU数据\\{dt.ToString("yyyy-MM")}\\{dt.ToString("yyyy-MM-dd")}\\{rfid}.csv";
+                StringBuilder sb = new StringBuilder();
+                sb.AppendLine($"SN,X,Y,U");
+                sb.AppendLine();
+                sb.AppendLine($"{rfid},{x},{y},{u}");
+                sb.AppendLine();
+                if (!Directory.Exists(Path.GetDirectoryName(path)))   //判断文件夹是否
+                {
+                    Directory.CreateDirectory(Path.GetDirectoryName(path));    //创建文件夹
+                }
+                if (File.Exists(path))
+                {
+                    // 使用 StreamWriter 以追加模式打开文件
+                    StreamWriter sw = new StreamWriter(path, true, Encoding.UTF8);
+                    sw.WriteLine(sb.ToString().TrimEnd(','));
+                    //sw.WriteLine(sb1.ToString().TrimEnd(','));
+                    sw.Close();
+                    sw.Dispose();
+                }
+                else
+                {
+                    StreamWriter sw = new StreamWriter(path, true, Encoding.UTF8);
+                    sw.WriteLine(sb.ToString().TrimEnd(','));
+                    sw.Close();
+                    sw.Dispose();
+                }
+                return true;
+            }
+            catch (Exception ex)
+            {
+                LogHelper.WriteLogError("写入产品记录时出错!", ex);
+                return false;
+            }
+        }
+        #endregion
         #region 产品锁付记录进行存储
         #region 产品锁付记录进行存储
         /// <summary>
         /// <summary>
         /// 产品锁付记录进行存储
         /// 产品锁付记录进行存储
@@ -4189,6 +4855,58 @@ namespace TeamAAS_VP.Core
 
 
         #endregion
         #endregion
 
 
+        /// <summary>
+        /// 后台报警刷新显示(适配PLC结构化变量名Bool点位 OPC版)
+        /// 完全沿用你原有循环结构、防抖逻辑、UI报警推送规则
+        /// </summary>
+        public void SendAlarmToUi(OpcUaClientPLC plc)
+        {
+            PlcExcelLoad loadData = new PlcExcelLoad();
+            loadData.LoadData(6);
+
+            // 增加报警状态缓存,防止循环重复刷屏报警
+            Dictionary<string, bool> alarmLastState = new Dictionary<string, bool>();
+            foreach (var alarm in loadData.AlaemList)
+            {
+                alarmLastState.Add(alarm.OpcAddress, true);
+            }
+
+            Task.Run(() =>
+            {
+                while (true)
+                {
+                    try
+                    {
+                        Thread.Sleep(50);
+
+                        foreach (var alarm in loadData.AlaemList)
+                        {
+                            // 调用你封装好的OPC读取Bool方法
+                            bool plcState = plc.ReadBoolNode(alarm.OpcAddress);
+
+                            // 上升沿防抖:只有状态从正常→异常(false)变化时,才推送一次报警
+                            if (!plcState && alarmLastState[alarm.OpcAddress])
+                            {
+                                SendTaskMessage($"PLC报警信息:{alarm.Name}", MessageLevel.Error);
+                                LogHelper.WriteLogPlcWarn($"PLC报警信息:{alarm.Name}");
+                                alarmLastState[alarm.OpcAddress] = false;
+                            }
+                            // 报警复位:状态恢复正常,重置缓存
+                            else if (plcState && !alarmLastState[alarm.OpcAddress])
+                            {
+                                alarmLastState[alarm.OpcAddress] = true;
+                            }
+                        }
+                    }
+                    catch
+                    {
+                        Thread.Sleep(200);
+                    }
+                }
+            });
+        }
+
+
         #endregion
         #endregion
     }
     }
 }
 }

+ 19 - 0
TeamAAS-VM/Core/PLCs/OPCuaClientPLC.cs

@@ -285,6 +285,25 @@ namespace TeamAAS_VP.Core.PLCs
             return result;
             return result;
         }
         }
 
 
+        /// <summary>
+        /// 读取单个PLC Bool布尔节点值
+        /// </summary>
+        /// <param name="nodeId">Excel里PLC变量名 Stop.XXX</param>
+        /// <returns>bool类型真实状态</returns>
+        public bool ReadBoolNode(string nodeId)
+        {
+            string readNodeId = nodeId;
+            if (!nodeId.StartsWith(NodeHeader))
+            {
+                readNodeId = NodeHeader + nodeId;
+            }
+
+            var value = OpcUaClient.ReadNode(new NodeId(readNodeId));
+            // 安全转换为布尔类型
+            return Convert.ToBoolean(value.Value);
+        }
+
+
         /// <summary>
         /// <summary>
         /// 读取单个节点的值
         /// 读取单个节点的值
         /// </summary>
         /// </summary>

+ 2 - 2
TeamAAS-VM/Data/DatabaseInitializer.cs

@@ -37,8 +37,8 @@ namespace TeamAAS_VP.Data
                 var userCount = _db.Queryable<User>().Count();
                 var userCount = _db.Queryable<User>().Count();
                 if (userCount == 0)
                 if (userCount == 0)
                 {
                 {
-                    var op = new User { UserName = "操作员", UserPassword = "123", userPart = Enums.UserPart.Operator, CreateTime = DateTime.Now, IsRemember = false };
-                    var eng = new User { UserName = "工程师", UserPassword = "123", userPart = Enums.UserPart.Engineer, CreateTime = DateTime.Now, IsRemember = false };
+                    var op = new User { UserName = "操作员", UserPassword = "", userPart = Enums.UserPart.Operator, CreateTime = DateTime.Now, IsRemember = false };
+                    var eng = new User { UserName = "工程师", UserPassword = "10086", userPart = Enums.UserPart.Engineer, CreateTime = DateTime.Now, IsRemember = false };
                     var admin = new User { UserName = "管理员", UserPassword = "team123456", userPart = Enums.UserPart.Administrator, CreateTime = DateTime.Now, IsRemember = false };
                     var admin = new User { UserName = "管理员", UserPassword = "team123456", userPart = Enums.UserPart.Administrator, CreateTime = DateTime.Now, IsRemember = false };
                     _db.Insertable(new List<User> { op, eng, admin }).ExecuteCommand();
                     _db.Insertable(new List<User> { op, eng, admin }).ExecuteCommand();
                 }
                 }

+ 4 - 0
TeamAAS-VM/Data/SystemDatabaseService.cs

@@ -563,6 +563,10 @@ namespace TeamAAS_VP.Data
 
 
         }
         }
 
 
+
+
+
+
         /// <summary>
         /// <summary>
         /// 获取指定产品名称的一个星期内按照每天统计对应的类别和数量
         /// 获取指定产品名称的一个星期内按照每天统计对应的类别和数量
         /// </summary>
         /// </summary>

+ 23 - 0
TeamAAS-VM/Interfaces/IRemoteCommandService.cs

@@ -249,6 +249,29 @@ namespace TeamAAS_VP.Interfaces
         /// <returns></returns>
         /// <returns></returns>
         bool ExecutePhoto(int index, ProcedureModel procedure, out CogToolBlockTerminalCollection outputCollection);
         bool ExecutePhoto(int index, ProcedureModel procedure, out CogToolBlockTerminalCollection outputCollection);
 
 
+        /// <summary>
+        /// 执行翻转相机拍照流程运行
+        /// </summary>
+        /// <param name="procedure"></param>
+        /// <param name="outputCollection"></param>
+        /// <returns></returns>
+        bool ExecutePhotoGetDistance(ProcedureModel procedure, Dictionary<string, string> InputTerminal);
+
+
+        /// <summary>
+        /// 执行相机拍照螺丝点位结果
+        /// </summary>
+        /// <param name="procedure"></param>
+        /// <param name="InputTerminal"></param>
+        /// <param name="robotCoord"></param>
+        /// <param name="cancellationToken"></param>
+        /// <param name="positionIndex"></param>
+        /// <param name="remark"></param>
+        /// <returns></returns>
+        Task<(bool IsSucceed, double X, double Y, double U)> ExecutePhotoGetSinglePoint1(ProcedureModel procedure, Dictionary<string, string> InputTerminal, double[] robotCoord, CancellationToken cancellationToken, int positionIndex, int num, string remark, ImageParameters imgPara);
+
+
+
         /// <summary>
         /// <summary>
         /// 执行相机拍照获取单个点位结果
         /// 执行相机拍照获取单个点位结果
         /// </summary>
         /// </summary>

+ 1 - 1
TeamAAS-VM/LogHelper.cs

@@ -35,7 +35,7 @@ namespace TeamAAS_VP
             }
             }
         }
         }
 
 
-        public static void WriteLogWarn(string info)
+        public static void WriteLogPlcWarn(string info)
         {
         {
             if (logwarn.IsWarnEnabled)
             if (logwarn.IsWarnEnabled)
             {
             {

+ 26 - 1
TeamAAS-VM/Models/CTQ_Data.cs

@@ -117,6 +117,25 @@ namespace TeamAAS_VP.Models
         /// </summary>
         /// </summary>
         public string PROCESS_MACHINE_ID { get => _PROCESS_MACHINE_ID; set => SetProperty(ref _PROCESS_MACHINE_ID, value); }
         public string PROCESS_MACHINE_ID { get => _PROCESS_MACHINE_ID; set => SetProperty(ref _PROCESS_MACHINE_ID, value); }
 
 
+        private string _Screwsize1;
+        /// <summary>
+        /// 螺丝型号1
+        /// </summary>
+        public string Screwsize1 { get => _Screwsize1; set => SetProperty(ref _Screwsize1, value); }
+
+        private string _Screwsize2;
+        /// <summary>
+        /// 螺丝型号2
+        /// </summary>
+        public string Screwsize2 { get => _Screwsize2; set => SetProperty(ref _Screwsize2, value); }
+
+
+        private string _Screwsize3;
+        /// <summary>
+        /// 螺丝型号3
+        /// </summary>
+        public string Screwsize3 { get => _Screwsize3; set => SetProperty(ref _Screwsize3, value); }
+
         private string _CTQ_UNIT_OF_MEASURE;
         private string _CTQ_UNIT_OF_MEASURE;
         /// <summary>
         /// <summary>
         /// 单位
         /// 单位
@@ -149,6 +168,9 @@ namespace TeamAAS_VP.Models
             PROCESS_MACHINE_ID = string.Empty;
             PROCESS_MACHINE_ID = string.Empty;
             CTQ_UNIT_OF_MEASURE = string.Empty;
             CTQ_UNIT_OF_MEASURE = string.Empty;
             ERROR_MESSAGE = string.Empty;
             ERROR_MESSAGE = string.Empty;
+            Screwsize1= string.Empty;
+            Screwsize2= string.Empty;
+            Screwsize3 = string.Empty;
         }
         }
 
 
         public CTQ_Data Copy()
         public CTQ_Data Copy()
@@ -172,7 +194,10 @@ namespace TeamAAS_VP.Models
                 PROCESS_OUTCOME = this.PROCESS_OUTCOME,
                 PROCESS_OUTCOME = this.PROCESS_OUTCOME,
                 PROCESS_MACHINE_ID = this.PROCESS_MACHINE_ID,
                 PROCESS_MACHINE_ID = this.PROCESS_MACHINE_ID,
                 CTQ_UNIT_OF_MEASURE = this.CTQ_UNIT_OF_MEASURE,
                 CTQ_UNIT_OF_MEASURE = this.CTQ_UNIT_OF_MEASURE,
-                ERROR_MESSAGE = this.ERROR_MESSAGE
+                ERROR_MESSAGE = this.ERROR_MESSAGE,
+                Screwsize1=this.Screwsize1,
+                Screwsize2 = this.Screwsize2,
+                Screwsize3 = this.Screwsize3
             };
             };
         }
         }
 
 

+ 15 - 0
TeamAAS-VM/Models/DeviceInfo.cs

@@ -51,6 +51,12 @@ namespace TeamAAS_VP.Models
         /// </summary>
         /// </summary>
         public bool EnableMES { get => _enableMes; set => SetProperty(ref _enableMes, value); }
         public bool EnableMES { get => _enableMes; set => SetProperty(ref _enableMes, value); }
 
 
+        private bool _enableXY;
+        /// <summary>
+        /// 是否启用锁螺丝XY超限 通讯功能,默认不启用
+        /// </summary>
+        public bool EnableXY { get => _enableXY; set => SetProperty(ref _enableXY, value); }
+
         private string _mesUrl;
         private string _mesUrl;
         /// <summary>
         /// <summary>
         /// URL
         /// URL
@@ -89,6 +95,12 @@ namespace TeamAAS_VP.Models
         /// </summary>
         /// </summary>
         public bool SaveCsv { get => _saveCsv; set => SetProperty(ref _saveCsv, value); }
         public bool SaveCsv { get => _saveCsv; set => SetProperty(ref _saveCsv, value); }
 
 
+        private bool _ScrewOverrun;
+        /// <summary>
+        /// 是否保存CSV文件,默认不保存
+        /// </summary>
+        public bool ScrewOverrun { get => _ScrewOverrun; set => SetProperty(ref _ScrewOverrun, value); }
+
         private bool _saveCsvPPID;
         private bool _saveCsvPPID;
         /// <summary>
         /// <summary>
         /// 是否保存CSV文件的PPID,默认不保存
         /// 是否保存CSV文件的PPID,默认不保存
@@ -127,6 +139,7 @@ namespace TeamAAS_VP.Models
             LogUrl = string.Empty;
             LogUrl = string.Empty;
             ApiKey = string.Empty;
             ApiKey = string.Empty;
             EnableMES = false;
             EnableMES = false;
+            EnableXY = false;
             SaveCsvPPID = true;
             SaveCsvPPID = true;
         }
         }
 
 
@@ -144,7 +157,9 @@ namespace TeamAAS_VP.Models
                 comp = this.comp,
                 comp = this.comp,
                 MesUrl = this.MesUrl,
                 MesUrl = this.MesUrl,
                 EnableMES = this.EnableMES,
                 EnableMES = this.EnableMES,
+                EnableXY = this.EnableXY,
                 SaveCsv = this.SaveCsv,
                 SaveCsv = this.SaveCsv,
+                ScrewOverrun=this.ScrewOverrun,
                 SaveCsvPath = this.SaveCsvPath,
                 SaveCsvPath = this.SaveCsvPath,
                 //EnableDoubleMes = this.EnableDoubleMes,
                 //EnableDoubleMes = this.EnableDoubleMes,
                 DataInfo = this.DataInfo.Copy(),
                 DataInfo = this.DataInfo.Copy(),

+ 103 - 1
TeamAAS-VM/Models/PLC/PlcAddressConfig.cs

@@ -12,6 +12,14 @@ namespace TeamAAS_VP.Models.PLC
     public class PlcAddressConfig : BindableBase
     public class PlcAddressConfig : BindableBase
     {
     {
         #region 写入到PLC的地址
         #region 写入到PLC的地址
+
+        private PlcAddress _Out_PlcFail;
+        public PlcAddress Out_PlcFail
+        {
+            get { return _Out_PlcFail; }
+            set { SetProperty(ref _Out_PlcFail, value); }
+        }
+
         private int _PlcNo;
         private int _PlcNo;
         public int PlcNo
         public int PlcNo
         {
         {
@@ -139,6 +147,27 @@ namespace TeamAAS_VP.Models.PLC
             set { SetProperty(ref _DownCameraStatus, value); }
             set { SetProperty(ref _DownCameraStatus, value); }
         }
         }
 
 
+        private PlcAddress _AddScrewView = new PlcAddress();
+        /// <summary>
+        /// 下相机拍照结果 =1 拍照OK =2 拍照NG =3 取图拍照OK
+        /// </summary>
+        public PlcAddress Out_AddScrewView
+        {
+            get { return _AddScrewView; }
+            set { SetProperty(ref _AddScrewView, value); }
+        }
+
+
+        private PlcAddress _Out_Screw_check_status;
+        /// <summary>
+        /// 相机拍照螺丝的结果,1:OK,2:NG
+        /// </summary>
+        public PlcAddress Out_Screw_check_status
+        {
+            get { return _Out_Screw_check_status; }
+            set { SetProperty(ref _Out_Screw_check_status, value); }
+        }
+
         private PlcAddress _UpCameraPickStatus = new PlcAddress();
         private PlcAddress _UpCameraPickStatus = new PlcAddress();
         /// <summary>
         /// <summary>
         /// 上相机取料拍照结果 =1 拍照OK =2 拍照NG =3 取图拍照OK
         /// 上相机取料拍照结果 =1 拍照OK =2 拍照NG =3 取图拍照OK
@@ -198,7 +227,17 @@ namespace TeamAAS_VP.Models.PLC
             get { return _FixedCameracheckStatus; }
             get { return _FixedCameracheckStatus; }
             set { SetProperty(ref _FixedCameracheckStatus, value); }
             set { SetProperty(ref _FixedCameracheckStatus, value); }
         }
         }
-    
+
+        private PlcAddress _FzCameraPickStatus = new PlcAddress();
+        /// <summary>
+        /// 固定相机取料拍照结果 =1 拍照OK =2 拍照NG =3 取图拍照OK
+        /// </summary>
+        public PlcAddress Out_FzCameraPickStatus
+        {
+            get { return _FzCameraPickStatus; }
+            set { SetProperty(ref _FzCameraPickStatus, value); }
+        }
+
         private PlcAddress _Out_CameraDone = new PlcAddress();
         private PlcAddress _Out_CameraDone = new PlcAddress();
         /// <summary>
         /// <summary>
         /// 相机坐标拟合完成
         /// 相机坐标拟合完成
@@ -432,6 +471,15 @@ namespace TeamAAS_VP.Models.PLC
             set { _Manu_ZAxis_Velocity = value; }
             set { _Manu_ZAxis_Velocity = value; }
         }
         }
 
 
+        private PlcAddress _PC_code = new PlcAddress();
+        /// <summary>
+        /// 发送plc流程码
+        /// </summary>
+        public PlcAddress Out_PC_code
+        {
+            get { return _PC_code; }
+            set { SetProperty(ref _PC_code, value); }
+        }
         #endregion
         #endregion
 
 
         #region 从PLC读取的地址
         #region 从PLC读取的地址
@@ -684,6 +732,16 @@ namespace TeamAAS_VP.Models.PLC
             set { SetProperty(ref _In_ScrewTeachExe, value); }
             set { SetProperty(ref _In_ScrewTeachExe, value); }
         }
         }
 
 
+        private PlcAddress _In_Screw_checkExe;
+        /// <summary>
+        /// 触发相机拍照螺丝复检
+        /// </summary>
+        public PlcAddress In_Screw_checkExe
+        {
+            get { return _In_Screw_checkExe; }
+            set { SetProperty(ref _In_Screw_checkExe, value); }
+        }
+
         private PlcAddress _In_PickINC;
         private PlcAddress _In_PickINC;
         /// <summary>
         /// <summary>
         /// 取一颗螺丝出发信号
         /// 取一颗螺丝出发信号
@@ -772,6 +830,16 @@ namespace TeamAAS_VP.Models.PLC
             set { SetProperty(ref _Fault, value); }
             set { SetProperty(ref _Fault, value); }
         }
         }
 
 
+        private PlcAddress _In_FzCameraPixExe = new PlcAddress();
+        /// <summary>
+        /// 翻转相机触发拍照
+        /// </summary>
+        public PlcAddress In_FzCameraPixExe
+        {
+            get { return _In_FzCameraPixExe; }
+            set { SetProperty(ref _In_FzCameraPixExe, value); }
+        }
+
         #endregion
         #endregion
 
 
         public PlcAddressConfig()
         public PlcAddressConfig()
@@ -863,6 +931,16 @@ namespace TeamAAS_VP.Models.PLC
             Out_DownCameraStatus.DataType = "int16";
             Out_DownCameraStatus.DataType = "int16";
             Out_DownCameraStatus.Description = Lang.下相机拍照结果1拍照OK2拍照NG3取图拍照OK;
             Out_DownCameraStatus.Description = Lang.下相机拍照结果1拍照OK2拍照NG3取图拍照OK;
 
 
+            Out_AddScrewView = Ensure(Out_AddScrewView);
+            Out_AddScrewView.Address = "ns=4;s=DB_Communication|FromPC.Out_AddScrewView";
+            Out_AddScrewView.DataType = "int16";
+            Out_AddScrewView.Description = Lang.添加螺丝型号结果1成功2失败;
+
+            Out_Screw_check_status = Ensure(Out_Screw_check_status);
+            Out_Screw_check_status.Address = "ns=4;s=DB_Communication|FromPC.Screw_check_status";
+            Out_Screw_check_status.DataType = "int16";
+            Out_Screw_check_status.Description = Lang.相机拍照螺丝复检的结果1OK2NG;
+
             Out_UpCameraPickStatus = Ensure(Out_UpCameraPickStatus);
             Out_UpCameraPickStatus = Ensure(Out_UpCameraPickStatus);
             Out_UpCameraPickStatus.Address = "ns=4;s=DB_Communication|FromPC.UpCameraPickStatus";
             Out_UpCameraPickStatus.Address = "ns=4;s=DB_Communication|FromPC.UpCameraPickStatus";
             Out_UpCameraPickStatus.DataType = "int16";
             Out_UpCameraPickStatus.DataType = "int16";
@@ -913,6 +991,10 @@ namespace TeamAAS_VP.Models.PLC
             Check_ScrewTorque.DataType = "Bool";
             Check_ScrewTorque.DataType = "Bool";
             Check_ScrewTorque.Description = "电批正转";
             Check_ScrewTorque.Description = "电批正转";
 
 
+            Out_PC_code = Ensure(Out_PC_code);
+            Out_PC_code.Address = "ns=4;s=DB_Communication|FromPC.PC_code[{0}]";
+            Out_PC_code.DataType = "string";
+            Out_PC_code.Description = "发送plc流程码";
             //首先到废料桶上方投料
             //首先到废料桶上方投料
             //有三个示教的地方
             //有三个示教的地方
             //
             //
@@ -972,6 +1054,11 @@ namespace TeamAAS_VP.Models.PLC
             Screw_Backward.DataType = "Bool";
             Screw_Backward.DataType = "Bool";
             Screw_Backward.Description = "电批反转";
             Screw_Backward.Description = "电批反转";
 
 
+            Out_FzCameraPickStatus = Ensure(Out_FzCameraPickStatus);
+            Out_FzCameraPickStatus.Address = "ns=4;s=DB_Communication|FromPC.FzCameraPickStatus";
+            Out_FzCameraPickStatus.DataType = "int16";
+            Out_FzCameraPickStatus.Description = "翻转相机取料拍照结果 =1 拍照OK =2 拍照NG =3 取图拍照OK";
+
             // Out_PickCamera 初始化并赋地址
             // Out_PickCamera 初始化并赋地址
             Out_PickCamera = EnsurePoint(Out_PickCamera);
             Out_PickCamera = EnsurePoint(Out_PickCamera);
             Out_PickCamera.Description = Lang.取料拍照点位参数;
             Out_PickCamera.Description = Lang.取料拍照点位参数;
@@ -1242,6 +1329,11 @@ namespace TeamAAS_VP.Models.PLC
             In_ScrewTeachExe.DataType = "bool";
             In_ScrewTeachExe.DataType = "bool";
             In_ScrewTeachExe.Description = Lang.触发披头视觉矫正;
             In_ScrewTeachExe.Description = Lang.触发披头视觉矫正;
 
 
+            In_Screw_checkExe = Ensure(In_Screw_checkExe);
+            In_Screw_checkExe.Address = "ns=4;s=DB_Communication|ToPC.Screw_checkExe";
+            In_Screw_checkExe.DataType = "bool";
+            In_Screw_checkExe.Description = Lang.触发相机拍照螺丝复检;
+
             In_PickINC = Ensure(In_PickINC);
             In_PickINC = Ensure(In_PickINC);
             In_PickINC.Address = "ns=4;s=DB_Communication|ToPC.PickINC";
             In_PickINC.Address = "ns=4;s=DB_Communication|ToPC.PickINC";
             In_PickINC.DataType = "int16";
             In_PickINC.DataType = "int16";
@@ -1294,6 +1386,16 @@ namespace TeamAAS_VP.Models.PLC
             Fault.DataType = "Bool";
             Fault.DataType = "Bool";
             Fault.Description = "报警";
             Fault.Description = "报警";
 
 
+            In_FzCameraPixExe = Ensure(In_FzCameraPixExe);
+            In_FzCameraPixExe.Address = "ns=4;s=DB_Communication|ToPC.In_FzCameraPickExe";
+            In_FzCameraPixExe.DataType = "bool";
+            In_FzCameraPixExe.Description = "翻转相机检测拍照触发";
+
+            Out_PlcFail = Ensure(Out_PlcFail);
+            Out_PlcFail.Address = "ns=4;s=DB_Communication|FromPC.PC反馈NG交互[0]";
+            Out_PlcFail.DataType = "bool";
+            Out_PlcFail.Description = "PLC触发报警信号";
+
             //ns=4;s=DB_Input|X16_螺丝供料器1螺丝到位
             //ns=4;s=DB_Input|X16_螺丝供料器1螺丝到位
             //ns=4;s=DB_Input|X17_螺丝供料器2螺丝到位
             //ns=4;s=DB_Input|X17_螺丝供料器2螺丝到位
 
 

+ 191 - 0
TeamAAS-VM/Models/PLC/PlcExcelLoad.cs

@@ -0,0 +1,191 @@
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Formats.Asn1;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using NPOI.SS.UserModel;
+using NPOI.XSSF.UserModel;
+
+namespace TeamAAS_VP.Models.PLC
+{
+    public class PlcExcelLoad
+    {
+        /// <summary>
+        /// 真正的 bool 类型地址结构(无字符串类型)
+        /// </summary>
+        public class PLCAddrs
+        {
+            public string OpcAddress { get; set; }   // PLC地址(变量名)
+            public string Name { get; set; }         // 报警文本
+            public bool Value { get; set; }          // 真实 BOOL 类型值
+        }
+
+        // 默认PLC地址表路径
+        private string _filePath = Path.Combine(Path.GetDirectoryName(Application.StartupPath), @"Config\PLC地址表.xlsx");
+
+        // 所有集合统一使用 PLCAddrs
+        public List<PLCAddrs> IOInputList = new List<PLCAddrs>();
+        public List<PLCAddrs> IOOutputList = new List<PLCAddrs>();
+        public List<PLCAddrs> JoggingList = new List<PLCAddrs>();
+        public List<PLCAddrs> AlarmMaskList = new List<PLCAddrs>();
+        public List<PLCAddrs> InputParamList = new List<PLCAddrs>();
+        public List<PLCAddrs> OutputParamList = new List<PLCAddrs>();
+        public List<PLCAddrs> AlaemList = new List<PLCAddrs>();      // 报警列表
+        public List<PLCAddrs> SysStateList = new List<PLCAddrs>();   // 系统状态
+
+        public string FilePath
+        {
+            get => _filePath;
+            set => _filePath = value;
+        }
+
+        public PlcExcelLoad(string filePathStr = null)
+        {
+            if (!string.IsNullOrEmpty(filePathStr))
+                _filePath = filePathStr;
+        }
+
+        private DataTable GetCsvData()
+        {
+            DataTable dt = new DataTable();
+            try
+            {
+                // 优先用GB2312兼容Excel导出的CSV,乱码时可改为Encoding.UTF8/Encoding.Default
+                Encoding encoding = Encoding.GetEncoding("GB2312");
+                string[] lines = File.ReadAllLines(_filePath, encoding);
+
+                if (lines.Length == 0) return null;
+
+                // 读取表头
+                string[] headers = lines[0].Split(',');
+                foreach (string header in headers)
+                {
+                    dt.Columns.Add(header.Trim());
+                }
+
+                // 读取数据行
+                for (int i = 1; i < lines.Length; i++)
+                {
+                    string[] cells = lines[i].Split(',');
+                    DataRow row = dt.NewRow();
+                    for (int j = 0; j < dt.Columns.Count; j++)
+                    {
+                        row[j] = j < cells.Length ? cells[j].Trim() : "";
+                    }
+                    dt.Rows.Add(row);
+                }
+
+                return dt;
+            }
+            catch
+            {
+                return null;
+            }
+        }
+        /// <summary>
+        /// 加载Excel数据
+        /// </summary>
+        public void LoadData(int sheetIndex)
+        {
+            try
+            {
+                if (!File.Exists(_filePath)) return;
+
+                DataTable dt = null;
+                string ext = Path.GetExtension(_filePath).ToLower();
+                dt = GetCsvData();
+      
+                if (dt == null || dt.Rows.Count == 0) return;
+
+                RemoveEmptyRow(dt);
+
+                foreach (DataRow row in dt.Rows)
+                {
+                    PLCAddrs temp = new PLCAddrs();
+
+                    switch (sheetIndex)
+                    {
+                        case 0: // IO输入
+                            temp.OpcAddress = row[0].ToString().Trim();
+                            temp.Name = row[1].ToString().Trim();
+                            IOInputList.Add(temp);
+                            break;
+
+                        case 1: // IO输出
+                            temp.OpcAddress = row[0].ToString().Trim();
+                            temp.Name = row[1].ToString().Trim();
+                            IOOutputList.Add(temp);
+                            break;
+
+                        case 2: // 点动
+                            temp.OpcAddress = row[0].ToString().Trim();
+                            temp.Name = row[1].ToString().Trim();
+                            JoggingList.Add(temp);
+                            break;
+
+                        case 3: // 参数输入
+                            temp.OpcAddress = row[0].ToString().Trim();
+                            temp.Name = row[1].ToString().Trim();
+                            InputParamList.Add(temp);
+                            break;
+
+                        case 4: // 参数输出
+                            temp.OpcAddress = row[0].ToString().Trim();
+                            temp.Name = row[1].ToString().Trim();
+                            OutputParamList.Add(temp);
+                            break;
+
+                        case 5: // 报警屏蔽
+                            temp.OpcAddress = row[0].ToString().Trim();
+                            temp.Name = row[1].ToString().Trim();
+                            AlarmMaskList.Add(temp);
+                            break;
+
+                        case 6: // 报警信息(A列名称,B列地址)
+                            temp.Name = row[0].ToString().Trim();       // 报警文本
+                            temp.OpcAddress = row[1].ToString().Trim(); // PLC地址
+                            AlaemList.Add(temp);
+                            break;
+
+                        case 7: // 系统状态
+                            temp.OpcAddress = row[0].ToString().Trim();
+                            temp.Name = row[1].ToString().Trim();
+                            SysStateList.Add(temp);
+                            break;
+                    }
+                }
+            }
+            catch (Exception ex)
+            {
+                MessageBox.Show($"加载PLC地址表失败:{ex.Message}");
+            }
+        }
+
+        // 清除空行
+        public void RemoveEmptyRow(DataTable dt)
+        {
+            List<DataRow> delRows = new List<DataRow>();
+            foreach (DataRow row in dt.Rows)
+            {
+                bool isEmpty = true;
+                foreach (var item in row.ItemArray)
+                {
+                    if (!string.IsNullOrWhiteSpace(item?.ToString()))
+                    {
+                        isEmpty = false;
+                        break;
+                    }
+                }
+                if (isEmpty) delRows.Add(row);
+            }
+            foreach (var row in delRows) dt.Rows.Remove(row);
+        }
+
+    }
+
+
+}

+ 23 - 0
TeamAAS-VM/Models/Product/ProductModel.cs

@@ -165,6 +165,18 @@ namespace TeamAAS_VP.Models
             get { return _GlobalParamEx; }
             get { return _GlobalParamEx; }
             set { SetProperty(ref _GlobalParamEx, value); }
             set { SetProperty(ref _GlobalParamEx, value); }
         }
         }
+
+        private Guid _FixedUpCameraProcedureId;
+        /// <summary>
+        /// 相机拍照螺丝复检视觉流程ID
+        /// </summary>
+        public Guid FixedUpCameraProcedureId
+        {
+            get { return _FixedUpCameraProcedureId; }
+            set { SetProperty(ref _FixedUpCameraProcedureId, value); }
+        }
+
+
         private Guid _FixedUpCamera2ProcedureId;
         private Guid _FixedUpCamera2ProcedureId;
         /// <summary>
         /// <summary>
         /// 固定向上相机2视觉流程ID
         /// 固定向上相机2视觉流程ID
@@ -195,6 +207,17 @@ namespace TeamAAS_VP.Models
             set { SetProperty(ref _MoveDownCameraLockPhotoProcedureId, value); }
             set { SetProperty(ref _MoveDownCameraLockPhotoProcedureId, value); }
         }
         }
 
 
+
+        private Guid _FzCameraProcedureId;
+        /// <summary>
+        /// 翻转相机流程ID
+        /// </summary>
+        public Guid FzCameraProcedureId
+        {
+            get { return _FzCameraProcedureId; }
+            set { SetProperty(ref _FzCameraProcedureId, value); }
+        }
+
         // 二维码扫码流程ID
         // 二维码扫码流程ID
         private Guid _QrCodeProcedureId;
         private Guid _QrCodeProcedureId;
         public Guid QrCodeProcedureId
         public Guid QrCodeProcedureId

+ 8 - 0
TeamAAS-VM/Models/SystemConfiguration.cs

@@ -257,6 +257,14 @@ namespace TeamAAS_VP.Models
             set { SetProperty(ref _IsBasePartOpenLightKB, value); }
             set { SetProperty(ref _IsBasePartOpenLightKB, value); }
         }
         }
 
 
+        private bool _IsMesResult;
+
+        public bool IsMesResult
+        {
+            get { return _IsMesResult; }
+            set { SetProperty(ref _IsMesResult, value); }
+        }
+
         private string _ChooseScrewModel = "***********abc123****";
         private string _ChooseScrewModel = "***********abc123****";
         /// <summary>
         /// <summary>
         /// 螺丝型号判断,如******123**,*为忽略字符
         /// 螺丝型号判断,如******123**,*为忽略字符

+ 48 - 3
TeamAAS-VM/Resources/Languages/Lang.Designer.cs

@@ -1940,7 +1940,30 @@ namespace TeamAAS_VP.Resources.Languages {
                 return ResourceManager.GetString("下相机拍照结果1拍照OK2拍照NG3取图拍照OK", resourceCulture);
                 return ResourceManager.GetString("下相机拍照结果1拍照OK2拍照NG3取图拍照OK", resourceCulture);
             }
             }
         }
         }
-        
+
+
+        /// <summary>
+        ///   查找类似 下相机拍照结果 =1 拍照OK =2 拍照NG =3 取图拍照OK 的本地化字符串。
+        /// </summary>
+        public static string 添加螺丝型号结果1成功2失败
+        {
+            get
+            {
+                return ResourceManager.GetString("添加螺丝型号结果1成功2失败", resourceCulture);
+            }
+        }
+
+        /// <summary>
+        ///   查找类似 下相机矫正披头的结果,1:OK,2:NG 的本地化字符串。
+        /// </summary>
+        public static string 相机拍照螺丝复检的结果1OK2NG
+        {
+            get
+            {
+                return ResourceManager.GetString("相机拍照螺丝复检的结果1OK2NG", resourceCulture);
+            }
+        }
+
         /// <summary>
         /// <summary>
         ///   查找类似 下相机拍照编号 的本地化字符串。
         ///   查找类似 下相机拍照编号 的本地化字符串。
         /// </summary>
         /// </summary>
@@ -3713,7 +3736,18 @@ namespace TeamAAS_VP.Resources.Languages {
                 return ResourceManager.GetString("固定向下相机取料流程ID", resourceCulture);
                 return ResourceManager.GetString("固定向下相机取料流程ID", resourceCulture);
             }
             }
         }
         }
-        
+
+        /// <summary>
+        ///   查找类似 固定向上相机1视觉流程流程ID:{0} 的本地化字符串。
+        /// </summary>
+        public static string 固定向上相机视觉流程流程ID
+        {
+            get
+            {
+                return ResourceManager.GetString("固定向上相机视觉流程流程ID0", resourceCulture);
+            }
+        }
+
         /// <summary>
         /// <summary>
         ///   查找类似 固定相机取料拍照结果 =1 拍照OK =2 拍照NG =3 取图拍照OK 的本地化字符串。
         ///   查找类似 固定相机取料拍照结果 =1 拍照OK =2 拍照NG =3 取图拍照OK 的本地化字符串。
         /// </summary>
         /// </summary>
@@ -10077,7 +10111,18 @@ namespace TeamAAS_VP.Resources.Languages {
                 return ResourceManager.GetString("触发披头视觉矫正", resourceCulture);
                 return ResourceManager.GetString("触发披头视觉矫正", resourceCulture);
             }
             }
         }
         }
-        
+
+        /// <summary>
+        ///   查找类似 触发相机拍照螺丝复检 的本地化字符串。
+        /// </summary>
+        public static string 触发相机拍照螺丝复检
+        {
+            get
+            {
+                return ResourceManager.GetString("触发相机拍照螺丝复检", resourceCulture);
+            }
+        }
+
         /// <summary>
         /// <summary>
         ///   查找类似 触发指令 的本地化字符串。
         ///   查找类似 触发指令 的本地化字符串。
         /// </summary>
         /// </summary>

+ 84 - 84
TeamAAS-VM/Services/ConfigService.cs

@@ -71,7 +71,7 @@ namespace TeamAAS_VP.Services
         // 锟斤拷源锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷
         // 锟斤拷源锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷
         private ObservableCollection<LightControllerConfig> LightControllers { get; set; }
         private ObservableCollection<LightControllerConfig> LightControllers { get; set; }
 
 
-        // Device info - 鏀�寔澶氳�澶�
+        // Device info - 鏀�寔澶氳�澶?
         private List<DeviceInfo> _deviceInfoList;
         private List<DeviceInfo> _deviceInfoList;
         public CTQ_Data CtqData { get; set; }
         public CTQ_Data CtqData { get; set; }
 
 
@@ -101,7 +101,7 @@ namespace TeamAAS_VP.Services
 
 
         /// <summary>
         /// <summary>
         /// 锟斤拷始锟斤拷一锟斤拷锟铰碉拷 <see cref="ConfigService"/> 实锟斤拷锟斤拷
         /// 锟斤拷始锟斤拷一锟斤拷锟铰碉拷 <see cref="ConfigService"/> 实锟斤拷锟斤拷
-        /// 锟斤拷锟届函锟斤拷锟斤拷锟斤拷锟皆讹拷锟斤拷锟斤拷锟斤拷锟斤拷锟侥硷拷锟斤拷锟斤拷锟斤拷锟节癸拷锟斤拷锟节硷拷锟斤拷锟� I/O 锟斤拷锟斤拷锟斤拷锟斤拷锟缴碉拷锟斤拷 <see cref="LoadAll"/> 锟斤拷 <see cref="LoadAllAsync"/> 锟斤拷式锟斤拷锟截★拷
+        /// 锟斤拷锟届函锟斤拷锟斤拷锟斤拷锟皆讹拷锟斤拷锟斤拷锟斤拷锟斤拷锟侥硷拷锟斤拷锟斤拷锟斤拷锟节癸拷锟斤拷锟节硷拷锟斤拷锟?I/O 锟斤拷锟斤拷锟斤拷锟斤拷锟缴碉拷锟斤拷 <see cref="LoadAll"/> 锟斤拷 <see cref="LoadAllAsync"/> 锟斤拷式锟斤拷锟截★拷
         /// </summary>
         /// </summary>
         public ConfigService()
         public ConfigService()
         {
         {
@@ -117,7 +117,7 @@ namespace TeamAAS_VP.Services
         {
         {
             lock (_sync)
             lock (_sync)
             {
             {
-                // 锟斤拷取锟斤拷锟斤拷锟矫o拷锟斤拷锟斤拷募锟斤拷锟斤拷锟斤拷冢锟斤拷虮3锟� DeviceConfig 默锟斤拷值
+                // 锟斤拷取锟斤拷锟斤拷锟矫o拷锟斤拷锟斤拷募锟斤拷锟斤拷锟斤拷冢锟斤拷虮3锟?DeviceConfig 默锟斤拷值
                 if (File.Exists(ConfigPaths.CamerasConfigurationPath))
                 if (File.Exists(ConfigPaths.CamerasConfigurationPath))
                     Cameras = FileHelper.ReadJsonFile<ObservableCollection<CameraInfo>>(ConfigPaths.CamerasConfigurationPath);
                     Cameras = FileHelper.ReadJsonFile<ObservableCollection<CameraInfo>>(ConfigPaths.CamerasConfigurationPath);
                 else
                 else
@@ -211,7 +211,7 @@ namespace TeamAAS_VP.Services
                     FileHelper.WriteJsonFile(_screwDriverConfig, ConfigPaths.ScrewDriverConfigurationPath);
                     FileHelper.WriteJsonFile(_screwDriverConfig, ConfigPaths.ScrewDriverConfigurationPath);
                 }
                 }
 
 
-                // load device info list (鏀�寔澶氳�澶�)
+                // load device info list (鏀�寔澶氳�澶?
                 if (File.Exists(ConfigPaths.DeviceInfoConfigurationPath))
                 if (File.Exists(ConfigPaths.DeviceInfoConfigurationPath))
                 {
                 {
                     try
                     try
@@ -263,7 +263,7 @@ namespace TeamAAS_VP.Services
 
 
         /// <summary>
         /// <summary>
         /// 锟斤拷锟节达拷锟叫碉拷锟斤拷锟斤拷锟斤拷锟斤拷写锟截碉拷锟斤拷应锟斤拷锟斤拷锟侥硷拷锟斤拷
         /// 锟斤拷锟节达拷锟叫碉拷锟斤拷锟斤拷锟斤拷锟斤拷写锟截碉拷锟斤拷应锟斤拷锟斤拷锟侥硷拷锟斤拷
-        /// 锟竭程帮拷全锟斤拷锟斤拷锟斤拷锟节诧拷锟斤拷写锟斤拷锟斤拷锟绞癸拷锟� <see cref="_sync"/> 锟斤拷锟斤拷锟斤拷
+        /// 锟竭程帮拷全锟斤拷锟斤拷锟斤拷锟节诧拷锟斤拷写锟斤拷锟斤拷锟绞癸拷锟?<see cref="_sync"/> 锟斤拷锟斤拷锟斤拷
         /// </summary>
         /// </summary>
         public void SaveAll()
         public void SaveAll()
         {
         {
@@ -285,7 +285,7 @@ namespace TeamAAS_VP.Services
                     FileHelper.WriteJsonFile(ScrewFeeders, ConfigPaths.ScrewFeedersConfigurationPath);
                     FileHelper.WriteJsonFile(ScrewFeeders, ConfigPaths.ScrewFeedersConfigurationPath);
                 // save plc addresses
                 // save plc addresses
                 //FileHelper.WriteJsonFile(PlcAddressConfig, "..//Config//PlcAddressConfiguration.cfg");
                 //FileHelper.WriteJsonFile(PlcAddressConfig, "..//Config//PlcAddressConfiguration.cfg");
-                // save device info list (鏀�寔澶氳�澶�)
+                // save device info list (鏀�寔澶氳�澶?
                 if (_deviceInfoList != null)
                 if (_deviceInfoList != null)
                     FileHelper.WriteJsonFile(_deviceInfoList, ConfigPaths.DeviceInfoConfigurationPath);
                     FileHelper.WriteJsonFile(_deviceInfoList, ConfigPaths.DeviceInfoConfigurationPath);
                 // save card reader config
                 // save card reader config
@@ -297,7 +297,7 @@ namespace TeamAAS_VP.Services
         /// <summary>
         /// <summary>
         /// 锟届步执锟斤拷 <see cref="SaveAll"/> 锟斤拷锟斤拷锟斤拷
         /// 锟届步执锟斤拷 <see cref="SaveAll"/> 锟斤拷锟斤拷锟斤拷
         /// </summary>
         /// </summary>
-        /// <returns>锟斤拷示锟届步锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟�</returns>
+        /// <returns>锟斤拷示锟届步锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟?/returns>
         public Task SaveAllAsync()
         public Task SaveAllAsync()
         {
         {
             return Task.Run(() => SaveAll());
             return Task.Run(() => SaveAll());
@@ -305,19 +305,19 @@ namespace TeamAAS_VP.Services
 
 
         #region Cameras
         #region Cameras
         /// <summary>
         /// <summary>
-        /// 锟斤拷取锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷玫锟街伙拷锟斤拷锟斤拷稀锟�
+        /// 锟斤拷取锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷玫锟街伙拷锟斤拷锟斤拷稀锟?
         /// 锟竭程帮拷全锟斤拷锟斤拷锟节诧拷锟斤拷锟斤拷锟皆憋拷证锟斤拷锟斤拷锟斤拷取锟斤拷一锟斤拷锟皆★拷
         /// 锟竭程帮拷全锟斤拷锟斤拷锟节诧拷锟斤拷锟斤拷锟皆憋拷证锟斤拷锟斤拷锟斤拷取锟斤拷一锟斤拷锟皆★拷
         /// </summary>
         /// </summary>
-        /// <returns>锟斤拷锟斤拷锟斤拷玫锟街伙拷锟斤拷锟斤拷稀锟�</returns>
+        /// <returns>锟斤拷锟斤拷锟斤拷玫锟街伙拷锟斤拷锟斤拷稀锟?/returns>
         public IReadOnlyCollection<CameraInfo> GetAllCameras()
         public IReadOnlyCollection<CameraInfo> GetAllCameras()
         {
         {
             lock (_sync) { return Cameras.ToList().AsReadOnly(); }
             lock (_sync) { return Cameras.ToList().AsReadOnly(); }
         }
         }
 
 
         /// <summary>
         /// <summary>
-        /// 锟斤拷锟捷憋拷识锟斤拷取锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟较�拷锟�
+        /// 锟斤拷锟捷憋拷识锟斤拷取锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟较�拷锟?
         /// </summary>
         /// </summary>
-        /// <param name="id">锟斤拷锟斤拷锟� Guid 锟斤拷识锟斤拷</param>
+        /// <param name="id">锟斤拷锟斤拷锟?Guid 锟斤拷识锟斤拷</param>
         /// <returns>锟揭碉拷锟津返回讹拷应锟斤拷 <see cref="CameraInfo"/>锟斤拷锟斤拷锟津返伙拷 <c>null</c>锟斤拷</returns>
         /// <returns>锟揭碉拷锟津返回讹拷应锟斤拷 <see cref="CameraInfo"/>锟斤拷锟斤拷锟津返伙拷 <c>null</c>锟斤拷</returns>
         public CameraInfo GetCamera(Guid id)
         public CameraInfo GetCamera(Guid id)
         {
         {
@@ -327,11 +327,11 @@ namespace TeamAAS_VP.Services
         /// <summary>
         /// <summary>
         /// 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟矫★拷
         /// 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟矫★拷
         /// - 锟斤拷锟斤拷锟斤拷 <paramref name="camera"/> 为 <c>null</c> 锟斤拷锟斤拷 <c>null</c>锟斤拷
         /// - 锟斤拷锟斤拷锟斤拷 <paramref name="camera"/> 为 <c>null</c> 锟斤拷锟斤拷 <c>null</c>锟斤拷
-        /// - 锟斤拷 Id 锟窖达拷锟斤拷锟斤拷锟芥换锟斤拷锟斤拷锟斤拷追锟接诧拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷 CameraNo 锟斤拷拧锟�
+        /// - 锟斤拷 Id 锟窖达拷锟斤拷锟斤拷锟芥换锟斤拷锟斤拷锟斤拷追锟接诧拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷 CameraNo 锟斤拷拧锟?
         /// 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷峤�拷锟斤拷锟斤拷锟较持久伙拷锟斤拷锟斤拷锟斤拷锟侥硷拷锟斤拷
         /// 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷峤�拷锟斤拷锟斤拷锟较持久伙拷锟斤拷锟斤拷锟斤拷锟侥硷拷锟斤拷
         /// </summary>
         /// </summary>
         /// <param name="camera">要锟斤拷锟接伙拷锟斤拷碌锟斤拷锟斤拷锟斤拷锟矫★拷</param>
         /// <param name="camera">要锟斤拷锟接伙拷锟斤拷碌锟斤拷锟斤拷锟斤拷锟矫★拷</param>
-        /// <returns>锟斤拷锟斤拷锟接伙拷锟斤拷碌锟� <see cref="CameraInfo"/>锟斤拷锟斤拷锟斤拷为 <c>null</c> 时锟斤拷锟斤拷 <c>null</c>锟斤拷</returns>
+        /// <returns>锟斤拷锟斤拷锟接伙拷锟斤拷碌锟?<see cref="CameraInfo"/>锟斤拷锟斤拷锟斤拷为 <c>null</c> 时锟斤拷锟斤拷 <c>null</c>锟斤拷</returns>
         public CameraInfo AddOrUpdateCamera(CameraInfo camera)
         public CameraInfo AddOrUpdateCamera(CameraInfo camera)
         {
         {
             if (camera == null) return null;
             if (camera == null) return null;
@@ -354,10 +354,10 @@ namespace TeamAAS_VP.Services
         }
         }
 
 
         /// <summary>
         /// <summary>
-        /// 锟斤拷锟捷憋拷识锟狡筹拷锟斤拷锟斤拷锟斤拷貌锟斤拷锟斤拷卤锟斤拷剩锟斤拷锟斤拷锟斤拷锟� CameraNo锟斤拷
+        /// 锟斤拷锟捷憋拷识锟狡筹拷锟斤拷锟斤拷锟斤拷貌锟斤拷锟斤拷卤锟斤拷剩锟斤拷锟斤拷锟斤拷锟?CameraNo锟斤拷
         /// 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷峤�拷锟斤拷锟斤拷锟较持久伙拷锟斤拷锟斤拷锟斤拷锟侥硷拷锟斤拷
         /// 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷峤�拷锟斤拷锟斤拷锟较持久伙拷锟斤拷锟斤拷锟斤拷锟侥硷拷锟斤拷
         /// </summary>
         /// </summary>
-        /// <param name="id">要锟狡筹拷锟斤拷锟斤拷锟� Guid锟斤拷</param>
+        /// <param name="id">要锟狡筹拷锟斤拷锟斤拷锟?Guid锟斤拷</param>
         /// <returns>锟斤拷锟揭碉拷锟斤拷锟缴癸拷锟狡筹拷锟斤拷锟斤拷 <c>true</c>锟斤拷锟斤拷锟津返伙拷 <c>false</c>锟斤拷</returns>
         /// <returns>锟斤拷锟揭碉拷锟斤拷锟缴癸拷锟狡筹拷锟斤拷锟斤拷 <c>true</c>锟斤拷锟斤拷锟津返伙拷 <c>false</c>锟斤拷</returns>
         public bool RemoveCamera(Guid id)
         public bool RemoveCamera(Guid id)
         {
         {
@@ -366,7 +366,7 @@ namespace TeamAAS_VP.Services
             {
             {
                 var exist = Cameras.FirstOrDefault(c => c.Id == id);
                 var exist = Cameras.FirstOrDefault(c => c.Id == id);
                 if (exist != null) result = Cameras.Remove(exist);
                 if (exist != null) result = Cameras.Remove(exist);
-                //锟斤拷锟铰憋拷锟�
+                //锟斤拷锟铰憋拷锟?
                 int no = 1;
                 int no = 1;
                 //锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟紺ameraNo锟斤拷锟斤拷
                 //锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟紺ameraNo锟斤拷锟斤拷
                 var sortedCameras = Cameras.OrderBy(c => c.CameraNo).ToList();
                 var sortedCameras = Cameras.OrderBy(c => c.CameraNo).ToList();
@@ -386,18 +386,18 @@ namespace TeamAAS_VP.Services
         }
         }
 
 
         /// <summary>
         /// <summary>
-        /// 锟斤拷锟斤拷欠锟斤拷锟斤拷指锟斤拷 Id 锟斤拷锟斤拷锟斤拷锟斤拷谩锟�
+        /// 锟斤拷锟斤拷欠锟斤拷锟斤拷指锟斤拷 Id 锟斤拷锟斤拷锟斤拷锟斤拷谩锟?
         /// </summary>
         /// </summary>
-        /// <param name="id">锟斤拷锟斤拷锟� Guid锟斤拷</param>
+        /// <param name="id">锟斤拷锟斤拷锟?Guid锟斤拷</param>
         /// <returns>锟斤拷锟节凤拷锟斤拷 <c>true</c>锟斤拷锟斤拷锟津返伙拷 <c>false</c>锟斤拷</returns>
         /// <returns>锟斤拷锟节凤拷锟斤拷 <c>true</c>锟斤拷锟斤拷锟津返伙拷 <c>false</c>锟斤拷</returns>
         public bool ContainsCamera(Guid id) { lock (_sync) { return Cameras.Any(c => c.Id == id); } }
         public bool ContainsCamera(Guid id) { lock (_sync) { return Cameras.Any(c => c.Id == id); } }
         #endregion
         #endregion
 
 
         #region DeviceInfo
         #region DeviceInfo
         /// <summary>
         /// <summary>
-        /// 鑾峰彇鎵€鏈夎�澶囦俊鎭�厤缃�垪琛�
+        /// 鑾峰彇鎵€鏈夎�澶囦俊鎭�厤缃�垪琛?
         /// </summary>
         /// </summary>
-        /// <returns>璁惧�淇℃伅鍒楄〃鐨勫彧璇婚泦鍚�</returns>
+        /// <returns>璁惧�淇℃伅鍒楄〃鐨勫彧璇婚泦鍚?/returns>
         public IReadOnlyCollection<DeviceInfo> GetAllDeviceInfos()
         public IReadOnlyCollection<DeviceInfo> GetAllDeviceInfos()
         {
         {
             lock (_sync)
             lock (_sync)
@@ -460,7 +460,7 @@ namespace TeamAAS_VP.Services
         }
         }
 
 
         /// <summary>
         /// <summary>
-        /// 娣诲姞鎴栨洿鏂拌�澶囦俊鎭�
+        /// 娣诲姞鎴栨洿鏂拌�澶囦俊鎭?
         /// </summary>
         /// </summary>
         /// <param name="deviceInfo">璁惧�淇℃伅瀵硅薄</param>
         /// <param name="deviceInfo">璁惧�淇℃伅瀵硅薄</param>
         public void SaveDeviceInfo(DeviceInfo deviceInfo)
         public void SaveDeviceInfo(DeviceInfo deviceInfo)
@@ -484,17 +484,17 @@ namespace TeamAAS_VP.Services
                 }
                 }
                 else
                 else
                 {
                 {
-                    // 娣诲姞鏂拌�澶�
+                    // 娣诲姞鏂拌�澶?
                     _deviceInfoList.Add(deviceInfo);
                     _deviceInfoList.Add(deviceInfo);
                 }
                 }
-                // 鎸夎�澶囩紪鍙锋帓搴�
+                // 鎸夎�澶囩紪鍙锋帓搴?
                 _deviceInfoList = _deviceInfoList.OrderBy(d => d.DeviceNo).ToList();
                 _deviceInfoList = _deviceInfoList.OrderBy(d => d.DeviceNo).ToList();
                 FileHelper.WriteJsonFile(_deviceInfoList, ConfigPaths.DeviceInfoConfigurationPath);
                 FileHelper.WriteJsonFile(_deviceInfoList, ConfigPaths.DeviceInfoConfigurationPath);
             }
             }
         }
         }
 
 
         /// <summary>
         /// <summary>
-        /// 淇濆瓨鎵€鏈夎�澶囦俊鎭�垪琛�
+        /// 淇濆瓨鎵€鏈夎�澶囦俊鎭�垪琛?
         /// </summary>
         /// </summary>
         /// <param name="deviceInfoList">璁惧�淇℃伅鍒楄〃</param>
         /// <param name="deviceInfoList">璁惧�淇℃伅鍒楄〃</param>
         public void SaveAllDeviceInfos(IEnumerable<DeviceInfo> deviceInfoList)
         public void SaveAllDeviceInfos(IEnumerable<DeviceInfo> deviceInfoList)
@@ -508,7 +508,7 @@ namespace TeamAAS_VP.Services
         }
         }
 
 
         /// <summary>
         /// <summary>
-        /// 娣诲姞鏂拌�澶�
+        /// 娣诲姞鏂拌�澶?
         /// </summary>
         /// </summary>
         /// <returns>鏂版坊鍔犵殑璁惧�</returns>
         /// <returns>鏂版坊鍔犵殑璁惧�</returns>
         public DeviceInfo AddDeviceInfo()
         public DeviceInfo AddDeviceInfo()
@@ -520,7 +520,7 @@ namespace TeamAAS_VP.Services
                     _deviceInfoList = new List<DeviceInfo>();
                     _deviceInfoList = new List<DeviceInfo>();
                 }
                 }
 
 
-                // 璁$畻鏂拌�澶囩紪鍙�
+                // 璁$畻鏂拌�澶囩紪鍙?
                 int newDeviceNo = _deviceInfoList.Count > 0 ? _deviceInfoList.Max(d => d.DeviceNo) + 1 : 0;
                 int newDeviceNo = _deviceInfoList.Count > 0 ? _deviceInfoList.Max(d => d.DeviceNo) + 1 : 0;
                 var newDevice = new DeviceInfo { DeviceNo = newDeviceNo };
                 var newDevice = new DeviceInfo { DeviceNo = newDeviceNo };
                 _deviceInfoList.Add(newDevice);
                 _deviceInfoList.Add(newDevice);
@@ -567,10 +567,10 @@ namespace TeamAAS_VP.Services
 
 
         /// <summary>
         /// <summary>
         /// 锟斤拷锟斤拷锟斤拷锟斤拷禄锟斤拷锟斤拷锟斤拷锟斤拷茫锟斤拷锟斤拷锟斤拷锟街久伙拷锟斤拷锟斤拷锟斤拷锟侥硷拷锟斤拷
         /// 锟斤拷锟斤拷锟斤拷锟斤拷禄锟斤拷锟斤拷锟斤拷锟斤拷茫锟斤拷锟斤拷锟斤拷锟街久伙拷锟斤拷锟斤拷锟斤拷锟侥硷拷锟斤拷
-        /// 锟斤拷锟斤拷时为锟斤拷锟斤拷锟剿凤拷锟斤拷锟斤拷锟斤拷锟斤拷 RobotNo 锟斤拷拧锟�
+        /// 锟斤拷锟斤拷时为锟斤拷锟斤拷锟剿凤拷锟斤拷锟斤拷锟斤拷锟斤拷 RobotNo 锟斤拷拧锟?
         /// </summary>
         /// </summary>
-        /// <param name="robot">要锟斤拷锟接伙拷锟斤拷碌幕锟斤拷锟斤拷锟斤拷锟斤拷谩锟�</param>
-        /// <returns>锟斤拷锟斤拷锟接伙拷锟斤拷碌锟� <see cref="RobotInfo"/>锟斤拷锟斤拷锟斤拷为 <c>null</c> 时锟斤拷锟斤拷 <c>null</c>锟斤拷</returns>
+        /// <param name="robot">要锟斤拷锟接伙拷锟斤拷碌幕锟斤拷锟斤拷锟斤拷锟斤拷谩锟?/param>
+        /// <returns>锟斤拷锟斤拷锟接伙拷锟斤拷碌锟?<see cref="RobotInfo"/>锟斤拷锟斤拷锟斤拷为 <c>null</c> 时锟斤拷锟斤拷 <c>null</c>锟斤拷</returns>
         public RobotInfo AddOrUpdateRobot(RobotInfo robot)
         public RobotInfo AddOrUpdateRobot(RobotInfo robot)
         {
         {
             if (robot == null) return null;
             if (robot == null) return null;
@@ -595,7 +595,7 @@ namespace TeamAAS_VP.Services
 
 
         /// <summary>
         /// <summary>
         /// 锟斤拷锟捷憋拷识锟狡筹拷锟斤拷锟斤拷锟斤拷锟斤拷锟矫诧拷锟斤拷锟铰憋拷锟绞o拷锟斤拷锟斤拷锟剿★拷
         /// 锟斤拷锟捷憋拷识锟狡筹拷锟斤拷锟斤拷锟斤拷锟斤拷锟矫诧拷锟斤拷锟铰憋拷锟绞o拷锟斤拷锟斤拷锟剿★拷
-        /// 锟斤拷锟斤拷锟斤拷志没锟斤拷锟斤拷锟斤拷募锟斤拷锟�
+        /// 锟斤拷锟斤拷锟斤拷志没锟斤拷锟斤拷锟斤拷募锟斤拷锟?
         /// </summary>
         /// </summary>
         /// <param name="id">要锟狡筹拷锟侥伙拷锟斤拷锟斤拷 Guid锟斤拷</param>
         /// <param name="id">要锟狡筹拷锟侥伙拷锟斤拷锟斤拷 Guid锟斤拷</param>
         /// <returns>锟狡筹拷锟缴癸拷锟斤拷锟斤拷 <c>true</c>锟斤拷锟斤拷锟津返伙拷 <c>false</c>锟斤拷</returns>
         /// <returns>锟狡筹拷锟缴癸拷锟斤拷锟斤拷 <c>true</c>锟斤拷锟斤拷锟津返伙拷 <c>false</c>锟斤拷</returns>
@@ -607,7 +607,7 @@ namespace TeamAAS_VP.Services
                 var e = Robots.FirstOrDefault(r => r.Id == id);
                 var e = Robots.FirstOrDefault(r => r.Id == id);
                 if (e != null)
                 if (e != null)
                     result = Robots.Remove(e);
                     result = Robots.Remove(e);
-                //锟斤拷锟铰憋拷锟�
+                //锟斤拷锟铰憋拷锟?
                 int no = 1;
                 int no = 1;
                 //锟斤拷锟斤拷锟叫伙拷锟斤拷锟剿帮拷RobotNo锟斤拷锟斤拷
                 //锟斤拷锟斤拷锟叫伙拷锟斤拷锟剿帮拷RobotNo锟斤拷锟斤拷
                 var sortedRobots = Robots.OrderBy(r => r.RobotNo).ToList();
                 var sortedRobots = Robots.OrderBy(r => r.RobotNo).ToList();
@@ -627,7 +627,7 @@ namespace TeamAAS_VP.Services
         }
         }
 
 
         /// <summary>
         /// <summary>
-        /// 锟叫讹拷锟角凤拷锟斤拷锟街革拷锟� Id 锟侥伙拷锟斤拷锟斤拷锟斤拷锟矫★拷
+        /// 锟叫讹拷锟角凤拷锟斤拷锟街革拷锟?Id 锟侥伙拷锟斤拷锟斤拷锟斤拷锟矫★拷
         /// </summary>
         /// </summary>
         /// <param name="id">锟斤拷锟斤拷锟剿碉拷 Guid锟斤拷</param>
         /// <param name="id">锟斤拷锟斤拷锟剿碉拷 Guid锟斤拷</param>
         /// <returns>锟斤拷锟节凤拷锟斤拷 <c>true</c>锟斤拷锟斤拷锟津返伙拷 <c>false</c>锟斤拷</returns>
         /// <returns>锟斤拷锟节凤拷锟斤拷 <c>true</c>锟斤拷锟斤拷锟津返伙拷 <c>false</c>锟斤拷</returns>
@@ -697,10 +697,10 @@ namespace TeamAAS_VP.Services
 
 
         /// <summary>
         /// <summary>
         /// 锟斤拷锟斤拷锟斤拷锟斤拷鹿锟斤拷锟斤拷锟斤拷锟斤拷茫锟斤拷锟斤拷锟斤拷锟街久伙拷锟斤拷锟斤拷锟斤拷锟侥硷拷锟斤拷
         /// 锟斤拷锟斤拷锟斤拷锟斤拷鹿锟斤拷锟斤拷锟斤拷锟斤拷茫锟斤拷锟斤拷锟斤拷锟街久伙拷锟斤拷锟斤拷锟斤拷锟侥硷拷锟斤拷
-        /// 锟斤拷锟斤拷时为锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷 FeederNo 锟斤拷拧锟�
+        /// 锟斤拷锟斤拷时为锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷 FeederNo 锟斤拷拧锟?
         /// </summary>
         /// </summary>
-        /// <param name="feeder">要锟斤拷锟接伙拷锟斤拷碌墓锟斤拷锟斤拷锟斤拷锟斤拷谩锟�</param>
-        /// <returns>锟斤拷锟斤拷锟接伙拷锟斤拷碌锟� <see cref="FeederInfo"/>锟斤拷锟斤拷锟斤拷为 <c>null</c> 时锟斤拷锟斤拷 <c>null</c>锟斤拷</returns>
+        /// <param name="feeder">要锟斤拷锟接伙拷锟斤拷碌墓锟斤拷锟斤拷锟斤拷锟斤拷谩锟?/param>
+        /// <returns>锟斤拷锟斤拷锟接伙拷锟斤拷碌锟?<see cref="FeederInfo"/>锟斤拷锟斤拷锟斤拷为 <c>null</c> 时锟斤拷锟斤拷 <c>null</c>锟斤拷</returns>
         public FeederInfo AddOrUpdateFeeder(FeederInfo feeder)
         public FeederInfo AddOrUpdateFeeder(FeederInfo feeder)
         {
         {
             if (feeder == null) return null;
             if (feeder == null) return null;
@@ -723,8 +723,8 @@ namespace TeamAAS_VP.Services
         }
         }
 
 
         /// <summary>
         /// <summary>
-        /// 锟斤拷锟捷憋拷识锟狡筹拷锟斤拷锟斤拷锟斤拷锟斤拷锟矫诧拷锟斤拷锟铰憋拷锟绞o拷喙╋拷锟斤拷锟斤拷锟�
-        /// 锟斤拷锟斤拷锟斤拷志没锟斤拷锟斤拷锟斤拷募锟斤拷锟�
+        /// 锟斤拷锟捷憋拷识锟狡筹拷锟斤拷锟斤拷锟斤拷锟斤拷锟矫诧拷锟斤拷锟铰憋拷锟绞o拷喙╋拷锟斤拷锟斤拷锟?
+        /// 锟斤拷锟斤拷锟斤拷志没锟斤拷锟斤拷锟斤拷募锟斤拷锟?
         /// </summary>
         /// </summary>
         /// <param name="id">要锟狡筹拷锟侥癸拷锟斤拷锟斤拷 Guid锟斤拷</param>
         /// <param name="id">要锟狡筹拷锟侥癸拷锟斤拷锟斤拷 Guid锟斤拷</param>
         /// <returns>锟狡筹拷锟缴癸拷锟斤拷锟斤拷 <c>true</c>锟斤拷锟斤拷锟津返伙拷 <c>false</c>锟斤拷</returns>
         /// <returns>锟狡筹拷锟缴癸拷锟斤拷锟斤拷 <c>true</c>锟斤拷锟斤拷锟津返伙拷 <c>false</c>锟斤拷</returns>
@@ -735,7 +735,7 @@ namespace TeamAAS_VP.Services
             {
             {
                 var e = Feeders.FirstOrDefault(f => f.Id == id);
                 var e = Feeders.FirstOrDefault(f => f.Id == id);
                 if (e != null) result = Feeders.Remove(e);
                 if (e != null) result = Feeders.Remove(e);
-                //锟斤拷锟铰憋拷锟�
+                //锟斤拷锟铰憋拷锟?
                 int no = 1;
                 int no = 1;
                 //锟斤拷锟斤拷锟叫癸拷锟斤拷锟斤拷锟斤拷FeederNo锟斤拷锟斤拷
                 //锟斤拷锟斤拷锟叫癸拷锟斤拷锟斤拷锟斤拷FeederNo锟斤拷锟斤拷
                 var sortedFeeders = Feeders.OrderBy(f => f.FeederNo).ToList();
                 var sortedFeeders = Feeders.OrderBy(f => f.FeederNo).ToList();
@@ -756,7 +756,7 @@ namespace TeamAAS_VP.Services
         }
         }
 
 
         /// <summary>
         /// <summary>
-        /// 锟叫讹拷锟角凤拷锟斤拷锟街革拷锟� Id 锟侥癸拷锟斤拷锟斤拷锟斤拷锟矫★拷
+        /// 锟叫讹拷锟角凤拷锟斤拷锟街革拷锟?Id 锟侥癸拷锟斤拷锟斤拷锟斤拷锟矫★拷
         /// </summary>
         /// </summary>
         /// <param name="id">锟斤拷锟斤拷锟斤拷 Guid锟斤拷</param>
         /// <param name="id">锟斤拷锟斤拷锟斤拷 Guid锟斤拷</param>
         /// <returns>锟斤拷锟节凤拷锟斤拷 <c>true</c>锟斤拷锟斤拷锟津返伙拷 <c>false</c>锟斤拷</returns>
         /// <returns>锟斤拷锟节凤拷锟斤拷 <c>true</c>锟斤拷锟斤拷锟津返伙拷 <c>false</c>锟斤拷</returns>
@@ -774,14 +774,14 @@ namespace TeamAAS_VP.Services
         /// 锟斤拷锟捷憋拷识锟斤拷取锟斤拷锟斤拷 PLC 锟斤拷锟矫★拷
         /// 锟斤拷锟捷憋拷识锟斤拷取锟斤拷锟斤拷 PLC 锟斤拷锟矫★拷
         /// </summary>
         /// </summary>
         /// <param name="id">PLC 锟斤拷 Guid 锟斤拷识锟斤拷</param>
         /// <param name="id">PLC 锟斤拷 Guid 锟斤拷识锟斤拷</param>
-        /// <returns>匹锟斤拷锟� <see cref="PlcInfo"/> 实锟斤拷锟斤拷锟揭诧拷锟斤拷锟斤拷锟斤拷 <c>null</c>锟斤拷</returns>
+        /// <returns>匹锟斤拷锟?<see cref="PlcInfo"/> 实锟斤拷锟斤拷锟揭诧拷锟斤拷锟斤拷锟斤拷 <c>null</c>锟斤拷</returns>
         public PlcInfo GetPlc(Guid id) { lock (_sync) { return Plcs.FirstOrDefault(p => p.Id == id); } }
         public PlcInfo GetPlc(Guid id) { lock (_sync) { return Plcs.FirstOrDefault(p => p.Id == id); } }
 
 
         /// <summary>
         /// <summary>
-        /// 锟斤拷锟斤拷锟斤拷锟斤拷锟� PLC 锟斤拷锟矫o拷锟斤拷锟斤拷锟斤拷志没锟斤拷锟斤拷锟斤拷锟斤拷募锟斤拷锟斤拷锟斤拷锟绞憋拷锟斤拷锟斤拷锟斤拷锟� PlcNo 锟斤拷拧锟�
+        /// 锟斤拷锟斤拷锟斤拷锟斤拷锟?PLC 锟斤拷锟矫o拷锟斤拷锟斤拷锟斤拷志没锟斤拷锟斤拷锟斤拷锟斤拷募锟斤拷锟斤拷锟斤拷锟绞憋拷锟斤拷锟斤拷锟斤拷锟?PlcNo 锟斤拷拧锟?
         /// </summary>
         /// </summary>
-        /// <param name="plc">要锟斤拷锟接伙拷锟斤拷碌锟� PLC 锟斤拷锟矫★拷</param>
-        /// <returns>锟斤拷锟斤拷锟接伙拷锟斤拷碌锟� <see cref="PlcInfo"/>锟斤拷锟斤拷锟斤拷为 <c>null</c> 时锟斤拷锟斤拷 <c>null</c>锟斤拷</returns>
+        /// <param name="plc">要锟斤拷锟接伙拷锟斤拷碌锟?PLC 锟斤拷锟矫★拷</param>
+        /// <returns>锟斤拷锟斤拷锟接伙拷锟斤拷碌锟?<see cref="PlcInfo"/>锟斤拷锟斤拷锟斤拷为 <c>null</c> 时锟斤拷锟斤拷 <c>null</c>锟斤拷</returns>
         public PlcInfo AddOrUpdatePlc(PlcInfo plc)
         public PlcInfo AddOrUpdatePlc(PlcInfo plc)
         {
         {
             if (plc == null) return null;
             if (plc == null) return null;
@@ -804,8 +804,8 @@ namespace TeamAAS_VP.Services
         }
         }
 
 
         /// <summary>
         /// <summary>
-        /// 锟斤拷锟捷憋拷识锟狡筹拷 PLC 锟斤拷锟矫诧拷锟斤拷锟铰憋拷锟绞o拷锟� PLC锟斤拷
-        /// 锟斤拷锟斤拷锟斤拷志没锟斤拷锟斤拷锟斤拷募锟斤拷锟�
+        /// 锟斤拷锟捷憋拷识锟狡筹拷 PLC 锟斤拷锟矫诧拷锟斤拷锟铰憋拷锟绞o拷锟?PLC锟斤拷
+        /// 锟斤拷锟斤拷锟斤拷志没锟斤拷锟斤拷锟斤拷募锟斤拷锟?
         /// </summary>
         /// </summary>
         /// <param name="id">要锟狡筹拷锟斤拷 PLC Guid锟斤拷</param>
         /// <param name="id">要锟狡筹拷锟斤拷 PLC Guid锟斤拷</param>
         /// <returns>锟狡筹拷锟缴癸拷锟斤拷锟斤拷 <c>true</c>锟斤拷锟斤拷锟津返伙拷 <c>false</c>锟斤拷</returns>
         /// <returns>锟狡筹拷锟缴癸拷锟斤拷锟斤拷 <c>true</c>锟斤拷锟斤拷锟津返伙拷 <c>false</c>锟斤拷</returns>
@@ -816,7 +816,7 @@ namespace TeamAAS_VP.Services
             {
             {
                 var e = Plcs.FirstOrDefault(p => p.Id == id);
                 var e = Plcs.FirstOrDefault(p => p.Id == id);
                 if (e != null) result = Plcs.Remove(e);
                 if (e != null) result = Plcs.Remove(e);
-                //锟斤拷锟铰憋拷锟�
+                //锟斤拷锟铰憋拷锟?
                 int no = 1;
                 int no = 1;
                 //锟斤拷锟斤拷锟斤拷PLC锟斤拷PlcNo锟斤拷锟斤拷
                 //锟斤拷锟斤拷锟斤拷PLC锟斤拷PlcNo锟斤拷锟斤拷
                 var sortedPlcs = Plcs.OrderBy(p => p.PlcNo).ToList();
                 var sortedPlcs = Plcs.OrderBy(p => p.PlcNo).ToList();
@@ -837,7 +837,7 @@ namespace TeamAAS_VP.Services
         }
         }
 
 
         /// <summary>
         /// <summary>
-        /// 锟叫讹拷锟角凤拷锟斤拷锟街革拷锟� Id 锟斤拷 PLC 锟斤拷锟矫★拷
+        /// 锟叫讹拷锟角凤拷锟斤拷锟街革拷锟?Id 锟斤拷 PLC 锟斤拷锟矫★拷
         /// </summary>
         /// </summary>
         /// <param name="id">PLC 锟斤拷 Guid锟斤拷</param>
         /// <param name="id">PLC 锟斤拷 Guid锟斤拷</param>
         /// <returns>锟斤拷锟节凤拷锟斤拷 <c>true</c>锟斤拷锟斤拷锟津返伙拷 <c>false</c>锟斤拷</returns>
         /// <returns>锟斤拷锟节凤拷锟斤拷 <c>true</c>锟斤拷锟斤拷锟津返伙拷 <c>false</c>锟斤拷</returns>
@@ -846,13 +846,13 @@ namespace TeamAAS_VP.Services
 
 
         #region BgTcp
         #region BgTcp
         /// <summary>
         /// <summary>
-        /// 锟斤拷取 BG TCP/IP 通锟斤拷锟斤拷锟矫o拷锟节达拷锟斤拷螅�锟斤拷锟轿� null锟斤拷锟斤拷
+        /// 锟斤拷取 BG TCP/IP 通锟斤拷锟斤拷锟矫o拷锟节达拷锟斤拷螅�锟斤拷锟轿?null锟斤拷锟斤拷
         /// </summary>
         /// </summary>
         /// <returns>锟斤拷前锟斤拷 <see cref="BgTcpIP"/> 锟斤拷锟矫讹拷锟斤拷</returns>
         /// <returns>锟斤拷前锟斤拷 <see cref="BgTcpIP"/> 锟斤拷锟矫讹拷锟斤拷</returns>
         public BgTcpIP GetBgTcp() { lock (_sync) { return BgCommunicate; } }
         public BgTcpIP GetBgTcp() { lock (_sync) { return BgCommunicate; } }
 
 
         /// <summary>
         /// <summary>
-        /// 锟斤拷锟斤拷 BG TCP/IP 通锟斤拷锟斤拷锟矫o拷锟斤拷锟斤拷锟斤拷锟节达拷锟斤拷螅�锟斤拷锟斤拷远锟斤拷志没锟斤拷锟斤拷锟�
+        /// 锟斤拷锟斤拷 BG TCP/IP 通锟斤拷锟斤拷锟矫o拷锟斤拷锟斤拷锟斤拷锟节达拷锟斤拷螅�锟斤拷锟斤拷远锟斤拷志没锟斤拷锟斤拷锟?
         /// 锟斤拷锟斤拷志没锟斤拷锟斤拷锟斤拷 <see cref="SaveBgTcp"/>锟斤拷
         /// 锟斤拷锟斤拷志没锟斤拷锟斤拷锟斤拷 <see cref="SaveBgTcp"/>锟斤拷
         /// </summary>
         /// </summary>
         /// <param name="cfg">锟铰碉拷 <see cref="BgTcpIP"/> 锟斤拷锟矫讹拷锟斤拷</param>
         /// <param name="cfg">锟铰碉拷 <see cref="BgTcpIP"/> 锟斤拷锟矫讹拷锟斤拷</param>
@@ -866,13 +866,13 @@ namespace TeamAAS_VP.Services
 
 
         #region BgModbus
         #region BgModbus
         /// <summary>
         /// <summary>
-        /// 锟斤拷取 BG Modbus TCP 通锟斤拷锟斤拷锟矫o拷锟节达拷锟斤拷螅�锟�
+        /// 锟斤拷取 BG Modbus TCP 通锟斤拷锟斤拷锟矫o拷锟节达拷锟斤拷螅�锟?
         /// </summary>
         /// </summary>
         /// <returns>锟斤拷前锟斤拷 <see cref="BgModbusTcp"/> 锟斤拷锟矫讹拷锟斤拷</returns>
         /// <returns>锟斤拷前锟斤拷 <see cref="BgModbusTcp"/> 锟斤拷锟矫讹拷锟斤拷</returns>
         public BgModbusTcp GetBgModbusTcp() { lock (_sync) { return BgModbusCommunicate; } }
         public BgModbusTcp GetBgModbusTcp() { lock (_sync) { return BgModbusCommunicate; } }
 
 
         /// <summary>
         /// <summary>
-        /// 锟斤拷锟斤拷 BG Modbus TCP 通锟斤拷锟斤拷锟矫o拷锟斤拷锟斤拷锟斤拷锟节达拷锟斤拷螅�锟斤拷锟斤拷远锟斤拷志没锟斤拷锟斤拷锟�
+        /// 锟斤拷锟斤拷 BG Modbus TCP 通锟斤拷锟斤拷锟矫o拷锟斤拷锟斤拷锟斤拷锟节达拷锟斤拷螅�锟斤拷锟斤拷远锟斤拷志没锟斤拷锟斤拷锟?
         /// </summary>
         /// </summary>
         /// <param name="cfg">锟铰碉拷 <see cref="BgModbusTcp"/> 锟斤拷锟矫讹拷锟斤拷</param>
         /// <param name="cfg">锟铰碉拷 <see cref="BgModbusTcp"/> 锟斤拷锟矫讹拷锟斤拷</param>
         public void SetBgModbusTcp(BgModbusTcp cfg) { lock (_sync) { BgModbusCommunicate = cfg; } }
         public void SetBgModbusTcp(BgModbusTcp cfg) { lock (_sync) { BgModbusCommunicate = cfg; } }
@@ -942,7 +942,7 @@ namespace TeamAAS_VP.Services
         /// <summary>
         /// <summary>
         /// 锟斤拷锟斤拷系统锟斤拷锟矫碉拷锟斤拷锟斤拷锟侥硷拷锟斤拷锟结覆锟斤拷锟斤拷锟斤拷锟侥硷拷锟斤拷锟斤拷
         /// 锟斤拷锟斤拷系统锟斤拷锟矫碉拷锟斤拷锟斤拷锟侥硷拷锟斤拷锟结覆锟斤拷锟斤拷锟斤拷锟侥硷拷锟斤拷锟斤拷
         /// </summary>
         /// </summary>
-        /// <param name="systemConfiguration">要锟斤拷锟斤拷锟较低筹拷锟斤拷枚锟斤拷锟�</param>
+        /// <param name="systemConfiguration">要锟斤拷锟斤拷锟较低筹拷锟斤拷枚锟斤拷锟?/param>
         public void SaveSystemConfiguration(SystemConfiguration systemConfiguration)
         public void SaveSystemConfiguration(SystemConfiguration systemConfiguration)
         {
         {
             lock (_sync)
             lock (_sync)
@@ -1026,16 +1026,16 @@ namespace TeamAAS_VP.Services
 
 
         #region Feeder锟斤拷锟斤拷锟斤拷锟斤拷
         #region Feeder锟斤拷锟斤拷锟斤拷锟斤拷
         /// <summary>
         /// <summary>
-        /// 锟斤拷取锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟街伙拷锟斤拷锟斤拷稀锟�
+        /// 锟斤拷取锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟街伙拷锟斤拷锟斤拷稀锟?
         /// </summary>
         /// </summary>
-        /// <returns>锟斤拷锟斤拷锟斤拷锟斤拷锟街伙拷锟斤拷锟斤拷稀锟�</returns>
+        /// <returns>锟斤拷锟斤拷锟斤拷锟斤拷锟街伙拷锟斤拷锟斤拷稀锟?/returns>
         public IReadOnlyCollection<FeederClearWork> GetAllClearanceTasks() { lock (_sync) { return FeederClearanceTasks.ToList().AsReadOnly(); } }
         public IReadOnlyCollection<FeederClearWork> GetAllClearanceTasks() { lock (_sync) { return FeederClearanceTasks.ToList().AsReadOnly(); } }
 
 
         /// <summary>
         /// <summary>
-        /// 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟绞蔽�拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟� TaskCode锟斤拷锟斤拷珊锟街久伙拷锟斤拷锟斤拷锟侥硷拷锟斤拷
+        /// 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟绞蔽�拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟?TaskCode锟斤拷锟斤拷珊锟街久伙拷锟斤拷锟斤拷锟侥硷拷锟斤拷
         /// </summary>
         /// </summary>
         /// <param name="task">要锟斤拷锟接伙拷锟斤拷碌锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷</param>
         /// <param name="task">要锟斤拷锟接伙拷锟斤拷碌锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷</param>
-        /// <returns>锟斤拷锟斤拷锟接伙拷锟斤拷碌锟� <see cref="FeederClearWork"/>锟斤拷锟斤拷锟斤拷为 <c>null</c> 时锟斤拷锟斤拷 <c>null</c>锟斤拷</returns>
+        /// <returns>锟斤拷锟斤拷锟接伙拷锟斤拷碌锟?<see cref="FeederClearWork"/>锟斤拷锟斤拷锟斤拷为 <c>null</c> 时锟斤拷锟斤拷 <c>null</c>锟斤拷</returns>
         public FeederClearWork AddOrUpdateClearanceTask(FeederClearWork task)
         public FeederClearWork AddOrUpdateClearanceTask(FeederClearWork task)
         {
         {
             if (task == null) return null;
             if (task == null) return null;
@@ -1049,7 +1049,7 @@ namespace TeamAAS_VP.Services
                 }
                 }
                 else
                 else
                 {
                 {
-                    // 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷为锟斤拷前锟斤拷锟斤拷偶锟�1
+                    // 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷为锟斤拷前锟斤拷锟斤拷偶锟?
                     task.TaskCode = FeederClearanceTasks.Count > 0 ? FeederClearanceTasks.Max(t => t.TaskCode) + 1 : 1;
                     task.TaskCode = FeederClearanceTasks.Count > 0 ? FeederClearanceTasks.Max(t => t.TaskCode) + 1 : 1;
                     FeederClearanceTasks.Add(task);
                     FeederClearanceTasks.Add(task);
                 }
                 }
@@ -1080,7 +1080,7 @@ namespace TeamAAS_VP.Services
         }
         }
 
 
         /// <summary>
         /// <summary>
-        /// 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷癫⒊志没锟斤拷占锟斤拷系锟斤拷锟斤拷锟斤拷募锟斤拷锟�
+        /// 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷癫⒊志没锟斤拷占锟斤拷系锟斤拷锟斤拷锟斤拷募锟斤拷锟?
         /// </summary>
         /// </summary>
         public void ClearAllClearanceTasks()
         public void ClearAllClearanceTasks()
         {
         {
@@ -1092,7 +1092,7 @@ namespace TeamAAS_VP.Services
         }
         }
 
 
         /// <summary>
         /// <summary>
-        /// 锟叫讹拷锟角凤拷锟斤拷锟街革拷锟� Id 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷
+        /// 锟叫讹拷锟角凤拷锟斤拷锟街革拷锟?Id 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷
         /// </summary>
         /// </summary>
         /// <param name="id">锟斤拷锟斤拷锟斤拷锟斤拷 Guid锟斤拷</param>
         /// <param name="id">锟斤拷锟斤拷锟斤拷锟斤拷 Guid锟斤拷</param>
         /// <returns>锟斤拷锟节凤拷锟斤拷 <c>true</c>锟斤拷锟斤拷锟津返伙拷 <c>false</c>锟斤拷</returns>
         /// <returns>锟斤拷锟节凤拷锟斤拷 <c>true</c>锟斤拷锟斤拷锟津返伙拷 <c>false</c>锟斤拷</returns>
@@ -1106,14 +1106,14 @@ namespace TeamAAS_VP.Services
         /// 锟斤拷锟捷憋拷识锟斤拷取锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷息锟斤拷
         /// 锟斤拷锟捷憋拷识锟斤拷取锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷息锟斤拷
         /// </summary>
         /// </summary>
         /// <param name="id">锟斤拷锟斤拷锟斤拷锟斤拷 Guid锟斤拷</param>
         /// <param name="id">锟斤拷锟斤拷锟斤拷锟斤拷 Guid锟斤拷</param>
-        /// <returns>匹锟斤拷锟� <see cref="FeederClearWork"/>锟斤拷锟揭诧拷锟斤拷锟斤拷锟斤拷 <c>null</c>锟斤拷</returns>
+        /// <returns>匹锟斤拷锟?<see cref="FeederClearWork"/>锟斤拷锟揭诧拷锟斤拷锟斤拷锟斤拷 <c>null</c>锟斤拷</returns>
         public FeederClearWork GetClearanceTask(Guid id)
         public FeederClearWork GetClearanceTask(Guid id)
         {
         {
             lock (_sync) { return FeederClearanceTasks.FirstOrDefault(t => t.Id == id); }
             lock (_sync) { return FeederClearanceTasks.FirstOrDefault(t => t.Id == id); }
         }
         }
 
 
         /// <summary>
         /// <summary>
-        /// 锟叫讹拷锟角凤拷锟斤拷锟街革拷锟斤拷锟斤拷锟斤拷诺锟斤拷锟斤拷锟斤拷锟斤拷锟�
+        /// 锟叫讹拷锟角凤拷锟斤拷锟街革拷锟斤拷锟斤拷锟斤拷诺锟斤拷锟斤拷锟斤拷锟斤拷锟?
         /// </summary>
         /// </summary>
         /// <param name="taskNumber">锟斤拷锟斤拷锟脚o拷TaskCode锟斤拷锟斤拷</param>
         /// <param name="taskNumber">锟斤拷锟斤拷锟脚o拷TaskCode锟斤拷锟斤拷</param>
         /// <returns>锟斤拷锟节凤拷锟斤拷 <c>true</c>锟斤拷锟斤拷锟津返伙拷 <c>false</c>锟斤拷</returns>
         /// <returns>锟斤拷锟节凤拷锟斤拷 <c>true</c>锟斤拷锟斤拷锟津返伙拷 <c>false</c>锟斤拷</returns>
@@ -1126,7 +1126,7 @@ namespace TeamAAS_VP.Services
         /// 锟斤拷锟斤拷锟斤拷锟斤拷锟脚伙拷取锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷息锟斤拷
         /// 锟斤拷锟斤拷锟斤拷锟斤拷锟脚伙拷取锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷息锟斤拷
         /// </summary>
         /// </summary>
         /// <param name="taskNumber">锟斤拷锟斤拷锟脚o拷TaskCode锟斤拷锟斤拷</param>
         /// <param name="taskNumber">锟斤拷锟斤拷锟脚o拷TaskCode锟斤拷锟斤拷</param>
-        /// <returns>匹锟斤拷锟� <see cref="FeederClearWork"/>锟斤拷锟揭诧拷锟斤拷锟斤拷锟斤拷 <c>null</c>锟斤拷</returns>
+        /// <returns>匹锟斤拷锟?<see cref="FeederClearWork"/>锟斤拷锟揭诧拷锟斤拷锟斤拷锟斤拷 <c>null</c>锟斤拷</returns>
         public FeederClearWork GetClearanceTaskByNumber(int taskNumber)
         public FeederClearWork GetClearanceTaskByNumber(int taskNumber)
         {
         {
             lock (_sync) { return FeederClearanceTasks.FirstOrDefault(t => t.TaskCode == taskNumber); }
             lock (_sync) { return FeederClearanceTasks.FirstOrDefault(t => t.TaskCode == taskNumber); }
@@ -1150,21 +1150,21 @@ namespace TeamAAS_VP.Services
         /// 锟竭程帮拷全锟斤拷锟矫凤拷锟斤拷锟斤拷锟节存集锟较斤拷锟斤拷只锟斤拷锟斤拷锟绞诧拷锟斤拷锟节诧拷锟斤拷锟斤拷锟斤拷
         /// 锟竭程帮拷全锟斤拷锟矫凤拷锟斤拷锟斤拷锟节存集锟较斤拷锟斤拷只锟斤拷锟斤拷锟绞诧拷锟斤拷锟节诧拷锟斤拷锟斤拷锟斤拷
         /// </summary>
         /// </summary>
         /// <param name="id">锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷识锟斤拷Id锟斤拷锟斤拷</param>
         /// <param name="id">锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷识锟斤拷Id锟斤拷锟斤拷</param>
-        /// <returns>匹锟斤拷锟� <see cref="LightControllerConfig"/> 实锟斤拷锟斤拷锟揭诧拷锟斤拷锟津返伙拷 <c>null</c>锟斤拷</returns>
+        /// <returns>匹锟斤拷锟?<see cref="LightControllerConfig"/> 实锟斤拷锟斤拷锟揭诧拷锟斤拷锟津返伙拷 <c>null</c>锟斤拷</returns>
         public LightControllerConfig GetLightController(int id)
         public LightControllerConfig GetLightController(int id)
         {
         {
             lock (_sync) { return LightControllers.FirstOrDefault(c => c.Id == id); }
             lock (_sync) { return LightControllers.FirstOrDefault(c => c.Id == id); }
         }
         }
 
 
         /// <summary>
         /// <summary>
-        /// 锟斤拷锟斤拷锟斤拷锟斤拷鹿锟皆达拷锟斤拷锟斤拷锟斤拷锟斤拷谩锟�
+        /// 锟斤拷锟斤拷锟斤拷锟斤拷鹿锟皆达拷锟斤拷锟斤拷锟斤拷锟斤拷谩锟?
         /// - 锟斤拷 <paramref name="controller"/> 为 <c>null</c> 锟斤拷锟斤拷 <c>null</c>锟斤拷
         /// - 锟斤拷 <paramref name="controller"/> 为 <c>null</c> 锟斤拷锟斤拷 <c>null</c>锟斤拷
         /// - 锟斤拷锟斤拷时锟斤拷 Id 匹锟斤拷锟斤拷锟斤拷锟筋并锟芥换锟斤拷
         /// - 锟斤拷锟斤拷时锟斤拷 Id 匹锟斤拷锟斤拷锟斤拷锟筋并锟芥换锟斤拷
         /// - 锟斤拷锟斤拷时锟斤拷锟斤拷锟斤拷锟斤拷锟侥匡拷锟斤拷锟斤拷 Id锟斤拷锟斤拷为锟斤拷锟斤拷锟斤拷锟节碉拷每锟斤拷通锟斤拷锟斤拷锟斤拷全锟斤拷通锟斤拷锟斤拷牛锟紾lobalIndex锟斤拷锟斤拷
         /// - 锟斤拷锟斤拷时锟斤拷锟斤拷锟斤拷锟斤拷锟侥匡拷锟斤拷锟斤拷 Id锟斤拷锟斤拷为锟斤拷锟斤拷锟斤拷锟节碉拷每锟斤拷通锟斤拷锟斤拷锟斤拷全锟斤拷通锟斤拷锟斤拷牛锟紾lobalIndex锟斤拷锟斤拷
         /// 锟竭程帮拷全锟斤拷锟斤拷锟节诧拷使锟斤拷 <see cref="_sync"/> 锟斤拷锟斤拷锟斤拷锟较★拷
         /// 锟竭程帮拷全锟斤拷锟斤拷锟节诧拷使锟斤拷 <see cref="_sync"/> 锟斤拷锟斤拷锟斤拷锟较★拷
         /// </summary>
         /// </summary>
-        /// <param name="controller">要锟斤拷锟接伙拷锟斤拷碌锟� <see cref="LightControllerConfig"/> 实锟斤拷锟斤拷</param>
-        /// <returns>锟斤拷锟斤拷锟接伙拷锟斤拷碌锟� <see cref="LightControllerConfig"/> 实锟斤拷锟斤拷锟斤拷锟斤拷为 <c>null</c> 时锟斤拷锟斤拷 <c>null</c>锟斤拷</returns>
+        /// <param name="controller">要锟斤拷锟接伙拷锟斤拷碌锟?<see cref="LightControllerConfig"/> 实锟斤拷锟斤拷</param>
+        /// <returns>锟斤拷锟斤拷锟接伙拷锟斤拷碌锟?<see cref="LightControllerConfig"/> 实锟斤拷锟斤拷锟斤拷锟斤拷为 <c>null</c> 时锟斤拷锟斤拷 <c>null</c>锟斤拷</returns>
         /// <exception cref="ArgumentException">锟斤拷要锟斤拷锟斤拷/锟斤拷锟铰的匡拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟截革拷时锟阶筹拷锟斤拷</exception>
         /// <exception cref="ArgumentException">锟斤拷要锟斤拷锟斤拷/锟斤拷锟铰的匡拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟截革拷时锟阶筹拷锟斤拷</exception>
         public LightControllerConfig AddOrUpdateLightController(LightControllerConfig controller)
         public LightControllerConfig AddOrUpdateLightController(LightControllerConfig controller)
         {
         {
@@ -1185,10 +1185,10 @@ namespace TeamAAS_VP.Services
                 else
                 else
                 {
                 {
                     // 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷
                     // 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷
-                    // 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷为锟斤拷前锟斤拷锟� Id + 1锟斤拷锟斤拷锟斤拷锟斤拷为锟斤拷锟斤拷为 1锟斤拷
+                    // 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷为锟斤拷前锟斤拷锟?Id + 1锟斤拷锟斤拷锟斤拷锟斤拷为锟斤拷锟斤拷为 1锟斤拷
                     controller.Id = LightControllers.Count > 0 ? LightControllers.Max(c => c.Id) + 1 : 1;
                     controller.Id = LightControllers.Count > 0 ? LightControllers.Max(c => c.Id) + 1 : 1;
 
 
-                    // 锟斤拷锟斤拷锟斤拷一锟斤拷全锟斤拷通锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟窖达拷锟节匡拷锟斤拷锟斤拷锟斤拷通锟斤拷 GlobalIndex 锟斤拷取锟斤拷锟街碉拷锟斤拷锟�1
+                    // 锟斤拷锟斤拷锟斤拷一锟斤拷全锟斤拷通锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟窖达拷锟节匡拷锟斤拷锟斤拷锟斤拷通锟斤拷 GlobalIndex 锟斤拷取锟斤拷锟街碉拷锟斤拷锟?
                     int nextGlobal = 0;
                     int nextGlobal = 0;
                     if (LightControllers.SelectMany(c => c.ChannelConfigs).Any())
                     if (LightControllers.SelectMany(c => c.ChannelConfigs).Any())
                     {
                     {
@@ -1209,17 +1209,17 @@ namespace TeamAAS_VP.Services
                     LightControllers.Add(controller);
                     LightControllers.Add(controller);
                 }
                 }
             }
             }
-            // 锟街久伙拷锟斤拷锟铰猴拷墓锟皆达拷锟斤拷锟斤拷锟斤拷锟斤拷锟�
+            // 锟街久伙拷锟斤拷锟铰猴拷墓锟皆达拷锟斤拷锟斤拷锟斤拷锟斤拷锟?
             FileHelper.WriteJsonFile(LightControllers, ConfigPaths.LightControllersConfigurationPath);
             FileHelper.WriteJsonFile(LightControllers, ConfigPaths.LightControllersConfigurationPath);
             return controller;
             return controller;
         }
         }
 
 
         /// <summary>
         /// <summary>
-        /// 锟斤拷锟斤拷 Id 锟狡筹拷锟斤拷源锟斤拷锟斤拷锟斤拷锟斤拷锟矫诧拷锟斤拷剩锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷卤锟脚o拷锟斤拷 1 锟斤拷始锟斤拷锟斤拷锟斤拷牛锟斤拷锟�
-        /// 锟斤拷锟斤拷锟斤拷志没锟斤拷锟斤拷锟斤拷募锟斤拷锟�
+        /// 锟斤拷锟斤拷 Id 锟狡筹拷锟斤拷源锟斤拷锟斤拷锟斤拷锟斤拷锟矫诧拷锟斤拷剩锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷卤锟脚o拷锟斤拷 1 锟斤拷始锟斤拷锟斤拷锟斤拷牛锟斤拷锟?
+        /// 锟斤拷锟斤拷锟斤拷志没锟斤拷锟斤拷锟斤拷募锟斤拷锟?
         /// </summary>
         /// </summary>
         /// <param name="id">要锟狡筹拷锟侥匡拷锟斤拷锟斤拷 Id锟斤拷</param>
         /// <param name="id">要锟狡筹拷锟侥匡拷锟斤拷锟斤拷 Id锟斤拷</param>
-        /// <returns>锟斤拷锟斤拷晒锟斤拷瞥锟斤拷锟斤拷锟� <c>true</c>锟斤拷锟斤拷锟津返伙拷 <c>false</c>锟斤拷锟斤拷锟斤拷未锟揭碉拷锟斤拷 Id锟斤拷锟斤拷</returns>
+        /// <returns>锟斤拷锟斤拷晒锟斤拷瞥锟斤拷锟斤拷锟?<c>true</c>锟斤拷锟斤拷锟津返伙拷 <c>false</c>锟斤拷锟斤拷锟斤拷未锟揭碉拷锟斤拷 Id锟斤拷锟斤拷</returns>
         public bool RemoveLightController(int id)
         public bool RemoveLightController(int id)
         {
         {
             bool result = false;
             bool result = false;
@@ -1229,7 +1229,7 @@ namespace TeamAAS_VP.Services
                 if (e != null)
                 if (e != null)
                     result = LightControllers.Remove(e);
                     result = LightControllers.Remove(e);
 
 
-                // 锟斤拷锟铰帮拷 Id 锟斤拷锟津并达拷 1 锟斤拷始锟斤拷锟铰憋拷牛锟斤拷员锟斤拷锟斤拷锟斤拷锟斤拷锟�
+                // 锟斤拷锟铰帮拷 Id 锟斤拷锟津并达拷 1 锟斤拷始锟斤拷锟铰憋拷牛锟斤拷员锟斤拷锟斤拷锟斤拷锟斤拷锟?
                 int no = 1;
                 int no = 1;
                 var sorted = LightControllers.OrderBy(c => c.Id).ToList();
                 var sorted = LightControllers.OrderBy(c => c.Id).ToList();
                 foreach (var c in sorted)
                 foreach (var c in sorted)
@@ -1248,7 +1248,7 @@ namespace TeamAAS_VP.Services
         }
         }
 
 
         /// <summary>
         /// <summary>
-        /// 锟叫讹拷锟角凤拷锟斤拷锟街革拷锟� Id 锟侥癸拷源锟斤拷锟斤拷锟斤拷锟斤拷
+        /// 锟叫讹拷锟角凤拷锟斤拷锟街革拷锟?Id 锟侥癸拷源锟斤拷锟斤拷锟斤拷锟斤拷
         /// </summary>
         /// </summary>
         /// <param name="id">锟斤拷锟斤拷锟斤拷 Id锟斤拷</param>
         /// <param name="id">锟斤拷锟斤拷锟斤拷 Id锟斤拷</param>
         /// <returns>锟斤拷锟节凤拷锟斤拷 <c>true</c>锟斤拷锟斤拷锟津返伙拷 <c>false</c>锟斤拷</returns>
         /// <returns>锟斤拷锟节凤拷锟斤拷 <c>true</c>锟斤拷锟斤拷锟津返伙拷 <c>false</c>锟斤拷</returns>
@@ -1257,7 +1257,7 @@ namespace TeamAAS_VP.Services
         /// <summary>
         /// <summary>
         /// 锟斤拷取锟斤拷锟叫癸拷源通锟斤拷锟斤拷只锟斤拷锟斤拷锟较o拷锟斤拷 GlobalIndex 锟斤拷锟津返回★拷
         /// 锟斤拷取锟斤拷锟叫癸拷源通锟斤拷锟斤拷只锟斤拷锟斤拷锟较o拷锟斤拷 GlobalIndex 锟斤拷锟津返回★拷
         /// </summary>
         /// </summary>
-        /// <returns>锟斤拷 GlobalIndex 锟斤拷锟斤拷锟� <see cref="ChannelConfig"/> 只锟斤拷锟斤拷锟较★拷</returns>
+        /// <returns>锟斤拷 GlobalIndex 锟斤拷锟斤拷锟?<see cref="ChannelConfig"/> 只锟斤拷锟斤拷锟较★拷</returns>
         public IReadOnlyCollection<ChannelConfig> GetAllLightChannels()
         public IReadOnlyCollection<ChannelConfig> GetAllLightChannels()
         {
         {
             lock (_sync) { return LightControllers.SelectMany(c => c.ChannelConfigs).OrderBy(ch => ch.GlobalIndex).ToList().AsReadOnly(); }
             lock (_sync) { return LightControllers.SelectMany(c => c.ChannelConfigs).OrderBy(ch => ch.GlobalIndex).ToList().AsReadOnly(); }
@@ -1267,14 +1267,14 @@ namespace TeamAAS_VP.Services
         /// 锟斤拷锟斤拷全锟斤拷通锟斤拷锟斤拷锟斤拷锟斤拷取锟斤拷锟斤拷通锟斤拷锟斤拷锟矫★拷
         /// 锟斤拷锟斤拷全锟斤拷通锟斤拷锟斤拷锟斤拷锟斤拷取锟斤拷锟斤拷通锟斤拷锟斤拷锟矫★拷
         /// </summary>
         /// </summary>
         /// <param name="globalIndex">通锟斤拷锟斤拷全锟斤拷锟斤拷锟斤拷锟斤拷GlobalIndex锟斤拷锟斤拷</param>
         /// <param name="globalIndex">通锟斤拷锟斤拷全锟斤拷锟斤拷锟斤拷锟斤拷GlobalIndex锟斤拷锟斤拷</param>
-        /// <returns>匹锟斤拷锟� <see cref="ChannelConfig"/> 实锟斤拷锟斤拷锟揭诧拷锟斤拷锟津返伙拷 <c>null</c>锟斤拷</returns>
+        /// <returns>匹锟斤拷锟?<see cref="ChannelConfig"/> 实锟斤拷锟斤拷锟揭诧拷锟斤拷锟津返伙拷 <c>null</c>锟斤拷</returns>
         public ChannelConfig GetLightChannelByGlobalIndex(int globalIndex)
         public ChannelConfig GetLightChannelByGlobalIndex(int globalIndex)
         {
         {
             lock (_sync) { return LightControllers.SelectMany(c => c.ChannelConfigs).FirstOrDefault(ch => ch.GlobalIndex == globalIndex); }
             lock (_sync) { return LightControllers.SelectMany(c => c.ChannelConfigs).FirstOrDefault(ch => ch.GlobalIndex == globalIndex); }
         }
         }
 
 
         /// <summary>
         /// <summary>
-        /// 锟叫讹拷锟角凤拷锟斤拷锟街革拷锟饺�拷锟酵�拷锟斤拷锟斤拷锟斤拷锟酵�拷锟斤拷锟斤拷谩锟�
+        /// 锟叫讹拷锟角凤拷锟斤拷锟街革拷锟饺�拷锟酵�拷锟斤拷锟斤拷锟斤拷锟酵�拷锟斤拷锟斤拷谩锟?
         /// </summary>
         /// </summary>
         /// <param name="globalIndex">全锟斤拷通锟斤拷锟斤拷锟斤拷锟斤拷</param>
         /// <param name="globalIndex">全锟斤拷通锟斤拷锟斤拷锟斤拷锟斤拷</param>
         /// <returns>锟斤拷锟节凤拷锟斤拷 <c>true</c>锟斤拷锟斤拷锟津返伙拷 <c>false</c>锟斤拷</returns>
         /// <returns>锟斤拷锟节凤拷锟斤拷 <c>true</c>锟斤拷锟斤拷锟津返伙拷 <c>false</c>锟斤拷</returns>
@@ -1356,8 +1356,8 @@ namespace TeamAAS_VP.Services
         public ScrewFeederInfo GetScrewFeeder(Guid id) { lock (_sync) { return ScrewFeeders.FirstOrDefault(s => s.Id == id); } }
         public ScrewFeederInfo GetScrewFeeder(Guid id) { lock (_sync) { return ScrewFeeders.FirstOrDefault(s => s.Id == id); } }
 
 
         /// <summary>
         /// <summary>
-        /// 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟剿匡拷锟斤拷锟斤拷锟斤拷锟斤拷谩锟�
-        /// 锟斤拷锟斤拷时锟斤拷未指锟斤拷 FeederNumber 锟斤拷锟斤拷锟轿�拷锟角帮拷锟斤拷锟�+1锟斤拷
+        /// 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟剿匡拷锟斤拷锟斤拷锟斤拷锟斤拷谩锟?
+        /// 锟斤拷锟斤拷时锟斤拷未指锟斤拷 FeederNumber 锟斤拷锟斤拷锟轿�拷锟角帮拷锟斤拷锟?1锟斤拷
         /// </summary>
         /// </summary>
         public ScrewFeederInfo AddOrUpdateScrewFeeder(ScrewFeederInfo feeder)
         public ScrewFeederInfo AddOrUpdateScrewFeeder(ScrewFeederInfo feeder)
         {
         {
@@ -1401,7 +1401,7 @@ namespace TeamAAS_VP.Services
         public event Action<ScrewFeederInfo> ScrewFeederLowLevelAlarmTriggered;
         public event Action<ScrewFeederInfo> ScrewFeederLowLevelAlarmTriggered;
 
 
         /// <summary>
         /// <summary>
-        /// 锟斤拷取指锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷诺锟绞o拷锟斤拷锟剿匡拷锟斤拷锟斤拷锟斤拷也锟斤拷锟斤拷锟斤拷锟� -1锟斤拷
+        /// 锟斤拷取指锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷诺锟绞o拷锟斤拷锟剿匡拷锟斤拷锟斤拷锟斤拷也锟斤拷锟斤拷锟斤拷锟?-1锟斤拷
         /// </summary>
         /// </summary>
         public int GetRemainingCountByFeederNumber(int feederNumber)
         public int GetRemainingCountByFeederNumber(int feederNumber)
         {
         {
@@ -1414,7 +1414,7 @@ namespace TeamAAS_VP.Services
         }
         }
 
 
         /// <summary>
         /// <summary>
-        /// 锟斤拷取指锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷诺牡锟斤拷锟斤拷锟斤拷锟阶刺�拷锟斤拷也锟斤拷锟斤拷锟斤拷锟� false锟斤拷
+        /// 锟斤拷取指锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷诺牡锟斤拷锟斤拷锟斤拷锟阶刺�拷锟斤拷也锟斤拷锟斤拷锟斤拷锟?false锟斤拷
         /// </summary>
         /// </summary>
         public bool GetLowLevelAlarmStatusByFeederNumber(int feederNumber)
         public bool GetLowLevelAlarmStatusByFeederNumber(int feederNumber)
         {
         {
@@ -1452,7 +1452,7 @@ namespace TeamAAS_VP.Services
         }
         }
 
 
         /// <summary>
         /// <summary>
-        /// 为指锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷诺菁锟街革拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷惴碉拷锟� -1
+        /// 为指锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷诺菁锟街革拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷惴碉拷锟?-1
         /// </summary>
         /// </summary>
         public int DecrementScrewCountByFeederNumber(int feederNumber, int decrement = 1)
         public int DecrementScrewCountByFeederNumber(int feederNumber, int decrement = 1)
         {
         {
@@ -1557,7 +1557,7 @@ namespace TeamAAS_VP.Services
                 }
                 }
                 catch
                 catch
                 {
                 {
-                    // 锟斤拷锟斤拷锟斤拷锟捷匡拷写锟斤拷锟斤拷螅�锟铰硷拷锟斤拷锟斤拷锟斤拷锟街�
+                    // 锟斤拷锟斤拷锟斤拷锟捷匡拷写锟斤拷锟斤拷螅�锟铰硷拷锟斤拷锟斤拷锟斤拷锟街?
                 }
                 }
             }
             }
             catch
             catch
@@ -1567,7 +1567,7 @@ namespace TeamAAS_VP.Services
         }
         }
 
 
         /// <summary>
         /// <summary>
-        /// 锟斤拷锟绞o拷锟斤拷锟剿匡拷欠癖ň锟�
+        /// 锟斤拷锟绞o拷锟斤拷锟剿匡拷欠癖ň锟?
         /// </summary>
         /// </summary>
         public bool CheckAlarm(int feederNumber)
         public bool CheckAlarm(int feederNumber)
         {
         {

+ 328 - 0
TeamAAS-VM/Services/RemoteCommandService.cs

@@ -5,6 +5,7 @@ using Microsoft.CodeAnalysis.Scripting;
 using NPOI.SS.Formula.Functions;
 using NPOI.SS.Formula.Functions;
 using NPOI.SS.UserModel;
 using NPOI.SS.UserModel;
 using NPOI.XSSF.Streaming.Values;
 using NPOI.XSSF.Streaming.Values;
+using OpenCvSharp.Flann;
 using Org.BouncyCastle.Tls;
 using Org.BouncyCastle.Tls;
 using Prism.Events;
 using Prism.Events;
 using Prism.Ioc;
 using Prism.Ioc;
@@ -1610,6 +1611,221 @@ namespace TeamAAS_VP.Services
                 return false;
                 return false;
             }
             }
         }
         }
+        /// <summary>
+        /// 执行翻转相机拍照流程运行
+        /// </summary>
+        /// <param name="procedure"></param>
+        /// <param name="outputCollection"></param>
+        /// <returns></returns>
+        public bool ExecutePhotoGetDistance(ProcedureModel procedure, Dictionary<string, string> InputTerminal)
+        {
+            try
+            {
+                //string dis = "";
+                //拍照失败时,需要多次拍照
+                for (int i = 0; i < procedure.FeederFailLimit; i++)
+                {
+                    SendTaskMessage(Lang.开始执行视觉流程.Replace("{0}", $"{i + 1}").Replace("{1}", procedure.Name), MessageLevel.Info);
+
+                    // 1. 执行相机拍照并运行视觉工具
+                    bool visionSucceed = ExecutePhotos(procedure, InputTerminal, out CogToolBlockTerminalCollection outputCollection);
+                    if (!visionSucceed)
+                    {
+                        SendTaskMessage(Lang.视觉任务执行失败, MessageLevel.Error);
+                        return false;
+                    }
+
+                    if (!outputCollection.Contains("Found"))
+                    {
+                        SendTaskMessage(Lang.未找到视觉输出结果, MessageLevel.Error);
+                        return false;
+                    }
+
+                    // 2. 获取视觉输出结果NA
+                    bool Found = (bool)(outputCollection["Found"].Value);
+                    if (!Found)
+                    {
+                        SendTaskMessage(Lang.拍照NG, MessageLevel.Debug);
+                        //dis = (string)(outputCollection["dis"].Value);
+                        return false;
+                    }
+
+                    SendTaskMessage(Lang.拍照OK, MessageLevel.Debug);
+
+                    LogHelper.WriteLogInfo("开始获取视觉输出结果");
+                    //dis = (string)(outputCollection["dis"].Value);
+                    return true;
+                }
+                SendTaskMessage(Lang.多次拍照失败, MessageLevel.Alarm);
+                return false;
+            }
+            catch (Exception ex)
+            {
+                LogHelper.WriteLogError("执行相机取图并获取单点位时出错!", ex);
+                return false;
+            }
+        }
+
+        /// <summary>
+        /// 翻转相机拍照方法
+        /// 该方法会发布 RenderUpdateNotification 以更新 UI。
+        /// </summary>
+        public bool ExecutePhotos(ProcedureModel procedure, Dictionary<string, string> InputTerminal, out CogToolBlockTerminalCollection outputCollection)
+        {
+            try
+            {
+                // 1. 采集图像
+                var camera = _cameraService.GetCamera(procedure.CameraId);
+                bool succed = camera.SetExposureTime(procedure.ExposureTime);
+                if (!succed)
+                {
+                    SendTaskMessage($"相机曝光设置失败!", MessageLevel.Error);
+                }
+                succed = camera.SetGain(procedure.Gain);
+                if (!succed)
+                {
+                    SendTaskMessage($"相机增益设置失败!", MessageLevel.Error);
+                }
+                DateTime nowtime = DateTime.Now;
+                LogHelper.WriteLogInfo("开始采集图像");
+                //var image = camera.Grab();
+                var image = camera.Grab();
+
+                if (image == null)
+                {
+
+                    SendTaskMessage(Lang.图像采集失败, MessageLevel.Error);
+                    outputCollection = null;
+                    return false;
+                }
+                procedure.ToolBlock.Inputs["InputImage"].Value = image;
+                LogHelper.WriteLogInfo($"采集图像完成;用时:{(DateTime.Now - nowtime).Milliseconds}ms");
+
+                // 2. 为ToolBlock传入其他输入终端
+                if (InputTerminal != null)
+                {
+                    LogHelper.WriteLogInfo($"为ToolBlock传入输入终端");
+                    foreach (var item in InputTerminal)
+                    {
+                        if (procedure.ToolBlock.Inputs.Contains(item.Key))
+                        {
+                            LogHelper.WriteLogInfo($"传入[{item.Key}]={item.Value}");
+                            procedure.ToolBlock.Inputs[item.Key].Value = item.Value;
+                        }
+                        else
+                        {
+                            LogHelper.WriteLogInfo($"创建并传入[{item.Key}]={item.Value}");
+                            procedure.ToolBlock.Inputs.Add(new CogToolBlockTerminal(item.Key, item.Value));
+                        }
+                    }
+                }
+
+                LogHelper.WriteLogInfo(Lang.开始运行视觉工具);
+                procedure.ToolBlock.Run();      //运行ToolBlock
+
+                if (procedure.ToolBlock.RunStatus.Result == CogToolResultConstants.Accept)
+                {
+                    SendTaskMessage(Lang.视觉流程执行耗时.Replace("{0}", procedure.Name).Replace("{1}", $"{procedure.ToolBlock.RunStatus.ProcessingTime:F1}"), MessageLevel.Info);
+                    outputCollection = procedure.ToolBlock.Outputs;     //获取输出终端集合
+                    DatabaseHelper.AddCameraRecords(_productService.GetCurrentProduct().Name, procedure.Name, outputCollection);
+                    ICogRecord record = null;
+                    foreach (CogToolBlockTerminal item in outputCollection)
+                    {
+                        if (item.Value is ICogRecord)
+                            record = item.Value as ICogRecord;
+                    }
+                    bool Found = (bool)(outputCollection["Found"].Value);
+                    //获取图片存储的图片文件名
+                    string imgName = string.Empty;
+                    if (procedure.IsSaveImage && !string.IsNullOrEmpty(procedure.ImageFileNameFormat))
+                    {
+                        // 创建模板,使用 {变量名:格式} 语法
+                        var template = new FileNameTemplate(procedure.ImageFileNameFormat);
+
+                        // 注册变量
+                        template.RegisterVariable("ProductSN", () => _productService.CurrentProductCode);
+                        template.RegisterVariable("CameraName", () => procedure.CameraName);
+                        //template.RegisterVariable("ShotCount", () => 1);
+                        template.RegisterVariable("Result", () => Found ? "OK" : "NG");
+                        //template.RegisterVariable("Number", () => 1);
+                        template.RegisterVariable("DateTime", () => DateTime.Now);
+
+                        // 生成文件名
+                        imgName = template.Generate();
+                    }
+
+                    _eventAggregator.GetEvent<RenderUpdateNotification>().Publish(new ShowRender()
+                    {
+                        Id = procedure.Id,
+                        Image = (ICogImage)procedure.ToolBlock.Inputs["InputImage"].Value,
+                        Graphic = outputCollection["Graphic"].Value as CogGraphicCollection,
+                        Record = record,
+                        Result = Found,
+                        IsShow = true,
+                        IsSaveImage = procedure.IsSaveImage,
+                        SaveImageModel = procedure.SaveImageModel,
+                        SaveImagePathModel = procedure.SaveImagePathModel,
+                        SavePath = procedure.SavePath,
+                        IsCompress = procedure.IsCompress,
+                        IsDelaySaveImage = procedure.IsDelaySaveImage,
+                        //ImgPara = imgPara,
+                        ImageFileName = imgName,
+                        ProceductName = procedure.Name,
+                    });
+                    SendTaskMessage($"{procedure.CameraName},{procedure.CameraId}", MessageLevel.Info);
+                    return true;
+                }
+                else
+                {
+                    SendTaskMessage(Lang.视觉流程执行出错耗时.Replace("{0}", procedure.Name).Replace("{1}", $"{procedure.ToolBlock.RunStatus.ProcessingTime:F1}"), MessageLevel.Error);
+                    SendTaskMessage(procedure.ToolBlock.RunStatus.Message, MessageLevel.Error);
+                    outputCollection = null;
+
+                    //获取图片存储的图片文件名
+                    string imgName = string.Empty;
+                    if (procedure.IsSaveImage && !string.IsNullOrEmpty(procedure.ImageFileNameFormat))
+                    {
+                        // 创建模板,使用 {变量名:格式} 语法
+                        var template = new FileNameTemplate(procedure.ImageFileNameFormat);
+
+                        // 注册变量
+                        template.RegisterVariable("ProductSN", () => _productService.CurrentProductCode);
+                        template.RegisterVariable("CameraName", () => procedure.CameraName);
+                        //template.RegisterVariable("ShotCount", () => index);
+                        template.RegisterVariable("Result", () => "NG");
+                        template.RegisterVariable("DateTime", () => DateTime.Now);
+
+                        // 生成文件名
+                        imgName = template.Generate();
+                    }
+                    _eventAggregator.GetEvent<RenderUpdateNotification>().Publish(new ShowRender()
+                    {
+                        Id = procedure.Id,
+                        Image = (ICogImage)procedure.ToolBlock.Inputs["InputImage"].Value,
+                        Graphic = new CogGraphicCollection(),
+                        Result = false,
+                        IsShow = true,
+                        IsSaveImage = procedure.IsSaveImage,
+                        SaveImageModel = procedure.SaveImageModel,
+                        SaveImagePathModel = procedure.SaveImagePathModel,
+                        SavePath = procedure.SavePath,
+                        IsCompress = procedure.IsCompress,
+                        IsDelaySaveImage = procedure.IsDelaySaveImage,
+                        ProceductName = procedure.Name,
+                        ImageFileName = imgName
+                    });
+                    return false;
+                }
+            }
+            catch (Exception ex)
+            {
+                SendTaskMessage(ex.Message, MessageLevel.Error);
+                LogHelper.WriteLogError("执行相机取图并执行视觉工具组时出错!", ex);
+                outputCollection = null;
+                return false;
+            }
+        }
+
         /// <summary>
         /// <summary>
         /// 执行拍照二维码流程运行
         /// 执行拍照二维码流程运行
         /// </summary>
         /// </summary>
@@ -1848,6 +2064,118 @@ namespace TeamAAS_VP.Services
             }
             }
         }
         }
 
 
+        /// <summary>
+        /// 执行相机拍照螺丝点位结果
+        /// </summary>
+        /// <param name="procedure"></param>
+        /// <param name="InputTerminal"></param>
+        /// <param name="robotCoord"></param>
+        /// <param name="cancellationToken"></param>
+        /// <param name="positionIndex"></param>
+        /// <param name="remark"></param>
+        /// <returns></returns>
+        public async Task<(bool IsSucceed, double X, double Y, double U)> ExecutePhotoGetSinglePoint1(ProcedureModel procedure, Dictionary<string, string> InputTerminal, double[] robotCoord, CancellationToken cancellationToken, int positionIndex, int num, string remark, ImageParameters imgPara)
+        {
+            var systemConfig = _configService.GetSystemConfiguration();
+            DateTime nowtime = DateTime.Now;
+            if (systemConfig.IsBasePartOpenLight)
+            {
+                if (positionIndex == 0 || positionIndex == 1)
+                {
+                    await SetLightBeforePhoto(procedure);
+                }
+            }
+            else
+            {
+                await SetLightBeforePhoto(procedure);
+            }
+
+            try
+            {
+                //拍照失败时,需要多次拍照
+                for (int i = 0; i < procedure.FeederFailLimit; i++)
+                {
+                    SendTaskMessage(Lang.开始执行视觉流程.Replace("{0}", $"{i + 1}").Replace("{1}", procedure.Name), MessageLevel.Info);
+
+                    // 1. 执行相机拍照并运行视觉工具
+                    bool visionSucceed = ExecutePhoto(i + 1, procedure, InputTerminal, out CogToolBlockTerminalCollection outputCollection, imgPara);
+                    if (!visionSucceed)
+                    {
+                        SendTaskMessage(Lang.视觉任务执行失败, MessageLevel.Error);
+                        continue;
+                    }
+
+                    if (!outputCollection.Contains("Found"))
+                    {
+                        SendTaskMessage(Lang.未找到视觉输出结果, MessageLevel.Error);
+                        await RecordPhotoCaptureAsync(procedure, robotCoord, false, new double[] { 0, 0, 0 }, new double[] { 0, 0, 0 }, string.Empty, positionIndex, remark);
+                        return (false, 0, 0, 0);
+                    }
+                    // 2. 获取视觉输出结果
+                    bool Found = (bool)(outputCollection["Found"].Value);
+                    if (!Found)
+                    {
+                        SendTaskMessage(Lang.拍照NG, MessageLevel.Debug);
+                        continue;
+                    }
+                    SendTaskMessage(Lang.拍照OK, MessageLevel.Debug);
+
+                    if (procedure.CalibrationId == Guid.Empty)
+                    {
+                        //没有关联校准时,则执行检测任务
+                        await RecordPhotoCaptureAsync(procedure, robotCoord, true, new double[] { 0, 0, 0 }, new double[] { 0, 0, 0 }, string.Empty, positionIndex, remark);
+                        return (true, 0, 0, 0);
+                    }
+
+                    // 3. 获取视觉输出结果
+                    LogHelper.WriteLogInfo(Lang.开始获取视觉输出结果);
+                    //获取相机校准
+                    var calib = _calibrationService.GetCalibration(procedure.CalibrationId);
+                    string points = (string)(outputCollection["Point"].Value);
+                    string[] strpoints = points.Split(';');
+                    //先将pos按照逗号进行分隔,拿到数组
+                    var posParts = strpoints[0].Split(',');
+                    double _pixel_x = double.Parse(posParts[0]);
+                    double _pixel_y = double.Parse(posParts[1]);
+                    double _pixel_u = double.Parse(posParts[2]);
+                    //转换点位-像素转换成机器人绝对坐标
+                    var calibResult = _calibrationService.ConvertPixelToPosition((_pixel_x, _pixel_y, _pixel_u), robotCoord, calib, RobotBrand.XYZ_Platform);
+                    if (!calibResult.IsSucceed)
+                    {
+                        await RecordPhotoCaptureAsync(procedure, robotCoord, false, new double[] { _pixel_x, _pixel_y, _pixel_u }, new double[] { 0, 0, 0 }, string.Empty, positionIndex, remark);
+                        return (false, 0, 0, 0);
+                    }
+                    await RecordPhotoCaptureAsync(procedure, robotCoord, true, new double[] { _pixel_x, _pixel_y, _pixel_u }, new double[] { calibResult.X, calibResult.Y, calibResult.U }, string.Empty, positionIndex, remark);
+                    return (true, calibResult.X, calibResult.Y, calibResult.U);
+                }
+                SendTaskMessage(Lang.多次拍照失败, MessageLevel.Alarm);
+                await RecordPhotoCaptureAsync(procedure, robotCoord, false, new double[] { 0, 0, 0 }, new double[] { 0, 0, 0 }, string.Empty, positionIndex, remark);
+                return (false, 0, 0, 0);
+            }
+            catch (Exception ex)
+            {
+                LogHelper.WriteLogError(Lang.执行相机取图并获取单点位时出错, ex);
+                await RecordPhotoCaptureAsync(procedure, robotCoord, false, new double[] { 0, 0, 0 }, new double[] { 0, 0, 0 }, string.Empty, positionIndex, remark);
+                return (false, 0, 0, 0);
+            }
+            finally
+            {
+                if (systemConfig.IsBasePartOpenLight)
+                {
+                    if (positionIndex == num)
+                    {
+                        await TurnOffLightAfterPhoto(procedure);
+                    }
+                }
+                else
+                {
+                    await TurnOffLightAfterPhoto(procedure);
+                }
+
+            }
+        }
+
+
         /// <summary>
         /// <summary>
         /// 执行相机拍照获取单个点位结果
         /// 执行相机拍照获取单个点位结果
         /// </summary>
         /// </summary>

+ 9 - 0
TeamAAS-VM/TeamAAS-VP.csproj

@@ -557,6 +557,7 @@
     <Compile Include="Models\ImageParameters.cs" />
     <Compile Include="Models\ImageParameters.cs" />
     <Compile Include="Models\NozzleChangeRecord.cs" />
     <Compile Include="Models\NozzleChangeRecord.cs" />
     <Compile Include="Models\NumberStatistics.cs" />
     <Compile Include="Models\NumberStatistics.cs" />
+    <Compile Include="Models\PLC\PlcExcelLoad.cs" />
     <Compile Include="Models\ProductWithMes.cs" />
     <Compile Include="Models\ProductWithMes.cs" />
     <Compile Include="Models\Product\ProductGlobalParamEx.cs" />
     <Compile Include="Models\Product\ProductGlobalParamEx.cs" />
     <Compile Include="Models\ThrowRecord.cs" />
     <Compile Include="Models\ThrowRecord.cs" />
@@ -577,6 +578,7 @@
     <Compile Include="Services\MesService.cs" />
     <Compile Include="Services\MesService.cs" />
     <Compile Include="Services\ShiftWatcherService.cs" />
     <Compile Include="Services\ShiftWatcherService.cs" />
     <Compile Include="ValueConverter\ImageFileNameFormatConverter.cs" />
     <Compile Include="ValueConverter\ImageFileNameFormatConverter.cs" />
+    <Compile Include="ViewModels\AddScrewViewModel.cs" />
     <Compile Include="ViewModels\Home\ImagePreviewWindowViewModel.cs" />
     <Compile Include="ViewModels\Home\ImagePreviewWindowViewModel.cs" />
     <Compile Include="ViewModels\Home\PickScrewAccuracyAnalyzerViewModel.cs" />
     <Compile Include="ViewModels\Home\PickScrewAccuracyAnalyzerViewModel.cs" />
     <Compile Include="ViewModels\Product\PlcPointOffserParamsViewModel.cs" />
     <Compile Include="ViewModels\Product\PlcPointOffserParamsViewModel.cs" />
@@ -596,6 +598,9 @@
     <Compile Include="ViewModels\Statistics\LockResultRecoredQueryViewModel.cs" />
     <Compile Include="ViewModels\Statistics\LockResultRecoredQueryViewModel.cs" />
     <Compile Include="ViewModels\Product\VisionStaticAccuracyAnalyzerViewModel.cs" />
     <Compile Include="ViewModels\Product\VisionStaticAccuracyAnalyzerViewModel.cs" />
     <Compile Include="ViewModels\Product\VisionDynamicAccuracyAnalyzerViewModel.cs" />
     <Compile Include="ViewModels\Product\VisionDynamicAccuracyAnalyzerViewModel.cs" />
+    <Compile Include="Views\AddScrewView.xaml.cs">
+      <DependentUpon>AddScrewView.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Views\DebugMod\FocusAnalyzerl.xaml.cs">
     <Compile Include="Views\DebugMod\FocusAnalyzerl.xaml.cs">
       <DependentUpon>FocusAnalyzerl.xaml</DependentUpon>
       <DependentUpon>FocusAnalyzerl.xaml</DependentUpon>
     </Compile>
     </Compile>
@@ -1181,6 +1186,10 @@
       <SubType>Designer</SubType>
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
       <Generator>MSBuild:Compile</Generator>
     </Page>
     </Page>
+    <Page Include="Views\AddScrewView.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="Views\DebugMod\FocusAnalyzerl.xaml">
     <Page Include="Views\DebugMod\FocusAnalyzerl.xaml">
       <SubType>Designer</SubType>
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
       <Generator>MSBuild:Compile</Generator>

+ 193 - 0
TeamAAS-VM/ViewModels/AddScrewViewModel.cs

@@ -0,0 +1,193 @@
+using Cognex.VisionPro.MultiLineFinder.Implementation.Internal;
+using Opc.Ua;
+using Prism.Events;
+using Prism.Mvvm;
+using Prism.Regions;
+using Prism.Services.Dialogs;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Input;
+using TeamAAS_VP.Core.PLCs;
+using TeamAAS_VP.Interfaces;
+using TeamAAS_VP.Models;
+using TeamAAS_VP.Views;
+
+namespace TeamAAS_VP.ViewModels
+{
+    public class AddScrewViewModel : BindableBase,IDialogAware
+    {
+        IConfigService _configService;
+        IEventAggregator _eventAggregator;
+        IPlcService _plcService;
+
+
+        private string _UserID;
+        /// <summary>
+        /// 员工工号
+        /// </summary>
+        public string UserID
+        {
+            get { return _UserID; }
+            set { SetProperty(ref _UserID, value); }
+        }
+
+        private string _ScrewsizeCode;
+
+        /// <summary>
+        /// 螺丝条码
+        /// </summary>
+        public string ScrewsizeCode
+        {
+            get { return _ScrewsizeCode; }
+            set { SetProperty(ref _ScrewsizeCode, value); }
+        }
+
+
+        private DelegateCommand _OkCommand;
+        public DelegateCommand OkCommand =>
+            _OkCommand ?? (_OkCommand = new DelegateCommand<string>(OkExecute));
+
+        private DelegateCommand _CancelCommand;
+
+        public event Action<IDialogResult> RequestClose;
+
+        public DelegateCommand CancelCommand =>
+            _CancelCommand ?? (_CancelCommand = new DelegateCommand<string>(CancelExecute));
+
+        public string Title => "";
+
+        public AddScrewViewModel(IConfigService configService, IEventAggregator eventAggregator, IPlcService plcService)
+        {
+            _configService = configService;
+            _eventAggregator = eventAggregator;
+            _plcService = plcService;
+
+        }
+
+
+        private async void OkExecute(string str)
+        {
+            try
+            {
+                var addressConfig = _configService.GetPlcAddresses();
+
+                var plc = _plcService.GetPlcByNumber(addressConfig.PlcNo) as OpcUaClientPLC;
+
+                string a = "";
+                var stationConfig = _configService.GetDeviceInfo(0);
+
+                if (ScrewsizeCode.Contains("|"))
+                {
+                    string[] arr = ScrewsizeCode.Split('|');
+                    //for (int i = 0; i < 16; i++)
+                    //{
+                    //    a += arr[i];
+                    //}
+                    a = arr[0];
+                }
+                else
+                {
+                    a = ScrewsizeCode;
+                }
+                UserID = UserID.Replace("\r\n", "").Trim();
+                if (string.IsNullOrWhiteSpace(a) && string.IsNullOrEmpty(UserID))
+                {
+                    MessageBox.Show("请先扫描螺丝条码", "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
+                    //BarcodeTextBox.Focus(); // 重新聚焦
+                    return;
+                }
+                if (a == stationConfig.DataInfo.Screwsize1 || a == stationConfig.DataInfo.Screwsize2 || a == stationConfig.DataInfo.Screwsize3)
+                {
+                    await plc.WriteNodeAsync<bool>(addressConfig.Out_PlcFail.Address, false);
+                    MessageBox.Show("螺丝型号匹配成功", "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
+                    //SendTaskMessage($"螺丝型号匹配成功", MessageLevel.Info);
+                    ExportDataToCsv(DateTime.Now.ToString("yyyy-MM-dd HH:mm"), a, stationConfig.DataInfo, true, UserID, @"D:\添加螺丝记录\螺丝上料Log.csv", appendMode: true);
+                }
+                else
+                {
+                    await plc.WriteNodeAsync<bool>(addressConfig.Out_PlcFail.Address, true);
+                    MessageBox.Show("螺丝型号匹配失败", "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
+
+                    //SendTaskMessage($"螺丝型号匹配失败", MessageLevel.Error);
+                    ExportDataToCsv(DateTime.Now.ToString("yyyy-MM-dd HH:mm"), a, stationConfig.DataInfo, false, UserID, @"D:\添加螺丝记录\螺丝上料Log.csv", appendMode: true);
+                }
+                //DialogResult = true;
+                //Close();
+            }
+            catch (Exception ex)
+            {
+                MessageBox.Show("螺丝螺丝条码异常", "提示", MessageBoxButton.OK, MessageBoxImage.Error);
+                return;
+            }
+        }
+
+
+        private void CancelExecute(string str)
+        {
+            //DialogResult = false;
+            //Close();
+        }
+        public static void ExportDataToCsv(string dateTime, string model, CTQ_Data DataInfo, bool isMatch,string UserId, string savePath, bool appendMode = false)
+        {
+            string directory = global::System.IO.Path.GetDirectoryName(savePath);
+
+            // 如果目录路径不为空且不存在,则创建
+            if (!string.IsNullOrEmpty(directory) && !Directory.Exists(directory))
+            {
+                Directory.CreateDirectory(directory);
+            }
+
+            // 构建CSV内容
+            StringBuilder csvContent = new StringBuilder();
+
+            // 处理表头:仅当文件不存在/非追加模式时,才写入表头
+            if (!appendMode || !File.Exists(savePath))
+            {
+                //csvContent.AppendLine("日期时间,目标螺丝型号1,螺丝型号2,螺丝型号3,添加螺丝型号,添加螺丝员工,是否匹配");
+                csvContent.AppendLine("DateTime,Screw1,Screw2,Screw3,AddScrew,UserID,Results");
+            }
+
+            // 处理数据行
+            string matchStr = isMatch ? "OK" : "NG";
+
+            // 如果型号中包含逗号,需要用引号包裹
+            string safeModel = model;
+            if (safeModel.Contains(","))
+            {
+                safeModel = $"\"{safeModel}\"";
+            }
+
+            csvContent.AppendLine($"{dateTime},{DataInfo.Screwsize1},{DataInfo.Screwsize2},{DataInfo.Screwsize3},{model},{UserId},{matchStr}");
+
+            // 写入文件:UTF-8带BOM编码,Excel打开无乱码
+            if (appendMode && File.Exists(savePath))
+            {
+                // 追加模式:在文件末尾新增内容
+                File.AppendAllText(savePath, csvContent.ToString(), Encoding.UTF8);
+            }
+            else
+            {
+                // 覆盖模式:新建/替换文件
+                File.WriteAllText(savePath, csvContent.ToString(), Encoding.UTF8);
+            }
+        }
+
+        public bool CanCloseDialog()
+        {
+            return true;
+        }
+
+        public void OnDialogClosed()
+        {
+        }
+
+        public void OnDialogOpened(IDialogParameters parameters)
+        {
+        }
+    }
+}

+ 2 - 2
TeamAAS-VM/ViewModels/Home/AddScrewViewModel.cs

@@ -13,13 +13,13 @@ using TeamAAS_VP.Models.Feeder;
 
 
 namespace TeamAAS_VP.ViewModels.Home
 namespace TeamAAS_VP.ViewModels.Home
 {
 {
-    public class AddScrewViewModel : BindableBase, IDialogAware
+    public class AddScrewViewModel1 : BindableBase, IDialogAware
     {
     {
         private readonly IConfigService _configService;
         private readonly IConfigService _configService;
         private readonly ISystemDatabaseService _systemDatabaseService;
         private readonly ISystemDatabaseService _systemDatabaseService;
         IContainerProvider _container;
         IContainerProvider _container;
 
 
-        public AddScrewViewModel(IConfigService configService, ISystemDatabaseService systemDatabaseService, IContainerProvider containerProvider)
+        public AddScrewViewModel1(IConfigService configService, ISystemDatabaseService systemDatabaseService, IContainerProvider containerProvider)
         {
         {
             _configService = configService;
             _configService = configService;
             _systemDatabaseService = systemDatabaseService;
             _systemDatabaseService = systemDatabaseService;

+ 24 - 3
TeamAAS-VM/ViewModels/HomeViewModel.cs

@@ -31,6 +31,7 @@ using TeamAAS_VP.Models;
 using TeamAAS_VP.Resources.Languages;
 using TeamAAS_VP.Resources.Languages;
 using TeamAAS_VP.Services;
 using TeamAAS_VP.Services;
 using TeamAAS_VP.ViewModels.DebugMod;
 using TeamAAS_VP.ViewModels.DebugMod;
+using TeamAAS_VP.Views;
 using TeamAAS_VP.Views.DebugMod;
 using TeamAAS_VP.Views.DebugMod;
 using static System.Windows.Forms.VisualStyles.VisualStyleElement.StartPanel;
 using static System.Windows.Forms.VisualStyles.VisualStyleElement.StartPanel;
 
 
@@ -45,6 +46,7 @@ namespace TeamAAS_VP.ViewModels
         IRemoteCommandService _remoteCommandService;
         IRemoteCommandService _remoteCommandService;
         ISystemDatabaseService _systemDatabaseService;
         ISystemDatabaseService _systemDatabaseService;
         IDialogService _dialogService;
         IDialogService _dialogService;
+        IPlcService _plcService;
 
 
         #region 属性
         #region 属性
         private PlotModel _PressurePlotModel = new PlotModel();
         private PlotModel _PressurePlotModel = new PlotModel();
@@ -220,12 +222,13 @@ namespace TeamAAS_VP.ViewModels
         #endregion
         #endregion
 
 
         public HomeViewModel(IEventAggregator ea, IContainerProvider container, IProductService productService, IConfigService configService, IRemoteCommandService remoteCommandService
         public HomeViewModel(IEventAggregator ea, IContainerProvider container, IProductService productService, IConfigService configService, IRemoteCommandService remoteCommandService
-            , ISystemDatabaseService systemDatabaseService, IDialogService dialogService)
+            , ISystemDatabaseService systemDatabaseService, IDialogService dialogService, IPlcService plcService)
         {
         {
             _eventAggregator = ea;
             _eventAggregator = ea;
             _container = container;
             _container = container;
             _dialogService = dialogService;
             _dialogService = dialogService;
             _productService = productService;
             _productService = productService;
+            _plcService=plcService;
             LoadedCommand = new DelegateCommand(OnLoad);
             LoadedCommand = new DelegateCommand(OnLoad);
             _eventAggregator.GetEvent<TaskMessageNotification>().Subscribe(AddMessageInvoke);
             _eventAggregator.GetEvent<TaskMessageNotification>().Subscribe(AddMessageInvoke);
             //订阅权限登录事件
             //订阅权限登录事件
@@ -420,7 +423,7 @@ namespace TeamAAS_VP.ViewModels
         /// 重置计数
         /// 重置计数
         /// </summary>
         /// </summary>
         async void ExecuteResetCounterCommand()
         async void ExecuteResetCounterCommand()
-        {
+        {           
             var currentProduct = _productService.GetCurrentProduct();
             var currentProduct = _productService.GetCurrentProduct();
             if (currentProduct == null) return;
             if (currentProduct == null) return;
             var view = new ShowMessage(Lang.计数清零, Lang.是否重置当前产品的计数);
             var view = new ShowMessage(Lang.计数清零, Lang.是否重置当前产品的计数);
@@ -583,7 +586,7 @@ namespace TeamAAS_VP.ViewModels
         /// </summary>
         /// </summary>
         private void ExecuteAddScrewCommand()
         private void ExecuteAddScrewCommand()
         {
         {
-            _dialogService.ShowDialog("AddScrew", rst =>
+            _dialogService.ShowDialog("AddScrewView", rst =>
             {
             {
                 //对话框关闭之后的回调函数,可以在这解析结果。
                 //对话框关闭之后的回调函数,可以在这解析结果。
                 ButtonResult result1 = rst.Result;
                 ButtonResult result1 = rst.Result;
@@ -593,6 +596,24 @@ namespace TeamAAS_VP.ViewModels
                     _eventAggregator.GetEvent<SnackbarMessageNotification>().Publish(new MessageParameter() { Msg = Lang.完成, Duration = 1 });
                     _eventAggregator.GetEvent<SnackbarMessageNotification>().Publish(new MessageParameter() { Msg = Lang.完成, Duration = 1 });
                 }
                 }
             });
             });
+            //var dialog = new AddScrewView(_configService, _eventAggregator, _plcService);
+            //dialog.Owner = Application.Current.MainWindow;
+
+            //// 显示弹窗,扫码枪结果会自动显示在输入框中
+            //if (dialog.ShowDialog() == true)
+            //{
+            //    string scanResult = dialog.ScannedBarcode;
+
+            //    _eventAggregator.GetEvent<SnackbarMessageNotification>()
+            //        ?.Publish(new MessageParameter()
+            //        {
+            //            Msg = $"已扫描:{scanResult}",
+            //            Duration = 1
+            //        });
+
+            //    // 这里可以继续处理你的添加螺丝逻辑
+            //    // AddScrew(scanResult);
+            //}
         }
         }
 
 
         /// <summary>
         /// <summary>

+ 216 - 24
TeamAAS-VM/ViewModels/MainWindowViewModel.cs

@@ -20,7 +20,10 @@ using System.Threading.Tasks;
 using System.Windows;
 using System.Windows;
 using System.Windows.Controls;
 using System.Windows.Controls;
 using System.Windows.Controls.Primitives;
 using System.Windows.Controls.Primitives;
+using System.Windows.Input;
+using System.Windows.Interop;
 using System.Windows.Media;
 using System.Windows.Media;
+using System.Windows.Threading;
 using Team.FFFeederService.Interfaces;
 using Team.FFFeederService.Interfaces;
 using TeamAAS_VP;
 using TeamAAS_VP;
 using TeamAAS_VP.Controls;
 using TeamAAS_VP.Controls;
@@ -64,6 +67,33 @@ namespace TeamAAS_VP.ViewModels
         Timer timer;
         Timer timer;
         private bool _loginShowing;
         private bool _loginShowing;
 
 
+        /// <summary>
+        /// 工程师和管理员权限的无操作超时时长。
+        /// 超过该时长后自动切回操作员权限。
+        /// </summary>
+        private readonly TimeSpan PermissionIdleTimeout = TimeSpan.FromMinutes(0.5);
+
+        /// <summary>
+        /// 权限空闲检测计时器。
+        /// 周期性检查最近一次用户输入距离当前时间是否超过超时阈值。
+        /// </summary>
+        private DispatcherTimer _permissionIdleTimer;
+
+        /// <summary>
+        /// 最近一次键盘、鼠标、触摸或手写笔输入时间。
+        /// </summary>
+        private DateTime _lastPermissionActivityTime;
+
+        /// <summary>
+        /// 标识权限超时处理是否正在执行,避免计时器重入。
+        /// </summary>
+        private bool _isPermissionTimeoutRunning;
+
+        /// <summary>
+        /// 标识是否已订阅全局输入事件,避免重复订阅。
+        /// </summary>
+        private bool _isTrackingUserInput;
+
         #region 属性
         #region 属性
 
 
         private Management _management;
         private Management _management;
@@ -113,6 +143,19 @@ namespace TeamAAS_VP.ViewModels
             set { SetProperty(ref _MyTitle, value); }
             set { SetProperty(ref _MyTitle, value); }
         }
         }
 
 
+        private Language _CurrentLanguage;
+        public Language CurrentLanguage
+        {
+            get { return _CurrentLanguage; }
+            set
+            {
+                if (SetProperty(ref _CurrentLanguage, value))
+                {
+                    _configService?.SetCurrentLanguage(value);
+                }
+            }
+        }
+
         #endregion
         #endregion
 
 
         #region 命令
         #region 命令
@@ -230,10 +273,8 @@ namespace TeamAAS_VP.ViewModels
             _configService.SaveSystemConfiguration(systemconfig);
             _configService.SaveSystemConfiguration(systemconfig);
 
 
             // 设置语言
             // 设置语言
-            //#region 设置语言
-            //var currentlanguage = _configService.GetSystemConfiguration().CurrentLanguage;
-            //_configService.SetCurrentLanguage(currentlanguage);
-            //#endregion
+            CurrentLanguage = systemconfig.CurrentLanguage;
+            _configService.SetCurrentLanguage(CurrentLanguage);
 
 
             SendTaskMessage(Lang.软件启动, MessageLevel.Info);
             SendTaskMessage(Lang.软件启动, MessageLevel.Info);
             StartTime = DateTime.Now;
             StartTime = DateTime.Now;
@@ -405,11 +446,16 @@ namespace TeamAAS_VP.ViewModels
             {
             {
                 _eventAggregator.GetEvent<ProgressNotification>().Publish(new UProgressBar.ProgressParameter { Maximum = max, Minimum = 0, SubTitle = $"{Lang.初始化中}...", Message = $"{Lang.完成}", Value = -1 });
                 _eventAggregator.GetEvent<ProgressNotification>().Publish(new UProgressBar.ProgressParameter { Maximum = max, Minimum = 0, SubTitle = $"{Lang.初始化中}...", Message = $"{Lang.完成}", Value = -1 });
             }));
             }));
+
+            // 初始弹窗登录发生在主窗口加载前,加载后需按当前用户补启权限空闲计时。
+            ConfigurePermissionIdleMonitor(_systemDatabaseService.GetCurrentUser());
+
         }
         }
 
 
         private void OnClose()
         private void OnClose()
         {
         {
-
+            StopPermissionIdleMonitor();
+            Stop();
         }
         }
 
 
         private void SendTaskMessage(string msg, MessageLevel level)
         private void SendTaskMessage(string msg, MessageLevel level)
@@ -438,46 +484,192 @@ namespace TeamAAS_VP.ViewModels
             timer = null;
             timer = null;
         }
         }
 
 
+        /// <summary>
+        /// 处理用户登录或权限切换事件。
+        /// 更新状态栏当前用户,登录后跳转主页,并根据用户权限启停空闲降权检测。
+        /// </summary>
+        /// <param name="user">触发事件的用户对象。</param>
         private void LoginChange(Models.User user)
         private void LoginChange(Models.User user)
         {
         {
+            var current = _systemDatabaseService.GetCurrentUser();
             var us = Status.FirstOrDefault(u => u.ID == currentUser);
             var us = Status.FirstOrDefault(u => u.ID == currentUser);
             if (us != null)
             if (us != null)
             {
             {
-                us.Message = $"{Lang.当前用户}:{_systemDatabaseService.GetCurrentUser().UserName}[{_systemDatabaseService.GetCurrentUser().userPart.ToString()}]";
+                us.Message = $"{Lang.当前用户}:{current.UserName}[{current.userPart.ToString()}]";
             }
             }
+
+            _regionManager.RequestNavigate("MainRegionContext", "HomeView");
+            lastNavigationName = "Home";
+            NavigationIndex = 0;
+            _eventAggregator.GetEvent<MainTabSwitchNotification>().Publish(NavigationIndex);
+            ConfigurePermissionIdleMonitor(current);
         }
         }
 
 
-        // 班次切换时触发:停流程→隐藏主窗口→弹登录→登录成功恢复
-        private void OnShiftChanged()
+        /// <summary>
+        /// 配置工程师和管理员权限的空闲检测。
+        /// 操作员权限不需要超时检测,会停止现有计时和输入监听。
+        /// </summary>
+        /// <param name="user">当前登录用户。</param>
+        private void ConfigurePermissionIdleMonitor(Models.User user)
         {
         {
-            if (_loginShowing)
+            if (user == null || user.userPart == UserPart.Operator)
+            {
+                StopPermissionIdleMonitor();
                 return;
                 return;
+            }
 
 
-            _loginShowing = true;
+            _lastPermissionActivityTime = DateTime.Now;
+            if (!_isTrackingUserInput)
+            {
+                InputManager.Current.PostProcessInput += OnUserInput;
+                ComponentDispatcher.ThreadFilterMessage += OnThreadFilterMessage;
+                _isTrackingUserInput = true;
+            }
 
 
-            // 1 隐藏主窗口
-            var mainWindow = Application.Current.MainWindow;
-            mainWindow?.Hide();
+            if (_permissionIdleTimer == null)
+            {
+                _permissionIdleTimer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(5) };
+                _permissionIdleTimer.Tick += PermissionIdleTimer_Tick;
+            }
 
 
-            CardLoginWindow loginWindow = new CardLoginWindow();
-            loginWindow.Show();
+            _permissionIdleTimer.Start();
+        }
 
 
-            bool? result = loginWindow.ShowDialog();
+        /// <summary>
+        /// 停止权限空闲检测并解绑全局输入事件。
+        /// </summary>
+        private void StopPermissionIdleMonitor()
+        {
+            if (_permissionIdleTimer != null)
+            {
+                _permissionIdleTimer.Stop();
+            }
 
 
-            // 4️⃣ 根据登录结果处理
-            if (result == true)
+            if (_isTrackingUserInput)
             {
             {
-                // 登录成功 → 显示主窗口 
-                mainWindow?.Show();
+                InputManager.Current.PostProcessInput -= OnUserInput;
+                ComponentDispatcher.ThreadFilterMessage -= OnThreadFilterMessage;
+                _isTrackingUserInput = false;
             }
             }
-            else
+        }
+
+        private void RecordPermissionActivity()
+        {
+            _lastPermissionActivityTime = DateTime.Now;
+        }
+
+        /// <summary>
+        /// 记录用户输入时间。
+        /// 键盘、鼠标、滚轮、触摸和手写笔输入都会刷新空闲计时。
+        /// </summary>
+        /// <param name="sender">输入事件发送方。</param>
+        /// <param name="e">输入事件参数。</param>
+        private void OnUserInput(object sender, ProcessInputEventArgs e)
+        {
+            var input = e?.StagingItem?.Input;
+            if (input is KeyEventArgs ||
+                input is MouseButtonEventArgs ||
+                input is MouseWheelEventArgs ||
+                input is MouseEventArgs ||
+                input is TouchEventArgs ||
+                input is StylusEventArgs)
             {
             {
-                // 如果你想强制退出可以用:
-                Application.Current.Shutdown();
+                RecordPermissionActivity();
             }
             }
-            _loginShowing = false;
         }
         }
 
 
+        private void OnThreadFilterMessage(ref MSG msg, ref bool handled)
+        {
+            if (IsUserInputMessage(msg.message))
+            {
+                RecordPermissionActivity();
+            }
+        }
+
+        private static bool IsUserInputMessage(int message)
+        {
+            switch (message)
+            {
+                case 0x0100: // WM_KEYDOWN
+                case 0x0101: // WM_KEYUP
+                case 0x0104: // WM_SYSKEYDOWN
+                case 0x0105: // WM_SYSKEYUP
+                case 0x0200: // WM_MOUSEMOVE
+                case 0x0201: // WM_LBUTTONDOWN
+                case 0x0202: // WM_LBUTTONUP
+                case 0x0203: // WM_LBUTTONDBLCLK
+                case 0x0204: // WM_RBUTTONDOWN
+                case 0x0205: // WM_RBUTTONUP
+                case 0x0206: // WM_RBUTTONDBLCLK
+                case 0x0207: // WM_MBUTTONDOWN
+                case 0x0208: // WM_MBUTTONUP
+                case 0x0209: // WM_MBUTTONDBLCLK
+                case 0x020A: // WM_MOUSEWHEEL
+                case 0x020B: // WM_XBUTTONDOWN
+                case 0x020C: // WM_XBUTTONUP
+                case 0x020D: // WM_XBUTTONDBLCLK
+                case 0x020E: // WM_MOUSEHWHEEL
+                    return true;
+                default:
+                    return false;
+            }
+        }
+
+        /// <summary>
+        /// 周期性检查工程师或管理员权限是否超时。
+        /// 如果 3 分钟无操作,则将当前用户切回操作员并广播权限切换事件。
+        /// </summary>
+        /// <param name="sender">计时器事件发送方。</param>
+        /// <param name="e">计时器事件参数。</param>
+        private async void PermissionIdleTimer_Tick(object sender, EventArgs e)
+        {
+            if (_isPermissionTimeoutRunning)
+                return;
+
+            var current = _systemDatabaseService.GetCurrentUser();
+            if (current == null || current.userPart == UserPart.Operator)
+            {
+                StopPermissionIdleMonitor();
+                return;
+            }
+
+            if (DateTime.Now - _lastPermissionActivityTime < PermissionIdleTimeout)
+                return;
+
+            _isPermissionTimeoutRunning = true;
+            try
+            {
+                var users = await _systemDatabaseService.GetAllUsersAsync();
+                var operatorUser = users?.FirstOrDefault(u => u.userPart == UserPart.Operator);
+                if (operatorUser == null)
+                {
+                    App.Current.Dispatcher.Invoke(() =>
+                    {
+                        _eventAggregator.GetEvent<TaskMessageNotification>().Publish(new Models.MessageStruct() { Message = "权限超时,但未找到操作员账号", level = MessageLevel.Error });
+                    });
+                    StopPermissionIdleMonitor();
+                    return;
+                }
+
+                await _systemDatabaseService.SetCurrentUserAsync(operatorUser.Id);
+                _eventAggregator.GetEvent<CurrentStatusNotification>().Publish();
+                _eventAggregator.GetEvent<UserLoginNotification>().Publish(_systemDatabaseService.GetCurrentUser());
+                _regionManager.RequestNavigate("MainRegionContext", "HomeView");
+                NavigationIndex = 0;
+                _eventAggregator.GetEvent<MainTabSwitchNotification>().Publish(NavigationIndex);
+                App.Current.Dispatcher.Invoke(() =>
+                {
+                    _eventAggregator.GetEvent<TaskMessageNotification>().Publish(new Models.MessageStruct() { Message = "权限超时,已自动退出工程师/管理员权限", level = MessageLevel.Error });
+                });
+            }
+            finally
+            {
+                _isPermissionTimeoutRunning = false;
+            }
+        }
+
+
+
         #endregion
         #endregion
     }
     }
 }
 }

+ 21 - 0
TeamAAS-VM/ViewModels/Product/ProductParamsViewModel.cs

@@ -149,6 +149,23 @@ namespace TeamAAS_VP.ViewModels.Product
             }
             }
         }
         }
 
 
+        private ProcedureModel _FzCameraProcedure;
+        /// <summary>
+        /// 翻转相机视觉流程
+        /// </summary>
+        public ProcedureModel FzCameraProcedure
+        {
+            get { return _FzCameraProcedure; }
+            set
+            {
+                SetProperty(ref _FzCameraProcedure, value);
+                if (value != null)
+                {
+                    SelectProduct.FzCameraProcedureId = value.Id;
+                }
+            }
+        }
+
         #endregion
         #endregion
 
 
         #region 命令
         #region 命令
@@ -316,6 +333,10 @@ namespace TeamAAS_VP.ViewModels.Product
                 {
                 {
                     QrCodePhotoProcedure = ProcedureModels.FirstOrDefault(p => p.Id == SelectProduct.QrCodeProcedureId);
                     QrCodePhotoProcedure = ProcedureModels.FirstOrDefault(p => p.Id == SelectProduct.QrCodeProcedureId);
                 }
                 }
+                if (SelectProduct.FzCameraProcedureId != Guid.Empty)
+                {
+                    FzCameraProcedure = ProcedureModels.FirstOrDefault(p => p.Id == SelectProduct.FzCameraProcedureId);
+                }
             }
             }
             catch (Exception ex)
             catch (Exception ex)
             {
             {

+ 12 - 1
TeamAAS-VM/ViewModels/SettingViewModel.cs

@@ -1399,7 +1399,7 @@ namespace TeamAAS_VP.ViewModels
         /// <exception cref="NotImplementedException"></exception>
         /// <exception cref="NotImplementedException"></exception>
         public async void OnNavigatedTo(NavigationContext navigationContext)
         public async void OnNavigatedTo(NavigationContext navigationContext)
         {
         {
-            if (_systemDatabaseService.GetCurrentUser().userPart == Enums.UserPart.Operator)
+            if (_systemDatabaseService.GetCurrentUser().userPart == Enums.UserPart.Operator|| _systemDatabaseService.GetCurrentUser().userPart == Enums.UserPart.Engineer)
             {
             {
                 IsAllowEdit = false;
                 IsAllowEdit = false;
             }
             }
@@ -1523,6 +1523,7 @@ namespace TeamAAS_VP.ViewModels
                 IsBasePartCodeChooseScrew = sys.IsBasePartCodeChooseScrew;
                 IsBasePartCodeChooseScrew = sys.IsBasePartCodeChooseScrew;
                 IsBasePartOpenLight = sys.IsBasePartOpenLight;
                 IsBasePartOpenLight = sys.IsBasePartOpenLight;
                 IsBasePartOpenLightKB = sys.IsBasePartOpenLightKB;
                 IsBasePartOpenLightKB = sys.IsBasePartOpenLightKB;
+                IsMesResult = sys.IsMesResult;
                 ChooseScrewModel = sys.ChooseScrewModel;
                 ChooseScrewModel = sys.ChooseScrewModel;
             }
             }
 
 
@@ -1624,6 +1625,15 @@ namespace TeamAAS_VP.ViewModels
             set { SetProperty(ref _IsBasePartOpenLightKB, value); }
             set { SetProperty(ref _IsBasePartOpenLightKB, value); }
         }
         }
 
 
+        private bool _IsMesResult;
+
+        public bool IsMesResult
+        {
+            get { return _IsMesResult; }
+            set { SetProperty(ref _IsMesResult, value); }
+        }
+
+
         private bool _IsBasePartCodeChooseScrew;
         private bool _IsBasePartCodeChooseScrew;
         /// <summary>
         /// <summary>
         /// 是否通过零件码判断螺丝型号
         /// 是否通过零件码判断螺丝型号
@@ -1815,6 +1825,7 @@ namespace TeamAAS_VP.ViewModels
                     sysConfig.ScrewCurvePath = ScrewCurvePath;
                     sysConfig.ScrewCurvePath = ScrewCurvePath;
                     sysConfig.IsBasePartCodeGetSN = IsBasePartCodeGetSN;
                     sysConfig.IsBasePartCodeGetSN = IsBasePartCodeGetSN;
                     sysConfig.IsBasePartCodeChooseScrew = IsBasePartCodeChooseScrew;
                     sysConfig.IsBasePartCodeChooseScrew = IsBasePartCodeChooseScrew;
+                    sysConfig.IsMesResult = IsMesResult;
                     sysConfig.IsBasePartOpenLightKB = IsBasePartOpenLightKB;
                     sysConfig.IsBasePartOpenLightKB = IsBasePartOpenLightKB;
                     sysConfig.IsBasePartOpenLight = IsBasePartOpenLight;
                     sysConfig.IsBasePartOpenLight = IsBasePartOpenLight;
                     sysConfig.ChooseScrewModel = ChooseScrewModel;
                     sysConfig.ChooseScrewModel = ChooseScrewModel;

+ 121 - 28
TeamAAS-VM/ViewModels/User/CardLoginWindowViewModel.cs

@@ -51,26 +51,51 @@ namespace TeamAAS_VP.ViewModels.User
         }
         }
 
 
         private string _SelectedUserName;
         private string _SelectedUserName;
+
+        /// <summary>
+        /// 当前在账号登录页选择的用户名。
+        /// 窗口加载时会清空;切换用户名时会同步清空密码。
+        /// </summary>
         public string SelectedUserName
         public string SelectedUserName
         {
         {
             get { return _SelectedUserName; }
             get { return _SelectedUserName; }
-            set { SetProperty(ref _SelectedUserName, value); }
+            set
+            {
+                if (SetProperty(ref _SelectedUserName, value))
+                {
+                    Password = string.Empty;
+                }
+            }
         }
         }
 
 
         private string _Password;
         private string _Password;
+
+        /// <summary>
+        /// 当前输入的账号登录密码。
+        /// 登录流程结束后会清空,避免窗口保留密码记录。
+        /// </summary>
         public string Password
         public string Password
         {
         {
             get { return _Password; }
             get { return _Password; }
             set { SetProperty(ref _Password, value); }
             set { SetProperty(ref _Password, value); }
         }
         }
 
 
-        public bool IsRemember { get; set; }
-
+        /// <summary>
+        /// 标识当前登录是否为本地登录模式。
+        /// </summary>
         public bool IsLocal { get; private set; }
         public bool IsLocal { get; private set; }
+
+        /// <summary>
+        /// 当前弹窗实例,用于登录成功或取消时设置 DialogResult。
+        /// </summary>
         public CardLoginWindow View { get; set; }
         public CardLoginWindow View { get; set; }
 
 
         //正在登录中
         //正在登录中
         private bool _IsLogining;
         private bool _IsLogining;
+
+        /// <summary>
+        /// 标识账号登录流程是否正在执行,用于禁用重复点击登录。
+        /// </summary>
         public bool IsLogining
         public bool IsLogining
         {
         {
             get { return _IsLogining; }
             get { return _IsLogining; }
@@ -78,6 +103,11 @@ namespace TeamAAS_VP.ViewModels.User
         }
         }
 
 
         private int _PageIndex;
         private int _PageIndex;
+
+        /// <summary>
+        /// 当前登录页索引。
+        /// 0 表示刷卡登录页,1 表示账号登录页。
+        /// </summary>
         public int PageIndex
         public int PageIndex
         {
         {
             get { return _PageIndex; }
             get { return _PageIndex; }
@@ -85,29 +115,54 @@ namespace TeamAAS_VP.ViewModels.User
         }
         }
 
 
         private Visibility _CardBtnVisibility = Visibility.Visible;
         private Visibility _CardBtnVisibility = Visibility.Visible;
+
+        /// <summary>
+        /// 刷卡登录按钮可见性。
+        /// 管理员模式下隐藏刷卡入口。
+        /// </summary>
         public Visibility CardBtnVisibility
         public Visibility CardBtnVisibility
         {
         {
             get { return _CardBtnVisibility; }
             get { return _CardBtnVisibility; }
             set { SetProperty(ref _CardBtnVisibility, value); }
             set { SetProperty(ref _CardBtnVisibility, value); }
         }
         }
 
 
+        /// <summary>
+        /// 刷卡器串口通讯对象。
+        /// 窗口关闭时需要解绑事件并释放连接。
+        /// </summary>
         public SerialPortProtocol serialPortProtocol { get; set; }
         public SerialPortProtocol serialPortProtocol { get; set; }
         #endregion
         #endregion
 
 
         #region 命令
         #region 命令
         private DelegateCommand _LoginCommand;
         private DelegateCommand _LoginCommand;
+
+        /// <summary>
+        /// 账号登录命令。
+        /// </summary>
         public DelegateCommand LoginCommand =>
         public DelegateCommand LoginCommand =>
             _LoginCommand ?? (_LoginCommand = new DelegateCommand(ExecuteLoginCommand, CanExecuteLoginCommand).ObservesProperty(() => SelectedUserName).ObservesProperty(() => Password).ObservesProperty(() => IsLogining));
             _LoginCommand ?? (_LoginCommand = new DelegateCommand(ExecuteLoginCommand, CanExecuteLoginCommand).ObservesProperty(() => SelectedUserName).ObservesProperty(() => Password).ObservesProperty(() => IsLogining));
 
 
         private DelegateCommand _CloseCommand;
         private DelegateCommand _CloseCommand;
+
+        /// <summary>
+        /// 关闭登录窗口命令。
+        /// </summary>
         public DelegateCommand CloseCommand =>
         public DelegateCommand CloseCommand =>
             _CloseCommand ?? (_CloseCommand = new DelegateCommand(ExecuteCloseCommand));
             _CloseCommand ?? (_CloseCommand = new DelegateCommand(ExecuteCloseCommand));
 
 
         private DelegateCommand<string> _TransitionerCommand;
         private DelegateCommand<string> _TransitionerCommand;
+
+        /// <summary>
+        /// 切换登录页命令。
+        /// </summary>
         public DelegateCommand<string> TransitionerCommand =>
         public DelegateCommand<string> TransitionerCommand =>
             _TransitionerCommand ?? (_TransitionerCommand = new DelegateCommand<string>(ExecuteTransitionerCommand));
             _TransitionerCommand ?? (_TransitionerCommand = new DelegateCommand<string>(ExecuteTransitionerCommand));
 
 
         private DelegateCommand _LoadedCommand;
         private DelegateCommand _LoadedCommand;
+
+        /// <summary>
+        /// 窗口加载命令。
+        /// </summary>
         public DelegateCommand LoadedCommand =>
         public DelegateCommand LoadedCommand =>
             _LoadedCommand ?? (_LoadedCommand = new DelegateCommand(ExecuteLoadedCommand));
             _LoadedCommand ?? (_LoadedCommand = new DelegateCommand(ExecuteLoadedCommand));
         #endregion
         #endregion
@@ -126,7 +181,8 @@ namespace TeamAAS_VP.ViewModels.User
 
 
         #region 方法
         #region 方法
         /// <summary>
         /// <summary>
-        /// 加载
+        /// 窗口加载时初始化用户列表和刷卡器通讯。
+        /// 同时清除记住用户标记,并清空用户名选择和密码输入。
         /// </summary>
         /// </summary>
         async void ExecuteLoadedCommand()
         async void ExecuteLoadedCommand()
         {
         {
@@ -140,28 +196,25 @@ namespace TeamAAS_VP.ViewModels.User
             {
             {
                 Users = new List<TeamAAS_VP.Models.User>();
                 Users = new List<TeamAAS_VP.Models.User>();
             }
             }
-            TeamAAS_VP.Models.User rememberUser = null;
             if (Users != null)
             if (Users != null)
             {
             {
                 UserNameList.Clear();
                 UserNameList.Clear();
                 foreach (var user in Users)
                 foreach (var user in Users)
                 {
                 {
                     UserNameList.Add(user.UserName);
                     UserNameList.Add(user.UserName);
-                    if (user.IsRemember)
-                    {
-                        rememberUser = user;
-                    }
                 }
                 }
             }
             }
-
-            //对记住的用户界面绑定
-            if (rememberUser != null)
+            try
+            {
+                await _systemDatabaseService.ClearRememberUserAsync();
+            }
+            catch
             {
             {
-                SelectedUserName = UserNameList.FirstOrDefault(p => p == rememberUser.UserName);
-                Password = rememberUser.UserPassword;
-                IsRemember = true;
             }
             }
 
 
+            SelectedUserName = null;
+            Password = string.Empty;
+
             //创建刷卡器通讯
             //创建刷卡器通讯
             serialPortProtocol = new SerialPortProtocol(cardConfig);
             serialPortProtocol = new SerialPortProtocol(cardConfig);
             serialPortProtocol.DataReceived += CardSerial_DataReceived;
             serialPortProtocol.DataReceived += CardSerial_DataReceived;
@@ -172,6 +225,12 @@ namespace TeamAAS_VP.ViewModels.User
             }
             }
         }
         }
 
 
+        /// <summary>
+        /// 处理刷卡器收到的卡号。
+        /// 在刷卡登录页中将卡号作为临时工程师账号登录,并发布用户切换事件。
+        /// </summary>
+        /// <param name="sender">串口事件发送方。</param>
+        /// <param name="code">刷卡器读取到的卡号。</param>
         private async void CardSerial_DataReceived(object sender, string code)
         private async void CardSerial_DataReceived(object sender, string code)
         {
         {
             if (PageIndex == 0)
             if (PageIndex == 0)
@@ -189,15 +248,21 @@ namespace TeamAAS_VP.ViewModels.User
 
 
                 await _systemDatabaseService.SetCurrentUserAsync(user);
                 await _systemDatabaseService.SetCurrentUserAsync(user);
 
 
-                App.Current.Dispatcher.Invoke(() =>
-                {
-                    _eventAggregator.GetEvent<UserLoginNotification>().Publish(user);
-                    View.DialogResult = true;
-                });
+                //App.Current.Dispatcher.Invoke(() =>
+                //{
+                //    user.UserPassword = string.Empty;
+                //    _eventAggregator.GetEvent<UserLoginNotification>().Publish(_systemDatabaseService.GetCurrentUser());
+                //    View.DialogResult = true;
+                //});
                 
                 
             }
             }
         }
         }
 
 
+        /// <summary>
+        /// 窗口关闭时释放刷卡器通讯资源。
+        /// </summary>
+        /// <param name="sender">窗口关闭事件发送方。</param>
+        /// <param name="e">关闭事件参数。</param>
         public async void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
         public async void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
         {
         {
             if (serialPortProtocol!=null)
             if (serialPortProtocol!=null)
@@ -210,6 +275,11 @@ namespace TeamAAS_VP.ViewModels.User
             serialPortProtocol = null;
             serialPortProtocol = null;
         }
         }
 
 
+        /// <summary>
+        /// 执行账号登录。
+        /// 操作员账号允许免密码登录;工程师和管理员仍需要密码认证。
+        /// 登录完成后清除记住用户标记、清空密码,并关闭登录弹窗。
+        /// </summary>
         async void ExecuteLoginCommand()
         async void ExecuteLoginCommand()
         {
         {
             if (Users == null || string.IsNullOrEmpty(SelectedUserName))
             if (Users == null || string.IsNullOrEmpty(SelectedUserName))
@@ -218,26 +288,30 @@ namespace TeamAAS_VP.ViewModels.User
             IsLogining = true;
             IsLogining = true;
             try
             try
             {
             {
+                var selectedUser = Users.FirstOrDefault(u => u.UserName == SelectedUserName);
+                if (selectedUser == null)
+                    return;
+
                 if (_systemDatabaseService.GetCurrentUser() != null)
                 if (_systemDatabaseService.GetCurrentUser() != null)
                 {
                 {
                     if (_systemDatabaseService.GetCurrentUser().UserName == SelectedUserName)
                     if (_systemDatabaseService.GetCurrentUser().UserName == SelectedUserName)
                     {
                     {
+                        Password = string.Empty;
+                        _eventAggregator.GetEvent<UserLoginNotification>().Publish(_systemDatabaseService.GetCurrentUser());
                         View.DialogResult = true;
                         View.DialogResult = true;
                         return;
                         return;
                     }
                     }
                 }
                 }
 
 
-                // authenticate via system database service
-                var user = await _systemDatabaseService.AuthenticateUserAsync(SelectedUserName, Password);
+                var user = selectedUser.userPart == UserPart.Operator
+                    ? selectedUser
+                    : await _systemDatabaseService.AuthenticateUserAsync(SelectedUserName, Password);
+
                 if (user != null)
                 if (user != null)
                 {
                 {
-                    // set remember flag via system database service
                     try
                     try
                     {
                     {
-                        if (IsRemember)
-                            await _systemDatabaseService.SetRememberUserAsync(SelectedUserName);
-                        else
-                            await _systemDatabaseService.ClearRememberUserAsync();
+                        await _systemDatabaseService.ClearRememberUserAsync();
                     }
                     }
                     catch
                     catch
                     {
                     {
@@ -247,7 +321,8 @@ namespace TeamAAS_VP.ViewModels.User
                     // mark current user in system DB and record login
                     // mark current user in system DB and record login
                     await _systemDatabaseService.SetCurrentUserAsync(user.Id);
                     await _systemDatabaseService.SetCurrentUserAsync(user.Id);
                     await _systemDatabaseService.RecordUserLoginAsync(new UserLoginRecord { UserId = user.Id, Success = true, Time = DateTime.Now, Message = "Login success" });
                     await _systemDatabaseService.RecordUserLoginAsync(new UserLoginRecord { UserId = user.Id, Success = true, Time = DateTime.Now, Message = "Login success" });
-                    _eventAggregator.GetEvent<UserLoginNotification>().Publish(user);
+                    Password = string.Empty;
+                    _eventAggregator.GetEvent<UserLoginNotification>().Publish(_systemDatabaseService.GetCurrentUser());
                     View.DialogResult = true;
                     View.DialogResult = true;
                 }
                 }
 
 
@@ -258,25 +333,43 @@ namespace TeamAAS_VP.ViewModels.User
             }
             }
             finally
             finally
             {
             {
+                Password = string.Empty;
                 IsLogining = false;
                 IsLogining = false;
             }
             }
         }
         }
 
 
+        /// <summary>
+        /// 判断账号登录命令是否可执行。
+        /// 选择用户名且当前未处于登录中时允许执行。
+        /// </summary>
+        /// <returns>可执行返回 true,否则返回 false。</returns>
         bool CanExecuteLoginCommand()
         bool CanExecuteLoginCommand()
         {
         {
             return !string.IsNullOrEmpty(SelectedUserName) && !IsLogining;
             return !string.IsNullOrEmpty(SelectedUserName) && !IsLogining;
         }
         }
 
 
+        /// <summary>
+        /// 关闭登录窗口并返回取消结果。
+        /// </summary>
         void ExecuteCloseCommand()
         void ExecuteCloseCommand()
         {
         {
             View.DialogResult = false;
             View.DialogResult = false;
         }
         }
 
 
+        /// <summary>
+        /// 切换刷卡登录页和账号登录页。
+        /// </summary>
+        /// <param name="parameter">目标页索引字符串。</param>
         void ExecuteTransitionerCommand(string parameter)
         void ExecuteTransitionerCommand(string parameter)
         {
         {
             PageIndex = int.Parse(parameter);
             PageIndex = int.Parse(parameter);
         }
         }
 
 
+        /// <summary>
+        /// 设置登录窗口模式。
+        /// 管理员模式进入账号登录页并隐藏刷卡按钮,普通模式进入刷卡登录页。
+        /// </summary>
+        /// <param name="isAdmin">是否使用管理员登录模式。</param>
         public void SetModel(bool isAdmin)
         public void SetModel(bool isAdmin)
         {
         {
             PageIndex = isAdmin ? 1 : 0;
             PageIndex = isAdmin ? 1 : 0;

+ 97 - 43
TeamAAS-VM/ViewModels/User/LoginViewModel.cs

@@ -13,6 +13,7 @@ using System.Linq;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
 using TeamAAS_VP.Core;
 using TeamAAS_VP.Core;
 using TeamAAS_VP.Data;
 using TeamAAS_VP.Data;
+using TeamAAS_VP.Enums;
 using TeamAAS_VP.Events;
 using TeamAAS_VP.Events;
 using TeamAAS_VP.Interfaces;
 using TeamAAS_VP.Interfaces;
 using TeamAAS_VP.Models;
 using TeamAAS_VP.Models;
@@ -41,11 +42,47 @@ namespace TeamAAS_VP.ViewModels.User
             set { _UserNameList = value; }
             set { _UserNameList = value; }
         }
         }
 
 
-        public string SelectedUserName { get; set; }
+        private string _SelectedUserName;
 
 
-        public string UserPassword { get; set; }
+        /// <summary>
+        /// 当前在登录界面选择的用户名。
+        /// 加载登录页时会清空;切换用户名时会同步清空密码。
+        /// </summary>
+        public string SelectedUserName
+        {
+            get { return _SelectedUserName; }
+            set
+            {
+                if (SetProperty(ref _SelectedUserName, value))
+                {
+                    UserPassword = string.Empty;
+                }
+            }
+        }
+
+        private string _UserPassword;
+
+        /// <summary>
+        /// 当前输入的登录密码。
+        /// 登录成功或失败后都会清空,避免界面保留密码记录。
+        /// </summary>
+        public string UserPassword
+        {
+            get { return _UserPassword; }
+            set { SetProperty(ref _UserPassword, value); }
+        }
 
 
-        public bool IsRemember { get; set; }
+        private bool _IsRemember;
+
+        /// <summary>
+        /// 是否记住用户的界面状态。
+        /// 当前登录策略不允许记住用户,加载和登录时会强制置为 false。
+        /// </summary>
+        public bool IsRemember
+        {
+            get { return _IsRemember; }
+            set { SetProperty(ref _IsRemember, value); }
+        }
 
 
         #endregion
         #endregion
 
 
@@ -58,9 +95,18 @@ namespace TeamAAS_VP.ViewModels.User
         /// 登录命令
         /// 登录命令
         /// </summary>
         /// </summary>
         public DelegateCommand LoginCommand { get; set; }
         public DelegateCommand LoginCommand { get; set; }
+
+        /// <summary>
+        /// 登录页加载命令。
+        /// 用于清除记住用户和密码输入。
+        /// </summary>
         public DelegateCommand LoadedCommand { get; set; }
         public DelegateCommand LoadedCommand { get; set; }
 
 
         private DelegateCommand _CardLoginCommand;
         private DelegateCommand _CardLoginCommand;
+
+        /// <summary>
+        /// 打开刷卡登录窗口命令。
+        /// </summary>
         public DelegateCommand CardLoginCommand =>
         public DelegateCommand CardLoginCommand =>
             _CardLoginCommand ?? (_CardLoginCommand = new DelegateCommand(ExecuteCardLoginCommand));
             _CardLoginCommand ?? (_CardLoginCommand = new DelegateCommand(ExecuteCardLoginCommand));
 
 
@@ -78,7 +124,7 @@ namespace TeamAAS_VP.ViewModels.User
             _container = container;
             _container = container;
             _systemDatabaseService = systemDatabaseService;
             _systemDatabaseService = systemDatabaseService;
 
 
-			LoadedCommand = new DelegateCommand(OnLoad);
+			LoadedCommand = new DelegateCommand(async () => await OnLoadAsync());
             SignUpCommand = new DelegateCommand(new Action(SignUp));
             SignUpCommand = new DelegateCommand(new Action(SignUp));
             LoginCommand = new DelegateCommand(async () => await LoginAsync());
             LoginCommand = new DelegateCommand(async () => await LoginAsync());
 
 
@@ -94,67 +140,68 @@ namespace TeamAAS_VP.ViewModels.User
                 Users = new List<TeamAAS_VP.Models.User>();
                 Users = new List<TeamAAS_VP.Models.User>();
             }
             }
 
 
-            TeamAAS_VP.Models.User rememberUser = null;
             if (Users != null)
             if (Users != null)
             {
             {
                 foreach (var user in Users)
                 foreach (var user in Users)
                 {
                 {
                     UserNameList.Add(user.UserName);
                     UserNameList.Add(user.UserName);
-                    if (user.IsRemember)
-                    {
-                        rememberUser = user;
-                    }
                 }
                 }
             }
             }
-
-            //对记住的用户界面绑定
-            if (rememberUser != null)
-            {
-                SelectedUserName = rememberUser.UserName;
-                UserPassword = rememberUser.UserPassword;
-                IsRemember = true;
-            }
         }
         }
 
 
         #region 方法
         #region 方法
+
+        /// <summary>
+        /// 执行账号登录。
+        /// 操作员账号允许免密码登录;工程师和管理员仍需要通过密码认证。
+        /// 登录完成后清除记住用户标记、清空密码,并发布用户切换事件交由主窗口跳转主页。
+        /// </summary>
         private async Task LoginAsync()
         private async Task LoginAsync()
         {
         {
-            if (Users == null || string.IsNullOrEmpty(SelectedUserName) || UserPassword == null)
+            if (Users == null || string.IsNullOrEmpty(SelectedUserName))
                 return;
                 return;
 
 
-            if (_systemDatabaseService.GetCurrentUser() != null)
+            var selectedUser = Users.FirstOrDefault(u => u.UserName == SelectedUserName);
+            if (selectedUser == null)
+                return;
+
+            var currentUser = _systemDatabaseService.GetCurrentUser();
+            if (currentUser != null)
             {
             {
-                if (_systemDatabaseService.GetCurrentUser().UserName == SelectedUserName)
+                if (currentUser.UserName == SelectedUserName)
                 {
                 {
+                    UserPassword = string.Empty;
+                    _eventAggregator.GetEvent<UserLoginNotification>().Publish(currentUser);
                     return;
                     return;
                 }
                 }
             }
             }
 
 
             try
             try
             {
             {
-                // authenticate via system database service
-                var user = await _systemDatabaseService.AuthenticateUserAsync(SelectedUserName, UserPassword);
+                var user = selectedUser.userPart == UserPart.Operator
+                    ? selectedUser
+                    : await _systemDatabaseService.AuthenticateUserAsync(SelectedUserName, UserPassword);
+
                 if (user != null)
                 if (user != null)
                 {
                 {
-                    // set remember flag via system database service
                     try
                     try
                     {
                     {
-                        if (IsRemember)
-                            await _systemDatabaseService.SetRememberUserAsync(SelectedUserName);
-                        else
-                            await _systemDatabaseService.ClearRememberUserAsync();
+                        await _systemDatabaseService.ClearRememberUserAsync();
                     }
                     }
                     catch
                     catch
                     {
                     {
                         
                         
                     }
                     }
+                    IsRemember = false;
 
 
                     // mark current user in system DB and record login
                     // mark current user in system DB and record login
                     await _systemDatabaseService.SetCurrentUserAsync(user.Id);
                     await _systemDatabaseService.SetCurrentUserAsync(user.Id);
                     //await _systemDatabaseService.RecordUserLoginAsync(new UserLoginRecord { UserId = user.Id, Success = true, Time = DateTime.Now, Message = "Login success" });
                     //await _systemDatabaseService.RecordUserLoginAsync(new UserLoginRecord { UserId = user.Id, Success = true, Time = DateTime.Now, Message = "Login success" });
 
 
                     _eventAggregator.GetEvent<SnackbarMessageNotification>().Publish(new MessageParameter() { Msg = $"{Lang.登录成功}!", Duration = 1 });
                     _eventAggregator.GetEvent<SnackbarMessageNotification>().Publish(new MessageParameter() { Msg = $"{Lang.登录成功}!", Duration = 1 });
-                    _eventAggregator.GetEvent<UserLoginNotification>().Publish(user);
+                    UserPassword = string.Empty;
+                    _eventAggregator.GetEvent<CurrentStatusNotification>().Publish();
+                    _eventAggregator.GetEvent<UserLoginNotification>().Publish(_systemDatabaseService.GetCurrentUser());
                 }
                 }
             }
             }
             catch (Exception ex)
             catch (Exception ex)
@@ -162,9 +209,14 @@ namespace TeamAAS_VP.ViewModels.User
                 // authentication failed or error
                 // authentication failed or error
                 await _systemDatabaseService.RecordUserLoginAsync(new UserLoginRecord { UserId = 0, Success = false, Time = DateTime.Now, Message = $"Login failed for {SelectedUserName}: {ex.Message}" });
                 await _systemDatabaseService.RecordUserLoginAsync(new UserLoginRecord { UserId = 0, Success = false, Time = DateTime.Now, Message = $"Login failed for {SelectedUserName}: {ex.Message}" });
                 _eventAggregator.GetEvent<SnackbarMessageNotification>().Publish(new MessageParameter() { Msg = Lang.密码错误, Duration = 1 });
                 _eventAggregator.GetEvent<SnackbarMessageNotification>().Publish(new MessageParameter() { Msg = Lang.密码错误, Duration = 1 });
+                UserPassword = string.Empty;
             }
             }
         }
         }
 
 
+        /// <summary>
+        /// 进入注册页。
+        /// 只有当前用户为管理员时允许注册新用户。
+        /// </summary>
         private void SignUp()
         private void SignUp()
         {
         {
             var management = _container.Resolve<Management>();
             var management = _container.Resolve<Management>();
@@ -177,13 +229,27 @@ namespace TeamAAS_VP.ViewModels.User
             _regionManager.RequestNavigate("UserRegionContext", "SignUpView");
             _regionManager.RequestNavigate("UserRegionContext", "SignUpView");
         }
         }
 
 
-        private void OnLoad()
+        /// <summary>
+        /// 登录页加载时执行安全清理。
+        /// 清除数据库中的记住用户标记,并清空用户名选择和密码输入。
+        /// </summary>
+        private async Task OnLoadAsync()
         {
         {
-
+            try
+            {
+                await _systemDatabaseService.ClearRememberUserAsync();
+            }
+            catch
+            {
+            }
+            IsRemember = false;
+            SelectedUserName = null;
+            UserPassword = string.Empty;
         }
         }
 
 
         /// <summary>
         /// <summary>
-        /// 更新用户列表
+        /// 更新用户列表。
+        /// 只刷新可选用户名,不读取或回填任何记住用户和密码信息。
         /// </summary>
         /// </summary>
         public void UpdateUserList()
         public void UpdateUserList()
         {
         {
@@ -198,25 +264,13 @@ namespace TeamAAS_VP.ViewModels.User
                 Users = new List<TeamAAS_VP.Models.User>();
                 Users = new List<TeamAAS_VP.Models.User>();
             }
             }
 
 
-            TeamAAS_VP.Models.User rememberUser = null;
             if (Users != null)
             if (Users != null)
             {
             {
                 foreach (var user in Users)
                 foreach (var user in Users)
                 {
                 {
                     UserNameList.Add(user.UserName);
                     UserNameList.Add(user.UserName);
-                    if (user.IsRemember)
-                    {
-                        rememberUser = user;
-                    }
                 }
                 }
             }
             }
-            //对记住的用户界面绑定
-            if (rememberUser != null)
-            {
-                SelectedUserName = rememberUser.UserName;
-                UserPassword = rememberUser.UserPassword;
-                IsRemember = true;
-            }
         }
         }
 
 
         /// <summary>
         /// <summary>

+ 76 - 0
TeamAAS-VM/Views/AddScrewView.xaml

@@ -0,0 +1,76 @@
+<UserControl x:Class="TeamAAS_VP.Views.AddScrewView"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:prism="http://prismlibrary.com/"
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+             xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
+             xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
+             xmlns:sys="clr-namespace:System;assembly=mscorlib"
+             xmlns:enums="clr-namespace:TeamAAS_VP.Enums"
+             xmlns:valRules="clr-namespace:TeamAAS_VP.Identity"
+             xmlns:ext="clr-namespace:TeamAAS_VP.Extension"
+             xmlns:c="clr-namespace:TeamAAS_VP.ValueConverter"
+             xmlns:lex="http://wpflocalizeextension.codeplex.com"
+             xmlns:vm="clr-namespace:TeamAAS_VP.ViewModels"
+             lex:LocalizeDictionary.DesignCulture="zh-CN"
+             lex:ResxLocalizationProvider.DefaultAssembly="TeamAAS-VP"
+             lex:ResxLocalizationProvider.DefaultDictionary="Lang"
+             mc:Ignorable="d"
+             d:Background="White"
+             d:Height="500"
+             d:Width="800"
+             prism:ViewModelLocator.AutoWireViewModel="True"
+             FontFamily="{DynamicResource DefaultFont}">
+    <Grid Margin="20">
+        <Grid.RowDefinitions>
+            <RowDefinition Height="Auto"/>
+            <RowDefinition Height="Auto"/>
+            <RowDefinition Height="Auto"/>
+            <RowDefinition Height="Auto"/>
+            <RowDefinition Height="Auto"/>
+        </Grid.RowDefinitions>
+
+        <TextBlock Grid.Row="0" 
+                   Text="请扫描螺丝条码:" 
+                   FontSize="14" 
+                   Margin="0,0,0,10"/>
+
+        <!-- 输入框会自动接收并显示扫码枪的结果 -->
+        <TextBox x:Name="BarcodeTextBox" 
+                 Grid.Row="1" 
+                 Height="30" 
+                 FontSize="14"
+                 Text="{Binding ScrewsizeCode, Mode=TwoWay}"
+                 Margin="0,0,0,20"/>
+
+        <TextBlock Grid.Row="2" 
+             Text="请扫描员工工号:" 
+             FontSize="14" 
+             Margin="0,0,0,10"/>
+
+        <!-- 输入框会自动接收并显示扫码枪的结果 -->
+        <TextBox x:Name="BarcodeTextBox1" 
+           Grid.Row="3" 
+           Height="30" 
+           FontSize="14"
+           Text="{Binding UserID, Mode=TwoWay}"
+           Margin="0,0,0,20"/>
+
+        <StackPanel Grid.Row="4" 
+                    Orientation="Horizontal" 
+                    HorizontalAlignment="Right">
+            <Button x:Name="OkButton" 
+                    Content="确定" 
+                    Width="80" 
+                    Height="30" 
+                    Margin="0,0,10,0"
+                    Command="{Binding OkCommand}"/>
+            <Button x:Name="CancelButton" 
+                    Content="取消" 
+                    Width="80" 
+                    Height="30"
+                    Command="{Binding CancelCommand}"/>
+        </StackPanel>
+    </Grid>
+</UserControl>

+ 288 - 0
TeamAAS-VM/Views/AddScrewView.xaml.cs

@@ -0,0 +1,288 @@
+using Prism.Events;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+using TeamAAS_VP.Core.PLCs;
+using TeamAAS_VP.Enums;
+using TeamAAS_VP.Events;
+using TeamAAS_VP.Interfaces;
+using TeamAAS_VP.Models;
+using TeamAAS_VP.Resources.Languages;
+using TeamAAS_VP.Services;
+using TeamAAS_VP.ViewModels.Home;
+using TouchSocket.Core;
+
+namespace TeamAAS_VP.Views
+{
+    /// <summary>
+    /// AddScrewView.xaml 的交互逻辑
+    /// </summary>
+    public partial class AddScrewView : UserControl
+    {
+
+        IConfigService _configService;
+        IEventAggregator _eventAggregator;
+        IPlcService _plcService;
+        public ICommand OkCommand { get; }
+        //public ICommand CancelCommand { get; }
+        public string ScannedBarcode { get; private set; }
+        public AddScrewView(IConfigService configService, IEventAggregator eventAggregator, IPlcService plcService)
+        {
+            InitializeComponent();
+            this.Width = 800;
+            this.Height = 500;
+            //_configService = configService;
+            //_eventAggregator = eventAggregator;
+            //_plcService=plcService;
+
+            //OkCommand = new RelayCommand(OkExecute);
+            //CancelCommand = new RelayCommand(CancelExecute);
+
+            this.Loaded += (s, e) => { BarcodeTextBox.Focus(); };
+
+            // 把Command赋值给DataContext,方便绑定
+            //DataContext = this;
+        }
+
+        ///// <summary>
+        ///// PLC命令触发时
+        ///// </summary>
+        ///// <param name="tuple"></param>
+        //private async void PlcCommandTrigger((string key, string nodeId, object value) tuple)
+        //{
+        //    try
+        //    {
+        //        if (tuple.key != "AutoSensor")
+        //        {
+        //            return;
+        //        }
+
+        //        var addressConfig = _configService.GetPlcAddresses();
+
+        //        var plc = _plcService.GetPlcByNumber(addressConfig.PlcNo) as OpcUaClientPLC;
+
+        //        string a = "";
+        //        var stationConfig = _configService.GetDeviceInfo(0);
+        //        ScannedBarcode = BarcodeTextBox.Text;
+        //        if (ScannedBarcode.Contains("|"))
+        //        {
+        //            string[] arr = ScannedBarcode.Split("|");
+        //            for (int i = 0; i < 16; i++)
+        //            {
+        //                a += arr[i];
+        //            }
+        //        }
+        //        else
+        //        {
+        //            a = ScannedBarcode;
+        //        }
+        //        if (string.IsNullOrWhiteSpace(ScannedBarcode))
+        //        {
+        //            MessageBox.Show("请先扫描螺丝条码", "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
+        //            BarcodeTextBox.Focus(); // 重新聚焦
+        //            return;
+        //        }
+        //        if (a == stationConfig.DataInfo.Screwsize1 || a == stationConfig.DataInfo.Screwsize2)
+        //        {
+        //            MessageBox.Show("螺丝型号匹配成功", "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
+        //            //SendTaskMessage($"螺丝型号匹配成功", MessageLevel.Info);
+        //            ExportDataToCsv(DateTime.Now.ToString("yyyy-MM-dd HH:mm"), a, true, @"D:\添加螺丝记录\螺丝上料Log.csv", appendMode: true);
+        //            await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, 1), (Int16)1);
+        //        }
+        //        else
+        //        {
+        //            MessageBox.Show("螺丝型号匹配失败", "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
+        //            //SendTaskMessage($"螺丝型号匹配失败", MessageLevel.Error);
+        //            ExportDataToCsv(DateTime.Now.ToString("yyyy-MM-dd HH:mm"), a, false, @"D:\添加螺丝记录\螺丝上料Log.csv", appendMode: true);
+        //            await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, 1), (Int16)1);
+        //        }
+        //        DialogResult = true;
+        //        Close();
+        //    }
+        //    catch (Exception ex)
+        //    {
+
+        //    }
+        //}
+        private async void OkExecute(object sender)
+        {
+            //try
+            //{
+            //    var addressConfig = _configService.GetPlcAddresses();
+
+            //    var plc = _plcService.GetPlcByNumber(addressConfig.PlcNo) as OpcUaClientPLC;
+
+            //    string a = "";
+            //    var stationConfig = _configService.GetDeviceInfo(0);
+            //    ScannedBarcode = BarcodeTextBox.Text;
+            //    if (ScannedBarcode.Contains("|"))
+            //    {
+            //        string[] arr = ScannedBarcode.Split("|");
+            //        for (int i = 0; i < 16; i++)
+            //        {
+            //            a += arr[i];
+            //        }
+            //    }
+            //    else
+            //    {
+            //        a = ScannedBarcode;
+            //    }
+            //    if (string.IsNullOrWhiteSpace(ScannedBarcode))
+            //    {
+            //        MessageBox.Show("请先扫描螺丝条码", "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
+            //        BarcodeTextBox.Focus(); // 重新聚焦
+            //        return;
+            //    }
+            //    if (a == stationConfig.DataInfo.Screwsize1 || a == stationConfig.DataInfo.Screwsize2 || a == stationConfig.DataInfo.Screwsize3)
+            //    {
+            //        await plc.WriteNodeAsync<bool>(addressConfig.Out_PlcFail.Address, false);
+            //        MessageBox.Show("螺丝型号匹配成功", "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
+            //        //SendTaskMessage($"螺丝型号匹配成功", MessageLevel.Info);
+            //        ExportDataToCsv(DateTime.Now.ToString("yyyy-MM-dd HH:mm"), a, stationConfig.DataInfo, true, @"D:\添加螺丝记录\螺丝上料Log.csv", appendMode: true);
+            //    }
+            //    else
+            //    {
+            //        await plc.WriteNodeAsync<bool>(addressConfig.Out_PlcFail.Address, true);
+            //        MessageBox.Show("螺丝型号匹配失败", "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
+
+            //        //SendTaskMessage($"螺丝型号匹配失败", MessageLevel.Error);
+            //        ExportDataToCsv(DateTime.Now.ToString("yyyy-MM-dd HH:mm"), a, stationConfig.DataInfo, false, @"D:\添加螺丝记录\螺丝上料Log.csv", appendMode: true);
+            //    }
+            //}
+            //catch (Exception ex)
+            //{
+
+            //}
+
+
+            //PlcCommandTrigger(("AutoSensor", "", ""));
+            //string a = "";
+
+            //var stationConfig = _configService.GetDeviceInfo(0);
+            //ScannedBarcode = BarcodeTextBox.Text;
+            //if (ScannedBarcode.Contains("|"))
+            //{
+            //    string[] arr = ScannedBarcode.Split("|");
+            //    for (int i = 0; i < 16; i++)
+            //    {
+            //        a += arr[i];
+            //    }
+            //}
+            //else
+            //{
+            //    a = ScannedBarcode;
+            //}
+            //if (string.IsNullOrWhiteSpace(ScannedBarcode))
+            //{
+            //    MessageBox.Show("请先扫描螺丝条码", "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
+            //    BarcodeTextBox.Focus(); // 重新聚焦
+            //    return;
+            //}
+            //if (a == stationConfig.DataInfo.Screwsize1 || a == stationConfig.DataInfo.Screwsize2)
+            //{
+            //    MessageBox.Show("螺丝型号匹配成功", "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
+            //    //SendTaskMessage($"螺丝型号匹配成功", MessageLevel.Info);
+            //    ExportDataToCsv(DateTime.Now.ToString("yyyy-MM-dd HH:mm"), a, true, @"D:\添加螺丝记录\螺丝上料Log.csv", appendMode: true);
+            //}
+            //else
+            //{
+            //    MessageBox.Show("螺丝型号匹配失败", "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
+            //    //SendTaskMessage($"螺丝型号匹配失败", MessageLevel.Error);
+            //    ExportDataToCsv(DateTime.Now.ToString("yyyy-MM-dd HH:mm"), a, false, @"D:\添加螺丝记录\螺丝上料Log.csv", appendMode: true);
+            //}
+            //DialogResult = true;
+            //Close();
+        }
+
+        private void CancelExecute(object sender)
+        {
+           
+        }
+
+        //public void SendTaskMessage(string msg, MessageLevel level)
+        //{
+        //    App.Current.Dispatcher.Invoke(() =>aZ
+        //    {
+        //        _eventAggregator.GetEvent<TaskMessageNotification>().Publish(new Models.MessageStruct() { Message = msg, level = level });
+        //    });
+        //}
+        public static void ExportDataToCsv(string dateTime, string model, CTQ_Data DataInfo, bool isMatch, string savePath, bool appendMode = false)
+        {
+            string directory = global::System.IO.Path.GetDirectoryName(savePath);
+
+            // 如果目录路径不为空且不存在,则创建
+            if (!string.IsNullOrEmpty(directory) && !Directory.Exists(directory))
+            {
+                Directory.CreateDirectory(directory);
+            }
+
+            // 构建CSV内容
+            StringBuilder csvContent = new StringBuilder();
+
+            // 处理表头:仅当文件不存在/非追加模式时,才写入表头
+            if (!appendMode || !File.Exists(savePath))
+            {
+                csvContent.AppendLine("日期时间,目标螺丝型号1,螺丝型号2,螺丝型号3,添加螺丝型号,是否匹配");
+            }
+
+            // 处理数据行
+            string matchStr = isMatch ? "是" : "否";
+
+            // 如果型号中包含逗号,需要用引号包裹
+            string safeModel = model;
+            if (safeModel.Contains(","))
+            {
+                safeModel = $"\"{safeModel}\"";
+            }
+
+            csvContent.AppendLine($"{dateTime},{DataInfo.Screwsize1},{DataInfo.Screwsize2},{DataInfo.Screwsize3},{model},{matchStr}");
+
+            // 写入文件:UTF-8带BOM编码,Excel打开无乱码
+            if (appendMode && File.Exists(savePath))
+            {
+                // 追加模式:在文件末尾新增内容
+                File.AppendAllText(savePath, csvContent.ToString(), Encoding.UTF8);
+            }
+            else
+            {
+                // 覆盖模式:新建/替换文件
+                File.WriteAllText(savePath, csvContent.ToString(), Encoding.UTF8);
+            }
+        }
+
+    }
+    //public class RelayCommand : ICommand
+    //{
+    //    private readonly Action<object> _execute;
+    //    private readonly Func<object, bool> _canExecute;
+
+    //    public event EventHandler CanExecuteChanged
+    //    {
+    //        add { CommandManager.RequerySuggested += value; }
+    //        remove { CommandManager.RequerySuggested -= value; }
+    //    }
+
+    //    public RelayCommand(Action<object> execute, Func<object, bool> canExecute = null)
+    //    {
+    //        _execute = execute ?? throw new ArgumentNullException(nameof(execute));
+    //        _canExecute = canExecute;
+    //    }
+
+    //    public bool CanExecute(object parameter) => _canExecute == null || _canExecute(parameter);
+
+    //    public void Execute(object parameter) => _execute(parameter);
+    //}
+
+}

+ 0 - 1
TeamAAS-VM/Views/Home/AddScrew.xaml

@@ -18,7 +18,6 @@
              lex:ResxLocalizationProvider.DefaultDictionary="Lang"
              lex:ResxLocalizationProvider.DefaultDictionary="Lang"
              mc:Ignorable="d"
              mc:Ignorable="d"
              d:Background="White"
              d:Background="White"
-             d:DataContext="{d:DesignInstance Type=vm:AddScrewViewModel}"
              prism:ViewModelLocator.AutoWireViewModel="True"
              prism:ViewModelLocator.AutoWireViewModel="True"
              FontFamily="{DynamicResource DefaultFont}">
              FontFamily="{DynamicResource DefaultFont}">
     <prism:Dialog.WindowStyle>
     <prism:Dialog.WindowStyle>

Plik diff jest za duży
+ 480 - 430
TeamAAS-VM/Views/HomeView.xaml


+ 212 - 76
TeamAAS-VM/Views/MainWindowView.xaml

@@ -5,13 +5,13 @@
     xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
     xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
     xmlns:converter="clr-namespace:TeamAAS_VP.ValueConverter"
     xmlns:converter="clr-namespace:TeamAAS_VP.ValueConverter"
     xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
     xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+    xmlns:enums="clr-namespace:TeamAAS_VP.Enums"
     xmlns:lex="http://wpflocalizeextension.codeplex.com"
     xmlns:lex="http://wpflocalizeextension.codeplex.com"
     xmlns:local="clr-namespace:TeamAAS_VP"
     xmlns:local="clr-namespace:TeamAAS_VP"
     xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
     xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
     xmlns:prism="http://prismlibrary.com/"
     xmlns:prism="http://prismlibrary.com/"
     xmlns:vm="clr-namespace:TeamAAS_VP.ViewModels"
     xmlns:vm="clr-namespace:TeamAAS_VP.ViewModels"
-    xmlns:enums="clr-namespace:TeamAAS_VP.Enums"
     d:DataContext="{d:DesignInstance Type=vm:MainWindowViewModel}"
     d:DataContext="{d:DesignInstance Type=vm:MainWindowViewModel}"
     d:Height="768"
     d:Height="768"
     d:Width="1024"
     d:Width="1024"
@@ -33,52 +33,52 @@
         <converter:NavigationStateConverter x:Key="_NavigationState" />
         <converter:NavigationStateConverter x:Key="_NavigationState" />
         <converter:NavigationStateConverter1 x:Key="_NavigationState1" />
         <converter:NavigationStateConverter1 x:Key="_NavigationState1" />
 
 
-        <!-- 普通状态背景 -->
+        <!--  普通状态背景  -->
         <SolidColorBrush x:Key="ModeNormalBrush" Color="White" />
         <SolidColorBrush x:Key="ModeNormalBrush" Color="White" />
-        <!-- 生产模式背景 -->
+        <!--  生产模式背景  -->
         <SolidColorBrush x:Key="ModeAutoBrush" Color="Green" />
         <SolidColorBrush x:Key="ModeAutoBrush" Color="Green" />
-        <!-- 调机模式背景 -->
+        <!--  调机模式背景  -->
         <SolidColorBrush x:Key="ModeManualBrush" Color="Orange" />
         <SolidColorBrush x:Key="ModeManualBrush" Color="Orange" />
-        <!-- 流线模式背景 -->
+        <!--  流线模式背景  -->
         <SolidColorBrush x:Key="ModeClearBrush" Color="Yellow" />
         <SolidColorBrush x:Key="ModeClearBrush" Color="Yellow" />
 
 
-        <!-- 生产卡片样式 -->
+        <!--  生产卡片样式  -->
         <Style x:Key="AutoModeCardStyle" TargetType="materialDesign:Card">
         <Style x:Key="AutoModeCardStyle" TargetType="materialDesign:Card">
             <Setter Property="Background" Value="{StaticResource ModeNormalBrush}" />
             <Setter Property="Background" Value="{StaticResource ModeNormalBrush}" />
-            <Setter Property="Margin" Value="50,10" />
+            <Setter Property="Margin" Value="6,0" />
+            <Setter Property="MinWidth" Value="64" />
             <Setter Property="HorizontalAlignment" Value="Center" />
             <Setter Property="HorizontalAlignment" Value="Center" />
             <Setter Property="VerticalAlignment" Value="Center" />
             <Setter Property="VerticalAlignment" Value="Center" />
             <Style.Triggers>
             <Style.Triggers>
-                <DataTrigger Binding="{Binding management.CurrentDisplayMode}"
-                         Value="{x:Static enums:RunDisplayMode.Auto}">
+                <DataTrigger Binding="{Binding management.CurrentDisplayMode}" Value="{x:Static enums:RunDisplayMode.Auto}">
                     <Setter Property="Background" Value="{StaticResource ModeAutoBrush}" />
                     <Setter Property="Background" Value="{StaticResource ModeAutoBrush}" />
                 </DataTrigger>
                 </DataTrigger>
             </Style.Triggers>
             </Style.Triggers>
         </Style>
         </Style>
 
 
-        <!-- 调机卡片样式 -->
+        <!--  调机卡片样式  -->
         <Style x:Key="ManualModeCardStyle" TargetType="materialDesign:Card">
         <Style x:Key="ManualModeCardStyle" TargetType="materialDesign:Card">
             <Setter Property="Background" Value="{StaticResource ModeNormalBrush}" />
             <Setter Property="Background" Value="{StaticResource ModeNormalBrush}" />
-            <Setter Property="Margin" Value="20,10" />
+            <Setter Property="Margin" Value="6,0" />
+            <Setter Property="MinWidth" Value="64" />
             <Setter Property="HorizontalAlignment" Value="Center" />
             <Setter Property="HorizontalAlignment" Value="Center" />
             <Setter Property="VerticalAlignment" Value="Center" />
             <Setter Property="VerticalAlignment" Value="Center" />
             <Style.Triggers>
             <Style.Triggers>
-                <DataTrigger Binding="{Binding management.CurrentDisplayMode}"
-                         Value="{x:Static enums:RunDisplayMode.Manual}">
+                <DataTrigger Binding="{Binding management.CurrentDisplayMode}" Value="{x:Static enums:RunDisplayMode.Manual}">
                     <Setter Property="Background" Value="{StaticResource ModeManualBrush}" />
                     <Setter Property="Background" Value="{StaticResource ModeManualBrush}" />
                 </DataTrigger>
                 </DataTrigger>
             </Style.Triggers>
             </Style.Triggers>
         </Style>
         </Style>
 
 
-        <!-- 流线卡片样式 -->
+        <!--  流线卡片样式  -->
         <Style x:Key="ClearModeCardStyle" TargetType="materialDesign:Card">
         <Style x:Key="ClearModeCardStyle" TargetType="materialDesign:Card">
             <Setter Property="Background" Value="{StaticResource ModeNormalBrush}" />
             <Setter Property="Background" Value="{StaticResource ModeNormalBrush}" />
-            <Setter Property="Margin" Value="50,10" />
+            <Setter Property="Margin" Value="6,0" />
+            <Setter Property="MinWidth" Value="64" />
             <Setter Property="HorizontalAlignment" Value="Center" />
             <Setter Property="HorizontalAlignment" Value="Center" />
             <Setter Property="VerticalAlignment" Value="Center" />
             <Setter Property="VerticalAlignment" Value="Center" />
             <Style.Triggers>
             <Style.Triggers>
-                <DataTrigger Binding="{Binding management.CurrentDisplayMode}"
-                         Value="{x:Static enums:RunDisplayMode.Clear}">
+                <DataTrigger Binding="{Binding management.CurrentDisplayMode}" Value="{x:Static enums:RunDisplayMode.Clear}">
                     <Setter Property="Background" Value="{StaticResource ModeClearBrush}" />
                     <Setter Property="Background" Value="{StaticResource ModeClearBrush}" />
                 </DataTrigger>
                 </DataTrigger>
             </Style.Triggers>
             </Style.Triggers>
@@ -127,11 +127,23 @@
                     CommandParameter="Home"
                     CommandParameter="Home"
                     Style="{StaticResource MaterialDesignIconButton}"
                     Style="{StaticResource MaterialDesignIconButton}"
                     ToolTip="{lex:Loc 运行窗口}">
                     ToolTip="{lex:Loc 运行窗口}">
-                    <materialDesign:PackIcon
-                        Width="70"
-                        Height="70"
-                        Foreground="{Binding NavigationIndex, Converter={StaticResource _NavigationState1}, ConverterParameter=0}"
-                        Kind="HomeOutline" />
+                    <StackPanel
+                        HorizontalAlignment="Center"
+                        VerticalAlignment="Center"
+                        Orientation="Vertical">
+                        <materialDesign:PackIcon
+                            Width="50"
+                            Height="50"
+                            Foreground="{Binding NavigationIndex, Converter={StaticResource _NavigationState1}, ConverterParameter=0}"
+                            Kind="HomeOutline" />
+                        <TextBlock
+                            Margin="0,0,0,5"
+                            HorizontalAlignment="Center"
+                            VerticalAlignment="Center"
+                            FontSize="12"
+                            Foreground="Black"
+                            Text="{lex:Loc 运行窗口}" />
+                    </StackPanel>
                 </Button>
                 </Button>
                 <Button
                 <Button
                     Grid.Row="1"
                     Grid.Row="1"
@@ -143,11 +155,23 @@
                     CommandParameter="Products"
                     CommandParameter="Products"
                     Style="{StaticResource MaterialDesignIconButton}"
                     Style="{StaticResource MaterialDesignIconButton}"
                     ToolTip="{lex:Loc 产品管理}">
                     ToolTip="{lex:Loc 产品管理}">
-                    <materialDesign:PackIcon
-                        Width="70"
-                        Height="70"
-                        Foreground="{Binding NavigationIndex, Converter={StaticResource _NavigationState1}, ConverterParameter=1}"
-                        Kind="FileTableBoxOutline" />
+                    <StackPanel
+                        HorizontalAlignment="Center"
+                        VerticalAlignment="Center"
+                        Orientation="Vertical">
+                        <materialDesign:PackIcon
+                            Width="50"
+                            Height="50"
+                            Foreground="{Binding NavigationIndex, Converter={StaticResource _NavigationState1}, ConverterParameter=1}"
+                            Kind="FileTableBoxOutline" />
+                        <TextBlock
+                            Margin="0,0,0,5"
+                            HorizontalAlignment="Center"
+                            VerticalAlignment="Center"
+                            FontSize="12"
+                            Foreground="Black"
+                            Text="{lex:Loc 产品管理}" />
+                    </StackPanel>
                 </Button>
                 </Button>
                 <Button
                 <Button
                     Grid.Row="1"
                     Grid.Row="1"
@@ -159,11 +183,23 @@
                     CommandParameter="Debug"
                     CommandParameter="Debug"
                     Style="{StaticResource MaterialDesignIconButton}"
                     Style="{StaticResource MaterialDesignIconButton}"
                     ToolTip="{lex:Loc 调试}">
                     ToolTip="{lex:Loc 调试}">
-                    <materialDesign:PackIcon
-                        Width="70"
-                        Height="70"
-                        Foreground="{Binding NavigationIndex, Converter={StaticResource _NavigationState1}, ConverterParameter=2}"
-                        Kind="WrenchOutline" />
+                    <StackPanel
+                        HorizontalAlignment="Center"
+                        VerticalAlignment="Center"
+                        Orientation="Vertical">
+                        <materialDesign:PackIcon
+                            Width="50"
+                            Height="50"
+                            Foreground="{Binding NavigationIndex, Converter={StaticResource _NavigationState1}, ConverterParameter=2}"
+                            Kind="WrenchOutline" />
+                        <TextBlock
+                            Margin="0,0,0,5"
+                            HorizontalAlignment="Center"
+                            VerticalAlignment="Center"
+                            FontSize="12"
+                            Foreground="Black"
+                            Text="{lex:Loc 调试}" />
+                    </StackPanel>
                 </Button>
                 </Button>
                 <Button
                 <Button
                     Grid.Row="1"
                     Grid.Row="1"
@@ -175,11 +211,23 @@
                     CommandParameter="Setting"
                     CommandParameter="Setting"
                     Style="{StaticResource MaterialDesignIconButton}"
                     Style="{StaticResource MaterialDesignIconButton}"
                     ToolTip="{lex:Loc 设置}">
                     ToolTip="{lex:Loc 设置}">
-                    <materialDesign:PackIcon
-                        Width="70"
-                        Height="70"
-                        Foreground="{Binding NavigationIndex, Converter={StaticResource _NavigationState1}, ConverterParameter=3}"
-                        Kind="Cog" />
+                    <StackPanel
+                        HorizontalAlignment="Center"
+                        VerticalAlignment="Center"
+                        Orientation="Vertical">
+                        <materialDesign:PackIcon
+                            Width="50"
+                            Height="50"
+                            Foreground="{Binding NavigationIndex, Converter={StaticResource _NavigationState1}, ConverterParameter=3}"
+                            Kind="Cog" />
+                        <TextBlock
+                            Margin="0,0,0,5"
+                            HorizontalAlignment="Center"
+                            VerticalAlignment="Center"
+                            FontSize="12"
+                            Foreground="Black"
+                            Text="{lex:Loc 设置}" />
+                    </StackPanel>
                 </Button>
                 </Button>
                 <materialDesign:Card
                 <materialDesign:Card
                     Grid.Row="1"
                     Grid.Row="1"
@@ -187,36 +235,86 @@
                     Margin="10"
                     Margin="10"
                     Background="White"
                     Background="White"
                     UniformCornerRadius="15">
                     UniformCornerRadius="15">
-                    <StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
+                    <Grid Margin="12,8">
+                        <Grid.ColumnDefinitions>
+                            <ColumnDefinition Width="Auto" />
+                            <ColumnDefinition Width="*" />
+                            <ColumnDefinition Width="Auto" />
+                        </Grid.ColumnDefinitions>
+
+                        <Border
+                            Grid.Column="0"
+                            MinWidth="190"
+                            Padding="10,6"
+                            VerticalAlignment="Center"
+                            BorderBrush="#D6DDE8"
+                            BorderThickness="1"
+                            CornerRadius="8">
+                            <StackPanel Orientation="Vertical">
+                                <TextBlock
+                                    Margin="0,0,0,4"
+                                    FontSize="{DynamicResource Font.Size.Body3}"
+                                    FontWeight="SemiBold"
+                                    Text="{lex:Loc SettingView_Language_Text}" />
+                                <ComboBox
+                                    MinWidth="160"
+                                    FontSize="12"
+                                    SelectedValue="{Binding CurrentLanguage, Mode=TwoWay}"
+                                    SelectedValuePath="Tag">
+                                    <ComboBoxItem
+                                        Content="{lex:Loc SettingView_Language_ChineseSimplified}"
+                                        Tag="{x:Static enums:Language.ChineseSimplified}" />
+                                    <ComboBoxItem
+                                        Content="{lex:Loc SettingView_Language_ChineseTraditional}"
+                                        Tag="{x:Static enums:Language.ChineseTraditional}" />
+                                    <ComboBoxItem
+                                        Content="{lex:Loc SettingView_Language_English}"
+                                        Tag="{x:Static enums:Language.English}" />
+                                    <ComboBoxItem
+                                        Content="{lex:Loc SettingView_Language_Japanese}"
+                                        Tag="{x:Static enums:Language.Japanese}" />
+                                    <ComboBoxItem
+                                        Content="{lex:Loc SettingView_Language_Vietnamese}"
+                                        Tag="{x:Static enums:Language.Vietnamese}" />
+                                </ComboBox>
+                            </StackPanel>
+                        </Border>
+
                         <TextBlock
                         <TextBlock
-                            Margin="280,0,0,0"
+                            Grid.Column="1"
                             HorizontalAlignment="Center"
                             HorizontalAlignment="Center"
                             VerticalAlignment="Center"
                             VerticalAlignment="Center"
                             FontSize="{DynamicResource Font.Size.Title1}"
                             FontSize="{DynamicResource Font.Size.Title1}"
                             FontWeight="Bold"
                             FontWeight="Bold"
+                            TextAlignment="Center"
                             Text="{Binding MyTitle}" />
                             Text="{Binding MyTitle}" />
-                        <materialDesign:Card Style="{StaticResource AutoModeCardStyle}">
-                            <TextBlock
-                                Margin="8"
-                                FontSize="22"
-                                Text="{lex:Loc 生产}" />
-                        </materialDesign:Card>
 
 
-                        <materialDesign:Card Style="{StaticResource ManualModeCardStyle}">
-                            <TextBlock
-                                Margin="8"
-                                FontSize="22"
-                                Text="{lex:Loc 调机}" />
-                        </materialDesign:Card>
+                        <StackPanel
+                            Grid.Column="2"
+                            HorizontalAlignment="Right"
+                            Orientation="Horizontal">
+                            <materialDesign:Card Style="{StaticResource AutoModeCardStyle}" Margin="6,0">
+                                <TextBlock
+                                    Margin="8"
+                                    FontSize="22"
+                                    Text="{lex:Loc 生产}" />
+                            </materialDesign:Card>
 
 
-                        <materialDesign:Card Style="{StaticResource ClearModeCardStyle}">
-                            <TextBlock
-                                Margin="8"
-                                FontSize="22"
-                                Text="{lex:Loc 流线}" />
-                        </materialDesign:Card>
-                    </StackPanel>
+                            <materialDesign:Card Style="{StaticResource ManualModeCardStyle}" Margin="6,0">
+                                <TextBlock
+                                    Margin="8"
+                                    FontSize="22"
+                                    Text="{lex:Loc 调机}" />
+                            </materialDesign:Card>
 
 
+                            <materialDesign:Card Style="{StaticResource ClearModeCardStyle}" Margin="6,0">
+                                <TextBlock
+                                    Margin="8"
+                                    FontSize="22"
+                                    Text="{lex:Loc 流线}" />
+                            </materialDesign:Card>
+                        </StackPanel>
+                    </Grid>
 
 
                 </materialDesign:Card>
                 </materialDesign:Card>
                 <Button
                 <Button
@@ -224,48 +322,86 @@
                     Grid.Column="5"
                     Grid.Column="5"
                     Width="90"
                     Width="90"
                     Height="90"
                     Height="90"
-                    Background="{Binding NavigationIndex, Converter={StaticResource _NavigationState}, ConverterParameter=5}"
+                    Background="{Binding NavigationIndex, Converter={StaticResource _NavigationState}, ConverterParameter=6}"
                     Command="{Binding NavigationCommand}"
                     Command="{Binding NavigationCommand}"
                     CommandParameter="Calib"
                     CommandParameter="Calib"
                     Style="{StaticResource MaterialDesignIconButton}"
                     Style="{StaticResource MaterialDesignIconButton}"
                     ToolTip="{lex:Loc 校准}">
                     ToolTip="{lex:Loc 校准}">
-                    <materialDesign:PackIcon
-                        Width="70"
-                        Height="70"
-                        Foreground="{Binding NavigationIndex, Converter={StaticResource _NavigationState1}, ConverterParameter=5}"
-                        Kind="CrosshairsGps" />
+                    <StackPanel
+                        HorizontalAlignment="Center"
+                        VerticalAlignment="Center"
+                        Orientation="Vertical">
+                        <materialDesign:PackIcon
+                            Width="50"
+                            Height="50"
+                            Foreground="{Binding NavigationIndex, Converter={StaticResource _NavigationState1}, ConverterParameter=6}"
+                            Kind="CrosshairsGps" />
+                        <TextBlock
+                            Margin="0,0,0,5"
+                            HorizontalAlignment="Center"
+                            VerticalAlignment="Center"
+                            FontSize="12"
+                            Foreground="Black"
+                            Text="{lex:Loc 校准}" />
+                    </StackPanel>
                 </Button>
                 </Button>
                 <Button
                 <Button
                     Grid.Row="1"
                     Grid.Row="1"
                     Grid.Column="6"
                     Grid.Column="6"
                     Width="90"
                     Width="90"
                     Height="90"
                     Height="90"
-                    Background="{Binding NavigationIndex, Converter={StaticResource _NavigationState}, ConverterParameter=6}"
+                    Background="{Binding NavigationIndex, Converter={StaticResource _NavigationState}, ConverterParameter=7}"
                     Command="{Binding NavigationCommand}"
                     Command="{Binding NavigationCommand}"
                     CommandParameter="Statistics"
                     CommandParameter="Statistics"
+                    Cursor="Hand"
                     Style="{StaticResource MaterialDesignIconButton}"
                     Style="{StaticResource MaterialDesignIconButton}"
                     ToolTip="{lex:Loc 统计}">
                     ToolTip="{lex:Loc 统计}">
-                    <materialDesign:PackIcon
-                        Width="70"
-                        Height="70"
-                        Foreground="{Binding NavigationIndex, Converter={StaticResource _NavigationState1}, ConverterParameter=6}"
-                        Kind="ChartBellCurveCumulative" />
+                    <StackPanel
+                        HorizontalAlignment="Center"
+                        VerticalAlignment="Center"
+                        Orientation="Vertical">
+                        <materialDesign:PackIcon
+                            Width="50"
+                            Height="50"
+                            Foreground="{Binding NavigationIndex, Converter={StaticResource _NavigationState1}, ConverterParameter=7}"
+                            Kind="ChartBellCurveCumulative" />
+                        <TextBlock
+                            Margin="0,0,0,5"
+                            HorizontalAlignment="Center"
+                            VerticalAlignment="Center"
+                            FontSize="12"
+                            Foreground="Black"
+                            Text="{lex:Loc 统计}" />
+                    </StackPanel>
                 </Button>
                 </Button>
                 <Button
                 <Button
                     Grid.Row="1"
                     Grid.Row="1"
                     Grid.Column="7"
                     Grid.Column="7"
                     Width="90"
                     Width="90"
                     Height="90"
                     Height="90"
-                    Background="{Binding NavigationIndex, Converter={StaticResource _NavigationState}, ConverterParameter=7}"
+                    Background="{Binding NavigationIndex, Converter={StaticResource _NavigationState}, ConverterParameter=8}"
                     Command="{Binding NavigationCommand}"
                     Command="{Binding NavigationCommand}"
                     CommandParameter="User"
                     CommandParameter="User"
                     Style="{StaticResource MaterialDesignIconButton}"
                     Style="{StaticResource MaterialDesignIconButton}"
                     ToolTip="{lex:Loc 用户}">
                     ToolTip="{lex:Loc 用户}">
-                    <materialDesign:PackIcon
-                        Width="70"
-                        Height="70"
-                        Foreground="{Binding NavigationIndex, Converter={StaticResource _NavigationState1}, ConverterParameter=7}"
-                        Kind="AccountMultipleOutline" />
+                    <StackPanel
+                        HorizontalAlignment="Center"
+                        VerticalAlignment="Center"
+                        Orientation="Vertical">
+                        <materialDesign:PackIcon
+                            Width="50"
+                            Height="50"
+                            Foreground="{Binding NavigationIndex, Converter={StaticResource _NavigationState1}, ConverterParameter=8}"
+                            Kind="AccountMultipleOutline" />
+                        <TextBlock
+                            Margin="0,0,0,5"
+                            HorizontalAlignment="Center"
+                            VerticalAlignment="Center"
+                            FontSize="12"
+                            Foreground="Black"
+                            Text="{lex:Loc 用户}" />
+                    </StackPanel>
+
                 </Button>
                 </Button>
             </Grid>
             </Grid>
 
 

+ 24 - 0
TeamAAS-VM/Views/Product/ProductParams.xaml

@@ -201,6 +201,7 @@
                         <RowDefinition Height="auto" />
                         <RowDefinition Height="auto" />
                         <RowDefinition Height="auto" />
                         <RowDefinition Height="auto" />
                         <RowDefinition Height="auto" />
                         <RowDefinition Height="auto" />
+                        <RowDefinition Height="auto" />
                     </Grid.RowDefinitions>
                     </Grid.RowDefinitions>
                     <Grid.ColumnDefinitions>
                     <Grid.ColumnDefinitions>
                         <ColumnDefinition Width="auto" />
                         <ColumnDefinition Width="auto" />
@@ -437,6 +438,29 @@
                             </DataTemplate>
                             </DataTemplate>
                         </ComboBox.ItemTemplate>
                         </ComboBox.ItemTemplate>
                     </ComboBox>
                     </ComboBox>
+                    <!--翻转相机流程id-->
+                    <TextBlock Grid.Row="6"
+                               Grid.Column="0"
+                               Text="翻转相机流程ID: " />
+                    <ComboBox Grid.Row="6"
+                              Grid.Column="1"
+                              ItemsSource="{Binding ProcedureModels}"
+                              SelectedItem="{Binding FzCameraProcedure}"
+                              materialDesign:TextFieldAssist.HasClearButton="True"
+                              materialDesign:HintAssist.Hint="{lex:Loc 选择需要配置的流程}">
+                        <ComboBox.ItemTemplate>
+                            <DataTemplate>
+                                <StackPanel Orientation="Horizontal">
+                                    <materialDesign:PackIcon Kind="VideoOutline" />
+                                    <TextBlock Text="{Binding CameraName}"
+                                               Margin="6,0" />
+                                    <materialDesign:PackIcon Kind="ProgressWrench" />
+                                    <TextBlock Text="{Binding Name}"
+                                               Margin="6,0" />
+                                </StackPanel>
+                            </DataTemplate>
+                        </ComboBox.ItemTemplate>
+                    </ComboBox>
                 </Grid>
                 </Grid>
             </Grid>
             </Grid>
 
 

Plik diff jest za duży
+ 581 - 440
TeamAAS-VM/Views/SettingView.xaml


+ 4 - 4
TeamAAS-VM/Views/User/LoginView.xaml

@@ -64,18 +64,18 @@
                     <Grid Grid.Row="3"
                     <Grid Grid.Row="3"
                           Height="40"
                           Height="40"
                           Margin="20,5,20,0">
                           Margin="20,5,20,0">
-                        <CheckBox Content="{lex:Loc 记住用户}"
+                        <!--<CheckBox Content="{lex:Loc 记住用户}"
                                   Foreground="Black"
                                   Foreground="Black"
                                   Style="{StaticResource MaterialDesignCheckBox}"
                                   Style="{StaticResource MaterialDesignCheckBox}"
                                   HorizontalAlignment="Left"
                                   HorizontalAlignment="Left"
                                   VerticalAlignment="Center"
                                   VerticalAlignment="Center"
-                                  IsChecked="{Binding IsRemember}"/>
-                        <Button Content="{lex:Loc 注册}"
+                                  IsChecked="{Binding IsRemember}"/>-->
+                        <!--<Button Content="{lex:Loc 注册}"
                                 HorizontalAlignment="Right"
                                 HorizontalAlignment="Right"
                                 Background="Transparent"
                                 Background="Transparent"
                                 BorderBrush="Transparent"
                                 BorderBrush="Transparent"
                                 Foreground="Black"
                                 Foreground="Black"
-                                Command="{Binding SignUpCommand}"/>
+                                Command="{Binding SignUpCommand}"/>-->
                     </Grid>
                     </Grid>
                     <Button Grid.Row="4"
                     <Button Grid.Row="4"
                             Margin="20,10"
                             Margin="20,10"

Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików