刘锦天 5 月之前
父節點
當前提交
f252de28c5

+ 16 - 14
TeamAAS-VM/Core/Cameras/OptCamera.cs

@@ -350,7 +350,8 @@ namespace TeamAAS_VP.Core.Cameras
                 // ch:打开设备 | en:Open device
                 nReVal = mvCameraAcq.OpenDevice();
                 // ch:设置触发模式为off | en:Set trigger mode as off
-                nReVal = mvCameraAcq.SetEnumValueByStringEx(SciCam.SciCamDeviceXmlType.SciCam_DeviceXml_Camera, "TriggerMode", "Off");
+                nReVal = mvCameraAcq.SetEnumValueByStringEx(SciCam.SciCamDeviceXmlType.SciCam_DeviceXml_Camera, "TriggerMode", "On");
+                nReVal = mvCameraAcq.SetEnumValueByStringEx(SciCam.SciCamDeviceXmlType.SciCam_DeviceXml_Camera, "TriggerSource", "Software");
                 if (!IsConnected)
                 {
                     CameraConnectChangedEvent?.Invoke(ID, true);
@@ -419,12 +420,13 @@ namespace TeamAAS_VP.Core.Cameras
                 {
                     try
                     {
-                        if (!mvCameraAcq.IsDeviceOpen())
-                        {
-                            OpenDevice();
-                        }
+                        //if (!mvCameraAcq.IsDeviceOpen())
+                        //{
+                        //    OpenDevice();
+                        //}
                         //nReVal = mvCameraAcq.StartGrabbing();
                         mvCameraAcq.ClearPayloadBuffer();
+                        nReVal = mvCameraAcq.SetCommandValueEx(SciCam.SciCamDeviceXmlType.SciCam_DeviceXml_Camera, "TriggerSoftware");
                         nReVal = mvCameraAcq.Grab(ref payload);
                         if (nReVal == SciCam.SCI_CAMERA_OK)
                         {
@@ -434,15 +436,15 @@ namespace TeamAAS_VP.Core.Cameras
                             TotalTime = sw.Elapsed;
                             return Image;
                         }
-                        else
-                        {
-                            nReVal = mvCameraAcq.FreePayload(payload);
-                            //nReVal = mvCameraAcq.StopGrabbing();
-                            //_operationSemaphore.Release();
-                            CloseDevice();
-                            OpenDevice();
-                            ErrorMessage = "图像采集失败!";
-                        }
+                        //else
+                        //{
+                        //    nReVal = mvCameraAcq.FreePayload(payload);
+                        //    //nReVal = mvCameraAcq.StopGrabbing();
+                        //    //_operationSemaphore.Release();
+                        //    CloseDevice();
+                        //    OpenDevice();
+                        //    ErrorMessage = "图像采集失败!";
+                        //}
                     }
                     catch (Exception ex)
                     {

+ 550 - 99
TeamAAS-VM/Core/Management.cs

@@ -1,5 +1,6 @@
 using Cognex.VisionPro;
 using CSScripting;
+//using ICSharpCode.SharpZipLib.Zip;
 using Prism.Events;
 using Prism.Ioc;
 using Prism.Mvvm;
@@ -9,6 +10,7 @@ using System.Collections.Generic;
 using System.Collections.ObjectModel;
 using System.Drawing;
 using System.IO;
+using System.IO.Compression;
 using System.Linq;
 using System.Text;
 using System.Threading;
@@ -55,7 +57,14 @@ namespace TeamAAS_VP.Core
         /// 产品主sn
         /// </summary>
         string ProductMainSN = "";
+        /// <summary>
+        /// 工单信息
+        /// </summary>
         string wo = "";
+        string model_num = "";//产品model_num
+        string color = "";//产品color
+        string ppid = "";//产品ppid
+        string revision = "";//产品revision
 
         #endregion
 
@@ -203,6 +212,13 @@ namespace TeamAAS_VP.Core
 
         public Dictionary<string, object> BackupObject { get; set; } = new Dictionary<string, object>();
 
+
+        private ObservableCollection<ProductModel> _ProductList;
+        public ObservableCollection<ProductModel> ProductList
+        {
+            get { return _ProductList; }
+            set { SetProperty(ref _ProductList, value); }
+        }
         #endregion
 
         #region 命令
@@ -1408,6 +1424,7 @@ namespace TeamAAS_VP.Core
         Int16 _LastPickINC = 0;
         DateTime[] _LastMesCheckTime = new DateTime[10];
         List<Task<(bool IsSucceed, bool[] Result, string Message)>> _PrcTaskList = new List<Task<(bool IsSucceed, bool[] Result, string Message)>>();
+        List<Task<(bool IsSucceed, ICogImage[] Images, string Message, int cameraIndex, Guid procedureId)>> _ImageTaskList = new List<Task<(bool IsSucceed, ICogImage[] Images, string Message, int cameraIndex, Guid procedureId)>>();
 
         private readonly object _stateLock = new object();
 
@@ -1623,20 +1640,71 @@ namespace TeamAAS_VP.Core
                                     if (response != "MES功能未启用!")
                                     {
                                         string[] items = response.Split('\n');
-                                        if (items[3].Contains("sn="))
+                                        string snItem = items.FirstOrDefault(f => f.Contains("sn="));
+                                        if (snItem != null)
                                         {
-                                            ProductMainSN = items[3].Replace("sn=", "");
+                                            ProductMainSN = snItem.Replace("sn=", "").Trim();
                                             _productService.CurrentProductCode = ProductMainSN;
+                                            SendTaskMessage($"产品主sn:{ProductMainSN}", MessageLevel.Info);
                                         }
-                                        SendTaskMessage($"产品主sn:{ProductMainSN}", MessageLevel.Info);
-                                        if (items[5].Contains("wo="))
+                                        string woItem = items.FirstOrDefault(f => f.Contains("wo="));
+                                        if (snItem != null)
                                         {
-                                            wo = items[5].Replace("wo=", "");
+                                            wo = snItem.Replace("wo=", "").Trim();
+                                            SendTaskMessage($"产品wo:{wo}", MessageLevel.Info);
                                         }
-                                        SendTaskMessage($"产品wo:{wo}", MessageLevel.Info);
+                                        string modelItem = items.FirstOrDefault(f => f.Contains("model_num="));
+                                        if (modelItem != null)
+                                        {
+                                            model_num = modelItem.Replace("model_num=", "").Trim();
+                                            SendTaskMessage($"model_num:{model_num}", MessageLevel.Info);
+                                        }
+                                        string colorItem = items.FirstOrDefault(f => f.Contains("color="));
+                                        if (colorItem != null)
+                                        {
+                                            color = colorItem.Replace("color=", "").Trim();
+                                            SendTaskMessage($"color:{color}", MessageLevel.Info);
+                                        }
+                                        string ppidItem = items.FirstOrDefault(f => f.Contains("ppid="));
+                                        if (ppidItem != null)
+                                        {
+                                            ppid = colorItem.Replace("ppid=", "").Trim();
+                                            SendTaskMessage($"ppid:{ppid}", MessageLevel.Info);
+                                        }
+                                        string revisionItem = items.FirstOrDefault(f => f.Contains("revision="));
+                                        if (revisionItem != null)
+                                        {
+                                            revision = colorItem.Replace("revision=", "").Trim();
+                                            SendTaskMessage($"revision:{revision}", MessageLevel.Info);
+                                        }
+
                                     }
                                     LogHelper.WriteLogMes($"【mes结束QUERY】");
                                     SendTaskMessage($"mes结束QUERY", MessageLevel.Info);
+                                    var q = await _systemDatabaseService.QueryProductFromMesAsync(model_num, color);
+                                    if (!string.IsNullOrEmpty(q))
+                                    {
+                                        ProductList = new ObservableCollection<ProductModel>(_productService.GetAllProducts());
+                                        Guid productId = Guid.Empty;
+                                        foreach (var itt in ProductList)
+                                        {
+                                            if (itt.Name == q)
+                                            {
+                                                productId = itt.ID;
+                                                break;
+                                            }
+                                        }
+                                        if (currentProduct.ID != productId)
+                                        {
+                                            //切换产品
+                                            _productService.LoadProduct(productId);
+                                            _productService.SetCurrentProduct(productId);
+                                            await WritePositionToPlcAsync();
+                                            SendTaskMessage($"切换产品成功", MessageLevel.Debug);
+                                        }
+                                    }
+
+
                                     await plc.WriteNodeAsync(addressConfig.Out_FixedCameraPickStatus.Address, (Int16)1);
                                     return;
                                 }
@@ -1689,9 +1757,10 @@ namespace TeamAAS_VP.Core
                                     if (response != "MES功能未启用!")
                                     {
                                         string[] item = response.Split('\n');
-                                        if (item[2].Contains("sn="))
+                                        string snItem = item.FirstOrDefault(f => f.Contains("sn="));
+                                        if (snItem != null)
                                         {
-                                            ProductMainSN_Temp = item[2].Replace("sn=", "");
+                                            ProductMainSN_Temp = snItem.Replace("sn=", "").Trim();
                                             SendTaskMessage($"sn:{ProductMainSN_Temp}", MessageLevel.Info);
                                         }
                                     }
@@ -1708,21 +1777,72 @@ namespace TeamAAS_VP.Core
                                         if (response2 != "MES功能未启用!")
                                         {
                                             string[] item = response2.Split('\n');
-                                            if (item[3].Contains("sn="))
+
+                                            string snItem = item.FirstOrDefault(f => f.Contains("sn="));
+                                            if (snItem != null)
                                             {
-                                                ProductMainSN = item[3].Replace("sn=", "");
+                                                ProductMainSN = snItem.Replace("sn=", "").Trim();
                                                 _productService.CurrentProductCode = ProductMainSN;
-                                                SendTaskMessage($"产品主sn:{ProductMainSN}", MessageLevel.Info);
+                                                SendTaskMessage($"产品主sn:{ProductMainSN}", MessageLevel.Info);
+                                            }
+                                            string woItem = item.FirstOrDefault(f => f.Contains("wo="));
+                                            if (snItem != null)
+                                            {
+                                                wo = snItem.Replace("wo=", "").Trim();
+                                                SendTaskMessage($"产品wo:{wo}", MessageLevel.Info);
+                                            }
+                                            string modelItem = item.FirstOrDefault(f => f.Contains("model_num="));
+                                            if (modelItem != null)
+                                            {
+                                                model_num = modelItem.Replace("model_num=", "").Trim();
+                                                SendTaskMessage($"model_num:{model_num}", MessageLevel.Info);
                                             }
-                                            if (item[5].Contains("wo="))
+                                            string colorItem = item.FirstOrDefault(f => f.Contains("color="));
+                                            if (colorItem != null)
                                             {
-                                                wo = item[5].Replace("wo=", "");
-                                                SendTaskMessage($"产品主wo:{wo}", MessageLevel.Info);
+                                                color = colorItem.Replace("color=", "").Trim();
+                                                SendTaskMessage($"color:{color}", MessageLevel.Info);
+                                            }
+                                            string ppidItem = item.FirstOrDefault(f => f.Contains("ppid="));
+                                            if (ppidItem != null)
+                                            {
+                                                ppid = colorItem.Replace("ppid=", "").Trim();
+                                                SendTaskMessage($"ppid:{ppid}", MessageLevel.Info);
+                                            }
+                                            string revisionItem = item.FirstOrDefault(f => f.Contains("revision="));
+                                            if (revisionItem != null)
+                                            {
+                                                revision = colorItem.Replace("revision=", "").Trim();
+                                                SendTaskMessage($"revision:{revision}", MessageLevel.Info);
                                             }
                                         }
                                         LogHelper.WriteLogMes($"第二次询问mes成功");
                                         SendTaskMessage($"第二次询问mes成功:{response2}", MessageLevel.Debug);
 
+                                        var q = await _systemDatabaseService.QueryProductFromMesAsync(model_num, color);
+                                        if (!string.IsNullOrEmpty(q))
+                                        {
+                                            ProductList = new ObservableCollection<ProductModel>(_productService.GetAllProducts());
+                                            Guid productId = Guid.Empty;
+                                            foreach (var itt in ProductList)
+                                            {
+                                                if (itt.Name == q)
+                                                {
+                                                    productId = itt.ID;
+                                                    break;
+                                                }
+                                            }
+                                            if (currentProduct.ID != productId)
+                                            {
+                                                //切换产品
+                                                _productService.LoadProduct(productId);
+                                                _productService.SetCurrentProduct(productId);
+                                                await WritePositionToPlcAsync();
+                                                SendTaskMessage($"切换产品成功", MessageLevel.Debug);
+                                            }
+                                        }
+
+
                                         await plc.WriteNodeAsync(addressConfig.Out_FixedCameraPickStatus.Address, (Int16)1);
                                     }
                                     else
@@ -1837,9 +1957,11 @@ namespace TeamAAS_VP.Core
                                         if (response != "MES功能未启用!")
                                         {
                                             string[] item = response.Split('\n');
-                                            if (item[2].Contains("sn="))
+
+                                            string snItem = item.FirstOrDefault(f => f.Contains("sn="));
+                                            if (snItem != null)
                                             {
-                                                ProductMainSN_Temp = item[2].Replace("sn=", "");
+                                                ProductMainSN_Temp = snItem.Replace("sn=", "").Trim();
                                                 SendTaskMessage($"sn:{ProductMainSN_Temp}", MessageLevel.Info);
                                             }
                                         }
@@ -1856,21 +1978,72 @@ namespace TeamAAS_VP.Core
                                             if (response2 != "MES功能未启用!")
                                             {
                                                 string[] item = response2.Split('\n');
-                                                if (item[3].Contains("sn="))
+
+
+                                                string snItem = item.FirstOrDefault(f => f.Contains("sn="));
+                                                if (snItem != null)
                                                 {
-                                                    ProductMainSN = item[3].Replace("sn=", "");
+                                                    ProductMainSN = snItem.Replace("sn=", "").Trim();
                                                     _productService.CurrentProductCode = ProductMainSN;
-                                                    SendTaskMessage($"产品主sn:{ProductMainSN}", MessageLevel.Info);
+                                                    SendTaskMessage($"产品主sn:{ProductMainSN}", MessageLevel.Info);
+                                                }
+                                                string woItem = item.FirstOrDefault(f => f.Contains("wo="));
+                                                if (snItem != null)
+                                                {
+                                                    wo = snItem.Replace("wo=", "").Trim();
+                                                    SendTaskMessage($"产品wo:{wo}", MessageLevel.Info);
                                                 }
-                                                if (item[5].Contains("wo="))
+                                                string modelItem = item.FirstOrDefault(f => f.Contains("model_num="));
+                                                if (modelItem != null)
                                                 {
-                                                    wo = item[5].Replace("wo=", "");
-                                                    SendTaskMessage($"产品主wo:{wo}", MessageLevel.Info);
+                                                    model_num = modelItem.Replace("model_num=", "").Trim();
+                                                    SendTaskMessage($"model_num:{model_num}", MessageLevel.Info);
+                                                }
+                                                string colorItem = item.FirstOrDefault(f => f.Contains("color="));
+                                                if (colorItem != null)
+                                                {
+                                                    color = colorItem.Replace("color=", "").Trim();
+                                                    SendTaskMessage($"color:{color}", MessageLevel.Info);
+                                                }
+                                                string ppidItem = item.FirstOrDefault(f => f.Contains("ppid="));
+                                                if (ppidItem != null)
+                                                {
+                                                    ppid = colorItem.Replace("ppid=", "").Trim();
+                                                    SendTaskMessage($"ppid:{ppid}", MessageLevel.Info);
+                                                }
+                                                string revisionItem = item.FirstOrDefault(f => f.Contains("revision="));
+                                                if (revisionItem != null)
+                                                {
+                                                    revision = colorItem.Replace("revision=", "").Trim();
+                                                    SendTaskMessage($"revision:{revision}", MessageLevel.Info);
                                                 }
                                             }
                                             LogHelper.WriteLogMes($"第二次询问mes成功");
                                             SendTaskMessage($"第二次询问mes成功:{response2}", MessageLevel.Debug);
 
+                                            var q = await _systemDatabaseService.QueryProductFromMesAsync(model_num, color);
+                                            if (!string.IsNullOrEmpty(q))
+                                            {
+                                                ProductList = new ObservableCollection<ProductModel>(_productService.GetAllProducts());
+                                                Guid productId = Guid.Empty;
+                                                foreach (var itt in ProductList)
+                                                {
+                                                    if (itt.Name == q)
+                                                    {
+                                                        productId = itt.ID;
+                                                        break;
+                                                    }
+                                                }
+                                                if (currentProduct.ID != productId)
+                                                {
+                                                    //切换产品
+                                                    _productService.LoadProduct(productId);
+                                                    _productService.SetCurrentProduct(productId);
+                                                    await WritePositionToPlcAsync();
+                                                    SendTaskMessage($"切换产品成功", MessageLevel.Debug);
+                                                }
+                                            }
+
                                             await plc.WriteNodeAsync(addressConfig.Out_FixedCameraPickStatus.Address, (Int16)1);
                                         }
                                         else
