From 89c6df5697dac26eb6cb010c2058d48607c4ef00 Mon Sep 17 00:00:00 2001
From: lhiven <2366881222@qq.com>
Date: Tue, 12 Dec 2023 07:37:00 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=8E=92=E6=96=99=E6=B5=81?=
=?UTF-8?q?=E7=A8=8B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Rs.SkyLine/Commom/Ops.cs | 32 +-
Rs.SkyLine/Flow/LoadAndUnloadTask.cs | 9 +
Rs.SkyLine/Flow/NormalFlow/DischargeFlow.cs | 337 ++++++++++++-------
Rs.SkyLine/Flow/SubFlow/UpCameraCheckFlow.cs | 2 +-
4 files changed, 241 insertions(+), 139 deletions(-)
diff --git a/Rs.SkyLine/Commom/Ops.cs b/Rs.SkyLine/Commom/Ops.cs
index e13e72b..6d931f8 100644
--- a/Rs.SkyLine/Commom/Ops.cs
+++ b/Rs.SkyLine/Commom/Ops.cs
@@ -137,14 +137,17 @@ namespace Rs.MotionPlat.Commom
public static void Start()
{
Task.Run(() => {
- WorkEnvironment.Instance.Ready();
- if (WorkEnvironment.Instance.EnvReadyOkEvent.WaitOne())
+ if(MachineManage.Instance.MachineStatus== EMachineStatus.Homed || MachineManage.Instance.MachineStatus== EMachineStatus.Stop)
{
+ if(!WorkEnvironment.Instance.EnvironmentOk)
+ {
+ WorkEnvironment.Instance.Ready();
+ WorkEnvironment.Instance.EnvReadyOkEvent.WaitOne();
+ }
DischargeFlow.Instance.Start();
TurnoverFlow.Instance.Start();
MachineManage.Instance.SetCenterMachineStatus(ERunStatus.Started);
- var status = MachineManage.Instance.GetLoadUnloadStatus();
- if(DischargeFlow.Instance.GetCurStep()=="等待任务" && TurnoverFlow.Instance.GetStep()== "等待任务")
+ if (DischargeFlow.Instance.GetCurStep() == "等待任务" && TurnoverFlow.Instance.GetStep() == "等待任务")
{
MachineManage.Instance.SetLoadUnloadStatus(ERunState.Waiting);
}
@@ -155,11 +158,22 @@ namespace Rs.MotionPlat.Commom
public static void Stop()
{
- DischargeFlow.Instance.Stop();
- TurnoverFlow.Instance.Stop();
- MachineManage.Instance.SetCenterMachineStatus(ERunStatus.Stopped);
- MachineManage.Instance.SetLoadUnloadStatus(ERunState.Interrupt);
- MachineManage.Instance.MachineStatus = EMachineStatus.Stop;
+ if(MachineManage.Instance.MachineStatus== EMachineStatus.Working)
+ {
+ DischargeFlow.Instance.Stop();
+ TurnoverFlow.Instance.Stop();
+ MachineManage.Instance.SetCenterMachineStatus(ERunStatus.Stopped);
+ //MachineManage.Instance.SetLoadUnloadStatus(ERunState.Interrupt);
+ MachineManage.Instance.MachineStatus = EMachineStatus.Stop;
+ }
+ else if(MachineManage.Instance.MachineStatus== EMachineStatus.Homing)
+ {
+ foreach (IAxis axis in AxisControl.GetAllAxis())
+ {
+ axis.Abort_Go_Home();
+ }
+ }
+
}
public static void GoHome()
diff --git a/Rs.SkyLine/Flow/LoadAndUnloadTask.cs b/Rs.SkyLine/Flow/LoadAndUnloadTask.cs
index 40dc5f0..5ee8f08 100644
--- a/Rs.SkyLine/Flow/LoadAndUnloadTask.cs
+++ b/Rs.SkyLine/Flow/LoadAndUnloadTask.cs
@@ -179,6 +179,15 @@ namespace Rs.MotionPlat.Flow
turnoverResult.Add(turnoverInfo);
}
+ public void CopyBarcodeToTask(int slotIndex,string sn)
+ {
+ TurnoverInfo ti = turnoverResult.Where(r => r.ToIndex == slotIndex && r.ToType == TurnoverType.Turnover).First();
+ if(ti!=null)
+ {
+ ti.SN = sn;
+ }
+ }
+
///
/// 获取测试治具上料的任务信息
///
diff --git a/Rs.SkyLine/Flow/NormalFlow/DischargeFlow.cs b/Rs.SkyLine/Flow/NormalFlow/DischargeFlow.cs
index 818cc8c..79fc92a 100644
--- a/Rs.SkyLine/Flow/NormalFlow/DischargeFlow.cs
+++ b/Rs.SkyLine/Flow/NormalFlow/DischargeFlow.cs
@@ -943,61 +943,97 @@ namespace Rs.MotionPlat.Flow
}
else
{
- //获取所有需要放料的吸嘴,检测真空是否还在,如果真空异常则报警
- List lostNozzles = new List();
- List toUnloadNozzles = NozzleManager.GetNozzlesByStatus(ENozzleStatus.ToUnload);
- if (toUnloadNozzles.Count > 0)
+ if(!curNozzle.HasProduct())
{
-
- foreach (var nozzle in toUnloadNozzles)
+ bool exit = false;
+ while(!exit)
{
- if (!nozzle.HasProduct())
+ //弹框报警
+ alarmInfo = $"检测到{curNozzle.NozzleIndex}吸嘴真空吸异常,可能丢料,请检查吸嘴的状态";
+ TestCenterMessageBox.Show(AlarmConstID.DischargeNozzleLostProductAlarm, alarmInfo, MessageButtonManager.GetSkip_MoveToSafe_Button(), MessageButtonManager.GetSkip_MoveToSafe_ButtonText());
+ msgBox = TestCenterMessageBox.WaitResult(AlarmConstID.DischargeNozzleLostProductAlarm);
+ switch (msgBox.Button)
{
- lostNozzles.Add(nozzle);
- }
- }
- if (lostNozzles.Count > 0)
- {
- bool bSkip = false;
- while (!bSkip)
- {
- //弹框报警
- alarmInfo = $"检测到{lostNozzles.Select(ln => ln.NozzleIndex).ToJoinString()}吸嘴真空吸异常,可能丢料,请检查吸嘴的状态";
- TestCenterMessageBox.Show(AlarmConstID.DischargeNozzleLostProductAlarm, alarmInfo, MessageButtonManager.GetSkip_MoveToSafe_Button(), MessageButtonManager.GetSkip_MoveToSafe_ButtonText());
- msgBox = TestCenterMessageBox.WaitResult(AlarmConstID.DischargeNozzleLostProductAlarm);
- switch (msgBox.Button)
- {
- case ETipButton.Skip:
- bSkip = true;
- lostNozzles.ForEach(ln => ln.Reset());
- break;
- case ETipButton.Yes:
- DischargeModuleGoSafePosFlow.Instance.GoSafePostion();
- break;
- default:
- break;
- }
- }
- }
- else
- {
- if (curNozzle.Status == ENozzleStatus.ToUnload)
- {
- flowStep = EDischargeFlowStep.到放料位下方;
- }
- else
- {
- flowStep = EDischargeFlowStep.放料任务完成;
+ case ETipButton.Skip:
+ if (!curNozzle.HasProduct())
+ {
+ curNozzle.Reset();
+ exit= true;
+ flowStep = EDischargeFlowStep.放料任务完成;
+ }
+ break;
+ case ETipButton.Yes:
+ DischargeModuleGoSafePosFlow.Instance.GoSafePostion();
+ break;
+ default:
+ break;
}
}
+
}
else
{
- flowStep = EDischargeFlowStep.放料任务完成;
+ flowStep = EDischargeFlowStep.到放料位下方;
}
+ #region 临时屏蔽
+ // //获取所有需要放料的吸嘴,检测真空是否还在,如果真空异常则报警
+ // List lostNozzles = new List();
+ // List toUnloadNozzles = NozzleManager.GetNozzlesByStatus(ENozzleStatus.ToUnload);
+ // if (toUnloadNozzles.Count > 0)
+ // {
+
+ // foreach (var nozzle in toUnloadNozzles)
+ // {
+ // if (!nozzle.HasProduct())
+ // {
+ // //lostNozzles.Add(nozzle);
+ // while (!bSkip)
+ // {
+
+ // }
+ // }
+ // }
+ // if (lostNozzles.Count > 0)
+ // {
+ // bool bSkip = false;
+ // while (!bSkip)
+ // {
+ // //弹框报警
+ // alarmInfo = $"检测到{lostNozzles.Select(ln => ln.NozzleIndex).ToJoinString()}吸嘴真空吸异常,可能丢料,请检查吸嘴的状态";
+ // TestCenterMessageBox.Show(AlarmConstID.DischargeNozzleLostProductAlarm, alarmInfo, MessageButtonManager.GetSkip_MoveToSafe_Button(), MessageButtonManager.GetSkip_MoveToSafe_ButtonText());
+ // msgBox = TestCenterMessageBox.WaitResult(AlarmConstID.DischargeNozzleLostProductAlarm);
+ // switch (msgBox.Button)
+ // {
+ // case ETipButton.Skip:
+ // bSkip = true;
+ // lostNozzles.ForEach(ln => ln.Reset());
+ // break;
+ // case ETipButton.Yes:
+ // DischargeModuleGoSafePosFlow.Instance.GoSafePostion();
+ // break;
+ // default:
+ // break;
+ // }
+ // }
+ // }
+ // else
+ // {
+ // if (curNozzle.Status == ENozzleStatus.ToUnload)
+ // {
+ // flowStep = EDischargeFlowStep.到放料位下方;
+ // }
+ // else
+ // {
+ // flowStep = EDischargeFlowStep.放料任务完成;
+ // }
+ // }
+ // }
+ // else
+ // {
+ // flowStep = EDischargeFlowStep.放料任务完成;
+ // }
+ #endregion
}
-
-
break;
//case EDischargeFlowStep.到放料位下方:
// DischargeDumpFlow.Instance.Start(curNozzle.ToType, curNozzle.NozzleIndex, curNozzle.ToIndex);
@@ -1136,10 +1172,14 @@ namespace Rs.MotionPlat.Flow
switch (msgBox.Button)
{
case ETipButton.Skip:
- curNozzle.Reset();
- skip = true;
logInfo = GetClassName() + "选择了跳过按钮";
MessageQueue.Instance.Insert(logInfo);
+ if (!curNozzle.HasProduct())
+ {
+ curNozzle.Reset();
+ skip = true;
+ flowStep = EDischargeFlowStep.放料任务完成;
+ }
break;
case ETipButton.Yes:
logInfo = GetClassName() + "选择了移动到安全位按钮";
@@ -1153,90 +1193,99 @@ namespace Rs.MotionPlat.Flow
else
{
curNozzle.VacSuction(EIoOperate.Close);
+ flowStep = EDischargeFlowStep.放料真空检测;
+ }
+ break;
+ case EDischargeFlowStep.放料真空检测:
+ if (curNozzle.ToType == TurnoverType.Turnover)
+ {
+ if (Ops.IsOn($"周转盘{curNozzle.ToIndex + 1}号穴位真空吸检测") || GlobalVar.RunSpace)
+ {
+ logInfo = GetClassName()+$"周转盘{curNozzle.ToIndex + 1}号穴位真空吸检测OK";
+ MessageQueue.Instance.Insert(logInfo);
+ flowStep = EDischargeFlowStep.放料任务完成;
+ }
+ else
+ {
+ bool exit = false;
+ Dictionary buttons = new Dictionary() {
+ { ETipButton.Retry,"重拍|Regrab" },
+ {ETipButton.Skip,"跳过|Skip" },
+ {ETipButton.Yes,"移动到安全位|MoveToSafePos" }
+ };
+ while (!exit)
+ {
+ TestCenterMessageBox.Show(AlarmConstID.TurnoverDumpFailAlarm, alarmInfo, ETipButton.Retry | ETipButton.Skip | ETipButton.Yes, buttons);
+ msgBox = TestCenterMessageBox.WaitResult(AlarmConstID.TurnoverDumpFailAlarm);
+ if (msgBox != null)
+ {
+ switch (msgBox.Button)
+ {
+ case ETipButton.Retry://重拍
+ logInfo = GetClassName()+$"选择了重拍";
+ MessageQueue.Instance.Insert(logInfo);
+ if (UpCameraCheckFlow.Instance.CheckTurnoverTrayDumpOK(curNozzle.ToIndex))
+ {
+ exit=true;
+ flowStep = EDischargeFlowStep.放料任务完成;
+ }
+ break;
+ case ETipButton.Skip://跳过
+ logInfo = GetClassName()+$"选择了跳过";
+ MessageQueue.Instance.Insert(logInfo);
+ //logInfo = $"{nameof(DischargeFlow)}-通知强力吸头到{curNozzle.ToType}盘{curNozzle.ToIndex}穴位处理异常料";
+ //MessageQueue.Instance.Insert(logInfo);
+ //WarningSuckerNgFlow.Instance.Start(ETrayType.Turnover, curNozzle.ToIndex);
+ //WarningSuckerNgFlow.Instance.Wait();
+ if (!UpCameraCheckFlow.Instance.CheckTurnoverTrayHasProduct(null,curNozzle.ToIndex))
+ {
+ exit=true;
+ curNozzle.Reset();
+ flowStep = EDischargeFlowStep.放料任务完成;
+ }
+ break;
+ case ETipButton.Yes://移动到安全位
+ logInfo = GetClassName() + $"选择了移动到安全位";
+ MessageQueue.Instance.Insert(logInfo);
+ DischargeModuleGoSafePosFlow.Instance.GoSafePostion();
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+
+
+
+
+
+
+ //logInfo = $"{nameof(DischargeFlow)}-周转盘{curNozzle.ToIndex + 1}号穴位真空吸异常";
+ //MessageQueue.Instance.Warn(logInfo);
+ //if (UpCameraCheckFlow.Instance.CheckStockTrayHasProduct(null, EStockType.Turnover, curNozzle.ToIndex))
+ //{
+ // flowStep = EDischargeFlowStep.放料任务完成;
+ //}
+ //else
+ //{
+ // flowStep = EDischargeFlowStep.周转盘放料真空报警;
+ //}
+ //DialogResult dr = Msg.ShowError($"周转盘{curNozzle.ToIndex + 1}号穴位真空吸异常,点击确定后跳过");
+ //alarmInfo = $"周转盘{curNozzle.ToIndex + 1}号穴位真空吸异常";
+ //TestCenterMessageBox.Show(AlarmConstID.TurnoverDumpFailAlarm, alarmInfo, ETipButton.Ok);
+ //box = TestCenterMessageBox.WaitResult(AlarmConstID.TurnoverDumpFailAlarm);
+ //if (box.Button== ETipButton.Ok)
+ //{
+ //flowStep = EDischargeFlowStep.放料任务完成;
+ //}
+ }
+ }
+ else
+ {
flowStep = EDischargeFlowStep.放料任务完成;
}
break;
- #region 临时屏蔽,排料头放料到周转盘时,不进行周转盘的真空检测,只要没有粘料就继续执行
- //case EDischargeFlowStep.放料真空检测:
- // if (curNozzle.ToType == TurnoverType.Turnover)
- // {
- // if (Ops.IsOn($"周转盘{curNozzle.ToIndex + 1}号穴位真空吸检测") || GlobalVar.RunSpace)
- // {
- // logInfo = $"{nameof(DischargeFlow)}-周转盘{curNozzle.ToIndex + 1}号穴位真空吸检测OK";
- // MessageQueue.Instance.Insert(logInfo);
- // flowStep = EDischargeFlowStep.放料任务完成;
- // }
- // else
- // {
- // logInfo = $"{nameof(DischargeFlow)}-周转盘{curNozzle.ToIndex + 1}号穴位真空吸异常";
- // MessageQueue.Instance.Warn(logInfo);
- // if(UpCameraCheckFlow.Instance.CheckStockTrayHasProduct(null,EStockType.Turnover, curNozzle.ToIndex))
- // {
- // flowStep = EDischargeFlowStep.放料任务完成;
- // }
- // else
- // {
- // flowStep = EDischargeFlowStep.周转盘放料真空报警;
- // }
- // //DialogResult dr = Msg.ShowError($"周转盘{curNozzle.ToIndex + 1}号穴位真空吸异常,点击确定后跳过");
- // //alarmInfo = $"周转盘{curNozzle.ToIndex + 1}号穴位真空吸异常";
- // //TestCenterMessageBox.Show(AlarmConstID.TurnoverDumpFailAlarm, alarmInfo, ETipButton.Ok);
- // //box = TestCenterMessageBox.WaitResult(AlarmConstID.TurnoverDumpFailAlarm);
- // //if (box.Button== ETipButton.Ok)
- // //{
- // //flowStep = EDischargeFlowStep.放料任务完成;
- // //}
- // }
- // }
- // else
- // {
- // flowStep = EDischargeFlowStep.放料任务完成;
- // }
- // break;
- //case EDischargeFlowStep.周转盘放料真空报警:
- // Dictionary buttons = new Dictionary() {
- // { ETipButton.Retry,"重拍|Regrab" },
- // {ETipButton.Skip,"跳过|Skip" },
- // {ETipButton.Yes,"移动到安全位|MoveToSafePos" }
- // };
- // TestCenterMessageBox.Show(AlarmConstID.TurnoverDumpFailAlarm, alarmInfo, ETipButton.Retry| ETipButton.Skip| ETipButton.Yes,buttons);
- // msgBox = TestCenterMessageBox.WaitResult(AlarmConstID.TurnoverDumpFailAlarm);
- // if(msgBox!=null)
- // {
- // switch (msgBox.Button)
- // {
- // case ETipButton.Retry://重拍
- // logInfo = $"{nameof(DischargeFlow)}-选择了重拍";
- // MessageQueue.Instance.Insert(logInfo);
- // if(UpCameraCheckFlow.Instance.CheckTurnoverTrayDumpOK(curNozzle.ToIndex))
- // {
- // flowStep = EDischargeFlowStep.放料任务完成;
- // }
- // break;
- // case ETipButton.Skip://跳过
- // logInfo = $"{nameof(DischargeFlow)}-选择了跳过";
- // MessageQueue.Instance.Insert(logInfo);
- // logInfo = $"{nameof(DischargeFlow)}-通知强力吸头到{curNozzle.ToType}盘{curNozzle.ToIndex}穴位处理异常料";
- // MessageQueue.Instance.Insert(logInfo);
- // WarningSuckerNgFlow.Instance.Start( ETrayType.Turnover, curNozzle.ToIndex);
- // WarningSuckerNgFlow.Instance.Wait();
- // flowStep = EDischargeFlowStep.放料任务完成;
- // break;
- // case ETipButton.Yes://移动到安全位
- // logInfo = $"{nameof(DischargeFlow)}-选择了移动到安全位";
- // MessageQueue.Instance.Insert(logInfo);
- // logInfo = $"{nameof(DischargeFlow)}-通知排料头回安全位";
- // MessageQueue.Instance.Insert(logInfo);
- // DischargeModuleGoSafePosFlow.Instance.GoSafePostion();
- // logInfo = $"{nameof(DischargeFlow)}-排料头已回到安全位";
- // MessageQueue.Instance.Insert(logInfo);
- // break;
- // default:
- // break;
- // }
- // }
- // break;
- #endregion
case EDischargeFlowStep.放料任务完成:
//AxisControl.GetAxis($"NozzleZ{curNozzle.NozzleIndex}").Home();
@@ -1277,6 +1326,7 @@ namespace Rs.MotionPlat.Flow
GlobalTray.MultiTray.ChangeStatus(curNozzle.ToIndex + 1, ESlotStatus.Have);
}
LoadAndUnloadTask.Instance.AddTurnoverResult(curNozzle);
+
}
curNozzle.Reset();
if (NozzleManager.GetNozzlesByStatus(ENozzleStatus.ToUnload).Count > 0)
@@ -1298,6 +1348,21 @@ namespace Rs.MotionPlat.Flow
SlotPoint grabEndPoint = TrayPointManager.GetSlotPoint(ETrayType.Turnover, 8);
UpCameraScanBarCodeFlow.Instance.Scan(1, false);
List result = UpCameraScanBarCodeFlow.Instance.Wait();
+ foreach (var vr in result)
+ {
+ if(TurnoverTrayManager.Instance.Slot(vr.SlotIndex).IsHasProduct)
+ {
+ if (vr.SearchModelOK && vr.OffsetX < 0.5 && vr.OffsetY < 0.5 && vr.OffsetR < 5)//定位成功
+ {
+ if(vr.ScanBarCodeOK)
+ {
+ //复制二维码
+ LoadAndUnloadTask.Instance.CopyBarcodeToTask(vr.SlotIndex, vr.SN);
+ }
+ }
+ }
+
+ }
OnUpCameraGrabResult?.Invoke(result);
}
//判断周转盘第三行有没有产品,如果有产品则拍第三行
@@ -1308,6 +1373,20 @@ namespace Rs.MotionPlat.Flow
SlotPoint grabEndPoint = TrayPointManager.GetSlotPoint(ETrayType.Turnover, 24);
UpCameraScanBarCodeFlow.Instance.Scan(24, true);
List result = UpCameraScanBarCodeFlow.Instance.Wait();
+ foreach (var vr in result)
+ {
+ if (TurnoverTrayManager.Instance.Slot(vr.SlotIndex).IsHasProduct)
+ {
+ if (vr.SearchModelOK && vr.OffsetX < 0.5 && vr.OffsetY < 0.5 && vr.OffsetR < 5)//定位成功
+ {
+ if (vr.ScanBarCodeOK)
+ {
+ //复制二维码
+ LoadAndUnloadTask.Instance.CopyBarcodeToTask(vr.SlotIndex, vr.SN);
+ }
+ }
+ }
+ }
OnUpCameraGrabResult?.Invoke(result);
}
@@ -1346,7 +1425,7 @@ namespace Rs.MotionPlat.Flow
{
Thread.Sleep(GlobalVar.VirtualAxisMoveTime);
}
- logInfo = $"{nameof(DischargeFlow)}-排料任务结束到安全位";
+ logInfo =GetClassName()+ $"排料任务结束到安全位";
MessageQueue.Instance.Insert(logInfo);
flowStep = EDischargeFlowStep.等待任务结束到安全位;
}
diff --git a/Rs.SkyLine/Flow/SubFlow/UpCameraCheckFlow.cs b/Rs.SkyLine/Flow/SubFlow/UpCameraCheckFlow.cs
index 05ef8d9..5096300 100644
--- a/Rs.SkyLine/Flow/SubFlow/UpCameraCheckFlow.cs
+++ b/Rs.SkyLine/Flow/SubFlow/UpCameraCheckFlow.cs
@@ -77,7 +77,7 @@ namespace Rs.MotionPlat.Flow.SubFlow
///
public bool CheckTurnoverTrayHasProduct(Action checkFinishedEvent,int slotIndex=1)
{
- //Go(ETrayType.Turnover, slotIndex);
+ Go(ETrayType.Turnover, slotIndex);
int result = VisionManager.TurnoverTrayHasProduct(checkFinishedEvent);
if (result == 1)
return true;