优化轴乱跑的问题

master
lhiven 11 months ago
parent cbec60bc50
commit ed93576c44

@ -116,7 +116,7 @@ namespace Rs.MotionPlat.Flow
/// <summary>
/// 最后一次换料的治具编号
/// </summary>
private int lastFixtureIndex = 0;
//private int lastFixtureIndex = 0;
List<int> checkFixtureList = new List<int>();
public void Init()
{
@ -152,13 +152,15 @@ namespace Rs.MotionPlat.Flow
// GlobalTray.NgTray.ChangeStatus(ESlotStatus.NotHave);
//}
//EButtonType button = Msgbox.ShowDialog(EButtonType.Ok | EButtonType.Cancel, "请确认 LOT 信息 信息正确 选择OK 信息错误退出重写 选择Cancel");
EButtonType button =Msgbox.ShowTipDialog(EButtonType.Ok | EButtonType.Cancel, "请确认 LOT信息\r\n信息正确 选择OK\r\n信息错误退出重写 选择Cancel");
EButtonType button =Msgbox.ShowTipDialog(EButtonType.Ok | EButtonType.Cancel, $"请确认 LOT信息:{GlobalVar.LotName}\r\n信息正确 选择OK\r\n信息错误退出重写 选择Cancel");
if(button== EButtonType.Ok)
{
button = Msgbox.ShowTipDialog(EButtonType.Ok | EButtonType.Cancel, "是否清除之前数据?\r\n清除点击OK\r\n不清楚点击Cancel");
if(button== EButtonType.Ok)
{
lastFixtureIndex = TestFixtureManager.Instance.GetEnableFixtureList().Select(f => f.Index).Min() - 1;
//lastFixtureIndex = TestFixtureManager.Instance.GetEnableFixtureList().Select(f => f.Index).Min() - 1;
CreateCheckFixtureQueue(6);
//lastFixtureIndex = checkFixtureList[0] - 1;
TestFixtureManager.Instance.GetTestFixture(1).ClearData();
TestFixtureManager.Instance.GetTestFixture(2).ClearData();
TestFixtureManager.Instance.GetTestFixture(3).ClearData();
@ -436,18 +438,23 @@ namespace Rs.MotionPlat.Flow
//治具换料
case EDischargeFlowStep.:
//先去第一个治具拍照位上方等待
if(TestFixtureManager.Instance.GetTestFixture(lastFixtureIndex+1).Product==null)
//if(TestFixtureManager.Instance.GetTestFixture(lastFixtureIndex+1).Product==null)
if (TestFixtureManager.Instance.GetTestFixture(checkFixtureList[0]).Product == null)
{
targetPosition = FixtureManager.GetFixtureGrabPos(lastFixtureIndex + 1);
//targetPosition = FixtureManager.GetFixtureGrabPos(lastFixtureIndex + 1);
targetPosition = FixtureManager.GetFixtureGrabPos(checkFixtureList[0]);
}
else
{
targetPosition = NozzleManager.GetNozzleToFixturePos(lastFixtureIndex + 1, NozzleManager.GetIdelNozzle().NozzleIndex);
targetPosition.X += TestFixtureManager.Instance.GetTestFixture(lastFixtureIndex + 1).PlaceProductOffsetX;
targetPosition.Y2 += TestFixtureManager.Instance.GetTestFixture(lastFixtureIndex + 1).PlaceProductOffsetY;
//targetPosition = NozzleManager.GetNozzleToFixturePos(lastFixtureIndex + 1, NozzleManager.GetIdelNozzle().NozzleIndex);
//targetPosition.X += TestFixtureManager.Instance.GetTestFixture(lastFixtureIndex + 1).PlaceProductOffsetX;
//targetPosition.Y2 += TestFixtureManager.Instance.GetTestFixture(lastFixtureIndex + 1).PlaceProductOffsetY;
targetPosition = NozzleManager.GetNozzleToFixturePos(checkFixtureList[0], NozzleManager.GetIdelNozzle().NozzleIndex);
targetPosition.X += TestFixtureManager.Instance.GetTestFixture(checkFixtureList[0]).PlaceProductOffsetX;
targetPosition.Y2 += TestFixtureManager.Instance.GetTestFixture(checkFixtureList[0]).PlaceProductOffsetY;
}
if(targetPosition.X-GlobalVar.FixtureSafePosX>50)
if (targetPosition.X-GlobalVar.FixtureSafePosX>50)
{
DischargeModuleGoSafePosFlow.Instance.GoSafePostion(ESafePosSide.PlaceToFixture);
}
@ -463,7 +470,7 @@ namespace Rs.MotionPlat.Flow
AxisPosPrint.PrintXY1Y2CurrentPos("轴loadx,loady1,loady2已停止运动,",GetClassName());
if(AxisArrived.LoadXY1Y2IsArrived(targetPosition.X, targetPosition.Y1, targetPosition.Y2))
{
CreateCheckFixtureQueue();
//CreateCheckFixtureQueue();
AxisPosPrint.PrintXY1Y2CurrentPos("已运动到放料缓冲位,", GetClassName());
flowStep = EDischargeFlowStep.;
}
@ -556,7 +563,9 @@ namespace Rs.MotionPlat.Flow
if(needPlaceNozzle!=null)
{
FixturePlaceFlow.Instance.Place(curFixture.Index, needPlaceNozzle.NozzleIndex);
lastFixtureIndex = curFixture.Index == checkFixtureList.Max() ? checkFixtureList.Min()-1 : curFixture.Index;
CreateCheckFixtureQueue(curFixture.Index);
//lastFixtureIndex = checkFixtureList[0] - 1;
//lastFixtureIndex = curFixture.Index == checkFixtureList.Max() ? checkFixtureList.Min()-1 : curFixture.Index;
//lastFixtureIndex = curFixture.Index == 6 ? 0 : curFixture.Index;
if (NozzleManager.GetToTestNozzle() != null || (GlobalVar.Clear && TestFixtureManager.Instance.GetHasProuctFixtureCount()>0))
{
@ -841,12 +850,12 @@ namespace Rs.MotionPlat.Flow
/// <summary>
/// 生成检测治具状态的队列
/// </summary>
void CreateCheckFixtureQueue()
void CreateCheckFixtureQueue(int lastIndex)
{
checkFixtureList.Clear();
for (int i = 0; i < 6; i++)
{
int number = ((lastFixtureIndex+1) + i - 1) % 6 + 1;
int number = ((lastIndex + 1) + i - 1) % 6 + 1;
if(TestFixtureManager.Instance.GetTestFixture(number).Enable)
{
checkFixtureList.Add(number);

Loading…
Cancel
Save