Browse Source

LCD添加关于gap检测上下限

844184169 6 months ago
parent
commit
6ea38c8854

+ 41 - 15
TeamAAS-VM/Core/Management.cs

@@ -1179,7 +1179,7 @@ namespace TeamAAS_VP.Core
         /// <summary>
         /// 复检结果
         /// </summary>
-        string gapString = "";
+        Dictionary<string, string> gapDict = new Dictionary<string, string>();
         /// <summary>
         /// 二次定位相机的工具坐标
         /// </summary>
@@ -2229,7 +2229,12 @@ namespace TeamAAS_VP.Core
                                 SendTaskMessage($"流程3结果:{visionResults[2].distance}", MessageLevel.Debug);
                                 SendTaskMessage($"流程4结果:{visionResults[3].distance}", MessageLevel.Debug);
 
-                                gapString = $"{visionResults[0].distance.Split(',')[1]},{visionResults[1].distance.Split(',')[1]},{visionResults[2].distance.Split(',')[1]},{visionResults[3].distance.Split(',')[1]}";
+                                gapDict.Clear();
+                                gapDict.Add("Gap1", visionResults[0].distance.Split(',')[1]);
+                                gapDict.Add("Gap2", visionResults[1].distance.Split(',')[1]);
+                                gapDict.Add("Gap3", visionResults[2].distance.Split(',')[1]);
+                                gapDict.Add("Gap4", visionResults[3].distance.Split(',')[1]);
+                                //gapString = $"{visionResults[0].distance.Split(',')[1]},{visionResults[1].distance.Split(',')[1]},{visionResults[2].distance.Split(',')[1]},{visionResults[3].distance.Split(',')[1]}";
                                 await plc.WriteNodeAsync(addressConfig.Out_FixedCameracheckStatus.Address, (Int16)1);
                                 return;
                             }
@@ -2253,7 +2258,12 @@ namespace TeamAAS_VP.Core
                                     res4 = visionResults[3].distance.Split(',')[1];
                                 }
                                 SendTaskMessage($"固定相机检测NG", MessageLevel.Error);
-                                gapString = $"{res1},{res2},{res3},{res4}";
+                                gapDict.Clear();
+                                gapDict.Add("Gap1", res1);
+                                gapDict.Add("Gap2", res2);
+                                gapDict.Add("Gap3", res3);
+                                gapDict.Add("Gap4", res4);
+                                //gapString = $"{res1},{res2},{res3},{res4}";
                                 await plc.WriteNodeAsync(addressConfig.Out_FixedCameracheckStatus.Address, (Int16)2);
                                 return;
                             }
@@ -2816,10 +2826,9 @@ namespace TeamAAS_VP.Core
 
                                     Dictionary<string, string> data = new Dictionary<string, string>();
 
