|
@@ -58,10 +58,10 @@ namespace Venus_RT.Modules.Schedulers
|
|
|
private SchedulerItem _currentScheduler = null;
|
|
|
private int _singleArmOption = 0;
|
|
|
|
|
|
- public SchedulerSETMRobot(ModuleName module) : base(module.ToString())
|
|
|
+ public SchedulerSETMRobot() : base(ModuleName.TMRobot.ToString())
|
|
|
{
|
|
|
_entity = Singleton<RouteManager>.Instance.seTM;
|
|
|
- _singleArmOption = SC.GetValue<int>($"{module}.SingleArmOption");
|
|
|
+ _singleArmOption = SC.GetValue<int>($"SETM.SingleArmOption");
|
|
|
}
|
|
|
|
|
|
public bool PostMoveItems(MoveItem[] items)
|
|
@@ -330,6 +330,81 @@ namespace Venus_RT.Modules.Schedulers
|
|
|
RunSchedulers();
|
|
|
return true;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ public bool SendMoveItems(MoveItem[] items)
|
|
|
+ {
|
|
|
+ for (int i = 1; i < items.Length; i++)
|
|
|
+ {
|
|
|
+ if (items[i - 1].Module != items[i].Module)
|
|
|
+ {
|
|
|
+ LOG.Write(eEvent.ERR_ROUTER, ModuleName.TMRobot, $"the actions for {items[i - 1].Module} and for {items[i].Module} should not put together");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ void PackMoveItems(SETMEntity.MSG cmdType, MoveItem[] actions)
|
|
|
+ {
|
|
|
+ SchedulerItem schItem = new SchedulerItem();
|
|
|
+ schItem.MoveType = cmdType;
|
|
|
+ schItem.target = actions[0].DestinationModule;
|
|
|
+ schItem.moveList = new Queue<MoveItem>();
|
|
|
+ foreach (var ac in actions)
|
|
|
+ {
|
|
|
+ schItem.moveList.Enqueue(ac);
|
|
|
+ }
|
|
|
+ _schedulerList.Enqueue(schItem);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (ModuleHelper.IsTMRobot(items[0].DestinationModule)) // pick
|
|
|
+ {
|
|
|
+ if(items.Length == 1)
|
|
|
+ {
|
|
|
+ PackMoveItems(ModuleHelper.IsPm(items[0].SourceModule) ? SETMEntity.MSG.PMPick : SETMEntity.MSG.Pick, items);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (ModuleHelper.IsPm(items[0].SourceModule))
|
|
|
+ {
|
|
|
+ if(items.Length == 2 && items[0].SourceModule == items[1].DestinationModule && ModuleHelper.IsTMRobot(items[1].SourceModule))
|
|
|
+ {
|
|
|
+ PackMoveItems(SETMEntity.MSG.PMSwap, items);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (ModuleHelper.IsLoadPort(items[0].SourceModule) && !items.ToList().Exists(mv => mv.SourceModule != items[0].SourceModule && mv.DestinationModule != items[0].SourceModule))
|
|
|
+ {
|
|
|
+ PackMoveItems(SETMEntity.MSG.Swap, items);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (ModuleHelper.IsTMRobot(items[0].SourceModule)) // place
|
|
|
+ {
|
|
|
+ if(items.Length == 1)
|
|
|
+ {
|
|
|
+ PackMoveItems(ModuleHelper.IsPm(items[0].DestinationModule) ? SETMEntity.MSG.PMPlace : SETMEntity.MSG.Place, items);
|
|
|
+ }
|
|
|
+ else if (ModuleHelper.IsLoadPort(items[0].DestinationModule) && !items.ToList().Exists(mv => mv.SourceModule != items[0].DestinationModule && mv.DestinationModule != items[0].DestinationModule))
|
|
|
+ {
|
|
|
+ PackMoveItems(SETMEntity.MSG.Swap, items);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(_schedulerList.Count == 0)
|
|
|
+ {
|
|
|
+ foreach (var item in items)
|
|
|
+ {
|
|
|
+ LOG.Write(eEvent.WARN_ROUTER, ModuleName.TMRobot, $"Wrong move action package: {item.SourceModule} Slot {item.SourceSlot + 1} => {item.DestinationModule} Slot {item.DestinationSlot + 1}");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ foreach (var item in items)
|
|
|
+ {
|
|
|
+ LOG.Write(eEvent.EV_ROUTER, ModuleName.TMRobot, $"Post Moving Item: {item.SourceModule} Slot {item.SourceSlot + 1} => {item.DestinationModule} Slot {item.DestinationSlot + 1}");
|
|
|
+ }
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
bool RunSchedulers()
|
|
|
{
|
|
|
//非运行状态
|