添加项目文件。
This commit is contained in:
80
CapMachine.Wpf/Models/Meter/MeterRunTime.cs
Normal file
80
CapMachine.Wpf/Models/Meter/MeterRunTime.cs
Normal file
@@ -0,0 +1,80 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Wpf.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Kp表单步跟踪其运行时间跟踪信息
|
||||
/// </summary>
|
||||
public class MeterRunTime
|
||||
{
|
||||
public delegate void RunTimeCallSglDelegate(string ProName, string MeterName, int MeterStep);
|
||||
public event RunTimeCallSglDelegate RunTimeCallSglEvent;
|
||||
|
||||
/// <summary>
|
||||
/// 是否启用
|
||||
/// </summary>
|
||||
public bool RunEnable { 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
|
||||
{
|
||||
if (RunEnable == true && value.ToString("yyyy-MM-dd HH:mm:ss") == EndDateTime.ToString("yyyy-MM-dd HH:mm:ss"))
|
||||
{
|
||||
currentDateTime = value;
|
||||
//时间到了触发下载新的步骤
|
||||
RunTimeCallSglEvent(ProName, MeterName, MeterStep);
|
||||
//RunEnable = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
currentDateTime = value;
|
||||
RunTime = (int)(currentDateTime - StartDateTime).TotalSeconds;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 当前步骤已经运行时长-秒
|
||||
/// </summary>
|
||||
public int RunTime { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user