更改主UI界面

This commit is contained in:
2025-04-27 17:50:57 +08:00
parent cf3d09cb3e
commit 96597c95f2
11 changed files with 545 additions and 284 deletions

View File

@@ -21,7 +21,7 @@
<Grid.RowDefinitions>
<RowDefinition Height="2.2*" />
<RowDefinition Height="3*" />
<RowDefinition Height="1.5*" />
<RowDefinition Height="1.2*" />
</Grid.RowDefinitions>
<Border
Margin="1,3,1,0"
@@ -81,16 +81,9 @@
<RowDefinition Height="0.5*" />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<!-- 手自动切换 -->
<StackPanel
Grid.ColumnSpan="2"
Margin="5,3,3,0"
Orientation="Horizontal">
<StackPanel Margin="5,3,3,0" Orientation="Horizontal">
<!--
Command="{Binding ElementName=MeterInstance, Path=AutoHandCommand}"
CommandParameter="{Binding ElementName=MeterInstance}"
@@ -114,90 +107,128 @@
Foreground="CadetBlue"
Text="{Binding ElementName=MeterInstance, Path=AutoStateMsg}" />
</StackPanel>
<!-- MV -->
<StackPanel
Grid.Row="1"
Grid.Column="0"
Margin="3,3,3,0">
<StackPanel.Resources />
<!--
Text="{Binding ElementName=MeterInstance, Path=AutoStateMsg}"
Command="{Binding ElementName=MeterInstance, Path=AutoHandCommand}"
CommandParameter="{Binding ElementName=MeterInstance}"
把整个控件作为参数传递进去 Text="{Binding ElementName=MeterInstance, Path=HandValueMVParameter}"
-->
<TextBox
x:Name="HandValueMV"
Width="42"
HorizontalContentAlignment="Center"
KeyDown="HandValueMV_KeyDown"
ToolTip="按【Enter】回车键才会发送生效"
Visibility="{Binding ElementName=MeterInstance, Path=IsHandValueShow}">
<TextBox.Style>
<Style BasedOn="{StaticResource MaterialDesignTextBox}" TargetType="TextBox">
<Style.Triggers>
<Trigger Property="IsFocused" Value="True">
<Setter Property="Text" Value="{Binding ElementName=MeterInstance, Path=HandValueTempMVParameter, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
<Setter Property="Background" Value="LimeGreen" />
</Trigger>
<Trigger Property="IsFocused" Value="False">
<Setter Property="Text" Value="{Binding ElementName=MeterInstance, Path=HandValueMVParameter, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
</Trigger>
</Style.Triggers>
</Style>
</TextBox.Style>
</TextBox>
<TextBlock
Margin="0,2,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontWeight="Bold"
Foreground="CadetBlue"
Text="MV"
Visibility="{Binding ElementName=MeterInstance, Path=IsHandValueShow}" />
</StackPanel>
<!-- SV -->
<StackPanel
Grid.Row="1"
Grid.Column="1"
Margin="3,3,3,0">
<StackPanel.Resources />
<!--
Text="{Binding ElementName=MeterInstance, Path=AutoStateMsg}"
Command="{Binding ElementName=MeterInstance, Path=AutoHandCommand}"
CommandParameter="{Binding ElementName=MeterInstance}"
把整个控件作为参数传递进去 Text="{Binding ElementName=MeterInstance, Path=HandValueSVParameter, Mode=TwoWay, UpdateSourceTrigger=LostFocus}"
-->
<TextBox
x:Name="HandValueSV"
Width="42"
HorizontalContentAlignment="Center"
KeyDown="HandValueSV_KeyDown"
ToolTip="按【Enter】回车键才会发送生效"
Visibility="{Binding ElementName=MeterInstance, Path=IsHandValueShow}">
<TextBox.Style>
<Style BasedOn="{StaticResource MaterialDesignTextBox}" TargetType="TextBox">
<Style.Triggers>
<Trigger Property="IsFocused" Value="True">
<Setter Property="Text" Value="{Binding ElementName=MeterInstance, Path=HandValueTempSVParameter, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
<Setter Property="Background" Value="LimeGreen" />
</Trigger>
<Trigger Property="IsFocused" Value="False">
<Setter Property="Text" Value="{Binding ElementName=MeterInstance, Path=HandValueSVParameter, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
</Trigger>
</Style.Triggers>
</Style>
</TextBox.Style>
</TextBox>
<TextBlock
Margin="0,2,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontWeight="Bold"
Foreground="CadetBlue"
Text="SV"
Visibility="{Binding ElementName=MeterInstance, Path=IsHandValueShow}" />
</StackPanel>
<TabControl Grid.Row="1" Grid.ColumnSpan="2">
<TabControl.Template>
<ControlTemplate TargetType="TabControl">
<Grid>
<ContentPresenter ContentSource="SelectedContent" />
</Grid>
</ControlTemplate>
</TabControl.Template>
<TabControl.Style>
<Style TargetType="TabControl">
<Setter Property="SelectedIndex" Value="0" />
<Style.Triggers>
<DataTrigger Binding="{Binding IsChecked, ElementName=ToggleBtnAutoHand}" Value="True">
<Setter Property="SelectedIndex" Value="1" />
</DataTrigger>
</Style.Triggers>
</Style>
</TabControl.Style>
<TabItem>
<TextBlock
Margin="2,2"
HorizontalAlignment="Center"
VerticalAlignment="Center"
xml:space="preserve"
FontSize="12"
FontWeight="Bold"
Foreground="#404040"
Text="{Binding ElementName=MeterInstance, Path=StepExeInfo}"
TextAlignment="Center" />
</TabItem>
<TabItem>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<!-- MV -->
<StackPanel Margin="3,3,3,0">
<StackPanel.Resources />
<!--
Text="{Binding ElementName=MeterInstance, Path=AutoStateMsg}"
Command="{Binding ElementName=MeterInstance, Path=AutoHandCommand}"
CommandParameter="{Binding ElementName=MeterInstance}"
把整个控件作为参数传递进去 Text="{Binding ElementName=MeterInstance, Path=HandValueMVParameter}"
Visibility="{Binding ElementName=MeterInstance, Path=IsHandValueShow}" 用TabControl控制了不需要显示了
-->
<TextBox
x:Name="HandValueMV"
Width="42"
HorizontalContentAlignment="Center"
KeyDown="HandValueMV_KeyDown"
ToolTip="按【Enter】回车键才会发送生效">
<TextBox.Style>
<Style BasedOn="{StaticResource MaterialDesignTextBox}" TargetType="TextBox">
<Style.Triggers>
<Trigger Property="IsFocused" Value="True">
<Setter Property="Text" Value="{Binding ElementName=MeterInstance, Path=HandValueTempMVParameter, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
<Setter Property="Background" Value="LimeGreen" />
</Trigger>
<Trigger Property="IsFocused" Value="False">
<Setter Property="Text" Value="{Binding ElementName=MeterInstance, Path=HandValueMVParameter, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
</Trigger>
</Style.Triggers>
</Style>
</TextBox.Style>
</TextBox>
<TextBlock
Margin="0,2,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontWeight="Bold"
Foreground="CadetBlue"
Text="MV" />
</StackPanel>
<!-- SV -->
<StackPanel Grid.Column="1" Margin="3,3,3,0">
<StackPanel.Resources />
<!--
Text="{Binding ElementName=MeterInstance, Path=AutoStateMsg}"
Command="{Binding ElementName=MeterInstance, Path=AutoHandCommand}"
CommandParameter="{Binding ElementName=MeterInstance}"
把整个控件作为参数传递进去 Text="{Binding ElementName=MeterInstance, Path=HandValueSVParameter, Mode=TwoWay, UpdateSourceTrigger=LostFocus}"
-->
<TextBox
x:Name="HandValueSV"
Width="42"
HorizontalContentAlignment="Center"
KeyDown="HandValueSV_KeyDown"
ToolTip="按【Enter】回车键才会发送生效">
<TextBox.Style>
<Style BasedOn="{StaticResource MaterialDesignTextBox}" TargetType="TextBox">
<Style.Triggers>
<Trigger Property="IsFocused" Value="True">
<Setter Property="Text" Value="{Binding ElementName=MeterInstance, Path=HandValueTempSVParameter, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
<Setter Property="Background" Value="LimeGreen" />
</Trigger>
<Trigger Property="IsFocused" Value="False">
<Setter Property="Text" Value="{Binding ElementName=MeterInstance, Path=HandValueSVParameter, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
</Trigger>
</Style.Triggers>
</Style>
</TextBox.Style>
</TextBox>
<TextBlock
Margin="0,2,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontWeight="Bold"
Foreground="CadetBlue"
Text="SV" />
</StackPanel>
</Grid>
</TabItem>
</TabControl>
</Grid>
<Border

