private void LoadTraysAll() { if (SelectedRack == null) { return; } // 测量过程中无法不能调整料库 if (SelectedRack.Status == RackStatus.RS_Busy) { return; } TraysOfRackViewModel trvm = new TraysOfRackViewModel(); trvm.Rack = SelectedRack; trvm.Trays.Clear(); //var trays = Trays.Where(t => t.Status == TrayStatus.TS_Idle).ToList(); var trays = Trays.Where(t => !t.Placed && t.PartCount != 0).ToList(); foreach (var item in trays) { trvm.Trays.Add(item); } TraysOfRackWindow trWindow = new TraysOfRackWindow(); trWindow.DataContext = trvm; trWindow.ShowDialog(); }
private void LoadTrayToRack() { if (SelectedTray == null) { return; } // 测量过程中无法不能调整料库 if (Rack.Status == RackStatus.RS_Busy) { return; } LoadTraysViewModel ltvm = new LoadTraysViewModel(); ltvm.SelectedTrayInRack = SelectedTray; ltvm.Rack = Rack; ltvm.Trays.Clear(); //var trays = Trays.Where(t => t.Status == TrayStatus.TS_Idle).ToList(); var trays = Trays.Where(t => !t.Placed && t.PartCount != 0).ToList(); foreach (var item in trays) { ltvm.Trays.Add(item); } LoadTrayToRackWindow ltWnd = new LoadTrayToRackWindow(); ltWnd.DataContext = ltvm; ltWnd.ShowDialog(); }
private void Add_Click(object sender, RoutedEventArgs e) { if (Trays.Where(t => t.Category == TrayViewModel.Category && t.TrayNb == TrayViewModel.TrayNb).Count() != 0) { return; } Tray tray = new Tray() { Id = Trays.Count + 1, // 表示未放置到料架上 Status = TrayStatus.TS_Idle, UseCmmNo = -1, Category = TrayViewModel.Category, TrayNb = TrayViewModel.TrayNb, CmmNo = TrayViewModel.CmmNo, SlotNb = -1, ColumnCount = TrayViewModel.ColumnCount, RowCount = TrayViewModel.RowCount, ColumnOffset = TrayViewModel.ColumnOffset, RowOffset = TrayViewModel.RowOffset, BaseColumnOffset = TrayViewModel.BaseColumnOffset, BaseRowOffset = TrayViewModel.BaseRowOffset, Placed = false, Parts = new ObservableCollection <Part>() }; for (int i = 0; i < tray.ColumnCount * tray.RowCount; i++) { tray.Parts.Add(new Part() { Id = i, SlotNb = i + 1, Status = PartStatus.PS_Empty }); } Trays.Add(tray); }