@@ -1958,20 +2131,71 @@ namespace TeamAAS_VP.Core
                                         if (response != "MES功能未启用!")
                                         {
                                             string[] items = response.Split('\n');
-                                            if (items[3].Contains("sn="))
+
+                                            string snItem = items.FirstOrDefault(f => f.Contains("sn="));
+                                            if (snItem != null)
                                             {
-                                                ProductMainSN = items[3].Replace("sn=", "");
+                                                ProductMainSN = snItem.Replace("sn=", "").Trim();
                                                 _productService.CurrentProductCode = ProductMainSN;
+                                                SendTaskMessage($"产品主sn:{ProductMainSN}", MessageLevel.Info);
                                             }
-                                            SendTaskMessage($"产品主sn:{ProductMainSN}", MessageLevel.Info);
-                                            if (items[5].Contains("wo="))
+                                            string woItem = items.FirstOrDefault(f => f.Contains("wo="));
+                                            if (snItem != null)
                                             {
-                                                wo = items[5].Replace("wo=", "");
+                                                wo = snItem.Replace("wo=", "").Trim();
+                                                SendTaskMessage($"产品wo:{wo}", MessageLevel.Info);
+                                            }
+                                            string modelItem = items.FirstOrDefault(f => f.Contains("model_num="));
+                                            if (modelItem != null)
+                                            {
+                                                model_num = modelItem.Replace("model_num=", "").Trim();
+                                                SendTaskMessage($"model_num:{model_num}", MessageLevel.Info);
+                                            }
+                                            string colorItem = items.FirstOrDefault(f => f.Contains("color="));
+                                            if (colorItem != null)
+                                            {
+                                                color = colorItem.Replace("color=", "").Trim();
+                                                SendTaskMessage($"color:{color}", MessageLevel.Info);
+                                            }
+                                            string ppidItem = items.FirstOrDefault(f => f.Contains("ppid="));
+                                            if (ppidItem != null)
+                                            {
+                                                ppid = colorItem.Replace("ppid=", "").Trim();
+                                                SendTaskMessage($"ppid:{ppid}", MessageLevel.Info);
+                                            }
+                                            string revisionItem = items.FirstOrDefault(f => f.Contains("revision="));
+                                            if (revisionItem != null)
+                                            {
+                                                revision = colorItem.Replace("revision=", "").Trim();
+                                                SendTaskMessage($"revision:{revision}", MessageLevel.Info);
                                             }
-                                            SendTaskMessage($"产品wo:{wo}", MessageLevel.Info);
                                         }
                                         LogHelper.WriteLogMes($"【mes结束QUERY】");
                                         SendTaskMessage($"mes结束QUERY", MessageLevel.Info);
+
+                                        var q = await _systemDatabaseService.QueryProductFromMesAsync(model_num, color);
+                                        if (!string.IsNullOrEmpty(q))
+                                        {
+                                            ProductList = new ObservableCollection<ProductModel>(_productService.GetAllProducts());
+                                            Guid productId = Guid.Empty;
+                                            foreach (var itt in ProductList)
+                                            {
+                                                if (itt.Name == q)
+                                                {
+                                                    productId = itt.ID;
+                                                    break;
+                                                }
+                                            }
+                                            if (currentProduct.ID != productId)
+                                            {
+                                                //切换产品
+                                                _productService.LoadProduct(productId);
+                                                _productService.SetCurrentProduct(productId);
+                                                await WritePositionToPlcAsync();
+                                                SendTaskMessage($"切换产品成功", MessageLevel.Debug);
+                                            }
+                                        }
+
                                         await plc.WriteNodeAsync(addressConfig.Out_FixedCameraPickStatus.Address, (Int16)1);
                                         return;
                                     }
@@ -1992,27 +2216,33 @@ namespace TeamAAS_VP.Core
                                 }
                                 return;
                             }
+
+                            _ImageTaskList.Clear();
                             foreach (var prcId in procIds)
                             {
-                                if (Is3D(prcId))
-                                {
-                                    _PrcTaskList.Add(ExecuteProcedureAsync(cameraIndex, prcId));
-                                }
-                                else
+                                _ImageTaskList.Add(GrabImageEx(cameraIndex, prcId));   
+                            }
+                            if (cameraIndex != currentProduct.PhotoCountStop)
+                            {
+                                //直接放行,执行下一个检测点
+                                await plc.WriteNodeAsync(addressConfig.Out_FixedCameraPickStatus.Address, (Int16)1);
+                            }
+                            if (_ImageTaskList.Count > 0)//如果2D取图有队列
+                            {
+                                var ImageTaskResults = await Task.WhenAll(_ImageTaskList);
+                                foreach (var item in ImageTaskResults)
                                 {
-                                    //2d相机时,需要先等待图像采集完成
-                                    var imageData = await GrabImage(cameraIndex, prcId);
-                                    if (imageData.IsSucceed)
+                                    if (item.IsSucceed)
                                     {
-                                        _PrcTaskList.Add(ExecuteProcedureAsync(cameraIndex, prcId, imageData.imges));
+                                        _PrcTaskList.Add(ExecuteProcedureAsync(item.cameraIndex, item.procedureId, item.Images));
+                                        //_PrcTaskList.Add(ExecuteProcedureAsync(cameraIndex, prcId, imageData.imges));
                                     }
                                     else
                                     {
-                                        SendTaskMessage($"图像采集失败!{cameraIndex}: {prcId}", MessageLevel.Alarm);
+                                        SendTaskMessage($"图像采集失败!{item.cameraIndex}: {item.procedureId}", MessageLevel.Alarm);
                                     }
                                 }
                             }
-
                             //如果最后一个拍照点,则需要等待前面所有的拍照处理完成
                             if (cameraIndex == currentProduct.PhotoCountStop)
                             {
@@ -2026,6 +2256,7 @@ namespace TeamAAS_VP.Core
                                     if (!item.IsSucceed || item.Result == null)
                                     {
                                         resultFlog = false;
+                                        break;
                                     }
                                     else
                                     {
@@ -2052,13 +2283,7 @@ namespace TeamAAS_VP.Core
                                     SendTaskMessage($"检测执行失败", MessageLevel.Alarm);
                                     await plc.WriteNodeAsync(addressConfig.Out_FixedCameraPickStatus.Address, (Int16)2);
                                 }
-                            }
-                            else
-                            {
-                                //直接放行,执行下一个检测点
-                                //SendTaskMessage($"流程执行成功", MessageLevel.Info);
-                                await plc.WriteNodeAsync(addressConfig.Out_FixedCameraPickStatus.Address, (Int16)1);
-                            }
+                            }                            
                         }
                         else
                         {
@@ -2148,9 +2373,61 @@ namespace TeamAAS_VP.Core
                                             wo = woItem.Replace("wo=", "").Trim();
                                             SendTaskMessage($"工单信息:{wo[i]}", MessageLevel.Info);
                                         }
+                                        string modelItem = item.FirstOrDefault(f => f.Contains("model_num="));
+                                        if (modelItem != null)
+                                        {
+                                            model_num = modelItem.Replace("model_num=", "").Trim();
+                                            SendTaskMessage($"model_num:{model_num}", MessageLevel.Info);
+                                        }
+                                        string colorItem = item.FirstOrDefault(f => f.Contains("color="));
+                                        if (colorItem != null)
+                                        {
+                                            color = colorItem.Replace("color=", "").Trim();
+                                            SendTaskMessage($"color:{color}", MessageLevel.Info);
+                                        }
+                                        string ppidItem = item.FirstOrDefault(f => f.Contains("ppid="));
+                                        if (ppidItem != null)
+                                        {
+                                            ppid = colorItem.Replace("ppid=", "").Trim();
+                                            SendTaskMessage($"ppid:{ppid}", MessageLevel.Info);
+                                        }
+                                        string revisionItem = item.FirstOrDefault(f => f.Contains("revision="));
+                                        if (revisionItem != null)
+                                        {
+                                            revision = colorItem.Replace("revision=", "").Trim();
+                                            SendTaskMessage($"revision:{revision}", MessageLevel.Info);
+                                        }
                                         ShowMes_Query = true;
                                         //产品发生改变并且供料器发生了变化时,需要通知PLC进行取料更改
 
+                                        //切换产品
+                                        if (i == 0)//i=0时才会切换产品
+                                        {
+                                            var q = await _systemDatabaseService.QueryProductFromMesAsync(model_num, color);
+                                            if (!string.IsNullOrEmpty(q))
+                                            {
+                                                ProductList = new ObservableCollection<ProductModel>(_productService.GetAllProducts());
+                                                Guid productId = Guid.Empty;
+                                                foreach (var itt in ProductList)
+                                                {
+                                                    if (itt.Name == q)
+                                                    {
+                                                        productId = itt.ID;
+                                                        break;
+                                                    }
+                                                }
+                                                if (currentProduct.ID != productId)
+                                                {
+                                                    //切换产品
+                                                    _productService.LoadProduct(productId);
+                                                    _productService.SetCurrentProduct(productId);
+                                                    await WritePositionToPlcAsync();
+                                                    SendTaskMessage($"切换产品成功", MessageLevel.Debug);
+                                                }
+                                            }
+                                        }
+
+
                                         await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)1);
 
                                         LogHelper.WriteLogMes($"【mes结束QUERY】");
@@ -2216,8 +2493,9 @@ namespace TeamAAS_VP.Core
                                     StringBuilder submitData = new StringBuilder();
                                     foreach (var item in lockResultsAll)
                                     {
-                                        submitData.Append($"{item.PhotoName}-{item.ResultData}");
+                                        submitData.Append($"{item.PhotoName}={item.ResultData}&");   
                                     }
+                                    
                                     ShowMes_Result = resultIndex == 1 ? true : false;
                                     //(bool isSuccess, string response) = await _mesService.SubmitGetAsync(ProductMainSN, "", MesData.Replace("--", "-"), resultIndex == 1 ? true : false, _LastMesCheckTime[i], DateTime.UtcNow);
                                     (bool isSuccess, string response) = await _mesService.SubmitGetAsync(ProductMainSN, "", submitData.ToString(), resultIndex == 1 ? true : false, _LastMesCheckTime[i], serverTimeResult.Now);
@@ -2244,17 +2522,17 @@ namespace TeamAAS_VP.Core
                                             {
                                                 DFC.Add(new DataFormCtq
                                                 {
-                                                    PPID = ProductMainSN,
+                                                    PPID = ppid,
                                                     PROCESS_NAME = stationConfig.DataInfo.PROCESS_NAME,
-                                                    PROCESS_START_TIME = _LastMesCheckTime[i].ToString(),
+                                                    PROCESS_START_TIME = _LastMesCheckTime[i].ToString("o"),
                                                     CTQ_NAME = item.PhotoName,
                                                     CTQ_VALUE = item.ResultData.Replace(",", ";"),
                                                     CTQ_LSL = item.DownLimit,
                                                     CTQ_USL = item.UpLimit,
-                                                    PROCESS_END_TIME = serverTimeResult.Now.ToString(),
+                                                    PROCESS_END_TIME = serverTimeResult.Now.ToString("o"),
                                                     SUPPLIER_NAME = stationConfig.DataInfo.SUPPLIER_NAME,
                                                     COMMODITY_TYPE = stationConfig.DataInfo.COMMODITY_TYPE,
-                                                    REVISION = stationConfig.DataInfo.REVISION,
+                                                    REVISION = revision,
                                                     WO = wo,
                                                     MFG_LOT = stationConfig.DataInfo.MFG_LOT,
                                                     MFG_ASSY_LINE = stationConfig.DataInfo.MFG_ASSY_LINE,
@@ -2262,7 +2540,7 @@ namespace TeamAAS_VP.Core
                                                     PROCESS_MACHINE_ID = stationConfig.DataInfo.PROCESS_MACHINE_ID,
                                                     CTQ_UNIT_OF_MEASURE = "mm",
                                                     ERROR_MESSAGE = item.PhotoPassed == "OK" ? "" : $"{item.PhotoName} OOS",
-                                                    PD_ATTR_01= "xxxxxxxx1",
+                                                    PD_ATTR_01= ProductMainSN,
                                                     PD_ATTR_02 = item.MidLimit,
                                                     PD_ATTR_03 = "",
                                                     PD_ATTR_04 = "",
@@ -2274,6 +2552,39 @@ namespace TeamAAS_VP.Core
                                             if (recordResult)
                                             {
                                                 SendTaskMessage($"{i}:{stationConfig.DeviceName}产品记录保存成功", MessageLevel.Debug);
+                                                //上传数据
+                                                try
+                                                {
+                                                    DateTime dt = DateTime.Now;
+                                                    string filename = $"{ProductMainSN}_{dt.ToString("yyyyMMddHHmmss")}";
+                                                    var device = _configService.GetDeviceInfo();
+                                                    (bool isSuc, string resp) = await _mesService.SendFtpFileAsync(ProductMainSN, filename);
+                                                    if (isSuc)
+                                                    {
+                                                        LogHelper.WriteLogMes($"上传数据成功");
+                                                        SendTaskMessage($"上传数据成功", MessageLevel.Debug);
+                                                        string filePath = $"D:\\Image\\Recored\\{dt.ToString("yyyy-MM")}\\{dt.ToString("MM-dd")}\\{currentProduct.Name}\\{ProductMainSN[i]}";
+                                                        //复制csv
+                                                        string source_csv = $"{stationConfig.SaveCsvPath}\\{dt.ToString("yyyy-MM")}\\{i}_{stationConfig.DeviceName}_{dt.ToString("yyyy-MM-dd")}.csv";
+                                                        string target_csv = Path.Combine(filePath, Path.GetFileName(source_csv)); ;
+                                                        File.Copy(source_csv, target_csv, true);
+                                                        //复制log
+                                                        string source_log = $"..\\Log\\LogInfo\\{dt.ToString("yyyy-MM")}\\{dt.ToString("yyyy-MM-dd")}.txt";
+                                                        string target_log = Path.Combine(filePath, Path.GetFileName(source_log));
+                                                        File.Copy(source_log, target_log, true);
+                                                        CompressionImage(filePath, filename, device.Station, device.FixtureId);
+                                                    }
+                                                    else
+                                                    {
+                                                        LogHelper.WriteLogMes($"上传数据失败");
+                                                        SendTaskMessage($"上传数据失败", MessageLevel.Error);
+                                                    }
+                                                }
+                                                catch (Exception ex)
+                                                {
+                                                    SendTaskMessage($"上传数据时出错:{ex.Message}", MessageLevel.Error);
+                                                    LogHelper.WriteLogError($"上传数据时出错", ex);
+                                                }
                                             }
                                             else
                                             {
@@ -2560,65 +2871,99 @@ namespace TeamAAS_VP.Core
                             //}
 
                             string[] strpoints1 = visionResult.Items[i].Split(',');
-                            lockResult1.PhotoName = strpoints1[0];
                             string[] body1 = strpoints1[1].Split(";");
-                            string body2 = null;
-
-                            if (body1.Length == 8)
-                            {
-                                body2 = $"{body1[0]},{body1[2]},{body1[4]},{body1[6]}";
-                            }
-                            else
+                            if (body1.Length > 1)
                             {
-                                body2 = strpoints1[1];
-                            }
-                            lockResult1.ResultData = body2;
-                            lockResult1.PhotoCode = ProductMainSN;
-                            var globalParam = currentProduct.GlobalParamListCollection.FirstOrDefault(p => p.Name == strpoints1[0]);
-                            if (globalParam != null)
-                            {
-                                lockResult1.UpLimit = globalParam.Param1;
-                                lockResult1.DownLimit = globalParam.Param2;
-                                lockResult1.MidLimit = globalParam.Param5;
-                                string ResData = strpoints1[1];
-                                if (ResData.Contains("NA"))
-                                {
-                                    ResData = "-1000";
-                                }
-                                string[] body = ResData.Split(";");
-                                bool resultflog = true;
-                                foreach (var item in body)
+                                for (int j = 1; j <= body1.Length; j++)
                                 {
-                                    if (Convert.ToDouble(item) >= Convert.ToDouble(globalParam.Param2) && Convert.ToDouble(item) <= Convert.ToDouble(globalParam.Param1))
+                                    lockResult1.PhotoName = strpoints1[0] + j.ToString();
+                                    lockResult1.ResultData = body1[j - 1];
+                                    lockResult1.PhotoCode = ProductMainSN;
+                                    var globalParam = currentProduct.GlobalParamListCollection.FirstOrDefault(p => p.Name == strpoints1[0]);
+                                    if (globalParam != null)
                                     {
+                                        lockResult1.UpLimit = globalParam.Param1;
+                                        lockResult1.DownLimit = globalParam.Param2;
+                                        lockResult1.MidLimit = globalParam.Param5;
+                                        string ResData = strpoints1[1];
+                                        if (ResData.Contains("NA"))
+                                        {
+                                            ResData = "-1000";
+                                        }
+                                        
+                                        bool resultflog = true;
+                                            if (Convert.ToDouble(lockResult1.ResultData) >= Convert.ToDouble(globalParam.Param2) && Convert.ToDouble(lockResult1.ResultData) <= Convert.ToDouble(globalParam.Param1))
+                                            {
 
+                                            }
+                                            else
+                                            {
+                                                resultflog = false;
+                                            }
+                                        if (resultflog)
+                                        {
+                                            lockResult1.PhotoPassed = "OK";
+                                            results.Add(true);
+                                        }
+                                        else
+                                        {
+                                            lockResult1.PhotoPassed = "NG";
+                                            results.Add(false);
+                                        }
                                     }
-                                    else
+                                    lock (_stateLock)
                                     {
-                                        resultflog = false;
+                                        lockResultsAll.Add(lockResult1);
                                     }
                                 }
-                                if (resultflog)
-                                {
-                                    lockResult1.PhotoPassed = "OK";
-                                    results.Add(true);
-                                }
-                                else
-                                {
-                                    lockResult1.PhotoPassed = "NG";
-                                    results.Add(false);
-                                }
                             }
-
-                            lock (_stateLock)
+                            else
                             {
-                                lockResultsAll.Add(lockResult1);
+                                    lockResult1.PhotoName = strpoints1[0];
+                                    lockResult1.ResultData = strpoints1[1];
+                                    lockResult1.PhotoCode = ProductMainSN;
+                                    var globalParam = currentProduct.GlobalParamListCollection.FirstOrDefault(p => p.Name == strpoints1[0]);
+                                    if (globalParam != null)
+                                    {
+                                        lockResult1.UpLimit = globalParam.Param1;
+                                        lockResult1.DownLimit = globalParam.Param2;
+                                        lockResult1.MidLimit = globalParam.Param5;
+                                        string ResData = strpoints1[1];
+                                        if (ResData.Contains("NA"))
+                                        {
+                                            ResData = "-1000";
+                                        }
+
+                                        bool resultflog = true;
+                                        if (Convert.ToDouble(lockResult1.ResultData) >= Convert.ToDouble(globalParam.Param2) && Convert.ToDouble(lockResult1.ResultData) <= Convert.ToDouble(globalParam.Param1))
+                                        {
+
+                                        }
+                                        else
+                                        {
+                                            resultflog = false;
+                                        }
+                                        if (resultflog)
+                                        {
+                                            lockResult1.PhotoPassed = "OK";
+                                            results.Add(true);
+                                        }
+                                        else
+                                        {
+                                            lockResult1.PhotoPassed = "NG";
+                                            results.Add(false);
+                                        }
+                                    }
+                                    lock (_stateLock)
+                                    {
+                                        lockResultsAll.Add(lockResult1);
+                                    }
                             }
-                            
-                            App.Current.Dispatcher.Invoke(() =>
-                            {
-                                _eventAggregator.GetEvent<LockFinishNotification>().Publish(lockResult1);
-                            });
+
+                                App.Current.Dispatcher.Invoke(() =>
+                                {
+                                    _eventAggregator.GetEvent<LockFinishNotification>().Publish(lockResult1);
+                                });
                         }
 
                         ////排序
@@ -3084,5 +3429,111 @@ namespace TeamAAS_VP.Core
                 SendTaskMessage(Lang.扫码枪接收信息时出错 + ex.Message, MessageLevel.Error);
             }
         }
+
+        /// <summary>
+        /// 2D相机先采集图像
+        /// </summary>
+        /// <param name="procedureId"></param>
+        /// <returns></returns>
+        private async Task<(bool IsSucceed, ICogImage[] imges, string Message, int pointIndex, Guid procedureId)> GrabImageEx(int pointIndex, Guid procedureId)
+        {
+            // 获取当前产品
+            var currentProduct = _productService.GetCurrentProduct();
+            if (currentProduct == null)
+            {
+                return (false, null, "当前产品为空,未加载产品!", pointIndex, procedureId);
+            }
+
+            var cameraProcedures = currentProduct.CameraProcedures;
+            if (cameraProcedures == null || cameraProcedures.Count == 0)
+            {
+                SendTaskMessage($"当前产品未配置 CameraProcedures,无法执行视觉流程", MessageLevel.Alarm);
+                return (false, null, $"当前产品未配置 CameraProcedures,无法执行视觉流程", pointIndex, procedureId);
+            }
+
+            try
+            {
+                ProcedureModel selectedProcedure = null;
+                try
+                {
+                    foreach (var cp in cameraProcedures)
+                    {
+                        if (cp?.ProcedureModels == null) continue;
+                        selectedProcedure = cp.ProcedureModels.FirstOrDefault(pm => pm.Id == procedureId);
+
+                        if (selectedProcedure != null) break;
+                    }
+                }
+                catch (Exception ex)
+                {
+                    LogHelper.WriteLogError("查找 AOI 点位对应视觉流程时出错", ex);
+                }
+
+                if (selectedProcedure == null)
+                {
+                    SendTaskMessage($"未找到 AOI 点位对应的视觉流程,Point#{pointIndex} ProcedureId={pointIndex}", MessageLevel.Alarm);
+                    return (false, null, $"未找到 AOI 点位对应的视觉流程,Point#{pointIndex} ProcedureId={procedureId}", pointIndex, procedureId);
+                }
+
+                SendTaskMessage($"开始执行 AOI 流程 (Point#{pointIndex}) 流程Id={pointIndex}", MessageLevel.Debug);
+                try
+                {
+                    var sysConfig = _configService.GetSystemConfiguration();
+                    if (selectedProcedure.Id == currentProduct.FixedDownCameraProcedureId && sysConfig.TurnOnAllLightUse == true)
+                    {
+                        await _remoteCommandService.SetLightBeforePhoto(selectedProcedure);
+                    }
+                    //1. 执行拍照
+                    var res = await _remoteCommandService.ExecuteGrabImageAsync(selectedProcedure);
+                    return (res.IsSucceed, res.Image, res.Msg, pointIndex, procedureId);
+                }
+                catch (Exception ex)
+                {
+                    LogHelper.WriteLogError("执行 AOI 视觉图像采集时出错", ex);
+                    SendTaskMessage($"执行 AOI 视觉图像采集时出错: {ex.Message}", MessageLevel.Alarm);
+                }
+
+                return (false, null, $"图像采集失败", pointIndex, procedureId);
+            }
+            catch (Exception ex)
+            {
+                LogHelper.WriteLogError("处理固定相机检测拍照时出错", ex);
+                return (false, null, $"处理固定相机检测拍照时出错", pointIndex, procedureId);
+            }
+        }
+
+        #region 压缩图片文件夹
+        /// <summary>
+        /// 压缩文件
+        /// </summary>
+        /// <param name="sourcePath">原路径</param>
+        /// <param name="zipname">压缩后文件的名称</param>
+        /// <param name="station">mes中的station</param>
+        /// <param name="fixid">mes中的fixtureID</param>
+        public async void CompressionImage(string sourcePath, string zipname, string station, string fixid)
+        {
+            string zipPath = "";
+            try
+            {
+                SendTaskMessage($"开始压缩文件", MessageLevel.Info);
+                await Task.Run(() =>
+                {
+                    zipPath = $"Z:\\{station}\\{fixid}\\{DateTime.Now.ToString("yyyyMMdd")}\\{zipname}.zip";//生成的zip文件路径
+                    string path = $"Z:\\{station}\\{fixid}\\{DateTime.Now.ToString("yyyyMMdd")}";
+                    if (!Directory.Exists(path))
+                    {
+                        Directory.CreateDirectory(path);
+                    }
+                   
+                    ZipFile.CreateFromDirectory(sourcePath, zipPath);
+                });
+            }
+            catch (Exception ex)
+            {
+                LogHelper.WriteLogError($"压缩文件时出错", ex);
+            }
+        }
+
+        #endregion
     }
 }