View File

@@ -125,6 +125,24 @@ namespace CapMachine.Shared.Controls
public static readonly DependencyProperty AutoHandStateProperty = DependencyProperty.Register("AutoHandState", typeof(bool), typeof(Meter), new PropertyMetadata(false));
/// <summary>
/// 步骤执行信息
/// </summary>
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 = "自动";
/// <summary>
/// 手自动的消息
@@ -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";
/// <summary>
/// 手动设置的是值是否显示
/// </summary>
public string IsHandValueShow
{
get { return _IsHandValueShow; }
set
{
_IsHandValueShow = value;
OnRaisePropertyChanged("IsHandValueShow");
}
}
//private string _IsHandValueShow = "Hidden";
///// <summary>
///// 手动设置的是值是否显示
///// </summary>
//public string IsHandValueShow
//{
// get { return _IsHandValueShow; }
// set
// {
// _IsHandValueShow = value;
// OnRaisePropertyChanged("IsHandValueShow");
// }
//}
/// <summary>

View File

@@ -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
/// </summary>
public List<ProStepExe> ListProStepExe { get; set; }
/// <summary>
/// 仪表步骤执行时间信息
/// </summary>
public ProRunTime ProRunTimeModel { get; set; }
/// <summary>
/// 下一步步骤数据执行
/// </summary>
@@ -84,14 +80,27 @@ namespace CapMachine.Wpf.Models.ProModelPars
public ProStepExe CurProStepExe
{
get { return _CurProStepExe; }
set { _CurProStepExe = value;RaisePropertyChanged(); }
set { _CurProStepExe = value; RaisePropertyChanged(); }
}
///// <summary>
///// 当前步骤数据执行
///// 给看步骤是否变化使用
///// </summary>
//public ProStepExe CurProStepExe { get; set; }
private string _RunSegName;
/// <summary>
/// 运行的程序段名称
/// </summary>
public string RunSegName
{
get { return _RunSegName; }
set
{
if (value != _RunSegName)
{
RaisePropertyChanged();
}
_RunSegName = value;
}
}
/// <summary>
/// 上一步步骤数据执行
@@ -99,16 +108,29 @@ namespace CapMachine.Wpf.Models.ProModelPars
/// </summary>
public ProStepExe LastProStepExe { get; set; }
/// <summary>
/// 当前的变量标签
/// TagManger里面的标签信息
/// </summary>
public ShortControlTag CurShortControlTag { get; set; }
///// <summary>
///// 当前程序段步骤步骤时间长
///// 程序步骤里面一个整步
///// Sec
///// </summary>
//public int CurProStepRunTime { get; set; }
///// <summary>
///// 当前程序段步骤开始时间
///// 程序步骤里面一个整步
///// </summary>
//public DateTime CurProStepStartTime { set; get; }
/// <summary>
/// 当前程序段时间长
/// 仪表步骤执行时间信息
/// </summary>
public int CurProTimeSum { get; set; }
/// <summary>
/// 当前程序段开始时间
/// </summary>
public DateTime CurProStartTime { set; get; }
public ProStepRunTime ProStepRunTimeModel { get; set; }
#region
@@ -131,11 +153,13 @@ namespace CapMachine.Wpf.Models.ProModelPars
/// <summary>
/// 当前步骤开始运行时间
/// 这个是具体的小步骤(那个带斜坡循环的)的开始时间
/// </summary>
public DateTime StepStartDt { get; set; }
/// <summary>
/// 当前步骤结束运行时间
/// 这个是具体的小步骤(那个带斜坡循环的)的结束时间
/// </summary>
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!;
////////准备新的数据///////////

