diff --git a/Rs.SkyLine/Commom/Scheduling.cs b/Rs.SkyLine/Commom/Scheduling.cs index 4de7b4b..c8ee1ca 100644 --- a/Rs.SkyLine/Commom/Scheduling.cs +++ b/Rs.SkyLine/Commom/Scheduling.cs @@ -1001,6 +1001,34 @@ namespace Rs.MotionPlat.Commom public SchedulingAlarms(params AlarmItem[] items) => Alarms = items; } + /// + /// 料仓托盘检查 + /// + public class SchedulingCheckTray : Scheduling + { + /// + /// 料仓类型 + /// + public SchedulingSiloBase.ESiloType Type { get; set; } + /// + /// 产品数量 + /// + public int ProductCount { get; set; } + + #region 反序列化以及相等比较 + public static explicit operator SchedulingCheckTray(string json) => JsonConvert.DeserializeObject(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 + } + /// /// 指令 /// @@ -1151,7 +1179,15 @@ namespace Rs.MotionPlat.Commom /// /// 移动周转轴到安全位 /// - MoveTurnoverArmToSafePoint + MoveTurnoverArmToSafePoint, + /// + /// 检查托盘 发送, 收到后原路返回 + /// + CheckTray, + /// + /// 托盘检查结果, 排料机发送, 中控不做回复 + /// + CheckTrayResult, } /// diff --git a/Rs.SkyLine/Flow/NormalFlow/DischargeFlow.cs b/Rs.SkyLine/Flow/NormalFlow/DischargeFlow.cs index 9376c78..51d5638 100644 --- a/Rs.SkyLine/Flow/NormalFlow/DischargeFlow.cs +++ b/Rs.SkyLine/Flow/NormalFlow/DischargeFlow.cs @@ -144,6 +144,10 @@ namespace Rs.MotionPlat.Flow private bool stop = true; private bool run = true; + /// + /// 最后一次取料索引 + /// + 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; } + /// + /// 获取最后一次取Input盘的穴位索引 + /// + /// + public int GetLastTakeSlotIndex() + { + return lastTaskSlotIndex; + } + ///// ///// 检测XY是否在目标位置上 ///// diff --git a/Rs.SkyLine/Flow/NormalFlow/StockTrayFlow.cs b/Rs.SkyLine/Flow/NormalFlow/StockTrayFlow.cs index 72ccf70..3486b5a 100644 --- a/Rs.SkyLine/Flow/NormalFlow/StockTrayFlow.cs +++ b/Rs.SkyLine/Flow/NormalFlow/StockTrayFlow.cs @@ -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 /// 等待搬运任务完成 /// 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) diff --git a/Rs.SkyLine/Flow/TestCenter.cs b/Rs.SkyLine/Flow/TestCenter.cs index 4565c8a..ce58fe6 100644 --- a/Rs.SkyLine/Flow/TestCenter.cs +++ b/Rs.SkyLine/Flow/TestCenter.cs @@ -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 alarmInfos = new Dictionary(); @@ -145,6 +147,7 @@ namespace Rs.MotionPlat.Flow { foreach (string json in Scheduling.GetJsons(msg)) { + //MachineManage.Instance.SetLoadUnloadStatus(ERunState.Waiting); Scheduling schedule = JsonConvert.DeserializeObject(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 hasProduct = new List(); + SchedulingCheckTray checkTraySchedule = (SchedulingCheckTray)json; + int checkNum = checkTraySchedule.ProductCount; + int lastIndex = DischargeFlow.Instance.GetLastTakeSlotIndex(); + for(int i=0;i { diff --git a/Rs.SkyLine/Properties/AssemblyInfo.cs b/Rs.SkyLine/Properties/AssemblyInfo.cs index d29ac7e..c1a4c76 100644 --- a/Rs.SkyLine/Properties/AssemblyInfo.cs +++ b/Rs.SkyLine/Properties/AssemblyInfo.cs @@ -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")]