/// <summary> /// 生成排拖单 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnPaiFact_Click(object sender, EventArgs e) { //获取选中的数据Id foreach (GridViewRow gvrow in this.grid.Rows) { CheckBox chkId = (CheckBox)gvrow.FindControl("chkId"); if (chkId.Checked == true) { string strBillNo = "", strCustNm = "", strArriveDt = "", strSate = ""; strBillNo = chkId.ValidationGroup; strCustNm = this.grid.DataKeys[gvrow.RowIndex].Values["custNm"].ToString(); strArriveDt = this.grid.DataKeys[gvrow.RowIndex].Values["arriveDt"].ToString(); //实时获取订单状态 using (BArriveBillBB billBB = new BArriveBillBB()) { DataSet ds = billBB.GetVList(" billNo='" + strBillNo + "'"); if (ds.Tables[0].Rows.Count > 0) { strSate = ds.Tables[0].Rows[0]["instantState"].ToString(); } } //判断到货单明细是否全部完成 using (BArriveDetailBB arriveDetailBB = new BArriveDetailBB()) { DataTable dtArriveDetail = arriveDetailBB.GetList("arriveBillNo='" + strBillNo + "'").Tables[0]; foreach (DataRow row in dtArriveDetail.Rows) { if (Convert.ToBoolean(row["isFinishReceive"]) == false) { this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"当前到货单未收货完成!\");", true); return; } } } if (strSate != "03" && strSate != "04" && strSate != "05") { Response.Redirect("../BArriveDetail/BArriveDetailList.aspx?billNo=" + strBillNo + "&custnm=" + Server.UrlEncode(strCustNm) + "&arriveDt=" + Server.UrlEncode(strArriveDt) + "&itemNo=" + this.itemNo + "&pTypeNo=edit", false); return; } else { this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"订单流程已提交或已收货状态,不能修改信息!\");", true); return; } } } this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"请选择一条记录!\");", true); return; }
/// <summary> /// 绑定Grid /// </summary> protected void BindGrid() { BArriveBillBB arriveBillBB = new BArriveBillBB(); try { string strWhere = this.StrWhere; DataSet ds = new DataSet(); //到货通知单编号 if (txtBillNo.Text.Trim() != "") { strWhere += " and billNo like '%" + txtBillNo.Text.Replace("'", "''") + "%'"; } //供应商 if (txtSupple.Text.Trim() != "") { strWhere += " and (custNo='" + txtSupple.Text.Replace("'", "''") + "' or custNm like '%" + txtSupple.Text.Replace("'", "''") + "%')"; } //到货通知单状态 if (ddlState.SelectedValue.Trim() != "") { strWhere += " and instantState = '" + ddlState.SelectedValue.Replace("'", "''") + "'"; } //到货日期 if (this.beginDt.Text != "") { strWhere += " and arriveDt >='" + this.beginDt.Text.Trim() + "'"; } if (this.endDt.Text != "") { strWhere += " and arriveDt <'" + Convert.ToDateTime(this.endDt.Text).AddDays(1).ToShortDateString() + "'"; } //是否收货完成 if (this.ddlIsFinishReceive.SelectedValue != "") { if (this.ddlIsFinishReceive.SelectedValue == "1")//收货完成 { strWhere += " and not exists(select 1 from dbo.BArriveDetail as t where t.arriveBillNo=dbo.vBArriveBill.billNo and t.isFinishReceive=0)"; } else//未收货完成 { strWhere += " and exists(select 1 from dbo.BArriveDetail as t where t.arriveBillNo=dbo.vBArriveBill.billNo and t.isFinishReceive=0)"; } } ds = arriveBillBB.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 { arriveBillBB.Dispose(); } }
public DataTable GetArriveBillList() { BArriveBillBB arriveBillBB = new BArriveBillBB(); try { DataTable dt = new DataTable(); dt = arriveBillBB.GetVList("instantState in ('03','04')").Tables[0]; return dt; } finally { arriveBillBB.Dispose(); } }