Esempio n. 1
0
        private static Brush GetFillBrush(ConveyorCell cell)
        {
            Brush brush = Brushes.LightGray;

            switch (cell.State)
            {
            case ConveyorCellState.Empty:
                brush = Brushes.LightGray;
                break;

            case ConveyorCellState.Processed:
                brush = Brushes.LightGreen;
                break;

            case ConveyorCellState.Processing:
                brush = Brushes.Khaki;
                break;

            case ConveyorCellState.Error:
                brush = Brushes.LightPink;
                break;

            default:
                break;
            }

            return(brush);
        }
Esempio n. 2
0
        // TODO: А что, если пробирка найдена, но в cell уже забит штрих-код другой пробирки?
        // (это все к вопросу о том, что мы не можем остлеживать точно полный круг конвейера)
        private void searchTubeInConveyorCell(int attemptsNumber)
        {
            ConveyorCell cell = conveyor.Cells[conveyor.CellInScanPosition];

            Logger.Debug($"Запущен поиск пробирки (сканирование)");

            Analyzer.Conveyor.Shift(reverse: false);

            int attempt = 0;

            while (attempt < attemptsNumber)
            {
                Logger.Debug($"Попытка {attempt}.");

                Analyzer.Conveyor.RotateAndScanTube();

                string barcode = Analyzer.State.TubeBarcode;

                if (!string.IsNullOrWhiteSpace(barcode))
                {
                    Logger.Debug($"Обнаружена пробирка со штрихкодом [{barcode}].");

                    cell.AnalysisBarcode = searchBarcodeInDatabase(barcode).BarCode; // TODO: - может вернуть null

                    if (!cell.IsEmpty)
                    {
                        Logger.Debug($"Пробирка со штрихкодом [{barcode}] найдена в списке анализов!");
                        searchBarcodeInDatabase(cell.AnalysisBarcode).IsFind = true;
                    }
                    else
                    {
                        Logger.Debug($"Пробирка со штрихкодом [{barcode}] не найдена в списке анализов!");
                    }
                    break;
                }
                else
                {
                    Logger.Debug($"Пробирка не обнаружена.");
                }
                attempt++;
            }

            Logger.Debug($"Поиск пробирки (сканирование) завершен.");
        }
Esempio n. 3
0
        private Ellipse getEllipse(Point point, int num, double diameter)
        {
            Brush fillBrush = Brushes.LightGray;

            ConveyorCell cell = Cells[num];

            fillBrush = GetFillBrush(cell);

            Ellipse Ellipse = new Ellipse
            {
                Tag             = num,
                Width           = diameter,
                Height          = diameter,
                Fill            = fillBrush,
                Stroke          = Brushes.Black,
                StrokeThickness = 1
            };

            Canvas.SetLeft(Ellipse, point.X - diameter / 2);
            Canvas.SetTop(Ellipse, point.Y - diameter / 2);
            return(Ellipse);
        }