123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289 |
- using Caliburn.Micro;
- using Caliburn.Micro.Core;
- using Aitex.Core.Common.DeviceData;
- using Aitex.Core.UI.ControlDataContext;
- using Aitex.Core.Util;
- using MECF.Framework.Common.DataCenter;
- using MECF.Framework.Common.OperationCenter;
- using MECF.Framework.UI.Client.ClientBase;
- using FurnaceUI.Models;
- using FurnaceUI.Views.Editors;
- using System.Collections.ObjectModel;
- using System.Collections.Generic;
- using System.Threading.Tasks;
- using System.Reflection;
- using System;
- using Aitex.Core.RT.Log;
- using System.Linq;
- using System.Windows;
- using MECF.Framework.Common.SubstrateTrackings;
- using MECF.Framework.Common.Equipment;
- using System.Text.RegularExpressions;
- namespace FurnaceUI.Views.Maintenances
- {
- public class WaferRobotViewModel : FurnaceUIViewModelBase
- {
- public bool IsManagerPermission { get => this.Permission == 3; }
- [Subscription("WaferRobot.Status")]
- public string WaferRobotStatus { get; set; }
- [Subscription("Rt.Status")]
- public string RtStatus { get; set; }
- public bool IsSelectButtonEnable => IsSystemStaus;
- public bool IsSystemStaus => (RtStatus != "AutoRunning");
- [Subscription("WaferRobot.IsOnline")]
- public bool WaferRobotIsOnline { get; set; }
- public bool IsWaferRobotOfflineButtonEnable => WaferRobotIsOnline ;
- public bool IsWaferRobotOnlineButtonEnable => !WaferRobotIsOnline;
- #region test TMRobot
- private List<int> _slotsTMRobot = new List<int>() { 170, 25, 25 };
- private List<string> _modulesTMRobot = new List<string>() { "Boat", "FIMS1", "FIMS2" };
- private List<string> _bladesTMRobot = new List<string>() { "Single", "Multiple" };
- private string _pickSelectedModuleTMRobot;
- public string PickSelectedModuleTMRobot
- {
- get { return _pickSelectedModuleTMRobot; }
- set
- {
- _pickSelectedModuleTMRobot = value;
- PickSlotsTMRobot = GetSlotsByModuleTMRobot(_pickSelectedModuleTMRobot);
- PickSelectedSlotTMRobot = 1;
- NotifyOfPropertyChange("PickSelectedModuleTMRobot");
- }
- }
- private int _pickSelectedSlotTMRobot;
- public int PickSelectedSlotTMRobot
- {
- get { return _pickSelectedSlotTMRobot; }
- set { _pickSelectedSlotTMRobot = value; NotifyOfPropertyChange("PickSelectedSlotTMRobot"); }
- }
- private string _pickSelectedBladeTMRobot;
- public string PickSelectedBladeTMRobot
- {
- get { return _pickSelectedBladeTMRobot; }
- set { _pickSelectedBladeTMRobot = value; NotifyOfPropertyChange("PickSelectedBladeTMRobot"); }
- }
- private List<int> _pickSlotsTMRobot;
- public List<int> PickSlotsTMRobot
- {
- get { return _pickSlotsTMRobot; }
- set { _pickSlotsTMRobot = value; NotifyOfPropertyChange("PickSlotsTMRobot"); }
- }
- private string _placeSelectedModuleTMRobot;
- public string PlaceSelectedModuleTMRobot
- {
- get { return _placeSelectedModuleTMRobot; }
- set
- {
- _placeSelectedModuleTMRobot = value;
- PlaceSlotsTMRobot = GetSlotsByModuleTMRobot(_placeSelectedModuleTMRobot);
- PlaceSelectedSlotTMRobot = 1;
- NotifyOfPropertyChange("PlaceSelectedModuleTMRobot");
- }
- }
- private int _placeSelectedSlotTMRobot;
- public int PlaceSelectedSlotTMRobot
- {
- get { return _placeSelectedSlotTMRobot; }
- set { _placeSelectedSlotTMRobot = value; NotifyOfPropertyChange("PlaceSelectedSlotTMRobot"); }
- }
- private string _placeSelectedBladeTMRobot;
- public string PlaceSelectedBladeTMRobot
- {
- get { return _placeSelectedBladeTMRobot; }
- set { _placeSelectedBladeTMRobot = value; NotifyOfPropertyChange("PlaceSelectedBladeTMRobot"); }
- }
- private List<int> _placeSlotsTMRobot;
- public List<int> PlaceSlotsTMRobot
- {
- get { return _placeSlotsTMRobot; }
- set { _placeSlotsTMRobot = value; NotifyOfPropertyChange("PlaceSlotsTMRobot"); }
- }
- public List<string> ModulesTMRobot
- {
- get { return _modulesTMRobot; }
- set { _modulesTMRobot = value; NotifyOfPropertyChange("ModulesTMRobot"); }
- }
- public List<string> BladesTMRobot
- {
- get { return _bladesTMRobot; }
- set { _bladesTMRobot = value; NotifyOfPropertyChange("BladesTMRobot"); }
- }
- private string _swapFromSelectedModuleTMRobot;
- public string SwapFromSelectedModuleTMRobot
- {
- get { return _swapFromSelectedModuleTMRobot; }
- set
- {
- _swapFromSelectedModuleTMRobot = value;
- SwapFromSlotsTMRobot = GetSlotsByModuleTMRobot(_swapFromSelectedModuleTMRobot);
- SwapFromSelectedSlotTMRobot = 1;
- NotifyOfPropertyChange("SwapFromSelectedModuleTMRobot");
- }
- }
- private int _swapFromSelectedSlotTMRobot;
- public int SwapFromSelectedSlotTMRobot
- {
- get { return _swapFromSelectedSlotTMRobot; }
- set { _swapFromSelectedSlotTMRobot = value; NotifyOfPropertyChange("SwapFromSelectedSlotTMRobot"); }
- }
- private string _swapSelectedBladeTMRobot;
- public string SwapSelectedBladeTMRobot
- {
- get { return _swapSelectedBladeTMRobot; }
- set { _swapSelectedBladeTMRobot = value; NotifyOfPropertyChange("SwapSelectedBladeTMRobot"); }
- }
- private List<int> _swapFromSlotsTMRobot;
- public List<int> SwapFromSlotsTMRobot
- {
- get { return _swapFromSlotsTMRobot; }
- set { _swapFromSlotsTMRobot = value; NotifyOfPropertyChange("SwapFromSlotsTMRobot"); }
- }
- private string _swapToSelectedModuleTMRobot;
- public string SwapToSelectedModuleTMRobot
- {
- get { return _swapToSelectedModuleTMRobot; }
- set
- {
- _swapToSelectedModuleTMRobot = value;
- SwapToSlotsTMRobot = GetSlotsByModuleTMRobot(_swapToSelectedModuleTMRobot);
- SwapToSelectedSlotTMRobot = 1;
- NotifyOfPropertyChange("SwapToSelectedModuleTMRobot");
- }
- }
- private int _swapToSelectedSlotTMRobot;
- public int SwapToSelectedSlotTMRobot
- {
- get { return _swapToSelectedSlotTMRobot; }
- set { _swapToSelectedSlotTMRobot = value; NotifyOfPropertyChange("SwapToSelectedSlotTMRobot"); }
- }
- private List<int> _swapToSlotsTMRobot;
- public List<int> SwapToSlotsTMRobot
- {
- get { return _swapToSlotsTMRobot; }
- set { _swapToSlotsTMRobot = value; NotifyOfPropertyChange("SwapToSlotsTMRobot"); }
- }
- private WaferInfo _robotWafer1;
- public WaferInfo RobotWafer1
- {
- get { return _robotWafer1; }
- set
- {
- _robotWafer1 = value;
- NotifyOfPropertyChange("RobotWafer1");
- }
- }
- private string _mappingSelectedModuleTMRobot;
- public string MappingSelectedModuleTMRobot
- {
- get { return _mappingSelectedModuleTMRobot; }
- set
- {
- _mappingSelectedModuleTMRobot = value;
- NotifyOfPropertyChange("MappingSelectedModuleTMRobot");
- }
- }
- #endregion
- public WaferRobotViewModel()
- {
- _slotsTMRobot = new List<int>();
- _slotsTMRobot.Add((int)QueryDataClient.Instance.Service.GetConfig("Boat.SlotCount"));
- _slotsTMRobot.Add((int)QueryDataClient.Instance.Service.GetConfig("System.CassetteSlotCount"));
- _slotsTMRobot.Add((int)QueryDataClient.Instance.Service.GetConfig("System.CassetteSlotCount"));
- }
- private List<int> GetSlotsByModuleTMRobot(string module)
- {
- List<int> slots = new List<int>();
- int i = _modulesTMRobot.IndexOf(module);
- int num = 0;
- if (i >= 0 && i < _slotsTMRobot.Count)
- num = _slotsTMRobot[i];
- int j = 0;
- while (j < num)
- {
- slots.Add(j + 1);
- j++;
- }
- return slots;
- }
- public void Home()
- {
- InvokeClient.Instance.Service.DoOperation("WaferRobot.Home");
- }
- public void TMRobot_Pick()
- {
- var module = PickSelectedModuleTMRobot.Replace("Boat", "PM1");
- InvokeClient.Instance.Service.DoOperation($"WaferRobot.Pick", module, PickSelectedSlotTMRobot - 1, PickSelectedBladeTMRobot == "Single" ? 0 : (PickSelectedBladeTMRobot == "Blade2" ? 1 : 2));
- }
- public void TMRobot_Place()
- {
- var module = PlaceSelectedModuleTMRobot.Replace("Boat", "PM1");
- InvokeClient.Instance.Service.DoOperation($"WaferRobot.Place", module, PlaceSelectedSlotTMRobot - 1, PlaceSelectedBladeTMRobot == "Single" ? 0 : (PlaceSelectedBladeTMRobot == "Blade2" ? 1 : 2));
- }
- public void TMRobot_Mapping()
- {
- var module = MappingSelectedModuleTMRobot.Replace("Boat", "PM1");
- string mappingSlot = string.Empty;
- var wafers = ModuleManager.ModuleInfos[module].WaferManager.Wafers;
- if (wafers != null)
- {
- for (int i = wafers.Count - 1; i >= 0; i--)
- {
- if (wafers[i].WaferStatus != 0)
- mappingSlot += "1";
- else
- mappingSlot += "0";
- }
- }
- InvokeClient.Instance.Service.DoOperation($"WaferRobot.Mapping", module, mappingSlot.Length == 0 ? 0 : Regex.Matches(mappingSlot, "1").Count, 0, mappingSlot, true, true);
- }
- public void WaferRobot_Swap()
- {
- var fromModule = SwapFromSelectedModuleTMRobot.Replace("Boat", "PM1"); ;
- var toModule = SwapToSelectedModuleTMRobot.Replace("Boat", "PM1"); ;
- InvokeClient.Instance.Service.DoOperation($"WaferRobot.Swap", fromModule, toModule, SwapFromSelectedSlotTMRobot - 1, SwapToSelectedSlotTMRobot - 1,
- SwapSelectedBladeTMRobot == "Single" ? 0 : (SwapSelectedBladeTMRobot == "Blade2" ? 1 : 2));
- }
- public void SetOnline(object target)
- {
- InvokeClient.Instance.Service.DoOperation($"{target}.SetOnline");
- }
- public void SetOffline(object target)
- {
- InvokeClient.Instance.Service.DoOperation($"{target}.SetOffline");
- }
- public void ClosedCmd()
- {
- (GetView() as Window).Close();
- }
- }
- }
|