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.
396 lines
16 KiB
C#
396 lines
16 KiB
C#
using Rs.Framework;
|
|
using Rs.MotionPlat.Flow;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Diagnostics;
|
|
using System.Linq;
|
|
using System.Reflection;
|
|
using System.Text;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Rs.MotionPlat.Commom
|
|
{
|
|
/// <summary>
|
|
/// 真空操作模式
|
|
/// </summary>
|
|
public enum EVacOperator
|
|
{
|
|
/// <summary>
|
|
/// 打开
|
|
/// </summary>
|
|
Open,
|
|
/// <summary>
|
|
/// 关闭
|
|
/// </summary>
|
|
Close
|
|
}
|
|
/// <summary>
|
|
/// 真空管理类(排料头吸嘴真空、周转盘真空、周转头吸嘴真空、测试盘真空)
|
|
/// </summary>
|
|
public static class VacManager
|
|
{
|
|
/// <summary>
|
|
/// 打开或关闭排料吸嘴真空吸
|
|
/// </summary>
|
|
/// <param name="eOperator"></param>
|
|
/// <param name="indexes"></param>
|
|
public static void DischargeVacSuction(EVacOperator eOperator, bool needSleep,params int[] indexes)
|
|
{
|
|
StackFrame stackFrame = new StackFrame(1); // 获取当前调用栈的上一帧
|
|
var method = stackFrame.GetMethod(); // 获取调用方法的信息
|
|
var callerName = method.ReflectedType.Name; // 获取调用者的类名
|
|
if (indexes.Length > 0)
|
|
{
|
|
foreach (var index in indexes)
|
|
{
|
|
if (eOperator == EVacOperator.Open)
|
|
{
|
|
Ops.On($"{index}号吸嘴真空吸电磁阀");
|
|
}
|
|
else
|
|
{
|
|
Ops.Off($"{index}号吸嘴真空吸电磁阀");
|
|
}
|
|
}
|
|
|
|
if (eOperator == EVacOperator.Open)
|
|
{
|
|
if (needSleep)
|
|
Thread.Sleep(GlobalVar.LoadNozzleOpenVacSuctionDelaytime);
|
|
MessageQueue.Instance.Insert(callerName+$"-打开排料{string.Join(",", indexes)}号吸嘴真空吸");
|
|
}
|
|
else
|
|
{
|
|
if (needSleep)
|
|
Thread.Sleep(GlobalVar.LoadNozzleCloseVacSuctionDelaytime);
|
|
MessageQueue.Instance.Insert(callerName + $"-关闭排料{string.Join(",", indexes)}号吸嘴真空吸");
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 打开或关闭排料吸嘴真空破
|
|
/// </summary>
|
|
/// <param name="eOperator"></param>
|
|
/// <param name="indexes"></param>
|
|
public static void DischargeVacBreak(EVacOperator eOperator, bool needSleep, params int[] indexes)
|
|
{
|
|
StackFrame stackFrame = new StackFrame(1); // 获取当前调用栈的上一帧
|
|
var method = stackFrame.GetMethod(); // 获取调用方法的信息
|
|
var callerName = method.ReflectedType.Name; // 获取调用者的类名
|
|
if (indexes.Length > 0)
|
|
{
|
|
foreach (var index in indexes)
|
|
{
|
|
if (eOperator == EVacOperator.Open)
|
|
{
|
|
Ops.On($"{index}号吸嘴真空破电磁阀");
|
|
}
|
|
else
|
|
{
|
|
Ops.Off($"{index}号吸嘴真空破电磁阀");
|
|
}
|
|
}
|
|
|
|
if (eOperator == EVacOperator.Open)
|
|
{
|
|
if (needSleep)
|
|
Thread.Sleep(GlobalVar.LoadNozzleOpenVacBreakDelaytime);
|
|
MessageQueue.Instance.Insert(callerName + $"-打开排料{string.Join(",", indexes)}号吸嘴真空破");
|
|
}
|
|
else
|
|
{
|
|
if (needSleep)
|
|
Thread.Sleep(GlobalVar.LoadNozzleCloseVacBreakDelaytime);
|
|
MessageQueue.Instance.Insert(callerName + $"-关闭排料{string.Join(",", indexes)}号吸嘴真空破");
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 打开或关闭周转盘真空吸
|
|
/// </summary>
|
|
/// <param name="eOperator"></param>
|
|
/// <param name="indexes"></param>
|
|
public static void TurnoverTrayVacSuction(EVacOperator eOperator,bool NeedSleep=true, params int[] indexes)
|
|
{
|
|
StackFrame stackFrame = new StackFrame(1); // 获取当前调用栈的上一帧
|
|
var method = stackFrame.GetMethod(); // 获取调用方法的信息
|
|
var callerName = method.ReflectedType.Name; // 获取调用者的类名
|
|
if (indexes.Length > 0)
|
|
{
|
|
foreach (var index in indexes)
|
|
{
|
|
if (eOperator == EVacOperator.Open)
|
|
{
|
|
Ops.On($"周转盘{index}号穴位真空吸");
|
|
}
|
|
else
|
|
{
|
|
Ops.Off($"周转盘{index}号穴位真空吸");
|
|
}
|
|
}
|
|
|
|
if (eOperator == EVacOperator.Open)
|
|
{
|
|
if(NeedSleep)
|
|
Thread.Sleep(GlobalVar.TurnoverTrayOpenVacSuctionDelaytime);
|
|
MessageQueue.Instance.Insert(callerName + $"-打开周转盘{string.Join(",", indexes)}号穴位真空吸");
|
|
}
|
|
else
|
|
{
|
|
if(NeedSleep)
|
|
Thread.Sleep(GlobalVar.TurnoverTrayCloseVacSuctionDelaytime);
|
|
MessageQueue.Instance.Insert(callerName + $"-关闭周转盘{string.Join(",", indexes)}号穴位真空吸");
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 打开或关闭周转盘真空破
|
|
/// </summary>
|
|
/// <param name="eOperator"></param>
|
|
/// <param name="indexes"></param>
|
|
public static void TurnoverTrayVacBreak(EVacOperator eOperator,bool bNeedSleep, params int[] indexes)
|
|
{
|
|
StackFrame stackFrame = new StackFrame(1); // 获取当前调用栈的上一帧
|
|
var method = stackFrame.GetMethod(); // 获取调用方法的信息
|
|
var callerName = method.ReflectedType.Name; // 获取调用者的类名
|
|
if (indexes.Length > 0)
|
|
{
|
|
foreach (var index in indexes)
|
|
{
|
|
if (eOperator == EVacOperator.Open)
|
|
{
|
|
Ops.On($"周转盘{index}号穴位真空破");
|
|
}
|
|
else
|
|
{
|
|
Ops.Off($"周转盘{index}号穴位真空破");
|
|
}
|
|
}
|
|
|
|
if (eOperator == EVacOperator.Open)
|
|
{
|
|
if (bNeedSleep)
|
|
Thread.Sleep(GlobalVar.TurnoverTrayOpenVacBreakDelaytime);
|
|
MessageQueue.Instance.Insert(callerName+$"-打开周转盘{indexes.ToJoinString()}号穴位真空破");
|
|
}
|
|
else
|
|
{
|
|
if (bNeedSleep)
|
|
Thread.Sleep(GlobalVar.TurnoverTrayCloseVacBreakDelaytime);
|
|
MessageQueue.Instance.Insert(callerName+$"-关闭周转盘{indexes.ToJoinString()}号穴位真空破");
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 打开或关闭周转吸嘴真空吸
|
|
/// </summary>
|
|
/// <param name="eOperator"></param>
|
|
/// <param name="indexes"></param>
|
|
public static void TransitNozzleVacSuction(EVacOperator eOperator, bool bNeedSleep, params int[] indexes)
|
|
{
|
|
|
|
StackFrame stackFrame = new StackFrame(1); // 获取当前调用栈的上一帧
|
|
var method = stackFrame.GetMethod(); // 获取调用方法的信息
|
|
var callerName = method.ReflectedType.Name; // 获取调用者的类名
|
|
|
|
if (indexes.Length > 0)
|
|
{
|
|
foreach (var index in indexes)
|
|
{
|
|
if (eOperator == EVacOperator.Open)
|
|
{
|
|
Ops.On($"周转{index}号吸嘴真空吸");
|
|
}
|
|
else
|
|
{
|
|
Ops.Off($"周转{index}号吸嘴真空吸");
|
|
}
|
|
}
|
|
|
|
if (eOperator == EVacOperator.Open)
|
|
{
|
|
if(bNeedSleep)
|
|
Thread.Sleep(GlobalVar.TurnoverNozzleOpenVacSuctionDelaytime);
|
|
MessageQueue.Instance.Insert(callerName + $"-打开周转吸嘴{string.Join(",", indexes)}号真空吸");
|
|
}
|
|
else
|
|
{
|
|
if (bNeedSleep)
|
|
Thread.Sleep(GlobalVar.TurnoverNozzleCloseVacSuctionDelaytime);
|
|
MessageQueue.Instance.Insert(callerName + $"-关闭周转吸嘴{string.Join(",", indexes)}号真空吸");
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 打开或关闭周转吸嘴真空破
|
|
/// </summary>
|
|
/// <param name="eOperator"></param>
|
|
/// <param name="indexes"></param>
|
|
public static void TransitNozzleVacBreak(EVacOperator eOperator,bool bNeedSleep, params int[] indexes)
|
|
{
|
|
StackFrame stackFrame = new StackFrame(1); // 获取当前调用栈的上一帧
|
|
var method = stackFrame.GetMethod(); // 获取调用方法的信息
|
|
var callerName = method.ReflectedType.Name; // 获取调用者的类名
|
|
if (indexes.Length > 0)
|
|
{
|
|
foreach (var index in indexes)
|
|
{
|
|
if (eOperator == EVacOperator.Open)
|
|
{
|
|
Ops.On($"周转{index}号吸嘴真空破");
|
|
}
|
|
else
|
|
{
|
|
Ops.Off($"周转{index}号吸嘴真空破");
|
|
}
|
|
}
|
|
|
|
if (eOperator == EVacOperator.Open)
|
|
{
|
|
if (bNeedSleep)
|
|
Thread.Sleep(GlobalVar.TurnoverNozzleOpenVacBreakDelaytime);
|
|
MessageQueue.Instance.Insert(callerName+$"-打开周转吸嘴{string.Join(",", indexes)}号真空破");
|
|
}
|
|
else
|
|
{
|
|
if (bNeedSleep)
|
|
Thread.Sleep(GlobalVar.TurnoverNozzleCloseVacBreakDelaytime);
|
|
MessageQueue.Instance.Insert(callerName + $"-关闭周转吸嘴{string.Join(",", indexes)}号真空破");
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 打开或关闭测试盘真空吸
|
|
/// </summary>
|
|
/// <param name="eOperator"></param>
|
|
/// <param name="indexes"></param>
|
|
public static void TestTrayVacSuction(EVacOperator eOperator,bool bNeedSleep, params int[] indexes)
|
|
{
|
|
StackFrame stackFrame = new StackFrame(1); // 获取当前调用栈的上一帧
|
|
var method = stackFrame.GetMethod(); // 获取调用方法的信息
|
|
var callerName = method.ReflectedType.Name; // 获取调用者的类名
|
|
if (indexes.Length>0)
|
|
{
|
|
foreach (var index in indexes)
|
|
{
|
|
if (eOperator == EVacOperator.Open)
|
|
{
|
|
Ops.On($"测试{index}号穴位真空吸");
|
|
}
|
|
else
|
|
{
|
|
Ops.Off($"测试{index}号穴位真空吸");
|
|
}
|
|
}
|
|
|
|
if (eOperator== EVacOperator.Open)
|
|
{
|
|
if (bNeedSleep)
|
|
Thread.Sleep(GlobalVar.PressOpenVacSuctionDelaytime);
|
|
MessageQueue.Instance.Insert(callerName + $"-打开测试{string.Join(",", indexes)}号穴位真空吸");
|
|
}
|
|
else
|
|
{
|
|
if (bNeedSleep)
|
|
Thread.Sleep(GlobalVar.PresseCloseVacSuctionDelaytime);
|
|
MessageQueue.Instance.Insert(callerName + $"-关闭测试{string.Join(",", indexes)}号穴位真空吸");
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 打开或关闭测试盘真空破
|
|
/// </summary>
|
|
/// <param name="eOperator"></param>
|
|
/// <param name="indexes"></param>
|
|
public static void TestTrayVacBreak(EVacOperator eOperator,bool bNeedSleep, params int[] indexes)
|
|
{
|
|
StackFrame stackFrame = new StackFrame(1); // 获取当前调用栈的上一帧
|
|
var method = stackFrame.GetMethod(); // 获取调用方法的信息
|
|
var callerName = method.ReflectedType.Name; // 获取调用者的类名
|
|
if (indexes.Length > 0)
|
|
{
|
|
foreach (var index in indexes)
|
|
{
|
|
if (eOperator == EVacOperator.Open)
|
|
{
|
|
Ops.On($"测试{index}号穴位真空破");
|
|
}
|
|
else
|
|
{
|
|
Ops.Off($"测试{index}号穴位真空破");
|
|
}
|
|
}
|
|
|
|
if (eOperator == EVacOperator.Open)
|
|
{
|
|
if (bNeedSleep)
|
|
Thread.Sleep(GlobalVar.PresseOpenVacBreakDelaytime);
|
|
MessageQueue.Instance.Insert(callerName+$"-打开测试{string.Join(",", indexes)}号穴位真空破");
|
|
}
|
|
else
|
|
{
|
|
if (bNeedSleep)
|
|
Thread.Sleep(GlobalVar.PressCloseVacBreakDelaytime);
|
|
MessageQueue.Instance.Insert(callerName+$"-关闭测试{string.Join(",", indexes)}号穴位真空破");
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 打开或关闭强力吸嘴真空吸
|
|
/// </summary>
|
|
/// <param name="eOperator"></param>
|
|
/// <param name="indexes"></param>
|
|
public static void ForceNozzleVacSuction(EVacOperator eOperator)
|
|
{
|
|
StackFrame stackFrame = new StackFrame(1); // 获取当前调用栈的上一帧
|
|
var method = stackFrame.GetMethod(); // 获取调用方法的信息
|
|
var callerName = method.ReflectedType.Name; // 获取调用者的类名
|
|
if (eOperator == EVacOperator.Open)
|
|
{
|
|
MessageQueue.Instance.Insert(callerName+"_打开独立吸头真空吸");
|
|
Ops.On($"独立吸头真空吸");
|
|
Thread.Sleep(100);
|
|
}
|
|
else
|
|
{
|
|
MessageQueue.Instance.Insert(callerName + "_关闭独立吸头真空吸");
|
|
Ops.Off($"独立吸头真空吸");
|
|
Thread.Sleep(100);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 打开或关闭强力吸嘴真空破
|
|
/// </summary>
|
|
/// <param name="eOperator"></param>
|
|
/// <param name="indexes"></param>
|
|
public static void ForceNozzleVacBreak(EVacOperator eOperator, params int[] indexes)
|
|
{
|
|
StackFrame stackFrame = new StackFrame(1); // 获取当前调用栈的上一帧
|
|
var method = stackFrame.GetMethod(); // 获取调用方法的信息
|
|
var callerName = method.ReflectedType.Name; // 获取调用者的类名
|
|
if (eOperator == EVacOperator.Open)
|
|
{
|
|
MessageQueue.Instance.Insert(callerName + "_打开独立吸头真空破");
|
|
Ops.On($"独立吸头真空破");
|
|
Thread.Sleep(100);
|
|
}
|
|
else
|
|
{
|
|
MessageQueue.Instance.Insert(callerName+"_关闭独立吸头真空破");
|
|
Ops.Off($"独立吸头真空破");
|
|
Thread.Sleep(100);
|
|
}
|
|
}
|
|
}
|
|
}
|