+ 19 - 2
TeamAAS-VM/Core/Robots/XYZU_Robot.cs

@@ -88,7 +88,7 @@ namespace TeamAAS_VP.Core.Robots
                 Brand = RobotBrand.XYZU_Platform;
             }
 
-            if (robot.PlcRobotParameter.AxixList.Count >= 4)
+            if (robot.PlcRobotParameter.AxixList.Count >= 5)
             {
                 var au = new Axis();
                 au.Name = "V";
@@ -100,7 +100,17 @@ namespace TeamAAS_VP.Core.Robots
                 Brand = RobotBrand.XYZU_Platform;
             }
 
-
+            if (robot.PlcRobotParameter.AxixList.Count >= 6)
+            {
+                var au = new Axis();
+                au.Name = "W";
+                au.Index = 6;
+                au.Command = robot.PlcRobotParameter.AxixList[5].Command;
+                au.Parameter = robot.PlcRobotParameter.AxixList[5].Parameter;
+                au.State = robot.PlcRobotParameter.AxixList[5].State;
+                Axes.Add(au);
+                Brand = RobotBrand.XYZU_Platform;
+            }
             if (Plc.IsConnected)
             {
                 try
@@ -124,6 +134,8 @@ namespace TeamAAS_VP.Core.Robots
                                     case "Y": CurrentPosition.Y = v; break;
                                     case "Z": CurrentPosition.Z = v; break;
                                     case "U": CurrentPosition.U = v; break;
+                                    case "V": CurrentPosition.V = v; break;
+                                    case "W": CurrentPosition.W = v; break;
                                 }
                             }
                         }
@@ -358,6 +370,7 @@ namespace TeamAAS_VP.Core.Robots
                         case "Z": point.Z = v; break;
                         case "U": point.U = v; break;
                         case "V": point.V = v; break;
+                        case "W": point.W = v; break;
                         default: break;
                     }
                 }
@@ -414,6 +427,9 @@ namespace TeamAAS_VP.Core.Robots
                 case "V":
                     currentPos.V += (float)distance;
                     break;
+                case "W":
+                    currentPos.W += (float)distance;
+                    break;
                 default:
                     return false;
             }
@@ -520,6 +536,7 @@ namespace TeamAAS_VP.Core.Robots
                         case "Z": value = position.Z; break;
                         case "U": value = position.U; break;
                         case "V": value = position.V; break;
+                        case "W": value = position.W; break;
                         default: value = 0; break;
                     }
                     keyValues.Add(nodeid, value);

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

@@ -26,7 +26,7 @@ namespace TeamAAS_VP.Data
                 // 创建数据库(如果不存在)
                 _db.DbMaintenance.CreateDatabase();
                 // 创建表
-                _db.CodeFirst.InitTables(typeof(User), typeof(ProductionRecord), typeof(UserLoginRecord), typeof(AlarmRecord), typeof(LockResult));
+                _db.CodeFirst.InitTables(typeof(User), typeof(ProductionRecord), typeof(UserLoginRecord), typeof(AlarmRecord), typeof(LockResult), typeof(ProductWithMes));
 
                 // 创建索引
                 CreateIndexes();

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

@@ -699,5 +699,84 @@ namespace TeamAAS_VP.Data
             if (record.ChangeTime == default(DateTime)) record.ChangeTime = DateTime.UtcNow;
             await _db.Insertable(record).ExecuteCommandAsync();
         }
+
+        #region 产品和mes的绑定,自动切换产品
+        /// <summary>
+        /// 添加绑定信息
+        /// </summary>
+        /// <param name="record"></param>
+        /// <param name="product"></param>
+        /// <returns></returns>
+        /// <exception cref="ArgumentNullException"></exception>
+        public async Task InsertProWithMesAsync(ProductWithMes record, ProductModel product)
+        {
+            //record.Id = product.ID;
+            record.ProductName = product.Name;
+            await _db.Insertable(record).ExecuteCommandAsync();
+        }
+
+        /// <summary>
+        /// 删除绑定信息
+        /// </summary>
+        /// <param name="record"></param>
+        /// <param name="product"></param>
+        /// <returns></returns>
+        public async Task<int> DeleteProWithMesAsync(ProductModel product)
+        {
+            var v = await _db.Deleteable<ProductWithMes>().Where(r => r.ProductName == product.Name).ExecuteCommandAsync();
+            return v;
+        }
+
+        /// <summary>
+        /// 更新绑定信息
+        /// </summary>
+        /// <param name="record"></param>
+        /// <param name="product"></param>
+        /// <returns></returns>
+        /// <exception cref="ArgumentNullException"></exception>
+        public async Task<int> UpdateProductWithMesAsync(ProductWithMes record, ProductModel product)
+        {
+            if (record == null) throw new ArgumentNullException(nameof(record));
+            var v = await _db.Updateable(record).Where(r => r.ProductName == product.Name).ExecuteCommandAsync();
+            return v;
+        }
+
+        /// <summary>
+        /// 查询绑定信息
+        /// </summary>
+        /// <param name="product"></param>
+        /// <returns></returns>
+        public async Task<ProductWithMes> QueryProductWithMesAsync(ProductModel product)
+        {
+            var total = await _db.Queryable<ProductWithMes>().Where(r => r.ProductName == product.Name).FirstAsync();
+            return total;
+        }
+
+        /// <summary>
+        /// 查询所有绑定信息
+        /// </summary>
+        /// <param name="product"></param>
+        /// <returns></returns>
+        public async Task<List<ProductWithMes>> QueryProductWithMesALLAsync()
+        {
+            var total = await _db.Queryable<ProductWithMes>().ToListAsync();
+            return total;
+        }
+
+        /// <summary>
+        /// 通过产品的编码和颜色查询产品的名称
+        /// </summary>
+        /// <param name="code"></param>
+        /// <returns></returns>
+        public async Task<string> QueryProductFromMesAsync(string code, string color)
+        {
+            var v = await _db.Queryable<ProductWithMes>().Where(r => r.ProductCode == code && r.ProductColor == color).FirstAsync();
+            if (v == null || v.ProductName == null)
+            {
+                return "";
+            }
+            return v.ProductName;
+        }
+        #endregion
     }
 }

+ 9 - 0
TeamAAS-VM/Interfaces/IMesService.cs

@@ -113,5 +113,14 @@ namespace TeamAAS_VP.Interfaces
         /// <param name="timeoutInSeconds"></param>
         /// <returns></returns>
         Task<(bool IsSuccess, DateTime Now)> GetServerTimeAsync(string sn, double timeoutInSeconds);
+
+        /// <summary>
+        /// ÉÏ´«log
+        /// </summary>
+        /// <param name="sn"></param>
+        /// <param name="name"></param>
+        /// <param name="cancellationToken"></param>
+        /// <returns></returns>
+        Task<(bool IsSuccess, string Response)> SendFtpFileAsync(string sn, string name, CancellationToken cancellationToken = default);
     }
 }

+ 49 - 0
TeamAAS-VM/Interfaces/ISystemDatabaseService.cs

@@ -337,5 +337,54 @@ namespace TeamAAS_VP.Interfaces
         /// <param name="user"></param>
         /// <returns></returns>
         Task SetCurrentUserAsync(User user);
+
+        #region 产品和mes的绑定,自动切换产品
+        /// <summary>
+        /// 添加绑定信息
+        /// </summary>
+        /// <param name="record"></param>
+        /// <param name="product"></param>
+        /// <returns></returns>
+        /// <exception cref="ArgumentNullException"></exception>
+        Task InsertProWithMesAsync(ProductWithMes record, ProductModel product);
+
+        /// <summary>
+        /// 删除绑定信息
+        /// </summary>
+        /// <param name="record"></param>
+        /// <param name="product"></param>
+        /// <returns></returns>
+        Task<int> DeleteProWithMesAsync(ProductModel product);
+
+        /// <summary>
+        /// 更新绑定信息
+        /// </summary>
+        /// <param name="record"></param>
+        /// <param name="product"></param>
+        /// <returns></returns>
+        /// <exception cref="ArgumentNullException"></exception>
+        Task<int> UpdateProductWithMesAsync(ProductWithMes record, ProductModel product);
+
+        /// <summary>
+        /// 查询绑定信息
+        /// </summary>
+        /// <param name="product"></param>
+        /// <returns></returns>
+        Task<ProductWithMes> QueryProductWithMesAsync(ProductModel product);
+
+        /// <summary>
+        /// 查询所有绑定信息
+        /// </summary>
+        /// <param name="product"></param>
+        /// <returns></returns>
+        Task<List<ProductWithMes>> QueryProductWithMesALLAsync();
+
+        /// <summary>
+        /// 通过产品的编码和颜色查询产品的id
+        /// </summary>
+        /// <param name="code"></param>
+        /// <returns></returns>
+        Task<string> QueryProductFromMesAsync(string code, string color);
+        #endregion
     }
 }

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

@@ -104,6 +104,18 @@ namespace TeamAAS_VP.Models
             set { SetProperty(ref _dataInfo, value); }
         }
 
+        private string _LogUrl;
+        /// <summary>
+        /// log的url
+        /// </summary>
+        public string LogUrl { get => _LogUrl; set => SetProperty(ref _LogUrl, value); }
+
+        private string _ApiKey;
+        /// <summary>
+        /// ApiKey
+        /// </summary>
+        public string ApiKey { get => _ApiKey; set => SetProperty(ref _ApiKey, value); }
+
         public DeviceInfo()
         {
             DeviceNo = 0;
@@ -113,6 +125,8 @@ namespace TeamAAS_VP.Models
             F = string.Empty;
             comp = string.Empty;
             MesUrl = string.Empty;
+            LogUrl = string.Empty;
+            ApiKey = string.Empty;
             EnableMES = false;
             XnSN = string.Empty;
         }
@@ -135,6 +149,8 @@ namespace TeamAAS_VP.Models
                 SaveCsv = this.SaveCsv,
                 SaveCsvPath = this.SaveCsvPath,
                 EnableDoubleMes = this.EnableDoubleMes,
+                LogUrl = this.LogUrl,
+                ApiKey= this.ApiKey,
                 DataInfo = this.DataInfo.Copy()
             };
         }

+ 10 - 114
TeamAAS-VM/Models/PLC/PlcAddressConfig.cs

@@ -626,120 +626,6 @@ namespace TeamAAS_VP.Models.PLC
             Out_MesStatus.DataType = "int16";
             Out_MesStatus.Description = "过站信息 =1 允许工作 =2 本站放行 =3 数据上传完成";
 
