Files
N_XLXSBJ----MX/XLBJD_FBJXQList.aspx.cs
T
2026-08-21 17:03:02 +08:00

230 lines
8.9 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_MODEL.Page;
using System.Collections.Generic;
using GThinking.N_MISPRO.Data;
using System.Text;
using GThinking.N_MISPRO;
using GThinking.N_MISPRO.Utility;
namespace GThinking.N_XLXSBJ
{
public partial class XLBJD_FBJXQList : SingleGridBase
{
XLBJD_FBJXQ entity = new XLBJD_FBJXQ();
Dictionary<string, string> dicJGBTJYZ = new Dictionary<string, string>();
int iXSWS = 5;
#region Page类事件继承
protected void Page_Load(object sender, EventArgs e)
{
this.UMID = 100860000;
this.UMName = "线缆销售报价单";
this.CurMaster = Master;
this.ModuleGV = ContentGrid;
this.CurEntity = entity;
this.PageHeight = 600;
this.PageWidth = 750;
base.DataKeyNames = new string[] { "XLXSBJDMX_XH", "XLXSBJDMX_XSSX", "XLXSBJDMX_JSYCBZ" };
Master.EnableNewBtn = false;
Master.EnableCopyBtn = false;
Master.EnableViewBtn = false;
Master.EnableEditBtn = false;
Master.EnableDeleteBtn = false;
Master.EnableQueryBtn = false;
iXSWS = string.IsNullOrEmpty(GetOption("BJU002")) ? 5 : CMISproConvert.StrToInt(GetOption("BJU002"));
if (iXSWS < 0)
iXSWS = 0;
else if (iXSWS > 8)
iXSWS = 8;
string sBJBM = XLBJDUtils.GetJGBBJBM(PageParam.GetRTrimString("BJFLID"));
if(!sBJBM.Equals(""))
ContentGrid.FindColumnByFieldName("XLXSBJDMX_JGBBJ").HeaderText = XLBJDUtils.GetJGBBJBM(PageParam.GetRTrimString("BJFLID"));
base.InitPage();
this.ModuleGV.OnClientDblClick = "return false;";
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(ContentGrid, tSession);
}
protected override void moduleGV_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
entity.EntityTable.QuerySelSql = GetSql();
base.moduleGV_PageIndexChanging(sender, e);
ContentGrid.SelectedIndex = -1;
}
protected override void moduleGV_RowDataBound(object sender, GridViewRowEventArgs e)
{
InitDic();
if (e.Row.RowType == DataControlRowType.DataRow)
{
if (e.Row.Cells[8].Text.Contains("A") || CMISproConvert.StrToInt(e.Row.Cells[7].Text.Trim()) == 0)
{
e.Row.Cells[7].Text = string.Format("<A href='#' onclick=\"CellClick('{0}','{1}','{2}','{3}','{4}') \"><U>" + XLBJDUtils.strPadRight(e.Row.Cells[7].Text.Trim(),iXSWS) + "</U></A>",
e.Row.Cells[1].Text.Trim(), e.Row.Cells[2].Text.Trim(), e.Row.Cells[3].Text.Trim(), e.Row.Cells[4].Text.Trim(), ContentGrid.DataKeys[e.Row.RowIndex]["XLXSBJDMX_XH"].ToString().Trim());
}
if ((e.Row.Cells[8].Text.Trim() != "") && (e.Row.Cells[8].Text.Trim() != "&nbsp;"))
{
e.Row.Cells[8].Text = GetJSYCXQ(e.Row.Cells[8].Text.Trim(), dicJGBTJYZ);
}
}
base.moduleGV_RowDataBound(sender, e);
}
protected override void ReportDataSetAdd()
{
AddUserReportField("JSYCBZ", "XLXSBJDMX_JSYCBZ", "负表价原因", "S");
base.ReportDataSetAdd();
}
protected override void ReportRecordSetAdd()
{
TDatabase DBERP = TContextDatabases.GetDatabase("DBERP");
TSQL SQL = new TSQL(DBERP);
SQL.Text = GetSql();
DataSet ds = DBERP.OpenDataSet(SQL);
if (ds.Tables[0].Rows.Count > 0)
{
int i = 0;
foreach (DataRow row in ds.Tables[0].Rows)
{
string sJSYCBZ = row["XLXSBJDMX_JSYCBZ"].ToString().Trim();
if (string.IsNullOrEmpty(sJSYCBZ))
{
ds.Tables[0].Rows[i]["XLXSBJDMX_JSYCBZ"] = GetJSYCXQ(sJSYCBZ, dicJGBTJYZ);
}
i++;
}
}
AddUserReportDataSet("JSYCBZ", ds);
base.ReportRecordSetAdd();
}
#endregion
#region 自定义函数
private string GetSql()
{
StringBuilder strSQL = new StringBuilder();
strSQL.AppendLine(" select XLXSBJDMX_XH,XLXSBJDMX_XSSX,XLXSBJDMX_XLXHID,XLXSBJDMX_JGBBJ,XLXSBJDMX_XLGGID,rtrim(XLXSBJDMX_XLBZID) ||'|'|| rtrim(XLBZ_XLBZLXMC) as XLBZ,XLXSBJDMX_DYDJID,");
strSQL.AppendLine(" XLXSBJDMX_BJCP,XLXSBJDMX_JLDW,XLXSBJDMX_JSYCBZ ");
strSQL.AppendLine(" from XLXSBJDMX ");
strSQL.AppendLine(" left join XLBZ on XLBZ_XLBZID = XLXSBJDMX_XLBZID ");
strSQL.AppendLine(" where XLXSBJDMX_BJDID = '" + PageParam.GetRTrimString("BJDID").Trim() + "' and (XLXSBJDMX_JGBBJ < 0 OR XLXSBJDMX_BJDHQCLCB=0) order by XLXSBJDMX_XSSX ");
return strSQL.ToString();
}
public static string GetJSYCXQ(string sJSYCBZ, Dictionary<string, string> dicJGBTJYZ)
{
if (sJSYCBZ.Equals(""))
return "";
string Rstr = "";
foreach (string str in sJSYCBZ.Split(','))
{
if (!str.Trim().Equals(""))
{
if (!Rstr.Equals(""))
Rstr += ",";
if (str.Trim().Equals("A"))
{
Rstr += "材料价缺失/有用量栏目未指定材料";
}
string YZID = "";
if (str.Contains("F"))
{
string sFGQCP = str.TrimEnd('F');
if (sFGQCP.Trim().Equals("0"))
YZID = "JZ10";
else
{
YZID = "JZ0" + sFGQCP;
}
if (dicJGBTJYZ.ContainsKey(YZID))
{
Rstr += dicJGBTJYZ[YZID] + "尚未覆盖本产品";
}
}
else
{
if (str.Trim().Equals("0"))
YZID = "JZ10";
else
{
YZID = "JZ0" + str;
}
if (dicJGBTJYZ.ContainsKey(YZID))
{
Rstr += dicJGBTJYZ[YZID] + "缺失异常";
}
}
}
}
return Rstr;
}
private void InitDic()
{
if (dicJGBTJYZ.Count > 0)
return;
dicJGBTJYZ = XLBJDUtils.GetJZJYZIDDic();
}
#endregion
#region 控件事件
protected void btnCXQSCL_Click(object sender, EventArgs e)
{
string sXLXHID = txtXLXHID.Value.Trim();
string sXLGGID = txtXLGGID.Value.Trim();
string sXLBZID = txtXLBZID.Value.Trim();
string sDYDJID = txtDYDJID.Value.Trim();
string sXH = txtXH.Value.Trim();
TPageParams tpp = new TPageParams();
tpp.UrlPath = "XLBJD_CXQSCLList.aspx";
tpp.AddString("XLXHID", sXLXHID);
tpp.AddString("XLGGID", sXLGGID);
tpp.AddString("XLBZID", sXLBZID);
tpp.AddString("DYDJID", sDYDJID);
tpp.AddString("BJDID", PageParam.GetRTrimString("BJDID"));
tpp.AddString("XH", sXH);
tpp.AddString("BJRQ", PageParam.GetRTrimString("BJRQ"));
tpp.AddString("BJFLID", PageParam.GetRTrimString("BJFLID"));
tpp.AddString("JGBID", PageParam.GetRTrimString("JGBID"));
tpp.AddString("JGBIDS", PageParam.GetRTrimString("JGBIDS"));
tpp.AddString("HSBZ", PageParam.GetRTrimString("HSBZ"));
tpp.AddString("BJDHQLY", PageParam.GetRTrimString("BJDHQLY"));
tpp.AddString("TBJCLID", PageParam.GetRTrimString("TBJCLID"));
tpp.AddString("LBJCLID", PageParam.GetRTrimString("LBJCLID"));
tpp.AddString("TJ", PageParam.GetRTrimString("TJ"));
tpp.AddString("LJ", PageParam.GetRTrimString("LJ"));
OpenModuleDialog(100860000, tpp);
}
#endregion
}
}