优化测试治具上料流程

master
lhiven 3 years ago
parent 89c6df5697
commit dcb5f9643e

@ -6,6 +6,14 @@ using System.Threading.Tasks;
namespace Rs.MotionPlat.Commom
{
public enum EFlowStatus
{
Running,
Idle
}
/// <summary>
/// 料盘类型
/// </summary>

@ -692,6 +692,12 @@ namespace Rs.MotionPlat.Commom
}
}
public struct TesterInfo
{
public ETesterState State { get; set; }
public HashSet<int> ReadySites { get; set; }
}
/// <summary>

@ -89,7 +89,7 @@ namespace Rs.MotionPlat.Flow
/// <summary>
/// 测试机状态
/// </summary>
private ETesterState testerState = ETesterState.NotReady;
private TesterInfo testerInfo;
/// <summary>
/// 物料分配模式(正常或空跑)
@ -107,13 +107,13 @@ namespace Rs.MotionPlat.Flow
RunStatus= status;
}
public void SetTesterState(ETesterState _testerState)
public void SetTesterState(TesterInfo _testerInfo)
{
testerState= _testerState;
testerInfo = _testerInfo;
}
public ETesterState GetTesterState() {
return testerState;
public TesterInfo GetTesterInfo() {
return testerInfo;
}
/// <summary>

@ -1,4 +1,5 @@
using System;
using Rs.MotionPlat.Commom;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

@ -1,4 +1,5 @@
using System;
using Rs.MotionPlat.Commom;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@ -23,11 +24,7 @@ namespace Rs.MotionPlat.Flow
}
public enum EFlowStatus
{
Running,
Idle
}
public class StockTrayTakeNgFlow:BaseFlow
{
private StockTrayTakeNgFlow() { }

@ -3,7 +3,6 @@ using Rs.Controls;
using Rs.Framework;
using Rs.MotionPlat.Commom;
using Rs.MotionPlat.Entitys.Trays;
using Rs.MotionPlat.Flow.RecheckFlow;
using Rs.MotionPlat.Flow.SafePosFlow;
using Rs.MotionPlat.Flow.SubFlow;
using System;
@ -96,6 +95,7 @@ namespace Rs.MotionPlat.Flow
/// </summary>
public class TurnoverFlow:BaseFlow
{
public EFlowStatus FlowStatus { get; set; } = EFlowStatus.Idle;
private static TurnoverFlow instance;
public static TurnoverFlow Instance
{
@ -153,6 +153,7 @@ namespace Rs.MotionPlat.Flow
//{
// slots.Add(slot.FromIndex + 1);
//}
FlowStatus = EFlowStatus.Running;
retakeNum = 0;
logInfo = GetClassName()+$"接收到测试工位上料任务";
MessageQueue.Instance.Insert(logInfo);
@ -165,6 +166,7 @@ namespace Rs.MotionPlat.Flow
//{
// slots.Add(slot.FromIndex + 1);
//}
FlowStatus = EFlowStatus.Running;
retakeNum = 0;
logInfo = GetClassName() + $"接收到测试工位下料任务";
MessageQueue.Instance.Insert(logInfo);
@ -243,7 +245,13 @@ namespace Rs.MotionPlat.Flow
}
break;
case ETurnoverFlowStep.:
//查询周转盘中待测穴位中有料的穴位
List<TurnoverTraySlot> untestSlots = TurnoverTrayManager.Instance.GetSlots(ETurnoverTraySlotType.WaitTest, ETurnoverTraySlotStatus.Have);
if(untestSlots!=null&&untestSlots.Count>0)
{
bool exit = false;
while (!exit)
{
alarmInfo = GetClassName() + $"周转盘{string.Join(",", untestSlots.Select(s => s.Index))}号穴位异常";
TestCenterMessageBox.Show(AlarmConstID.TurnoverTakeFailAlarm, alarmInfo, MessageButtonManager.GetRetry_Skip_MoveToSafe_Button(),
MessageButtonManager.GetRetry_Skip_MoveToSafe_ButtonText());
@ -254,6 +262,7 @@ namespace Rs.MotionPlat.Flow
logInfo = $"选择了重试";
MessageQueue.Instance.Insert(logInfo);
retakeNum = 0;
exit = true;
Step = ETurnoverFlowStep.;
break;
case ETipButton.Skip:
@ -265,12 +274,20 @@ namespace Rs.MotionPlat.Flow
}
else
{
logInfo = $"异常处理吸嘴未启用";
MessageQueue.Instance.Insert(logInfo);
if (TurnoverTrayLasterRecheckFlow.Instance.Recheck())
untestSlots = TurnoverTrayManager.Instance.GetSlots(ETurnoverTraySlotType.WaitTest, ETurnoverTraySlotStatus.Have);
foreach (TurnoverTraySlot slot in untestSlots)
{
TransitModuleSafePosFlow.Instance.GoSafePostion();
Step = ETurnoverFlowStep.;
if (!LaserFlow.Instance.HasProduct(ETrayType.Turnover, slot.Index))
{
slot.ClearProduct();
GlobalTray.TurnoverTray.ChangeStatus(slot.Index, ESlotStatus.NotHave);
}
}
untestSlots = TurnoverTrayManager.Instance.GetSlots(ETurnoverTraySlotType.WaitTest, ETurnoverTraySlotStatus.Have);
if (untestSlots == null || untestSlots.Count == 0)
{
exit = true;
Step = ETurnoverFlowStep.;
}
}
break;
@ -282,6 +299,8 @@ namespace Rs.MotionPlat.Flow
default:
break;
}
}
}
break;
case ETurnoverFlowStep.1:
if (Ops.IsStop(AxisControl.TurnoverZ) || GlobalVar.VirtualAxis)
@ -446,13 +465,7 @@ namespace Rs.MotionPlat.Flow
//{
// GlobalTray.TurnoverTray.ChangeStatus(turnoverInfo.FromIndex + 1, ESlotStatus.NotHave);
//}
if(TurnoverTrayManager.Instance.GetSlots( ETurnoverTraySlotType.WaitTest, ETurnoverTraySlotStatus.Have).Count()==0)
{
TestCenter.Instance.Send(LoadAndUnloadTask.Instance.GetTestLoadString());
LoadAndUnloadTask.Instance.Clear(1);
MachineManage.Instance.SetLoadUnloadStatus(ERunState.Waiting);
MessageQueue.Instance.Insert("通知中控周转载盘产品已取走,可以继续排料");
}
//List<TurnoverInfo> testLoadList = LoadAndUnloadTask.Instance.GetTurnoverToTestTasks();
@ -467,7 +480,13 @@ namespace Rs.MotionPlat.Flow
//MachineManage.Instance.SetLoadUnloadStatus(ERunState.Waiting);
//MessageQueue.Instance.Insert("通知中控周转载盘产品已取走,可以继续排料");
#endregion
if (TurnoverTrayManager.Instance.GetSlots(ETurnoverTraySlotType.WaitTest, ETurnoverTraySlotStatus.Have).Count() == 0)
{
TestCenter.Instance.Send(LoadAndUnloadTask.Instance.GetTestLoadString());
LoadAndUnloadTask.Instance.Clear(1);
MachineManage.Instance.SetLoadUnloadStatus(ERunState.Waiting);
MessageQueue.Instance.Insert("通知中控周转载盘产品已取走,可以继续排料");
}
Step = ETurnoverFlowStep.;
}
break;
@ -477,6 +496,8 @@ namespace Rs.MotionPlat.Flow
Step = ETurnoverFlowStep.1;
}
else
{
if(TransitNozzleManager.Instance.GetHasProductNozzles().Count>0)
{
loseSlots.Clear();
//检测是否丢料
@ -488,6 +509,9 @@ namespace Rs.MotionPlat.Flow
}
}
if (loseSlots.Count > 0)
{
bool exit = false;
while (!exit)
{
alarmInfo = $"周转{loseSlots.ToJoinString()}号吸嘴真空异常丢料,请处理";
TestCenterMessageBox.Show(AlarmConstID.NozzlesLoseMaterialAlarm, alarmInfo, MessageButtonManager.GetSkip_MoveToSafe_Button(), MessageButtonManager.GetSkip_MoveToSafe_ButtonText());
@ -495,17 +519,21 @@ namespace Rs.MotionPlat.Flow
switch (msgBox.Button)
{
case ETipButton.Skip:
MessageQueue.Instance.Insert(GetClassName()+$"点击了跳过按钮");
logInfo = GetClassName() + $"点击了跳过按钮";
MessageQueue.Instance.Insert(logInfo);
exit = true;
TransitNozzleManager.Instance.GetHasProductNozzles().ForEach((n) => { n.IsHasProduct = false; n.SN = ""; });
break;
case ETipButton.Yes:
MessageQueue.Instance.Insert(GetClassName()+$"点击了移动到安全位按钮");
logInfo = GetClassName() + $"点击了移动到安全位按钮";
MessageQueue.Instance.Insert(logInfo);
TransitModuleSafePosFlow.Instance.GoSafePostion();
break;
default:
break;
}
}
}
else
{
logInfo = GetClassName() + $"已运动到测试放料位上方";
@ -513,6 +541,19 @@ namespace Rs.MotionPlat.Flow
Step = ETurnoverFlowStep.1;
}
}
else
{
if (TurnoverTrayManager.Instance.GetSlots(ETurnoverTraySlotType.WaitTest, ETurnoverTraySlotStatus.Have).Count() > 0)
{
Step = ETurnoverFlowStep.;
retakeNum++;
}
else
{
Step = ETurnoverFlowStep.;
}
}
}
break;
case ETurnoverFlowStep.1:
@ -629,13 +670,14 @@ namespace Rs.MotionPlat.Flow
if(masticSlots.Count > 0)
{
//粘料报警
alarmInfo = $"周转{loseSlots.ToJoinString()}号吸嘴真空异常粘料,请手工处理";
alarmInfo = $"周转吸头{masticSlots.ToJoinString()}号吸嘴真空异常粘料,请手工处理";
TestCenterMessageBox.Show(AlarmConstID.NozzlesLoseMaterialAlarm, alarmInfo, MessageButtonManager.GetSkip_MoveToSafe_Button(), MessageButtonManager.GetSkip_MoveToSafe_ButtonText());
msgBox = TestCenterMessageBox.WaitResult(AlarmConstID.NozzlesLoseMaterialAlarm);
switch (msgBox.Button)
{
case ETipButton.Skip:
MessageQueue.Instance.Insert(GetClassName() + $"点击了跳过按钮");
logInfo = GetClassName() + $"点击了跳过按钮";
MessageQueue.Instance.Insert(logInfo);
foreach (int nozzleIndex in masticSlots)
{
TransitNozzle nozzle = TransitNozzleManager.Instance.Nozzle(nozzleIndex);
@ -667,40 +709,57 @@ namespace Rs.MotionPlat.Flow
}
else
{
if (GlobalVar.RunSpace || GlobalVar.VirtualAxis)
{
foreach (var nozzle in TransitNozzleManager.Instance.GetHasProductNozzles())
{
if(Ops.IsOn($"测试{nozzle.NozzleIndex}号穴位真空吸检测") || GlobalVar.RunSpace)
{
GlobalTray.TestTray.ChangeStatus(nozzle.NozzleIndex, ESlotStatus.Have);
//TestTrayManager.Instance.Slot(nozzle.NozzleIndex).AddProduct(nozzle.SN, nozzle.FromIndex, TurnoverType.Turnover, nozzle.NozzleIndex);
TestTrayManager.Instance.Slot(nozzle.NozzleIndex).AddProduct(nozzle);
nozzle.Clear();
}
if (TurnoverTrayManager.Instance.GetSlots( ETurnoverTraySlotType.WaitTest, ETurnoverTraySlotStatus.Have).Count() > 0)
else
{
Step = ETurnoverFlowStep.;
bool exit = false;
while (!exit)
{
alarmInfo = $"测试治具{nozzle.NozzleIndex}号真空吸异常";
TestCenterMessageBox.Show(AlarmConstID.NozzlesLoseMaterialAlarm, alarmInfo, MessageButtonManager.GetRetry_Skip_MoveToSafe_Button(), MessageButtonManager.GetRetry_Skip_MoveToSafe_ButtonText());
msgBox = TestCenterMessageBox.WaitResult(AlarmConstID.NozzlesLoseMaterialAlarm);
switch (msgBox.Button)
{
case ETipButton.Retry:
if (Ops.IsOn($"测试{nozzle.NozzleIndex}号穴位真空吸检测"))
{
TestTrayManager.Instance.Slot(nozzle.NozzleIndex).AddProduct(nozzle);
exit = true;
}
else
break;
case ETipButton.Skip:
//镭射头过来复检,有产品则继续报警,
if(!LaserFlow.Instance.HasProduct(ETrayType.Test, nozzle.NozzleIndex))
{
//在这里通知中控
Step = ETurnoverFlowStep.;
nozzle.Clear();
exit = true;
}
break;
case ETipButton.Yes://移动到安全位
TransitModuleSafePosFlow.Instance.GoSafePostion();
break;
}
else
}
}
}
if (TurnoverTrayManager.Instance.GetSlots(ETurnoverTraySlotType.WaitTest, ETurnoverTraySlotStatus.Have).Count() > 0)
{
//string msg = string.Join(",", ngList.ToArray());
//logInfo = $"测试 {string.Join(",", ngList.ToArray())} 号穴位放料真空异常,请手动处理完成后点击确定";
MessageQueue.Instance.Warn(logInfo);
TestCenterMessageBox.Show(AlarmConstID.TestDumpFailAlarm, logInfo, SchedulingMessageBox.ETipButton.Ok);
SchedulingMessageBox msgBox = TestCenterMessageBox.WaitResult(AlarmConstID.TestDumpFailAlarm);
if (msgBox.Button == SchedulingMessageBox.ETipButton.Ok)
Step = ETurnoverFlowStep.;
}
else
{
Step = ETurnoverFlowStep.;
}
//Msg.ShowError($"测试穴位 {msg} 真空异常,请处理后点击确定");
}
}
break;
@ -785,7 +844,7 @@ namespace Rs.MotionPlat.Flow
List<TestTraySlot> willTestSlot = TestTrayManager.Instance.GetSlots(ETestTraySlotStatus.Have);
VacManager.TestTrayVacSuction(EVacOperator.Close, willTestSlot.Select(s => s.Index).ToArray());
loadOk = true;
MachineManage.Instance.SetTesterState(ETesterState.Ready);
MachineManage.Instance.SetTesterState(new TesterInfo() { State = ETesterState.Ready, ReadySites = TestTrayManager.Instance.GetSlots(ETestTraySlotStatus.Have).Select(s => s.Index).ToHashSet() });
logInfo = GetClassName() + "通知中控测试位就绪,可以开始测试";
MessageQueue.Instance.Insert(logInfo);
//Thread.Sleep(1000 * 30);
@ -1052,7 +1111,7 @@ namespace Rs.MotionPlat.Flow
Step = ETurnoverFlowStep.;
if(TestTrayManager.Instance.GetSlots(ETestTraySlotStatus.Have).Count==0)
{
MachineManage.Instance.SetTesterState(ETesterState.NotReady);
MachineManage.Instance.SetTesterState(new TesterInfo() { State = ETesterState.NotReady, ReadySites = null });
logInfo = GetClassName() + "通知中控产品全部已从治具中取出状态变成NotReady";
}

@ -1,108 +0,0 @@
using Rs.Framework;
using Rs.Motion;
using Rs.MotionPlat.Commom;
using Rs.MotionPlat.Entitys.Trays;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace Rs.MotionPlat.Flow.RecheckFlow
{
enum ETurnoverTrayLasterRecheckFlowStep
{
,
,
,
,
,
,
}
/// <summary>
/// 中转盘镭射头复检有无料
/// </summary>
public class TurnoverTrayLasterRecheckFlow
{
private ETurnoverTrayLasterRecheckFlowStep step = ETurnoverTrayLasterRecheckFlowStep.;
private TurnoverTrayLasterRecheckFlow() { }
private static TurnoverTrayLasterRecheckFlow instance;
public static TurnoverTrayLasterRecheckFlow Instance
{
get
{
if (instance == null)
instance = new TurnoverTrayLasterRecheckFlow();
return instance;
}
}
double targetPos = 0.0;
ErrorCode errCode = ErrorCode.Ok;
bool checkResult = true;
string logInfo = string.Empty;
private bool finished = false;
/// <summary>
/// 周转盘有无料复检
/// </summary>
public bool Recheck()
{
//获取还有多少个穴位需要复检
List<TurnoverTraySlot> untestSlots = TurnoverTrayManager.Instance.GetSlots(ETurnoverTraySlotType.WaitTest, ETurnoverTraySlotStatus.Have);
foreach (TurnoverTraySlot slot in untestSlots)
{
step = ETurnoverTrayLasterRecheckFlowStep.;
finished = false;
checkResult= false;
while (true && !finished)
{
switch (step)
{
case ETurnoverTrayLasterRecheckFlowStep.:
logInfo = $"{nameof(TurnoverTrayLasterRecheckFlow)}-到周转盘{slot.Index}号穴位测高位上方";
MessageQueue.Instance.Insert(logInfo);
step = ETurnoverTrayLasterRecheckFlowStep.;
break;
case ETurnoverTrayLasterRecheckFlowStep.:
logInfo = $"{nameof(TurnoverTrayLasterRecheckFlow)}-已运动到周转盘{slot.Index}号穴位测高位上方";
MessageQueue.Instance.Insert(logInfo);
step = ETurnoverTrayLasterRecheckFlowStep.;
break;
case ETurnoverTrayLasterRecheckFlowStep.:
logInfo = $"{nameof(TurnoverTrayLasterRecheckFlow)}-到周转盘{slot.Index}号穴位测高位";
MessageQueue.Instance.Insert(logInfo);
step = ETurnoverTrayLasterRecheckFlowStep.;
break;
case ETurnoverTrayLasterRecheckFlowStep.:
logInfo = $"{nameof(TurnoverTrayLasterRecheckFlow)}-已运动到周转盘{slot.Index}号穴位测高位";
MessageQueue.Instance.Insert(logInfo);
step = ETurnoverTrayLasterRecheckFlowStep.;
break;
case ETurnoverTrayLasterRecheckFlowStep.:
checkResult = true;
if(checkResult)
{
slot.ClearProduct();
}
step = ETurnoverTrayLasterRecheckFlowStep.;
break;
case ETurnoverTrayLasterRecheckFlowStep.:
logInfo = $"{nameof(TurnoverTrayLasterRecheckFlow)}-测高完成抬起";
MessageQueue.Instance.Insert(logInfo);
step = ETurnoverTrayLasterRecheckFlowStep.;
break;
case ETurnoverTrayLasterRecheckFlowStep.:
logInfo = $"{nameof(TurnoverTrayLasterRecheckFlow)}-测高完成已抬起";
MessageQueue.Instance.Insert(logInfo);
finished = true;
break;
default:
break;
}
}
}
return TurnoverTrayManager.Instance.GetSlots(ETurnoverTraySlotType.WaitTest, ETurnoverTraySlotStatus.Have).Count == 0;
}
}
}

@ -14,11 +14,7 @@ namespace Rs.MotionPlat.Flow.SubFlow
{
,
,
,
,
,
,
}
/// <summary>
/// 镭射头到穴位上方
@ -79,7 +75,7 @@ namespace Rs.MotionPlat.Flow.SubFlow
{
logInfo = GetClassName() + $"已运动到{trayType}盘{slotIndex}号穴位的上方";
MessageQueue.Instance.Insert(logInfo);
step = ELaserFlowStep.;
step = ELaserFlowStep.;
}
else
{
@ -94,61 +90,15 @@ namespace Rs.MotionPlat.Flow.SubFlow
}
}
break;
case ELaserFlowStep.:
if(Ops.Go(AxisAlias.TurnoverZ,GlobalVar.TurnoverCheckBaseHeight) || GlobalVar.VirtualAxis)
{
logInfo = GetClassName() + $"到{trayType}盘{slotIndex}号穴位的测高位";
MessageQueue.Instance.Insert(logInfo);
step = ELaserFlowStep.;
}
break;
case ELaserFlowStep.:
if (Ops.IsStop(AxisAlias.TurnoverZ) || GlobalVar.VirtualAxis)
{
if (Ops.IsArrived(AxisAlias.TurnoverZ) || GlobalVar.VirtualAxis)
{
logInfo = GetClassName() + $"已运动到{trayType}盘{slotIndex}号穴位的测高位";
MessageQueue.Instance.Insert(logInfo);
step = ELaserFlowStep.;
}
else
{
Msg.ShowQuestion($"{AxisAlias.TurnoverZ}轴没有运动到位");
step = ELaserFlowStep.;
}
}
break;
case ELaserFlowStep.:
case ELaserFlowStep.:
double heightVal = DeviceFactory.checkHeightDev.Read();
logInfo = GetClassName() + $"开始测高:{heightVal}";
MessageQueue.Instance.Insert(logInfo);
step = ELaserFlowStep.;
break;
case ELaserFlowStep.:
if (Ops.Go(AxisAlias.TurnoverZ, 0) || GlobalVar.VirtualAxis)
{
logInfo = GetClassName() + $"测高完成到到{trayType}盘{slotIndex}号穴位的安全位";
MessageQueue.Instance.Insert(logInfo);
step = ELaserFlowStep.;
}
break;
case ELaserFlowStep.:
if (Ops.IsStop(AxisAlias.TurnoverZ) || GlobalVar.VirtualAxis)
{
if (Ops.IsArrived(AxisAlias.TurnoverZ) || GlobalVar.VirtualAxis)
{
logInfo = GetClassName() + $"测高完成已运动到{trayType}盘{slotIndex}号穴位安全位,测高结果:{hasProduct}";
MessageQueue.Instance.Insert(logInfo);
hasProduct = Math.Abs(heightVal - 0.5) < 0.5;
finished = true;
}
else
{
Msg.ShowQuestion($"{AxisAlias.TurnoverZ}轴没有运动到位");
step = ELaserFlowStep.;
}
}
break;
}
}
return hasProduct;

@ -144,7 +144,7 @@ namespace Rs.MotionPlat.Flow
statusInto.Info = EAssignMode.Normal.ToString();
break;
case SchedulingStatusInfo.InfoType.TesterState:
statusInto.Info = MachineManage.Instance.GetTesterState().ToString();
statusInto.Info = JsonConvert.SerializeObject(MachineManage.Instance.GetTesterInfo());//.ToString();
break;
default:
break;

@ -194,7 +194,6 @@
<Compile Include="Flow\SubFlow\WarningSuckerNgFlow.cs" />
<Compile Include="Flow\RearrangeFlow.cs" />
<Compile Include="Flow\RearrangeTask.cs" />
<Compile Include="Flow\RecheckFlow\TurnoverTrayLasterRecheckFlow.cs" />
<Compile Include="Flow\SafeControl.cs" />
<Compile Include="Flow\SafePosFlow\DischargeModuleGoSafePosFlow.cs" />
<Compile Include="Flow\SafePosFlow\GoSafePosFlow.cs" />

Loading…
Cancel
Save