-            // Out_PickCamera 初始化并赋地址
-            Out_PickCamera = EnsurePoint(Out_PickCamera);
-            Out_PickCamera.Description = "取料拍照点位参数";
-            Out_PickCamera.X_Position_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_PickCamera[{0}].X_Position";
-            Out_PickCamera.X_Velocity_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_PickCamera[{0}].X_Velocity";
-            Out_PickCamera.Y_Position_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_PickCamera[{0}].Y_Position";
-            Out_PickCamera.Y_Velocity_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_PickCamera[{0}].Y_Velocity";
-            Out_PickCamera.Z_Position_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_PickCamera[{0}].Z_Position_Start";
-            Out_PickCamera.Z_Velocity_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_PickCamera[{0}].Z_Velocity_Start";
-            Out_PickCamera.Z_Position_Stop.Address = "ns=4;s=DB_Communication|FromPC.Point_PickCamera[{0}].Z_Position_Stop";
-            Out_PickCamera.Z_Velocity_Stop.Address = "ns=4;s=DB_Communication|FromPC.Point_PickCamera[{0}].Z_Velocity_Stop";
-            Out_PickCamera.U_Position_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_PickCamera[{0}].U_Position";
-            Out_PickCamera.U_Velocity_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_PickCamera[{0}].U_Velocity";
-            //Out_PickCamera.R_Position.Address = "ns=4;s=DB_Communication|FromPC.Point_PickCamera[{0}].R_Position";
-            //Out_PickCamera.R_Velocity.Address = "ns=4;s=DB_Communication|FromPC.Point_PickCamera[{0}].R_Velocity";
-            //Out_PickCamera.Torque.Address = "ns=4;s=DB_Communication|FromPC.Point_PickCamera[{0}].Torque";
-            //Out_PickCamera.Feeder.Address = "ns=4;s=DB_Communication|FromPC.Point_PickCamera[{0}].Feeder";
-            //Out_PickCamera.ScrewProNum.Address = "ns=4;s=DB_Communication|FromPC.Point_PickCamera[{0}].ScrewProNum";
-
-            // Out_Pick(取料点位)初始化并赋地址
-            Out_Pick = EnsurePoint(Out_Pick);
-            Out_Pick.Description = "取料点位参数";
-            Out_Pick.X_Position_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_Pick[{0}].X_Position";
-            Out_Pick.X_Velocity_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_Pick[{0}].X_Velocity";
-            Out_Pick.Y_Position_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_Pick[{0}].Y_Position";
-            Out_Pick.Y_Velocity_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_Pick[{0}].Y_Velocity";
-            Out_Pick.Z_Position_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_Pick[{0}].Z_Position_Start";
-            Out_Pick.Z_Velocity_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_Pick[{0}].Z_Velocity_Start";
-            Out_Pick.Z_Position_Stop.Address = "ns=4;s=DB_Communication|FromPC.Point_Pick[{0}].Z_Position_Stop";
-            Out_Pick.Z_Velocity_Stop.Address = "ns=4;s=DB_Communication|FromPC.Point_Pick[{0}].Z_Velocity_Stop";
-            Out_Pick.U_Position_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_Pick[{0}].U_Position";
-            Out_Pick.U_Velocity_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_Pick[{0}].U_Velocity";
-            //Out_Pick.R_Position.Address = "ns=4;s=DB_Communication|FromPC.Point_Pick[{0}].R_Position";
-            //Out_Pick.R_Velocity.Address = "ns=4;s=DB_Communication|FromPC.Point_Pick[{0}].R_Velocity";
-            //Out_Pick.Torque.Address = "ns=4;s=DB_Communication|FromPC.Point_Pick[{0}].Torque";
-            //Out_Pick.Feeder.Address = "ns=4;s=DB_Communication|FromPC.Point_Pick[{0}].Feeder";
-            //Out_Pick.ScrewProNum.Address = "ns=4;s=DB_Communication|FromPC.Point_Pick[{0}].ScrewProNum";
-
-            // Out_SecPosCamera(下相机二次定位)初始化并赋地址
-            Out_SecPosCamera = EnsurePoint(Out_SecPosCamera);
-            Out_SecPosCamera.Description = "下相机二次定位点位参数";
-            Out_SecPosCamera.X_Position_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_SecPosCamera[{0}].X_Position";
-            Out_SecPosCamera.X_Velocity_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_SecPosCamera[{0}].X_Velocity";
-            Out_SecPosCamera.Y_Position_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_SecPosCamera[{0}].Y_Position";
-            Out_SecPosCamera.Y_Velocity_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_SecPosCamera[{0}].Y_Velocity";
-            Out_SecPosCamera.Z_Position_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_SecPosCamera[{0}].Z_Position_Start";
-            Out_SecPosCamera.Z_Velocity_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_SecPosCamera[{0}].Z_Velocity_Start";
-            Out_SecPosCamera.Z_Position_Stop.Address = "ns=4;s=DB_Communication|FromPC.Point_SecPosCamera[{0}].Z_Position_Stop";
-            Out_SecPosCamera.Z_Velocity_Stop.Address = "ns=4;s=DB_Communication|FromPC.Point_SecPosCamera[{0}].Z_Velocity_Stop";
-            Out_SecPosCamera.U_Position_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_SecPosCamera[{0}].U_Position";
-            Out_SecPosCamera.U_Velocity_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_SecPosCamera[{0}].U_Velocity";
-            //Out_SecPosCamera.R_Position.Address = "ns=4;s=DB_Communication|FromPC.Point_SecPosCamera[{0}].R_Position";
-            //Out_SecPosCamera.R_Velocity.Address = "ns=4;s=DB_Communication|FromPC.Point_SecPosCamera[{0}].R_Velocity";
-            //Out_SecPosCamera.Torque.Address = "ns=4;s=DB_Communication|FromPC.Point_SecPosCamera[{0}].Torque";
-            //Out_SecPosCamera.Feeder.Address = "ns=4;s=DB_Communication|FromPC.Point_SecPosCamera[{0}].Feeder";
-            //Out_SecPosCamera.ScrewProNum.Address = "ns=4;s=DB_Communication|FromPC.Point_SecPosCamera[{0}].ScrewProNum";
-
-            // Out_ScrewCamera(锁附拍照点位)初始化并赋地址
-            Out_ScrewCamera = EnsurePoint(Out_ScrewCamera);
-            Out_ScrewCamera.Description = "锁附拍照点位参数";
-            Out_ScrewCamera.X_Position_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_ScrewCamera[{0}].X_Position";
-            Out_ScrewCamera.X_Velocity_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_ScrewCamera[{0}].X_Velocity";
-            Out_ScrewCamera.Y_Position_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_ScrewCamera[{0}].Y_Position";
-            Out_ScrewCamera.Y_Velocity_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_ScrewCamera[{0}].Y_Velocity";
-            Out_ScrewCamera.Z_Position_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_ScrewCamera[{0}].Z_Position_Start";
-            Out_ScrewCamera.Z_Velocity_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_ScrewCamera[{0}].Z_Velocity_Start";
-            Out_ScrewCamera.Z_Position_Stop.Address = "ns=4;s=DB_Communication|FromPC.Point_ScrewCamera[{0}].Z_Position_Stop";
-            Out_ScrewCamera.Z_Velocity_Stop.Address = "ns=4;s=DB_Communication|FromPC.Point_ScrewCamera[{0}].Z_Velocity_Stop";
-            Out_ScrewCamera.U_Position_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_ScrewCamera[{0}].U_Position";
-            Out_ScrewCamera.U_Velocity_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_ScrewCamera[{0}].U_Velocity";
-            //Out_ScrewCamera.R_Position.Address = "ns=4;s=DB_Communication|FromPC.Point_ScrewCamera[{0}].R_Position";
-            //Out_ScrewCamera.R_Velocity.Address = "ns=4;s=DB_Communication|FromPC.Point_ScrewCamera[{0}].R_Velocity";
-            //Out_ScrewCamera.Torque.Address = "ns=4;s=DB_Communication|FromPC.Point_ScrewCamera[{0}].Torque";
-            //Out_ScrewCamera.Feeder.Address = "ns=4;s=DB_Communication|FromPC.Point_ScrewCamera[{0}].Feeder";
-            //Out_ScrewCamera.ScrewProNum.Address = "ns=4;s=DB_Communication|FromPC.Point_ScrewCamera[{0}].ScrewProNum";
-
-            // Out_Screw(锁附点位)初始化并赋地址
-            Out_Screw = EnsurePoint(Out_Screw);
-            Out_Screw.Description = "锁附点位参数";
-            Out_Screw.X_Position_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_Screw[{0}].X_Position";
-            Out_Screw.X_Velocity_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_Screw[{0}].X_Velocity";
-            Out_Screw.Y_Position_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_Screw[{0}].Y_Position";
-            Out_Screw.Y_Velocity_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_Screw[{0}].Y_Velocity";
-            Out_Screw.Z_Position_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_Screw[{0}].Z_Position_Start";
-            Out_Screw.Z_Velocity_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_Screw[{0}].Z_Velocity_Start";
-            Out_Screw.Z_Position_Stop.Address = "ns=4;s=DB_Communication|FromPC.Point_Screw[{0}].Z_Position_Stop";
-            Out_Screw.Z_Velocity_Stop.Address = "ns=4;s=DB_Communication|FromPC.Point_Screw[{0}].Z_Velocity_Stop";
-            Out_Screw.U_Position_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_Screw[{0}].U_Position";
-            Out_Screw.U_Velocity_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_Screw[{0}].U_Velocity";
-            //Out_Screw.R_Position.Address = "ns=4;s=DB_Communication|FromPC.Point_Screw[{0}].R_Position";
-            //Out_Screw.R_Velocity.Address = "ns=4;s=DB_Communication|FromPC.Point_Screw[{0}].R_Velocity";
-            //Out_Screw.Torque.Address = "ns=4;s=DB_Communication|FromPC.Point_Screw[{0}].Torque";
-            //Out_Screw.Feeder.Address = "ns=4;s=DB_Communication|FromPC.Point_Screw[{0}].Feeder";
-            //Out_Screw.ScrewProNum.Address = "ns=4;s=DB_Communication|FromPC.Point_Screw[{0}].ScrewProNum";
-
-            // Out_CheckCamera(复检点位)初始化并赋地址
-            Out_CheckCamera = EnsurePoint(Out_CheckCamera);
-            Out_CheckCamera.Description = "复检点位参数";
-            Out_CheckCamera.X_Position_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_CheckCamera[{0}].X_Position";
-            Out_CheckCamera.X_Velocity_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_CheckCamera[{0}].X_Velocity";
-            Out_CheckCamera.Y_Position_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_CheckCamera[{0}].Y_Position";
-            Out_CheckCamera.Y_Velocity_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_CheckCamera[{0}].Y_Velocity";
-            Out_CheckCamera.Z_Position_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_CheckCamera[{0}].Z_Position_Start";
-            Out_CheckCamera.Z_Velocity_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_CheckCamera[{0}].Z_Velocity_Start";
-            Out_CheckCamera.Z_Position_Stop.Address = "ns=4;s=DB_Communication|FromPC.Point_CheckCamera[{0}].Z_Position_Stop";
-            Out_CheckCamera.Z_Velocity_Stop.Address = "ns=4;s=DB_Communication|FromPC.Point_CheckCamera[{0}].Z_Velocity_Stop";
-            Out_CheckCamera.U_Position_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_CheckCamera[{0}].U_Position";
-            Out_CheckCamera.U_Velocity_Start.Address = "ns=4;s=DB_Communication|FromPC.Point_CheckCamera[{0}].U_Velocity";
-            //Out_CheckCamera.R_Position.Address = "ns=4;s=DB_Communication|FromPC.Point_CheckCamera[{0}].R_Position";
-            //Out_CheckCamera.R_Velocity.Address = "ns=4;s=DB_Communication|FromPC.Point_CheckCamera[{0}].R_Velocity";
-            //Out_CheckCamera.Torque.Address = "ns=4;s=DB_Communication|FromPC.Point_CheckCamera[{0}].Torque";
-            //Out_CheckCamera.Feeder.Address = "ns=4;s=DB_Communication|FromPC.Point_CheckCamera[{0}].Feeder";
-            //Out_CheckCamera.ScrewProNum.Address = "ns=4;s=DB_Communication|FromPC.Point_CheckCamera[{0}].ScrewProNum";
-
             // Out_AoiCamera(AOI点位)初始化并赋地址
             Out_AoiCamera = EnsurePoint(Out_AoiCamera);
 
@@ -764,6 +650,16 @@ namespace TeamAAS_VP.Models.PLC
             Out_AoiCamera.U_Position_Stop.Address = "ns=4;s=DB_Communication|FromPC.point_AOI[{0}].U_Position_Stop";
             Out_AoiCamera.U_Velocity_Stop.Address = "ns=4;s=DB_Communication|FromPC.point_AOI[{0}].U_Velocity_Stop";
 
+            Out_AoiCamera.V_Position_Start.Address = "ns=4;s=DB_Communication|FromPC.point_AOI[{0}].V_Position_Start";
+            Out_AoiCamera.V_Velocity_Start.Address = "ns=4;s=DB_Communication|FromPC.point_AOI[{0}].V_Velocity_Start";
+            Out_AoiCamera.V_Position_Stop.Address = "ns=4;s=DB_Communication|FromPC.point_AOI[{0}].V_Position_Stop";
+            Out_AoiCamera.V_Velocity_Stop.Address = "ns=4;s=DB_Communication|FromPC.point_AOI[{0}].V_Velocity_Stop";
+
+            Out_AoiCamera.W_Position_Start.Address = "ns=4;s=DB_Communication|FromPC.point_AOI[{0}].W_Position_Start";
+            Out_AoiCamera.W_Velocity_Start.Address = "ns=4;s=DB_Communication|FromPC.point_AOI[{0}].W_Velocity_Start";
+            Out_AoiCamera.W_Position_Stop.Address = "ns=4;s=DB_Communication|FromPC.point_AOI[{0}].W_Position_Stop";
+            Out_AoiCamera.W_Velocity_Stop.Address = "ns=4;s=DB_Communication|FromPC.point_AOI[{0}].W_Velocity_Stop";
+
             Out_AoiCamera.Enable_Start_Node.Address = "ns=4;s=DB_Communication|FromPC.point_AOI[{0}].Enable_Start_Node";
             Out_AoiCamera.Enable_Pulse.Address = "ns=4;s=DB_Communication|FromPC.point_AOI[{0}].Enable_Pulse";
             Out_AoiCamera.Enable_3D.Address = "ns=4;s=DB_Communication|FromPC.point_AOI[{0}].Enable_3D";

+ 8 - 8
TeamAAS-VM/Models/PLC/PlcPoint.cs

@@ -525,14 +525,14 @@ namespace TeamAAS_VP.Models.PLC
             nodeValues.Add(string.Format(plcAddress.U_Velocity_Start.Address, Number), U_Velocity_Start);
             nodeValues.Add(string.Format(plcAddress.U_Position_Stop.Address, Number), U_Position_Stop);
             nodeValues.Add(string.Format(plcAddress.U_Velocity_Stop.Address, Number), U_Velocity_Stop);
-            //nodeValues.Add(string.Format(plcAddress.V_Position_Start.Address, Number), V_Position_Start);
-            //nodeValues.Add(string.Format(plcAddress.V_Velocity_Start.Address, Number), V_Velocity_Start);
-            //nodeValues.Add(string.Format(plcAddress.V_Position_Stop.Address, Number), V_Position_Stop);
-            //nodeValues.Add(string.Format(plcAddress.V_Velocity_Stop.Address, Number), V_Velocity_Stop);
-            //nodeValues.Add(string.Format(plcAddress.W_Position_Start.Address, Number), W_Position_Start);
-            //nodeValues.Add(string.Format(plcAddress.W_Velocity_Start.Address, Number), W_Velocity_Start);
-            //nodeValues.Add(string.Format(plcAddress.W_Position_Stop.Address, Number), W_Position_Stop);
-            //nodeValues.Add(string.Format(plcAddress.W_Velocity_Stop.Address, Number), W_Velocity_Stop);
+            nodeValues.Add(string.Format(plcAddress.V_Position_Start.Address, Number), V_Position_Start);
+            nodeValues.Add(string.Format(plcAddress.V_Velocity_Start.Address, Number), V_Velocity_Start);
+            nodeValues.Add(string.Format(plcAddress.V_Position_Stop.Address, Number), V_Position_Stop);
+            nodeValues.Add(string.Format(plcAddress.V_Velocity_Stop.Address, Number), V_Velocity_Stop);
+            nodeValues.Add(string.Format(plcAddress.W_Position_Start.Address, Number), W_Position_Start);
+            nodeValues.Add(string.Format(plcAddress.W_Velocity_Start.Address, Number), W_Velocity_Start);
+            nodeValues.Add(string.Format(plcAddress.W_Position_Stop.Address, Number), W_Position_Stop);
+            nodeValues.Add(string.Format(plcAddress.W_Velocity_Stop.Address, Number), W_Velocity_Stop);
 
             nodeValues.Add(string.Format(plcAddress.Enable_Start_Node.Address, Number), Enable_Start_Node);
             nodeValues.Add(string.Format(plcAddress.Enable_Pulse.Address, Number), Enable_Pulse);

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

@@ -0,0 +1,61 @@
+using Prism.Mvvm;
+using SqlSugar;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace TeamAAS_VP.Models
+{
+    [SugarTable("ProductWithMes")]
+    public class ProductWithMes : BindableBase
+    {
+        //[SugarColumn(IsPrimaryKey = true)]
+        //public Guid Id { get; set; } = Guid.NewGuid();
+
+
+        private string _ProductName;
+        [SugarColumn(IsPrimaryKey = true)]
+        /// <summary>
+        /// 产品名称
+        /// </summary>
+        public string ProductName
+        {
+            get { return _ProductName; }
+            set { SetProperty(ref _ProductName, value); }
+        }
+
+
+        private string _ProductCode;
+        /// <summary>
+        /// 产品编码
+        /// </summary>
+        public string ProductCode
+        {
+            get { return _ProductCode; }
+            set { SetProperty(ref _ProductCode, value); }
+        }
+
+
+        private string _ProductColor = "";
+        /// <summary>
+        /// 产品颜色
+        /// </summary>
+        public string ProductColor
+        {
+            get { return _ProductColor; }
+            set { SetProperty(ref _ProductColor, value); }
+        }
+
+        private int _ProductLoadMode;
+        /// <summary>
+        /// 产品加载编号
+        /// </summary>
+        public int ProductLoadMode
+        {
+            get { return _ProductLoadMode; }
+            set { SetProperty(ref _ProductLoadMode, value); }
+        }
+    }
+}

+ 19 - 1
TeamAAS-VM/Models/SystemConfiguration.cs

@@ -426,6 +426,24 @@ namespace TeamAAS_VP.Models
             set => SetProperty(ref _CameraData4Use, value);
         }
 
-        
+        private bool _PhotoAI;
+        /// <summary>
+        /// 深度学习是否使用
+        /// </summary>
+        public bool PhotoAI
+        {
+            get => _PhotoAI;
+            set => SetProperty(ref _PhotoAI, value);
+        }
+
+        private bool _AxisPassUse;
+        /// <summary>
+        /// 轴过度点是否使用
+        /// </summary>
+        public bool AxisPassUse
+        {
+            get => _AxisPassUse;
+            set => SetProperty(ref _AxisPassUse, value);
+        }
     }
 }

+ 55 - 1
TeamAAS-VM/Resources/Languages/Lang.Designer.cs

