public RubbishAlert(Guid RotationID) { InitializeComponent(); double lenghtUnit = deskTop.Width / 84; imgKingFisher.Width = lenghtUnit * 24; imgKingFisher.Height = lenghtUnit * 24; imgKingFisher.Margin = new Thickness(-lenghtUnit * 2 * 1.4, lenghtUnit * 1, 0, lenghtUnit * 2); deskTop.Children.Add(desktopService.DrawCoordinate(deskTop.Width, 69, lenghtUnit)); List <CarrierBase> carriers = desktopService.GetCarriers(lenghtUnit, 1.4); List <ReagentAndSuppliesConfiguration> supplies = new ReagentSuppliesConfigurationController(). GetRotationVolume(SessionInfo.ExperimentID, RotationID, new short[] { 0 }, ReagentAndSuppliesConfiguration.CurrentVolumeFieldName).FindAll(P => P.ItemType >= 100 && P.ItemType < 200); List <PlateBase> plates = new List <PlateBase>(); if (supplies.Exists(P => P.ItemType == 101)) { ReagentAndSuppliesConfiguration supply = supplies.First(P => P.ItemType == 101); PlateBase plate = new Control.Plate(); plate.DisplayName = supply.DisplayName; plate.ChineseName = supply.DisplayName; plate.NeedVolume = 1; plate.CurrentVolume = 1; plate.Grid = 1; plate.Position = 1; plate.ContainerName = "001"; plate.Color = new SolidColorBrush((Color)ColorConverter.ConvertFromString(supply.Color)); plate.ItemType = (short)supply.ItemType; plate.BarcodePrefix = supply.BarcodePrefix; plate.ConfigurationItemID = supply.ItemID; plate.Correct = false; plates.Add(plate); } Brush PCRPlateColor = new SolidColorBrush(Colors.Red); foreach (ReagentAndSuppliesConfiguration supply in supplies) { Brush color = new SolidColorBrush((Color)ColorConverter.ConvertFromString(supply.Color)); if (supply.ItemType == DiTiType.DiTi1000)//DiTi1000 { //int position = 1; //int grid = 1; //string containerName = supply.ContainerName; //int totalCount = int.Parse(decimal.Ceiling(decimal.Parse((supply.CurrentVolume / 96).ToString())).ToString()); //for (int i = 0; i < totalCount; i++) //{ // PlateBase plate = new WanTai.View.Control.Plate(); // plate.DisplayName = supply.DisplayName + " " + (i + 1).ToString(); // plate.ChineseName = supply.DisplayName; // plate.NeedVolume = 1; // plate.CurrentVolume = 1; // plate.Grid = grid; // plate.Position = position; // plate.ContainerName = "006"; // plate.Color = color; // plate.ItemType = (short)supply.ItemType; // plate.ConfigurationItemID = supply.ItemID; // plate.Correct = false; // plates.Add(plate); // position++; // if (i == 5) break; //} } else if (supply.ItemType == DiTiType.DiTi200)//DiTi200 { //int position = 1; //int grid = 1; //string containerName = supply.ContainerName; //int totalCount = int.Parse(decimal.Ceiling(decimal.Parse((supply.CurrentVolume / 96).ToString())).ToString()); //for (int i = 0; i < totalCount; i++) //{ // PlateBase plate = new WanTai.View.Control.Plate(); // plate.DisplayName = supply.DisplayName + " " + (i + 1).ToString(); // plate.ChineseName = supply.DisplayName; // plate.NeedVolume = 1; // plate.CurrentVolume = 1; // plate.Grid = grid; // plate.Position = position; // plate.ContainerName = "007"; // plate.Color = color; // plate.ItemType = (short)supply.ItemType; // plate.ConfigurationItemID = supply.ItemID; // plate.Correct = false; // plates.Add(plate); // position++; // if (i == 3) break; //} } else if (supply.ItemType == 103) //&& supply.NeedVolume>0)//PCR Plate { PCRPlateColor = color; int position = 2; int grid = 1; //string containerName = supply.ContainerName; //for (int i = 0; i < supply.CurrentVolume; i++) //{ PlateBase plate = new WanTai.View.Control.Plate(); plate.DisplayName = supply.DisplayName; plate.ChineseName = supply.DisplayName; plate.NeedVolume = 1; plate.CurrentVolume = 1; plate.Grid = grid; plate.Position = position; plate.ContainerName = "002"; plate.Color = color; plate.ItemType = (short)supply.ItemType; plate.ConfigurationItemID = supply.ItemID; plate.Correct = false; plates.Add(plate); //position++; //if (i == 2) break; //} } } /* * //DW96Plate3、DW96Plate4、DW96Plate5 * PlateBase PCRPlate = new WanTai.View.Control.Plate(); * PCRPlate.DisplayName = "DW96Plate3"; * PCRPlate.ChineseName = "DW96Plate3"; * PCRPlate.NeedVolume = 1; * PCRPlate.CurrentVolume = 1; * PCRPlate.Grid = 1; * PCRPlate.Position = 1; * PCRPlate.ContainerName = "002"; * PCRPlate.Color = PCRPlateColor; * PCRPlate.ItemType = 100; * PCRPlate.ConfigurationItemID = new Guid(); * PCRPlate.Correct = false; * plates.Add(PCRPlate); * * PlateBase PCRPlate = new WanTai.View.Control.Plate(); * PCRPlate.DisplayName = "DW96Plate4"; * PCRPlate.ChineseName = "DW96Plate4"; * PCRPlate.NeedVolume = 1; * PCRPlate.CurrentVolume = 1; * PCRPlate.Grid = 1; * PCRPlate.Position = 2; * PCRPlate.ContainerName = "002"; * PCRPlate.Color = PCRPlateColor; * PCRPlate.ItemType = 102; * PCRPlate.ConfigurationItemID = new Guid(); * PCRPlate.Correct = false; * plates.Add(PCRPlate); * * PCRPlate = new WanTai.View.Control.Plate(); * PCRPlate.DisplayName = "DW96Plate5"; * PCRPlate.ChineseName = "DW96Plate5"; * PCRPlate.NeedVolume = 1; * PCRPlate.CurrentVolume = 1; * PCRPlate.Grid = 1; * PCRPlate.Position = 3; * PCRPlate.ContainerName = "002"; * PCRPlate.Color = PCRPlateColor; * PCRPlate.ItemType = 103; * PCRPlate.ConfigurationItemID = new Guid(); * PCRPlate.Correct = false; * plates.Add(PCRPlate); */ foreach (CarrierBase c in carriers) { c.UpdatePlate(plates.FindAll(P => P.ContainerName == c.CarrierName)); deskTop.Children.Add(c); c.Scan(); } this.RotationID = RotationID; }
public void DrawDeskTopInGrid() { reagentAndSupplies.Clear(); RotationInfo firstRotation = new ConfigRotationController().GetCurrentRotationInfos(SessionInfo.ExperimentID).FirstOrDefault(); if (firstRotation == null) { return; } isFirstRotation = firstRotation.RotationID == SessionInfo.PraperRotation.RotationID; //Binding DataGrid Dictionary <short, bool> operationOrders = new OperationController().GetOperationOrders(SessionInfo.PraperRotation.OperationID); ReagentSuppliesConfigurationController configController = new ReagentSuppliesConfigurationController(); reagentAndSupplies = configController.GetReagentAndSuppliesNeeded(operationOrders, SessionInfo.RotationFormulaParameters[SessionInfo.PraperRotation.RotationID]); if (!isFirstRotation) { configController.UpdateExperimentVolume(SessionInfo.ExperimentID, ref reagentAndSupplies, new short[] { ConsumptionType.FirstAdd, ConsumptionType.Add, ConsumptionType.consume }, ReagentAndSuppliesConfiguration.CurrentVolumeFieldName); configController.UpdateExperimentTotalNeedConsumptionVolume(SessionInfo.ExperimentID, ref reagentAndSupplies); foreach (DataGrid dg in dataGridDictionary.Values) { dg.Columns[2].Visibility = Visibility.Visible; dg.Columns[5].Visibility = Visibility.Hidden; } } else { foreach (DataGrid dg in dataGridDictionary.Values) { dg.Columns[2].Visibility = Visibility.Hidden; dg.Columns[5].Visibility = Visibility.Hidden; } } dgSupplies.ItemsSource = reagentAndSupplies.Where(P => (short)P.ItemType >= 100 && (short)P.ItemType < 200).ToList(); dgReagent.ItemsSource = reagentAndSupplies.Where(P => (short)P.ItemType == 0).ToList(); List <ReagentSuppliesType> reagentSuppliesType = Common.Configuration.GetReagentSuppliesTypes(); foreach (ReagentSuppliesType reagentType in reagentSuppliesType) { short typeid = Convert.ToInt16(reagentType.TypeId); if (0 != typeid && typeid < 100 && typeid % 5 == 0 && dataGridDictionary.ContainsKey(reagentType.TypeName)) { dataGridDictionary[reagentType.TypeName].ItemsSource = reagentAndSupplies.Where(P => (short)P.ItemType == typeid).OrderByDescending(P => P.Grid); } } //Binding UserControl Services.DeskTopService deskTopService = new DeskTopService(); ViewPlates.Clear(); ViewPlates = deskTopService.SetReagentPosition(reagentAndSupplies, new CarrierController().GetCarrier(), 0);//create plates List <CarrierBase> carriers = deskTopService.GetCarriers(lengthUnit, cooPoint); foreach (CarrierBase c in carriers) { c.UpdatePlate(ViewPlates.FindAll(P => P.ContainerName == c.CarrierName)); if (c.CarrierName == "001" && !isFirstRotation) { List <PlateBase> greenPlate = ViewPlates.FindAll(P => P.ItemType == 101 && (P.DisplayName.Contains("1") || P.DisplayName.Contains("2"))); string[] plateNames = new string[greenPlate.Count]; int index = 0; foreach (PlateBase plate in greenPlate) { plateNames[index] = plate.DisplayName; index++; } c.ShiningWithGreen(plateNames); } if (c.CarrierName == "006") { //labelRotationName.ActualWidth 40 labDiTi1000.ActualWidth 50 labDiTi1000.Margin = new Thickness(c.Margin.Left + c.Width / 2 - 50 / 2 - 40 - 10, 0, 0, 0); } if (c.CarrierName == "007") { labDiTi200.Margin = new Thickness(c.Margin.Left + c.Width / 6 * 4 / 2 - 50 / 2 - 10 - labDiTi1000.Margin.Left - 50 - 50, 0, 0, 0); } DeskTopWithGrid.Children.Add(c); } }
public PCRRubbishAlert(Guid RotationID) { InitializeComponent(); double lenghtUnit = deskTop.Width / 84; imgKingFisher.Width = lenghtUnit * 24; imgKingFisher.Height = lenghtUnit * 24; imgKingFisher.Margin = new Thickness(-lenghtUnit * 2 * 1.4, lenghtUnit * 1, 0, lenghtUnit * 2); deskTop.Children.Add(desktopService.DrawCoordinate(deskTop.Width, 69, lenghtUnit)); List <CarrierBase> carriers = desktopService.GetCarriers(lenghtUnit, 1.4); List <ReagentAndSuppliesConfiguration> supplies = new ReagentSuppliesConfigurationController(). GetRotationVolume(SessionInfo.ExperimentID, RotationID, new short[] { 0 }, ReagentAndSuppliesConfiguration.CurrentVolumeFieldName).FindAll(P => P.ItemType >= 100 && P.ItemType < 200); List <PlateBase> plates = new List <PlateBase>(); //if (supplies.Exists(P => P.ItemType == 101))//dw 96 plate //{ // ReagentAndSuppliesConfiguration supply = supplies.First(P => P.ItemType == 101); // PlateBase plate = new Control.Plate(); // plate.DisplayName = supply.DisplayName; // plate.ChineseName = supply.DisplayName; // plate.NeedVolume = 1; // plate.CurrentVolume = 1; // plate.Grid = 1; // plate.Position = 1; // plate.ContainerName = "001"; // plate.Color = new SolidColorBrush((Color)ColorConverter.ConvertFromString(supply.Color)); // plate.ItemType = (short)supply.ItemType; // plate.BarcodePrefix = supply.BarcodePrefix; // plate.ConfigurationItemID = supply.ItemID; // plate.Correct = false; // // plates.Add(plate); //} //if (supplies.Exists(P => P.ItemType == 102))//96 Tip Comb //{ // ReagentAndSuppliesConfiguration supply = supplies.First(P => P.ItemType == 102); // PlateBase plate = new Control.Plate(); // plate.DisplayName = supply.DisplayName; // plate.ChineseName = supply.DisplayName; // plate.NeedVolume = 1; // plate.CurrentVolume = 1; // plate.Grid = 1; // plate.Position = 1; // plate.ContainerName = "001"; // plate.Color = new SolidColorBrush((Color)ColorConverter.ConvertFromString(supply.Color)); // plate.ItemType = (short)supply.ItemType; // plate.BarcodePrefix = supply.BarcodePrefix; // plate.ConfigurationItemID = supply.ItemID; // plate.Correct = false; // plates.Add(plate); //} Brush PCRPlateColor = new SolidColorBrush(Colors.Red); foreach (ReagentAndSuppliesConfiguration supply in supplies) { if (supply.ItemType == 101)//dw 96 plate { for (int i = 1; i < 4; i++) { PlateBase plate = new Control.Plate(); plate.DisplayName = supply.DisplayName + " " + (6 - i).ToString();; plate.ChineseName = supply.DisplayName; plate.NeedVolume = 1; plate.CurrentVolume = 1; plate.Grid = 1; plate.Position = i; plate.ContainerName = "002"; plate.Color = new SolidColorBrush((Color)ColorConverter.ConvertFromString(supply.Color)); plate.ItemType = (short)supply.ItemType; plate.BarcodePrefix = supply.BarcodePrefix; plate.ConfigurationItemID = supply.ItemID; plate.Correct = true; plates.Add(plate); } } else if (supply.ItemType == 102 && supply.CurrentVolume > 0)//96 Tip Comb { PlateBase plate = new Control.Plate(); plate.DisplayName = supply.DisplayName; plate.ChineseName = supply.DisplayName; plate.NeedVolume = 1; plate.CurrentVolume = 1; plate.Grid = 1; plate.Position = 1; plate.ContainerName = "001"; plate.Color = new SolidColorBrush((Color)ColorConverter.ConvertFromString(supply.Color)); plate.ItemType = (short)supply.ItemType; plate.BarcodePrefix = supply.BarcodePrefix; plate.ConfigurationItemID = supply.ItemID; plate.Correct = true; plates.Add(plate); } else if (supply.ItemType == 103 && supply.CurrentVolume > 0)//PCR Plate { int position = 5; int grid = 1; PlateBase plate = new WanTai.View.Control.Plate(); plate.DisplayName = supply.DisplayName; plate.ChineseName = supply.DisplayName; plate.NeedVolume = 1; plate.CurrentVolume = 1; plate.Grid = grid; plate.Position = position; plate.ContainerName = "007"; plate.Color = new SolidColorBrush((Color)ColorConverter.ConvertFromString(supply.Color)); plate.ItemType = (short)supply.ItemType; plate.ConfigurationItemID = supply.ItemID; plate.Correct = true; plates.Add(plate); } } foreach (CarrierBase c in carriers) { List <PlateBase> greenPlate = plates.FindAll(P => P.ContainerName == c.CarrierName); c.UpdatePlate(greenPlate); deskTop.Children.Add(c); string[] plateNames = new string[greenPlate.Count]; int index = 0; foreach (PlateBase plate in greenPlate) { plateNames[index] = plate.DisplayName; index++; } c.ShiningWithGreen(plateNames); //c.Scan(); } }