Parcourir la source

Merge branch 'master' of http://49.235.130.76/XXF_1122/DaisyNPILine

KWD il y a 7 mois
Parent
commit
693f3d8509

+ 14 - 0
TeamAAS-VM/Core/Management.cs

@@ -233,6 +233,16 @@ namespace TeamAAS_VP.Core
             get { return _CTtime; }
             set { SetProperty(ref _CTtime, value); }
         }
+
+        private bool _TorqueStatus = false;
+
+        public bool TorqueStatus
+        {
+            get { return _TorqueStatus; }
+            set { _TorqueStatus = value; }
+        }
+
+
         #endregion
 
         #region 命令
@@ -1731,6 +1741,10 @@ namespace TeamAAS_VP.Core
                         }
                         if (state == 1 || state == 2)
                         {
+                            if (TorqueStatus)
+                            {
+                                
+                            }
                             SendTaskMessage(Lang.收到停止锁付信号, MessageLevel.Debug);
                             //位置编号
                             Int16 positionIndex = plc.ReadNode<Int16>(addressConfig.In_ProductNum.Address);

+ 33 - 0
TeamAAS-VM/Models/PLC/PlcAddressConfig.cs

@@ -684,6 +684,26 @@ namespace TeamAAS_VP.Models.PLC
             set { SetProperty(ref _In_PickINC, value); }
         }
 
+        private PlcAddress _ScrewProvide1;
+        /// <summary>
+        /// 螺丝供料器1到位信号
+        /// </summary>
+        public PlcAddress ScrewProvide1
+        {
+            get { return _ScrewProvide1; }
+            set { _ScrewProvide1 = value; }
+        }
+
+        private PlcAddress _ScrewProvide2;
+        /// <summary>
+        /// 螺丝供料器1到位信号
+        /// </summary>
+        public PlcAddress ScrewProvide2
+        {
+            get { return _ScrewProvide2; }
+            set { _ScrewProvide2 = value; }
+        }
+
 
         #endregion
 
@@ -1162,6 +1182,19 @@ namespace TeamAAS_VP.Models.PLC
             Cam_code_mode.DataType = "Bool";
             Cam_code_mode.Description = "PLC二维码读取模式";
 
+            ScrewProvide1 = Ensure(ScrewProvide1);
+            ScrewProvide1.Address = "ns=4;s=DB_Input|X16_螺丝供料器1螺丝到位";
+            ScrewProvide1.DataType = "Bool";
+            ScrewProvide1.Description = "螺丝供料器1螺丝到位";
+
+            ScrewProvide2 = Ensure(ScrewProvide2);
+            ScrewProvide2.Address = "ns=4;s=DB_Input|X17_螺丝供料器2螺丝到位";
+            ScrewProvide2.DataType = "Bool";
+            ScrewProvide2.Description = "螺丝供料器1螺丝到位";
+
+            //ns=4;s=DB_Input|X16_螺丝供料器1螺丝到位
+            //ns=4;s=DB_Input|X17_螺丝供料器2螺丝到位
+
             // 说明:若项目中 PlcAddress 的实际属性名或类型与此不同(例如使用枚举、不同字段名),
             // 请根据实际类型调整赋值。本方法主要提供合理的默认字符串地址、数据类型及描述,便于后续从配置覆盖。
         }

+ 17 - 0
TeamAAS-VM/Models/Torque/PickScrewAccuracyAnalyzerrConfigModel.cs

@@ -27,6 +27,23 @@ namespace TeamAAS_VP.Models.Torque
             get { return _RepeatCount; }
             set { SetProperty(ref _RepeatCount, value); }
         }
+
+        private bool _IsScrewProvide2;
+
+        public bool IsScrewProvide2
+        {
+            get { return _IsScrewProvide2; }
+            set { SetProperty(ref _IsScrewProvide2, value); }
+        }
+
+        private bool _IsScrewProvide1;
+
+        public bool IsScrewProvide1
+        {
+            get { return _IsScrewProvide1; }
+            set { SetProperty(ref _IsScrewProvide1, value); }
+        }
+
     }
 
 }

+ 2 - 7
TeamAAS-VM/Services/TorqueService.cs

@@ -113,8 +113,6 @@ namespace TeamAAS_VP.Services
 
             result.Add(await plc.WriteNodeAsync(addressConfig.Manu_ZAxis_Velocity.Address, speed));
 
-            float Z_Distance = -(PlcPoint.TorquePoints[0].Z_Position_Start - PlcPoint.TorquePoints[0].Z_Position_Stop);
-
             result.Add(await Robot.JumpAsync(point, 0));
 
             result.Add(await plc.WriteNodeAsync<bool>(addressConfig.ManuToHome.Address, true));