@@ -19,7 +19,7 @@ namespace TeamAAS_VP.Resources.Languages {
     // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
     // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
     // (以 /str 作为命令选项),或重新生成 VS 项目。
-    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "18.0.0.0")]
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
     [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
     public class Lang {
@@ -3570,6 +3570,42 @@ namespace TeamAAS_VP.Resources.Languages {
             }
         }
         
+        /// <summary>
+        ///   查找类似 是否运行到过度点位 的本地化字符串。
+        /// </summary>
+        public static string 是否运行到过度点位 {
+            get {
+                return ResourceManager.GetString("是否运行到过度点位", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 是否运行到过度点旋转位 的本地化字符串。
+        /// </summary>
+        public static string 是否运行到过度点旋转位 {
+            get {
+                return ResourceManager.GetString("是否运行到过度点旋转位", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 是否运行过度点 的本地化字符串。
+        /// </summary>
+        public static string 是否运行过度点 {
+            get {
+                return ResourceManager.GetString("是否运行过度点", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 是否运行过度点旋转 的本地化字符串。
+        /// </summary>
+        public static string 是否运行过度点旋转 {
+            get {
+                return ResourceManager.GetString("是否运行过度点旋转", resourceCulture);
+            }
+        }
+        
         /// <summary>
         ///   查找类似 是否重置当前产品的计数? 的本地化字符串。
         /// </summary>
@@ -5505,6 +5541,15 @@ namespace TeamAAS_VP.Resources.Languages {
             }
         }
         
+        /// <summary>
+        ///   查找类似 过度点旋转 的本地化字符串。
+        /// </summary>
+        public static string 过度点旋转 {
+            get {
+                return ResourceManager.GetString("过度点旋转", resourceCulture);
+            }
+        }
+        
         /// <summary>
         ///   查找类似 运动结束: 的本地化字符串。
         /// </summary>
@@ -5550,6 +5595,15 @@ namespace TeamAAS_VP.Resources.Languages {
             }
         }
         
+        /// <summary>
+        ///   查找类似 运行过度点 的本地化字符串。
+        /// </summary>
+        public static string 运行过度点 {
+            get {
+                return ResourceManager.GetString("运行过度点", resourceCulture);
+            }
+        }
+        
         /// <summary>
         ///   查找类似 返回 的本地化字符串。
         /// </summary>

+ 24 - 0
TeamAAS-VM/Resources/Languages/Lang.resx

@@ -2223,4 +2223,28 @@
     <value>扫码枪接收信息时出错</value>
     <comment>扫码枪接收信息时出错</comment>
   </data>
+  <data name="运行过度点" xml:space="preserve">
+    <value>运行过度点</value>
+    <comment>运行过度点</comment>
+  </data>
+  <data name="是否运行过度点" xml:space="preserve">
+    <value>是否运行过度点</value>
+    <comment>是否运行过度点</comment>
+  </data>
+  <data name="过度点旋转" xml:space="preserve">
+    <value>过度点旋转</value>
+    <comment>过度点旋转</comment>
+  </data>
+  <data name="是否运行过度点旋转" xml:space="preserve">
+    <value>是否运行过度点旋转</value>
+    <comment>是否运行过度点旋转</comment>
+  </data>
+  <data name="是否运行到过度点位" xml:space="preserve">
+    <value>是否运行到过度点位</value>
+    <comment>是否运行到过度点位</comment>
+  </data>
+  <data name="是否运行到过度点旋转位" xml:space="preserve">
+    <value>是否运行到过度点旋转位</value>
+    <comment>是否运行到过度点旋转位</comment>
+  </data>
 </root>

+ 60 - 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";
+                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,revision";
             }
             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";
+                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,revision";
             }
 
             LogHelper.WriteLogMes($"【询问URL】{url}");
@@ -533,5 +533,63 @@ namespace TeamAAS_VP.Services
                 _eventAggregator.GetEvent<TaskMessageNotification>().Publish(new Models.MessageStruct() { Message = msg, level = level });
             });
         }
+
+        /// <summary>
+        /// 上传log服务器
+        /// </summary>
+        /// <param name="sn"></param>
+        /// <param name="name"></param>
+        /// <param name="cancellationToken"></param>
+        /// <returns></returns>
+        /// <exception cref="ObjectDisposedException"></exception>
+        public async Task<(bool IsSuccess, string Response)> SendFtpFileAsync(string sn, string name, CancellationToken cancellationToken = default)
+        {
+            // 如果已经释放,则抛出异常,防止在已释放资源上继续操作。
+            if (_disposed) throw new ObjectDisposedException(nameof(MesService));
+
+            var device = _configService.GetDeviceInfo();
+            if (device == null || !device.EnableMES)
+            {
+                return (true, "MES功能未启用!");
+            }
+            if (string.IsNullOrWhiteSpace(device.LogUrl))
+            {
+                return (false, "Missing MES station LogUrl");
+            }
+
+            string url = $"{device.LogUrl}?db=mysql&ApiKey={device.ApiKey}&jsondata={{\"SN\":\"{sn}\",\"LINE\":\"{device.Line}\",\"STATION\":\"{device.Station}\",\"TESTRESULT\":\"PASS\",\"FIXTUREID\":\"{device.FixtureId}\",\"TESTDATETIME\":\"{DateTime.Now.ToString()}\",\"LOGFILENAME\":\"{name}.zip\",\"STATIONTYPE\":\"AE\"}}";
+
+            LogHelper.WriteLogMes($"【上传LogData的URL】{url}");
+            SendTaskMessage($"【上传LogData的URL】{url}", MessageLevel.Info);
+            (bool IsSuccess, string Response) result = (false, string.Empty);
+
+            for (int i = 0; i < 3; i++)
+            {
+                try
+                {
+                    using (var rsp = await _httpClient.GetAsync(url, cancellationToken))
+                    {
+                        var text = await rsp.Content.ReadAsStringAsync();
+                        LogHelper.WriteLogMes($"【上传LogData的HTTP接收】{text}");
+                        SendTaskMessage($"【上传LogData的HTTP接收】{text}", MessageLevel.Info);
+                        // "SFC_OK" 代表和 MES 连接成功
+                        if (text.Contains("\"Code\":1"))
+                        {
+                            return (true, text);
+                        }
+                        result = (false, text);
+                    }
+                }
+                catch (OperationCanceledException)
+                {
+                    result = (false, "Canceled");
+                }
+                catch (Exception ex)
+                {
+                    result = (false, ex.Message);
+                }
+            }
+            return result;
+        }
     }
 }

+ 4 - 1
TeamAAS-VM/TeamAAS-VP.csproj

@@ -367,6 +367,8 @@
     <Reference Include="System.Formats.Asn1, Version=9.0.0.9, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
       <HintPath>..\packages\System.Formats.Asn1.9.0.9\lib\net462\System.Formats.Asn1.dll</HintPath>
     </Reference>
+    <Reference Include="System.IO.Compression" />
+    <Reference Include="System.IO.Compression.FileSystem" />
     <Reference Include="System.IO.Pipelines, Version=9.0.0.9, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
       <HintPath>..\packages\System.IO.Pipelines.9.0.9\lib\net462\System.IO.Pipelines.dll</HintPath>
     </Reference>
@@ -555,6 +557,7 @@
     <Compile Include="Core\Lights\LightModel.cs" />
     <Compile Include="Core\Lights\SerialPortProtocol.cs" />
     <Compile Include="Core\Lights\TcpProtocol.cs" />
+    <Compile Include="Core\Robots\XYZU_Robot.cs" />
     <Compile Include="Core\Scanners\NlsScanner.cs" />
     <Compile Include="Core\StabilityAnalyzer.cs" />
     <Compile Include="Enums\ScannerBrand.cs" />
@@ -575,6 +578,7 @@
     <Compile Include="Models\PLC\PlcPointAddress.cs" />
     <Compile Include="Models\PLC\PlcRobotParameter.cs" />
     <Compile Include="Models\ProductionRecord.cs" />
+    <Compile Include="Models\ProductWithMes.cs" />
     <Compile Include="Models\Scanner\ScannerInfo.cs" />
     <Compile Include="Models\ScanRs232ConfigModel.cs" />
     <Compile Include="Models\ScrewFeederBatchRecord.cs" />
@@ -638,7 +642,6 @@
     <Compile Include="Core\Cameras\CameraBase.cs" />
     <Compile Include="Core\Cameras\OptCamera.cs" />
     <Compile Include="Core\Robots\Axis.cs" />
-    <Compile Include="Core\Robots\XYZU_Robot.cs" />
     <Compile Include="Core\ScrewDriver\XYD_ScrewDriver.cs" />
     <Compile Include="Data\DatabaseInitializer.cs" />
     <Compile Include="Data\SystemDatabaseService.cs" />

+ 5 - 3
TeamAAS-VM/ViewModels/MainWindowViewModel.cs

@@ -390,9 +390,11 @@ namespace TeamAAS_VP.ViewModels
                 _eventAggregator.GetEvent<ProgressNotification>().Publish(new UProgressBar.ProgressParameter { Maximum = max, Minimum = 0, SubTitle = $"{Lang.初始化中}...", Message = $"{Lang.正在开启后台脚本}...", Value = curvalue });
             }));
             management.InitBackgroundcript();
-
-            await management.InitScan();
-
+            var sysConfig = _configService.GetSystemConfiguration();
+            if (sysConfig.ScannerUse == true)
+            {
+                await management.InitScan();
+            }
             //当前日期
             CurrentTime = Guid.NewGuid();
             Status.Add(new StatusInfo(CurrentTime, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), new SolidColorBrush(Colors.White)));

+ 73 - 13
TeamAAS-VM/ViewModels/Product/AdvancedProcedureViewModel.cs

@@ -1,4 +1,5 @@
-using Prism.Commands;
+using Cognex.VisionPro.ToolBlock;
+using Prism.Commands;
 using Prism.Events;
 using Prism.Ioc;
 using Prism.Mvvm;
@@ -8,18 +9,18 @@ using System;
 using System.Collections.Generic;
 using System.Collections.ObjectModel;
 using System.Linq;
-using TeamAAS_VP.Events;
+using System.Web.Hosting;
+using System.Windows;
+using System.Windows.Media.Media3D;
+using Team.FFFeederService;
+using Team.FFFeederService.Interfaces;
+using TeamAAS_VP;
 using TeamAAS_VP.Core;
+using TeamAAS_VP.Events;
 using TeamAAS_VP.Interfaces;
 using TeamAAS_VP.Models;
-using TeamAAS_VP;
-using System.Windows.Media.Media3D;
-using Cognex.VisionPro.ToolBlock;
-using System.Web.Hosting;
-using Team.FFFeederService;
-using System.Windows;
 using TeamAAS_VP.Resources.Languages;
-using Team.FFFeederService.Interfaces;
+using TeamAAS_VP.Services;
 
 namespace TeamAAS_VP.ViewModels.Product
 {
@@ -33,6 +34,7 @@ namespace TeamAAS_VP.ViewModels.Product
         IRobotService _robotService;
         ICameraService _cameraService;
         ISystemDatabaseService _systemDatabaseService;
+        IConfigService _configService;
 
         #region 属性
 
@@ -109,7 +111,7 @@ namespace TeamAAS_VP.ViewModels.Product
         #endregion
 
         public AdvancedProcedureViewModel(IRegionManager regionManager, IEventAggregator ea, IContainerProvider container, IDialogService dialogService,
-            IFeederService feederService, IRobotService robotService,ICameraService cameraService, ISystemDatabaseService systemDatabaseService)
+            IFeederService feederService, IRobotService robotService,ICameraService cameraService, ISystemDatabaseService systemDatabaseService, IConfigService configService)
         {
             _regionManager = regionManager;
             _eventAggregator = ea;
@@ -118,9 +120,11 @@ namespace TeamAAS_VP.ViewModels.Product
             _feederService = feederService;
             _robotService = robotService;
             _cameraService = cameraService;
+            _configService = configService;
             _systemDatabaseService = systemDatabaseService;
             //订阅权限登录事件
             _eventAggregator.GetEvent<UserLoginNotification>().Subscribe(LoginChange);
+            _configService = configService;
         }
 
         #region 方法
@@ -201,9 +205,65 @@ namespace TeamAAS_VP.ViewModels.Product
                 var image= Camera.Grab();
                 if (image != null)
                 {
-                    ToolBlockEdit.Subject.Inputs["InputImage"].Value = image;
-                    ToolBlockEdit.Subject.Run();
-                    
+                    var sysConfig = _configService.GetSystemConfiguration();
+                    if(sysConfig.PhotoAI==true)
+                    {
+                        //Model rawModel = OVCore.Shared.ReadModel("best.onnx");
+                        //PrePostProcessor pp = rawModel.CreatePrePostProcessor();
+                        //PreProcessInputInfo inputInfo = pp.Inputs.Primary;
+                        //inputInfo.TensorInfo.Layout = Layout.NHWC;
+                        //inputInfo.ModelInfo.Layout = Layout.NCHW;
+                        //inputInfo.Dispose();
+
+                        //m = pp.BuildModel();
+                        //CompiledModel cm = OVCore.Shared.CompileModel(m, "CPU");
+                        //ir = cm.CreateInferRequest();
+
+                        ////string imagepath = @"C:\Users\18896\Desktop\Image1\2025-11-11 14_01_26_result.png";
+                        ////Mat img = Cv2.ImRead(imagepath);
+                        ////SelectProcedure.ToolBlock.Inputs["InputImage"].Value = ImageHelper.MatConvertICogImage(img);
+                        //Mat src = ImageHelper.ICogImageConvertMat(SelectProcedure.ToolBlock.Outputs["OutputImage1"].Value as ICogImage);
+
+                        //Shape inputShape = m.Inputs.Primary.Shape;
+                        ////MessageBox.Show("1.2");
+                        //Size2f sizeRatio = new Size2f(1f * src.Width / inputShape[2], 1f * src.Height / inputShape[1]);
+                        //Mat resized = src.Resize(new OpenCvSharp.Size(inputShape[2], inputShape[1]));
+                        //Mat f32 = new Mat();
+                        //resized.ConvertTo(f32, MatType.CV_32FC3, 1.0 / 255);
+                        //using (Tensor input = f32.AsTensor())
+                        //{
+                        //    ir.Inputs.Primary = input;
+                        //}
+                        ////执行预测
+                        //var management = _container.Resolve<Management>();
+                        //ir.Run();
+                        //DetectionResult[] results;
+                        //using (Tensor output = ir.Outputs.Primary)
+                        //{
+                        //    ReadOnlySpan<float> data = output.GetData<float>();
+                        //    results = DetectionResult.FromYolov8DetectionResult(data, output.Shape, sizeRatio, management.dicts);
+                        //    /*Cv2.PutText(src, $"Preprocess: {preprocessTime:F2}ms", new OpenCvSharp.Point(10, 20), HersheyFonts.HersheyPlain, 3, Scalar.Red, 2);
+                        //    Cv2.PutText(src, $"Infer: {inferTime:F2}ms", new OpenCvSharp.Point(10, 40), HersheyFonts.HersheyPlain, 3, Scalar.Red, 2);
+                        //    Cv2.PutText(src, $"Postprocess: {postprocessTime:F2}ms", new OpenCvSharp.Point(10, 60), HersheyFonts.HersheyPlain, 3, Scalar.Red, 2);*/
+                        //    //Cv2.PutText(src, $"Total: {totalTime:F2}ms", new OpenCvSharp.Point(10, 80), HersheyFonts.HersheyPlain, 3, Scalar.Red);
+                        //    Cv2.PutText(src, $"detect Count: {results.Length}", new OpenCvSharp.Point(10, 120), HersheyFonts.HersheyPlain, 3, Scalar.Green, 2);
+                        //    foreach (DetectionResult r in results)
+                        //    {
+                        //        Cv2.PutText(src, $"{r.Class}:{r.Confidence:P0}", r.Rect.TopLeft, HersheyFonts.HersheyPlain, 3, Scalar.Blue, 2);
+                        //        Cv2.Rectangle(src, r.Rect, Scalar.Blue, thickness: 2);
+                        //        MessageBox.Show(r.Class);
+                        //    }
+                        //    //Cv2.ImWrite("C:\\Users\\18896\\Desktop\\1.png", src);
+                        //}
+                        //resized.Dispose();
+                        //src.Dispose();
+                        //f32.Dispose();
+                    }
+                    else
+                    {
+                        ToolBlockEdit.Subject.Inputs["InputImage"].Value = image;
+                        ToolBlockEdit.Subject.Run();
+                    }
                     Message = $"{Lang.图像采集耗时}:{Camera.TotalTime.TotalMilliseconds.ToString("F2")} ms {Lang.工具运行耗时}:{ToolBlockEdit.Subject.RunStatus.TotalTime.ToString("F2")} ms";
                 }
                 else

+ 2 - 1
TeamAAS-VM/ViewModels/Product/AutoCorrectLockPointViewModel.cs

@@ -250,7 +250,8 @@ namespace TeamAAS_VP.ViewModels.Product
                     Y = screwCameraPoint[1].Y_Position_Start,
                     Z = screwCameraPoint[1].Z_Position_Start,
                     U = screwCameraPoint[1].U_Position_Start,
-                    V = screwCameraPoint[1].R_Position,
+                    V = screwCameraPoint[1].V_Position_Start,
+                    W = screwCameraPoint[1].W_Position_Start,
                 };
                 await Robot.CalibMotionAsync(rpoint, 0);
                 if (_cts.IsCancellationRequested)

+ 272 - 0
TeamAAS-VM/ViewModels/Product/PlcPointParamsViewModel.cs

@@ -710,6 +710,142 @@ namespace TeamAAS_VP.ViewModels.Product
             {
                 return;
             }
