From f266afe56fd165c16dd38f0452161cb996ada738 Mon Sep 17 00:00:00 2001 From: fly-l <1420031550@qq.com> Date: Wed, 28 Jun 2023 16:54:27 +0800 Subject: [PATCH] 2023-06-28 --- .../File/Fastreport/组件打印.frx | 4 +- .../HJGL/PreDesign/PrePipeline.aspx.cs | 2 +- .../HJGL/WeldingManage/JotTwoDesign.aspx | 8 ++ .../HJGL/WeldingManage/JotTwoDesign.aspx.cs | 6 +- .../JotTwoDesign.aspx.designer.cs | 9 +++ .../HJGL/WeldingManage/WeldJointList.aspx | 7 +- .../HJGL/WeldingManage/WeldJointList.aspx.cs | 76 ++++++++++++++++++- .../WeldJointList.aspx.designer.cs | 9 +++ .../Controllers/FileUploadController.cs | 30 +++++--- 9 files changed, 128 insertions(+), 23 deletions(-) diff --git a/SGGL/FineUIPro.Web/File/Fastreport/组件打印.frx b/SGGL/FineUIPro.Web/File/Fastreport/组件打印.frx index dabc1087..5d47cd9a 100644 --- a/SGGL/FineUIPro.Web/File/Fastreport/组件打印.frx +++ b/SGGL/FineUIPro.Web/File/Fastreport/组件打印.frx @@ -1,5 +1,5 @@  - + using System; using System.Collections; using System.Collections.Generic; @@ -99,7 +99,7 @@ namespace FastReport } - + diff --git a/SGGL/FineUIPro.Web/HJGL/PreDesign/PrePipeline.aspx.cs b/SGGL/FineUIPro.Web/HJGL/PreDesign/PrePipeline.aspx.cs index 451c0bb0..3ebbaf32 100644 --- a/SGGL/FineUIPro.Web/HJGL/PreDesign/PrePipeline.aspx.cs +++ b/SGGL/FineUIPro.Web/HJGL/PreDesign/PrePipeline.aspx.cs @@ -237,7 +237,7 @@ namespace FineUIPro.Web.HJGL.PreDesign { string strSql = @" SELECT distinct com.PipelineComponentId,com.PipelineComponentCode,com.BoxNumber, com.PipelineId, punit.UnitName AS PreUnit,aunit.UnitName AS AssembleUnit, - com.QRCode,com.State,com.ProductionState,pipe.PlanStartDate,com.DrawingName,com.ReceiveDate, + com.QRCode,com.State,com.ProductionState,pipe.PlanStartDate,pipe.FlowingSection,com.DrawingName,com.ReceiveDate, person.PersonName FROM HJGL_Pipeline_Component com LEFT JOIN HJGL_Pipeline pipe ON pipe.PipelineId =com.PipelineId diff --git a/SGGL/FineUIPro.Web/HJGL/WeldingManage/JotTwoDesign.aspx b/SGGL/FineUIPro.Web/HJGL/WeldingManage/JotTwoDesign.aspx index 2455ccd5..0336ea13 100644 --- a/SGGL/FineUIPro.Web/HJGL/WeldingManage/JotTwoDesign.aspx +++ b/SGGL/FineUIPro.Web/HJGL/WeldingManage/JotTwoDesign.aspx @@ -5,6 +5,12 @@ 二次焊口信息 +
@@ -47,6 +53,8 @@ Width="240px" LabelWidth="80px" LabelAlign="Right"> + + diff --git a/SGGL/FineUIPro.Web/HJGL/WeldingManage/JotTwoDesign.aspx.cs b/SGGL/FineUIPro.Web/HJGL/WeldingManage/JotTwoDesign.aspx.cs index 71eaeb5d..fdf0390e 100644 --- a/SGGL/FineUIPro.Web/HJGL/WeldingManage/JotTwoDesign.aspx.cs +++ b/SGGL/FineUIPro.Web/HJGL/WeldingManage/JotTwoDesign.aspx.cs @@ -292,7 +292,8 @@ namespace FineUIPro.Web.HJGL.WeldingManage } SqlParameter[] parameter = listStr.ToArray(); DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); - + var SizeSum = tb.AsEnumerable().Select(x => x.Field("Size")).Sum(); + lbSize.Text=SizeSum.ToString(); // 2.获取当前分页数据 Grid1.RecordCount = tb.Rows.Count; var table = this.GetPagedDataTable(Grid1, tb); @@ -334,7 +335,8 @@ namespace FineUIPro.Web.HJGL.WeldingManage } SqlParameter[] parameter = listStr.ToArray(); DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); - + var SizeSum = tb.AsEnumerable().Select(x => x.Field("Size")).Sum(); + lbSize.Text = SizeSum.ToString(); // 2.获取当前分页数据 Grid1.RecordCount = tb.Rows.Count; var table = this.GetPagedDataTable(Grid1, tb); diff --git a/SGGL/FineUIPro.Web/HJGL/WeldingManage/JotTwoDesign.aspx.designer.cs b/SGGL/FineUIPro.Web/HJGL/WeldingManage/JotTwoDesign.aspx.designer.cs index 84d7c54d..4e1f44a8 100644 --- a/SGGL/FineUIPro.Web/HJGL/WeldingManage/JotTwoDesign.aspx.designer.cs +++ b/SGGL/FineUIPro.Web/HJGL/WeldingManage/JotTwoDesign.aspx.designer.cs @@ -122,6 +122,15 @@ namespace FineUIPro.Web.HJGL.WeldingManage /// protected global::FineUIPro.CheckBox ckIsAudit; + /// + /// lbSize 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Label lbSize; + /// /// DropTwoJointType 控件。 /// diff --git a/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldJointList.aspx b/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldJointList.aspx index 5a8f9d4b..8f588d9d 100644 --- a/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldJointList.aspx +++ b/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldJointList.aspx @@ -95,9 +95,10 @@ - - - + + + + diff --git a/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldJointList.aspx.cs b/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldJointList.aspx.cs index e8818b33..37562ac5 100644 --- a/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldJointList.aspx.cs +++ b/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldJointList.aspx.cs @@ -234,16 +234,22 @@ namespace FineUIPro.Web.HJGL.WeldingManage this.BindGrid1(this.tvControlItem.SelectedNodeID); this.BindGrid2(this.tvControlItem.SelectedNodeID); this.BindGrid3(this.tvControlItem.SelectedNodeID); - this.lbSinglePreRate.Label = "图纸预制率"; + this.lbSinglePreRate.Label = "图纸预制率(达因)"; this.lbSinglePreRate.Text = GetRateByPipelineid(this.tvControlItem.SelectedNodeID); + this.lbSinglePreRateByWeldJoint.Label = "图纸预制率(焊口)"; + this.lbSinglePreRateByWeldJoint.Text = GetWeldJointRateByPipelineid(this.tvControlItem.SelectedNodeID); + } else { this.hdUnitWorkId.Text = this.tvControlItem.SelectedNodeID; - this.lbSinglePreRate.Label = "主项预制率"; + this.lbSinglePreRate.Label = "主项预制率(达因)"; this.lbSinglePreRate.Text = GetRateByUnitWork(this.tvControlItem.SelectedNodeID); + this.lbSinglePreRateByWeldJoint.Label = "主项预制率(焊口)"; + this.lbSinglePreRateByWeldJoint.Text = GetWeldJointRateByUnitWork(this.tvControlItem.SelectedNodeID); + } this.lbShopSize.Text = ShopSumSize; this.lbFiledSize.Text = FieldSumSize; @@ -437,6 +443,37 @@ namespace FineUIPro.Web.HJGL.WeldingManage } return "0%"; } + + private string GetWeldJointRateByUnitWork(string unitworkid) + { + string rate = ""; + int ShopNum = 0; + int FieldNum = 0; + int AllNum = 0; + var db = Funs.DB; + var q = from x in db.View_HJGL_WeldJoint where x.UnitWorkId == unitworkid select x; + if (q != null && q.Count() > 0) + { + ShopNum = (from x in q + where x.JointAttribute == "预制口" + select x + ).Count(); + FieldNum = (from x in q + where x.JointAttribute == "安装口" + select x + ).Count(); + AllNum = ShopNum + FieldNum; + + if (AllNum > 0) + { + var a = (decimal)100 * ShopNum / AllNum; + rate = Math.Round((decimal)a, 1).ToString() + "%"; + } + + return rate; + } + return "0%"; + } private string GetRateByPipelineid(string pipelineid) { string rate = ""; @@ -484,8 +521,41 @@ namespace FineUIPro.Web.HJGL.WeldingManage } return "0%"; } + /// + /// 获取预制率(焊口) 预制口数量/总焊口数量 + /// + /// + /// + private string GetWeldJointRateByPipelineid(string pipelineid) + { + string rate = ""; + int ShopNum = 0; + int FieldNum = 0; + int AllNum = 0; + var db = Funs.DB; + var q = from x in db.View_HJGL_WeldJoint where x.PipelineId == pipelineid select x; + if (q != null && q.Count() > 0) + { + ShopNum = (from x in q + where x.JointAttribute == "预制口" select x + ).Count(); + FieldNum = (from x in q + where x.JointAttribute == "安装口" + select x + ).Count(); + AllNum = ShopNum + FieldNum; + + if (AllNum > 0) + { + var a = (decimal)100 * ShopNum / AllNum; + rate = Math.Round((decimal)a, 1).ToString() + "%"; + } + + return rate; + } + return "0%"; + } - #endregion #region 焊口信息 维护事件 diff --git a/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldJointList.aspx.designer.cs b/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldJointList.aspx.designer.cs index ad7790fe..933cb925 100644 --- a/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldJointList.aspx.designer.cs +++ b/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldJointList.aspx.designer.cs @@ -221,6 +221,15 @@ namespace FineUIPro.Web.HJGL.WeldingManage /// protected global::FineUIPro.Label lbSinglePreRate; + /// + /// lbSinglePreRateByWeldJoint 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Label lbSinglePreRateByWeldJoint; + /// /// lbShopSize 控件。 /// diff --git a/SGGL/WebAPI/Controllers/FileUploadController.cs b/SGGL/WebAPI/Controllers/FileUploadController.cs index b10f6848..57acff33 100644 --- a/SGGL/WebAPI/Controllers/FileUploadController.cs +++ b/SGGL/WebAPI/Controllers/FileUploadController.cs @@ -145,25 +145,25 @@ namespace WebAPI.Controllers /// /// [HttpPost] - public async Task DownloadDocument([FromBody] Model.SaveOnlineFileItem toDoItem) - //public async Task DownloadDocument( string UrlStr, string PCUrl) + public async Task DownloadDocument([FromBody] Model.SaveOnlineFileItem toDoItem) { var responeData = new Model.ResponeData(); - + HttpClient _httpClient = new HttpClient(); try { - // System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12; + System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12; + // 发送 GET 请求以获取文件内容 var response = await _httpClient.GetAsync(toDoItem.UrlStr); response.EnsureSuccessStatusCode(); + string savePath = ""; if (!string.IsNullOrEmpty(toDoItem.PCUrl)) { - savePath = ConfigurationManager.AppSettings["localRoot"]+toDoItem.PCUrl; - - + savePath = ConfigurationManager.AppSettings["localRoot"] + toDoItem.PCUrl; } + if (savePath != null) { // 将文件内容保存到本地 @@ -171,19 +171,25 @@ namespace WebAPI.Controllers { await response.Content.CopyToAsync(fileStream); } - responeData.data = "文件已成功下载并保存到本地"; - // Console.WriteLine("文件已成功下载并保存到本地。"); + responeData.code = 1; + responeData.data = "文件已成功下载并保存到本地"; + } + else + { + responeData.code = 0; + responeData.message = "保存路径为空"; } - return responeData; } catch (Exception ex) { - responeData.code=0; + responeData.code = 0; responeData.message = $"下载文件时出现错误:{ex.Message}"; - return responeData; } + + return responeData; } + #region 附件上传 /// /// 附件上传