using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using GThinking.N_MODEL.Page; using GThinking.N_PUBLIC; using GThinking.N_MISPRO.Utility; using GThinking.N_MISPRO.Data; namespace GThinking.N_XLXSBJ { public partial class JGCZBMLQuery : SingleQueryBase { JGCZBML_M qryEntity = new JGCZBML_M(); #region 页面初始化 protected void Page_Load(object sender, EventArgs e) { this.UMID = 100860020; this.UMName = "线缆销售报价结构尺重表"; this.CurMaster = Master; this.CurQueryTable = QueryTable; this.CurQueryEntity = qryEntity; base.InitPage(); if (!IsPostBack) { InitControls(); } } #endregion #region 模板事件 protected override bool QueryLogicValid() { return base.QueryLogicValid(); } #endregion #region 私有函数 private void InitControls() { cbxCZBLX.ClearItems(); cbxCZBLX.Items.Add(new ListItem("自主策划", "Z")); cbxCZBLX.Items.Add(new ListItem("材料用量(直接维护)", "A")); cbxCZBLX.Items.Add(new ListItem("材料用量(Excel导入)", "B")); cbxCZBLX.Items.Add(new ListItem("结构工艺(成套计算)", "C")); cbxCZBLX.Items.Add(new ListItem("结构工艺(临时编制)", "G")); txtBJCL_OnTextChanged(null, null); cbxPXFS.ClearItems(); cbxPXFS.Items.Add(new ListItem("尺重表表号", "0")); cbxPXFS.Items.Add(new ListItem("导入时间倒序↓", "1")); cbxCLYLPSQK.ClearItems(); cbxCLYLPSQK.Items.Add(new ListItem("", "")); cbxCLYLPSQK.Items.Add(new ListItem("已派生", "已派生")); cbxCLYLPSQK.Items.Add(new ListItem("未派生", "未派生")); TComboBox.SetComboBox("DBERP", cbxCPMLID, "select XLXSCPML_CPMLID,XLXSCPML_CPMLMC from XLXSCPML where 1=1 and XLXSCPML_SJY = 'Y' order by XLXSCPML_CPMLID", true); TComboBox.SetComboBox("DBERP", cbxXLBZID, "select XLBZ_XLBZID,XLBZ_XLBZLXMC from XLBZ where 1=1 order by XLBZ_PX,XLBZ_XLBZID", true); TComboBox.SetComboBox("DBERP", cbxSYXLXHID, "select XLXHB_XLXHID as ID,XLXHB_XLXHID as Name from XLXHB where isnull(XLXHB_TYBZ,'N')<>'Y' order by ID ", true); } #endregion #region 控件事件 protected void txtBJCL_OnTextChanged(object sender, EventArgs e) { TDatabase dberp = TContextDatabases.GetDatabase("DBERP"); TSQL SQL = new TSQL(dberp); string sBJCLID = txtBJCLID.Text.Trim(); string sBJCLMC = txtBJCLMC.Text.Trim(); string sBJCL = cbxBJCL.SelectedValue.Trim(); int flag = 0; if (!sBJCLID.Equals("") || !sBJCLMC.Equals("")) { cbxBJCL.ClearItems(); SQL.Clear(); SQL.Add(" select XLXSBJCL_BJCLID, rtrim(XLXSBJCL_BJCLID)||'|'||XLXSBJCL_BJCLMC as BJCLMC from XLXSBJCL "); SQL.Add(" where 1 = 1 and isnull(XLXSBJCL_BJCLMC,' ')<>' ' "); if (!sBJCLID.Equals("")) { SQL.Add(" and XLXSBJCL_BJCLID like :pBJCLID"); SQL.ParamByName("pBJCLID").Value = "%" + sBJCLID + "%"; } if (!sBJCLMC.Equals("")) { SQL.Add(" and XLXSBJCL_BJCLMC like :pBJCLMC"); SQL.ParamByName("pBJCLMC").Value = "%" + sBJCLMC + "%"; } SQL.Add(" order by XLXSBJCL_BJCLID"); DataSet ds = dberp.OpenDataSet(SQL); cbxBJCL.Items.Add(new ListItem("", "")); cbxBJCL.Items.Add(new ListItem("未设置", "未设置")); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { cbxBJCL.Items.Add(new ListItem((ds.Tables[0].Rows[i][1].ToString().Trim()), (ds.Tables[0].Rows[i][0].ToString().Trim()))); if (ds.Tables[0].Rows[i][0].ToString().Trim().Equals(sBJCL)) { flag = 1; } } if (1 == flag) { cbxBJCL.SelectedValue = sBJCL; } cbxBJCL.ShowValue = false; } else { cbxBJCL.ClearItems(); SQL.Clear(); SQL.Add(" select XLXSBJCL_BJCLID, "); SQL.Add(" rtrim(XLXSBJCL_BJCLID)||'|'||rtrim(XLXSBJCL_BJCLMC) as Name"); SQL.Add(" from XLXSBJCL where isnull(XLXSBJCL_BJCLMC,' ')<>' ' "); SQL.Add(" order by XLXSBJCL_BJCLID"); DataSet ds = dberp.OpenDataSet(SQL); cbxBJCL.Items.Add(new ListItem("", "")); cbxBJCL.Items.Add(new ListItem("未设置", "未设置")); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { cbxBJCL.Items.Add(new ListItem((ds.Tables[0].Rows[i][1].ToString().Trim()), (ds.Tables[0].Rows[i][0].ToString().Trim()))); } cbxBJCL.ShowValue = false; } } #endregion } }