zly 1 month ago
parent
commit
8c365f4862

+ 17 - 10
TeamAAS-VM/Core/Cameras/IKapCamera.cs

@@ -403,7 +403,7 @@ namespace TeamAAS_VP.Core.Cameras
         // 注意:需要更新 Grab 方法中的图像获取部分
         public ICogImage Grab(bool isRealtime = true)
         {
-            _operationSemaphore.Wait();
+           // _operationSemaphore.Wait();
             try
             {
                 Stopwatch sw = Stopwatch.StartNew();
@@ -438,16 +438,23 @@ namespace TeamAAS_VP.Core.Cameras
                 // 等待采集完成
                 _ikDevice.waitGrab();
 
-                // 获取图像数据
-                lock (_imageLock)
+
+                if (_ikDevice.m_pUserBuffer != IntPtr.Zero && _ikDevice.m_bUpdateImage)
                 {
-                    if (_ikDevice.m_pUserBuffer != IntPtr.Zero && _ikDevice.m_bUpdateImage)
-                    {
-                        // 使用新的图像转换方法
-                        Image = ConvertBufferToCogImage(_ikDevice.m_pUserBuffer);
-                        _ikDevice.m_bUpdateImage = false;
-                    }
+                    // 使用新的图像转换方法
+                    Image = ConvertBufferToCogImage(_ikDevice.m_pUserBuffer);
+                    _ikDevice.m_bUpdateImage = false;
                 }
+                // 获取图像数据
+                //lock (_imageLock)
+                //{
+                //    if (_ikDevice.m_pUserBuffer != IntPtr.Zero && _ikDevice.m_bUpdateImage)
+                //    {
+                //        // 使用新的图像转换方法
+                //        Image = ConvertBufferToCogImage(_ikDevice.m_pUserBuffer);
+                //        _ikDevice.m_bUpdateImage = false;
+                //    }
+                //}
 
                 // 停止采集
                 _ikDevice.stopGrab();
@@ -474,7 +481,7 @@ namespace TeamAAS_VP.Core.Cameras
             }
             finally
             {
-                _operationSemaphore.Release();
+               // _operationSemaphore.Release();
             }
         }
 

+ 1 - 1
TeamAAS-VM/Core/ImageHelper.cs

@@ -20,7 +20,7 @@ namespace TeamAAS_VP.Core
         /// <param name="bitmap"></param>
         /// <param name="path">目标图像存储路径JPEG</param>
         /// <param name="quality">压缩等级,0到100,0 最差质量,100 最佳</param>
-        public static void CompressImage(Bitmap bitmap, string path, long quality = 100)
+        public static void CompressImage(Bitmap bitmap, string path, long quality = 20)
         {
             ImageCodecInfo codecInfo = GetEncoderInfo("image/jpeg");
             System.Drawing.Imaging.Encoder encoder = System.Drawing.Imaging.Encoder.Quality;

+ 7 - 0
TeamAAS-VM/Core/Lights/ILightChannel.cs

@@ -68,6 +68,13 @@ namespace TeamAAS_VP.Core.Lights
         /// </remarks>
         Task<bool> SetBrightnessAsync(int brightness);
 
+        /// <summary>
+        /// 异步设置多个通道的亮度。
+        /// </summary>
+        /// <param name="channelBrightnessMap">通道索引与目标亮度的键值对。</param>
+        /// <returns>若所有通道均成功设置返回 true,任一失败返回 false。</returns>
+        Task<bool> SetChannelsAsync(IDictionary<int, int> channelBrightnessMap);
+
         /// <summary>
         /// 异步开启通道。
         /// </summary>

+ 21 - 0
TeamAAS-VM/Core/Lights/KCSLightChannel.cs

@@ -94,6 +94,27 @@ namespace TeamAAS_VP.Core.Lights
             return result;
         }
 
+        /// <summary>
+        /// 异步设置多个通道的亮度
+        /// </summary>
+        /// <param name="channelBrightnessMap">通道索引与目标亮度的键值对。</param>
+        /// <returns>若设备返回确认字符 '!' 则认为操作成功。</returns>
+        public async Task<bool> SetChannelsAsync(IDictionary<int, int> channelBrightnessMap)
+        {
+            foreach (var item in channelBrightnessMap)
+            {
+                if (item.Key < 0 || item.Key >= 255)
+                    throw new ArgumentOutOfRangeException(nameof(channelBrightnessMap), $"通道索引 {item.Key} 超出范围");
+
+                if (item.Value < 0 || item.Value > 255)
+                    throw new ArgumentOutOfRangeException(nameof(channelBrightnessMap), $"亮度值 {item.Value} 超出范围");
+            }
+
+            return await _controller.TurnOnChannelsAsync(channelBrightnessMap);
+            //return await _controller.TurnOffAllAsync();
+            
+        }
+
         /// <summary>
         /// 异步开启通道。如果当前有缓存亮度且大于 0,则使用该亮度;否则使用默认亮度 100。
         /// 该方法会调用 <see cref="SetBrightnessAsync"/> 并返回控制器操作结果。

+ 69 - 1
TeamAAS-VM/Core/Lights/KCSLightController.cs

@@ -146,7 +146,7 @@ namespace TeamAAS_VP.Core.Lights
         {
             var data = _encoding.GetBytes(command);
             // 使用协议的 SendAndReceiveAsync 发送数据并等待响应(超时时间以协议或调用方为准)
-            var response = await _protocol.SendAndReceiveAsync(data, 1000);
+            var response = await _protocol.SendAndReceiveAsync(data, 1500);
             return _encoding.GetString(response);
         }
 
@@ -207,5 +207,73 @@ namespace TeamAAS_VP.Core.Lights
             // 成功时返回通道字母(例如 'A'),去除空白后比较
             return response?.Trim() == ((char)('A' + channelIndex)).ToString();
         }
+
+        /// <summary>
+        /// 打开指定的多个通道并设置亮度,未指定通道保持当前状态不变。
+        /// 命令格式:S{CH1:DDD}{动作}...C#
+        /// </summary>
+        /// <param name="channelBrightnessMap">通道索引与目标亮度的键值对,亮度为0时关闭通道。</param>
+        /// <returns>若设备返回确认字符 '!' 则认为操作成功。</returns>
+        public async Task<bool> TurnOnChannelsAsync(IDictionary<int, int> channelBrightnessMap)
+        {
+            StringBuilder commandBuilder = new StringBuilder();
+
+            for (int i = 0; i < ChannelCount; i++)
+            {
+                var channel = (KCSLightChannel)ChannelsInternal[i];
+                if (channelBrightnessMap.TryGetValue(i, out int brightness))
+                {
+                    //// 指定通道:使用传入的亮度
+                    //brightness = Math.Max(0, Math.Min(255, brightness));
+                    //commandBuilder.Append(brightness.ToString("D3"));
+                    //// 亮度 > 0 表示打开,亮度 = 0 表示关闭
+                    //commandBuilder.Append(brightness > 0 ? "T" : "F");
+                    commandBuilder.Append($"S{(char)('A' + i)}0{brightness.ToString("D3")}#");
+                }
+                else
+                {
+                    //// 未指定通道:保持当前亮度,无动作字符
+                    commandBuilder.Append($"S{(char)('A' + i)}0{brightness.ToString("D3")}#");
+                }
+                
+            }
+            var response = await SendCommandAsync(commandBuilder.ToString());
+            return response?.Trim().ToUpper() == "ABCDEFGH";
+        }
+
+        /// <summary>
+        /// 关闭指定的多个通道,未指定通道保持当前状态不变。
+        /// 命令格式:S{CH1:DDD}{动作}...C#
+        /// </summary>
+        /// <param name="channelIndices">要关闭的通道索引集合。</param>
+        /// <returns>若设备返回确认字符 '!' 则认为操作成功。</returns>
+        public async Task<bool> TurnOffChannelsAsync(IEnumerable<int> channelIndices)
+        {
+            var offIndices = new HashSet<int>(channelIndices);
+
+            StringBuilder commandBuilder = new StringBuilder("S");
+
+            for (int i = 0; i < ChannelCount; i++)
+            {
+                var channel = (KCSLightChannel)ChannelsInternal[i];
+
+                if (offIndices.Contains(i))
+                {
+                    // 关闭:亮度 000 + 'F'
+                    commandBuilder.Append("000");
+                    commandBuilder.Append("F");
+                }
+                else
+                {
+                    // 保持原状态:当前亮度,无动作字符
+                    commandBuilder.Append(channel.CurrentBrightness.ToString("D3"));
+                }
+            }
+
+            commandBuilder.Append("C#");
+
+            var response = await SendCommandAsync(commandBuilder.ToString());
+            return response?.Trim() == "!";
+        }
     }
 }

File diff suppressed because it is too large
+ 304 - 177
TeamAAS-VM/Core/Management.cs


+ 7 - 0
TeamAAS-VM/Interfaces/ILightManagerService.cs

@@ -71,6 +71,13 @@ namespace TeamAAS_VP.Interfaces
         /// <returns>操作成功返回 true,否则返回 false。</returns>
         Task<bool> SetGlobalChannelBrightnessAsync(int globalChannelId, int brightness);
 
+        /// <summary>
+        /// 设置多个通道的亮度值。
+        /// </summary>
+        /// <param name="channelBrightnessMap">全局通道ID与目标亮度的键值对。</param>
+        /// <returns>若所有通道均成功设置返回 true,任一失败返回 false。</returns>
+        Task<bool> SetGlobalChannelBrightnessAsync2(IDictionary<int, int> channelBrightnessMap);
+
         /// <summary>
         /// 打开指定的全局通道(将其置于开启状态)。
         /// </summary>

+ 1 - 1
TeamAAS-VM/Interfaces/IRemoteCommandService.cs

@@ -265,7 +265,7 @@ namespace TeamAAS_VP.Interfaces
         /// </summary>
         /// <param name="procedure"></param>
         /// <returns></returns>
