wanghan пре 7 месеци
родитељ
комит
cce41e95d0

+ 25 - 0
TeamAAS-VM/App.config

@@ -75,6 +75,11 @@
       <level value="ALL" />
       <appender-ref ref="CTAppender" />
     </logger>
+	  <!--mes日志类-->
+	  <logger name="logMes">
+		  <level value="ALL" />
+		  <appender-ref ref="MesAppender" />
+	  </logger>
     <!--定义输出到文件中-->
     <!--错误日志附加介质-->
     <appender name="ErrorAppender" type="log4net.Appender.RollingFileAppender">
@@ -200,6 +205,26 @@
         <param name="ConversionPattern" value="[日志时间:%d] [%t] [%-5p]:%m%n" />
       </layout>
     </appender>
+	  <!--mes日志-->
+	  <appender name="MesAppender" type="log4net.Appender.RollingFileAppender">
+		  <!--输出日志文件的路径-->
+		  <param name="File" value="..\\Log\\LogMes\\" />
+		  <!--输出日志时自动向后追加-->
+		  <param name="AppendToFile" value="true" />
+		  <!--防止多线程时不能写Log,官方说线程非安全,但实际使用时,本地测试正常,部署后有不能写日志的情况-->
+		  <lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
+		  <param name="MaxFileSize" value="10240" />
+		  <param name="MaxSizeRollBackups" value="100" />
+		  <param name="StaticLogFileName" value="false" />
+		  <param name="DatePattern" value="yyyy-MM\\yyyy-MM-dd&quot;.txt&quot;" />
+		  <param name="RollingStyle" value="Date" />
+		  <!--输出格式-->
+		  <!--样例:[日志时间:2023-11-08 10:56:12,247] [1] [INFO ]:系统启动!-->
+		  <!--信息日志布局-->
+		  <layout type="log4net.Layout.PatternLayout">
+			  <param name="ConversionPattern" value="[日志时间:%d] [%t] [%-5p]:%m%n" />
+		  </layout>
+	  </appender>
   </log4net>
   <system.web>
     <membership defaultProvider="ClientAuthenticationMembershipProvider">

+ 30 - 6
TeamAAS-VM/Core/Management.cs

@@ -2149,7 +2149,9 @@ namespace TeamAAS_VP.Core
 
                                     _LastMesCheckTime[i] = DateTime.UtcNow;
 
-                                    (bool isSuccess, string response) = await _mesService.StationGetAsync(code, 2);
+                                    LogHelper.WriteLogMes($"【mes开始QUERY】");
+                                    SendTaskMessage($"mes开始QUERY", MessageLevel.Info);
+                                    (bool isSuccess, string response) = await _mesService.StationGetAsync(code, "",2);
                                     if (i == 0)
                                     {
                                         SendTaskMessage($"收到当前过站检查请求(当站是否生产)...", MessageLevel.Debug);
@@ -2162,16 +2164,26 @@ namespace TeamAAS_VP.Core
                                     {
                                         //产品发生改变并且供料器发生了变化时,需要通知PLC进行取料更改
                                         await plc.WriteNodeAsync(addressConfig.Out_ScrewFeederIsChanged.Address, (Int16)1); //不发生改变
-
                                         await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)1);
+
+                                        LogHelper.WriteLogMes($"询问mes成功");
+                                        SendTaskMessage($"询问mes成功", MessageLevel.Debug);
+
+                                        LogHelper.WriteLogMes($"【mes结束QUERY】");
+                                        SendTaskMessage($"mes结束QUERY", MessageLevel.Info);
                                         return;
                                     }
                                     else
                                     {
                                         //产品发生改变并且供料器发生了变化时,需要通知PLC进行取料更改
                                         await plc.WriteNodeAsync(addressConfig.Out_ScrewFeederIsChanged.Address, (Int16)1); //不发生改变
+                                        await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)2);
 
-                                        await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)0);
+                                        LogHelper.WriteLogMes($"询问mes失败");
+                                        SendTaskMessage($"询问mes失败:{response}", MessageLevel.Error);
+
+                                        LogHelper.WriteLogMes($"【mes结束QUERY】");
+                                        SendTaskMessage($"mes结束QUERY", MessageLevel.Info);
                                         return;
                                     }
                                 }
@@ -2237,10 +2249,22 @@ namespace TeamAAS_VP.Core
 
                                     await _systemDatabaseService.RecordAssemblyAsync(assemblyRecord);
 
-                                    (bool isSuccess, string response) = await _mesService.SubmitGetAsync(code, resultIndex == 1 ? true : false, _LastMesCheckTime[i], DateTime.UtcNow);
-                                    //假设上传成功,这里缺少上传失败的处理
-
+                                    LogHelper.WriteLogMes($"【mes开始ADD】");
+                                    SendTaskMessage($"【mes开始ADD】", MessageLevel.Info);
+                                    (bool isSuccess, string response) = await _mesService.SubmitGetAsync(code,"", resultIndex == 1 ? true : false, _LastMesCheckTime[i], DateTime.UtcNow);
+                                    if (isSuccess)
+                                    {
+                                        LogHelper.WriteLogMes($"上传mes成功");
+                                        SendTaskMessage($"上传mes成功", MessageLevel.Debug);
+                                    }
+                                    else
+                                    {
+                                        LogHelper.WriteLogMes($"上传mes失败");
+                                        SendTaskMessage($"上传mes失败", MessageLevel.Error);
+                                    }
                                     await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)3);
