172 lines
6.1 KiB
C#
172 lines
6.1 KiB
C#
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 WLHQQuery : SingleQueryBase
|
|
{
|
|
XLXSWLHQ_M qryEntity = new XLXSWLHQ_M();
|
|
|
|
#region 页面初始化
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
this.UMID = 100860032;
|
|
this.UMName = "线缆销售报价物料行情";
|
|
this.CurMaster = Master;
|
|
this.CurQueryTable = QueryTable;
|
|
this.CurQueryEntity = qryEntity;
|
|
|
|
base.InitPage();
|
|
if (!IsPostBack)
|
|
{
|
|
InitControls();
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 模板事件
|
|
protected override bool QueryLogicValid()
|
|
{
|
|
if (datCKRQ.Text.Equals(""))
|
|
{
|
|
ShowMessage("参考日期不允许为空!");
|
|
return false;
|
|
}
|
|
return base.QueryLogicValid();
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 私有函数
|
|
|
|
private void InitControls()
|
|
{
|
|
//TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
|
|
//TSQL SQL = new TSQL(dberp);
|
|
//cbxBJCL.ClearItems();
|
|
//SQL.Clear();
|
|
//SQL.Add(" select XLXSBJCL_BJCLID, ");
|
|
//SQL.Add(" rtrim(XLXSBJCL_BJCLID)||'|'||rtrim(XLXSBJCL_BJCLMC)||'|'||'Kg' 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("", ""));
|
|
//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;
|
|
|
|
txtBJCL_OnTextChanged(null, null);
|
|
|
|
cbxPSQK.ClearItems();
|
|
cbxPSQK.Items.Add(new ListItem("", ""));
|
|
cbxPSQK.Items.Add(new ListItem("已派生材料物料", "已派生材料物料"));
|
|
cbxPSQK.Items.Add(new ListItem("未派生材料物料", "未派生材料物料"));
|
|
|
|
if (datCKRQ.Text.Trim().Equals(DateTime.Now.ToShortDateString().Trim()))
|
|
chkHQWS.Enabled = true;
|
|
else
|
|
chkHQWS.Enabled = false;
|
|
|
|
}
|
|
#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 || case when isnull(XLXSBJCL_TYBZ,'N')= 'Y' then '(停用)' else ' ' end as BJCLMC from XLXSBJCL ");
|
|
SQL.Add(" where 1 = 1 and isnull(XLXSBJCL_BJCLMC,' ')<>' ' and XLXSBJCL_BJHQ='2' ");
|
|
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 isnull(XLXSBJCL_TYBZ,'N'),XLXSBJCL_BJCLID");
|
|
DataSet ds = dberp.OpenDataSet(SQL);
|
|
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) || case when isnull(XLXSBJCL_TYBZ,'N')= 'Y' then '(停用)' else ' ' end as Name");
|
|
SQL.Add(" from XLXSBJCL where isnull(XLXSBJCL_BJCLMC,' ')<>' ' and XLXSBJCL_BJHQ='2' ");
|
|
SQL.Add(" order by isnull(XLXSBJCL_TYBZ,'N'),XLXSBJCL_BJCLID");
|
|
DataSet ds = dberp.OpenDataSet(SQL);
|
|
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;
|
|
}
|
|
}
|
|
|
|
protected void OndatCKRQChanged(object Sender, EventArgs e)
|
|
{
|
|
chkHQWS.Checked = false;
|
|
|
|
if (datCKRQ.Text.Trim().Equals(DateTime.Now.ToShortDateString().Trim()))
|
|
chkHQWS.Enabled = true;
|
|
else
|
|
chkHQWS.Enabled = false;
|
|
}
|
|
|
|
protected void cbxBJCL_OnSelectChanged(object Sender, EventArgs e)
|
|
{
|
|
string sBJCL = cbxBJCL.SelectedItem.Text;
|
|
if (sBJCL.Contains("(停用)"))
|
|
chkXSTYCL.Checked = true;
|
|
}
|
|
|
|
#endregion
|
|
|
|
}
|
|
}
|