-        Task<(bool IsSucceed, ICogImage[] Image, string Msg)> ExecuteGrabImageAsync(ProcedureModel procedure,bool Is3dPhoto);
+        Task<(bool IsSucceed, ICogImage[] Image, string Msg)> ExecuteGrabImageAsync(ProcedureModel procedure,bool Is3dPhoto,int index);
 
         /// <summary>
         /// 执行相机拍照获取单个点位结果

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

@@ -85,6 +85,12 @@ namespace TeamAAS_VP.Models
         /// </summary>
         public bool SaveCsv { get => _saveCsv; set => SetProperty(ref _saveCsv, value); }
 
+        private bool _saveCsvJmp;
+        /// <summary>
+        /// 是否保存键盘格JMP数据,默认不保存
+        /// </summary>
+        public bool SaveCsvJmp { get => _saveCsvJmp; set => SetProperty(ref _saveCsvJmp, value); }
+
         private bool _saveCsvPPID;
         /// <summary>
         /// 是否保存CSV文件的PPID,默认不保存

+ 76 - 0
TeamAAS-VM/Models/Product/ProcedureModel.cs

@@ -212,7 +212,45 @@ namespace TeamAAS_VP.Models
             get { return _Photo1Light3; }
             set { SetProperty(ref _Photo1Light3, value); }
         }
+        private int _Photo1Light4;
+        /// <summary>
+        /// 第一次拍照光源4亮度
+        /// </summary>
+        public int Photo1Light4
+        {
+            get { return _Photo1Light4; }
+            set { SetProperty(ref _Photo1Light4, value); }
+        }
+
+        private int _Photo1Light5;
+        /// <summary>
+        /// 第一次拍照光源5亮度
+        /// </summary>
+        public int Photo1Light5
+        {
+            get { return _Photo1Light5; }
+            set { SetProperty(ref _Photo1Light5, value); }
+        }
 
+        private int _Photo1Light6;
+        /// <summary>
+        /// 第一次拍照光源6亮度
+        /// </summary>
+        public int Photo1Light6
+        {
+            get { return _Photo1Light6; }
+            set { SetProperty(ref _Photo1Light6, value); }
+        }
+
+        private int _Photo1Light7;
+        /// <summary>
+        /// 第一次拍照光源7亮度
+        /// </summary>
+        public int Photo1Light7
+        {
+            get { return _Photo1Light7; }
+            set { SetProperty(ref _Photo1Light7, value); }
+        }
         private int _Photo2Light1;
         /// <summary>
         /// 第二次拍照光源1亮度
@@ -241,7 +279,45 @@ namespace TeamAAS_VP.Models
             get { return _Photo2Light3; }
             set { SetProperty(ref _Photo2Light3, value); }
         }
+        private int _Photo2Light4;
+        /// <summary>
+        /// 第二次拍照光源4亮度
+        /// </summary>
+        public int Photo2Light4
+        {
+            get { return _Photo2Light4; }
+            set { SetProperty(ref _Photo2Light4, value); }
+        }
+
+        private int _Photo2Light5;
+        /// <summary>
+        /// 第二次拍照光源5亮度
+        /// </summary>
+        public int Photo2Light5
+        {
+            get { return _Photo2Light5; }
+            set { SetProperty(ref _Photo2Light5, value); }
+        }
 
+        private int _Photo2Light6;
+        /// <summary>
+        /// 第二次拍照光源6亮度
+        /// </summary>
+        public int Photo2Light6
+        {
+            get { return _Photo2Light6; }
+            set { SetProperty(ref _Photo2Light6, value); }
+        }
+
+        private int _Photo2Light7;
+        /// <summary>
+        /// 第二次拍照光源7亮度
+        /// </summary>
+        public int Photo2Light7
+        {
+            get { return _Photo2Light7; }
+            set { SetProperty(ref _Photo2Light7, value); }
+        }
         private int _PhotoCount;
         /// <summary>
         /// 拍照次数

+ 9 - 0
TeamAAS-VM/Models/ProductWithMes.cs

@@ -37,6 +37,15 @@ namespace TeamAAS_VP.Models
             set { SetProperty(ref _ProductCode, value); }
         }
 
+        private string _ProductKBSN;
+        /// <summary>
+        /// 产品编码
+        /// </summary>
+        public string ProductKBSN
+        {
+            get { return _ProductKBSN; }
+            set { SetProperty(ref _ProductKBSN, value); }
+        }
 
         private string _ProductColor = "";
         /// <summary>

+ 33 - 0
TeamAAS-VM/Services/LightManagerService.cs

@@ -215,6 +215,39 @@ namespace TeamAAS_VP.Services
             return result;
         }
 
+        /// <summary>
+        /// 设置多个通道的亮度值。
+        /// </summary>
+        /// <param name="channelBrightnessMap">通道,亮度</param>
+        /// <returns>操作是否成功</returns>
+        public async Task<bool> SetGlobalChannelBrightnessAsync2(IDictionary<int, int> channelBrightnessMap)
+        {
+            var validChannelsMap = new Dictionary<int, int>();
+
+            foreach (var item in channelBrightnessMap)
+            {
+                if (_globalChannels.TryGetValue(item.Key, out var channel))
+                {
+                    validChannelsMap[item.Key] = item.Value;
+                }
+            }
+
+            if (validChannelsMap.Count == 0)
+                return false;
+
+            var firstChannel = _globalChannels[validChannelsMap.Keys.First()];
+            bool result = await firstChannel.SetChannelsAsync(validChannelsMap);
+
+            // 触发所有通道的状态变化事件
+            foreach (var key in validChannelsMap.Keys)
+            {
+                var channel = _globalChannels[key];
+                ChannelStatusChanged?.Invoke(this, new LightChannelEventArgs(channel, channel.IsOn, channel.Brightness));
+            }
+
+            return result;
+        }
+
         /// <summary>
         /// 打开指定的全局通道。
         /// </summary>

+ 2 - 2
TeamAAS-VM/Services/MesService.cs

@@ -101,11 +101,11 @@ namespace TeamAAS_VP.Services
             string url = "";
             if (device.F == "PTL")
             {
-                url = $"{device.MesUrl}?c=QUERY_RECORD&line={device.Line}&station={device.Station}&fixtureid={device.FixtureId}&sn={sn}&comp={device.comp}:{comp}&p=unit_process_check,message,model,sn,wo,model_num,color,ppid,stage";
+                url = $"{device.MesUrl}?c=QUERY_RECORD&line={device.Line}&station={device.Station}&fixtureid={device.FixtureId}&sn={sn}&comp={device.comp}:{comp}&p=unit_process_check,message,model,sn,wo,model_num,color,ppid,stage,KB";
             }
             else
             {
-                url = $"{device.MesUrl}?c=QUERY_RECORD&line={device.Line}&station={device.Station}&fixtureid={device.FixtureId}&sn={sn}&p=unit_process_check,message,model,sn,wo,model_num,color,ppid,stage";
+                url = $"{device.MesUrl}?c=QUERY_RECORD&line={device.Line}&station={device.Station}&fixtureid={device.FixtureId}&sn={sn}&p=unit_process_check,message,model,sn,wo,model_num,color,ppid,stage,KB";
             }
 
             LogHelper.WriteLogMes($"¡¾Ñ¯ÎÊURL¡¿{url}");

+ 308 - 70
TeamAAS-VM/Services/RemoteCommandService.cs

@@ -30,6 +30,7 @@ using Team.FFFeederService;
 using Team.FFFeederService.Interfaces;
 using TeamAAS_VP.Core;
 using TeamAAS_VP.Core.Cameras;
+using TeamAAS_VP.Core.Lights;
 using TeamAAS_VP.Data;
 using TeamAAS_VP.Enums;
 using TeamAAS_VP.Events;
@@ -2060,6 +2061,30 @@ namespace TeamAAS_VP.Services
                                     //RangeImage = (CogImage16Range)procedure.ToolBlock.Outputs["RangeImage"].Value,
                                     //GreyImage = (CogImage16Grey)procedure.ToolBlock.Outputs["GreyImage"].Value
                                 });
+                                if (procedure.ToolBlock.Inputs["InputImage2"].Value != null)
+                                {
+                                    _eventAggregator.GetEvent<RenderUpdateNotification>().Publish(new ShowRender()
+                                    {
+                                        Id = procedure.DisplayId,
+                                        DisplayName = procedure.DisplayName,
+                                        //Image = (ICogImage)procedure.ToolBlock.Outputs["OriImage"].Value,
+                                        Image = (ICogImage)procedure.ToolBlock.Inputs["InputImage2"].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,
+                                        ProceductName = procedure.Name,
+                                        ImageFileName = imgName+ "222222",
+                                        Is3DModel = is3dmodel,
+                                        //RangeImage = (CogImage16Range)procedure.ToolBlock.Outputs["RangeImage"].Value,
+                                        //GreyImage = (CogImage16Grey)procedure.ToolBlock.Outputs["GreyImage"].Value
+                                    });
+                                }
                             }
                             else
                             {
@@ -2084,6 +2109,30 @@ namespace TeamAAS_VP.Services
                                     RangeImage = (CogImage16Range)procedure.ToolBlock.Outputs["RangeImage"].Value,
                                     GreyImage = (CogImage16Grey)procedure.ToolBlock.Outputs["GreyImage"].Value
                                 });
+                                if (procedure.ToolBlock.Inputs["InputImage2"].Value != null)
+                                {
+                                    _eventAggregator.GetEvent<RenderUpdateNotification>().Publish(new ShowRender()
+                                    {
+                                        Id = procedure.DisplayId,
+                                        DisplayName = procedure.DisplayName,
+                                        //Image = (ICogImage)procedure.ToolBlock.Outputs["OriImage"].Value,
+                                        Image = (ICogImage)procedure.ToolBlock.Inputs["InputImage2"].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,
+                                        ProceductName = procedure.Name,
+                                        ImageFileName = imgName+ "222222",
+                                        Is3DModel = is3dmodel,
+                                        RangeImage = (CogImage16Range)procedure.ToolBlock.Outputs["RangeImage"].Value,
+                                        GreyImage = (CogImage16Grey)procedure.ToolBlock.Outputs["GreyImage"].Value
+                                    });
+                                }
                             }
                         }
                         else
