2026821
This commit is contained in:
@@ -0,0 +1,668 @@
|
||||
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.Data;
|
||||
using GThinking.N_MODEL.Page;
|
||||
using GThinking.N_MISPRO;
|
||||
using GThinking.N_CONTROL;
|
||||
using GThinking.N_MISPRO.Utility;
|
||||
using System.Collections.Generic;
|
||||
using GThinking.N_MISPRO.Caching;
|
||||
|
||||
namespace GThinking.N_XLXSBJ
|
||||
{
|
||||
public partial class BJFL_TJYZList : SingleGridBase
|
||||
{
|
||||
BJFL_TJYZ entity = new BJFL_TJYZ();
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
this.UMID = 100860023;
|
||||
this.UMName = "线缆销售报价分类";
|
||||
this.CurMaster = Master;
|
||||
this.ModuleGV = ContentGrid;
|
||||
this.CurEntity = entity;
|
||||
this.PageHeight = 600;
|
||||
this.PageWidth = 750;
|
||||
base.DataKeyNames = new string[] { "YZID" };
|
||||
Master.EnableNewBtn = false;
|
||||
Master.EnableCopyBtn = false;
|
||||
Master.EnableViewBtn = false;
|
||||
Master.EnableEditBtn = false;
|
||||
Master.EnableDeleteBtn = false;
|
||||
Master.EnableQueryBtn = false;
|
||||
|
||||
base.InitPage();
|
||||
if (!IsPostBack)
|
||||
{
|
||||
InitTZQCPBJGS();
|
||||
Master_OnStandardQuery(null, null);
|
||||
}
|
||||
}
|
||||
|
||||
#region 模板继承事件
|
||||
|
||||
protected override void Master_OnStandardQuery(object sender, EventArgs e)
|
||||
{
|
||||
base.Master_OnStandardQuery(sender, e);
|
||||
entity.EntityTable.QuerySelSql = GetQuerySql();
|
||||
entity.GridDataBind(ContentGrid, tSession);
|
||||
}
|
||||
|
||||
protected override void moduleGV_PageIndexChanging(object sender, GridViewPageEventArgs e)
|
||||
{
|
||||
entity.EntityTable.QuerySelSql = GetQuerySql();
|
||||
ContentGrid.SelectedIndex = -1;
|
||||
base.moduleGV_PageIndexChanging(sender, e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 自定义方法
|
||||
|
||||
private string GetQuerySql()
|
||||
{
|
||||
string sAddSql=string.Empty;
|
||||
if (IsXSTZZDXJ(PageParam.GetRTrimString("BJFLID")))
|
||||
{
|
||||
if (IsTZZDXJContained(PageParam.GetRTrimString("BJFLID")))
|
||||
sAddSql = "union all select 'TZZDXJ','调整最低限价','Y','系统自动生成','SUPERVISOR','超级用户',GETDATE(),9999";
|
||||
else
|
||||
sAddSql = "union all select 'TZZDXJ','调整最低限价','N','系统自动生成','SUPERVISOR','超级用户',GETDATE(),9999";
|
||||
}
|
||||
string sSQL = " select XLXSTZYZ_YZID as YZID,XLXSTZYZ_YZMC as YZMC,"
|
||||
+ " case when XLXSBJFLYZ_YZID is null then 'N' else 'Y' end as SY,"
|
||||
+ " case when XLXSBJFLYZ_YZID is null then XLXSTZYZ_BZ else XLXSBJFLYZ_BZ end as BZ,"
|
||||
+ " case when XLXSBJFLYZ_YZID is null then XLXSTZYZ_WHRID else XLXSBJFLYZ_WHRID end as WHRID,"
|
||||
+ " case when XLXSBJFLYZ_YZID is null then XLXSTZYZ_WHR else XLXSBJFLYZ_WHR end as WHR,"
|
||||
+ " case when XLXSBJFLYZ_YZID is null then XLXSTZYZ_WHSJ else XLXSBJFLYZ_WHSJ end as WHSJ,"
|
||||
+ " XLXSTZYZ_XSXH"
|
||||
+ " from XLXSTZYZ left join XLXSBJFLYZ on XLXSBJFLYZ_BJFLID=:pBJFLID and XLXSBJFLYZ_YZID=XLXSTZYZ_YZID"
|
||||
+ " where XLXSTZYZ_MXBH='BJD' "
|
||||
+ sAddSql
|
||||
+ " order by XLXSTZYZ_XSXH,XLXSTZYZ_YZID";
|
||||
entity.Param.Add("pBJFLID", PageParam.GetRTrimString("BJFLID"));
|
||||
|
||||
return sSQL;
|
||||
}
|
||||
|
||||
//允许加入因子,返回true 因子顺序不符合规格,返回false
|
||||
private bool CanYZIDSave(TDatabase dberp, TSQL sql, string sBJFLID, string sYZID)
|
||||
{
|
||||
if (IsQYGS(sBJFLID))
|
||||
return true;
|
||||
Dictionary<string, string> dicXLXSTZYZ = new Dictionary<string, string>();
|
||||
dicXLXSTZYZ.Clear();
|
||||
DataSet ds = new DataSet();
|
||||
|
||||
sql.Clear();
|
||||
sql.Add(" select XLXSBJFLYZ_YZID,XLXSTZYZ_JJFS from XLXSBJFLYZ ");
|
||||
sql.Add(" left join XLXSTZYZ on XLXSTZYZ_YZID = XLXSBJFLYZ_YZID ");
|
||||
sql.Add(" where XLXSBJFLYZ_BJFLID =:pBJFLID ");
|
||||
if (!sYZID.Equals(""))
|
||||
{
|
||||
sql.Add(" and XLXSBJFLYZ_YZID <> :pYZID ");
|
||||
sql.ParamByName("pYZID").Value = sYZID;
|
||||
}
|
||||
sql.Add(" and isnull(XLXSTZYZ_BCYTJ,'N') <> 'Y' ");
|
||||
sql.Add(" order by XLXSTZYZ_XSXH ");
|
||||
sql.ParamByName("pBJFLID").Value = sBJFLID;
|
||||
ds = dberp.OpenDataSet(sql);
|
||||
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
|
||||
{
|
||||
dicXLXSTZYZ.Add(ds.Tables[0].Rows[i]["XLXSBJFLYZ_YZID"].ToString().Trim(), ds.Tables[0].Rows[i]["XLXSTZYZ_JJFS"].ToString().Trim());
|
||||
}
|
||||
List<string> lst = new List<string>();
|
||||
lst.Clear();
|
||||
//如果是扣点/加点,则加入 1 如果是加价则加入 0,最终形成:空或者01或者10或者1或者0,不能形成101形式或者010形式或者1010等大于2个数据的形式
|
||||
foreach (KeyValuePair<string, string> kvp in dicXLXSTZYZ)
|
||||
{
|
||||
if (kvp.Value.Equals("JJ"))
|
||||
{
|
||||
if (lst.Count == 0)
|
||||
{
|
||||
lst.Add("0");
|
||||
}
|
||||
else if (lst[lst.Count - 1] == "1")
|
||||
{
|
||||
lst.Add("0");
|
||||
}
|
||||
else if (lst[lst.Count - 1] == "0")
|
||||
{
|
||||
//不处理
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//此处包含加点扣点乘以除以
|
||||
if (lst.Count == 0)
|
||||
{
|
||||
lst.Add("1");
|
||||
}
|
||||
else if (lst[lst.Count - 1] == "1")
|
||||
{
|
||||
//不处理
|
||||
}
|
||||
else if (lst[lst.Count - 1] == "0")
|
||||
{
|
||||
lst.Add("1");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (lst.Count >= 3)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//获取当前报价分类所使用的因子ID、计算顺序、调价类型、调价因子ID、调因子值因子ID、加价方式
|
||||
public static List<BJFLYZXX> GetBJFLYZXX(string sBJFLID, out Dictionary<string, string> YZJJFS)
|
||||
{
|
||||
YZJJFS = new Dictionary<string, string>();
|
||||
List<BJFLYZXX> BJFLYZXX_List = new List<BJFLYZXX>();
|
||||
List<XLXSBJFLYZXX> bjflYZ = XLBJDUtils.GetBJFLYZXXByBJFLID(sBJFLID);
|
||||
if (bjflYZ.Count > 0)
|
||||
{
|
||||
foreach(XLXSBJFLYZXX sYZ in bjflYZ)
|
||||
{
|
||||
TZYZXX yzxx=XLBJDUtils.GetYZXXByYZID(sYZ.XLXSBJFLYZ_YZID);
|
||||
BJFLYZXX bjFLYZXX = new BJFLYZXX();
|
||||
bjFLYZXX.YZID = yzxx.XLXSTZYZ_YZID;
|
||||
bjFLYZXX.JSXH = CMISproConvert.StrToFloat(yzxx.XLXSTZYZ_XSXH);
|
||||
bjFLYZXX.TJLX = yzxx.XLXSTZYZ_TJLX;
|
||||
bjFLYZXX.TJYZID = yzxx.XLXSTZYZ_TJYZID;
|
||||
bjFLYZXX.TYZZYZID = yzxx.XLXSTZYZ_TYZZYZID;
|
||||
bjFLYZXX.JJFS = yzxx.XLXSTZYZ_JJFS;
|
||||
bjFLYZXX.YZZGS = yzxx.XLXSTZYZ_YZID;
|
||||
BJFLYZXX_List.Add(bjFLYZXX);
|
||||
YZJJFS[bjFLYZXX.YZID] = bjFLYZXX.JJFS;
|
||||
}
|
||||
|
||||
}
|
||||
if (IsTZZDXJContained(sBJFLID))
|
||||
{
|
||||
string sTZQCPBJGS = string.Empty;
|
||||
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
|
||||
TSQL SQL = new TSQL(dberp);
|
||||
SQL.Clear();
|
||||
SQL.Add("select XLXSBJFL_TZQCPBJGS from XLXSBJFL where XLXSBJFL_BJFLID=:pBJFLID");
|
||||
SQL.ParamByName("pBJFLID").Value = sBJFLID;
|
||||
DataSet ds = dberp.OpenDataSet(SQL);
|
||||
if (ds.Tables[0].Rows.Count > 0)
|
||||
{
|
||||
double iTZZDXJXH = 0;
|
||||
string sYZID = "TZZDXJ";
|
||||
sTZQCPBJGS = ds.Tables[0].Rows[0][0].ToString().Trim();
|
||||
// 查找 TZZDXJ 的索引
|
||||
int tzzdxjIndex = sTZQCPBJGS.IndexOf("TZZDXJ");
|
||||
int bjIndex = sTZQCPBJGS.Substring(0, tzzdxjIndex).LastIndexOf("BJ");
|
||||
while (bjIndex != -1)
|
||||
{
|
||||
string sBJYZID = sTZQCPBJGS.Substring(bjIndex, 4);
|
||||
if (XLBJDUtils.GetYZXXByYZID(sBJYZID).XLXSTZYZ_TJLX == "1" && XLBJDUtils.GetYZXXByYZID(sBJYZID).XLXSTZYZ_TJYZID.Equals(sBJYZID))
|
||||
{
|
||||
iTZZDXJXH = CMISproConvert.StrToFloat(XLBJDUtils.GetYZXXByYZID(sBJYZID).XLXSTZYZ_XSXH, 0) + 0.5;
|
||||
break;
|
||||
}
|
||||
else
|
||||
bjIndex = sTZQCPBJGS.Substring(0, bjIndex).LastIndexOf("BJ");
|
||||
}
|
||||
|
||||
BJFLYZXX bjFLYZXX = new BJFLYZXX();
|
||||
bjFLYZXX.YZID = sYZID;
|
||||
bjFLYZXX.JSXH = iTZZDXJXH;
|
||||
bjFLYZXX.TJLX = "1";
|
||||
bjFLYZXX.TJYZID = sYZID;
|
||||
bjFLYZXX.TYZZYZID = "";
|
||||
bjFLYZXX.JJFS = "JD";
|
||||
bjFLYZXX.YZZGS = sYZID;
|
||||
BJFLYZXX_List.Add(bjFLYZXX);
|
||||
YZJJFS[bjFLYZXX.YZID] = bjFLYZXX.JJFS;
|
||||
|
||||
}
|
||||
}
|
||||
BJFLYZXX_List.Sort(new BJFLYZXXComparer());
|
||||
return BJFLYZXX_List;
|
||||
|
||||
}
|
||||
|
||||
public static string GetJSGS(string sBJFLID)
|
||||
{
|
||||
Dictionary<string, string> YZJJFS = new Dictionary<string, string>();
|
||||
List<BJFLYZXX> BJFLYZXX_List = GetBJFLYZXX(sBJFLID, out YZJJFS);
|
||||
string formula = "JGBBJ";
|
||||
//先调因子值
|
||||
foreach (BJFLYZXX item in BJFLYZXX_List)
|
||||
{
|
||||
if ((!string.IsNullOrEmpty(item.TYZZYZID) )&& item.TJLX == "1" && YZJJFS.ContainsKey(item.TYZZYZID))
|
||||
{
|
||||
item.YZZGS = GetJSGSbyJJFS(item.YZZGS, item.TYZZYZID, YZJJFS[item.TYZZYZID]);
|
||||
}
|
||||
}
|
||||
//再按分组相加
|
||||
Dictionary<string, BJFLYZXX> groupedSums = new Dictionary<string, BJFLYZXX>();
|
||||
foreach (BJFLYZXX item in BJFLYZXX_List)
|
||||
{
|
||||
if (item.TJLX == "1")
|
||||
{
|
||||
if (groupedSums.ContainsKey(item.TJYZID))
|
||||
{
|
||||
groupedSums[item.TJYZID].YZZGS = "(" + groupedSums[item.TJYZID].YZZGS + "+" + item.YZZGS + ")";
|
||||
}
|
||||
else
|
||||
{
|
||||
groupedSums[item.TJYZID] = item;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
//生成计算公式
|
||||
foreach (BJFLYZXX item in groupedSums.Values)
|
||||
{
|
||||
formula = GetJSGSbyJJFS(formula, item);
|
||||
}
|
||||
|
||||
return formula;
|
||||
}
|
||||
|
||||
public static string GetJSGSbyJJFS(string sformula, string sYZZGS, string sJJFS)
|
||||
{
|
||||
switch (sJJFS)
|
||||
{
|
||||
|
||||
case "JD": return sformula + "*(1+" + sYZZGS + "/100)";
|
||||
|
||||
case "KD": return sformula + "/(1-" + sYZZGS + "/100)";
|
||||
|
||||
case "DD": return sformula + "/(1+" + sYZZGS + "/100)";
|
||||
|
||||
case "MD": return sformula + "*(1-" + sYZZGS + "/100)";
|
||||
|
||||
case "JJ": return "(" + sformula + "+" + sYZZGS + ")";
|
||||
|
||||
case "MX": return sformula + "*" + sYZZGS;
|
||||
|
||||
case "DX": return sformula + "/(" + sYZZGS + ")";
|
||||
|
||||
default: return sformula;
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetJSGSbyJJFS(string sformula, BJFLYZXX bJFLYZXX)
|
||||
{
|
||||
|
||||
return GetJSGSbyJJFS(sformula, bJFLYZXX.YZZGS, bJFLYZXX.JJFS);
|
||||
}
|
||||
|
||||
private bool IsQYGS(string sBJFLID)
|
||||
{
|
||||
if (CMISproDataBase.ExistsRecord("DBERP", string.Format("select 1 from XLXSBJFL where XLXSBJFL_BJFLID='{0}' and isnull(XLXSBJFL_TZQCPBJGS,' ') <> ' ' ", sBJFLID)))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
//存在上点除、下点乘的加价方式
|
||||
private bool HasSXJJFS(string sBJFLID)
|
||||
{
|
||||
List<XLXSBJFLYZXX> bjflYZ = XLBJDUtils.GetBJFLYZXXByBJFLID(sBJFLID);
|
||||
if (bjflYZ.Count > 0)
|
||||
{
|
||||
foreach (XLXSBJFLYZXX sYZ in bjflYZ)
|
||||
{
|
||||
TZYZXX yzxx = XLBJDUtils.GetYZXXByYZID(sYZ.XLXSBJFLYZ_YZID);
|
||||
if (yzxx.XLXSTZYZ_JJFS.Equals("SX"))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool HasTYZZYZChecked(string sBJFLID, string sYZID)
|
||||
{
|
||||
TZYZXX yzxx = XLBJDUtils.GetYZXXByYZID(sYZID);
|
||||
List<XLXSBJFLYZXX> bjflYZ = XLBJDUtils.GetBJFLYZXXByBJFLID(sBJFLID);
|
||||
if (bjflYZ.Count > 0)
|
||||
{
|
||||
foreach (XLXSBJFLYZXX sYZ in bjflYZ)
|
||||
{
|
||||
if (yzxx.XLXSTZYZ_TYZZYZID.Equals(sYZ.XLXSBJFLYZ_YZID))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool TYZZYZIsUsed(string sBJFLID, string sYZID)
|
||||
{
|
||||
TZYZXX yzxx =XLBJDUtils.GetYZXXByYZID(sYZID);
|
||||
if (yzxx.XLXSTZYZ_MXBH=="BJD"&&yzxx.XLXSTZYZ_TJLX=="1")
|
||||
return true;
|
||||
|
||||
List<XLXSBJFLYZXX> bjflYZ = XLBJDUtils.GetBJFLYZXXByBJFLID(sBJFLID);
|
||||
if (bjflYZ.Count > 0)
|
||||
{
|
||||
foreach (XLXSBJFLYZXX sYZ in bjflYZ)
|
||||
{
|
||||
yzxx=XLBJDUtils.GetYZXXByYZID(sYZ.XLXSBJFLYZ_YZID);
|
||||
if (yzxx.XLXSTZYZ_TYZZYZID.Equals(sYZID))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool IsXSTZZDXJ(string sBJFLID)
|
||||
{
|
||||
if (CMISproDataBase.ExistsRecord("DBERP", string.Format("select 1 from XLXSBJFL where XLXSBJFL_BJFLID='{0}' and XLXSBJFL_XSTZZDXJ ='Y' and isnull(XLXSBJFL_TZQCPBJGS,' ') <> ' ' ", sBJFLID)))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool IsTZZDXJContained(string sBJFLID)
|
||||
{
|
||||
if (CMISproDataBase.ExistsRecord("DBERP", string.Format("select 1 from XLXSBJFL where XLXSBJFL_TZQCPBJGS like '%TZZDXJ%' and XLXSBJFL_BJFLID='{0}'", sBJFLID)))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
private void InitTZQCPBJGS()
|
||||
{
|
||||
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
|
||||
TSQL SQL = new TSQL(dberp);
|
||||
SQL.Clear();
|
||||
SQL.Add("select isnull(XLXSBJFL_TZQCPBJGS,' ') as TZQCPBJGS from XLXSBJFL where XLXSBJFL_BJFLID=:pBJFLID ");
|
||||
SQL.ParamByName("pBJFLID").Value = PageParam.GetRTrimString("BJFLID");
|
||||
DataSet ds = dberp.OpenDataSet(SQL);
|
||||
if (ds.Tables[0].Rows.Count > 0)
|
||||
txtTZQCPBJGS.Text = ds.Tables[0].Rows[0]["TZQCPBJGS"].ToString();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 控件事件
|
||||
|
||||
protected void ContentGrid_RowDoubleClick(object sender, GThinking.N_CONTROL.RowDoubleClickEventArgs e)
|
||||
{
|
||||
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
|
||||
TSQL sql = new TSQL(dberp);
|
||||
string sBJFLID = PageParam.GetRTrimString("BJFLID");
|
||||
string sYZID = ContentGrid.DataKeys[ContentGrid.SelectedIndex]["YZID"].ToString().Trim();
|
||||
|
||||
if (sYZID.Equals("TZZDXJ"))
|
||||
{
|
||||
//如果已经有公式里已经含有TZZDXJ,说明是取消勾选,先清空再生成。
|
||||
if (IsTZZDXJContained(sBJFLID))
|
||||
{
|
||||
sql.Clear();
|
||||
sql.Add("update XLXSBJFL set XLXSBJFL_TZQCPBJGS=' ' where XLXSBJFL_BJFLID=:pBJFLID");
|
||||
sql.ParamByName("pBJFLID").Value = sBJFLID;
|
||||
dberp.ExecSQL(sql);
|
||||
btnQYGS_Click(null, null);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
string sTZQCPBJGS = "(" + txtTZQCPBJGS.Text.Trim() + ")*(1+TZZDXJ/100)";
|
||||
sql.Clear();
|
||||
sql.Add("update XLXSBJFL set XLXSBJFL_TZQCPBJGS=:pTZQCPBJGS where XLXSBJFL_BJFLID=:pBJFLID");
|
||||
sql.ParamByName("pTZQCPBJGS").Value = sTZQCPBJGS;
|
||||
sql.ParamByName("pBJFLID").Value = sBJFLID;
|
||||
dberp.ExecSQL(sql);
|
||||
txtTZQCPBJGS.Text = sTZQCPBJGS;
|
||||
moduleGV_PageIndexChanging(null, null);
|
||||
FormAreaUpdate();
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (CMISproDataBase.ExistsRecord("DBERP", string.Format("select 1 from XLXSBJFLYZ where XLXSBJFLYZ_BJFLID='{0}' and XLXSBJFLYZ_YZID='{1}'",
|
||||
sBJFLID, sYZID)))
|
||||
{
|
||||
if (HasTYZZYZChecked(sBJFLID, sYZID))
|
||||
{
|
||||
ShowMessage("请先取消勾选当前因子的调因子值方式指定的因子!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (CMISproDataBase.ExistsRecord("DBERP", string.Format("select 1 from XLXSBJFL where XLXSBJFL_BJFLID='{0}' and XLXSBJFL_JMBGSYZID='{1}'",
|
||||
sBJFLID, sYZID)))
|
||||
{
|
||||
ShowMessage("当前选择因子已被指定为“截面比公式适用因子”,不允许取消勾选!");
|
||||
return;
|
||||
}
|
||||
if (!CanYZIDSave(dberp, sql, sBJFLID, sYZID))
|
||||
{
|
||||
ShowMessage("当前选择因子不满足“加价因子必须全部在加点/扣点因子之前或者之后”规则,不允许去除!请至“100860005|线缆销售报价单因子”模块调整因子顺序或者重新选择因子!");
|
||||
return;
|
||||
}
|
||||
dberp.ExecSQL(string.Format("delete from XLXSBJFLYZ where XLXSBJFLYZ_BJFLID='{0}' and XLXSBJFLYZ_YZID='{1}'", sBJFLID, sYZID));
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!TYZZYZIsUsed(sBJFLID, sYZID))
|
||||
{
|
||||
ShowMessage("当前报价分类未选择调因子值方式为当前选择因子的调价格因子,不允许勾选!");
|
||||
return;
|
||||
}
|
||||
if (IsQYGS(sBJFLID) && CMISproDataBase.ExistsRecord("DBERP", string.Format("select 1 from XLXSTZYZ where XLXSTZYZ_MXBH='BJD' and XLXSTZYZ_YZID='{0}' and XLXSTZYZ_JJFS = 'SX' ", sYZID)))
|
||||
{
|
||||
ShowMessage("当前报价分类已启用公式,不允许选择调价方式为“上点除、下点乘”的因子!");
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
dberp.BeginTrans();
|
||||
sql.Clear();
|
||||
sql.Add("insert into XLXSBJFLYZ(XLXSBJFLYZ_BJFLID,XLXSBJFLYZ_YZID,XLXSBJFLYZ_BZ,XLXSBJFLYZ_WHR,XLXSBJFLYZ_WHRID,XLXSBJFLYZ_WHSJ)");
|
||||
sql.Add(" values(:XLXSBJFLYZ_BJFLID,:XLXSBJFLYZ_YZID,:XLXSBJFLYZ_BZ,:XLXSBJFLYZ_WHR,:XLXSBJFLYZ_WHRID,:XLXSBJFLYZ_WHSJ)");
|
||||
sql.ParamByName("XLXSBJFLYZ_BJFLID").Value = sBJFLID;
|
||||
sql.ParamByName("XLXSBJFLYZ_YZID").Value = sYZID;
|
||||
sql.ParamByName("XLXSBJFLYZ_BZ").Value = "";
|
||||
sql.ParamByName("XLXSBJFLYZ_WHR").Value = tSession.UserName;
|
||||
sql.ParamByName("XLXSBJFLYZ_WHRID").Value = tSession.UserId;
|
||||
sql.ParamByName("XLXSBJFLYZ_WHSJ").Value = DateTime.Now;
|
||||
dberp.ExecSQL(sql);
|
||||
|
||||
if (!CanYZIDSave(dberp, sql, sBJFLID, ""))
|
||||
{
|
||||
throw new Exception();
|
||||
}
|
||||
dberp.CommitTrans();
|
||||
}
|
||||
catch
|
||||
{
|
||||
ShowMessage("当前选择因子不满足“加价因子必须全部在加点/扣点因子之前或者之后”规则,不允许添加!请至“100860005|线缆销售报价单因子”模块调整因子顺序或者重新选择因子!");
|
||||
dberp.RollbackTrans();
|
||||
}
|
||||
}
|
||||
CacheNotify.TableIsUpdated("DBERP", "XLXSBJFLYZ");
|
||||
if (IsQYGS(sBJFLID))
|
||||
{
|
||||
btnQYGS_Click(null, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
moduleGV_PageIndexChanging(null, null);
|
||||
FormAreaUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
protected void btnQYGS_Click(object sender, EventArgs e)
|
||||
{
|
||||
string sBJFLID = PageParam.GetRTrimString("BJFLID");
|
||||
if (HasSXJJFS(sBJFLID))
|
||||
{
|
||||
ShowMessage("当前报价分类使用的调价因子存在“上点除,下点乘”调价方式,不允许启用公式!");
|
||||
return;
|
||||
}
|
||||
string sTZQCPBJGS = GetJSGS(sBJFLID);
|
||||
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
|
||||
TSQL SQL = new TSQL(dberp);
|
||||
SQL.Clear();
|
||||
SQL.Add("update XLXSBJFL set XLXSBJFL_TZQCPBJGS=:pTZQCPBJGS where XLXSBJFL_BJFLID=:pBJFLID");
|
||||
SQL.ParamByName("pTZQCPBJGS").Value = sTZQCPBJGS;
|
||||
SQL.ParamByName("pBJFLID").Value = sBJFLID;
|
||||
dberp.ExecSQL(SQL);
|
||||
txtTZQCPBJGS.Text = sTZQCPBJGS;
|
||||
moduleGV_PageIndexChanging(null, null);
|
||||
FormAreaUpdate();
|
||||
}
|
||||
|
||||
protected void btnQKGS_Click(object sender, EventArgs e)
|
||||
{
|
||||
string sBJFLID = PageParam.GetRTrimString("BJFLID");
|
||||
if (!IsQYGS(sBJFLID))
|
||||
{
|
||||
ShowMessage("未启用公式!");
|
||||
return;
|
||||
}
|
||||
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
|
||||
TSQL SQL = new TSQL(dberp);
|
||||
try
|
||||
{
|
||||
dberp.BeginTrans();
|
||||
SQL.Clear();
|
||||
SQL.Add("update XLXSBJFL set XLXSBJFL_TZQCPBJGS=' ' where XLXSBJFL_BJFLID=:pBJFLID");
|
||||
SQL.ParamByName("pBJFLID").Value = sBJFLID;
|
||||
dberp.ExecSQL(SQL);
|
||||
if (!CanYZIDSave(dberp, SQL, sBJFLID, ""))
|
||||
{
|
||||
throw new Exception();
|
||||
}
|
||||
dberp.CommitTrans();
|
||||
txtTZQCPBJGS.Text = "";
|
||||
}
|
||||
catch
|
||||
{
|
||||
ShowMessage("当前选择因子不满足“加价因子必须全部在加点/扣点因子之前或者之后”规则,不允许清空公式!请至“100860005|线缆销售报价单因子”模块调整因子顺序或者重新选择因子!");
|
||||
dberp.RollbackTrans();
|
||||
}
|
||||
|
||||
moduleGV_PageIndexChanging(null, null);
|
||||
FormAreaUpdate();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
public class BJFLYZXX
|
||||
{
|
||||
private string _YZID;
|
||||
public string YZID
|
||||
{
|
||||
get
|
||||
{
|
||||
return _YZID;
|
||||
}
|
||||
set
|
||||
{
|
||||
_YZID = value; ;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private double _JSXH;
|
||||
public double JSXH
|
||||
{
|
||||
get
|
||||
{
|
||||
return _JSXH;
|
||||
}
|
||||
set
|
||||
{
|
||||
_JSXH = value; ;
|
||||
}
|
||||
}
|
||||
|
||||
private string _TJLX;
|
||||
public string TJLX
|
||||
{
|
||||
get
|
||||
{
|
||||
return _TJLX;
|
||||
}
|
||||
set
|
||||
{
|
||||
_TJLX = value; ;
|
||||
}
|
||||
}
|
||||
|
||||
private string _TJYZID;
|
||||
public string TJYZID
|
||||
{
|
||||
get
|
||||
{
|
||||
return _TJYZID;
|
||||
}
|
||||
set
|
||||
{
|
||||
_TJYZID = value; ;
|
||||
}
|
||||
}
|
||||
|
||||
private string _TYZZYZID;
|
||||
public string TYZZYZID
|
||||
{
|
||||
get
|
||||
{
|
||||
return _TYZZYZID;
|
||||
}
|
||||
set
|
||||
{
|
||||
_TYZZYZID = value; ;
|
||||
}
|
||||
}
|
||||
|
||||
private string _JJFS;
|
||||
public string JJFS
|
||||
{
|
||||
get
|
||||
{
|
||||
return _JJFS;
|
||||
}
|
||||
set
|
||||
{
|
||||
_JJFS = value; ;
|
||||
}
|
||||
}
|
||||
|
||||
private string _YZZGS;
|
||||
public string YZZGS
|
||||
{
|
||||
get
|
||||
{
|
||||
return _YZZGS;
|
||||
}
|
||||
set
|
||||
{
|
||||
_YZZGS = value; ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class BJFLYZXXComparer : IComparer<BJFLYZXX>
|
||||
{
|
||||
public int Compare(BJFLYZXX x, BJFLYZXX y)
|
||||
{
|
||||
if (x.JSXH == y.JSXH)
|
||||
return x.YZID.CompareTo(y.YZID);
|
||||
return x.JSXH.CompareTo(y.JSXH);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user