451 lines
30 KiB
C#
451 lines
30 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 System.Text.RegularExpressions;
|
||
using GThinking.N_CONTROL;
|
||
using System.Collections.Generic;
|
||
using GThinking.N_MISPRO.Caching;
|
||
|
||
namespace GThinking.N_XLXSBJ
|
||
{
|
||
public partial class BJFL_ZDXJGSInfo : SingleCardBase
|
||
{
|
||
BJFL_ZDXJGS entity = new BJFL_ZDXJGS();
|
||
string sBJFLID = "";
|
||
#region 页面初始化
|
||
|
||
protected void Page_Load(object sender, EventArgs e)
|
||
{
|
||
this.UMID = 100860023;
|
||
this.UMName = "线缆销售报价分类";
|
||
this.CurMaster = Master;
|
||
this.CurEntity = entity;
|
||
this.Master.EnableAttachBtn = false;
|
||
if (PageParam.ContainsKey("JSJGS"))
|
||
{
|
||
Title = "结算价公式";
|
||
}
|
||
if (PageParam.GetRTrimString("MXBH").Equals("JGE"))
|
||
{
|
||
this.PageWidth = 700;
|
||
this.PageHeight = 600;
|
||
}
|
||
else
|
||
{
|
||
this.PageWidth = 500;
|
||
this.PageHeight = 500;
|
||
}
|
||
|
||
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();
|
||
LinkZDXJ.Visible = false;
|
||
tr1.Visible = false;
|
||
tr2.Visible = false;
|
||
trJJYZ1.Visible = false;
|
||
trJJYZ2.Visible = false;
|
||
sBJFLID = PageParam.GetRTrimString("BJFLID");
|
||
if (PageParam.GetRTrimString("MXBH").Equals("JGE"))
|
||
{
|
||
tr1.Visible = true;
|
||
tr2.Visible = true;
|
||
trJJYZ1.Visible = true;
|
||
trJJYZ2.Visible = true;
|
||
}
|
||
if (PageParam.ContainsKey("JSJGS"))
|
||
{
|
||
LinkZDXJ.Visible = true;
|
||
lblZDXJGS.Text = "结算价公式:";
|
||
}
|
||
|
||
if (!IsPostBack)
|
||
{
|
||
InitControl();
|
||
}
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region 模板事件继承
|
||
|
||
|
||
#endregion
|
||
|
||
#region 成本 基价 表价 报价 最低限价
|
||
protected void LinkCLCB_Click(object sender, EventArgs e)
|
||
{
|
||
txtZDXJGS.Text = txtZDXJGS.Text + "成本";
|
||
}
|
||
|
||
protected void LinkJGBJJ_Click(object sender, EventArgs e)
|
||
{
|
||
txtZDXJGS.Text = txtZDXJGS.Text + "基价";
|
||
}
|
||
|
||
|
||
protected void LinkJGBBJ_Click(object sender, EventArgs e)
|
||
{
|
||
txtZDXJGS.Text = txtZDXJGS.Text + "表价";
|
||
}
|
||
|
||
|
||
protected void LinkCPBJ_Click(object sender, EventArgs e)
|
||
{
|
||
txtZDXJGS.Text = txtZDXJGS.Text + "报价";
|
||
}
|
||
|
||
protected void LinkZDXJ_Click(object sender, EventArgs e)
|
||
{
|
||
txtZDXJGS.Text = txtZDXJGS.Text + "最低限价";
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region 价格表因子
|
||
protected void LinkJJ01_Click(object sender, EventArgs e)
|
||
{
|
||
txtZDXJGS.Text = txtZDXJGS.Text + LinkJJ01.Text.Trim();
|
||
}
|
||
|
||
protected void LinkJJ02_Click(object sender, EventArgs e)
|
||
{
|
||
txtZDXJGS.Text = txtZDXJGS.Text + LinkJJ02.Text.Trim();
|
||
}
|
||
|
||
protected void LinkJJ03_Click(object sender, EventArgs e)
|
||
{
|
||
txtZDXJGS.Text = txtZDXJGS.Text + LinkJJ03.Text.Trim();
|
||
}
|
||
|
||
protected void LinkJJ04_Click(object sender, EventArgs e)
|
||
{
|
||
txtZDXJGS.Text = txtZDXJGS.Text + LinkJJ04.Text.Trim();
|
||
}
|
||
|
||
protected void LinkJJ05_Click(object sender, EventArgs e)
|
||
{
|
||
txtZDXJGS.Text = txtZDXJGS.Text + LinkJJ05.Text.Trim();
|
||
}
|
||
|
||
protected void LinkJJ06_Click(object sender, EventArgs e)
|
||
{
|
||
txtZDXJGS.Text = txtZDXJGS.Text + LinkJJ06.Text.Trim();
|
||
}
|
||
|
||
protected void LinkJJ07_Click(object sender, EventArgs e)
|
||
{
|
||
txtZDXJGS.Text = txtZDXJGS.Text + LinkJJ07.Text.Trim();
|
||
}
|
||
|
||
protected void LinkJJ08_Click(object sender, EventArgs e)
|
||
{
|
||
txtZDXJGS.Text = txtZDXJGS.Text + LinkJJ08.Text.Trim();
|
||
}
|
||
|
||
protected void LinkJJ09_Click(object sender, EventArgs e)
|
||
{
|
||
txtZDXJGS.Text = txtZDXJGS.Text + LinkJJ09.Text.Trim();
|
||
}
|
||
|
||
protected void LinkJJ10_Click(object sender, EventArgs e)
|
||
{
|
||
txtZDXJGS.Text = txtZDXJGS.Text + LinkJJ10.Text.Trim();
|
||
}
|
||
|
||
|
||
#endregion
|
||
|
||
#region 报价单因子
|
||
protected void LinkYZ01_Click(object sender, EventArgs e)
|
||
{
|
||
txtZDXJGS.Text = txtZDXJGS.Text + LinkYZ01.Text.Trim();
|
||
}
|
||
|
||
protected void LinkYZ02_Click(object sender, EventArgs e)
|
||
{
|
||
txtZDXJGS.Text = txtZDXJGS.Text + LinkYZ02.Text.Trim();
|
||
}
|
||
|
||
protected void LinkYZ03_Click(object sender, EventArgs e)
|
||
{
|
||
txtZDXJGS.Text = txtZDXJGS.Text + LinkYZ03.Text.Trim();
|
||
}
|
||
|
||
protected void LinkYZ04_Click(object sender, EventArgs e)
|
||
{
|
||
txtZDXJGS.Text = txtZDXJGS.Text + LinkYZ04.Text.Trim();
|
||
}
|
||
|
||
protected void LinkYZ05_Click(object sender, EventArgs e)
|
||
{
|
||
txtZDXJGS.Text = txtZDXJGS.Text + LinkYZ05.Text.Trim();
|
||
}
|
||
|
||
protected void LinkYZ06_Click(object sender, EventArgs e)
|
||
{
|
||
txtZDXJGS.Text = txtZDXJGS.Text + LinkYZ06.Text.Trim();
|
||
}
|
||
|
||
protected void LinkYZ07_Click(object sender, EventArgs e)
|
||
{
|
||
txtZDXJGS.Text = txtZDXJGS.Text + LinkYZ07.Text.Trim();
|
||
}
|
||
|
||
protected void LinkYZ08_Click(object sender, EventArgs e)
|
||
{
|
||
txtZDXJGS.Text = txtZDXJGS.Text + LinkYZ08.Text.Trim();
|
||
}
|
||
|
||
protected void LinkYZ09_Click(object sender, EventArgs e)
|
||
{
|
||
txtZDXJGS.Text = txtZDXJGS.Text + LinkYZ09.Text.Trim();
|
||
}
|
||
|
||
protected void LinkYZ10_Click(object sender, EventArgs e)
|
||
{
|
||
txtZDXJGS.Text = txtZDXJGS.Text + LinkYZ10.Text.Trim();
|
||
}
|
||
protected void LinkYZ11_Click(object sender, EventArgs e)
|
||
{
|
||
txtZDXJGS.Text = txtZDXJGS.Text + LinkYZ11.Text.Trim();
|
||
}
|
||
|
||
protected void LinkYZ12_Click(object sender, EventArgs e)
|
||
{
|
||
txtZDXJGS.Text = txtZDXJGS.Text + LinkYZ12.Text.Trim();
|
||
}
|
||
|
||
protected void LinkYZ13_Click(object sender, EventArgs e)
|
||
{
|
||
txtZDXJGS.Text = txtZDXJGS.Text + LinkYZ13.Text.Trim();
|
||
}
|
||
|
||
protected void LinkYZ14_Click(object sender, EventArgs e)
|
||
{
|
||
txtZDXJGS.Text = txtZDXJGS.Text + LinkYZ14.Text.Trim();
|
||
}
|
||
|
||
protected void LinkYZ15_Click(object sender, EventArgs e)
|
||
{
|
||
txtZDXJGS.Text = txtZDXJGS.Text + LinkYZ15.Text.Trim();
|
||
}
|
||
|
||
protected void LinkYZ16_Click(object sender, EventArgs e)
|
||
{
|
||
txtZDXJGS.Text = txtZDXJGS.Text + LinkYZ16.Text.Trim();
|
||
}
|
||
|
||
protected void LinkYZ17_Click(object sender, EventArgs e)
|
||
{
|
||
txtZDXJGS.Text = txtZDXJGS.Text + LinkYZ17.Text.Trim();
|
||
}
|
||
|
||
protected void LinkYZ18_Click(object sender, EventArgs e)
|
||
{
|
||
txtZDXJGS.Text = txtZDXJGS.Text + LinkYZ18.Text.Trim();
|
||
}
|
||
|
||
protected void LinkYZ19_Click(object sender, EventArgs e)
|
||
{
|
||
txtZDXJGS.Text = txtZDXJGS.Text + LinkYZ19.Text.Trim();
|
||
}
|
||
|
||
protected void LinkYZ20_Click(object sender, EventArgs e)
|
||
{
|
||
txtZDXJGS.Text = txtZDXJGS.Text + LinkYZ20.Text.Trim();
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region 控件事件
|
||
|
||
protected void btnOK_Click(object sender, EventArgs e)
|
||
{
|
||
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
|
||
TSQL SQL = new TSQL(dberp);
|
||
SQL.Clear();
|
||
sBJFLID = PageParam.GetRTrimString("BJFLID");
|
||
//校验公式
|
||
if (!txtZDXJGS.Text.Trim().Equals(""))
|
||
{
|
||
//校验报价单因子名称
|
||
SQL.Clear();
|
||
SQL.Add("select count(1) from XLXSTZYZ ");
|
||
SQL.Add("where XLXSTZYZ_MXBH ='BJD' ");
|
||
SQL.Add(" group by XLXSTZYZ_YZMC ");
|
||
DataSet dsBJD = dberp.OpenDataSet(SQL);
|
||
if (dsBJD.Tables[0].Rows.Count != 20)
|
||
{
|
||
ShowMessage("报价单因子名称存在重复!");
|
||
return;
|
||
}
|
||
|
||
if (PageParam.GetRTrimString("MXBH").Equals("JGE"))
|
||
{
|
||
//校验价格表因子名称
|
||
SQL.Clear();
|
||
SQL.Add("select count(1) from XLXSTZYZ ");
|
||
SQL.Add("where XLXSTZYZ_MXBH ='JZJ' ");
|
||
SQL.Add(" group by XLXSTZYZ_YZMC ");
|
||
DataSet dsJGB = dberp.OpenDataSet(SQL);
|
||
if (dsJGB.Tables[0].Rows.Count != 10)
|
||
{
|
||
ShowMessage("价格表因子名称存在重复!");
|
||
return;
|
||
}
|
||
}
|
||
|
||
|
||
txtValue.Value = XLXSBJFL.GetZDXJGSBM(txtZDXJGS.Text.Trim());
|
||
string sTmp = txtValue.Value;
|
||
sTmp = XLBJDUtils.SubStringFunc(txtValue.Value, 250);
|
||
if (!sTmp.Equals(txtValue.Value))
|
||
{
|
||
ShowMessage("公式超长!");
|
||
return;
|
||
}
|
||
|
||
gtExpression exp = new gtExpression();
|
||
|
||
sTmp = sTmp.Replace(" ", "").Replace("CLCB", "7.1").Replace("JGBJJ", "9.4").Replace("JGBBJ", "5.2").Replace("CPBJ", "11.2").Replace("×", "*").Replace("ZDXJ","10");
|
||
sTmp = sTmp.Replace("BJ01", "1.2").Replace("BJ02", "1.6").Replace("BJ03", "2.3").Replace("BJ04", "3.1").Replace("BJ05", "3.6");
|
||
sTmp = sTmp.Replace("BJ06", "4.5").Replace("BJ07", "4.6").Replace("BJ08", "5.1").Replace("BJ09", "6.4").Replace("BJ10", "8.1");
|
||
sTmp = sTmp.Replace("BJ11", "1.2").Replace("BJ12", "1.6").Replace("BJ13", "2.3").Replace("BJ14", "3.1").Replace("BJ15", "3.6");
|
||
sTmp = sTmp.Replace("BJ16", "4.5").Replace("BJ17", "4.6").Replace("BJ18", "5.1").Replace("BJ19", "6.4").Replace("BJ20", "8.1");
|
||
if (PageParam.GetRTrimString("MXBH").Equals("JGE"))
|
||
{
|
||
sTmp = sTmp.Replace("JZ01", "1.2").Replace("JZ02", "1.6").Replace("JZ03", "2.3").Replace("JZ04", "3.1").Replace("JZ05", "3.6");
|
||
sTmp = sTmp.Replace("JZ06", "4.5").Replace("JZ07", "4.6").Replace("JZ08", "5.1").Replace("JZ09", "6.4").Replace("JZ10", "8.1");
|
||
}
|
||
|
||
try
|
||
{
|
||
double dZBZ = NumberUtils.RoundX(exp.Evaluate(sTmp), 4);
|
||
//SQL.Clear();
|
||
//SQL.Add("select " + sTmp + " as px1 ");
|
||
//dberp.ExecSQL(SQL);
|
||
}
|
||
catch
|
||
{
|
||
ShowMessage("公式存在语法错误!");
|
||
return;
|
||
}
|
||
|
||
}
|
||
else
|
||
{
|
||
txtValue.Value = "";
|
||
}
|
||
|
||
if (PageParam.ContainsKey("JSJGS"))
|
||
{
|
||
//更新数据
|
||
SQL.Clear();
|
||
SQL.Add(" UPDATE XLXSBJFL SET XLXSBJFL_JSJGS = :pXLXSBJFL_ZDXJGS where XLXSBJFL_BJFLID = :pXLXSBJFL_BJFLID ");
|
||
SQL.ParamByName("pXLXSBJFL_ZDXJGS").Value = txtValue.Value;
|
||
SQL.ParamByName("pXLXSBJFL_BJFLID").Value = sBJFLID;
|
||
dberp.ExecSQL(SQL);
|
||
}
|
||
else
|
||
{
|
||
//更新数据
|
||
SQL.Clear();
|
||
SQL.Add(" UPDATE XLXSBJFL SET XLXSBJFL_ZDXJGS = :pXLXSBJFL_ZDXJGS where XLXSBJFL_BJFLID = :pXLXSBJFL_BJFLID ");
|
||
SQL.ParamByName("pXLXSBJFL_ZDXJGS").Value = txtValue.Value;
|
||
SQL.ParamByName("pXLXSBJFL_BJFLID").Value = sBJFLID;
|
||
dberp.ExecSQL(SQL);
|
||
}
|
||
CacheNotify.TableIsUpdated("DBERP", "XLXSBJFL");
|
||
|
||
//
|
||
DialogOperationScript dos = new DialogOperationScript(this);
|
||
dos.ClickOwnerButton(PageParam.GetRTrimString("btnRefreshCID"));
|
||
dos.CloseSelf();
|
||
dos.Execute();
|
||
}
|
||
|
||
protected void btnQX_Click(object sender, EventArgs e)
|
||
{
|
||
CloseWindow();
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region 私有函数
|
||
private void InitControl()
|
||
{
|
||
if (PageParam.ContainsKey("JSJGS"))
|
||
{
|
||
if (!PageParam.GetRTrimString("JSJGS").Equals(""))
|
||
{
|
||
txtValue.Value = PageParam.GetRTrimString("JSJGS");
|
||
txtZDXJGS.Text = XLXSBJFL.GetZDXJGSMC(PageParam.GetRTrimString("JSJGS"));
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if (!PageParam.GetRTrimString("ZDXJGS").Equals(""))
|
||
{
|
||
txtValue.Value = PageParam.GetRTrimString("ZDXJGS");
|
||
txtZDXJGS.Text = XLXSBJFL.GetZDXJGSMC(PageParam.GetRTrimString("ZDXJGS"));
|
||
}
|
||
}
|
||
|
||
|
||
//加载界面标签
|
||
Dictionary<string, string> dic = XLBJDUtils.GetALLYZIDDic();
|
||
|
||
|
||
foreach (string sYZID in dic.Keys)
|
||
{
|
||
|
||
LinkButton LinkYZID = (LinkButton)Master.ContentFormControl.FindControl("LinkYZ" + sYZID.Replace("BJ", ""));
|
||
if (LinkYZID != null)
|
||
{
|
||
LinkYZID.Text = dic[sYZID];
|
||
}
|
||
}
|
||
if (PageParam.GetRTrimString("MXBH").Equals("JGE"))
|
||
{
|
||
foreach (string sYZID in dic.Keys)
|
||
{
|
||
|
||
LinkButton LinkYZID = (LinkButton)Master.ContentFormControl.FindControl("LinkJJ" + sYZID.Replace("JZ", ""));
|
||
if (LinkYZID != null)
|
||
{
|
||
LinkYZID.Text = dic[sYZID];
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
}
|
||
|
||
public static bool IsNumeric(string value)
|
||
{
|
||
return Regex.IsMatch(value, @"^[+-]?\d*[.]?\d*$");
|
||
}
|
||
#endregion
|
||
}
|
||
}
|