+
+            var sysConfig = _configService.GetSystemConfiguration();
+            if(sysConfig.AxisPassUse==true)
+            {
+                float Judge_X = 0;
+                var view = new ShowMessage(Lang.运行过度点, $"{Lang.是否运行过度点}?");
+                //show the dialog
+                var result = await DialogHost.Show(view, "RootDialog", null, null, null);
+                if (result != null && result is true)
+                {
+                    try
+                    {
+                        var values1 = (object[])parameter;
+                        var curpos = await Robot.GetRobotPosAsync();
+                        Judge_X = curpos.X;
+                        var point1 = new RPoint()
+                        {
+                            X = Judge_X,
+                            Y = float.Parse("1"),
+                            Z = float.Parse("0"),
+                            U = float.Parse("0"),
+                            V = float.Parse("0"),
+                            W = float.Parse("0"),
+                        };
+                        MotionCommand motionCmd1 = (MotionCommand)values1[1];
+                        if (Robot == null || !Robot.IsConnected) return;
+                        try
+                        {
+                            Robot.Timeout = 6000000;
+                            switch (motionCmd1)
+                            {
+                                case MotionCommand.Go:
+                                    await Robot.GoAsync(point1);
+                                    break;
+                                case MotionCommand.Jump:
+                                    await Robot.JumpAsync(point1, 0);
+                                    break;
+                                case MotionCommand.Move:
+                                    await Robot.MoveAsync(point1);
+                                    break;
+                            }
+                            Robot.Timeout = 5000;
+                            _eventAggregator.GetEvent<SnackbarMessageNotification>().Publish(new MessageParameter() { Msg = $"{Lang.完成}!", Duration = 0.4 });
+                            view = new ShowMessage(Lang.运行过度点, $"{Lang.是否运行到过度点位}?");
+                            //show the dialog
+                            result = await DialogHost.Show(view, "RootDialog", null, null, null);
+                            if (result == null || result is false)
+                            {
+                                return;
+                            }
+                            view = new ShowMessage(Lang.过度点旋转, $"{Lang.是否运行过度点旋转}?");
+                            //show the dialog
+                            result = await DialogHost.Show(view, "RootDialog", null, null, null);
+                            if (result != null && result is true)
+                            {
+                                try
+                                {
+                                    var values2 = (object[])parameter;
+                                    if (curpos.X < 10)
+                                    {
+                                        Judge_X = float.Parse("87.88");
+                                    }
+                                    else
+                                    {
+                                        Judge_X = float.Parse("-2.15");
+                                    }
+                                    var point2 = new RPoint()
+                                    {
+                                        X = Judge_X,
+                                        Y = float.Parse("1"),
+                                        Z = float.Parse("0"),
+                                        U = float.Parse("0"),
+                                        V = float.Parse("0"),
+                                        W = float.Parse("0"),
+                                    };
+                                    MotionCommand motionCmd2 = (MotionCommand)values2[1];
+                                    if (Robot == null || !Robot.IsConnected) return;
+                                    try
+                                    {
+                                        Robot.Timeout = 6000000;
+                                        switch (motionCmd2)
+                                        {
+                                            case MotionCommand.Go:
+                                                await Robot.GoAsync(point2);
+                                                break;
+                                            case MotionCommand.Jump:
+                                                await Robot.JumpAsync(point2, 0);
+                                                break;
+                                            case MotionCommand.Move:
+                                                await Robot.MoveAsync(point2);
+                                                break;
+                                        }
+                                        Robot.Timeout = 5000;
+                                        _eventAggregator.GetEvent<SnackbarMessageNotification>().Publish(new MessageParameter() { Msg = $"{Lang.完成}!", Duration = 0.4 });
+                                        view = new ShowMessage(Lang.过度点旋转, $"{Lang.是否运行到过度点旋转位}?");
+                                        //show the dialog
+                                        result = await DialogHost.Show(view, "RootDialog", null, null, null);
+                                        if (result == null || result is false)
+                                        {
+                                            return;
+                                        }
+
+                                    }
+                                    catch (Exception ex)
+                                    {
+                                        LogHelper.WriteLogError("机器人点位-执行点位时出错", ex);
+                                        _eventAggregator.GetEvent<SnackbarMessageNotification>().Publish(new MessageParameter() { Msg = ex.Message, Duration = 1 });
+                                    }
+                                }
+                                catch (Exception ex)
+                                {
+                                    LogHelper.WriteLogError("机器人过度点时出错", ex);
+                                    _eventAggregator.GetEvent<SnackbarMessageNotification>().Publish(new MessageParameter() { Msg = ex.Message, Duration = 1 });
+                                }
+                            }
+
+
+
+                        }
+                        catch (Exception ex)
+                        {
+                            LogHelper.WriteLogError("机器人点位-执行点位时出错", ex);
+                            _eventAggregator.GetEvent<SnackbarMessageNotification>().Publish(new MessageParameter() { Msg = ex.Message, Duration = 1 });
+                        }
+                    }
+                    catch (Exception ex)
+                    {
+                        LogHelper.WriteLogError("机器人过度点时出错", ex);
+                        _eventAggregator.GetEvent<SnackbarMessageNotification>().Publish(new MessageParameter() { Msg = ex.Message, Duration = 1 });
+                    }
+                }
+            }
+            
+
+            
+
             var values = (object[])parameter;
             var point = new RPoint()
             {
@@ -761,6 +897,142 @@ namespace TeamAAS_VP.ViewModels.Product
             {
                 return;
             }
+
+            var sysConfig = _configService.GetSystemConfiguration();
+            if (sysConfig.AxisPassUse == true)
+            {
+                float Judge_X = 0;
+                var view = new ShowMessage(Lang.运行过度点, $"{Lang.是否运行过度点}?");
+                //show the dialog
+                var result = await DialogHost.Show(view, "RootDialog", null, null, null);
+                if (result != null && result is true)
+                {
+                    try
+                    {
+                        var values1 = (object[])parameter;
+                        var curpos = await Robot.GetRobotPosAsync();
+                        Judge_X = curpos.X;
+                        var point1 = new RPoint()
+                        {
+                            X = Judge_X,
+                            Y = float.Parse("1"),
+                            Z = float.Parse("0"),
+                            U = float.Parse("0"),
+                            V = float.Parse("0"),
+                            W = float.Parse("0"),
+                        };
+                        MotionCommand motionCmd1 = (MotionCommand)values1[1];
+                        if (Robot == null || !Robot.IsConnected) return;
+                        try
+                        {
+                            Robot.Timeout = 6000000;
+                            switch (motionCmd1)
+                            {
+                                case MotionCommand.Go:
+                                    await Robot.GoAsync(point1);
+                                    break;
+                                case MotionCommand.Jump:
+                                    await Robot.JumpAsync(point1, 0);
+                                    break;
+                                case MotionCommand.Move:
+                                    await Robot.MoveAsync(point1);
+                                    break;
+                            }
+                            Robot.Timeout = 5000;
+                            _eventAggregator.GetEvent<SnackbarMessageNotification>().Publish(new MessageParameter() { Msg = $"{Lang.完成}!", Duration = 0.4 });
+                            view = new ShowMessage(Lang.运行过度点, $"{Lang.是否运行到过度点位}?");
+                            //show the dialog
+                            result = await DialogHost.Show(view, "RootDialog", null, null, null);
+                            if (result == null || result is false)
+                            {
+                                return;
+                            }
+                            view = new ShowMessage(Lang.过度点旋转, $"{Lang.是否运行过度点旋转}?");
+                            //show the dialog
+                            result = await DialogHost.Show(view, "RootDialog", null, null, null);
+                            if (result != null && result is true)
+                            {
+                                try
+                                {
+                                    var values2 = (object[])parameter;
+                                    if (curpos.X < 10)
+                                    {
+                                        Judge_X = float.Parse("87.88");
+                                    }
+                                    else
+                                    {
+                                        Judge_X = float.Parse("-2.15");
+                                    }
+                                    var point2 = new RPoint()
+                                    {
+                                        X = Judge_X,
+                                        Y = float.Parse("1"),
+                                        Z = float.Parse("0"),
+                                        U = float.Parse("0"),
+                                        V = float.Parse("0"),
+                                        W = float.Parse("0"),
+                                    };
+                                    MotionCommand motionCmd2 = (MotionCommand)values2[1];
+                                    if (Robot == null || !Robot.IsConnected) return;
+                                    try
+                                    {
+                                        Robot.Timeout = 6000000;
+                                        switch (motionCmd2)
+                                        {
+                                            case MotionCommand.Go:
+                                                await Robot.GoAsync(point2);
+                                                break;
+                                            case MotionCommand.Jump:
+                                                await Robot.JumpAsync(point2, 0);
+                                                break;
+                                            case MotionCommand.Move:
+                                                await Robot.MoveAsync(point2);
+                                                break;
+                                        }
+                                        Robot.Timeout = 5000;
+                                        _eventAggregator.GetEvent<SnackbarMessageNotification>().Publish(new MessageParameter() { Msg = $"{Lang.完成}!", Duration = 0.4 });
+                                        view = new ShowMessage(Lang.过度点旋转, $"{Lang.是否运行到过度点旋转位}?");
+                                        //show the dialog
+                                        result = await DialogHost.Show(view, "RootDialog", null, null, null);
+                                        if (result == null || result is false)
+                                        {
+                                            return;
+                                        }
+
+                                    }
+                                    catch (Exception ex)
+                                    {
+                                        LogHelper.WriteLogError("机器人点位-执行点位时出错", ex);
+                                        _eventAggregator.GetEvent<SnackbarMessageNotification>().Publish(new MessageParameter() { Msg = ex.Message, Duration = 1 });
+                                    }
+                                }
+                                catch (Exception ex)
+                                {
+                                    LogHelper.WriteLogError("机器人过度点时出错", ex);
+                                    _eventAggregator.GetEvent<SnackbarMessageNotification>().Publish(new MessageParameter() { Msg = ex.Message, Duration = 1 });
+                                }
+                            }
+
+
+
+                        }
+                        catch (Exception ex)
+                        {
+                            LogHelper.WriteLogError("机器人点位-执行点位时出错", ex);
+                            _eventAggregator.GetEvent<SnackbarMessageNotification>().Publish(new MessageParameter() { Msg = ex.Message, Duration = 1 });
+                        }
+                    }
+                    catch (Exception ex)
+                    {
+                        LogHelper.WriteLogError("机器人过度点时出错", ex);
+                        _eventAggregator.GetEvent<SnackbarMessageNotification>().Publish(new MessageParameter() { Msg = ex.Message, Duration = 1 });
+                    }
+                }
+            }
+
+
+
+
             var values = (object[])parameter;
             var point = new RPoint()
             {

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

@@ -17,6 +17,7 @@ using System.Globalization;
 using System.IO;
 using System.Linq;
 using System.Text;
+using System.Web;
 using System.Windows;
 using Team.FFFeederService.Interfaces;
 using TeamAAS_VP.Controls;
@@ -190,6 +191,13 @@ namespace TeamAAS_VP.ViewModels
             set { SetProperty(ref _SelectPlc, value); }
         }
 
+        private ObservableCollection<ProductModel> _ProductList;
+        public ObservableCollection<ProductModel> ProductList
+        {
+            get { return _ProductList; }
+            set { SetProperty(ref _ProductList, value); }
+        }
+
         private ObservableCollection<string> _ResultsValues = new ObservableCollection<string>();
 
         public ObservableCollection<string> ResultsValues { get => _ResultsValues; set => _ResultsValues = value; }
@@ -373,6 +381,21 @@ namespace TeamAAS_VP.ViewModels
             get { return _CardReaderConfig; }
             set { SetProperty(ref _CardReaderConfig, value); }
         }
+
+        private ProductWithMes _ProMesInfo = new ProductWithMes();
+        public ProductWithMes ProMesInfo
+        {
+            get { return _ProMesInfo; }
+            set { SetProperty(ref _ProMesInfo, value); }
+        }
+
+        private ProductModel _SelectProduct;
+
+        public ProductModel SelectProduct
+        {
+            get { return _SelectProduct; }
+            set { SetProperty(ref _SelectProduct, value); }
+        }
         #endregion
 
         #region 命令
@@ -475,7 +498,18 @@ namespace TeamAAS_VP.ViewModels
         public DelegateCommand SaveCardReaderConfigCommand =>
             _SaveCardReaderConfigCommand ?? (_SaveCardReaderConfigCommand = new DelegateCommand(ExecuteSaveCardReaderConfigCommand));
 
-        
+        private DelegateCommand _GetProWithMesCommand;
+        public DelegateCommand GetProWithMesCommand =>
+            _GetProWithMesCommand ?? (_GetProWithMesCommand = new DelegateCommand(ExecuteGetProWithMesCommand));
+
+        private DelegateCommand _DeleteProWithMesCommand;
+        public DelegateCommand DeleteProWithMesCommand =>
+            _DeleteProWithMesCommand ?? (_DeleteProWithMesCommand = new DelegateCommand(ExecuteDeleteProWithMesCommand));
+
+        private DelegateCommand _SaveProWithMesCommand;
+        public DelegateCommand SaveProWithMesCommand =>
+            _SaveProWithMesCommand ?? (_SaveProWithMesCommand = new DelegateCommand(ExecuteSaveProWithMesCommandAsync));
+
         #endregion
 
         #region 事件
@@ -1396,6 +1430,14 @@ namespace TeamAAS_VP.ViewModels
                 this.PropertyChanged += OnPropertyChanged;
                 isFirstLoad = false;
             }
+            try
+            {
+                ProductList = new ObservableCollection<ProductModel>(_productService.GetAllProducts());
+            }
+            catch (Exception ex)
+            {
+                LogHelper.WriteLogError("加载产品列表时出错", ex);
+            }
         }
 
         /// <summary>
@@ -1649,5 +1691,58 @@ namespace TeamAAS_VP.ViewModels
             }
         }
         #endregion
+
+        #region 产品与mes绑定
+
+        private async void ExecuteGetProWithMesCommand()
+        {
+            var v = await _systemDatabaseService.QueryProductWithMesAsync(SelectProduct);
+            if (v == null)
+            {
+                ProMesInfo.ProductCode = "";
+                ProMesInfo.ProductColor = "";
+                ProMesInfo.ProductLoadMode = 0;
+            }
+            else
+            {
+                ProMesInfo.ProductCode = v.ProductCode;
+                ProMesInfo.ProductColor = v.ProductColor;
+                ProMesInfo.ProductLoadMode = v.ProductLoadMode;
+            }
+        }
+
+        private async void ExecuteDeleteProWithMesCommand()
+        {
+            var v = await _systemDatabaseService.DeleteProWithMesAsync(SelectProduct);
+            if (v > 0)
+            {
+                _eventAggregator.GetEvent<SnackbarMessageNotification>().Publish(new MessageParameter() { Msg = "删除成功", Duration = 1 });
+                var F = await _systemDatabaseService.QueryProductWithMesAsync(SelectProduct);
+                if (F == null)
+                {
+                    ProMesInfo.ProductCode = "";
+                    ProMesInfo.ProductColor = "";
+                    ProMesInfo.ProductLoadMode = 0;
+                }
+            }
+        }
+        private async void ExecuteSaveProWithMesCommandAsync()
+        {
+            var v = await _systemDatabaseService.QueryProductWithMesAsync(SelectProduct);
+            if (v == null)
+            {
+                await _systemDatabaseService.InsertProWithMesAsync(ProMesInfo, SelectProduct);
+                _eventAggregator.GetEvent<SnackbarMessageNotification>().Publish(new MessageParameter() { Msg = "添加成功", Duration = 1 });
+            }
+            else
+            {
+                var n = await _systemDatabaseService.UpdateProductWithMesAsync(ProMesInfo, SelectProduct);
+                if (n > 0)
+                {
+                    _eventAggregator.GetEvent<SnackbarMessageNotification>().Publish(new MessageParameter() { Msg = "更新成功", Duration = 1 });
+                }
+            }
+        }
+        #endregion
     }
 }

+ 317 - 0
TeamAAS-VM/Views/Home/ShowVisionRender.xaml.cs

@@ -153,6 +153,14 @@ namespace TeamAAS_VP.Views.Home
         Grid grid10 = new Grid();
         Grid grid11 = new Grid();
         Grid grid12 = new Grid();
+        Grid grid13 = new Grid();
+        Grid grid14 = new Grid();
+        Grid grid15 = new Grid();
+        Grid grid16 = new Grid();
+        Grid grid17 = new Grid();
+        Grid grid18 = new Grid();
+        Grid grid19 = new Grid();
+        Grid grid20 = new Grid();
         private void ViewModel_UpdateLayout(System.Collections.ObjectModel.ObservableCollection<Models.ShowRender> obj)
         {
             System.Windows.Media.FontFamily font = Application.Current.Resources["DefaultFont"] as System.Windows.Media.FontFamily;
@@ -1180,6 +1188,315 @@ namespace TeamAAS_VP.Views.Home
                         ((Cognex.VisionPro.CogRecordDisplay)((WindowsFormsHost)vmRenders[obj[i].Id]).Child).BackColor = System.Drawing.SystemColors.ActiveCaption;
                     }
                     break;
