wanghan 10 bulan lalu
induk
melakukan
69c2b7b162

+ 6 - 1
TeamAAS-VM/Core/FilePath.cs

@@ -70,6 +70,11 @@ namespace TeamAAS_VP.Core
         /// <summary>
         /// <summary>
         /// 扭力测量仪路径
         /// 扭力测量仪路径
         /// </summary>
         /// </summary>
-        public static string SignalConfigPath = "..//Config//扭力测量仪配置文件.json";
+        public static string SignalConfigPath { get; set; } = "..//Config//扭力测量仪配置文件.json";
+        /// <summary>
+        /// 生产排班参数路径
+        /// </summary>
+
+        public static readonly string WorkShiftParamPath = "..//Log//WorkShiftParam.cfg";
     }
     }
 }
 }

+ 1 - 1
TeamAAS-VM/Core/Management.cs

@@ -683,7 +683,7 @@ namespace TeamAAS_VP.Core
             if (File.Exists(FilePath.SignalConfigPath))
             if (File.Exists(FilePath.SignalConfigPath))
             {
             {
                 try
                 try
-                {
+                {                    
                     var port = FileHelper.ReadJsonFile<string>(FilePath.SignalConfigPath);
                     var port = FileHelper.ReadJsonFile<string>(FilePath.SignalConfigPath);
                     if (port != null)
                     if (port != null)
                     {
                     {

+ 2 - 6
TeamAAS-VM/Events/WorkShiftChangedNotification.cs

@@ -7,13 +7,9 @@ using System.Threading.Tasks;
 
 
 namespace TeamAAS_VP.Events
 namespace TeamAAS_VP.Events
 {
 {
-    public class WorkShiftChangedNotification:PubSubEvent<ShiftChangedPayload>
+    public class WorkShiftChangedNotification:PubSubEvent
     {
     {
 
 
     }
     }
-    public class ShiftChangedPayload
-    {
-        public string NewShiftName { get; set; }  // 中文注释:新班次名称
-        public DateTime SwitchTime { get; set; }  // 中文注释:切换时间
-    }
+
 }
 }

+ 3 - 3
TeamAAS-VM/Events/WorkShiftUpdateNotification.cs

@@ -4,11 +4,11 @@ using System.Collections.Generic;
 using System.Linq;
 using System.Linq;
 using System.Text;
 using System.Text;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
-using TeamAAS_VP.Models.Torque;
+using TeamAAS_VP.Models;
 
 
 namespace TeamAAS_VP.Events
 namespace TeamAAS_VP.Events
 {
 {
-    public class WorkShiftUpdateNotification:PubSubEvent<WorkShift>
+    public class WorkShiftUpdateNotification : PubSubEvent<WorkShift>
     {
     {
-            }
+    }
 }
 }

+ 2 - 0
TeamAAS-VM/Models/Torque/PlcPoint_Torque.cs

@@ -55,6 +55,8 @@ namespace TeamAAS_VP.Models.Torque
         }
         }
 
 
 
 
+
+
         public PlcPoint_Torque()
         public PlcPoint_Torque()
         {
         {
             Number = 0;
             Number = 0;

+ 2 - 1
TeamAAS-VM/Models/Torque/TorqueProduceModel.cs

@@ -9,7 +9,7 @@ using TeamAAS_VP.Models.PLC;
 
 
 namespace TeamAAS_VP.Models.Torque
 namespace TeamAAS_VP.Models.Torque
 {
 {
-    public class TorqueProduceModel:BindableBase
+    public class TorqueProduceModel : BindableBase
     {
     {
         private ObservableCollection<PlcPoint_Torque> _TorquePoints = new ObservableCollection<PlcPoint_Torque>();
         private ObservableCollection<PlcPoint_Torque> _TorquePoints = new ObservableCollection<PlcPoint_Torque>();
         /// <summary>
         /// <summary>
@@ -26,6 +26,7 @@ namespace TeamAAS_VP.Models.Torque
         /// </summary>
         /// </summary>
         public float TorqueValue { get; set; } = 0;
         public float TorqueValue { get; set; } = 0;
 
 
+        public string TorqueMeasureSerialPort { get; set; } = string.Empty;
 
 
     }
     }
 }
 }

+ 0 - 24
TeamAAS-VM/Models/Torque/TorqueTest.cs

@@ -1,24 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace TeamAAS_VP.Models.Torque
-{
-    /// <summary>
-    /// 扭力点检参数
-    /// </summary>
-    public class TorqueTest
-    {
-        public double Xpoint { get; set; }
-        public double Ypoint { get; set; }
-        public double Zpoint { get; set; }
-        /// <summary>
-        /// 扭力阈值
-        /// </summary>
-        public double TorqueValue { get; set; }
-
-        public double ZDistance { get; set; }
-    }
-}

+ 0 - 20
TeamAAS-VM/Models/Torque/WorkShift.cs

@@ -1,20 +0,0 @@
-using Prism.Mvvm;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace TeamAAS_VP.Models.Torque
-{
-    public class WorkShift : BindableBase
-    {
-        public string DayShift { get; set; }
-
-        public string NightShift { get; set; }
-
-        public bool DayShiftSpotCheck { get; set; }
-
-        public bool NightShiftSpotCheck { get; set; }
-    }
-}

+ 37 - 0
TeamAAS-VM/Models/WorkShift.cs

@@ -0,0 +1,37 @@
+using Prism.Mvvm;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace TeamAAS_VP.Models
+{
+    public class WorkShift : BindableBase
+    {
+        /// <summary>
+        /// 白班时间
+        /// </summary>
+        private string _DayShift;
+        public string DayShift
+        {
+            get { return _DayShift; }
+            set { SetProperty(ref _DayShift, value); }
+        }
+        /// <summary>
+        /// 晚班时间
+        /// </summary>
+        private string _NightShift;
+        public string NightShift
+        {
+            get { return _NightShift; }
+            set { SetProperty(ref _NightShift, value); }
+        }
+
+        public bool DayShiftSpotCheck { get; set; }
+
+        public bool NightShiftSpotCheck { get; set; }
+
+        public DateTime LoginTime { get; set; }
+    }
+}

+ 30 - 7
TeamAAS-VM/Services/ShiftWatcherService.cs

@@ -5,7 +5,9 @@ using System.Linq;
 using System.Text;
 using System.Text;
 using System.Threading;
 using System.Threading;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
+using TeamAAS_VP.Core;
 using TeamAAS_VP.Events;
 using TeamAAS_VP.Events;
+using TeamAAS_VP.Models;
 
 
 namespace TeamAAS_VP.Services
 namespace TeamAAS_VP.Services
 {
 {
@@ -14,8 +16,9 @@ namespace TeamAAS_VP.Services
         private readonly IEventAggregator _eventAggregator;
         private readonly IEventAggregator _eventAggregator;
         private Timer _timer;
         private Timer _timer;
         private string _lastShift;
         private string _lastShift;
+        private WorkShift workShift;
 
 
-        public ShiftWatcherService(IEventAggregator  eventAggregator)
+        public ShiftWatcherService(IEventAggregator eventAggregator)
         {
         {
             this._eventAggregator = eventAggregator;
             this._eventAggregator = eventAggregator;
         }
         }
@@ -24,10 +27,30 @@ namespace TeamAAS_VP.Services
         {
         {
             // 中文注释:每秒检测一次
             // 中文注释:每秒检测一次
             _timer = new Timer(_ => CheckShift(), null, 0, 1000);
             _timer = new Timer(_ => CheckShift(), null, 0, 1000);
+            try
+            {
+                this.workShift = FileHelper.ReadJsonFile<WorkShift>(FilePath.WorkShiftParamPath);
+            }
+            catch (Exception)
+            { }
+            _eventAggregator.GetEvent<WorkShiftUpdateNotification>().Subscribe((p) =>
+            {
+                this.workShift = p;
+            });
         }
         }
 
 
         private void CheckShift()
         private void CheckShift()
         {
         {
+            DateTime dateTimeDayShift = DateTime.Now;
+            DateTime dateTimeNightShift = DateTime.Now;
+            try
+            {
+                dateTimeDayShift = DateTime.Parse(workShift.DayShift);
+                dateTimeNightShift = DateTime.Parse(workShift.NightShift);
+            }
+            catch
+            {
+            }
             string currentShift =
             string currentShift =
                 (DateTime.Now.Hour >= 8 && DateTime.Now.Hour < 20) ? "Day" : "Night";
                 (DateTime.Now.Hour >= 8 && DateTime.Now.Hour < 20) ? "Day" : "Night";
 
 
@@ -41,12 +64,12 @@ namespace TeamAAS_VP.Services
             {
             {
                 _lastShift = currentShift;
                 _lastShift = currentShift;
 
 
-                // 中文注释:只负责“通知”,不要弹窗
-                _eventAggregator.GetEvent<WorkShiftChangedNotification>().Publish(new ShiftChangedPayload
+                // 只负责“通知”,不要弹窗
+                _ = App.Current.Dispatcher.BeginInvoke(new Action(() =>
                 {
                 {
-                    NewShiftName = currentShift,
-                    SwitchTime = DateTime.Now
-                });
+                    _eventAggregator.GetEvent<WorkShiftChangedNotification>().Publish();
+                }));
+
             }
             }
         }
         }
     }
     }
@@ -273,7 +296,6 @@ namespace YourApp.ViewModels
                 // 如果你想强制退出可以用:
                 // 如果你想强制退出可以用:
                 // Application.Current.Shutdown();
                 // Application.Current.Shutdown();
             }
             }
-
             _loginShowing = false;
             _loginShowing = false;
         }
         }
     }
     }
