This commit is contained in:
2026-08-21 17:03:02 +08:00
commit f065129b20
2292 changed files with 666241 additions and 0 deletions
+467
View File
@@ -0,0 +1,467 @@
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 JGBPZList : SingleGridBase
{
JGBPZ entity = new JGBPZ();
protected void Page_Load(object sender, EventArgs e)
{
this.UMID = 100860036;
this.UMName = "线缆销售报价价格目录配置";
this.CurMaster = Master;
this.ModuleGV = grdGrid;
this.CurEntity = entity;
this.sURLTarget = "JGBPZInfo.aspx";
this.PageHeight = 600;
this.PageWidth = 750;
base.DataKeyNames = new string[] { "XLXSJGBPZ_JGBPZDH" };
this.Master.EnableQueryBtn = false;
base.InitPage();
if (!IsPostBack)
{
Master_OnStandardQuery(null, null);
}
}
#region 模板事件
protected override void Master_OnStandardQuery(object sender, EventArgs e)
{
entity.EntityTable.QuerySelSql = GetSql();
base.Master_OnStandardQuery(sender, e);
entity.GridDataBind(grdGrid, tSession);
}
protected override void moduleGV_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
entity.EntityTable.QuerySelSql = GetSql();
base.moduleGV_PageIndexChanging(sender, e);
grdGrid.SelectedIndex = -1;
}
protected override void moduleGV_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
if ((e.Row.Cells[1].Text.Trim() != "") && (e.Row.Cells[1].Text.Trim() != " "))
{
if (e.Row.Cells[1].Text.Trim().Equals("JGB"))
e.Row.Cells[1].Text = "报价价格表";
else if (e.Row.Cells[1].Text.Trim().Equals("JGC"))
e.Row.Cells[1].Text = "基价价格表";
}
if ((e.Row.Cells[2].Text.Trim() != "") && (e.Row.Cells[2].Text.Trim() != " "))
{
if (e.Row.Cells[2].Text.Trim().Equals("1"))
e.Row.Cells[2].Text = "1|表价(出厂价)=基价(材料价)&调价";
else if (e.Row.Cells[2].Text.Trim().Equals("2"))
e.Row.Cells[2].Text = "2|表价(区域价)=基价(出厂价)&调价";
}
if ((e.Row.Cells[4].Text.Trim() != "") && (e.Row.Cells[4].Text.Trim() != " "))
{
e.Row.Cells[4].Text = GetBJCLXX(e.Row.Cells[4].Text.Trim());
}
LinkPageParam.AddString("XLXSJGBPZ_JGBPZDH", grdGrid.DataKeys[e.Row.RowIndex]["XLXSJGBPZ_JGBPZDH"].ToString().Trim());
}
base.moduleGV_RowDataBound(sender, e);
}
protected override void BeforeDelete(TDatabase db, ref bool ActionIsDone)
{
entity.Param.Add("XLXSJGBPZ_JGBPZDH", grdGrid.DataKeys[grdGrid.SelectedIndex]["XLXSJGBPZ_JGBPZDH"].ToString().Trim());
base.BeforeDelete(db, ref ActionIsDone);
}
protected override bool Master_BeforeDeleteAction(object sender, EventArgs e)
{
if (!base.Master_BeforeDeleteAction(sender, e))
{ return false; }
string sJGBPZDH = grdGrid.DataKeys[grdGrid.SelectedIndex]["XLXSJGBPZ_JGBPZDH"].ToString().Trim();
// TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
// TSQL sql = new TSQL(dberp);
// sql.Add("select XLXSJGBPZ_CPMLID");
// sql.Add(" from XLXSJGBPZ");
// sql.Add(" where XLXSJGBPZ_JGBPZDH=:pJGBPZDH");
// sql.ParamByName("pJGBPZDH").Value = sJGBPZDH;
// DataSet ds = dberp.OpenDataSet(sql);
// if (ds.Tables[0].Rows.Count > 0)
// {
// if (CMISproDataBase.ExistsRecord("DBERP", string.Format(@"select 1 from XLXSJGBPZ left join XLXSCPML on XLXSCPML_CPMLID=XLXSJGBPZ_CPMLID
// where isnull(XLXSCPML_CPMLIDS,' ')<>' ' and ','||rtrim(XLXSCPML_CPMLIDS)||',' like '{0}'",
// "%," + ds.Tables[0].Rows[0]["XLXSJGBPZ_CPMLID"].ToString().Trim() + ",%")))
// {
// ShowMessage("当前产品目录存在引用的组合产品目录的配置记录,不允许删除!");
// return false;
// }
// }
string sSQL = string.Format("select top 1 XLXSJGBPZJGB_CLHQZH from XLXSJGBPZJGB where XLXSJGBPZJGB_JGBPZDH = '{0}' and isnull(XLXSJGBPZJGB_JGBID,' ')<>' '",
sJGBPZDH);
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 XLXSJGBPZJGB where XLXSJGBPZJGB_JGBPZDH='{0}'", grdGrid.DataKeys[grdGrid.SelectedIndex]["XLXSJGBPZ_JGBPZDH"].ToString().Trim()));
db.ExecSQL(string.Format("delete from XLXSJGBPZCLHQFD where XLXSJGBPZCLHQFD_JGBPZDH='{0}'", grdGrid.DataKeys[grdGrid.SelectedIndex]["XLXSJGBPZ_JGBPZDH"].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(grdGrid, tSession);
grdGrid.SelectedIndex = -1;
return true;
}
#endregion
#region 自定义函数
private string GetSql()
{
StringBuilder strSQL = new StringBuilder();
strSQL.AppendLine(" select XLXSJGBPZ_JGBPZDH,XLXSJGBPZ_MXBH,XLXSJGBPZ_TJYS,XLXSJGBPZ_CPMLID,");
strSQL.AppendLine(" XLXSJGBPZ_BJCLIDS,XLXSJGBPZ_BZ,XLXSJGBPZ_WHR,XLXSJGBPZ_WHRID,XLXSJGBPZ_WHSJ,");
strSQL.AppendLine(" rtrim(XLXSJGBPZ_CPMLID)||'|'||XLXSCPML_CPMLMC as CPML ");
strSQL.AppendLine(" from XLXSJGBPZ ");
strSQL.AppendLine(" left join XLXSCPML on XLXSCPML_CPMLID=XLXSJGBPZ_CPMLID ");
strSQL.AppendLine(" where 1=1 order by XLXSJGBPZ_JGBPZDH");
return strSQL.ToString();
}
private string GetBJCLXX(string sBJCLIDList)
{
string[] sBJCLIDs = sBJCLIDList.Trim().Split(',');
string Result = "";
for (int i = 0; i < sBJCLIDs.Length; i++)
{
Result += sBJCLIDs[i].Trim() + "|" + GetBJCLMC(sBJCLIDs[i].Trim()) + ",";
}
return Result.TrimEnd(',');
}
private string GetBJCLMC(string sBJCLID)
{
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
TSQL sql = new TSQL(dberp);
sql.Add("select XLXSBJCL_BJCLMC from XLXSBJCL where XLXSBJCL_BJCLID=:pBJCLID ");
sql.ParamByName("pBJCLID").Value = sBJCLID.Trim();
DataSet ds = dberp.OpenDataSet(sql);
string sBJCLMC = "";
if (ds.Tables[0].Rows.Count > 0)
{
sBJCLMC = ds.Tables[0].Rows[0][0].ToString().Trim();
}
return sBJCLMC;
}
#endregion
#region 控件事件
protected void btnPSJGB_Click(object sender, EventArgs e)
{
if (grdGrid.SelectedIndex < 0)
{
ShowMessage("请选择处理记录!");
return;
}
string sJGBPZDH = grdGrid.DataKeys[grdGrid.SelectedIndex]["XLXSJGBPZ_JGBPZDH"].ToString().Trim();
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
TSQL sql = new TSQL(dberp);
sql.Add("select XLXSJGBPZ_CPMLID,XLXSCPML_CPMLLX,XLXSCPML_CPMLIDS,XLXSJGBPZ_BJCLIDS,XLXSJGBPZ_MXBH,XLXSJGBPZ_TJYS");
sql.Add(" from XLXSJGBPZ");
sql.Add(" left join XLXSCPML on XLXSCPML_CPMLID=XLXSJGBPZ_CPMLID");
sql.Add(" where XLXSJGBPZ_JGBPZDH=:pJGBPZDH");
sql.ParamByName("pJGBPZDH").Value = sJGBPZDH;
DataSet ds = dberp.OpenDataSet(sql);
if (ds.Tables[0].Rows.Count > 0)
{
if (ds.Tables[0].Rows[0]["XLXSJGBPZ_BJCLIDS"].ToString().Trim().Equals(""))
{
ShowMessage("请先维护行情分段材料!");
return;
}
//若尚未派生价格表,则重新生成XLXSJGBPZJGB、XLXSJGBPZCLHQFD之记录
if (!CMISproDataBase.ExistsRecord("DBERP", string.Format("select top 1 XLXSJGBPZJGB_CLHQZH from XLXSJGBPZJGB where XLXSJGBPZJGB_JGBPZDH = '{0}' and isnull(XLXSJGBPZJGB_JGBID,' ')<>' '",
sJGBPZDH)))
{
string[] sBJCLIDs = ds.Tables[0].Rows[0]["XLXSJGBPZ_BJCLIDS"].ToString().Trim().Split(',');
#region 校验各报价材料的分段数笛卡尔集必须小于1679616(即四位数36进制的最多组合数:36*36*36*36)
sql.Clear();
sql.Add("select XLXSCLHQFD_BJCLID as BJCLID,count(1) as CNT");
sql.Add(" from XLXSCLHQFD");
sql.Add(" where " + CMISproDataBase.GetWhereEqual("XLXSCLHQFD_BJCLID", ds.Tables[0].Rows[0]["XLXSJGBPZ_BJCLIDS"].ToString().Trim()));
sql.Add(" group by XLXSCLHQFD_BJCLID");
DataSet dsCNT = dberp.OpenDataSet(sql);
double dZHCount = 0;//材料分段组合笛卡尔集
for (int i = 0; i < dsCNT.Tables[0].Rows.Count; i++)
{
if (i == 0)
dZHCount = CMISproConvert.StrToFloat(dsCNT.Tables[0].Rows[i]["CNT"].ToString());
else
dZHCount = dZHCount * CMISproConvert.StrToFloat(dsCNT.Tables[0].Rows[i]["CNT"].ToString());
}
if (dZHCount >= 1679616)
{
ShowMessage("待生成的材料行情分组个数过多,当下最多只能存储1679615个!操作中止!");
return;
}
#endregion
#region XLXSJGBPZJGB
dberp.ExecSQL(string.Format("delete from XLXSJGBPZJGB where XLXSJGBPZJGB_JGBPZDH='{0}'", sJGBPZDH));
sql.Clear();
sql.Add("insert into XLXSJGBPZJGB(XLXSJGBPZJGB_JGBPZDH,XLXSJGBPZJGB_CLHQZH,XLXSJGBPZJGB_WHRID,XLXSJGBPZJGB_WHR,XLXSJGBPZJGB_WHSJ) ");
sql.Add("select :pJGBPZDH,CLHQZH,:pWHRID,:pWHR,:pWHSJ ");
sql.Add("from ");
sql.Add("( ");//将XH转换成36进制
sql.Add(" select ");
sql.Add(" case ");
sql.Add(" when XH/36/36/36= 0 then '0' when XH/36/36/36= 1 then '1' when XH/36/36/36= 2 then '2' when XH/36/36/36= 3 then '3' when XH/36/36/36= 4 then '4' ");
sql.Add(" when XH/36/36/36= 5 then '5' when XH/36/36/36= 6 then '6' when XH/36/36/36= 7 then '7' when XH/36/36/36= 8 then '8' when XH/36/36/36= 9 then '9' ");
sql.Add(" when XH/36/36/36=10 then 'A' when XH/36/36/36=11 then 'B' when XH/36/36/36=12 then 'C' when XH/36/36/36=13 then 'D' when XH/36/36/36=14 then 'E' ");
sql.Add(" when XH/36/36/36=15 then 'F' when XH/36/36/36=16 then 'G' when XH/36/36/36=17 then 'H' when XH/36/36/36=18 then 'I' when XH/36/36/36=19 then 'J' ");
sql.Add(" when XH/36/36/36=20 then 'K' when XH/36/36/36=21 then 'L' when XH/36/36/36=22 then 'M' when XH/36/36/36=23 then 'N' when XH/36/36/36=24 then 'O' ");
sql.Add(" when XH/36/36/36=25 then 'P' when XH/36/36/36=26 then 'Q' when XH/36/36/36=27 then 'R' when XH/36/36/36=28 then 'S' when XH/36/36/36=29 then 'T' ");
sql.Add(" when XH/36/36/36=30 then 'U' when XH/36/36/36=31 then 'V' when XH/36/36/36=32 then 'W' when XH/36/36/36=33 then 'X' when XH/36/36/36=34 then 'Y' ");
sql.Add(" when XH/36/36/36=35 then 'Z' ");
sql.Add(" else null ");
sql.Add(" end || ");
sql.Add(" case ");
sql.Add(" when MOD(XH/36/36,36)= 0 then '0' when MOD(XH/36/36,36)= 1 then '1' when MOD(XH/36/36,36)= 2 then '2' when MOD(XH/36/36,36)= 3 then '3' when MOD(XH/36/36,36)= 4 then '4' ");
sql.Add(" when MOD(XH/36/36,36)= 5 then '5' when MOD(XH/36/36,36)= 6 then '6' when MOD(XH/36/36,36)= 7 then '7' when MOD(XH/36/36,36)= 8 then '8' when MOD(XH/36/36,36)= 9 then '9' ");
sql.Add(" when MOD(XH/36/36,36)=10 then 'A' when MOD(XH/36/36,36)=11 then 'B' when MOD(XH/36/36,36)=12 then 'C' when MOD(XH/36/36,36)=13 then 'D' when MOD(XH/36/36,36)=14 then 'E' ");
sql.Add(" when MOD(XH/36/36,36)=15 then 'F' when MOD(XH/36/36,36)=16 then 'G' when MOD(XH/36/36,36)=17 then 'H' when MOD(XH/36/36,36)=18 then 'I' when MOD(XH/36/36,36)=19 then 'J' ");
sql.Add(" when MOD(XH/36/36,36)=20 then 'K' when MOD(XH/36/36,36)=21 then 'L' when MOD(XH/36/36,36)=22 then 'M' when MOD(XH/36/36,36)=23 then 'N' when MOD(XH/36/36,36)=24 then 'O' ");
sql.Add(" when MOD(XH/36/36,36)=25 then 'P' when MOD(XH/36/36,36)=26 then 'Q' when MOD(XH/36/36,36)=27 then 'R' when MOD(XH/36/36,36)=28 then 'S' when MOD(XH/36/36,36)=29 then 'T' ");
sql.Add(" when MOD(XH/36/36,36)=30 then 'U' when MOD(XH/36/36,36)=31 then 'V' when MOD(XH/36/36,36)=32 then 'W' when MOD(XH/36/36,36)=33 then 'X' when MOD(XH/36/36,36)=34 then 'Y' ");
sql.Add(" when MOD(XH/36/36,36)=35 then 'Z' ");
sql.Add(" else null ");
sql.Add(" end || ");
sql.Add(" case ");
sql.Add(" when MOD(XH/36,36)= 0 then '0' when MOD(XH/36,36)= 1 then '1' when MOD(XH/36,36)= 2 then '2' when MOD(XH/36,36)= 3 then '3' when MOD(XH/36,36)= 4 then '4' ");
sql.Add(" when MOD(XH/36,36)= 5 then '5' when MOD(XH/36,36)= 6 then '6' when MOD(XH/36,36)= 7 then '7' when MOD(XH/36,36)= 8 then '8' when MOD(XH/36,36)= 9 then '9' ");
sql.Add(" when MOD(XH/36,36)=10 then 'A' when MOD(XH/36,36)=11 then 'B' when MOD(XH/36,36)=12 then 'C' when MOD(XH/36,36)=13 then 'D' when MOD(XH/36,36)=14 then 'E' ");
sql.Add(" when MOD(XH/36,36)=15 then 'F' when MOD(XH/36,36)=16 then 'G' when MOD(XH/36,36)=17 then 'H' when MOD(XH/36,36)=18 then 'I' when MOD(XH/36,36)=19 then 'J' ");
sql.Add(" when MOD(XH/36,36)=20 then 'K' when MOD(XH/36,36)=21 then 'L' when MOD(XH/36,36)=22 then 'M' when MOD(XH/36,36)=23 then 'N' when MOD(XH/36,36)=24 then 'O' ");
sql.Add(" when MOD(XH/36,36)=25 then 'P' when MOD(XH/36,36)=26 then 'Q' when MOD(XH/36,36)=27 then 'R' when MOD(XH/36,36)=28 then 'S' when MOD(XH/36,36)=29 then 'T' ");
sql.Add(" when MOD(XH/36,36)=30 then 'U' when MOD(XH/36,36)=31 then 'V' when MOD(XH/36,36)=32 then 'W' when MOD(XH/36,36)=33 then 'X' when MOD(XH/36,36)=34 then 'Y' ");
sql.Add(" when MOD(XH/36,36)=35 then 'Z' ");
sql.Add(" else null ");
sql.Add(" end || ");
sql.Add(" case ");
sql.Add(" when MOD(XH,36)= 0 then '0' when MOD(XH,36)= 1 then '1' when MOD(XH,36)= 2 then '2' when MOD(XH,36)= 3 then '3' when MOD(XH,36)= 4 then '4' ");
sql.Add(" when MOD(XH,36)= 5 then '5' when MOD(XH,36)= 6 then '6' when MOD(XH,36)= 7 then '7' when MOD(XH,36)= 8 then '8' when MOD(XH,36)= 9 then '9' ");
sql.Add(" when MOD(XH,36)=10 then 'A' when MOD(XH,36)=11 then 'B' when MOD(XH,36)=12 then 'C' when MOD(XH,36)=13 then 'D' when MOD(XH,36)=14 then 'E' ");
sql.Add(" when MOD(XH,36)=15 then 'F' when MOD(XH,36)=16 then 'G' when MOD(XH,36)=17 then 'H' when MOD(XH,36)=18 then 'I' when MOD(XH,36)=19 then 'J' ");
sql.Add(" when MOD(XH,36)=20 then 'K' when MOD(XH,36)=21 then 'L' when MOD(XH,36)=22 then 'M' when MOD(XH,36)=23 then 'N' when MOD(XH,36)=24 then 'O' ");
sql.Add(" when MOD(XH,36)=25 then 'P' when MOD(XH,36)=26 then 'Q' when MOD(XH,36)=27 then 'R' when MOD(XH,36)=28 then 'S' when MOD(XH,36)=29 then 'T' ");
sql.Add(" when MOD(XH,36)=30 then 'U' when MOD(XH,36)=31 then 'V' when MOD(XH,36)=32 then 'W' when MOD(XH,36)=33 then 'X' when MOD(XH,36)=34 then 'Y' ");
sql.Add(" when MOD(XH,36)=35 then 'Z' ");
sql.Add(" else null ");
sql.Add(" end as CLHQZH");
sql.Add(" from");
sql.Add(" (");//据pJGBPZDH所指记录XLXSJGBPZ_BJCLIDS字段所含材料行情分段的报价材料动态构造
sql.Add(" select row_number() over(order by");
for (int i = 0; i < sBJCLIDs.Length; i++)
{
if (i == sBJCLIDs.Length - 1)
sql.Add(string.Format(" bjcl{0}.XLXSCLHQFD_BJCLID,bjcl{0}.XLXSCLHQFD_CLHQDH", i.ToString()));
else
sql.Add(string.Format(" bjcl{0}.XLXSCLHQFD_BJCLID,bjcl{0}.XLXSCLHQFD_CLHQDH,", i.ToString()));
}
sql.Add(" ) as XH");
sql.Add(" from ");
for (int i = 0; i < sBJCLIDs.Length; i++)
{
if (i == sBJCLIDs.Length - 1)
sql.Add(string.Format(" XLXSCLHQFD bjcl{0}", i.ToString()));
else
sql.Add(string.Format(" XLXSCLHQFD bjcl{0},", i.ToString()));
}
sql.Add(" where 1=1 ");
for (int i = 0; i < sBJCLIDs.Length; i++)
{
sql.Add(string.Format(" and bjcl{0}.XLXSCLHQFD_BJCLID='{1}'", i.ToString(), sBJCLIDs[i].Trim()));
}
sql.Add(" ) a ");
sql.Add(") b ");
sql.ParamByName("pJGBPZDH").Value = sJGBPZDH;
sql.ParamByName("pWHRID").Value = tSession.UserId;
sql.ParamByName("pWHR").Value = tSession.UserName;
sql.ParamByName("pWHSJ").Value = DateTime.Now;
dberp.ExecSQL(sql);
#endregion
#region XLXSJGBPZCLHQFD
dberp.ExecSQL(string.Format("delete from XLXSJGBPZCLHQFD where XLXSJGBPZCLHQFD_JGBPZDH='{0}'", sJGBPZDH));
sql.Clear();
sql.Add("insert into XLXSJGBPZCLHQFD(XLXSJGBPZCLHQFD_JGBPZDH,XLXSJGBPZCLHQFD_CLHQZH,XLXSJGBPZCLHQFD_BJCLID,XLXSJGBPZCLHQFD_CLHQDH) ");
sql.Add("select :pJGBPZDH,CLHQZH, ");
sql.Add(" case");
for (int i = 0; i < sBJCLIDs.Length; i++)
{
sql.Add(string.Format(" when IDX_ID={0} then BJCLID{0}", Convert.ToString(i + 1)));
}
sql.Add(" end as BJCLID,");
sql.Add(" case");
for (int i = 0; i < sBJCLIDs.Length; i++)
{
sql.Add(string.Format(" when IDX_ID={0} then CLHQDH{0}", Convert.ToString(i + 1)));
}
sql.Add(" end as CLHQDH ");
sql.Add("from ");
sql.Add("( ");//将XH转换成36进制
sql.Add(" select ");
sql.Add(" case ");
sql.Add(" when XH/36/36/36= 0 then '0' when XH/36/36/36= 1 then '1' when XH/36/36/36= 2 then '2' when XH/36/36/36= 3 then '3' when XH/36/36/36= 4 then '4' ");
sql.Add(" when XH/36/36/36= 5 then '5' when XH/36/36/36= 6 then '6' when XH/36/36/36= 7 then '7' when XH/36/36/36= 8 then '8' when XH/36/36/36= 9 then '9' ");
sql.Add(" when XH/36/36/36=10 then 'A' when XH/36/36/36=11 then 'B' when XH/36/36/36=12 then 'C' when XH/36/36/36=13 then 'D' when XH/36/36/36=14 then 'E' ");
sql.Add(" when XH/36/36/36=15 then 'F' when XH/36/36/36=16 then 'G' when XH/36/36/36=17 then 'H' when XH/36/36/36=18 then 'I' when XH/36/36/36=19 then 'J' ");
sql.Add(" when XH/36/36/36=20 then 'K' when XH/36/36/36=21 then 'L' when XH/36/36/36=22 then 'M' when XH/36/36/36=23 then 'N' when XH/36/36/36=24 then 'O' ");
sql.Add(" when XH/36/36/36=25 then 'P' when XH/36/36/36=26 then 'Q' when XH/36/36/36=27 then 'R' when XH/36/36/36=28 then 'S' when XH/36/36/36=29 then 'T' ");
sql.Add(" when XH/36/36/36=30 then 'U' when XH/36/36/36=31 then 'V' when XH/36/36/36=32 then 'W' when XH/36/36/36=33 then 'X' when XH/36/36/36=34 then 'Y' ");
sql.Add(" when XH/36/36/36=35 then 'Z' ");
sql.Add(" else null ");
sql.Add(" end || ");
sql.Add(" case ");
sql.Add(" when MOD(XH/36/36,36)= 0 then '0' when MOD(XH/36/36,36)= 1 then '1' when MOD(XH/36/36,36)= 2 then '2' when MOD(XH/36/36,36)= 3 then '3' when MOD(XH/36/36,36)= 4 then '4' ");
sql.Add(" when MOD(XH/36/36,36)= 5 then '5' when MOD(XH/36/36,36)= 6 then '6' when MOD(XH/36/36,36)= 7 then '7' when MOD(XH/36/36,36)= 8 then '8' when MOD(XH/36/36,36)= 9 then '9' ");
sql.Add(" when MOD(XH/36/36,36)=10 then 'A' when MOD(XH/36/36,36)=11 then 'B' when MOD(XH/36/36,36)=12 then 'C' when MOD(XH/36/36,36)=13 then 'D' when MOD(XH/36/36,36)=14 then 'E' ");
sql.Add(" when MOD(XH/36/36,36)=15 then 'F' when MOD(XH/36/36,36)=16 then 'G' when MOD(XH/36/36,36)=17 then 'H' when MOD(XH/36/36,36)=18 then 'I' when MOD(XH/36/36,36)=19 then 'J' ");
sql.Add(" when MOD(XH/36/36,36)=20 then 'K' when MOD(XH/36/36,36)=21 then 'L' when MOD(XH/36/36,36)=22 then 'M' when MOD(XH/36/36,36)=23 then 'N' when MOD(XH/36/36,36)=24 then 'O' ");
sql.Add(" when MOD(XH/36/36,36)=25 then 'P' when MOD(XH/36/36,36)=26 then 'Q' when MOD(XH/36/36,36)=27 then 'R' when MOD(XH/36/36,36)=28 then 'S' when MOD(XH/36/36,36)=29 then 'T' ");
sql.Add(" when MOD(XH/36/36,36)=30 then 'U' when MOD(XH/36/36,36)=31 then 'V' when MOD(XH/36/36,36)=32 then 'W' when MOD(XH/36/36,36)=33 then 'X' when MOD(XH/36/36,36)=34 then 'Y' ");
sql.Add(" when MOD(XH/36/36,36)=35 then 'Z' ");
sql.Add(" else null ");
sql.Add(" end || ");
sql.Add(" case ");
sql.Add(" when MOD(XH/36,36)= 0 then '0' when MOD(XH/36,36)= 1 then '1' when MOD(XH/36,36)= 2 then '2' when MOD(XH/36,36)= 3 then '3' when MOD(XH/36,36)= 4 then '4' ");
sql.Add(" when MOD(XH/36,36)= 5 then '5' when MOD(XH/36,36)= 6 then '6' when MOD(XH/36,36)= 7 then '7' when MOD(XH/36,36)= 8 then '8' when MOD(XH/36,36)= 9 then '9' ");
sql.Add(" when MOD(XH/36,36)=10 then 'A' when MOD(XH/36,36)=11 then 'B' when MOD(XH/36,36)=12 then 'C' when MOD(XH/36,36)=13 then 'D' when MOD(XH/36,36)=14 then 'E' ");
sql.Add(" when MOD(XH/36,36)=15 then 'F' when MOD(XH/36,36)=16 then 'G' when MOD(XH/36,36)=17 then 'H' when MOD(XH/36,36)=18 then 'I' when MOD(XH/36,36)=19 then 'J' ");
sql.Add(" when MOD(XH/36,36)=20 then 'K' when MOD(XH/36,36)=21 then 'L' when MOD(XH/36,36)=22 then 'M' when MOD(XH/36,36)=23 then 'N' when MOD(XH/36,36)=24 then 'O' ");
sql.Add(" when MOD(XH/36,36)=25 then 'P' when MOD(XH/36,36)=26 then 'Q' when MOD(XH/36,36)=27 then 'R' when MOD(XH/36,36)=28 then 'S' when MOD(XH/36,36)=29 then 'T' ");
sql.Add(" when MOD(XH/36,36)=30 then 'U' when MOD(XH/36,36)=31 then 'V' when MOD(XH/36,36)=32 then 'W' when MOD(XH/36,36)=33 then 'X' when MOD(XH/36,36)=34 then 'Y' ");
sql.Add(" when MOD(XH/36,36)=35 then 'Z' ");
sql.Add(" else null ");
sql.Add(" end || ");
sql.Add(" case ");
sql.Add(" when MOD(XH,36)= 0 then '0' when MOD(XH,36)= 1 then '1' when MOD(XH,36)= 2 then '2' when MOD(XH,36)= 3 then '3' when MOD(XH,36)= 4 then '4' ");
sql.Add(" when MOD(XH,36)= 5 then '5' when MOD(XH,36)= 6 then '6' when MOD(XH,36)= 7 then '7' when MOD(XH,36)= 8 then '8' when MOD(XH,36)= 9 then '9' ");
sql.Add(" when MOD(XH,36)=10 then 'A' when MOD(XH,36)=11 then 'B' when MOD(XH,36)=12 then 'C' when MOD(XH,36)=13 then 'D' when MOD(XH,36)=14 then 'E' ");
sql.Add(" when MOD(XH,36)=15 then 'F' when MOD(XH,36)=16 then 'G' when MOD(XH,36)=17 then 'H' when MOD(XH,36)=18 then 'I' when MOD(XH,36)=19 then 'J' ");
sql.Add(" when MOD(XH,36)=20 then 'K' when MOD(XH,36)=21 then 'L' when MOD(XH,36)=22 then 'M' when MOD(XH,36)=23 then 'N' when MOD(XH,36)=24 then 'O' ");
sql.Add(" when MOD(XH,36)=25 then 'P' when MOD(XH,36)=26 then 'Q' when MOD(XH,36)=27 then 'R' when MOD(XH,36)=28 then 'S' when MOD(XH,36)=29 then 'T' ");
sql.Add(" when MOD(XH,36)=30 then 'U' when MOD(XH,36)=31 then 'V' when MOD(XH,36)=32 then 'W' when MOD(XH,36)=33 then 'X' when MOD(XH,36)=34 then 'Y' ");
sql.Add(" when MOD(XH,36)=35 then 'Z' ");
sql.Add(" else null ");
sql.Add(" end as CLHQZH,");
for (int i = 0; i < sBJCLIDs.Length; i++)
{
if (i == sBJCLIDs.Length - 1)
sql.Add(string.Format(" BJCLID{0},CLHQDH{0}", Convert.ToString(i + 1)));
else
sql.Add(string.Format(" BJCLID{0},CLHQDH{0},", Convert.ToString(i + 1)));
}
sql.Add(" from ");
sql.Add(" (");
sql.Add(" select row_number() over(order by");
for (int i = 0; i < sBJCLIDs.Length; i++)
{
if (i == sBJCLIDs.Length - 1)
sql.Add(string.Format(" bjcl{0}.XLXSCLHQFD_BJCLID,bjcl{0}.XLXSCLHQFD_CLHQDH", Convert.ToString(i + 1)));
else
sql.Add(string.Format(" bjcl{0}.XLXSCLHQFD_BJCLID,bjcl{0}.XLXSCLHQFD_CLHQDH,", Convert.ToString(i + 1)));
}
sql.Add(" ) as XH,");
for (int i = 0; i < sBJCLIDs.Length; i++)
{
if (i == sBJCLIDs.Length - 1)
sql.Add(string.Format(" bjcl{0}.XLXSCLHQFD_BJCLID as BJCLID{0},bjcl{0}.XLXSCLHQFD_CLHQDH as CLHQDH{0}", Convert.ToString(i + 1)));
else
sql.Add(string.Format(" bjcl{0}.XLXSCLHQFD_BJCLID as BJCLID{0},bjcl{0}.XLXSCLHQFD_CLHQDH as CLHQDH{0},", Convert.ToString(i + 1)));
}
sql.Add(" from");
for (int i = 0; i < sBJCLIDs.Length; i++)
{
if (i == sBJCLIDs.Length - 1)
sql.Add(string.Format(" XLXSCLHQFD bjcl{0}", Convert.ToString(i + 1)));
else
sql.Add(string.Format(" XLXSCLHQFD bjcl{0},", Convert.ToString(i + 1)));
}
sql.Add(" where 1=1");
for (int i = 0; i < sBJCLIDs.Length; i++)
{
sql.Add(string.Format(" and bjcl{0}.XLXSCLHQFD_BJCLID='{1}'", Convert.ToString(i + 1), sBJCLIDs[i].Trim()));
}
sql.Add(" ) a");
sql.Add(" ) b,IDX ");
sql.Add(string.Format("where IDX_ID<{0} ", sBJCLIDs.Length + 1));
//sql.Add("order by CLHQZH,BJCLID,CLHQDH ");
sql.ParamByName("pJGBPZDH").Value = sJGBPZDH;
dberp.ExecSQL(sql);
#endregion
}
TPageParams param = new TPageParams();
param.UrlPath = "JGBPZ_HQFZList.aspx";
param.AddString("JGBPZDH", sJGBPZDH);
param.AddString("CPMLID", ds.Tables[0].Rows[0]["XLXSJGBPZ_CPMLID"].ToString().Trim());
param.AddString("CPMLLX", ds.Tables[0].Rows[0]["XLXSCPML_CPMLLX"].ToString().Trim());
param.AddString("CPMLIDS", ds.Tables[0].Rows[0]["XLXSCPML_CPMLIDS"].ToString().Trim());
param.AddString("BJCLIDS", ds.Tables[0].Rows[0]["XLXSJGBPZ_BJCLIDS"].ToString().Trim());
param.AddString("MXBH", ds.Tables[0].Rows[0]["XLXSJGBPZ_MXBH"].ToString().Trim());
param.AddString("TJYS", ds.Tables[0].Rows[0]["XLXSJGBPZ_TJYS"].ToString().Trim());
OpenDialog(param);
}
}
#endregion
}
}