From b6e254bfca6f3a06f84e7592c964a44cb9e1fca4 Mon Sep 17 00:00:00 2001 From: gaofei <231232131@163.com> Date: Tue, 19 Oct 2021 17:50:34 +0800 Subject: [PATCH] 1019-003-gaofei --- .gitignore | 1 + SGGL/BLL/API/APIGetHttpService.cs | 68 ++++++++++++++++++ SGGL/BLL/Common/Funs.cs | 8 +++ SGGL/FineUIPro.Web/ErrLog.txt | 69 +++++++++++++++++++ SGGL/FineUIPro.Web/Global.asax.cs | 13 ++-- .../ProjectData/Installation.aspx | 3 + .../ProjectData/Installation.aspx.cs | 32 ++++++++- .../ProjectData/Installation.aspx.designer.cs | 9 +++ 8 files changed, 195 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 6b3ba18d..c7bc02cb 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ /SGGLPackFile/PackFile/bin /SGGLPackFile +/SGGL/FineUIPro.Web/File/Excel/Temp diff --git a/SGGL/BLL/API/APIGetHttpService.cs b/SGGL/BLL/API/APIGetHttpService.cs index 9869e3eb..9fbb9cb7 100644 --- a/SGGL/BLL/API/APIGetHttpService.cs +++ b/SGGL/BLL/API/APIGetHttpService.cs @@ -145,5 +145,73 @@ namespace BLL } } } + + /// + /// 不做catch处理,需要在外部做 + /// + /// + /// 默认GET,空则补充为GET + /// 默认json,空则补充为json + /// 请求头部 + /// 请求body内容 + /// + public static string ControlHttp(string url, string method = "GET", string contenttype = "application/json;charset=utf-8", Hashtable header = null, string data = null) + { + + HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); + request.Method = string.IsNullOrEmpty(method) ? "GET" : method; + request.ContentType = string.IsNullOrEmpty(contenttype) ? "application/json;charset=utf-8" : contenttype; + if (header != null) + { + foreach (var i in header.Keys) + { + request.Headers.Add(i.ToString(), header[i].ToString()); + } + } + if (!string.IsNullOrEmpty(data)) + { + Stream RequestStream = request.GetRequestStream(); + byte[] bytes = Encoding.UTF8.GetBytes(data); + RequestStream.Write(bytes, 0, bytes.Length); + RequestStream.Close(); + } + + HttpWebResponse response = null; + Stream ResponseStream = null; + StreamReader StreamReader = null; + try + { + response = (HttpWebResponse)request.GetResponse(); + ResponseStream = response.GetResponseStream(); + StreamReader = new StreamReader(ResponseStream, Encoding.GetEncoding("utf-8")); + + string re = StreamReader.ReadToEnd(); + return re; + } + catch (WebException ex) + { + response = (HttpWebResponse)ex.Response; + ResponseStream = response.GetResponseStream(); + StreamReader = new StreamReader(ResponseStream, Encoding.GetEncoding("utf-8")); + + string re = StreamReader.ReadToEnd(); + return re; + } + finally + { + if (StreamReader != null) + { + StreamReader.Close(); + } + if (ResponseStream != null) + { + ResponseStream.Close(); + } + if (response != null) + { + response.Close(); + } + } + } } } diff --git a/SGGL/BLL/Common/Funs.cs b/SGGL/BLL/Common/Funs.cs index 12e6ee53..4c799577 100644 --- a/SGGL/BLL/Common/Funs.cs +++ b/SGGL/BLL/Common/Funs.cs @@ -103,6 +103,14 @@ namespace BLL set; } /// + /// ѿַ + /// + public static string ControlApiUrl + { + get; + set; + } + /// /// 汾 /// public static string SystemVersion diff --git a/SGGL/FineUIPro.Web/ErrLog.txt b/SGGL/FineUIPro.Web/ErrLog.txt index 30e81efa..fcd18812 100644 --- a/SGGL/FineUIPro.Web/ErrLog.txt +++ b/SGGL/FineUIPro.Web/ErrLog.txt @@ -17,3 +17,72 @@ IP地址:::1 出错时间:09/29/2021 15:32:37 + +错误信息开始=====> +错误类型:ProtocolViolationException +错误信息:无法发送具有此谓词类型的内容正文。 +错误堆栈: + 在 System.Net.HttpWebRequest.CheckProtocol(Boolean onRequestStream) + 在 System.Net.HttpWebRequest.GetRequestStream(TransportContext& context) + 在 System.Net.HttpWebRequest.GetRequestStream() + 在 BLL.APIGetHttpService.OutsideHttp(String url, String method, String contenttype, Hashtable header, String data) 位置 E:\工作\五环施工平台\SGGL_CWCEC\SGGL\BLL\API\APIGetHttpService.cs:行号 105 + 在 FineUIPro.Web.ProjectData.Installation.btnMenuDown_Click(Object sender, EventArgs e) 位置 E:\工作\五环施工平台\SGGL_CWCEC\SGGL\FineUIPro.Web\ProjectData\Installation.aspx.cs:行号 251 + 在 FineUIPro.MenuButton.OnClick(EventArgs e) + 在 (MenuButton , EventArgs ) + 在 FineUIPro.MenuButton.RaisePostBackEvent(String eventArgument) + 在 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) + 在 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) + 在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +出错时间:10/19/2021 16:10:16 +出错文件:http://localhost:8118/ProjectData/Installation.aspx +IP地址:::1 +操作人员:JT + +出错时间:10/19/2021 16:10:16 + + +错误信息开始=====> +错误类型:ProtocolViolationException +错误信息:无法发送具有此谓词类型的内容正文。 +错误堆栈: + 在 System.Net.HttpWebRequest.CheckProtocol(Boolean onRequestStream) + 在 System.Net.HttpWebRequest.GetRequestStream(TransportContext& context) + 在 System.Net.HttpWebRequest.GetRequestStream() + 在 BLL.APIGetHttpService.OutsideHttp(String url, String method, String contenttype, Hashtable header, String data) 位置 E:\工作\五环施工平台\SGGL_CWCEC\SGGL\BLL\API\APIGetHttpService.cs:行号 105 + 在 FineUIPro.Web.ProjectData.Installation.btnMenuDown_Click(Object sender, EventArgs e) 位置 E:\工作\五环施工平台\SGGL_CWCEC\SGGL\FineUIPro.Web\ProjectData\Installation.aspx.cs:行号 251 + 在 FineUIPro.MenuButton.OnClick(EventArgs e) + 在 (MenuButton , EventArgs ) + 在 FineUIPro.MenuButton.RaisePostBackEvent(String eventArgument) + 在 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) + 在 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) + 在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +出错时间:10/19/2021 16:10:56 +出错文件:http://localhost:8118/ProjectData/Installation.aspx +IP地址:::1 +操作人员:JT + +出错时间:10/19/2021 16:10:56 + + +错误信息开始=====> +错误类型:ProtocolViolationException +错误信息:无法发送具有此谓词类型的内容正文。 +错误堆栈: + 在 System.Net.HttpWebRequest.CheckProtocol(Boolean onRequestStream) + 在 System.Net.HttpWebRequest.GetRequestStream(TransportContext& context) + 在 System.Net.HttpWebRequest.GetRequestStream() + 在 BLL.APIGetHttpService.OutsideHttp(String url, String method, String contenttype, Hashtable header, String data) 位置 E:\工作\五环施工平台\SGGL_CWCEC\SGGL\BLL\API\APIGetHttpService.cs:行号 105 + 在 FineUIPro.Web.ProjectData.Installation.btnMenuDown_Click(Object sender, EventArgs e) 位置 E:\工作\五环施工平台\SGGL_CWCEC\SGGL\FineUIPro.Web\ProjectData\Installation.aspx.cs:行号 251 + 在 FineUIPro.MenuButton.OnClick(EventArgs e) + 在 (MenuButton , EventArgs ) + 在 FineUIPro.MenuButton.RaisePostBackEvent(String eventArgument) + 在 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) + 在 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) + 在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +出错时间:10/19/2021 16:11:45 +出错文件:http://localhost:8118/ProjectData/Installation.aspx +IP地址:::1 +操作人员:JT + +出错时间:10/19/2021 16:11:45 + diff --git a/SGGL/FineUIPro.Web/Global.asax.cs b/SGGL/FineUIPro.Web/Global.asax.cs index f3a3d41c..3bc99df7 100644 --- a/SGGL/FineUIPro.Web/Global.asax.cs +++ b/SGGL/FineUIPro.Web/Global.asax.cs @@ -20,13 +20,14 @@ try { Funs.RootPath = Server.MapPath("~/"); - + // 日志文件所在目录 ErrLogInfo.DefaultErrLogFullPath = Server.MapPath("~/ErrLog.txt"); Funs.ConnString = ConfigurationManager.AppSettings["ConnectionString"]; Funs.SystemName = ConfigurationManager.AppSettings["SystemName"]; Funs.SGGLUrl = ConfigurationManager.AppSettings["SGGLUrl"]; Funs.RealNameApiUrl = ConfigurationManager.AppSettings["RealNameApiUrl"]; + Funs.ControlApiUrl = ConfigurationManager.AppSettings["ControlApiUrl"]; } catch (Exception ex) { @@ -38,7 +39,7 @@ try { string address = ConfigurationManager.AppSettings["endpoint"]; - Funs.SystemVersion = ConfigurationManager.AppSettings["SystemVersion"]; + Funs.SystemVersion = ConfigurationManager.AppSettings["SystemVersion"]; } catch (Exception ex) { @@ -49,7 +50,7 @@ { BLL.RealNameMonitorService.StartInOutMonitor(); if (ConfigurationManager.AppSettings["EnableRealName"] == "True") - { + { BLL.RealNameMonitorService.StartMonitor(); } } @@ -59,7 +60,7 @@ } ////通用定时器 try - { + { BLL.MonitorService.StartMonitor(); BLL.MonitorService.StartMonitorEve(); BLL.MonitorService.StartPersonQuarterCheck(); @@ -80,7 +81,7 @@ } protected void Application_BeginRequest(object sender, EventArgs e) - { + { } protected void Application_AuthenticateRequest(object sender, EventArgs e) @@ -140,7 +141,7 @@ { if (errLog != null) { - db.Sys_ErrLogInfo.InsertOnSubmit(newErr); + db.Sys_ErrLogInfo.InsertOnSubmit(newErr); db.SubmitChanges(); } diff --git a/SGGL/FineUIPro.Web/ProjectData/Installation.aspx b/SGGL/FineUIPro.Web/ProjectData/Installation.aspx index 980b2fe4..17d3aec0 100644 --- a/SGGL/FineUIPro.Web/ProjectData/Installation.aspx +++ b/SGGL/FineUIPro.Web/ProjectData/Installation.aspx @@ -97,6 +97,9 @@ Width="800px" Height="300px"> + diff --git a/SGGL/FineUIPro.Web/ProjectData/Installation.aspx.cs b/SGGL/FineUIPro.Web/ProjectData/Installation.aspx.cs index c7f045c7..1793ed60 100644 --- a/SGGL/FineUIPro.Web/ProjectData/Installation.aspx.cs +++ b/SGGL/FineUIPro.Web/ProjectData/Installation.aspx.cs @@ -8,6 +8,7 @@ using System.Web.UI; using System.Web.UI.WebControls; using BLL; using Newtonsoft.Json.Linq; +using Newtonsoft.Json; namespace FineUIPro.Web.ProjectData { @@ -46,6 +47,7 @@ namespace FineUIPro.Web.ProjectData { if (buttonList.Contains(BLL.Const.BtnAdd)) { + this.btnMenuDown.Hidden = false; this.btnMenuAdd.Hidden = false; } if (buttonList.Contains(BLL.Const.BtnModify)) @@ -227,7 +229,33 @@ namespace FineUIPro.Web.ProjectData } #endregion - #region 右键增加、修改、删除方法 + #region 右键抽取、增加、修改、删除方法 + /// + /// 抽取 + /// + /// + /// + protected void btnMenuDown_Click(object sender, EventArgs e) + { + if (this.trProjects.SelectedNode != null) + { + if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.ProjectInstallationMenuId, BLL.Const.BtnAdd)) + { + string url = Funs.RealNameApiUrl + "/Projects/GetConstructionWbsList"; + string contenttype = "application/json;charset=utf-8"; + var returndata = BLL.APIGetHttpService.ControlHttp(Funs.ControlApiUrl + "/Projects/GetConstructionWbsList?ProjId=" + 2370, "GET", contenttype, null, null); + } + else + { + ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning); + } + } + else + { + ShowNotify("请选择树节点!", MessageBoxIcon.Warning); + } + } + /// /// 右键修改事件 /// @@ -348,7 +376,7 @@ namespace FineUIPro.Web.ProjectData private void DeleteBaseData(string installationId) { - Model.Project_Installation installation=BLL.Project_InstallationService.GetInstallationByInstallationId(installationId); + Model.Project_Installation installation = BLL.Project_InstallationService.GetInstallationByInstallationId(installationId); if (installation.IsEnd == false) { BLL.Project_InstallationService.DeleteInstallation(installationId); diff --git a/SGGL/FineUIPro.Web/ProjectData/Installation.aspx.designer.cs b/SGGL/FineUIPro.Web/ProjectData/Installation.aspx.designer.cs index 81c89e9c..46b190ec 100644 --- a/SGGL/FineUIPro.Web/ProjectData/Installation.aspx.designer.cs +++ b/SGGL/FineUIPro.Web/ProjectData/Installation.aspx.designer.cs @@ -174,6 +174,15 @@ namespace FineUIPro.Web.ProjectData { /// protected global::FineUIPro.Menu Menu1; + /// + /// btnMenuDown 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.MenuButton btnMenuDown; + /// /// btnMenuAdd 控件。 ///