261 lines
9.7 KiB
C#
261 lines
9.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_MISPRO;
|
||
using GThinking.N_MISPRO.Data;
|
||
using GThinking.N_MODEL.Page;
|
||
using GThinking.N_MISPRO.Utility;
|
||
using GThinking.N_PUBLIC;
|
||
using GThinking.N_MODEL.Dialog;
|
||
|
||
namespace GThinking.N_XLXSBJ
|
||
{
|
||
public partial class BJYFJZQJInfo : SingleCardBase
|
||
{
|
||
BJYFJZQJ entity = new BJYFJZQJ();
|
||
protected void Page_Load(object sender, EventArgs e)
|
||
{
|
||
this.UMID = 100860071;
|
||
this.UMName = "线缆销售报价单运费";
|
||
this.CurMaster = Master;
|
||
this.CurEntity = entity;
|
||
this.PageHeight = 400;
|
||
this.PageWidth = 500;
|
||
string sYFJSFS = PageParam.GetRTrimString("YFJSFS");
|
||
if (!IsPostBack)
|
||
{
|
||
if (sYFJSFS.Equals("1"))
|
||
{
|
||
txtYFJSGS.Visible = true;
|
||
txtYFJSGS3.Visible = false;
|
||
//btnSZ3.Visible = false;
|
||
}
|
||
else
|
||
{
|
||
txtYFJSGS.Visible = false;
|
||
txtYFJSGS3.Visible = true;
|
||
//btnSZ3.Visible = true;
|
||
}
|
||
if (GetOption("BJU025").Equals("2"))
|
||
{
|
||
GtLabelWeight.Text = "吨 < 重量 <= ";
|
||
}
|
||
}
|
||
base.InitPage();
|
||
|
||
}
|
||
|
||
#region 模板事件继承
|
||
|
||
protected override void SetControlState()
|
||
{
|
||
base.SetControlState();
|
||
txtYFJSGS.Enabled = false;
|
||
txtYFJSGS3.Enabled = false;
|
||
txtWHR.Enabled = false;
|
||
datWHSJ.Enabled = false;
|
||
|
||
btnSZ.Enabled = ControlState == TControlState.ctsBrowse;
|
||
}
|
||
|
||
protected override void LoadRecord()
|
||
{
|
||
if (!IsPostBack)
|
||
{
|
||
entity.Param.Add("OLD_XLXSBJYFJZQJ_YFJZQH", PageParam.GetRTrimString("XLXSBJYFJZQJ_YFJZQH"));
|
||
}
|
||
else
|
||
{
|
||
entity.Param.Add("OLD_XLXSBJYFJZQJ_YFJZQH", txtOLD_YFJZQH.Value);
|
||
}
|
||
base.LoadRecord();
|
||
txtOLD_YFJZQH.Value = txtYFJZQH.Text.Trim();
|
||
}
|
||
|
||
protected override void OnNewRecorder()
|
||
{
|
||
base.OnNewRecorder();
|
||
txtYFJSGS.Text = "运价*运重";
|
||
txtYFJSGS3.Text = "运距*运率*运重";
|
||
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 (txtYFJZXX.Value < 0)
|
||
{
|
||
ShowMessage("计重区间下限--不允许为负数!");
|
||
return false;
|
||
}
|
||
if (txtYFJZSX.Value < 0)
|
||
{
|
||
ShowMessage("计重区间上限--不允许为负数!");
|
||
return false;
|
||
}
|
||
if (txtYFJZSX.Value != 0)
|
||
{
|
||
if (txtYFJZXX.Value >= txtYFJZSX.Value)
|
||
{
|
||
ShowMessage("计重区间下限必须小于计重区间上限!");
|
||
return false;
|
||
}
|
||
}
|
||
|
||
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
|
||
TSQL sql = new TSQL(dberp);
|
||
if (ControlState == TControlState.ctsInsert || ControlState == TControlState.ctsCopy)
|
||
{
|
||
sql.Clear();
|
||
sql.Add("select XLXSBJYFJZQJ_YFJZXX,XLXSBJYFJZQJ_YFJZSX from XLXSBJYFJZQJ where 1=1 ");
|
||
sql.Add(" and ((XLXSBJYFJZQJ_YFJZXX>=:pYFJZXX ");
|
||
if (txtYFJZSX.Value != 0)
|
||
{
|
||
sql.Add(" and XLXSBJYFJZQJ_YFJZXX<:pYFJZSX ");
|
||
}
|
||
sql.Add(" ) ");
|
||
sql.Add(" or (");
|
||
if (txtYFJZSX.Value != 0)
|
||
{
|
||
sql.Add(" XLXSBJYFJZQJ_YFJZSX>0 and XLXSBJYFJZQJ_YFJZSX>:pYFJZXX and XLXSBJYFJZQJ_YFJZSX<=:pYFJZSX ");
|
||
}
|
||
else
|
||
{
|
||
sql.Add(" (XLXSBJYFJZQJ_YFJZSX>0 and XLXSBJYFJZQJ_YFJZSX>:pYFJZXX) or (XLXSBJYFJZQJ_YFJZSX=0) ");
|
||
}
|
||
sql.Add(" ) ");
|
||
sql.Add(" or (XLXSBJYFJZQJ_YFJZXX<:pYFJZXX and (XLXSBJYFJZQJ_YFJZSX=0 or XLXSBJYFJZQJ_YFJZSX>:pYFJZSX))");
|
||
sql.Add(" ) ");
|
||
sql.ParamByName("pYFJZXX").Value = txtYFJZXX.Value;
|
||
if (txtYFJZSX.Value != 0)
|
||
{
|
||
sql.ParamByName("pYFJZSX").Value = txtYFJZSX.Value;
|
||
}
|
||
DataSet ds = dberp.OpenDataSet(sql);
|
||
if (ds.Tables[0].Rows.Count > 0)
|
||
{
|
||
string sYFJZQJ = "";
|
||
if (CMISproConvert.StrToFloat(ds.Tables[0].Rows[0]["XLXSBJYFJZQJ_YFJZSX"].ToString()) != 0)
|
||
sYFJZQJ = ds.Tables[0].Rows[0]["XLXSBJYFJZQJ_YFJZXX"].ToString().Trim() + "~" + ds.Tables[0].Rows[0]["XLXSBJYFJZQJ_YFJZSX"].ToString().Trim() + "吨";
|
||
else
|
||
sYFJZQJ = ds.Tables[0].Rows[0]["XLXSBJYFJZQJ_YFJZXX"].ToString().Trim() + "~" + "--" + "吨";
|
||
|
||
ShowMessage(string.Format("与已有计重区间【{0}】有交集,不允许保存!", sYFJZQJ));
|
||
return false;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
sql.Clear();
|
||
sql.Add("select XLXSBJYFJZQJ_YFJZXX,XLXSBJYFJZQJ_YFJZSX from XLXSBJYFJZQJ where XLXSBJYFJZQJ_YFJZQH<>:OLDYFJZQH ");
|
||
sql.Add(" and ((XLXSBJYFJZQJ_YFJZXX>=:pYFJZXX ");
|
||
if (txtYFJZSX.Value != 0)
|
||
{
|
||
sql.Add(" and XLXSBJYFJZQJ_YFJZXX<:pYFJZSX ");
|
||
}
|
||
sql.Add(" ) ");
|
||
sql.Add(" or (");
|
||
if (txtYFJZSX.Value != 0)
|
||
{
|
||
sql.Add(" XLXSBJYFJZQJ_YFJZSX>0 and XLXSBJYFJZQJ_YFJZSX>:pYFJZXX and XLXSBJYFJZQJ_YFJZSX<=:pYFJZSX ");
|
||
}
|
||
else
|
||
{
|
||
sql.Add(" (XLXSBJYFJZQJ_YFJZSX>0 and XLXSBJYFJZQJ_YFJZSX>:pYFJZXX) or (XLXSBJYFJZQJ_YFJZSX=0) ");
|
||
}
|
||
sql.Add(" ) ");
|
||
sql.Add(" or (XLXSBJYFJZQJ_YFJZXX<:pYFJZXX and (XLXSBJYFJZQJ_YFJZSX=0 or XLXSBJYFJZQJ_YFJZSX>:pYFJZSX))");
|
||
sql.Add(" ) ");
|
||
sql.ParamByName("OLDYFJZQH").Value = txtOLD_YFJZQH.Value.Trim();
|
||
sql.ParamByName("pYFJZXX").Value = txtYFJZXX.Value;
|
||
if (txtYFJZSX.Value != 0)
|
||
{
|
||
sql.ParamByName("pYFJZSX").Value = txtYFJZSX.Value;
|
||
}
|
||
DataSet ds = dberp.OpenDataSet(sql);
|
||
if (ds.Tables[0].Rows.Count > 0)
|
||
{
|
||
string sYFJZQJ = "";
|
||
if (CMISproConvert.StrToFloat(ds.Tables[0].Rows[0]["XLXSBJYFJZQJ_YFJZSX"].ToString()) != 0)
|
||
sYFJZQJ = ds.Tables[0].Rows[0]["XLXSBJYFJZQJ_YFJZXX"].ToString().Trim() + "~" + ds.Tables[0].Rows[0]["XLXSBJYFJZQJ_YFJZSX"].ToString().Trim() + "吨";
|
||
else
|
||
sYFJZQJ = ds.Tables[0].Rows[0]["XLXSBJYFJZQJ_YFJZXX"].ToString().Trim() + "~" + "--" + "吨";
|
||
|
||
ShowMessage(string.Format("与已有计重区间【{0}】有交集,不允许保存!", sYFJZQJ));
|
||
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_YFJZQH.Value = txtYFJZQH.Text.Trim();
|
||
|
||
return base.Master_AfterSaveAction(sender, e);
|
||
}
|
||
|
||
protected override void AfterSave(TDatabase db, ref bool ActionIsDone)
|
||
{
|
||
base.AfterSave(db, ref ActionIsDone);
|
||
//UpdateXJXSYQY(cbxQY.SelectedValue.Trim(), txtSJXSYBH.Text.Trim());
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region 控件事件
|
||
protected void btnSZ_Click(object sender, EventArgs e)
|
||
{
|
||
TPageParams pageParams = new TPageParams();
|
||
pageParams.UrlPath = "BJYFJZQJ_JSGSInfo.aspx";
|
||
pageParams.AddString("YFJZQH", txtYFJZQH.Text.Trim());
|
||
if (PageParam.GetRTrimString("YFJSFS").Equals("1"))
|
||
pageParams.AddString("YFJSGS", txtYFJSGS.Text.Trim());
|
||
else
|
||
pageParams.AddString("YFJSGS", txtYFJSGS3.Text.Trim());
|
||
pageParams.AddString("YFJSFS", PageParam.GetRTrimString("YFJSFS"));
|
||
pageParams.AddString("btnRefreshCID", btnRefresh.ClientID);
|
||
OpenDialog(pageParams);
|
||
}
|
||
|
||
protected void btnRefresh_Click(object sender, EventArgs e)
|
||
{
|
||
LoadRecord();
|
||
RefreshForm();
|
||
SetControlState();
|
||
FormAreaUpdate();
|
||
MenuAreaUpdate();
|
||
}
|
||
#endregion
|
||
}
|
||
}
|