/// <summary>
    /// 绑定Grid
    /// </summary>
    protected void BindGrid()
    {
        BTallyBillBB tTallyBillBB = new BTallyBillBB();
        DataSet ds = new DataSet();

        try
        {
            string strWhere = this.StrWhere;

            if (!string.IsNullOrEmpty(this.txtPtNo.Text))
            {
                strWhere += " and palletNo like '%" + txtPtNo.Text.Trim() + "%' ";
            }

            //限制状态为“已理货完成”
            strWhere += "  and instantState='02'";

            ds = tTallyBillBB.GetList(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
        {
            tTallyBillBB.Dispose();
        }
    }
Example #2
0
    public int SaveTallyBill(string strPalletNo, int isrtEmpId, string strInstantState)
    {
        BTallyBillBB tallyBillBB = new BTallyBillBB();

        try
        {
            int mainId = 0;
            DataSet ds = new DataSet();
            BTallyBillData tallyBillModel = new BTallyBillData();

            //判断当前托盘是否已经理货
            ds = tallyBillBB.GetList("palletNo='" + strPalletNo + "' and isInStock=0");
            if (ds.Tables[0].Rows.Count == 0)
            {
                tallyBillModel.palletNo = strPalletNo;//托盘条码号
                tallyBillModel.isInStock = false;//是否入库
                tallyBillModel.isrtDt = System.DateTime.Now.ToString();//添加时间
                tallyBillModel.isrtEmpId = isrtEmpId;//添加人
                tallyBillModel.instantState = "01";//理货中

                mainId = tallyBillBB.AddRecord(tallyBillModel);//称重理货单ID赋值
            }
            else
            {
                mainId = Convert.ToInt32(ds.Tables[0].Rows[0]["id"]);//称重理货单ID赋值

                if (strInstantState == "02")//理货已完成
                {
                    tallyBillModel = tallyBillBB.GetModel(mainId);

                    tallyBillModel.instantState = "02";//理货已完成

                    tallyBillBB.ModifyRecord(tallyBillModel);
                }
            }

            return mainId;
        }
        finally
        {
            tallyBillBB.Dispose();
        }
    }