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; } } } } }
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; } } }
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; } } }
private void GelScaner_DataReceived(AbstractScaner scaner, T_BJ_SampleRack sampleRack) { CurrentGelBarcode = scaner.Read(); }
private void Scaner_DataReceived(AbstractScaner scaner) { ScanResult += scaner.Read() + Environment.NewLine; }