@@ -2108,6 +2157,29 @@ namespace TeamAAS_VP.Services
                                 Is3DModel = is3dmodel
 
                             });
+                            if (procedure.ToolBlock.Inputs["InputImage2"].Value != null)
+                            {
+                                _eventAggregator.GetEvent<RenderUpdateNotification>().Publish(new ShowRender()
+                                {
+                                    Id = procedure.DisplayId,
+                                    DisplayName = procedure.DisplayName,
+                                    //Image = (ICogImage)procedure.ToolBlock.Outputs["OriImage"].Value,
+                                    Image = (ICogImage)procedure.ToolBlock.Inputs["InputImage2"].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,
+                                    ProceductName = procedure.Name,
+                                    ImageFileName = imgName+ "222222",
+                                    Is3DModel = is3dmodel
+
+                                });
+                            }
                         }
                         return true;
                     }
@@ -2155,6 +2227,28 @@ namespace TeamAAS_VP.Services
                                 RangeImage = (CogImage16Range)procedure.ToolBlock.Outputs["RangeImage"].Value,
                                 GreyImage = (CogImage16Grey)procedure.ToolBlock.Outputs["GreyImage"].Value
                             });
+                            if (procedure.ToolBlock.Inputs["InputImage2"].Value != null)
+                            {
+                                _eventAggregator.GetEvent<RenderUpdateNotification>().Publish(new ShowRender()
+                                {
+                                    Id = procedure.DisplayId,
+                                    DisplayName = procedure.DisplayName,
+                                    //Image = (ICogImage)procedure.ToolBlock.Outputs["OriImage"].Value,
+                                    Image = (ICogImage)procedure.ToolBlock.Inputs["InputImage2"].Value,
+                                    Graphic = new CogGraphicCollection(),
+                                    Result = false,
+                                    IsShow = true,
+                                    IsSaveImage = procedure.IsSaveImage,
+                                    SaveImageModel = procedure.SaveImageModel,
+                                    SaveImagePathModel = procedure.SaveImagePathModel,
+                                    SavePath = procedure.SavePath,
+                                    ProceductName = procedure.Name,
+                                    ImageFileName = imgName+ "222222",
+                                    Is3DModel = is3dmodel,
+                                    RangeImage = (CogImage16Range)procedure.ToolBlock.Outputs["RangeImage"].Value,
+                                    GreyImage = (CogImage16Grey)procedure.ToolBlock.Outputs["GreyImage"].Value
+                                });
+                            }
                         }
                         else
                         {
@@ -2175,6 +2269,26 @@ namespace TeamAAS_VP.Services
                                 ImageFileName = imgName,
                                 Is3DModel = is3dmodel
                             });
+                            if (procedure.ToolBlock.Inputs["InputImage2"].Value != null)
+                            {
+                                _eventAggregator.GetEvent<RenderUpdateNotification>().Publish(new ShowRender()
+                                {
+                                    Id = procedure.DisplayId,
+                                    DisplayName = procedure.DisplayName,
+                                    //Image = (ICogImage)procedure.ToolBlock.Outputs["OriImage"].Value,
+                                    Image = (ICogImage)procedure.ToolBlock.Inputs["InputImage2"].Value,
+                                    Graphic = new CogGraphicCollection(),
+                                    Result = false,
+                                    IsShow = true,
+                                    IsSaveImage = procedure.IsSaveImage,
+                                    SaveImageModel = procedure.SaveImageModel,
+                                    SaveImagePathModel = procedure.SaveImagePathModel,
+                                    SavePath = procedure.SavePath,
+                                    ProceductName = procedure.Name,
+                                    ImageFileName = imgName+"222222",
+                                    Is3DModel = is3dmodel
+                                });
+                            }
                         }
                         return false;
                     }
@@ -2195,7 +2309,7 @@ namespace TeamAAS_VP.Services
         /// </summary>
         /// <param name="procedure"></param>
         /// <returns></returns>
