2026821
This commit is contained in:
@@ -0,0 +1,401 @@
|
||||
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.Utility;
|
||||
using GThinking.N_MISPRO.Data;
|
||||
using GThinking.N_MISPRO;
|
||||
using GThinking.N_WORKFLOW;
|
||||
using System.Collections.Generic;
|
||||
using GThinking.N_CONTROL;
|
||||
|
||||
namespace GThinking.N_XLXSBJ
|
||||
{
|
||||
public partial class XLBJD_WBBJDNRList : SingleGridBase
|
||||
{
|
||||
XLBJD_WBBJDNR entity = new XLBJD_WBBJDNR();
|
||||
Dictionary<string, string> dicHeaderTextCPMC = new Dictionary<string, string>();
|
||||
//指定栏目类型-栏目编号
|
||||
Dictionary<string, string> dicLMBH = new Dictionary<string, string>();
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
this.UMID = 100860043;
|
||||
this.UMName = "外部线缆产品导入";
|
||||
this.CurMaster = Master;
|
||||
this.ModuleGV = ContentGrid;
|
||||
this.CurEntity = entity;
|
||||
this.PageHeight = 600;
|
||||
this.PageWidth = 750;
|
||||
base.DataKeyNames = new string[] { "XLWBBJDNR_WBBJDID", "XLWBBJDNR_DRHH" };
|
||||
|
||||
this.Master.EnableNewBtn = false;
|
||||
this.Master.EnableCopyBtn = false;
|
||||
this.Master.EnableViewBtn = false;
|
||||
this.Master.EnableEditBtn = false;
|
||||
this.Master.EnableDeleteBtn = false;
|
||||
this.Master.EnablePrintBtn = false;
|
||||
this.Master.EnableAttachBtn = false;
|
||||
this.Master.EnableQueryBtn = false;
|
||||
|
||||
string sXLBJDID = PageParam.GetRTrimString("SELBJDID").Equals("") ? " " : PageParam.GetRTrimString("SELBJDID");
|
||||
if (sXLBJDID.Trim().Equals(""))
|
||||
{
|
||||
btnWBBJDMX.Visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
btnWBBJDMX.Visible = true;
|
||||
}
|
||||
|
||||
if (!IsPostBack)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
base.InitPage();
|
||||
|
||||
this.ModuleGV.OnClientDblClick = "return false;";
|
||||
|
||||
if (!IsPostBack)
|
||||
{
|
||||
Master_OnStandardQuery(null, null);
|
||||
}
|
||||
}
|
||||
|
||||
#region 模板继承事件
|
||||
|
||||
protected override void Master_OnStandardQuery(object sender, EventArgs e)
|
||||
{
|
||||
base.Master_OnStandardQuery(sender, e);
|
||||
entity.EntityTable.QuerySelSql = GetQuerySql();
|
||||
entity.GridDataBind(ContentGrid, tSession);
|
||||
}
|
||||
|
||||
protected override void moduleGV_PageIndexChanging(object sender, GridViewPageEventArgs e)
|
||||
{
|
||||
entity.EntityTable.QuerySelSql = GetQuerySql();
|
||||
ContentGrid.SelectedIndex = -1;
|
||||
base.moduleGV_PageIndexChanging(sender, e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 私有函数
|
||||
|
||||
private string GetQuerySql()
|
||||
{
|
||||
InitGrid();
|
||||
string sWBBJDID = PageParam.GetRTrimString("WBBJDID");
|
||||
string sSELBJDID = PageParam.GetRTrimString("SELBJDID").Equals("") ? " " : PageParam.GetRTrimString("SELBJDID");
|
||||
|
||||
string sSQL = " select XLWBBJDNR_WBBJDID,XLWBBJDNR_DRHH, ";
|
||||
foreach (KeyValuePair<string, string> kpv in dicHeaderTextCPMC)
|
||||
{
|
||||
sSQL += string.Format("XLWBBJDNR_LMNR{0},", kpv.Key.ToString().Trim());
|
||||
}
|
||||
sSQL += " XLWBBJDNR_BJDID ";
|
||||
sSQL += " from XLWBBJDNR where 1=1 ";
|
||||
|
||||
sSQL += "\r\n and XLWBBJDNR_WBBJDID = :XLWBBJDNR_WBBJDID ";
|
||||
entity.Param.Add("XLWBBJDNR_WBBJDID", sWBBJDID);
|
||||
sSQL += "\r\n and XLWBBJDNR_BJDID = :XLWBBJDNR_BJDID ";
|
||||
entity.Param.Add("XLWBBJDNR_BJDID", sSELBJDID);
|
||||
sSQL += " order by XLWBBJDNR_DRHH ";
|
||||
return sSQL;
|
||||
}
|
||||
|
||||
public void InitGrid()
|
||||
{
|
||||
dicHeaderTextCPMC.Clear();
|
||||
|
||||
if (string.IsNullOrEmpty(PageParam.GetRTrimString("WBBJDID")))
|
||||
return;
|
||||
|
||||
string sWBBJDID = PageParam.GetRTrimString("WBBJDID");
|
||||
string sSELBJDID = PageParam.GetRTrimString("SELBJDID").Equals("") ? " " : PageParam.GetRTrimString("SELBJDID");
|
||||
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
|
||||
TSQL sql = new TSQL(dberp);
|
||||
|
||||
DataSet ds;
|
||||
sql.Add(" select XLWBBJDLM_WBBJDID,XLWBBJDLM_LMBH,XLWBBJDLM_LMMC,XLWBBJDLM_BJDID from XLWBBJDLM ");
|
||||
sql.Add(" where XLWBBJDLM_WBBJDID=:XLWBBJDLM_WBBJDID and XLWBBJDLM_BJDID=:XLWBBJDLM_BJDID ");
|
||||
sql.Add(" order by XLWBBJDLM_LMBH ");
|
||||
sql.ParamByName("XLWBBJDLM_WBBJDID").Value = sWBBJDID;
|
||||
sql.ParamByName("XLWBBJDLM_BJDID").Value = sSELBJDID;
|
||||
ds = dberp.OpenDataSet(sql);
|
||||
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
|
||||
{
|
||||
dicHeaderTextCPMC.Add((ds.Tables[0].Rows[i]["XLWBBJDLM_LMBH"].ToString().Trim()), ds.Tables[0].Rows[i]["XLWBBJDLM_LMMC"].ToString().Trim());
|
||||
}
|
||||
string sValue = "";
|
||||
foreach (KeyValuePair<string, string> kpv in dicHeaderTextCPMC)
|
||||
{
|
||||
sValue = kpv.Value.ToString().Trim();
|
||||
AddColumn(0, "XLWBBJDNR_LMNR" + kpv.Key.ToString().Trim(), kpv.Value.ToString().Trim(), sValue.Length < 8 ? 160 : sValue.Length * 10 + 80, true);
|
||||
}
|
||||
}
|
||||
|
||||
public static bool ReCreate(string sWBBJDID, string sXLBJDID, TConfirm Confirm, Dictionary<string, string> dicLMBH, CMISproSession tSession, string sBJU003, string sDefaultXLBZID, ref string sErrMsg)
|
||||
{
|
||||
//判断是否导入报价单了
|
||||
string sSQL = string.Format("select top 1 XLXSBJDMX_BJDID from XLXSBJDMX where XLXSBJDMX_WBBJDID='{0}' and XLXSBJDMX_BJDID='{1}' ", sWBBJDID, sXLBJDID);
|
||||
if (CMISproDataBase.ExistsRecord("DBERP", sSQL))
|
||||
{
|
||||
sErrMsg = "已导入报价单,不允许重新生成!";
|
||||
return false;
|
||||
}
|
||||
|
||||
Confirm.Register("IsQD", "即将根据导入内容重新生成外部报价单明细,是否继续?");
|
||||
Confirm.ShowBtnText = TConfirm.cBtnText.Yes_No;
|
||||
if (Confirm.GetValue("IsQD").Trim().Equals(""))
|
||||
{
|
||||
Confirm.Ask("IsQD");
|
||||
return false;
|
||||
}
|
||||
else if (Confirm.GetValue("IsQD").Trim().Equals("N"))
|
||||
{
|
||||
//表示进行了提示并选择了取消,直接返回或其他处理
|
||||
Confirm.Clear();
|
||||
return false;
|
||||
}
|
||||
else if (Confirm.GetValue("IsQD").Trim().Equals("Y"))
|
||||
{
|
||||
//表示进行了提示并选择了确认
|
||||
Confirm.Clear();
|
||||
}
|
||||
|
||||
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
|
||||
TSQL SQL = new TSQL(dberp);
|
||||
try
|
||||
{
|
||||
dberp.BeginTrans();
|
||||
XLWBBJDUtils.InsXLWBBJDMX(dberp, SQL, sWBBJDID, sXLBJDID, tSession, ref sErrMsg);
|
||||
if (!sErrMsg.Equals(""))
|
||||
{
|
||||
throw new Exception(sErrMsg);
|
||||
}
|
||||
|
||||
//重新导入需要更新预处理字段为"N"
|
||||
SQL.Clear();
|
||||
SQL.Add("update XLWBBJDML set XLWBBJDML_YCL ='N' where XLWBBJDML_WBBJDID = :pWBBJDID and XLWBBJDML_BJDID = :pXLBJDID ");
|
||||
SQL.ParamByName("pWBBJDID").Value = sWBBJDID;
|
||||
SQL.ParamByName("pXLBJDID").Value = sXLBJDID;
|
||||
dberp.ExecSQL(SQL);
|
||||
dberp.CommitTrans();
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
sErrMsg = "自动生成外部报价单明细失败,请检查指定的报价单栏目是否正确!" + ex;
|
||||
dberp.RollbackTrans();
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static bool DobtnWBBJDMX_Click(string sWBBJDID, string sXLBJDID, Dictionary<string, string> dicLMBH, CMISproSession tSession, string sBJU003, string sDefaultXLBZID, ref string sErrMsg)
|
||||
{
|
||||
string sSQL = "";
|
||||
sSQL = string.Format("select top 1 XLWBBJDMX_BJDID from XLWBBJDMX where XLWBBJDMX_WBBJDID='{0}' and XLWBBJDMX_BJDID='{1}' ", sWBBJDID, sXLBJDID);
|
||||
if (!CMISproDataBase.ExistsRecord("DBERP", sSQL))
|
||||
{
|
||||
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
|
||||
TSQL SQL = new TSQL(dberp);
|
||||
try
|
||||
{
|
||||
dberp.BeginTrans();
|
||||
XLWBBJDUtils.InsXLWBBJDMX(dberp, SQL, sWBBJDID, sXLBJDID, tSession, ref sErrMsg);
|
||||
if (!sErrMsg.Equals(""))
|
||||
{
|
||||
throw new Exception(sErrMsg);
|
||||
}
|
||||
dberp.CommitTrans();
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
sErrMsg = "自动生成报价单明细失败,请检查指定的报价单栏目是否正确!" + ex;
|
||||
dberp.RollbackTrans();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool DobtnWBBJDMX_Click(string[] sWBBJDID, string sXLBJDID, Dictionary<string, string> dicLMBH, CMISproSession tSession, string sBJU003, string sDefaultXLBZID, ref string sErrMsg)
|
||||
{
|
||||
if (!(sWBBJDID.Length >= 1))
|
||||
return false;
|
||||
//同一个分组是同一个报价单id
|
||||
string sSQL = "";
|
||||
sSQL = string.Format("select top 1 XLWBBJDMX_BJDID from XLWBBJDMX where XLWBBJDMX_WBBJDID='{0}' and XLWBBJDMX_BJDID='{1}' ", sWBBJDID[0], sXLBJDID);
|
||||
if (!CMISproDataBase.ExistsRecord("DBERP", sSQL))
|
||||
{
|
||||
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
|
||||
TSQL SQL = new TSQL(dberp);
|
||||
try
|
||||
{
|
||||
dberp.BeginTrans();
|
||||
for (int i = 0; i < sWBBJDID.Length; i++)
|
||||
XLWBBJDUtils.InsXLWBBJDMX(dberp, SQL, sWBBJDID[i], sXLBJDID, tSession, ref sErrMsg);
|
||||
if (!sErrMsg.Equals(""))
|
||||
{
|
||||
throw new Exception(sErrMsg);
|
||||
}
|
||||
dberp.CommitTrans();
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
sErrMsg = "自动生成报价单明细失败,请检查指定的报价单栏目是否正确!" + ex;
|
||||
dberp.RollbackTrans();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region 按钮事件
|
||||
|
||||
//指定报价单栏目
|
||||
protected void btnZDBJDLM_Click(object sender, EventArgs e)
|
||||
{
|
||||
TPageParams pageParams = new TPageParams();
|
||||
pageParams.UrlPath = "XLBJD_WBBJDLMList.aspx";
|
||||
pageParams.AddString("WBBJDID", PageParam.GetRTrimString("WBBJDID"));
|
||||
//当前选中行的报价单ID
|
||||
pageParams.AddString("SELBJDID", PageParam.GetRTrimString("SELBJDID"));
|
||||
pageParams.AddString("MLFZH", PageParam.GetRTrimString("MLFZH"));
|
||||
OpenDialog(pageParams);
|
||||
}
|
||||
|
||||
//外部报价单明细以及重新生成
|
||||
protected void btnWBBJDMX_Click(object sender, EventArgs e)
|
||||
{
|
||||
//在点击外部报价单的时候判断栏目设置并且生成明细记录
|
||||
string sErrMsg = "";
|
||||
string sMLFZH = PageParam.GetRTrimString("MLFZH");
|
||||
string sBJDID = PageParam.GetRTrimString("SELBJDID").Equals("") ? " " : PageParam.GetRTrimString("SELBJDID");
|
||||
bool bResult = false;
|
||||
if (sMLFZH == "0")
|
||||
bResult = DobtnWBBJDMX_Click(PageParam.GetRTrimString("WBBJDID"), sBJDID, dicLMBH, tSession, GetOption(100860000, "BJU003"), XLBJDUtils.GetDefaultXLBZID(), ref sErrMsg);
|
||||
else
|
||||
{
|
||||
string[] sWBBJDIDList = XLWBBJDUtils.GetWBBJDListByMLFZH(sBJDID, PageParam.GetRTrimString("MLFZH")).Split(',');
|
||||
bResult = DobtnWBBJDMX_Click(sWBBJDIDList, PageParam.GetRTrimString("SELBJDID").Equals("") ? " " : PageParam.GetRTrimString("SELBJDID"), dicLMBH, tSession, GetOption(100860000, "BJU003"), XLBJDUtils.GetDefaultXLBZID(), ref sErrMsg);
|
||||
}
|
||||
if (!sErrMsg.Equals(""))
|
||||
{
|
||||
ShowMessage(sErrMsg);
|
||||
}
|
||||
if (bResult)
|
||||
{
|
||||
DialogOperationScript dos = new DialogOperationScript(this);
|
||||
//dos.SetOwnerControlValue(PageParam.GetRTrimString("txtSource"), "FNR");
|
||||
dos.SetCallbackArgument("OPEN");
|
||||
dos.CloseSelf();
|
||||
dos.Execute();
|
||||
}
|
||||
}
|
||||
|
||||
protected void btnWBBJDMX_MenuItemClick(object sender, string ItemIndex)
|
||||
{
|
||||
int index = Int32.Parse(ItemIndex);
|
||||
switch (index)
|
||||
{
|
||||
case 0:
|
||||
//重新生成
|
||||
string sErrMsg = "";
|
||||
bool bResult = ReCreate(PageParam.GetRTrimString("WBBJDID"), PageParam.GetRTrimString("SELBJDID").Equals("") ? " " : PageParam.GetRTrimString("SELBJDID"),
|
||||
Confirm, dicLMBH, tSession, GetOption(100860000, "BJU003"), XLBJDUtils.GetDefaultXLBZID(), ref sErrMsg);
|
||||
if (!sErrMsg.Equals(""))
|
||||
{
|
||||
ShowMessage(sErrMsg);
|
||||
}
|
||||
if (bResult)
|
||||
{
|
||||
DialogOperationScript dos = new DialogOperationScript(this);
|
||||
//dos.SetOwnerControlValue(PageParam.GetRTrimString("txtSource"), "FNR");
|
||||
dos.SetCallbackArgument("OPEN");
|
||||
dos.CloseSelf();
|
||||
dos.Execute();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//删除
|
||||
protected void btnDELETE_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
string sWBBJDID = PageParam.GetRTrimString("WBBJDID");
|
||||
string sSELBJDID = PageParam.GetRTrimString("SELBJDID").Equals("") ? " " : PageParam.GetRTrimString("SELBJDID");
|
||||
|
||||
if (ContentGrid.SelectedIndex < 0)
|
||||
{
|
||||
ShowMessage("请选择需要删除的记录!");
|
||||
return;
|
||||
}
|
||||
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
|
||||
TSQL SQL = new TSQL(dberp);
|
||||
SQL.Clear();
|
||||
SQL.Add(" delete from XLWBBJDNR where XLWBBJDNR_WBBJDID=:pWBBJDID and XLWBBJDNR_BJDID=:pBJDID and XLWBBJDNR_DRHH = :pDRHH ");
|
||||
SQL.ParamByName("pWBBJDID").Value = sWBBJDID;
|
||||
SQL.ParamByName("pBJDID").Value = sSELBJDID;
|
||||
SQL.ParamByName("pDRHH").Value = ContentGrid.DataKeys[ContentGrid.SelectedIndex]["XLWBBJDNR_DRHH"].ToString().Trim();
|
||||
dberp.ExecSQL(SQL);
|
||||
btnRefresh_Click(null, null);
|
||||
}
|
||||
|
||||
|
||||
protected void btnRefresh_Click(object sender, EventArgs e)
|
||||
{
|
||||
moduleGV_PageIndexChanging(null, null);
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region GridView增加列
|
||||
/// <summary>
|
||||
/// 设置etString列的属性
|
||||
/// </summary>
|
||||
/// <param name="sDataField"></param>
|
||||
/// <param name="HeadText"></param>
|
||||
/// <param name="Width"></param>
|
||||
private void AddColumn(int index, string sDataField, string HeadText, int Width, bool fVisible)
|
||||
{
|
||||
BoundField Column = new BoundField();
|
||||
Column.DataField = sDataField;
|
||||
Column.HeaderText = HeadText;
|
||||
Column.ItemStyle.Width = (Unit)Width;
|
||||
Column.HeaderStyle.Width = (Unit)Width;
|
||||
Column.Visible = fVisible;
|
||||
ContentGrid.Columns.Add(Column);
|
||||
|
||||
gtGridView_Column ColumnEx = new gtGridView_Column();
|
||||
ColumnEx.DataField = sDataField;
|
||||
ColumnEx.EditType = TEditType.etString;
|
||||
ColumnEx.ShowHint = true;
|
||||
ContentGrid.ColumnsEx.Insert(index, ColumnEx);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user