Example #1
0
        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;
        }
Example #2
0
        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);
                    }
                }
            }
        }
Example #3
0
        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);
        }
Example #4
0
        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);
            }
        }
        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;
                }
            }
        }