2026821
This commit is contained in:
@@ -0,0 +1,241 @@
|
||||
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_WORKFLOW;
|
||||
using GThinking.N_PUBLIC;
|
||||
using GThinking.N_MISPRO.Utility;
|
||||
using System.Text.RegularExpressions;
|
||||
using GThinking.N_MISPRO.TableCache;
|
||||
|
||||
namespace GThinking.N_XLJC
|
||||
{
|
||||
public partial class XLJGCZB_XHMLInfo : SingleCardBase
|
||||
{
|
||||
XLJGCZB_XHML entity = new XLJGCZB_XHML();
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
this.UMID = 101421008;
|
||||
this.UMName = "线缆结构尺重表";
|
||||
base.CurMaster = Master;
|
||||
this.CurEntity = entity;
|
||||
this.PageHeight = 400;
|
||||
this.PageWidth = 500;
|
||||
|
||||
if (!IsPostBack)
|
||||
{
|
||||
InitControls();
|
||||
}
|
||||
|
||||
base.InitPage();
|
||||
}
|
||||
|
||||
#region 模板继承事件
|
||||
|
||||
protected override void LoadRecord()
|
||||
{
|
||||
if (!this.IsPostBack)
|
||||
{
|
||||
entity.Param.Add("XLXHJGCZBML_JGCZBID", PageParam.GetRTrimString("XLXHJGCZBML_JGCZBID").Trim());
|
||||
entity.Param.Add("XLXHJGCZBML_JGCZBXH", PageParam.GetRTrimString("XLXHJGCZBML_JGCZBXH").Trim());
|
||||
}
|
||||
else
|
||||
{
|
||||
entity.Param.Add("XLXHJGCZBML_JGCZBID", txtJGCZBID.Value.Trim());
|
||||
entity.Param.Add("XLXHJGCZBML_JGCZBXH", -1*txtJGCZBXH.Value);
|
||||
}
|
||||
|
||||
base.LoadRecord();
|
||||
txtJGCZBXH.Value = Math.Abs(txtJGCZBXH.Value);
|
||||
}
|
||||
|
||||
protected override void OnNewRecorder()
|
||||
{
|
||||
base.OnNewRecorder();
|
||||
|
||||
txtWHR.Text = tSession.UserName;
|
||||
txtWHRID.Value = tSession.UserId;
|
||||
datWHSJ.Text = CMISproConvert.ConvertTime(System.DateTime.Now);
|
||||
|
||||
}
|
||||
|
||||
protected override void OnCopyRecorder()
|
||||
{
|
||||
base.OnCopyRecorder();
|
||||
|
||||
txtWHR.Text = tSession.UserName;
|
||||
txtWHRID.Value = tSession.UserId;
|
||||
datWHSJ.Text = CMISproConvert.ConvertTime(System.DateTime.Now);
|
||||
|
||||
txtJGCZBXH.Value = 0;
|
||||
}
|
||||
|
||||
protected override void SetControlState()
|
||||
{
|
||||
base.SetControlState();
|
||||
txtWHR.Enabled = false;
|
||||
datWHSJ.Enabled = false;
|
||||
txtJGCZBXH.Enabled = false;
|
||||
|
||||
if (ControlState == TControlState.ctsInsert || ControlState == TControlState.ctsCopy || ControlState == TControlState.ctsEdit)
|
||||
{
|
||||
cbxXLXHID.Enabled = txtXLXHBN.Value.Trim().Equals("N");
|
||||
cbxXLBZID.Enabled = txtXLBZBN.Value.Trim().Equals("N");
|
||||
cbxDYDJID.Enabled = txtDYDJBN.Value.Trim().Equals("N");
|
||||
}
|
||||
}
|
||||
|
||||
protected override bool DataLogicValid()
|
||||
{
|
||||
// 1、新增记录与其它线缆结构尺重表重复时应给出提示并不能予以保存。----所有负数不重复
|
||||
string sXLXHID = cbxXLXHID.SelectedValue.Trim();
|
||||
string sDYDJID = cbxDYDJID.SelectedValue.Trim();
|
||||
string sXLBZID = cbxXLBZID.SelectedValue.Trim();
|
||||
string sGYFLBM = PageParam.GetRTrimString("GYFLBM").Equals("") ? " " : PageParam.GetRTrimString("GYFLBM");
|
||||
string sXLBZBH = cbxXLBZBH.SelectedValue.Trim();
|
||||
|
||||
string sJGCZBID = txtJGCZBID.Value.Trim();
|
||||
|
||||
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
|
||||
TSQL SQL = new TSQL(dberp);
|
||||
SQL.Clear();
|
||||
if (ControlState == TControlState.ctsInsert || ControlState == TControlState.ctsCopy)
|
||||
{
|
||||
string sSQL = string.Format("select XLXHJGCZBML_JGCZBID,XLJGCZBML_JGCZBMC from XLXHJGCZBML "
|
||||
+ " left join XLJGCZBML on XLJGCZBML_JGCZBID = XLXHJGCZBML_JGCZBID WHERE XLXHJGCZBML_JGCZBXH < 0 "
|
||||
+ " and XLXHJGCZBML_XLXHID='{0}' and XLXHJGCZBML_DYDJID = '{1}' "
|
||||
+ " and XLXHJGCZBML_XLBZID='{2}' and ISNULL(XLJGCZBML_GYFLBM,' ') = '{3}' "
|
||||
+ " and XLXHJGCZBML_XLBZBH='{4}' ", sXLXHID, sDYDJID, sXLBZID, sGYFLBM, sXLBZBH);
|
||||
SQL.Add(sSQL);
|
||||
DataSet dsXLXHJGCZBML = dberp.OpenDataSet(SQL);
|
||||
if (dsXLXHJGCZBML.Tables[0].Rows.Count > 0)
|
||||
{
|
||||
ShowMessage(string.Format("与结构尺重表【{0}】存在相同的涵盖范围记录,不允许保存! ", dsXLXHJGCZBML.Tables[0].Rows[0][0].ToString().Trim() + "|" + dsXLXHJGCZBML.Tables[0].Rows[0][1].ToString().Trim()));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
string sSQL = string.Format("select XLXHJGCZBML_JGCZBID,XLJGCZBML_JGCZBMC from XLXHJGCZBML "
|
||||
+ " left join XLJGCZBML on XLJGCZBML_JGCZBID = XLXHJGCZBML_JGCZBID WHERE XLXHJGCZBML_JGCZBXH < 0 "
|
||||
+ " and XLXHJGCZBML_XLXHID='{0}' and XLXHJGCZBML_DYDJID = '{1}' "
|
||||
+ " and XLXHJGCZBML_XLBZID='{2}' and ISNULL(XLXHJGCZBML_GYFLBM,' ') = '{3}' "
|
||||
+ " and XLXHJGCZBML_XLBZBH='{4}' and XLXHJGCZBML_JGCZBID <> '{5}' ", sXLXHID, sDYDJID, sXLBZID, sGYFLBM, sXLBZBH, sJGCZBID);
|
||||
SQL.Add(sSQL);
|
||||
DataSet dsXLXHJGCZBML = dberp.OpenDataSet(SQL);
|
||||
if (dsXLXHJGCZBML.Tables[0].Rows.Count > 0)
|
||||
{
|
||||
ShowMessage(string.Format("与结构尺重表【{0}】存在相同的涵盖范围记录,不允许保存! ", dsXLXHJGCZBML.Tables[0].Rows[0][0].ToString().Trim() + "|" + dsXLXHJGCZBML.Tables[0].Rows[0][1].ToString().Trim()));
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
return base.DataLogicValid();
|
||||
}
|
||||
|
||||
protected override bool Master_BeforeDeleteAction(object sender, EventArgs e)
|
||||
{
|
||||
//当前记录已处理过结构工艺,不允许删除!
|
||||
txtJGCZBXH.Value = -1 * txtJGCZBXH.Value;
|
||||
return base.Master_BeforeDeleteAction(sender, e);
|
||||
}
|
||||
|
||||
protected override bool Master_BeforeSaveAction(object sender, EventArgs e)
|
||||
{
|
||||
txtWHR.Text = tSession.UserName;
|
||||
txtWHRID.Value = tSession.UserId;
|
||||
datWHSJ.Text = CMISproConvert.ConvertTime(System.DateTime.Now);
|
||||
|
||||
if (ControlState == TControlState.ctsInsert || ControlState == TControlState.ctsCopy)
|
||||
{
|
||||
double sNewBH = XLJGCZB_XHML.getNewXH(txtJGCZBID.Value.Trim());
|
||||
txtJGCZBXH.Value = sNewBH;
|
||||
}
|
||||
if (ControlState == TControlState.ctsEdit)
|
||||
{
|
||||
txtJGCZBXH.Value = -1 * txtJGCZBXH.Value;
|
||||
}
|
||||
|
||||
return base.Master_BeforeSaveAction(sender, e);
|
||||
}
|
||||
|
||||
protected override bool Master_AfterSaveAction(object sender, EventArgs e)
|
||||
{
|
||||
txtJGCZBXH.Value = Math.Abs(txtJGCZBXH.Value);
|
||||
return base.Master_AfterSaveAction(sender, e);
|
||||
}
|
||||
|
||||
protected override void SetComboxItems()
|
||||
{
|
||||
TComboBox.SetComboBox("DBERP", cbxXLXHID, "select XLXHB_XLXHID as ID,XLXHB_XLXHID as Name from XLXHB where isnull(XLXHB_TYBZ,'N')<>'Y' order by ID ", true);
|
||||
TComboBox.SetComboBox("DBERP", cbxDYDJID, "select XLDYDJB_DYDJID as ID,XLDYDJB_DYDJID as Name from XLDYDJB where isnull(XLDYDJB_TYBZ,'N')<>'Y' order by XLDYDJB_XH ", true);
|
||||
TComboBox.SetComboBox("DBERP", cbxXLBZID, "select XLBZ_XLBZID as ID,XLBZ_XLBZLXMC as Name from XLBZ where 1=1 order by XLBZ_XLBZID ", true);
|
||||
TComboBox.SetComboBox("DBERP", cbxXLBZBH, "select XLZXBZ_XLBZBH as ID, XLZXBZ_XLBZBH as Name from XLZXBZ where 1=1 order by XLZXBZ_XLBZID,XLZXBZ_XLBZBH ", true);
|
||||
|
||||
base.SetComboxItems();
|
||||
}
|
||||
|
||||
protected override bool CanEdit()
|
||||
{
|
||||
// 当前记录已处理过结构工艺,不允许编辑
|
||||
//string sJGCZBID = txtJGCZBID.Value.Trim();
|
||||
//TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
|
||||
//TSQL sSQL = new TSQL(dberp);
|
||||
//sSQL.Add("select top 1 XLXHJGCZBML_JGCZBXH from XLXHJGCZBML where 1=1 and XLXHJGCZBML_JGCZBID=:pJGCZBID where XLXHJGCZBML_JGCZBXH > 0 ");
|
||||
//sSQL.ParamByName("").Value = sJGCZBID;
|
||||
//DataSet ds = dberp.OpenDataSet(sSQL);
|
||||
//if(ds.Tables[0].Rows.Count > 0)
|
||||
//{
|
||||
// ShowMessage("当前记录已处理过结构工艺,不允许编辑!");
|
||||
// return false;
|
||||
//}
|
||||
|
||||
return base.CanEdit();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 自定义事件
|
||||
|
||||
private void InitControls()
|
||||
{
|
||||
if(txtJGCZBID.Value.Trim().Equals(""))
|
||||
{
|
||||
txtJGCZBID.Value = PageParam.GetRTrimString("JGCZBIDFromList").Equals("") ? PageParam.GetRTrimString("XLXHJGCZBML_JGCZBID") : PageParam.GetRTrimString("JGCZBIDFromList");
|
||||
}
|
||||
|
||||
//表内表外
|
||||
if(txtXLXHBN.Value.Trim().Equals(""))
|
||||
{
|
||||
txtXLXHBN.Value = PageParam.GetRTrimString("XLXHBNFromList").Equals("") ? PageParam.GetRTrimString("XLXHBN") : PageParam.GetRTrimString("XLXHBNFromList");
|
||||
}
|
||||
|
||||
if(txtXLBZBN.Value.Trim().Equals(""))
|
||||
{
|
||||
txtXLBZBN.Value = PageParam.GetRTrimString("XLBZBNFromList").Equals("") ? PageParam.GetRTrimString("XLBZBN") : PageParam.GetRTrimString("XLBZBNFromList");
|
||||
}
|
||||
|
||||
if(txtDYDJBN.Value.Trim().Equals(""))
|
||||
{
|
||||
txtDYDJBN.Value = PageParam.GetRTrimString("DYDJBNFromList").Equals("") ? PageParam.GetRTrimString("DYDJBN") : PageParam.GetRTrimString("DYDJBNFromList");
|
||||
}
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 控件事件
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user