|
|
|
|
@ -25,6 +25,7 @@ namespace Rs.MotionPlat.Flow
|
|
|
|
|
到取料盘上方,
|
|
|
|
|
等待到取料盘上方,
|
|
|
|
|
等待料盘准备就绪,
|
|
|
|
|
到下方取料位,
|
|
|
|
|
等待运动到取料位下方,
|
|
|
|
|
//等待夹磁气缸松开,
|
|
|
|
|
取料盘完成抬起,
|
|
|
|
|
@ -76,7 +77,7 @@ namespace Rs.MotionPlat.Flow
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if(intance == null)
|
|
|
|
|
if (intance == null)
|
|
|
|
|
intance = new TakeTrayFlow();
|
|
|
|
|
return intance;
|
|
|
|
|
}
|
|
|
|
|
@ -98,7 +99,7 @@ namespace Rs.MotionPlat.Flow
|
|
|
|
|
/// <param name="toTray"></param>
|
|
|
|
|
/// <param name="isNeedGoDown"></param>
|
|
|
|
|
/// <param name="placeTrayGrab">放料盘拍照</param>
|
|
|
|
|
public void Take(ETrayType fromTray, ETrayType toTray,bool isNeedGoDown=true,bool placeTrayGrab=false)
|
|
|
|
|
public void Take(ETrayType fromTray, ETrayType toTray, bool isNeedGoDown = true, bool placeTrayGrab = false)
|
|
|
|
|
{
|
|
|
|
|
switch (fromTray)
|
|
|
|
|
{
|
|
|
|
|
@ -144,175 +145,252 @@ namespace Rs.MotionPlat.Flow
|
|
|
|
|
switch (step)
|
|
|
|
|
{
|
|
|
|
|
case ETakeTrayFlowStep.到取料盘上方:
|
|
|
|
|
if(fromTray== ETrayType.Empty)
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
targetPosition.TakeTrayX = GlobalVar.EmptyStockGrabPos + GlobalVar.ClampCenter2CameraCenterDist;
|
|
|
|
|
}
|
|
|
|
|
else if(fromTray== ETrayType.Input)
|
|
|
|
|
{
|
|
|
|
|
targetPosition.TakeTrayX = GlobalVar.InputStockGrabPos + GlobalVar.ClampCenter2CameraCenterDist;
|
|
|
|
|
if (fromTray == ETrayType.Empty)
|
|
|
|
|
{
|
|
|
|
|
targetPosition.TakeTrayX = GlobalVar.EmptyStockGrabPos + GlobalVar.ClampCenter2CameraCenterDist;
|
|
|
|
|
}
|
|
|
|
|
else if (fromTray == ETrayType.Input)
|
|
|
|
|
{
|
|
|
|
|
targetPosition.TakeTrayX = GlobalVar.InputStockGrabPos + GlobalVar.ClampCenter2CameraCenterDist;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Msg.ShowError($"cann't from take tray from {fromTray}");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (GroupAxisMove.TakeXMove(GetClassName(), targetPosition.TakeTrayX, GlobalVar.WholeSpeed))
|
|
|
|
|
{
|
|
|
|
|
if (GlobalVar.VirtualAxis)
|
|
|
|
|
{
|
|
|
|
|
Thread.Sleep(GlobalVar.VirtualAxisMoveTime);
|
|
|
|
|
}
|
|
|
|
|
AxisPosPrint.PrintTakeTrayXTargetPos($"准备运动到料仓{m_fromTray}取料盘位上方", targetPosition, GetClassName());
|
|
|
|
|
step = ETakeTrayFlowStep.等待到取料盘上方;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
Msg.ShowError($"cann't from take tray from {fromTray}");
|
|
|
|
|
return ;
|
|
|
|
|
AlarmCollection.SystemExceptionAlarm(ex);
|
|
|
|
|
}
|
|
|
|
|
if(GroupAxisMove.TakeXMove(GetClassName(), targetPosition.TakeTrayX, GlobalVar.WholeSpeed))
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
case ETakeTrayFlowStep.等待到取料盘上方:
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (GlobalVar.VirtualAxis)
|
|
|
|
|
if (Ops.IsStop("TakeTrayX") || GlobalVar.VirtualAxis)
|
|
|
|
|
{
|
|
|
|
|
Thread.Sleep(GlobalVar.VirtualAxisMoveTime);
|
|
|
|
|
if (fromTray == ETrayType.Empty)
|
|
|
|
|
{
|
|
|
|
|
StockManager.CloseTray(fromStockIndex);
|
|
|
|
|
}
|
|
|
|
|
AxisPosPrint.PrintTakeTrayXCurrentPos($"已运动到料仓{m_fromTray}取料盘位上方", GetClassName());
|
|
|
|
|
//松开夹爪
|
|
|
|
|
StockManager.OpenTray(fromStockIndex);
|
|
|
|
|
step = ETakeTrayFlowStep.等待料盘准备就绪;
|
|
|
|
|
}
|
|
|
|
|
AxisPosPrint.PrintTakeTrayXTargetPos($"准备运动到料仓{m_fromTray}取料盘位上方", targetPosition, GetClassName());
|
|
|
|
|
step = ETakeTrayFlowStep.等待到取料盘上方;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
AlarmCollection.SystemExceptionAlarm(ex);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
case ETakeTrayFlowStep.等待到取料盘上方:
|
|
|
|
|
if (Ops.IsStop("TakeTrayX") || GlobalVar.VirtualAxis)
|
|
|
|
|
|
|
|
|
|
case ETakeTrayFlowStep.等待料盘准备就绪:
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if(fromTray== ETrayType.Empty)
|
|
|
|
|
if (Ops.IsOn($"满料{fromStockIndex}对射光电"))
|
|
|
|
|
{
|
|
|
|
|
StockManager.CloseTray(fromStockIndex);
|
|
|
|
|
logInfo = GetClassName() + $"料仓{m_fromTray}料盘准备就绪";
|
|
|
|
|
MessageQueue.Instance.Insert(logInfo);
|
|
|
|
|
|
|
|
|
|
step = ETakeTrayFlowStep.上升一层;
|
|
|
|
|
//step = ETakeTrayFlowStep.等待运动到取料位下方;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
alarmEntity = AlarmCollection.Get(AlarmConstID.料仓无料盘报警).Transform(fromTray);
|
|
|
|
|
Msgbox.ShowDialog(alarmEntity, EButtonType.Retry, true);
|
|
|
|
|
}
|
|
|
|
|
AxisPosPrint.PrintTakeTrayXCurrentPos($"已运动到料仓{m_fromTray}取料盘位上方", GetClassName());
|
|
|
|
|
step = ETakeTrayFlowStep.等待料盘准备就绪;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
AlarmCollection.SystemExceptionAlarm(ex);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
case ETakeTrayFlowStep.等待料盘准备就绪:
|
|
|
|
|
if (Ops.IsOn($"满料{fromStockIndex}对射光电"))
|
|
|
|
|
case ETakeTrayFlowStep.上升一层:
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
logInfo = GetClassName() + $"料仓{m_fromTray}料盘准备就绪";
|
|
|
|
|
StockManager.Up(fromStockIndex);
|
|
|
|
|
logInfo = GetClassName() + $"料仓{fromTray}上升一层";
|
|
|
|
|
MessageQueue.Instance.Insert(logInfo);
|
|
|
|
|
TakeTrayModule.CylinderGoDown(GetClassName());
|
|
|
|
|
stopwatch.Restart();
|
|
|
|
|
step = ETakeTrayFlowStep.等待运动到取料位下方;
|
|
|
|
|
step = ETakeTrayFlowStep.到下方取料位;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
alarmEntity = AlarmCollection.Get(AlarmConstID.料仓无料盘报警).Transform(fromTray);
|
|
|
|
|
Msgbox.ShowDialog(alarmEntity, EButtonType.Retry);
|
|
|
|
|
AlarmCollection.SystemExceptionAlarm(ex);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
case ETakeTrayFlowStep.等待运动到取料位下方:
|
|
|
|
|
if (Ops.IsOn("料盘搬运气缸动位"))
|
|
|
|
|
case ETakeTrayFlowStep.到下方取料位:
|
|
|
|
|
{
|
|
|
|
|
logInfo = GetClassName() + $"料盘搬运气缸动位 OK";
|
|
|
|
|
MessageQueue.Instance.Insert(logInfo);
|
|
|
|
|
stopwatch.Stop();
|
|
|
|
|
//打开真空
|
|
|
|
|
TakeTrayModule.VacOperation(EIoOperate.Open,GetClassName());
|
|
|
|
|
//松开夹爪
|
|
|
|
|
//StockModule.ClampTrayCylinder(EIoOperate.Open, fromStockIndex,GetClassName());
|
|
|
|
|
StockManager.OpenTray(fromStockIndex);
|
|
|
|
|
TakeTrayModule.CylinderGoDown(GetClassName());
|
|
|
|
|
stopwatch.Restart();
|
|
|
|
|
step = ETakeTrayFlowStep.取料盘完成抬起;
|
|
|
|
|
step = ETakeTrayFlowStep.等待运动到取料位下方;
|
|
|
|
|
}
|
|
|
|
|
else if (stopwatch.ElapsedMilliseconds > 5000)
|
|
|
|
|
break;
|
|
|
|
|
case ETakeTrayFlowStep.等待运动到取料位下方:
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
alarmEntity = AlarmCollection.Get(AlarmConstID.料盘搬运气缸动位异常);
|
|
|
|
|
if (alarmEntity != null)
|
|
|
|
|
if (Ops.IsOn("料盘搬运气缸动位"))
|
|
|
|
|
{
|
|
|
|
|
Msgbox.ShowDialog (alarmEntity, EButtonType.Retry);
|
|
|
|
|
step = ETakeTrayFlowStep.等待运动到取料位下方;
|
|
|
|
|
logInfo = GetClassName() + $"料盘搬运气缸动位 OK";
|
|
|
|
|
MessageQueue.Instance.Insert(logInfo);
|
|
|
|
|
stopwatch.Stop();
|
|
|
|
|
//打开真空
|
|
|
|
|
TakeTrayModule.VacOperation(EIoOperate.Open, GetClassName());
|
|
|
|
|
StockManager.CloseTray(fromStockIndex);
|
|
|
|
|
//stopwatch.Restart();
|
|
|
|
|
step = ETakeTrayFlowStep.取料盘完成抬起;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
else if (stopwatch.ElapsedMilliseconds > 5000)
|
|
|
|
|
{
|
|
|
|
|
Msg.ShowError("翻译文件中未找到料盘搬运气缸动位异常");
|
|
|
|
|
AlarmCollection.ShowMsg(AlarmConstID.料盘搬运气缸动位异常, () => { step = ETakeTrayFlowStep.等待运动到取料位下方; });
|
|
|
|
|
//alarmEntity = AlarmCollection.Get(AlarmConstID.料盘搬运气缸动位异常);
|
|
|
|
|
//if (alarmEntity != null)
|
|
|
|
|
//{
|
|
|
|
|
// Msgbox.ShowDialog(alarmEntity, EButtonType.Retry, true);
|
|
|
|
|
// step = ETakeTrayFlowStep.等待运动到取料位下方;
|
|
|
|
|
//}
|
|
|
|
|
//else
|
|
|
|
|
//{
|
|
|
|
|
// Msg.ShowError("翻译文件中未找到料盘搬运气缸动位异常");
|
|
|
|
|
//}
|
|
|
|
|
//stopwatch.Restart();
|
|
|
|
|
}
|
|
|
|
|
stopwatch.Restart();
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
AlarmCollection.SystemExceptionAlarm(ex);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
//case ETakeTrayFlowStep.等待夹磁气缸松开:
|
|
|
|
|
// if(Ops.IsOn($"料仓夹磁气缸{fromStockIndex}原位"))
|
|
|
|
|
// {
|
|
|
|
|
// step = ETakeTrayFlowStep.取料盘完成抬起;
|
|
|
|
|
// }
|
|
|
|
|
// else if(stopwatch.ElapsedMilliseconds>5000)
|
|
|
|
|
// {
|
|
|
|
|
// alarmEntity = AlarmCollection.Get($"料仓{fromStockIndex}夹磁气缸原位异常");
|
|
|
|
|
// if (alarmEntity != null)
|
|
|
|
|
// {
|
|
|
|
|
// Msgbox.ShowDialog(alarmEntity, EButtonType.Retry);
|
|
|
|
|
// step = ETakeTrayFlowStep.等待夹磁气缸松开;
|
|
|
|
|
// }
|
|
|
|
|
// else
|
|
|
|
|
// {
|
|
|
|
|
// Msg.ShowError($"料仓{fromStockIndex}夹磁气缸原位异常");
|
|
|
|
|
// }
|
|
|
|
|
// stopwatch.Restart();
|
|
|
|
|
// }
|
|
|
|
|
// break;
|
|
|
|
|
case ETakeTrayFlowStep.取料盘完成抬起:
|
|
|
|
|
TakeTrayModule.CylinderGoUp(GetClassName());
|
|
|
|
|
stopwatch.Restart();
|
|
|
|
|
step = ETakeTrayFlowStep.等待取料盘完成抬起;
|
|
|
|
|
break;
|
|
|
|
|
case ETakeTrayFlowStep.等待取料盘完成抬起:
|
|
|
|
|
if ((Ops.IsOn("料盘搬运气缸原位")))
|
|
|
|
|
{
|
|
|
|
|
logInfo = GetClassName()+$"检测到上下气缸原位 OK";
|
|
|
|
|
MessageQueue.Instance.Insert(logInfo);
|
|
|
|
|
stopwatch.Stop();
|
|
|
|
|
step = ETakeTrayFlowStep.料盘是否抓起检测;
|
|
|
|
|
}
|
|
|
|
|
else if(stopwatch.ElapsedMilliseconds > 5000)
|
|
|
|
|
{
|
|
|
|
|
alarmEntity = AlarmCollection.Get(AlarmConstID.料盘搬运气缸原位异常);
|
|
|
|
|
if (alarmEntity != null)
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
MessageQueue.Instance.Warn(GetClassName() + alarmEntity.CN);
|
|
|
|
|
Msgbox.ShowDialog(alarmEntity, EButtonType.Retry);
|
|
|
|
|
TakeTrayModule.CylinderGoUp(GetClassName());
|
|
|
|
|
stopwatch.Restart();
|
|
|
|
|
step = ETakeTrayFlowStep.等待取料盘完成抬起;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
Msg.ShowError("翻译文件中未找到料盘搬运气缸原位异常");
|
|
|
|
|
AlarmCollection.SystemExceptionAlarm(ex);
|
|
|
|
|
}
|
|
|
|
|
stopwatch.Restart();
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case ETakeTrayFlowStep.料盘是否抓起检测:
|
|
|
|
|
if (TakeTrayModule.HasTray())
|
|
|
|
|
case ETakeTrayFlowStep.等待取料盘完成抬起:
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
logInfo = GetClassName() + $"料盘已被抓起 OK";
|
|
|
|
|
MessageQueue.Instance.Insert(logInfo);
|
|
|
|
|
if ( StockManager.GetCurrentLayer(fromStockIndex) == 1)
|
|
|
|
|
if ((Ops.IsOn("料盘搬运气缸原位")))
|
|
|
|
|
{
|
|
|
|
|
step = ETakeTrayFlowStep.到放料盘上方;
|
|
|
|
|
logInfo = GetClassName() + $"检测到上下气缸原位 OK";
|
|
|
|
|
MessageQueue.Instance.Insert(logInfo);
|
|
|
|
|
stopwatch.Stop();
|
|
|
|
|
step = ETakeTrayFlowStep.料盘是否抓起检测;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
else if (stopwatch.ElapsedMilliseconds > 5000)
|
|
|
|
|
{
|
|
|
|
|
step = ETakeTrayFlowStep.上升一层;
|
|
|
|
|
alarmEntity = AlarmCollection.Get(AlarmConstID.料盘搬运气缸原位异常);
|
|
|
|
|
if (alarmEntity != null)
|
|
|
|
|
{
|
|
|
|
|
MessageQueue.Instance.Warn(GetClassName() + alarmEntity.CN);
|
|
|
|
|
Msgbox.ShowDialog(alarmEntity, EButtonType.Retry, true);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Msg.ShowError("翻译文件中未找到料盘搬运气缸原位异常");
|
|
|
|
|
}
|
|
|
|
|
stopwatch.Restart();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
AlarmCollection.SystemExceptionAlarm(ex);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
case ETakeTrayFlowStep.料盘是否抓起检测:
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
alarmEntity = AlarmCollection.Get(AlarmConstID.料盘未抓起报警).Transform(fromTray.ToString());
|
|
|
|
|
if (alarmEntity != null)
|
|
|
|
|
if (TakeTrayModule.HasTray())
|
|
|
|
|
{
|
|
|
|
|
Msgbox.ShowDialog(alarmEntity, EButtonType.Retry);
|
|
|
|
|
step = ETakeTrayFlowStep.到取料盘上方;
|
|
|
|
|
logInfo = GetClassName() + $"料盘已被抓起 OK";
|
|
|
|
|
MessageQueue.Instance.Insert(logInfo);
|
|
|
|
|
if (fromTray == ETrayType.Input)
|
|
|
|
|
{
|
|
|
|
|
step = ETakeTrayFlowStep.上料仓拍照处理;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (placeTrayGrab && GlobalVar.EnableBeforePlaceTrayToOkGrab)
|
|
|
|
|
{
|
|
|
|
|
step = ETakeTrayFlowStep.放料盘前拍照;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
step = ETakeTrayFlowStep.到放料盘上方;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//if (StockManager.GetCurrentLayer(fromStockIndex) == 1)
|
|
|
|
|
//{
|
|
|
|
|
// step = ETakeTrayFlowStep.到放料盘上方;
|
|
|
|
|
//}
|
|
|
|
|
//else
|
|
|
|
|
//{
|
|
|
|
|
// step = ETakeTrayFlowStep.上升一层;
|
|
|
|
|
//}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Msg.ShowError("翻译文件中未找到抓料盘未抓起");
|
|
|
|
|
alarmEntity = AlarmCollection.Get(AlarmConstID.料盘未抓起报警).Transform(fromTray.ToString());
|
|
|
|
|
if (alarmEntity != null)
|
|
|
|
|
{
|
|
|
|
|
Msgbox.ShowDialog(alarmEntity, EButtonType.Retry, true);
|
|
|
|
|
step = ETakeTrayFlowStep.到下方取料位;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Msg.ShowError("翻译文件中未找到抓料盘未抓起");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case ETakeTrayFlowStep.上升一层:
|
|
|
|
|
StockManager.Up(fromStockIndex);
|
|
|
|
|
logInfo = GetClassName() + $"料仓{fromTray}上升一层";
|
|
|
|
|
MessageQueue.Instance.Insert(logInfo);
|
|
|
|
|
step = ETakeTrayFlowStep.等待上升一层完成;
|
|
|
|
|
break;
|
|
|
|
|
case ETakeTrayFlowStep.等待上升一层完成:
|
|
|
|
|
if(fromTray== ETrayType.Input)
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
step = ETakeTrayFlowStep.上料仓拍照处理;
|
|
|
|
|
AlarmCollection.SystemExceptionAlarm(ex);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
//case ETakeTrayFlowStep.等待上升一层完成:
|
|
|
|
|
// try
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
// catch (Exception ex)
|
|
|
|
|
// {
|
|
|
|
|
// AlarmCollection.SystemExceptionAlarm(ex);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// break;
|
|
|
|
|
case ETakeTrayFlowStep.上料仓拍照处理:
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (placeTrayGrab && GlobalVar.EnableBeforePlaceTrayToOkGrab)
|
|
|
|
|
StockGrabFlow.Instance.Grab(fromTray);
|
|
|
|
|
if (placeTrayGrab)
|
|
|
|
|
{
|
|
|
|
|
step = ETakeTrayFlowStep.放料盘前拍照;
|
|
|
|
|
}
|
|
|
|
|
@ -321,43 +399,45 @@ namespace Rs.MotionPlat.Flow
|
|
|
|
|
step = ETakeTrayFlowStep.到放料盘上方;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case ETakeTrayFlowStep.上料仓拍照处理:
|
|
|
|
|
StockGrabFlow.Instance.Grab(fromTray);
|
|
|
|
|
if(placeTrayGrab)
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
step = ETakeTrayFlowStep.放料盘前拍照;
|
|
|
|
|
AlarmCollection.SystemExceptionAlarm(ex);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
case ETakeTrayFlowStep.放料盘前拍照:
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
StockGrabFlow.Instance.Grab(toTray);
|
|
|
|
|
step = ETakeTrayFlowStep.到放料盘上方;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case ETakeTrayFlowStep.放料盘前拍照:
|
|
|
|
|
StockGrabFlow.Instance.Grab(toTray);
|
|
|
|
|
step = ETakeTrayFlowStep.到放料盘上方;
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
AlarmCollection.SystemExceptionAlarm(ex);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
case ETakeTrayFlowStep.到放料盘上方:
|
|
|
|
|
//if (DischargeFlow.Instance.XYCanGoLocalArea())
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if(fromTray!= ETrayType.Input && toTray== ETrayType.Ok && GlobalVar.EnableOkTrayCheckFull)
|
|
|
|
|
if (fromTray != ETrayType.Input && toTray == ETrayType.Ok && GlobalVar.EnableOkTrayCheckFull)
|
|
|
|
|
{
|
|
|
|
|
Msgbox.ShowTipDialog(EButtonType.Ok, "please check product in tray has placed ok?", "Tip", true);
|
|
|
|
|
}
|
|
|
|
|
if(toTray== ETrayType.Ok)
|
|
|
|
|
if (toTray == ETrayType.Ok)
|
|
|
|
|
{
|
|
|
|
|
targetPosition.TakeTrayX = GlobalVar.OkStockGrabPos + GlobalVar.ClampCenter2CameraCenterDist;
|
|
|
|
|
}
|
|
|
|
|
else if(toTray== ETrayType.Input)
|
|
|
|
|
else if (toTray == ETrayType.Input)
|
|
|
|
|
{
|
|
|
|
|
targetPosition.TakeTrayX = GlobalVar.InputStockGrabPos + GlobalVar.ClampCenter2CameraCenterDist;
|
|
|
|
|
}
|
|
|
|
|
else if(toTray== ETrayType.Empty)
|
|
|
|
|
else if (toTray == ETrayType.Empty)
|
|
|
|
|
{
|
|
|
|
|
targetPosition.TakeTrayX = GlobalVar.EmptyStockGrabPos + GlobalVar.ClampCenter2CameraCenterDist;
|
|
|
|
|
}
|
|
|
|
|
//takeTrayFinishedEvent?.Invoke();
|
|
|
|
|
if(GroupAxisMove.TakeXMove(GetClassName(),targetPosition.TakeTrayX,GlobalVar.WholeSpeed))
|
|
|
|
|
if (GroupAxisMove.TakeXMove(GetClassName(), targetPosition.TakeTrayX, GlobalVar.WholeSpeed))
|
|
|
|
|
{
|
|
|
|
|
if (GlobalVar.VirtualAxis)
|
|
|
|
|
{
|
|
|
|
|
@ -368,156 +448,216 @@ namespace Rs.MotionPlat.Flow
|
|
|
|
|
step = ETakeTrayFlowStep.等待到放料盘上方;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//else
|
|
|
|
|
//{
|
|
|
|
|
// //alarmEntity = AlarmCollection.Get(AlarmConstID.运动不安全).Transform("LoadY", "TurnvoerY");
|
|
|
|
|
// //AlarmMessageBox.ShowDialog(alarmEntity, ETipButton.Ok, null);
|
|
|
|
|
//}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
AlarmCollection.SystemExceptionAlarm(ex);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case ETakeTrayFlowStep.等待到放料盘上方:
|
|
|
|
|
if (Ops.IsStop("TakeTrayX") || GlobalVar.VirtualAxis)
|
|
|
|
|
{
|
|
|
|
|
//if(toTray== ETrayType.Empty)
|
|
|
|
|
//{
|
|
|
|
|
// if(StockManager.HasTray(3))
|
|
|
|
|
// {
|
|
|
|
|
// StockManager.Down(3);
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
//StockManager.OpenTray(toStockIndex);
|
|
|
|
|
logInfo = GetClassName() + $"已运动到{toTray}料仓放料盘上方";
|
|
|
|
|
MessageQueue.Instance.Insert(logInfo);
|
|
|
|
|
//arrivedDumpPosEvent?.Invoke();
|
|
|
|
|
step = ETakeTrayFlowStep.到放料盘位下方;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (Ops.IsStop("TakeTrayX") || GlobalVar.VirtualAxis)
|
|
|
|
|
{
|
|
|
|
|
//if(toTray== ETrayType.Empty)
|
|
|
|
|
//{
|
|
|
|
|
// if(StockManager.HasTray(3))
|
|
|
|
|
// {
|
|
|
|
|
// StockManager.Down(3);
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
//StockManager.OpenTray(toStockIndex);
|
|
|
|
|
logInfo = GetClassName() + $"已运动到{toTray}料仓放料盘上方";
|
|
|
|
|
MessageQueue.Instance.Insert(logInfo);
|
|
|
|
|
//arrivedDumpPosEvent?.Invoke();
|
|
|
|
|
step = ETakeTrayFlowStep.到放料盘位下方;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
AlarmCollection.SystemExceptionAlarm(ex);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
case ETakeTrayFlowStep.到放料盘位下方:
|
|
|
|
|
//if ((StockManager.Instance.GetStock(m_toTray).Status == EStockTrayStatus.Unloaded || StockManager.Instance.GetStock(m_toTray).Status == EStockTrayStatus.Empty) || GlobalVar.VirtualAxis)
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
StockManager.OpenTray(toStockIndex);
|
|
|
|
|
TakeTrayModule.CylinderGoDown(GetClassName());
|
|
|
|
|
step = ETakeTrayFlowStep.等待运动到放料位下方;
|
|
|
|
|
stopwatch.Restart();
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
AlarmCollection.SystemExceptionAlarm(ex);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case ETakeTrayFlowStep.等待运动到放料位下方:
|
|
|
|
|
if (Ops.IsOn("料盘搬运气缸动位"))
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
logInfo = GetClassName() + "检测到料盘搬运气缸动位 OK";
|
|
|
|
|
MessageQueue.Instance.Insert(logInfo);
|
|
|
|
|
stopwatch.Stop();
|
|
|
|
|
//if(toTray!= ETrayType.Empty)
|
|
|
|
|
//{
|
|
|
|
|
// //夹住料盘
|
|
|
|
|
// Ops.On($"料仓夹磁气缸{toStockIndex}夹");
|
|
|
|
|
// Ops.Off($"料仓夹磁气缸{toStockIndex}开");
|
|
|
|
|
// Thread.Sleep(100);
|
|
|
|
|
//}
|
|
|
|
|
if (Ops.IsOn("料盘搬运气缸动位"))
|
|
|
|
|
{
|
|
|
|
|
logInfo = GetClassName() + "检测到料盘搬运气缸动位 OK";
|
|
|
|
|
MessageQueue.Instance.Insert(logInfo);
|
|
|
|
|
stopwatch.Stop();
|
|
|
|
|
//if(toTray!= ETrayType.Empty)
|
|
|
|
|
//{
|
|
|
|
|
// //夹住料盘
|
|
|
|
|
// Ops.On($"料仓夹磁气缸{toStockIndex}夹");
|
|
|
|
|
// Ops.Off($"料仓夹磁气缸{toStockIndex}开");
|
|
|
|
|
// Thread.Sleep(100);
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
////关闭真空吸
|
|
|
|
|
//Ops.On("料盘真空关");
|
|
|
|
|
//Ops.Off("料盘真空开");
|
|
|
|
|
//logInfo = GetClassName() + $"料盘真空关 on";
|
|
|
|
|
//MessageQueue.Instance.Insert(logInfo);
|
|
|
|
|
//Thread.Sleep(100);
|
|
|
|
|
if(isNeedGoDown)
|
|
|
|
|
////关闭真空吸
|
|
|
|
|
//Ops.On("料盘真空关");
|
|
|
|
|
//Ops.Off("料盘真空开");
|
|
|
|
|
//logInfo = GetClassName() + $"料盘真空关 on";
|
|
|
|
|
//MessageQueue.Instance.Insert(logInfo);
|
|
|
|
|
//Thread.Sleep(100);
|
|
|
|
|
//关闭真空吸
|
|
|
|
|
TakeTrayModule.VacOperation(EIoOperate.Close, GetClassName());
|
|
|
|
|
if (isNeedGoDown)
|
|
|
|
|
{
|
|
|
|
|
StockManager.Down(toStockIndex);
|
|
|
|
|
}
|
|
|
|
|
StockManager.CloseTray(toStockIndex);
|
|
|
|
|
|
|
|
|
|
step = ETakeTrayFlowStep.放料盘完成后抬起;
|
|
|
|
|
}
|
|
|
|
|
else if (stopwatch.ElapsedMilliseconds > 5000)
|
|
|
|
|
{
|
|
|
|
|
StockManager.Down(toStockIndex);
|
|
|
|
|
alarmEntity = AlarmCollection.Get(AlarmConstID.上下气缸动位异常);
|
|
|
|
|
if (alarmEntity != null)
|
|
|
|
|
{
|
|
|
|
|
LogHelper.Debug(GetClassName() + alarmEntity.CN);
|
|
|
|
|
Msg.ShowError(alarmEntity.CN);
|
|
|
|
|
//AlarmMessageBox.ShowDialog(alarmEntity, ETipButton.Ok, null);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Msg.ShowError("翻译文件中未找到上下气缸动位");
|
|
|
|
|
}
|
|
|
|
|
stopwatch.Stop();
|
|
|
|
|
stopwatch.Restart();
|
|
|
|
|
}
|
|
|
|
|
StockManager.CloseTray(toStockIndex);
|
|
|
|
|
//关闭真空吸
|
|
|
|
|
TakeTrayModule.VacOperation(EIoOperate.Close,GetClassName());
|
|
|
|
|
step = ETakeTrayFlowStep.放料盘完成后抬起;
|
|
|
|
|
}
|
|
|
|
|
else if(stopwatch.ElapsedMilliseconds>5000)
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
alarmEntity = AlarmCollection.Get(AlarmConstID.上下气缸动位异常);
|
|
|
|
|
if (alarmEntity != null)
|
|
|
|
|
{
|
|
|
|
|
LogHelper.Debug(GetClassName() + alarmEntity.CN);
|
|
|
|
|
Msg.ShowError(alarmEntity.CN);
|
|
|
|
|
//AlarmMessageBox.ShowDialog(alarmEntity, ETipButton.Ok, null);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Msg.ShowError("翻译文件中未找到上下气缸动位");
|
|
|
|
|
}
|
|
|
|
|
stopwatch.Stop();
|
|
|
|
|
stopwatch.Restart();
|
|
|
|
|
AlarmCollection.SystemExceptionAlarm(ex);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
case ETakeTrayFlowStep.放料盘完成后抬起:
|
|
|
|
|
TakeTrayModule.CylinderGoUp(GetClassName());
|
|
|
|
|
step = ETakeTrayFlowStep.等待放料完成抬起;
|
|
|
|
|
stopwatch.Restart();
|
|
|
|
|
break;
|
|
|
|
|
case ETakeTrayFlowStep.等待放料完成抬起:
|
|
|
|
|
if (Ops.IsOn("料盘搬运气缸原位"))
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
logInfo = GetClassName() + "料盘搬运气缸原位 OK";
|
|
|
|
|
MessageQueue.Instance.Insert(logInfo);
|
|
|
|
|
step = ETakeTrayFlowStep.放料完成后真空检测;
|
|
|
|
|
TakeTrayModule.CylinderGoUp(GetClassName());
|
|
|
|
|
step = ETakeTrayFlowStep.等待放料完成抬起;
|
|
|
|
|
stopwatch.Restart();
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
AlarmCollection.SystemExceptionAlarm(ex);
|
|
|
|
|
}
|
|
|
|
|
else if(stopwatch.ElapsedMilliseconds>5000)
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
case ETakeTrayFlowStep.等待放料完成抬起:
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
alarmEntity = AlarmCollection.Get(AlarmConstID.上下气缸原位异常);
|
|
|
|
|
if (alarmEntity != null)
|
|
|
|
|
if (Ops.IsOn("料盘搬运气缸原位"))
|
|
|
|
|
{
|
|
|
|
|
LogHelper.Debug(GetClassName() + alarmEntity.CN);
|
|
|
|
|
Msg.ShowError(alarmEntity.CN);
|
|
|
|
|
//AlarmMessageBox.ShowDialog(alarmEntity, ETipButton.Ok, null);
|
|
|
|
|
logInfo = GetClassName() + "料盘搬运气缸原位 OK";
|
|
|
|
|
MessageQueue.Instance.Insert(logInfo);
|
|
|
|
|
step = ETakeTrayFlowStep.放料完成后真空检测;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
else if (stopwatch.ElapsedMilliseconds > 5000)
|
|
|
|
|
{
|
|
|
|
|
Msg.ShowError("翻译文件中未找到上下气缸动位");
|
|
|
|
|
alarmEntity = AlarmCollection.Get(AlarmConstID.上下气缸原位异常);
|
|
|
|
|
if (alarmEntity != null)
|
|
|
|
|
{
|
|
|
|
|
LogHelper.Debug(GetClassName() + alarmEntity.CN);
|
|
|
|
|
Msg.ShowError(alarmEntity.CN);
|
|
|
|
|
//AlarmMessageBox.ShowDialog(alarmEntity, ETipButton.Ok, null);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Msg.ShowError("翻译文件中未找到上下气缸动位");
|
|
|
|
|
}
|
|
|
|
|
stopwatch.Stop();
|
|
|
|
|
stopwatch.Restart();
|
|
|
|
|
}
|
|
|
|
|
stopwatch.Stop();
|
|
|
|
|
stopwatch.Restart();
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
AlarmCollection.SystemExceptionAlarm(ex);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
case ETakeTrayFlowStep.放料完成后真空检测:
|
|
|
|
|
if (!TakeTrayModule.HasTray())
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
logInfo = GetClassName() + $"放料盘完成";
|
|
|
|
|
MessageQueue.Instance.Insert(logInfo);
|
|
|
|
|
step = ETakeTrayFlowStep.到待机位;
|
|
|
|
|
if(toTray== ETrayType.Empty)
|
|
|
|
|
if (!TakeTrayModule.HasTray())
|
|
|
|
|
{
|
|
|
|
|
StockManager.CloseTray(toStockIndex);
|
|
|
|
|
StockManager.OpenTray(toStockIndex);
|
|
|
|
|
logInfo = GetClassName() + $"放料盘完成";
|
|
|
|
|
MessageQueue.Instance.Insert(logInfo);
|
|
|
|
|
step = ETakeTrayFlowStep.到待机位;
|
|
|
|
|
if (toTray == ETrayType.Empty)
|
|
|
|
|
{
|
|
|
|
|
StockManager.CloseTray(toStockIndex);
|
|
|
|
|
StockManager.OpenTray(toStockIndex);
|
|
|
|
|
}
|
|
|
|
|
//if (mLoadUnloadType == ELoadUnloadType.Load)
|
|
|
|
|
//{
|
|
|
|
|
// StockManager.Instance.Load(m_toTray, EStockTrayLoadMode.AfterTakeTray);
|
|
|
|
|
//}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
step = ETakeTrayFlowStep.到放料盘上方;
|
|
|
|
|
//粘料盘
|
|
|
|
|
//logInfo = "检测到料盘未放下,请处理后点击确定重放";
|
|
|
|
|
//MessageQueue.Instance.Warn(GetClassName() + logInfo);
|
|
|
|
|
//TestCenterMessageBox.Show(AlarmConstID.UpDownCylinderExceptionAlarm, logInfo, ETipButton.Ok);
|
|
|
|
|
//TestCenterMessageBox.WaitResult(AlarmConstID.UpDownCylinderExceptionAlarm);
|
|
|
|
|
//step = ETakeTrayFlowStep.到放料盘上方;
|
|
|
|
|
}
|
|
|
|
|
//if (mLoadUnloadType == ELoadUnloadType.Load)
|
|
|
|
|
//{
|
|
|
|
|
// StockManager.Instance.Load(m_toTray, EStockTrayLoadMode.AfterTakeTray);
|
|
|
|
|
//}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
step = ETakeTrayFlowStep.到放料盘上方;
|
|
|
|
|
//粘料盘
|
|
|
|
|
//logInfo = "检测到料盘未放下,请处理后点击确定重放";
|
|
|
|
|
//MessageQueue.Instance.Warn(GetClassName() + logInfo);
|
|
|
|
|
//TestCenterMessageBox.Show(AlarmConstID.UpDownCylinderExceptionAlarm, logInfo, ETipButton.Ok);
|
|
|
|
|
//TestCenterMessageBox.WaitResult(AlarmConstID.UpDownCylinderExceptionAlarm);
|
|
|
|
|
//step = ETakeTrayFlowStep.到放料盘上方;
|
|
|
|
|
AlarmCollection.SystemExceptionAlarm(ex);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
case ETakeTrayFlowStep.到待机位:
|
|
|
|
|
if(GroupAxisMove.TakeXMove(GetClassName(), GlobalVar.TakeTrayXWaitPos, GlobalVar.WholeSpeed))
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
logInfo = GetClassName() + $"到待机位";
|
|
|
|
|
MessageQueue.Instance.Insert(logInfo);
|
|
|
|
|
step = ETakeTrayFlowStep.等待运动到待机位;
|
|
|
|
|
if (GroupAxisMove.TakeXMove(GetClassName(), GlobalVar.TakeTrayXWaitPos, GlobalVar.WholeSpeed))
|
|
|
|
|
{
|
|
|
|
|
logInfo = GetClassName() + $"到待机位";
|
|
|
|
|
MessageQueue.Instance.Insert(logInfo);
|
|
|
|
|
step = ETakeTrayFlowStep.等待运动到待机位;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
AlarmCollection.SystemExceptionAlarm(ex);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
case ETakeTrayFlowStep.等待运动到待机位:
|
|
|
|
|
if(Ops.IsStop("TakeTrayX"))
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
logInfo = GetClassName() + $"从{fromTray}搬运到{toTray}完成";
|
|
|
|
|
MessageQueue.Instance.Insert(logInfo);
|
|
|
|
|
TakeStatus = ETakeStatus.TakeOK;
|
|
|
|
|
//dumpTrayFinishedEvent?.Invoke();
|
|
|
|
|
finisehd = true;
|
|
|
|
|
if (Ops.IsStop("TakeTrayX"))
|
|
|
|
|
{
|
|
|
|
|
logInfo = GetClassName() + $"从{fromTray}搬运到{toTray}完成";
|
|
|
|
|
MessageQueue.Instance.Insert(logInfo);
|
|
|
|
|
TakeStatus = ETakeStatus.TakeOK;
|
|
|
|
|
//dumpTrayFinishedEvent?.Invoke();
|
|
|
|
|
finisehd = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
AlarmCollection.SystemExceptionAlarm(ex);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|