+                case 20:
+                    //增加显示界面
+                    vmRenders.Add(obj[0].Id, new WindowsFormsHost() { Tag = obj[0].DisplayName, Child = new Cognex.VisionPro.CogRecordDisplay() { Tag = obj[0].DisplayName } });
+                    vmRenders.Add(obj[1].Id, new WindowsFormsHost() { Tag = obj[1].DisplayName, Child = new Cognex.VisionPro.CogRecordDisplay() { Tag = obj[1].DisplayName } });
+                    vmRenders.Add(obj[2].Id, new WindowsFormsHost() { Tag = obj[2].DisplayName, Child = new Cognex.VisionPro.CogRecordDisplay() { Tag = obj[2].DisplayName } });
+                    vmRenders.Add(obj[3].Id, new WindowsFormsHost() { Tag = obj[3].DisplayName, Child = new Cognex.VisionPro.CogRecordDisplay() { Tag = obj[3].DisplayName } });
+                    vmRenders.Add(obj[4].Id, new WindowsFormsHost() { Tag = obj[4].DisplayName, Child = new Cognex.VisionPro.CogRecordDisplay() { Tag = obj[4].DisplayName } });
+                    vmRenders.Add(obj[5].Id, new WindowsFormsHost() { Tag = obj[5].DisplayName, Child = new Cognex.VisionPro.CogRecordDisplay() { Tag = obj[5].DisplayName } });
+                    vmRenders.Add(obj[6].Id, new WindowsFormsHost() { Tag = obj[6].DisplayName, Child = new Cognex.VisionPro.CogRecordDisplay() { Tag = obj[6].DisplayName } });
+                    vmRenders.Add(obj[7].Id, new WindowsFormsHost() { Tag = obj[7].DisplayName, Child = new Cognex.VisionPro.CogRecordDisplay() { Tag = obj[7].DisplayName } });
+                    vmRenders.Add(obj[8].Id, new WindowsFormsHost() { Tag = obj[8].DisplayName, Child = new Cognex.VisionPro.CogRecordDisplay() { Tag = obj[8].DisplayName } });
+                    vmRenders.Add(obj[9].Id, new WindowsFormsHost() { Tag = obj[9].DisplayName, Child = new Cognex.VisionPro.CogRecordDisplay() { Tag = obj[9].DisplayName } });
+                    vmRenders.Add(obj[10].Id, new WindowsFormsHost() { Tag = obj[10].DisplayName, Child = new Cognex.VisionPro.CogRecordDisplay() { Tag = obj[10].DisplayName } });
+                    vmRenders.Add(obj[11].Id, new WindowsFormsHost() { Tag = obj[11].DisplayName, Child = new Cognex.VisionPro.CogRecordDisplay() { Tag = obj[11].DisplayName } });
+                    vmRenders.Add(obj[12].Id, new WindowsFormsHost() { Tag = obj[12].DisplayName, Child = new Cognex.VisionPro.CogRecordDisplay() { Tag = obj[12].DisplayName } });
+                    vmRenders.Add(obj[13].Id, new WindowsFormsHost() { Tag = obj[13].DisplayName, Child = new Cognex.VisionPro.CogRecordDisplay() { Tag = obj[13].DisplayName } });
+                    vmRenders.Add(obj[14].Id, new WindowsFormsHost() { Tag = obj[14].DisplayName, Child = new Cognex.VisionPro.CogRecordDisplay() { Tag = obj[14].DisplayName } });
+                    vmRenders.Add(obj[15].Id, new WindowsFormsHost() { Tag = obj[15].DisplayName, Child = new Cognex.VisionPro.CogRecordDisplay() { Tag = obj[15].DisplayName } });
+                    vmRenders.Add(obj[16].Id, new WindowsFormsHost() { Tag = obj[16].DisplayName, Child = new Cognex.VisionPro.CogRecordDisplay() { Tag = obj[16].DisplayName } });
+                    vmRenders.Add(obj[17].Id, new WindowsFormsHost() { Tag = obj[17].DisplayName, Child = new Cognex.VisionPro.CogRecordDisplay() { Tag = obj[17].DisplayName } });
+                    vmRenders.Add(obj[18].Id, new WindowsFormsHost() { Tag = obj[18].DisplayName, Child = new Cognex.VisionPro.CogRecordDisplay() { Tag = obj[18].DisplayName } });
+                    vmRenders.Add(obj[19].Id, new WindowsFormsHost() { Tag = obj[19].DisplayName, Child = new Cognex.VisionPro.CogRecordDisplay() { Tag = obj[19].DisplayName } });
+                    //vmRenders.Add(obj[20].Id, new WindowsFormsHost() { Tag = obj[20].DisplayName, Child = new Cognex.VisionPro.CogRecordDisplay() { Tag = obj[20].DisplayName } });
+                    Titles.Add(obj[0].Id, new TextBlock() { Text = obj[0].DisplayName, HorizontalAlignment = System.Windows.HorizontalAlignment.Center, FontWeight = FontWeights.Bold, FontFamily = font, FontSize = 12, Foreground = System.Windows.Media.Brushes.Black });
+                    Titles.Add(obj[1].Id, new TextBlock() { Text = obj[1].DisplayName, HorizontalAlignment = System.Windows.HorizontalAlignment.Center, FontWeight = FontWeights.Bold, FontFamily = font, FontSize = 12, Foreground = System.Windows.Media.Brushes.Black });
+                    Titles.Add(obj[2].Id, new TextBlock() { Text = obj[2].DisplayName, HorizontalAlignment = System.Windows.HorizontalAlignment.Center, FontWeight = FontWeights.Bold, FontFamily = font, FontSize = 12, Foreground = System.Windows.Media.Brushes.Black });
+                    Titles.Add(obj[3].Id, new TextBlock() { Text = obj[3].DisplayName, HorizontalAlignment = System.Windows.HorizontalAlignment.Center, FontWeight = FontWeights.Bold, FontFamily = font, FontSize = 12, Foreground = System.Windows.Media.Brushes.Black });
+                    Titles.Add(obj[4].Id, new TextBlock() { Text = obj[4].DisplayName, HorizontalAlignment = System.Windows.HorizontalAlignment.Center, FontWeight = FontWeights.Bold, FontFamily = font, FontSize = 12, Foreground = System.Windows.Media.Brushes.Black });
+                    Titles.Add(obj[5].Id, new TextBlock() { Text = obj[5].DisplayName, HorizontalAlignment = System.Windows.HorizontalAlignment.Center, FontWeight = FontWeights.Bold, FontFamily = font, FontSize = 12, Foreground = System.Windows.Media.Brushes.Black });
+                    Titles.Add(obj[6].Id, new TextBlock() { Text = obj[6].DisplayName, HorizontalAlignment = System.Windows.HorizontalAlignment.Center, FontWeight = FontWeights.Bold, FontFamily = font, FontSize = 12, Foreground = System.Windows.Media.Brushes.Black });
+                    Titles.Add(obj[7].Id, new TextBlock() { Text = obj[7].DisplayName, HorizontalAlignment = System.Windows.HorizontalAlignment.Center, FontWeight = FontWeights.Bold, FontFamily = font, FontSize = 12, Foreground = System.Windows.Media.Brushes.Black });
+                    Titles.Add(obj[8].Id, new TextBlock() { Text = obj[8].DisplayName, HorizontalAlignment = System.Windows.HorizontalAlignment.Center, FontWeight = FontWeights.Bold, FontFamily = font, FontSize = 12, Foreground = System.Windows.Media.Brushes.Black });
+                    Titles.Add(obj[9].Id, new TextBlock() { Text = obj[9].DisplayName, HorizontalAlignment = System.Windows.HorizontalAlignment.Center, FontWeight = FontWeights.Bold, FontFamily = font, FontSize = 12, Foreground = System.Windows.Media.Brushes.Black });
+                    Titles.Add(obj[10].Id, new TextBlock() { Text = obj[10].DisplayName, HorizontalAlignment = System.Windows.HorizontalAlignment.Center, FontWeight = FontWeights.Bold, FontFamily = font, FontSize = 12, Foreground = System.Windows.Media.Brushes.Black });
+                    Titles.Add(obj[11].Id, new TextBlock() { Text = obj[11].DisplayName, HorizontalAlignment = System.Windows.HorizontalAlignment.Center, FontWeight = FontWeights.Bold, FontFamily = font, FontSize = 12, Foreground = System.Windows.Media.Brushes.Black });
+                    Titles.Add(obj[12].Id, new TextBlock() { Text = obj[12].DisplayName, HorizontalAlignment = System.Windows.HorizontalAlignment.Center, FontWeight = FontWeights.Bold, FontFamily = font, FontSize = 12, Foreground = System.Windows.Media.Brushes.Black });
+                    Titles.Add(obj[13].Id, new TextBlock() { Text = obj[13].DisplayName, HorizontalAlignment = System.Windows.HorizontalAlignment.Center, FontWeight = FontWeights.Bold, FontFamily = font, FontSize = 12, Foreground = System.Windows.Media.Brushes.Black });
+                    Titles.Add(obj[14].Id, new TextBlock() { Text = obj[14].DisplayName, HorizontalAlignment = System.Windows.HorizontalAlignment.Center, FontWeight = FontWeights.Bold, FontFamily = font, FontSize = 12, Foreground = System.Windows.Media.Brushes.Black });
+                    Titles.Add(obj[15].Id, new TextBlock() { Text = obj[15].DisplayName, HorizontalAlignment = System.Windows.HorizontalAlignment.Center, FontWeight = FontWeights.Bold, FontFamily = font, FontSize = 12, Foreground = System.Windows.Media.Brushes.Black });
+                    Titles.Add(obj[16].Id, new TextBlock() { Text = obj[16].DisplayName, HorizontalAlignment = System.Windows.HorizontalAlignment.Center, FontWeight = FontWeights.Bold, FontFamily = font, FontSize = 12, Foreground = System.Windows.Media.Brushes.Black });
+                    Titles.Add(obj[17].Id, new TextBlock() { Text = obj[17].DisplayName, HorizontalAlignment = System.Windows.HorizontalAlignment.Center, FontWeight = FontWeights.Bold, FontFamily = font, FontSize = 12, Foreground = System.Windows.Media.Brushes.Black });
+                    Titles.Add(obj[18].Id, new TextBlock() { Text = obj[18].DisplayName, HorizontalAlignment = System.Windows.HorizontalAlignment.Center, FontWeight = FontWeights.Bold, FontFamily = font, FontSize = 12, Foreground = System.Windows.Media.Brushes.Black });
+                    Titles.Add(obj[19].Id, new TextBlock() { Text = obj[19].DisplayName, HorizontalAlignment = System.Windows.HorizontalAlignment.Center, FontWeight = FontWeights.Bold, FontFamily = font, FontSize = 12, Foreground = System.Windows.Media.Brushes.Black });
+                    //Titles.Add(obj[20].Id, new TextBlock() { Text = obj[19].DisplayName, HorizontalAlignment = System.Windows.HorizontalAlignment.Center, FontWeight = FontWeights.Bold, FontFamily = font, FontSize = 12, Foreground = System.Windows.Media.Brushes.Black });
+                    //布局
+                    gridRender.RowDefinitions.Add(new RowDefinition());
+                    gridRender.RowDefinitions.Add(new RowDefinition());
+                    gridRender.RowDefinitions.Add(new RowDefinition());
+                    gridRender.RowDefinitions.Add(new RowDefinition());
+                    gridRender.RowDefinitions.Add(new RowDefinition());
+                    gridRender.ColumnDefinitions.Add(new ColumnDefinition());
+                    gridRender.ColumnDefinitions.Add(new ColumnDefinition());
+                    gridRender.ColumnDefinitions.Add(new ColumnDefinition());
+                    gridRender.ColumnDefinitions.Add(new ColumnDefinition());
+                    gridRender.ShowGridLines = true;
+                    grid1 = new Grid();
+                    grid2 = new Grid();
+                    grid3 = new Grid();
+                    grid4 = new Grid();
+                    grid5 = new Grid();
+                    grid6 = new Grid();
+                    grid7 = new Grid();
+                    grid8 = new Grid();
+                    grid9 = new Grid();
+                    grid10 = new Grid();
+                    grid11 = new Grid();
+                    grid12 = new Grid();
+                    grid13 = new Grid();
+                    grid14 = new Grid();
+                    grid15 = new Grid();
+                    grid16 = new Grid();
+                    grid17 = new Grid();
+                    grid18 = new Grid();
+                    grid19 = new Grid();
+                    grid20 = new Grid();
+                    grid1.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Auto) });
+                    grid1.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) });
+                    grid2.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Auto) });
+                    grid2.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) });
+                    grid3.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Auto) });
+                    grid3.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) });
+                    grid4.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Auto) });
+                    grid4.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) });
+                    grid5.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Auto) });
+                    grid5.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) });
+                    grid6.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Auto) });
+                    grid6.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) });
+                    grid7.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Auto) });
+                    grid7.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) });
+                    grid8.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Auto) });
+                    grid8.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) });
+                    grid9.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Auto) });
+                    grid9.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) });
+                    grid10.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Auto) });
+                    grid10.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) });
+                    grid11.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Auto) });
+                    grid11.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) });
+                    grid12.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Auto) });
+                    grid12.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) });
+                    grid13.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Auto) });
+                    grid13.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) });
+                    grid14.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Auto) });
+                    grid14.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) });
+                    grid15.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Auto) });
+                    grid15.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) });
+                    grid16.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Auto) });
+                    grid16.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) });
+                    grid17.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Auto) });
+                    grid17.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) });
+                    grid18.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Auto) });
+                    grid18.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) });
+                    grid19.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Auto) });
+                    grid19.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) });
+                    grid20.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Auto) });
+                    grid20.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) });
+                    gridRender.Children.Add(grid1);
+                    gridRender.Children.Add(grid2);
+                    gridRender.Children.Add(grid3);
+                    gridRender.Children.Add(grid4);
+                    gridRender.Children.Add(grid5);
+                    gridRender.Children.Add(grid6);
+                    gridRender.Children.Add(grid7);
+                    gridRender.Children.Add(grid8);
+                    gridRender.Children.Add(grid9);
+                    gridRender.Children.Add(grid10);
+                    gridRender.Children.Add(grid11);
+                    gridRender.Children.Add(grid12);
+                    gridRender.Children.Add(grid13);
+                    gridRender.Children.Add(grid14);
+                    gridRender.Children.Add(grid15);
+                    gridRender.Children.Add(grid16);
+                    gridRender.Children.Add(grid17);
+                    gridRender.Children.Add(grid18);
+                    gridRender.Children.Add(grid19);
+                    gridRender.Children.Add(grid20);
+                    Grid.SetRow(grid1, 0);
+                    Grid.SetColumn(grid1, 0);
+                    Grid.SetRow(grid2, 0);
+                    Grid.SetColumn(grid2, 1);
+                    Grid.SetRow(grid3, 0);
+                    Grid.SetColumn(grid3, 2);
+                    Grid.SetRow(grid4, 0);
+                    Grid.SetColumn(grid4, 3);
+                    Grid.SetRow(grid5, 1);
+                    Grid.SetColumn(grid5, 0);
+                    Grid.SetRow(grid6, 1);
+                    Grid.SetColumn(grid6, 1);
+                    Grid.SetRow(grid7, 1);
+                    Grid.SetColumn(grid7, 2);
+                    Grid.SetRow(grid8, 1);
+                    Grid.SetColumn(grid8, 3);
+                    Grid.SetRow(grid9, 2);
+                    Grid.SetColumn(grid9, 0);
+                    Grid.SetRow(grid10, 2);
+                    Grid.SetColumn(grid10, 1);
+                    Grid.SetRow(grid11, 2);
+                    Grid.SetColumn(grid11, 2);
+                    Grid.SetRow(grid12, 2);
+                    Grid.SetColumn(grid12, 3);
+                    Grid.SetRow(grid13, 3);
+                    Grid.SetColumn(grid13, 0);
+                    Grid.SetRow(grid14, 3);
+                    Grid.SetColumn(grid14, 1);
+                    Grid.SetRow(grid15, 3);
+                    Grid.SetColumn(grid15, 2);
+                    Grid.SetRow(grid16, 3);
+                    Grid.SetColumn(grid16, 3);
+                    Grid.SetRow(grid17, 4);
+                    Grid.SetColumn(grid17, 0);
+                    Grid.SetRow(grid18, 4);
+                    Grid.SetColumn(grid18, 1);
+                    Grid.SetRow(grid19, 4);
+                    Grid.SetColumn(grid19, 2);
+                    Grid.SetRow(grid20, 4);
+                    Grid.SetColumn(grid20, 3);
+
+
+                    grid1.Children.Add(vmRenders[obj[0].Id]);
+                    grid2.Children.Add(vmRenders[obj[1].Id]);
+                    grid3.Children.Add(vmRenders[obj[2].Id]);
+                    grid4.Children.Add(vmRenders[obj[3].Id]);
+                    grid5.Children.Add(vmRenders[obj[4].Id]);
+                    grid6.Children.Add(vmRenders[obj[5].Id]);
+                    grid7.Children.Add(vmRenders[obj[6].Id]);
+                    grid8.Children.Add(vmRenders[obj[7].Id]);
+                    grid9.Children.Add(vmRenders[obj[8].Id]);
+                    grid10.Children.Add(vmRenders[obj[9].Id]);
+                    grid11.Children.Add(vmRenders[obj[10].Id]);
+                    grid12.Children.Add(vmRenders[obj[11].Id]);
+                    grid13.Children.Add(vmRenders[obj[12].Id]);
+                    grid14.Children.Add(vmRenders[obj[13].Id]);
+                    grid15.Children.Add(vmRenders[obj[14].Id]);
+                    grid16.Children.Add(vmRenders[obj[15].Id]);
+                    grid17.Children.Add(vmRenders[obj[16].Id]);
+                    grid18.Children.Add(vmRenders[obj[17].Id]);
+                    grid19.Children.Add(vmRenders[obj[18].Id]);
+                    grid20.Children.Add(vmRenders[obj[19].Id]);
+
+
+                    grid1.Children.Add(Titles[obj[0].Id]);
+                    grid2.Children.Add(Titles[obj[1].Id]);
+                    grid3.Children.Add(Titles[obj[2].Id]);
+                    grid4.Children.Add(Titles[obj[3].Id]);
+                    grid5.Children.Add(Titles[obj[4].Id]);
+                    grid6.Children.Add(Titles[obj[5].Id]);
+                    grid7.Children.Add(Titles[obj[6].Id]);
+                    grid8.Children.Add(Titles[obj[7].Id]);
+                    grid9.Children.Add(Titles[obj[8].Id]);
+                    grid10.Children.Add(Titles[obj[9].Id]);
+                    grid11.Children.Add(Titles[obj[10].Id]);
+                    grid12.Children.Add(Titles[obj[11].Id]);
+                    grid13.Children.Add(Titles[obj[12].Id]);
+                    grid14.Children.Add(Titles[obj[13].Id]);
+                    grid15.Children.Add(Titles[obj[14].Id]);
+                    grid16.Children.Add(Titles[obj[15].Id]);
+                    grid17.Children.Add(Titles[obj[16].Id]);
+                    grid18.Children.Add(Titles[obj[17].Id]);
+                    grid19.Children.Add(Titles[obj[18].Id]);
+                    grid20.Children.Add(Titles[obj[19].Id]);
+
+                    Grid.SetRow(Titles[obj[0].Id], 0);
+                    Grid.SetColumn(Titles[obj[0].Id], 0);
+                    Grid.SetRow(Titles[obj[1].Id], 0);
+                    Grid.SetColumn(Titles[obj[1].Id], 0);
+                    Grid.SetRow(Titles[obj[2].Id], 0);
+                    Grid.SetColumn(Titles[obj[2].Id], 0);
+                    Grid.SetRow(Titles[obj[3].Id], 0);
+                    Grid.SetColumn(Titles[obj[3].Id], 0);
+                    Grid.SetRow(Titles[obj[4].Id], 0);
+                    Grid.SetColumn(Titles[obj[4].Id], 0);
+                    Grid.SetRow(Titles[obj[5].Id], 0);
+                    Grid.SetColumn(Titles[obj[5].Id], 0);
+                    Grid.SetRow(Titles[obj[6].Id], 0);
+                    Grid.SetColumn(Titles[obj[6].Id], 0);
+                    Grid.SetRow(Titles[obj[7].Id], 0);
+                    Grid.SetColumn(Titles[obj[7].Id], 0);
+                    Grid.SetRow(Titles[obj[8].Id], 0);
+                    Grid.SetColumn(Titles[obj[8].Id], 0);
+                    Grid.SetRow(Titles[obj[9].Id], 0);
+                    Grid.SetColumn(Titles[obj[9].Id], 0);
+                    Grid.SetRow(Titles[obj[10].Id], 0);
+                    Grid.SetColumn(Titles[obj[10].Id], 0);
+                    Grid.SetRow(Titles[obj[11].Id], 0);
+                    Grid.SetColumn(Titles[obj[11].Id], 0);
+                    Grid.SetRow(Titles[obj[12].Id], 0);
+                    Grid.SetColumn(Titles[obj[12].Id], 0);
+                    Grid.SetRow(Titles[obj[13].Id], 0);
+                    Grid.SetColumn(Titles[obj[13].Id], 0);
+                    Grid.SetRow(Titles[obj[14].Id], 0);
+                    Grid.SetColumn(Titles[obj[14].Id], 0);
+                    Grid.SetRow(Titles[obj[15].Id], 0);
+                    Grid.SetColumn(Titles[obj[15].Id], 0);
+                    Grid.SetRow(Titles[obj[16].Id], 0);
+                    Grid.SetColumn(Titles[obj[16].Id], 0);
+                    Grid.SetRow(Titles[obj[17].Id], 0);
+                    Grid.SetColumn(Titles[obj[17].Id], 0);
+                    Grid.SetRow(Titles[obj[18].Id], 0);
+                    Grid.SetColumn(Titles[obj[18].Id], 0);
+                    Grid.SetRow(Titles[obj[19].Id], 0);
+                    Grid.SetColumn(Titles[obj[19].Id], 0);
+
+                    Grid.SetRow(vmRenders[obj[0].Id], 1);
+                    Grid.SetColumn(vmRenders[obj[0].Id], 0);
+                    Grid.SetRow(vmRenders[obj[1].Id], 1);
+                    Grid.SetColumn(vmRenders[obj[1].Id], 0);
+                    Grid.SetRow(vmRenders[obj[2].Id], 1);
+                    Grid.SetColumn(vmRenders[obj[2].Id], 0);
+                    Grid.SetRow(vmRenders[obj[3].Id], 1);
+                    Grid.SetColumn(vmRenders[obj[3].Id], 0);
+                    Grid.SetRow(vmRenders[obj[4].Id], 1);
+                    Grid.SetColumn(vmRenders[obj[4].Id], 0);
+                    Grid.SetRow(vmRenders[obj[5].Id], 1);
+                    Grid.SetColumn(vmRenders[obj[5].Id], 0);
+                    Grid.SetRow(vmRenders[obj[6].Id], 1);
+                    Grid.SetColumn(vmRenders[obj[6].Id], 0);
+                    Grid.SetRow(vmRenders[obj[7].Id], 1);
+                    Grid.SetColumn(vmRenders[obj[7].Id], 0);
+                    Grid.SetRow(vmRenders[obj[8].Id], 1);
+                    Grid.SetColumn(vmRenders[obj[8].Id], 0);
+                    Grid.SetRow(vmRenders[obj[9].Id], 1);
+                    Grid.SetColumn(vmRenders[obj[9].Id], 0);
+                    Grid.SetRow(vmRenders[obj[10].Id], 1);
+                    Grid.SetColumn(vmRenders[obj[10].Id], 0);
+                    Grid.SetRow(vmRenders[obj[11].Id], 1);
+                    Grid.SetColumn(vmRenders[obj[11].Id], 0);
+                    Grid.SetRow(vmRenders[obj[12].Id], 1);
+                    Grid.SetColumn(vmRenders[obj[12].Id], 0);
+                    Grid.SetRow(vmRenders[obj[13].Id], 1);
+                    Grid.SetColumn(vmRenders[obj[13].Id], 0);
+                    Grid.SetRow(vmRenders[obj[14].Id], 1);
+                    Grid.SetColumn(vmRenders[obj[14].Id], 0);
+                    Grid.SetRow(vmRenders[obj[15].Id], 1);
+                    Grid.SetColumn(vmRenders[obj[15].Id], 0);
+                    Grid.SetRow(vmRenders[obj[16].Id], 1);
+                    Grid.SetColumn(vmRenders[obj[16].Id], 0);
+                    Grid.SetRow(vmRenders[obj[17].Id], 1);
+                    Grid.SetColumn(vmRenders[obj[17].Id], 0);
+                    Grid.SetRow(vmRenders[obj[18].Id], 1);
+                    Grid.SetColumn(vmRenders[obj[18].Id], 0);
+                    Grid.SetRow(vmRenders[obj[19].Id], 1);
+                    Grid.SetColumn(vmRenders[obj[19].Id], 0);
+                    for (int i = 0; i < 20; i++)
+                    {
+                        ((Cognex.VisionPro.CogRecordDisplay)((WindowsFormsHost)vmRenders[obj[i].Id]).Child).HorizontalScrollBar = false;
+                        ((Cognex.VisionPro.CogRecordDisplay)((WindowsFormsHost)vmRenders[obj[i].Id]).Child).VerticalScrollBar = false;
+                        ((Cognex.VisionPro.CogRecordDisplay)((WindowsFormsHost)vmRenders[obj[i].Id]).Child).AutoFit = true;
+                        ((Cognex.VisionPro.CogRecordDisplay)((WindowsFormsHost)vmRenders[obj[i].Id]).Child).BackColor = System.Drawing.SystemColors.ActiveCaption;
+                    }
+                    break;
                 default:
                     break;
             }

