/// <summary> /// NeededVolume of Processing rotations /// </summary> /// <param name="list"></param> public void NeededVolumeofProcessingRotations(ref List <ReagentAndSuppliesConfiguration> list) { ReagentsAndSuppliesConsumptionController consumptionController = new ReagentsAndSuppliesConsumptionController(); List <ReagentsAndSuppliesConsumption> consumptions = consumptionController.GetProcessingRotationsVolume(); ReagentAndSuppliesController reagentController = new ReagentAndSuppliesController(); List <ReagentAndSupply> reagents = reagentController.GetAll(SessionInfo.ExperimentID); foreach (ReagentAndSuppliesConfiguration config in list) { double neededVolume = 0; List <ReagentAndSupply> listReagent = reagents.Where(P => P.ConfigurationItemID == config.ItemID).ToList(); if (listReagent != null && listReagent.Count > 0) { foreach (ReagentAndSupply reagent in listReagent) { ReagentsAndSuppliesConsumption consumption = consumptions.FirstOrDefault(P => P.ReagentAndSupplieID == reagent.ItemID); if (consumption != null && consumption.Volume != null) { neededVolume += (double)consumption.Volume; } } config.NeedVolume = neededVolume; } } }
/// <summary> /// Volume of one rotation /// </summary> /// <param name="list">0 need,1 consumption,2 add,3 firstAdd</param> public List <ReagentAndSuppliesConfiguration> GetRotationVolume(Guid experimentID, Guid rotationID, short[] volumeType, string volumeFiled) { ReagentsAndSuppliesConsumptionController consumptionController = new ReagentsAndSuppliesConsumptionController(); List <ReagentsAndSuppliesConsumption> consumptions = consumptionController.GetRotationVolume(rotationID, volumeType); ReagentAndSuppliesController reagentController = new ReagentAndSuppliesController(); List <ReagentAndSupply> reagents = reagentController.GetAll(experimentID); ReagentSuppliesConfigurationController configurationController = new ReagentSuppliesConfigurationController(); List <ReagentAndSuppliesConfiguration> list = configurationController.GetAllActived(); foreach (ReagentAndSuppliesConfiguration config in list) { double volume = 0; List <ReagentAndSupply> listReagent = reagents.Where(P => P.ConfigurationItemID == config.ItemID).ToList(); if (listReagent != null && listReagent.Count > 0) { foreach (ReagentAndSupply reagent in listReagent) { ReagentsAndSuppliesConsumption consumption = consumptions.FirstOrDefault(P => P.ReagentAndSupplieID == reagent.ItemID); if (consumption != null && consumption.Volume != null) { volume += (double)consumption.Volume; } } } Type type = typeof(ReagentAndSuppliesConfiguration); FieldInfo fieldInfo = type.GetField(volumeFiled, BindingFlags.NonPublic | BindingFlags.Instance); if (fieldInfo != null) { fieldInfo.SetValue(config, volume); } } return(list); }
/// <summary> /// volume of experiment /// </summary> /// <param name="list"></param> /// <param name="list">0 need,1 consumption,2 add,3 firstAdd</param> /// <param name="volumeFiled">the filed to update</param> public void UpdateExperimentTotalNeedConsumptionVolume(Guid experimentID, ref List <ReagentAndSuppliesConfiguration> list) { ReagentsAndSuppliesConsumptionController consumptionController = new ReagentsAndSuppliesConsumptionController(); List <ReagentsAndSuppliesConsumption> consumptions = consumptionController.GetExperimentVolume(experimentID, new short[] { ConsumptionType.Need, ConsumptionType.consume }); ReagentAndSuppliesController reagentController = new ReagentAndSuppliesController(); List <ReagentAndSupply> reagents = reagentController.GetAll(experimentID); foreach (ReagentAndSuppliesConfiguration config in list) { double volume = 0; List <ReagentAndSupply> listReagent = reagents.Where(P => P.ConfigurationItemID == config.ItemID).ToList(); if (listReagent != null && listReagent.Count > 0) { foreach (ReagentAndSupply reagent in listReagent) { ReagentsAndSuppliesConsumption consumption = consumptions.FirstOrDefault(P => P.ReagentAndSupplieID == reagent.ItemID); if (consumption != null && consumption.Volume != null) { volume += (double)consumption.Volume; } } if (config.ItemType == DiTiType.DiTi200 || config.ItemType == DiTiType.DiTi1000) { volume = volume / 96; volume = Math.Ceiling(volume * 10) / 10; } config.TotalNeedValueAndConsumption = volume; } } }
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> /// volume of experiment /// </summary> /// <param name="list"></param> /// <param name="list">0 need,1 consumption,2 add,3 firstAdd</param> /// <param name="volumeFiled">the filed to update</param> public void UpdateExperimentVolume(Guid experimentID, ref List <ReagentAndSuppliesConfiguration> list, short[] volumeType, string volumeFiled) { ReagentsAndSuppliesConsumptionController consumptionController = new ReagentsAndSuppliesConsumptionController(); List <ReagentsAndSuppliesConsumption> consumptions = consumptionController.GetExperimentVolume(experimentID, volumeType); ReagentAndSuppliesController reagentController = new ReagentAndSuppliesController(); List <ReagentAndSupply> reagents = reagentController.GetAll(experimentID); foreach (ReagentAndSuppliesConfiguration config in list) { double volume = 0; List <ReagentAndSupply> listReagent = reagents.Where(P => P.ConfigurationItemID == config.ItemID).ToList(); if (listReagent != null && listReagent.Count > 0) { foreach (ReagentAndSupply reagent in listReagent) { ReagentsAndSuppliesConsumption consumption = consumptions.FirstOrDefault(P => P.ReagentAndSupplieID == reagent.ItemID); if (consumption != null && consumption.Volume != null) { volume += (double)consumption.Volume; } } if (config.ItemType == DiTiType.DiTi200 || config.ItemType == DiTiType.DiTi1000) { config.CurrentActualVolume = volume; volume = volume / 96; volume = Math.Ceiling(volume * 10) / 10; } //if (volume < 0) // volume = 0.0; Type type = typeof(ReagentAndSuppliesConfiguration); FieldInfo filedInfo = type.GetField(volumeFiled, BindingFlags.NonPublic | BindingFlags.Instance); if (filedInfo != null) { filedInfo.SetValue(config, volume); } } } }
private void btnSave_Click(object sender, RoutedEventArgs e) { //MessageBoxResult msResult = MessageBox.Show("确认保存么", "系统提示", MessageBoxButton.YesNo, MessageBoxImage.Information); //if (msResult == MessageBoxResult.No) //{ // return; //} ReagentsAndSuppliesConsumptionController consumptionController = new ReagentsAndSuppliesConsumptionController(); ReagentAndSuppliesController reagentController = new ReagentAndSuppliesController(); PlateController plateController = new PlateController(); foreach (PlateBase plate in ViewPlates) { if (plate.ItemType == 101 && (plate.DisplayName.EndsWith("1") || plate.DisplayName.EndsWith("2"))) { string plateName = ""; if (plate.DisplayName.EndsWith("1")) { plateName = PlateName.DWPlate1; } if (plate.DisplayName.EndsWith("2")) { plateName = PlateName.DWPlate2; } plateController.UpdateBarcode(plateName, 0, SessionInfo.PraperRotation.RotationID, plate.Barcode); } ReagentAndSupply reagent = new ReagentAndSupply(); if ((isFirstRotation) || (!isFirstRotation && (plate.ItemType >= 100 && plate.ItemType < 200))) { reagent.ItemID = WanTaiObjectService.NewSequentialGuid(); reagent.BarCode = plate.Barcode; reagent.ItemType = plate.ItemType; reagent.ExperimentID = SessionInfo.ExperimentID; reagent.ConfigurationItemID = plate.ConfigurationItemID; reagentController.AddReagentAndSupplies(reagent); } else { reagent.ItemID = new ReagentAndSuppliesController().GetReagentID(SessionInfo.ExperimentID, plate.BarcodePrefix); if (reagent.ItemID == Guid.Empty) { reagent.ItemID = WanTaiObjectService.NewSequentialGuid(); reagent.BarCode = plate.Barcode; reagent.ItemType = plate.ItemType; reagent.ExperimentID = SessionInfo.ExperimentID; reagent.ConfigurationItemID = plate.ConfigurationItemID; reagentController.AddReagentAndSupplies(reagent); } } ReagentsAndSuppliesConsumption calcReagentConsumption = new ReagentsAndSuppliesConsumption(); calcReagentConsumption.ItemID = WanTaiObjectService.NewSequentialGuid(); if (plate.ActualSavedVolume > 0) { calcReagentConsumption.Volume = plate.ActualSavedVolume; } else { calcReagentConsumption.Volume = plate.NeedVolume; } calcReagentConsumption.UpdateTime = DateTime.Now; calcReagentConsumption.ExperimentID = SessionInfo.ExperimentID; calcReagentConsumption.RotationID = SessionInfo.PraperRotation.RotationID; calcReagentConsumption.VolumeType = ConsumptionType.Need; calcReagentConsumption.ReagentAndSupplieID = reagent.ItemID; consumptionController.AddConsumption(calcReagentConsumption); ReagentsAndSuppliesConsumption scanReagentConsumption = new ReagentsAndSuppliesConsumption(); scanReagentConsumption.ItemID = WanTaiObjectService.NewSequentialGuid(); scanReagentConsumption.UpdateTime = DateTime.Now; scanReagentConsumption.ExperimentID = SessionInfo.ExperimentID; scanReagentConsumption.RotationID = SessionInfo.PraperRotation.RotationID; scanReagentConsumption.VolumeType = ConsumptionType.FirstAdd; if (reagent.ItemType == DiTiType.DiTi200 || reagent.ItemType == DiTiType.DiTi1000) { scanReagentConsumption.Volume = plate.FirstAddVolume * 96; } else { scanReagentConsumption.Volume = plate.FirstAddVolume; } scanReagentConsumption.ReagentAndSupplieID = reagent.ItemID; consumptionController.AddConsumption(scanReagentConsumption); } btnScan.IsEnabled = false; btnManual.IsEnabled = false; btnSave.IsEnabled = false; btnNext.IsEnabled = true; btnSupplies.IsEnabled = false; btnReagent.IsEnabled = false; btnTestItem.IsEnabled = false; SessionInfo.NextButIndex = 3; ////MessageBox.Show("保存成功!", "系统提示"); }
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; } } }