123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578 |
- using MECF.Framework.Common.CommonData;
- using MECF.Framework.Common.DataCenter;
- using MECF.Framework.Common.Equipment;
- using MECF.Framework.Common.OperationCenter;
- using OpenSEMI.ClientBase;
- using Prism.Commands;
- using Prism.Mvvm;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Threading;
- using CyberX8_Core;
- using CyberX8_MainPages.Unity;
- using CyberX8_MainPages.Views;
- using CyberX8_Themes.CustomControls;
- using CyberX8_Themes.Unity;
- using CyberX8_Themes.UserControls;
- using Aitex.Core.RT.Log;
- using MECF.Framework.Common.Reservior;
- using MECF.Framework.Common.ProcessCell;
- using MECF.Framework.Common.Utilities;
- using Aitex.Sorter.Common;
- using MECF.Framework.Common.Schedulers;
- using MECF.Framework.Common.Beckhoff.Station;
- using MECF.Framework.Common.Layout;
- using Aitex.Core.RT.Routine;
- using Aitex.Core.RT.Device;
- using System.Reflection;
- using MECF.Framework.Common.Beckhoff.IOAxis;
- using MECF.Framework.Common.TwinCat;
- using LiveCharts.Wpf;
- using MECF.Framework.Common.CommonData.PUF;
- using MECF.Framework.Common.Beckhoff.AxisProvider;
- using QiHe.CodeLib;
- using MECF.Framework.Common.Jobs;
- namespace CyberX8_MainPages.ViewModels
- {
- public class OperationOverViewModel : BindableBase
- {
- #region 常量
- private const string CURRENT_STATION = "CurrentStation";
- private const string MOTOR_POSITION = "MotorPosition";
- private const string MOTION_DATA = "MotionData";
- private const double LOADER_ROTATION_DIFFER = 90;
- private const double PUF_FLIP_DIFFER = 180;
- #endregion
- #region 私有字段
- private bool _isLp1Unable;
- private bool _isLp2Unable;
- private bool _isLp3Unable;
- private ModuleInfo _LP1ModuleInfo;
- private ModuleInfo _LP2ModuleInfo;
- private ModuleInfo _LP3ModuleInfo;
- private ModuleInfo _EFEMModuleInfo;
- private ModuleInfo _srd1ModuleInfo;
- private ModuleInfo _srd2ModuleInfo;
- private ModuleInfo _puf1ModuleInfo;
- private ModuleInfo _dummy1ModuleInfo;
- private ModuleInfo _dummy2ModuleInfo;
- private ModuleInfo _loaderModuleInfo;
- private WaferRobotTAction m_Robot1TAction;
- private WaferRobotXAction m_Robot1XAction;
- private WaferRobotTAction m_Robot2TAction;
- private WaferRobotXAction m_Robot2XAction;
- private WaferRobotTAction m_Robot3TAction;
- private WaferRobotXAction m_Robot3XAction;
- private WaferRobotTAction m_Robot4TAction;
- private WaferRobotXAction m_Robot4XAction;
- private RobotMoveInfo m_robotMoveInfo;
- private WaferInfo m_srd1Wafer;
- private WaferInfo m_srd2Wafer;
- private WaferInfo m_puf1WaferA;
- private WaferInfo m_puf1WaferB;
- private WaferInfo m_loaderWaferA;
- private WaferInfo m_loaderWaferB;
- private List<string> m_RtDataKeys = new List<string>();
- private Dictionary<string, object> m_RtDataValues;
- private bool m_EFEMIsInstalled;
- private bool m_loaderInstalled;
- private bool m_puf1IsInRobotStation;
- //private bool m_IsPUFChange;
- private WaferInfo m_EFEMBladeAWafer;
- private WaferInfo m_EFEMBladeBWafer;
- private WaferInfo m_Aligner1Wafer;
- private int m_LP1WaferCount;
- private int m_LP2WaferCount;
- private int m_LP3WaferCount;
- private int m_dummy1WaferCount;
- private int m_dummy2WaferCount;
- private int m_CycledWafer;
- private int m_CycleCountDisplay;
- private EFEM.RobotPosition m_CurrentRobotPosition;
- private PufControl.LoaderXLocation m_loaderAXLoaction = PufControl.LoaderXLocation.Parker;
- private PufControl.LoaderXLocation m_loaderBXLoaction = PufControl.LoaderXLocation.Parker;
-
- /// <summary>
- /// Loader的sideA开启状态
- /// </summary>
- private bool m_loaderWaferVisibleA = false;
- /// <summary>
- /// Loader的sideB开启状态
- /// </summary>
- private bool m_loaderWaferVisibleB = false;
- private WaferInfo m_BladeAWafer;
- private WaferInfo m_BladeBWafer;
- private string m_ATMModeIsOn;
- private string m_RouteState;
- /// <summary>
- /// puf1 Rotation ui 水平比例
- /// </summary>
- private double _puf1RotationRatio;
- /// <summary>
- /// 定时器
- /// </summary>
- private DispatcherTimer _timer;
- /// <summary>
- /// 定时器1
- /// </summary>
- private DispatcherTimer _timer1;
- /// <summary>
- /// puf Rotation UI水平距离
- /// </summary>
- private int _pufLayoutRotationDistance;
- /// <summary>
- /// Efem robot UI位置
- /// </summary>
- private int _robotLayoutPosition;
- /// <summary>
- /// Puf1 Rotation实际位置数据
- /// </summary>
- private double _puf1RotationMotorPosition;
- /// <summary>
- /// Puf1 Flip实际位置数据
- /// </summary>
- private double _puf1FlipMotorPosition;
- /// <summary>
- /// Puf1 Flip UI位置
- /// </summary>
- private double _puf1FlipPosition;
- /// <summary>
- /// Puf1 Rotation最左侧的位置
- /// </summary>
- private double _puf1RotationMotorPositionMax;
- /// <summary>
- /// Puf1 Rotation UI对应位置
- /// </summary>
- private double _puf1RotationPosition;
- /// <summary>
- /// Loader1 Rotation UI对应位置
- /// </summary>
- private double _loader1RotationPosition;
- /// <summary>
- /// Puf1 Rotation Axis
- /// </summary>
- private BeckhoffStationAxis _puf1RotationAxis;
- /// <summary>
- /// Puf1 Flip Axis
- /// </summary>
- private BeckhoffStationAxis _puf1FlipAxis;
- /// <summary>
- /// Loader1 Rotation Axis
- /// </summary>
- private BeckhoffStationAxis _loader1RotationAxis;
- /// <summary>
- /// Loader1 TlitA Axis
- /// </summary>
- private BeckhoffStationAxis _loader1TiltAAxis;
- /// <summary>
- /// Loader1 TlitB Axis
- /// </summary>
- private BeckhoffStationAxis _loader1TiltBAxis;
- /// <summary>
- /// Loader1 Rotation实际位置数据
- /// </summary>
- private double _loader1RotationMotorPosition;
- /// <summary>
- /// Loader1 TiltA实际位置数据
- /// </summary>
- private double _loader1TiltAMotorPosition;
- /// <summary>
- /// Loader1 TiltB实际位置数据
- /// </summary>
- private double _loader1TiltBMotorPosition;
- /// <summary>
- /// Loader Rotation位置
- /// </summary>
- private LoaderControl.LoaderRotation m_currentLoaderRotation = LoaderControl.LoaderRotation.Load;
- /// <summary>
- /// Puf1 Flip当前station
- /// </summary>
- private string _puf1FlipCurrentStation;
- /// <summary>
- /// Loader1 TiltA当前station
- /// </summary>
- private string _loaderTiltACurrentStation;
- /// <summary>
- /// Loader1 TiltB当前station
- /// </summary>
- private string _loaderTiltBCurrentStation;
- /// <summary>
- /// 是否存在Job
- /// </summary>
- private bool _isLp1HasNoJob;
- private bool _isLp2HasNoJob;
- private bool _isLp3HasNoJob;
- #endregion
- #region 属性
- public bool IsLP1Unable
- {
- get { return _isLp1Unable; }
- set { SetProperty(ref _isLp1Unable, value); }
- }
- public bool IsLP2Unable
- {
- get { return _isLp2Unable; }
- set { SetProperty(ref _isLp2Unable, value); }
- }
- public bool IsLP3Unable
- {
- get { return _isLp3Unable; }
- set { SetProperty(ref _isLp3Unable, value); }
- }
- public ModuleInfo LP1ModuleInfo
- {
- get { return _LP1ModuleInfo; }
- set { SetProperty(ref _LP1ModuleInfo, value); }
- }
- public ModuleInfo EFEMModuleInfo
- {
- get { return _EFEMModuleInfo; }
- set { SetProperty(ref _EFEMModuleInfo, value); }
- }
- public ModuleInfo LP2ModuleInfo
- {
- get { return _LP2ModuleInfo; }
- set { SetProperty(ref _LP2ModuleInfo, value); }
- }
- public ModuleInfo LP3ModuleInfo
- {
- get { return _LP3ModuleInfo; }
- set { SetProperty(ref _LP3ModuleInfo, value); }
- }
- public ModuleInfo SRD1ModuleInfo
- {
- get { return _srd1ModuleInfo; }
- set { SetProperty(ref _srd1ModuleInfo, value); }
- }
- public ModuleInfo SRD2ModuleInfo
- {
- get { return _srd2ModuleInfo; }
- set { SetProperty(ref _srd2ModuleInfo, value); }
- }
- public ModuleInfo PUF1ModuleInfo
- {
- get { return _puf1ModuleInfo; }
- set { SetProperty(ref _puf1ModuleInfo, value); }
- }
- public ModuleInfo Dummy1ModuleInfo
- {
- get { return _dummy1ModuleInfo; }
- set { SetProperty(ref _dummy1ModuleInfo, value); }
- }
- public ModuleInfo Dummy2ModuleInfo
- {
- get { return _dummy2ModuleInfo; }
- set { SetProperty(ref _dummy2ModuleInfo, value); }
- }
- public ModuleInfo LoaderModuleInfo
- {
- get { return _loaderModuleInfo; }
- set { SetProperty(ref _loaderModuleInfo, 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 WaferRobotTAction Robot3TAction
- {
- get { return m_Robot3TAction; }
- set { SetProperty(ref m_Robot3TAction, value); }
- }
- public WaferRobotXAction Robot3XAction
- {
- get { return m_Robot3XAction; }
- set { SetProperty(ref m_Robot3XAction, value); }
- }
- public WaferRobotTAction Robot4TAction
- {
- get { return m_Robot4TAction; }
- set { SetProperty(ref m_Robot4TAction, value); }
- }
- public WaferRobotXAction Robot4XAction
- {
- get { return m_Robot4XAction; }
- set { SetProperty(ref m_Robot4XAction, value); }
- }
- public RobotMoveInfo RobotMoveInfo
- {
- get { return m_robotMoveInfo; }
- set
- {
- RobotMoveInfoChanged(m_robotMoveInfo, value);
- //m_robotMoveInfo = value;
- SetProperty(ref m_robotMoveInfo, value);
- }
- }
- public Dictionary<string, object> RtDataValues
- {
- get { return m_RtDataValues; }
- set { SetProperty(ref m_RtDataValues, value); }
- }
- public bool EFEMIsInstalled
- {
- get { return m_EFEMIsInstalled; }
- set { SetProperty(ref m_EFEMIsInstalled, value); }
- }
- public WaferInfo EFEMBladeAWafer
- {
- get { return m_EFEMBladeAWafer; }
- set { SetProperty(ref m_EFEMBladeAWafer, value); }
- }
- public WaferInfo EFEMBladeBWafer
- {
- get { return m_EFEMBladeBWafer; }
- set { SetProperty(ref m_EFEMBladeBWafer, value); }
- }
- public bool LoaderIsInstalled
- {
- get { return m_loaderInstalled; }
- set { SetProperty(ref m_loaderInstalled, value); }
- }
- public WaferInfo Aligner1Wafer
- {
- get { return m_Aligner1Wafer; }
- set { SetProperty(ref m_Aligner1Wafer, value); }
- }
- public WaferInfo SRD1Wafer
- {
- get { return m_srd1Wafer; }
- set { SetProperty(ref m_srd1Wafer, value); }
- }
- public WaferInfo SRD2Wafer
- {
- get { return m_srd2Wafer; }
- set { SetProperty(ref m_srd2Wafer, value); }
- }
- public WaferInfo PUF1WaferA
- {
- get { return m_puf1WaferA; }
- set { SetProperty(ref m_puf1WaferA, value); }
- }
- public WaferInfo PUF1WaferB
- {
- get { return m_puf1WaferB; }
- set { SetProperty(ref m_puf1WaferB, value); }
- }
- public WaferInfo LoaderWaferA
- {
- get { return m_loaderWaferA; }
- set { SetProperty(ref m_loaderWaferA, value); }
- }
- public WaferInfo LoaderWaferB
- {
- get { return m_loaderWaferB; }
- set { SetProperty(ref m_loaderWaferB, value); }
- }
- public int LP1WaferCount
- {
- get { return m_LP1WaferCount; }
- set { SetProperty(ref m_LP1WaferCount, value); }
- }
- public int LP2WaferCount
- {
- get { return m_LP2WaferCount; }
- set { SetProperty(ref m_LP2WaferCount, value); }
- }
- public int LP3WaferCount
- {
- get { return m_LP3WaferCount; }
- set { SetProperty(ref m_LP3WaferCount, value); }
- }
- public int Dummy1WaferCount
- {
- get { return m_dummy1WaferCount; }
- set { SetProperty(ref m_dummy1WaferCount, value); }
- }
- public int Dummy2WaferCount
- {
- get { return m_dummy2WaferCount; }
- set { SetProperty(ref m_dummy2WaferCount, value); }
- }
- public int CycledWafer
- {
- get { return m_CycledWafer; }
- set { SetProperty(ref m_CycledWafer, value); }
- }
- public int CycleCountDisplay
- {
- get { return m_CycleCountDisplay; }
- set { SetProperty(ref m_CycleCountDisplay, value); }
- }
- public RobotMoveInfo m_EfemRobotMoveInfo;
- public RobotMoveInfo EfemRobotMoveInfo
- {
- get { return m_EfemRobotMoveInfo; }
- set
- {
- EFEMRobotMoveInfoChanged(m_EfemRobotMoveInfo, value);
- //m_EfemRobotMoveInfo = value;
- SetProperty(ref m_EfemRobotMoveInfo, value);
- }
- }
- public EFEM.RobotPosition CurrentRobotPosition
- {
- get { return m_CurrentRobotPosition; }
- set { SetProperty(ref m_CurrentRobotPosition, value); }
- }
-
- public PufControl.LoaderXLocation LoaderAXLocation
- {
- get { return m_loaderAXLoaction; }
- set { SetProperty(ref m_loaderAXLoaction, value); }
- }
- public PufControl.LoaderXLocation LoaderBXLocation
- {
- get { return m_loaderBXLoaction; }
- set { SetProperty(ref m_loaderBXLoaction, 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 string ATMModeIsOn
- {
- get { return m_ATMModeIsOn; }
- set { SetProperty(ref m_ATMModeIsOn, value); }
- }
-
- public string RouteState
- {
- get { return m_RouteState; }
- set { SetProperty(ref m_RouteState, value); }
- }
- /// <summary>
- /// Loader的sideA开启状态
- /// </summary>
- public bool LoaderWaferVisibleA
- {
- get { return m_loaderWaferVisibleA; }
- set { SetProperty(ref m_loaderWaferVisibleA, value); }
- }
- /// <summary>
- /// Loader的sideB开启状态
- /// </summary>
- public bool LoaderWaferVisibleB
- {
- get { return m_loaderWaferVisibleB; }
- set { SetProperty(ref m_loaderWaferVisibleB, value); }
- }
- public bool Puf1IsInRobotStation
- {
- get { return m_puf1IsInRobotStation; }
- set { SetProperty(ref m_puf1IsInRobotStation, value); }
- }
- /// <summary>
- /// Puf1 Rotation实际位置数据
- /// </summary>
- public double Puf1RotationMotorPosition
- {
- get { return _puf1RotationMotorPosition; }
- set { SetProperty(ref _puf1RotationMotorPosition, value); }
- }
- /// <summary>
- /// Puf1 Flip实际位置数据
- /// </summary>
- public double Puf1FlipMotorPosition
- {
- get { return _puf1FlipMotorPosition; }
- set { SetProperty(ref _puf1FlipMotorPosition, value); }
- }
- /// <summary>
- /// Puf1 Flip UI位置
- /// </summary>
- public double Puf1FlipPosition
- {
- get { return _puf1FlipPosition; }
- set { SetProperty(ref _puf1FlipPosition, value); }
- }
- /// <summary>
- /// Puf1 Rotation UI对应位置
- /// </summary>
- public double Puf1RotationPosition
- {
- get { return _puf1RotationPosition; }
- set { SetProperty(ref _puf1RotationPosition, value); }
- }
- /// <summary>
- /// Loader1 Rotation UI对应位置
- /// </summary>
- public double Loader1RotationPosition
- {
- get { return _loader1RotationPosition; }
- set { SetProperty(ref _loader1RotationPosition, value); }
- }
- /// <summary>
- /// Puf1 Rotation Axis
- /// </summary>
- public BeckhoffStationAxis Puf1RotationAxis
- {
- get { return _puf1RotationAxis; }
- set { SetProperty(ref _puf1RotationAxis, value); }
- }
- /// <summary>
- /// Puf1 Flip Axis
- /// </summary>
- public BeckhoffStationAxis Puf1FlipAxis
- {
- get { return _puf1FlipAxis; }
- set { SetProperty(ref _puf1FlipAxis, value); }
- }
- /// <summary>
- /// Loader1 Rotation Axis
- /// </summary>
- public BeckhoffStationAxis Loader1RotationAxis
- {
- get { return _loader1RotationAxis; }
- set { SetProperty(ref _loader1RotationAxis, value); }
- }
- /// <summary>
- /// Loader1 TiltA Axis
- /// </summary>
- public BeckhoffStationAxis Loader1TiltAAxis
- {
- get { return _loader1TiltAAxis; }
- set { SetProperty(ref _loader1TiltAAxis, value); }
- }
- /// <summary>
- /// Loader1 TiltB Axis
- /// </summary>
- public BeckhoffStationAxis Loader1TiltBAxis
- {
- get { return _loader1TiltBAxis; }
- set { SetProperty(ref _loader1TiltBAxis, value); }
- }
- /// <summary>
- /// Loader1 Rotation实际位置数据
- /// </summary>
- public double Loader1RotationMotorPosition
- {
- get { return _loader1RotationMotorPosition; }
- set { SetProperty(ref _loader1RotationMotorPosition, value); }
- }
- /// <summary>
- /// Loader1 TiltA实际位置数据
- /// </summary>
- public double Loader1TiltAMotorPosition
- {
- get { return _loader1TiltAMotorPosition; }
- set { SetProperty(ref _loader1TiltAMotorPosition, value); }
- }
- /// <summary>
- /// Loader1 TiltB实际位置数据
- /// </summary>
- public double Loader1TiltBMotorPosition
- {
- get { return _loader1TiltBMotorPosition; }
- set { SetProperty(ref _loader1TiltBMotorPosition, value); }
- }
- /// <summary>
- /// Loader Rotation位置
- /// </summary>
- public LoaderControl.LoaderRotation CurrentLoaderRotation
- {
- get { return m_currentLoaderRotation; }
- set { SetProperty(ref m_currentLoaderRotation, value); }
- }
- public string LoaderTiltACurrentStation
- {
- get { return _loaderTiltACurrentStation; }
- set { SetProperty(ref _loaderTiltACurrentStation, value); }
- }
- /// <summary>
- /// Loader TiltB当前station
- /// </summary>
- public string LoaderTiltBCurrentStation
- {
- get { return _loaderTiltBCurrentStation; }
- set { SetProperty(ref _loaderTiltBCurrentStation, value); }
- }
- public bool IsLP1HasNoJob
- {
- get { return _isLp1HasNoJob; }
- set { SetProperty(ref _isLp1HasNoJob, value); }
- }
- public bool IsLP2HasNoJob
- {
- get { return _isLp2HasNoJob; }
- set { SetProperty(ref _isLp2HasNoJob, value); }
- }
- public bool IsLP3HasNoJob
- {
- get { return _isLp3HasNoJob; }
- set { SetProperty(ref _isLp3HasNoJob, value); }
- }
- #endregion
- #region 命令
- private DelegateCommand<object> _LoadWaferCommand;
- public DelegateCommand<object> LoadWaferCommand =>
- _LoadWaferCommand ?? (_LoadWaferCommand = new DelegateCommand<object>(OnLoadWafer));
- private DelegateCommand<object> _UnLoadWaferCommand;
- public DelegateCommand<object> UnLoadWaferCommand =>
- _UnLoadWaferCommand ?? (_UnLoadWaferCommand = new DelegateCommand<object>(OnUnLoadWafer));
- private DelegateCommand<object> _StartCommand;
- public DelegateCommand<object> StartCommand =>
- _StartCommand ?? (_StartCommand = new DelegateCommand<object>(OnStart));
- private DelegateCommand<object> _StopCommand;
- public DelegateCommand<object> StopCommand =>
- _StopCommand ?? (_StopCommand = new DelegateCommand<object>(OnStop));
- private DelegateCommand<object> _AbortCommand;
- public DelegateCommand<object> AbortCommand =>
- _AbortCommand ?? (_AbortCommand = new DelegateCommand<object>(OnAbort));
- private DelegateCommand _HomeAllCommand;
- public DelegateCommand HomeAllCommand =>
- _HomeAllCommand ?? (_HomeAllCommand = new DelegateCommand(OnHomeAll));
- private DelegateCommand _ResumeAllJobCommand;
- public DelegateCommand ResumeAllJobCommand =>
- _ResumeAllJobCommand ?? (_ResumeAllJobCommand = new DelegateCommand(OnResumeAllJob));
- private DelegateCommand _AbortAllCommand;
- public DelegateCommand AbortAllCommand =>
- _AbortAllCommand ?? (_AbortAllCommand = new DelegateCommand(OnAbortAll));
- private DelegateCommand _ReturnAllWaferCommand;
- public DelegateCommand ReturnAllWaferCommand =>
- _ReturnAllWaferCommand ?? (_ReturnAllWaferCommand = new DelegateCommand(OnReturnAllWafer));
- private DelegateCommand<object> _SetSequenceCommand;
- public DelegateCommand<object> SetSequenceCommand =>
- _SetSequenceCommand ?? (_SetSequenceCommand = new DelegateCommand<object>(OnSetSequence));
- private DelegateCommand _EnableAutoCommand;
- public DelegateCommand EnableAutoCommand =>
- _EnableAutoCommand ?? (_EnableAutoCommand = new DelegateCommand(OnEnableAuto));
- private DelegateCommand _EnableManualCommand;
- public DelegateCommand EnableManualCommand =>
- _EnableManualCommand ?? (_EnableManualCommand = new DelegateCommand(OnEnableManual));
- private DelegateCommand<object> _GotoSrdViewCommond;
- public DelegateCommand<object> GotoSrdViewCommond =>
- _GotoSrdViewCommond ?? (_GotoSrdViewCommond = new DelegateCommand<object>(GotoSrdViewAction));
- public bool SwitchFlag;
-
- #endregion
- #region 构造函数
- public OperationOverViewModel()
- {
- addDataKeys();
- ATMModeIsOn = Convert.ToBoolean(QueryDataClient.Instance.Service.GetConfig("System.IsATMMode")) == true ? "ATM Mode On" : "ATM Mode Off";
- }
- #endregion
- #region 命令方法
- /// <summary>
- /// 加载数据
- /// </summary>
- public void LoadData(string systemName)
- {
- Dictionary<string, object> allModulesDictionary = QueryDataClient.Instance.Service.PollData(new List<string>() { "System.InstalledModules" });
- if (allModulesDictionary != null)
- {
- List<string> allModules = CommonFunction.GetValue<List<string>>(allModulesDictionary, "System.InstalledModules");
- EFEMIsInstalled = allModules.Contains("EFEM");
- LoaderIsInstalled = allModules.Contains(ModuleName.Loader1.ToString());
- }
- if (_timer == null)
- {
- _timer = new DispatcherTimer();
- _timer.Interval = TimeSpan.FromMilliseconds(100);
- _timer.Tick += Timer_Tick;
- }
- _timer.Start();
- if (_timer1 == null)
- {
- _timer1 = new DispatcherTimer();
- _timer1.Interval = TimeSpan.FromMilliseconds(50);
- _timer1.Tick += Timer1_Tick;
- }
- _timer1.Start();
- _pufLayoutRotationDistance = (int)QueryDataClient.Instance.Service.GetConfig("DualPUF.PufLayoutRotationDistance");
- _robotLayoutPosition = (int)QueryDataClient.Instance.Service.GetConfig("DualPUF.RobotLayoutPosition");
- if (!m_RtDataKeys.Contains($"Station.PUF1.Roation"))
- {
- addStationDataKeys();
- }
-
- RtDataValues = QueryDataClient.Instance.Service.PollData(m_RtDataKeys);
- if (RtDataValues != null)
- {
- //目标位置数据获取
- Puf1RotationAxis = CommonFunction.GetValue<BeckhoffStationAxis>(RtDataValues, $"Station.PUF1.Rotation");
- //Puf1Rotation比例尺计算
- var resultRotation = Puf1RotationAxis != null ? CalculateMaxMin(Puf1RotationAxis) : (0, 0);
- double distance = resultRotation.max - resultRotation.min;
- _puf1RotationRatio = distance / _pufLayoutRotationDistance;
- _puf1RotationMotorPositionMax = resultRotation.max;
-
- }
- }
-
- /// <summary>
- /// 隐藏
- /// </summary>
- public void Hide()
- {
- if (_timer != null)
- {
- _timer.Stop();
- }
- if (_timer1 != null)
- {
- _timer1.Stop();
- }
-
- }
-
- private void OnLoadWafer(object obj)
- {
- InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.Load", ModuleManager.ModuleInfos[obj.ToString()].ModuleID);
- }
- private void OnUnLoadWafer(object obj)
- {
- InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.Unload", ModuleManager.ModuleInfos[obj.ToString()].ModuleID);
- }
- private void OnStart(object obj)
- {
- var info = obj as WaferAssociationInfo;
- InvokeClient.Instance.Service.DoOperation("System.StartJob", info.LotId);
- }
- private void OnStop(object obj)
- {
- var info = obj as WaferAssociationInfo;
- InvokeClient.Instance.Service.DoOperation("System.PauseJob", info.JobID);
- }
- private void OnAbort(object obj)
- {
- var info = obj as WaferAssociationInfo;
- InvokeClient.Instance.Service.DoOperation("System.ResumeJob", info.JobID);
- }
- private void OnHomeAll()
- {
- InvokeClient.Instance.Service.DoOperation("System.HomeAll");
- }
- private void OnResumeAllJob()
- {
- if (CommonFunction.GetValue<int>(RtDataValues, "EquipmentStatus") == 4)
- {
- InvokeClient.Instance.Service.DoOperation("System.ResumeAllJob");
- }
- else
- {
- InvokeClient.Instance.Service.DoOperation("System.PauseAllJob");
- }
- }
- private void OnAbortAll()
- {
- InvokeClient.Instance.Service.DoOperation("System.Abort");
- }
- private void OnReturnAllWafer()
- {
- //Dialog
- WaferDialogView dialog = new WaferDialogView()
- {
- Owner = Application.Current.MainWindow,
- };
- dialog.Height = 300;
- dialog.Width = 400;
- double angel = 0;
- double coolingtime = 0;
- string message = "Please Confirm Return Wafer";
- WaferDialogViewModel vm = new WaferDialogViewModel();
- vm.ConfirmText = message;
- dialog.DataContext = vm;
- if (dialog.ShowDialog() == true)
- {
- if ((bool)dialog.AlignFlag == true && !string.IsNullOrEmpty(dialog.Angle))
- {
- angel = Convert.ToDouble(dialog.Angle);
- }
- if ((bool)dialog.CoolingFlag == true && !string.IsNullOrEmpty(dialog.CoolingTime))
- {
- coolingtime = Convert.ToDouble(dialog.CoolingTime);
- }
- InvokeClient.Instance.Service.DoOperation("System.ReturnAllWafer", dialog.CoolingFlag, coolingtime, dialog.AlignFlag, angel);
- }
- }
- private void OnSetSequence(object obj)
- {
- var info = obj as WaferInfo;
- bool flag = info.SequenceName != "" ? false : true;
- }
- private void OnEnableAuto()
- {
- InvokeClient.Instance.Service.DoOperation("System.SetAutoMode");
- }
- private void OnEnableManual()
- {
- InvokeClient.Instance.Service.DoOperation("System.SetManualMode");
- }
- private void GotoSrdViewAction(object obj)
- {
- CyberX8_Core.GlobalEvents.OnSwitchFixedTabItem("HardWare", "SRD", $"{obj.ToString()}");
- }
-
- #endregion
- #region 私有方法
- /// <summary>
- /// 定时器
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void Timer_Tick(object sender, EventArgs e)
- {
- LP1ModuleInfo = ModuleManager.ModuleInfos["LP1"];
- LP2ModuleInfo = ModuleManager.ModuleInfos["LP2"];
- LP3ModuleInfo = ModuleManager.ModuleInfos["LP3"];
- EFEMModuleInfo = ModuleManager.ModuleInfos["EfemRobot"];
- SRD1ModuleInfo = ModuleManager.ModuleInfos["SRD1"];
- SRD2ModuleInfo = ModuleManager.ModuleInfos["SRD2"];
- PUF1ModuleInfo = ModuleManager.ModuleInfos["PUF1"];
- Dummy1ModuleInfo = ModuleManager.ModuleInfos["Dummy1"];
- Dummy2ModuleInfo = ModuleManager.ModuleInfos["Dummy2"];
- LoaderModuleInfo = ModuleManager.ModuleInfos["Loader1"];
- if (ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers.Count != 0)
- {
- BladeAWafer = ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers[0];
- }
- if (EFEMIsInstalled == true)
- {
- if (ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers.Count != 0)
- {
- EFEMBladeAWafer = ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers[0];
- }
- if (ModuleManager.ModuleInfos["Aligner1"].WaferManager.Wafers.Count != 0)
- {
- Aligner1Wafer = ModuleManager.ModuleInfos["Aligner1"].WaferManager.Wafers[0];
- }
- }
- if (SRD1ModuleInfo != null&& SRD1ModuleInfo.WaferManager.Wafers.Count!=0)
- {
- SRD1Wafer = SRD1ModuleInfo.WaferManager.Wafers[0];
- }
- if (SRD2ModuleInfo != null&& SRD2ModuleInfo.WaferManager.Wafers.Count!=0)
- {
- SRD2Wafer = SRD2ModuleInfo.WaferManager.Wafers[0];
- }
- if(PUF1ModuleInfo!=null)
- {
- if (PUF1ModuleInfo.WaferManager.Wafers.Count != 0)
- {
- PUF1WaferA = PUF1ModuleInfo.WaferManager.Wafers[0];
- }
- if (PUF1ModuleInfo.WaferManager.Wafers.Count != 0)
- {
- PUF1WaferB = PUF1ModuleInfo.WaferManager.Wafers[1];
- }
- }
- if(LoaderIsInstalled&&LoaderModuleInfo!=null)
- {
- if (LoaderModuleInfo.WaferManager.Wafers.Count != 0)
- {
- LoaderWaferA = LoaderModuleInfo.WaferManager.Wafers[0];
- }
- if (LoaderModuleInfo.WaferManager.Wafers.Count != 0)
- {
- LoaderWaferB = LoaderModuleInfo.WaferManager.Wafers[1];
- }
- }
- RobotMoveInfo = (RobotMoveInfo)QueryDataClient.Instance.Service.GetData("TM.RobotMoveAction");
- EfemRobotMoveInfo = (RobotMoveInfo)QueryDataClient.Instance.Service.GetData("EFEM.RobotMoveAction");
- LP1WaferCount = LP1ModuleInfo.WaferManager.Wafers.Where(x => x.WaferStatus != 0).Count();
- LP2WaferCount = LP2ModuleInfo.WaferManager.Wafers.Where(x => x.WaferStatus != 0).Count();
- LP3WaferCount = LP3ModuleInfo.WaferManager.Wafers.Where(x => x.WaferStatus != 0).Count();
- //Dummy1WaferCount = 15;
- Dummy1WaferCount = Dummy1ModuleInfo.WaferManager.Wafers.Where(x => x.WaferStatus != 0).Count();
- Dummy2WaferCount = Dummy2ModuleInfo.WaferManager.Wafers.Where(x => x.WaferStatus != 0).Count();
- RtDataValues = QueryDataClient.Instance.Service.PollData(m_RtDataKeys);
- IsLP1Unable = (bool)QueryDataClient.Instance.Service.GetConfig("EFEM.IsLoadPort1Unable");
- IsLP2Unable = (bool)QueryDataClient.Instance.Service.GetConfig("EFEM.IsLoadPort2Unable");
- IsLP3Unable = (bool)QueryDataClient.Instance.Service.GetConfig("EFEM.IsLoadPort3Unable");
- if (RtDataValues != null)
- {
- Puf1IsInRobotStation = CommonFunction.GetValue<bool>(RtDataValues, "PUF1.IsInRobotStation");
- if (CommonFunction.GetValue<int>(RtDataValues, "EquipmentStatus") == 4)
- {
- RouteState = "Resume";
- }
- else
- {
- RouteState = "Pause";
- }
- ControlJobInfo lp1Cj = CommonFunction.GetValue<ControlJobInfo>(RtDataValues, "LP1.CurrentControlJob");
- IsLP1HasNoJob = lp1Cj == null ? true : false;
- ControlJobInfo lp2Cj = CommonFunction.GetValue<ControlJobInfo>(RtDataValues, "LP2.CurrentControlJob");
- IsLP2HasNoJob = lp2Cj == null ? true : false;
- ControlJobInfo lp3Cj = CommonFunction.GetValue<ControlJobInfo>(RtDataValues, "LP3.CurrentControlJob");
- IsLP3HasNoJob = lp3Cj == null ? true : false;
- }
- }
- int count = 0;
- /// <summary>
- /// 定时器1
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void Timer1_Tick(object sender, EventArgs e)
- {
- if (m_RtDataKeys.Count != 0)
- {
- RtDataValues = QueryDataClient.Instance.Service.PollData(m_RtDataKeys);
- if (RtDataValues != null)
- {
- Puf1RotationMotorPosition = CommonFunction.GetValue<double>(RtDataValues, $"PUF1.Rotation.{MOTOR_POSITION}");
- Loader1TiltAMotorPosition = CommonFunction.GetValue<double>(RtDataValues, $"Loader1.TiltA.{MOTOR_POSITION}");
- Loader1TiltBMotorPosition = CommonFunction.GetValue<double>(RtDataValues, $"Loader1.TiltB.{MOTOR_POSITION}");
- Loader1RotationMotorPosition = CommonFunction.GetValue<double>(RtDataValues, $"Loader1.Rotation.{MOTOR_POSITION}");
- Puf1FlipMotorPosition = CommonFunction.GetValue<double>(RtDataValues, $"PUF1.Flip.{MOTOR_POSITION}");
- //计算Puf1 Rotation UI位置
- Puf1RotationPosition = _robotLayoutPosition + (_puf1RotationMotorPositionMax - Puf1RotationMotorPosition) / _puf1RotationRatio;
- //计Loader Rotation UI位置
- Loader1RotationPosition = -Loader1RotationMotorPosition - LOADER_ROTATION_DIFFER;
- //计算Puf1 Flip UI位置
- Puf1FlipPosition = Puf1FlipMotorPosition - PUF_FLIP_DIFFER;
- //判断Loader1的TiltA水平状态
- LoaderTiltACurrentStation = CommonFunction.GetCurrentStationLastContent(CommonFunction.GetValue<string>(RtDataValues, $"Loader1.TiltA.{CURRENT_STATION}"), "Loader1.TiltA");
- if (LoaderTiltACurrentStation == "HORI")
- {
- LoaderWaferVisibleA = true;
- }
- else if(LoaderTiltACurrentStation == "VERT")
- {
- LoaderWaferVisibleA = false;
- }
- //判断Loader1的TiltB水平状态
- LoaderTiltBCurrentStation = CommonFunction.GetCurrentStationLastContent(CommonFunction.GetValue<string>(RtDataValues, $"Loader1.TiltB.{CURRENT_STATION}"), "Loader1.TiltB");
- if (LoaderTiltBCurrentStation == "HORI")
- {
- LoaderWaferVisibleB = true;
- }
- else if (LoaderTiltBCurrentStation == "VERT")
- {
- LoaderWaferVisibleB = false;
- }
- }
- }
-
- }
-
- private async void RobotMoveInfoChanged(RobotMoveInfo oldValue, RobotMoveInfo newValue)
- {
- string RobotTarget;
- if (oldValue == null || newValue == null)
- {
- return;
- }
- #region Rotating
- if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && (newValue.Action == RobotAction.Rotating))
- {
- 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);
- }
- else if (arm == "ArmB")
- {
- Robot2TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
- }
- }
- #endregion
- #region pick 和 place LL
- else if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && (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")
- {
- var waferRobotTAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
- if (waferRobotTAction != Robot1TAction)
- {
- Robot1TAction = waferRobotTAction;
- }
- else
- {
- //await Task.Delay(100);
- }
- await Task.Delay(600);
- //Robot1TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
- //await Task.Delay(600);
- Robot1XAction = WaferRobotXAction.Extend;
- while ((newValue.Action == RobotAction.Placing && ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[0].WaferStatus != 0) || (newValue.Action == RobotAction.Picking && ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[0].WaferStatus == 0))
- {
- await Task.Delay(100);
- }
- Robot1XAction = WaferRobotXAction.Retract;
- }
- else if (arm == "ArmB")
- {
- var waferRobotTAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
- if (waferRobotTAction != Robot2TAction)
- {
- Robot2TAction = waferRobotTAction;
- }
- else
- {
- //await Task.Delay(100);
- }
- await Task.Delay(600);
- //Robot2TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
- //await Task.Delay(600);
- Robot2XAction = WaferRobotXAction.Extend;
- while ((newValue.Action == RobotAction.Placing && ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[1].WaferStatus != 0) || (newValue.Action == RobotAction.Picking && ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[1].WaferStatus == 0))
- {
- await Task.Delay(100);
- }
- Robot2XAction = WaferRobotXAction.Retract;
- }
- }
- #endregion
- #region pick 和 place pm
- else if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && 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")
- {
- var waferRobotTAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
- if (waferRobotTAction != Robot1TAction)
- {
- Robot1TAction = waferRobotTAction;
- }
- else
- {
- // await Task.Delay(100);
- }
- await Task.Delay(600);
- Robot1XAction = WaferRobotXAction.Extend;
- }
- else if (arm == "ArmB")
- {
- var waferRobotTAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
- if (waferRobotTAction != Robot2TAction)
- {
- Robot2TAction = waferRobotTAction;
- }
- else
- {
- // await Task.Delay(100);
- }
- await Task.Delay(600);
- Robot2XAction = WaferRobotXAction.Extend;
- }
- }
- else if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && 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
- #region Home
- else if (oldValue.Action == RobotAction.None && newValue.Action == RobotAction.Homing)
- {
- if (Robot1XAction == WaferRobotXAction.Extend)
- {
- Robot1XAction = WaferRobotXAction.Retract;
- }
- if (Robot2XAction == WaferRobotXAction.Extend)
- {
- Robot2XAction = WaferRobotXAction.Retract;
- }
- await Task.Delay(2000);
- if (Robot1TAction != WaferRobotTAction.T_Origin)
- {
- Robot1TAction = WaferRobotTAction.T_Origin;
- }
- if (Robot2TAction != WaferRobotTAction.T_Origin)
- {
- Robot2TAction = WaferRobotTAction.T_Origin;
- }
- }
- #endregion
- }
- private async void EFEMRobotMoveInfoChanged(RobotMoveInfo oldValue, RobotMoveInfo newValue)
- {
- string RobotTarget;
- if (oldValue == null || newValue == null)
- {
- return;
- }
- #region pick 和 place LL
- if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && (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")
- {
- var robot3Robot3TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
- //await Task.Delay(1000);
- await ChangePosition(robot3Robot3TAction, newValue.Action);
- if (Robot3TAction != robot3Robot3TAction)
- {
- Robot3TAction = robot3Robot3TAction;
- await Task.Delay(600);
- }
- Robot3XAction = WaferRobotXAction.Extend;
- while ((newValue.Action == RobotAction.Placing && ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers[0].WaferStatus != 0) || (newValue.Action == RobotAction.Picking && ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers[0].WaferStatus == 0))
- {
- await Task.Delay(100);
- }
- Robot3XAction = WaferRobotXAction.Retract;
- if(newValue.Action == RobotAction.Placing)
- {
- await ChangePosition(WaferRobotTAction.T_Origin, newValue.Action);
- }
-
- }
- }
- #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")
- {
- Robot3TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
- await Task.Delay(1500);
- //ChangePosition(Robot3TAction);
- //await Task.Delay(2000);
- Robot3XAction = WaferRobotXAction.Extend;
- }
- else if (arm == "ArmB")
- {
- Robot4TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
- await Task.Delay(1500);
- //ChangePosition(Robot4TAction);
- //await Task.Delay(2000);
- Robot4XAction = 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")
- {
- Robot3XAction = WaferRobotXAction.Retract;
- await Task.Delay(3000);
- //ChangePosition(Robot3TAction);
- //await Task.Delay(2000);
- }
- else if (arm == "ArmB")
- {
- Robot4XAction = WaferRobotXAction.Retract;
- await Task.Delay(3000);
- //ChangePosition(Robot3TAction);
- //await Task.Delay(2000);
- }
- }
- #endregion
- #region Home
- else if (oldValue.Action == RobotAction.None && newValue.Action == RobotAction.Homing)
- {
- if (Robot3XAction == WaferRobotXAction.Extend)
- {
- Robot3XAction = WaferRobotXAction.Retract;
- }
- if (Robot4XAction == WaferRobotXAction.Extend)
- {
- Robot4XAction = WaferRobotXAction.Retract;
- }
- if (Robot3TAction != WaferRobotTAction.T_Origin)
- {
- Robot3TAction = WaferRobotTAction.T_Origin;
- }
- if (Robot4TAction != WaferRobotTAction.T_Origin)
- {
- Robot4TAction = WaferRobotTAction.T_Origin;
- }
- await Task.Delay(1000);
- await ChangePosition(WaferRobotTAction.T_Origin, newValue.Action);
- }
- #endregion
- }
- private void addDataKeys()
- {
- m_RtDataKeys.Add("LP1.IsLoaded");
- m_RtDataKeys.Add("LP2.IsLoaded");
- m_RtDataKeys.Add("LP3.IsLoaded");
- m_RtDataKeys.Add("LP1.CassettePlaced");
- m_RtDataKeys.Add("LP2.CassettePlaced");
- m_RtDataKeys.Add("LP3.CassettePlaced");
- m_RtDataKeys.Add("LP1.CurrentControlJob");
- m_RtDataKeys.Add("LP2.CurrentControlJob");
- m_RtDataKeys.Add("LP3.CurrentControlJob");
-
- m_RtDataKeys.Add("System.IsAutoMode");
- m_RtDataKeys.Add("System.IsBusy");
- m_RtDataKeys.Add("Scheduler.CycledCount");
- m_RtDataKeys.Add("Scheduler.CycledWafer");
- m_RtDataKeys.Add("Scheduler.CycleSetPoint");
- m_RtDataKeys.Add("Scheduler.Throughput");
- m_RtDataKeys.Add("EquipmentStatus");
- m_RtDataKeys.Add("Scheduler.PjNameList");
- m_RtDataKeys.Add("PUF1.IsInRobotStation");
- m_RtDataKeys.Add("Scheduler.CjNameList");
- }
- private void addStationDataKeys()
- {
- m_RtDataKeys.Add($"Station.PUF1.Rotation");
- m_RtDataKeys.Add($"Station.PUF1.Flip");
- m_RtDataKeys.Add($"Station.PUF1.Vertical");
- m_RtDataKeys.Add($"Station.Loader1.Rotation");
- m_RtDataKeys.Add($"Station.Loader1.TiltA");
- m_RtDataKeys.Add($"Station.Loader1.TiltB");
- m_RtDataKeys.Add($"PUF1.Rotation.{MOTOR_POSITION}");
- m_RtDataKeys.Add($"PUF1.Flip.{MOTOR_POSITION}");
- m_RtDataKeys.Add($"Loader1.Rotation.{MOTOR_POSITION}");
- m_RtDataKeys.Add($"Loader1.TiltA.{MOTOR_POSITION}");
- m_RtDataKeys.Add($"Loader1.TiltB.{MOTOR_POSITION}");
- m_RtDataKeys.Add($"PUF1.Flip.{CURRENT_STATION}");
- m_RtDataKeys.Add($"Loader1.TiltA.{CURRENT_STATION}");
- m_RtDataKeys.Add($"Loader1.TiltB.{CURRENT_STATION}");
- m_RtDataKeys.Add($"PUF1.Rotation.{MOTION_DATA}");
- }
- private bool HasWaferOnSlot(List<WaferInfo> wafers, int index)
- {
- if (wafers[index].WaferStatus == 0)
- return false;
- return true;
- }
- private async Task ChangePosition(WaferRobotTAction waferRobotTAction, RobotAction robotAction)
- {
- await Task.Delay(500);
- int delay = 500;
- if (robotAction == RobotAction.Placing)
- {
- if (waferRobotTAction == WaferRobotTAction.LP1 || waferRobotTAction == WaferRobotTAction.PUF1)
- {
- CurrentRobotPosition = EFEM.RobotPosition.Left_Place;
- await Task.Delay(delay);
- }
- else if (waferRobotTAction == WaferRobotTAction.LP3)
- {
- CurrentRobotPosition = EFEM.RobotPosition.Right_Place;
- await Task.Delay(delay);
- }
- else if (waferRobotTAction == WaferRobotTAction.LP2 )
- {
- CurrentRobotPosition = EFEM.RobotPosition.Middle_Place;
- await Task.Delay(delay);
- }
- else if (waferRobotTAction == WaferRobotTAction.Aligner1)
- {
- CurrentRobotPosition = EFEM.RobotPosition.Aligner_Place;
- await Task.Delay(delay);
- }
- else if (waferRobotTAction == WaferRobotTAction.SRD1 || waferRobotTAction == WaferRobotTAction.SRD2)
- {
- CurrentRobotPosition = EFEM.RobotPosition.SRD_Place;
- }
- else if (waferRobotTAction == WaferRobotTAction.Dummy1 || waferRobotTAction == WaferRobotTAction.Dummy2)
- {
- CurrentRobotPosition = EFEM.RobotPosition.Dummy_Place;
- }
- else
- {
- CurrentRobotPosition = EFEM.RobotPosition.Origin;
- await Task.Delay(delay);
- }
- }
- else
- {
- if (waferRobotTAction == WaferRobotTAction.LP1 || waferRobotTAction == WaferRobotTAction.PUF1)
- {
- CurrentRobotPosition = EFEM.RobotPosition.Left;
- await Task.Delay(delay);
- }
- else if (waferRobotTAction == WaferRobotTAction.LP3)
- {
- CurrentRobotPosition = EFEM.RobotPosition.Right;
- await Task.Delay(delay);
- }
- else if (waferRobotTAction == WaferRobotTAction.LP2)
- {
- CurrentRobotPosition = EFEM.RobotPosition.Middle;
- await Task.Delay(delay);
- }
- else if (waferRobotTAction == WaferRobotTAction.Aligner1)
- {
- CurrentRobotPosition = EFEM.RobotPosition.Aligner;
- await Task.Delay(delay);
- }
- else if (waferRobotTAction == WaferRobotTAction.SRD1 || waferRobotTAction == WaferRobotTAction.SRD2)
- {
- CurrentRobotPosition = EFEM.RobotPosition.SRD;
- }
- else if (waferRobotTAction == WaferRobotTAction.Dummy1 || waferRobotTAction == WaferRobotTAction.Dummy2)
- {
- CurrentRobotPosition = EFEM.RobotPosition.Dummy;
- }
- else
- {
- CurrentRobotPosition = EFEM.RobotPosition.Origin;
- await Task.Delay(delay);
- }
- }
-
- }
- /// <summary>
- /// 计算最大值最小值
- /// </summary>
- /// <param name="Puf1RotationAxis"></param>
- /// <returns></returns>
- private (double max, double min) CalculateMaxMin(BeckhoffStationAxis pufAxis)
- {
- double max = 0;
- double min = 0;
- foreach (Station item in pufAxis.Stations)
- {
- double position = double.Parse(item.Position);
- if (position > max)
- {
- max = position;
- }
- if (position < min)
- {
- min = position;
- }
- }
- foreach (Station item in pufAxis.Stations)
- {
- double position = double.Parse(item.Position);
- if (position > max)
- {
- max = position;
- }
- if (position < min)
- {
- min = position;
- }
- }
- return (max, min);
- }
- /// <summary>
- /// 判定是否在station位置
- /// </summary>
- private bool JudgeAtStation(double targetPosition, double currentPosition, double tolerance)
- {
-
- if (Math.Abs(currentPosition - targetPosition) <= tolerance)
- {
- return true;
- }
- else
- {
- return false;
- }
- }
-
- #endregion
- }
- }
|