diff --git a/CapMachine.Shared/Controls/Meter.xaml b/CapMachine.Shared/Controls/Meter.xaml index 86fb258..422238d 100644 --- a/CapMachine.Shared/Controls/Meter.xaml +++ b/CapMachine.Shared/Controls/Meter.xaml @@ -21,7 +21,7 @@ - + - - - - - + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + /// 步骤执行信息 + /// + public string StepExeInfo + { + get + { + return (string)base.GetValue(Meter.StepExeInfoProperty); + } + set + { + base.SetValue(Meter.StepExeInfoProperty, value); + } + } + public static readonly DependencyProperty StepExeInfoProperty = DependencyProperty.Register("StepExeInfo", typeof(string), typeof(Meter), new PropertyMetadata("--")); + + + private string _AutoStateMsg = "自动"; /// /// 手自动的消息 @@ -202,12 +220,12 @@ namespace CapMachine.Shared.Controls if (control != null && control.IsChecked == true) { AutoStateMsg = "手动"; - IsHandValueShow = "Visible"; + //IsHandValueShow = "Visible";//用TabControl控制了,不需要显示了 } else { AutoStateMsg = "自动"; - IsHandValueShow = "Hidden"; + //IsHandValueShow = "Hidden";//用TabControl控制了,不需要显示了 } } @@ -215,19 +233,19 @@ namespace CapMachine.Shared.Controls - private string _IsHandValueShow = "Hidden"; - /// - /// 手动设置的是值是否显示 - /// - public string IsHandValueShow - { - get { return _IsHandValueShow; } - set - { - _IsHandValueShow = value; - OnRaisePropertyChanged("IsHandValueShow"); - } - } + //private string _IsHandValueShow = "Hidden"; + ///// + ///// 手动设置的是值是否显示 + ///// + //public string IsHandValueShow + //{ + // get { return _IsHandValueShow; } + // set + // { + // _IsHandValueShow = value; + // OnRaisePropertyChanged("IsHandValueShow"); + // } + //} /// diff --git a/CapMachine.Wpf/Models/ProModelPars/ProExModel.cs b/CapMachine.Wpf/Models/ProModelPars/ProExModel.cs index 0b79ba1..37f1541 100644 --- a/CapMachine.Wpf/Models/ProModelPars/ProExModel.cs +++ b/CapMachine.Wpf/Models/ProModelPars/ProExModel.cs @@ -1,5 +1,6 @@ using AngleSharp.Dom.Events; using CapMachine.Wpf.ChannelModel; +using CapMachine.Wpf.Models.Tag; using CapMachine.Wpf.Services; using ImTools; using Masuit.Tools; @@ -66,11 +67,6 @@ namespace CapMachine.Wpf.Models.ProModelPars /// public List ListProStepExe { get; set; } - /// - /// 仪表步骤执行时间信息 - /// - public ProRunTime ProRunTimeModel { get; set; } - /// /// 下一步步骤数据执行 /// @@ -84,14 +80,27 @@ namespace CapMachine.Wpf.Models.ProModelPars public ProStepExe CurProStepExe { get { return _CurProStepExe; } - set { _CurProStepExe = value;RaisePropertyChanged(); } + set { _CurProStepExe = value; RaisePropertyChanged(); } } - ///// - ///// 当前步骤数据执行 - ///// 给看步骤是否变化使用 - ///// - //public ProStepExe CurProStepExe { get; set; } + private string _RunSegName; + /// + /// 运行的程序段名称 + /// + public string RunSegName + { + get { return _RunSegName; } + set + { + if (value != _RunSegName) + { + RaisePropertyChanged(); + } + _RunSegName = value; + } + } + + /// /// 上一步步骤数据执行 @@ -99,16 +108,29 @@ namespace CapMachine.Wpf.Models.ProModelPars /// public ProStepExe LastProStepExe { get; set; } + /// + /// 当前的变量标签 + /// TagManger里面的标签信息 + /// + public ShortControlTag CurShortControlTag { get; set; } + + ///// + ///// 当前程序段步骤步骤时间长 + ///// 程序步骤里面一个整步 + ///// Sec + ///// + //public int CurProStepRunTime { get; set; } + + ///// + ///// 当前程序段步骤开始时间 + ///// 程序步骤里面一个整步 + ///// + //public DateTime CurProStepStartTime { set; get; } /// - /// 当前程序段时间长 + /// 仪表步骤执行时间信息 /// - public int CurProTimeSum { get; set; } - - /// - /// 当前程序段开始时间 - /// - public DateTime CurProStartTime { set; get; } + public ProStepRunTime ProStepRunTimeModel { get; set; } #region 仪表步骤执行时间信息 @@ -131,11 +153,13 @@ namespace CapMachine.Wpf.Models.ProModelPars /// /// 当前步骤开始运行时间 + /// 这个是具体的小步骤(那个带斜坡循环的)的开始时间 /// public DateTime StepStartDt { get; set; } /// /// 当前步骤结束运行时间 + /// 这个是具体的小步骤(那个带斜坡循环的)的结束时间 /// public DateTime StepEndDt { get; set; } @@ -175,8 +199,12 @@ namespace CapMachine.Wpf.Models.ProModelPars //速度执行结束发布事件 if (IsSpeed) SpeedRunEndEvent.Invoke(this, "OK"); + + //UI的标识清空 + CurShortControlTag.StepExeInfo = "--"; //为空时不执行后续的数据 RunEnable = false; + return; } @@ -219,7 +247,7 @@ namespace CapMachine.Wpf.Models.ProModelPars CurLoadLimit = LimitResult == true ? new Limit() { Up = (short)NextProStepExe.CurConfigLimitDto.Up, Down = (short)NextProStepExe.CurConfigLimitDto.Down } : new Limit(), CurLoadPID = PidResult == true ? new PID() { P = (short)NextProStepExe.CurConfigPIDDto.P, I = (short)NextProStepExe.CurConfigPIDDto.I, D = (short)NextProStepExe.CurConfigPIDDto.D } : new PID(), RunStepType = GetRunStepType(PidResult, LimitResult, false), - IsSpeed=IsSpeed, + IsSpeed = IsSpeed, ListStepExd = GetStepExds(NextProStepExe),//拓展参数 @@ -288,6 +316,10 @@ namespace CapMachine.Wpf.Models.ProModelPars ); } + //当前的步骤信息的展示到UI上,给TagManager的标签中心中 + CurShortControlTag.StepExeInfo = NextProStepExe.StepExeInfo!; + //当前的SegName名称展示,要展示到UI上,以速度为主 + RunSegName = NextProStepExe.ProSegName!; ////////准备新的数据/////////// diff --git a/CapMachine.Wpf/Models/ProModelPars/ProRunTime.cs b/CapMachine.Wpf/Models/ProModelPars/ProRunTime.cs deleted file mode 100644 index f705c57..0000000 --- a/CapMachine.Wpf/Models/ProModelPars/ProRunTime.cs +++ /dev/null @@ -1,88 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace CapMachine.Wpf.Models.ProModelPars -{ - /// - /// 程序运行时间 - /// - public class ProRunTime - { - - public EventHandler RunTimeCallSglEvent; - - /// - /// 是否启用 - /// - public bool RunEnable { get; set; } = false; - - /// - /// RunTimeCallSglEvent 是否注册关联方法 - /// - public bool EventRegister { get; set; } = false; - - /// - /// 当前仪表名称 - /// - public string MeterName { get; set; } - - /// - /// 当前程序段名称 - /// - public string ProName { get; set; } - - /// - /// 当前仪表程序步骤 - /// - public int MeterStep { get; set; } - - /// - /// 当前步骤开始运行时间 - /// - public DateTime StartDateTime { get; set; } - - /// - /// 当前步骤结束运行时间 - /// - public DateTime EndDateTime { get; set; } - - - private DateTime currentDateTime; - /// - /// 当前时间 - /// - public DateTime CurrentDateTime - { - get - { - return currentDateTime; - } - set - { - //value.ToString("yyyy-MM-dd HH:mm:ss") == EndDateTime.ToString("yyyy-MM-dd HH:mm:ss") - if (RunEnable == true && value >= EndDateTime) - { - currentDateTime = value; - RunEnable = false; - //时间到了触发下载新的步骤 - //RunTimeCallSglEvent(ProName, MeterName, MeterStep); - //RunTimeCallSglEvent.BeginInvoke(ProName, MeterName, MeterStep, null, null); - //RunEnable = false; - } - else - { - currentDateTime = value; - RunTime = (int)(currentDateTime - StartDateTime).TotalSeconds; - } - } - } - - /// - /// 当前步骤已经运行时长-秒 - /// - public int RunTime { get; set; } - } -} diff --git a/CapMachine.Wpf/Models/ProModelPars/ProStepExe.cs b/CapMachine.Wpf/Models/ProModelPars/ProStepExe.cs index b512194..42a0f1a 100644 --- a/CapMachine.Wpf/Models/ProModelPars/ProStepExe.cs +++ b/CapMachine.Wpf/Models/ProModelPars/ProStepExe.cs @@ -73,10 +73,25 @@ namespace CapMachine.Wpf.Models.ProModelPars set { _ProStepInfo = value;RaisePropertyChanged(); } } - /////// - /////// 这个步骤是打开具体设置步骤界面的那个层面的信息,例如:2-3,代表是程序2里面的仪表步骤3,方便调试和给液击使用 - /////// - ////public string? ProStepInfo { get; set; } + + private string? _ProStep; + /// + /// 程序步骤的步骤信息 + /// 比如:例如:2-3里面的2步骤信息,就是大步骤的信息 + /// + public string? ProStep + { + get { return _ProStep; } + set { _ProStep = value; RaisePropertyChanged(); } + } + + + /// + ///步骤执行的信息 + /// 0->8000 + /// [00:00:12] + /// + public string? StepExeInfo { get; set; } ///// ///// 启用状态-没有启用就是什么数据都没有 diff --git a/CapMachine.Wpf/Models/ProModelPars/ProStepRunTime.cs b/CapMachine.Wpf/Models/ProModelPars/ProStepRunTime.cs new file mode 100644 index 0000000..0bdae59 --- /dev/null +++ b/CapMachine.Wpf/Models/ProModelPars/ProStepRunTime.cs @@ -0,0 +1,55 @@ +using Prism.Mvvm; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CapMachine.Wpf.Models.ProModelPars +{ + /// + /// 程序步骤里面一个整步运行时间 + /// + public class ProStepRunTime : BindableBase + { + + public EventHandler RunTimeCallSglEvent; + + /// + /// 是否启用 + /// + public bool RunEnable { get; set; } = false; + + /// + /// 当前仪表程序步骤 + /// + public int ProStep { get; set; } + + /// + /// 当前步骤开始运行时间 + /// + public DateTime StartDt { get; set; } + + + private DateTime currentDateTime; + /// + /// 当前时间 + /// + public DateTime CurrentDateTime + { + get + { + return currentDateTime; + } + set + { + currentDateTime = value; + } + } + + /// + /// 当前步骤已经运行时长-秒 + /// + public int RunTime { get; set; } + } +} diff --git a/CapMachine.Wpf/Models/ProRunTimeCalc.cs b/CapMachine.Wpf/Models/ProRunTimeCalc.cs index 1135bfb..def81d0 100644 --- a/CapMachine.Wpf/Models/ProRunTimeCalc.cs +++ b/CapMachine.Wpf/Models/ProRunTimeCalc.cs @@ -11,7 +11,7 @@ using System.Windows.Threading; namespace CapMachine.Wpf.Models { /// - /// 程序运行时间统计 + /// 整个程序运行时间统计 /// public class ProRunTimeCalc : BindableBase { @@ -19,6 +19,12 @@ namespace CapMachine.Wpf.Models { //秒触发一次 CycleTimer = new System.Timers.Timer(1000); + //CycleTimer = new DispatcherTimer + //{ + // Interval = TimeSpan.FromSeconds(1) + //}; + //CycleTimer.Tick += (s, e) => CalcTime(); + CycleTimer.Elapsed += ProRunCycleAction; CycleTimer.AutoReset = true; CycleTimer.Enabled = true; @@ -27,6 +33,7 @@ namespace CapMachine.Wpf.Models /// /// 程序运行时间周期统计 + /// 弃用 /// /// /// @@ -49,8 +56,13 @@ namespace CapMachine.Wpf.Models private void CalcTime() { ProEndDt = DateTime.Now; - - ProRunTimeStr = ConvertSecToDHMS((int)Math.Round((ProEndDt - ProStartDt).TotalSeconds - PauseTotalSecTime)); + var CurTime = (ProEndDt - ProStartDt).TotalSeconds - PauseTotalSecTime; //计算总时间,单位秒 + if (TotalProSec != 0) + { + ProValue = CurTime * 100 / TotalProSec; + } + ProRunTimeStr = ConvertSecToDHMS((int)Math.Round(CurTime)); + } private string ConvertSecToDHMS(int totalSeconds) @@ -81,6 +93,9 @@ namespace CapMachine.Wpf.Models CycleTimer.Start(); //暂停时间清零,可能是多次开始执行程序,导致PauseTotalSecTime残留到下一个程序计时中 PauseTotalSecTime = 0; + + //结束时间信息 + EndTimeInfo = ProStartDt.AddSeconds(PauseTotalSecTime).ToString("yyyy-MM-dd HH:mm:ss"); } /// @@ -88,15 +103,28 @@ namespace CapMachine.Wpf.Models /// public void PauseProRunTime() { + //开始暂停的计时 + PauseStartDt = DateTime.Now; + CycleTimer.Stop(); } /// /// 继续计时 + /// 返回暂停时间 /// - public void ContinueProRunTime() + public double ContinueProRunTime() { + PauseEndDt = DateTime.Now; + + //统计的暂停的时间 + var PauseTime = (PauseEndDt - PauseStartDt).TotalSeconds; + PauseTotalSecTime = PauseTotalSecTime + (int)Math.Round(PauseTime); + EndTimeInfo = ProStartDt.AddSeconds(PauseTotalSecTime).ToString("yyyy-MM-dd HH:mm:ss"); + CycleTimer.Start(); + + return PauseTime; } /// @@ -126,6 +154,22 @@ namespace CapMachine.Wpf.Models /// public DateTime ProEndDt { get; set; } + /// + /// 整个程序步骤的时间长度 + /// + public long TotalProSec { get; set; } + + + private double _ProValue; + /// + /// 进度数据 + /// + public double ProValue + { + get { return _ProValue; } + set { _ProValue = value; RaisePropertyChanged(); } + } + private string? _ProRunTimeStr; /// @@ -137,6 +181,17 @@ namespace CapMachine.Wpf.Models set { _ProRunTimeStr = value; RaisePropertyChanged(); } } + private string _EndTimeInfo; + /// + /// 结束时间字符串 + /// + public string EndTimeInfo + { + get { return _EndTimeInfo; } + set { _EndTimeInfo = value; RaisePropertyChanged(); } + } + + /// /// 全部的暂停的时间 /// 可能暂停多次 @@ -144,5 +199,21 @@ namespace CapMachine.Wpf.Models public int PauseTotalSecTime { get; set; } + #region 暂停操作 + + /// + /// 暂停开始时间 + /// + public DateTime PauseStartDt { get; set; } + + /// + /// 暂停结束时间 + /// + public DateTime PauseEndDt { get; set; } + + + #endregion + + } } diff --git a/CapMachine.Wpf/Models/Tag/ShortControlTag.cs b/CapMachine.Wpf/Models/Tag/ShortControlTag.cs index 0b922ad..ed78471 100644 --- a/CapMachine.Wpf/Models/Tag/ShortControlTag.cs +++ b/CapMachine.Wpf/Models/Tag/ShortControlTag.cs @@ -103,6 +103,19 @@ namespace CapMachine.Wpf.Models.Tag set { _AutoHandState = value; RaisePropertyChanged(); } } + private string _StepExeInfo="--"; + /// + /// 步骤执行的信息 + /// 作为主界面的Meter当前步骤的数据的信息 + /// + public string StepExeInfo + { + get { return _StepExeInfo; } + set { _StepExeInfo = value; RaisePropertyChanged(); } + } + + + ///// ///// 手自动切换地址 ///// diff --git a/CapMachine.Wpf/Services/MachineRtDataService.cs b/CapMachine.Wpf/Services/MachineRtDataService.cs index 5232b8f..d82cd8f 100644 --- a/CapMachine.Wpf/Services/MachineRtDataService.cs +++ b/CapMachine.Wpf/Services/MachineRtDataService.cs @@ -2562,16 +2562,12 @@ namespace CapMachine.Wpf.Services while (ThreadEnable) { - //await Task.CompletedTask; DiagnosticsTime.Reset(); DiagnosticsTime.Start(); - await Task.Delay(20); - - - + await Task.Delay(5); try { diff --git a/CapMachine.Wpf/Services/ProRuntimeService.cs b/CapMachine.Wpf/Services/ProRuntimeService.cs index 0654758..b67a393 100644 --- a/CapMachine.Wpf/Services/ProRuntimeService.cs +++ b/CapMachine.Wpf/Services/ProRuntimeService.cs @@ -80,11 +80,12 @@ namespace CapMachine.Wpf.Services MeterName = itemKeyValue.Value.NameNoUnit, ListProStepExe = new List(), IsSpeed = itemKeyValue.Value.Name.Contains("转速") == true ? true : false, + CurShortControlTag = MachineRtDataService.TagManger.GetShortControlTagByName(itemKeyValue.Key)!, }); } } - SpeedProExModel= ListProExModel.FindFirst(a => a.MeterName.Contains("转速"));//转速执行模型 + SpeedProExModel = ListProExModel.FindFirst(a => a.MeterName.Contains("转速"));//转速执行模型 //SpeedRunEndEvent ListProExModel.FindFirst(a => a.MeterName.Contains("转速")).SpeedRunEndEvent += ProRuntimeService_SpeedRunEndEvent; @@ -147,6 +148,20 @@ namespace CapMachine.Wpf.Services /// public MachineRunState MachineRunState1 { get; set; } + /// + /// 时间转换为字符串 + /// + /// + /// + private string ConvertSecToTimeStr(int totalSeconds) + { + int hours = totalSeconds / 3600; + int remainingSeconds = totalSeconds % 3600; + int minutes = remainingSeconds / 60; + int seconds = remainingSeconds % 60; + + return $"{hours}:{minutes:D2}:{seconds:D2}"; + } /// /// 加载选中的程序运行集合 @@ -200,6 +215,8 @@ namespace CapMachine.Wpf.Services //获取当前的程序 if (CurProgramSeg != null && CurProgramSeg.ProSteps != null && CurProgramSeg.ProSteps.Any()) { + var SpeedMaxStep = CurProgramSeg.ProSteps.Max(a => a.StepNo); + //CurProgramSeg有重复运行的次数 for (int SegIndex = 0; SegIndex < CurProgramSeg.ProRepeat; SegIndex++) { @@ -211,6 +228,7 @@ namespace CapMachine.Wpf.Services //统计当前步骤itemStep的速度所有时间,供后面的其他参数使用,因为其他的参数也是牟定当前步骤速度是总时间,在这个步骤中,所有的参数的总时间是一样的 var SpeedStepTotaolTime = 0; + //********* 单个【转速】步骤信息的解析 ********* { var CurMeterName = "转速"; @@ -275,7 +293,9 @@ namespace CapMachine.Wpf.Services new StepExd(){ Name="压缩机使能",Value=itemMeterValueCell.CapEnable,ValueType=ExdValueType.Bool}, }, - ProStepInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}", + ProStepInfo = $"{itemStep.StepNo}", + ProStep = $"{itemStep.StepNo}/{SpeedMaxStep}", + StepExeInfo = $"{itemStep.StepNo}{Environment.NewLine}{itemMeterValueCell.Constant}->{itemMeterValueCell.Constant}{Environment.NewLine}[{ConvertSecToTimeStr(itemMeterValueCell.KeepTime)}]", }); } @@ -341,6 +361,8 @@ namespace CapMachine.Wpf.Services }, ProStepInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}", + ProStep = $"{itemStep.StepNo}/{SpeedMaxStep}", + StepExeInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}{Environment.NewLine}{itemMeterValueCell.StartValue}->{itemMeterValueCell.EndValue}{Environment.NewLine}[{ConvertSecToTimeStr(itemMeterValueCell.KeepTime)}]", MeterName = CurMeterName, }); } @@ -412,7 +434,9 @@ namespace CapMachine.Wpf.Services CurConfigLimitDto = Mapper.Map(Limit), CurConfigAlarmDto = Mapper.Map(Alarm), - ProStepInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}", + ProStepInfo = $"{itemStep.StepNo}", + ProStep = $"{itemStep.StepNo}/{SpeedMaxStep}", + StepExeInfo = $"{itemStep.StepNo}{Environment.NewLine}{itemMeterValueCell.Constant}->{itemMeterValueCell.Constant}{Environment.NewLine}[{ConvertSecToTimeStr(itemMeterValueCell.KeepTime)}]", }); } break; @@ -469,6 +493,8 @@ namespace CapMachine.Wpf.Services CurConfigAlarmDto = Mapper.Map(Alarm), ProStepInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}", + ProStep = $"{itemStep.StepNo}/{SpeedMaxStep}", + StepExeInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}{Environment.NewLine}{itemMeterValueCell.StartValue}->{itemMeterValueCell.EndValue}{Environment.NewLine}[{ConvertSecToTimeStr(itemMeterValueCell.KeepTime)}]", MeterName = CurMeterName, }); } @@ -561,7 +587,9 @@ namespace CapMachine.Wpf.Services CurConfigLimitDto = Mapper.Map(Limit), CurConfigAlarmDto = Mapper.Map(Alarm), - ProStepInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}", + ProStepInfo = $"{itemStep.StepNo}", + ProStep = $"{itemStep.StepNo}/{SpeedMaxStep}", + StepExeInfo = $"{itemStep.StepNo}{Environment.NewLine}{itemMeterValueCell.Constant}->{itemMeterValueCell.Constant}{Environment.NewLine}[{ConvertSecToTimeStr(itemMeterValueCell.KeepTime)}]", }); } break; @@ -618,6 +646,8 @@ namespace CapMachine.Wpf.Services CurConfigAlarmDto = Mapper.Map(Alarm), ProStepInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}", + ProStep = $"{itemStep.StepNo}/{SpeedMaxStep}", + StepExeInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}{Environment.NewLine}{itemMeterValueCell.StartValue}->{itemMeterValueCell.EndValue}{Environment.NewLine}[{ConvertSecToTimeStr(itemMeterValueCell.KeepTime)}]", MeterName = CurMeterName, }); } @@ -710,7 +740,9 @@ namespace CapMachine.Wpf.Services CurConfigLimitDto = Mapper.Map(Limit), CurConfigAlarmDto = Mapper.Map(Alarm), - ProStepInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}", + ProStepInfo = $"{itemStep.StepNo}", + ProStep = $"{itemStep.StepNo}/{SpeedMaxStep}", + StepExeInfo = $"{itemStep.StepNo}{Environment.NewLine}{itemMeterValueCell.Constant}->{itemMeterValueCell.Constant}{Environment.NewLine}[{ConvertSecToTimeStr(itemMeterValueCell.KeepTime)}]", }); } break; @@ -767,6 +799,8 @@ namespace CapMachine.Wpf.Services CurConfigAlarmDto = Mapper.Map(Alarm), ProStepInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}", + ProStep = $"{itemStep.StepNo}/{SpeedMaxStep}", + StepExeInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}{Environment.NewLine}{itemMeterValueCell.StartValue}->{itemMeterValueCell.EndValue}{Environment.NewLine}[{ConvertSecToTimeStr(itemMeterValueCell.KeepTime)}]", MeterName = CurMeterName, }); } @@ -859,7 +893,9 @@ namespace CapMachine.Wpf.Services CurConfigLimitDto = Mapper.Map(Limit), CurConfigAlarmDto = Mapper.Map(Alarm), - ProStepInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}", + ProStepInfo = $"{itemStep.StepNo}", + ProStep = $"{itemStep.StepNo}/{SpeedMaxStep}", + StepExeInfo = $"{itemStep.StepNo}{Environment.NewLine}{itemMeterValueCell.Constant}->{itemMeterValueCell.Constant}{Environment.NewLine}[{ConvertSecToTimeStr(itemMeterValueCell.KeepTime)}]", }); } break; @@ -916,6 +952,8 @@ namespace CapMachine.Wpf.Services CurConfigAlarmDto = Mapper.Map(Alarm), ProStepInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}", + ProStep = $"{itemStep.StepNo}/{SpeedMaxStep}", + StepExeInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}{Environment.NewLine}{itemMeterValueCell.StartValue}->{itemMeterValueCell.EndValue}{Environment.NewLine}[{ConvertSecToTimeStr(itemMeterValueCell.KeepTime)}]", MeterName = CurMeterName, }); } @@ -1008,7 +1046,9 @@ namespace CapMachine.Wpf.Services CurConfigLimitDto = Mapper.Map(Limit), CurConfigAlarmDto = Mapper.Map(Alarm), - ProStepInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}", + ProStepInfo = $"{itemStep.StepNo}", + ProStep = $"{itemStep.StepNo}/{SpeedMaxStep}", + StepExeInfo = $"{itemStep.StepNo}{Environment.NewLine}{itemMeterValueCell.Constant}->{itemMeterValueCell.Constant}{Environment.NewLine}[{ConvertSecToTimeStr(itemMeterValueCell.KeepTime)}]", }); } break; @@ -1065,6 +1105,8 @@ namespace CapMachine.Wpf.Services CurConfigAlarmDto = Mapper.Map(Alarm), ProStepInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}", + ProStep = $"{itemStep.StepNo}/{SpeedMaxStep}", + StepExeInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}{Environment.NewLine}{itemMeterValueCell.StartValue}->{itemMeterValueCell.EndValue}{Environment.NewLine}[{ConvertSecToTimeStr(itemMeterValueCell.KeepTime)}]", MeterName = CurMeterName, }); } @@ -1157,7 +1199,9 @@ namespace CapMachine.Wpf.Services CurConfigLimitDto = Mapper.Map(Limit), CurConfigAlarmDto = Mapper.Map(Alarm), - ProStepInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}", + ProStepInfo = $"{itemStep.StepNo}", + ProStep = $"{itemStep.StepNo}/{SpeedMaxStep}", + StepExeInfo = $"{itemStep.StepNo}{Environment.NewLine}{itemMeterValueCell.Constant}->{itemMeterValueCell.Constant}{Environment.NewLine}[{ConvertSecToTimeStr(itemMeterValueCell.KeepTime)}]", }); } break; @@ -1214,6 +1258,8 @@ namespace CapMachine.Wpf.Services CurConfigAlarmDto = Mapper.Map(Alarm), ProStepInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}", + ProStep = $"{itemStep.StepNo}/{SpeedMaxStep}", + StepExeInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}{Environment.NewLine}{itemMeterValueCell.StartValue}->{itemMeterValueCell.EndValue}{Environment.NewLine}[{ConvertSecToTimeStr(itemMeterValueCell.KeepTime)}]", MeterName = CurMeterName, }); } @@ -1306,7 +1352,9 @@ namespace CapMachine.Wpf.Services CurConfigLimitDto = Mapper.Map(Limit), CurConfigAlarmDto = Mapper.Map(Alarm), - ProStepInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}", + ProStepInfo = $"{itemStep.StepNo}", + ProStep = $"{itemStep.StepNo}/{SpeedMaxStep}", + StepExeInfo = $"{itemStep.StepNo}{Environment.NewLine}{itemMeterValueCell.Constant}->{itemMeterValueCell.Constant}{Environment.NewLine}[{ConvertSecToTimeStr(itemMeterValueCell.KeepTime)}]", }); } break; @@ -1363,6 +1411,8 @@ namespace CapMachine.Wpf.Services CurConfigAlarmDto = Mapper.Map(Alarm), ProStepInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}", + ProStep = $"{itemStep.StepNo}/{SpeedMaxStep}", + StepExeInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}{Environment.NewLine}{itemMeterValueCell.StartValue}->{itemMeterValueCell.EndValue}{Environment.NewLine}[{ConvertSecToTimeStr(itemMeterValueCell.KeepTime)}]", MeterName = CurMeterName, }); } @@ -1455,7 +1505,9 @@ namespace CapMachine.Wpf.Services CurConfigLimitDto = Mapper.Map(Limit), CurConfigAlarmDto = Mapper.Map(Alarm), - ProStepInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}", + ProStepInfo = $"{itemStep.StepNo}", + ProStep = $"{itemStep.StepNo}/{SpeedMaxStep}", + StepExeInfo = $"{itemStep.StepNo}{Environment.NewLine}{itemMeterValueCell.Constant}->{itemMeterValueCell.Constant}{Environment.NewLine}[{ConvertSecToTimeStr(itemMeterValueCell.KeepTime)}]", }); } break; @@ -1512,6 +1564,8 @@ namespace CapMachine.Wpf.Services CurConfigAlarmDto = Mapper.Map(Alarm), ProStepInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}", + ProStep = $"{itemStep.StepNo}/{SpeedMaxStep}", + StepExeInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}{Environment.NewLine}{itemMeterValueCell.StartValue}->{itemMeterValueCell.EndValue}{Environment.NewLine}[{ConvertSecToTimeStr(itemMeterValueCell.KeepTime)}]", MeterName = CurMeterName, }); } @@ -1604,7 +1658,9 @@ namespace CapMachine.Wpf.Services CurConfigLimitDto = Mapper.Map(Limit), CurConfigAlarmDto = Mapper.Map(Alarm), - ProStepInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}", + ProStepInfo = $"{itemStep.StepNo}", + ProStep = $"{itemStep.StepNo}/{SpeedMaxStep}", + StepExeInfo = $"{itemStep.StepNo}{Environment.NewLine}{itemMeterValueCell.Constant}->{itemMeterValueCell.Constant}{Environment.NewLine}[{ConvertSecToTimeStr(itemMeterValueCell.KeepTime)}]", }); } break; @@ -1661,6 +1717,8 @@ namespace CapMachine.Wpf.Services CurConfigAlarmDto = Mapper.Map(Alarm), ProStepInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}", + ProStep = $"{itemStep.StepNo}/{SpeedMaxStep}", + StepExeInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}{Environment.NewLine}{itemMeterValueCell.StartValue}->{itemMeterValueCell.EndValue}{Environment.NewLine}[{ConvertSecToTimeStr(itemMeterValueCell.KeepTime)}]", MeterName = CurMeterName, }); } @@ -1753,7 +1811,9 @@ namespace CapMachine.Wpf.Services CurConfigLimitDto = Mapper.Map(Limit), CurConfigAlarmDto = Mapper.Map(Alarm), - ProStepInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}", + ProStepInfo = $"{itemStep.StepNo}", + ProStep = $"{itemStep.StepNo}/{SpeedMaxStep}", + StepExeInfo = $"{itemStep.StepNo}{Environment.NewLine}{itemMeterValueCell.Constant}->{itemMeterValueCell.Constant}{Environment.NewLine}[{ConvertSecToTimeStr(itemMeterValueCell.KeepTime)}]", }); } break; @@ -1810,6 +1870,8 @@ namespace CapMachine.Wpf.Services CurConfigAlarmDto = Mapper.Map(Alarm), ProStepInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}", + ProStep = $"{itemStep.StepNo}/{SpeedMaxStep}", + StepExeInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}{Environment.NewLine}{itemMeterValueCell.StartValue}->{itemMeterValueCell.EndValue}{Environment.NewLine}[{ConvertSecToTimeStr(itemMeterValueCell.KeepTime)}]", MeterName = CurMeterName, }); } @@ -1902,7 +1964,9 @@ namespace CapMachine.Wpf.Services CurConfigLimitDto = Mapper.Map(Limit), CurConfigAlarmDto = Mapper.Map(Alarm), - ProStepInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}", + ProStepInfo = $"{itemStep.StepNo}", + ProStep = $"{itemStep.StepNo}/{SpeedMaxStep}", + StepExeInfo = $"{itemStep.StepNo}{Environment.NewLine}{itemMeterValueCell.Constant}->{itemMeterValueCell.Constant}{Environment.NewLine}[{ConvertSecToTimeStr(itemMeterValueCell.KeepTime)}]", }); } break; @@ -1959,6 +2023,8 @@ namespace CapMachine.Wpf.Services CurConfigAlarmDto = Mapper.Map(Alarm), ProStepInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}", + ProStep = $"{itemStep.StepNo}/{SpeedMaxStep}", + StepExeInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}{Environment.NewLine}{itemMeterValueCell.StartValue}->{itemMeterValueCell.EndValue}{Environment.NewLine}[{ConvertSecToTimeStr(itemMeterValueCell.KeepTime)}]", MeterName = CurMeterName, }); } @@ -2051,7 +2117,9 @@ namespace CapMachine.Wpf.Services CurConfigLimitDto = Mapper.Map(Limit), CurConfigAlarmDto = Mapper.Map(Alarm), - ProStepInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}", + ProStepInfo = $"{itemStep.StepNo}", + ProStep = $"{itemStep.StepNo}/{SpeedMaxStep}", + StepExeInfo = $"{itemStep.StepNo}{Environment.NewLine}{itemMeterValueCell.Constant}->{itemMeterValueCell.Constant}{Environment.NewLine}[{ConvertSecToTimeStr(itemMeterValueCell.KeepTime)}]", }); } break; @@ -2108,6 +2176,8 @@ namespace CapMachine.Wpf.Services CurConfigAlarmDto = Mapper.Map(Alarm), ProStepInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}", + ProStep = $"{itemStep.StepNo}/{SpeedMaxStep}", + StepExeInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}{Environment.NewLine}{itemMeterValueCell.StartValue}->{itemMeterValueCell.EndValue}{Environment.NewLine}[{ConvertSecToTimeStr(itemMeterValueCell.KeepTime)}]", MeterName = CurMeterName, }); } @@ -2200,7 +2270,9 @@ namespace CapMachine.Wpf.Services CurConfigLimitDto = Mapper.Map(Limit), CurConfigAlarmDto = Mapper.Map(Alarm), - ProStepInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}", + ProStepInfo = $"{itemStep.StepNo}", + ProStep = $"{itemStep.StepNo}/{SpeedMaxStep}", + StepExeInfo = $"{itemStep.StepNo}{Environment.NewLine}{itemMeterValueCell.Constant}->{itemMeterValueCell.Constant}{Environment.NewLine}[{ConvertSecToTimeStr(itemMeterValueCell.KeepTime)}]", }); } break; @@ -2257,6 +2329,8 @@ namespace CapMachine.Wpf.Services CurConfigAlarmDto = Mapper.Map(Alarm), ProStepInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}", + ProStep = $"{itemStep.StepNo}/{SpeedMaxStep}", + StepExeInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}{Environment.NewLine}{itemMeterValueCell.StartValue}->{itemMeterValueCell.EndValue}{Environment.NewLine}[{ConvertSecToTimeStr(itemMeterValueCell.KeepTime)}]", MeterName = CurMeterName, }); } @@ -2349,7 +2423,9 @@ namespace CapMachine.Wpf.Services CurConfigLimitDto = Mapper.Map(Limit), CurConfigAlarmDto = Mapper.Map(Alarm), - ProStepInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}", + ProStepInfo = $"{itemStep.StepNo}", + ProStep = $"{itemStep.StepNo}/{SpeedMaxStep}", + StepExeInfo = $"{itemStep.StepNo}{Environment.NewLine}{itemMeterValueCell.Constant}->{itemMeterValueCell.Constant}{Environment.NewLine}[{ConvertSecToTimeStr(itemMeterValueCell.KeepTime)}]", }); } break; @@ -2406,6 +2482,8 @@ namespace CapMachine.Wpf.Services CurConfigAlarmDto = Mapper.Map(Alarm), ProStepInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}", + ProStep = $"{itemStep.StepNo}/{SpeedMaxStep}", + StepExeInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}{Environment.NewLine}{itemMeterValueCell.StartValue}->{itemMeterValueCell.EndValue}{Environment.NewLine}[{ConvertSecToTimeStr(itemMeterValueCell.KeepTime)}]", MeterName = CurMeterName, }); } @@ -2498,7 +2576,9 @@ namespace CapMachine.Wpf.Services CurConfigLimitDto = Mapper.Map(Limit), CurConfigAlarmDto = Mapper.Map(Alarm), - ProStepInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}", + ProStepInfo = $"{itemStep.StepNo}", + ProStep = $"{itemStep.StepNo}/{SpeedMaxStep}", + StepExeInfo = $"{itemStep.StepNo}{Environment.NewLine}{itemMeterValueCell.Constant}->{itemMeterValueCell.Constant}{Environment.NewLine}[{ConvertSecToTimeStr(itemMeterValueCell.KeepTime)}]", }); } break; @@ -2555,6 +2635,8 @@ namespace CapMachine.Wpf.Services CurConfigAlarmDto = Mapper.Map(Alarm), ProStepInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}", + ProStep = $"{itemStep.StepNo}/{SpeedMaxStep}", + StepExeInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}{Environment.NewLine}{itemMeterValueCell.StartValue}->{itemMeterValueCell.EndValue}{Environment.NewLine}[{ConvertSecToTimeStr(itemMeterValueCell.KeepTime)}]", MeterName = CurMeterName, }); } @@ -2647,7 +2729,9 @@ namespace CapMachine.Wpf.Services CurConfigLimitDto = Mapper.Map(Limit), CurConfigAlarmDto = Mapper.Map(Alarm), - ProStepInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}", + ProStepInfo = $"{itemStep.StepNo}", + ProStep = $"{itemStep.StepNo}/{SpeedMaxStep}", + StepExeInfo = $"{itemStep.StepNo}{Environment.NewLine}{itemMeterValueCell.Constant}->{itemMeterValueCell.Constant}{Environment.NewLine}[{ConvertSecToTimeStr(itemMeterValueCell.KeepTime)}]", }); } break; @@ -2704,6 +2788,8 @@ namespace CapMachine.Wpf.Services CurConfigAlarmDto = Mapper.Map(Alarm), ProStepInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}", + ProStep = $"{itemStep.StepNo}/{SpeedMaxStep}", + StepExeInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}{Environment.NewLine}{itemMeterValueCell.StartValue}->{itemMeterValueCell.EndValue}{Environment.NewLine}[{ConvertSecToTimeStr(itemMeterValueCell.KeepTime)}]", MeterName = CurMeterName, }); } @@ -2796,7 +2882,9 @@ namespace CapMachine.Wpf.Services CurConfigLimitDto = Mapper.Map(Limit), CurConfigAlarmDto = Mapper.Map(Alarm), - ProStepInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}", + ProStepInfo = $"{itemStep.StepNo}", + ProStep = $"{itemStep.StepNo}/{SpeedMaxStep}", + StepExeInfo = $"{itemStep.StepNo}{Environment.NewLine}{itemMeterValueCell.Constant}->{itemMeterValueCell.Constant}{Environment.NewLine}[{ConvertSecToTimeStr(itemMeterValueCell.KeepTime)}]", }); } break; @@ -2853,6 +2941,8 @@ namespace CapMachine.Wpf.Services CurConfigAlarmDto = Mapper.Map(Alarm), ProStepInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}", + ProStep = $"{itemStep.StepNo}/{SpeedMaxStep}", + StepExeInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}{Environment.NewLine}{itemMeterValueCell.StartValue}->{itemMeterValueCell.EndValue}{Environment.NewLine}[{ConvertSecToTimeStr(itemMeterValueCell.KeepTime)}]", MeterName = CurMeterName, }); } @@ -2945,7 +3035,9 @@ namespace CapMachine.Wpf.Services CurConfigLimitDto = Mapper.Map(Limit), CurConfigAlarmDto = Mapper.Map(Alarm), - ProStepInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}", + ProStepInfo = $"{itemStep.StepNo}", + ProStep = $"{itemStep.StepNo}/{SpeedMaxStep}", + StepExeInfo = $"{itemStep.StepNo}{Environment.NewLine}{itemMeterValueCell.Constant}->{itemMeterValueCell.Constant}{Environment.NewLine}[{ConvertSecToTimeStr(itemMeterValueCell.KeepTime)}]", }); } break; @@ -3002,6 +3094,8 @@ namespace CapMachine.Wpf.Services CurConfigAlarmDto = Mapper.Map(Alarm), ProStepInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}", + ProStep = $"{itemStep.StepNo}/{SpeedMaxStep}", + StepExeInfo = $"{itemStep.StepNo}-{itemMeterValueCell.StepNo}{Environment.NewLine}{itemMeterValueCell.StartValue}->{itemMeterValueCell.EndValue}{Environment.NewLine}[{ConvertSecToTimeStr(itemMeterValueCell.KeepTime)}]", MeterName = CurMeterName, }); } @@ -3046,6 +3140,9 @@ namespace CapMachine.Wpf.Services } } + + //通过速度的步骤信息获取总时间 + ProRunTimeCalcModel.TotalProSec = ListProExModel.FindFirst(a => a.MeterName == "转速").ListProStepExe.Sum(a => a.KeepTime); } @@ -3156,15 +3253,7 @@ namespace CapMachine.Wpf.Services /// public ProRunTimeCalc ProRunTimeCalcModel { get; set; } = new ProRunTimeCalc(); - /// - /// 暂停开始时间 - /// - public DateTime PauseStartDt { get; set; } - /// - /// 暂停结束时间 - /// - public DateTime PauseEndDt { get; set; } /// /// 开始程序调度运行 @@ -3218,8 +3307,6 @@ namespace CapMachine.Wpf.Services /// public void PauseProRun() { - //开始暂停的计时 - PauseStartDt = DateTime.Now; //暂停计时统计 ProRunTimeCalcModel.PauseProRunTime(); @@ -3241,13 +3328,7 @@ namespace CapMachine.Wpf.Services /// public void ContinueProRun() { - ProRunTimeCalcModel.ContinueProRunTime(); - - PauseEndDt = DateTime.Now; - - //统计的暂停的时间 - var PauseTime = (PauseEndDt - PauseStartDt).TotalSeconds; - ProRunTimeCalcModel.PauseTotalSecTime = ProRunTimeCalcModel.PauseTotalSecTime + (int)Math.Round(PauseTime); + var PauseTime = ProRunTimeCalcModel.ContinueProRunTime(); LogService.Info($"【时间】: {DateTime.Now.ToString()} - 程序执行继续"); diff --git a/CapMachine.Wpf/Views/MonitorView.xaml b/CapMachine.Wpf/Views/MonitorView.xaml index d4baa6b..8af3c17 100644 --- a/CapMachine.Wpf/Views/MonitorView.xaml +++ b/CapMachine.Wpf/Views/MonitorView.xaml @@ -174,6 +174,7 @@ MeterName="{Binding NameNoUnit}" PVValue="{Binding PVModel.EngValueStr}" SVValue="{Binding SVModel.EngValueStr}" + StepExeInfo="{Binding StepExeInfo}" Unit="{Binding Unit}" /> @@ -211,7 +212,7 @@ + + + + + + + +