优化当排料下料时没有产品时,直接到安全位等待

master
lhiven 1 year ago
parent fe24183d0e
commit 0f4c0545ae

@ -589,39 +589,45 @@ namespace Rs.MotionPlat.Flow
HikCamera.Instance.SetExposure("locationCamera", GlobalVar.FlyGrabExposureTime);
HikCamera.Instance.SetGain("locationCamera", GlobalVar.FlyGrabGain);
}
if(NozzleManager.GetNozzlesByStatus(ENozzleStatus.ToUnload)[0].ToType== TurnoverType.Turnover)
if(NozzleManager.GetNozzlesByStatus(ENozzleStatus.ToUnload).Count>0)
{
needGrabNum = NozzleManager.GetNozzlesByStatus(ENozzleStatus.ToUnload).Count();
errCode = AxisControl.LoadX.MovePos(SysConfigParam.GetValue<double>($"Nozzle{needGrabNum}CenterX") - 30, GlobalVar.WholeSpeed);
if(errCode== ErrorCode.Ok || GlobalVar.VirtualAxis)
if (NozzleManager.GetNozzlesByStatus(ENozzleStatus.ToUnload)[0].ToType == TurnoverType.Turnover)
{
errCode= AxisControl.LoadY.MovePos(SysConfigParam.GetValue<double>($"Nozzle8CenterY"), GlobalVar.WholeSpeed);
if(errCode== ErrorCode.Ok|| GlobalVar.VirtualAxis)
needGrabNum = NozzleManager.GetNozzlesByStatus(ENozzleStatus.ToUnload).Count();
errCode = AxisControl.LoadX.MovePos(SysConfigParam.GetValue<double>($"Nozzle{needGrabNum}CenterX") - 30, GlobalVar.WholeSpeed);
if (errCode == ErrorCode.Ok || GlobalVar.VirtualAxis)
{
flowStep = EDischargeFlowStep.;
errCode = AxisControl.LoadY.MovePos(SysConfigParam.GetValue<double>($"Nozzle8CenterY"), GlobalVar.WholeSpeed);
if (errCode == ErrorCode.Ok || GlobalVar.VirtualAxis)
{
flowStep = EDischargeFlowStep.;
}
}
}
}
else
{
errCode = AxisControl.LoadX.MovePos(SysConfigParam.GetValue<double>("Nozzle1CenterX") + 30, GlobalVar.WholeSpeed);
if(errCode== ErrorCode.Ok || GlobalVar.VirtualAxis)
else
{
errCode = AxisControl.LoadY.MovePos(SysConfigParam.GetValue<double>("Nozzle1CenterY"), GlobalVar.WholeSpeed);
if(errCode== ErrorCode.Ok || GlobalVar.VirtualAxis)
errCode = AxisControl.LoadX.MovePos(SysConfigParam.GetValue<double>("Nozzle1CenterX") + 30, GlobalVar.WholeSpeed);
if (errCode == ErrorCode.Ok || GlobalVar.VirtualAxis)
{
flowStep = EDischargeFlowStep.;
errCode = AxisControl.LoadY.MovePos(SysConfigParam.GetValue<double>("Nozzle1CenterY"), GlobalVar.WholeSpeed);
if (errCode == ErrorCode.Ok || GlobalVar.VirtualAxis)
{
flowStep = EDischargeFlowStep.;
}
else
{
MsgBox.ShowAxisAlarmDialog(AxisControl.LoadY, errCode);
}
}
else
{
MsgBox.ShowAxisAlarmDialog(AxisControl.LoadY, errCode);
MsgBox.ShowAxisAlarmDialog(AxisControl.LoadX, errCode);
}
}
else
{
MsgBox.ShowAxisAlarmDialog(AxisControl.LoadX, errCode);
}
}
else
{
flowStep = EDischargeFlowStep.;
}
}
@ -940,7 +946,7 @@ namespace Rs.MotionPlat.Flow
{
//如果吸嘴是1并且最后一列
downSlot = GlobalTray.MultiTray.GetSlot(ESlotStatus.NotHave);
#region 为了解决第一个吸嘴到不了最后两列的问题,新的料盘已经不存在这个问题
#region 为了解决第一个吸嘴到不了最后一列的问题
if (curNozzle.NozzleIndex == 1 && downSlot != null && (downSlot.Column == 0))
{
if (downSlot.Column == 0)
@ -1307,6 +1313,8 @@ namespace Rs.MotionPlat.Flow
}
else
{
logInfo = GetClassName() + $"排料吸嘴{curNozzle.NozzleIndex}号SN={curNozzle.SN}放{WitchTrayWitchSlot(curNozzle.ToType, curNozzle.ToIndex)}";
MessageQueue.Instance.Insert(logInfo);
curNozzle.VacSuction(EIoOperate.Close);
flowStep = EDischargeFlowStep.;
}
@ -1507,7 +1515,7 @@ namespace Rs.MotionPlat.Flow
}
else
{
OnShowGrabResult?.Invoke(new VisionResult(),false);
OnShowGrabResult?.Invoke(vr,false);
}
}
//OnUpCameraGrabResult?.Invoke(result);
@ -1568,7 +1576,7 @@ namespace Rs.MotionPlat.Flow
}
else
{
OnShowGrabResult?.Invoke(new VisionResult(),false);
OnShowGrabResult?.Invoke(vr,false);
}
}
//OnUpCameraGrabResult?.Invoke(result);

