/// <summary> /// 展示数据 /// </summary> /// <param name="id">记录Id</param> private void ShowInfo(int id) { LCheckDetailBB checkDetailBB = new LCheckDetailBB(); vLCheckDetailData model = new vLCheckDetailData(); try { model = checkDetailBB.GetVModel(id); this.id.Text = model.id.ToString(); this.checkDetailDesc.Text = model.checkDetailDesc; this.materialNo.Text = model.materialNo; this.checkFileId.Text = model.checkFileId.ToString(); this.checkItemId.Text = model.checkItemId.ToString(); this.dateType.Text = model.dateType; this.unit.Text = model.unit; this.uplimit.Text = model.uplimit; this.downlimit.Text = model.downlimit; this.standDesc.Text = model.standDesc; this.isMustCheck.Text = model.isMustCheck.ToString(); this.isAddupCheck.Text = model.isAddupCheck.ToString(); this.checkAmount.Text = model.checkAmount.ToString(); this.arrivedAmount.Text = model.arrivedAmount.ToString(); this.openBoxScale.Text = model.openBoxScale.ToString(); this.checkOutScale.Text = model.checkOutScale.ToString(); this.mark.Text = model.mark; } finally { checkDetailBB.Dispose(); } }
/// <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; }
/// <summary> /// 删除 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnDel_Click(object sender, EventArgs e) { bool retChecked = false; LCheckDetailBB checkDetailBB = new LCheckDetailBB(); try { //获取选中的数据Id foreach (GridViewRow gvrow in this.grid.Rows) { CheckBox chkId = (CheckBox)gvrow.FindControl("chkId"); if (chkId.Checked == true) { retChecked = true; int id = int.Parse(chkId.ValidationGroup); checkDetailBB.DeleteRecord(id); } } } catch (Exception ex) { this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true); return; } finally { checkDetailBB.Dispose(); } if (retChecked) { this.BindGrid(); } }
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(); } }
/// <summary> /// 数据保存 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSave_Click(object sender, EventArgs e) { LCheckDetailData model = new LCheckDetailData(); LCheckDetailBB checkDetailBB = new LCheckDetailBB(); try { if (this.State == "1") { this.SetModel(ref model); model.isrtDt = DateTime.Now.ToString(); model.isrtEmpId = this.currentUser.empId; this.IdValue = checkDetailBB.AddRecord(model); this.State = "2"; } else if (this.State == "2") { model = checkDetailBB.GetModel(this.IdValue); this.SetModel(ref model); model.updtDt = DateTime.Now.ToString(); model.updtEmpId = this.currentUser.empId; checkDetailBB.ModifyRecord(model); } } catch (Exception ex) { this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true); return; } finally { checkDetailBB.Dispose(); } this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('保存成功!');", true); }
/// <summary> /// 展示数据 /// </summary> /// <param name="id">记录Id</param> private void ShowInfo(int id) { LCheckDetailBB checkDetailBB = new LCheckDetailBB(); vLCheckDetailData model = new vLCheckDetailData(); SFileBB fileBB = new SFileBB(); try { model = checkDetailBB.GetVModel(id); this.materialNo.Text = model.materialNo; this.materialDesc.Text = model.materialDesc; this.checkDetailDesc.Text = model.checkDetailDesc; this.checkItemId.SelectedValue = model.checkItemId.ToString(); this.dateType.SelectedValue = model.dateType; this.unit.Text = model.unit; this.uplimit.Text = model.uplimit; this.downlimit.Text = model.downlimit; this.standDesc.Text = model.standDesc; if (model.isMustCheck != null) { this.isMustCheck.Checked = model.isMustCheck; } if (model.isAddupCheck != null) { this.isAddupCheck.Checked = model.isAddupCheck; } this.checkAmount.Text = model.checkAmount.ToString(); this.openBoxScale.Text = Convert.ToString(model.openBoxScale * 100); this.checkOutScale.Text = Convert.ToString(model.checkOutScale * 100); this.mark.Text = model.mark; if (model.checkFileId != 0) { this.fileId.Value = Convert.ToString(model.checkFileId); this.fileNm.Value = fileBB.GetBatchFileNm(Convert.ToString(model.checkFileId)); this.localeImage.ImageUrl = "../../../Common/Image.ashx?ImID=" + Convert.ToString(model.checkFileId); } //else //{ // this.fileId.Value = model.checkFileId.ToString(); // this.fileNm = //} } finally { checkDetailBB.Dispose(); fileBB.Dispose(); } }