+                                    LogHelper.WriteLogMes($"【mes结束ADD】");
+                                    SendTaskMessage($"mes结束ADD", MessageLevel.Info);
                                     return;
                                 }
                                 else

+ 4 - 4
TeamAAS-VM/Interfaces/IMesService.cs

@@ -27,7 +27,7 @@ namespace TeamAAS_VP.Interfaces
         /// - 实现应尊重 <paramref name="cancellationToken"/>,在取消时尽早抛出 <see cref="OperationCanceledException"/> 或返回失败结果。
         /// - 若 <paramref name="sn"/> 无效,应抛出 <see cref="ArgumentNullException"/> 或 <see cref="ArgumentException"/>。
         /// </remarks>
-        Task<(bool IsSuccess, string Response)> StationGetAsync(string sn, CancellationToken cancellationToken = default);
+        Task<(bool IsSuccess, string Response)> StationGetAsync(string sn, string comp, CancellationToken cancellationToken = default);
 
         /// <summary>
         /// 使用配置的过站(Station)URL 发起 GET 请求,携带序列号(sn)作为查询参数进行过站,并使用指定的超时时间(秒)。
@@ -43,7 +43,7 @@ namespace TeamAAS_VP.Interfaces
         /// - 此重载方便在不使用 <see cref="CancellationToken"/> 的场景中指定超时时间。
         /// - 实现应验证 <paramref name="timeoutInSeconds"/> 为合理值(例如 > 0),否则可抛出 <see cref="ArgumentOutOfRangeException"/>。
         /// </remarks>
-        Task<(bool IsSuccess, string Response)> StationGetAsync(string sn, double timeoutInSeconds);
+        Task<(bool IsSuccess, string Response)> StationGetAsync(string sn, string comp, double timeoutInSeconds);
 
         /// <summary>
         /// 使用配置的提交(Submit)URL 发起 GET 请求,提交过站结果及时间信息。
@@ -63,7 +63,7 @@ namespace TeamAAS_VP.Interfaces
         /// - 若 <paramref name="start_time"/> 晚于 <paramref name="stop_time"/>,实现应记录并视情况返回失败或抛出异常。
         /// - 实现应尊重 <paramref name="cancellationToken"/>,并在取消时尽早中止请求。
         /// </remarks>
-        Task<(bool IsSuccess, string Response)> SubmitGetAsync(string sn, bool isSuccess, DateTime start_time, DateTime stop_time, CancellationToken cancellationToken = default);
+        Task<(bool IsSuccess, string Response)> SubmitGetAsync(string sn, string comp, bool isSuccess, DateTime start_time, DateTime stop_time, CancellationToken cancellationToken = default);
 
         /// <summary>
         /// 使用配置的提交(Submit)URL 发起 GET 请求,提交过站结果及时间信息,并使用指定的超时时间(秒)。
@@ -82,6 +82,6 @@ namespace TeamAAS_VP.Interfaces
         /// - 此重载用于在不传入 <see cref="CancellationToken"/> 的场景中指定超时时间。
         /// - 实现应确保对时间参数与布尔参数进行适当的 URL 编码或格式化。
         /// </remarks>
-        Task<(bool IsSuccess, string Response)> SubmitGetAsync(string sn, bool isSuccess, DateTime start_time, DateTime stop_time, double timeoutInSeconds);
+        Task<(bool IsSuccess, string Response)> SubmitGetAsync(string sn, string comp, bool isSuccess, DateTime start_time, DateTime stop_time, double timeoutInSeconds);
     }
 }

+ 9 - 0
TeamAAS-VM/LogHelper.cs

@@ -16,6 +16,7 @@ namespace TeamAAS_VP
         public static readonly ILog logfatal = LogManager.GetLogger("logfatal");
         public static readonly ILog logDynamic = LogManager.GetLogger("logDynamic");
         public static readonly ILog logCT = LogManager.GetLogger("logCT");
+        public static readonly ILog logmes = LogManager.GetLogger("logMes");
         public static void WriteLogInfo(string info)
         {
             if (loginfo.IsInfoEnabled)
@@ -75,5 +76,13 @@ namespace TeamAAS_VP
                 logCT.Info(info);
             }
         }
+        public static void WriteLogMes(string info)
+        {
+            if (logmes.IsInfoEnabled)
+            {
+                logmes.Info(info);
+
+            }
+        }
     }
 }

+ 12 - 10
TeamAAS-VM/Models/DeviceInfo.cs

@@ -32,26 +32,28 @@ namespace TeamAAS_VP.Models
         /// </summary>
         public bool EnableMES { get => _enableMes; set => SetProperty(ref _enableMes, value); }
 
-        private string _mesStationUrl;
+        private string _mesUrl;
         /// <summary>
