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.
175 lines
4.7 KiB
C#
175 lines
4.7 KiB
C#
using Rs.Framework;
|
|
using Rs.MotionPlat.Entitys.Trays;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Reflection;
|
|
using System.Text;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Rs.MotionPlat.Commom
|
|
{
|
|
/// <summary>
|
|
/// 中转吸头管理类
|
|
/// 中转吸头共有16个吸头
|
|
/// </summary>
|
|
public class TransitNozzleManager
|
|
{
|
|
private TransitNozzle[] nozzles;
|
|
private TransitNozzleManager() {
|
|
nozzles = new TransitNozzle[16];
|
|
for(int i=0;i<16; i++)
|
|
{
|
|
nozzles[i] = new TransitNozzle() {
|
|
NozzleIndex = i + 1,
|
|
IsHasProduct = false,
|
|
SN=""
|
|
};
|
|
}
|
|
}
|
|
private static TransitNozzleManager instance;
|
|
public static TransitNozzleManager Instance
|
|
{
|
|
get
|
|
{
|
|
if(instance==null)
|
|
{
|
|
instance = new TransitNozzleManager();
|
|
}
|
|
return instance;
|
|
}
|
|
}
|
|
|
|
public TransitNozzle Nozzle(int nozzleIndex)
|
|
{
|
|
nozzleIndex = nozzleIndex > 16 ? nozzleIndex - 8 : nozzleIndex;
|
|
return nozzles[nozzleIndex - 1];
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取含有产品的吸嘴
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public List<TransitNozzle> GetHasProductNozzles()
|
|
{
|
|
return nozzles.Where(n => n.IsHasProduct).ToList();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 中转吸嘴
|
|
/// </summary>
|
|
public class TransitNozzle
|
|
{
|
|
public void AddProduct(TestTraySlot testTraySlot)
|
|
{
|
|
IsHasProduct = true;
|
|
SN = testTraySlot.SN;
|
|
FromIndex = testTraySlot.Index-1;
|
|
FromType = TurnoverType.Tester;
|
|
}
|
|
public void AddProduct(TurnoverTraySlot turnoverTraySlot)
|
|
{
|
|
IsHasProduct = true;
|
|
SN=turnoverTraySlot.SN;
|
|
FromIndex = turnoverTraySlot.Index-1;
|
|
FromType = TurnoverType.Turnover;
|
|
}
|
|
|
|
|
|
public void AddProduct(TurnoverInfo task)
|
|
{
|
|
IsHasProduct = true;
|
|
SN = task.SN;
|
|
FromIndex = task.FromIndex;
|
|
FromType = task.FromType;
|
|
ToIndex= task.ToIndex;
|
|
ToType= task.ToType;
|
|
ToFloor= task.ToFloor;
|
|
}
|
|
|
|
|
|
public void Clear(bool closeVac=false)
|
|
{
|
|
IsHasProduct = false;
|
|
SN = "";
|
|
if(closeVac )
|
|
{
|
|
CloseVac();
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 吸嘴索引
|
|
/// </summary>
|
|
public int NozzleIndex { get; set; }
|
|
/// <summary>
|
|
/// 是否有产品
|
|
/// </summary>
|
|
public bool IsHasProduct { get; set; }
|
|
/// <summary>
|
|
/// 产品的SN
|
|
/// </summary>
|
|
public string SN { get; set; }
|
|
public int FromIndex { get; set; }
|
|
public TurnoverType FromType { get; set; }
|
|
public int FromFloor { get; set; }
|
|
|
|
public int ToIndex { get; set; }
|
|
public TurnoverType ToType { get; set; }
|
|
public int ToFloor { get; set; }
|
|
|
|
/// <summary>
|
|
/// 是否有真空信号
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public bool HasVacSignal()
|
|
{
|
|
if(Ops.IsOn($"周转{NozzleIndex}号吸嘴真空吸检测"))
|
|
return true;
|
|
return false;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 关闭真空吸
|
|
/// </summary>
|
|
public void CloseVac(int waittime=0)
|
|
{
|
|
if (waittime > 0)
|
|
{
|
|
Thread.Sleep(waittime);
|
|
}
|
|
Ops.Off($"周转{NozzleIndex}号吸嘴真空吸");
|
|
MessageQueue.Instance.Insert($"关闭周转{NozzleIndex}号吸嘴真空吸");
|
|
}
|
|
/// <summary>
|
|
/// 打开真空吸
|
|
/// </summary>
|
|
public void OpenVac(int waittime = 0)
|
|
{
|
|
if (waittime > 0)
|
|
{
|
|
Thread.Sleep(waittime);
|
|
}
|
|
Ops.On($"周转{NozzleIndex}号吸嘴真空吸");
|
|
MessageQueue.Instance.Insert($"打开周转{NozzleIndex}号吸嘴真空吸");
|
|
}
|
|
|
|
/// <summary>
|
|
/// 打开真空破
|
|
/// </summary>
|
|
public void OpenBreak()
|
|
{
|
|
VacManager.TransitNozzleVacBreak(EVacOperator.Open, true,NozzleIndex);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 关闭真空破
|
|
/// </summary>
|
|
public void CloseBreak()
|
|
{
|
|
VacManager.TransitNozzleVacBreak(EVacOperator.Open, true, NozzleIndex);
|
|
}
|
|
}
|
|
}
|