@ -0,0 +1,194 @@
using Rs.Controls;
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.SubFlow
{
enum EFiberWarningPressFlowStep
{
,
,
1,
1,
2,
2,
,
}
/// <summary>
///
/// 当光纤报警时,主动去压一次
/// </summary>
public class FiberWarningPressFlow
{
private static FiberWarningPressFlow instance;
public static FiberWarningPressFlow Instance
{
get
{
if (instance == null)
instance = new FiberWarningPressFlow();
return instance;
}
}
private string logInfo = string.Empty;
private EFiberWarningPressFlowStep step = EFiberWarningPressFlowStep.;
private double targetPos = 0.0;
ErrorCode errCode = ErrorCode.Ok;
bool finished = true;
/// <summary>
/// 当出现光纤异常时,下嘴下压一次
/// </summary>
public void Press()
{
if (finished)
{
finished = false;
}
else
{
return;
}
targetPos = 0.0;
step = EFiberWarningPressFlowStep.;
while (!finished)
{
if (MachineManage.Instance.MachineStatus == EMachineStatus.Stop)
{
Thread.Sleep(10);
continue;
}
switch (step)
{
case EFiberWarningPressFlowStep.:
targetPos = SysConfigParam.GetValue<double>("PressDumpX");
errCode = AxisControl.TurnoverX.MovePos(targetPos, GlobalVar.WholeSpeed);
if (errCode == Motion.ErrorCode.Ok || GlobalVar.VirtualAxis)
{
targetPos = SysConfigParam.GetValue<double>("PressDumpY");
errCode = AxisControl.TurnoverY.MovePos(targetPos, GlobalVar.WholeSpeed);
if (errCode == Motion.ErrorCode.Ok || GlobalVar.VirtualAxis)
{
if (GlobalVar.VirtualAxis)
{
Thread.Sleep(GlobalVar.VirtualAxisMoveTime);
}
logInfo = GetClassName() + $"到测试放料位上方";
MessageQueue.Instance.Insert(logInfo);
step = EFiberWarningPressFlowStep.;
}
else
{
MsgBox.ShowAxisAlarmDialog(AxisControl.TurnoverY, errCode);
}
}
else
{
MsgBox.ShowAxisAlarmDialog(AxisControl.TurnoverX, errCode);
}
break;
case EFiberWarningPressFlowStep.:
if (Ops.IsStop(AxisControl.TurnoverX, AxisControl.TurnoverY) || GlobalVar.VirtualAxis)
{
step = EFiberWarningPressFlowStep.1;
}
break;
case EFiberWarningPressFlowStep.1:
targetPos = SysConfigParam.GetValue<double>("PressDumpZ") + GlobalVar.PressLowSpeedOffset;
errCode = AxisControl.TurnoverZ.MovePos(targetPos, GlobalVar.WholeSpeed);
if (errCode == Motion.ErrorCode.Ok || GlobalVar.VirtualAxis)
{
if (GlobalVar.VirtualAxis)
{
Thread.Sleep(GlobalVar.VirtualAxisMoveTime);
}
logInfo = GetClassName() + $"到测试放料位下方1";
MessageQueue.Instance.Insert(logInfo);
step = EFiberWarningPressFlowStep.1;
}
else
{
MsgBox.ShowAxisAlarmDialog(AxisControl.TurnoverZ, errCode);
}
break;
case EFiberWarningPressFlowStep.1:
if (Ops.IsStop(AxisControl.TurnoverZ) || GlobalVar.VirtualAxis)
{
logInfo = GetClassName() + $"已运动到到测试放料位下方1 TurnoverZ at:{Ops.GetCurPosition(AxisAlias.TurnoverZ)}";
MessageQueue.Instance.Insert(logInfo);
step = EFiberWarningPressFlowStep.2;
}
break;
case EFiberWarningPressFlowStep.2:
targetPos = SysConfigParam.GetValue<double>("PressDumpZ");
errCode = AxisControl.TurnoverZ.MovePos(targetPos, GlobalVar.PressLowSpeed);
if (errCode == Motion.ErrorCode.Ok || GlobalVar.VirtualAxis)
{
if (GlobalVar.VirtualAxis)
{
Thread.Sleep(GlobalVar.VirtualAxisMoveTime);
}
logInfo = GetClassName() + $"到测试放料位下方2";
MessageQueue.Instance.Insert(logInfo);
LogHelper.Debug(logInfo);
step = EFiberWarningPressFlowStep.2;
}
else
{
MsgBox.ShowAxisAlarmDialog(AxisControl.TurnoverZ, errCode);
}
break;
case EFiberWarningPressFlowStep.2:
if (Ops.IsStop(AxisControl.TurnoverZ) || GlobalVar.VirtualAxis)
{
Thread.Sleep(1000);
step = EFiberWarningPressFlowStep.;
}
break;
case EFiberWarningPressFlowStep.:
targetPos = SysConfigParam.GetValue<double>("PressSafeZ");
errCode = AxisControl.TurnoverZ.MovePos(targetPos, GlobalVar.WholeSpeed);
if (errCode == Motion.ErrorCode.Ok || GlobalVar.VirtualAxis)
{
if (GlobalVar.VirtualAxis)
{
Thread.Sleep(GlobalVar.VirtualAxisMoveTime);
}
logInfo = GetClassName() + $"测试位下压完成抬起";
MessageQueue.Instance.Insert(logInfo);
step = EFiberWarningPressFlowStep.;
}
else
{
MsgBox.ShowAxisAlarmDialog(AxisControl.TurnoverZ, errCode);
}
break;
case EFiberWarningPressFlowStep.:
if (Ops.IsStop(AxisControl.TurnoverZ) || GlobalVar.VirtualAxis)
{
logInfo = GetClassName() + $"测试位下压完成抬起完成";
MessageQueue.Instance.Insert(logInfo);
finished = true;
}
break;
}
}
}
private string GetClassName()
{
return "FiberWarningPressFlow-";
}
}
}

