增加重测NG流程

搬运料盘增加周转轴防呆
master
lhiven 1 year ago
parent 2224794e85
commit b9ea59e857

@ -1887,7 +1887,7 @@ namespace Rs.MotionPlat.Flow
return false;
return true;
}
private bool XYCanMove()
public bool XYCanMove()
{
if (!CanGoTurnoverTray())
return false;

@ -1,6 +1,7 @@
using Rs.AutoDischarge.V3.Flow;
using Rs.Controls;
using Rs.Framework;
using Rs.Motion;
using Rs.MotionPlat.Commom;
using Rs.MotionPlat.Flow.Space;
using System;
@ -101,42 +102,52 @@ namespace Rs.MotionPlat.Flow
switch (step)
{
case ETakeTrayFlowStep.:
//double centerX = SysConfigParam.GetValue<double>($"Tray{m_fromTray.ToString()}CenterX");
//double centerY = SysConfigParam.GetValue<double>($"Tray{m_fromTray.ToString()}CenterY");
double cameraCenterX = SysConfigParam.GetValue<double>("ClampCenter2UpCameraCenterX");
double cameraCenterY = SysConfigParam.GetValue<double>("ClampCenter2UpCameraCenterY");
targetX = SysConfigParam.GetValue<double>($"{m_fromTray.ToString()}TakeTrayX");
targetY = SysConfigParam.GetValue<double>($"{m_fromTray.ToString()}TakeTrayY");
Motion.ErrorCode errCode = AxisControl.LoadX.MovePos(targetX + cameraCenterX, GlobalVar.TakeTraySpeed);
if (errCode == Motion.ErrorCode.Ok || GlobalVar.VirtualAxis)
if(DischargeFlow.Instance.XYCanMove())
{
errCode = AxisControl.LoadY.MovePos(targetY+ cameraCenterY, GlobalVar.TakeTraySpeed);
//double centerX = SysConfigParam.GetValue<double>($"Tray{m_fromTray.ToString()}CenterX");
//double centerY = SysConfigParam.GetValue<double>($"Tray{m_fromTray.ToString()}CenterY");
double cameraCenterX = SysConfigParam.GetValue<double>("ClampCenter2UpCameraCenterX");
double cameraCenterY = SysConfigParam.GetValue<double>("ClampCenter2UpCameraCenterY");
targetX = SysConfigParam.GetValue<double>($"{m_fromTray.ToString()}TakeTrayX");
targetY = SysConfigParam.GetValue<double>($"{m_fromTray.ToString()}TakeTrayY");
Motion.ErrorCode errCode = AxisControl.LoadX.MovePos(targetX + cameraCenterX, GlobalVar.TakeTraySpeed);
if (errCode == Motion.ErrorCode.Ok || GlobalVar.VirtualAxis)
{
if (GlobalVar.VirtualAxis)
errCode = AxisControl.LoadY.MovePos(targetY + cameraCenterY, GlobalVar.TakeTraySpeed);
if (errCode == Motion.ErrorCode.Ok || GlobalVar.VirtualAxis)
{
Thread.Sleep(GlobalVar.VirtualAxisMoveTime);
if (GlobalVar.VirtualAxis)
{
Thread.Sleep(GlobalVar.VirtualAxisMoveTime);
}
logInfo = GetClassName() + $"准备运动到{m_fromTray}料仓取料盘位上方";
MessageQueue.Instance.Insert(logInfo);
step = ETakeTrayFlowStep.;
}
else
{
MsgBox.ShowAxisAlarmDialog(AxisControl.LoadY, errCode);
}
logInfo =GetClassName()+ $"准备运动到{m_fromTray}料仓取料盘位上方";
MessageQueue.Instance.Insert(logInfo);
step = ETakeTrayFlowStep.;
}
else
{
MsgBox.ShowAxisAlarmDialog(AxisControl.LoadY, errCode);
MsgBox.ShowAxisAlarmDialog(AxisControl.LoadX, errCode);
}
}
else
{
MsgBox.ShowAxisAlarmDialog(AxisControl.LoadX, errCode);
Msg.ShowError("周转Y轴不在安全位请移动到安全后点击确定");
}
break;
case ETakeTrayFlowStep.:
if (Ops.IsStop("LoadX", "LoadY") || GlobalVar.VirtualAxis)
{
logInfo = GetClassName() + $"已运动到{m_fromTray}料仓取料盘位上方";
MessageQueue.Instance.Insert(logInfo);
step = ETakeTrayFlowStep.;
if(Ops.IsArrived(AxisControl.LoadX,AxisControl.LoadY))
{
logInfo = GetClassName() + $"已运动到{m_fromTray}料仓取料盘位上方";
MessageQueue.Instance.Insert(logInfo);
step = ETakeTrayFlowStep.;
}
}
break;
case ETakeTrayFlowStep.:
@ -254,50 +265,60 @@ namespace Rs.MotionPlat.Flow
}
break;
case ETakeTrayFlowStep.:
//if(GlobalVar.RunSpace)
//{
// Thread.Sleep(2000);
//}
//centerX = SysConfigParam.GetValue<double>($"Tray{m_toTray.ToString()}CenterX");
//centerY = SysConfigParam.GetValue<double>($"Tray{m_toTray.ToString()}CenterY");
takeTrayFinishedEvent?.Invoke();
cameraCenterX = SysConfigParam.GetValue<double>("ClampCenter2UpCameraCenterX");
cameraCenterY = SysConfigParam.GetValue<double>("ClampCenter2UpCameraCenterY");
targetX = SysConfigParam.GetValue<double>($"{m_toTray.ToString()}TakeTrayX");
targetY = SysConfigParam.GetValue<double>($"{m_toTray.ToString()}TakeTrayY");
errCode = AxisControl.LoadX.MovePos(targetX+ cameraCenterX, GlobalVar.TakeTraySpeed);
if (errCode == Motion.ErrorCode.Ok || GlobalVar.VirtualAxis)
if (DischargeFlow.Instance.XYCanMove())
{
errCode = AxisControl.LoadY.MovePos(targetY+ cameraCenterY - 2, GlobalVar.TakeTraySpeed);
//if(GlobalVar.RunSpace)
//{
// Thread.Sleep(2000);
//}
//centerX = SysConfigParam.GetValue<double>($"Tray{m_toTray.ToString()}CenterX");
//centerY = SysConfigParam.GetValue<double>($"Tray{m_toTray.ToString()}CenterY");
takeTrayFinishedEvent?.Invoke();
double cameraCenterX = SysConfigParam.GetValue<double>("ClampCenter2UpCameraCenterX");
double cameraCenterY = SysConfigParam.GetValue<double>("ClampCenter2UpCameraCenterY");
targetX = SysConfigParam.GetValue<double>($"{m_toTray.ToString()}TakeTrayX");
targetY = SysConfigParam.GetValue<double>($"{m_toTray.ToString()}TakeTrayY");
ErrorCode errCode = AxisControl.LoadX.MovePos(targetX + cameraCenterX, GlobalVar.TakeTraySpeed);
if (errCode == Motion.ErrorCode.Ok || GlobalVar.VirtualAxis)
{
if (GlobalVar.VirtualAxis)
errCode = AxisControl.LoadY.MovePos(targetY + cameraCenterY - 2, GlobalVar.TakeTraySpeed);
if (errCode == Motion.ErrorCode.Ok || GlobalVar.VirtualAxis)
{
Thread.Sleep(GlobalVar.VirtualAxisMoveTime);
if (GlobalVar.VirtualAxis)
{
Thread.Sleep(GlobalVar.VirtualAxisMoveTime);
}
logInfo = GetClassName() + $"到{toTray}料仓放料盘上方";
MessageQueue.Instance.Insert(logInfo);
step = ETakeTrayFlowStep.;
}
else
{
MsgBox.ShowAxisAlarmDialog(AxisControl.LoadY, errCode);
}
logInfo = GetClassName()+$"到{toTray}料仓放料盘上方";
MessageQueue.Instance.Insert(logInfo);
step = ETakeTrayFlowStep.;
}
else
{
MsgBox.ShowAxisAlarmDialog(AxisControl.LoadY, errCode);
MsgBox.ShowAxisAlarmDialog(AxisControl.LoadX, errCode);
}
}
else
{
MsgBox.ShowAxisAlarmDialog(AxisControl.LoadX, errCode);
Msg.ShowError("周转Y轴不在安全位请移动到安全后点击确定");
}
break;
case ETakeTrayFlowStep.:
if (Ops.IsStop("LoadX", "LoadY") || GlobalVar.VirtualAxis)
{
logInfo = GetClassName() + $"已运动到{toTray}料仓放料盘上方";
MessageQueue.Instance.Insert(logInfo);
arrivedDumpPosEvent?.Invoke();
step = ETakeTrayFlowStep.;
if (Ops.IsArrived(AxisControl.LoadX, AxisControl.LoadY))
{
logInfo = GetClassName() + $"已运动到{toTray}料仓放料盘上方";
MessageQueue.Instance.Insert(logInfo);
arrivedDumpPosEvent?.Invoke();
step = ETakeTrayFlowStep.;
}
}
break;
case ETakeTrayFlowStep.:

@ -48,8 +48,6 @@ namespace Rs.MotionPlat.Flow.SubFlow
});
});
}
Thread.Sleep(5000);
while (true)
{
if(Ops.IsOff("4号料仓料盘到位光电检测"))//如果ng料仓处没有料盘
@ -68,13 +66,14 @@ namespace Rs.MotionPlat.Flow.SubFlow
}
logInfo = "start take ng tray to input stock";
MessageQueue.Instance.Insert(logInfo );
TakeTrayFlow.Instance.Take(ETrayType.Ng, ETrayType.Input, null, null, () =>{
TakeTrayFlow.Instance.Take(ETrayType.Ng, ETrayType.Input, () => {
StockManager.Instance.GetStock(ETrayType.Ng).ChangeStatus(EStockTrayStatus.Empty);
}, null, () =>{
Task.Run(() => {
StockManager.Instance.GetStock(ETrayType.Input).Unload(EStockTrayUnLoadMode.Whole, null);
});
});
}
Ops.Stop();
}
}
}

