Exemplo n.º 1
0
    /// <summary>
    /// 绑定Grid
    /// </summary>
    protected void BindGrid()
    {
        LWareBB wareBB = new LWareBB();
        DataSet ds = new DataSet();

        try
        {
            string strWhere = this.StrWhere;

            //库区编码
            if (this.tbWareNo.Text.Trim() != "")
            {
                strWhere += " and wareNo like '%" + this.tbWareNo.Text.Trim().Replace("'", "''") + "%'";
            }

            //库区名称
            if (this.tbWareNm.Text.Trim() != "")
            {
                strWhere += " and wareNm like '%" + this.tbWareNm.Text.Trim().Replace("'", "''") + "%'";
            }

            //货位分类
            if (this.ddlWareSort.SelectedValue != "")
            {
                strWhere += " and wareSortNo='"+this.ddlWareSort.SelectedValue +"'";
            }

            ds = wareBB.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
        {
            wareBB.Dispose();
        }
    }
Exemplo n.º 2
0
    public string GetPalletWareInfo(string strPalletNo)
    {
        string strWareLocatorNo = "";
        BArrangeBillBoxBB arrangeBillBoxBB = new BArrangeBillBoxBB();
        LWareBB wareBB = new LWareBB();
        LWareLocatorBB wareLocatorBB = new LWareLocatorBB();
        LMaterialBB materialBB = new LMaterialBB();
        SCommBB commBB = new SCommBB();

        try
        {
            DataTable dtArrangeBillBox = new DataTable();
            DataTable dtWare = new DataTable();
            DataTable dtWareLocator = new DataTable();

            //获取托盘下的所有箱子
            dtArrangeBillBox = arrangeBillBoxBB.GetVList("palletNo='" + strPalletNo + "' and isnull(wareNo,'')<>''").Tables[0];
            if (dtArrangeBillBox.Rows.Count > 0)
            {
                string strFinanceBillSort = "", strFinanceBillNo = "";

                strFinanceBillSort = dtArrangeBillBox.Rows[0]["financeBillSort"].ToString();//采购合同类型
                strFinanceBillNo = dtArrangeBillBox.Rows[0]["financeBillNo"].ToString();//采购合同号
                if (strFinanceBillSort == "按单" || strFinanceBillNo.IndexOf("EB16") == -1)
                {
                    #region 按单

                    //按单的物料,放置在正式库的平面库区
                    dtWareLocator = wareLocatorBB.GetVList("wareSortNo='A' and wareType='03' and isUsing=0 and isDel=0").Tables[0];
                    if (dtWareLocator.Rows.Count > 0)
                    {
                        strWareLocatorNo = dtWareLocator.Rows[0]["wareNo"].ToString() + ","
                            + dtWareLocator.Rows[0]["wareLocatorNo"].ToString();//库位
                    }

                    #endregion 按单
                }
                else if (strFinanceBillSort == "备货" || strFinanceBillNo.IndexOf("EB16") != -1)
                {
                    #region 备货

                    string strMaterialNos = "", strUCodeNos = "", strWareSortNos = "B";
                    int materialNum = 1;
                    DataTable dtMaterial = new DataTable();

                    //判断当前托盘是否存在多个物料
                    strMaterialNos = dtArrangeBillBox.Rows[0]["materialNo"].ToString();//物料编号
                    strUCodeNos = dtArrangeBillBox.Rows[0]["U_CodeNo"].ToString();//物料U_CodeNo
                    foreach (DataRow row in dtArrangeBillBox.Rows)
                    {
                        if (strMaterialNos.IndexOf(row["materialNo"].ToString()) == -1)
                        {
                            materialNum++;
                            strMaterialNos += "," + row["materialNo"].ToString();//物料编号
                        }

                        if (strUCodeNos.IndexOf(row["U_CodeNo"].ToString()) == -1)
                        {
                            strUCodeNos += "," + row["U_CodeNo"].ToString();//物料U_CodeNo
                        }
                    }

                    if (materialNum == 1)//托盘上只有一种物料
                    {
                        dtMaterial = materialBB.GetList("materialNo='" + strMaterialNos + "'").Tables[0];//获取物料信息
                        strWareSortNos = dtMaterial.Rows[0]["wareSortNo"].ToString();//获取物料的货位分类
                    }
                    else
                    {
                        foreach (DataRow row in dtArrangeBillBox.Rows)
                        {
                            dtMaterial = materialBB.GetList("materialNo='" + row["materialNo"].ToString() + "'").Tables[0];//获取物料信息
                            if (dtMaterial.Rows[0]["wareSortNo"].ToString() != "B")//查找货位分类为非高位货架所有类别
                            {
                                if (strWareSortNos == "B")//如果当前类型为高位货架
                                {
                                    strWareSortNos = dtMaterial.Rows[0]["wareSortNo"].ToString();//货架分类赋新值
                                }
                                else
                                {
                                    if (strWareSortNos.IndexOf(dtMaterial.Rows[0]["wareSortNo"].ToString()) == -1)
                                    {
                                        strWareSortNos += "," + dtMaterial.Rows[0]["wareSortNo"].ToString();
                                    }
                                }
                            }
                        }
                    }

                    if (strWareSortNos == "D" || strWareSortNos == "E")//流利货架摆放不分库位,推荐到库区即可
                    {
                        //获取推荐库区信息
                        dtWare = wareBB.GetVList("wareSortNo='" + strWareSortNos + "' and wareType='03' and isDel=0").Tables[0];
                        if (dtWare.Rows.Count > 0)
                        {
                            strWareLocatorNo = dtWare.Rows[0]["wareNo"].ToString() + ",";//库区
                        }
                    }
                    else//其他货架,推荐到库位
                    {
                        //获取推荐库位信息
                        dtWareLocator = commBB.Query("exec Proc_GetSuggestWareLocator '" + strWareSortNos.Trim(',')
                            + "','" + strUCodeNos.Trim(',') + "','" + strMaterialNos.Trim(',') + "'").Tables[0];
                        if (dtWareLocator.Rows.Count > 0)
                        {
                            strWareLocatorNo = dtWareLocator.Rows[0]["wareNo"].ToString() + ","
                                + dtWareLocator.Rows[0]["wareLocatorNo"].ToString();//库位
                        }
                    }

                    #endregion 备货
                }
            }
        }
        finally
        {
            arrangeBillBoxBB.Dispose();
            wareBB.Dispose();
            wareLocatorBB.Dispose();
            materialBB.Dispose();
            commBB.Dispose();
        }

        return strWareLocatorNo;
    }