/// <summary>存放集合 /// /// </summary> /// <param name="dt"></param> /// <param name="orderbarcodeback"></param> private static void CreateOrder(DataTable dt, Orderbarcode orderbarcodeback) { orderbarcodeback.Orderbarcodeid = Convert.ToDouble(dt.Rows[0]["Orderbarcodeid"]); orderbarcodeback.Ordernum = dt.Rows[0]["Ordernum"].ToString(); orderbarcodeback.Barcode = dt.Rows[0]["Barcode"].ToString(); orderbarcodeback.Ensurestatus = dt.Rows[0]["STATUS"].ToString() == "5" ? "未采血" : "已采血"; orderbarcodeback.Collectdate = Convert.ToDateTime(dt.Rows[0]["Collectdate"]); orderbarcodeback.Realname = dt.Rows[0]["Realname"].ToString(); orderbarcodeback.Itemname = dt.Rows[0]["Itemname"].ToString(); orderbarcodeback.Username = dt.Rows[0]["Username"].ToString(); orderbarcodeback.Labdeptname = dt.Rows[0]["Labdeptname"].ToString(); orderbarcodeback.Testnames = dt.Rows[0]["Testnames"].ToString(); }
protected void tbEnsureBarcode_TriggerClick(object sender, EventArgs e) { #region ////是否存在该条码 //bool ischeck = false; ////清空旧条码 //int j = tbEnsureBarcode.Text.IndexOf((char)2); //if (j >= 0) //{ // tbEnsureBarcode.Text = tbEnsureBarcode.Text.Substring(j + 1) + (char)2; //} //else //{ // tbEnsureBarcode.Text = tbEnsureBarcode.Text + (char)2; //} //List<int> selectedRowIndexArray = gdCollectBlood.SelectedRowIndexArray.ToList(); //for (int i = 0; i < gdCollectBlood.Rows.Count; i++) //{ // object[] dataKeys = gdCollectBlood.DataKeys[i]; // if (tbEnsureBarcode.Text.Replace(((char)2).ToString(), "") == dataKeys[1].ToString()) // { // if (selectedRowIndexArray.IndexOf(i) >= 0) // { // MessageBoxShow("该条码号已扫描"); // this.tbEnsureBarcode.Text = string.Empty; // return; // } // selectedRowIndexArray.Add(i); // ischeck = true; // } //} //if (selectedRowIndexArray.Count > 0) //{ // gdCollectBlood.SelectedRowIndexArray = selectedRowIndexArray.ToArray(); //} //if (!ischeck) //{ // MessageBoxShow("没有找到该条码号"); //} //this.tbEnsureBarcode.Text = string.Empty; #endregion if (tbEnsureBarcode.Text.Trim() == "") { MessageBoxShow("条码号不能为空!", MessageBoxIcon.Information); return; } Hashtable ht1 = new Hashtable(); ht1.Add("ordebarcode", this.tbEnsureBarcode.Text.Trim()); ht1.Add("status", 5); //是否存在有该未采血的条码 List <Orderbarcode> ordrbarcodeList = orderbarcodeService.SelectOrderbarcode(ht1).ToList(); if (ordrbarcodeList.Count == 0) { MessageBoxShow("您要确认的条码号不存在或已采过血!", MessageBoxIcon.Information); this.tbEnsureBarcode.Text = string.Empty; return; } Hashtable ht = new Hashtable(); UserInfo userInfo = (UserInfo)Session["UserInfo"]; ht.Add("OrdersBarcodeIds", ordrbarcodeList[0].Orderbarcodeid); ht.Add("UserName", userInfo.userId); //修改状态为已采血 int affectRow = orderbarcodeService.EnSureCollectBlood(ht); if (affectRow > 0) { Hashtable htback = new Hashtable(); htback.Add("tbStrKey", ordrbarcodeList[0].Barcode); DataTable dt = orderbarcodeService.DataForCollectBlood(htback); //修改为已采血的条码信息添加到临时集合中显示 Orderbarcode orderbarcodeback = new Orderbarcode(); CreateOrder(dt, orderbarcodeback); orderdatatable.Add(orderbarcodeback); //绑定前20条数据 var order = (from da in orderdatatable orderby da.Collectdate descending select da).Take(20); gdCollectBlood.DataSource = order; gdCollectBlood.DataBind(); orderbarcodeService.AddOperationLog(ordrbarcodeList[0].Ordernum, ordrbarcodeList[0].Barcode, "采血确认", "确认标本已采血", "修改留痕", ""); this.tbEnsureBarcode.Text = string.Empty; } }