@ -126,9 +126,10 @@ namespace Rs.MotionPlat.Flow
switch (eInstructioneInstruction)
{
case EInstruction.TransferSiloTray:
//ReportToTestCenter(schedule);
//MachineManage.Instance.SetLoadUnloadStatus(ERunState.Busying);
//NgTrayToInputTrayFlow.Instance.MoveToInput();
ReportToTestCenter(schedule);
MachineManage.Instance.SetLoadUnloadStatus(ERunState.Busying);
NgTrayToInputTrayFlow.Instance.MoveToInput();
MachineManage.Instance.SetLoadUnloadStatus(ERunState.Waiting);
break;
case EInstruction.TestFinished:
MessageQueue.Instance.Insert("测试完成:"+JsonConvert.SerializeObject(schedule, new StringEnumConverter()));

@ -212,15 +212,18 @@ namespace Rs.MotionPlat.SysConfig
tostock = ETrayType.Multi;
if (btnToEmpty2.Checked)
tostock = ETrayType.Empty2;
StockManager.Instance.GetStock(fromstock).Load(EStockTrayLoadMode.Whole, null);
TakeTrayFlow.Instance.Take(fromstock, tostock,
null,
() => {
StockManager.Instance.GetStock(fromstock).ChangeStatus(EStockTrayStatus.Unloaded);
},
() => {
StockManager.Instance.GetStock(tostock).Unload(EStockTrayUnLoadMode.Whole, null);
});
Task.Run(() => {
StockManager.Instance.GetStock(fromstock).Load(EStockTrayLoadMode.Whole, null);
TakeTrayFlow.Instance.Take(fromstock, tostock,
null,
() => {
StockManager.Instance.GetStock(fromstock).ChangeStatus(EStockTrayStatus.Unloaded);
},
() => {
StockManager.Instance.GetStock(tostock).Unload(EStockTrayUnLoadMode.Whole, null);
});
});
}
}
}

Loading…
Cancel
Save