private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            for (int i = 0; i < dtReagent.Rows.Count; i++)
            {
                if (!(bool)dtReagent.Rows[i]["Correct"])
                {
                    MessageBox.Show("请确认试剂" + dtReagent.Rows[i]["DisplayName"].ToString() + "。", "系统提示");
                    return;
                }
            }
            ReagentsAndSuppliesConsumptionController consumptionController = new ReagentsAndSuppliesConsumptionController();

            consumptionController.AddConsumption(dtReagent, 2);
            this.DialogResult = true;
            this.Close();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 每个操作完成调用此方法添加耗材消耗量
        /// </summary>
        /// <param name="rotationID"></param>
        /// <param name="operationID"></param>
        public void AddSuppliesConsumption(Guid rotationID, Guid operationID, FormulaParameters formulaParameters)
        {
            Dictionary <short, bool> operation = new OperationController().GetOperationOrders(operationID);
            List <ReagentAndSuppliesConfiguration> suppliseConfig = reagentConfigController.GetAll().FindAll(P => P.ItemType >= 100 && P.ItemType < 200);
            List <ReagentAndSupply> supplise = reagentController.GetReagentID(rotationID).FindAll(P => P.ItemType >= 100 && P.ItemType < 200);

            foreach (ReagentAndSuppliesConfiguration supplyconfig in suppliseConfig)
            {
                ReagentAndSupply supply = supplise.FirstOrDefault(P => P.ConfigurationItemID == supplyconfig.ItemID);
                if (supply != null)
                {
                    Guid   supplyID    = supply.ItemID;
                    double consumption = reagentConfigController.CalcVolume(supplyconfig.CalculationFormula, operation, formulaParameters);
                    reagentConsumptionController.AddConsumption(rotationID, supplyID, 0 - consumption, ConsumptionType.consume);
                }
            }
        }
Ejemplo n.º 3
0
        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("保存成功!", "系统提示");
        }