374 lines
8.4 KiB
C#
374 lines
8.4 KiB
C#
using PLCSharp.Core.Common;
|
||
using PLCSharp.VVMs.MotionController;
|
||
using Prism.Mvvm;
|
||
using System.ComponentModel.DataAnnotations;
|
||
using System.ComponentModel.DataAnnotations.Schema;
|
||
|
||
namespace PLCSharp.VVMs.Cylinders
|
||
{
|
||
/// <summary>
|
||
/// 气缸感应类型
|
||
/// </summary>
|
||
public enum SensorType
|
||
{
|
||
None,
|
||
OnlyA,
|
||
OnlyB,
|
||
Two,
|
||
}
|
||
|
||
/// <summary>
|
||
/// 气缸
|
||
/// </summary>
|
||
public class Cylinder : BindableBase
|
||
{
|
||
/// <summary>
|
||
/// 唯一标识
|
||
/// </summary>
|
||
[Key]
|
||
public Guid ID { get; set; } = Guid.NewGuid();
|
||
|
||
private string _Name;
|
||
|
||
/// <summary>
|
||
/// 气缸名称
|
||
/// </summary>
|
||
public string Name
|
||
{
|
||
get { return _Name; }
|
||
set
|
||
{
|
||
if (_Name != value)
|
||
{
|
||
Prompt = "已修改,请保存";
|
||
}
|
||
SetProperty(ref _Name, value);
|
||
}
|
||
}
|
||
|
||
private SensorType _SensorType;
|
||
|
||
/// <summary>
|
||
/// 感应类型
|
||
/// </summary>
|
||
public SensorType SensorType
|
||
{
|
||
get { return _SensorType; }
|
||
set
|
||
{
|
||
if (_SensorType != value)
|
||
{
|
||
Prompt = "已修改,请保存";
|
||
}
|
||
SetProperty(ref _SensorType, value);
|
||
}
|
||
}
|
||
|
||
|
||
private string _InA;
|
||
|
||
/// <summary>
|
||
/// A位感应输入点
|
||
/// </summary>
|
||
public string InA
|
||
{
|
||
get { return _InA; }
|
||
set
|
||
{
|
||
if (_InA != value)
|
||
{
|
||
Prompt = "已修改,请保存";
|
||
}
|
||
SetProperty(ref _InA, value);
|
||
}
|
||
}
|
||
|
||
private string _InB;
|
||
|
||
/// <summary>
|
||
/// B位感应输入点
|
||
/// </summary>
|
||
public string InB
|
||
{
|
||
get { return _InB; }
|
||
set
|
||
{
|
||
if (_InB != value)
|
||
{
|
||
Prompt = "已修改,请保存";
|
||
}
|
||
SetProperty(ref _InB, value);
|
||
}
|
||
}
|
||
|
||
private string _OutA;
|
||
|
||
/// <summary>
|
||
/// A位输出点(DQ 名称或序号)
|
||
/// </summary>
|
||
public string OutA
|
||
{
|
||
get { return _OutA; }
|
||
set
|
||
{
|
||
if (_OutA != value)
|
||
{
|
||
Prompt = "已修改,请保存";
|
||
}
|
||
SetProperty(ref _OutA, value);
|
||
}
|
||
}
|
||
|
||
private string _OutB;
|
||
|
||
/// <summary>
|
||
/// B位输出点(DQ 名称或序号)
|
||
/// </summary>
|
||
public string OutB
|
||
{
|
||
get { return _OutB; }
|
||
set
|
||
{
|
||
if (_OutB != value)
|
||
{
|
||
Prompt = "已修改,请保存";
|
||
}
|
||
SetProperty(ref _OutB, value);
|
||
}
|
||
}
|
||
|
||
private bool _OffWhenStopped;
|
||
|
||
/// <summary>
|
||
/// 有停止命令时关闭输出
|
||
/// </summary>
|
||
public bool OffWhenStopped
|
||
{
|
||
get { return _OffWhenStopped; }
|
||
set
|
||
{
|
||
if (_OffWhenStopped != value)
|
||
{
|
||
Prompt = "已修改,请保存";
|
||
}
|
||
SetProperty(ref _OffWhenStopped, value);
|
||
}
|
||
}
|
||
|
||
private bool _OffWhenInPosition;
|
||
|
||
/// <summary>
|
||
/// 到位后关闭输出
|
||
/// </summary>
|
||
public bool OffWhenInPosition
|
||
{
|
||
get { return _OffWhenInPosition; }
|
||
set
|
||
{
|
||
if (_OffWhenInPosition != value)
|
||
{
|
||
Prompt = "已修改,请保存";
|
||
}
|
||
SetProperty(ref _OffWhenInPosition, value);
|
||
}
|
||
}
|
||
|
||
private bool _Enabled = true;
|
||
/// <summary>
|
||
/// 启用
|
||
/// </summary>
|
||
public bool Enabled
|
||
{
|
||
get { return _Enabled; }
|
||
set { SetProperty(ref _Enabled, value); }
|
||
}
|
||
|
||
private bool _NoInterlock;
|
||
/// <summary>
|
||
/// 不需要互锁
|
||
/// </summary>
|
||
public bool NoInterlock
|
||
{
|
||
get { return _NoInterlock; }
|
||
set { SetProperty(ref _NoInterlock, value); }
|
||
}
|
||
|
||
private double _ATimeout;
|
||
/// <summary>
|
||
///
|
||
/// </summary>
|
||
public double ATimeout
|
||
{
|
||
get { return _ATimeout; }
|
||
set { SetProperty(ref _ATimeout, value); }
|
||
}
|
||
|
||
private double _BTimeout;
|
||
/// <summary>
|
||
///
|
||
/// </summary>
|
||
public double BTimeout
|
||
{
|
||
get { return _BTimeout; }
|
||
set { SetProperty(ref _BTimeout, value); }
|
||
}
|
||
|
||
|
||
|
||
|
||
private double _ADelay;
|
||
/// <summary>
|
||
/// 感应到位延时
|
||
/// </summary>
|
||
public double ADelay
|
||
{
|
||
get { return _ADelay; }
|
||
set { SetProperty(ref _ADelay, value); }
|
||
}
|
||
|
||
|
||
|
||
private double _BDelay;
|
||
/// <summary>
|
||
/// 感应到位延时
|
||
/// </summary>
|
||
public double BDelay
|
||
{
|
||
get { return _BDelay; }
|
||
set { SetProperty(ref _BDelay, value); }
|
||
}
|
||
|
||
private string _Comment;
|
||
|
||
/// <summary>
|
||
/// 备注
|
||
/// </summary>
|
||
public string Comment
|
||
{
|
||
get { return _Comment; }
|
||
set
|
||
{
|
||
if (_Comment != value)
|
||
{
|
||
Prompt = "已修改,请保存";
|
||
}
|
||
SetProperty(ref _Comment, value);
|
||
}
|
||
}
|
||
|
||
private string _Prompt;
|
||
#region NotMapped Properties
|
||
private string _Cmd;
|
||
/// <summary>
|
||
/// 指令 "A"/"B"/"Stop"
|
||
/// </summary>
|
||
[NotMapped]
|
||
public string Cmd
|
||
{
|
||
get { return _Cmd; }
|
||
set { SetProperty(ref _Cmd, value); }
|
||
}
|
||
/// <summary>
|
||
/// 动作流程
|
||
/// </summary>
|
||
[NotMapped]
|
||
public FlowModel Flow { get; set; } = new();
|
||
/// <summary>
|
||
/// 提示(已修改,请保存)
|
||
/// </summary>
|
||
[NotMapped]
|
||
public string Prompt
|
||
{
|
||
get { return _Prompt; }
|
||
set { SetProperty(ref _Prompt, value); }
|
||
}
|
||
|
||
private bool _StatusAIn;
|
||
|
||
/// <summary>
|
||
/// A位感应状态
|
||
/// </summary>
|
||
[NotMapped]
|
||
public bool StatusAIn
|
||
{
|
||
get { return _StatusAIn; }
|
||
set { SetProperty(ref _StatusAIn, value); }
|
||
}
|
||
|
||
private bool _StatusBIn;
|
||
|
||
/// <summary>
|
||
/// B位感应状态
|
||
/// </summary>
|
||
[NotMapped]
|
||
public bool StatusBIn
|
||
{
|
||
get { return _StatusBIn; }
|
||
set { SetProperty(ref _StatusBIn, value); }
|
||
}
|
||
|
||
|
||
private bool _StatusAOut;
|
||
/// <summary>
|
||
/// A位输出状态
|
||
/// </summary>
|
||
[NotMapped]
|
||
public bool StatusAOut
|
||
{
|
||
get { return _StatusAOut; }
|
||
|
||
set { SetProperty(ref _StatusAOut, value); }
|
||
|
||
}
|
||
|
||
private bool _StatusBOut;
|
||
/// <summary>
|
||
/// B位输出状态
|
||
/// </summary>
|
||
[NotMapped]
|
||
public bool StatusBOut
|
||
{
|
||
get { return _StatusBOut; }
|
||
set { SetProperty(ref _StatusBOut, value); }
|
||
}
|
||
|
||
private string _FaultCode;
|
||
|
||
/// <summary>
|
||
/// 故障码
|
||
/// </summary>
|
||
[NotMapped]
|
||
public string FaultCode
|
||
{
|
||
get { return _FaultCode; }
|
||
set { SetProperty(ref _FaultCode, value); }
|
||
}
|
||
[NotMapped]
|
||
|
||
public bool AComplit { get; set; }
|
||
|
||
[NotMapped]
|
||
public bool BComplit { get; set; }
|
||
[NotMapped]
|
||
|
||
public DI DIA { get; set; }
|
||
[NotMapped]
|
||
|
||
public DI DIB { get; set; }
|
||
[NotMapped]
|
||
public DQ DQA { get; set; }
|
||
[NotMapped]
|
||
public DQ DQB { get; set; }
|
||
|
||
|
||
[NotMapped]
|
||
public DateTime ADelayTimer { get; set; } = DateTime.Now ;
|
||
|
||
[NotMapped]
|
||
public DateTime BDelayTimer { get; set; } = DateTime.Now;
|
||
|
||
#endregion
|
||
|
||
}
|
||
}
|