public void OnReagentUpdated(ReagentUpdate update) { _logger.LogReceived($"{update}"); // Map to other representation (Note: We have deliberately not used the same type here) ReagentItem updateToClients = new ReagentItem { Serial = update.Serial, Location = update.Location, ProductName = update.ProductName, Quantity = update.Quantity }; foreach (var client in _clients) { try { client.ReagentItemUpdated(updateToClients); } catch (Exception exception) { _logger.LogError(exception); } } }
public async Task OnReagentUpdatedAsync(ReagentUpdate update) { _logger.LogReceived($"{update}"); // Map to other representation (Note: We have deliberately not used the same type here) ReagentItem updateToClients = new ReagentItem { Serial = update.Serial, Location = update.Location, ProductName = update.ProductName, Quantity = update.Quantity }; Task[] callbackTasks = null; lock (_syncClients) { callbackTasks = _clients .Select(client => client.ReagentItemUpdatedAsync(updateToClients)) .ToArray() ; } try { await Task.WhenAll(callbackTasks).ConfigureAwait(false); } catch (ObjectDisposedException) {} catch (Exception exception) { _logger.LogError(exception); } }
void DoSaveAssayValuePara(ReagentItem ReagentItem) { AssayValuePara a = new AssayValuePara(); a.Name = ReagentItem.ItemName; a.EquipAdjustRfA = 1; a.EquipAdjustRfB = 0; a.ReagentAbsMin = ReagentItem.ReagentAbsMin; a.ReagentAbsMax = ReagentItem.ReagentAbsMax; a.LineSerumLimitMax = ReagentItem.LineSerumLimitMax; a.LineSerumLimitMin = ReagentItem.LineSerumLimitMin; a.LineUrineLimitMax = ReagentItem.LineSerumLimitMax; a.LineUrineLimitMin = ReagentItem.LineSerumLimitMin; a.SerumPanicLimitMax = ReagentItem.SerumPanicLimitMax; a.SerumPanicLimitMin = ReagentItem.SerumPanicLimitMin; a.UrineAbs = 0; a.SerumAbs = 0; a.OtherAbs = 0; a.PreDirection = ReagentItem.ReacteDirect; a.PreviousLimit = 0; a.IsAutoRedo = false; new AssayValueParaService().Delete(ReagentItem.ItemName); new AssayValueParaService().Save(a); }
/// <summary> /// 保存项目信息 /// </summary> /// <param name="r"></param> /// <param name="proType"></param> private void DoSaveAssayProjectInfo(ReagentItem r, string proType) { AssayProjectInfo a = new AssayProjectInfo(); a.ProjectName = r.ItemName; a.SampleType = proType; a.ProFullName = r.LongName; a.ChannelNum = r.Code.ToString(); mybatis.SaveProjectAssayInfo(a); }
/// <summary> /// 保存结果信息 /// </summary> /// <param name="r"></param> /// <param name="proType"></param> public void SaveResultSets(ReagentItem r, string proType) { try { ism_SqlMap.Insert("AssayProjectInfo.SaveRangeParamAndCalibParam", string.Format("insert resultSetTb(ProjectName,SampleType,Unit,RadixPointNum) values('{0}','{1}','{2}',{3})", r.ItemName, proType, r.Unit, r.RadixPointNum)); } catch (Exception ex) { LogInfo.WriteErrorLog("SaveResultSetsAndProRunSequence(ReagentItem r, string proType) ==" + ex.Message, Module.LISSetting); } }
public RegentConstRecordInfo GetRegentConstRecordInfo(ReagentItem item, DateTime begin, DateTime end) { RegentConstRecordInfo inf = new RegentConstRecordInfo(); inf.Name = item.ItemName; List <ReagentBarcode> bars = new ReagentBarcodeService().GetReagentBarcodes(begin, end); foreach (ReagentBarcode e in bars) { /* * if (e.ValidPercent != 99) * { * continue; * } */ string b = Decode(e.Barcode); if (b == null) { continue; } string code = b.Substring(0, 3); if (code != item.Code.ToString()) { continue; } BarDrawInfo barDrawInfo = new BarDrawInfo(); barDrawInfo.Bar = e.Barcode; barDrawInfo.Datetime = e.ExchangeDatetime; string reagenttype = b.Substring(4, 1); switch (reagenttype) { case "1": inf.R1BarDrawInfos.Add(barDrawInfo); break; case "2": inf.R2BarDrawInfos.Add(barDrawInfo); break; case "3": break; case "4": break; case "5": break; //case "6": ReagentPosition.AssayPara = "R4"; break; } } return(inf); }
void DoSaveResultSets(ReagentItem ReagentItem) { new ResultSetService().Delete(ReagentItem.ItemName); foreach (SMPType e in new SMPTypeService().GetALL()) { ResultSet d = new ResultSet(); d.SampleType = e.Name; d.Unit = ReagentItem.Unit; d.Name = ReagentItem.ItemName; d.RadixPointNum = ReagentItem.RadixPointNum; new ResultSetService().Save(d); } }
/// <summary> /// 获取试剂项目参数信息 /// </summary> /// <param name="code"></param> /// <returns></returns> public ReagentItem getReagentItemInfo(string code) { ReagentItem reagent = null; try { reagent = ism_SqlMap.QueryForObject <ReagentItem>("ReagentInfo.getReagentItemInfo", string.Format("select * from ReagentItemTb where Code ={0}", code)); } catch (Exception ex) { LogInfo.WriteErrorLog("getReagentItemInfo(string code) ==" + ex.Message, Module.Reagent); } return(reagent); }
public async Task OnReagentUpdatedAsync(ReagentUpdate update) { _logger.LogReceived($"{update}"); // Map to other representation (Note: We have deliberately not used the same type here) ReagentItem updateToClients = new ReagentItem { Serial = update.Serial, Location = update.Location, ProductName = update.ProductName, Quantity = update.Quantity }; Task compoundCallbackTask = null; lock (_syncClients) { compoundCallbackTask = Task.WhenAll( _clients .Select(client => client.ReagentItemUpdatedAsync(updateToClients)) .ToArray() ) ; } try { await compoundCallbackTask.ConfigureAwait(false); // <-- Due to await this only throws // the FIRST exception - not an AggregateException // containing all... } catch { // ... but the compoundCallbackTask.Exception is exactly that AggregateException! AggregateException compoundException = compoundCallbackTask.Exception.Flatten(); foreach (Exception exception in compoundException.InnerExceptions) { if (exception is ObjectDisposedException) { // Silently ignore } else { _logger.LogError(exception); } } } }
public Task ReagentItemUpdatedAsync(ReagentItem reagentItem) { ReagentViewModel itemVM = this.Items .SingleOrDefault(item => item.Serial == reagentItem.Serial) ; if (itemVM is null) { // First update for this serial Add(new ReagentViewModel(reagentItem)); } else { itemVM.From(reagentItem); } return(Task.CompletedTask); }
public RegentConstInfo GetR1R2ConstCount(ReagentItem item, DateTime begin, DateTime end) { RegentConstInfo inf = new RegentConstInfo(); inf.Name = item.ItemName; inf.R1Count = 0; inf.R2Count = 0; List <string> bars = new ReagentBarcodeService().GetAllBarString(begin, end); foreach (string e in bars) { string b = Decode(e); if (b == null) { continue; } string code = b.Substring(0, 3); if (code != item.Code.ToString()) { continue; } string reagenttype = b.Substring(4, 1); switch (reagenttype) { case "1": inf.R1Count++; break; case "2": inf.R2Count++; break; case "3": break; case "4": break; case "5": break; //case "6": ReagentPosition.AssayPara = "R4"; break; } } return(inf); }
void DoSaveRunSQ(ReagentItem ReagentItem) { RunAssaySQ r = null; RunAssaySQ runAssaySQ = new RunAssaySQService().Get(ReagentItem.ItemName) as RunAssaySQ; if (runAssaySQ != null) { r = new RunAssaySQ(); r.AssayName = ReagentItem.ItemName; r.RunSQ = runAssaySQ.RunSQ; } else { r = new RunAssaySQ(); r.AssayName = ReagentItem.ItemName; r.RunSQ = new RunAssaySQService().GetALL().Count; } new RunAssaySQService().Delete(ReagentItem.ItemName); new RunAssaySQService().Save(r); }
/// <summary> /// 根据条码解析数据 /// </summary> /// <param name="barcode"></param> /// <param name="b1"></param> /// <returns></returns> ReagentSettingsInfo AnanlyeBarcode(string barcode, string b1) { string code = barcode.Substring(0, 3); ReagentItem reagentItem = mybatis.getReagentItemInfo(code); if (reagentItem == null) { TroubleLog t = new TroubleLog(); t.TroubleCode = "7777772"; t.TroubleType = TROUBLETYPE.ERR; t.TroubleUnit = @"试剂条码"; t.TroubleInfo = "条码:" + b1 + "与封闭项目不匹配"; mybatis.TroubleLogSave("TroubleLogSave", t); return(null); } ReagentSettingsInfo reagentSettingsInfo = new ReagentSettingsInfo(); reagentSettingsInfo.ProjectName = reagentItem.ItemName; //1:S10ml 2:M 20ml 3:L 70ml 4:XL100m string RGTContainerType = null; string containertype = barcode.Substring(3, 1); switch (containertype) { case "1": reagentSettingsInfo.ReagentContainer = "20ml"; break; case "2": reagentSettingsInfo.ReagentContainer = "40ml"; break; case "3": reagentSettingsInfo.ReagentContainer = "70ml"; break; case "4": reagentSettingsInfo.ReagentContainer = "100ml"; break; } if (string.IsNullOrEmpty(reagentSettingsInfo.ReagentContainer)) { TroubleLog t = new TroubleLog(); t.TroubleCode = "7777773"; t.TroubleType = TROUBLETYPE.ERR; t.TroubleUnit = @"试剂条码"; t.TroubleInfo = "条码:" + b1 + "容器类型系统不识别"; mybatis.TroubleLogSave("TroubleLogSave", t); return(null); } //1:R1 2:R2 3:R3 4:R4 5:稀释液 6:清洗剂 string reagenttype = barcode.Substring(4, 1); switch (reagenttype) { case "1": reagentSettingsInfo.AssayParamType = "R1"; break; case "2": reagentSettingsInfo.AssayParamType = "R2"; break; case "3": reagentSettingsInfo.AssayParamType = "R3"; break; case "4": reagentSettingsInfo.AssayParamType = "R4"; break; case "5": reagentSettingsInfo.AssayParamType = "Diluent"; break; //case "6": ReagentPosition.AssayPara = "R4"; break; } switch (this.Disk) { case 1: if (reagentSettingsInfo.AssayParamType == "R1" || reagentSettingsInfo.AssayParamType == "Diluent") { reagentSettingsInfo.ReagentName = reagentItem.ItemName + "R1"; reagentSettingsInfo.ReagentVol = reagentItem.R1Vol; } else { TroubleLog t = new TroubleLog(); t.TroubleCode = "7777774"; t.TroubleType = TROUBLETYPE.ERR; t.TroubleUnit = @"试剂条码"; t.TroubleInfo = "条码:" + b1 + "试剂类型R1识别失败"; mybatis.TroubleLogSave("TroubleLogSave", t); return(null); } break; case 2: if (reagentSettingsInfo.AssayParamType == "R2") { reagentSettingsInfo.ReagentName = reagentItem.ItemName + "R2"; reagentSettingsInfo.ReagentVol = reagentItem.R2Vol; } else { TroubleLog t = new TroubleLog(); t.TroubleCode = "7777775"; t.TroubleType = TROUBLETYPE.ERR; t.TroubleUnit = @"试剂条码"; t.TroubleInfo = "条码:" + b1 + "试剂类型R2识别失败"; mybatis.TroubleLogSave("TroubleLogSave", t); return(null); } break; } string batchnum = barcode.Substring(5, 6); //项目试剂类型 string projectReagenttype = barcode.Substring(12, 1); switch (projectReagenttype) { case "1": reagentSettingsInfo.ReagentType = "血清"; break; case "2": reagentSettingsInfo.ReagentType = "尿液"; break; case "3": reagentSettingsInfo.ReagentType = "稀释液"; break; case "4": reagentSettingsInfo.ReagentType = "清洗剂"; break; } reagentSettingsInfo.BatchNum = batchnum; string str1 = batchnum.Substring(0, 2); int str1int = 0; try { str1int = int.Parse(str1); } catch { return(null); } str1 = "20" + (str1int + 1).ToString() + batchnum.Substring(2); try { reagentSettingsInfo.ValidDate = DateTime.ParseExact(str1, "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture); } catch { TroubleLog t = new TroubleLog(); t.TroubleCode = "7777776"; t.TroubleType = TROUBLETYPE.ERR; t.TroubleUnit = @"试剂条码"; t.TroubleInfo = "条码:" + b1 + "识别失败"; mybatis.TroubleLogSave("TroubleLogSave", t); return(null); } reagentSettingsInfo.Barcode = b1; mybatis.DeleteAssayProject(reagentItem.ItemName, reagentSettingsInfo.ReagentType); DoSaveAssayPorjectPara(reagentItem, reagentSettingsInfo.ReagentType); DoSaveAssayProjectInfo(reagentItem, reagentSettingsInfo.ReagentType); mybatis.SaveResultSets(reagentItem, reagentSettingsInfo.ReagentType); //测试序列 mybatis.SaveProRunSequence(reagentItem.ItemName, reagentSettingsInfo.ReagentType); return(reagentSettingsInfo); }
public void ReagentItemUpdated(ReagentItem reagentItem) { Add(new ReagentViewModel(reagentItem)); }
public Task ReagentItemUpdatedAsync(ReagentItem reagentItem) { Add(new ReagentViewModel(reagentItem)); return(Task.CompletedTask); }
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); }
/// <summary> /// 保存生化项目参数信息,范围参数信息和校准参数信息 /// </summary> /// <param name="ReagentItem"></param> void DoSaveAssayPorjectPara(ReagentItem ReagentItem, string reagentType) { //实例化生化项目参数实体 AssayProjectParamInfo a = new AssayProjectParamInfo(); a.ProjectName = ReagentItem.ItemName; //分析方法 switch (ReagentItem.AnalyzeMethod) { case "1Point": a.AnalysisMethod = "一点终点法"; break; case "2Point": a.AnalysisMethod = "二点终点法"; break; case "Arate": a.AnalysisMethod = "速率A法"; break; case "Brate": a.AnalysisMethod = "速率B法"; break; } a.SampleType = reagentType; //第一测试点S a.MeasureLightDot1 = ReagentItem.FirstPointS; //第一测试点E a.MeasureLightDot2 = ReagentItem.FirstPointE; //第二测试点S a.MeasureLightDot3 = ReagentItem.SecondPointS; //第二测试点E a.MeasureLightDot4 = ReagentItem.SecondPointE; //主波长 a.MainWaveLength = ReagentItem.MainWaveLength; //次波长 a.SecWaveLength = ReagentItem.SubWaveLength; //单位 a.ResultUnit = ReagentItem.Unit; //仪器因素 a.InstrumentFactorA = 1; a.InstrumentFactorB = 0; //试剂1体积 a.Reagent1VolSettings = ReagentItem.R1Vol; //试剂2体积 a.Reagent2VolSettings = ReagentItem.R2Vol; //样本反应体积 a.IncStosteVol = ReagentItem.IncreaseVol; a.IncSamVol = 0; a.IncDilutionVol = 0; a.ComStosteVol = ReagentItem.NormalVol; a.ComSamVol = 0; a.ComDilutionVol = 0; a.DecStosteVol = ReagentItem.DecreaseVol; a.DecSamVol = 0; a.DecDilutionVol = 0; a.CalibStosteVol = ReagentItem.SDTVol; a.CalibSamVol = 0; a.CalibDilutionVol = 0; //反应方向 switch (ReagentItem.ReacteDirect) { case 1: a.ReactionDirection = "正反应"; break; case -1: a.ReactionDirection = "负反应"; break; } //搅拌强度 switch (ReagentItem.Stiring1Force) // 搅拌1强度 { case 1: a.Stirring1Intensity = "低"; break; case 2: a.Stirring1Intensity = "中"; break; case 3: a.Stirring1Intensity = "高"; break; } switch (ReagentItem.Stiring2Force) // 搅拌2强度 { case 1: a.Stirring2Intensity = "低"; break; case 2: a.Stirring2Intensity = "中"; break; case 3: a.Stirring2Intensity = "高"; break; } //int m = new RGTPOSManager().GetReagentMode(); //等测试后是否需要加 a.FirstSlope = ReagentItem.LineSerumLimitMin; a.FirstSlopeHigh = ReagentItem.LineSerumLimitMax; a.ReagentBlankMinimum = ReagentItem.ReagentAbsMin; a.ReagentBlankMaximum = ReagentItem.ReagentAbsMax; a.SerumCriticalMinimum = ReagentItem.SerumPanicLimitMin; a.SerumCriticalMaximum = ReagentItem.SerumPanicLimitMax; mybatis.SaveRGSpendingAssayProjectInfo(a); mybatis.SaveRangeParamAndCalibParam(ReagentItem.ItemName, reagentType, ReagentItem.SDTCount); }