添加项目文件。

This commit is contained in:
2024-07-04 17:42:03 +08:00
parent dc72862945
commit 1bd6cd358f
71 changed files with 7218 additions and 0 deletions

View File

@@ -0,0 +1,328 @@
using CapMachine.Model;
using HslCommunication;
using Prism.Mvvm;
namespace CapMachine.Wpf.Models
{
/// <summary>
/// 仪表实时数据
/// </summary>
public class MeterRtDataModel : BindableBase
{
public delegate void MeterStepTrackDelegate(string MeterName, int NextStep);
public event MeterStepTrackDelegate MeterStepTrackEvent;
/// <summary>
/// 实例化函数
/// </summary>
public MeterRtDataModel()
{
ListProStepExecuteInfo = new List<ProStepExecute>();
ListQuickProStepExecuteInfo = new List<QuickProStepExecute>();
QuickRunTimeInfo = new QuickRunTime();
QuickNextMeterStep = new QuickProStepExecute();
RunTimeInfo = new MeterRunTime();
NextMeterStep = new ProStepExecute();
}
/// <summary>
/// 仪表类型
/// </summary>
public MeterType MeterTypeInfo { get; set; }
private int _MeterStepTrack;
/// <summary>
/// 步骤追踪
/// </summary>
public int MeterStepTrack
{
get
{
return _MeterStepTrack;
}
set
{
if (value != _MeterStepTrack)//步骤改动
{
_MeterStepTrack = value;
//MeterStepTrackEvent(MeterName, value);//开始动作
}
_MeterStepTrack = value;
}
}
//////////////////////////////////////////////////
/////////////////仪表实时数据///////////////////
//////////////////////////////////////////////////
#region
/// <summary>
/// 通信结果长度连续值
/// </summary>
private OperateResult<Int16[]> _RtOperateResultContinuousData;
public OperateResult<Int16[]> RtOperateResultContinuousData
{
get { return _RtOperateResultContinuousData; }
set { _RtOperateResultContinuousData = value; }
}
/// <summary>
/// 通信结果PV值
/// </summary>
private OperateResult<Int16> _RtOperateResultPV;
public OperateResult<Int16> RtOperateResultPV
{
get { return _RtOperateResultPV; }
set { _RtOperateResultPV = value; }
}
private double _RtPV;
/// <summary>
/// 实时值PV
/// </summary>
public double RtPV
{
get { return _RtPV; }
set { _RtPV = value; }
}
/// <summary>
/// 通信结果MV值
/// </summary>
private OperateResult<Int16> _RtOperateResultMV;
public OperateResult<Int16> RtOperateResultMV
{
get { return _RtOperateResultMV; }
set { _RtOperateResultMV = value; }
}
private double _RtMV;
/// <summary>
/// 实时值MV
/// </summary>
public double RtMV
{
get { return _RtMV; }
set { _RtMV = value; }
}
/// <summary>
/// 通信结果SV值
/// </summary>
private OperateResult<Int16> _RtOperateResultSV;
public OperateResult<Int16> RtOperateResultSV
{
get { return _RtOperateResultSV; }
set { _RtOperateResultSV = value; }
}
private double _RtSV;
/// <summary>
/// 实时值SV
/// </summary>
public double RtSV
{
get { return _RtSV; }
set { _RtSV = value; }
}
/// <summary>
/// PV值的地址
/// </summary>
public string RtAddressPV;
/// <summary>
/// MV值的地址
/// </summary>
public string RtAddressMV;
/// <summary>
/// SV值的地址
/// </summary>
public string RtAddressSV;
/// <summary>
/// MV值的UI展示名称
/// </summary>
public string RtMVUIControlIndex;
/// <summary>
/// PV值的UI展示名称
/// </summary>
public string RtPVUIControlIndex;
/// <summary>
/// SV值的UI展示名称
/// </summary>
public string RtSVUIControlIndex;
/// <summary>
/// UI展示名称标题
/// </summary>
public string RtUIControlTitle;
/// <summary>
/// UI展示名称控件
/// </summary>
public string RtUIControlTitleIndex;
#endregion
//////////////////////////////////////////////////
//////////////////////////////////////////////////
/////////////////仪表整体信息///////////////////
//////////////////////////////////////////////////
#region
/// <summary>
/// 仪表连接状态
/// </summary>
public bool LinkState { get; set; }
/// <summary>
/// 仪表名称
/// </summary>
public string MeterName { get; set; }
/// <summary>
/// 仪表站号
/// </summary>
public byte Station { get; set; }
/// <summary>
/// 最大值
/// </summary>
public double MaxValue { get; set; }
/// <summary>
/// 最小值
/// </summary>
public double MinValue { get; set; }
/// <summary>
/// 精度
/// </summary>
public Int16 Accuracy { get; set; }
/// <summary>
/// 单位
/// </summary>
public string Unit { get; set; }
/// <summary>
/// 采样周期
/// </summary>
public int SamplingPeriod { get; set; }
#endregion
//////////////////////////////////////////////////
/////////////////仪表程序使能//////////////////
//////////////////////////////////////////////////
/// <summary>
/// 当前仪表使能状态
/// 根据程序步骤里面有没有涉及到本仪表的步骤个数
/// </summary>
public bool MeterEnableState = false;
/// <summary>
/// 当前仪表使能状态
///需要在执行时发送数据给PLC
/// </summary>
public string MeterEnableStatePLCAddress = string.Empty;
//////////////////////////////////////////////////
/////////////////程序段//////////////////////////
//////////////////////////////////////////////////
/// <summary>
/// 程序段和程序步骤执行具体方法
/// </summary>
public List<ProStepExecute> ListProStepExecuteInfo { get; set; }
/// <summary>
/// 快速设置程序段和程序步骤执行具体方法
/// </summary>
public List<QuickProStepExecute> ListQuickProStepExecuteInfo { get; set; }
/// <summary>
/// 仪表当前步骤执行时间信息
/// </summary>
public MeterRunTime RunTimeInfo { get; set; }
/// <summary>
/// Quick仪表当前步骤执行时间信息
/// </summary>
public QuickRunTime QuickRunTimeInfo { get; set; }
/// <summary>
/// 仪表当前步骤是否存在下一步
/// </summary>
public bool IsExistMeterNextStep { get; set; } = false;
/// <summary>
/// 仪表下一步具体程序步骤
/// </summary>
public ProStepExecute NextMeterStep { get; set; }
/// <summary>
/// Quick仪表下一步具体程序步骤
/// </summary>
public QuickProStepExecute QuickNextMeterStep { get; set; }
/// <summary>
/// Quick仪表【当前步骤】具体程序步骤
/// 给看步骤是否变化使用
/// </summary>
public QuickProStepExecute QuickCurrentMeterStep { get; set; }
/// <summary>
/// 当前程序段名称
/// </summary>
public string CurrentProName { get; set; }
/// <summary>
/// 当前程序段步骤
/// </summary>
public int CurrentProStep { get; set; }
/// <summary>
/// 当前程序段时间长
/// </summary>
public int CurrentProTimeSum { get; set; }
/// <summary>
/// 当前程序段开始时间
/// </summary>
public DateTime CurrentProStartTime { set; get; }
//////////////////////////////////////////////////
/////////////////仪表步骤数据///////////////////
//////////////////////////////////////////////////
/// <summary>
/// 当前仪表步骤
/// </summary>
public int CurrentMeterStep { get; set; }
/// <summary>
/// 当前仪表步骤时间长
/// </summary>
public int CurrentMeterTimeSum { get; set; }
/// <summary>
/// 当前仪表开始时间
/// </summary>
public DateTime CurrentMeterStartTime { get; set; }
/// <summary>
/// 当前仪表步骤剩余时间
/// </summary>
public int CurrentMeterRemainTime { get; set; }
}
}

View 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; }
}
}

View File

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CapMachine.Wpf.Models
{
/// <summary>
/// 仪表类型
/// </summary>
public enum MeterType
{
KP=1,
CP=2,
DP=3
}
}

View File

@@ -0,0 +1,85 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CapMachine.Wpf.Models
{
public class QuickRunTime
{
public delegate void RunTimeCallSglDelegate(string ProName, string MeterName, int MeterStep);
public event RunTimeCallSglDelegate 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; }
}
}