-        public async Task <(bool IsSucceed, ICogImage[] Image, string Msg)> ExecuteGrabImageAsync(ProcedureModel procedure,bool Is3dPhoto)
+        public async Task <(bool IsSucceed, ICogImage[] Image, string Msg)> ExecuteGrabImageAsync(ProcedureModel procedure,bool Is3dPhoto,int index)
         {
             try
             {
@@ -2211,21 +2325,103 @@ namespace TeamAAS_VP.Services
                     {
                         if (i == 1)
                         {
-                            //bool isSucceed = false;
-                            //isSucceed = await _lightManagerService.SetGlobalChannelBrightnessAsync(0, procedure.Photo1Light1);
-                            //if (!isSucceed)
-                            //{
-                            //    LogHelper.WriteLogInfo($"设置光源通道1亮度{procedure.Photo1Light1}失败!");
-                            //}
-                            //isSucceed = await _lightManagerService.SetGlobalChannelBrightnessAsync(1, procedure.Photo1Light2);
-                            //if (!isSucceed)
-                            //{
-                            //    LogHelper.WriteLogInfo($"设置光源通道2亮度{procedure.Photo1Light2}失败!");
-                            //}
-                            //isSucceed = await _lightManagerService.SetGlobalChannelBrightnessAsync(2, procedure.Photo1Light3);
-                            //if (!isSucceed)
+                            if (true)
+                            {
+                                bool isSucceed = false;
+                                SendTaskMessage("打开光源", MessageLevel.Debug);
+                                try
+                                {
+                                    isSucceed = await _lightManagerService.SetGlobalChannelBrightnessAsync2(new Dictionary<int, int> { { 0, 0 }, { 1, 0 }, { 2, 0 }, { 3, 0 }, { 4, 0 }, { 5, 0 }, { 6, 255 }, { 7, 255 } });//, { 6, 255 }, { 7, 255 }
+                                }
+                                catch (Exception)
+                                {
+                                    SendTaskMessage("光源控制失败!", MessageLevel.Error);
+                                }
+                                if (!isSucceed)
+                                {
+                                    LogHelper.WriteLogInfo($"设置光源通道亮度失败");
+                                }
+                                SendTaskMessage("打开光源完成", MessageLevel.Debug);
+                                //if (procedure.LightChannels != null)
+                                //{
+                                //    if (procedure.IsControlLightChannels)
+                                //    {
+                                //        bool isSucceed = false;
+                                //        //打开所有需要控制的光源通道
+                                //        foreach (var lightChannel in procedure.LightChannels)
+                                //        {
+
+                                //            if (lightChannel.GlobalIndex == 6)
+                                //            {
+                                //                isSucceed = await _lightManagerService.SetGlobalChannelBrightnessAsync(6, 255);
+                                //                if (!isSucceed)
+                                //                {
+                                //                    LogHelper.WriteLogInfo($"设置光源通道7亮度{procedure.Photo1Light7}失败!");
+                                //                }
+                                //            }
+                                //            else
+                                //            {
+                                //                isSucceed = await _lightManagerService.TurnOffGlobalChannelAsync(lightChannel.GlobalIndex);
+                                //                if (!isSucceed)
+                                //                {
+                                //                    SendTaskMessage($"设置光源通道{lightChannel.GlobalIndex}关闭失败!", MessageLevel.Debug);
+                                //                }
+                                //            }
+                                //        }
+                                //    }
+                                //}
+                            }
+                            //if (index == 3)
                             //{
-                            //    LogHelper.WriteLogInfo($"设置光源通道3亮度{procedure.Photo1Light3}失败!");
+                            //    bool isSucceed = false;
+                            //    SendTaskMessage("打开光源", MessageLevel.Debug);
+                            //    isSucceed = await _lightManagerService.SetGlobalChannelBrightnessAsync2(new Dictionary<int, int> { { 0, 150 }, { 1, 130 }, { 2, 150 }, { 3, 130 }, { 4, 150 }, { 5, 130 }, { 6, 0 } });
+                            //    if (!isSucceed)
+                            //    {
+                            //        LogHelper.WriteLogInfo($"设置光源通道亮度失败");
+                            //    }
+                            //    SendTaskMessage("打开光源完成", MessageLevel.Debug);
+                            //    //if (procedure.LightChannels != null)
+                            //    //{
+                            //    //    if (procedure.IsControlLightChannels)
+                            //    //    {
+                            //    //        bool isSucceed = false;
+                            //    //        isSucceed = await _lightManagerService.SetGlobalChannelBrightnessAsync(6, 0);
+                            //    //        if (!isSucceed)
+                            //    //        {
+                            //    //            LogHelper.WriteLogInfo($"设置光源通道7亮度{procedure.Photo1Light7}失败!");
+                            //    //        }
+                            //    //        //打开所有需要控制的光源通道
+                            //    //        foreach (var lightChannel in procedure.LightChannels)
+                            //    //        {
+
+                            //    //            if (lightChannel.GlobalIndex == 6)
+                            //    //            {
+
+                            //    //            }
+                            //    //            else
+                            //    //            {
+                            //    //                if (lightChannel.GlobalIndex == 0 || lightChannel.GlobalIndex == 2 || lightChannel.GlobalIndex == 4)
+                            //    //                {
+                            //    //                    isSucceed = await _lightManagerService.SetGlobalChannelBrightnessAsync(lightChannel.GlobalIndex, 150);
+                            //    //                    if (!isSucceed)
+                            //    //                    {
+                            //    //                        SendTaskMessage($"设置光源通道{lightChannel.GlobalIndex}打开失败!", MessageLevel.Debug);
+                            //    //                    }
+                            //    //                }
+                            //    //                if (lightChannel.GlobalIndex == 1 || lightChannel.GlobalIndex == 3 || lightChannel.GlobalIndex == 5)
+                            //    //                {
+                            //    //                    isSucceed = await _lightManagerService.SetGlobalChannelBrightnessAsync(lightChannel.GlobalIndex, 130);
+                            //    //                    if (!isSucceed)
+                            //    //                    {
+                            //    //                        SendTaskMessage($"设置光源通道{lightChannel.GlobalIndex}打开失败!", MessageLevel.Debug);
+                            //    //                    }
+                            //    //                }
+                            //    //            }
+                            //    //        }
+
+                            //    //    }
+                            //    //}
                             //}
                             bool succed = camera.SetExposureTime(procedure.ExposureTime);
                             if (!succed)
@@ -2238,41 +2434,100 @@ namespace TeamAAS_VP.Services
                                 SendTaskMessage($"相机增益设置失败!", MessageLevel.Error);
                             }
                             image = camera.Grab();
-                            //isSucceed = await _lightManagerService.TurnOffGlobalChannelAsync(0);
-                            //if (!isSucceed)
-                            //{
-                            //    LogHelper.WriteLogInfo($"设置光源通道0关闭失败!");
-                            //}
-                            //isSucceed = await _lightManagerService.TurnOffGlobalChannelAsync(1);
-                            //if (!isSucceed)
-                            //{
-                            //    LogHelper.WriteLogInfo($"设置光源通道1关闭失败!");
-                            //}
-                            //isSucceed = await _lightManagerService.TurnOffGlobalChannelAsync(2);
-                            //if (!isSucceed)
-                            //{
-                            //    LogHelper.WriteLogInfo($"设置光源通道2关闭失败!");
-                            //}
 
                         }
                         else if (i == 2)
                         {
-                            //bool isSucceed = false;
-                            //isSucceed = await _lightManagerService.SetGlobalChannelBrightnessAsync(0, procedure.Photo2Light1);
-                            //if (!isSucceed)
-                            //{
-                            //    LogHelper.WriteLogInfo($"设置光源通道1亮度{procedure.Photo2Light1}失败!");
-                            //}
-                            //isSucceed = await _lightManagerService.SetGlobalChannelBrightnessAsync(1, procedure.Photo2Light2);
-                            //if (!isSucceed)
-                            //{
-                            //    LogHelper.WriteLogInfo($"设置光源通道2亮度{procedure.Photo2Light2}失败!");
-                            //}
-                            //isSucceed = await _lightManagerService.SetGlobalChannelBrightnessAsync(2, procedure.Photo2Light3);
-                            //if (!isSucceed)
+
+                            bool isSucceed = false;
+                            SendTaskMessage("打开光源", MessageLevel.Debug);
+                            try
+                            {
+                                isSucceed = await _lightManagerService.SetGlobalChannelBrightnessAsync2(new Dictionary<int, int> { { 0, 255 }, { 1, 255 }, { 2, 255 }, { 3, 255 }, { 4, 255 }, { 5, 255 }, { 6, 0 }, { 7, 0 } });//
+                            }
+                            catch (Exception)
+                            {
+                                SendTaskMessage($"光源控制失败!", MessageLevel.Error);
+                            }
+                            if (!isSucceed)
+                            {
+                                LogHelper.WriteLogInfo($"设置光源通道亮度失败");
+                            }
+
+                            //if (index == 3)
                             //{
-                            //    LogHelper.WriteLogInfo($"设置光源通道3亮度{procedure.Photo2Light3}失败!");
+                            //    if (procedure.LightChannels != null)
+                            //    {
+                            //        if (procedure.IsControlLightChannels)
+                            //        {
+                            //            bool isSucceed = false;
+                            //            isSucceed = await _lightManagerService.TurnOffGlobalChannelAsync(7);
+                            //            if (!isSucceed)
+                            //            {
+                            //                SendTaskMessage($"设置光源通道7关闭失败!", MessageLevel.Debug);
+                            //            }
+                            //            //打开所有需要控制的光源通道
+                            //            foreach (var lightChannel in procedure.LightChannels)
+                            //            {
+
+                            //                if (lightChannel.GlobalIndex == 7)
+                            //                {
+
+                            //                }
+                            //                else
+                            //                {
+                            //                    isSucceed = await _lightManagerService.TurnOnGlobalChannelAsync(lightChannel.GlobalIndex);
+                            //                    if (!isSucceed)
+                            //                    {
+                            //                        SendTaskMessage($"设置光源通道{lightChannel.GlobalIndex}打开失败!", MessageLevel.Debug);
+                            //                    }
+                            //                }
+                            //            }
+
+                            //        }
+
+                            //    }
+                            //    //if (procedure.LightChannels != null)
+                            //    //{
+                            //    //    bool isSucceed = false;
+                            //    //    isSucceed = await _lightManagerService.SetGlobalChannelBrightnessAsync(0, procedure.Photo1Light1);
+                            //    //    if (!isSucceed)
+                            //    //    {
+                            //    //        LogHelper.WriteLogInfo($"设置光源通道1亮度{procedure.Photo1Light1}失败!");
+                            //    //    }
+                            //    //    isSucceed = await _lightManagerService.SetGlobalChannelBrightnessAsync(1, procedure.Photo1Light2);
+                            //    //    if (!isSucceed)
+                            //    //    {
+                            //    //        LogHelper.WriteLogInfo($"设置光源通道2亮度{procedure.Photo1Light2}失败!");
+                            //    //    }
+                            //    //    isSucceed = await _lightManagerService.SetGlobalChannelBrightnessAsync(2, procedure.Photo1Light3);
+                            //    //    if (!isSucceed)
+                            //    //    {
+                            //    //        LogHelper.WriteLogInfo($"设置光源通道3亮度{procedure.Photo1Light3}失败!");
+                            //    //    }
+                            //    //    isSucceed = await _lightManagerService.SetGlobalChannelBrightnessAsync(3, procedure.Photo1Light4);
+                            //    //    if (!isSucceed)
+                            //    //    {
+                            //    //        LogHelper.WriteLogInfo($"设置光源通道4亮度{procedure.Photo1Light4}失败!");
+                            //    //    }
+                            //    //    isSucceed = await _lightManagerService.SetGlobalChannelBrightnessAsync(4, procedure.Photo1Light5);
+                            //    //    if (!isSucceed)
+                            //    //    {
+                            //    //        LogHelper.WriteLogInfo($"设置光源通道5亮度{procedure.Photo1Light5}失败!");
+                            //    //    }
+                            //    //    isSucceed = await _lightManagerService.SetGlobalChannelBrightnessAsync(5, procedure.Photo1Light6);
+                            //    //    if (!isSucceed)
+                            //    //    {
+                            //    //        LogHelper.WriteLogInfo($"设置光源通道6亮度{procedure.Photo1Light6}失败!");
+                            //    //    }
+                            //    //    isSucceed = await _lightManagerService.SetGlobalChannelBrightnessAsync(6, 0);
+                            //    //    if (!isSucceed)
+                            //    //    {
+                            //    //        LogHelper.WriteLogInfo($"设置光源通道7亮度{procedure.Photo1Light7}失败!");
+                            //    //    }
+                            //    //}
                             //}
+
                             SendTaskMessage($"开始设置相机曝光!", MessageLevel.Info);
                             bool succed = camera.SetExposureTime(procedure.ExposureTime2);
                             if (!succed)
@@ -2286,22 +2541,6 @@ namespace TeamAAS_VP.Services
                                 SendTaskMessage($"相机增益设置失败!", MessageLevel.Error);
                             }
                             image2 = camera.Grab();
-                            
-                            //isSucceed = await _lightManagerService.TurnOffGlobalChannelAsync(0);
-                            //if (!isSucceed)
-                            //{
-                            //    LogHelper.WriteLogInfo($"设置光源通道0关闭失败!");
-                            //}
-                            //isSucceed = await _lightManagerService.TurnOffGlobalChannelAsync(1);
-                            //if (!isSucceed)
-                            //{
-                            //    LogHelper.WriteLogInfo($"设置光源通道1关闭失败!");
-                            //}
-                            //isSucceed = await _lightManagerService.TurnOffGlobalChannelAsync(2);
-                            //if (!isSucceed)
-                            //{
-                            //    LogHelper.WriteLogInfo($"设置光源通道2关闭失败!");
-                            //}
                         }
 
                     }
@@ -2445,7 +2684,7 @@ namespace TeamAAS_VP.Services
                     string[] PhotoRes = new string[100];
                     for (int k = 1; k <= Count; k++)
                     {
-
+                       
                         PhotoRes[k] = (string)(outputCollection[$"dis{k}"].Value);
                         //PhotoRes[k] = "222";
                     }
@@ -2480,14 +2719,14 @@ namespace TeamAAS_VP.Services
                 LogHelper.WriteLogError("执行相机取图并获取单点位时出错!", ex);
                 return (false, null, 0);
             }
-            finally
-            {
-                var sysConfig = _configService.GetSystemConfiguration();
-                if (sysConfig.TurnOffAllLightUse == false)
-                {
-                    await TurnOffLightAfterPhoto(procedure);
-                }
-            }
+            //finally
+            //{
+            //    var sysConfig = _configService.GetSystemConfiguration();
+            //    if (sysConfig.TurnOffAllLightUse == false)
+            //    {
+            //        await TurnOffLightAfterPhoto(procedure);
+            //    }
+            //}
         }
 
 
@@ -3372,7 +3611,6 @@ namespace TeamAAS_VP.Services
                 }
             }
         }
-
         /// <summary>
         /// 在拍照后关闭光源
         /// </summary>

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

@@ -63,7 +63,7 @@ namespace TeamAAS_VP.ViewModels
             set { SetProperty(ref _IsNoCode, value); }
         }
 
-        private bool _IsResultTrue = false;
+        private bool _IsResultTrue = true;
         /// <summary>
         /// 检测结果为1
         /// </summary>