View File

@@ -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
{
/// <summary>
/// 程序运行时间
/// </summary>
public class ProRunTime
{
public EventHandler<string> RunTimeCallSglEvent;
/// <summary>
/// 是否启用
/// </summary>
public bool RunEnable { get; set; } = false;
/// <summary>
/// RunTimeCallSglEvent 是否注册关联方法
/// </summary>
public bool EventRegister { get; set; } = false;
/// <summary>
/// 当前仪表名称
/// </summary>
public string MeterName { get; set; }
/// <summary>
/// 当前程序段名称
/// </summary>
public string ProName { get; set; }
/// <summary>
/// 当前仪表程序步骤
/// </summary>
public int MeterStep { get; set; }
/// <summary>
/// 当前步骤开始运行时间
/// </summary>
public DateTime StartDateTime { get; set; }
/// <summary>
/// 当前步骤结束运行时间
/// </summary>
public DateTime EndDateTime { get; set; }
private DateTime currentDateTime;
/// <summary>
/// 当前时间
/// </summary>
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;
}
}
}
/// <summary>
/// 当前步骤已经运行时长-秒
/// </summary>
public int RunTime { get; set; }
}
}

View File

@@ -73,10 +73,25 @@ namespace CapMachine.Wpf.Models.ProModelPars
set { _ProStepInfo = value;RaisePropertyChanged(); }
}
/////// <summary>
/////// 这个步骤是打开具体设置步骤界面的那个层面的信息例如2-3,代表是程序2里面的仪表步骤3方便调试和给液击使用
/////// </summary>
////public string? ProStepInfo { get; set; }
private string? _ProStep;
/// <summary>
/// 程序步骤的步骤信息
/// 比如例如2-3里面的2步骤信息就是大步骤的信息
/// </summary>
public string? ProStep
{
get { return _ProStep; }
set { _ProStep = value; RaisePropertyChanged(); }
}
/// <summary>
///步骤执行的信息
/// 0->8000
/// [00:00:12]
/// </summary>
public string? StepExeInfo { get; set; }
///// <summary>
///// 启用状态-没有启用就是什么数据都没有

