예제 #1
0
        private void Scaner_DataReceived(AbstractScaner scaner_tem)
        {
            string sample_code = "";
            var    scan_code   = scaner_tem.Read();

            if (IsInScanerCodeList(scan_code) == false)
            {
                scaner_code_list.Add(scan_code);
            }
            if (scaner_code_list.Count > 3)
            {
                scaner_code_list.RemoveAt(0);
            }
            if (scaner_code_list.Count == 3)
            {
                sample_index = GetSampleIndex(scaner_code_list, template_code_list);
                if (sample_index != -1)
                {
                    sample_code = scaner_code_list[1];
                    var sample_find = Samples.Where(item => item.Index == sample_index && item.RackIndex == rack_index).ToList();
                    if (sample_find.Count != 0)
                    {
                        sample_find[0].Barcode   = sample_code;
                        sample_find[0].RackIndex = (byte)rack_index;
                        sample_find[0].Index     = (byte)sample_index;
                        var resinfo = ResManager.getInstance().SearchGelCard("T_BJ_SampleRack", "", "", sample_index, rack_index);
                        if (resinfo != null)
                        {
                            resinfo.SetCode(sample_code);
                            resinfo.Values[resinfo.CountX, resinfo.CountY] = resinfo;
                        }
                    }
                }
            }
        }
예제 #2
0
        private void Scaner_DataReceived(AbstractScaner scaner, T_BJ_SampleRack sampleRack)
        {
            byte?curIndex = null;

            for (byte i = 0; i < 3; i++)
            {
                if (scanerVals[i] == null)
                {
                    scanerVals[i] = scaner.Read();
                    curIndex      = i;
                    break;
                }
            }
            if (curIndex == 2)
            {
                byte i1, i2;
                if (scanerVals[1].Length > 2 && scanerVals[0].Length <= 2 && scanerVals[2].Length <= 2 && byte.TryParse(scanerVals[0], out i1) && byte.TryParse(scanerVals[2], out i2))
                {
                    if (Math.Abs(i1 - i2) == 1)
                    {
                        var w      = (byte)(Math.Min(i1, i2) - 1);
                        var sample = Samples.Where(sam => sam.RackIndex == sampleRack.Index && sam.Index == w).FirstOrDefault();
                        if (sample == null)
                        {
                            sample = new SampleInfo()
                            {
                                RackIndex = sampleRack.Index, Index = w
                            };
                            Samples.Add(sample);
                        }
                        sample.Barcode = scanerVals[1];
                        var list = Samples.OrderBy(item => item.RackIndex.ToString() + item.Index.ToString("00")).ToArray();
                        Samples.Clear();
                        Samples.AddRange(list);
                    }
                    scanerVals[0] = scanerVals[2];
                    scanerVals[1] = null;
                    scanerVals[2] = null;
                }
                else
                {
                    scanerVals[0] = scanerVals[1];
                    scanerVals[1] = scanerVals[2];
                    scanerVals[2] = null;
                }
            }
        }
예제 #3
0
 public void OpenScaner()
 {
     if (SelectedItem == null)
     {
         return;
     }
     Scaner = IoC.Get <AbstractScaner>(SelectedItem.ScanerType);
     if (Scaner == null)
     {
         ScanResult += "不支持的型号:" + SelectedItem.ScanerType + Environment.NewLine;
         ScanResult += "打开阅读器失败!" + Environment.NewLine;
     }
     else
     {
         if (Scaner.IsOpen)
         {
             return;
         }
         ScanResult += "正在打开阅读器......" + Environment.NewLine;
         try
         {
             var res = true;
             if (!Scaner.IsOpen)
             {
                 Scaner.CancelAllEvent();
                 Scaner.Open(SelectedItem.Port);//115200
                 res = Scaner.Start(false);
                 if (res)
                 {
                     Scaner.DataReceived += Scaner_DataReceived;
                 }
                 else
                 {
                     Scaner.Close();
                 }
             }
             ScanResult += "打开阅读器" + (res ? "成功!" : "失败!") + Environment.NewLine;
         }catch (Exception ex)
         {
             ScanResult += ex.Message + Environment.NewLine;
             Scaner      = null;
         }
     }
 }
예제 #4
0
        private void Scaner_DataReceived(AbstractScaner scaner, T_BJ_SampleRack sampleRack)
        {
            byte?curIndex = null;

            for (byte i = 0; i < 3; i++)
            {
                if (scanerVals[i] == null)
                {
                    scanerVals[i] = scaner.Read();
                    curIndex      = i;
                    break;
                }
            }
            if (curIndex == 2)
            {
                byte i1, i2;
                if (scanerVals[1].Length > 2 && scanerVals[0].Length <= 2 && scanerVals[2].Length <= 2 && byte.TryParse(scanerVals[0], out i1) && byte.TryParse(scanerVals[2], out i2))
                {
                    if (Math.Abs(i1 - i2) == 1)
                    {
                        var w = (byte)(Math.Min(i1, i2) - 1);
                        if (Samples.Where(sam => sam.Index == w).FirstOrDefault() == null)
                        {
                            Samples.Add(new SampleInfo()
                            {
                                Index = w
                            });
                        }
                        var sample = Samples.Where(sam => sam.Index == w).FirstOrDefault();
                        sample.SetBarcode(sampleRack.Index, scanerVals[1]);
                    }
                    scanerVals[0] = scanerVals[2];
                    scanerVals[1] = null;
                    scanerVals[2] = null;
                }
                else
                {
                    scanerVals[0] = scanerVals[1];
                    scanerVals[1] = scanerVals[2];
                    scanerVals[2] = null;
                }
            }
        }
예제 #5
0
 private void GelScaner_DataReceived(AbstractScaner scaner, T_BJ_SampleRack sampleRack)
 {
     CurrentGelBarcode = scaner.Read();
 }
예제 #6
0
 private void Scaner_DataReceived(AbstractScaner scaner)
 {
     ScanResult += scaner.Read() + Environment.NewLine;
 }