//条码段生成 输入开始条码、结束条码、条码间隔生成条形码 public void Create_Click(object sender, EventArgs e) { hpvinstrumentsLst.Clear(); try { double nStar = double.Parse(TextStar.Text); double nEnd = double.Parse(TextEnd.Text); int spaceNum = int.Parse(txtSpaceNum.Text); List <Hpvinstruments> hpvlist = new List <Hpvinstruments>(); while (nStar <= nEnd) { //是否存在相同的耗材条码 如已存在则跳出. Hashtable ht = new Hashtable(); ht.Add("Instrumentsbarcode", nStar); hpvlist = hpvService.GetHpvinstrumentsByWhere(ht); if (hpvlist.Count > 0) { nStar = nStar + spaceNum; continue; } Hpvinstruments hpvs = new Hpvinstruments(); hpvs.Dictcustomerid = Convert.ToDouble(this.Drop_Ctcustomer.SelectedValue); hpvs.Dicttestitemid = Convert.ToDouble(this.Drop_Dicttestitem.SelectedValue); hpvs.Instrumentsbarcode = nStar.ToString(); hpvs.Instenterby = Userinfo.userName; hpvs.Instcreatedate = DateTime.Now; hpvs.Isactive = "1"; hpvs.Customername = this.Drop_Ctcustomer.SelectedText; hpvs.Testname = this.Drop_Dicttestitem.SelectedText; hpvService.InsertHpvinstruments(hpvs); hpvinstrumentsLst.Add(hpvs); nStar = nStar + spaceNum; } gvList.DataSource = hpvinstrumentsLst; gvList.DataBind(); } catch (Exception ex) { MessageBoxShow(ex.Message, MessageBoxIcon.Error); } }
//扫描耗材条码,并累积显示本次扫描的条码 protected void tbxbarcode_TriggerClick(object sender, EventArgs e) { try { if (string.IsNullOrWhiteSpace(this.tbxbarcode.Text.Trim())) { return; } Hashtable ht = new Hashtable(); ht.Add("Instrumentsbarcode", tbxbarcode.Text); //是否存在相同的耗材条码 如已存在则跳出 List <Hpvinstruments> hpvlist = hpvService.GetHpvinstrumentsByWhere(ht); if (hpvlist.Count > 0) { MessageBoxShow("该耗材条码已存在!", MessageBoxIcon.Information); return; } Hpvinstruments hpvs = new Hpvinstruments(); hpvs.Dictcustomerid = Convert.ToDouble(this.Drop_Ctcustomer.SelectedValue); hpvs.Dicttestitemid = Convert.ToDouble(this.Drop_Dicttestitem.SelectedValue); hpvs.Instrumentsbarcode = this.tbxbarcode.Text.Trim(); hpvs.Instrumentsbarcode = this.tbxbarcode.Text.Trim(); hpvs.Instenterby = Userinfo.userName; hpvs.Isactive = "1"; bool flag = hpvService.InsertHpvinstruments(hpvs); if (flag) { hpvs.Customername = this.Drop_Ctcustomer.SelectedText; hpvs.Testname = this.Drop_Dicttestitem.SelectedText; hpvs.Instcreatedate = DateTime.Now; hpvinstrumentsLst.Add(hpvs); gvList.DataSource = hpvinstrumentsLst; gvList.DataBind(); this.tbxbarcode.Text = string.Empty; } } catch (Exception ex) { this.tbxbarcode.Text = string.Empty; MessageBoxShow(ex.Message, MessageBoxIcon.Error); } }
/// <summary>删除 /// /// </summary> /// <param name="strId">记录ID</param> /// <returns>是否删除成功 True False</returns> public bool DeleteHpvinstruments(string strId) { int nflag = 0; try { //增加删除日志对象 fhp Hpvinstruments hpvinstruments = GetHpvinstruments(Convert.ToDouble(strId)); //临时存储待删除对象,备写日志用 nflag = this.delete("Order.DeleteHpvinstruments", strId); List <LogInfo> logLst = getLogInfo <Hpvinstruments>(hpvinstruments, new Hpvinstruments()); AddMaintenanceLog("Hpvinstruments", hpvinstruments.Hpvinstrumentsid, logLst, "删除", hpvinstruments.Instrumentsbarcode, hpvinstruments.Instenterby, modulename); } catch (Exception ex) { throw new Exception(ex.Message); } return(nflag > 0); }
/// <summary> /// 取消耗材与条码号的关联,即将条码号更新为空 /// </summary> /// <param name="strId">记录ID</param> /// <returns>是否操作成功 True False</returns> public bool UpdateHpvinstruments(string strId) { int nflag = 0; try { //增加删除日志对象 fhp Hpvinstruments hpvinstruments = GetHpvinstruments(Convert.ToDouble(strId)); //临时存储待删除对象,备写日志用 Hpvinstruments newhpvinstruments = hpvinstruments; newhpvinstruments.Barcodecreatedate = null; newhpvinstruments.Barcode = null; newhpvinstruments.Barcodeenterby = null; nflag = this.update("Order.UpdateHpvinstruments", newhpvinstruments); List <LogInfo> logLst = getLogInfo <Hpvinstruments>(hpvinstruments, new Hpvinstruments()); AddMaintenanceLog("Hpvinstruments", hpvinstruments.Hpvinstrumentsid, logLst, "修改", hpvinstruments.Instrumentsbarcode, hpvinstruments.Instenterby, modulename); } catch (Exception ex) { throw new Exception(ex.Message); } return(nflag > 0); }
/// <summary>新增 修改 Hpvinstrumentsid为0或者null时表示新增数据,反之为编辑数据 /// /// </summary> /// <param name="hpvs">产品对象</param> /// <returns>是否操作成功 True 成功 false 失败</returns> public bool InsertHpvinstruments(Hpvinstruments hpvs) { int nflag = 0; if (hpvs.Hpvinstrumentsid == 0 || hpvs.Hpvinstrumentsid == null) { try { hpvs.Hpvinstrumentsid = getSeqID("SEQ_HPVINSTRUMENTS"); insert("Order.InsertHpvinstruments", hpvs); nflag = 1; List <LogInfo> logLst = getLogInfo <Hpvinstruments>(new Hpvinstruments(), hpvs); AddMaintenanceLog("Hpvinstruments", int.Parse(hpvs.Hpvinstrumentsid.ToString()), logLst, "新增", hpvs.Instrumentsbarcode, hpvs.Dictcustomerid.ToString(), modulename); } catch (Exception ex) { nflag = 0; throw new Exception(ex.Message); } } else { try { Hpvinstruments dictlab = GetHpvinstruments(Convert.ToDouble(hpvs.Hpvinstrumentsid)); nflag = update("Order.UpdateHpvinstruments", hpvs); List <LogInfo> logLst = getLogInfo <Hpvinstruments>(dictlab, hpvs); AddMaintenanceLog("Hpvinstruments", int.Parse(hpvs.Hpvinstrumentsid.ToString()), logLst, "修改", hpvs.Instrumentsbarcode, hpvs.Dictcustomerid.ToString(), modulename); } catch (Exception ex) { throw new Exception(ex.Message); } } return(nflag > 0); }
// 扫描标本条码 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); } }