/// <summary> /// 绑定到货物料明细表 /// </summary> protected void BindMateriel() { using (BArriveDetailBB arriveDetailBB = new BArriveDetailBB()) { string strWhere = " isFinishReceive=1"; DataSet ds = new DataSet(); //到货单号 if (this.txtA.Text.Trim() != "") { strWhere += " and arriveBillNo like '%" + this.txtA.Text.Replace("'", "''") + "%' "; } //采购单号 if (this.txtB.Text.Trim() != "") { strWhere += " and financeBillNo like '%" + this.txtB.Text.Replace("'", "''") + "%' "; } //物料 if (this.txtC.Text.Trim() != "") { strWhere += " and (materialNo like '%" + this.txtC.Text.Replace("'", "''") + "%' or materialDesc like '%" + this.txtC.Text.Replace("'", "''") + "%')"; } //必须是排托已完成的物料 //strWhere += " and exists (select 1 from dbo.BArriveBill where dbo.BArriveBill.instantState='05' and dbo.BArriveBill.billNo=dbo.vBArriveDetail.arriveBillNo)"; //必须尚未生成检验单的物料 strWhere += @" and not exists(select 1 from BCheckBill where BCheckBill.arriveBillNo=vBArriveDetail.arriveBillNo and BCheckBill.financeBillNo=vBArriveDetail.financeBillNo and BCheckBill.materialNo=vBArriveDetail.materialNo)"; //判定必须有收货并且有放置在质检区信息 strWhere += @" and exists(select 1 from dbo.vBArrangeBillBox as t where t.arriveBillNo=dbo.vBArriveDetail.arriveBillNo and t.financeBillNo=dbo.vBArriveDetail.financeBillNo and t.materialNo=dbo.vBArriveDetail.materialNo and t.wareType='01')"; //到货单物料所在库位类别为质检区 strWhere += @" and not exists(select 1 from dbo.vBArrangeBillBox as t where t.arriveBillNo=dbo.vBArriveDetail.arriveBillNo and t.financeBillNo=dbo.vBArriveDetail.financeBillNo and t.materialNo=dbo.vBArriveDetail.materialNo and t.wareType<>'01')"; ds = arriveDetailBB.GetVList(strWhere); this.grvMateriel.DataSource = ds.Tables[0]; this.grvMateriel.DataBind(); //赋值记录条数、页面总数 this.Label3.Text = ds.Tables[0].Rows.Count.ToString(); this.Label2.Text = this.grvMateriel.PageCount.ToString(); this.currPage.Text = (this.grvMateriel.PageIndex + 1).ToString(); } }
/// <summary> /// 初始化数据 /// </summary> private void InitData() { BArriveDetailBB arriveDetailBB = new BArriveDetailBB(); BArrangeBillDetailBB arrangeBillDetailBB = new BArrangeBillDetailBB(); try { #region 生成到货明细数据源 //到货明细 this.DtDetail = arriveDetailBB.GetVList(" arriveBillNo='" + this.ArriveBillNo + "'").Tables[0]; #endregion 生成到货明细数据源 #region 生成排托明细数据源 //排托明细 string strWhere = "arriveBillNo=@arriveBillNo"; SqlParameter[] param = new SqlParameter[] { new SqlParameter("@arriveBillNo", this.ArriveBillNo) }; DataSet ds = arrangeBillDetailBB.GetVList(strWhere, param); if (ds != null && ds.Tables.Count > 0) { this.DtResult = ds.Tables[0]; this.DtResult.Columns.Add(new DataColumn("rowId", typeof(string))); this.DtResult.Columns.Add(new DataColumn("isdel", typeof(string))); this.DtResult.Columns.Add(new DataColumn("ischeck", typeof(string))); this.DtResult.Columns.Add(new DataColumn("hideAmount", typeof(string))); foreach (DataRow dr in this.DtResult.Rows) { dr["rowId"] = Guid.NewGuid().ToString(); dr["isdel"] = "0"; dr["ischeck"] = "false"; #region 记录合计行 if (dr["boxNum"] != null && dr["boxNum"] != DBNull.Value) { //初始化时保存amount的原始值 dr["hideAmount"] = dr["boxNum"].ToString() == "" ? "0" : dr["boxNum"].ToString(); } else { dr["hideAmount"] = "0"; } #endregion } } #endregion 生成排托明细数据源 } finally { arriveDetailBB.Dispose(); arrangeBillDetailBB.Dispose(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.StrWhere = "1=1"; string id= Request.QueryString["id"]; BArriveDetailBB arriveDetailBB = new BArriveDetailBB(); BArriveBillBB arriveBillBB = new BArriveBillBB(); DataSet ds = new DataSet(); try { vBArriveBillData data = arriveBillBB.GetVModel(Convert.ToInt32(id)); this.IdValue = data.billNo; this.StrWhere = " arriveBillNo='" + data.billNo + "'"; txtBillNo.Text = data.billNo; txtSupple.Text = data.custNm; txtarrageBillNo.Text = "PT" + data.billNo; txtarriveDt.Text = Convert.ToDateTime(data.arriveDt).ToString("yyyy-MM-dd"); this.DtDetail = arriveDetailBB.GetVList(this.StrWhere).Tables[0]; } finally { arriveDetailBB.Dispose(); } this.BindGrid(); } InitPageData(); }
public DataTable GetArriveDetail(int arriveDetailId) { BArriveDetailBB arriveDetailBB = new BArriveDetailBB(); try { DataTable dt = new DataTable(); dt = arriveDetailBB.GetVList("id=" + arriveDetailId.ToString()).Tables[0]; return dt; } finally { arriveDetailBB.Dispose(); } }