按照秦工的需求,优化取料盘和放料盘逻辑

develop
lhiven 2 months ago
parent ae9eab279c
commit b9110b7ca2

@ -285,9 +285,9 @@ namespace Rs.MotionPlat.Flow.NormalFlow
public void Up() public void Up()
{ {
if(CurrentLayer==1) if(CurrentLayer==0)
{ {
logInfo = $"{GetClassName()} 料仓{StockIndex}已处于第层,不能再上升"; logInfo = $"{GetClassName()} 料仓{StockIndex}已处于第{CurrentLayer}层,不能再上升";
MessageQueue.Instance.Warn(logInfo); MessageQueue.Instance.Warn(logInfo);
return; return;
} }
@ -311,11 +311,11 @@ namespace Rs.MotionPlat.Flow.NormalFlow
Thread.Sleep(500); Thread.Sleep(500);
logInfo = $"{GetClassName()} 料仓{StockIndex}已运动到{CurrentLayer}层cz:{Ops.GetCurPosition($"StockZ{StockIndex}")}"; logInfo = $"{GetClassName()} 料仓{StockIndex}已运动到{CurrentLayer}层cz:{Ops.GetCurPosition($"StockZ{StockIndex}")}";
MessageQueue.Instance.Insert(logInfo); MessageQueue.Instance.Insert(logInfo);
if (HasTray()) //if (HasTray())
{ //{
ClampTray(); // ClampTray();
Thread.Sleep(GlobalVar.StepMotorMoveDelayTime); // Thread.Sleep(GlobalVar.StepMotorMoveDelayTime);
} //}
break; break;
} }
else if (stopwatch.ElapsedMilliseconds > 5000) else if (stopwatch.ElapsedMilliseconds > 5000)

