//行点击事件 删除 protected void gvList_RowCommand(object sender, GridCommandEventArgs e) { object[] objvalue = gvList.DataKeys[e.RowIndex]; //取消关联 if (e.CommandName == "Cancel") { if (objvalue[1] == null) { MessageBoxShow("没有关联的条码号,如果不需要,可直接删除!"); return; } Hashtable ht = new Hashtable(); ht.Add("ordebarcode", objvalue[1].ToString()); List <Orderbarcode> orderbarcodelist = new OrderbarcodeService().SelectOrderbarcode(ht).ToList(); if (orderbarcodelist.Count > 0) { MessageBoxShow("该条码已经生成了订单,不能取消!"); return; } bool falg = hpvService.UpdateHpvinstruments(objvalue[0].ToString()); if (falg) { MessageBoxShow("取消成功!"); } else { MessageBoxShow("取消失败!"); return; } BindGrid(); } if (e.CommandName == "delete") { if (objvalue[1] != null) { Hashtable ht = new Hashtable(); ht.Add("ordebarcode", objvalue[1].ToString()); List <Orderbarcode> orderbarcodelist = new OrderbarcodeService().SelectOrderbarcode(ht).ToList(); if (orderbarcodelist.Count > 0) { MessageBoxShow("该条码已经生成了订单,不能删除!"); return; } } bool falg = hpvService.DeleteHpvinstruments(objvalue[0].ToString()); if (!falg) { MessageBoxShow("删除失败!"); return; } BindGrid(); } }
//打印条码 protected void btnPrintBarcode_Click(object sender, EventArgs e) { foreach (int rowIndex in GridOrders.SelectedRowIndexArray) { GridRow row = GridOrders.Rows[rowIndex]; if (!(row.Values[5].Contains("已登记") || row.Values[5].Contains("条码已打印"))) { MessageBoxShow(string.Format("条码号:{0} 姓名:{1} 已打印过条码,条码补打模块可补打条码", row.Values[0], row.Values[1])); return; } } SetInitlocalsetting(hdMac.Text);//设置打印所需的客户端配置信息 string ordernums = GetSelectOrderNums(false); if (ordernums == string.Empty) { return; } DataTable dtSource = new OrderbarcodeService().GetPrintBarcodeData(new Hashtable() { { "ordernum", ordernums }, { "orderbarcode", null } }); for (int i = 0; i < dtSource.Rows.Count; i++) { string testnames = dtSource.Rows[i]["TESTNAMES"].ToString(); dtSource.Rows[i]["AGE"] = WebUI.GetAge(dtSource.Rows[i]["AGE"]);//处理年龄 dtSource.Rows[i]["COLLECTDATE"] = dtSource.Rows[i]["COLLECTDATE"].ToString(); dtSource.Rows[i]["TESTNAMES"] = testnames.TrimEnd(','); dtSource.Rows[i]["COUNT"] = String.Format("共{0}项", testnames.TrimEnd(',').Split(',').Length); } //修改订单状态为[条码已打印](已登记的才改) new OrdersService().EditStatusByOldStatus(new Hashtable() { { "ordernum", ordernums }, { "status", (int)ParamStatus.OrdersStatus.BarCodePrint }, { "oldstatus", (int)ParamStatus.OrdersStatus.Register }, }); //后续调用柯木朗方法打印 //.......................... commonReport.PrintBarCode(dtSource, Userinfo); ExtAspNet.PageContext.RegisterStartupScript(string.Format(" PrintBarCode(\'{0}\',\'{1}\');", CommonReport.printer, CommonReport.json)); //记录日志 JournalLog(ordernums, "打印条码"); }
// 扫描标本条码 protected void tbxbarcode_TriggerClick(object sender, EventArgs e) { try { string barcode = tbxbarcode.Text.Trim(); List <Hpvinstruments> hpvlist = Check(); if (hpvlist == null || hpvlist.Count == 0) { return; } if (string.IsNullOrWhiteSpace(barcode)) { return; } else { //条码号必须以00结尾,且长度为12 if (barcode.Length != 12) { MessageBoxShow(string.Format("此条码号[{0}]格式不正确,请更改条码号!", barcode), MessageBoxIcon.Information); tbxbarcode.Text = string.Empty; return; } if (barcode.Substring(barcode.Length - 2) != "00") { MessageBoxShow(string.Format("此条码号[{0}]不是以00结尾,请更改条码号!", barcode), MessageBoxIcon.Information); tbxbarcode.Text = string.Empty; return; } Hashtable htPara = new Hashtable(); //检查耗材表中该条码号是否已使用过 htPara.Add("Barcode", barcode); List <Hpvinstruments> hpvbarcode = hpvService.GetHpvinstrumentsByWhere(htPara).ToList(); //是否保存了该标本条码 if (hpvbarcode.Count == 1) { MessageBoxShow("该条码已有相关联的耗材,请更换其他条码!", MessageBoxIcon.Information); tbxbarcode.Text = string.Empty; return; } //检查orderbarcode表中是否存在该条码号 htPara.Clear(); htPara.Add("ordebarcode", tbxbarcode.Text); List <Orderbarcode> orderbarcodelist = new OrderbarcodeService().SelectOrderbarcode(htPara).ToList(); if (orderbarcodelist.Count > 0) { MessageBoxShow("该条码已经生成了订单!", MessageBoxIcon.Information); tbxbarcode.Text = string.Empty; return; } //添加样本条码等信息 Hpvinstruments hpvs = hpvlist[0]; hpvs.Barcode = this.tbxbarcode.Text.Trim(); hpvs.Barcodecreatedate = DateTime.Now; hpvs.Barcodeenterby = Userinfo.userName; hpvs.Testname = hpvlist[0].Testname; bool flag = hpvService.InsertHpvinstruments(hpvs); if (flag) { hpvlist = new List <Hpvinstruments>(); hpvlist.Add(hpvs); BindGrid(hpvlist); this.tbxbarcode.Text = string.Empty; this.tbxinstrumentsbarcode.Text = string.Empty; tbxinstrumentsbarcode.Focus(); } } } catch (Exception ex) { MessageBoxShow(ex.Message, MessageBoxIcon.Error); } }
/// <summary> /// 开始计时 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { if (b) { return; } //设置timer不可用 timer.Stop();// //传输数据 try { #region 输数据 // LoginService loginservice = new LoginService(); OrdersService orderservice = new OrdersService(); OrderbarcodeService orderbarcodeservice = new OrderbarcodeService(); Stopwatch sw = new Stopwatch(); //调用登陆验证方法(string Login(UserName: string; Password: string; Operator: string))返回SID //UserName,Password来源配置文件,Operator为空 string username = ConfigurationManager.AppSettings["UserName"]; string password = ConfigurationManager.AppSettings["Password"]; string Operator = ConfigurationManager.AppSettings["Operator"]; SendOrdersToLis.CenterServiceSoapClient client = new SendOrdersToLis.CenterServiceSoapClient(); sw.Start(); // int t = 0; string strM = ""; //按分点查找 List <Dictlab> labLst = labser.GetDictlabList().Where(c => c.IsActive == '1').ToList <Dictlab>(); #region foreach (Dictlab dictlab in labLst) { //查询分点下面有没有数据 DataTable dt = orderservice.GetOrderToLis(dictlab.Dictlabid);// orderservice.GetOrderToLis(dictlab.Dictlabid); if (dt.Rows.Count > 0) { if (!ht.ContainsKey(dictlab.Labcode)) { string strsid = client.Login(dictlab.Labcode, username, password, Operator); if (strsid.Split('|')[0] == "1") { strsid = strsid.Split('|')[1]; ht.Add(dictlab.Labcode, strsid); } else { string strS01 = String.Format("{0}登录失败!\n{1}", dictlab.Labname, strsid.Split('|')[1]); SetTB(strS01); continue; //return; } } #region dt.TableName = "data_row"; string strxml = DataToXml.CDataToXml(dt);//将订单信息转换成xml形式的字符串 //根据SID,分点,及分点下的订单信息(xml字符串形式)调用Webservice上传数据到Lis string strmessage = client.SendRequestInfo(ht[dictlab.Labcode].ToString(), dictlab.Labcode, StringToXML(strxml)); if (strmessage.Contains("MSG0006")) //登陆超时 { ht.Remove(dictlab.Labcode); SetTB(dictlab.Labname + " 登录超时!"); continue; } else { string[] strsp = strmessage.Split(','); #region for for (int k = 0; k < strsp.Length - 1; k++) { string[] s = strsp[k].Split('|'); if (s[3] == "0") { strM += String.Format("{0} 达安条码[{1}],上传成功!\n", dictlab.Labname, s[0]); //上传后 如果成功就跟新orderbarcode中transed=1并给出成功提示信息,如果失败则给出失败信息 orderbarcodeservice.UpdateTransedToLis(s[0]); } else { string[] g = s[3].Split('/'); #region for for (int i = 0; i < g.Length - 1; i++) { if (g[i] == "MSG1001") { strM += "申请信息不全,达安条码、医院条码、标本唯一标识不能全为空;"; } if (g[i] == "MSG1002") { strM += String.Format("达安条码[{0}],申请信息姓名、性别、年龄必填项,有空值;", s[0]); } if (g[i] == "MSG1003") { strM += String.Format("达安条码[{0}],有匹配不正确的达安项目代码;", s[0]); } if (g[i] == "MSG1004") { strM += String.Format("达安条码[{0}],年龄格式不正确;", s[0]); } if (g[i] == "MSG1005") { strM += String.Format("达安条码[{0}],采样时间不能转换成时间格式;", s[0]); } if (g[i] == "MSG1007") { strM += String.Format("达安条码[{0}],病人电话格式错误;", s[0]); } if (g[i] == "MSG1008") { strM += String.Format("达安条码[{0}],医生电话格式错误;", s[0]); } if (g[i] == "MSG1009") { strM += String.Format("达安条码[{0}],病理标本、细菌标本必须单独信息;", s[0]); } if (g[i] == "MSG1010") { strM += String.Format("达安条码[{0}],性别必须为M或者F或者U;", s[0]); } } #endregion //失败信息,更新orderbarcode中transed=2 if (s[0] != null && s[0] != "") { orderbarcodeservice.UpdateTransedToLisFail(s[0]); } } } #endregion SetTB(strM); strM = null; } #endregion } else { string str2 = dictlab.Labname + "没有传输的数据!\n"; SetTB(str2); } #endregion sw.Stop(); } #endregion } catch (Exception ex) { string exmessage = String.Format("{0}: {1}", DateTime.Now, ex.Message); SetTB(exmessage); CreateErrorLog(exmessage); } finally { //设置timer可用 timer.Start(); } }