196 lines
5.9 KiB
C#
196 lines
5.9 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_MISPRO;
|
|
using GThinking.N_MISPRO.Data;
|
|
using GThinking.N_MODEL.Page;
|
|
using GThinking.N_PUBLIC;
|
|
using GThinking.N_MISPRO.Utility;
|
|
using GThinking.N_CONTROL;
|
|
using System.Text.RegularExpressions;
|
|
|
|
namespace GThinking.N_XLXSBJ
|
|
{
|
|
public partial class XLBJD_WBBJDMX_GGZZTHInfo : SingleCardBase
|
|
{
|
|
XLBJD_WBBJDMX_GGZZTH entity = new XLBJD_WBBJDMX_GGZZTH();
|
|
|
|
private const string THLX_GGZZTH = "GGZZTH";
|
|
|
|
#region 页面初始化
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
this.UMID = 100860043;
|
|
this.UMName = "外部线缆产品导入";
|
|
this.CurMaster = Master;
|
|
this.CurEntity = entity;
|
|
this.Master.EnableAttachBtn = false;
|
|
this.Master.EnablePrintBtn = false;
|
|
this.PageWidth = 500;
|
|
this.PageHeight = 400;
|
|
|
|
base.InitPage();
|
|
|
|
if (!IsPostBack)
|
|
{
|
|
InitControl();
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
#region 模板事件继承
|
|
|
|
protected override void LoadRecord()
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
this.CurEntity.Param.Add("XLXSBJDXTHDZQD_XH", PageParam.GetRTrimString("XLXSBJDXTHDZQD_XH"));
|
|
this.CurEntity.Param.Add("XLXSBJDXTHDZQD_THLX", PageParam.GetRTrimString("XLXSBJDXTHDZQD_THLX"));
|
|
}
|
|
else
|
|
{
|
|
this.CurEntity.Param.Add("XLXSBJDXTHDZQD_XH", txtXH.Value.Trim());
|
|
this.CurEntity.Param.Add("XLXSBJDXTHDZQD_THLX", txtTHLX.Value.Trim());
|
|
}
|
|
|
|
base.LoadRecord();
|
|
}
|
|
|
|
protected override void OnNewRecorder()
|
|
{
|
|
base.OnNewRecorder();
|
|
|
|
txtTHLX.Value = THLX_GGZZTH;
|
|
|
|
txtWHR.Text = tSession.UserName;
|
|
datWHSJ.Value = CMISproConvert.ConvertTime(DateTime.Now);
|
|
txtWHRID.Value = tSession.UserId;
|
|
}
|
|
|
|
protected override void OnCopyRecorder()
|
|
{
|
|
base.OnCopyRecorder();
|
|
|
|
txtTHLX.Value = THLX_GGZZTH;
|
|
|
|
txtWHR.Text = tSession.UserName;
|
|
txtWHRID.Value = tSession.UserId;
|
|
datWHSJ.Value = CMISproConvert.ConvertTime(DateTime.Now);
|
|
}
|
|
|
|
protected override void SetControlState()
|
|
{
|
|
base.SetControlState();
|
|
|
|
txtWHR.Enabled = false;
|
|
datWHSJ.Enabled = false;
|
|
}
|
|
|
|
protected override void SetComboxItems()
|
|
{
|
|
base.SetComboxItems();
|
|
}
|
|
|
|
protected override bool DataLogicValid()
|
|
{
|
|
if (txtTHQGGZF.Text.Trim().Equals(""))
|
|
{
|
|
ShowMessage("替换前规格不允许为空!");
|
|
return false;
|
|
}
|
|
if (txtTHHGGZF.Text.Trim().Equals(""))
|
|
{
|
|
ShowMessage("替换后规格不允许为空!");
|
|
return false;
|
|
}
|
|
|
|
try
|
|
{
|
|
new Regex(txtTHQGGZF.Text.Trim());
|
|
new Regex(txtTHHGGZF.Text.Trim());
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
ShowMessage("替换前/后规格不是合法的正则表达式! " + ex.Message);
|
|
return false;
|
|
}
|
|
|
|
string sQGG = txtTHQGGZF.Text.Trim().Replace("'", "''");
|
|
if ((ControlState == TControlState.ctsInsert) || (ControlState == TControlState.ctsCopy))
|
|
{
|
|
string sSQL = string.Format(
|
|
"select 1 from XLXSBJDXTHDZQD where XLXSBJDXTHDZQD_THLX = '{0}' and XLXSBJDXTHDZQD_THQGGZF = '{1}' ",
|
|
THLX_GGZZTH, sQGG);
|
|
if (CMISproDataBase.ExistsRecord("DBERP", sSQL))
|
|
{
|
|
ShowMessage("已存在相同替换前规格的规则,不允许重复!");
|
|
return false;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
string sSQL = string.Format(
|
|
"select 1 from XLXSBJDXTHDZQD where XLXSBJDXTHDZQD_THLX = '{0}' and XLXSBJDXTHDZQD_THQGGZF = '{1}' "
|
|
+ " and not (XLXSBJDXTHDZQD_XH = {2} and XLXSBJDXTHDZQD_THLX = '{0}')",
|
|
THLX_GGZZTH, sQGG, txtXH.Value.Trim());
|
|
if (CMISproDataBase.ExistsRecord("DBERP", sSQL))
|
|
{
|
|
ShowMessage("已存在相同替换前规格的规则,不允许重复!");
|
|
return false;
|
|
}
|
|
}
|
|
|
|
return base.DataLogicValid();
|
|
}
|
|
|
|
protected override bool Master_BeforeSaveAction(object sender, EventArgs e)
|
|
{
|
|
if ((ControlState == TControlState.ctsInsert) || (ControlState == TControlState.ctsCopy))
|
|
{
|
|
int iXH = CMISproDataBase.GetMaxXH("DBERP", "XLXSBJDXTHDZQD", "XLXSBJDXTHDZQD_XH",
|
|
"XLXSBJDXTHDZQD_THLX ='GGZZTH'") + 1;
|
|
txtXH.Value = iXH.ToString();
|
|
}
|
|
txtTHLX.Value = THLX_GGZZTH;
|
|
|
|
txtWHR.Text = tSession.UserName;
|
|
txtWHRID.Value = tSession.UserId;
|
|
datWHSJ.Text = CMISproConvert.ConvertTime(System.DateTime.Now);
|
|
|
|
return base.Master_BeforeSaveAction(sender, e);
|
|
}
|
|
|
|
protected override void BeforeSave(TDatabase db, ref bool ActionIsDone)
|
|
{
|
|
base.BeforeSave(db, ref ActionIsDone);
|
|
}
|
|
|
|
protected override void AfterSave(TDatabase db, ref bool ActionIsDone)
|
|
{
|
|
base.AfterSave(db, ref ActionIsDone);
|
|
}
|
|
|
|
protected override bool Master_AfterSaveAction(object sender, EventArgs e)
|
|
{
|
|
return base.Master_AfterSaveAction(sender, e);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 私有函数
|
|
private void InitControl()
|
|
{
|
|
|
|
}
|
|
#endregion
|
|
|
|
}
|
|
}
|