/// <summary> /// 保存试剂条码信息 /// </summary> /// <param name="r"></param> public void InsertReagentBarcode(ReagentBarcodeParam r) { try { ism_SqlMap.Insert("ReagentInfo.InsertReagentBarcode", string.Format("insert ReagentBarcodeParamTb(Barcode,ValidPercent,ExchangeDatetime) values('{0}',{1},'{2}')", r.Barcode, r.ValidPercent, r.ExchangeDatetime)); } catch (Exception ex) { LogInfo.WriteErrorLog("InsertReagentBarcode(ReagentBarcodeParam r) == " + ex.Message, Module.Reagent); } }
/// <summary> /// 获取试剂条码参数信息 /// </summary> /// <param name="barcode"></param> /// <returns></returns> public ReagentBarcodeParam GetAllReagentBarParam(string barcode) { ReagentBarcodeParam RB = null; try { string SQL = string.Format(@"select * from ReagentBarcodeParamTb where Barcode='{0}' order by ExchangeDatetime desc", barcode); RB = ism_SqlMap.QueryForObject("ReagentInfo.GetAllReagentBarParamByBarcode", SQL) as ReagentBarcodeParam; } catch (Exception ex) { LogInfo.WriteErrorLog("ReagentBarcodeParam GetAllReagentBarParam(string barcode) ==" + ex.Message, Module.Reagent); } return(RB); }
/// <summary> /// 移除被占用的是试剂信息 /// </summary> private void RemoveOccupiedReagentInfo(ReagentSettingsInfo barrgtpos) { ReagentBarcodeParam r = new ReagentBarcodeParam(); r.Barcode = barrgtpos.Barcode; switch (Disk) { case 1: r.ValidPercent = Convert.ToInt32(barrgtpos.ValidPercent); break; case 2: r.ValidPercent = Convert.ToInt32(barrgtpos.ValidPercent2); break; } r.ExchangeDatetime = DateTime.Now; mybatis.InsertReagentBarcode(r); ReagentStateInfoR1R2 r1r2 = mybatis.SelectReagentStateForR1R2("SelectReagentStateForR1R2", barrgtpos); this.ReagentStateInfoHandle(r1r2, barrgtpos); mybatis.DeleteReagentInfo(Disk, barrgtpos.Pos); }
/// <summary> /// 根据试剂条码信息获取对应的项目参数信息 /// </summary> /// <param name="disk"></param> /// <param name="pos"></param> /// <param name="reagentBracode"></param> /// <returns></returns> public object GetRgBracodePara(int disk, string pos, string reagentBracode) { string b = Decode(reagentBracode); if (b == null) { string erinfo = "条码:" + reagentBracode + "解码失败"; TroubleLog t = new TroubleLog(); t.TroubleCode = "7777771"; t.TroubleType = TROUBLETYPE.ERR; t.TroubleUnit = @"试剂条码"; t.TroubleInfo = erinfo; //new ReagentState().TroubleLogSave().Save(t); mybatis.TroubleLogSave("TroubleLogSave", t); return("条码:" + reagentBracode + "不识别"); } this.Disk = disk; this.Position = pos; ReagentSettingsInfo newReagentSet = AnanlyeBarcode(b, reagentBracode); if (newReagentSet == null) { return("条码:" + reagentBracode + "不识别"); } AssayProjectParamInfo a = mybatis.GetAssayProjectParamInfo(newReagentSet.ProjectName, newReagentSet.ReagentType) as AssayProjectParamInfo; if (a != null) { if (a.Reagent2VolSettings == 0 && newReagentSet.AssayParamType == "R2") { string erinfo = "条码:" + reagentBracode + "不能装填。原因:参数试剂2体积为0,不能在该位置装填试剂2"; TroubleLog t = new TroubleLog(); t.TroubleCode = "7777771"; t.TroubleType = TROUBLETYPE.ERR; t.TroubleUnit = @"试剂条码"; t.TroubleInfo = erinfo; mybatis.TroubleLogSave("TroubleLogSave", t); return("条码:" + reagentBracode + "装填失败"); } } //检查该条码在试剂盘中是否存在 ReagentSettingsInfo barrgtpos = mybatis.GetAssayALLReagentByBarcode(newReagentSet.Barcode); if (barrgtpos == null) { //newreagentPosition.AssayPara = "MR1"; } else { this.RemoveOccupiedReagentInfo(barrgtpos); //newreagentPosition.AssayPara = barrgtpos.AssayPara; } ReagentSettingsInfo rgtpos = mybatis.GetAssayReagentByDisk(Disk, Position); if (rgtpos == null) { } else { this.RemoveOccupiedReagentInfo(rgtpos); } //List<CLItem> reagents = new RGTPOSManager().GetAssayALLReagent(newReagentSetInfo.Assay); //if (newReagentSetInfo.AssayPara == "R1") //{ // bool f1 = false; // foreach (RGTPosition e in reagents) // { // if (e.AssayPara == "R1") // { // f1 = true; // break; // } // } // if (f1 == true) // { // newReagentSetInfo.AssayPara = "MR1"; // } // else // { // newReagentSetInfo.AssayPara = "R1"; // } //} //if (newReagentSetInfo.AssayPara == "R2") //{ // bool f1 = false; // foreach (RGTPosition e in reagents) // { // if (e.AssayPara == "R2") // { // f1 = true; // break; // } // } // if (f1 == true) // { // newReagentSetInfo.AssayPara = "MR2"; // } // else // { // newReagentSetInfo.AssayPara = "R2"; // } //} //newReagentSetInfo.Disk = disk; newReagentSet.Pos = pos; //RGTPosition oldreagentPosition = new RGTPOSManager().Get(disk, pos); //if (oldreagentPosition != null) //{ // ReagentBarcode r = new ReagentBarcode(); // r.Barcode = oldreagentPosition.BarCode; // r.ValidPercent = oldreagentPosition.ValidPercent; // r.ExchangeDatetime = DateTime.Now; // new ReagentBarcodeService().InsertReagentBarcode(r); //} ReagentBarcodeParam ReagentBarcode = mybatis.GetAllReagentBarParam(reagentBracode); if (ReagentBarcode == null) { if (disk == 1) { newReagentSet.ValidPercent = 99; } else if (disk == 2) { newReagentSet.ValidPercent2 = 99; } } else { if (disk == 1) { newReagentSet.ValidPercent = ReagentBarcode.ValidPercent; } else if (disk == 2) { newReagentSet.ValidPercent2 = ReagentBarcode.ValidPercent; } } mybatis.SaveReagentSettingInfo(disk, newReagentSet); new Task(new Action(() => { this.SaveOrUpReagentStateR1R2Info(newReagentSet); })).Start(); TroubleLog t1 = new TroubleLog(); t1.TroubleCode = "7777772"; t1.TroubleType = TROUBLETYPE.WARN; t1.TroubleUnit = @"试剂条码"; t1.TroubleInfo = "条码:" + reagentBracode + "加载成功";; mybatis.TroubleLogSave("TroubleLogSave", t1); return(null); }