/// <summary>
        /// 查询
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnQurey_OnClick(object sender, EventArgs e)
        {
            string sqltext = "select *,cast(BM_SINGNUMBER as varchar)+' | '+cast(BM_NUMBER as varchar)+' | '+cast(BM_PNUMBER as varchar) AS NUMBER from " + ViewState["viewtablename"].ToString() + " where BM_ENGID='" + ViewState["TaskID"].ToString() + "' AND BM_KU='库' and BM_MASHAPE='采' and BM_MASTATE='标' AND BM_MARID<>'' AND BM_BJ='N'";

            if (ddlParts.SelectedIndex != 0)
            {
                sqltext += "AND (BM_XUHAO='" + ddlParts.SelectedValue + "' OR BM_XUHAO LIKE '" + ddlParts.SelectedValue + ".%')";
            }
            udqMS.ExistedConditions = sqltext;
            sqltext += UserDefinedQueryConditions.ReturnQueryString((GridView)udqMS.FindControl("GridView1"), (Label)udqMS.FindControl("Label1"));
            sqltext += " order by dbo.f_formatstr(BM_XUHAO,'.')";
            DataTable dt = DBCallCommon.GetDTUsingSqlText(sqltext);

            if (dt.Rows.Count > 0)
            {
                GridView1.DataSource = dt;
                GridView1.DataBind();
                NoDataPanel.Visible = false;
                btnCreate.Visible   = true;
            }
            else
            {
                GridView1.DataSource = null;
                GridView1.DataBind();
                NoDataPanel.Visible = true;
                btnCreate.Visible   = false;
            }
        }
        /// <summary>
        /// 查询
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnQuery_OnClick(object sender, EventArgs e)
        {
            string strWhere = " BM_ENGID='" + ViewState["TaskID"].ToString() + "' AND BM_MARID!='' AND BM_MSSTATE='0' AND BM_MPSTATE='0' AND BM_OSSTATE='0' ";

            string sql = "select DISTINCT [BM_MARID],[BM_MANAME],[BM_MAGUIGE],[BM_MAQUALITY],[BM_STANDARD],[BM_MASHAPE],[BM_MASTATE] from View_TM_DQO where ";

            if (txtGuiGe.Text.Trim() != "")
            {
                strWhere += " AND [BM_MAGUIGE] like '%" + txtGuiGe.Text.Trim() + "%'";
            }

            if (txtMarCZ.Text.Trim() != "")
            {
                strWhere += " AND [BM_MAQUALITY] like '%" + txtMarCZ.Text.Trim() + "%'";
            }

            if (txtMarid.Text.Trim() != "")
            {
                strWhere += " AND [BM_MARID] like '%" + txtMarid.Text.Trim() + "%'";
            }

            if (txtMarName.Text.Trim() != "")
            {
                strWhere += " AND [BM_MANAME] like '%" + txtMarName.Text.Trim() + "%'";
            }

            if (txtZongXu.Text.Trim() != "")
            {
                strWhere += " AND [BM_ZONGXU]='" + txtZongXu.Text.Trim() + "' or [BM_ZONGXU] like '" + txtZongXu.Text.Trim() + ".%'";
            }


            udqOrg.ExistedConditions = strWhere;
            strWhere += UserDefinedQueryConditions.ReturnQueryString((GridView)udqOrg.FindControl("GridView1"), (Label)udqOrg.FindControl("Label1"));

            sql += strWhere + " ORDER BY BM_MARID";

            ViewState["strWhere"] = strWhere.Replace('\'', '^');

            DataTable dt = DBCallCommon.GetDTUsingSqlText(sql);

            GridView2.DataSource = dt;
            GridView2.DataBind();
            if (GridView2.Rows.Count > 0)
            {
                NoDataPanel1.Visible = false;
            }
            else
            {
                NoDataPanel1.Visible = true;
            }
        }
        private string Get_StrWhere()
        {
            string returnValue = ViewState["sqlText"].ToString();

            //显示级数
            if (ddlOrgJishu.SelectedIndex != 0)
            {
                returnValue += " AND [dbo].[Splitnum](" + ddlShowType.SelectedValue + ",'.')=" + ddlOrgJishu.SelectedValue + " ";
            }
            udqMS.ExistedConditions = returnValue;
            returnValue             = returnValue + UserDefinedQueryConditions.ReturnQueryString((GridView)udqMS.FindControl("GridView1"), (Label)udqMS.FindControl("Label1"));
            return(returnValue);
        }
        /// <summary>
        /// 获取查询Where条件
        /// </summary>
        /// <returns></returns>
        private string CreateConStr()
        {
            string sql = "";

            sql += " TSA_STATE='" + rblstatus.SelectedValue + "' ";
            if (ddlSearch.SelectedItem.Text.Trim() != "-请选择-")
            {
                sql += "and " + ddlSearch.SelectedValue.Trim() + "  like '%" + txtSearch.Text.Trim() + "%'";//下拉
            }

            if (IsPostBack)
            {
                udqMS.ExistedConditions = sql;
                sql = sql + UserDefinedQueryConditions.ReturnQueryString((GridView)udqMS.FindControl("GridView1"), (Label)udqMS.FindControl("Label1"));
            }
            return(sql);
        }
