Quellcode durchsuchen

修复了视觉静态测试移动相机输出绝对坐标问题
修复了刷卡登录的报错

徐孝锋 vor 7 Monaten
Ursprung
Commit
8ca4ee860b

+ 17 - 1
TeamAAS-VM/ViewModels/Product/VisionStaticAccuracyAnalyzerViewModel.cs

@@ -967,8 +967,24 @@ namespace TeamAAS_VP.ViewModels.Product
                                             //如果需要转换为绝对坐标,则再创建绝对X、绝对Y两列
                                             if (needConvertToAbsolute)
                                             {
+                                                double[] point = new double[3];
                                                 var calibration = _calibrationService.GetCalibration(SelectProcedure.CalibrationId);
-                                                (bool IsSucceed, double X, double Y, double U) = _calibrationService.ConvertPixelToPosition((double.Parse(subitems[0]), double.Parse(subitems[1]), double.Parse(subitems[2])), null, calibration);
+
+                                                var Robot = _robotService.GetRobot(SelectProcedure.RobotId);
+                                                if (Robot!=null)
+                                                {
+                                                    //获取机器人当前坐标系
+                                                    RPoint rPoint = Robot.GetRobotPos();
+
+                                                    point[0] = rPoint.X;
+                                                    point[1] = rPoint.Y;
+                                                    point[2] = rPoint.U;
+                                                    if (calibration.CameraMount == CameraMount.FixedUp || calibration.CameraMount == CameraMount.FixedDown)
+                                                    {
+                                                        point = null;
+                                                    }
+                                                }
+                                                (bool IsSucceed, double X, double Y, double U) = _calibrationService.ConvertPixelToPosition((double.Parse(subitems[0]), double.Parse(subitems[1]), double.Parse(subitems[2])), point, calibration);
                                                 result.Add(Math.Round(X, 5));
                                                 result.Add(Math.Round(Y, 5));
                                             }

+ 12 - 4
TeamAAS-VM/ViewModels/User/CardLoginWindowViewModel.cs

@@ -33,6 +33,7 @@ namespace TeamAAS_VP.ViewModels.User
         #region 字段
         IConfigService _configService;
         private readonly ISystemDatabaseService _systemDatabaseService;
+        private readonly IEventAggregator _eventAggregator;
         private List<TeamAAS_VP.Models.User> Users;
         #endregion
 
@@ -115,10 +116,11 @@ namespace TeamAAS_VP.ViewModels.User
 
         #endregion
 
-        public CardLoginWindowViewModel(IConfigService configService, ISystemDatabaseService systemDatabaseService)
+        public CardLoginWindowViewModel(IConfigService configService, ISystemDatabaseService systemDatabaseService, IEventAggregator eventAggregator)
         {
             _configService = configService;
             _systemDatabaseService = systemDatabaseService;
+            _eventAggregator = eventAggregator;
         }
 
 
@@ -179,15 +181,20 @@ namespace TeamAAS_VP.ViewModels.User
                     return;
                 }
                 Models.User user = new Models.User();
-                user.UserName = code;
+                user.UserName = code.Trim().TrimStart('\0');
                 user.userPart = UserPart.Engineer;
-                user.UserPassword = code; //刷卡密码默认为卡号
+                user.UserPassword = code.Trim().TrimStart('\0'); //刷卡密码默认为卡号
                 user.CreateTime = DateTime.Now;
                 user.Id = -1;
 
                 await _systemDatabaseService.SetCurrentUserAsync(user);
 
-                View.DialogResult = true;
+                App.Current.Dispatcher.Invoke(() =>
+                {
+                    _eventAggregator.GetEvent<UserLoginNotification>().Publish(user);
+                    View.DialogResult = true;
+                });
+                
             }
         }
 
@@ -240,6 +247,7 @@ namespace TeamAAS_VP.ViewModels.User
                     // mark current user in system DB and record login
                     await _systemDatabaseService.SetCurrentUserAsync(user.Id);
                     await _systemDatabaseService.RecordUserLoginAsync(new UserLoginRecord { UserId = user.Id, Success = true, Time = DateTime.UtcNow, Message = "Login success" });
+                    _eventAggregator.GetEvent<UserLoginNotification>().Publish(user);
                     View.DialogResult = true;
                 }