-        /// MES ¹ýÕ¾ URL
+        /// URL
         /// </summary>
-        public string MesStationUrl { get => _mesStationUrl; set => SetProperty(ref _mesStationUrl, value); }
+        public string MesUrl { get => _mesUrl; set => SetProperty(ref _mesUrl, value); }
 
-        private string _mesSubmitUrl;
-        /// <summary>
-        /// MES Ìá½» URL
-        /// </summary>
-        public string MesSubmitUrl { get => _mesSubmitUrl; set => SetProperty(ref _mesSubmitUrl, value); }
+
+        private string _f;
+        public string F { get => _f; set => SetProperty(ref _f, value); }
+
+        private string _comp;
+        public string comp { get => _comp; set => SetProperty(ref _comp, value); }
 
         public DeviceInfo()
         {
             Line = string.Empty;
             Station = string.Empty;
             FixtureId = string.Empty;
+            F = string.Empty;
+            comp = string.Empty;
+            MesUrl = string.Empty;
             EnableMES = false;
-            MesStationUrl = string.Empty;
-            MesSubmitUrl = string.Empty;
         }
     }
 }

+ 71 - 15
TeamAAS-VM/Services/MesService.cs

@@ -1,9 +1,13 @@
+using Prism.Events;
+using Prism.Ioc;
 using System;
 using System.Collections.Generic;
 using System.Net.Http;
 using System.Text;
 using System.Threading;
 using System.Threading.Tasks;
+using TeamAAS_VP.Enums;
+using TeamAAS_VP.Events;
 using TeamAAS_VP.Interfaces;
 using TeamAAS_VP.Models;
 
