172 lines
8.3 KiB
C#
172 lines
8.3 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_MISPRO.Utility;
|
||
using GThinking.N_MISPRO.Data;
|
||
using GThinking.N_WORKFLOW;
|
||
using GThinking.N_PUBLIC;
|
||
using GThinking.N_MODEL.Dialog;
|
||
using GThinking.N_CONTROL;
|
||
using System.Text;
|
||
|
||
namespace GThinking.N_XLXSBJ
|
||
{
|
||
public partial class CLCBQuery : SingleQueryBase
|
||
{
|
||
CLCB_M queryentity = new CLCB_M();
|
||
|
||
protected void Page_Load(object sender, EventArgs e)
|
||
{
|
||
this.UMID = 100860034;
|
||
this.UMName = "查询";
|
||
this.CurMaster = Master;
|
||
this.CurQueryTable = QueryTalbe;
|
||
this.CurQueryEntity = queryentity;
|
||
|
||
if (!IsPostBack)
|
||
{
|
||
InitControl();
|
||
}
|
||
|
||
base.InitPage();
|
||
}
|
||
|
||
protected override bool QueryLogicValid()
|
||
{
|
||
if (cbxJGCZB.SelectedValue.Trim().Equals(""))
|
||
{
|
||
ShowMessage("结构尺重表--不允许为空!");
|
||
return false;
|
||
}
|
||
return base.QueryLogicValid();
|
||
}
|
||
|
||
#region 私有函数
|
||
|
||
private void InitControl()
|
||
{
|
||
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
|
||
TSQL sql = new TSQL(dberp);
|
||
sql.Add("select JGCZBID,XLJGCZBML_JGCZBMC as JGCZBMC,JGCZBBBID ");
|
||
sql.Add("from ");
|
||
sql.Add("( ");
|
||
sql.Add(" select distinct XLXSCLQD_JGCZBID as JGCZBID, XLXSCLQD_JGCZBBBID as JGCZBBBID");
|
||
sql.Add(" from XLXSCLQD where 1=1");
|
||
sql.Add(") a left join XLJGCZBML on XLJGCZBML_JGCZBID=JGCZBID ");
|
||
sql.Add("order by JGCZBID");
|
||
DataSet ds = dberp.OpenDataSet(sql);
|
||
cbxJGCZB.ClearItems();
|
||
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
|
||
{
|
||
string sJGCZBBBID = ds.Tables[0].Rows[i]["JGCZBBBID"].ToString().Trim();
|
||
cbxJGCZB.Items.Add(new ListItem(ds.Tables[0].Rows[i]["JGCZBID"].ToString().Trim() + "|" + ds.Tables[0].Rows[i]["JGCZBMC"].ToString().Trim() + "|" + sJGCZBBBID
|
||
, ds.Tables[0].Rows[i]["JGCZBID"].ToString().Trim() + "|" + sJGCZBBBID));
|
||
}
|
||
|
||
TComboBox.SetComboBox("DBERP", cbxXLXHID, "select XLXHB_XLXHID as ID,(rtrim(XLXHB_XLXHID) || case when isnull(XLXHB_TYBZ,'N') = 'N' then '' else '(已停用)' end) as Name from XLXHB where XLXHB_XLXHID in(select distinct XLXSCLQD_XLXHID as XLXHB_XLXHID from XLXSCLQD where 1=1 and XLXSCLQD_WPID = 'ZZZZ') order by XLXHB_TYBZ,ID", true);
|
||
TComboBox.SetComboBox("DBERP", cbxST, "select XLBZ_XLBZID,XLBZ_XLBZLXMC from XLBZ where 1=1 order by XLBZ_PX,XLBZ_XLBZID", true);
|
||
TComboBox.SetComboBox("DBERP", cbxDYDJID, "select distinct XLDYDJB_DYDJID as ID,XLDYDJB_DYDJID as Name from XLDYDJB where 1=1 order by ID ", true);
|
||
|
||
cbxPXFS.ClearItems();
|
||
cbxPXFS.Items.Add(new ListItem("型号+序号", "型号+序号"));
|
||
cbxPXFS.Items.Add(new ListItem("尺重表内容导入行号", "尺重表内容导入行号"));
|
||
}
|
||
|
||
#endregion
|
||
|
||
protected void cbxJGCZB_SelectedIndexChanged(object Sender, EventArgs e)
|
||
{
|
||
if (!cbxJGCZB.SelectedValue.Trim().Equals(""))
|
||
{
|
||
txtJGCZBBBID.Text = cbxJGCZB.SelectedValue.Trim().Split('|')[1];
|
||
|
||
string sXLXHID = cbxXLXHID.SelectedValue.Trim();
|
||
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
|
||
TSQL sql = new TSQL(dberp);
|
||
sql.Add("select ID,Name,PX from ");
|
||
sql.Add("( select 1 as PX,isnull(XLXHB_TYBZ,'N') as TYBZ,XLXHB_XLXHID as ID,(rtrim(XLXHB_XLXHID)||case when isnull(XLXHB_TYBZ,'N')='N' then '' else '(已停用)' end)||'(*)' as Name ");
|
||
sql.Add("from XLXHB ");
|
||
sql.Add("where XLXHB_XLXHID in(select distinct XLXSCLQD_XLXHID as XLXHB_XLXHID from XLXSCLQD where XLXSCLQD_WPID='ZZZZ' and XLXSCLQD_JGCZBID=:pJGCZBID and XLXSCLQD_JGCZBBBID=:pJGCZBBBID) ");
|
||
sql.Add("union all ");
|
||
sql.Add("select 2 as PX,isnull(XLXHB_TYBZ,'N') as TYBZ,XLXHB_XLXHID as ID,(rtrim(XLXHB_XLXHID)||case when isnull(XLXHB_TYBZ,'N')='N' then '' else '(已停用)' end) as Name ");
|
||
sql.Add("from XLXHB ");
|
||
sql.Add("where XLXHB_XLXHID in(select distinct XLXSCLQD_XLXHID as XLXHB_XLXHID from XLXSCLQD where XLXSCLQD_WPID='ZZZZ' and (XLXSCLQD_JGCZBID<>:pJGCZBID or XLXSCLQD_JGCZBBBID<>:pJGCZBBBID)) ");
|
||
sql.Add(") a ");
|
||
sql.Add("order by PX,TYBZ,ID ");
|
||
sql.ParamByName("pJGCZBID").Value = cbxJGCZB.SelectedValue.Trim().Split('|')[0];
|
||
sql.ParamByName("pJGCZBBBID").Value = txtJGCZBBBID.Text.Trim(); ;
|
||
DataSet ds = dberp.OpenDataSet(sql);
|
||
cbxXLXHID.ClearItems();
|
||
cbxXLXHID.Items.Add(new ListItem("", ""));
|
||
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
|
||
{
|
||
if (ds.Tables[0].Rows[i]["ID"].ToString().Trim().Equals("2"))
|
||
{
|
||
if (!cbxXLXHID.Items.Contains(new ListItem(ds.Tables[0].Rows[i]["Name"].ToString().Trim() + "(*)", ds.Tables[0].Rows[i]["ID"].ToString().Trim())))
|
||
cbxXLXHID.Items.Add(new ListItem(ds.Tables[0].Rows[i]["Name"].ToString().Trim(), ds.Tables[0].Rows[i]["ID"].ToString().Trim()));
|
||
}
|
||
else
|
||
cbxXLXHID.Items.Add(new ListItem(ds.Tables[0].Rows[i]["Name"].ToString().Trim(), ds.Tables[0].Rows[i]["ID"].ToString().Trim()));
|
||
}
|
||
cbxXLXHID.SelectedValue = sXLXHID;
|
||
}
|
||
}
|
||
|
||
protected void cbxXLXHID_SelectedIndexChanged(object Sender, EventArgs e)
|
||
{
|
||
if (IsPostBack)
|
||
{
|
||
if (!cbxXLXHID.SelectedValue.Trim().Equals(""))
|
||
{
|
||
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
|
||
TSQL sql = new TSQL(dberp);
|
||
sql.Add("select distinct XLXSCLQD_JGCZBID,XLXSCLQD_JGCZBBBID as JGCZBBBID ");
|
||
sql.Add(" from XLXSCLQD");
|
||
sql.Add(" where XLXSCLQD_XLXHID=:pXLXHID");
|
||
if (!txtXLGGID.Text.Trim().Equals(""))
|
||
{
|
||
if (txtXLGGID.Text.Trim().Contains("*"))
|
||
{
|
||
sql.Add(" and (XLXSCLQD_XLGGID like :pXLGG or XLXSCLQD_XLGGID like :pXLGG2)");
|
||
sql.ParamByName("pXLGG").Value = "%" + txtXLGGID.Text.Trim() + "%";
|
||
sql.ParamByName("pXLGG2").Value = "%" + txtXLGGID.Text.Trim().Replace("*", "×") + "%";
|
||
}
|
||
else
|
||
{
|
||
sql.Add(" and XLXSCLQD_XLGGID like :pXLGGID ");
|
||
sql.ParamByName("pXLGGID").Value = "%" + txtXLGGID.Text.Trim() + "%";
|
||
}
|
||
}
|
||
if (!cbxST.SelectedValue.Trim().Equals(""))
|
||
{
|
||
sql.Add(" and XLXSCLQD_XLBZID = :pST ");
|
||
sql.ParamByName("pST").Value = cbxST.SelectedValue.Trim();
|
||
}
|
||
if (!cbxDYDJID.SelectedValue.Trim().Equals(""))
|
||
{
|
||
sql.Add(" and XLXSCLQD_DYDJID = :pDYDJ ");
|
||
sql.ParamByName("pDYDJ").Value = cbxDYDJID.SelectedValue.Trim();
|
||
}
|
||
sql.Add(" order by XLXSCLQD_JGCZBID");
|
||
sql.ParamByName("pXLXHID").Value = cbxXLXHID.SelectedValue.Trim();
|
||
DataSet ds = dberp.OpenDataSet(sql);
|
||
if (ds.Tables[0].Rows.Count > 0)
|
||
{
|
||
string sJGCZBBBID = ds.Tables[0].Rows[0]["JGCZBBBID"].ToString().Trim();
|
||
cbxJGCZB.SelectedValue = ds.Tables[0].Rows[0]["XLXSCLQD_JGCZBID"].ToString().Trim() + "|" + sJGCZBBBID;
|
||
cbxJGCZB_SelectedIndexChanged(null, null);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|