View File

@@ -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
{
/// <summary>
/// 程序步骤里面一个整步运行时间
/// </summary>
public class ProStepRunTime : BindableBase
{
public EventHandler<string> RunTimeCallSglEvent;
/// <summary>
/// 是否启用
/// </summary>
public bool RunEnable { get; set; } = false;
/// <summary>
/// 当前仪表程序步骤
/// </summary>
public int ProStep { get; set; }
/// <summary>
/// 当前步骤开始运行时间
/// </summary>
public DateTime StartDt { get; set; }
private DateTime currentDateTime;
/// <summary>
/// 当前时间
/// </summary>
public DateTime CurrentDateTime
{
get
{
return currentDateTime;
}
set
{
currentDateTime = value;
}
}
/// <summary>
/// 当前步骤已经运行时长-秒
/// </summary>
public int RunTime { get; set; }
}
}

View File

@@ -11,7 +11,7 @@ using System.Windows.Threading;
namespace CapMachine.Wpf.Models
{
/// <summary>
/// 程序运行时间统计
/// 整个程序运行时间统计
/// </summary>
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
/// <summary>
/// 程序运行时间周期统计
/// 弃用
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
@@ -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");
}
/// <summary>
@@ -88,15 +103,28 @@ namespace CapMachine.Wpf.Models
/// </summary>
public void PauseProRunTime()
{
//开始暂停的计时
PauseStartDt = DateTime.Now;
CycleTimer.Stop();
}
/// <summary>
/// 继续计时
/// 返回暂停时间
/// </summary>
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;
}
/// <summary>
@@ -126,6 +154,22 @@ namespace CapMachine.Wpf.Models
/// </summary>
public DateTime ProEndDt { get; set; }
/// <summary>
/// 整个程序步骤的时间长度
/// </summary>
public long TotalProSec { get; set; }
private double _ProValue;
/// <summary>
/// 进度数据
/// </summary>
public double ProValue
{
get { return _ProValue; }
set { _ProValue = value; RaisePropertyChanged(); }
}
private string? _ProRunTimeStr;
/// <summary>
@@ -137,6 +181,17 @@ namespace CapMachine.Wpf.Models
set { _ProRunTimeStr = value; RaisePropertyChanged(); }
}
private string _EndTimeInfo;
/// <summary>
/// 结束时间字符串
/// </summary>
public string EndTimeInfo
{
get { return _EndTimeInfo; }
set { _EndTimeInfo = value; RaisePropertyChanged(); }
}
/// <summary>
/// 全部的暂停的时间
/// 可能暂停多次
@@ -144,5 +199,21 @@ namespace CapMachine.Wpf.Models
public int PauseTotalSecTime { get; set; }
#region
/// <summary>
/// 暂停开始时间
/// </summary>
public DateTime PauseStartDt { get; set; }
/// <summary>
/// 暂停结束时间
/// </summary>
public DateTime PauseEndDt { get; set; }
#endregion
}
}

View File

