1、增加复测时最后托盘检测功能

2、优化搬运INPUT料盘到EMPTY1两次的问题
develop
lhiven 9 months ago
parent 90a20806b8
commit e69e104658

@ -1001,6 +1001,34 @@ namespace Rs.MotionPlat.Commom
public SchedulingAlarms(params AlarmItem[] items) => Alarms = items;
}
/// <summary>
/// 料仓托盘检查
/// </summary>
public class SchedulingCheckTray : Scheduling
{
/// <summary>
/// 料仓类型
/// </summary>
public SchedulingSiloBase.ESiloType Type { get; set; }
/// <summary>
/// 产品数量
/// </summary>
public int ProductCount { get; set; }
#region 反序列化以及相等比较
public static explicit operator SchedulingCheckTray(string json) => JsonConvert.DeserializeObject<SchedulingCheckTray>(json);
public override bool Equals(object obj) => Equals(obj as SchedulingCheckTray);
public bool Equals(SchedulingCheckTray other)
=> Equals(other as Scheduling)
&& Equals(other.Type, Type)
&& Equals(other.ProductCount, ProductCount);
#endregion
}
/// <summary>
/// 指令
/// </summary>
@ -1151,7 +1179,15 @@ namespace Rs.MotionPlat.Commom
/// <summary>
/// 移动周转轴到安全位
/// </summary>
MoveTurnoverArmToSafePoint
MoveTurnoverArmToSafePoint,
/// <summary>
/// 检查托盘 发送<see cref="SchedulingCheckTray"/>, 收到后原路返回
/// </summary>
CheckTray,
/// <summary>
/// 托盘检查结果, 排料机发送<see cref="SchedulingCheckTray"/>, 中控不做回复
/// </summary>
CheckTrayResult,
}
/// <summary>

@ -144,6 +144,10 @@ namespace Rs.MotionPlat.Flow
private bool stop = true;
private bool run = true;
/// <summary>
/// 最后一次取料索引
/// </summary>
private int lastTaskSlotIndex = 0;
public void Init()
{
mainTask = new Task(Run);
@ -266,6 +270,7 @@ namespace Rs.MotionPlat.Flow
}
if (slot != null)
{
lastTaskSlotIndex = slot.Index;
curSlotPoint = TrayPointManager.GetSlotPoint(ETrayType.Input, slot.Index);
curNozzle.FromIndex = slot.Index - 1;
logInfo = GetClassName() + $"排料{curNozzle.NozzleIndex}号吸嘴到{curTask.FromType.ToString()}盘{curNozzle.FromIndex + 1}号穴位取料";
@ -321,6 +326,7 @@ namespace Rs.MotionPlat.Flow
TakeTrayFlow.Instance.Take(ETrayType.Input, ETrayType.Empty1,
() =>
{
StockManager.Instance.GetStock(ETrayType.Input).PreLoad();
Task.Run(() =>
{
StockManager.Instance.GetStock(ETrayType.Input).Load(EStockTrayLoadMode.Whole, null);
@ -333,7 +339,7 @@ namespace Rs.MotionPlat.Flow
StockManager.Instance.GetStock(ETrayType.Empty1).Unload(EStockTrayUnLoadMode.Whole, null);
});
});
StockManager.Instance.GetStock(ETrayType.Input).WaitFinished();
StockManager.Instance.GetStock(ETrayType.Input).LoadedOK();
}
}
break;
@ -2836,6 +2842,15 @@ namespace Rs.MotionPlat.Flow
scanNum = 0;
}
/// <summary>
/// 获取最后一次取Input盘的穴位索引
/// </summary>
/// <returns></returns>
public int GetLastTakeSlotIndex()
{
return lastTaskSlotIndex;
}
///// <summary>
///// 检测XY是否在目标位置上
///// </summary>

