358 lines
16 KiB
C#
358 lines
16 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 System.Collections.Generic;
|
||
using GThinking.N_MODEL.Page;
|
||
using GThinking.N_MISPRO.Utility;
|
||
using GThinking.N_MISPRO.Data;
|
||
using GThinking.N_MODEL.Dialog;
|
||
|
||
namespace GThinking.N_XLXSBJ
|
||
{
|
||
public partial class XLXSBJCXQuery : SingleQueryBase
|
||
{
|
||
XLXSBJCX_M queryentity = new XLXSBJCX_M();
|
||
|
||
#region page事件
|
||
|
||
protected void Page_Load(object sender, EventArgs e)
|
||
{
|
||
this.UMID = 100860069;
|
||
this.UMName = "查询";
|
||
this.CurMaster = Master;
|
||
this.CurQueryEntity = queryentity;
|
||
this.CurQueryTable = QueryTalbe;
|
||
if (!IsPostBack)
|
||
{
|
||
InitControls();
|
||
}
|
||
base.InitPage();
|
||
InitTJYZRangeControls(new TSQL(TContextDatabases.GetDatabase("DBERP")));
|
||
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region 模板事件
|
||
|
||
protected override bool QueryLogicValid()
|
||
{
|
||
if (cbxCXDX.SelectedValue.Trim().Equals(""))
|
||
{
|
||
ShowMessage("请选择查询对象!");
|
||
return false;
|
||
}
|
||
|
||
if (cbxBJFLID.SelectedValue.Trim().Equals(""))
|
||
{
|
||
ShowMessage("请选择报价分类!");
|
||
return false;
|
||
}
|
||
if (cbxBJFLID.SelectedValue.Trim().Contains(","))
|
||
{
|
||
string sFMXBH = "";
|
||
foreach (string sBJFLID in cbxBJFLID.SelectedValue.Trim().Split(','))
|
||
{
|
||
BJFLXX bjflxx = XLBJDUtils.GetBJFLXX(sBJFLID);
|
||
if (sFMXBH.Equals(""))
|
||
sFMXBH = bjflxx.XLXSBJFL_MXBH;
|
||
if (!sFMXBH.Equals(bjflxx.XLXSBJFL_MXBH))
|
||
{
|
||
ShowMessage("报价分类价格表类型必须均为表价实时计算价格表或报价价格表!");
|
||
return false;
|
||
}
|
||
}
|
||
}
|
||
|
||
string sXLGGID = txtXLGGID.Text.Trim();
|
||
string[] sTempXLGGID = sXLGGID.Split(new Char[] { ',', ',' }, StringSplitOptions.RemoveEmptyEntries);
|
||
if (sTempXLGGID.Length >= 2 && chkXLGGIDJQPP.Checked == false)
|
||
{
|
||
ShowMessage("多规格查询时,规格精确匹配必须勾选!");
|
||
return false;
|
||
}
|
||
|
||
string sXLXHID = txtXLXHID.Text.Trim();
|
||
string[] sTempXLXHID = sXLXHID.Split(new Char[] { ',', ',' }, StringSplitOptions.RemoveEmptyEntries);
|
||
if (sTempXLXHID.Length >= 2 && chkXLXHIDJQPP.Checked == false)
|
||
{
|
||
ShowMessage("多型号查询时,型号精确匹配必须勾选!");
|
||
return false;
|
||
}
|
||
|
||
|
||
return base.QueryLogicValid();
|
||
}
|
||
# endregion
|
||
|
||
#region 自定义事件
|
||
|
||
private void InitControls()
|
||
{
|
||
lblBJSLDW.Text = GetOption(100860000, "BJU003").Trim();
|
||
lblBJSLDW2.Text = GetOption(100860000, "BJU003").Trim();
|
||
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
|
||
TSQL SQL = new TSQL(dberp);
|
||
|
||
string sBJDID = PageParam.GetRTrimString("BJDID");
|
||
string sBJDLX = PageParam.GetRTrimString("BJDLX");
|
||
if (sBJDLX.Equals("HBBJ"))
|
||
{
|
||
cbxCXDX.Enabled = false;
|
||
cbxBJFLID.Enabled = false;
|
||
cbxFKZT.Enabled = false;
|
||
cbxTXY.Enabled = false;
|
||
txtKH.Enabled = false;
|
||
txtKHLXR.Enabled = false;
|
||
}
|
||
else if (sBJDLX.Equals("CFBJ"))
|
||
{
|
||
cbxCXDX.Enabled = false;
|
||
cbxBJFLID.Enabled = false;
|
||
txtBJDID.Enabled = false;
|
||
chkBJDIDJQPP.Enabled = false;
|
||
}
|
||
|
||
WorkFlowUtils.SetCheckedDropDownList_WFPROC("XLXSBJ_BJD", cbxWFState);
|
||
|
||
cbxCXDX.ClearItems();
|
||
cbxCXDX.Items.Add(new ListItem("报价单主信息", "BJD"));
|
||
cbxCXDX.Items.Add(new ListItem("报价单明细信息", "BJDMX"));
|
||
cbxCXDX.ShowValue = false;
|
||
|
||
cbxFKZT.ClearItems();
|
||
cbxFKZT.Items.Add(new ListItem("", ""));
|
||
cbxFKZT.Items.Add(new ListItem("未反馈", "未反馈"));
|
||
cbxFKZT.Items.Add(new ListItem("已反馈", "已反馈"));
|
||
cbxFKZT.ShowValue = false;
|
||
|
||
cbxZB.ClearItems();
|
||
cbxZB.Items.Add(new ListItem("中标", "1"));
|
||
cbxZB.Items.Add(new ListItem("未中标", "0"));
|
||
cbxZB.Items.Add(new ListItem("废标", "2"));
|
||
cbxZB.Items.Add(new ListItem("弃标", "3"));
|
||
cbxZB.ShowValue = false;
|
||
|
||
cbxDZSC.ClearItems();
|
||
cbxDZSC.Items.Add(new ListItem("", ""));
|
||
cbxDZSC.Items.Add(new ListItem("定制", "Y"));
|
||
cbxDZSC.Items.Add(new ListItem("非定制", "N"));
|
||
cbxDZSC.ShowValue = false;
|
||
|
||
cbxPXFS.ClearItems();
|
||
cbxPXFS.Items.Add(new ListItem("报价单号倒序↓", "A"));
|
||
cbxPXFS.Items.Add(new ListItem("报价单号正序↑", "B"));
|
||
cbxPXFS.Items.Add(new ListItem("报价日期倒序↓", "C"));
|
||
cbxPXFS.Items.Add(new ListItem("报价日期正序↑", "D"));
|
||
|
||
TComboBox.SetComboBox("DBERP", cbxXLBZID, "select XLBZ_XLBZID,XLBZ_XLBZLXMC from XLBZ where 1=1 AND len(XLBZ_XLBZID) < 10 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", cbxCPYT, "select XLCPYT_CPYT,XLCPYT_CPYTMC from XLCPYT where 1=1 order by XLCPYT_CPYT", true);
|
||
TComboBox.SetComboBox("DBERP", cbxCPML, "select XLXSCPML_CPMLID,XLXSCPML_CPMLMC from XLXSCPML where 1=1 order by XLXSCPML_CPMLID", true);
|
||
|
||
string sSQL = string.Format("select XLXSBJFL_BJFLID,case isnull(XLXSBJFL_TYBZ,' ') when 'Y' then rtrim(XLXSBJFL_BJFLMC)||'(停用)' else XLXSBJFL_BJFLMC end as Name from XLXSBJFL where 1 =1 ");
|
||
if (!GetOption("BJU012").Equals(""))
|
||
{
|
||
sSQL += " and " + CMISproDataBase.GetWhereEqual("XLXSBJFL_BJFLID", GetOption("BJU012"));
|
||
}
|
||
sSQL += " order by XLXSBJFL_XSXH,XLXSBJFL_MXBH,XLXSBJFL_BJFLID ";
|
||
SQL.Clear();
|
||
SQL.Add(sSQL);
|
||
DataSet ds = dberp.OpenDataSet(SQL);
|
||
if (ds.Tables[0].Rows.Count > 0)
|
||
{
|
||
cbxBJFLID.ClearItems();
|
||
foreach (DataRow trow in ds.Tables[0].Rows)
|
||
{
|
||
cbxBJFLID.Items.Add(new ListItem(trow["Name"].ToString().Trim(), trow["XLXSBJFL_BJFLID"].ToString().Trim()));
|
||
}
|
||
}
|
||
|
||
sSQL = "select rtrim(GS_SYDWID) as ID,rtrim(GS_GSMC) as MC from GS where 1=1 and isnull(GS_TYBZ,'N')<>'Y' order by GS_SYDWID";
|
||
TComboBox.SetComboBox("DBERP", cbxXSDW, sSQL, true);
|
||
|
||
sSQL = "select XSQY_XSQYID,XSQY_XSQYMC from XSQY where 1=1 order by XSQY_XSQYID";
|
||
TComboBox.SetComboBox("DBERP", cbxXSQY, sSQL, true);
|
||
|
||
sSQL = " SELECT BM_BMID,BM_MC FROM BM where 1=1 ";
|
||
if (!string.IsNullOrEmpty(GetOption("HJU006").Trim()))
|
||
{
|
||
sSQL += " and " + CMISproDataBase.GetWhereEqual("BM_BMID", GetOption("HJU006").Trim());
|
||
}
|
||
sSQL += " order by BM_BMID";
|
||
TComboBox.SetComboBox("DBERP", cbxXSBM, sSQL, true);
|
||
|
||
SQL.Clear();
|
||
SQL.Add("select XSY_TXY,XSY_ZJM from XSY where 1=1 ");
|
||
if (!string.IsNullOrEmpty(GetOption("HJU006").Trim()))
|
||
{
|
||
SQL.Add(" and (" + CMISproDataBase.GetWhereEqual("XSY_BMID", GetOption("HJU006").Trim()));
|
||
SQL.Add(" or isnull(XSY_BMID, ' ') = ' ') ");
|
||
}
|
||
SQL.Add(" order by XSY_ZJM ");
|
||
ds = dberp.OpenDataSet(SQL);
|
||
cbxTXY.ClearItems();
|
||
if (ds.Tables[0].Rows.Count > 0)
|
||
{
|
||
cbxTXY.Items.Add(new ListItem("", ""));
|
||
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
|
||
{
|
||
string sTXY = ds.Tables[0].Rows[i][0].ToString().Trim();
|
||
string sZJM = ds.Tables[0].Rows[i][1].ToString().Trim();
|
||
if (sZJM.Equals(""))
|
||
sZJM = CMISproConvert.ConvertZJM(sTXY).Trim();
|
||
cbxTXY.Items.Add(new ListItem(sZJM + "|" + sTXY, sTXY));
|
||
}
|
||
}
|
||
|
||
SQL.Clear();
|
||
SQL.Add("select distinct XLXSBJD_SQRGH,XLXSBJD_SQR from XLXSBJD order by XLXSBJD_SQRGH");
|
||
ds=dberp.OpenDataSet(SQL);
|
||
cbxSQR.ClearItems();
|
||
if (ds.Tables[0].Rows.Count > 0)
|
||
{
|
||
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
|
||
{
|
||
string sSQRGH = ds.Tables[0].Rows[i]["XLXSBJD_SQRGH"].ToString().Trim();
|
||
string sSQR = ds.Tables[0].Rows[i]["XLXSBJD_SQR"].ToString().Trim();
|
||
string sZJM = CMISproConvert.ConvertZJM(sSQR).Trim();
|
||
cbxSQR.Items.Add(new ListItem(sZJM + "|" + sSQR + "|" + sSQRGH, sSQRGH));
|
||
}
|
||
}
|
||
|
||
InitTJYZRangeControls(SQL);
|
||
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region 控件事件
|
||
protected void txtXLXHID_OnTextChanged(object Sender, EventArgs e)
|
||
{
|
||
if (!txtXLXHID.Text.Trim().Equals(""))
|
||
{
|
||
string sXLXHID = txtXLXHID.Text.Trim();
|
||
string[] sTemp = sXLXHID.Split(new Char[] { ',', ',' }, StringSplitOptions.RemoveEmptyEntries);
|
||
if (sTemp.Length >= 2)
|
||
{
|
||
if (chkXLXHIDJQPP.Checked == true)
|
||
{
|
||
chkXLXHIDJQPP.Checked = false;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
protected void txtXLGGID_OnTextChanged(object Sender, EventArgs e)
|
||
{
|
||
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 == true)
|
||
{
|
||
chkXLGGIDJQPP.Checked = false;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
protected void cbxBJFLID_OnSelectedIndexChanged(object sender, EventArgs e)
|
||
{
|
||
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
|
||
TSQL SQL = new TSQL(dberp);
|
||
InitTJYZRangeControls(SQL);
|
||
}
|
||
#endregion
|
||
|
||
private void InitTJYZRangeControls(TSQL SQL)
|
||
{
|
||
Dictionary<string, string> dicYZMC = XLBJDUtils.GetBJDYZIDDic();
|
||
for (int i = 1; i <= 20; i++)
|
||
{
|
||
string sYZID = string.Format("BJ{0}", i.ToString("00"));
|
||
string sYZMC = dicYZMC.ContainsKey(sYZID) ? dicYZMC[sYZID] : string.Format("调价因子{0}", i.ToString("00"));
|
||
SetTJYZVisible(i, false, sYZMC);
|
||
}
|
||
|
||
string sBJFLID = cbxBJFLID.SelectedValue.Trim();
|
||
if (string.IsNullOrEmpty(sBJFLID))
|
||
{
|
||
return;
|
||
}
|
||
|
||
Dictionary<string, string> dicUsedYZID = GetBJFLUsedYZID(SQL, sBJFLID);
|
||
for (int i = 1; i <= 20; i++)
|
||
{
|
||
string sYZID = string.Format("BJ{0}", i.ToString("00"));
|
||
if (!dicUsedYZID.ContainsKey(sYZID))
|
||
{
|
||
continue;
|
||
}
|
||
string sYZMC = dicYZMC.ContainsKey(sYZID) ? dicYZMC[sYZID] : string.Format("调价因子{0}", i.ToString("00"));
|
||
SetTJYZVisible(i, true, sYZMC);
|
||
}
|
||
}
|
||
|
||
private Dictionary<string, string> GetBJFLUsedYZID(TSQL SQL, string sBJFLID)
|
||
{
|
||
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
|
||
Dictionary<string, string> dicUsedYZID = new Dictionary<string, string>();
|
||
SQL.Clear();
|
||
SQL.Add(" select distinct XLXSBJFLYZ_YZID from XLXSBJFLYZ ");
|
||
SQL.Add(" where 1 = 1 ");
|
||
SQL.Add(" and " + CMISproDataBase.GetWhereEqual("XLXSBJFLYZ_BJFLID", sBJFLID));
|
||
SQL.Add(" and XLXSBJFLYZ_YZID like 'BJ__' ");
|
||
DataSet ds = dberp.OpenDataSet(SQL);
|
||
foreach (DataRow dr in ds.Tables[0].Rows)
|
||
{
|
||
string sYZID = dr["XLXSBJFLYZ_YZID"].ToString().Trim();
|
||
if (!string.IsNullOrEmpty(sYZID))
|
||
{
|
||
if (!dicUsedYZID.ContainsKey(sYZID))
|
||
{
|
||
dicUsedYZID.Add(sYZID, sYZID);
|
||
}
|
||
}
|
||
}
|
||
return dicUsedYZID;
|
||
}
|
||
|
||
private void SetTJYZVisible(int iIndex, bool bVisible, string sYZMC)
|
||
{
|
||
switch (iIndex)
|
||
{
|
||
case 1: rowTJYZ01.Visible = bVisible; rowTJYZ01Z.Visible = bVisible; lblTJYZ01.Text = sYZMC + "始:"; lblTJYZ01Z.Text = sYZMC + "止:"; break;
|
||
case 2: rowTJYZ02.Visible = bVisible; rowTJYZ02Z.Visible = bVisible; lblTJYZ02.Text = sYZMC + "始:"; lblTJYZ02Z.Text = sYZMC + "止:"; break;
|
||
case 3: rowTJYZ03.Visible = bVisible; rowTJYZ03Z.Visible = bVisible; lblTJYZ03.Text = sYZMC + "始:"; lblTJYZ03Z.Text = sYZMC + "止:"; break;
|
||
case 4: rowTJYZ04.Visible = bVisible; rowTJYZ04Z.Visible = bVisible; lblTJYZ04.Text = sYZMC + "始:"; lblTJYZ04Z.Text = sYZMC + "止:"; break;
|
||
case 5: rowTJYZ05.Visible = bVisible; rowTJYZ05Z.Visible = bVisible; lblTJYZ05.Text = sYZMC + "始:"; lblTJYZ05Z.Text = sYZMC + "止:"; break;
|
||
case 6: rowTJYZ06.Visible = bVisible; rowTJYZ06Z.Visible = bVisible; lblTJYZ06.Text = sYZMC + "始:"; lblTJYZ06Z.Text = sYZMC + "止:"; break;
|
||
case 7: rowTJYZ07.Visible = bVisible; rowTJYZ07Z.Visible = bVisible; lblTJYZ07.Text = sYZMC + "始:"; lblTJYZ07Z.Text = sYZMC + "止:"; break;
|
||
case 8: rowTJYZ08.Visible = bVisible; rowTJYZ08Z.Visible = bVisible; lblTJYZ08.Text = sYZMC + "始:"; lblTJYZ08Z.Text = sYZMC + "止:"; break;
|
||
case 9: rowTJYZ09.Visible = bVisible; rowTJYZ09Z.Visible = bVisible; lblTJYZ09.Text = sYZMC + "始:"; lblTJYZ09Z.Text = sYZMC + "止:"; break;
|
||
case 10: rowTJYZ10.Visible = bVisible; rowTJYZ10Z.Visible = bVisible; lblTJYZ10.Text = sYZMC + "始:"; lblTJYZ10Z.Text = sYZMC + "止:"; break;
|
||
case 11: rowTJYZ11.Visible = bVisible; rowTJYZ11Z.Visible = bVisible; lblTJYZ11.Text = sYZMC + "始:"; lblTJYZ11Z.Text = sYZMC + "止:"; break;
|
||
case 12: rowTJYZ12.Visible = bVisible; rowTJYZ12Z.Visible = bVisible; lblTJYZ12.Text = sYZMC + "始:"; lblTJYZ12Z.Text = sYZMC + "止:"; break;
|
||
case 13: rowTJYZ13.Visible = bVisible; rowTJYZ13Z.Visible = bVisible; lblTJYZ13.Text = sYZMC + "始:"; lblTJYZ13Z.Text = sYZMC + "止:"; break;
|
||
case 14: rowTJYZ14.Visible = bVisible; rowTJYZ14Z.Visible = bVisible; lblTJYZ14.Text = sYZMC + "始:"; lblTJYZ14Z.Text = sYZMC + "止:"; break;
|
||
case 15: rowTJYZ15.Visible = bVisible; rowTJYZ15Z.Visible = bVisible; lblTJYZ15.Text = sYZMC + "始:"; lblTJYZ15Z.Text = sYZMC + "止:"; break;
|
||
case 16: rowTJYZ16.Visible = bVisible; rowTJYZ16Z.Visible = bVisible; lblTJYZ16.Text = sYZMC + "始:"; lblTJYZ16Z.Text = sYZMC + "止:"; break;
|
||
case 17: rowTJYZ17.Visible = bVisible; rowTJYZ17Z.Visible = bVisible; lblTJYZ17.Text = sYZMC + "始:"; lblTJYZ17Z.Text = sYZMC + "止:"; break;
|
||
case 18: rowTJYZ18.Visible = bVisible; rowTJYZ18Z.Visible = bVisible; lblTJYZ18.Text = sYZMC + "始:"; lblTJYZ18Z.Text = sYZMC + "止:"; break;
|
||
case 19: rowTJYZ19.Visible = bVisible; rowTJYZ19Z.Visible = bVisible; lblTJYZ19.Text = sYZMC + "始:"; lblTJYZ19Z.Text = sYZMC + "止:"; break;
|
||
case 20: rowTJYZ20.Visible = bVisible; rowTJYZ20Z.Visible = bVisible; lblTJYZ20.Text = sYZMC + "始:"; lblTJYZ20Z.Text = sYZMC + "止:"; break;
|
||
}
|
||
}
|
||
}
|
||
}
|