using JSMachine.WMS.Storage.BusinessModules.Views; using JSMachine.WMS.Common.Mvvm; using Unity; using static JSMachine.WMS.Common.EventBus.GlobalEventBus; using JSMachine.WMS.App.Dto; namespace JSMachine.WMS.Storage.BusinessModules.ViewModels { public class HomePageViewModel : ViewModelBase, IViewLoadedAndUnloadedAware { HomePage _homePage; public HomePageViewModel(IUnityContainer container) : base(container) { } public void OnLoaded(HomePage view) { _homePage = view; //base.OnLoaded(view); view.Page_Change.Content = new PaperStorageView(); EventAggregator.GetEvent().Subscribe(UpdateDeviceConnectState); } public void OnUnloaded(HomePage view) { } #region PLC通讯状态 /// /// PLC通讯状态-连接 /// private bool _plcConected; public bool PLCConected { get => _plcConected; set => SetProperty(ref _plcConected, value); } private bool _plcVisible; public bool PLCVisible { get => _plcVisible; set => SetProperty(ref _plcVisible, value); } #endregion #region DB通讯状态 /// /// DB通讯状态-连接 /// private bool _dbConected; public bool DBConected { get => _dbConected; set => SetProperty(ref _dbConected, value); } private bool _dbVisible; public bool DBVisible { get => _dbVisible; set => SetProperty(ref _dbVisible, value); } #endregion #region CodeScnner通讯状态 /// /// CS1通讯状态-连接 /// private bool _cs1Conected; public bool CS1Conected { get => _cs1Conected; set => SetProperty(ref _cs1Conected, value); } private bool _cs1Visible; public bool CS1Visible { get => _cs1Visible; set => SetProperty(ref _cs1Visible, value); } /// /// CS2通讯状态 /// private bool _cs2Conected; public bool CS2Conected { get => _cs2Conected; set => SetProperty(ref _cs2Conected, value); } private bool _cs2Visible; public bool CS2Visible { get => _cs2Visible; set => SetProperty(ref _cs2Visible, value); } #endregion #region ERP通讯状态 /// /// ERP通讯状态-连接 /// private bool _erpConected; public bool ERPConected { get => _erpConected; set => SetProperty(ref _erpConected, value); } private bool _erpVisible; public bool ERPVisible { get => _erpVisible; set => SetProperty(ref _erpVisible, value); } #endregion #region ACS通讯状态 /// /// ACS通讯状态-连接 /// private bool _acsConected; public bool ACSConected { get => _acsConected; set => SetProperty(ref _acsConected, value); } private bool _acsVisible; public bool ACSVisible { get => _acsVisible; set => SetProperty(ref _acsVisible, value); } #endregion #region WeighBridge通讯状态 /// /// 地磅通讯状态-连接 /// private bool _wbConected; public bool WBConected { get => _wbConected; set => SetProperty(ref _wbConected, value); } private bool _wbVisible; public bool WBVisible { get => _wbVisible; set => SetProperty(ref _wbVisible, value); } #endregion #region 印贴一体机通讯状态 /// /// 印贴一体机通讯状态-连接 /// private bool _printConected; public bool PrintConected { get => _printConected; set => SetProperty(ref _printConected, value); } private bool _printVisible; public bool PrintVisible { get => _printVisible; set => SetProperty(ref _printVisible, value); } #endregion /// /// 设备连接事件 /// /// private void UpdateDeviceConnectState(DeviceStateDto deviceStateDto) { #region PLCState PLCConected = deviceStateDto.PLCConected; PLCVisible = deviceStateDto.PLCVisible; #endregion #region DBState DBConected = deviceStateDto.DBConected; DBVisible = deviceStateDto.DBVisible; #endregion #region CS1State CS1Conected = deviceStateDto.CS1Conected; CS1Visible = deviceStateDto.CS1Visible; #endregion #region CS2State CS2Conected = deviceStateDto.CS2Conected; CS2Visible = deviceStateDto.CS2Visible; #endregion #region ERPState ERPConected = deviceStateDto.ERPConected; ERPVisible = deviceStateDto.ERPVisible; #endregion #region ACState ACSConected = deviceStateDto.ACSConected; ACSVisible = deviceStateDto.ACSVisible; #endregion #region WBState WBConected = deviceStateDto.WBConected; WBVisible = deviceStateDto.WBVisible; #endregion #region PrintState PrintConected = deviceStateDto.PrintConected; PrintVisible = deviceStateDto.PrintVisible; #endregion } } }