123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357 |
- using MECF.Framework.Common.CommonData;
- using MECF.Framework.Common.DataCenter;
- using OpenSEMI.ClientBase;
- using Prism.Mvvm;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Threading;
- using Venus_MainPages.Unity;
- using Venus_Themes.CustomControls;
- namespace Venus_MainPages.ViewModels
- {
- public class OperationOverViewModel : BindableBase
- {
- #region 私有字段
- private bool m_TabIsChecked=true;
- private ModuleInfo m_LP1ModuleInfo;
- private ModuleInfo m_LP2ModuleInfo;
- private WaferRobotTAction m_Robot1TAction;
- private WaferRobotXAction m_Robot1XAction;
- private WaferRobotTAction m_Robot2TAction;
- private WaferRobotXAction m_Robot2XAction;
- private RobotMoveInfo m_robotMoveInfo;
- int arm1oldWaferStatus = 100;
- int arm2oldWaferStatus = 100;
- private WaferInfo m_PMAWafer;
- private WaferInfo m_PMBWafer;
- private WaferInfo m_PMCWafer;
- private WaferInfo m_PMDWafer;
- private WaferInfo m_LLAWafer;
- private WaferInfo m_LLBWafer;
- private WaferInfo m_BladeAWafer;
- private WaferInfo m_BladeBWafer;
- private List<string> m_RtDataKeys = new List<string>();
- private Dictionary<string, object> m_RtDataValues;
- private bool m_PMAIsInstalled;
- private bool m_PMBIsInstalled;
- private bool m_PMCIsInstalled;
- private bool m_PMDIsInstalled;
- private bool m_LLAIsInstalled;
- private bool m_LLBIsInstalled;
- private bool m_TMIsInstalled;
- #endregion
- #region 属性
- public bool TabIsChecked
- {
- get { return m_TabIsChecked; }
- set { SetProperty(ref m_TabIsChecked, value); }
- }
- public ModuleInfo LP1ModuleInfo
- {
- get { return m_LP1ModuleInfo; }
- set { SetProperty(ref m_LP1ModuleInfo, value); }
- }
- public ModuleInfo LP2ModuleInfo
- {
- get { return m_LP2ModuleInfo; }
- set { SetProperty(ref m_LP2ModuleInfo, value); }
- }
- public WaferRobotTAction Robot1TAction
- {
- get { return m_Robot1TAction; }
- set { SetProperty(ref m_Robot1TAction, value); }
- }
- public WaferRobotXAction Robot1XAction
- {
- get { return m_Robot1XAction; }
- set { SetProperty(ref m_Robot1XAction, value); }
- }
- public WaferRobotTAction Robot2TAction
- {
- get { return m_Robot2TAction; }
- set { SetProperty(ref m_Robot2TAction, value); }
- }
- public WaferRobotXAction Robot2XAction
- {
- get { return m_Robot2XAction; }
- set { SetProperty(ref m_Robot2XAction, value); }
- }
- public RobotMoveInfo RobotMoveInfo
- {
- get { return m_robotMoveInfo; }
- set
- {
- RobotMoveInfoChanged(m_robotMoveInfo, value);
- m_robotMoveInfo = value;
- }
- }
- public WaferInfo LLAWafer
- {
- get { return m_LLAWafer; }
- set { SetProperty(ref m_LLAWafer, value); }
- }
- public WaferInfo LLBWafer
- {
- get { return m_LLBWafer; }
- set { SetProperty(ref m_LLBWafer, value); }
- }
- public WaferInfo PMAWafer
- {
- get { return m_PMAWafer; }
- set { SetProperty(ref m_PMAWafer, value); }
- }
- public WaferInfo PMBWafer
- {
- get { return m_PMBWafer; }
- set { SetProperty(ref m_PMBWafer, value); }
- }
- public WaferInfo PMCWafer
- {
- get { return m_PMCWafer; }
- set { SetProperty(ref m_PMCWafer, value); }
- }
- public WaferInfo PMDWafer
- {
- get { return m_PMDWafer; }
- set { SetProperty(ref m_PMDWafer, value); }
- }
- public WaferInfo BladeAWafer
- {
- get { return m_BladeAWafer; }
- set { SetProperty(ref m_BladeAWafer, value); }
- }
- public WaferInfo BladeBWafer
- {
- get { return m_BladeBWafer; }
- set { SetProperty(ref m_BladeBWafer, value); }
- }
- public Dictionary<string, object> RtDataValues
- {
- get { return m_RtDataValues; }
- set { SetProperty(ref m_RtDataValues, value); }
- }
- public bool PMAIsInstalled
- {
- get { return m_PMAIsInstalled; }
- set { SetProperty(ref m_PMAIsInstalled, value); }
- }
- public bool PMBIsInstalled
- {
- get { return m_PMBIsInstalled; }
- set { SetProperty(ref m_PMBIsInstalled, value); }
- }
- public bool PMCIsInstalled
- {
- get { return m_PMCIsInstalled; }
- set { SetProperty(ref m_PMCIsInstalled, value); }
- }
- public bool PMDIsInstalled
- {
- get { return m_PMDIsInstalled; }
- set { SetProperty(ref m_PMDIsInstalled, value); }
- }
- public bool LLAIsInstalled
- {
- get { return m_LLAIsInstalled; }
- set { SetProperty(ref m_LLAIsInstalled, value); }
- }
- public bool LLBIsInstalled
- {
- get { return m_LLBIsInstalled; }
- set { SetProperty(ref m_LLBIsInstalled, value); }
- }
- public bool TMIsInstalled
- {
- get { return m_TMIsInstalled; }
- set { SetProperty(ref m_TMIsInstalled, value); }
- }
- #endregion
- #region 构造函数
- public OperationOverViewModel()
- {
- DispatcherTimer timer = new DispatcherTimer();
- timer.Interval = TimeSpan.FromSeconds(0.5);
- timer.Tick += Timer_Tick;
- timer.Start();
- addDataKeys();
- string[] allModules = QueryDataClient.Instance.Service.GetConfig($"System.InstalledModules").ToString().Split(',');
- PMAIsInstalled = allModules.Contains("PMA");
- PMBIsInstalled = allModules.Contains("PMB");
- PMCIsInstalled = allModules.Contains("PMC");
- PMDIsInstalled = allModules.Contains("PMD");
- LLAIsInstalled = allModules.Contains("LLA");
- LLBIsInstalled = allModules.Contains("LLB");
- }
- #endregion
- #region 私有方法
- private void Timer_Tick(object sender, EventArgs e)
- {
- LP1ModuleInfo = ModuleManager.ModuleInfos["LP1"];
- LP2ModuleInfo = ModuleManager.ModuleInfos["LP1"];
- if (LLAIsInstalled == true)
- {
- LLAWafer = ModuleManager.ModuleInfos["LLA"].WaferManager.Wafers.FirstOrDefault(x => x.WaferStatus != 0);
- }
- if (LLBIsInstalled == true)
- {
- LLBWafer = ModuleManager.ModuleInfos["LLB"].WaferManager.Wafers.FirstOrDefault(x => x.WaferStatus != 0);
- }
- if (PMAIsInstalled == true)
- {
- PMAWafer = ModuleManager.ModuleInfos["PMA"].WaferManager.Wafers[0];
- }
- if (PMBIsInstalled == true)
- {
- PMBWafer = ModuleManager.ModuleInfos["PMB"].WaferManager.Wafers[0];
- }
- if (PMCIsInstalled == true)
- {
- PMCWafer = ModuleManager.ModuleInfos["PMC"].WaferManager.Wafers[0];
- }
- if (PMDIsInstalled == true)
- {
- PMDWafer = ModuleManager.ModuleInfos["PMD"].WaferManager.Wafers[0];
- }
- if (TMIsInstalled == true)
- {
- BladeAWafer = ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[0];
- BladeBWafer = ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[1];
- }
-
- RobotMoveInfo = (RobotMoveInfo)QueryDataClient.Instance.Service.GetData("TM.RobotMoveAction");
- RtDataValues = QueryDataClient.Instance.Service.PollData(m_RtDataKeys);
- }
- private async void RobotMoveInfoChanged(RobotMoveInfo oldValue, RobotMoveInfo newValue)
- {
- string RobotTarget;
- if (oldValue == null || newValue == null)
- {
- return;
- }
- #region pick 和 place LL
- if (oldValue.Action == RobotAction.None && (newValue.Action == RobotAction.Placing || newValue.Action == RobotAction.Picking))
- {
- var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
- if (TMRobotMoveActionBladeTarget != null)
- {
- RobotTarget = TMRobotMoveActionBladeTarget.ToString();
- }
- else
- {
- return;
- }
- var values = RobotTarget.Split('.');
- var arm = values[0];
- var module = values[1];
- if (arm == "ArmA")
- {
- Robot1TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
- await Task.Delay(1500);
- Robot1XAction = WaferRobotXAction.Extend;
- await Task.Delay(3000);
- Robot1XAction = WaferRobotXAction.Retract;
- }
- else if (arm == "ArmB")
- {
- Robot2TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
- await Task.Delay(1500);
- Robot2XAction = WaferRobotXAction.Extend;
- await Task.Delay(3000);
- Robot2XAction = WaferRobotXAction.Retract;
- }
- }
- #endregion
- #region pick 和 place pm
- if (oldValue.Action == RobotAction.None && newValue.Action == RobotAction.Extending)
- {
- var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
- if (TMRobotMoveActionBladeTarget != null)
- {
- RobotTarget = TMRobotMoveActionBladeTarget.ToString();
- }
- else
- {
- return;
- }
- var values = RobotTarget.Split('.');
- var arm = values[0];
- var module = values[1];
- if (arm == "ArmA")
- {
- Robot1TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
- await Task.Delay(1500);
- Robot1XAction = WaferRobotXAction.Extend;
- }
- else if (arm == "ArmB")
- {
- Robot2TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
- await Task.Delay(1500);
- Robot2XAction = WaferRobotXAction.Extend;
- }
- }
- if (oldValue.Action == RobotAction.None && newValue.Action == RobotAction.Retracting)
- {
- var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
- if (TMRobotMoveActionBladeTarget != null)
- {
- RobotTarget = TMRobotMoveActionBladeTarget.ToString();
- }
- else
- {
- return;
- }
- var values = RobotTarget.Split('.');
- var arm = values[0];
- if (arm == "ArmA")
- {
- Robot1XAction = WaferRobotXAction.Retract;
- }
- else if (arm == "ArmB")
- {
- Robot2XAction = WaferRobotXAction.Retract;
- }
- }
- #endregion
- arm1oldWaferStatus = ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[0].WaferStatus;
- arm2oldWaferStatus = ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[1].WaferStatus;
- }
- private void addDataKeys()
- {
- m_RtDataKeys.Add("PMA.IsSlitDoorClosed");
- m_RtDataKeys.Add("PMB.IsSlitDoorClosed");
- m_RtDataKeys.Add("PMC.IsSlitDoorClosed");
- m_RtDataKeys.Add("PMD.IsSlitDoorClosed");
- m_RtDataKeys.Add("TM.LLATSlitDoor.IsClosed");
- m_RtDataKeys.Add("TM.LLBTSlitDoor.IsClosed");
- }
- #endregion
- }
- }
|