/// <summary>
    /// 绑定Grid
    /// </summary>
    protected void BindGrid()
    {
        BArrangeBillDetailBB arrangeBillDetailBB = new BArrangeBillDetailBB();

        try
        {
            string strArriveBillNo = "", strFinanceBillNo = "", strMaterial = "",
                strStartDt = "", strEndDt = "", strAcceptStartDt = "", stAccecptEndDt = "";
            DataSet ds = new DataSet();

            //到货单号
            if (!string.IsNullOrEmpty(this.tbArriveBillNo.Text.Trim()))
            {
                strArriveBillNo = this.tbArriveBillNo.Text.Trim().ToUpper();
            }

            //采购合同号
            if (!string.IsNullOrEmpty(this.tbFinanceBillNo.Text.Trim()))
            {
                strFinanceBillNo = this.tbFinanceBillNo.Text.Trim().ToUpper();
            }

            //物料
            if (!string.IsNullOrEmpty(this.tbMaterial.Text.Trim()))
            {
                strMaterial = this.tbMaterial.Text.Trim().ToUpper();
            }

            //开始入库日期
            if (!string.IsNullOrEmpty(this.tbStartDt.Text.Trim()))
            {
                strStartDt = this.tbStartDt.Text.Trim().ToUpper();
            }

            //截止入库日期
            if (!string.IsNullOrEmpty(this.tbEndDt.Text.Trim()))
            {
                strEndDt = this.tbEndDt.Text.Trim().ToUpper();
            }

            //开始收货日期
            if (!string.IsNullOrEmpty(this.tbAcceptStartDt.Text.Trim()))
            {
                strAcceptStartDt = this.tbAcceptStartDt.Text.Trim().ToUpper();
            }

            //截止收货日期
            if (!string.IsNullOrEmpty(this.tbAcceptEndDt.Text.Trim()))
            {
                stAccecptEndDt = this.tbAcceptEndDt.Text.Trim().ToUpper();
            }

            ds = arrangeBillDetailBB.ArriveBoxStatisticReport(strArriveBillNo, strFinanceBillNo, strMaterial,
                strStartDt, strEndDt, strAcceptStartDt, stAccecptEndDt);
            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
        {
            arrangeBillDetailBB.Dispose();
        }
    }
    /// <summary>
    /// 绑定明细模版
    /// </summary>
    protected void BindDetailTable()
    {
        #region 绑定明细模版
        if (DtResult == null)
        {
            BArrangeBillDetailBB arrangeBillDetailBB = new BArrangeBillDetailBB();
            try
            {

                string strwhere = "arriveBillNo=@arriveBillNo";
                SqlParameter[] param = new SqlParameter[] { new SqlParameter("arriveBillNo", IdValue) };
                DataSet ds = arrangeBillDetailBB.GetVList(strwhere, param);
                if (ds != null && ds.Tables.Count > 0)
                {
                    this.DtResult = ds.Tables[0];

                    #region  添加合计行
                    //DataRow drHJ = this.DtResult.NewRow();
                    //drHJ["id"] = -1;
                    //drHJ["materielNo"] = "合计:";
                    //this.DtResult.Rows.Add(drHJ);
                    #endregion

                    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
                    }

                }
            }
            catch (Exception ex)
            {
                this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",4);", true);
                return;
            }
            finally
            {
                arrangeBillDetailBB.Dispose();
            }
        }
        DataView dv = this.DtResult.DefaultView;
        dv.RowFilter = "isdel=0";
        dv.Sort = "palletIndex";
        this.GridView1.DataSource = dv;
        this.GridView1.DataBind();
        HS.Function.CommFunction.MergeCol(GridView1, 1);
        HS.Function.CommFunction.MergeColRefer(GridView1, 0, 1);
        HS.Function.CommFunction.MergeColRefer(GridView1, 2, 1);

        #endregion
    }
    /// <summary>
    ///保存工作,返回明细表基本信息
    /// </summary>
    /// <returns></returns>
    private List<vBArrangeBillDetailData> SetDetailApplyBillModel()
    {
        if (this.DtResult != null)
        {
            List<vBArrangeBillDetailData> list = new List<vBArrangeBillDetailData>();
            foreach (DataRow dr in this.DtResult.Rows)
            {
                vBArrangeBillDetailData model = new vBArrangeBillDetailData();
                int detailId = Convert.ToInt32(dr["id"]);

                //修改行
                if (detailId > 0)
                {
                    using (BArrangeBillDetailBB datailBB = new BArrangeBillDetailBB())
                    {
                        model = datailBB.GetVModel(detailId);
                    }
                }

                if (detailId > 0 && dr["isdel"].ToString() == "1")
                {
                    //删除
                    model.arriveBillNo = "";
                }
                else
                {
                    //新增明细 关联申请单号
                    model.arriveBillNo = this.ArriveBillNo;
                }

                if ((detailId == 0 && dr["isdel"].ToString() == "0") || detailId > 0)
                {
                    model.arrangeBillNo = dr["arrangeBillNo"].ToString();
                    model.arriveBillNo = dr["arriveBillNo"].ToString();
                    model.materialDesc = dr["materialDesc"].ToString();
                    model.materialNo = dr["materialNo"].ToString();
                    model.financeBillNo = dr["financeBillNo"].ToString();
                    model.palletIndex = Convert.ToInt32(dr["palletIndex"]);

                    if (dr["region"].ToString() != "")
                    {
                        model.region = Convert.ToInt32(dr["region"].ToString());
                    }

                    if (dr["boxNum"].ToString() != "")
                    {
                        model.boxNum = Convert.ToInt32(dr["boxNum"].ToString());
                    }

                    if (dr["instantState"].ToString() == "" || dr["instantState"].ToString() == "01")
                    {
                        model.instantState = "01";
                    }

                    list.Add(model);

                }
            }

            return list;
        }

        return null;
    }
    /// <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();
        }
    }
Beispiel #5
0
    public DataTable GetArrangeBillDetail_Region(string strArriveBillNo, string strPalletIndex, int region)
    {
        BArrangeBillDetailBB arrangeBillDetailBB = new BArrangeBillDetailBB();

        try
        {
            DataTable dt = new DataTable();

            dt = arrangeBillDetailBB.GetVList("arriveBillNo='" + strArriveBillNo
                + "' and palletIndex='" + strPalletIndex + "' and region=" + region.ToString()).Tables[0];
            return dt;
        }
        finally
        {
            arrangeBillDetailBB.Dispose();
        }
    }
Beispiel #6
0
    public DataTable GetArrangeBillDetail(string strArriveBillNo, string strPalletIndex)
    {
        BArrangeBillDetailBB arrangeBillDetailBB = new BArrangeBillDetailBB();

        try
        {
            DataTable dt = new DataTable();

            dt = arrangeBillDetailBB.GetVList("arriveBillNo='" + strArriveBillNo + "' and palletIndex='" + strPalletIndex + "'").Tables[0];
            return dt;
        }
        finally
        {
            arrangeBillDetailBB.Dispose();
        }
    }