+ 211 - 9
TeamAAS-VM/Views/SettingView.xaml

@@ -22,7 +22,7 @@
              lex:LocalizeDictionary.DesignCulture="zh-CN"
              mc:Ignorable="d"
              d:DataContext="{d:DesignInstance Type=vm:SettingViewModel}"
-             d:Height="600"
+             d:Height="1080"
              d:Width="1024"
              d:Background="White"
              x:Class="TeamAAS_VP.Views.SettingView"
@@ -627,33 +627,54 @@
                              Grid.Column="1"
                              Text="{Binding DeviceInfo.comp, Mode=TwoWay}"
                              Margin="6,2" />
-
+                    
                     <TextBlock Grid.Row="9"
+                       Grid.Column="0"
+                       Text="LogUrl:"
+                       HorizontalAlignment="Right"
+                       VerticalAlignment="Center" />
+                    <TextBox Grid.Row="9"
+                         Grid.Column="1"
+                         Text="{Binding SelectDeviceInfo.LogUrl, Mode=TwoWay}"
+                         Margin="6,2" />
+
+                    <TextBlock Grid.Row="10"
+                       Grid.Column="0"
+                       Text="apikey:"
+                       HorizontalAlignment="Right"
+                       VerticalAlignment="Center" />
+                    <TextBox Grid.Row="10"
+                         Grid.Column="1"
+                         Text="{Binding SelectDeviceInfo.ApiKey, Mode=TwoWay}"
+                         Margin="6,2" />
+
+
+                    <TextBlock Grid.Row="11"
                                Grid.Column="0"
                                Text="启用 MES:"
                                HorizontalAlignment="Right"
                                VerticalAlignment="Center" />
-                    <CheckBox Grid.Row="9"
+                    <CheckBox Grid.Row="11"
                               Grid.Column="1"
                               IsChecked="{Binding DeviceInfo.EnableMES, Mode=TwoWay}"
                               Margin="6,2" />
-                    <CheckBox Grid.Row="10"
+                    <CheckBox Grid.Row="12"
                               Grid.Column="1"
                               Content="是否启用两次产品编号"
                               IsChecked="{Binding DeviceInfo.EnableDoubleMes, Mode=TwoWay}"
                               Margin="6,2" />
-                    <CheckBox Grid.Row="11"
+                    <CheckBox Grid.Row="13"
                               Grid.Column="1"
                               Content="是否保存CSV文件"
                               IsChecked="{Binding DeviceInfo.SaveCsv, Mode=TwoWay}"
                               Margin="6,2" />
-                    <TextBlock Grid.Row="12"
+                    <TextBlock Grid.Row="14"
                                Grid.Column="0"
                                Text="保存的CSV文件路径:"
                                HorizontalAlignment="Right"
                                VerticalAlignment="Center" />
                     <DockPanel HorizontalAlignment="Stretch"
-                               Grid.Row="12"
+                               Grid.Row="14"
                                Grid.Column="1"
                                Margin="6,2">
                         <Button DockPanel.Dock="Right"
@@ -668,12 +689,12 @@
 
                     </DockPanel>
                     <!--CTQ 数据信息-->
-                    <TextBlock Grid.Row="13"
+                    <TextBlock Grid.Row="15"
                                Grid.Column="0"
                                Text="PROCESS_NAME:"
                                HorizontalAlignment="Right"
                                VerticalAlignment="Center" />
-                    <TextBox Grid.Row="13"
+                    <TextBox Grid.Row="15"
                              Grid.Column="1"
                              Text="{Binding DeviceInfo.DataInfo.PROCESS_NAME, Mode=TwoWay}"
                              Margin="6,2" />
@@ -2827,6 +2848,187 @@
                 </StackPanel>
             </TabItem>
 
+            <!--产品信息-->
+            <TabItem>
+                <TabItem.Header>
+                    <StackPanel HorizontalAlignment="Stretch">
+                        <materialDesign:PackIcon Width="24"
+                                     Height="24"
+                                     HorizontalAlignment="Center"
+                                     Kind="BallotOutline" />
+                        <TextBlock Style="{StaticResource TabHeaderTextBlockStyle}"
+                       FontSize="{DynamicResource Font.Size.Body2}"
+                       Text="产品信息"
+                       HorizontalAlignment="Stretch" />
+                    </StackPanel>
+                </TabItem.Header>
+
+                <StackPanel Margin="16">
+
+                    <GroupBox HorizontalAlignment="Left"
+                  Margin="10,5"
+                  Header="产品与mes参数绑定设置"
+                  Width="400"
+                  FontSize="{DynamicResource Font.Size.Title4}">
+                        <Grid Margin="20">
+                            <Grid.ColumnDefinitions>
+                                <ColumnDefinition Width="auto" />
+                                <ColumnDefinition Width="auto" />
+                            </Grid.ColumnDefinitions>
+                            <Grid.RowDefinitions>
+                                <RowDefinition Height=" auto" />
+                                <RowDefinition Height=" auto" />
+                                <RowDefinition Height=" auto" />
+                                <RowDefinition Height=" auto" />
+                                <RowDefinition Height=" auto" />
+                            </Grid.RowDefinitions>
+
+                            <TextBlock Margin="0,0,0,8"
+                           Text="产品名称:"
+                           VerticalAlignment="Center"
+                           FontSize="{DynamicResource Font.Size.Body3}"
+                           HorizontalAlignment="Right" />
+                            <ComboBox x:Name="selectProduct"
+                          Grid.Column="1"
+                          Width="100"
+                          Margin="10,4"
+                          FontSize="14"
+                          materialDesign:HintAssist.Hint="{lex:Loc 选择产品}"
+                          SelectedItem="{Binding SelectProduct,Mode=TwoWay}"
+                          ItemsSource="{Binding ProductList,Mode=TwoWay}"
+                          HorizontalAlignment="Left">
+                                <ComboBox.ItemTemplate>
+                                    <DataTemplate>
+                                        <StackPanel Orientation="Vertical">
+                                            <StackPanel Orientation="Horizontal">
+                                                <materialDesign:PackIcon Kind="CubeOutline" />
+                                                <TextBlock Text="{Binding Name}" />
+                                            </StackPanel>
+                                            <TextBlock Text="{Binding Description}"
+                                           MinHeight="0"
+                                           MaxWidth="300"
+                                           Foreground="Gray"
+                                           TextTrimming="CharacterEllipsis"
+                                           FontSize="{DynamicResource Font.Size.Captions4}"
+                                           TextWrapping="Wrap" />
+                                        </StackPanel>
+                                    </DataTemplate>
+                                </ComboBox.ItemTemplate>
+                            </ComboBox>
+                            <TextBlock Margin="0,0,0,8"
+                           Grid.Row="1"
+                           Text="产品编码(model):"
+                           VerticalAlignment="Center"
+                           FontSize="{DynamicResource Font.Size.Body3}"
+                           HorizontalAlignment="Right" />
+                            <TextBox Grid.Row="1"
+                         Grid.Column="1"
+                         Margin="10,4"
+                         MinWidth="100"
+                         FontSize="{DynamicResource Font.Size.Body3}"
+                         TextAlignment="Center"
+                         HorizontalAlignment="Left"
+                         VerticalAlignment="Center">
+                                <TextBox.Text>
+                                    <Binding Path="ProMesInfo.ProductCode"
+                                 Mode="TwoWay">
+                                    </Binding>
+                                </TextBox.Text>
+                            </TextBox>
+
+                            <TextBlock Margin="0,0,0,8"
+                           Grid.Row="2"
+                           VerticalAlignment="Center"
+                           Text="产品颜色:"
+                           FontSize="{DynamicResource Font.Size.Body3}"
+                           HorizontalAlignment="Right" />
+                            <TextBox Grid.Row="2"
+                         Grid.Column="1"
+                         Margin="10,4"
+                         MinWidth="100"
+                         FontSize="{DynamicResource Font.Size.Body3}"
+                         TextAlignment="Center"
+                         HorizontalAlignment="Left"
+                         VerticalAlignment="Center">
+                                <TextBox.Text>
+                                    <Binding Path="ProMesInfo.ProductColor"
+                                 Mode="TwoWay">
+                                    </Binding>
+                                </TextBox.Text>
+                            </TextBox>
+
+                            <TextBlock Margin="0,0,0,8"
+                           Grid.Row="3"
+                           VerticalAlignment="Center"
+                           Text="产品类型:"
+                           FontSize="{DynamicResource Font.Size.Body3}"
+                           HorizontalAlignment="Right" />
+                            <TextBox Grid.Row="3"
+                         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"
+                                 Mode="TwoWay">
+                                    </Binding>
+                                </TextBox.Text>
+                            </TextBox>
+
+                            <StackPanel Grid.Row="6"
+                            Grid.ColumnSpan="2"
+                            Margin="0,6"
+                            Orientation="Horizontal"
+                            HorizontalAlignment="Center">
+                                <Button Margin="5"
+                            Style="{StaticResource MaterialDesignRaisedButton}"
+                            materialDesign:ButtonAssist.CornerRadius="10"
+                            MinWidth="100"
+                            Command="{Binding GetProWithMesCommand}">
+                                    <StackPanel Orientation="Horizontal"
+                                    HorizontalAlignment="Center">
+                                        <materialDesign:PackIcon Kind="PuzzleEditOutline"
+                                                     Margin="0,0,6,0" />
+                                        <TextBlock VerticalAlignment="Center"
+                                       Text="获取" />
+                                    </StackPanel>
+                                </Button>
+                                <Button Margin="5"
+                            Style="{StaticResource MaterialDesignRaisedButton}"
+                            materialDesign:ButtonAssist.CornerRadius="10"
+                            MinWidth="100"
+                            Command="{Binding DeleteProWithMesCommand}">
+                                    <StackPanel Orientation="Horizontal"
+                                    HorizontalAlignment="Center">
+                                        <materialDesign:PackIcon Kind="DeleteForeverOutline"
+                                                     Margin="0,0,6,0" />
+                                        <TextBlock VerticalAlignment="Center"
+                                       Text="删除" />
+                                    </StackPanel>
+                                </Button>
+                                <Button Margin="5"
+                            Style="{StaticResource MaterialDesignRaisedButton}"
+                            materialDesign:ButtonAssist.CornerRadius="10"
+                            MinWidth="100"
+                            Command="{Binding SaveProWithMesCommand}">
+                                    <StackPanel Orientation="Horizontal"
+                                    HorizontalAlignment="Center">
+                                        <materialDesign:PackIcon Kind="ContentSaveCheck"
+                                                     Margin="0,0,6,0" />
+                                        <TextBlock VerticalAlignment="Center"
+                                       Text="保存" />
+                                    </StackPanel>
+                                </Button>
+                            </StackPanel>
+
+                        </Grid>
+                    </GroupBox>
+                </StackPanel>
+            </TabItem>
+
             <!--生产排班-->
             <TabItem>
                 <TabItem.Header>