Files
2026-08-21 17:03:02 +08:00

234 lines
7.5 KiB
C#

#region 功能说明
/*
* 参数说明:
* 注意事项:
* 更新记录:
*/
#endregion
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.Text;
using GThinking.N_MISPRO;
using GThinking.N_MISPRO.Data;
using GThinking.N_MODEL.Page;
using GThinking.N_MISPRO.Utility;
using GThinking.N_PUBLIC;
using GThinking.N_PUBLIC2;
using GThinking.N_MODEL.Dialog;
namespace GThinking.N_XLXSBJ
{
public partial class CLWLInfo : SingleCardBase
{
CLWL entity = new CLWL();
#region Page类事件继承
protected void Page_Load(object sender, EventArgs e)
{
this.UMID = 100860013;
this.UMName = "线缆销售报价材料物料";
this.CurMaster = Master;
this.CurEntity = entity;
this.PageHeight = 400;
this.PageWidth = 500;
base.InitPage();
}
#endregion
#region 模板事件继承
protected override void SetControlState()
{
base.SetControlState();
txtWLMC.Enabled = false;
txtWLGG.Enabled = false;
txtWLTZ.Enabled = false;
txtWLCL.Enabled = false;
txtJLDW.Enabled = false;
txtWHR.Enabled = false;
datWHSJ.Enabled = false;
}
protected override void LoadRecord()
{
if (!IsPostBack)
{
if (string.IsNullOrEmpty(PageParam.GetRTrimString("XLXSBJCLWL_WLID")))
{
entity.Param.Add("OLD_XLXSBJCLWL_WLID", "");
}
else
{
entity.Param.Add("OLD_XLXSBJCLWL_WLID", PageParam.GetRTrimString("XLXSBJCLWL_WLID"));
}
}
else
{
entity.Param.Add("OLD_XLXSBJCLWL_WLID", txtOLD_WLID.Value);
}
base.LoadRecord();
txtOLD_WLID.Value = txtWLID.Text.Trim();
}
protected override void OnNewRecorder()
{
base.OnNewRecorder();
txtWHR.Text = tSession.UserName;
txtWHRID.Value = tSession.UserId;
datWHSJ.Text = CMISproConvert.ConvertTime(DateTime.Now);
}
protected override void OnCopyRecorder()
{
base.OnCopyRecorder();
txtWHR.Text = tSession.UserName;
txtWHRID.Value = tSession.UserId;
datWHSJ.Text = CMISproConvert.ConvertTime(DateTime.Now);
}
protected override bool DataLogicValid()
{
if (!base.DataLogicValid()) return false;
if (txtWLMC.Text.Trim().Equals(""))
{
ShowMessage("物料不存在或已停用!");
return false;
}
if (cbxBJCL.SelectedItem.Text.Trim().Equals("(尚未使用)"))
{
txtCLMC.Value ="";
TPageParams param = new TPageParams();
param.UrlPath = "CLWL_NEWInfo.aspx";
param.AddString("CLMCClientID", txtCLMC.ClientID);
param.AddString("BJCL", cbxBJCL.SelectedValue.Trim());
OpenDialogClickBtn(param, btnRefreshCLMC.ClientID.ToString());
return false;
}
return true;
}
protected override bool Master_BeforeSaveAction(object sender, EventArgs e)
{
if (!base.Master_BeforeSaveAction(sender, e)) return false;
txtWHR.Text = tSession.UserName;
txtWHRID.Value = tSession.UserId;
datWHSJ.Text = CMISproConvert.ConvertTime(System.DateTime.Now);
return true;
}
protected override bool Master_AfterSaveAction(object sender, EventArgs e)
{
txtOLD_WLID.Value = txtWLID.Text.Trim();
return base.Master_AfterSaveAction(sender, e);
}
protected override void AfterDelete(TDatabase db, ref bool ActionIsDone)
{
base.AfterDelete(db, ref ActionIsDone);
db.ExecSQL(string.Format("delete from XLXSWLHQ where 1=1 and XLXSWLHQ_JGBID=' ' and XLXSWLHQ_WLID='{0}'", txtWLID.Text.Trim()));
}
protected override void SetComboxItems()
{
InitControls();
base.SetComboxItems();
}
#endregion
#region 自定义函数
private void InitControls()
{
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
TSQL SQL = new TSQL(dberp);
cbxBJCL.ClearItems();
SQL.Clear();
SQL.Add(" select XLXSBJCL_BJCLID, ");
SQL.Add(" case");
SQL.Add(" when isnull(XLXSBJCL_BJCLMC,' ')=' ' then rtrim(XLXSBJCL_BJCLID)||'|'||'(尚未使用)' else rtrim(XLXSBJCL_BJCLID)||'|'||rtrim(XLXSBJCL_BJCLMC)||'|'||'Kg' end ");
SQL.Add(" from XLXSBJCL");
if (ControlState == TControlState.ctsBrowse)
{
SQL.Add(" where XLXSBJCL_BJCLID = '" + cbxBJCL.SelectedValue.Trim() + "' ");
}
else
{
SQL.Add(" where isnull(XLXSBJCL_BJCLMC,' ')<>' '");
SQL.Add(" and isnull(XLXSBJCL_TYBZ,'N') <> 'Y' ");
SQL.Add(" and XLXSBJCL_BJHQ = '2' ");
}
SQL.Add(" order by XLXSBJCL_BJCLID");
DataSet ds = dberp.OpenDataSet(SQL);
cbxBJCL.Items.Add(new ListItem("", ""));
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
cbxBJCL.Items.Add(new ListItem((ds.Tables[0].Rows[i][1].ToString().Trim()), (ds.Tables[0].Rows[i][0].ToString().Trim())));
}
cbxBJCL.ShowValue = false;
}
#endregion
#region 控件事件
protected void txtWLID_TextChanged(object sender, EventArgs e)
{
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
TSQL SQL = new TSQL(dberp);
SQL.Add("select WL_MC,WL_GG,WL_TZ,WL_CL,WL_JLDW from WL where WL_WLID = :pWLID and isnull(WL_TYBZ,'N')<>'Y' ");
SQL.ParamByName("pWLID").Value = txtWLID.Text.Trim();
DataSet ds = dberp.OpenDataSet(SQL);
if (ds.Tables[0].Rows.Count > 0)
{
txtWLMC.Text = ds.Tables[0].Rows[0]["WL_MC"].ToString().Trim();
txtWLGG.Text = ds.Tables[0].Rows[0]["WL_GG"].ToString().Trim();
txtWLTZ.Text = ds.Tables[0].Rows[0]["WL_TZ"].ToString().Trim();
txtWLCL.Text = ds.Tables[0].Rows[0]["WL_CL"].ToString().Trim();
txtJLDW.Text = ds.Tables[0].Rows[0]["WL_JLDW"].ToString().Trim();
}
else
{
txtWLMC.Text = "";
txtWLGG.Text = "";
txtWLTZ.Text = "";
txtWLCL.Text = "";
txtJLDW.Text = "";
}
}
protected void btnRefreshCLMC_Click(object sender, EventArgs e)
{
if (!txtCLMC.Value.Trim().Equals(""))
{
InitControls();
FormAreaUpdate();
//重新调用模板保存按钮
DialogOperationScript dos = new DialogOperationScript(this);
dos.AddScript("document.getElementById('ctl00_btnSaveButton').click();");;
dos.Execute();
//Master.OnS;
}
}
#endregion
}
}