@@ -388,6 +410,7 @@ namespace YourApp
 
 
  */
  */
 
 
+
 /*
 /*
 
 
  ///// <summary>
  ///// <summary>

+ 3 - 3
TeamAAS-VM/Services/TorqueService.cs

@@ -60,7 +60,7 @@ namespace TeamAAS_VP.Services
         {
         {
             try
             try
             {
             {
-                if (File.Exists(TorqueParametrPath))
+                if (!File.Exists(TorqueParametrPath))
                 {
                 {
                     Directory.CreateDirectory(TorqueParametrPath);
                     Directory.CreateDirectory(TorqueParametrPath);
                 }
                 }
@@ -83,9 +83,9 @@ namespace TeamAAS_VP.Services
                     }
                     }
                 }
                 }
             }
             }
-            catch (Exception)
+            catch (Exception ex)
             {
             {
-                MessageBox.Show("写入数据失败");
+                MessageBox.Show("写入数据失败"+ex);
 
 
             }
             }
         }
         }

+ 1 - 2
TeamAAS-VM/TeamAAS-VP.csproj

@@ -542,10 +542,9 @@
     <Compile Include="Models\Torque\PlcPoint_Torque.cs" />
     <Compile Include="Models\Torque\PlcPoint_Torque.cs" />
     <Compile Include="Models\PhotoCaptureRecord.cs" />
     <Compile Include="Models\PhotoCaptureRecord.cs" />
     <Compile Include="Models\ScrewFeederBatchRecord.cs" />
     <Compile Include="Models\ScrewFeederBatchRecord.cs" />
-    <Compile Include="Models\Torque\TorqueTest.cs" />
     <Compile Include="Models\Torque\Torque_TaskStatus.cs" />
     <Compile Include="Models\Torque\Torque_TaskStatus.cs" />
     <Compile Include="Models\Torque\TorqueProduceModel.cs" />
     <Compile Include="Models\Torque\TorqueProduceModel.cs" />
-    <Compile Include="Models\Torque\WorkShift.cs" />
+    <Compile Include="Models\WorkShift.cs" />
     <Compile Include="Resources\Languages\Lang.Designer.cs">
     <Compile Include="Resources\Languages\Lang.Designer.cs">
       <AutoGen>True</AutoGen>
       <AutoGen>True</AutoGen>
       <DesignTime>True</DesignTime>
       <DesignTime>True</DesignTime>

+ 15 - 0
TeamAAS-VM/ViewModels/Home/TorqueCheckViewModel.cs

@@ -229,6 +229,10 @@ namespace TeamAAS_VP.ViewModels.Home
         public DelegateCommand TechPointCommand =>
         public DelegateCommand TechPointCommand =>
             _TechPointCommand ?? (_TechPointCommand = new DelegateCommand(ExecuteTechPointCommand));
             _TechPointCommand ?? (_TechPointCommand = new DelegateCommand(ExecuteTechPointCommand));
 
 
+        private DelegateCommand _MovePointCommand;
+        public DelegateCommand MovePointCommand =>
+            _MovePointCommand ?? (_MovePointCommand = new DelegateCommand(ExecuteMovePointCommand));
+
         private DelegateCommand _ModifyCommand;
         private DelegateCommand _ModifyCommand;
         public DelegateCommand ModifyCommand =>
         public DelegateCommand ModifyCommand =>
             _ModifyCommand ?? (_ModifyCommand = new DelegateCommand(ExecuteModifyCommand));
             _ModifyCommand ?? (_ModifyCommand = new DelegateCommand(ExecuteModifyCommand));
@@ -725,5 +729,16 @@ namespace TeamAAS_VP.ViewModels.Home
             MessageBox.Show("参数保存成功");
             MessageBox.Show("参数保存成功");
         }
         }
 
 
+        private async void ExecuteMovePointCommand()
+        {
+            if (MessageBox.Show($"确认要进行单独移动至点位吗?", "执行点位", MessageBoxButton.YesNo, MessageBoxImage.Question) != MessageBoxResult.Yes)
+            {
+                return;
+            }
+            PlcAddressConfig addressConfig = _configService.GetPlcAddresses();
+            OpcUaClientPLC plc = _plcService.GetPlcByNumber(addressConfig.PlcNo) as OpcUaClientPLC;
+            await _torqueService.Signal_Move_Async(Robot, plc, addressConfig, SelectedPoint);
+        }
+
     }
     }
 }
 }

+ 55 - 6
TeamAAS-VM/ViewModels/MainWindowViewModel.cs

@@ -33,6 +33,7 @@ using TeamAAS_VP.Models;
 using TeamAAS_VP.Resources.Languages;
 using TeamAAS_VP.Resources.Languages;
 using TeamAAS_VP.Services;
 using TeamAAS_VP.Services;
 using TeamAAS_VP.Views;
 using TeamAAS_VP.Views;
+using TeamAAS_VP.Views.User;
 using WPFLocalizeExtension.Engine;
 using WPFLocalizeExtension.Engine;
 using static MaterialDesignThemes.Wpf.Theme.ToolBar;
 using static MaterialDesignThemes.Wpf.Theme.ToolBar;
 
 
@@ -54,13 +55,14 @@ namespace TeamAAS_VP.ViewModels
         ICalibrationService _calibrationService;
         ICalibrationService _calibrationService;
         ISystemDatabaseService _systemDatabaseService;
         ISystemDatabaseService _systemDatabaseService;
         IDatabaseInitializer _databaseInitializer;
         IDatabaseInitializer _databaseInitializer;
-
+        ShiftWatcherService _shiftWatcherService;
         private Management management;
         private Management management;
         private Guid CurrentTime;
         private Guid CurrentTime;
         private Guid RunTime;
         private Guid RunTime;
         private DateTime StartTime;
         private DateTime StartTime;
         private Guid currentUser;
         private Guid currentUser;
         Timer timer;
         Timer timer;
+        private bool _loginShowing;
 
 
         #region 属性
         #region 属性
 
 
@@ -127,7 +129,7 @@ namespace TeamAAS_VP.ViewModels
 
 
         public MainWindowViewModel(IRegionManager regionManager, IEventAggregator ea, IRegionNavigationService regionNavigationService, IContainerProvider container, IDialogService dialogService,
         public MainWindowViewModel(IRegionManager regionManager, IEventAggregator ea, IRegionNavigationService regionNavigationService, IContainerProvider container, IDialogService dialogService,
             IConfigService configService, IRobotService robotService, ICameraService cameraService, IFeederService feederService, IPlcService plcService, IProductService productService,
             IConfigService configService, IRobotService robotService, ICameraService cameraService, IFeederService feederService, IPlcService plcService, IProductService productService,
-            ICalibrationService calibrationService, ISystemDatabaseService systemDatabaseService, IDatabaseInitializer databaseInitializer)
+            ICalibrationService calibrationService, ISystemDatabaseService systemDatabaseService, IDatabaseInitializer databaseInitializer, ShiftWatcherService shiftWatcherService)
         {
         {
             _regionManager = regionManager;
             _regionManager = regionManager;
             _regionNavigationService = regionNavigationService;
             _regionNavigationService = regionNavigationService;
@@ -143,6 +145,7 @@ namespace TeamAAS_VP.ViewModels
             _calibrationService = calibrationService;
             _calibrationService = calibrationService;
             _systemDatabaseService = systemDatabaseService;
             _systemDatabaseService = systemDatabaseService;
             _databaseInitializer = databaseInitializer;
             _databaseInitializer = databaseInitializer;
+            _shiftWatcherService = shiftWatcherService;
             //订阅权限登录事件
             //订阅权限登录事件
             _eventAggregator.GetEvent<UserLoginNotification>().Subscribe(LoginChange);
             _eventAggregator.GetEvent<UserLoginNotification>().Subscribe(LoginChange);
             management = _container.Resolve<Management>();
             management = _container.Resolve<Management>();
@@ -150,7 +153,6 @@ namespace TeamAAS_VP.ViewModels
             LoadedCommand = new DelegateCommand(OnLoad);
             LoadedCommand = new DelegateCommand(OnLoad);
             ClosedCommand = new DelegateCommand(OnClose);
             ClosedCommand = new DelegateCommand(OnClose);
             Status = management.Status;
             Status = management.Status;
-            
 
 
 
 
         }
         }
@@ -208,7 +210,6 @@ namespace TeamAAS_VP.ViewModels
                 default:
                 default:
                     break;
                     break;
             }
             }
-
         }
         }
 
 
         private async void OnLoad()
         private async void OnLoad()
@@ -221,7 +222,6 @@ namespace TeamAAS_VP.ViewModels
             systemconfig.SoftwareVersion = AppVersion;
             systemconfig.SoftwareVersion = AppVersion;
             _configService.SaveSystemConfiguration(systemconfig);
             _configService.SaveSystemConfiguration(systemconfig);
 
 
-
             // 设置语言
             // 设置语言
             //#region 设置语言
             //#region 设置语言
             //var currentlanguage = _configService.GetSystemConfiguration().CurrentLanguage;
             //var currentlanguage = _configService.GetSystemConfiguration().CurrentLanguage;
@@ -345,7 +345,12 @@ namespace TeamAAS_VP.ViewModels
                 _eventAggregator.GetEvent<ProgressNotification>().Publish(new UProgressBar.ProgressParameter { Maximum = max, Minimum = 0, SubTitle = $"{Lang.初始化中}...", Message = $"{Lang.正在开启}...", Value = curvalue });
                 _eventAggregator.GetEvent<ProgressNotification>().Publish(new UProgressBar.ProgressParameter { Maximum = max, Minimum = 0, SubTitle = $"{Lang.初始化中}...", Message = $"{Lang.正在开启}...", Value = curvalue });
             }));
             }));
             await management.InitSignal();
             await management.InitSignal();
-            
+
+            //-------------------SETP 13: 开启生产排班检测-----------------------------------------------------------------------
+            // 订阅班次切换事件,强制在UI线程执行(这样可以安全Hide/Show主窗口和弹窗)
+
+            _eventAggregator.GetEvent<WorkShiftChangedNotification>().Subscribe(OnShiftChanged, ThreadOption.UIThread);
+            _shiftWatcherService.Start();
 
 
             //当前日期
             //当前日期
             CurrentTime = Guid.NewGuid();
             CurrentTime = Guid.NewGuid();
@@ -400,6 +405,15 @@ namespace TeamAAS_VP.ViewModels
             var d = Status.FirstOrDefault(b => b.ID == RunTime);
             var d = Status.FirstOrDefault(b => b.ID == RunTime);
             var run = (DateTime.Now - StartTime);
             var run = (DateTime.Now - StartTime);
             d.Message = string.Format(Lang.已运行时长, (int)run.TotalDays, run.Hours, run.Minutes, run.Seconds);
             d.Message = string.Format(Lang.已运行时长, (int)run.TotalDays, run.Hours, run.Minutes, run.Seconds);
+
+
+
+        }
+
+        public void Stop()
+        {
+            timer?.Dispose();
+            timer = null;
         }
         }
 
 
         private void LoginChange(Models.User user)
         private void LoginChange(Models.User user)
@@ -410,6 +424,41 @@ namespace TeamAAS_VP.ViewModels
                 us.Message = $"{Lang.当前用户}:{_systemDatabaseService.GetCurrentUser().UserName}[{_systemDatabaseService.GetCurrentUser().userPart.ToString()}]";
                 us.Message = $"{Lang.当前用户}:{_systemDatabaseService.GetCurrentUser().UserName}[{_systemDatabaseService.GetCurrentUser().userPart.ToString()}]";
             }
             }
         }
         }
+
+        // 中文注释:班次切换时触发:停流程→隐藏主窗口→弹登录→登录成功恢复
+        private void OnShiftChanged()
+        {
+            if (_loginShowing)
+                return;
+
+            _loginShowing = true;
+
+            // 1 隐藏主窗口
+            var mainWindow = Application.Current.MainWindow;
+            mainWindow?.Hide();
+
+            CardLoginWindow loginWindow = new CardLoginWindow();
+            loginWindow.Show();
+
+            bool? result = loginWindow.ShowDialog();
+
+            // 4️⃣ 根据登录结果处理
+            if (result == true)
+            {
+                // 登录成功 → 显示主窗口 
+                mainWindow?.Show();
+            }
+            else
+            {
+                // 登录失败/取消:按需求决定(示例:仍显示主窗口但不启动流程)
+                //mainWindow?.Show();
+
+                // 如果你想强制退出可以用:
+                Application.Current.Shutdown();
+            }
+            _loginShowing = false;
+        }
+
         #endregion
         #endregion
     }
     }
 }
 }

+ 38 - 4
TeamAAS-VM/ViewModels/SettingViewModel.cs

@@ -30,6 +30,7 @@ using TeamAAS_VP.Interfaces;
 using TeamAAS_VP.Models;
 using TeamAAS_VP.Models;
 using TeamAAS_VP.Models.Feeder;
 using TeamAAS_VP.Models.Feeder;
 using TeamAAS_VP.Models.Lights;
 using TeamAAS_VP.Models.Lights;
+using TeamAAS_VP.Models.Torque;
 using TeamAAS_VP.Resources.Languages;
 using TeamAAS_VP.Resources.Languages;
 using TeamAAS_VP.Services;
 using TeamAAS_VP.Services;
 using TeamAAS_VP.ViewModels.User;
 using TeamAAS_VP.ViewModels.User;
@@ -342,6 +343,14 @@ namespace TeamAAS_VP.ViewModels
             set { SetProperty(ref _CardReaderConfig, value); }
             set { SetProperty(ref _CardReaderConfig, value); }
         }
         }
 
 
+        private WorkShift _WorkShift;
+
+        public WorkShift WorkShifts
+        {
+            get { return _WorkShift; }
+            set { SetProperty(ref _WorkShift, value); }
+        }
+
         #endregion
         #endregion
 
 
         #region 命令
         #region 命令
@@ -444,7 +453,10 @@ namespace TeamAAS_VP.ViewModels
         public DelegateCommand SaveCardReaderConfigCommand =>
         public DelegateCommand SaveCardReaderConfigCommand =>
             _SaveCardReaderConfigCommand ?? (_SaveCardReaderConfigCommand = new DelegateCommand(ExecuteSaveCardReaderConfigCommand));
             _SaveCardReaderConfigCommand ?? (_SaveCardReaderConfigCommand = new DelegateCommand(ExecuteSaveCardReaderConfigCommand));
 
 
-        
+        private DelegateCommand _SaveWorkShiftCommand;
+        public DelegateCommand SaveWorkShiftCommand =>
+            _SaveWorkShiftCommand ?? (_SaveWorkShiftCommand = new DelegateCommand(ExecuteSaveWorkShiftCommand));
+
         #endregion
         #endregion
 
 
         #region 事件
         #region 事件
@@ -1186,9 +1198,31 @@ namespace TeamAAS_VP.ViewModels
         }
         }
         #endregion
         #endregion
 
 
+        #region 生产排班
+
+        private void ExecuteSaveWorkShiftCommand()
+        {
+            try
+            {
+                FileHelper.WriteJsonFile(WorkShifts, FilePath.WorkShiftParamPath);
+                _eventAggregator.GetEvent<WorkShiftUpdateNotification>().Publish(WorkShifts);
+            }
+            catch (Exception)
+            { }
+        }
+
+        #endregion
+
         private void OnLoad()
         private void OnLoad()
         {
         {
+            try
+            {
+                this.WorkShifts = FileHelper.ReadJsonFile<WorkShift>(FilePath.WorkShiftParamPath);
+            }
+            catch (Exception)
+            {
 
 
+            }
         }
         }
 
 
         private void OnPropertyChanged(object sender, PropertyChangedEventArgs e)
         private void OnPropertyChanged(object sender, PropertyChangedEventArgs e)
@@ -1331,7 +1365,7 @@ namespace TeamAAS_VP.ViewModels
                 DeviceInfo = _configService.GetDeviceInfo();
                 DeviceInfo = _configService.GetDeviceInfo();
             }
             }
 
 
-            if (ScrewFeederList==null)
+            if (ScrewFeederList == null)
             {
             {
                 var screwFeeders = _configService.GetAllScrewFeeders();
                 var screwFeeders = _configService.GetAllScrewFeeders();
                 ScrewFeederList = new ObservableCollection<ScrewFeederInfo>(screwFeeders);
                 ScrewFeederList = new ObservableCollection<ScrewFeederInfo>(screwFeeders);
@@ -1362,8 +1396,8 @@ namespace TeamAAS_VP.ViewModels
                 FixedCameraPutNum = sys.FixedCameraPutNum;
                 FixedCameraPutNum = sys.FixedCameraPutNum;
                 FixedCameracheckNum = sys.FixedCameracheckNum;
                 FixedCameracheckNum = sys.FixedCameracheckNum;
                 ScrewTeachNum = sys.ScrewTeachNum;
                 ScrewTeachNum = sys.ScrewTeachNum;
-                IsSaveScrewCurve= sys.IsSaveScrewCurve;
-                ScrewCurvePath= sys.ScrewCurvePath;
+                IsSaveScrewCurve = sys.IsSaveScrewCurve;
+                ScrewCurvePath = sys.ScrewCurvePath;
             }
             }
 
 
             if (isFirstLoad)
             if (isFirstLoad)

+ 7 - 0
TeamAAS-VM/Views/Home/TorqueCheck.xaml

@@ -461,6 +461,13 @@
                                     HorizontalAlignment="Center"
                                     HorizontalAlignment="Center"
                                     Grid.Row="3"
                                     Grid.Row="3"
                                     Grid.ColumnSpan="2">
                                     Grid.ColumnSpan="2">
+                            <Button Content="移动"
+                                    Margin="10"
+                                    HorizontalAlignment="Right"
+                                    Width="100"
+                                    materialDesign:ButtonAssist.CornerRadius="10"
+                                    Style="{StaticResource MaterialDesignRaisedDarkButton}"
+                                    Command="{Binding MovePointCommand}" />
                             <Button Content="{lex:Loc 示教}"
                             <Button Content="{lex:Loc 示教}"
                                     Margin="0,10"
                                     Margin="0,10"
                                     HorizontalAlignment="Right"
                                     HorizontalAlignment="Right"

+ 129 - 10
TeamAAS-VM/Views/SettingView.xaml

@@ -1523,7 +1523,7 @@
                                 <b:Interaction.Triggers>
                                 <b:Interaction.Triggers>
                                     <b:EventTrigger EventName="SelectionChanged">
                                     <b:EventTrigger EventName="SelectionChanged">
                                         <b:InvokeCommandAction Command="{Binding LightModelChangedCommand}"
                                         <b:InvokeCommandAction Command="{Binding LightModelChangedCommand}"
-                                                               CommandParameter="{Binding SelectLightController}"/>
+                                                               CommandParameter="{Binding SelectLightController}" />
                                     </b:EventTrigger>
                                     </b:EventTrigger>
                                 </b:Interaction.Triggers>
                                 </b:Interaction.Triggers>
                             </ComboBox>
                             </ComboBox>
@@ -2176,7 +2176,8 @@
                                    HorizontalAlignment="Stretch" />
                                    HorizontalAlignment="Stretch" />
                     </StackPanel>
                     </StackPanel>
                 </TabItem.Header>
                 </TabItem.Header>
-                <StackPanel Orientation="Vertical" Margin="20">
+                <StackPanel Orientation="Vertical"
+                            Margin="20">
                     <Grid>
                     <Grid>
                         <Grid.ColumnDefinitions>
                         <Grid.ColumnDefinitions>
                             <ColumnDefinition Width="auto" />
                             <ColumnDefinition Width="auto" />
@@ -2334,8 +2335,7 @@
                                    VerticalAlignment="Center"
                                    VerticalAlignment="Center"
                                    HorizontalAlignment="Right"
                                    HorizontalAlignment="Right"
                                    Margin="0,6,10,6"
                                    Margin="0,6,10,6"
-                                   Text="{lex:Loc 取料位置}"
-                                   />
+                                   Text="{lex:Loc 取料位置}" />
                         <mah:NumericUpDown Grid.Row="8"
                         <mah:NumericUpDown Grid.Row="8"
                                            Grid.Column="1"
                                            Grid.Column="1"
                                            Margin="0,6"
                                            Margin="0,6"
@@ -2369,7 +2369,7 @@
                                   IsChecked="{Binding IsSaveScrewCurve,Mode=TwoWay}"
                                   IsChecked="{Binding IsSaveScrewCurve,Mode=TwoWay}"
                                   VerticalAlignment="Center"
                                   VerticalAlignment="Center"
                                   HorizontalAlignment="Right"
                                   HorizontalAlignment="Right"
-                                   FontSize="{DynamicResource Font.Size.Body3}"
+                                  FontSize="{DynamicResource Font.Size.Body3}"
                                   Margin="0,0,6,0">保存锁付曲线图</CheckBox>
                                   Margin="0,0,6,0">保存锁付曲线图</CheckBox>
                         <!-- 保存锁付曲线设置 -->
                         <!-- 保存锁付曲线设置 -->
                         <StackPanel Grid.Row="10"
                         <StackPanel Grid.Row="10"
@@ -2413,7 +2413,7 @@
                             </StackPanel>
                             </StackPanel>
                         </Button>
                         </Button>
                     </Grid>
                     </Grid>
-                    
+
                     <!--刷卡参数配置-->
                     <!--刷卡参数配置-->
                     <GroupBox Grid.Row="5"
                     <GroupBox Grid.Row="5"
                               Grid.ColumnSpan="2"
                               Grid.ColumnSpan="2"
@@ -2511,10 +2511,129 @@
                 </TabItem.Header>
                 </TabItem.Header>
 
 
                 <StackPanel Margin="16">
                 <StackPanel Margin="16">
-                    <TextBlock Margin="0,0,0,8"
-                               Style="{StaticResource MaterialDesignHeadline5TextBlock}"
-                               FontSize="{DynamicResource Font.Size.Body3}"
-                               Text="{lex:Loc 白夜班}" />
+                    <Button Style="{StaticResource MaterialDesignRaisedButton}"
+                            materialDesign:ButtonAssist.CornerRadius="10"
+                            Width="60"
+                            Margin="10"
+                            ToolTip="{lex:Loc 保存}"
+                            HorizontalAlignment="Left"
+                            Command="{Binding SaveWorkShiftCommand}"
+                            CommandParameter="WorkShift">
+                        <materialDesign:PackIcon Kind="ContentSaveCheck" />
+                    </Button>
+                    <GroupBox HorizontalAlignment="Left"
+                              Margin="10,5"
+                              Header="白夜班时间设置"
+                              Width="320"
+                              FontSize="{DynamicResource Font.Size.Title4}">
+                        <Grid Margin="20">
+                            <Grid.ColumnDefinitions>
+                                <ColumnDefinition Width="auto" />
+                                <ColumnDefinition Width="auto" />
+                                <ColumnDefinition Width="auto" />
+                            </Grid.ColumnDefinitions>
+                            <Grid.RowDefinitions>
+                                <RowDefinition Height="auto" />
+                                <RowDefinition Height=" auto" />
+                                <RowDefinition Height=" auto" />
+                                <RowDefinition Height=" auto" />
+                            </Grid.RowDefinitions>
+
+                            <TextBlock Margin="0,0,0,8"
+                                       Text="白班开始时间:"
+                                       VerticalAlignment="Center"
+                                       FontSize="{DynamicResource Font.Size.Body3}"
+                                       HorizontalAlignment="Right" />
+                            <TextBox Grid.Row="0"
+                                     Grid.Column="1"
+                                     Margin="10,4"
+                                     MinWidth="80"
+                                     FontSize="{DynamicResource Font.Size.Body3}"
+                                     TextAlignment="Center"
+                                     HorizontalAlignment="Left"
+                                     VerticalAlignment="Center">
+                                <TextBox.Text>
+                                    <Binding Path="WorkShifts.DayShift"
+                                             Mode="TwoWay">
+                                    </Binding>
+                                </TextBox.Text>
+                            </TextBox>
+                            <TextBlock Margin="0,0,0,8"
+                                       Grid.Row="1"
+                                       Text="白班结束时间:"
+                                       VerticalAlignment="Center"
+                                       FontSize="{DynamicResource Font.Size.Body3}"
+                                       HorizontalAlignment="Right" />
+                            <TextBox Grid.Row="1"
+                                     Grid.Column="1"
+                                     Margin="10,4"
+                                     MinWidth="80"
+                                     FontSize="{DynamicResource Font.Size.Body3}"
+                                     TextAlignment="Center"
+                                     HorizontalAlignment="Left"
+                                     VerticalAlignment="Center">
+                                <TextBox.Text>
+                                    <Binding Path="WorkShifts.DayShift"
+                                             Mode="TwoWay">
+                                    </Binding>
+                                </TextBox.Text>
+                            </TextBox>
+                            <StackPanel Grid.Column="2" Grid.RowSpan="2" HorizontalAlignment="Center" Margin="10,5" >
+                                <ToggleButton 
+                                           Margin="0,10"
+                                          Height="40" 
+                                          Width="60"/>
+                            </StackPanel>
+
+                            <!--结束符-->
+                            <TextBlock Margin="0,0,0,8"
+                                       Grid.Row="2"
+                                       VerticalAlignment="Center"
+                                       Text="夜班开始时间:"
+                                       FontSize="{DynamicResource Font.Size.Body3}"
+                                       HorizontalAlignment="Right" />
+                            <TextBox Grid.Row="2"
+                                     Grid.Column="1"
+                                     Margin="10,4"
+                                     MinWidth="80"
+                                     FontSize="{DynamicResource Font.Size.Body3}"
+                                     TextAlignment="Center"
+                                     HorizontalAlignment="Left"
+                                     VerticalAlignment="Center">
+                                <TextBox.Text>
+                                    <Binding Path="WorkShifts.NightShift"
+                                             Mode="TwoWay">
+                                    </Binding>
+                                </TextBox.Text>
+                            </TextBox>
+                            <TextBlock Margin="0,0,0,8"
+                                       Grid.Row="3"
+                                       VerticalAlignment="Center"
+                                       Text="夜班结束时间:"
+                                       FontSize="{DynamicResource Font.Size.Body3}"
+                                       HorizontalAlignment="Right" />
+                            <TextBox Grid.Row="3"
+                                     Grid.Column="1"
+                                     Margin="10,4"
+                                     MinWidth="80"
+                                     FontSize="{DynamicResource Font.Size.Body3}"
+                                     TextAlignment="Center"
+                                     HorizontalAlignment="Left"
+                                     VerticalAlignment="Center">
+                                <TextBox.Text>
+                                    <Binding Path="WorkShifts.NightShift"
+                                             Mode="TwoWay">
+                                    </Binding>
+                                </TextBox.Text>
+                            </TextBox>
+                            <ToggleButton Grid.Row="2" Grid.Column="2" 
+                                          Grid.RowSpan="2" 
+                                          HorizontalAlignment="Center" 
+                                          Margin="10,5" 
+                                          Height="40" 
+                                          Width="60"/>
+                        </Grid>
+                    </GroupBox>
                 </StackPanel>
                 </StackPanel>
             </TabItem>
             </TabItem>