diff --git a/DM_Weight/App.xaml.cs b/DM_Weight/App.xaml.cs index 081ea18..c98ea2a 100644 --- a/DM_Weight/App.xaml.cs +++ b/DM_Weight/App.xaml.cs @@ -23,7 +23,6 @@ using log4net; using System.Windows.Interop; using System.Windows.Threading; using System.Timers; -using DM_Weight.HIKVISION; using System.Diagnostics; using System.Runtime.InteropServices; using log4net.Repository.Hierarchy; @@ -104,7 +103,7 @@ namespace DM_Weight // 组态屏工具 //containerRegistry.RegisterSingleton(); // 录像机 - containerRegistry.RegisterSingleton(); + //containerRegistry.RegisterSingleton(); containerRegistry.Register(); diff --git a/DM_Weight/DM_Weight.csproj b/DM_Weight/DM_Weight.csproj index 6d71208..7ff7ff6 100644 --- a/DM_Weight/DM_Weight.csproj +++ b/DM_Weight/DM_Weight.csproj @@ -11,6 +11,13 @@ AnyCPU;x86;x64 + + + + + + + @@ -135,10 +142,6 @@ - - - - diff --git a/DM_Weight/Port/PortUtil.cs b/DM_Weight/Port/PortUtil.cs index 2030536..4fc2252 100644 --- a/DM_Weight/Port/PortUtil.cs +++ b/DM_Weight/Port/PortUtil.cs @@ -23,8 +23,7 @@ using Unity; using DM_Weight.msg; using DM_Weight.Views; using System.Reflection; -using DM_Weight.HIKVISION; -using PreviewDemo; +//using PreviewDemo; using System.Runtime.InteropServices; using DM_Weight.Common; using System.Net; @@ -236,8 +235,8 @@ namespace DM_Weight.Port logger.Info($"进行抽屉操作抽屉号【{DrawerNo}】类型【{BoardType}】库位【{string.Join(",", ColNos)}】窗口【{WindowName}】"); Operate = true; //开始录像 - _chkFunction.HIKStartDVRRecord(); - logger.Info($"时间:{DateTime.Now}"); + //_chkFunction.HIKStartDVRRecord(); + //logger.Info($"时间:{DateTime.Now}"); try { // 储物箱直接开 @@ -416,7 +415,7 @@ namespace DM_Weight.Port } } - int i = 10; + int i = 15; public async void GetDrawerStatus() { try @@ -521,7 +520,7 @@ namespace DM_Weight.Port if (i == 0) { SpeakAsync("请关闭抽屉"); - i = 10; + i = 15; } // 继续监听抽屉状态 await Task.Delay(200); @@ -529,6 +528,7 @@ namespace DM_Weight.Port } else { + i = 15; statue = 2; if (BoardType == 2) { @@ -695,8 +695,8 @@ namespace DM_Weight.Port private readonly IEventAggregator _eventAggregator; - private CHKFunction _chkFunction; - public PortUtil(IEventAggregator eventAggregator, CHKFunction chkFunction) + //private CHKFunction _chkFunction; + public PortUtil(IEventAggregator eventAggregator) { _eventAggregator = eventAggregator; try @@ -761,7 +761,7 @@ namespace DM_Weight.Port } } - _chkFunction = chkFunction; + //_chkFunction = chkFunction; } diff --git a/DM_Weight/ViewModels/HomeWindowViewModel.cs b/DM_Weight/ViewModels/HomeWindowViewModel.cs index 3fa80ad..48c8555 100644 --- a/DM_Weight/ViewModels/HomeWindowViewModel.cs +++ b/DM_Weight/ViewModels/HomeWindowViewModel.cs @@ -22,7 +22,6 @@ using Unity; using System.Windows.Threading; using Newtonsoft.Json.Linq; using DM_Weight.msg; -using DM_Weight.HIKVISION; using System.Threading; namespace DM_Weight.ViewModels @@ -340,16 +339,16 @@ namespace DM_Weight.ViewModels public bool Is16Drawer { get => _is16Drawer; set => SetProperty(ref _is16Drawer, value); } public bool KeepAlive => false; private PortUtil _portUtil; - private CHKFunction _chkFunction; + //private CHKFunction _chkFunction; IEventAggregator _eventAggregator; - public HomeWindowViewModel(IRegionManager iRegionManager, PortUtil portUtil, IDialogService dialogService, IUnityContainer container, IEventAggregator eventAggregator, CHKFunction cHKFunction) + public HomeWindowViewModel(IRegionManager iRegionManager, PortUtil portUtil, IDialogService dialogService, IUnityContainer container, IEventAggregator eventAggregator) { _portUtil = portUtil; _regionManager = iRegionManager; _dialogService = dialogService; _container = container; this._eventAggregator = eventAggregator; - _chkFunction = cHKFunction; + //_chkFunction = cHKFunction; } public DelegateCommand OpenFingerDialog @@ -553,7 +552,7 @@ namespace DM_Weight.ViewModels if ((DateTime.Now - _portUtil.dateTime).TotalSeconds > autoExit && CheckComputerFreeState.GetLastInputTime() > autoExit) { logger.Info($"设备30秒内无人操作,用户【{Operator?.Nickname}】自动退出登录"); - _chkFunction.HIKStopDVRRecord(); + //_chkFunction.HIKStopDVRRecord(); Operator = null; Reviewer = null; Application.Current.Dispatcher.Invoke(() => @@ -580,25 +579,25 @@ namespace DM_Weight.ViewModels //} //#endregion //GetWD(); - if (stopRecord > 0) - { - System.Timers.Timer timer = new System.Timers.Timer(); - timer.Interval = 1000; - timer.Elapsed += (sender, e) => - { + //if (stopRecord > 0) + //{ + // System.Timers.Timer timer = new System.Timers.Timer(); + // timer.Interval = 1000; + // timer.Elapsed += (sender, e) => + // { - //指定时间内无人操作鼠标键盘则停止录像 - if (!_portUtil.Operate && CheckComputerFreeState.GetLastInputTime() > stopRecord) - { - _chkFunction.HIKStopDVRRecord(); - } - }; - timer.Start(); - } - logger.Info($"当前时间:{DateTime.Now}\r\n获取录像机的时间"); - //获取录像机的时间 - _chkFunction.HIK_DVR_TIME(); - _chkFunction.HIKStartDVRRecord(); + // //指定时间内无人操作鼠标键盘则停止录像 + // if (!_portUtil.Operate && CheckComputerFreeState.GetLastInputTime() > stopRecord) + // { + // _chkFunction.HIKStopDVRRecord(); + // } + // }; + // timer.Start(); + //} + //logger.Info($"当前时间:{DateTime.Now}\r\n获取录像机的时间"); + ////获取录像机的时间 + //_chkFunction.HIK_DVR_TIME(); + //_chkFunction.HIKStartDVRRecord(); } //每次导航的时候,该实列用不用重新创建,true是不重新创建,false是重新创建 diff --git a/DM_Weight/ViewModels/LoginWindowViewModel.cs b/DM_Weight/ViewModels/LoginWindowViewModel.cs index 9144f2a..e5b9b28 100644 --- a/DM_Weight/ViewModels/LoginWindowViewModel.cs +++ b/DM_Weight/ViewModels/LoginWindowViewModel.cs @@ -24,7 +24,6 @@ using System.Collections.ObjectModel; using Microsoft.Win32; using System.Xml; using System.Diagnostics; -using DM_Weight.HIKVISION; using System.Security.AccessControl; namespace DM_Weight.ViewModels @@ -65,7 +64,6 @@ namespace DM_Weight.ViewModels private FingerprintUtil _fingerprintUtil; private PortUtil _portUtil; - private CHKFunction _chkFunction; public Boolean LoginBtnEnable { get { return _loginBtnEnable; } set { SetProperty(ref _loginBtnEnable, value); } } public string Password { get { return password; } set { SetProperty(ref password, value); } } @@ -84,7 +82,7 @@ namespace DM_Weight.ViewModels get => _portUtil._canBusExsit && !_portUtil.canBusSerial.IsOpen; } - private bool _fingerMsg= CHKFunction.HKUserId>=0; + private bool _fingerMsg = false;// CHKFunction.HKUserId>=0; public bool FingerMsg { @@ -96,12 +94,12 @@ namespace DM_Weight.ViewModels get => !_portUtil.fridgeSerial.IsOpen; } //录像机登录状态 - private bool _hikMsg; - public bool HIKMsg - { - get=>_hikMsg; - set=>SetProperty(ref _hikMsg, value); - } + //private bool _hikMsg; + //public bool HIKMsg + //{ + // get=>_hikMsg; + // set=>SetProperty(ref _hikMsg, value); + //} //public LoginWindowViewModel(IRegionManager regionManager, IEventAggregator eventAggregator, PortUtil portUtil, FingerprintUtil fingerprintUtil) //{ @@ -110,11 +108,11 @@ namespace DM_Weight.ViewModels // _regionManager = regionManager; // _eventAggregator = eventAggregator; //} - public LoginWindowViewModel(IRegionManager regionManager, IEventAggregator eventAggregator, PortUtil portUtil, CHKFunction chcFunction) + public LoginWindowViewModel(IRegionManager regionManager, IEventAggregator eventAggregator, PortUtil portUtil) { //_fingerprintUtil = fingerprintUtil; _portUtil = portUtil; - _chkFunction= chcFunction; + //_chkFunction= chcFunction; _regionManager = regionManager; _eventAggregator = eventAggregator; } @@ -355,7 +353,6 @@ _exitCommand ??= new DelegateCommand(Exit); void Exit() { - _chkFunction.HIKLoginOut(); Process.GetCurrentProcess().Kill(); Environment.Exit(0); } diff --git a/DM_Weight/ViewModels/MainWindowViewModel.cs b/DM_Weight/ViewModels/MainWindowViewModel.cs index 22ce93a..7c86ffb 100644 --- a/DM_Weight/ViewModels/MainWindowViewModel.cs +++ b/DM_Weight/ViewModels/MainWindowViewModel.cs @@ -15,7 +15,6 @@ using DM_Weight.util; using DM_Weight.Finger; using DM_Weight.Views; using Unity; -using DM_Weight.HIKVISION; using log4net.Repository.Hierarchy; using log4net; @@ -65,9 +64,8 @@ namespace DM_Weight.ViewModels private FingerprintUtil _fingerprintUtil; IRegionManager _regionManager; IUnityContainer _container; - private CHKFunction _cHKFunction; private readonly ILog logger = LogManager.GetLogger(typeof(PortUtil)); - public MainWindowViewModel(IRegionManager regionManager, IUnityContainer container, IEventAggregator eventAggregator, FingerprintUtil fingerprintUtil, CHKFunction cHKFunction) + public MainWindowViewModel(IRegionManager regionManager, IUnityContainer container, IEventAggregator eventAggregator, FingerprintUtil fingerprintUtil) { //_portUtil = portUtil; this.eventAggregator = eventAggregator; @@ -75,7 +73,6 @@ namespace DM_Weight.ViewModels _fingerprintUtil = fingerprintUtil; _regionManager = regionManager; _container = container; - _cHKFunction = cHKFunction; System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() => { diff --git a/DM_Weight/ViewModels/OrderTakeDialogViewModel.cs b/DM_Weight/ViewModels/OrderTakeDialogViewModel.cs index 0074927..17e51c0 100644 --- a/DM_Weight/ViewModels/OrderTakeDialogViewModel.cs +++ b/DM_Weight/ViewModels/OrderTakeDialogViewModel.cs @@ -21,7 +21,6 @@ using DM_Weight.Port; using DM_Weight.select; using DM_Weight.util; using System.Threading; -using DM_Weight.HIKVISION; namespace DM_Weight.ViewModels { diff --git a/DM_Weight/ViewModels/SelfTakeDialogViewModel.cs b/DM_Weight/ViewModels/SelfTakeDialogViewModel.cs index 3e9896e..e3ff86e 100644 --- a/DM_Weight/ViewModels/SelfTakeDialogViewModel.cs +++ b/DM_Weight/ViewModels/SelfTakeDialogViewModel.cs @@ -17,7 +17,6 @@ using DM_Weight.Port; using DM_Weight.util; using System.Threading; using System.Configuration; -using DM_Weight.HIKVISION; namespace DM_Weight.ViewModels { diff --git a/DM_Weight/Views/LoginWindow.xaml b/DM_Weight/Views/LoginWindow.xaml index 000a75f..1095bbd 100644 --- a/DM_Weight/Views/LoginWindow.xaml +++ b/DM_Weight/Views/LoginWindow.xaml @@ -198,7 +198,7 @@ - +