@@ -103,6 +103,19 @@ namespace CapMachine.Wpf.Models.Tag
set { _AutoHandState = value; RaisePropertyChanged(); }
}
private string _StepExeInfo="--";
/// <summary>
/// 步骤执行的信息
/// 作为主界面的Meter当前步骤的数据的信息
/// </summary>
public string StepExeInfo
{
get { return _StepExeInfo; }
set { _StepExeInfo = value; RaisePropertyChanged(); }
}
///// <summary>
///// 手自动切换地址
///// </summary>

View File

@@ -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
{

View File

@@ -80,11 +80,12 @@ namespace CapMachine.Wpf.Services
MeterName = itemKeyValue.Value.NameNoUnit,
ListProStepExe = new List<ProStepExe>(),
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
/// </summary>
public MachineRunState MachineRunState1 { get; set; }
/// <summary>
/// 时间转换为字符串
/// </summary>
/// <param name="totalSeconds"></param>
/// <returns></returns>
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}";
}
/// <summary>
/// 加载选中的程序运行集合
@@ -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<ConfigLimitDto>(Limit),
CurConfigAlarmDto = Mapper.Map<ConfigAlarmDto>(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<ConfigAlarmDto>(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<ConfigLimitDto>(Limit),
CurConfigAlarmDto = Mapper.Map<ConfigAlarmDto>(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<ConfigAlarmDto>(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<ConfigLimitDto>(Limit),
CurConfigAlarmDto = Mapper.Map<ConfigAlarmDto>(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<ConfigAlarmDto>(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<ConfigLimitDto>(Limit),
CurConfigAlarmDto = Mapper.Map<ConfigAlarmDto>(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<ConfigAlarmDto>(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<ConfigLimitDto>(Limit),
CurConfigAlarmDto = Mapper.Map<ConfigAlarmDto>(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<ConfigAlarmDto>(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<ConfigLimitDto>(Limit),
CurConfigAlarmDto = Mapper.Map<ConfigAlarmDto>(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<ConfigAlarmDto>(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<ConfigLimitDto>(Limit),
CurConfigAlarmDto = Mapper.Map<ConfigAlarmDto>(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<ConfigAlarmDto>(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<ConfigLimitDto>(Limit),
CurConfigAlarmDto = Mapper.Map<ConfigAlarmDto>(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<ConfigAlarmDto>(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<ConfigLimitDto>(Limit),
CurConfigAlarmDto = Mapper.Map<ConfigAlarmDto>(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<ConfigAlarmDto>(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<ConfigLimitDto>(Limit),
CurConfigAlarmDto = Mapper.Map<ConfigAlarmDto>(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<ConfigAlarmDto>(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<ConfigLimitDto>(Limit),
CurConfigAlarmDto = Mapper.Map<ConfigAlarmDto>(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<ConfigAlarmDto>(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<ConfigLimitDto>(Limit),
CurConfigAlarmDto = Mapper.Map<ConfigAlarmDto>(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<ConfigAlarmDto>(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<ConfigLimitDto>(Limit),
CurConfigAlarmDto = Mapper.Map<ConfigAlarmDto>(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<ConfigAlarmDto>(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<ConfigLimitDto>(Limit),
CurConfigAlarmDto = Mapper.Map<ConfigAlarmDto>(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<ConfigAlarmDto>(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<ConfigLimitDto>(Limit),
CurConfigAlarmDto = Mapper.Map<ConfigAlarmDto>(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<ConfigAlarmDto>(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<ConfigLimitDto>(Limit),
CurConfigAlarmDto = Mapper.Map<ConfigAlarmDto>(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<ConfigAlarmDto>(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<ConfigLimitDto>(Limit),
CurConfigAlarmDto = Mapper.Map<ConfigAlarmDto>(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<ConfigAlarmDto>(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<ConfigLimitDto>(Limit),
CurConfigAlarmDto = Mapper.Map<ConfigAlarmDto>(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<ConfigAlarmDto>(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
/// </summary>
public ProRunTimeCalc ProRunTimeCalcModel { get; set; } = new ProRunTimeCalc();
/// <summary>
/// 暂停开始时间
/// </summary>
public DateTime PauseStartDt { get; set; }
/// <summary>
/// 暂停结束时间
/// </summary>
public DateTime PauseEndDt { get; set; }
/// <summary>
/// 开始程序调度运行
@@ -3218,8 +3307,6 @@ namespace CapMachine.Wpf.Services
/// </summary>
public void PauseProRun()
{
//开始暂停的计时
PauseStartDt = DateTime.Now;
//暂停计时统计
ProRunTimeCalcModel.PauseProRunTime();
@@ -3241,13 +3328,7 @@ namespace CapMachine.Wpf.Services
/// </summary>
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()} - 程序执行继续");

View File

@@ -174,6 +174,7 @@
MeterName="{Binding NameNoUnit}"
PVValue="{Binding PVModel.EngValueStr}"
SVValue="{Binding SVModel.EngValueStr}"
StepExeInfo="{Binding StepExeInfo}"
Unit="{Binding Unit}" />
</DataTemplate>
</ItemsControl.ItemTemplate>
@@ -211,7 +212,7 @@
</Grid.ColumnDefinitions>
<materialDesign:Card
Grid.ColumnSpan="6"
Grid.ColumnSpan="2"
Margin="3"
Background="{DynamicResource MaterialDesignLightBackground}"
Foreground="{DynamicResource PrimaryHueLightForegroundBrush}"
@@ -232,6 +233,29 @@
</StackPanel>
</materialDesign:Card>
<materialDesign:Card
Grid.Column="2"
Grid.ColumnSpan="4"
Margin="3"
Background="{DynamicResource MaterialDesignLightBackground}"
Foreground="{DynamicResource PrimaryHueLightForegroundBrush}"
UniformCornerRadius="5">
<StackPanel Orientation="Horizontal">
<TextBlock
Margin="10,0,0,0"
VerticalAlignment="Center"
FontFamily="/Assets/Fonts/#iconfont"
FontSize="26"
Text="&#xe6b4;" />
<TextBlock Style="{StaticResource TitelStyle}" Text="试验工况:" />
<TextBlock
VerticalAlignment="Center"
FontSize="26"
FontWeight="Bold"
Text="{Binding ProRuntimeService.SpeedProExModel.RunSegName}" />
</StackPanel>
</materialDesign:Card>
<!--<materialDesign:Card
Grid.Column="3"
Grid.ColumnSpan="3"
@@ -264,21 +288,34 @@
Background="{DynamicResource MaterialDesignLightBackground}"
Foreground="{DynamicResource PrimaryHueLightForegroundBrush}"
UniformCornerRadius="5">
<StackPanel Orientation="Horizontal">
<TextBlock
Margin="10,0,0,0"
VerticalAlignment="Center"
FontFamily="/Assets/Fonts/#iconfont"
FontSize="26"
Text="&#xe7e7;" />
<TextBlock Style="{StaticResource TitelStyle}" Text="总运行时间:" />
<TextBlock
VerticalAlignment="Center"
FontSize="26"
FontWeight="Bold"
Foreground="LimeGreen"
Text="{Binding ProRuntimeService.ProRunTimeCalcModel.ProRunTimeStr}" />
</StackPanel>
<Grid>
<Border>
<ProgressBar
Height="45"
Background="Transparent"
BorderThickness="0"
Foreground="LightGreen"
Value="{Binding ProRuntimeService.ProRunTimeCalcModel.ProValue}" />
</Border>
<StackPanel Orientation="Horizontal">
<TextBlock
Margin="10,0,0,0"
VerticalAlignment="Center"
FontFamily="/Assets/Fonts/#iconfont"
FontSize="26"
Text="&#xe7e7;" />
<TextBlock Style="{StaticResource TitelStyle}" Text="总运行时间:" />
<TextBlock
VerticalAlignment="Center"
FontSize="26"
FontWeight="Bold"
Foreground="#404040"
Text="{Binding ProRuntimeService.ProRunTimeCalcModel.ProRunTimeStr}" />
</StackPanel>
</Grid>
</materialDesign:Card>
<materialDesign:Card
@@ -301,7 +338,7 @@
VerticalAlignment="Center"
FontSize="30"
FontWeight="Bold"
Text="{Binding ProRuntimeService.SpeedProExModel.CurProStepExe.ProStepInfo}" />
Text="{Binding ProRuntimeService.SpeedProExModel.CurProStepExe.ProStep}" />
</StackPanel>
</materialDesign:Card>
@@ -320,12 +357,12 @@
FontFamily="/Assets/Fonts/#iconfont"
FontSize="26"
Text="&#xe7f7;" />
<TextBlock Style="{StaticResource TitelStyle}" Text="步进运行时间:" />
<TextBlock Style="{StaticResource TitelStyle}" Text="结束时间:" />
<TextBlock
VerticalAlignment="Center"
FontSize="26"
FontWeight="Bold"
Text="0" />
Text="{Binding ProRuntimeService.ProRunTimeCalcModel.EndTimeInfo}" />
</StackPanel>
</materialDesign:Card>