@@ -161,12 +159,11 @@ namespace TeamAAS_VP.Services
                 Y = PlcPoint.TorquePoints[2].Y_Position,
                 Z = PlcPoint.TorquePoints[2].Z_Position_Start,
             };
-            //float Z_Distance = -(PlcPoint.TorquePoints[2].Z_Position_Start - PlcPoint.TorquePoints[2].Z_Position_Stop);
-
-            result.Add(await plc.WriteNodeAsync(addressConfig.Manu_ZAxis_Velocity.Address, (float)5.0));
 
             result.Add(await Robot.JumpAsync(point, 0));
 
+            result.Add(await plc.WriteNodeAsync(addressConfig.Manu_ZAxis_Velocity.Address, (float)5.0));
+
             result.Add(await plc.WriteNodeAsync(addressConfig.Check_ScrewTorque.Address, true));
 
             point.Z = PlcPoint.TorquePoints[2].Z_Position_Stop;
@@ -177,8 +174,6 @@ namespace TeamAAS_VP.Services
 
             result.Add(await plc.WriteNodeAsync(addressConfig.Manu_ZAxis_Velocity.Address, (float)100.0));
 
-            result.Add(await BackZero_Async(Robot, point));
-
             return !result.Contains(false);
         }
 

+ 52 - 7
TeamAAS-VM/ViewModels/Home/PickScrewAccuracyAnalyzerViewModel.cs

@@ -190,6 +190,22 @@ namespace TeamAAS_VP.ViewModels.Home
             set { SetProperty(ref _Points, value); }
         }
 
+        private bool _IsScrewProvide2;
+
+        public bool IsScrewProvide2
+        {
+            get { return _IsScrewProvide2; }
+            set { SetProperty(ref _IsScrewProvide2, value); }
+        }
+
+        private bool _IsScrewProvide1;
+
+        public bool IsScrewProvide1
+        {
+            get { return _IsScrewProvide1; }
+            set { SetProperty(ref _IsScrewProvide1, value); }
+        }
+
 
         #endregion
 
@@ -237,7 +253,9 @@ namespace TeamAAS_VP.ViewModels.Home
                 var ConfigModel = new PickScrewAccuracyAnalyzerrConfigModel
                 {
                     RepeatCount = this.RepeatCount,
-                    MoveSpeed = this.MoveSpeed
+                    MoveSpeed = this.MoveSpeed,
+                    IsScrewProvide1 = this.IsScrewProvide1,
+                    IsScrewProvide2 = this.IsScrewProvide2,
                 };
                 FileHelper.WriteJsonFile(ConfigModel, FilePath.PickScrewAccuracyAnalyzerrConfigurationPath);
             }
@@ -254,6 +272,8 @@ namespace TeamAAS_VP.ViewModels.Home
                 var res = FileHelper.ReadJsonFile<PickScrewAccuracyAnalyzerrConfigModel>(FilePath.PickScrewAccuracyAnalyzerrConfigurationPath);
                 this.RepeatCount = res.RepeatCount;
                 this.MoveSpeed = res.MoveSpeed;
