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.
180 lines
4.0 KiB
C#
180 lines
4.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
namespace SocketProcess
|
|
{
|
|
public class Station
|
|
{
|
|
private readonly List<DataFormat> _TrayQueue;
|
|
|
|
public List<DataFormat> TrayQueue
|
|
{
|
|
get { return _TrayQueue; }
|
|
}
|
|
|
|
///天线号
|
|
public string Ant = "";
|
|
|
|
//站名
|
|
public string StationName = "";
|
|
|
|
//站类型
|
|
public string StationType = "";
|
|
|
|
|
|
/// <summary>
|
|
/// 工位状态
|
|
/// </summary>
|
|
public StationState State { get; set; }
|
|
|
|
/// <summary>
|
|
/// 插入数据表名
|
|
/// </summary>
|
|
public string DbTableName;
|
|
|
|
|
|
public PLCAddress plcAdress;
|
|
|
|
public WorkTray workTray;
|
|
|
|
/// <summary>
|
|
/// 数据区对应的名字
|
|
/// </summary>
|
|
public string DataName;
|
|
|
|
/// <summary>
|
|
/// 报警区对应的名字
|
|
/// </summary>
|
|
public string AlarmName;
|
|
|
|
public string Ant;
|
|
|
|
|
|
public Station()
|
|
{
|
|
_TrayQueue = new List<DataFormat>();
|
|
}
|
|
|
|
//添加
|
|
public void InsertQueue(DataFormat Tray)
|
|
{
|
|
foreach (DataFormat fm in _TrayQueue)
|
|
{
|
|
if (fm.Epc == Tray.Epc)
|
|
{
|
|
return;
|
|
}
|
|
}
|
|
lock (this)
|
|
{
|
|
_TrayQueue.Add(Tray);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 轮胎出队
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public DataFormat OutQueue()
|
|
{
|
|
DataFormat tyre = null;
|
|
lock (this)
|
|
{
|
|
if (_TrayQueue != null && _TrayQueue.Count > 0)
|
|
{
|
|
tyre=_TrayQueue[0];
|
|
}
|
|
}
|
|
return tyre;
|
|
}
|
|
/// <summary>
|
|
/// 处理成功,删除队列中的轮胎
|
|
/// </summary>
|
|
/// <param name="tyre"></param>
|
|
public void DeleteTyre(DataFormat tyre)
|
|
{
|
|
lock (this)
|
|
{
|
|
_TrayQueue.RemoveAt(0);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 队列是否为空
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public bool IsTyreInfoAvailable()
|
|
{
|
|
bool exist;
|
|
lock (this)
|
|
{
|
|
exist = _TrayQueue.Count > 0;
|
|
}
|
|
return exist;
|
|
|
|
}
|
|
/// <summary>
|
|
/// 处理超时则清空某些轮胎
|
|
/// </summary>
|
|
/// <param name="time"></param>
|
|
public void ClearQueue(DateTime time)
|
|
{
|
|
lock (this)
|
|
{
|
|
for (int i = 0; i < _TrayQueue.Count; i++)
|
|
{
|
|
var tyre = _TrayQueue[i];
|
|
//if (tyre.InputTime < time)
|
|
//{
|
|
_TrayQueue.RemoveAt(i);
|
|
//}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public class PLCAddress
|
|
{
|
|
/// <summary>
|
|
/// PLC允许写入地址
|
|
/// </summary>
|
|
public string PlcReadAddress { get; set; }
|
|
|
|
/// <summary>
|
|
/// PLC开始工作地址
|
|
/// </summary>
|
|
public string PlcWorkAddress { get; set; }
|
|
|
|
/// <summary>
|
|
/// PLC放行地址
|
|
/// </summary>
|
|
public string PlcReleaseAdress { get; set; }
|
|
|
|
/// <summary>
|
|
/// 工作完毕
|
|
/// </summary>
|
|
public string WorkedAlready { get; set; }
|
|
|
|
/// <summary>
|
|
/// PLC参数获取起始地址
|
|
/// </summary>
|
|
public string PlcDataAdress { get; set; }
|
|
|
|
/// <summary>
|
|
/// PLC参数数量
|
|
/// </summary>
|
|
public int PlcDataQuantity { get; set; }
|
|
|
|
/// <summary>
|
|
/// Plc质量地址
|
|
/// </summary>
|
|
public string PlcQuality { get; set; }
|
|
}
|
|
public enum StationState
|
|
{
|
|
Namorl,
|
|
Stop,
|
|
Fault
|
|
}
|
|
}
|