public void CalacCorrentVolume() { ReagentSuppliesConfigurationController configurationController = new ReagentSuppliesConfigurationController(); CurrentList = configurationController.GetAll(); bool normalLevel = true; while (RunningLiquidThread) { configurationController.UpdateExperimentVolume(SessionInfo.ExperimentID, ref CurrentList, new short[] { 1, 2, 3 }, ReagentAndSuppliesConfiguration.CurrentVolumeFieldName); configurationController.NeededVolumeofProcessingRotations(ref CurrentList); normalLevel = CheckCurrentVolume(); if (normalLevel) { RiseNormal(this, null); Thread.Sleep(t); } else { if (RiseWarning != null) { ReagentWarningArgs args = new ReagentWarningArgs(); args.CurrentList = CurrentList; RiseWarning(this, args); } } } }
public bool CalacCorrentVolumeIsValid() { ReagentSuppliesConfigurationController configurationController = new ReagentSuppliesConfigurationController(); CurrentList = configurationController.GetAll(); bool normalLevel = true; configurationController.UpdateExperimentVolume(SessionInfo.ExperimentID, ref CurrentList, new short[] { 1, 2, 3 }, ReagentAndSuppliesConfiguration.CurrentVolumeFieldName); configurationController.NeededVolumeofProcessingRotations(ref CurrentList); normalLevel = CheckCurrentVolume(); return(normalLevel); }
public ReagentAndSuppliesList(Guid experimentID) { InitializeComponent(); reagentConfigController = new ReagentSuppliesConfigurationController(); reagentController = new ReagentAndSuppliesController(); DataTable dt = new DataTable(); dt.Columns.Add("BarCode", typeof(string)); dt.Columns.Add("DisplayName", typeof(string)); dt.Columns.Add("Volume", typeof(double)); dt.Columns.Add("Unit", typeof(string)); dt.Columns.Add("ItemType", typeof(string)); List <ReagentAndSuppliesConfiguration> reagentConfigs = reagentConfigController.GetAll(); reagentConfigController.UpdateExperimentVolume(experimentID, ref reagentConfigs, new short[] { ConsumptionType.consume }, ReagentAndSuppliesConfiguration.CurrentVolumeFieldName); reagentConfigController.UpdateExperimentVolume(experimentID, ref reagentConfigs, new short[] { ConsumptionType.Need }, ReagentAndSuppliesConfiguration.NeedVolumeFieldName); List <ReagentAndSupply> reagents = reagentController.GetAll(experimentID); List <DataModel.Configuration.ReagentSuppliesType> reagentType = Common.Configuration.GetReagentSuppliesTypes(); foreach (ReagentAndSuppliesConfiguration r in reagentConfigs) { string itemTypeName = string.Empty; string barCode = string.Empty; DataModel.Configuration.ReagentSuppliesType rType = reagentType.FirstOrDefault(P => P.TypeId == r.ItemType.ToString()); if (rType != null) { itemTypeName = rType.TypeName; } ReagentAndSupply reagent = reagents.FirstOrDefault(P => P.ConfigurationItemID == r.ItemID); if (reagent != null) { barCode = reagent.BarCode; } if (r.ItemType == 104 || r.ItemType == 105) { dt.Rows.Add(barCode, r.DisplayName, Math.Abs(r.CurrentVolume), r.Unit, itemTypeName); } else { dt.Rows.Add(barCode, r.DisplayName, Math.Abs(r.CurrentVolume), r.Unit, itemTypeName); } } dgReagentSupplies.DataContext = dt.DefaultView; }
/// <summary> /// Check DitiPlate by Scan Result,and Update Volume(Plate Count) to DataGrid /// </summary> /// <param name="dtScan"></param> private void CheckDitiByScanResult(DataTable dtScan) { int Diti1000 = 0; int Diti200 = 0; string Diti1000BarcodePrefix = new ReagentSuppliesConfigurationController().GetBarcodePrefix(DiTiType.DiTi1000); string Diti200BarcodePrefix = new ReagentSuppliesConfigurationController().GetBarcodePrefix(DiTiType.DiTi200); PlateBase plate = null; for (int i = 0; i < dtScan.Rows.Count; i++) { if (Diti1000BarcodePrefix != null && dtScan.Rows[i]["Barcode"].ToString().StartsWith(Diti1000BarcodePrefix) && dtScan.Rows[i]["TypeName"].ToString() == "DiTi 1000ul") { switch (Diti1000) { case 0: plate = ViewPlates.FirstOrDefault( P => (P.ContainerName == "005" && P.Position == 1)); break; case 1: plate = ViewPlates.FirstOrDefault( P => (P.ContainerName == "005" && P.Position == 2)); break; default: plate = ViewPlates.FirstOrDefault( P => (P.ContainerName == "006" && P.Position == Diti1000)); break; } Diti1000++; } else if (Diti200BarcodePrefix != null && dtScan.Rows[i]["Barcode"].ToString().StartsWith(Diti200BarcodePrefix) && dtScan.Rows[i]["TypeName"].ToString() == "DiTi 200 ul") { switch (Diti200) { case 0: plate = ViewPlates.FirstOrDefault( P => (P.ContainerName == "005" && P.Position == 3)); break; default: plate = ViewPlates.FirstOrDefault( P => (P.ContainerName == "007" && P.Position == Diti200 + 1)); break; } Diti200++; } else { continue; } if (plate != null) { plate.Correct = true; plate.Barcode = dtScan.Rows[i]["Barcode"].ToString(); plate.FirstAddVolume = 0; } foreach (ReagentAndSuppliesConfiguration reagent in reagentAndSupplies) { if (dtScan.Rows[i]["Barcode"].ToString().StartsWith(reagent.BarcodePrefix)) { reagent.FirstAddVolume += (double)dtScan.Rows[i]["Volume"]; break; } } } }
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 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 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(); } }
private void WhenAdd() { //DataGrid AddColumns(dtReagent); ReagentSuppliesConfigurationController configurationController = new ReagentSuppliesConfigurationController(); List <ReagentAndSuppliesConfiguration> configurations = configurationController.GetAllActived().Where(P => P.ItemType < 100).OrderBy(P => P.ItemType).ToList(); configurationController.UpdateExperimentVolume(SessionInfo.ExperimentID, ref configurations, new short[] { ConsumptionType.consume, ConsumptionType.Add, ConsumptionType.FirstAdd }, ReagentAndSuppliesConfiguration.CurrentVolumeFieldName); //configurationController.UpdateExperimentVolume(SessionInfo.ExperimentID, ref configurations, new short[] { // ConsumptionType.Need }, ReagentAndSuppliesConfiguration.NeedVolumeFieldName); configurationController.NeededVolumeofProcessingRotations(ref configurations); List <ReagentAndSupply> reagents = new ReagentAndSuppliesController().GetAll(SessionInfo.ExperimentID); foreach (ReagentAndSuppliesConfiguration config in configurations) { if (config.ItemType >= 100) { continue; } Guid?reagentAndSuppplieID = null; config.Correct = config.Correct = config.NeedVolume == 0 ? true : config.CurrentVolume > config.NeedVolume * Common.Configuration.GetMinVolume(); ReagentAndSupply reagent = reagents.FirstOrDefault(P => P.ConfigurationItemID == config.ItemID); if (reagent != null) { reagentAndSuppplieID = reagent.ItemID; } dtReagent.Rows.Add(config.DisplayName, config.CurrentVolume, 0, config.Unit, config.Correct, config.ItemType, reagentAndSuppplieID, config.NeedVolume, config.NeedVolume * Common.Configuration.GetMinVolume(), config.ItemID); } dtReagent.DefaultView.Sort = "ItemType"; dgReagent.DataContext = dtReagent.DefaultView.FindRows(0); foreach (short dataGridKey in dataGridDictionary.Keys) { dataGridDictionary[dataGridKey].ItemsSource = dtReagent.DefaultView.FindRows(dataGridKey); } //Drawing Plates and Carriers viewPlates = new Services.DeskTopService().SetReagentPosition(configurations, new CarrierController().GetCarrier(), 0); double lengthUnit = (this.Width - 50) / 84; double cooPoint = 1.4; panelDeskTop.Width = (this.Width - 50); panelDeskTop.Height = lengthUnit * 30; View.Services.DeskTopService desktopService = new Services.DeskTopService(); carrierBases = desktopService.GetCarriers(lengthUnit, cooPoint); foreach (CarrierBase carrier in carrierBases) { carrier.UpdatePlate(viewPlates.FindAll(P => P.ContainerName == carrier.CarrierName)); panelDeskTop.Children.Add(carrier); } panelDeskTop.Children.Add(desktopService.DrawCoordinate((this.Width - 50), 69, lengthUnit)); for (int i = 0; i < dtReagent.Rows.Count; i++) { if (!(bool)dtReagent.Rows[i]["Correct"]) { this.btnSave.Visibility = System.Windows.Visibility.Visible; } } }