@@ -404,6 +404,8 @@ namespace TeamAAS_VP.ViewModels
                     isCanExecute = true;
                 }
             }
+            //management.TestLight();
+
         }
 
         //初始化曲线图

+ 141 - 58
TeamAAS-VM/ViewModels/Product/AdvancedProcedureViewModel.cs

@@ -223,22 +223,64 @@ namespace TeamAAS_VP.ViewModels.Product
                     {
                         if(i==1)
                         {
-                            bool isSucceed = false;
-                            isSucceed =  await _lightManagerService.SetGlobalChannelBrightnessAsync(0, SelectProcedure.Photo1Light1);
-                            if (!isSucceed)
-                            {
-                                LogHelper.WriteLogInfo($"设置光源通道1亮度{SelectProcedure.Photo1Light1}失败!");
-                            }
-                            isSucceed =  await _lightManagerService.SetGlobalChannelBrightnessAsync(1, SelectProcedure.Photo1Light2);
-                            if (!isSucceed)
-                            {
-                                LogHelper.WriteLogInfo($"设置光源通道2亮度{SelectProcedure.Photo1Light2}失败!");
-                            }
-                            isSucceed =  await _lightManagerService.SetGlobalChannelBrightnessAsync(2, SelectProcedure.Photo1Light3);
-                            if (!isSucceed)
+
+                            if (SelectProcedure.LightChannels != null)
                             {
-                                LogHelper.WriteLogInfo($"设置光源通道3亮度{SelectProcedure.Photo1Light3}失败!");
+                                if (SelectProcedure.IsControlLightChannels)
+                                {
+                                    //打开所有需要控制的光源通道
+                                    foreach (var lightChannel in SelectProcedure.LightChannels)
+                                    {
+                                        bool isSucceed = false;
+                                        isSucceed = await _lightManagerService.TurnOnGlobalChannelAsync(lightChannel.GlobalIndex);
+                                        if (!isSucceed)
+                                        {
+                                            SendTaskMessage($"设置光源通道{lightChannel.GlobalIndex}打开失败!", MessageLevel.Debug);
+                                        }
+                                        isSucceed = await _lightManagerService.SetGlobalChannelBrightnessAsync(lightChannel.GlobalIndex, lightChannel.DefaultBrightness);
+                                        if (!isSucceed)
+                                        {
+                                            SendTaskMessage($"设置光源通道{lightChannel.GlobalIndex}亮度{lightChannel.DefaultBrightness}失败!", MessageLevel.Alarm);
+                                        }
+                                    }
+                                }
                             }
+                            //bool isSucceed = false;
+                            //isSucceed =  await _lightManagerService.SetGlobalChannelBrightnessAsync(0, SelectProcedure.Photo1Light1);
+                            //if (!isSucceed)
+                            //{
+                            //    LogHelper.WriteLogInfo($"设置光源通道1亮度{SelectProcedure.Photo1Light1}失败!");
+                            //}
+                            //isSucceed =  await _lightManagerService.SetGlobalChannelBrightnessAsync(1, SelectProcedure.Photo1Light2);
+                            //if (!isSucceed)
+                            //{
+                            //    LogHelper.WriteLogInfo($"设置光源通道2亮度{SelectProcedure.Photo1Light2}失败!");
+                            //}
+                            //isSucceed =  await _lightManagerService.SetGlobalChannelBrightnessAsync(2, SelectProcedure.Photo1Light3);
+                            //if (!isSucceed)
+                            //{
+                            //    LogHelper.WriteLogInfo($"设置光源通道3亮度{SelectProcedure.Photo1Light3}失败!");
+                            //}
+                            //isSucceed = await _lightManagerService.SetGlobalChannelBrightnessAsync(3, SelectProcedure.Photo1Light4);
+                            //if (!isSucceed)
+                            //{
+                            //    LogHelper.WriteLogInfo($"设置光源通道4亮度{SelectProcedure.Photo1Light4}失败!");
+                            //}
+                            //isSucceed = await _lightManagerService.SetGlobalChannelBrightnessAsync(4, SelectProcedure.Photo1Light5);
+                            //if (!isSucceed)
+                            //{
+                            //    LogHelper.WriteLogInfo($"设置光源通道5亮度{SelectProcedure.Photo1Light5}失败!");
+                            //}
+                            //isSucceed = await _lightManagerService.SetGlobalChannelBrightnessAsync(5, SelectProcedure.Photo1Light6);
+                            //if (!isSucceed)
+                            //{
+                            //    LogHelper.WriteLogInfo($"设置光源通道6亮度{SelectProcedure.Photo1Light6}失败!");
+                            //}
+                            //isSucceed = await _lightManagerService.SetGlobalChannelBrightnessAsync(6, SelectProcedure.Photo1Light7);
+                            //if (!isSucceed)
+                            //{
+                            //    LogHelper.WriteLogInfo($"设置光源通道7亮度{SelectProcedure.Photo1Light7}失败!");
+                            //}
                             bool succed = camera.SetExposureTime(SelectProcedure.ExposureTime);
                             if (!succed)
                             {
@@ -259,41 +301,82 @@ namespace TeamAAS_VP.ViewModels.Product
                                 Message = Lang.图像采集失败耗时.Replace("{0}", Camera.TotalTime.TotalMilliseconds.ToString("F2")).Replace("{1}", Camera.ErrorMessage);
                             }
                             
-                            isSucceed = await _lightManagerService.TurnOffGlobalChannelAsync(0);
-                            if (!isSucceed)
-                            {
-                                LogHelper.WriteLogInfo($"设置光源通道0关闭失败!");
-                            }
-                            isSucceed = await _lightManagerService.TurnOffGlobalChannelAsync(1);
-                            if (!isSucceed)
-                            {
-                                LogHelper.WriteLogInfo($"设置光源通道1关闭失败!");
-                            }
-                            isSucceed = await _lightManagerService.TurnOffGlobalChannelAsync(2);
-                            if (!isSucceed)
-                            {
-                                LogHelper.WriteLogInfo($"设置光源通道2关闭失败!");
-                            }
+                            //isSucceed = await _lightManagerService.TurnOffGlobalChannelAsync(0);
+                            //if (!isSucceed)
+                            //{
+                            //    LogHelper.WriteLogInfo($"设置光源通道0关闭失败!");
+                            //}
+                            //isSucceed = await _lightManagerService.TurnOffGlobalChannelAsync(1);
+                            //if (!isSucceed)
+                            //{
+                            //    LogHelper.WriteLogInfo($"设置光源通道1关闭失败!");
+                            //}
+                            //isSucceed = await _lightManagerService.TurnOffGlobalChannelAsync(2);
+                            //if (!isSucceed)
+                            //{
+                            //    LogHelper.WriteLogInfo($"设置光源通道2关闭失败!");
+                            //}
 
                         }
                         else if(i==2)
                         {
-                            bool isSucceed = false;
-                            isSucceed = await _lightManagerService.SetGlobalChannelBrightnessAsync(0, SelectProcedure.Photo2Light1);
-                            if (!isSucceed)
+                            if (SelectProcedure.LightChannels != null)
                             {
-                                LogHelper.WriteLogInfo($"设置光源通道1亮度{SelectProcedure.Photo2Light1}失败!");
-                            }
-                            isSucceed = await _lightManagerService.SetGlobalChannelBrightnessAsync(1, SelectProcedure.Photo2Light2  );
-                            if (!isSucceed)
-                            {
-                                LogHelper.WriteLogInfo($"设置光源通道2亮度{SelectProcedure.Photo2Light2}失败!");
-                            }
-                            isSucceed = await _lightManagerService.SetGlobalChannelBrightnessAsync(2, SelectProcedure.Photo2Light3);
-                            if (!isSucceed)
-                            {
-                                LogHelper.WriteLogInfo($"设置光源通道3亮度{SelectProcedure.Photo2Light3}失败!");
+                                if (SelectProcedure.IsControlLightChannels)
+                                {
+                                    //打开所有需要控制的光源通道
+                                    foreach (var lightChannel in SelectProcedure.LightChannels)
+                                    {
+                                        bool isSucceed = false;
+                                        //isSucceed = await _lightManagerService.TurnOnGlobalChannelAsync(lightChannel.GlobalIndex);
+                                        //if (!isSucceed)
+                                        //{
+                                        //    SendTaskMessage($"设置光源通道{lightChannel.GlobalIndex}打开失败!", MessageLevel.Debug);
+                                        //}
+                                        isSucceed = await _lightManagerService.SetGlobalChannelBrightnessAsync(lightChannel.GlobalIndex, lightChannel.DefaultBrightness);
+                                        if (!isSucceed)
+                                        {
+                                            SendTaskMessage($"设置光源通道{lightChannel.GlobalIndex}亮度{lightChannel.DefaultBrightness}失败!", MessageLevel.Alarm);
+                                        }
+                                    }
+                                }
                             }
+                            //bool isSucceed = false;
+                            //isSucceed = await _lightManagerService.SetGlobalChannelBrightnessAsync(0, SelectProcedure.Photo2Light1);
+                            //if (!isSucceed)
+                            //{
+                            //    LogHelper.WriteLogInfo($"设置光源通道1亮度{SelectProcedure.Photo2Light1}失败!");
+                            //}
+                            //isSucceed = await _lightManagerService.SetGlobalChannelBrightnessAsync(1, SelectProcedure.Photo2Light2  );
+                            //if (!isSucceed)
+                            //{
+                            //    LogHelper.WriteLogInfo($"设置光源通道2亮度{SelectProcedure.Photo2Light2}失败!");
+                            //}
+                            //isSucceed = await _lightManagerService.SetGlobalChannelBrightnessAsync(2, SelectProcedure.Photo2Light3);
+                            //if (!isSucceed)
+                            //{
+                            //    LogHelper.WriteLogInfo($"设置光源通道3亮度{SelectProcedure.Photo2Light3}失败!");
+                            //}
+                            //isSucceed = await _lightManagerService.SetGlobalChannelBrightnessAsync(11, SelectProcedure.Photo2Light4);
+                            //if (!isSucceed)
+                            //{
+                            //    LogHelper.WriteLogInfo($"设置光源通道4亮度{SelectProcedure.Photo2Light4}失败!");
+                            //}
+                            //isSucceed = await _lightManagerService.SetGlobalChannelBrightnessAsync(12, SelectProcedure.Photo2Light5);
+                            //if (!isSucceed)
+                            //{
+                            //    LogHelper.WriteLogInfo($"设置光源通道5亮度{SelectProcedure.Photo2Light5}失败!");
+                            //}
+                            //isSucceed = await _lightManagerService.SetGlobalChannelBrightnessAsync(13, SelectProcedure.Photo2Light6);
+                            //if (!isSucceed)
+                            //{
+                            //    LogHelper.WriteLogInfo($"设置光源通道6亮度{SelectProcedure.Photo2Light6}失败!");
+                            //}
+                            //isSucceed = await _lightManagerService.SetGlobalChannelBrightnessAsync(14, SelectProcedure.Photo2Light7);
+                            //if (!isSucceed)
+                            //{
+                            //    LogHelper.WriteLogInfo($"设置光源通道7亮度{SelectProcedure.Photo2Light7}失败!");
+                            //}
                             bool succed = camera.SetExposureTime(SelectProcedure.ExposureTime2);
                             if (!succed)
                             {
@@ -313,21 +396,21 @@ namespace TeamAAS_VP.ViewModels.Product
                             {
                                 Message = Lang.图像采集失败耗时.Replace("{0}", Camera.TotalTime.TotalMilliseconds.ToString("F2")).Replace("{1}", Camera.ErrorMessage);
                             }
-                            isSucceed = await _lightManagerService.TurnOffGlobalChannelAsync(0);
-                            if (!isSucceed)
-                            {
-                                LogHelper.WriteLogInfo($"设置光源通道0关闭失败!");
-                            }
-                            isSucceed = await _lightManagerService.TurnOffGlobalChannelAsync(1);
-                            if (!isSucceed)
-                            {
-                                LogHelper.WriteLogInfo($"设置光源通道1关闭失败!");
-                            }
-                            isSucceed = await _lightManagerService.TurnOffGlobalChannelAsync(2);
-                            if (!isSucceed)
-                            {
-                                LogHelper.WriteLogInfo($"设置光源通道2关闭失败!");
-                            }
+                            //isSucceed = await _lightManagerService.TurnOffGlobalChannelAsync(0);
+                            //if (!isSucceed)
+                            //{
+                            //    LogHelper.WriteLogInfo($"设置光源通道0关闭失败!");
+                            //}
+                            //isSucceed = await _lightManagerService.TurnOffGlobalChannelAsync(1);
+                            //if (!isSucceed)
+                            //{
+                            //    LogHelper.WriteLogInfo($"设置光源通道1关闭失败!");
+                            //}
+                            //isSucceed = await _lightManagerService.TurnOffGlobalChannelAsync(2);
+                            //if (!isSucceed)
+                            //{
+                            //    LogHelper.WriteLogInfo($"设置光源通道2关闭失败!");
+                            //}
                         }
                         
                     }

+ 128 - 0
TeamAAS-VM/ViewModels/Product/CameraParamsViewModel.cs

@@ -253,6 +253,66 @@ namespace TeamAAS_VP.ViewModels.Product
             }
         }
 