+                this.IsScrewProvide2 = res.IsScrewProvide2;
+                this.IsScrewProvide1 = res.IsScrewProvide1;
             }
             catch (Exception ex)
             {
@@ -276,11 +296,10 @@ namespace TeamAAS_VP.ViewModels.Home
             FailCount = 0;
             TestResults = new ObservableCollection<PickDynamicTestResult>();
             Message = "测试进行中...";
-
+            PlcAddressConfig addressConfig = _configService.GetPlcAddresses();
+            OpcUaClientPLC plc = _plcService.GetPlcByNumber(addressConfig.PlcNo) as OpcUaClientPLC;
             try
             {
-                PlcAddressConfig addressConfig = _configService.GetPlcAddresses();
-                OpcUaClientPLC plc = _plcService.GetPlcByNumber(addressConfig.PlcNo) as OpcUaClientPLC;
                 var result = System.Windows.MessageBox.Show("确定进行连续测试吗?", "提示", System.Windows.MessageBoxButton.YesNo, System.Windows.MessageBoxImage.Question);
                 if (result != System.Windows.MessageBoxResult.Yes)
                 {
@@ -297,6 +316,30 @@ namespace TeamAAS_VP.ViewModels.Home
 
                 while (CurrentProgress < RepeatCount)
                 {
+                    if (IsScrewProvide1)
+                    {
+                        while(!await plc.ReadNodeAsync<bool>(addressConfig.ScrewProvide1.Address))
+                        {
+                            Message = "螺丝供料机1未到位,可暂停等待";
+                            if (_cts.Token.IsCancellationRequested)
+                            {
+                                Message = "测试已取消!";
+                                break;
+                            }
+                        }
+                    }
+                    if (IsScrewProvide2)
+                    {
+                        while (!await plc.ReadNodeAsync<bool>(addressConfig.ScrewProvide2.Address))
+                        {
+                            Message = "螺丝供料机2未到位,可暂停等待";
+                            if (_cts.Token.IsCancellationRequested)
+                            {
+                                Message = "测试已取消!";
+                                break;
+                            }
+                        }
+                    }
                     DateTime startTime = DateTime.Now;
                     if (_cts.Token.IsCancellationRequested)
                     {
@@ -353,8 +396,9 @@ namespace TeamAAS_VP.ViewModels.Home
                 if (CurrentProgress >= RepeatCount)
                 {
                     Message = "测试完成!";
-                    await _torqueService.Throw_Screw_Async(Robot, plc, addressConfig, Points, MoveSpeed);
+                    
                 }
+
             }
             catch (Exception ex)
             {
@@ -362,6 +406,7 @@ namespace TeamAAS_VP.ViewModels.Home
             }
             finally
             {
+                await _torqueService.Throw_Screw_Async(Robot, plc, addressConfig, Points, MoveSpeed);
                 IsRunning = false;
             }
         }
@@ -370,8 +415,8 @@ namespace TeamAAS_VP.ViewModels.Home
         {
             App.Current.Dispatcher.Invoke(() =>
             {
-                _eventAggregator.GetEvent<SnackbarMessageNotification>().Publish(new MessageParameter() { Msg =msg, Duration = 1 });
-            });            
+                _eventAggregator.GetEvent<SnackbarMessageNotification>().Publish(new MessageParameter() { Msg = msg, Duration = 1 });
+            });
         }
 
         private void ExecuteExportCSVCommand()

+ 6 - 4
TeamAAS-VM/ViewModels/Home/TorqueCheckViewModel.cs

@@ -528,7 +528,7 @@ namespace TeamAAS_VP.ViewModels.Home
         {
             try
             {
-                await Task.Delay(100);
+                await Task.Delay(500);
                 TValue = management.SignalValue;
                 double tvalue = double.Parse(TValue.Split(' ')[0]);
                 double pvalue = Value;
@@ -580,13 +580,14 @@ namespace TeamAAS_VP.ViewModels.Home
 
             while (count++ < 20)
             {
-                await Task.Delay(100);
+                await Task.Delay(50);
                 oking = plc.ReadNode(addressConfig.Screw_OK.Address);
                 nging = plc.ReadNode(addressConfig.Screw_NG.Address);
 
                 if (oking != null && nging != null)
                 {
-                    bool okin = (bool)oking; bool ngin = (bool)nging;
+                    bool okin = (bool)oking;
+                    bool ngin = (bool)nging;
                     //电批OKNG
                     if (okin || ngin)
                     {
@@ -602,9 +603,10 @@ namespace TeamAAS_VP.ViewModels.Home
                         });
                         //await _systemDatabaseService.RecordLockResultAsync(lockResult);
                         await plc.WriteNodeAsync(addressConfig.In_WorkDone.Address, (Int16)0);
-
+                        //await Task.Delay(200);
                         Value = lockResult.LockTorque;
                         await plc.WriteNodeAsync(addressConfig.Check_ScrewTorque.Address, false);
+                        await _torqueService.BackZero_Async(Robot,Robot.GetRobotPos());
                         return true;
                     }
                 }

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

@@ -439,7 +439,7 @@ namespace TeamAAS_VP.ViewModels
             {
                 Key="X",
                 Position = AxisPosition.Bottom,
-                Title = Lang.角度,
+                Title = Lang.锁付圈数,
                 Minimum = 0,
                 MajorGridlineStyle = LineStyle.Solid,
                 MinorGridlineStyle = LineStyle.Dot

+ 14 - 1
TeamAAS-VM/Views/Home/PickScrewAccuracyAnalyzer.xaml

@@ -263,7 +263,20 @@
 
                             <WrapPanel HorizontalAlignment="Center"
                                        Margin="0 10 0 0">
-
+                                <CheckBox Content="启用螺丝供料机1"
+                                          Foreground="Black"
+                                          Style="{StaticResource MaterialDesignCheckBox}"
+                                          VerticalAlignment="Center"
+                                          IsChecked="{Binding IsScrewProvide1}"
+                                          Margin="10,0"
+                                          FontSize="15" />
+                                <CheckBox Content="启用螺丝供料机2"
+                                          Foreground="Black"
+                                          Style="{StaticResource MaterialDesignCheckBox}"
+                                          VerticalAlignment="Center"
+                                          IsChecked="{Binding IsScrewProvide2}"
+                                          Margin="10,0"
+                                          FontSize="15" />
                                 <!--<Button Content="单次测试"
                                         Background="#3498DB"
                                         Foreground="White"