private void ProcessReagentBarcodeScan() { string s = new ReagentBarcode().GetRgBracodePara(ReagentDisk, cboReagentPos.Text.Trim(), txtBarcode.Text.Trim()) as string; if (s == null) { if (this.InputReagentBarcodeEvent != null) { this.InputReagentBarcodeEvent(ReagentDisk); } MessageBox.Show(txtBarcode.Text.Trim() + "条码装载试剂成功!"); } else { MessageBox.Show(s); } //Thread.Sleep(500); this.Close(); }
public object Process(string barcode, int disk, string position) { string b = Decode(barcode); if (b == null) { string erinfo = "条码:" + barcode + "解码失败"; TroubleLog t = new TroubleLog(); t.TroubleCode = "7777771"; t.TroubleType = TROUBLETYPE.ERR; t.TroubleUnit = @"试剂条码"; t.TroubleInfo = erinfo; new TroubleLogService().Save(t); return("条码:" + barcode + "不识别"); } this.Disk = disk; this.Position = position; RGTPosition newreagentPosition = AnanlyeBarcode(b, barcode); if (newreagentPosition == null) { return("条码:" + barcode + "不识别"); } AssayRunPara a = new AssayRunParaService().Get(newreagentPosition.Assay) as AssayRunPara; if (a != null) { if (a.R2Vol == 0 && newreagentPosition.AssayPara == "R2") { string erinfo = "条码:" + barcode + "不能装填。原因:参数试剂2体积为0,不能在该位置装填试剂2"; TroubleLog t = new TroubleLog(); t.TroubleCode = "7777771"; t.TroubleType = TROUBLETYPE.ERR; t.TroubleUnit = @"试剂条码"; t.TroubleInfo = erinfo; new TroubleLogService().Save(t); return("条码:" + barcode + "装填失败"); } } //检查该条码在试剂盘中是否存在 RGTPosition barrgtpos = new RGTPOSManager().GetAssayALLReagentByBarcode(newreagentPosition.BarCode); if (barrgtpos == null) { //newreagentPosition.AssayPara = "MR1"; } else { ReagentBarcode r = new ReagentBarcode(); r.Barcode = barrgtpos.BarCode; r.ValidPercent = barrgtpos.ValidPercent; r.ExchangeDatetime = DateTime.Now; new ReagentBarcodeService().InsertReagentBarcode(r); new RGTPOSManager().Delete(barrgtpos); //newreagentPosition.AssayPara = barrgtpos.AssayPara; } RGTPosition rgtpos = new RGTPOSManager().Get(disk, position); if (rgtpos == null) { } else { ReagentBarcode r = new ReagentBarcode(); r.Barcode = rgtpos.BarCode; r.ValidPercent = rgtpos.ValidPercent; r.ExchangeDatetime = DateTime.Now; new ReagentBarcodeService().InsertReagentBarcode(r); new RGTPOSManager().Delete(rgtpos); } List <CLItem> reagents = new RGTPOSManager().GetAssayALLReagent(newreagentPosition.Assay); if (newreagentPosition.AssayPara == "R1") { bool f1 = false; foreach (RGTPosition e in reagents) { if (e.AssayPara == "R1") { f1 = true; break; } } if (f1 == true) { newreagentPosition.AssayPara = "MR1"; } else { newreagentPosition.AssayPara = "R1"; } } if (newreagentPosition.AssayPara == "R2") { bool f1 = false; foreach (RGTPosition e in reagents) { if (e.AssayPara == "R2") { f1 = true; break; } } if (f1 == true) { newreagentPosition.AssayPara = "MR2"; } else { newreagentPosition.AssayPara = "R2"; } } newreagentPosition.Disk = disk; newreagentPosition.Position = position; RGTPosition oldreagentPosition = new RGTPOSManager().Get(disk, position); if (oldreagentPosition != null) { ReagentBarcode r = new ReagentBarcode(); r.Barcode = oldreagentPosition.BarCode; r.ValidPercent = oldreagentPosition.ValidPercent; r.ExchangeDatetime = DateTime.Now; new ReagentBarcodeService().InsertReagentBarcode(r); } ReagentBarcode ReagentBarcode = new ReagentBarcodeService().GetLastestReagentBarcode(barcode); if (ReagentBarcode == null) { newreagentPosition.ValidPercent = 99; } else { newreagentPosition.ValidPercent = ReagentBarcode.ValidPercent; } new RGTPOSManager().Delete(newreagentPosition); new RGTPOSManager().Save(newreagentPosition); TroubleLog t1 = new TroubleLog(); t1.TroubleCode = "7777772"; t1.TroubleType = TROUBLETYPE.WARN; t1.TroubleUnit = @"试剂条码"; t1.TroubleInfo = "条码:" + barcode + "加载成功";; new TroubleLogService().Save(t1); return(null); }