123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335 |
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.Data;
- using System.Linq;
- using System.Windows;
- using System.Windows.Data;
- using Aitex.Core.RT.Log;
- using Aitex.Core.Util;
- using MECF.Framework.Common.CommonData;
- using MECF.Framework.Common.DataCenter;
- using MECF.Framework.Common.OperationCenter;
- using OpenSEMI.ClientBase;
- namespace Venus_MainPages.ViewModels
- {
- public class StatsDataListItem : NotifiableItem
- {
- public string Name { get; set; }
- public string Value { get; set; }
- public string Description { get; set; }
- public string Total { get; set; }
- public string LastUpdateTime { get; set; }
- public string LastResetTime { get; set; }
- public string LastResetTotalTime { get; set; }
- public string WarningValue { get; set; }
- public string WarningValueSetPoint { get; set; }
- public bool WarningEnable { get; set; }
- public string AlarmValue { get; set; }
- public string AlarmValueSetPoint { get; set; }
- public bool AlarmEnable { get; set; }
- public bool AlarmTextSaved { get; set; }
- public bool WarningTextSaved { get; set; }
- public bool IsVisible { get; set; }
- }
- public class StatsDataListItemRFAndPump : NotifiableItem
- {
- public string Name { get; set; }
- public string Description { get; set; }
- public string LastPMTime { get; set; }
- public string fromLastPM { get; set; }
- public string Total { get; set; }
- public string PMInterval { get; set; }
- public string PMIntervalSetPoint { get; set; }
- public bool AlarmEnable { get; set; }
- public bool PMIntervalTextSaved { get; set; }
- }
- public class StatisticsViewModel : Binding
- {
- private int MenuPermission
- {
-
-
-
-
- get; set;
- }
- public ObservableCollection<StatsDataListItem> StatData
- {
- get;
- set;
- }
- public ObservableCollection<StatsDataListItemRFAndPump> StatDataRFAndPump
- {
- get;
- set;
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- public void ResetValue(StatsDataListItem item)
- {
- if (MenuPermission != 3) return;
- InvokeClient.Instance.Service.DoOperation("System.Stats.ResetValue", item.Name);
- }
- public void ResetEnableAlarm(StatsDataListItem item)
- {
- if (MenuPermission != 3) return;
- InvokeClient.Instance.Service.DoOperation("System.Stats.EnableAlarm", item.Name, item.AlarmEnable);
- }
- public void ResetEnableWarning(StatsDataListItem item)
- {
- if (MenuPermission != 3) return;
- InvokeClient.Instance.Service.DoOperation("System.Stats.EnableWarning", item.Name, item.WarningEnable);
- }
- public void SetAlarmValue(StatsDataListItem item)
- {
- if (MenuPermission != 3) return;
- if (string.IsNullOrEmpty(item.AlarmValueSetPoint) ||
- !int.TryParse(item.AlarmValueSetPoint, out int setValue))
- {
- DialogBox.ShowWarning("Alarm value not valid");
- return;
- }
- InvokeClient.Instance.Service.DoOperation("System.Stats.SetAlarmValue", item.Name, setValue);
- item.AlarmTextSaved = true;
- item.InvokePropertyChanged(nameof(item.AlarmTextSaved));
- }
- public void SetWarningValue(StatsDataListItem item)
- {
- if (MenuPermission != 3) return;
- if (string.IsNullOrEmpty(item.WarningValueSetPoint) ||
- !int.TryParse(item.WarningValueSetPoint, out int setValue))
- {
- DialogBox.ShowWarning("Warning value not valid");
- return;
- }
- InvokeClient.Instance.Service.DoOperation("System.Stats.SetWarningValue", item.Name, setValue);
- item.WarningTextSaved = true;
- item.InvokePropertyChanged(nameof(item.WarningTextSaved));
- }
-
- public void ResetTotalValue(StatsDataListItem item)
- {
- if (MenuPermission != 3) return;
- InvokeClient.Instance.Service.DoOperation("System.Stats.ResetTotalValue", item.Name);
- }
- public void ResetTimeValue(StatsDataListItemRFAndPump item)
- {
- if (MenuPermission != 3) return;
- InvokeClient.Instance.Service.DoOperation("System.StatsRFAndPump.ResetValue", item.Name);
- }
- public void ResetRFEnableAlarm(StatsDataListItemRFAndPump item)
- {
- if (MenuPermission != 3) return;
- InvokeClient.Instance.Service.DoOperation("System.StatsRFAndPump.EnableAlarm", item.Name, item.AlarmEnable);
- }
- public void SetPMIntervalValue(StatsDataListItemRFAndPump item)
- {
- if (MenuPermission != 3) return;
- if (string.IsNullOrEmpty(item.PMIntervalSetPoint) ||
- !int.TryParse(item.PMIntervalSetPoint, out int setValue))
- {
- DialogBox.ShowWarning("PM Interval value not valid");
- return;
- }
- InvokeClient.Instance.Service.DoOperation("System.StatsRFAndPump.SetPMIntervalValue", item.Name, setValue);
- item.PMIntervalTextSaved = true;
- item.InvokePropertyChanged(nameof(item.PMIntervalTextSaved));
- }
- }
- }
|