Files
N_XLXSBJ----MX/CLQDQuery.aspx.cs
T
2026-08-21 17:03:02 +08:00

440 lines
18 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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 CLQDQuery : SingleQueryBase
{
CLQD_M queryentity = new CLQD_M();
#region 页面初始化
protected void Page_Load(object sender, EventArgs e)
{
this.UMID = 100860002;
this.UMName = "查询";
this.CurMaster = Master;
this.CurQueryTable = QueryTalbe;
this.CurQueryEntity = queryentity;
if (!IsPostBack)
{
InitControl();
}
base.InitPage();
if (!IsPostBack)
{
txtXLGGID_OnTextChanged(null, null);
}
}
protected override bool QueryLogicValid()
{
if (cbxJGCZB.SelectedValue.Trim().Equals(""))
{
ShowMessage("结构尺重表--不允许为空!");
return false;
}
string sXLGGID = txtXLGGID.Text.Trim();
string[] sTemp = sXLGGID.Split(new Char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
if (sTemp.Length >= 2 && chkXLGGIDJQPP.Checked == false)
{
ShowMessage("多规格查询时,规格精确匹配必须勾选!");
return false;
}
return base.QueryLogicValid();
}
#endregion
#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 and XLXSCLQD_WPID ='ZZZZ' ");
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", 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);
TComboBox.SetComboBox("DBERP", cbxCPMLID, "SELECT XLXSCPML_CPMLID,XLXSCPML_CPMLMC FROM XLXSCPML where 1=1 order by XLXSCPML_CPMLID ", 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];
}
protected void txtXLXHID_OnTextChanged(object Sender, EventArgs e)
{
//结构尺重表之前的值
string sOLDJGCZB = cbxJGCZB.SelectedValue.Trim();
int flag = 0;
cbxJGCZB.ClearItems();
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
TSQL sql = new TSQL(dberp);
sql.Clear();
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 ");
sql.Add(" where 1 = 1 and XLXSCLQD_WPID ='ZZZZ' ");
if (!txtXLXHID.Text.Trim().Equals(""))
{
if (chkXLXHIDJQPP.Checked == true)
{
sql.Add(" and XLXSCLQD_XLXHID = :pXLXHID");
sql.ParamByName("pXLXHID").Value = txtXLXHID.Text.Trim();
}
else
{
sql.Add(" and XLXSCLQD_XLXHID like :pXLXHID");
sql.ParamByName("pXLXHID").Value = "%" + txtXLXHID.Text.Trim() + "%";
}
}
if (!txtXLGGID.Text.Trim().Equals(""))
{
string sXLGGID = txtXLGGID.Text.Trim();
string[] sTemp = sXLGGID.Split(new Char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
if (sTemp.Length >= 2)
{
sql.Add(" and " + CMISproDataBase.GetWhereEqual(" replace(XLXSCLQD_XLGGID,'*','×')", sXLGGID.Replace('*', '×')));
}
else
{
if (chkXLGGIDJQPP.Checked == true)
{
sql.Add(" and replace(XLXSCLQD_XLGGID,'*','×') = :pXLGGID ");
sql.ParamByName("pXLGGID").Value = txtXLGGID.Text.Trim().Replace('*', '×');
}
else
{
sql.Add(" and replace(XLXSCLQD_XLGGID,'*','×') like :pXLGGID ");
sql.ParamByName("pXLGGID").Value = "%" + txtXLGGID.Text.Trim().Replace('*', '×') + "%";
}
}
}
if (!txtJGCZBID2.Text.Trim().Equals(""))
{
sql.Add(" and XLXSCLQD_JGCZBID = :pJGCZBID");
sql.ParamByName("pJGCZBID").Value = txtJGCZBID2.Text.Trim();
}
if (!cbxST.SelectedValue.Trim().Equals(""))
{
sql.Add(" and XLXSCLQD_XLBZID = :pXLBZID");
sql.ParamByName("pXLBZID").Value = cbxST.SelectedValue.Trim();
}
if (!cbxDYDJID.SelectedValue.Trim().Equals(""))
{
sql.Add(" and XLXSCLQD_DYDJID = :pDYDJID");
sql.ParamByName("pDYDJID").Value = cbxDYDJID.SelectedValue.Trim();
}
sql.Add(") a left join XLJGCZBML on XLJGCZBML_JGCZBID=JGCZBID ");
sql.Add("where 1=1 ");
if (!cbxCPMLID.SelectedValue.Trim().Equals(""))
{
sql.Add(" and XLJGCZBML_CPMLID = :pCPMLID");
sql.ParamByName("pCPMLID").Value = cbxCPMLID.SelectedValue.Trim();
}
sql.Add("order by JGCZBID");
DataSet ds = dberp.OpenDataSet(sql);
if (ds.Tables[0].Rows.Count > 0)
{
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));
if (sOLDJGCZB.Equals(ds.Tables[0].Rows[i]["JGCZBID"].ToString().Trim() + "|" + sJGCZBBBID))
{
flag = 1;
}
}
if (1 == flag)
{
cbxJGCZB.SelectedValue = sOLDJGCZB;
cbxJGCZB_SelectedIndexChanged(null, null);
}
else
{
if (cbxJGCZB.ItemsCount >= 1)
{
cbxJGCZB.SelectedIndex = 0;
cbxJGCZB_SelectedIndexChanged(null, null);
}
}
}
}
protected void txtXLGGID_OnTextChanged(object Sender, EventArgs e)
{
//结构尺重表之前的值
string sOLDJGCZB = cbxJGCZB.SelectedValue.Trim();
int flag = 0;
cbxJGCZB.ClearItems();
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
TSQL sql = new TSQL(dberp);
sql.Clear();
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");
sql.Add(" where 1 = 1 and XLXSCLQD_WPID ='ZZZZ' ");
if (!txtXLXHID.Text.Trim().Equals(""))
{
if (chkXLXHIDJQPP.Checked == true)
{
sql.Add(" and XLXSCLQD_XLXHID = :pXLXHID");
sql.ParamByName("pXLXHID").Value = txtXLXHID.Text.Trim();
}
else
{
sql.Add(" and XLXSCLQD_XLXHID like :pXLXHID");
sql.ParamByName("pXLXHID").Value = "%" + txtXLXHID.Text.Trim() + "%";
}
}
if (!txtXLGGID.Text.Trim().Equals(""))
{
string sXLGGID = txtXLGGID.Text.Trim();
string[] sTemp = sXLGGID.Split(new Char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
if (sTemp.Length >= 2)
{
if (chkXLGGIDJQPP.Checked == false)
{
chkXLGGIDJQPP.Checked = true;
}
sql.Add(" and " + CMISproDataBase.GetWhereEqual(" replace(XLXSCLQD_XLGGID,'*','×')", sXLGGID.Replace('*', '×')));
}
else
{
if (chkXLGGIDJQPP.Checked == true)
{
sql.Add(" and replace(XLXSCLQD_XLGGID,'*','×') = :pXLGGID ");
sql.ParamByName("pXLGGID").Value = txtXLGGID.Text.Trim().Replace('*', '×');
}
else
{
sql.Add(" and replace(XLXSCLQD_XLGGID,'*','×') like :pXLGGID ");
sql.ParamByName("pXLGGID").Value = "%" + txtXLGGID.Text.Trim().Replace('*', '×') + "%";
}
}
}
if (!txtJGCZBID2.Text.Trim().Equals(""))
{
sql.Add(" and XLXSCLQD_JGCZBID = :pJGCZBID");
sql.ParamByName("pJGCZBID").Value = txtJGCZBID2.Text.Trim();
}
if (!cbxST.SelectedValue.Trim().Equals(""))
{
sql.Add(" and XLXSCLQD_XLBZID = :pXLBZID");
sql.ParamByName("pXLBZID").Value = cbxST.SelectedValue.Trim();
}
if (!cbxDYDJID.SelectedValue.Trim().Equals(""))
{
sql.Add(" and XLXSCLQD_DYDJID = :pDYDJID");
sql.ParamByName("pDYDJID").Value = cbxDYDJID.SelectedValue.Trim();
}
sql.Add(") a left join XLJGCZBML on XLJGCZBML_JGCZBID=JGCZBID ");
sql.Add("where 1=1 ");
if (!cbxCPMLID.SelectedValue.Trim().Equals(""))
{
sql.Add(" and XLJGCZBML_CPMLID = :pCPMLID");
sql.ParamByName("pCPMLID").Value = cbxCPMLID.SelectedValue.Trim();
}
sql.Add("order by JGCZBID");
DataSet ds = dberp.OpenDataSet(sql);
if (ds.Tables[0].Rows.Count > 0)
{
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));
if (sOLDJGCZB.Equals(ds.Tables[0].Rows[i]["JGCZBID"].ToString().Trim() + "|" + sJGCZBBBID))
{
flag = 1;
}
}
if (1 == flag)
{
cbxJGCZB.SelectedValue = sOLDJGCZB;
cbxJGCZB_SelectedIndexChanged(null, null);
}
else
{
if (cbxJGCZB.ItemsCount >= 1)
{
cbxJGCZB.SelectedIndex = 0;
cbxJGCZB_SelectedIndexChanged(null, null);
}
}
}
}
protected void chkXLXHIDJQPP_OnCheckedChanged(object Sender, EventArgs e)
{
//结构尺重表之前的值
string sOLDJGCZB = cbxJGCZB.SelectedValue.Trim();
int flag = 0;
cbxJGCZB.ClearItems();
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
TSQL sql = new TSQL(dberp);
sql.Clear();
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");
sql.Add(" where 1 = 1 and XLXSCLQD_WPID ='ZZZZ' ");
if (!txtXLXHID.Text.Trim().Equals(""))
{
if (chkXLXHIDJQPP.Checked == true)
{
sql.Add(" and XLXSCLQD_XLXHID = :pXLXHID");
sql.ParamByName("pXLXHID").Value = txtXLXHID.Text.Trim();
}
else
{
sql.Add(" and XLXSCLQD_XLXHID like :pXLXHID");
sql.ParamByName("pXLXHID").Value = "%" + txtXLXHID.Text.Trim() + "%";
}
}
if (!txtXLGGID.Text.Trim().Equals(""))
{
string sXLGGID = txtXLGGID.Text.Trim();
string[] sTemp = sXLGGID.Split(new Char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
if (sTemp.Length >= 2)
{
sql.Add(" and " + CMISproDataBase.GetWhereEqual(" replace(XLXSCLQD_XLGGID,'*','×')", sXLGGID.Replace('*', '×')));
}
else
{
if (chkXLGGIDJQPP.Checked == true)
{
sql.Add(" and replace(XLXSCLQD_XLGGID,'*','×') = :pXLGGID ");
sql.ParamByName("pXLGGID").Value = txtXLGGID.Text.Trim().Replace('*', '×');
}
else
{
sql.Add(" and replace(XLXSCLQD_XLGGID,'*','×') like :pXLGGID ");
sql.ParamByName("pXLGGID").Value = "%" + txtXLGGID.Text.Trim().Replace('*', '×') + "%";
}
}
}
if (!txtJGCZBID2.Text.Trim().Equals(""))
{
sql.Add(" and XLXSCLQD_JGCZBID = :pJGCZBID");
sql.ParamByName("pJGCZBID").Value = txtJGCZBID2.Text.Trim();
}
if (!cbxST.SelectedValue.Trim().Equals(""))
{
sql.Add(" and XLXSCLQD_XLBZID = :pXLBZID");
sql.ParamByName("pXLBZID").Value = cbxST.SelectedValue.Trim();
}
if (!cbxDYDJID.SelectedValue.Trim().Equals(""))
{
sql.Add(" and XLXSCLQD_DYDJID = :pDYDJID");
sql.ParamByName("pDYDJID").Value = cbxDYDJID.SelectedValue.Trim();
}
sql.Add(") a left join XLJGCZBML on XLJGCZBML_JGCZBID=JGCZBID ");
sql.Add("where 1=1 ");
if (!cbxCPMLID.SelectedValue.Trim().Equals(""))
{
sql.Add(" and XLJGCZBML_CPMLID = :pCPMLID");
sql.ParamByName("pCPMLID").Value = cbxCPMLID.SelectedValue.Trim();
}
sql.Add("order by JGCZBID");
DataSet ds = dberp.OpenDataSet(sql);
if (ds.Tables[0].Rows.Count > 0)
{
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));
if (sOLDJGCZB.Equals(ds.Tables[0].Rows[i]["JGCZBID"].ToString().Trim() + "|" + sJGCZBBBID))
{
flag = 1;
}
}
if (1 == flag)
{
cbxJGCZB.SelectedValue = sOLDJGCZB;
cbxJGCZB_SelectedIndexChanged(null, null);
}
else
{
if (cbxJGCZB.ItemsCount >= 1)
{
cbxJGCZB.SelectedIndex = 0;
cbxJGCZB_SelectedIndexChanged(null, null);
}
}
}
}
protected void chkXLGGIDJQPP_OnCheckedChanged(object Sender, EventArgs e)
{
string sXLGGID = txtXLGGID.Text.Trim();
string[] sTemp = sXLGGID.Split(new Char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
if (sTemp.Length >= 2)
{
}
else
{
txtXLGGID_OnTextChanged(null, null);
}
}
}
}