/// <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 (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.GetVListSC(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();
        }
    }
    /// <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>
    /// 提交排托单
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnCommit_Click(object sender, EventArgs e)
    {
        BArriveBillBB arriveBillBB = new BArriveBillBB();
        BArrangeBillBC arrangeBillBC = new BArrangeBillBC();

        try
        {
            //获取选中的数据Id
            foreach (GridViewRow gvrow in this.grid.Rows)
            {
                CheckBox chkId = (CheckBox)gvrow.FindControl("chkId");
                if (chkId.Checked == true)
                {
                    string strBillNo = "", strSate = "";
                    DataSet ds = new DataSet();

                    strBillNo = chkId.ValidationGroup;

                    //实时获取到货单状态
                    ds = arriveBillBB.GetList(" billNo='" + strBillNo + "'");
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        strSate = ds.Tables[0].Rows[0]["instantState"].ToString();
                    }

                    if (strSate != "02")//当前到货单状态必须为“已生成排托单”
                    {
                        this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"当前到货单未生成排托单、排托单已提交或已开始收货,不允许提交!\");", true);
                        return;
                    }
                    else
                    {
                        arrangeBillBC.CommitArrangeBill(strBillNo);//提交排托单
                        this.BindGrid();//重新绑定到货单列表
                        return;
                    }
                }
            }

            this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"请选择一条记录!\");", true);
            return;
        }
        finally
        {
            arriveBillBB.Dispose();
            arrangeBillBC.Dispose();
        }
    }
Пример #4
0
    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();
    }
Пример #5
0
    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();
        }
    }