소스 검색

修改mes参数

wanghan 7 달 전
부모
커밋
2e8e369802
5개의 변경된 파일121개의 추가작업 그리고 14개의 파일을 삭제
  1. 44 12
      TeamAAS-VM/Core/Management.cs
  2. 16 0
      TeamAAS-VM/Models/PressureModel.cs
  3. 10 1
      TeamAAS-VM/Services/MesService.cs
  4. 1 1
      TeamAAS-VM/ViewModels/HomeViewModel.cs
  5. 50 0
      TeamAAS-VM/Views/SettingView.xaml

+ 44 - 12
TeamAAS-VM/Core/Management.cs

@@ -2062,7 +2062,7 @@ namespace TeamAAS_VP.Core
                             if (visionResults[0].IsSucceed && visionResults[1].IsSucceed && visionResults[2].IsSucceed && visionResults[3].IsSucceed)
                             {
                                 SendTaskMessage($"固定相机检测OK", MessageLevel.Debug);
-                                gapString = $"1-{visionResults[0].distance},2-{visionResults[1].distance},3-{visionResults[2].distance},4-{visionResults[3].distance}";
+                                gapString = $"1-{visionResults[0].distance.Split(',')[1]},2-{visionResults[1].distance.Split(',')[1]},3-{visionResults[2].distance.Split(',')[1]},4-{visionResults[3].distance.Split(',')[1]}";
                                 await plc.WriteNodeAsync(addressConfig.Out_FixedCameracheckStatus.Address, (Int16)1);
                                 return;
                             }
@@ -2255,8 +2255,7 @@ namespace TeamAAS_VP.Core
                                 }
                                 var code = plc.ReadNode<string>(string.Format(addressConfig.In_Code.Address, i));
                                 string comp = PartSN;
-                                //code = "CN0NJTYVLXU0061W0001";
-                                //comp = "110RNYV4123456789012345";
+                                SendTaskMessage($"产品sn:{code},辅料码:{comp}", MessageLevel.Info);
                                 //询问mes
                                 if (state == 1)
                                 {
@@ -2374,12 +2373,46 @@ namespace TeamAAS_VP.Core
                                     if (i==0)
                                     {
                                         gap = gapString;
-                                        assypress = currentPressure[0].ToString();
+                                        try
+                                        {
+                                            assypress = currentPressure[0].ToString("F2");
+                                            if (currentPressure[0] >= p1.PressureDownLimit && currentPressure[0]<=p1.PressureUpLimit)
+                                            {
+                                                resultIndex = 1;
+                                            }
+                                            else
+                                            {
+                                                resultIndex = 2;
+                                            }
+                                        }
+                                        catch (Exception ex)
+                                        {
+                                            assypress = "0";
+                                            resultIndex = 2;
+                                        }
+                                        SendTaskMessage($"gap:{gap},组装压力:{assypress}", MessageLevel.Info);
                                     }
                                     else if (i == 1)
                                     {
-                                        press = currentPressure[1].ToString();
+                                        try
+                                        {
+                                            press = currentPressure[1].ToString("F2");
+                                            if (currentPressure[1] >= p2.PressureDownLimit && currentPressure[1] <= p2.PressureUpLimit)
+                                            {
+                                                resultIndex = 1;
+                                            }
+                                            else
+                                            {
+                                                resultIndex = 2;
+                                            }
+                                        }
+                                        catch (Exception ex)
+                                        {
+                                            press = "0";
+                                            resultIndex = 2;
+                                        }
                                         presstime = p2.PressureTime.ToString();
+                                        SendTaskMessage($"保压压力:{press},保压时间:{presstime}", MessageLevel.Info);
                                     }
                                     //gap-复检gap参数, press-保压站实际压力值, presstime-保压站保压时间, assypress-组装站实际压力值
                                     (bool isSuccess, string response) = await _mesService.SubmitGetAsync(i,code, comp, gap, press, presstime, assypress, resultIndex == 1 ? true : false, _LastMesCheckTime[i], DateTime.UtcNow);
@@ -2433,16 +2466,15 @@ namespace TeamAAS_VP.Core
                                 }
                                 else
                                 {
-                                    SendTaskMessage($"开始保压信号[{i}]已关闭", MessageLevel.Alarm);
-                                    //// 关闭时的处理(如需)可放在这里
-                                    //SendTaskMessage($"收到关闭保压信号[{i}]...", MessageLevel.Debug);
-                                    //// 停止采集压力并保存
-                                    //await StopAndSavePressureCollectionAsync(currentProduct.Name, code, i);
+                                    SendTaskMessage($"关闭开始保压信号[{i}]...", MessageLevel.Debug);
                                 }
                             }
                         }
-                        //停止组装
-                        else if (string.Format(addressConfig.In_WorkDone.Address, i).Contains(tuple.nodeId))
+                    }
+                    //开始/停止 组装/锁附
+                    for (int i = 0; i < 7; i++)
+                    {
+                        if (string.Format(addressConfig.In_WorkDone.Address, i).Contains(tuple.nodeId))
                         {
                             if (tuple.value is Int16 state)
                             {

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

@@ -33,5 +33,21 @@ namespace TeamAAS_VP.Models
             set { SetProperty(ref _PressureNumMax, value); }
         }
 
+        private float _PressureUpLimit = 0;
+
+        public float PressureUpLimit
+        {
+            get { return _PressureUpLimit; }
+            set { SetProperty(ref _PressureUpLimit, value); }
+        }
+
+        private float _PressureDownLimit = 0;
+
+        public float PressureDownLimit
+        {
+            get { return _PressureDownLimit; }
+            set { SetProperty(ref _PressureDownLimit, value); }
+        }
+
     }
 }

