123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387 |
- using Aitex.Core.Common;
- using Aitex.Core.RT.SCCore;
- using Aitex.Core.UI.MVVM;
- using Aitex.Sorter.Common;
- using MECF.Framework.Common.OperationCenter;
- using System;
- using System.ComponentModel;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Input;
- using MECF.Framework.Common.Equipment;
- namespace Aitex.Sorter.UI.Controls
- {
- /// <summary>
- /// Wafer.xaml 的交互逻辑
- /// </summary>
- public partial class Wafer : UserControl
- {
- public static readonly DependencyProperty WaferItemProperty = DependencyProperty.Register(
- "WaferItem", typeof(WaferInfo), typeof(Wafer),
- new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.AffectsRender));
- public WaferInfo WaferItem
- {
- get
- {
- return (WaferInfo)GetValue(WaferItemProperty);
- }
- set
- {
- SetValue(WaferItemProperty, value);
- }
- }
- public bool IsEnableTextMenu
- {
- get { return (bool)GetValue(IsEnableTextMenuProperty); }
- set { SetValue(IsEnableTextMenuProperty, value); }
- }
- // Using a DependencyProperty as the backing store for IsEnableTextMenu. This enables animation, styling, binding, etc...
- public static readonly DependencyProperty IsEnableTextMenuProperty =
- DependencyProperty.Register("IsEnableTextMenu", typeof(bool), typeof(Wafer), new PropertyMetadata(true));
- public int Slot
- {
- get { return (int)GetValue(SlotProperty); }
- set { SetValue(SlotProperty, value); }
- }
- // Using a DependencyProperty as the backing store for Slot. This enables animation, styling, binding, etc...
- public static readonly DependencyProperty SlotProperty =
- DependencyProperty.Register("Slot", typeof(int), typeof(Wafer), new PropertyMetadata(-1));
- public ModuleName Station
- {
- get { return (ModuleName)GetValue(StationProperty); }
- set { SetValue(StationProperty, value); }
- }
- // Using a DependencyProperty as the backing store for Station. This enables animation, styling, binding, etc...
- public static readonly DependencyProperty StationProperty =
- DependencyProperty.Register("Station", typeof(ModuleName), typeof(Wafer), new PropertyMetadata(ModuleName.System));
- public ICommand WaferTransferCommand
- {
- get { return (ICommand)GetValue(WaferTransferCommandProperty); }
- set { SetValue(WaferTransferCommandProperty, value); }
- }
- public bool ShowSlot
- {
- get { return (bool)GetValue(ShowSlotProperty); }
- set { SetValue(ShowSlotProperty, value); }
- }
- // Using a DependencyProperty as the backing store for ShowSlot. This enables animation, styling, binding, etc...
- public static readonly DependencyProperty ShowSlotProperty =
- DependencyProperty.Register("ShowSlot", typeof(bool), typeof(Wafer), new PropertyMetadata(false));
-
- public bool ShowControl
- {
- get { return (bool)GetValue(ShowControlProperty); }
- set {
- SetValue(ShowControlProperty, value);
- }
- }
- public static readonly DependencyProperty ShowControlProperty =
- DependencyProperty.Register("ShowControl", typeof(bool), typeof(Wafer), new FrameworkPropertyMetadata(true, FrameworkPropertyMetadataOptions.None));
-
-
- // Using a DependencyProperty as the backing store for WaferMovementCommand. This enables animation, styling, binding, etc...
- public static readonly DependencyProperty WaferTransferCommandProperty =
- DependencyProperty.Register("WaferTransferCommand", typeof(ICommand), typeof(Wafer), new PropertyMetadata(null));
- public WaferDisplayMode WaferIDDisplayMode
- {
- get { return (WaferDisplayMode)GetValue(WaferDisplayModeProperty); }
- set { SetValue(WaferDisplayModeProperty, value); }
- }
- // Using a DependencyProperty as the backing store for WaferIDDisplayMode. This enables animation, styling, binding, etc...
- public static readonly DependencyProperty WaferDisplayModeProperty =
- DependencyProperty.Register("WaferIDDisplayMode", typeof(WaferDisplayMode), typeof(Wafer), new PropertyMetadata(WaferDisplayMode.None));
- public ICommand WaferTransferOptionCommand
- {
- get { return (ICommand)GetValue(WaferTransferOptionCommandProperty); }
- set { SetValue(WaferTransferOptionCommandProperty, value); }
- }
- // Using a DependencyProperty as the backing store for WaferTransferOptionCommand. This enables animation, styling, binding, etc...
- public static readonly DependencyProperty WaferTransferOptionCommandProperty =
- DependencyProperty.Register("WaferTransferOptionCommand", typeof(ICommand), typeof(Wafer), new PropertyMetadata(null));
- public ICommand CreateDeleteWaferCommand
- {
- get { return (ICommand)GetValue(CreateDeleteWaferCommandProperty); }
- set { SetValue(CreateDeleteWaferCommandProperty, value); }
- }
- // Using a DependencyProperty as the backing store for CreateDeleteWaferCommand. This enables animation, styling, binding, etc...
- public static readonly DependencyProperty CreateDeleteWaferCommandProperty =
- DependencyProperty.Register("CreateDeleteWaferCommand", typeof(ICommand), typeof(Wafer), new PropertyMetadata(null));
- private WaferStyle waferStyle = WaferStyle.Rect;
- public WaferStyle WaferStyle
- {
- get
- {
- return waferStyle;
- }
- set
- {
- waferStyle = value;
- }
- }
- public Wafer()
- {
- InitializeComponent();
- CreateDeleteWaferCommand = new DelegateCommand<string>(CreateDeleteWafer);
- root.DataContext = this;
- }
- private void Wafer_MouseMove(object sender, MouseEventArgs e)
- {
- if (WaferItem == null)
- {
- return;
- }
- if (e.LeftButton == MouseButtonState.Pressed && (WaferItem.Status == WaferStatus.Normal || WaferItem.Status == WaferStatus.Dummy) && !WaferItem.IsSource)
- {
- var data = new DataObject();
- data.SetData("Object", WaferItem);
- data.SetData("Station", Station);
- data.SetData("Slot", Slot);
- DragDrop.DoDragDrop(sender as DependencyObject,
- data,
- DragDropEffects.Copy | DragDropEffects.Move);
- }
- }
- private void Wafer_Drop(object sender, DragEventArgs e)
- {
- if (sender != null)
- {
- var target = (Border)sender;
- target.BorderThickness = new Thickness(0);
- if (target.ToolTip as ToolTip != null)
- ((ToolTip)target.ToolTip).IsOpen = false;
- var sourceWafer = (WaferInfo)e.Data.GetData("Object");
- var sourceStation = (ModuleName)e.Data.GetData("Station");
- var sourceSlot = (int)e.Data.GetData("Slot");
- if (sourceWafer == null)
- {
- return;
- }
- if (sourceStation == ModuleName.Robot && Station == ModuleName.Robot)
- {
- return;
- }
- WaferTransferOption transferOption = null;
- if (WaferTransferOptionCommand != null)
- {
- transferOption = new WaferTransferOption();
- WaferTransferOptionCommand.Execute(transferOption);
- }
- //if (sourceWafer.SubstE90Status == EnumE90Status.InProcess || sourceWafer.SubstE90Status== EnumE90Status.NeedProcessing)
- //{
- // return;
- //}
- var dialog = new WaferTransferDialog(sourceWafer, sourceStation, sourceSlot, Station, Slot, transferOption);
- dialog.SetControlShow(ShowControl);
- dialog.Owner = Window.GetWindow(this);
- if (dialog.ShowDialog() == true)
- {
- if (sourceWafer.Status == WaferStatus.Dummy)
- {
- if (WaferTransferCommand != null)
- {
- WaferTransferCommand.Execute(new SorterRecipeTransferTableItem
- {
- SourceStation = sourceStation,
- SourceSlot = sourceSlot,
- DestinationStation = Station,
- DestinationSlot = Slot,
- IsAlign = dialog.Aligner,
- IsTurnOver = dialog.TurnOver,
- IsReadLaserMarker = dialog.ReadLaserMarker,
- IsReadT7Code = dialog.ReadT7Code,
- AlignAngle = dialog.AlignerAngle
- });
- }
- }
- else
- {
- var moveType = MoveType.Move;
- MoveOption moveOption = 0;
- if (dialog.Aligner)
- {
- moveOption |= MoveOption.Align;
- }
- if (dialog.TurnOver)
- {
- moveOption |= MoveOption.Turnover;
- }
- if (dialog.ReadLaserMarker)
- {
- moveOption |= MoveOption.ReadID;
- }
- if (dialog.ReadT7Code)
- {
- moveOption |= MoveOption.ReadID2;
- }
- var hand = (Hand)dialog.Blade;
- object[] param;
- if (hand == Hand.Both)
- {
- param = new object[]
- {
- moveType,
- moveOption,
- hand,
- sourceStation,
- sourceSlot,
- Station,
- Slot,
- dialog.AlignerAngle
- };
- InvokeClient.Instance.Service.DoOperation(OperationName.MultiMoveWafer, param);
- }
- else
- {
- param = new object[]
- {
- moveType,
- moveOption,
- hand,
- sourceStation,
- sourceSlot,
- Station,
- Slot,
- dialog.AlignerAngle
- };
- InvokeClient.Instance.Service.DoOperation(OperationName.MoveWafer.ToString(), param);
- }
- }
- }
- }
- }
- private void CreateDeleteWafer(string cmd)
- {
- var param = new object[] { Station, Slot, WaferStatus.Normal };
- InvokeClient.Instance.Service.DoOperation(cmd, param);
- }
- private void Border_DragOver(object sender, DragEventArgs e)
- {
- var sourceWafer = (WaferInfo)e.Data.GetData("Object");
- var sourceStation = (ModuleName)e.Data.GetData("Station");
- var sourceSlot = (int)e.Data.GetData("Slot");
- if (!(sourceStation == Station && sourceSlot == Slot))
- {
- var target = (Border)sender;
- target.BorderThickness = new Thickness(1);
- ((ToolTip)target.ToolTip).Content = Slot + 1;
- ((ToolTip)target.ToolTip).IsOpen = true;
- }
- }
- private void Border_DragLeave(object sender, DragEventArgs e)
- {
- var sourceWafer = (WaferInfo)e.Data.GetData("Object");
- var sourceStation = (ModuleName)e.Data.GetData("Station");
- var sourceSlot = (int)e.Data.GetData("Slot");
- if (!(sourceStation == Station && sourceSlot == Slot))
- {
- var target = (Border)sender;
- target.BorderThickness = new Thickness(0);
- ((ToolTip)target.ToolTip).IsOpen = false;
- }
- }
- private void PreviewMouseRightButtonUp(object sender, MouseButtonEventArgs e)
- {
-
- e.Handled = IsEnableTextMenu ? false : true;
- }
- }
- public enum WaferStyle
- {
- Rect,
- Eclipse
- }
- public class WaferTransferOption
- {
- public WaferTransferOption()
- {
- Setting = new WaferTransferOptionSetting();
- }
- public bool Align { get; set; }
- public bool TurnOver { get; set; }
- public bool ReadLaserMarker { get; set; }
- public bool ReadT7Code { get; set; }
- public int Blade { get; set; }
- public double AlignerAngle { get; set; }
- public WaferTransferOptionSetting Setting { get; set; }
- }
- public class WaferTransferOptionSetting
- {
- public WaferTransferOptionSetting()
- {
- ShowAlign = true;
- ShowLaserMarker = true;
- ShowT7Code = true;
- ShowTurnOver = false;
- ShowBlade = true;
- ShowTurnOverBeforeAlign = true;
- }
- public bool ShowAlign { get; set; }
- public bool ShowLaserMarker { get; set; }
- public bool ShowT7Code { get; set; }
- public bool ShowTurnOver { get; set; } = false;
- public bool ShowBlade { get; set; }
- public bool ShowTurnOverBeforeAlign { get; set; } = false;
- }
- }
|