241 lines
9.0 KiB
C#
241 lines
9.0 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.Data;
|
|
using GThinking.N_MISPRO.Utility;
|
|
|
|
namespace GThinking.N_XLXSBJ
|
|
{
|
|
public partial class CLYL_JGCZBInfo : SingleCardBase
|
|
{
|
|
CLYL_JGCZB entity = new CLYL_JGCZB();
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
this.UMID = 100860014;
|
|
this.UMName = "线缆销售报价材料用量";
|
|
base.CurMaster = Master;
|
|
base.CurEntity = entity;
|
|
this.PageHeight = 400;
|
|
this.PageWidth = 500;
|
|
Master.EnableAttachBtn = false;
|
|
Master.EnableCancelBtn = false;
|
|
Master.EnableCopyBtn = false;
|
|
Master.EnableDeleteBtn = false;
|
|
Master.EnableEditBtn = false;
|
|
Master.EnableInsertBtn = false;
|
|
Master.EnablePrintBtn = false;
|
|
Master.EnableRefreshBtn = false;
|
|
Master.EnableSaveBtn = false;
|
|
|
|
base.InitPage();
|
|
|
|
if (!IsPostBack)
|
|
{
|
|
InitControl();
|
|
}
|
|
}
|
|
|
|
#region 模板
|
|
|
|
protected override void SetControlState()
|
|
{
|
|
base.SetControlState();
|
|
}
|
|
|
|
protected override void SetComboxItems()
|
|
{
|
|
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
|
|
TSQL sql = new TSQL(dberp);
|
|
sql.Add("select XLJGCZBML_JGCZBID,XLJGCZBML_JGCZBMC,XLJGCZBML_JGCZBBBID ");
|
|
sql.Add(" from XLJGCZBML ");
|
|
sql.Add(" where XLJGCZBML_CZBLX = 'A'");
|
|
sql.Add(" order by XLJGCZBML_JGCZBID");
|
|
DataSet ds = dberp.OpenDataSet(sql);
|
|
cbxJGCZB.ClearItems();
|
|
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
|
|
{
|
|
string sJGCZBID = ds.Tables[0].Rows[i]["XLJGCZBML_JGCZBID"].ToString().Trim();
|
|
string sJGCZBMC = ds.Tables[0].Rows[i]["XLJGCZBML_JGCZBMC"].ToString().Trim();
|
|
string sJGCZBBBID = ds.Tables[0].Rows[i]["XLJGCZBML_JGCZBBBID"].ToString().Trim();
|
|
|
|
cbxJGCZB.Items.Add(new ListItem(sJGCZBID + "|" + sJGCZBMC + "|" + sJGCZBBBID, sJGCZBID + "|" + sJGCZBBBID));
|
|
}
|
|
string sBJDID = PageParam.GetRTrimString("BJDID").Trim();
|
|
|
|
sql.Clear();
|
|
sql.Add("select distinct XLXSCLQD_XLXHID as ID ,XLXSCLQD_XLXHID as MC from XLXSCLQD where isnull(XLXSCLQD_BJDID,' ') = :pBJDID ");
|
|
sql.Add(" and XLXSCLQD_WFAWAITER like :pDCLR ");
|
|
sql.Add(" order by ID ");
|
|
sql.ParamByName("pBJDID").Value = sBJDID;
|
|
sql.ParamByName("pDCLR").Value = "%,"+tSession.UserId+",%";
|
|
cbxXLXHID.ClearItems();
|
|
ds.Clear();
|
|
ds = dberp.OpenDataSet(sql);
|
|
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
|
|
{
|
|
string sID = ds.Tables[0].Rows[i]["ID"].ToString().Trim();
|
|
string sName = ds.Tables[0].Rows[i]["MC"].ToString().Trim();
|
|
cbxXLXHID.Items.Add(new ListItem(sName, sID));
|
|
}
|
|
|
|
sql.Clear();
|
|
sql.Add("select distinct XLXSCLQD_DYDJID as ID ,XLXSCLQD_DYDJID as MC from XLXSCLQD where isnull(XLXSCLQD_BJDID,' ') = :pBJDID and XLXSCLQD_WFAWAITER like :pDCLR order by ID ");
|
|
sql.ParamByName("pBJDID").Value = sBJDID;
|
|
sql.ParamByName("pDCLR").Value = "%," + tSession.UserId + ",%";
|
|
cbxDYDJID.ClearItems();
|
|
ds.Clear();
|
|
ds = dberp.OpenDataSet(sql);
|
|
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
|
|
{
|
|
string sID = ds.Tables[0].Rows[i]["ID"].ToString().Trim();
|
|
string sName = ds.Tables[0].Rows[i]["MC"].ToString().Trim();
|
|
cbxDYDJID.Items.Add(new ListItem(sName, sID));
|
|
}
|
|
|
|
base.SetComboxItems();
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 自定义函数
|
|
|
|
private void InitControl()
|
|
{
|
|
string sXLXHID = PageParam.GetRTrimString("XLXHID").Trim();
|
|
if (!sXLXHID.Trim().Equals(""))
|
|
cbxXLXHID.SelectedValue = sXLXHID;
|
|
|
|
string sDYDJID = PageParam.GetRTrimString("DYDJID").Trim();
|
|
if (!sDYDJID.Trim().Equals(""))
|
|
cbxDYDJID.SelectedValue = sDYDJID;
|
|
|
|
string sJGCZB = PageParam.GetRTrimString("JGCZB").Trim();
|
|
if (!sJGCZB.Trim().Equals(""))
|
|
cbxJGCZB.SelectedValue = sJGCZB;
|
|
|
|
chkTG.Checked = true;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 自定义按钮
|
|
|
|
protected void btnOK_Click(object sender, EventArgs e)
|
|
{
|
|
if (cbxJGCZB.SelectedValue.Trim().Equals(""))
|
|
{
|
|
ShowMessage("结构尺重表--不允许为空!");
|
|
return;
|
|
}
|
|
|
|
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
|
|
TSQL SQL = new TSQL(dberp);
|
|
try
|
|
{
|
|
string sBJDID = PageParam.GetRTrimString("BJDID").Trim();
|
|
string sJGCZBID = cbxJGCZB.SelectedValue.Trim().Split('|')[0].Trim();
|
|
string sJGCZBBBID = cbxJGCZB.SelectedValue.Trim().Split('|')[1].Trim();
|
|
string sXLXHID = cbxXLXHID.SelectedValue.Trim();
|
|
string sDYDJID = cbxDYDJID.SelectedValue.Trim();
|
|
|
|
SQL.Add(" update XLXSCLQD set XLXSCLQD_JGCZBID = :pJGCZBID,XLXSCLQD_JGCZBBBID = :pJGCZBBBID ");
|
|
SQL.Add(" where isnull(XLXSCLQD_BJDID,' ') = :pBJDID ");
|
|
SQL.Add(" and XLXSCLQD_WFAWAITER like :pDCLR ");
|
|
if (chkTG.Checked)
|
|
{
|
|
SQL.Add(" and isnull(XLXSCLQD_JGCZBID, ' ') = ' ' ");
|
|
}
|
|
if (!sXLXHID.Equals(""))
|
|
{
|
|
SQL.Add(" and " + CMISproDataBase.GetWhereEqual("XLXSCLQD_XLXHID", sXLXHID));
|
|
}
|
|
if (!sDYDJID.Equals(""))
|
|
{
|
|
SQL.Add(" and " + CMISproDataBase.GetWhereEqual("XLXSCLQD_DYDJID", sDYDJID));
|
|
}
|
|
SQL.ParamByName("pJGCZBID").Value = sJGCZBID;
|
|
SQL.ParamByName("pJGCZBBBID").Value = sJGCZBBBID;
|
|
SQL.ParamByName("pBJDID").Value = sBJDID;
|
|
SQL.ParamByName("pDCLR").Value = "%," + tSession.UserId + ",%";
|
|
dberp.ExecSQL(SQL);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
ShowMessage(ex.Message);
|
|
return;
|
|
}
|
|
|
|
DialogOperationScript dos = new DialogOperationScript(this);
|
|
dos.ClickOwnerButton(PageParam.GetRTrimString("btnRefreshClientID"));
|
|
dos.CloseSelf();
|
|
dos.Execute();
|
|
}
|
|
|
|
protected void btnQX_Click(object sender, EventArgs e)
|
|
{
|
|
CloseWindow();
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 控件事件
|
|
|
|
protected void txtJGCZBSX_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.Add("select XLJGCZBML_JGCZBID,XLJGCZBML_JGCZBMC,XLJGCZBML_JGCZBBBID ");
|
|
sql.Add(" from XLJGCZBML ");
|
|
sql.Add(" where XLJGCZBML_CZBLX = 'A'");
|
|
if (!txtJGCZBSX.Text.Trim().Equals(""))
|
|
{
|
|
sql.Add(" and (XLJGCZBML_JGCZBID like :pJGCZB or XLJGCZBML_JGCZBMC like :pJGCZB ) ");
|
|
sql.ParamByName("pJGCZB").Value = txtJGCZBSX.Text.Trim();
|
|
}
|
|
sql.Add(" order by XLJGCZBML_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 sJGCZBID = ds.Tables[0].Rows[i]["XLJGCZBML_JGCZBID"].ToString().Trim();
|
|
string sJGCZBMC = ds.Tables[0].Rows[i]["XLJGCZBML_JGCZBMC"].ToString().Trim();
|
|
string sJGCZBBBID = ds.Tables[0].Rows[i]["XLJGCZBML_JGCZBBBID"].ToString().Trim();
|
|
|
|
cbxJGCZB.Items.Add(new ListItem(sJGCZBID + "|" + sJGCZBMC + "|" + sJGCZBBBID, sJGCZBID + "|" + sJGCZBBBID));
|
|
if (sOLDJGCZB.Equals((sJGCZBID) + "|" + sJGCZBBBID))
|
|
{
|
|
flag = 1;
|
|
}
|
|
}
|
|
if (1 == flag)
|
|
{
|
|
cbxJGCZB.SelectedValue = sOLDJGCZB;
|
|
|
|
}
|
|
else
|
|
{
|
|
if (cbxJGCZB.ItemsCount >= 1)
|
|
{
|
|
cbxJGCZB.SelectedIndex = 0;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|