@ -189,6 +189,7 @@
<Compile Include="Flow\LoadAndUnloadTask.cs" />
<Compile Include="Flow\MachineManage.cs" />
<Compile Include="Flow\MonitorSystemButton.cs" />
<Compile Include="Flow\SubFlow\FiberWarningPressFlow.cs" />
<Compile Include="Flow\SubFlow\UpCameraScanBarCodeFlow.cs" />
<Compile Include="Flow\SubFlow\WarningSuckerNgFlow.cs" />
<Compile Include="Flow\RearrangeFlow.cs" />

@ -33,6 +33,7 @@
this.btnSocketExceptionGoSafePoint = new System.Windows.Forms.Button();
this.btnTransiteNozzleExceptionGoSafePoint = new System.Windows.Forms.Button();
this.btnTurnoverTrayExceptionGoSafePoint = new System.Windows.Forms.Button();
this.btnTransitNozzlePress = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// btnTurnoverSlotException
@ -85,11 +86,22 @@
this.btnTurnoverTrayExceptionGoSafePoint.UseVisualStyleBackColor = true;
this.btnTurnoverTrayExceptionGoSafePoint.Click += new System.EventHandler(this.btnTurnoverTrayExceptionGoSafePoint_Click);
//
// btnTransitNozzlePress
//
this.btnTransitNozzlePress.Location = new System.Drawing.Point(12, 96);
this.btnTransitNozzlePress.Name = "btnTransitNozzlePress";
this.btnTransitNozzlePress.Size = new System.Drawing.Size(152, 37);
this.btnTransitNozzlePress.TabIndex = 0;
this.btnTransitNozzlePress.Text = "周转吸嘴下压";
this.btnTransitNozzlePress.UseVisualStyleBackColor = true;
this.btnTransitNozzlePress.Click += new System.EventHandler(this.btnTransitNozzlePress_Click);
//
// TestFrm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1336, 854);
this.Controls.Add(this.btnTransitNozzlePress);
this.Controls.Add(this.btnTurnoverTrayExceptionGoSafePoint);
this.Controls.Add(this.btnTransiteNozzleExceptionGoSafePoint);
this.Controls.Add(this.btnSocketExceptionGoSafePoint);
@ -108,5 +120,6 @@
private System.Windows.Forms.Button btnSocketExceptionGoSafePoint;
private System.Windows.Forms.Button btnTransiteNozzleExceptionGoSafePoint;
private System.Windows.Forms.Button btnTurnoverTrayExceptionGoSafePoint;
private System.Windows.Forms.Button btnTransitNozzlePress;
}
}

@ -1,5 +1,6 @@
using Rs.MotionPlat.Flow.NgFlow;
using Rs.MotionPlat.Flow.SafePosFlow;
using Rs.MotionPlat.Flow.SubFlow;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@ -45,5 +46,10 @@ namespace Rs.MotionPlat
{
TransitModuleSafePosFlow.Instance.GoSafePostion(Commom.EExceptionSafePos.TurnoverTray);
}
private void btnTransitNozzlePress_Click(object sender, EventArgs e)
{
FiberWarningPressFlow.Instance.Press();
}
}
}

Loading…
Cancel
Save