1751 lines
80 KiB
C#
1751 lines
80 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_MODEL.Page;
|
||
using GThinking.N_MISPRO.Data;
|
||
using GThinking.N_CONTROL;
|
||
using GThinking.N_PUBLIC;
|
||
using GThinking.N_MISPRO.Utility;
|
||
using GThinking.N_MODEL.Dialog;
|
||
using GThinking.N_WORKFLOW;
|
||
using System.Collections.Generic;
|
||
using System.Text;
|
||
|
||
namespace GThinking.N_XLXSBJ
|
||
{
|
||
public partial class CXJGB_XLXHList : SingleGridBase
|
||
{
|
||
CXJGB_XLXH entity = new CXJGB_XLXH();
|
||
CXJGB_XLXH_M queryentity = new CXJGB_XLXH_M();
|
||
static string pFL = "";
|
||
static string pJGBID = "";
|
||
static string pXSFS = "";
|
||
static string pXH = "";
|
||
static string pBZ = "";
|
||
static string pDYDJ = "";
|
||
static string pHSBJ = "";
|
||
|
||
#region pageload 事件
|
||
|
||
protected void Page_Load(object sender, EventArgs e)
|
||
{
|
||
this.UMID = 100860037;
|
||
this.UMName = "线缆型号销售价格表查询";
|
||
this.CurMaster = Master;
|
||
this.ModuleGV = this.grdContentGrid;
|
||
this.CurEntity = entity;
|
||
this.CurQueryEntity = queryentity;
|
||
this.sQueryURLTarget = "CXJGB_XLXHQuery.aspx";
|
||
this.sURLTarget = "";
|
||
this.PageHeight = 600;
|
||
this.PageWidth = 750;
|
||
if (!IsPostBack)
|
||
{
|
||
CurQueryEntity.FieldByName("FL").Value = "JGB";
|
||
CurQueryEntity.FieldByName("XSFS").Value = "1";
|
||
CurQueryEntity.FieldByName("HSBJ").Value = "True";
|
||
}
|
||
this.Master.EnableCopyBtn = false;
|
||
this.Master.EnableDeleteBtn = false;
|
||
this.Master.EnableNewBtn = false;
|
||
this.Master.EnableEditBtn = false;
|
||
this.Master.EnableViewBtn = false;
|
||
|
||
base.InitPage();
|
||
this.ModuleGV.OnClientDblClick = "return false;";
|
||
|
||
if (!IsPostBack)
|
||
{
|
||
lblXDXH.Visible = false;
|
||
lblDYDJ.Visible = false;
|
||
lblBZ.Visible = false;
|
||
txtXDXH.Visible = false;
|
||
txtBZ.Visible = false;
|
||
txtDYDJ.Visible = false;
|
||
if (base.IsDefaultExecute)
|
||
{
|
||
Master_OnStandardQuery(null, null);
|
||
}
|
||
}
|
||
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region 模板事件继承
|
||
|
||
protected override void Master_OnStandardQuery(object sender, EventArgs e)
|
||
{
|
||
base.InitEntityByCondition();
|
||
if (CurQueryEntity.FieldByName("XSFS").Value.Trim().Equals("2") || CurQueryEntity.FieldByName("XSFS").Value.Trim().Equals("3"))
|
||
{
|
||
lblXDXH.Visible = true;
|
||
lblDYDJ.Visible = true;
|
||
lblBZ.Visible = true;
|
||
txtXDXH.Visible = true;
|
||
txtBZ.Visible = true;
|
||
txtDYDJ.Visible = true;
|
||
if (!CurQueryEntity.FieldByName("XH").Value.Trim().Equals(""))
|
||
txtXDXH.Text = CurQueryEntity.FieldByName("XH").Value.Trim();
|
||
if (!CurQueryEntity.FieldByName("DYDJ").Value.Trim().Equals(""))
|
||
txtDYDJ.Text = CurQueryEntity.FieldByName("DYDJ").Value.Trim();
|
||
if (!CurQueryEntity.FieldByName("BZ").Value.Trim().Equals(""))
|
||
txtBZ.Text = CurQueryEntity.FieldByName("BZ").Value.Trim() + "|" + GetBZ(CurQueryEntity.FieldByName("BZ").Value.Trim());
|
||
}
|
||
else
|
||
{
|
||
lblXDXH.Visible = false;
|
||
lblDYDJ.Visible = false;
|
||
lblBZ.Visible = false;
|
||
txtXDXH.Visible = false;
|
||
txtBZ.Visible = false;
|
||
txtDYDJ.Visible = false;
|
||
}
|
||
entity.EntityTable.QuerySelSql = "select 1 from XLXSJGBMX where 1<>1";
|
||
base.Master_OnStandardQuery(sender, e);
|
||
DataSet ds = GetTable();
|
||
entity.GridDataBind(grdContentGrid, tSession);
|
||
entity.GridDataBind(grdContentGrid, ds.Tables[0],ds.Tables[0].Rows.Count);
|
||
grdContentGrid.DataSource = ds;
|
||
}
|
||
|
||
protected override void moduleGV_PageIndexChanging(object sender, GridViewPageEventArgs e)
|
||
{
|
||
base.InitEntityByCondition();
|
||
if (CurQueryEntity.FieldByName("XSFS").Value.Trim().Equals("2") || CurQueryEntity.FieldByName("XSFS").Value.Trim().Equals("3"))
|
||
{
|
||
lblXDXH.Visible = true;
|
||
lblDYDJ.Visible = true;
|
||
lblBZ.Visible = true;
|
||
txtXDXH.Visible = true;
|
||
txtBZ.Visible = true;
|
||
txtDYDJ.Visible = true;
|
||
if (!CurQueryEntity.FieldByName("XH").Value.Trim().Equals(""))
|
||
txtXDXH.Text = CurQueryEntity.FieldByName("XH").Value.Trim();
|
||
if (!CurQueryEntity.FieldByName("DYDJ").Value.Trim().Equals(""))
|
||
txtDYDJ.Text = CurQueryEntity.FieldByName("DYDJ").Value.Trim();
|
||
if (!CurQueryEntity.FieldByName("BZ").Value.Trim().Equals(""))
|
||
txtBZ.Text = CurQueryEntity.FieldByName("BZ").Value.Trim() + "|" + GetBZ(CurQueryEntity.FieldByName("BZ").Value.Trim());
|
||
}
|
||
else
|
||
{
|
||
lblXDXH.Visible = false;
|
||
lblDYDJ.Visible = false;
|
||
lblBZ.Visible = false;
|
||
txtXDXH.Visible = false;
|
||
txtBZ.Visible = false;
|
||
txtDYDJ.Visible = false;
|
||
}
|
||
entity.EntityTable.QuerySelSql = "select 1 from XLXSJGBMX where 1<>1";
|
||
base.moduleGV_PageIndexChanging(sender, e);
|
||
grdContentGrid.SelectedIndex = -1;
|
||
DataSet ds = GetTable();
|
||
entity.GridDataBind(grdContentGrid, tSession);
|
||
entity.GridDataBind(grdContentGrid, ds.Tables[0], ds.Tables[0].Rows.Count);
|
||
grdContentGrid.DataSource = ds;
|
||
}
|
||
|
||
protected override void moduleGV_RowDataBound(object sender, GridViewRowEventArgs e)
|
||
{
|
||
base.moduleGV_RowDataBound(sender, e);
|
||
}
|
||
|
||
protected override void ReportRecordSetAdd()
|
||
{
|
||
base.InitEntityByCondition();
|
||
DataSet ds = GetTable();
|
||
AddUserReportDataSet("CX_JGB", ds);
|
||
base.ReportRecordSetAdd();
|
||
|
||
}
|
||
|
||
protected override void ReportDataSetAdd()
|
||
{
|
||
string strs = Getfield();
|
||
if (!strs.Equals(""))
|
||
{
|
||
foreach (string strx in strs.Split(';'))
|
||
{
|
||
AddUserReportField("CX_JGB", strx.Split(',')[0], strx.Split(',')[1], "S");
|
||
}
|
||
}
|
||
base.ReportDataSetAdd();
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region 自定义函数
|
||
|
||
|
||
private string GetBZ(string XLBZID)
|
||
{
|
||
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
|
||
TSQL sql = new TSQL(dberp);
|
||
sql.Clear();
|
||
sql.Add("select XLBZ_XLBZLXMC from XLBZ where XLBZ_XLBZID=:pXLBZID");
|
||
sql.ParamByName("pXLBZID").Value = XLBZID;
|
||
string Rstr = "";
|
||
DataSet ds = dberp.OpenDataSet(sql);
|
||
if(ds.Tables[0].Rows.Count>0)
|
||
Rstr = ds.Tables[0].Rows[0][0].ToString().Trim();
|
||
return Rstr;
|
||
}
|
||
|
||
private DataSet GetTable2()
|
||
{
|
||
grdContentGrid.Columns.Clear();
|
||
|
||
int iXSWS = string.IsNullOrEmpty(GetOption(100860037, "BJU002")) ? 5 : CMISproConvert.StrToInt(GetOption(100860037, "BJU002"));
|
||
if (iXSWS < 0)
|
||
iXSWS = 0;
|
||
else if (iXSWS > 8)
|
||
iXSWS = 8;
|
||
string sFL = CurQueryEntity.FieldByName("FL").Value.Trim();
|
||
string sJGBID = CurQueryEntity.FieldByName("JGB").Value.Trim();
|
||
string sXSFS = CurQueryEntity.FieldByName("XSFS").Value.Trim();
|
||
string sXH = CurQueryEntity.FieldByName("XH").Value.Trim();
|
||
string sBZ = CurQueryEntity.FieldByName("BZ").Value.Trim();
|
||
string sDYDJ = CurQueryEntity.FieldByName("DYDJ").Value.Trim();
|
||
string sHSBJ = CurQueryEntity.FieldByName("HSBJ").Value.Trim();
|
||
pFL = sFL;
|
||
pJGBID = sJGBID;
|
||
pXSFS = sXSFS;
|
||
pXH = sXH;
|
||
pBZ = sBZ;
|
||
pDYDJ = sDYDJ;
|
||
pHSBJ = sHSBJ;
|
||
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
|
||
TSQL sql = new TSQL(dberp);
|
||
sql.Clear();
|
||
sql.Add("select XLXSCPML_CPMLLX,XLXSJGB_JGCIDS");
|
||
sql.Add(" from XLXSJGB");
|
||
sql.Add(" left join XLXSCPML on XLXSCPML_CPMLID=XLXSJGB_CPMLID");
|
||
sql.Add(" where XLXSJGB_MXBH=:pMXBH and XLXSJGB_JGBID=:pJGBID");
|
||
sql.ParamByName("pMXBH").Value = sFL;
|
||
sql.ParamByName("pJGBID").Value = sJGBID;
|
||
DataSet dsJGB = dberp.OpenDataSet(sql);
|
||
string sCPMLLX = "";
|
||
string sJGCIDS = "";
|
||
if (dsJGB.Tables[0].Rows.Count > 0)
|
||
{
|
||
sCPMLLX = dsJGB.Tables[0].Rows[0]["XLXSCPML_CPMLLX"].ToString().Trim();
|
||
sJGCIDS = dsJGB.Tables[0].Rows[0]["XLXSJGB_JGCIDS"].ToString().Trim();
|
||
}
|
||
|
||
DataTable dt= new DataTable();
|
||
if (sXSFS.Equals("1"))
|
||
{
|
||
sql.Clear();
|
||
sql.Add("select distinct XLXSJGBMX_XLXHID,XLXSJGBMX_XLBZID ||'|'||XLBZ_XLBZLXMC as XLXSJGBMX_XLBZID,XLXSJGBMX_XLGGID,XLXSJGBMX_DYDJID,XLXSJGBMX_HSBJ,XLXSJGBMX_WSBJ,XLGGB_XH,XLGGB_XXJGID,XLGGB_DTJMZHID,XLDYDJB_XH ");
|
||
sql.Add(" from XLXSJGBMX ");
|
||
sql.Add(" left join XLBZ on XLBZ_XLBZID = XLXSJGBMX_XLBZID ");
|
||
sql.Add(" left join XLXHB on XLXHB_XLXHID=XLXSJGBMX_XLXHID");
|
||
sql.Add(" left join XLGGB on XLGGB_XLGGID = XLXSJGBMX_XLGGID and XLGGB_XLGGJDGZ = isnull(XLXHB_XLGGJDGZ,'0') ");
|
||
sql.Add(" left join XLDYDJB on XLDYDJB_DYDJID = XLXSJGBMX_DYDJID where 1=1");
|
||
if (sCPMLLX.Equals("Y"))//组合产品目录价格表
|
||
{
|
||
sql.Add(" and " + CMISproDataBase.GetWhereEqual("XLXSJGBMX_JGBID", sJGCIDS));
|
||
}
|
||
else
|
||
{
|
||
sql.Add(" and XLXSJGBMX_JGBID=:pJGBID ");
|
||
sql.ParamByName("pJGBID").Value = sJGBID;
|
||
}
|
||
if (!sXH.Equals(""))
|
||
sql.Add(" and " + CMISproDataBase.GetWhereEqual("XLXSJGBMX_XLXHID", sXH));
|
||
if (!sBZ.Equals(""))
|
||
sql.Add(" and XLXSJGBMX_XLBZID ='" + sBZ + "'");
|
||
if (!sDYDJ.Equals(""))
|
||
sql.Add(" and XLXSJGBMX_DYDJID='" + sDYDJ + "'");
|
||
sql.Add(" order by XLXSJGBMX_XLBZID,XLGGB_XH,XLDYDJB_XH,XLXSJGBMX_DYDJID,XLXSJGBMX_XLXHID");
|
||
DataSet ds = dberp.OpenDataSet(sql);
|
||
if (ds.Tables[0].Rows.Count > 0)
|
||
{
|
||
dt.Columns.Add("XLXSJGBMX_XLBZID", typeof(string));
|
||
AddColumn("XLXSJGBMX_XLBZID", "标准", 100);
|
||
dt.Columns.Add("XLXSJGBMX_DYDJID", typeof(string));
|
||
AddColumn("XLXSJGBMX_DYDJID", "电压等级", 100);
|
||
dt.Columns.Add("XLXSJGBMX_XLGGID", typeof(string));
|
||
AddColumn("XLXSJGBMX_XLGGID", "规格", 100);
|
||
string sDctk = "";
|
||
string sStr = "";
|
||
string sXHL = "";
|
||
string sTitle = "";
|
||
int index = 0;
|
||
string sJM = "";
|
||
Dictionary<string, string> myDiction = new Dictionary<string, string>();
|
||
foreach (DataRow row in ds.Tables[0].Rows)
|
||
{
|
||
sJM = row["XLXSJGBMX_XLXHID"].ToString().Trim();
|
||
if (!sJM.Equals(sXHL) && !sTitle.Contains("&" + sJM + "&"))
|
||
{
|
||
|
||
sXHL = row["XLXSJGBMX_XLXHID"].ToString().Trim();
|
||
if (!sTitle.Equals(""))
|
||
sTitle += ",";
|
||
sTitle += "&" + sXHL + "&";
|
||
}
|
||
sDctk = row["XLXSJGBMX_XLBZID"].ToString().Trim() + "," + row["XLXSJGBMX_DYDJID"].ToString().Trim() + "," + row["XLXSJGBMX_XLGGID"].ToString().Trim();
|
||
if (myDiction.ContainsKey(sDctk))
|
||
{
|
||
sStr = myDiction[sDctk];
|
||
if (sHSBJ.Equals("True"))
|
||
{
|
||
double dnum = NumberUtils.RoundX(CMISproConvert.StrToFloat(row["XLXSJGBMX_HSBJ"].ToString().Trim()), iXSWS);
|
||
if(dnum!=0)
|
||
sStr += ",&" + row["XLXSJGBMX_XLXHID"].ToString().Trim() + "&:" + dnum.ToString();
|
||
else
|
||
sStr += ",&" + row["XLXSJGBMX_XLXHID"].ToString().Trim() + "&:";
|
||
|
||
}
|
||
else
|
||
{
|
||
double dnum = NumberUtils.RoundX(CMISproConvert.StrToFloat(row["XLXSJGBMX_WSBJ"].ToString().Trim()), iXSWS);
|
||
if (dnum != 0)
|
||
sStr += ",&" + row["XLXSJGBMX_XLXHID"].ToString().Trim() + "&:" + dnum.ToString();
|
||
else
|
||
sStr += ",&" + row["XLXSJGBMX_XLXHID"].ToString().Trim() + "&:";
|
||
}
|
||
myDiction[sDctk] = sStr;
|
||
}
|
||
else
|
||
{
|
||
sStr = "";
|
||
if (sHSBJ.Equals("True"))
|
||
{
|
||
double dnum = NumberUtils.RoundX(CMISproConvert.StrToFloat(row["XLXSJGBMX_HSBJ"].ToString().Trim()), iXSWS);
|
||
if (dnum != 0)
|
||
sStr += ",&" + row["XLXSJGBMX_XLXHID"].ToString().Trim() + "&:" + dnum.ToString();
|
||
else
|
||
sStr += ",&" + row["XLXSJGBMX_XLXHID"].ToString().Trim() + "&:";
|
||
}
|
||
else
|
||
{
|
||
double dnum = NumberUtils.RoundX(CMISproConvert.StrToFloat(row["XLXSJGBMX_WSBJ"].ToString().Trim()), iXSWS);
|
||
if (dnum != 0)
|
||
sStr += ",&" + row["XLXSJGBMX_XLXHID"].ToString().Trim() + "&:" + dnum.ToString();
|
||
else
|
||
sStr += ",&" + row["XLXSJGBMX_XLXHID"].ToString().Trim() + "&:";
|
||
}
|
||
myDiction.Add(sDctk, sStr);
|
||
}
|
||
}
|
||
sTitle = sTitle.Replace("&", "");
|
||
sTitle = SortTitle(sTitle);
|
||
index = 0;
|
||
Dictionary<string, string> myDiction1 = new Dictionary<string, string>();
|
||
foreach (string strss in sTitle.Split(','))
|
||
{
|
||
dt.Columns.Add("XLXSJGBMX_XLXHID" + index.ToString(), typeof(string));
|
||
AddColumn("XLXSJGBMX_XLXHID" + index.ToString(), strss, 100);
|
||
myDiction1.Add("&" + strss + "&", "");
|
||
index++;
|
||
}
|
||
sTitle = AddSpe(sTitle);
|
||
foreach (KeyValuePair<string, string> kvp in myDiction)
|
||
{
|
||
string mrow = kvp.Key;
|
||
foreach (string skey in sTitle.Split(','))
|
||
{
|
||
myDiction1[skey] = "";
|
||
}
|
||
foreach (string xx in kvp.Value.Split(','))
|
||
{
|
||
string GJR = xx;
|
||
if (myDiction1.ContainsKey(GJR.Split(':')[0]))
|
||
{
|
||
myDiction1[GJR.Split(':')[0]] = GJR.Split(':')[1];
|
||
}
|
||
}
|
||
foreach (string skey in sTitle.Split(','))
|
||
{
|
||
mrow += "," + myDiction1[skey];
|
||
}
|
||
DataRow dtrow = dt.NewRow();
|
||
dtrow.ItemArray = mrow.Split(',');
|
||
dt.Rows.Add(dtrow);
|
||
}
|
||
}
|
||
}
|
||
else if (sXSFS.Equals("2"))
|
||
{
|
||
sql.Clear();
|
||
sql.Add("select distinct XLXSJGBMX_XLXHID,XLXSJGBMX_XLBZID ||'|'||XLBZ_XLBZLXMC as XLXSJGBMX_XLBZID,XLXSJGBMX_XLGGID,XLXSJGBMX_DYDJID,XLXSJGBMX_HSBJ,XLXSJGBMX_WSBJ,XLGGB_XH,XLGGB_XXJGID,XLGGB_DTJMZHID ");
|
||
sql.Add(" from XLXSJGBMX ");
|
||
sql.Add(" left join XLBZ on XLBZ_XLBZID = XLXSJGBMX_XLBZID");
|
||
sql.Add(" left join XLXHB on XLXHB_XLXHID=XLXSJGBMX_XLXHID");
|
||
sql.Add(" left join XLGGB on XLGGB_XLGGID = XLXSJGBMX_XLGGID and XLGGB_XLGGJDGZ = isnull(XLXHB_XLGGJDGZ,'0') ");
|
||
sql.Add(" where 1=1 ");
|
||
|
||
if (sCPMLLX.Equals("Y"))//组合产品目录价格表
|
||
{
|
||
sql.Add(" and " + CMISproDataBase.GetWhereEqual("XLXSJGBMX_JGBID", sJGCIDS));
|
||
}
|
||
else
|
||
{
|
||
sql.Add(" and XLXSJGBMX_JGBID=:pJGBID ");
|
||
sql.ParamByName("pJGBID").Value = sJGBID;
|
||
}
|
||
if (!sXH.Equals(""))
|
||
sql.Add(" and " + CMISproDataBase.GetWhereEqual("XLXSJGBMX_XLXHID", sXH));
|
||
if (!sBZ.Equals(""))
|
||
sql.Add(" and XLXSJGBMX_XLBZID ='" + sBZ + "'");
|
||
if (!sDYDJ.Equals(""))
|
||
sql.Add(" and XLXSJGBMX_DYDJID='" + sDYDJ + "'");
|
||
sql.Add(" order by XLXSJGBMX_XLXHID,XLGGB_XH");
|
||
DataSet ds = dberp.OpenDataSet(sql);
|
||
if (ds.Tables[0].Rows.Count > 0)
|
||
{
|
||
dt.Columns.Add("XLGGB_XXJGID", typeof(string));
|
||
AddColumn("XLGGB_XXJGID", "芯线结构", 100);
|
||
string sDctk = "";
|
||
string sStr = "";
|
||
string sXHL = "";
|
||
string sTitle = "";
|
||
string sJM = "";
|
||
Dictionary<string, string> myDiction = new Dictionary<string, string>();
|
||
foreach (DataRow row in ds.Tables[0].Rows)
|
||
{
|
||
if (row["XLGGB_DTJMZHID"].ToString().Trim().Contains("/"))
|
||
{
|
||
sJM = row["XLGGB_DTJMZHID"].ToString().Trim().Split('/')[0];
|
||
}
|
||
else
|
||
{
|
||
sJM = row["XLGGB_DTJMZHID"].ToString().Trim();
|
||
}
|
||
if (!sJM.Equals(sXHL) && !sTitle.Contains("&" + sJM + "&"))
|
||
{
|
||
if (row["XLGGB_DTJMZHID"].ToString().Trim().Contains("/"))
|
||
{
|
||
sXHL = row["XLGGB_DTJMZHID"].ToString().Trim().Split('/')[0];
|
||
}
|
||
else
|
||
{
|
||
sXHL = row["XLGGB_DTJMZHID"].ToString().Trim();
|
||
}
|
||
if (!sTitle.Equals(""))
|
||
sTitle += ",";
|
||
sTitle += "&" + sXHL + "&";
|
||
}
|
||
sDctk = row["XLGGB_XXJGID"].ToString().Trim();
|
||
if (myDiction.ContainsKey(sDctk))
|
||
{
|
||
sStr = myDiction[sDctk];
|
||
if (sHSBJ.Equals("True"))
|
||
{
|
||
if (!sStr.Contains("&" + sJM + "&"))
|
||
{
|
||
double dnum = NumberUtils.RoundX(CMISproConvert.StrToFloat(row["XLXSJGBMX_HSBJ"].ToString().Trim()), iXSWS);
|
||
sStr += ",&" + sJM + "&:" + dnum.ToString();
|
||
}
|
||
else
|
||
{
|
||
sStr = sStr.Replace("&" + sJM + "&", "&" + sJM + "&*");
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if (!sStr.Contains("&" + sJM + "&"))
|
||
{
|
||
double dnum = NumberUtils.RoundX(CMISproConvert.StrToFloat(row["XLXSJGBMX_WSBJ"].ToString().Trim()), iXSWS);
|
||
sStr += ",&" + sJM + "&:" + dnum.ToString();
|
||
}
|
||
else
|
||
{
|
||
sStr = sStr.Replace("&" + sJM + "&", "&" + sJM + "&*");
|
||
}
|
||
}
|
||
myDiction[sDctk] = sStr;
|
||
}
|
||
else
|
||
{
|
||
sStr = "";
|
||
if (sHSBJ.Equals("True"))
|
||
{
|
||
double dnum = NumberUtils.RoundX(CMISproConvert.StrToFloat(row["XLXSJGBMX_HSBJ"].ToString().Trim()), iXSWS);
|
||
sStr += "&" + sJM + "&:" + dnum.ToString();
|
||
}
|
||
else
|
||
{
|
||
double dnum = NumberUtils.RoundX(CMISproConvert.StrToFloat(row["XLXSJGBMX_WSBJ"].ToString().Trim()), iXSWS);
|
||
sStr += "&" + sJM + "&:" + dnum.ToString();
|
||
}
|
||
myDiction.Add(sDctk, sStr);
|
||
}
|
||
}
|
||
sTitle = SortString(sTitle.Replace("&",""));
|
||
int index = 0;
|
||
Dictionary<string, string> myDiction1 = new Dictionary<string, string>();
|
||
foreach (string strss in sTitle.Split(','))
|
||
{
|
||
dt.Columns.Add("XLGGB_DTJMZHID" + index.ToString(), typeof(string));
|
||
AddColumn("XLGGB_DTJMZHID" + index.ToString(), strss, 100);
|
||
myDiction1.Add("&"+strss+"&","");
|
||
index++;
|
||
}
|
||
sTitle = AddSpe(sTitle);
|
||
foreach (KeyValuePair<string, string> kvp in myDiction)
|
||
{
|
||
string mrow = kvp.Key;
|
||
foreach (string skey in sTitle.Split(','))
|
||
{
|
||
myDiction1[skey] = "";
|
||
}
|
||
foreach (string xx in kvp.Value.Split(','))
|
||
{
|
||
string GJR = xx;
|
||
if (xx.Contains("*"))
|
||
{
|
||
int lenth1 = xx.Length - xx.Replace("*", "").Length;
|
||
GJR=xx.Replace("*", "");
|
||
for (int y = 0; y < lenth1; y++)
|
||
{
|
||
GJR += "*";
|
||
}
|
||
}
|
||
if (myDiction1.ContainsKey(GJR.Split(':')[0]))
|
||
{
|
||
myDiction1[GJR.Split(':')[0]] = GJR.Split(':')[1];
|
||
}
|
||
}
|
||
foreach (string skey in sTitle.Split(','))
|
||
{
|
||
mrow += "," + myDiction1[skey];
|
||
}
|
||
DataRow dtrow = dt.NewRow();
|
||
dtrow.ItemArray = mrow.Split(',');
|
||
dt.Rows.Add(dtrow);
|
||
}
|
||
}
|
||
}
|
||
else if (sXSFS.Equals("3"))
|
||
{
|
||
sql.Clear();
|
||
sql.Add("select distinct XLXSJGBMX_XLXHID,XLXSJGBMX_XLBZID ||'|'||XLBZ_XLBZLXMC as XLXSJGBMX_XLBZID,XLXSJGBMX_XLGGID,XLXSJGBMX_DYDJID,XLXSJGBMX_HSBJ,XLXSJGBMX_WSBJ,XLGGB_XH,XLGGB_XXJGID,XLGGB_DTJMZHID ");
|
||
sql.Add(" from XLXSJGBMX ");
|
||
sql.Add(" left join XLBZ on XLBZ_XLBZID = XLXSJGBMX_XLBZID");
|
||
sql.Add(" left join XLXHB on XLXHB_XLXHID=XLXSJGBMX_XLXHID");
|
||
sql.Add(" left join XLGGB on XLGGB_XLGGID = XLXSJGBMX_XLGGID and XLGGB_XLGGJDGZ = isnull(XLXHB_XLGGJDGZ,'0') ");
|
||
sql.Add(" where 1=1 ");
|
||
if (sCPMLLX.Equals("Y"))//组合产品目录价格表
|
||
{
|
||
sql.Add(" and " + CMISproDataBase.GetWhereEqual("XLXSJGBMX_JGBID", sJGCIDS));
|
||
}
|
||
else
|
||
{
|
||
sql.Add(" and XLXSJGBMX_JGBID=:pJGBID ");
|
||
sql.ParamByName("pJGBID").Value = sJGBID;
|
||
}
|
||
if (!sXH.Equals(""))
|
||
sql.Add(" and " + CMISproDataBase.GetWhereEqual("XLXSJGBMX_XLXHID", sXH));
|
||
if (!sBZ.Equals(""))
|
||
sql.Add(" and XLXSJGBMX_XLBZID ='" + sBZ + "'");
|
||
if (!sDYDJ.Equals(""))
|
||
sql.Add(" and XLXSJGBMX_DYDJID='" + sDYDJ + "'");
|
||
sql.Add(" order by XLXSJGBMX_XLXHID,XLGGB_XH");
|
||
DataSet ds = dberp.OpenDataSet(sql);
|
||
if (ds.Tables[0].Rows.Count > 0)
|
||
{
|
||
int i = 1;
|
||
for (i = 1; i < 6; i++)
|
||
{
|
||
if (sHSBJ.Equals("True"))
|
||
{
|
||
dt.Columns.Add("XLXSJGBMX_XLGGID" + i.ToString(), typeof(string));
|
||
AddColumn("XLXSJGBMX_XLGGID" + i.ToString(), "规格", 100);
|
||
dt.Columns.Add("XLXSJGBMX_HSBJ" + i.ToString(), typeof(string));
|
||
AddColumn("XLXSJGBMX_HSBJ" + i.ToString(), "含税表价", 100);
|
||
}
|
||
else
|
||
{
|
||
dt.Columns.Add("XLXSJGBMX_XLGGID" + i.ToString(), typeof(string));
|
||
AddColumn("XLXSJGBMX_WSBJ" + i.ToString(), "规格", 100);
|
||
dt.Columns.Add("XLXSJGBMX_WSBJ" + i.ToString(), typeof(string));
|
||
AddColumn("XLXSJGBMX_WSBJ" + i.ToString(), "无税表价", 100);
|
||
}
|
||
if (i * i >= ds.Tables[0].Rows.Count)
|
||
break;
|
||
}
|
||
if (i == 6)
|
||
i--;
|
||
string sItems = "";
|
||
int index = 1;
|
||
int max = ds.Tables[0].Rows.Count / i;
|
||
if ((ds.Tables[0].Rows.Count % i) > 0)
|
||
max++;
|
||
max++;
|
||
string[] ssss = new string[i];
|
||
int ssindex = 0;
|
||
DataRow dtrow;
|
||
foreach (DataRow row in ds.Tables[0].Rows)
|
||
{
|
||
if (index == max)
|
||
{
|
||
index = 1;
|
||
ssss[ssindex] = sItems;
|
||
ssindex++;
|
||
sItems = "";
|
||
}
|
||
if (!sItems.Equals(""))
|
||
{
|
||
sItems += ",";
|
||
}
|
||
if (sHSBJ.Equals("True"))
|
||
{
|
||
double dnum = NumberUtils.RoundX(CMISproConvert.StrToFloat(row["XLXSJGBMX_HSBJ"].ToString().Trim()), iXSWS);
|
||
sItems += row["XLXSJGBMX_XLGGID"].ToString().Trim() + ":" + dnum.ToString();
|
||
}
|
||
else
|
||
{
|
||
double dnum = NumberUtils.RoundX(CMISproConvert.StrToFloat(row["XLXSJGBMX_WSBJ"].ToString().Trim()), iXSWS);
|
||
sItems += row["XLXSJGBMX_XLGGID"].ToString().Trim() + ":" + dnum.ToString();
|
||
}
|
||
index++;
|
||
}
|
||
if (index == max)
|
||
{
|
||
ssss[ssindex] = sItems;
|
||
}
|
||
else
|
||
{
|
||
for (int x = 0; x < max - index; x++)
|
||
{
|
||
sItems += ",:";
|
||
}
|
||
ssss[ssindex] = sItems;
|
||
}
|
||
|
||
for (int j = 0; j < max - 1; j++)
|
||
{
|
||
dtrow = dt.NewRow();
|
||
string strs = "";
|
||
string strss = "";
|
||
for (int x = 0; x < i; x++)
|
||
{
|
||
if ((x + 1) == i)
|
||
{
|
||
strs = ssss[x].Split(',')[j];
|
||
strss += strs.Split(':')[0] + "," + strs.Split(':')[1];
|
||
}
|
||
else
|
||
{
|
||
strs = ssss[x].Split(',')[j];
|
||
strss += strs.Split(':')[0] + "," + strs.Split(':')[1] + ",";
|
||
}
|
||
}
|
||
dtrow.ItemArray = strss.Split(',');
|
||
dt.Rows.Add(dtrow);
|
||
}
|
||
|
||
}
|
||
}
|
||
DataSet dss = new DataSet();
|
||
dss.Tables.Add(dt);
|
||
return dss;
|
||
}
|
||
|
||
|
||
private DataSet GetTable()
|
||
{
|
||
grdContentGrid.Columns.Clear();
|
||
|
||
int iXSWS = string.IsNullOrEmpty(GetOption(100860037, "BJU002")) ? 5 : CMISproConvert.StrToInt(GetOption(100860037, "BJU002"));
|
||
if (iXSWS < 0)
|
||
iXSWS = 0;
|
||
else if (iXSWS > 8)
|
||
iXSWS = 8;
|
||
string sFL = CurQueryEntity.FieldByName("FL").Value.Trim();
|
||
string sJGBID = CurQueryEntity.FieldByName("JGB").Value.Trim();
|
||
string sXSFS = CurQueryEntity.FieldByName("XSFS").Value.Trim();
|
||
string sXH = CurQueryEntity.FieldByName("XH").Value.Trim();
|
||
string sBZ = CurQueryEntity.FieldByName("BZ").Value.Trim();
|
||
string sDYDJ = CurQueryEntity.FieldByName("DYDJ").Value.Trim();
|
||
string sHSBJ = CurQueryEntity.FieldByName("HSBJ").Value.Trim();
|
||
pFL = sFL;
|
||
pJGBID = sJGBID;
|
||
pXSFS = sXSFS;
|
||
pXH = sXH;
|
||
pBZ = sBZ;
|
||
pDYDJ = sDYDJ;
|
||
pHSBJ = sHSBJ;
|
||
|
||
Dictionary<string, int> dicXHLM = new Dictionary<string, int>();
|
||
string[] sXHList = sXH.Split(',');
|
||
int LMBH=1;
|
||
for (int i = 0; i < sXHList.Length; i++)
|
||
{
|
||
if (!dicXHLM.ContainsKey(sXHList[i]))
|
||
{
|
||
dicXHLM.Add(sXHList[i], LMBH++);
|
||
}
|
||
}
|
||
|
||
|
||
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
|
||
TSQL sql = new TSQL(dberp);
|
||
sql.Clear();
|
||
sql.Add("select XLXSCPML_CPMLLX,XLXSJGB_JGCIDS");
|
||
sql.Add(" from XLXSJGB");
|
||
sql.Add(" left join XLXSCPML on XLXSCPML_CPMLID=XLXSJGB_CPMLID");
|
||
sql.Add(" where XLXSJGB_MXBH=:pMXBH and XLXSJGB_JGBID=:pJGBID");
|
||
sql.ParamByName("pMXBH").Value = sFL;
|
||
sql.ParamByName("pJGBID").Value = sJGBID;
|
||
DataSet dsJGB = dberp.OpenDataSet(sql);
|
||
string sCPMLLX = "";
|
||
string sJGCIDS = "";
|
||
if (dsJGB.Tables[0].Rows.Count > 0)
|
||
{
|
||
sCPMLLX = dsJGB.Tables[0].Rows[0]["XLXSCPML_CPMLLX"].ToString().Trim();
|
||
sJGCIDS = dsJGB.Tables[0].Rows[0]["XLXSJGB_JGCIDS"].ToString().Trim();
|
||
}
|
||
|
||
DataTable dt = new DataTable();
|
||
if (sXSFS.Equals("1"))
|
||
{
|
||
sql.Clear();
|
||
sql.Add("select rtrim(XLBZID)+'|'+rtrim(XLBZ_XLBZLXMC) as XLBZID, DYDJID,XLGGID ");
|
||
foreach(string skey in dicXHLM.Keys)
|
||
{
|
||
sql.Add(string.Format(",HSBJ{0},WSBJ{0} ",dicXHLM[skey].ToString().PadLeft(4,'0')));
|
||
}
|
||
|
||
sql.Add(" from ( ");
|
||
sql.Add(" select XLXSJGBMX_XLBZID as XLBZID,XLXSJGBMX_DYDJID as DYDJID,XLXSJGBMX_XLGGID as XLGGID, min(isnull(XLXHB_XLGGJDGZ,'0')) as XLGGJDGZ ");
|
||
foreach (string skey in dicXHLM.Keys)
|
||
{
|
||
sql.Add(string.Format(",sum(case when XLXSJGBMX_XLXHID='{1}' then XLXSJGBMX_HSBJ else 0 end) as HSBJ{0},sum(case when XLXSJGBMX_XLXHID='{1}' then XLXSJGBMX_WSBJ else 0 end) as WSBJ{0} ", dicXHLM[skey].ToString().PadLeft(4, '0'),skey));
|
||
}
|
||
sql.Add(" from XLXSJGBMX ");
|
||
sql.Add(" left join XLXHB on XLXHB_XLXHID=XLXSJGBMX_XLXHID ");
|
||
sql.Add(" where 1=1 ");
|
||
if (sCPMLLX.Equals("Y"))//组合产品目录价格表
|
||
{
|
||
sql.Add(" and " + CMISproDataBase.GetWhereEqual("XLXSJGBMX_JGBID", sJGCIDS));
|
||
}
|
||
else
|
||
{
|
||
sql.Add(" and XLXSJGBMX_JGBID=:pJGBID ");
|
||
sql.ParamByName("pJGBID").Value = sJGBID;
|
||
}
|
||
if (!sXH.Equals(""))
|
||
sql.Add(" and " + CMISproDataBase.GetWhereEqual("XLXSJGBMX_XLXHID", sXH));
|
||
if (!sBZ.Equals(""))
|
||
sql.Add(" and XLXSJGBMX_XLBZID ='" + sBZ + "'");
|
||
if (!sDYDJ.Equals(""))
|
||
sql.Add(" and XLXSJGBMX_DYDJID='" + sDYDJ + "'");
|
||
|
||
sql.Add(" group by XLXSJGBMX_XLBZID,XLXSJGBMX_XLGGID,XLXSJGBMX_DYDJID ) a ");
|
||
sql.Add(" left join XLBZ on XLBZ_XLBZID = XLBZID ");
|
||
sql.Add(" left join XLGGB on XLGGB_XLGGID = XLGGID and XLGGB_XLGGJDGZ = XLGGJDGZ ");
|
||
sql.Add(" left join XLDYDJB on XLDYDJB_DYDJID = DYDJID ");
|
||
|
||
sql.Add(" order by XLBZID,XLGGB_XH,XLDYDJB_XH,DYDJID ");
|
||
DataSet ds = dberp.OpenDataSet(sql);
|
||
if (ds.Tables[0].Rows.Count > 0)
|
||
{
|
||
dt.Columns.Add("XLXSJGBMX_XLBZID", typeof(string));
|
||
AddColumn("XLXSJGBMX_XLBZID", "标准", 100);
|
||
dt.Columns.Add("XLXSJGBMX_DYDJID", typeof(string));
|
||
AddColumn("XLXSJGBMX_DYDJID", "电压等级", 100);
|
||
dt.Columns.Add("XLXSJGBMX_XLGGID", typeof(string));
|
||
AddColumn("XLXSJGBMX_XLGGID", "规格", 100);
|
||
string sDctk = "";
|
||
string sStr = "";
|
||
string sXHL = "";
|
||
string sTitle = "";
|
||
int index = 0;
|
||
string sJM = "";
|
||
Dictionary<string, string> myDiction = new Dictionary<string, string>();
|
||
foreach (DataRow row in ds.Tables[0].Rows)
|
||
{
|
||
foreach (string skey in dicXHLM.Keys)
|
||
{
|
||
sJM = skey;
|
||
if (!sJM.Equals(sXHL) && !sTitle.Contains("&" + sJM + "&"))
|
||
{
|
||
|
||
sXHL = skey;
|
||
if (!sTitle.Equals(""))
|
||
sTitle += ",";
|
||
sTitle += "&" + sXHL + "&";
|
||
}
|
||
sDctk = row["XLBZID"].ToString().Trim() + "," + row["DYDJID"].ToString().Trim() + "," + row["XLGGID"].ToString().Trim();
|
||
if (myDiction.ContainsKey(sDctk))
|
||
{
|
||
sStr = myDiction[sDctk];
|
||
if (sHSBJ.Equals("True"))
|
||
{
|
||
double dnum = NumberUtils.RoundX(CMISproConvert.StrToFloat(row["HSBJ" + dicXHLM[skey].ToString().PadLeft(4,'0')].ToString().Trim()), iXSWS);
|
||
if (dnum != 0)
|
||
sStr += ",&" + skey + "&:" + dnum.ToString();
|
||
else
|
||
sStr += ",&" + skey + "&:";
|
||
}
|
||
else
|
||
{
|
||
double dnum = NumberUtils.RoundX(CMISproConvert.StrToFloat(row["WSBJ" + dicXHLM[skey].ToString().PadLeft(4, '0')].ToString().Trim()), iXSWS);
|
||
if (dnum != 0)
|
||
sStr += ",&" + skey + "&:" + dnum.ToString();
|
||
else
|
||
sStr += ",&" + skey + "&:";
|
||
}
|
||
myDiction[sDctk] = sStr;
|
||
}
|
||
else
|
||
{
|
||
sStr = "";
|
||
if (sHSBJ.Equals("True"))
|
||
{
|
||
double dnum = NumberUtils.RoundX(CMISproConvert.StrToFloat(row["HSBJ" + dicXHLM[skey].ToString().PadLeft(4, '0')].ToString().Trim()), iXSWS);
|
||
if (dnum != 0)
|
||
sStr += ",&" + skey + "&:" + dnum.ToString();
|
||
else
|
||
sStr += ",&" + skey + "&:";
|
||
}
|
||
else
|
||
{
|
||
double dnum = NumberUtils.RoundX(CMISproConvert.StrToFloat(row["WSBJ" + dicXHLM[skey].ToString().PadLeft(4, '0')].ToString().Trim()), iXSWS);
|
||
if (dnum != 0)
|
||
sStr += ",&" + skey + "&:" + dnum.ToString();
|
||
else
|
||
sStr += ",&" + skey + "&:";
|
||
}
|
||
myDiction.Add(sDctk, sStr);
|
||
}
|
||
}
|
||
|
||
|
||
}
|
||
sTitle = sTitle.Replace("&", "");
|
||
sTitle = SortTitle(sTitle);
|
||
index = 0;
|
||
Dictionary<string, string> myDiction1 = new Dictionary<string, string>();
|
||
foreach (string strss in sTitle.Split(','))
|
||
{
|
||
dt.Columns.Add("XLXSJGBMX_XLXHID" + index.ToString(), typeof(string));
|
||
AddColumn2("XLXSJGBMX_XLXHID" + index.ToString(), strss, 100);
|
||
myDiction1.Add("&" + strss + "&", "");
|
||
index++;
|
||
}
|
||
sTitle = AddSpe(sTitle);
|
||
foreach (KeyValuePair<string, string> kvp in myDiction)
|
||
{
|
||
string mrow = kvp.Key;
|
||
foreach (string skey in sTitle.Split(','))
|
||
{
|
||
myDiction1[skey] = "";
|
||
}
|
||
foreach (string xx in kvp.Value.Split(','))
|
||
{
|
||
string GJR = xx;
|
||
if (myDiction1.ContainsKey(GJR.Split(':')[0]))
|
||
{
|
||
myDiction1[GJR.Split(':')[0]] = GJR.Split(':')[1];
|
||
}
|
||
}
|
||
foreach (string skey in sTitle.Split(','))
|
||
{
|
||
mrow += "," + myDiction1[skey];
|
||
}
|
||
DataRow dtrow = dt.NewRow();
|
||
dtrow.ItemArray = mrow.Split(',');
|
||
dt.Rows.Add(dtrow);
|
||
}
|
||
}
|
||
}
|
||
else if (sXSFS.Equals("2"))
|
||
{
|
||
sql.Clear();
|
||
sql.Add("select distinct XLXSJGBMX_XLXHID,XLXSJGBMX_XLBZID ||'|'||XLBZ_XLBZLXMC as XLXSJGBMX_XLBZID,XLXSJGBMX_XLGGID,XLXSJGBMX_DYDJID,XLXSJGBMX_HSBJ,XLXSJGBMX_WSBJ,XLGGB_XH,XLGGB_XXJGID,XLGGB_DTJMZHID ");
|
||
sql.Add(" from XLXSJGBMX ");
|
||
sql.Add(" left join XLBZ on XLBZ_XLBZID = XLXSJGBMX_XLBZID");
|
||
sql.Add(" left join XLXHB on XLXHB_XLXHID=XLXSJGBMX_XLXHID");
|
||
sql.Add(" left join XLGGB on XLGGB_XLGGID = XLXSJGBMX_XLGGID and XLGGB_XLGGJDGZ = isnull(XLXHB_XLGGJDGZ,'0') ");
|
||
sql.Add(" where 1=1 ");
|
||
|
||
if (sCPMLLX.Equals("Y"))//组合产品目录价格表
|
||
{
|
||
sql.Add(" and " + CMISproDataBase.GetWhereEqual("XLXSJGBMX_JGBID", sJGCIDS));
|
||
}
|
||
else
|
||
{
|
||
sql.Add(" and XLXSJGBMX_JGBID=:pJGBID ");
|
||
sql.ParamByName("pJGBID").Value = sJGBID;
|
||
}
|
||
if (!sXH.Equals(""))
|
||
sql.Add(" and " + CMISproDataBase.GetWhereEqual("XLXSJGBMX_XLXHID", sXH));
|
||
if (!sBZ.Equals(""))
|
||
sql.Add(" and XLXSJGBMX_XLBZID ='" + sBZ + "'");
|
||
if (!sDYDJ.Equals(""))
|
||
sql.Add(" and XLXSJGBMX_DYDJID='" + sDYDJ + "'");
|
||
sql.Add(" order by XLXSJGBMX_XLXHID,XLGGB_XH");
|
||
DataSet ds = dberp.OpenDataSet(sql);
|
||
if (ds.Tables[0].Rows.Count > 0)
|
||
{
|
||
dt.Columns.Add("XLGGB_XXJGID", typeof(string));
|
||
AddColumn("XLGGB_XXJGID", "芯线结构", 100);
|
||
string sDctk = "";
|
||
string sStr = "";
|
||
string sXHL = "";
|
||
string sTitle = "";
|
||
string sJM = "";
|
||
Dictionary<string, string> myDiction = new Dictionary<string, string>();
|
||
foreach (DataRow row in ds.Tables[0].Rows)
|
||
{
|
||
if (row["XLGGB_DTJMZHID"].ToString().Trim().Contains("/"))
|
||
{
|
||
sJM = row["XLGGB_DTJMZHID"].ToString().Trim().Split('/')[0];
|
||
}
|
||
else
|
||
{
|
||
sJM = row["XLGGB_DTJMZHID"].ToString().Trim();
|
||
}
|
||
if (!sJM.Equals(sXHL) && !sTitle.Contains("&" + sJM + "&"))
|
||
{
|
||
if (row["XLGGB_DTJMZHID"].ToString().Trim().Contains("/"))
|
||
{
|
||
sXHL = row["XLGGB_DTJMZHID"].ToString().Trim().Split('/')[0];
|
||
}
|
||
else
|
||
{
|
||
sXHL = row["XLGGB_DTJMZHID"].ToString().Trim();
|
||
}
|
||
if (!sTitle.Equals(""))
|
||
sTitle += ",";
|
||
sTitle += "&" + sXHL + "&";
|
||
}
|
||
sDctk = row["XLGGB_XXJGID"].ToString().Trim();
|
||
if (myDiction.ContainsKey(sDctk))
|
||
{
|
||
sStr = myDiction[sDctk];
|
||
if (sHSBJ.Equals("True"))
|
||
{
|
||
if (!sStr.Contains("&" + sJM + "&"))
|
||
{
|
||
double dnum = NumberUtils.RoundX(CMISproConvert.StrToFloat(row["XLXSJGBMX_HSBJ"].ToString().Trim()), iXSWS);
|
||
sStr += ",&" + sJM + "&:" + dnum.ToString();
|
||
}
|
||
else
|
||
{
|
||
sStr = sStr.Replace("&" + sJM + "&", "&" + sJM + "&*");
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if (!sStr.Contains("&" + sJM + "&"))
|
||
{
|
||
double dnum = NumberUtils.RoundX(CMISproConvert.StrToFloat(row["XLXSJGBMX_WSBJ"].ToString().Trim()), iXSWS);
|
||
sStr += ",&" + sJM + "&:" + dnum.ToString();
|
||
}
|
||
else
|
||
{
|
||
sStr = sStr.Replace("&" + sJM + "&", "&" + sJM + "&*");
|
||
}
|
||
}
|
||
myDiction[sDctk] = sStr;
|
||
}
|
||
else
|
||
{
|
||
sStr = "";
|
||
if (sHSBJ.Equals("True"))
|
||
{
|
||
double dnum = NumberUtils.RoundX(CMISproConvert.StrToFloat(row["XLXSJGBMX_HSBJ"].ToString().Trim()), iXSWS);
|
||
sStr += "&" + sJM + "&:" + dnum.ToString();
|
||
}
|
||
else
|
||
{
|
||
double dnum = NumberUtils.RoundX(CMISproConvert.StrToFloat(row["XLXSJGBMX_WSBJ"].ToString().Trim()), iXSWS);
|
||
sStr += "&" + sJM + "&:" + dnum.ToString();
|
||
}
|
||
myDiction.Add(sDctk, sStr);
|
||
}
|
||
}
|
||
sTitle = SortString(sTitle.Replace("&", ""));
|
||
int index = 0;
|
||
Dictionary<string, string> myDiction1 = new Dictionary<string, string>();
|
||
foreach (string strss in sTitle.Split(','))
|
||
{
|
||
dt.Columns.Add("XLGGB_DTJMZHID" + index.ToString(), typeof(string));
|
||
AddColumn("XLGGB_DTJMZHID" + index.ToString(), strss, 100);
|
||
myDiction1.Add("&" + strss + "&", "");
|
||
index++;
|
||
}
|
||
sTitle = AddSpe(sTitle);
|
||
foreach (KeyValuePair<string, string> kvp in myDiction)
|
||
{
|
||
string mrow = kvp.Key;
|
||
foreach (string skey in sTitle.Split(','))
|
||
{
|
||
myDiction1[skey] = "";
|
||
}
|
||
foreach (string xx in kvp.Value.Split(','))
|
||
{
|
||
string GJR = xx;
|
||
if (xx.Contains("*"))
|
||
{
|
||
int lenth1 = xx.Length - xx.Replace("*", "").Length;
|
||
GJR = xx.Replace("*", "");
|
||
for (int y = 0; y < lenth1; y++)
|
||
{
|
||
GJR += "*";
|
||
}
|
||
}
|
||
if (myDiction1.ContainsKey(GJR.Split(':')[0]))
|
||
{
|
||
myDiction1[GJR.Split(':')[0]] = GJR.Split(':')[1];
|
||
}
|
||
}
|
||
foreach (string skey in sTitle.Split(','))
|
||
{
|
||
mrow += "," + myDiction1[skey];
|
||
}
|
||
DataRow dtrow = dt.NewRow();
|
||
dtrow.ItemArray = mrow.Split(',');
|
||
dt.Rows.Add(dtrow);
|
||
}
|
||
}
|
||
}
|
||
else if (sXSFS.Equals("3"))
|
||
{
|
||
sql.Clear();
|
||
sql.Add("select distinct XLXSJGBMX_XLXHID,XLXSJGBMX_XLBZID ||'|'||XLBZ_XLBZLXMC as XLXSJGBMX_XLBZID,XLXSJGBMX_XLGGID,XLXSJGBMX_DYDJID,XLXSJGBMX_HSBJ,XLXSJGBMX_WSBJ,XLGGB_XH,XLGGB_XXJGID,XLGGB_DTJMZHID ");
|
||
sql.Add(" from XLXSJGBMX ");
|
||
sql.Add(" left join XLBZ on XLBZ_XLBZID = XLXSJGBMX_XLBZID");
|
||
sql.Add(" left join XLXHB on XLXHB_XLXHID=XLXSJGBMX_XLXHID");
|
||
sql.Add(" left join XLGGB on XLGGB_XLGGID = XLXSJGBMX_XLGGID and XLGGB_XLGGJDGZ = isnull(XLXHB_XLGGJDGZ,'0') ");
|
||
sql.Add(" where 1=1 ");
|
||
if (sCPMLLX.Equals("Y"))//组合产品目录价格表
|
||
{
|
||
sql.Add(" and " + CMISproDataBase.GetWhereEqual("XLXSJGBMX_JGBID", sJGCIDS));
|
||
}
|
||
else
|
||
{
|
||
sql.Add(" and XLXSJGBMX_JGBID=:pJGBID ");
|
||
sql.ParamByName("pJGBID").Value = sJGBID;
|
||
}
|
||
if (!sXH.Equals(""))
|
||
sql.Add(" and " + CMISproDataBase.GetWhereEqual("XLXSJGBMX_XLXHID", sXH));
|
||
if (!sBZ.Equals(""))
|
||
sql.Add(" and XLXSJGBMX_XLBZID ='" + sBZ + "'");
|
||
if (!sDYDJ.Equals(""))
|
||
sql.Add(" and XLXSJGBMX_DYDJID='" + sDYDJ + "'");
|
||
sql.Add(" order by XLXSJGBMX_XLXHID,XLGGB_XH");
|
||
DataSet ds = dberp.OpenDataSet(sql);
|
||
if (ds.Tables[0].Rows.Count > 0)
|
||
{
|
||
int i = 1;
|
||
for (i = 1; i < 6; i++)
|
||
{
|
||
if (sHSBJ.Equals("True"))
|
||
{
|
||
dt.Columns.Add("XLXSJGBMX_XLGGID" + i.ToString(), typeof(string));
|
||
AddColumn("XLXSJGBMX_XLGGID" + i.ToString(), "规格", 100);
|
||
dt.Columns.Add("XLXSJGBMX_HSBJ" + i.ToString(), typeof(string));
|
||
AddColumn("XLXSJGBMX_HSBJ" + i.ToString(), "含税表价", 100);
|
||
}
|
||
else
|
||
{
|
||
dt.Columns.Add("XLXSJGBMX_XLGGID" + i.ToString(), typeof(string));
|
||
AddColumn("XLXSJGBMX_WSBJ" + i.ToString(), "规格", 100);
|
||
dt.Columns.Add("XLXSJGBMX_WSBJ" + i.ToString(), typeof(string));
|
||
AddColumn("XLXSJGBMX_WSBJ" + i.ToString(), "无税表价", 100);
|
||
}
|
||
if (i * i >= ds.Tables[0].Rows.Count)
|
||
break;
|
||
}
|
||
if (i == 6)
|
||
i--;
|
||
string sItems = "";
|
||
int index = 1;
|
||
int max = ds.Tables[0].Rows.Count / i;
|
||
if ((ds.Tables[0].Rows.Count % i) > 0)
|
||
max++;
|
||
max++;
|
||
string[] ssss = new string[i];
|
||
int ssindex = 0;
|
||
DataRow dtrow;
|
||
foreach (DataRow row in ds.Tables[0].Rows)
|
||
{
|
||
if (index == max)
|
||
{
|
||
index = 1;
|
||
ssss[ssindex] = sItems;
|
||
ssindex++;
|
||
sItems = "";
|
||
}
|
||
if (!sItems.Equals(""))
|
||
{
|
||
sItems += ",";
|
||
}
|
||
if (sHSBJ.Equals("True"))
|
||
{
|
||
double dnum = NumberUtils.RoundX(CMISproConvert.StrToFloat(row["XLXSJGBMX_HSBJ"].ToString().Trim()), iXSWS);
|
||
sItems += row["XLXSJGBMX_XLGGID"].ToString().Trim() + ":" + dnum.ToString();
|
||
}
|
||
else
|
||
{
|
||
double dnum = NumberUtils.RoundX(CMISproConvert.StrToFloat(row["XLXSJGBMX_WSBJ"].ToString().Trim()), iXSWS);
|
||
sItems += row["XLXSJGBMX_XLGGID"].ToString().Trim() + ":" + dnum.ToString();
|
||
}
|
||
index++;
|
||
}
|
||
if (index == max)
|
||
{
|
||
ssss[ssindex] = sItems;
|
||
}
|
||
else
|
||
{
|
||
for (int x = 0; x < max - index; x++)
|
||
{
|
||
sItems += ",:";
|
||
}
|
||
ssss[ssindex] = sItems;
|
||
}
|
||
|
||
for (int j = 0; j < max - 1; j++)
|
||
{
|
||
dtrow = dt.NewRow();
|
||
string strs = "";
|
||
string strss = "";
|
||
for (int x = 0; x < i; x++)
|
||
{
|
||
if ((x + 1) == i)
|
||
{
|
||
strs = ssss[x].Split(',')[j];
|
||
strss += strs.Split(':')[0] + "," + strs.Split(':')[1];
|
||
}
|
||
else
|
||
{
|
||
strs = ssss[x].Split(',')[j];
|
||
strss += strs.Split(':')[0] + "," + strs.Split(':')[1] + ",";
|
||
}
|
||
}
|
||
dtrow.ItemArray = strss.Split(',');
|
||
dt.Rows.Add(dtrow);
|
||
}
|
||
|
||
}
|
||
}
|
||
DataSet dss = new DataSet();
|
||
dss.Tables.Add(dt);
|
||
return dss;
|
||
}
|
||
|
||
|
||
private string Getfield()
|
||
{
|
||
string Restr = "";
|
||
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
|
||
TSQL sql = new TSQL(dberp);
|
||
sql.Clear();
|
||
sql.Add("select XLXSCPML_CPMLLX,XLXSJGB_JGCIDS");
|
||
sql.Add(" from XLXSJGB");
|
||
sql.Add(" left join XLXSCPML on XLXSCPML_CPMLID=XLXSJGB_CPMLID");
|
||
sql.Add(" where XLXSJGB_MXBH=:pMXBH and XLXSJGB_JGBID=:pJGBID");
|
||
sql.ParamByName("pMXBH").Value = pFL;
|
||
sql.ParamByName("pJGBID").Value = pJGBID;
|
||
DataSet dsJGB = dberp.OpenDataSet(sql);
|
||
string sCPMLLX = "";
|
||
string sJGCIDS = "";
|
||
if (dsJGB.Tables[0].Rows.Count > 0)
|
||
{
|
||
sCPMLLX = dsJGB.Tables[0].Rows[0]["XLXSCPML_CPMLLX"].ToString().Trim();
|
||
sJGCIDS = dsJGB.Tables[0].Rows[0]["XLXSJGB_JGCIDS"].ToString().Trim();
|
||
}
|
||
if (pXSFS.Equals("1"))
|
||
{
|
||
sql.Clear();
|
||
sql.Add("select distinct XLXSJGBMX_XLXHID,XLXSJGBMX_XLBZID ||'|'||XLBZ_XLBZLXMC as XLXSJGBMX_XLBZID,XLXSJGBMX_XLGGID,XLXSJGBMX_DYDJID,XLXSJGBMX_HSBJ,XLXSJGBMX_WSBJ,XLGGB_XH,XLGGB_XXJGID,XLGGB_DTJMZHID ");
|
||
sql.Add(" from XLXSJGBMX ");
|
||
sql.Add(" left join XLBZ on XLBZ_XLBZID = XLXSJGBMX_XLBZID");
|
||
sql.Add(" left join XLXHB on XLXHB_XLXHID=XLXSJGBMX_XLXHID");
|
||
sql.Add(" left join XLGGB on XLGGB_XLGGID = XLXSJGBMX_XLGGID and XLGGB_XLGGJDGZ = isnull(XLXHB_XLGGJDGZ,'0') ");
|
||
sql.Add(" where 1=1 ");
|
||
if (sCPMLLX.Equals("Y"))//组合产品目录价格表
|
||
{
|
||
sql.Add(" and " + CMISproDataBase.GetWhereEqual("XLXSJGBMX_JGBID", sJGCIDS));
|
||
}
|
||
else
|
||
{
|
||
sql.Add(" and XLXSJGBMX_JGBID=:pJGBID ");
|
||
sql.ParamByName("pJGBID").Value = pJGBID;
|
||
}
|
||
if (!pXH.Equals(""))
|
||
sql.Add(" and " + CMISproDataBase.GetWhereEqual("XLXSJGBMX_XLXHID", pXH));
|
||
if (!pBZ.Equals(""))
|
||
sql.Add(" and XLXSJGBMX_XLBZID ='" + pBZ + "'");
|
||
if (!pDYDJ.Equals(""))
|
||
sql.Add(" and XLXSJGBMX_DYDJID='" + pDYDJ + "'");
|
||
sql.Add(" order by XLXSJGBMX_XLXHID,XLGGB_XH");
|
||
DataSet ds = dberp.OpenDataSet(sql);
|
||
if (ds.Tables[0].Rows.Count > 0)
|
||
{
|
||
Restr += "XLXSJGBMX_XLBZID,标准;XLXSJGBMX_DYDJID,电压等级;XLXSJGBMX_XLGGID,规格";
|
||
string sXHL = "";
|
||
string sTitle = "";
|
||
int index = 0;
|
||
string sJM = "";
|
||
Dictionary<string, string> myDiction = new Dictionary<string, string>();
|
||
foreach (DataRow row in ds.Tables[0].Rows)
|
||
{
|
||
sJM = row["XLXSJGBMX_XLXHID"].ToString().Trim();
|
||
if (!sJM.Equals(sXHL) && !sTitle.Contains("&" + sJM + "&"))
|
||
{
|
||
|
||
sXHL = row["XLXSJGBMX_XLXHID"].ToString().Trim();
|
||
if (!sTitle.Equals(""))
|
||
sTitle += ",";
|
||
sTitle += "&" + sXHL + "&";
|
||
}
|
||
}
|
||
sTitle = sTitle.Replace("&", "");
|
||
sTitle = SortTitle(sTitle);
|
||
index = 0;
|
||
foreach (string strss in sTitle.Split(','))
|
||
{
|
||
Restr += ";" + "XLXSJGBMX_XLXHID" + index.ToString() + "," + strss;
|
||
index++;
|
||
}
|
||
}
|
||
}
|
||
else if (pXSFS.Equals("2"))
|
||
{
|
||
sql.Clear();
|
||
sql.Add("select distinct XLXSJGBMX_XLXHID,XLXSJGBMX_XLBZID ||'|'||XLBZ_XLBZLXMC as XLXSJGBMX_XLBZID,XLXSJGBMX_XLGGID,XLXSJGBMX_DYDJID,XLXSJGBMX_HSBJ,XLXSJGBMX_WSBJ,XLGGB_XH,XLGGB_XXJGID,XLGGB_DTJMZHID ");
|
||
sql.Add(" from XLXSJGBMX ");
|
||
sql.Add(" left join XLBZ on XLBZ_XLBZID = XLXSJGBMX_XLBZID");
|
||
sql.Add(" left join XLXHB on XLXHB_XLXHID=XLXSJGBMX_XLXHID");
|
||
sql.Add(" left join XLGGB on XLGGB_XLGGID = XLXSJGBMX_XLGGID and XLGGB_XLGGJDGZ = isnull(XLXHB_XLGGJDGZ,'0') ");
|
||
sql.Add(" where 1=1 ");
|
||
if (sCPMLLX.Equals("Y"))//组合产品目录价格表
|
||
{
|
||
sql.Add(" and " + CMISproDataBase.GetWhereEqual("XLXSJGBMX_JGBID", sJGCIDS));
|
||
}
|
||
else
|
||
{
|
||
sql.Add(" and XLXSJGBMX_JGBID=:pJGBID ");
|
||
sql.ParamByName("pJGBID").Value = pJGBID;
|
||
}
|
||
if (!pXH.Equals(""))
|
||
sql.Add(" and " + CMISproDataBase.GetWhereEqual("XLXSJGBMX_XLXHID", pXH));
|
||
if (!pBZ.Equals(""))
|
||
sql.Add(" and XLXSJGBMX_XLBZID ='" + pBZ + "'");
|
||
if (!pDYDJ.Equals(""))
|
||
sql.Add(" and XLXSJGBMX_DYDJID='" + pDYDJ + "'");
|
||
sql.Add(" order by XLXSJGBMX_XLXHID,XLGGB_XH");
|
||
DataSet ds = dberp.OpenDataSet(sql);
|
||
if (ds.Tables[0].Rows.Count > 0)
|
||
{
|
||
Restr += "XLGGB_XXJGID,芯线结构";
|
||
string sXHL = "";
|
||
string sTitle = "";
|
||
string sJM = "";
|
||
foreach (DataRow row in ds.Tables[0].Rows)
|
||
{
|
||
if (row["XLGGB_DTJMZHID"].ToString().Trim().Contains("/"))
|
||
{
|
||
sJM = row["XLGGB_DTJMZHID"].ToString().Trim().Split('/')[0];
|
||
}
|
||
else
|
||
{
|
||
sJM = row["XLGGB_DTJMZHID"].ToString().Trim();
|
||
}
|
||
if (!sJM.Equals(sXHL) && !sTitle.Contains("&" + sJM + "&"))
|
||
{
|
||
if (row["XLGGB_DTJMZHID"].ToString().Trim().Contains("/"))
|
||
{
|
||
sXHL = row["XLGGB_DTJMZHID"].ToString().Trim().Split('/')[0];
|
||
}
|
||
else
|
||
{
|
||
sXHL = row["XLGGB_DTJMZHID"].ToString().Trim();
|
||
}
|
||
if (!sTitle.Equals(""))
|
||
sTitle += ",";
|
||
sTitle += "&" + sXHL + "&";
|
||
}
|
||
}
|
||
sTitle = SortString(sTitle.Replace("&", ""));
|
||
int index = 0;
|
||
foreach (string strss in sTitle.Split(','))
|
||
{
|
||
Restr += ";" + "XLGGB_DTJMZHID" + index.ToString() + "," + strss;
|
||
index++;
|
||
}
|
||
}
|
||
}
|
||
else if (pXSFS.Equals("3"))
|
||
{
|
||
sql.Clear();
|
||
sql.Add("select distinct XLXSJGBMX_XLXHID,XLXSJGBMX_XLBZID ||'|'||XLBZ_XLBZLXMC as XLXSJGBMX_XLBZID,XLXSJGBMX_XLGGID,XLXSJGBMX_DYDJID,XLXSJGBMX_HSBJ,XLXSJGBMX_WSBJ,XLGGB_XH,XLGGB_XXJGID,XLGGB_DTJMZHID ");
|
||
sql.Add(" from XLXSJGBMX ");
|
||
sql.Add(" left join XLBZ on XLBZ_XLBZID = XLXSJGBMX_XLBZID");
|
||
sql.Add(" left join XLXHB on XLXHB_XLXHID=XLXSJGBMX_XLXHID");
|
||
sql.Add(" left join XLGGB on XLGGB_XLGGID = XLXSJGBMX_XLGGID and XLGGB_XLGGJDGZ = isnull(XLXHB_XLGGJDGZ,'0') ");
|
||
sql.Add(" where 1=1 ");
|
||
if (sCPMLLX.Equals("Y"))//组合产品目录价格表
|
||
{
|
||
sql.Add(" and " + CMISproDataBase.GetWhereEqual("XLXSJGBMX_JGBID", sJGCIDS));
|
||
}
|
||
else
|
||
{
|
||
sql.Add(" and XLXSJGBMX_JGBID=:pJGBID ");
|
||
sql.ParamByName("pJGBID").Value = pJGBID;
|
||
}
|
||
if (!pXH.Equals(""))
|
||
sql.Add(" and " + CMISproDataBase.GetWhereEqual("XLXSJGBMX_XLXHID", pXH));
|
||
if (!pBZ.Equals(""))
|
||
sql.Add(" and XLXSJGBMX_XLBZID ='" + pBZ + "'");
|
||
if (!pDYDJ.Equals(""))
|
||
sql.Add(" and XLXSJGBMX_DYDJID='" + pDYDJ + "'");
|
||
sql.Add(" order by XLXSJGBMX_XLXHID,XLGGB_XH");
|
||
DataSet ds = dberp.OpenDataSet(sql);
|
||
if (ds.Tables[0].Rows.Count > 0)
|
||
{
|
||
int i = 1;
|
||
for (i = 1; i < 6; i++)
|
||
{
|
||
if (pHSBJ.Equals("True"))
|
||
{
|
||
if(!Restr.Equals(""))
|
||
Restr+=";";
|
||
Restr += "XLXSJGBMX_XLGGID" + i.ToString() + ",规格;XLXSJGBMX_HSBJ" + i.ToString() + ",含税表价";
|
||
}
|
||
else
|
||
{
|
||
if (!Restr.Equals(""))
|
||
Restr += ";";
|
||
Restr += "XLXSJGBMX_XLGGID" + i.ToString() + ",规格;XLXSJGBMX_WSBJ" + i.ToString() + ",无税表价";
|
||
}
|
||
if (i * i >= ds.Tables[0].Rows.Count)
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
return Restr;
|
||
}
|
||
|
||
|
||
private string Getfield2()
|
||
{
|
||
string Restr = "";
|
||
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
|
||
TSQL sql = new TSQL(dberp);
|
||
sql.Clear();
|
||
sql.Add("select XLXSCPML_CPMLLX,XLXSJGB_JGCIDS");
|
||
sql.Add(" from XLXSJGB");
|
||
sql.Add(" left join XLXSCPML on XLXSCPML_CPMLID=XLXSJGB_CPMLID");
|
||
sql.Add(" where XLXSJGB_MXBH=:pMXBH and XLXSJGB_JGBID=:pJGBID");
|
||
sql.ParamByName("pMXBH").Value = pFL;
|
||
sql.ParamByName("pJGBID").Value = pJGBID;
|
||
DataSet dsJGB = dberp.OpenDataSet(sql);
|
||
string sCPMLLX = "";
|
||
string sJGCIDS = "";
|
||
if (dsJGB.Tables[0].Rows.Count > 0)
|
||
{
|
||
sCPMLLX = dsJGB.Tables[0].Rows[0]["XLXSCPML_CPMLLX"].ToString().Trim();
|
||
sJGCIDS = dsJGB.Tables[0].Rows[0]["XLXSJGB_JGCIDS"].ToString().Trim();
|
||
}
|
||
if (pXSFS.Equals("1"))
|
||
{
|
||
sql.Clear();
|
||
sql.Add("select distinct XLXSJGBMX_XLXHID,XLXSJGBMX_XLBZID ||'|'||XLBZ_XLBZLXMC as XLXSJGBMX_XLBZID,XLXSJGBMX_XLGGID,XLXSJGBMX_DYDJID,XLXSJGBMX_HSBJ,XLXSJGBMX_WSBJ,XLGGB_XH,XLGGB_XXJGID,XLGGB_DTJMZHID ");
|
||
sql.Add(" from XLXSJGBMX ");
|
||
sql.Add(" left join XLBZ on XLBZ_XLBZID = XLXSJGBMX_XLBZID");
|
||
sql.Add(" left join XLXHB on XLXHB_XLXHID=XLXSJGBMX_XLXHID");
|
||
sql.Add(" left join XLGGB on XLGGB_XLGGID = XLXSJGBMX_XLGGID and XLGGB_XLGGJDGZ = isnull(XLXHB_XLGGJDGZ,'0') ");
|
||
sql.Add(" where 1=1 ");
|
||
if (sCPMLLX.Equals("Y"))//组合产品目录价格表
|
||
{
|
||
sql.Add(" and " + CMISproDataBase.GetWhereEqual("XLXSJGBMX_JGBID", sJGCIDS));
|
||
}
|
||
else
|
||
{
|
||
sql.Add(" and XLXSJGBMX_JGBID=:pJGBID ");
|
||
sql.ParamByName("pJGBID").Value = pJGBID;
|
||
}
|
||
if (!pXH.Equals(""))
|
||
sql.Add(" and " + CMISproDataBase.GetWhereEqual("XLXSJGBMX_XLXHID", pXH));
|
||
if (!pBZ.Equals(""))
|
||
sql.Add(" and XLXSJGBMX_XLBZID ='" + pBZ + "'");
|
||
if (!pDYDJ.Equals(""))
|
||
sql.Add(" and XLXSJGBMX_DYDJID='" + pDYDJ + "'");
|
||
sql.Add(" order by XLXSJGBMX_XLXHID,XLGGB_XH");
|
||
DataSet ds = dberp.OpenDataSet(sql);
|
||
if (ds.Tables[0].Rows.Count > 0)
|
||
{
|
||
Restr += "XLXSJGBMX_XLBZID,标准;XLXSJGBMX_DYDJID,电压等级;XLXSJGBMX_XLGGID,规格";
|
||
string sXHL = "";
|
||
string sTitle = "";
|
||
int index = 0;
|
||
string sJM = "";
|
||
Dictionary<string, string> myDiction = new Dictionary<string, string>();
|
||
foreach (DataRow row in ds.Tables[0].Rows)
|
||
{
|
||
sJM = row["XLXSJGBMX_XLXHID"].ToString().Trim();
|
||
if (!sJM.Equals(sXHL) && !sTitle.Contains("&" + sJM + "&"))
|
||
{
|
||
|
||
sXHL = row["XLXSJGBMX_XLXHID"].ToString().Trim();
|
||
if (!sTitle.Equals(""))
|
||
sTitle += ",";
|
||
sTitle += "&" + sXHL + "&";
|
||
}
|
||
}
|
||
sTitle = sTitle.Replace("&", "");
|
||
sTitle = SortTitle(sTitle);
|
||
index = 0;
|
||
foreach (string strss in sTitle.Split(','))
|
||
{
|
||
Restr += ";" + "XLXSJGBMX_XLXHID" + index.ToString() + "," + strss;
|
||
index++;
|
||
}
|
||
}
|
||
}
|
||
else if (pXSFS.Equals("2"))
|
||
{
|
||
sql.Clear();
|
||
sql.Add("select distinct XLXSJGBMX_XLXHID,XLXSJGBMX_XLBZID ||'|'||XLBZ_XLBZLXMC as XLXSJGBMX_XLBZID,XLXSJGBMX_XLGGID,XLXSJGBMX_DYDJID,XLXSJGBMX_HSBJ,XLXSJGBMX_WSBJ,XLGGB_XH,XLGGB_XXJGID,XLGGB_DTJMZHID ");
|
||
sql.Add(" from XLXSJGBMX ");
|
||
sql.Add(" left join XLBZ on XLBZ_XLBZID = XLXSJGBMX_XLBZID");
|
||
sql.Add(" left join XLXHB on XLXHB_XLXHID=XLXSJGBMX_XLXHID");
|
||
sql.Add(" left join XLGGB on XLGGB_XLGGID = XLXSJGBMX_XLGGID and XLGGB_XLGGJDGZ = isnull(XLXHB_XLGGJDGZ,'0') ");
|
||
sql.Add(" where 1=1 ");
|
||
if (sCPMLLX.Equals("Y"))//组合产品目录价格表
|
||
{
|
||
sql.Add(" and " + CMISproDataBase.GetWhereEqual("XLXSJGBMX_JGBID", sJGCIDS));
|
||
}
|
||
else
|
||
{
|
||
sql.Add(" and XLXSJGBMX_JGBID=:pJGBID ");
|
||
sql.ParamByName("pJGBID").Value = pJGBID;
|
||
}
|
||
if (!pXH.Equals(""))
|
||
sql.Add(" and " + CMISproDataBase.GetWhereEqual("XLXSJGBMX_XLXHID", pXH));
|
||
if (!pBZ.Equals(""))
|
||
sql.Add(" and XLXSJGBMX_XLBZID ='" + pBZ + "'");
|
||
if (!pDYDJ.Equals(""))
|
||
sql.Add(" and XLXSJGBMX_DYDJID='" + pDYDJ + "'");
|
||
sql.Add(" order by XLXSJGBMX_XLXHID,XLGGB_XH");
|
||
DataSet ds = dberp.OpenDataSet(sql);
|
||
if (ds.Tables[0].Rows.Count > 0)
|
||
{
|
||
Restr += "XLGGB_XXJGID,芯线结构";
|
||
string sXHL = "";
|
||
string sTitle = "";
|
||
string sJM = "";
|
||
foreach (DataRow row in ds.Tables[0].Rows)
|
||
{
|
||
if (row["XLGGB_DTJMZHID"].ToString().Trim().Contains("/"))
|
||
{
|
||
sJM = row["XLGGB_DTJMZHID"].ToString().Trim().Split('/')[0];
|
||
}
|
||
else
|
||
{
|
||
sJM = row["XLGGB_DTJMZHID"].ToString().Trim();
|
||
}
|
||
if (!sJM.Equals(sXHL) && !sTitle.Contains("&" + sJM + "&"))
|
||
{
|
||
if (row["XLGGB_DTJMZHID"].ToString().Trim().Contains("/"))
|
||
{
|
||
sXHL = row["XLGGB_DTJMZHID"].ToString().Trim().Split('/')[0];
|
||
}
|
||
else
|
||
{
|
||
sXHL = row["XLGGB_DTJMZHID"].ToString().Trim();
|
||
}
|
||
if (!sTitle.Equals(""))
|
||
sTitle += ",";
|
||
sTitle += "&" + sXHL + "&";
|
||
}
|
||
}
|
||
sTitle = SortString(sTitle.Replace("&", ""));
|
||
int index = 0;
|
||
foreach (string strss in sTitle.Split(','))
|
||
{
|
||
Restr += ";" + "XLGGB_DTJMZHID" + index.ToString() + "," + strss;
|
||
index++;
|
||
}
|
||
}
|
||
}
|
||
else if (pXSFS.Equals("3"))
|
||
{
|
||
sql.Clear();
|
||
sql.Add("select distinct XLXSJGBMX_XLXHID,XLXSJGBMX_XLBZID ||'|'||XLBZ_XLBZLXMC as XLXSJGBMX_XLBZID,XLXSJGBMX_XLGGID,XLXSJGBMX_DYDJID,XLXSJGBMX_HSBJ,XLXSJGBMX_WSBJ,XLGGB_XH,XLGGB_XXJGID,XLGGB_DTJMZHID ");
|
||
sql.Add(" from XLXSJGBMX ");
|
||
sql.Add(" left join XLBZ on XLBZ_XLBZID = XLXSJGBMX_XLBZID");
|
||
sql.Add(" left join XLXHB on XLXHB_XLXHID=XLXSJGBMX_XLXHID");
|
||
sql.Add(" left join XLGGB on XLGGB_XLGGID = XLXSJGBMX_XLGGID and XLGGB_XLGGJDGZ = isnull(XLXHB_XLGGJDGZ,'0') ");
|
||
sql.Add(" where 1=1 ");
|
||
if (sCPMLLX.Equals("Y"))//组合产品目录价格表
|
||
{
|
||
sql.Add(" and " + CMISproDataBase.GetWhereEqual("XLXSJGBMX_JGBID", sJGCIDS));
|
||
}
|
||
else
|
||
{
|
||
sql.Add(" and XLXSJGBMX_JGBID=:pJGBID ");
|
||
sql.ParamByName("pJGBID").Value = pJGBID;
|
||
}
|
||
if (!pXH.Equals(""))
|
||
sql.Add(" and " + CMISproDataBase.GetWhereEqual("XLXSJGBMX_XLXHID", pXH));
|
||
if (!pBZ.Equals(""))
|
||
sql.Add(" and XLXSJGBMX_XLBZID ='" + pBZ + "'");
|
||
if (!pDYDJ.Equals(""))
|
||
sql.Add(" and XLXSJGBMX_DYDJID='" + pDYDJ + "'");
|
||
sql.Add(" order by XLXSJGBMX_XLXHID,XLGGB_XH");
|
||
DataSet ds = dberp.OpenDataSet(sql);
|
||
if (ds.Tables[0].Rows.Count > 0)
|
||
{
|
||
int i = 1;
|
||
for (i = 1; i < 6; i++)
|
||
{
|
||
if (pHSBJ.Equals("True"))
|
||
{
|
||
if (!Restr.Equals(""))
|
||
Restr += ";";
|
||
Restr += "XLXSJGBMX_XLGGID" + i.ToString() + ",规格;XLXSJGBMX_HSBJ" + i.ToString() + ",含税表价";
|
||
}
|
||
else
|
||
{
|
||
if (!Restr.Equals(""))
|
||
Restr += ";";
|
||
Restr += "XLXSJGBMX_XLGGID" + i.ToString() + ",规格;XLXSJGBMX_WSBJ" + i.ToString() + ",无税表价";
|
||
}
|
||
if (i * i >= ds.Tables[0].Rows.Count)
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
return Restr;
|
||
}
|
||
|
||
private string SortString(string str)
|
||
{
|
||
if (str.Split(',').Length > 1)
|
||
{
|
||
double[] dnum = new double[str.Split(',').Length-1];
|
||
string strx = "";
|
||
double first = CMISproConvert.StrToFloat(str.Split(',')[0].Trim());
|
||
for (int i = 1; i < str.Split(',').Length;i++ )
|
||
{
|
||
if (!strx.Equals(""))
|
||
strx += ",";
|
||
if (first > CMISproConvert.StrToFloat(str.Split(',')[i].Trim()))
|
||
{
|
||
strx += first.ToString();
|
||
first = CMISproConvert.StrToFloat(str.Split(',')[i].Trim());
|
||
}
|
||
else
|
||
{
|
||
strx += str.Split(',')[i].Trim();
|
||
}
|
||
}
|
||
return first.ToString()+","+SortString(strx);
|
||
}
|
||
else
|
||
{
|
||
return str;
|
||
}
|
||
}
|
||
|
||
private string AddSpe(string str)
|
||
{
|
||
str = str.Replace(",", "&,&");
|
||
str = "&" + str + "&";
|
||
return str;
|
||
}
|
||
|
||
private string SortTitle2(string str)
|
||
{
|
||
string rstr = "";
|
||
foreach(string strs in str.Split(','))
|
||
{
|
||
if (rstr.Equals(""))
|
||
{
|
||
rstr += "('" + strs + "'";
|
||
}
|
||
else
|
||
{
|
||
rstr += ",'" + strs + "'";
|
||
}
|
||
}
|
||
rstr += ")";
|
||
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
|
||
TSQL sql = new TSQL(dberp);
|
||
sql.Clear();
|
||
sql.Add("select distinct XLXSJGBMX_XLXHID from XLXSJGBMX where 1=1 and XLXSJGBMX_XLXHID in " + rstr + " order by XLXSJGBMX_XLXHID");
|
||
DataSet ds = dberp.OpenDataSet(sql);
|
||
rstr = "";
|
||
if (ds.Tables[0].Rows.Count > 0)
|
||
{
|
||
foreach(DataRow row in ds.Tables[0].Rows)
|
||
{
|
||
if (!rstr.Equals(""))
|
||
rstr += ",";
|
||
rstr += row["XLXSJGBMX_XLXHID"].ToString().Trim();
|
||
}
|
||
}
|
||
return rstr;
|
||
}
|
||
|
||
private string SortTitle(string str)
|
||
{
|
||
// 分割输入字符串
|
||
string[] parts = str.Split(',');
|
||
|
||
// 创建列表用于存储处理后的值
|
||
List<string> processedList = new List<string>();
|
||
|
||
// 处理每个部分:去空格、去重
|
||
foreach (string part in parts)
|
||
{
|
||
string trimmed = part.Trim();
|
||
if (!string.IsNullOrEmpty(trimmed) && !processedList.Contains(trimmed))
|
||
{
|
||
processedList.Add(trimmed);
|
||
}
|
||
}
|
||
|
||
// 排序(使用 .NET 2.0 的 List.Sort())
|
||
processedList.Sort();
|
||
|
||
// 重新拼接字符串
|
||
StringBuilder result = new StringBuilder();
|
||
for (int i = 0; i < processedList.Count; i++)
|
||
{
|
||
if (i > 0)
|
||
{
|
||
result.Append(",");
|
||
}
|
||
result.Append(processedList[i]);
|
||
}
|
||
|
||
return result.ToString();
|
||
}
|
||
|
||
|
||
#endregion
|
||
#region GridView增加列
|
||
|
||
/// <summary>
|
||
/// 设置etCheckBox列的属性
|
||
/// </summary>
|
||
/// <param name="sDataField"></param>
|
||
/// <param name="HeadText"></param>
|
||
/// <param name="Width"></param>
|
||
/// <param name="CheckBox"></param>
|
||
private void AddColumn(string sDataField, string HeadText, int Width, TEditType CheckBox)
|
||
{
|
||
BoundField Column = new BoundField();
|
||
Column.DataField = sDataField;
|
||
Column.HeaderText = HeadText;
|
||
Column.ItemStyle.Width = (Unit)Width;
|
||
Column.HeaderStyle.Width = (Unit)Width;
|
||
grdContentGrid.Columns.Add(Column);
|
||
|
||
gtGridView_Column ColumnEx = new gtGridView_Column();
|
||
ColumnEx.DataField = sDataField;
|
||
ColumnEx.EditType = TEditType.etCheckBox;
|
||
grdContentGrid.ColumnsEx.Insert(0, ColumnEx);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 设置etString列的属性
|
||
/// </summary>
|
||
/// <param name="sDataField"></param>
|
||
/// <param name="HeadText"></param>
|
||
/// <param name="Width"></param>
|
||
private void AddColumn(string sDataField, string HeadText, int Width)
|
||
{
|
||
BoundField Column = new BoundField();
|
||
Column.DataField = sDataField;
|
||
Column.HeaderText = HeadText;
|
||
Column.ItemStyle.Width = (Unit)Width;
|
||
Column.HeaderStyle.Width = (Unit)Width;
|
||
grdContentGrid.Columns.Add(Column);
|
||
|
||
gtGridView_Column ColumnEx = new gtGridView_Column();
|
||
ColumnEx.DataField = sDataField;
|
||
ColumnEx.EditType = TEditType.etString;
|
||
ColumnEx.ShowHint = true;
|
||
grdContentGrid.ColumnsEx.Insert(0, ColumnEx);
|
||
}
|
||
|
||
private void AddColumn2(string sDataField, string HeadText, int Width)
|
||
{
|
||
BoundField Column = new BoundField();
|
||
Column.DataField = sDataField;
|
||
Column.HeaderText = HeadText;
|
||
Column.ItemStyle.Width = (Unit)Width;
|
||
Column.HeaderStyle.Width = (Unit)Width;
|
||
Column.ItemStyle.HorizontalAlign = HorizontalAlign.Right;
|
||
grdContentGrid.Columns.Add(Column);
|
||
|
||
gtGridView_Column ColumnEx = new gtGridView_Column();
|
||
ColumnEx.DataField = sDataField;
|
||
ColumnEx.EditType = TEditType.etString;
|
||
ColumnEx.ShowHint = true;
|
||
grdContentGrid.ColumnsEx.Insert(0, ColumnEx);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 设置etNumber列的属
|
||
/// </summary>
|
||
/// <param name="sDataField"></param>
|
||
/// <param name="HeadText"></param>
|
||
/// <param name="NumberDecimalPlace"></param>
|
||
/// <param name="Width"></param>
|
||
private void AddColumn(string sDataField, string HeadText, int NumberDecimalPlace, int Width)
|
||
{
|
||
BoundField Column = new BoundField();
|
||
Column.DataField = sDataField;
|
||
Column.HeaderText = HeadText;
|
||
Column.ItemStyle.Width = (Unit)Width;
|
||
Column.HeaderStyle.Width = (Unit)Width;
|
||
Column.ItemStyle.HorizontalAlign = HorizontalAlign.Right;
|
||
grdContentGrid.Columns.Add(Column);
|
||
|
||
gtGridView_Column ColumnEx = new gtGridView_Column();
|
||
ColumnEx.DataField = sDataField;
|
||
ColumnEx.EditType = TEditType.etNumber;
|
||
ColumnEx.ShowHint = true;
|
||
ColumnEx.NumberDecimalPlace = NumberDecimalPlace;
|
||
grdContentGrid.ColumnsEx.Insert(0, ColumnEx);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 设置etDateTime列的属性
|
||
/// </summary>
|
||
/// <param name="sDataField"></param>
|
||
/// <param name="HeadText"></param>
|
||
/// <param name="DateTimeKind"></param>
|
||
/// <param name="Width"></param>
|
||
private void AddColumn(string sDataField, string HeadText, TDateTimeEditKinds DateTimeKind)
|
||
{
|
||
BoundField Column = new BoundField();
|
||
Column.DataField = sDataField;
|
||
Column.HeaderText = HeadText;
|
||
Column.ItemStyle.Width = (Unit)(DateTimeKind == TDateTimeEditKinds.dtDateTime ? 125 : 72);
|
||
Column.HeaderStyle.Width = (Unit)(DateTimeKind == TDateTimeEditKinds.dtDateTime ? 125 : 72);
|
||
grdContentGrid.Columns.Add(Column);
|
||
|
||
gtGridView_Column ColumnEx = new gtGridView_Column();
|
||
ColumnEx.DataField = sDataField;
|
||
ColumnEx.EditType = TEditType.etDateTime;
|
||
ColumnEx.DateTimeEditKins = DateTimeKind;
|
||
grdContentGrid.ColumnsEx.Insert(0, ColumnEx);
|
||
}
|
||
|
||
#endregion
|
||
}
|
||
}
|