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_WORKFLOW; using GThinking.N_MISPRO; using GThinking.N_MISPRO.Data; using GThinking.N_MISPRO.Utility; using System.Text; using GThinking.N_CONTROL; namespace GThinking.N_XLXSBJ { public partial class CLHQHistory : SingleGridBase { XLXSCLHQ_HIS entity = new XLXSCLHQ_HIS(); #region Page_Load protected void Page_Load(object sender, EventArgs e) { this.UMID = 100860003; this.UMName = "线缆销售报价材料行情"; this.CurMaster = Master; this.ModuleGV = grdGrid; this.CurEntity = entity; this.PageWidth = 400; this.PageHeight = 500; this.Master.EnableNewBtn = false; this.Master.EnableEditBtn = false; this.Master.EnableCopyBtn = false; this.Master.EnableDeleteBtn = false; this.Master.EnableViewBtn = false; base.DataKeyNames = new string[] { "HIS_YXQS" }; if (!IsPostBack) { TDatabase dberp = TContextDatabases.GetDatabase("DBERP"); TSQL SQL = new TSQL(dberp); SQL.Clear(); SQL.Add(" select XLXSBJCL_JGYBJCLID,XLXSBJCL_BJCLID from XLXSBJCL where XLXSBJCL_BJCLID = :pBJCLID "); SQL.ParamByName("pBJCLID").Value = PageParam.GetRTrimString("BJCLID"); DataSet dsBJCL = dberp.OpenDataSet(SQL); if (dsBJCL.Tables[0].Rows.Count > 0) { //加工原料 铜 if (dsBJCL.Tables[0].Rows[0][0].ToString().Trim().Equals("")) { grdGrid.FindColumnByFieldName("HIS_WSJGF").Visible = false; grdGrid.FindColumnByFieldName("HIS_HSJGF").Visible = false; grdGrid.FindColumnByFieldName("HIS_WSCGJG").Visible = true; grdGrid.FindColumnByFieldName("HIS_HSCGJG").Visible = true; } //加工料 铜丝 else { grdGrid.FindColumnByFieldName("HIS_WSJGF").Visible = true; grdGrid.FindColumnByFieldName("HIS_HSJGF").Visible = true; grdGrid.FindColumnByFieldName("HIS_WSCGJG").Visible = false; grdGrid.FindColumnByFieldName("HIS_HSCGJG").Visible = false; } } else { grdGrid.FindColumnByFieldName("HIS_WSJGF").Visible = false; grdGrid.FindColumnByFieldName("HIS_HSJGF").Visible = false; grdGrid.FindColumnByFieldName("HIS_WSCGJG").Visible = true; grdGrid.FindColumnByFieldName("HIS_HSCGJG").Visible = true; } } grdGrid.FindColumnExByFieldName("HIS_WSJGF").NumberDecimalPlace = XLBJDUtils.BJCLPriceDecimal; grdGrid.FindColumnExByFieldName("HIS_WSCGJG").NumberDecimalPlace = XLBJDUtils.BJCLPriceDecimal; grdGrid.FindColumnExByFieldName("HIS_WSJG").NumberDecimalPlace = XLBJDUtils.BJCLPriceDecimal; grdGrid.FindColumnExByFieldName("HIS_HSJGF").NumberDecimalPlace = XLBJDUtils.BJCLPriceDecimal; grdGrid.FindColumnExByFieldName("HIS_HSCGJG").NumberDecimalPlace = XLBJDUtils.BJCLPriceDecimal; grdGrid.FindColumnExByFieldName("HIS_HSJG").NumberDecimalPlace = XLBJDUtils.BJCLPriceDecimal; base.InitPage(); grdGrid.OnClientDblClick = "return false;"; if (!IsPostBack) { Master_OnStandardQuery(null, null); } } #endregion #region 模板事件继承 protected override void Master_OnStandardQuery(object sender, EventArgs e) { entity.EntityTable.QuerySelSql = GetQuerySql(); base.Master_OnStandardQuery(sender, e); entity.GridDataBind(grdGrid, tSession); } protected override bool Master_AfterDeleteAction(object sender, EventArgs e) { entity.EntityTable.QuerySelSql = GetQuerySql(); entity.GridDataBind(grdGrid, tSession); grdGrid.SelectedIndex = -1; return true; } protected override void moduleGV_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { try { string sBJCLID = PageParam.GetRTrimString("BJCLID"); string sBDQK = ""; int index_WHSJ = grdGrid.Columns.IndexOf(grdGrid.FindColumnByFieldName("HIS_WHSJ")); string sYXQS = grdGrid.DataKeys[e.Row.RowIndex]["HIS_YXQS"].ToString().Trim(); TDatabase dberp = TContextDatabases.GetDatabase("DBERP"); TSQL SQL = new TSQL(dberp); SQL.Clear(); SQL.Add("select XLXSCLHQ_BDQK,XLXSCLHQ_HSJG,XLXSCLHQ_WHR,XLXSCLHQ_WHSJ "); SQL.Add(" from XLXSCLHQ "); SQL.Add(" where XLXSCLHQ_JGBID ='ZZZZZZZZ' and XLXSCLHQ_YXQS= :pRQ and XLXSCLHQ_BJCLID = :pBJCLID "); SQL.ParamByName("pRQ").Value = sYXQS; SQL.ParamByName("pBJCLID").Value = sBJCLID; DataSet dsCLHQ = dberp.OpenDataSet(SQL); if (dsCLHQ.Tables[0].Rows.Count > 0) { sBDQK = dsCLHQ.Tables[0].Rows[0]["XLXSCLHQ_BDQK"].ToString().Trim(); if (!sBDQK.Equals("")) { e.Row.Cells[index_WHSJ].ToolTip = sBDQK.Replace("|", "\r\n"); } } } catch { } } base.moduleGV_RowDataBound(sender, e); } protected override void moduleGV_PageIndexChanging(object sender, GridViewPageEventArgs e) { entity.EntityTable.QuerySelSql = GetQuerySql(); grdGrid.SelectedIndex = -1; base.moduleGV_PageIndexChanging(sender, e); } #endregion #region 自定义函数 private string GetQuerySql() { string sBJCLID = PageParam.GetRTrimString("BJCLID"); StringBuilder strSql = new StringBuilder(); strSql.AppendLine("select XLXSCLHQ_YXQS as HIS_YXQS, XLXSCLHQ_YXQZ as HIS_YXQZ,"); strSql.AppendLine("isnull(XLXSCLHQ_WSJGF,0.0) as HIS_WSJGF,isnull(XLXSCLHQ_WSCGJG,0.0) as HIS_WSCGJG, isnull(XLXSCLHQ_WSJG,0.0) as HIS_WSJG,isnull(XLXSCLHQ_HSJGF,0.0) as HIS_HSJGF,isnull(XLXSCLHQ_HSCGJG,0.0) as HIS_HSCGJG,isnull(XLXSCLHQ_HSJG,0.0) as HIS_HSJG,"); strSql.AppendLine("isnull(XLXSCLHQ_BZ, ' ') as HIS_BZ, isnull(XLXSCLHQ_WHR, ' ') as HIS_WHR,XLXSCLHQ_WHRID, XLXSCLHQ_WHSJ as HIS_WHSJ"); strSql.AppendLine("from XLXSCLHQ"); strSql.AppendLine("where XLXSCLHQ_BJCLID =:pXLXSCLHQ_BJCLID and XLXSCLHQ_JGBID ='ZZZZZZZZ'"); strSql.AppendLine("order by XLXSCLHQ_YXQS desc"); entity.Param.Add("pXLXSCLHQ_BJCLID", sBJCLID); return strSql.ToString(); } #endregion } }