+ 10 - 1
TeamAAS-VM/Services/MesService.cs

@@ -102,6 +102,15 @@ namespace TeamAAS_VP.Services
             station = device.Station.Split(',');
             fixtureId = device.FixtureId.Split(',');
 
+            try
+            {
+                string str = station[num];
+            }
+            catch (Exception ex)
+            {
+                return (false, "本机应该有多站,station应该有多个值");
+            }
+
             if (num == 0)//组装站
             {
                 if (device.F == "PTL")
@@ -135,7 +144,7 @@ namespace TeamAAS_VP.Services
                         // "SFC_OK" 代表和 MES 连接成功
                         if (text.Contains("SFC_OK"))
                         {
-                            if (text.Contains("unit_process_check=OK"))
+                            if (text.Contains("message=OK"))
                             {
                                 return (true, text);
                             }

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

@@ -336,7 +336,7 @@ namespace TeamAAS_VP.ViewModels
         {
             try
             {
-                if (MessageQueue.Count >= 20)
+                if (MessageQueue.Count >= 200)
                 {
                     MessageQueue.RemoveAt(0);// 从队列头部移除最早的消息
                 }

+ 50 - 0
TeamAAS-VM/Views/SettingView.xaml

@@ -2745,6 +2745,7 @@ Grid.Row="1">
                                         <RowDefinition Height="Auto" />
                                         <RowDefinition Height="Auto" />
                                         <RowDefinition Height="Auto" />
+                                        <RowDefinition Height="Auto" />
                                     </Grid.RowDefinitions>
                                     <TextBlock Text="保压时间:"
                                                Grid.Row="0"
@@ -2782,6 +2783,30 @@ Grid.Row="1">
                                                Grid.Row="2"
                                                Grid.Column="2"
                                                HorizontalAlignment="Right" />
+                                    <TextBlock Text="保压上限:"
+                                               Grid.Row="3"
+                                               Grid.Column="0"
+                                               HorizontalAlignment="Right" />
+                                    <TextBox Text="{Binding AssemblyPressureConfig.PressureUpLimit,Mode=TwoWay}"
+                                             Grid.Row="3"
+                                             Grid.Column="1"
+                                             Margin="6,0" />
+                                    <TextBlock Text="kg"
+                                               Grid.Row="3"
+                                               Grid.Column="2"
+                                               HorizontalAlignment="Right" />
+                                    <TextBlock Text="保压下限:"
+                                               Grid.Row="4"
+                                               Grid.Column="0"
+                                               HorizontalAlignment="Right" />
+                                    <TextBox Text="{Binding AssemblyPressureConfig.PressureDownLimit,Mode=TwoWay}"
+                                             Grid.Row="4"
+                                             Grid.Column="1"
+                                             Margin="6,0" />
+                                    <TextBlock Text="kg"
+                                               Grid.Row="4"
+                                               Grid.Column="2"
+                                               HorizontalAlignment="Right" />
                                 </Grid>
                             </GroupBox>
                             <GroupBox Header="后保压配置"
@@ -2799,6 +2824,7 @@ Grid.Row="1">
                                         <RowDefinition Height="Auto" />
                                         <RowDefinition Height="Auto" />
                                         <RowDefinition Height="Auto" />
+                                        <RowDefinition Height="Auto" />
                                     </Grid.RowDefinitions>
                                     <TextBlock Text="保压时间:"
                                                Grid.Row="0"
@@ -2836,6 +2862,30 @@ Grid.Row="1">
                                                Grid.Row="2"
                                                Grid.Column="2"
                                                HorizontalAlignment="Right" />
+                                    <TextBlock Text="保压上限:"
+                                               Grid.Row="3"
+                                               Grid.Column="0"
+                                               HorizontalAlignment="Right" />
+                                    <TextBox Text="{Binding DownPressureConfig.PressureUpLimit,Mode=TwoWay}"
+                                             Grid.Row="3"
+                                             Grid.Column="1"
+                                             Margin="6,0" />
+                                    <TextBlock Text="kg"
+                                               Grid.Row="3"
+                                               Grid.Column="2"
+                                               HorizontalAlignment="Right" />
+                                    <TextBlock Text="保压下限:"
+                                               Grid.Row="4"
+                                               Grid.Column="0"
+                                               HorizontalAlignment="Right" />
+                                    <TextBox Text="{Binding DownPressureConfig.PressureDownLimit,Mode=TwoWay}"
+                                             Grid.Row="4"
+                                             Grid.Column="1"
+                                             Margin="6,0" />
+                                    <TextBlock Text="kg"
+                                               Grid.Row="4"
+                                               Grid.Column="2"
+                                               HorizontalAlignment="Right" />
                                 </Grid>
                             </GroupBox>
                         </StackPanel>