@ -505,7 +505,10 @@ namespace Rs.AutoDischarge.V3.Flow
return true;
}
public void PreLoad()
{
actionFinishedEvent.Reset();
}
public void Reset()
{
finished = true;
@ -518,8 +521,24 @@ namespace Rs.AutoDischarge.V3.Flow
/// 等待搬运任务完成
/// </summary>
public void WaitFinished()
{
Thread.Sleep(1000);
actionFinishedEvent.WaitOne();
}
public void LoadedOK()
{
actionFinishedEvent.WaitOne();
while( true ) {
if (Ops.IsOn($"{(int)m_stockType}号料仓料盘到位光电检测") || GlobalVar.VirtualAxis)
{
break;
}
else
{
Thread.Sleep(100);
}
}
}
public bool Unload(EStockTrayUnLoadMode unLoadMode, Action unloadFinishedEvent)

@ -5,6 +5,7 @@ using Rs.AutoDischarge.V3.Flow;
using Rs.Controls;
using Rs.Framework;
using Rs.MotionPlat.Commom;
using Rs.MotionPlat.Flow.Camera;
using Rs.MotionPlat.Flow.SafePosFlow;
using Rs.MotionPlat.Flow.SubFlow;
using System;
@ -25,6 +26,7 @@ namespace Rs.MotionPlat.Flow
public class TestCenter
{
TcpClientHelper client = new TcpClientHelper("127.0.0.1",2048);
//TcpClientHelper client = new TcpClientHelper("192.168.31.120", 2048);
SchedulingResult schedulResult = new SchedulingResult();
SchedulingMaterial sm;
Dictionary<int, AlarmItem> alarmInfos = new Dictionary<int, AlarmItem>();
@ -145,6 +147,7 @@ namespace Rs.MotionPlat.Flow
{
foreach (string json in Scheduling.GetJsons(msg))
{
//MachineManage.Instance.SetLoadUnloadStatus(ERunState.Waiting);
Scheduling schedule = JsonConvert.DeserializeObject<Scheduling>(json);
EInstruction eInstructioneInstruction = schedule.Instruction;
if (eInstructioneInstruction != EInstruction.InquireStatus)
@ -153,6 +156,35 @@ namespace Rs.MotionPlat.Flow
}
switch (eInstructioneInstruction)
{
case EInstruction.CheckTray:
MachineManage.Instance.SetLoadUnloadStatus(ERunState.Busying);
ReportToTestCenter(schedule);
//这里开始检测料盘
List<int> hasProduct = new List<int>();
SchedulingCheckTray checkTraySchedule = (SchedulingCheckTray)json;
int checkNum = checkTraySchedule.ProductCount;
int lastIndex = DischargeFlow.Instance.GetLastTakeSlotIndex();
for(int i=0;i<checkNum;i++)
{
lastIndex++;
if(lastIndex <= (GlobalTray.InputTray.RowNum * GlobalTray.InputTray.ColumnNum))
{
SlotProductHasOrNotResult result = UpCameraCheckFlow.Instance.CheckStockTrayHasProduct(ETrayType.Input, lastIndex, true);
if (result.HasProduct)
{
hasProduct.Add(lastIndex);
}
}
else
{
break;
}
}
checkTraySchedule.Instruction = EInstruction.CheckTrayResult;
checkTraySchedule.ProductCount = hasProduct.Count;
ReportToTestCenter(checkTraySchedule);
MachineManage.Instance.SetLoadUnloadStatus(ERunState.Waiting);
break;
case EInstruction.MoveTurnoverArmToSafePoint:
ReportToTestCenter(schedule);
Task.Run(() => {

@ -31,6 +31,6 @@ using System.Runtime.InteropServices;
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
[assembly: AssemblyVersion("3.20.24.45")]
[assembly: AssemblyVersion("3.20.24.51")]
//[assembly: AssemblyVersion("1.0.0.0")]
//[assembly: AssemblyFileVersion("1.0.0.0")]

Loading…
Cancel
Save