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

174 lines
5.7 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 CLYLZDSQ_MX_ZDRInfo : SingleCardBase
{
CLYLZDSQ_MX_ZDR entity = new CLYLZDSQ_MX_ZDR();
protected void Page_Load(object sender, EventArgs e)
{
this.UMID = 100860064;
this.UMName = "材料用量制定申请";
base.CurMaster = Master;
base.CurEntity = entity;
this.PageHeight = 180;
this.PageWidth = 420;
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();
string sXHList = PageParam.GetRTrimString("XHList");
if (sXHList.Trim().Equals(""))
cbxSZFW.Enabled = false;
}
protected override void SetComboxItems()
{
string sXHList = PageParam.GetRTrimString("XHList");
cbxSZFW.ClearItems();
if (!sXHList.Trim().Equals(""))
cbxSZFW.Items.Add(new ListItem("勾选记录", "N"));
cbxSZFW.Items.Add(new ListItem("整单记录", "Y"));
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
TSQL SQL = new TSQL(dberp);
string sBMIDList = "";
string sGHList = "";
XLXSBJPZXX pzxx = XLBJDUtils.GetXLXSBJPZXX(100860064);
if (!string.IsNullOrEmpty(pzxx.XLXSBJPZ_ZDBMIDS))
sBMIDList = pzxx.XLXSBJPZ_ZDBMIDS;
if (!string.IsNullOrEmpty(pzxx.XLXSBJPZ_ZDRGHS))
sGHList = pzxx.XLXSBJPZ_ZDRGHS;
SQL.Clear();
SQL.Add("select RSRYJBXX_GH as ID, rtrim(isnull(RSRYJBXX_PYBM,' '))||'|'||rtrim(ltrim(isnull(RSRYJBXX_RYMC,' ')))||'|'||rtrim(RSRYJBXX_GH) as CODE ");
SQL.Add(" from RSRYJBXX ");
SQL.Add(" where 1=1 ");
SQL.Add(" and isnull(RSRYJBXX_TYBZ, 'N') <> 'Y'");
SQL.Add(" and isnull(RSRYJBXX_USER, 'N') = 'Y'");
if (!sBMIDList.Equals(""))
{
SQL.Add(" and (" + CMISproDataBase.GetWhereEqual("RSRYJBXX_RZBM", sBMIDList));
SQL.Add(" or isnull(RSRYJBXX_RZBM, ' ')=' ' )");
}
if (!sGHList.Equals(""))
{
SQL.Add(" and " + CMISproDataBase.GetWhereEqual("RSRYJBXX_GH", sGHList));
}
SQL.Add(" order by isnull(RSRYJBXX_PYBM,' '),RSRYJBXX_GH");
DataSet ds = dberp.OpenDataSet(SQL);
cbxZDR.ClearItems();
if (ds.Tables[0].Rows.Count > 0)
{
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
cbxZDR.Items.Add(new ListItem(ds.Tables[0].Rows[i]["CODE"].ToString().Trim(), ds.Tables[0].Rows[i]["ID"].ToString().Trim()));
}
}
base.SetComboxItems();
}
#endregion
#region 自定义函数
private void InitControl()
{
string sXHList = PageParam.GetRTrimString("XHList");
if (sXHList.Trim().Equals(""))
cbxSZFW.SelectedValue = "Y";
else
cbxSZFW.SelectedValue = "N";
}
#endregion
#region 自定义按钮
protected void btnOK_Click(object sender, EventArgs e)
{
if (cbxSZFW.SelectedValue.Trim().Equals(""))
{
ShowMessage("调价范围--不允许为空!");
return;
}
if (cbxZDR.SelectedValue.Trim().Equals(""))
{
ShowMessage("制定人--不允许为空!");
return;
}
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
TSQL SQL = new TSQL(dberp);
try
{
SQL.Add("update XLXSBJYLZDMX set XLXSBJYLZDMX_ZDRGH = :pZDRGH where XLXSBJYLZDMX_SQDH = :pSQDH ");
SQL.ParamByName("pZDRGH").Value = cbxZDR.SelectedValue.Trim();
SQL.ParamByName("pSQDH").Value = PageParam.GetRTrimString("SQDH").Trim();
if (cbxSZFW.SelectedValue.Trim().Equals("N"))
{
string sXHList = PageParam.GetRTrimString("XHList");
if (!sXHList.Trim().Equals(""))
SQL.Add(" and " + CMISproDataBase.GetWhereEqual("XLXSBJYLZDMX_XH", sXHList));
}
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 控件事件
#endregion
}
}