-                                    string gap = ""; string press = ""; string presstime = ""; string assypress = "";
+                                    string press = ""; string presstime = ""; string assypress = "";
                                     if (i == 0)
                                     {
-                                        gap = gapString;
                                         try
                                         {
                                             assypress = currentPressure[0].ToString("F2");
@@ -2837,9 +2846,9 @@ namespace TeamAAS_VP.Core
                                             assypress = "0";
                                             resultIndex = 2;
                                         }
-                                        data.Add("Gap1", gap);
+                                        data = gapDict;
                                         data.Add("AssyPressure1", assypress);
-                                        SendTaskMessage($"gap:{gap},组装压力:{assypress}", MessageLevel.Info);
+                                        SendTaskMessage($"Gap1:{gapDict["Gap1"]},Gap2:{gapDict["Gap2"]},Gap3:{gapDict["Gap3"]},Gap4:{gapDict["Gap4"]},组装压力:{assypress}", MessageLevel.Info);
                                         #region 数据
                                         bool assyPresRes;
                                         if (currentPressure[0] >= currentProduct.GlobalParamEx.AssemblyPressure.PressureDownLimit && currentPressure[0] <= currentProduct.GlobalParamEx.AssemblyPressure.PressureUpLimit)
@@ -2849,20 +2858,37 @@ namespace TeamAAS_VP.Core
                                         else assyPresRes = false;
                                         DFC.Clear();
 
-                                        int itemIndex = 0;
-                                        var gaps = gap.Split(',');
-                                        foreach (var item in gaps)
+                                        foreach (var item in gapDict)
                                         {
-                                            itemIndex++;
+                                            string upLimitValue = "" ,downLimitValue = "";
+                                            switch (item.Key)
+                                            {
+                                                case "Gap1":
+                                                    upLimitValue = currentProduct.GlobalParamEx.Gap1UpLimit.ToString("F3");
+                                                    downLimitValue = currentProduct.GlobalParamEx.Gap1DownLimit.ToString("F3");
+                                                    break;
+                                                case "Gap2":
+                                                    upLimitValue = currentProduct.GlobalParamEx.Gap2UpLimit.ToString("F3");
+                                                    downLimitValue = currentProduct.GlobalParamEx.Gap2DownLimit.ToString("F3");
+                                                    break;
+                                                case "Gap3":
+                                                    upLimitValue = currentProduct.GlobalParamEx.Gap3UpLimit.ToString("F3");
+                                                    downLimitValue = currentProduct.GlobalParamEx.Gap3DownLimit.ToString("F3");
+                                                    break;
+                                                case "Gap4":
+                                                    upLimitValue = currentProduct.GlobalParamEx.Gap4UpLimit.ToString("F3");
+                                                    downLimitValue = currentProduct.GlobalParamEx.Gap4DownLimit.ToString("F3");
+                                                    break;
+                                            }
                                             DFC.Add(new DataFormCtq
                                             {
                                                 PPID = ProductMainSN[i],
                                                 PROCESS_NAME = stationConfig.DataInfo.PROCESS_NAME,
                                                 PROCESS_START_TIME = _LastMesCheckTime[i].ToString(),
-                                                CTQ_NAME = $"Gap{itemIndex}",
-                                                CTQ_VALUE = item,
-                                                CTQ_LSL = "",
-                                                CTQ_USL = "",
+                                                CTQ_NAME = item.Key,
+                                                CTQ_VALUE = item.Value,
+                                                CTQ_LSL = upLimitValue,
+                                                CTQ_USL = downLimitValue,
                                                 PROCESS_END_TIME = serverTimeResult.Now.ToString(),
                                                 SUPPLIER_NAME = stationConfig.DataInfo.SUPPLIER_NAME,
                                                 COMMODITY_TYPE = stationConfig.DataInfo.COMMODITY_TYPE,

+ 80 - 0
TeamAAS-VM/Models/Product/ProductGlobalParamEx.cs

@@ -23,5 +23,85 @@ namespace TeamAAS_VP.Models.Product
             get { return _DownPressure; }
             set { SetProperty(ref _DownPressure, value); }
         }
+
+        private float _Gap1UpLimit = 0;
+        /// <summary>
+        /// gap1上限
+        /// </summary>
+        public float Gap1UpLimit
+        {
+            get { return _Gap1UpLimit; }
+            set { SetProperty(ref _Gap1UpLimit, value); }
+        }
+
+        private float _Gap1DownLimit = 0;
+        /// <summary>
+        /// gap1下限
+        /// </summary>
+        public float Gap1DownLimit
+        {
+            get { return _Gap1DownLimit; }
+            set { SetProperty(ref _Gap1DownLimit, value); }
+        }
+
+        private float _Gap2UpLimit = 0;
+        /// <summary>
+        /// gap2上限
+        /// </summary>
+        public float Gap2UpLimit
+        {
+            get { return _Gap2UpLimit; }
+            set { SetProperty(ref _Gap2UpLimit, value); }
+        }
+
+        private float _Gap2DownLimit = 0;
+        /// <summary>
+        /// gap2下限
+        /// </summary>
+        public float Gap2DownLimit
+        {
+            get { return _Gap2DownLimit; }
+            set { SetProperty(ref _Gap2DownLimit, value); }
+        }
+
+        private float _Gap3UpLimit = 0;
+        /// <summary>
+        /// gap3上限
+        /// </summary>
+        public float Gap3UpLimit
+        {
+            get { return _Gap3UpLimit; }
+            set { SetProperty(ref _Gap3UpLimit, value); }
+        }
+
+        private float _Gap3DownLimit = 0;
+        /// <summary>
+        /// gap3下限
+        /// </summary>
+        public float Gap3DownLimit
+        {
+            get { return _Gap3DownLimit; }
+            set { SetProperty(ref _Gap3DownLimit, value); }
+        }
+
+        private float _Gap4UpLimit = 0;
+        /// <summary>
+        /// gap4上限
+        /// </summary>
+        public float Gap4UpLimit
+        {
+            get { return _Gap4UpLimit; }
+            set { SetProperty(ref _Gap4UpLimit, value); }
+        }
+
+        private float _Gap4DownLimit = 0;
+        /// <summary>
+        /// gap4下限
+        /// </summary>
+        public float Gap4DownLimit
+        {
+            get { return _Gap4DownLimit; }
+            set { SetProperty(ref _Gap4DownLimit, value); }
+        }
     }
 }

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

@@ -275,6 +275,124 @@
                                                HorizontalAlignment="Right" />
                                 </Grid>
                             </GroupBox>
+
+                            <GroupBox Header="相机复检配置"
+                                      Margin="5"
+                                      Width="200">
+                                <Grid Margin="10">
+                                    <Grid.ColumnDefinitions>
+                                        <ColumnDefinition Width="auto" />
+                                        <ColumnDefinition Width="*" />
+                                        <ColumnDefinition Width="auto" />
+                                    </Grid.ColumnDefinitions>
+                                    <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>
+                                    <TextBlock Text="Gap1上限"
+                                               Grid.Row="0"
+                                               Grid.Column="0"
+                                               HorizontalAlignment="Right" />
+                                    <TextBox Text="{Binding SelectProduct.GlobalParamEx.Gap1UpLimit,Mode=TwoWay}"
+                                             Grid.Row="0"
+                                             Grid.Column="1"
+                                             Margin="6,0" />
+                                    <TextBlock Text="mm"
+                                               Grid.Row="0"
+                                               Grid.Column="2"
+                                               HorizontalAlignment="Right" />
+                                    <TextBlock Text="Gap1下限"
+                                               Grid.Row="1"
+                                               Grid.Column="0"
+                                               HorizontalAlignment="Right" />
+                                    <TextBox Text="{Binding SelectProduct.GlobalParamEx.Gap1DownLimit,Mode=TwoWay}"
+                                             Grid.Row="1"
+                                             Grid.Column="1"
+                                             Margin="6,0" />
+                                    <TextBlock Text="mm"
+                                               Grid.Row="1"
+                                               Grid.Column="2"
+                                               HorizontalAlignment="Right" />
+                                    <TextBlock Text="Gap2上限"
+                                               Grid.Row="2"
+                                               Grid.Column="0"
+                                               HorizontalAlignment="Right" />
+                                    <TextBox Text="{Binding SelectProduct.GlobalParamEx.Gap2UpLimit,Mode=TwoWay}"
+                                             Grid.Row="2"
+                                             Grid.Column="1"
+                                             Margin="6,0" />
+                                    <TextBlock Text="mm"
+                                               Grid.Row="2"
+                                               Grid.Column="2"
+                                               HorizontalAlignment="Right" />
+                                    <TextBlock Text="Gap2下限"
+                                               Grid.Row="3"
+                                               Grid.Column="0"
+                                               HorizontalAlignment="Right" />
+                                    <TextBox Text="{Binding SelectProduct.GlobalParamEx.Gap2DownLimit,Mode=TwoWay}"
+                                             Grid.Row="3"
+                                             Grid.Column="1"
+                                             Margin="6,0" />
+                                    <TextBlock Text="mm"
+                                               Grid.Row="3"
+                                               Grid.Column="2"
+                                               HorizontalAlignment="Right" />
+                                    <TextBlock Text="Gap3上限"
+                                               Grid.Row="4"
+                                               Grid.Column="0"
+                                               HorizontalAlignment="Right" />
+                                    <TextBox Text="{Binding SelectProduct.GlobalParamEx.Gap3UpLimit,Mode=TwoWay}"
+                                             Grid.Row="4"
+                                             Grid.Column="1"
+                                             Margin="6,0" />
+                                    <TextBlock Text="mm"
+                                               Grid.Row="4"
+                                               Grid.Column="2"
+                                               HorizontalAlignment="Right" />
+                                    <TextBlock Text="Gap3下限"
+                                               Grid.Row="5"
+                                               Grid.Column="0"
+                                               HorizontalAlignment="Right" />
+                                    <TextBox Text="{Binding SelectProduct.GlobalParamEx.Gap3DownLimit,Mode=TwoWay}"
+                                             Grid.Row="5"
+                                             Grid.Column="1"
+                                             Margin="6,0" />
+                                    <TextBlock Text="mm"
+                                               Grid.Row="5"
+                                               Grid.Column="2"
+                                               HorizontalAlignment="Right" />
+                                    <TextBlock Text="Gap4上限"
+                                               Grid.Row="6"
+                                               Grid.Column="0"
+                                               HorizontalAlignment="Right" />
+                                    <TextBox Text="{Binding SelectProduct.GlobalParamEx.Gap4UpLimit,Mode=TwoWay}"
+                                             Grid.Row="6"
+                                             Grid.Column="1"
+                                             Margin="6,0" />
+                                    <TextBlock Text="mm"
+                                               Grid.Row="6"
+                                               Grid.Column="2"
+                                               HorizontalAlignment="Right" />
+                                    <TextBlock Text="Gap4下限"
+                                               Grid.Row="7"
+                                               Grid.Column="0"
+                                               HorizontalAlignment="Right" />
+                                    <TextBox Text="{Binding SelectProduct.GlobalParamEx.Gap4DownLimit,Mode=TwoWay}"
+                                             Grid.Row="7"
+                                             Grid.Column="1"
+                                             Margin="6,0" />
+                                    <TextBlock Text="mm"
+                                               Grid.Row="7"
+                                               Grid.Column="2"
+                                               HorizontalAlignment="Right" />
+                                </Grid>
+                            </GroupBox>
                         </StackPanel>
                     </ScrollViewer>
                 </Grid>