@@ -23,6 +27,7 @@ namespace TeamAAS_VP.Services
     /// </summary>
     public class MesService : IMesService
     {
+        IEventAggregator _eventAggregator;
         /// <summary>
         /// 用于执行 HTTP 请求的客户端实例。建议在服务生命周期内重用,避免频繁创建导致套接字/端口耗尽。
         /// </summary>
@@ -43,11 +48,12 @@ namespace TeamAAS_VP.Services
         /// </summary>
         /// <param name="configService">用于获取设备配置信息的实现,不能为空。</param>
         /// <exception cref="ArgumentNullException">当 <paramref name="configService"/> 为 null 时抛出。</exception>
-        public MesService(IConfigService configService)
+        public MesService(IConfigService configService, IContainerProvider container, IEventAggregator ea)
         {
             _configService = configService ?? throw new ArgumentNullException(nameof(configService));
             _httpClient = new HttpClient();
             _disposed = false;
+            _eventAggregator = ea;
         }
 
 
@@ -70,7 +76,7 @@ namespace TeamAAS_VP.Services
         /// - 捕获 <see cref="OperationCanceledException"/> 返回 "Canceled",捕获其它异常则返回异常消息。
         /// - 若实例已被释放则抛出 <see cref="ObjectDisposedException"/>。
         /// </remarks>
-        public async Task<(bool IsSuccess, string Response)> StationGetAsync(string sn, CancellationToken cancellationToken = default)
+        public async Task<(bool IsSuccess, string Response)> StationGetAsync(string sn, string comp, CancellationToken cancellationToken = default)
         {
             // 如果已经释放,则抛出异常,防止在已释放资源上继续操作。
             if (_disposed) throw new ObjectDisposedException(nameof(MesService));
@@ -80,19 +86,40 @@ namespace TeamAAS_VP.Services
             {
                 return (true, "MES功能未启用!");
             }
-            if (string.IsNullOrWhiteSpace(device.MesStationUrl))
+            if (string.IsNullOrWhiteSpace(device.MesUrl))
                 return (false, "Missing MES station URL");
+            if (device.F == "PTL")
+            {
+                if (string.IsNullOrEmpty(device.comp))
+                {
+                    return (false, "PTL模式下comp不能为空");
+                }
+            }
 
-            var url = string.Format(device.MesStationUrl, sn);
+            string url = "";
+            if (device.F == "PTL")
+            {
+                url = $"{device.MesUrl}?c=QUERY_RECORD&line={device.Line}&station={device.Station}&fixtureid={device.FixtureId}&sn={sn}&comp={comp}&p=unit_process_check,model";
+            }
+            else
+            {
+                url = $"{device.MesUrl}?c=QUERY_RECORD&line={device.Line}&station={device.Station}&fixtureid={device.FixtureId}&sn={sn}&p=unit_process_check,model";
+            }
 
+            LogHelper.WriteLogMes($"【询问URL】{url}");
+            SendTaskMessage($"【询问URL】{url}", MessageLevel.Info);
             (bool IsSuccess, string Response) result = (false, string.Empty);
-            for (int i = 0; i < 5; i++)
+
+            for (int i = 0; i < 3; i++)
             {
                 try
                 {
-                    using (var rsp = await _httpClient.GetAsync(url, cancellationToken))
+                    using (var rsp = await _httpClient.GetAsync(url))
                     {
                         var text = await rsp.Content.ReadAsStringAsync();
+                        LogHelper.WriteLogMes($"【HTTP接收】{text}");
+                        SendTaskMessage($"【HTTP接收】{text}", MessageLevel.Info);
+
                         // "SFC_OK" 代表和 MES 连接成功
                         if (text.Contains("SFC_OK"))
                         {
@@ -122,11 +149,11 @@ namespace TeamAAS_VP.Services
         /// <param name="sn">序列号(SN)。</param>
         /// <param name="timeoutInSeconds">请求超时,单位为秒。</param>
         /// <returns>与 <see cref="StationGetAsync(string, CancellationToken)"/> 相同的返回语义。</returns>
-        public async Task<(bool IsSuccess, string Response)> StationGetAsync(string sn, double timeoutInSeconds)
+        public async Task<(bool IsSuccess, string Response)> StationGetAsync(string sn, string comp, double timeoutInSeconds)
         {
             using (var cts = new CancellationTokenSource(TimeSpan.FromSeconds(timeoutInSeconds)))
             {
-                return await StationGetAsync(sn, cts.Token);
+                return await StationGetAsync(sn, comp, cts.Token);
             }
         }
 
@@ -152,7 +179,7 @@ namespace TeamAAS_VP.Services
         /// - 捕获 <see cref="OperationCanceledException"/> 返回 "Canceled",捕获其它异常则返回异常消息。
         /// - 若实例已被释放则抛出 <see cref="ObjectDisposedException"/>。
         /// </remarks>
-        public async Task<(bool IsSuccess, string Response)> SubmitGetAsync(string sn, bool isSuccess, DateTime start_time, DateTime stop_time, CancellationToken cancellationToken = default)
+        public async Task<(bool IsSuccess, string Response)> SubmitGetAsync(string sn, string comp, bool isSuccess, DateTime start_time, DateTime stop_time, CancellationToken cancellationToken = default)
         {
             // 如果已经释放,则抛出异常,防止在已释放资源上继续操作。
             if (_disposed) throw new ObjectDisposedException(nameof(MesService));
@@ -162,19 +189,41 @@ namespace TeamAAS_VP.Services
             {
                 return (true, "MES功能未启用!");
             }
-            if (string.IsNullOrWhiteSpace(device.MesStationUrl))
+            if (string.IsNullOrWhiteSpace(device.MesUrl))
                 return (false, "Missing MES submit URL");
+            if (device.F == "PTL")
+            {
+                if (string.IsNullOrEmpty(device.comp))
+                {
+                    return (false, "PTL模式下comp不能为空");
+                }
+            }
 
-            var url = string.Format(device.MesStationUrl, sn, isSuccess ? "PASS" : "FAIL", start_time.ToString("yyyy-MM-dd HH:mm:ss"), stop_time.ToString("yyyy-MM-dd HH:mm:ss"));
-
+            string res = isSuccess ? "PASS" : "FAIL";
+            string url = "";
+            if (device.F == "PTL")
+            {
+                url = $"{device.MesUrl}?c=ADD_RECORD&line={device.Line}&station={device.Station}&fixtureid={device.FixtureId}&sn={sn}&f=PTL&comp={comp}" +
+                    $"&result={res}&start_time={start_time.ToString("yyyy-MM-dd HH:mm:ss")}&stop_time={stop_time.ToString("yyyy-MM-dd HH:mm:ss")}";
+            }
+            else
+            {
+                url = $"{device.MesUrl}?c=ADD_RECORD&line={device.Line}&station={device.Station}&fixtureid={device.FixtureId}&sn={sn}&f=PQC" +
+                    $"&result={res}&start_time={start_time.ToString("yyyy-MM-dd HH:mm:ss")}&stop_time={stop_time.ToString("yyyy-MM-dd HH:mm:ss")}";
+            }
+            LogHelper.WriteLogMes($"【上传URL】{url}");
+            SendTaskMessage($"【上传URL】{url}", MessageLevel.Info);
             (bool IsSuccess, string Response) result = (false, string.Empty);
-            for (int i = 0; i < 5; i++)
+
+            for (int i = 0; i < 3; i++)
             {
                 try
                 {
                     using (var rsp = await _httpClient.GetAsync(url, cancellationToken))
                     {
                         var text = await rsp.Content.ReadAsStringAsync();
+                        LogHelper.WriteLogMes($"【HTTP接收】{text}");
+                        SendTaskMessage($"【HTTP接收】{text}", MessageLevel.Info);
                         // "SFC_OK" 代表和 MES 连接成功
                         if (text.Contains("SFC_OK"))
                         {
@@ -209,11 +258,11 @@ namespace TeamAAS_VP.Services
         /// <param name="stop_time">结束时间。</param>
         /// <param name="timeoutInSeconds">请求超时,单位为秒。</param>
         /// <returns>与 <see cref="SubmitGetAsync(string, bool, DateTime, DateTime, CancellationToken)"/> 相同的返回语义。</returns>
-        public async Task<(bool IsSuccess, string Response)> SubmitGetAsync(string sn, bool isSuccess, DateTime start_time, DateTime stop_time, double timeoutInSeconds)
+        public async Task<(bool IsSuccess, string Response)> SubmitGetAsync(string sn, string comp, bool isSuccess, DateTime start_time, DateTime stop_time, double timeoutInSeconds)
         {
             using (var cts = new CancellationTokenSource(TimeSpan.FromSeconds(timeoutInSeconds)))
             {
-                return await SubmitGetAsync(sn, isSuccess, start_time, stop_time, cts.Token);
+                return await SubmitGetAsync(sn, comp, isSuccess, start_time, stop_time, cts.Token);
             }
         }
 
@@ -229,5 +278,12 @@ namespace TeamAAS_VP.Services
                 _disposed = true;
             }
         }
+        public void SendTaskMessage(string msg, MessageLevel level)
+        {
+            App.Current.Dispatcher.Invoke(() =>
+            {
+                _eventAggregator.GetEvent<TaskMessageNotification>().Publish(new Models.MessageStruct() { Message = msg, level = level });
+            });
+        }
     }
 }

+ 227 - 232
TeamAAS-VM/Views/SettingView.xaml

@@ -228,242 +228,237 @@
                     </StackPanel>
                 </TabItem.Header>
 
-                <Grid Margin="16">
+                <Grid>
                     <Grid.RowDefinitions>
-                        <RowDefinition Height="Auto" />
-                        <RowDefinition Height="Auto" />
-                        <RowDefinition Height="Auto" />
-                        <RowDefinition Height="Auto" />
-                        <RowDefinition Height="Auto" />
-                        <RowDefinition Height="Auto" />
-                        <RowDefinition Height="Auto" />
-                        <RowDefinition Height="Auto" />
-                        <RowDefinition Height="Auto" />
-                        <RowDefinition Height="Auto" />
-                        <RowDefinition Height="Auto" />
-                        <RowDefinition Height="Auto" />
-                        <RowDefinition Height="Auto" />
-                        <RowDefinition Height="Auto" />
-                        <RowDefinition Height="Auto" />
-                        <RowDefinition Height="Auto" />
-                        <RowDefinition Height="Auto" />
-                        <RowDefinition Height="Auto" />
-                        <RowDefinition Height="Auto" />
-                        <RowDefinition Height="Auto" />
-                        <RowDefinition Height="Auto" />
+                        <RowDefinition Height="auto"/>
+                        <RowDefinition Height="auto"/>
                     </Grid.RowDefinitions>
-                    <Grid.ColumnDefinitions>
-                        <ColumnDefinition Width="auto" />
-                        <ColumnDefinition Width="*" />
-                    </Grid.ColumnDefinitions>
+                    <Grid Margin="16">
+                        <Grid.RowDefinitions>
+                            <RowDefinition Height="Auto" />
+                            <RowDefinition Height="Auto" />
+                            <RowDefinition Height="Auto" />
+                            <RowDefinition Height="Auto" />
+                            <RowDefinition Height="Auto" />
+                            <RowDefinition Height="Auto" />
+                            <RowDefinition Height="Auto" />
+                            <RowDefinition Height="Auto" />
+                        </Grid.RowDefinitions>
+                        <Grid.ColumnDefinitions>
+                            <ColumnDefinition Width="auto" />
+                            <ColumnDefinition Width="*" />
+                        </Grid.ColumnDefinitions>
 
-                    <TextBlock Grid.Row="0"
-                               Grid.Column="0"
-                               Text="线别:"
-                               HorizontalAlignment="Right"
-                               VerticalAlignment="Center" />
-                    <TextBox Grid.Row="0"
-                             Grid.Column="1"
-                             Text="{Binding DeviceInfo.Line, Mode=TwoWay}"
-                             Margin="6" />
-
-                    <TextBlock Grid.Row="1"
-                               Grid.Column="0"
-                               Text="站别:"
-                               HorizontalAlignment="Right"
-                               VerticalAlignment="Center" />
-                    <TextBox Grid.Row="1"
-                             Grid.Column="1"
-                             Text="{Binding DeviceInfo.Station, Mode=TwoWay}"
-                             Margin="6" />
-
-                    <TextBlock Grid.Row="2"
-                               Grid.Column="0"
-                               Text="机台号:"
-                               HorizontalAlignment="Right"
-                               VerticalAlignment="Center" />
-                    <TextBox Grid.Row="2"
-                             Grid.Column="1"
-                             Text="{Binding DeviceInfo.FixtureId, Mode=TwoWay}"
-                             Margin="6" />
-
-                    <TextBlock Grid.Row="3"
-                               Grid.Column="0"
-                               Text="启用 MES:"
-                               HorizontalAlignment="Right"
-                               VerticalAlignment="Center" />
-                    <CheckBox Grid.Row="3"
-                              Grid.Column="1"
-                              IsChecked="{Binding DeviceInfo.EnableMES, Mode=TwoWay}"
-                              Margin="6" />
-
-                    <TextBlock Grid.Row="4"
-                               Grid.Column="0"
-                               Text="MES 过站 URL:"
-                               HorizontalAlignment="Right"
-                               VerticalAlignment="Center" />
-                    <TextBox Grid.Row="4"
-                             Grid.Column="1"
-                             Text="{Binding DeviceInfo.MesStationUrl, Mode=TwoWay}"
-                             Margin="6" />
-
-                    <TextBlock Grid.Row="5"
-                               Grid.Column="0"
-                               Text="MES 提交 URL:"
-                               HorizontalAlignment="Right"
-                               VerticalAlignment="Center" />
-                    <TextBox Grid.Row="5"
-                             Grid.Column="1"
-                             Text="{Binding DeviceInfo.MesSubmitUrl, Mode=TwoWay}"
-                             Margin="6" />
-
-                    <StackPanel Orientation="Horizontal"
-                                HorizontalAlignment="Right"
-                                Grid.Row="6"
-                                Grid.ColumnSpan="2"
-                                Margin="6">
-                        <Button Style="{StaticResource MaterialDesignRaisedButton}"
-                                Command="{Binding SaveDeviceInfoCommand}">保存</Button>
-                    </StackPanel>
 
-                    <TextBlock Grid.Row="7"
-                               Grid.Column="0"
-                               Text="PROCESS_NAME:"
-                               HorizontalAlignment="Right"
-                               VerticalAlignment="Center" />
-                    <TextBox Grid.Row="7"
-                             Grid.Column="1"
-                             Text="{Binding DeviceInfo.MesSubmitUrl, Mode=TwoWay}"
-                             Margin="6" />
-
-                    <TextBlock Grid.Row="8"
-                               Grid.Column="0"
-                               Text="CTQ_LSL(扭力下限):"
-                               HorizontalAlignment="Right"
-                               VerticalAlignment="Center" />
-                    <TextBox Grid.Row="8"
-                             Grid.Column="1"
-                             Text="{Binding DeviceInfo.MesSubmitUrl, Mode=TwoWay}"
-                             Margin="6" />
-
-                    <TextBlock Grid.Row="9"
-                               Grid.Column="0"
-                               Text="CTQ_USL(扭力上限)"
-                               HorizontalAlignment="Right"
-                               VerticalAlignment="Center" />
-                    <TextBox Grid.Row="9"
-                             Grid.Column="1"
-                             Text="{Binding DeviceInfo.MesSubmitUrl, Mode=TwoWay}"
-                             Margin="6" />
-
-                    <TextBlock Grid.Row="10"
-                               Grid.Column="0"
-                               Text="CTQ_LSL(压力下限):"
-                               HorizontalAlignment="Right"
-                               VerticalAlignment="Center" />
-                    <TextBox Grid.Row="10"
-                             Grid.Column="1"
-                             Text="{Binding DeviceInfo.MesSubmitUrl, Mode=TwoWay}"
-                             Margin="6" />
-
-                    <TextBlock Grid.Row="11"
-                               Grid.Column="0"
-                               Text="CTQ_USL(压力上限):"
-                               HorizontalAlignment="Right"
-                               VerticalAlignment="Center" />
-                    <TextBox Grid.Row="11"
-                             Grid.Column="1"
-                             Text="{Binding DeviceInfo.MesSubmitUrl, Mode=TwoWay}"
-                             Margin="6" />
-
-                    <TextBlock Grid.Row="12"
-                               Grid.Column="0"
-                               Text="SUPPLIER_NAME:"
-                               HorizontalAlignment="Right"
-                               VerticalAlignment="Center" />
-                    <TextBox Grid.Row="12"
-                             Grid.Column="1"
-                             Text="{Binding DeviceInfo.MesSubmitUrl, Mode=TwoWay}"
-                             Margin="6" />
-
-                    <TextBlock Grid.Row="13"
-                               Grid.Column="0"
-                               Text="COMMODITY_TYPE:"
-                               HorizontalAlignment="Right"
-                               VerticalAlignment="Center" />
-                    <TextBox Grid.Row="13"
-                             Grid.Column="1"
-                             Text="{Binding DeviceInfo.MesSubmitUrl, Mode=TwoWay}"
-                             Margin="6" />
-
-                    <TextBlock Grid.Row="14"
-                               Grid.Column="0"
-                               Text="REVISION:"
-                               HorizontalAlignment="Right"
-                               VerticalAlignment="Center" />
-                    <TextBox Grid.Row="14"
-                             Grid.Column="1"
-                             Text="{Binding DeviceInfo.MesSubmitUrl, Mode=TwoWay}"
-                             Margin="6" />
-
-                    <TextBlock Grid.Row="15"
-                               Grid.Column="0"
-                               Text="WO#:"
-                               HorizontalAlignment="Right"
-                               VerticalAlignment="Center" />
-                    <TextBox Grid.Row="15"
-                             Grid.Column="1"
-                             Text="{Binding DeviceInfo.MesSubmitUrl, Mode=TwoWay}"
-                             Margin="6" />
-
-                    <TextBlock Grid.Row="16"
-                               Grid.Column="0"
-                               Text="MFG_LOT#:"
-                               HorizontalAlignment="Right"
-                               VerticalAlignment="Center" />
-                    <TextBox Grid.Row="16"
-                             Grid.Column="1"
-                             Text="{Binding DeviceInfo.MesSubmitUrl, Mode=TwoWay}"
-                             Margin="6" />
-
-                    <TextBlock Grid.Row="17"
-                               Grid.Column="0"
-                               Text="MFG_ASSY_LINE:"
-                               HorizontalAlignment="Right"
-                               VerticalAlignment="Center" />
-                    <TextBox Grid.Row="17"
-                             Grid.Column="1"
-                             Text="{Binding DeviceInfo.MesSubmitUrl, Mode=TwoWay}"
-                             Margin="6" />
-
-                    <TextBlock Grid.Row="18"
-                               Grid.Column="0"
-                               Text="PROCESS_MACHINE_ID:"
-                               HorizontalAlignment="Right"
-                               VerticalAlignment="Center" />
-                    <TextBox Grid.Row="18"
-                             Grid.Column="1"
-                             Text="{Binding DeviceInfo.MesSubmitUrl, Mode=TwoWay}"
-                             Margin="6" />
-
-                    <TextBlock Grid.Row="19"
-                               Grid.Column="0"
-                               Text="CTQ_UNIT_OF_MEASURE:"
-                               HorizontalAlignment="Right"
-                               VerticalAlignment="Center" />
-                    <TextBox Grid.Row="19"
-                             Grid.Column="1"
-                             Text="{Binding DeviceInfo.MesSubmitUrl, Mode=TwoWay}"
-                             Margin="6" />
-
-                    <StackPanel Orientation="Horizontal"
-                                HorizontalAlignment="Right"
-                                Grid.Row="20"
-                                Grid.ColumnSpan="2"
-                                Margin="6">
-                        <Button Style="{StaticResource MaterialDesignRaisedButton}"
-                                Command="{Binding SaveDeviceInfoCommand}">保存</Button>
-                    </StackPanel>
+                        <TextBlock Grid.Row="0"
+         Grid.Column="0"
+         Text="Url:"
+         HorizontalAlignment="Right"
+         VerticalAlignment="Center" />
+                        <TextBox Grid.Row="0"
+       Grid.Column="1"
+       Text="{Binding DeviceInfo.MesUrl, Mode=TwoWay}"
+       Margin="6" />
+
+                        <TextBlock Grid.Row="1"
+         Grid.Column="0"
+         Text="Line:"
+         HorizontalAlignment="Right"
+         VerticalAlignment="Center" />
+                        <TextBox Grid.Row="1"
+       Grid.Column="1"
+       Text="{Binding DeviceInfo.Line, Mode=TwoWay}"
+       Margin="6" />
+
+                        <TextBlock Grid.Row="2"
+         Grid.Column="0"
+         Text="Station:"
+         HorizontalAlignment="Right"
+         VerticalAlignment="Center" />
+                        <TextBox Grid.Row="2"
+       Grid.Column="1"
+       Text="{Binding DeviceInfo.Station, Mode=TwoWay}"
+       Margin="6" />
+
+                        <TextBlock Grid.Row="3"
+         Grid.Column="0"
+         Text="FixtureId:"
+         HorizontalAlignment="Right"
+         VerticalAlignment="Center" />
+                        <TextBox Grid.Row="3"
+       Grid.Column="1"
+       Text="{Binding DeviceInfo.FixtureId, Mode=TwoWay}"
+       Margin="6" />
+
+                        <TextBlock Grid.Row="4"
+         Grid.Column="0"
+         Text="f:"
+         HorizontalAlignment="Right"
+         VerticalAlignment="Center" />
+                        <TextBox Grid.Row="4"
+       Grid.Column="1"
+       Text="{Binding DeviceInfo.F, Mode=TwoWay}"
+       Margin="6" />
+
+                        <TextBlock Grid.Row="5"
+         Grid.Column="0"
+         Text="comp:"
+         HorizontalAlignment="Right"
+         VerticalAlignment="Center" />
+                        <TextBox Grid.Row="5"
+       Grid.Column="1"
+       Text="{Binding DeviceInfo.comp, Mode=TwoWay}"
+       Margin="6" />
+
+                        <TextBlock Grid.Row="6"
+         Grid.Column="0"
+         Text="启用 MES:"
+         HorizontalAlignment="Right"
+         VerticalAlignment="Center" />
+                        <CheckBox Grid.Row="6"
+        Grid.Column="1"
+        IsChecked="{Binding DeviceInfo.EnableMES, Mode=TwoWay}"
+        Margin="6" />
+
+                        <StackPanel Orientation="Horizontal"
+          HorizontalAlignment="Right"
+          Grid.Row="7"
+          Grid.ColumnSpan="2"
+          Margin="6">
+                            <Button Style="{StaticResource MaterialDesignRaisedButton}"
+          Command="{Binding SaveDeviceInfoCommand}">保存</Button>
+                        </StackPanel>
+                    </Grid>
+
+                    <!--<Grid Margin="16"
+Grid.Row="1">
+              <Grid.RowDefinitions>
+                  <RowDefinition Height="Auto" />
+                  <RowDefinition Height="Auto" />
+                  <RowDefinition Height="Auto" />
+                  <RowDefinition Height="Auto" />
+                  <RowDefinition Height="Auto" />
+                  <RowDefinition Height="Auto" />
+                  <RowDefinition Height="Auto" />
+                  <RowDefinition Height="Auto" />
+                  <RowDefinition Height="Auto" />
+                  <RowDefinition Height="Auto" />
+                  <RowDefinition Height="Auto" />
+              </Grid.RowDefinitions>
+              <Grid.ColumnDefinitions>
+                  <ColumnDefinition Width="auto" />
+                  <ColumnDefinition Width="*" />
+              </Grid.ColumnDefinitions>
+
+              <TextBlock Grid.Row="0"
+         Grid.Column="0"
+         Text="PROCESS_NAME:"
+         HorizontalAlignment="Right"
+         VerticalAlignment="Center" />
+              <TextBox Grid.Row="0"
+       Grid.Column="1"
+       Text="{Binding DataInfo.PROCESS_NAME, Mode=TwoWay}"
+       Margin="6" />
+
+              <TextBlock Grid.Row="1"
+         Grid.Column="0"
+         Text="CTQ_LSL(压力下限):"
+         HorizontalAlignment="Right"
+         VerticalAlignment="Center" />
+              <TextBox Grid.Row="1"
+       Grid.Column="1"
+       Text="{Binding DataInfo.CTQ_LSL_Pressure, Mode=TwoWay}"
+       Margin="6" />
+
+              <TextBlock Grid.Row="2"
+         Grid.Column="0"
+         Text="CTQ_USL(压力上限):"
+         HorizontalAlignment="Right"
+         VerticalAlignment="Center" />
+              <TextBox Grid.Row="2"
+       Grid.Column="1"
+       Text="{Binding DataInfo.CTQ_USL_Pressure, Mode=TwoWay}"
+       Margin="6" />
+
+              <TextBlock Grid.Row="3"
+         Grid.Column="0"
+         Text="SUPPLIER_NAME:"
+         HorizontalAlignment="Right"
+         VerticalAlignment="Center" />
+              <TextBox Grid.Row="3"
+       Grid.Column="1"
+       Text="{Binding DataInfo.SUPPLIER_NAME, Mode=TwoWay}"
+       Margin="6" />
+
+              <TextBlock Grid.Row="4"
+         Grid.Column="0"
+         Text="COMMODITY_TYPE:"
+         HorizontalAlignment="Right"
+         VerticalAlignment="Center" />
+              <TextBox Grid.Row="4"
+       Grid.Column="1"
+       Text="{Binding DataInfo.COMMODITY_TYPE, Mode=TwoWay}"
+       Margin="6" />
+
+              <TextBlock Grid.Row="5"
+         Grid.Column="0"
+         Text="REVISION:"
+         HorizontalAlignment="Right"
+         VerticalAlignment="Center" />
+              <TextBox Grid.Row="5"
+       Grid.Column="1"
+       Text="{Binding DataInfo.REVISION, Mode=TwoWay}"
+       Margin="6" />
+
+              <TextBlock Grid.Row="6"
+         Grid.Column="0"
+         Text="WO#:"
+         HorizontalAlignment="Right"
+         VerticalAlignment="Center" />
+              <TextBox Grid.Row="6"
+       Grid.Column="1"
+       Text="{Binding DataInfo.WO, Mode=TwoWay}"
+       Margin="6" />
+
+              <TextBlock Grid.Row="7"
+         Grid.Column="0"
+         Text="MFG_LOT#:"
+         HorizontalAlignment="Right"
+         VerticalAlignment="Center" />
+              <TextBox Grid.Row="7"
+       Grid.Column="1"
+       Text="{Binding DataInfo.MFG_LOT, Mode=TwoWay}"
+       Margin="6" />
+
+              <TextBlock Grid.Row="8"
+         Grid.Column="0"
+         Text="MFG_ASSY_LINE:"
+         HorizontalAlignment="Right"
+         VerticalAlignment="Center" />
+              <TextBox Grid.Row="8"
+       Grid.Column="1"
+       Text="{Binding DataInfo.MFG_ASSY_LINE, Mode=TwoWay}"
+       Margin="6" />
+
+              <TextBlock Grid.Row="9"
+         Grid.Column="0"
+         Text="PROCESS_MACHINE_ID:"
+         HorizontalAlignment="Right"
+         VerticalAlignment="Center" />
+              <TextBox Grid.Row="9"
+       Grid.Column="1"
+       Text="{Binding DataInfo.PROCESS_MACHINE_ID, Mode=TwoWay}"
+       Margin="6" />
+
+              <StackPanel Orientation="Horizontal"
+          HorizontalAlignment="Right"
+          Grid.Row="10"
+          Grid.ColumnSpan="2"
+          Margin="6">
+                  <Button Style="{StaticResource MaterialDesignRaisedButton}"
+          Command="{Binding SaveDataInfoCommand}">保存</Button>
+              </StackPanel>
+          </Grid>-->
                 </Grid>
             </TabItem>