/// <summary> /// 绑定Grid /// </summary> protected void BindGrid() { LCheckDetailBB checkDetailBB = new LCheckDetailBB(); DataSet ds = new DataSet(); try { string strWhere = this.StrWhere; if (this.materialNo.Text != "")//物料号 { strWhere += " and (materialNo like '%" + this.materialNo.Text.Replace("'", "''")+"%')"; } if (this.checkItemNm.Text != "")//检测项目 { strWhere += " and (checkItemNo like '%" + this.checkItemNm.Text.Replace("'", "''") + "%' or checkItemNm like '%" + this.checkItemNm.Text.Replace("'", "''") + "%')"; } if (this.checkDetailDesc.Text != "")//检验明细项目 { strWhere += " and checkDetailDesc like '%" + this.checkDetailDesc.Text.Replace("'", "''") + "%'"; } ds = checkDetailBB.GetVList(strWhere); this.grid.DataSource = ds.Tables[0]; this.grid.DataBind(); //赋值记录条数、页面总数 this.Label3.Text = ds.Tables[0].Rows.Count.ToString(); this.Label2.Text = this.grid.PageCount.ToString(); this.currPage.Text = (this.grid.PageIndex + 1).ToString(); } finally { checkDetailBB.Dispose(); } }
/// <summary> /// 物料对应检测标准列表数据选择事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void grvMateriel2_SelectedIndexChanged(object sender, EventArgs e) { int i = this.grvMateriel2.SelectedIndex; if (i >= 0) { string checkDetailId = this.grvMateriel2.DataKeys[i].Values["id"].ToString();//物料检测标准ID if (this.DtResult.Select("checkDetailId='" + checkDetailId + "' and isdel=0 ").Length > 0) { this.ClientScript.RegisterStartupScript(this.GetType(), "showFloat", "alert('该条检测明细已经存在!');", true); return; } LCheckDetailBB checkDetailBB = new LCheckDetailBB(); DataSet ds = checkDetailBB.GetVList(" id='" + checkDetailId + "'"); if (ds != null && ds.Tables[0].Rows.Count > 0) { DataRow dr = this.DtResult.NewRow(); dr["rowId"] = Guid.NewGuid().ToString();//生成序列号 dr["isdel"] = "0";//是否删除 dr["checkDetailId"] = checkDetailId;//物料检测标准ID dr["checkDetailDesc"] = ds.Tables[0].Rows[0]["checkDetailDesc"].ToString();//检测标准描述 dr["preFileNm"] = ds.Tables[0].Rows[0]["preFileNm"].ToString();//文件名称 dr["unit"] = ds.Tables[0].Rows[0]["unit"].ToString();//测量单位 dr["uplimit"] = ds.Tables[0].Rows[0]["uplimit"].ToString();//内控标准上限 dr["downlimit"] = ds.Tables[0].Rows[0]["downlimit"].ToString();//内控标准下限 dr["standDesc"] = ds.Tables[0].Rows[0]["standDesc"].ToString();//内控标准描述 dr["isMustCheckDesc"] = ds.Tables[0].Rows[0]["isMustCheckDesc"];//是否必检 dr["isAddupCheck"] = ds.Tables[0].Rows[0]["isAddupCheck"];//是否累计检测 //累计检测数量 if (ds.Tables[0].Rows[0]["checkAmount"].ToString() != "") { dr["checkAmount"] = Convert.ToDouble(ds.Tables[0].Rows[0]["checkAmount"].ToString()); } else { dr["checkAmount"] = 0; } //已累计到货数量 if (ds.Tables[0].Rows[0]["arrivedAmount"].ToString() != "") { dr["arrivedAmount"] = Convert.ToDouble(ds.Tables[0].Rows[0]["arrivedAmount"].ToString()); } else { dr["arrivedAmount"] = 0; } //开箱比例 if (ds.Tables[0].Rows[0]["openBoxScale"].ToString() != "") { dr["openBoxScale"] = Convert.ToDouble(ds.Tables[0].Rows[0]["openBoxScale"].ToString()); } else { dr["openBoxScale"] = 0; } //检验比例 if (ds.Tables[0].Rows[0]["checkOutScale"].ToString() != "") { dr["checkOutScale"] = Convert.ToDouble(ds.Tables[0].Rows[0]["checkOutScale"].ToString()); } else { dr["checkOutScale"] = 0; } dr["openBoxNum"] = "0";//开箱数量 dr["checkNum"] = "0";//检验数量 dr["BCheckDetailID"] = 0;//检测单明细ID dr["BArriveDetailId"] = this.hidArriveDetailID.Value;//到货明细ID dr["adviceBoxInNum"] = 0;//建议开箱数量 this.DtResult.Rows.Add(dr); this.InitPageData(); } } }
/// <summary> /// 绑定物料对应检测标准明细表 /// </summary> protected bool BindMateriel2() { if (this.hidMaterialNo.Value.Trim() == "") { this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('请先选择具体检测物料!');", true); return false; } LCheckDetailBB checkDetailBB = new LCheckDetailBB(); try { DataSet ds = new DataSet(); string strWhere = " 1=1"; //检测物料 strWhere += " and materialNo ='" + this.hidMaterialNo.Value + "' "; //检测标准 if (this.txtcheckDetailDesc.Text.Trim() != "") { strWhere += " and checkDetailDesc like '%" + this.txtcheckDetailDesc.Text.Trim().Replace("'", "''") + "%' "; } ds = checkDetailBB.GetVList(strWhere); this.grvMateriel2.DataSource = ds.Tables[0]; this.grvMateriel2.DataBind(); //赋值记录条数、页面总数 this.Label4.Text = ds.Tables[0].Rows.Count.ToString(); this.Label1.Text = this.grvMateriel2.PageCount.ToString(); this.currPage2.Text = (this.grvMateriel2.PageIndex + 1).ToString(); } finally { checkDetailBB.Dispose(); } return true; }
public DataTable GetLCheckDetail(int checkDetailId) { LCheckDetailBB checkDetailBB = new LCheckDetailBB(); try { DataTable dt = new DataTable(); dt = checkDetailBB.GetVList("id='" + checkDetailId.ToString() + "'").Tables[0]; return dt; } finally { checkDetailBB.Dispose(); } }