You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
lj_plc/Controls/Mesnac.Controls.Feeding/SmallMaterialStatus.cs

173 lines
5.0 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
using System.ComponentModel;
namespace Mesnac.Controls.Feeding
{
/// <summary>
/// 小料称量状态
/// </summary>
[ToolboxBitmap(typeof(System.Windows.Forms.Label))]
public class SmallMaterialStatus : Label
{
#region 字段定义
private int _firstPloy = 0;
private int _sendingPloy = 0;
private int _endAndWaitPloy = 0;
private int _endWeight = 0;
private int _weightAuto = 0;
private string _firstPloyName;
private string _sendingPloyName;
private string _endAndWaitPloyName;
private string _endWeightName;
private string _weightAutoName;
private Dictionary<string, string> _statusValueList = new Dictionary<string, string>() { { "FirstPloy", "正在称量小料" }, { "SendingPloy", "正在送小料..." }, { "EndAndWaitPloy", "等待送小料" }, { "WeightAuto", "称量正确" } };
#endregion
#region 属性定义
/// <summary>
/// 正在称第一种小料
/// </summary>
[Description("正在称第一种小料"), Category("PLC")]
public int FirstPloy
{
get { return _firstPloy; }
set { _firstPloy = value; this.RefereshText(); }
}
/// <summary>
/// 正在送小料
/// </summary>
[Description("正在送小料"), Category("PLC")]
public int SendingPloy
{
get { return _sendingPloy; }
set { _sendingPloy = value; this.RefereshText(); }
}
/// <summary>
/// 称量结束等待送小料
/// </summary>
[Description("称量结束等待送小料"), Category("PLC")]
public int EndAndWaitPloy
{
get { return _endAndWaitPloy; }
set { _endAndWaitPloy = value; this.RefereshText(); }
}
/// <summary>
/// 结束称量
/// </summary>
[Description("结束称量"), Category("PLC")]
public int EndWeight
{
get { return _endWeight; }
set { _endWeight = value; this.RefereshText(); }
}
/// <summary>
/// 秤自动
/// </summary>
[Description("秤自动"), Category("PLC")]
public int WeightAuto
{
get { return _weightAuto; }
set { _weightAuto = value; this.RefereshText(); }
}
#endregion
#region 动画属性定义
/// <summary>
/// 正在称第一种小料动画属性
/// </summary>
public string FirstPloyName
{
get { return _firstPloyName; }
set { _firstPloyName = value; }
}
/// <summary>
/// 正在送小料动画属性
/// </summary>
public string SendingPloyName
{
get { return _sendingPloyName; }
set { _sendingPloyName = value; }
}
/// <summary>
/// 称量结束等待送小料动画属性
/// </summary>
public string EndAndWaitPloyName
{
get { return _endAndWaitPloyName; }
set { _endAndWaitPloyName = value; }
}
/// <summary>
/// 结束称量动画属性
/// </summary>
public string EndWeightName
{
get { return _endWeightName; }
set { _endWeightName = value; }
}
/// <summary>
/// 秤自动动画属性
/// </summary>
public string WeightAutoName
{
get { return _weightAutoName; }
set { _weightAutoName = value; }
}
#endregion
#region 业务逻辑处理,根据各属性值确定小料状态
/// <summary>
/// 根据各属性值确定小料状态
/// </summary>
private void RefereshText()
{
string tmp = String.Empty;
if (this._firstPloy == 1)
{
tmp = this._statusValueList["FirstPloy"]; //"正在称量小料";
}
if (this._sendingPloy == 1)
{
tmp = this._statusValueList["SendingPloy"]; //"正在送小料...";
}
if (this._endAndWaitPloy == 1)
{
tmp = this._statusValueList["EndAndWaitPloy"]; //"等待送小料";
}
if (this._endWeight == 0)
{
if (this._weightAuto == 1)
{
tmp = this._statusValueList["WeightAuto"]; //"称量正确";
}
}
this.Text = tmp;
}
#endregion
/// <summary>
/// 状态值列表,键固定
/// </summary>
[Description("状态值集合"), Category("状态")]
public Dictionary<string, string> StatusValueList
{
get { return _statusValueList; }
set { _statusValueList = value; }
}
}
}