@ -25,6 +25,7 @@ namespace Rs.MotionPlat.Flow
, ,
, ,
, ,
,
, ,
//等待夹磁气缸松开, //等待夹磁气缸松开,
, ,
@ -185,6 +186,8 @@ namespace Rs.MotionPlat.Flow
StockManager.CloseTray(fromStockIndex); StockManager.CloseTray(fromStockIndex);
} }
AxisPosPrint.PrintTakeTrayXCurrentPos($"已运动到料仓{m_fromTray}取料盘位上方", GetClassName()); AxisPosPrint.PrintTakeTrayXCurrentPos($"已运动到料仓{m_fromTray}取料盘位上方", GetClassName());
//松开夹爪
StockManager.OpenTray(fromStockIndex);
step = ETakeTrayFlowStep.; step = ETakeTrayFlowStep.;
} }
} }
@ -194,6 +197,7 @@ namespace Rs.MotionPlat.Flow
} }
break; break;
case ETakeTrayFlowStep.: case ETakeTrayFlowStep.:
try try
{ {
@ -201,9 +205,9 @@ namespace Rs.MotionPlat.Flow
{ {
logInfo = GetClassName() + $"料仓{m_fromTray}料盘准备就绪"; logInfo = GetClassName() + $"料仓{m_fromTray}料盘准备就绪";
MessageQueue.Instance.Insert(logInfo); MessageQueue.Instance.Insert(logInfo);
TakeTrayModule.CylinderGoDown(GetClassName());
stopwatch.Restart(); step = ETakeTrayFlowStep.;
step = ETakeTrayFlowStep.; //step = ETakeTrayFlowStep.等待运动到取料位下方;
} }
else else
{ {
@ -216,6 +220,26 @@ namespace Rs.MotionPlat.Flow
AlarmCollection.SystemExceptionAlarm(ex); AlarmCollection.SystemExceptionAlarm(ex);
} }
break;
case ETakeTrayFlowStep.:
try
{
StockManager.Up(fromStockIndex);
logInfo = GetClassName() + $"料仓{fromTray}上升一层";
MessageQueue.Instance.Insert(logInfo);
step = ETakeTrayFlowStep.;
}
catch (Exception ex)
{
AlarmCollection.SystemExceptionAlarm(ex);
}
break;
case ETakeTrayFlowStep.:
{
TakeTrayModule.CylinderGoDown(GetClassName());
stopwatch.Restart();
}
break; break;
case ETakeTrayFlowStep.: case ETakeTrayFlowStep.:
try try
@ -227,10 +251,8 @@ namespace Rs.MotionPlat.Flow
stopwatch.Stop(); stopwatch.Stop();
//打开真空 //打开真空
TakeTrayModule.VacOperation(EIoOperate.Open, GetClassName()); TakeTrayModule.VacOperation(EIoOperate.Open, GetClassName());
//松开夹爪 StockManager.CloseTray(fromStockIndex);
//StockModule.ClampTrayCylinder(EIoOperate.Open, fromStockIndex,GetClassName()); //stopwatch.Restart();
StockManager.OpenTray(fromStockIndex);
stopwatch.Restart();
step = ETakeTrayFlowStep.; step = ETakeTrayFlowStep.;
} }
else if (stopwatch.ElapsedMilliseconds > 5000) else if (stopwatch.ElapsedMilliseconds > 5000)
@ -245,7 +267,7 @@ namespace Rs.MotionPlat.Flow
{ {
Msg.ShowError("翻译文件中未找到料盘搬运气缸动位异常"); Msg.ShowError("翻译文件中未找到料盘搬运气缸动位异常");
} }
stopwatch.Restart(); //stopwatch.Restart();
} }
} }
catch (Exception ex) catch (Exception ex)
@ -255,6 +277,7 @@ namespace Rs.MotionPlat.Flow
break; break;
case ETakeTrayFlowStep.: case ETakeTrayFlowStep.:
{
try try
{ {
TakeTrayModule.CylinderGoUp(GetClassName()); TakeTrayModule.CylinderGoUp(GetClassName());
@ -265,7 +288,7 @@ namespace Rs.MotionPlat.Flow
{ {
AlarmCollection.SystemExceptionAlarm(ex); AlarmCollection.SystemExceptionAlarm(ex);
} }
}
break; break;
case ETakeTrayFlowStep.: case ETakeTrayFlowStep.:
try try
@ -305,22 +328,37 @@ namespace Rs.MotionPlat.Flow
{ {
logInfo = GetClassName() + $"料盘已被抓起 OK"; logInfo = GetClassName() + $"料盘已被抓起 OK";
MessageQueue.Instance.Insert(logInfo); MessageQueue.Instance.Insert(logInfo);
if (StockManager.GetCurrentLayer(fromStockIndex) == 1) if (fromTray == ETrayType.Input)
{ {
step = ETakeTrayFlowStep.; step = ETakeTrayFlowStep.;
} }
else else
{ {
step = ETakeTrayFlowStep.; if (placeTrayGrab && GlobalVar.EnableBeforePlaceTrayToOkGrab)
{
step = ETakeTrayFlowStep.;
}
else
{
step = ETakeTrayFlowStep.;
} }
} }
//if (StockManager.GetCurrentLayer(fromStockIndex) == 1)
//{
// step = ETakeTrayFlowStep.到放料盘上方;
//}
//else
//{
// step = ETakeTrayFlowStep.上升一层;
//}
}
else else
{ {
alarmEntity = AlarmCollection.Get(AlarmConstID.).Transform(fromTray.ToString()); alarmEntity = AlarmCollection.Get(AlarmConstID.).Transform(fromTray.ToString());
if (alarmEntity != null) if (alarmEntity != null)
{ {
Msgbox.ShowDialog(alarmEntity, EButtonType.Retry, true); Msgbox.ShowDialog(alarmEntity, EButtonType.Retry, true);
step = ETakeTrayFlowStep.; step = ETakeTrayFlowStep.;
} }
else else
{ {
@ -334,45 +372,18 @@ namespace Rs.MotionPlat.Flow
} }
break; break;
case ETakeTrayFlowStep.:
try
{
StockManager.Up(fromStockIndex);
logInfo = GetClassName() + $"料仓{fromTray}上升一层";
MessageQueue.Instance.Insert(logInfo);
step = ETakeTrayFlowStep.;
}
catch (Exception ex)
{
AlarmCollection.SystemExceptionAlarm(ex);
}
break; //case ETakeTrayFlowStep.等待上升一层完成:
case ETakeTrayFlowStep.: // try
try // {
{
if (fromTray == ETrayType.Input)
{
step = ETakeTrayFlowStep.;
}
else
{
if (placeTrayGrab && GlobalVar.EnableBeforePlaceTrayToOkGrab)
{
step = ETakeTrayFlowStep.;
}
else
{
step = ETakeTrayFlowStep.;
}
}
}
catch (Exception ex)
{
AlarmCollection.SystemExceptionAlarm(ex);
}
break; // }
// catch (Exception ex)
// {
// AlarmCollection.SystemExceptionAlarm(ex);
// }
// break;
case ETakeTrayFlowStep.: case ETakeTrayFlowStep.:
try try
{ {
@ -501,13 +512,14 @@ namespace Rs.MotionPlat.Flow
//logInfo = GetClassName() + $"料盘真空关 on"; //logInfo = GetClassName() + $"料盘真空关 on";
//MessageQueue.Instance.Insert(logInfo); //MessageQueue.Instance.Insert(logInfo);
//Thread.Sleep(100); //Thread.Sleep(100);
//关闭真空吸
TakeTrayModule.VacOperation(EIoOperate.Close, GetClassName());
if (isNeedGoDown) if (isNeedGoDown)
{ {
StockManager.Down(toStockIndex); StockManager.Down(toStockIndex);
} }
StockManager.CloseTray(toStockIndex); StockManager.CloseTray(toStockIndex);
//关闭真空吸
TakeTrayModule.VacOperation(EIoOperate.Close, GetClassName());
step = ETakeTrayFlowStep.; step = ETakeTrayFlowStep.;
} }
else if (stopwatch.ElapsedMilliseconds > 5000) else if (stopwatch.ElapsedMilliseconds > 5000)

Loading…
Cancel
Save