217 lines
6.0 KiB
C#
217 lines
6.0 KiB
C#
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 _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<DeviceConnectionEvent>().Subscribe(UpdateDeviceConnectState);
|
||
|
|
}
|
||
|
|
|
||
|
|
public void OnUnloaded(HomePage view)
|
||
|
|
{
|
||
|
|
}
|
||
|
|
#region PLC通讯状态
|
||
|
|
/// <summary>
|
||
|
|
/// PLC通讯状态-连接
|
||
|
|
/// </summary>
|
||
|
|
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通讯状态
|
||
|
|
/// <summary>
|
||
|
|
/// DB通讯状态-连接
|
||
|
|
/// </summary>
|
||
|
|
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通讯状态
|
||
|
|
/// <summary>
|
||
|
|
/// CS1通讯状态-连接
|
||
|
|
/// </summary>
|
||
|
|
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);
|
||
|
|
}
|
||
|
|
/// <summary>
|
||
|
|
/// CS2通讯状态
|
||
|
|
/// </summary>
|
||
|
|
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通讯状态
|
||
|
|
/// <summary>
|
||
|
|
/// ERP通讯状态-连接
|
||
|
|
/// </summary>
|
||
|
|
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通讯状态
|
||
|
|
/// <summary>
|
||
|
|
/// ACS通讯状态-连接
|
||
|
|
/// </summary>
|
||
|
|
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通讯状态
|
||
|
|
/// <summary>
|
||
|
|
/// 地磅通讯状态-连接
|
||
|
|
/// </summary>
|
||
|
|
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 印贴一体机通讯状态
|
||
|
|
/// <summary>
|
||
|
|
/// 印贴一体机通讯状态-连接
|
||
|
|
/// </summary>
|
||
|
|
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
|
||
|
|
/// <summary>
|
||
|
|
/// 设备连接事件
|
||
|
|
/// </summary>
|
||
|
|
/// <param name = "deviceStateDto" ></ param >
|
||
|
|
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
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|