|
|
@@ -11,6 +11,7 @@ using System.Collections.Generic;
|
|
|
using System.Linq;
|
|
|
using System.Text;
|
|
|
using System.Threading.Tasks;
|
|
|
+using System.Windows.Markup;
|
|
|
|
|
|
namespace PunkHPX8_RT.Modules
|
|
|
{
|
|
|
@@ -20,11 +21,14 @@ namespace PunkHPX8_RT.Modules
|
|
|
{
|
|
|
ReservoirHome,
|
|
|
ReservoirHomeWait,
|
|
|
+ WaitMatcherIdle,
|
|
|
CellHome,
|
|
|
End,
|
|
|
}
|
|
|
#region 内部变量
|
|
|
private ReservoirEntity _reservoirEntity;
|
|
|
+ private PlatingCellEntity _platingCellEntity;
|
|
|
+ private string _matcher = "";
|
|
|
#endregion
|
|
|
/// <summary>
|
|
|
/// 构造函数
|
|
|
@@ -48,6 +52,7 @@ namespace PunkHPX8_RT.Modules
|
|
|
{
|
|
|
Runner.RunIf(ReservoirStep.ReservoirHome, _reservoirEntity.IsAuto, ReservoirHome, _delay_1ms)
|
|
|
.WaitWithStopConditionIf(ReservoirStep.ReservoirHomeWait,_reservoirEntity.IsAuto,() => { return _reservoirEntity.IsIdle; }, () => { return _reservoirEntity.State != ReservoirState.Initializing && !_reservoirEntity.IsIdle; })
|
|
|
+ .Wait(ReservoirStep.WaitMatcherIdle,ChechMatcherIdle,_delay_2m)
|
|
|
.Run(ReservoirStep.CellHome, MetalsHome, _delay_1ms)
|
|
|
.End(ReservoirStep.End, NullFun, _delay_1ms);
|
|
|
return Runner.Status;
|
|
|
@@ -62,30 +67,67 @@ namespace PunkHPX8_RT.Modules
|
|
|
return reservoirInvoke==(int)ReservoirMsg.Initialize;
|
|
|
}
|
|
|
/// <summary>
|
|
|
- /// Metal Home
|
|
|
+ /// 检验匹配另一个是否完成Idle
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
- private bool MetalsHome()
|
|
|
+ private bool ChechMatcherIdle()
|
|
|
{
|
|
|
ReservoirItem reservoirItem = ReservoirItemManager.Instance.GetReservoirItem(Module.ToString());
|
|
|
- if (reservoirItem != null)
|
|
|
+ if (reservoirItem == null)
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ List<PlatingCellItem> platingCellItems = reservoirItem.PlatingCells;
|
|
|
+ if (platingCellItems == null || platingCellItems.Count == 0)
|
|
|
{
|
|
|
- List<PlatingCellItem> platingCellItems = reservoirItem.PlatingCells;
|
|
|
- if (platingCellItems != null && platingCellItems.Count > 0)
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ foreach (PlatingCellItem item in platingCellItems)
|
|
|
+ {
|
|
|
+ if (!item.Installed)
|
|
|
{
|
|
|
- foreach (PlatingCellItem item in platingCellItems)
|
|
|
- {
|
|
|
- if (item.Installed)
|
|
|
- {
|
|
|
- PlatingCellEntity moduleEntity = Singleton<RouteManager>.Instance.GetModule<PlatingCellEntity>(item.ModuleName);
|
|
|
- if (moduleEntity.IsAuto)
|
|
|
- {
|
|
|
- moduleEntity.Invoke("HomeAll");
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ continue;
|
|
|
}
|
|
|
+ _platingCellEntity= Singleton<RouteManager>.Instance.GetModule<PlatingCellEntity>(item.ModuleName);
|
|
|
+ _matcher=ModuleMatcherManager.Instance.GetMatcherByModule(item.ModuleName);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ if (string.IsNullOrEmpty(_matcher))
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (ModuleMatcherManager.Instance.IsMatcherFirst(_platingCellEntity.Module.ToString()))
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ PlatingCellEntity matherEntity = Singleton<RouteManager>.Instance.GetModule<PlatingCellEntity>(_matcher);
|
|
|
+ if(matherEntity == null)
|
|
|
+ {
|
|
|
+ return true;
|
|
|
}
|
|
|
+ if (matherEntity.IsDisable)
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ if (!matherEntity.IsAuto)
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ if (matherEntity.IsError)
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return matherEntity.IsIdle;
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// Metal Home
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ private bool MetalsHome()
|
|
|
+ {
|
|
|
+ _platingCellEntity.Invoke("HomeAll");
|
|
|
return true;
|
|
|
}
|
|
|
/// <summary>
|