+        private int _Photo1Light4;
+        /// <summary>
+        /// 第一次拍照光源4亮度
+        /// </summary>
+        public int Photo1Light4
+        {
+            get { return _Photo1Light4; }
+            set
+            {
+                SetProperty(ref _Photo1Light4, value);
+                SelectProcedure.Photo1Light4 = value;
+
+            }
+        }
+
+        private int _Photo1Light5;
+        /// <summary>
+        /// 第一次拍照光源5亮度
+        /// </summary>
+        public int Photo1Light5
+        {
+            get { return _Photo1Light5; }
+            set
+            {
+                SetProperty(ref _Photo1Light5, value);
+                SelectProcedure.Photo1Light5 = value;
+
+            }
+        }
+
+        private int _Photo1Light6;
+        /// <summary>
+        /// 第一次拍照光源6亮度
+        /// </summary>
+        public int Photo1Light6
+        {
+            get { return _Photo1Light6; }
+            set
+            {
+                SetProperty(ref _Photo1Light6, value);
+                SelectProcedure.Photo1Light6 = value;
+
+            }
+        }
+
+        private int _Photo1Light7;
+        /// <summary>
+        /// 第一次拍照光源7亮度
+        /// </summary>
+        public int Photo1Light7
+        {
+            get { return _Photo1Light7; }
+            set
+            {
+                SetProperty(ref _Photo1Light7, value);
+                SelectProcedure.Photo1Light7 = value;
+
+            }
+        }
+
         private int _Photo2Light1;
         /// <summary>
         /// 第二次拍照光源1亮度
@@ -298,6 +358,66 @@ namespace TeamAAS_VP.ViewModels.Product
             }
         }
 
+        private int _Photo2Light4;
+        /// <summary>
+        /// 第二次拍照光源4亮度
+        /// </summary>
+        public int Photo2Light4
+        {
+            get { return _Photo2Light4; }
+            set
+            {
+                SetProperty(ref _Photo2Light4, value);
+                SelectProcedure.Photo2Light4 = value;
+
+            }
+        }
+
+        private int _Photo2Light5;
+        /// <summary>
+        /// 第二次拍照光源5亮度
+        /// </summary>
+        public int Photo2Light5
+        {
+            get { return _Photo2Light5; }
+            set
+            {
+                SetProperty(ref _Photo2Light5, value);
+                SelectProcedure.Photo2Light5 = value;
+
+            }
+        }
+
+        private int _Photo2Light6;
+        /// <summary>
+        /// 第二次拍照光源6亮度
+        /// </summary>
+        public int Photo2Light6
+        {
+            get { return _Photo2Light6; }
+            set
+            {
+                SetProperty(ref _Photo2Light6, value);
+                SelectProcedure.Photo2Light6 = value;
+
+            }
+        }
+
+        private int _Photo2Light7;
+        /// <summary>
+        /// 第二次拍照光源7亮度
+        /// </summary>
+        public int Photo2Light7
+        {
+            get { return _Photo2Light7; }
+            set
+            {
+                SetProperty(ref _Photo2Light7, value);
+                SelectProcedure.Photo2Light7 = value;
+
+            }
+        }
+
         private int _PhotoCount;
         /// <summary>
         /// 拍照次数
@@ -720,9 +840,17 @@ namespace TeamAAS_VP.ViewModels.Product
                 Photo1Light1 = SelectProcedure.Photo1Light1;
                 Photo1Light2 = SelectProcedure.Photo1Light2;
                 Photo1Light3 = SelectProcedure.Photo1Light3;
+                Photo1Light4 = SelectProcedure.Photo1Light4;
+                Photo1Light5 = SelectProcedure.Photo1Light5;
+                Photo1Light6 = SelectProcedure.Photo1Light6;
+                Photo1Light7 = SelectProcedure.Photo1Light7;
                 Photo2Light1 = SelectProcedure.Photo2Light1;
                 Photo2Light2 = SelectProcedure.Photo2Light2;
                 Photo2Light3 = SelectProcedure.Photo2Light3;
