2026821
This commit is contained in:
@@ -0,0 +1,261 @@
|
||||
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_MODEL.Page;
|
||||
using GThinking.N_MISPRO.Data;
|
||||
using GThinking.N_MISPRO;
|
||||
using GThinking.N_MISPRO.Utility;
|
||||
using System.Text;
|
||||
using GThinking.N_CONTROL;
|
||||
|
||||
|
||||
namespace GThinking.N_XLXSBJ
|
||||
{
|
||||
public partial class BJFLList : SingleGridBase
|
||||
{
|
||||
XLXSBJFL entity = new XLXSBJFL();
|
||||
|
||||
#region Page类事件继承
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
this.UMID = 100860023;
|
||||
this.UMName = "线缆销售报价分类";
|
||||
this.CurMaster = Master;
|
||||
this.ModuleGV = grdXLXSBJFL;
|
||||
this.CurEntity = entity;
|
||||
this.sURLTarget = "BJFLInfo.aspx";
|
||||
this.PageHeight = 600;
|
||||
this.PageWidth = 750;
|
||||
|
||||
base.DataKeyNames = new string[] { "XLXSBJFL_BJFLID" };
|
||||
this.Master.EnableQueryBtn = false;
|
||||
|
||||
base.InitPage();
|
||||
|
||||
if (!IsPostBack)
|
||||
{
|
||||
Master_OnStandardQuery(null, null);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 模板事件
|
||||
protected override void Master_OnStandardQuery(object sender, EventArgs e)
|
||||
{
|
||||
entity.EntityTable.QuerySelSql = GetSql();
|
||||
base.Master_OnStandardQuery(sender, e);
|
||||
entity.GridDataBind(grdXLXSBJFL,tSession);
|
||||
}
|
||||
|
||||
protected override void moduleGV_PageIndexChanging(object sender, GridViewPageEventArgs e)
|
||||
{
|
||||
entity.EntityTable.QuerySelSql = GetSql();
|
||||
base.moduleGV_PageIndexChanging(sender, e);
|
||||
grdXLXSBJFL.SelectedIndex = -1;
|
||||
}
|
||||
|
||||
protected override void moduleGV_RowDataBound(object sender, GridViewRowEventArgs e)
|
||||
{
|
||||
if (e.Row.RowType == DataControlRowType.DataRow)
|
||||
{
|
||||
if ((e.Row.Cells[3].Text.Trim() != "") && (e.Row.Cells[3].Text.Trim() != " "))
|
||||
{
|
||||
e.Row.Cells[3].Text = GetJGBTJYSS(e.Row.Cells[3].Text.Trim());
|
||||
}
|
||||
if ((e.Row.Cells[4].Text.Trim() != "") && (e.Row.Cells[4].Text.Trim() != " "))
|
||||
{
|
||||
e.Row.Cells[4].Text = GetJGBXX(e.Row.Cells[4].Text.Trim());
|
||||
}
|
||||
if ((e.Row.Cells[5].Text.Trim() != "") && (e.Row.Cells[5].Text.Trim() != " "))
|
||||
{
|
||||
e.Row.Cells[5].Text = GetXSQYXX(e.Row.Cells[5].Text.Trim());
|
||||
}
|
||||
LinkPageParam.AddString("XLXSBJFL_BJFLID", this.grdXLXSBJFL.DataKeys[e.Row.RowIndex]["XLXSBJFL_BJFLID"].ToString().Trim());
|
||||
}
|
||||
base.moduleGV_RowDataBound(sender, e);
|
||||
}
|
||||
|
||||
protected override void BeforeDelete(TDatabase db, ref bool ActionIsDone)
|
||||
{
|
||||
entity.Param.Add("XLXSBJFL_BJFLID", this.grdXLXSBJFL.DataKeys[grdXLXSBJFL.SelectedIndex]["XLXSBJFL_BJFLID"].ToString().Trim());
|
||||
base.BeforeDelete(db, ref ActionIsDone);
|
||||
}
|
||||
|
||||
protected override bool Master_BeforeDeleteAction(object sender, EventArgs e)
|
||||
{
|
||||
if (!base.Master_BeforeDeleteAction(sender, e))
|
||||
{ return false; }
|
||||
|
||||
if (grdXLXSBJFL.DataKeys[grdXLXSBJFL.SelectedIndex]["XLXSBJFL_BJFLID"].ToString().Trim().Equals("--------"))
|
||||
{
|
||||
ShowMessage("演示分类不允许删除!");
|
||||
return false;
|
||||
}
|
||||
|
||||
string sSQL = string.Format("select 1 from XLXSBJD where XLXSBJD_BJFLID = '{0}'",
|
||||
grdXLXSBJFL.DataKeys[grdXLXSBJFL.SelectedIndex]["XLXSBJFL_BJFLID"].ToString().Trim());
|
||||
if (CMISproDataBase.ExistsRecord("DBERP", sSQL))
|
||||
{
|
||||
ShowMessage("已被报价单使用,不允许删除!");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override void AfterDelete(TDatabase db, ref bool ActionIsDone)
|
||||
{
|
||||
base.AfterDelete(db, ref ActionIsDone);
|
||||
db.ExecSQL(string.Format("delete from XLXSBJFLKH where XLXSBJFLKH_BJFLID='{0}'", grdXLXSBJFL.DataKeys[grdXLXSBJFL.SelectedIndex]["XLXSBJFL_BJFLID"].ToString().Trim()));
|
||||
db.ExecSQL(string.Format("delete from XLXSBJFLYZ where XLXSBJFLYZ_BJFLID='{0}'", grdXLXSBJFL.DataKeys[grdXLXSBJFL.SelectedIndex]["XLXSBJFL_BJFLID"].ToString().Trim()));
|
||||
db.ExecSQL(string.Format("delete from XLXSBJFLJSLM where XLXSBJFLJSLM_BJFLID='{0}'", grdXLXSBJFL.DataKeys[grdXLXSBJFL.SelectedIndex]["XLXSBJFL_BJFLID"].ToString().Trim()));
|
||||
}
|
||||
|
||||
protected override bool Master_AfterDeleteAction(object sender, EventArgs e)
|
||||
{
|
||||
if (!base.Master_AfterDeleteAction(sender, e))
|
||||
{ return false; }
|
||||
entity.EntityTable.QuerySelSql = GetSql();
|
||||
entity.GridDataBind(grdXLXSBJFL, tSession);
|
||||
grdXLXSBJFL.SelectedIndex = -1;
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 自定义函数
|
||||
|
||||
private string GetSql()
|
||||
{
|
||||
StringBuilder strSQL = new StringBuilder();
|
||||
strSQL.AppendLine(" select XLXSBJFL_BJFLID,XLXSBJFL_BJFLMC,XLXSBJFL_XSXH,XLXSBJFL_JGBTJYSS,XLXSBJFL_JGBIDS,XLXSBJFL_XSQYIDS,XLXSBJFL_QYRQ,isnull(XLXSBJFL_TYBZ,'N') AS XLXSBJFL_TYBZ,XLXSBJFL_TYRQ,");
|
||||
strSQL.AppendLine(" XLXSBJFL_BZ, XLXSBJFL_WHR,XLXSBJFL_WHRID,XLXSBJFL_WHSJ,XLXSBJFL_MRCKC, ");
|
||||
strSQL.AppendLine(" RTRIM(XLXSBJFL_CPMLID) ||'|'|| RTRIM(XLXSCPML_CPMLMC) AS XLXSBJFL_CPMLID,XLXSBJFL_SDJGBCLHQFW,XLXSBJFL_XSJGBJJ,XLXSBJFL_XSJGBBJJCE,XLXSBJFL_BJJCLLX, ");
|
||||
strSQL.AppendLine(" XLXSBJFL_TZCLHQ,XLXSBJFL_TZJGBBJ, XLXSBJFL_BJDHQLY,XLXSBJFL_LJJCLLX, ");
|
||||
strSQL.AppendLine(" XLXSBJFL_XSTZCPBJ, XLXSBJFL_ZDXJGS, XLXSBJFL_XSTZBJJE,XLXSBJFL_XTCPBJYZ,XLXSBJFL_BJCPFZJS,XLXSBJFL_XHABJCSDP,XLXSBJFL_JYF,XLXSBJFL_YFWLID,XLXSBJFL_BJHYF ");
|
||||
strSQL.AppendLine(" from XLXSBJFL ");
|
||||
strSQL.AppendLine(" left join XLXSCPML on XLXSCPML_CPMLID = XLXSBJFL_CPMLID ");
|
||||
strSQL.AppendLine(" where 1=1 order by XLXSBJFL_XSXH,XLXSBJFL_BJFLID ");
|
||||
return strSQL.ToString();
|
||||
}
|
||||
|
||||
private string GetJGBTJYSS(string sJGBTJYSList)
|
||||
{
|
||||
string[] sJGBTJYSs = sJGBTJYSList.Trim().Split(',');
|
||||
string Result = "";
|
||||
for (int i = 0; i < sJGBTJYSs.Length; i++)
|
||||
{
|
||||
if (sJGBTJYSs[i].Trim().Equals("1"))
|
||||
{
|
||||
Result += "1|表价(出厂价)=基价(材料价)&调价,";
|
||||
}
|
||||
else if (sJGBTJYSs[i].Trim().Equals("2"))
|
||||
{
|
||||
Result += "2|表价(区域价)=基价(出厂价)&调价,";
|
||||
}
|
||||
else if (sJGBTJYSs[i].Trim().Equals("3"))
|
||||
{
|
||||
Result += "3|表价(现行价)=基价(出厂价+材料价价差)&调价,";
|
||||
}
|
||||
}
|
||||
return Result.TrimEnd(',');
|
||||
}
|
||||
|
||||
private string GetXSQYXX(string sXSQYIDList)
|
||||
{
|
||||
string[] sXSQYIDs = sXSQYIDList.Trim().Split(',');
|
||||
string Result = "";
|
||||
for (int i = 0; i < sXSQYIDs.Length; i++)
|
||||
{
|
||||
Result += sXSQYIDs[i].Trim() + "|" + GetXSQYMC(sXSQYIDs[i].Trim()) + ",";
|
||||
}
|
||||
return Result.TrimEnd(',');
|
||||
}
|
||||
|
||||
private string GetXSQYMC(string sXSQYID)
|
||||
{
|
||||
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
|
||||
TSQL sql = new TSQL(dberp);
|
||||
sql.Add("select XSQY_XSQYMC from XSQY where XSQY_XSQYID=:pXSQYID ");
|
||||
sql.ParamByName("pXSQYID").Value = sXSQYID.Trim();
|
||||
DataSet ds = dberp.OpenDataSet(sql);
|
||||
string sXSQYMC = "";
|
||||
if (ds.Tables[0].Rows.Count > 0)
|
||||
{
|
||||
sXSQYMC = ds.Tables[0].Rows[0][0].ToString().Trim();
|
||||
}
|
||||
return sXSQYMC;
|
||||
}
|
||||
|
||||
private string GetJGBXX(string sJGBIDList)
|
||||
{
|
||||
string[] sJGBIDs = sJGBIDList.Trim().Split(',');
|
||||
string Result = "";
|
||||
for (int i = 0; i < sJGBIDs.Length; i++)
|
||||
{
|
||||
if (sJGBIDs[i].Trim().Equals("CUR"))
|
||||
Result += "CUR|当前有效价格表,";
|
||||
else
|
||||
Result += sJGBIDs[i].Trim() + "|" + GetJGBMC(sJGBIDs[i].Trim()) + ",";
|
||||
}
|
||||
return Result.TrimEnd(',');
|
||||
}
|
||||
|
||||
private string GetJGBMC(string sJGBID)
|
||||
{
|
||||
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
|
||||
TSQL sql = new TSQL(dberp);
|
||||
sql.Add("select XLXSJGB_JGBMC from XLXSJGB where XLXSJGB_MXBH='JGB' and XLXSJGB_JGBID=:pJGBID ");
|
||||
sql.ParamByName("pJGBID").Value = sJGBID.Trim();
|
||||
DataSet ds = dberp.OpenDataSet(sql);
|
||||
string sJGBMC = "";
|
||||
if (ds.Tables[0].Rows.Count > 0)
|
||||
{
|
||||
sJGBMC = ds.Tables[0].Rows[0][0].ToString().Trim();
|
||||
}
|
||||
return sJGBMC;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 控件事件
|
||||
protected void btnKH_OnClick(object sender, EventArgs e)
|
||||
{
|
||||
if (grdXLXSBJFL.SelectedIndex < 0)
|
||||
{
|
||||
ShowMessage("请选择处理记录!");
|
||||
return;
|
||||
}
|
||||
string sBJFLID = grdXLXSBJFL.DataKeys[grdXLXSBJFL.SelectedIndex]["XLXSBJFL_BJFLID"].ToString().Trim();
|
||||
|
||||
TPageParams tpp = new TPageParams();
|
||||
tpp.UrlPath = "BJFL_KHList.aspx";
|
||||
tpp.CallAction = TPageCallAction.pcaBrowse;
|
||||
tpp.AddString("BJFLID", sBJFLID);
|
||||
OpenDialog(tpp);
|
||||
}
|
||||
|
||||
protected void btnTJYZ_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (grdXLXSBJFL.SelectedIndex < 0)
|
||||
{
|
||||
ShowMessage("请选择处理记录!");
|
||||
return;
|
||||
}
|
||||
|
||||
string sBJFLID = grdXLXSBJFL.DataKeys[grdXLXSBJFL.SelectedIndex]["XLXSBJFL_BJFLID"].ToString().Trim();
|
||||
|
||||
TPageParams param = new TPageParams();
|
||||
param.UrlPath = "BJFL_TJYZList.aspx";
|
||||
param.AddString("BJFLID", sBJFLID);
|
||||
OpenDialog(param);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user