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); }
void RgtWarning(int d, int p) { RGTPOSManager RGTPOSMgr = new RGTPOSManager(); AssayRunParaService AssayRunParaSer = new AssayRunParaService(); RunService RunSer = new RunService(); TroubleLogService TroubleLogSer = new TroubleLogService(); int rgtwarncount = RunSer.GetRgtWarnCount(); int rgtleastcount = RunSer.GetRgtLeastCount(); RGTPosition rgp = RGTPOSMgr.Get(1, p.ToString()); if (rgp != null) { AssayRunPara arp = AssayRunParaSer.Get(rgp.Assay) as AssayRunPara; int c = 0; int v = rgp.CType.Volume * rgp.ValidPercent / 100 * 1000; switch (rgp.AssayPara) { case "R1": c = arp.R1Vol == 0 ? 0 : v / arp.R1Vol; if (c < rgtleastcount) { if (RunSer.IsMutiRgtEnable() == true) //多试剂位开关标志 { RGTPosition mrgt = RGTPOSMgr.GetEnableMutiRgtPosition(rgp); if (mrgt != null) { RGTPOSMgr.BetweenMutiRgtPositionAndRgtPositionChange(mrgt, rgp); TroubleLog trouble = new TroubleLog(); trouble.TroubleCode = @"0000773"; trouble.TroubleType = TROUBLETYPE.WARN; trouble.TroubleUnit = @"试剂"; trouble.TroubleInfo = string.Format("试剂位{0}项目{1}试剂1由于余量不足开始启用其多试剂位{2}. ", p, rgp.Assay, mrgt.Position); TroubleLogSer.Save(trouble); } else { if (RunSer.IsLockRgtEnable() == true) { rgp.IsLocked = true; RGTPOSMgr.UpdateLockState(rgp); TroubleLog trouble = new TroubleLog(); trouble.TroubleCode = @"0000773"; trouble.TroubleType = TROUBLETYPE.WARN; trouble.TroubleUnit = @"试剂"; trouble.TroubleInfo = string.Format("试剂位{0}项目{1}试剂1由于余量不足将锁定其对应的工作表. ", p, rgp.Assay); TroubleLogSer.Save(trouble); } else { TroubleLog trouble = new TroubleLog(); trouble.TroubleCode = @"0000773"; trouble.TroubleType = TROUBLETYPE.ERR; trouble.TroubleUnit = @"试剂"; trouble.TroubleInfo = string.Format("试剂位{0}项目{1}试剂1由于余量不足. ", p, rgp.Assay); TroubleLogSer.Save(trouble); } } } else { if (RunSer.IsLockRgtEnable() == true) { rgp.IsLocked = true; RGTPOSMgr.UpdateLockState(rgp); TroubleLog trouble = new TroubleLog(); trouble.TroubleCode = @"0000773"; trouble.TroubleType = TROUBLETYPE.WARN; trouble.TroubleUnit = @"试剂"; trouble.TroubleInfo = string.Format("试剂位{0}项目{1}试剂1由于余量不足将锁定其对应的工作表. ", p, rgp.Assay); TroubleLogSer.Save(trouble); } else { TroubleLog trouble = new TroubleLog(); trouble.TroubleCode = @"0000773"; trouble.TroubleType = TROUBLETYPE.ERR; trouble.TroubleUnit = @"试剂"; trouble.TroubleInfo = string.Format("试剂位{0}项目{1}试剂1由于余量不足. ", p, rgp.Assay); TroubleLogSer.Save(trouble); } } } if (c < rgtwarncount && c > rgtleastcount) { TroubleLog trouble = new TroubleLog(); trouble.TroubleCode = @"0000773"; trouble.TroubleType = TROUBLETYPE.WARN; trouble.TroubleUnit = @"设备"; trouble.TroubleInfo = string.Format("试剂位{0}项目{1}:试剂1余量即将耗尽. ", p, rgp.Assay); TroubleLogSer.Save(trouble); return; } break; case "R2": c = arp.R2Vol == 0 ? 0 : v / arp.R2Vol; if (c < rgtleastcount) { if (RunSer.IsMutiRgtEnable() == true) //多试剂位开关标志 { RGTPosition mrgt = RGTPOSMgr.GetEnableMutiRgtPosition(rgp); if (mrgt != null) { RGTPOSMgr.BetweenMutiRgtPositionAndRgtPositionChange(mrgt, rgp); TroubleLog trouble = new TroubleLog(); trouble.TroubleCode = @"0000773"; trouble.TroubleType = TROUBLETYPE.WARN; trouble.TroubleUnit = @"试剂"; trouble.TroubleInfo = string.Format("试剂位{0}项目{1}试剂2由于余量不足开始启用其多试剂位{2}. ", p, rgp.Assay, mrgt.Position); TroubleLogSer.Save(trouble); } else { if (RunSer.IsLockRgtEnable() == true) { rgp.IsLocked = true; RGTPOSMgr.UpdateLockState(rgp); TroubleLog trouble = new TroubleLog(); trouble.TroubleCode = @"0000773"; trouble.TroubleType = TROUBLETYPE.WARN; trouble.TroubleUnit = @"试剂"; trouble.TroubleInfo = string.Format("试剂位{0}项目{1}试剂2由于余量不足将锁定其对应的工作表. ", p, rgp.Assay); TroubleLogSer.Save(trouble); } else { TroubleLog trouble = new TroubleLog(); trouble.TroubleCode = @"0000773"; trouble.TroubleType = TROUBLETYPE.ERR; trouble.TroubleUnit = @"试剂"; trouble.TroubleInfo = string.Format("试剂位{0}项目{1}试剂2余量不足. ", p, rgp.Assay); TroubleLogSer.Save(trouble); } } } else { if (RunSer.IsLockRgtEnable() == true) { rgp.IsLocked = true; RGTPOSMgr.UpdateLockState(rgp); TroubleLog trouble = new TroubleLog(); trouble.TroubleCode = @"0000773"; trouble.TroubleType = TROUBLETYPE.WARN; trouble.TroubleUnit = @"试剂"; trouble.TroubleInfo = string.Format("试剂位{0}项目{1}试剂2余量不足将锁定其对应的工作表. ", p, rgp.Assay); TroubleLogSer.Save(trouble); } else { TroubleLog trouble = new TroubleLog(); trouble.TroubleCode = @"0000773"; trouble.TroubleType = TROUBLETYPE.ERR; trouble.TroubleUnit = @"试剂"; trouble.TroubleInfo = string.Format("试剂位{0}项目{1}试剂2余量不足. ", p, rgp.Assay); TroubleLogSer.Save(trouble); } } } if (c < rgtwarncount && c > rgtleastcount) { TroubleLog trouble = new TroubleLog(); trouble.TroubleCode = @"0000775"; trouble.TroubleType = TROUBLETYPE.WARN; trouble.TroubleUnit = @"设备"; trouble.TroubleInfo = string.Format("试剂位{0}项目{1}:试剂2余量即将耗尽. ", p, rgp.Assay); TroubleLogSer.Save(trouble); return; } break; } } }
void DoSaveAssayRunPara(ReagentItem ReagentItem) { //加载测试参数 AssayRunPara a = new AssayRunPara(); a.Name = ReagentItem.ItemName; a.FullName = ReagentItem.LongName; //分析方法 a.AnalyzeMethod = ReagentItem.AnalyzeMethod; //第一测试点S a.FirstPointS = ReagentItem.FirstPointS; //第一测试点E a.FirstPointE = ReagentItem.FirstPointE; //第二测试点S a.SecondPointS = ReagentItem.SecondPointS; //第二测试点E a.SecondPointE = ReagentItem.SecondPointE; //主波长 a.MainWaveLength = ReagentItem.MainWaveLength; //次波长 a.SubWaveLength = ReagentItem.SubWaveLength; //测试次数 a.DoCount = ReagentItem.DoCount; //质控间隔 a.QCSpace = ReagentItem.QCSpace; //定标次数 a.SDTCount = ReagentItem.SDTCount; //试剂1体积 a.R1Vol = ReagentItem.R1Vol; //试剂2体积 a.R2Vol = ReagentItem.R2Vol; //样本反应体积 a.SerumIncreaseVol.VolPre = ReagentItem.IncreaseVol; a.SerumIncreaseVol.VolAft = 0; a.SerumIncreaseVol.VolDil = 0; a.SerumNormalVol.VolPre = ReagentItem.NormalVol; a.SerumNormalVol.VolAft = 0; a.SerumNormalVol.VolDil = 0; a.SerumDecreaseVol.VolPre = ReagentItem.DecreaseVol; a.SerumDecreaseVol.VolAft = 0; a.SerumDecreaseVol.VolDil = 0; a.UrineIncreaseVol.VolPre = ReagentItem.IncreaseVol; a.UrineIncreaseVol.VolAft = 0; a.UrineIncreaseVol.VolDil = 0; a.UrineNormalVol.VolPre = ReagentItem.NormalVol; a.UrineNormalVol.VolAft = 0; a.UrineNormalVol.VolDil = 0; a.UrineDecreaseVol.VolPre = ReagentItem.DecreaseVol; a.UrineDecreaseVol.VolAft = 0; a.UrineDecreaseVol.VolDil = 0; a.SDTVol.VolPre = ReagentItem.SDTVol; a.SDTVol.VolAft = 0; a.SDTVol.VolDil = 0; //反应方向 a.ReacteDirect = ReagentItem.ReacteDirect; //搅拌强度 a.Stiring1Force = ReagentItem.Stiring1Force; a.Stiring2Force = ReagentItem.Stiring2Force; //显示顺序 int m = new RGTPOSManager().GetReagentMode(); AssayRunPara a1 = new AssayRunParaService().Get(ReagentItem.ItemName) as AssayRunPara; if (a1 != null && a1.DisplaySQ <= 0) { new AssayRunParaService().Delete(a1.DisplaySQ); } a1 = new AssayRunParaService().Get(ReagentItem.ItemName) as AssayRunPara; if (a1 == null) { for (int i = 1; i <= 120; i++) { AssayRunPara e = new AssayRunParaService().Get(i) as AssayRunPara; if (e == null) { if (m == 3) { List <int> itemnumbers = new RGTPOSManager().GetReagentNumbers(); bool isflag = false; foreach (int ie in itemnumbers) { if (ie == i) { isflag = true; } } if (isflag == true) { continue; } else { a.DisplaySQ = i; break; } } if (m == 2) { a.DisplaySQ = i; break; } } } } else { a.DisplaySQ = a1.DisplaySQ; } new AssayRunParaService().Delete(ReagentItem.ItemName); new AssayRunParaService().Delete(a.DisplaySQ); new AssayRunParaService().Save(a); }