+                Photo2Light4 = SelectProcedure.Photo2Light4;
+                Photo2Light5 = SelectProcedure.Photo2Light5;
+                Photo2Light6 = SelectProcedure.Photo2Light6;
+                Photo2Light7 = SelectProcedure.Photo2Light7;
                 PhotoCount = SelectProcedure.PhotoCount;
                 if (Camera != null && !_remoteCommandService.IsExecuting)
                 {

+ 3 - 1
TeamAAS-VM/ViewModels/Product/VisionDynamicAccuracyAnalyzerViewModel.cs

@@ -1221,7 +1221,9 @@ namespace TeamAAS_VP.ViewModels.Product
                         {
                             string[] Point1 = ((string)(outputCollection["Point"].Value)).Split(',');
                             var calibration = _calibrationService.GetCalibration(SelectProcedure.CalibrationId);
-                            (bool IsSucceed, double X, double Y, double U) = _calibrationService.ConvertPixelToPosition((double.Parse(Point1[0]), double.Parse(Point1[1]), double.Parse(Point1[2])), null, calibration);
+                            var pos= Robot.GetRobotPos();
+                            double[] robotpos = new double[] { pos.X, pos.Y, pos.Z };
+                            (bool IsSucceed, double X, double Y, double U) = _calibrationService.ConvertPixelToPosition((double.Parse(Point1[0]), double.Parse(Point1[1]), double.Parse(Point1[2])), robotpos, calibration);
                             if (!IsSucceed)
                             {
                                 SendTaskMessage("坐标转换失败!");

+ 4 - 1
TeamAAS-VM/ViewModels/Product/VisionStaticAccuracyAnalyzerViewModel.cs

@@ -929,7 +929,10 @@ namespace TeamAAS_VP.ViewModels.Product
                                             if (needConvertToAbsolute)
                                             {
                                                 var calibration = _calibrationService.GetCalibration(SelectProcedure.CalibrationId);
-                                                (bool IsSucceed, double X, double Y, double U) = _calibrationService.ConvertPixelToPosition((double.Parse(subitems[0]), double.Parse(subitems[1]), double.Parse(subitems[2])), null, calibration);
+                                                var robot= _robotService.GetAllRobots().FirstOrDefault();
+                                                var pos= robot.GetRobotPos();
+                                                double[] robotpos = new double[] { pos.X,pos.Y,pos.Z };
+                                                (bool IsSucceed, double X, double Y, double U) = _calibrationService.ConvertPixelToPosition((double.Parse(subitems[0]), double.Parse(subitems[1]), double.Parse(subitems[2])), robotpos, calibration);
                                                 result.Add(Math.Round(X, 5));
                                                 result.Add(Math.Round(Y, 5));
                                             }

+ 3 - 0
TeamAAS-VM/ViewModels/SettingViewModel.cs

@@ -1804,12 +1804,14 @@ namespace TeamAAS_VP.ViewModels
             {
                 ProMesInfo.ProductCode = "";
                 ProMesInfo.ProductColor = "";
+                ProMesInfo.ProductKBSN = "";
                 ProMesInfo.ProductLoadMode = 0;
             }
             else
             {
                 ProMesInfo.ProductCode = v.ProductCode;
                 ProMesInfo.ProductColor = v.ProductColor;
+                ProMesInfo.ProductKBSN = v.ProductKBSN;
                 ProMesInfo.ProductLoadMode = v.ProductLoadMode;
             }
         }
@@ -1825,6 +1827,7 @@ namespace TeamAAS_VP.ViewModels
                 {
                     ProMesInfo.ProductCode = "";
                     ProMesInfo.ProductColor = "";
+                    ProMesInfo.ProductKBSN = "";
                     ProMesInfo.ProductLoadMode = 0;
                 }
             }

+ 2 - 2
TeamAAS-VM/Views/Home/ShowVisionRender.xaml.cs

@@ -750,7 +750,7 @@ namespace TeamAAS_VP.Views.Home
 
                         if (isCompress)
                         {
-                            ImageHelper.CompressImage(reimage, Recordedpath, 100);
+                            ImageHelper.CompressImage(reimage, Recordedpath, 20);
                         }
                         else
                         {
@@ -857,7 +857,7 @@ namespace TeamAAS_VP.Views.Home
 
                         if (isCompress)
                         {
-                            ImageHelper.CompressImage(reimage, Recordedpath, 100);
+                            ImageHelper.CompressImage(reimage, Recordedpath, 20);
                         }
                         else
                         {

+ 0 - 57
TeamAAS-VM/Views/HomeView.xaml

@@ -173,63 +173,6 @@
                                 Orientation="Vertical"
                                 HorizontalAlignment="Center"
                                 Visibility="{Binding DataContext.IsShowLabel,ElementName=zzz, Converter={StaticResource BooleanToVisibilityConverter}}">
-                        <StackPanel Orientation="Vertical">
-                            <TextBlock Text="MES:"
-                                       FontWeight="Black"
-                                       FontSize="30" />
-                            <TextBlock FontSize="80"
-                                       FontWeight="Black">
-                                <TextBlock.Style>
-                                    <Style TargetType="TextBlock">
-                                        <Style.Triggers>
-                                            <DataTrigger Binding="{Binding management.ShowMes_Query}"
-                                                         Value="True">
-                                                <Setter Property="Text"
-                                                        Value="OK" />
-                                                <Setter Property="Background"
-                                                        Value="Green" />
-                                            </DataTrigger>
-                                            <DataTrigger Binding="{Binding management.ShowMes_Query}"
-                                                         Value="False">
-                                                <Setter Property="Text"
-                                                        Value="NG" />
-                                                <Setter Property="Background"
-                                                        Value="Red" />
-                                            </DataTrigger>
-                                        </Style.Triggers>
-                                    </Style>
-                                </TextBlock.Style>
-                            </TextBlock>
-                        </StackPanel>
-                        <StackPanel Orientation="Vertical"
-                                    Margin="0,40">
-                            <TextBlock Text="结果:"
-                                       FontWeight="Black"
-                                       FontSize="30" />
-                            <TextBlock FontSize="80"
-                                       FontWeight="Black">
-                                <TextBlock.Style>
-                                    <Style TargetType="TextBlock">
-                                        <Style.Triggers>
-                                            <DataTrigger Binding="{Binding management.ShowMes_Result}"
-                                                         Value="True">
-                                                <Setter Property="Text"
-                                                        Value="OK" />
-                                                <Setter Property="Background"
-                                                        Value="Green" />
-                                            </DataTrigger>
-                                            <DataTrigger Binding="{Binding management.ShowMes_Result}"
-                                                         Value="False">
-                                                <Setter Property="Text"
-                                                        Value="NG" />
-                                                <Setter Property="Background"
-                                                        Value="Red" />
-                                            </DataTrigger>
-                                        </Style.Triggers>
-                                    </Style>
-                                </TextBlock.Style>
-                            </TextBlock>
-                        </StackPanel>
                     </StackPanel>
                 </Grid>
 

+ 136 - 108
TeamAAS-VM/Views/Product/CameraParams.xaml

@@ -118,59 +118,81 @@
                         <ColumnDefinition Width="*" />
                         <ColumnDefinition Width="auto" />
                     </Grid.ColumnDefinitions>
+                    
                     <Grid Grid.Column="1">
+                        
                         <Grid.RowDefinitions>
-                            <RowDefinition Height="auto" />
-                            <RowDefinition Height="auto" />
-                            <RowDefinition Height="auto" />
-                            <RowDefinition Height="auto" />
-                            <RowDefinition Height="auto" />
-                            <RowDefinition Height="auto" />
-                            <RowDefinition Height="auto" />
-                            <RowDefinition Height="auto" />
-                            <RowDefinition Height="auto" />
-                            <RowDefinition Height="auto" />
-                            <RowDefinition Height="auto" />
-                            <RowDefinition Height="auto" />
-                            <RowDefinition Height="auto" />
-                            <RowDefinition Height="auto" />
-                            <RowDefinition Height="auto" />
+                            <RowDefinition Height="35" />
+                            <RowDefinition Height="35" />
+                            <RowDefinition Height="35" />
+                            <RowDefinition Height="35" />
+                            <RowDefinition Height="35" />
+                            <RowDefinition Height="35" />
+                            <RowDefinition Height="35" />
+                            <RowDefinition Height="35" />
+                            <RowDefinition Height="35" />
+                            <RowDefinition Height="35" />
+                            <RowDefinition Height="35" />
+                            <RowDefinition Height="35" />
+                            <RowDefinition Height="35" />
+                            <RowDefinition Height="35" />
+                            <RowDefinition Height="350" />
                         </Grid.RowDefinitions>
+
+                       
                         <Grid.ColumnDefinitions>
                             <ColumnDefinition Width="auto" />
                             <ColumnDefinition Width="*" />
                         </Grid.ColumnDefinitions>
-                        <ToggleButton Grid.Column="1"
-                                      HorizontalAlignment="Right"
-                                      VerticalAlignment="Top"
-                                      Visibility="{Binding IsHaveRobot,Converter={StaticResource BooleanToVisibilityConverter}}"
-                                      materialDesign:ToggleButtonAssist.OnContent="{materialDesign:PackIcon Kind=ArrowRight}"
-                                      Content="{materialDesign:PackIcon Kind=RobotIndustrial}"
-                                      Style="{StaticResource MaterialDesignActionToggleButton}"
-                                      ToolTip="{lex:Loc 机器人步进}"
-                                      Margin="5,0"
-                                      IsChecked="{Binding IsRightDrawerOpen,ElementName=DrawerHost}" />
-                        <TextBlock Text="{lex:Loc 相机参数设置}"
-                                   Grid.Row="1"
-                                   FontWeight="Bold"
-                                   Margin="10"
-                                   Grid.ColumnSpan="2" />
-                        <TextBlock Grid.Row="2"
-                                   
-           Grid.Column="0"
-           Margin="5"
-           VerticalAlignment="Center"
-           Visibility="{Binding IsPhotosUse,Converter={StaticResource BooleanToVisibilityConverter}}"
-           Text="{lex:Loc 拍照次数,Converter={StaticResource StringFormatConverter},ConverterParameter='{}{0}: '}" />
-                        <mah:NumericUpDown Grid.Row="2"
-                   Grid.Column="1"
-                   Margin="5"
-                   Minimum="0"
-                   Maximum="999985"
-                   Interval="1"
-                   StringFormat="{}{0:N0} "
-                   Visibility="{Binding IsPhotosUse,Converter={StaticResource BooleanToVisibilityConverter}}"
-                   Value="{Binding PhotoCount,Mode=TwoWay}" />
+                        
+                      
+                            
+                          
+                                <ToggleButton Grid.Column="1"
+              HorizontalAlignment="Right"
+              VerticalAlignment="Top"
+              Visibility="{Binding IsHaveRobot,Converter={StaticResource BooleanToVisibilityConverter}}"
+              materialDesign:ToggleButtonAssist.OnContent="{materialDesign:PackIcon Kind=ArrowRight}"
+              Content="{materialDesign:PackIcon Kind=RobotIndustrial}"
+              Style="{StaticResource MaterialDesignActionToggleButton}"
+              ToolTip="{lex:Loc 机器人步进}"
+              Margin="5,0"
+              IsChecked="{Binding IsRightDrawerOpen,ElementName=DrawerHost}" />
+                                
+                                <TextBlock Text="{lex:Loc 相机参数设置}"
+           Grid.Row="1"
+           FontWeight="Bold"
+           Margin="10"
+           Grid.ColumnSpan="2" />
+
+                               
+                                    <TextBlock Grid.Row="2"
+                        
+Grid.Column="0"
+Margin="5"
+VerticalAlignment="Center"
+Visibility="{Binding IsPhotosUse,Converter={StaticResource BooleanToVisibilityConverter}}"
+Text="{lex:Loc 拍照次数,Converter={StaticResource StringFormatConverter},ConverterParameter='{}{0}: '}" />
+                                    <mah:NumericUpDown Grid.Row="2"
+        Grid.Column="1"
+        Margin="5"
+        Minimum="0"
+        Maximum="999985"
+        Interval="1"
+        StringFormat="{}{0:N0} "
+        Visibility="{Binding IsPhotosUse,Converter={StaticResource BooleanToVisibilityConverter}}"
+        Value="{Binding PhotoCount,Mode=TwoWay}" />
+                             
+
+
+                           
+
+                            
+                        
+                        
+                        
+                        
+ 
                         <TextBlock Grid.Row="3"
                                    Grid.Column="0"
                                    Margin="5"
@@ -317,71 +339,77 @@ Text="{lex:Loc 第二次拍照光源3,Converter={StaticResource StringFormatConv
         StringFormat="{}{0:N2} "
         Visibility="{Binding IsPhotosUse,Converter={StaticResource BooleanToVisibilityConverter}}"
         Value="{Binding Photo2Light3,Mode=TwoWay}" />
-                        <!-- 光源通道列表与调节 -->
-                        <StackPanel Orientation="Vertical"
-                                    Grid.Row="15"
-                                    Grid.ColumnSpan="2"
-                                    Margin="5" >
-                            <TextBlock Text="{lex:Loc 光源通道列表}"
-                                       FontWeight="Bold" />
-                            <ItemsControl ItemsSource="{Binding SelectProcedure.LightChannels}">
-                                <ItemsControl.ItemTemplate>
-                                    <DataTemplate>
-                                        <Grid>
-                                            <Grid.RowDefinitions>
-                                                <RowDefinition Height="auto" />
-                                                <RowDefinition Height="auto" />
-                                                <RowDefinition Height="auto" />
-                                            </Grid.RowDefinitions>
-                                            <TextBlock Width="120"
-                                                       Grid.Row="0"
-                                                       HorizontalAlignment="Left"
-                                                       VerticalAlignment="Center">
-                                                <TextBlock.Text>
-                                                    <MultiBinding StringFormat="{}{0} . {1}">
-                                                        <Binding Path="GlobalIndex" />
-                                                        <Binding Path="Name" />
-                                                    </MultiBinding>
-                                                </TextBlock.Text>
-                                            </TextBlock>
-                                            <StackPanel Grid.Row="1"
-                                                        Orientation="Horizontal"
-                                                        Margin="0,4">
 
-                                                <Slider Minimum="0"
-                                                        Maximum="255"
-                                                        Width="200"
-                                                        Value="{Binding DefaultBrightness,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
-                                                    <b:Interaction.Behaviors>
-                                                        <localbehaviors:SliderUserInteractionBehavior UserInteractionCommand="{Binding DataContext.SetChannelBrightnessCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"
-                                                                                                      CommandParameter="{Binding}" />
-                                                    </b:Interaction.Behaviors>
-                                                </Slider>
-                                                <TextBlock Text="{Binding DefaultBrightness}"
-                                                           Width="40"
-                                                           VerticalAlignment="Center"
-                                                           Margin="6,0" />
-                                            </StackPanel>
-                                            <StackPanel Grid.Row="2"
-                                                        Orientation="Horizontal"
-                                                        HorizontalAlignment="Right"
-                                                        Margin="0,4">
-                                                <Button Content="打开"
-                                                        Command="{Binding DataContext.TurnOnCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"
-                                                        CommandParameter="{Binding}"
-                                                        Margin="0,0,8,0" />
-                                                <Button Content="关闭"
-                                                        Command="{Binding DataContext.TurnOffCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"
-                                                        CommandParameter="{Binding}"
-                                                        Margin="0,0,8,0" />
-                                            </StackPanel>
-                                        </Grid>
 
-                                    </DataTemplate>
-                                </ItemsControl.ItemTemplate>
-                            </ItemsControl>
-                        </StackPanel>
+                        <ScrollViewer Grid.Row="15" Grid.ColumnSpan="2"  VerticalScrollBarVisibility="Visible">
+                            <!-- 光源通道列表与调节 -->
+                            <StackPanel Orientation="Vertical"  Margin="5" >
+
+                                <TextBlock Text="{lex:Loc 光源通道列表}"
+               FontWeight="Bold" />
+                                <ItemsControl ItemsSource="{Binding SelectProcedure.LightChannels}">
+                                    <ItemsControl.ItemTemplate>
+                                        <DataTemplate>
+                                            <Grid>
+                                                <Grid.RowDefinitions>
+                                                    <RowDefinition Height="auto" />
+                                                    <RowDefinition Height="auto" />
+                                                    <RowDefinition Height="auto" />
+                                                </Grid.RowDefinitions>
+                                                <TextBlock Width="120"
+                               Grid.Row="0"
+                               HorizontalAlignment="Left"
+                               VerticalAlignment="Center">
+                                                    <TextBlock.Text>
+                                                        <MultiBinding StringFormat="{}{0} . {1}">
+                                                            <Binding Path="GlobalIndex" />
+                                                            <Binding Path="Name" />
+                                                        </MultiBinding>
+                                                    </TextBlock.Text>
+                                                </TextBlock>
+                                                <StackPanel Grid.Row="1"
+                                Orientation="Horizontal"
+                                Margin="0,4">
+
+                                                    <Slider Minimum="0"
+                                Maximum="255"
+                                Width="200"
+                                Value="{Binding DefaultBrightness,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
+                                                        <b:Interaction.Behaviors>
+                                                            <localbehaviors:SliderUserInteractionBehavior UserInteractionCommand="{Binding DataContext.SetChannelBrightnessCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"
+                                                                              CommandParameter="{Binding}" />
+                                                        </b:Interaction.Behaviors>
+                                                    </Slider>
+                                                    <TextBlock Text="{Binding DefaultBrightness}"
+                                   Width="40"
+                                   VerticalAlignment="Center"
+                                   Margin="6,0" />
+                                                </StackPanel>
+                                                <StackPanel Grid.Row="2"
+                                Orientation="Horizontal"
+                                HorizontalAlignment="Right"
+                                Margin="0,4">
+                                                    <Button Content="打开"
+                                Command="{Binding DataContext.TurnOnCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"
+                                CommandParameter="{Binding}"
+                                Margin="0,0,8,0" />
+                                                    <Button Content="关闭"
+                                Command="{Binding DataContext.TurnOffCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"
+                                CommandParameter="{Binding}"
+                                Margin="0,0,8,0" />
+                                                </StackPanel>
+                                            </Grid>
+
+                                        </DataTemplate>
+                                    </ItemsControl.ItemTemplate>
+                                </ItemsControl>
+                            </StackPanel>
+                        </ScrollViewer>
+                        
+
                     </Grid>
+                    
+                    
                     <wf:WindowsFormsHost Grid.Column="0"
                                          Margin="0,40">
                         <vp:CogRecordDisplay x:Name="display" />

+ 33 - 2
TeamAAS-VM/Views/SettingView.xaml

@@ -762,11 +762,20 @@
                               IsChecked="{Binding SelectDeviceInfo.EnableMES, Mode=TwoWay}"
                               Command="{Binding CheckStatusCommand}"
                               Margin="6,2" />
+                                <StackPanel Grid.Row="12"
+                             Grid.Column="1"
+                             Orientation="Horizontal">
                                 <CheckBox Grid.Row="12"
                               Grid.Column="1"
                               Content="是否启用两次产品编号"
                               IsChecked="{Binding SelectDeviceInfo.EnableDoubleMes, Mode=TwoWay}"
                               Margin="6,2" />
+                                <CheckBox Grid.Row="12"
+                                        Grid.Column="1"
+                                          Content="是否保存键盘格JMP数据"
+                                          IsChecked="{Binding SelectDeviceInfo.SaveCsvJmp, Mode=TwoWay}"
+                                          Margin="6,2" />
+                                </StackPanel>
                                 <StackPanel Grid.Row="13"
                                 Grid.Column="1"
                                 Orientation="Horizontal">
@@ -2668,7 +2677,7 @@
                                   VerticalAlignment="Center"
                                   HorizontalAlignment="Right"
                                   FontSize="{DynamicResource Font.Size.Body3}"
-                                  Margin="0,0,6,0">保存拍照數據CSV</CheckBox>
+                                  Margin="0,0,6,0">保存锁付曲线图</CheckBox>
                         <!-- 保存拍照數據CSV -->
                         <StackPanel Grid.Row="9"
                                     Grid.Column="1"
@@ -2903,6 +2912,7 @@
                                 <RowDefinition Height=" auto" />
                                 <RowDefinition Height=" auto" />
                                 <RowDefinition Height=" auto" />
+                                <RowDefinition Height=" auto" />
                             </Grid.RowDefinitions>
 
                             <TextBlock Margin="0,0,0,8"
@@ -2982,7 +2992,7 @@
                             <TextBlock Margin="0,0,0,8"
                            Grid.Row="3"
                            VerticalAlignment="Center"
-                           Text="产品类型:"
+                           Text="产品KB:"
                            FontSize="{DynamicResource Font.Size.Body3}"
                            HorizontalAlignment="Right" />
                             <TextBox Grid.Row="3"
@@ -2992,6 +3002,27 @@
                          FontSize="{DynamicResource Font.Size.Body3}"
                          TextAlignment="Center"
                          HorizontalAlignment="Left"
+                         VerticalAlignment="Center">
+                                <TextBox.Text>
+                                    <Binding Path="ProMesInfo.ProductKBSN"
+                                 Mode="TwoWay">
+                                    </Binding>
+                                </TextBox.Text>
+                            </TextBox>
+
+                            <TextBlock Margin="0,0,0,8"
+                           Grid.Row="4"
+                           VerticalAlignment="Center"
+                           Text="产品类型:"
+                           FontSize="{DynamicResource Font.Size.Body3}"
+                           HorizontalAlignment="Right" />
+                            <TextBox Grid.Row="4"
+                         Grid.Column="1"
+                         Margin="10,4"
+                         MinWidth="100"
+                         FontSize="{DynamicResource Font.Size.Body3}"
+                         TextAlignment="Center"
+                         HorizontalAlignment="Left"
                          VerticalAlignment="Center">
                                 <TextBox.Text>
                                     <Binding Path="ProMesInfo.ProductLoadMode"

Some files were not shown because too many files changed in this diff