Example #5
0
        /// <summary>
        /// 查询
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnOrgQuery_OnClick(object sender, EventArgs e)
        {
            this.GetListName();
            StringBuilder strb_sql = new StringBuilder();

            strb_sql.Append(" BM_ENGID='" + hdfEngid.Value.Trim() + "'");


            if (ddlQueryType.SelectedIndex != 0)
            {
                if (txtMCorZX.Text.Trim() != "")
                {
                    if (ddlQueryType.SelectedValue == "BM_ZONGXU" || ddlQueryType.SelectedValue == "BM_XUHAO")
                    {
                        strb_sql.Append(" and (" + ddlQueryType.SelectedValue.ToString() + "='" + txtMCorZX.Text.Trim() + "' OR " + ddlQueryType.SelectedValue.ToString() + " like '" + txtMCorZX.Text.Trim() + ".%')");
                    }
                    else
                    {
                        strb_sql.Append(" and " + ddlQueryType.SelectedValue.ToString() + " like '%" + txtMCorZX.Text.Trim() + "%'");
                    }
                }
                else
                {
                    strb_sql.Append(" and " + ddlQueryType.SelectedValue.ToString() + "='" + txtMCorZX.Text.Trim() + "'");
                }
            }

            //操作的字段
            if (ddlRepType.SelectedValue == "BM_TUHAO")
            {
                strb_sql.Append(" AND BM_MSSTATE='0' AND BM_OSSTATE='0'");
            }
            else if (ddlRepType.SelectedValue == "BM_MASHAPE" || ddlRepType.SelectedValue == "BM_MASTATE")
            {
                strb_sql.Append(" AND BM_MPSTATE='0' AND BM_OSSTATE='0' AND BM_MSSTATE='0'");
            }

            udqMS.ExistedConditions = strb_sql.ToString();
            ViewState["Org"]        = strb_sql.ToString() + UserDefinedQueryConditions.ReturnQueryString((GridView)udqMS.FindControl("GridView1"), (Label)udqMS.FindControl("Label1"));
            UCPagingOrg.CurrentPage = 1;
            this.InitVar(UCPagingOrg, viewtable, "BM_ID", "*,cast(BM_SINGNUMBER as varchar)+' | '+cast(BM_NUMBER as varchar)+' | '+cast(BM_PNUMBER as varchar) AS NUMBER", "dbo.f_formatstr(" + ddlSort.SelectedValue.ToString() + ", '.')", ViewState["Org"].ToString(), 0, 30);
            this.bindGrid(UCPagingOrg, GridView1, NoDataPanel1);
            ViewState["CurrentUCPaging"] = "UCPagingOrg";
        }
Example #6
0
        /// <summary>
        /// 返回详细信息的查询条件
        /// </summary>
        private string GetSearchList()
        {
            this.InitList();
            //获取类别
            string wherecond = "";

            if (ddlmpName.SelectedItem.Text.Trim() == "标准件")
            {
                wherecond = " and MP_MASHAPE='采' ";
            }
            else if (ddlmpName.SelectedItem.Text.Trim() == "钢材")
            {
                wherecond = " and (MP_MASHAPE='板' or MP_MASHAPE='型' or MP_MASHAPE='圆') ";
            }
            else if (ddlmpName.SelectedItem.Text.Trim() == "铸锻件")
            {
                wherecond = "and ( MP_MASHAPE='锻' or MP_MASHAPE='铸')";
            }
            else if (ddlmpName.SelectedItem.Text.Trim() == "采购成品")
            {
                wherecond = " and MP_MASHAPE  = '采购成品' ";
            }
            else if (ddlmpName.SelectedItem.Text.Trim() == "非金属")
            {
                wherecond = " and MP_MASHAPE  = '非金属' ";
            }

            //材料名称
            if (ddlMarName.SelectedIndex != 0)
            {
                wherecond += " and MP_NAME='" + ddlMarName.SelectedValue + "'";
            }
            //材料规格
            if (ddlMarGuiGe.SelectedIndex != 0)
            {
                wherecond += " and MP_GUIGE='" + ddlMarGuiGe.SelectedValue + "'";
            }
            //材料材质
            if (ddlMarCaiZhi.SelectedIndex != 0)
            {
                wherecond += " and MP_CAIZHI='" + ddlMarCaiZhi.SelectedValue + "'";
            }

            if (ckbShowZero.Checked)
            {
                wherecond += " and (MP_YONGLIANG='0' or MP_YONGLIANG='') ";
            }

            //根据批号查询数据
            string sql_select_detail = " MP_PID='" + mp_no.Value + "'";

            //string sql_select_type = "select MP_MASHAPE from "+mptable+" where MP_ID='"+mp_no.Value+"' ";
            //string matype="";//提交的该批材料计划类别:非定尺板、定尺板、型材、标(发运)、标(组装)
            //SqlDataReader dr=DBCallCommon.GetDRUsingSqlText(sql_select_type);

            //if(dr.HasRows)
            //{
            //    dr.Read();
            //    matype=dr["MP_MASHAPE"].ToString();
            //    dr.Close();
            //}

            //if (matype == "非定尺板")
            //{
            //    GridView1.Columns[13].HeaderText = "张数";//数量》》张数
            //    GridView1.Columns[13].Visible = false;//如果是非定尺不显示数量列
            //}
            //else if (matype == "定尺板")
            //{
            //    GridView1.Columns[13].HeaderText = "张数";//数量》》张数
            //}
            //else if (matype == "型材")
            //{
            //    GridView1.Columns[13].HeaderText = "根数";//数量》》总长
            //}
            //else if (matype == "标(发运)")
            //{
            //    ;
            //}
            //else if (matype == "标(组装)")
            //{
            //    ;
            //}

            //if (matype != "")
            //{
            sql_select_detail += " " + wherecond + "";
            //}

            if (IsPostBack)
            {
                udqOrg.ExistedConditions = sql_select_detail;
                sql_select_detail       += UserDefinedQueryConditions.ReturnQueryString((GridView)udqOrg.FindControl("GridView1"), (Label)udqOrg.FindControl("Label1"));
            }
            return(sql_select_detail);
        }