From 6e6f3d42fde58c98cb921cab87e84193e1fbd042 Mon Sep 17 00:00:00 2001 From: wendy <408182087@qq.com> Date: Wed, 24 Sep 2025 15:27:48 +0800 Subject: [PATCH] =?UTF-8?q?20250924=20=E4=BF=AE=E6=94=B9=E6=8E=92=E4=BA=A7?= =?UTF-8?q?=E8=AE=A1=E5=88=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProductionSchedulingPlanService.cs | 2 + .../HJGL/WeldingManage/WeldJointService.cs | 130 ++++++++++++++---- .../PreDesign/ProductionSchedulingPlan.aspx | 30 ++-- .../ProductionSchedulingPlan.aspx.cs | 112 +++++++++++---- .../ProductionSchedulingPlan.aspx.designer.cs | 18 --- 5 files changed, 215 insertions(+), 77 deletions(-) diff --git a/SGGL/BLL/HJGL/PreDesign/ProductionSchedulingPlanService.cs b/SGGL/BLL/HJGL/PreDesign/ProductionSchedulingPlanService.cs index ab72d20e..7e5d5131 100644 --- a/SGGL/BLL/HJGL/PreDesign/ProductionSchedulingPlanService.cs +++ b/SGGL/BLL/HJGL/PreDesign/ProductionSchedulingPlanService.cs @@ -55,6 +55,8 @@ namespace BLL newPlan.CompletedCount = plan.CompletedCount; newPlan.CompletedRate = plan.CompletedRate; newPlan.TotalCompletedRate = plan.TotalCompletedRate; + newPlan.OnDayCompleteDyne = plan.OnDayCompleteDyne; + newPlan.NextDayCompleteDyne = plan.NextDayCompleteDyne; db.HJGL_ProductionSchedulingPlan.InsertOnSubmit(newPlan); db.SubmitChanges(); } diff --git a/SGGL/BLL/HJGL/WeldingManage/WeldJointService.cs b/SGGL/BLL/HJGL/WeldingManage/WeldJointService.cs index 230f8d1e..e9c4010f 100644 --- a/SGGL/BLL/HJGL/WeldingManage/WeldJointService.cs +++ b/SGGL/BLL/HJGL/WeldingManage/WeldJointService.cs @@ -640,9 +640,9 @@ namespace BLL /// 流水段 /// 材质 /// 口径 - /// 1-总达因,2-完成总达因 + /// 1-达因,2-完成达因 /// - public static decimal? GetSizeSum(string projectId, string unitWorkId, string flowingSection, string steelType, string caliber,string type) + public static decimal? GetSizeSum(string projectId, string unitWorkId, string flowingSection, string steelType, string caliber, string type) { Model.SGGLDB db = Funs.DB; decimal? sizeSum = 0; @@ -655,38 +655,40 @@ namespace BLL join z in db.Base_Material on y.MaterialId equals z.MaterialId where x.ProjectId == projectId && y.UnitWorkId == unitWorkId && y.FlowingSection == flowingSection && z.SteelType == steelType && y.PipeArea == "1" && x.JointAttribute == "预制口" - //&& Convert.ToInt32(x.DNDia.Substring(2, x.DNDia.Length - 2)) < c select x); foreach (var item in weldjoints) { - int s = Convert.ToInt32(item.DNDia.Substring(2, item.DNDia.Length - 2)); - if (caliber.Substring(0, 1) == "<" && s < c) + if (!string.IsNullOrEmpty(item.DNDia) && item.DNDia != null) { - if (type == "1") + int s = Convert.ToInt32(item.DNDia.Substring(2, item.DNDia.Length - 2)); + if (caliber.Substring(0, 1) == "<" && s < c) { - sizeSum += item.Size; - } - else - { - if (!string.IsNullOrEmpty(item.WeldingDailyId)) + if (type == "1") { sizeSum += item.Size; } + else + { + if (!string.IsNullOrEmpty(item.WeldingDailyId)) + { + sizeSum += item.Size; + } + } } - } - else if (caliber.Substring(0, 1) == "≥" && s >= c) - { - if (type == "1") + else if (caliber.Substring(0, 1) == "≥" && s >= c) { - sizeSum += item.Size; - } - else - { - if (!string.IsNullOrEmpty(item.WeldingDailyId)) + if (type == "1") { sizeSum += item.Size; } + else + { + if (!string.IsNullOrEmpty(item.WeldingDailyId)) + { + sizeSum += item.Size; + } + } } } } @@ -695,14 +697,14 @@ namespace BLL } /// - /// 根据单位工程、流水段获取总达因 + /// 根据单位工程、流水段获取优先级总达因、完成总达因 /// /// 项目id /// 单位工程 /// 流水段 /// 1-总达因,2-完成总达因 /// - public static decimal? GetSizeSumByUnitWorkIdAndFlowingSection(string projectId, string unitWorkId, string flowingSection,string type) + public static decimal? GetSizeSumByUnitWorkIdAndFlowingSection(string projectId, string unitWorkId, string flowingSection, string type) { Model.SGGLDB db = Funs.DB; decimal? sizeSum = 0; @@ -710,7 +712,7 @@ namespace BLL { sizeSum = (from x in db.HJGL_WeldJoint join y in db.HJGL_Pipeline on x.PipelineId equals y.PipelineId - join z in db.Base_Material on y.MaterialId equals z.MaterialId + //join z in db.Base_Material on y.MaterialId equals z.MaterialId where x.ProjectId == projectId && y.UnitWorkId == unitWorkId && y.FlowingSection == flowingSection && y.PipeArea == "1" && x.JointAttribute == "预制口" select x.Size).Sum(); @@ -719,7 +721,7 @@ namespace BLL { sizeSum = (from x in db.HJGL_WeldJoint join y in db.HJGL_Pipeline on x.PipelineId equals y.PipelineId - join z in db.Base_Material on y.MaterialId equals z.MaterialId + //join z in db.Base_Material on y.MaterialId equals z.MaterialId where x.ProjectId == projectId && y.UnitWorkId == unitWorkId && y.FlowingSection == flowingSection && y.PipeArea == "1" && x.JointAttribute == "预制口" && x.WeldingDailyId != "" && x.WeldingDailyId != null @@ -727,5 +729,85 @@ namespace BLL } return sizeSum; } + + /// + /// 根据单位工程、流水段、材质获取总达因(按材质) + /// + /// 项目id + /// 单位工程id + /// 流水号 + /// 材质 + /// + public static decimal? GetSizeSumByUnitWorkIdAndFlowingSectionAndMaterial(string projectId, string unitWorkId, string flowingSection, string steelType) + { + Model.SGGLDB db = Funs.DB; + decimal? sizeSum = 0; + sizeSum = (from x in db.HJGL_WeldJoint + join y in db.HJGL_Pipeline on x.PipelineId equals y.PipelineId + join z in db.Base_Material on y.MaterialId equals z.MaterialId + where x.ProjectId == projectId && y.UnitWorkId == unitWorkId && y.FlowingSection == flowingSection + && y.PipeArea == "1" && x.JointAttribute == "预制口" + && z.SteelType == steelType + select x.Size).Sum(); + return sizeSum; + } + + + /// + /// 获取当日已完成量 + /// + /// + /// + /// + /// + /// + /// + public static decimal? GetCurrentDaySizeSum(string projectId, string unitWorkId, string flowingSection, string steelType, string caliber) + { + Model.SGGLDB db = Funs.DB; + decimal? sizeSum = 0; + int c = 0; + if (!string.IsNullOrEmpty(caliber)) + { + c = Convert.ToInt32(caliber.Substring(1, caliber.Length - 1)); + var weldjoints = (from x in db.HJGL_WeldJoint + join y in db.HJGL_Pipeline on x.PipelineId equals y.PipelineId + join z in db.Base_Material on y.MaterialId equals z.MaterialId + where x.ProjectId == projectId && y.UnitWorkId == unitWorkId && y.FlowingSection == flowingSection && z.SteelType == steelType + && y.PipeArea == "1" && x.JointAttribute == "预制口" + select x); + + foreach (var item in weldjoints) + { + if (!string.IsNullOrEmpty(item.DNDia) && item.DNDia != null) + { + int s = Convert.ToInt32(item.DNDia.Substring(2, item.DNDia.Length - 2)); + if (caliber.Substring(0, 1) == "<" && s < c) + { + if (!string.IsNullOrEmpty(item.WeldingDailyId)) + { + var weldingDaily = BLL.WeldingDailyService.GetPipeline_WeldingDailyByWeldingDailyId(item.WeldingDailyId); + if (weldingDaily != null && weldingDaily.WeldingDate.HasValue && weldingDaily.WeldingDate.Value.ToShortDateString() == DateTime.Now.ToShortDateString()) + { + sizeSum += item.Size; + } + } + } + else if (caliber.Substring(0, 1) == "≥" && s >= c) + { + if (!string.IsNullOrEmpty(item.WeldingDailyId)) + { + var weldingDaily = BLL.WeldingDailyService.GetPipeline_WeldingDailyByWeldingDailyId(item.WeldingDailyId); + if (weldingDaily != null && weldingDaily.WeldingDate.HasValue && weldingDaily.WeldingDate.Value.ToShortDateString() == DateTime.Now.ToShortDateString()) + { + sizeSum += item.Size; + } + } + } + } + } + } + return sizeSum; + } } } diff --git a/SGGL/FineUIPro.Web/HJGL/PreDesign/ProductionSchedulingPlan.aspx b/SGGL/FineUIPro.Web/HJGL/PreDesign/ProductionSchedulingPlan.aspx index adee1de5..fcbc9628 100644 --- a/SGGL/FineUIPro.Web/HJGL/PreDesign/ProductionSchedulingPlan.aspx +++ b/SGGL/FineUIPro.Web/HJGL/PreDesign/ProductionSchedulingPlan.aspx @@ -7,6 +7,12 @@ 排产计划 +
@@ -56,7 +62,7 @@ EnableColumnLines="true" ClicksToEdit="1" DataIDField="ProductionSchedulingPlanId" AllowSorting="true" SortField="FlowNum,Material,Caliber" SortDirection="ASC" OnSort="Grid1_Sort" AllowPaging="true" IsDatabasePaging="true" PageSize="15" OnPageIndexChange="Grid1_PageIndexChange" - EnableTextSelection="True"> + EnableTextSelection="True" OnRowDataBound="Grid1_RowDataBound"> @@ -80,23 +86,23 @@ DataField="Dain" SortField="Dain" FieldType="Float" HeaderTextAlign="Center" TextAlign="Left" Width="90px"> - + Width="150px"> - + Width="190px"> - - + <%-- - + --%> --%> - @@ -129,9 +135,9 @@ - + <%-- - + --%> listStr = new List(); - listStr.Add(new SqlParameter("@projectId", this.CurrUser.LoginProjectId)); + listStr.Add(new SqlParameter("@projectId", projectId)); if (!string.IsNullOrEmpty(this.tvControlItem.SelectedNode.ParentNode.NodeID)) { listStr.Add(new SqlParameter("@unitWorkId", this.tvControlItem.SelectedNode.ParentNode.NodeID)); @@ -252,7 +253,7 @@ namespace FineUIPro.Web.HJGL.PreDesign DataTable tb = SQLHelper.GetDataTableRunProc("Sp_ProductionSchedulingPlanStatistics", parameter); //删除原有数据 - BLL.ProductionSchedulingPlanService.DeleteProductionSchedulingPlanByUnitWorkIdAndFlowNum(this.CurrUser.LoginProjectId,this.tvControlItem.SelectedNode.ParentNode.Text, this.tvControlItem.SelectedNode.Text); + BLL.ProductionSchedulingPlanService.DeleteProductionSchedulingPlanByUnitWorkIdAndFlowNum(projectId, this.tvControlItem.SelectedNode.ParentNode.Text, this.tvControlItem.SelectedNode.Text); for (int i = 0; i < tb.Rows.Count; i++) { string unitWorkId = tb.Rows[i]["UnitWorkId"].ToString();//单位工程 @@ -261,32 +262,52 @@ namespace FineUIPro.Web.HJGL.PreDesign string material = tb.Rows[i]["Material"].ToString();//材质Text string caliber = tb.Rows[i]["Caliber"].ToString();//寸径 - var plan = BLL.ProductionSchedulingPlanService.GetProductionSchedulingPlan(this.CurrUser.LoginProjectId, flowingSection, unitWorkId, material, caliber); + var plan = BLL.ProductionSchedulingPlanService.GetProductionSchedulingPlan(projectId, flowingSection, unitWorkId, material, caliber); if (plan == null) { Model.HJGL_ProductionSchedulingPlan newPlan = new HJGL_ProductionSchedulingPlan(); newPlan.ProductionSchedulingPlanId = SQLHelper.GetNewID(typeof(Model.HJGL_ProductionSchedulingPlan)); - newPlan.ProjectId = this.CurrUser.LoginProjectId; + newPlan.ProjectId = projectId; newPlan.PipelineId = unitWorkId; newPlan.FlowNum = flowingSection; newPlan.MainItemName = tb.Rows[i]["UnitWorkName"].ToString(); newPlan.Material = material; newPlan.Caliber = caliber; - newPlan.Dain = BLL.WeldJointService.GetSizeSum(this.CurrUser.LoginProjectId, unitWorkId, flowingSection, steelType, caliber,"1"); - newPlan.TotalDyne = BLL.WeldJointService.GetSizeSumByUnitWorkIdAndFlowingSection(this.CurrUser.LoginProjectId, unitWorkId, flowingSection,"1"); - newPlan.CompletedCount = BLL.WeldJointService.GetSizeSum(this.CurrUser.LoginProjectId, unitWorkId, flowingSection, steelType, caliber, "2"); + newPlan.Dain = BLL.WeldJointService.GetSizeSum(projectId, unitWorkId, flowingSection, steelType, caliber, "1");//达因数 + var dyne = BLL.WeldJointService.GetSizeSumByUnitWorkIdAndFlowingSectionAndMaterial(projectId, unitWorkId, flowingSection, steelType);//总达因(按材质) + if (dyne != null) + { + newPlan.TotalDyne = dyne; + } + else + { + newPlan.TotalDyne = 0; + } + newPlan.PriorityTotalDyne = BLL.WeldJointService.GetSizeSumByUnitWorkIdAndFlowingSection(projectId, unitWorkId, flowingSection, "1");//总达因 + //当日已完成量 + var currentDay = BLL.WeldJointService.GetCurrentDaySizeSum(projectId, unitWorkId, flowingSection, steelType, caliber); + if (currentDay != null) + { + newPlan.OnDayCompleteDyne = currentDay; + } + else + { + newPlan.OnDayCompleteDyne = 0; + } + + newPlan.CompletedCount = BLL.WeldJointService.GetSizeSum(projectId, unitWorkId, flowingSection, steelType, caliber, "2");//累计已完成量 if (newPlan.Dain > 0) { - newPlan.CompletedRate = (newPlan.CompletedCount / newPlan.Dain) * 100; + newPlan.CompletedRate = (newPlan.CompletedCount / newPlan.Dain) * 100;//已完成百分比 } else { newPlan.CompletedRate = 0; } - if (newPlan.TotalDyne > 0) + if (newPlan.PriorityTotalDyne > 0) { - decimal? completeDinSum = BLL.WeldJointService.GetSizeSumByUnitWorkIdAndFlowingSection(this.CurrUser.LoginProjectId, unitWorkId, flowingSection, "2"); - newPlan.TotalCompletedRate = (completeDinSum / newPlan.TotalDyne) * 100; + decimal? completeDinSum = BLL.WeldJointService.GetSizeSumByUnitWorkIdAndFlowingSection(projectId, unitWorkId, flowingSection, "2");//完成总达因 + newPlan.TotalCompletedRate = (completeDinSum / newPlan.PriorityTotalDyne) * 100;//已完成百分比汇总 } else { @@ -299,7 +320,7 @@ namespace FineUIPro.Web.HJGL.PreDesign else if (tvControlItem.SelectedNode.CommandName.Split('|').Length == 2)//单位工程 { List listStr = new List(); - listStr.Add(new SqlParameter("@projectId", this.CurrUser.LoginProjectId)); + listStr.Add(new SqlParameter("@projectId", projectId)); if (!string.IsNullOrEmpty(this.tvControlItem.SelectedNode.NodeID)) { listStr.Add(new SqlParameter("@unitWorkId", this.tvControlItem.SelectedNode.NodeID)); @@ -317,7 +338,7 @@ namespace FineUIPro.Web.HJGL.PreDesign DataTable tb = SQLHelper.GetDataTableRunProc("Sp_ProductionSchedulingPlanStatistics", parameter); //删除原有数据 - BLL.ProductionSchedulingPlanService.DeleteProductionSchedulingPlanByUnitWork(this.CurrUser.LoginProjectId, this.tvControlItem.SelectedNode.Text); + BLL.ProductionSchedulingPlanService.DeleteProductionSchedulingPlanByUnitWork(projectId, this.tvControlItem.SelectedNode.Text); for (int i = 0; i < tb.Rows.Count; i++) { string unitWorkId = tb.Rows[i]["UnitWorkId"].ToString();//单位工程 @@ -325,32 +346,51 @@ namespace FineUIPro.Web.HJGL.PreDesign string steelType = tb.Rows[i]["SteelType"].ToString();//材质Value string material = tb.Rows[i]["Material"].ToString();//材质Text string caliber = tb.Rows[i]["Caliber"].ToString();//寸径 - var plan = BLL.ProductionSchedulingPlanService.GetProductionSchedulingPlan(this.CurrUser.LoginProjectId, flowingSection, unitWorkId, material, caliber); + var plan = BLL.ProductionSchedulingPlanService.GetProductionSchedulingPlan(projectId, flowingSection, unitWorkId, material, caliber); if (plan == null) { Model.HJGL_ProductionSchedulingPlan newPlan = new HJGL_ProductionSchedulingPlan(); newPlan.ProductionSchedulingPlanId = SQLHelper.GetNewID(typeof(Model.HJGL_ProductionSchedulingPlan)); - newPlan.ProjectId = this.CurrUser.LoginProjectId; + newPlan.ProjectId = projectId; newPlan.PipelineId = unitWorkId; newPlan.FlowNum = flowingSection; newPlan.MainItemName = tb.Rows[i]["UnitWorkName"].ToString(); newPlan.Material = material; newPlan.Caliber = caliber; - newPlan.Dain = BLL.WeldJointService.GetSizeSum(this.CurrUser.LoginProjectId, unitWorkId, flowingSection, steelType, caliber, "1"); - newPlan.TotalDyne = BLL.WeldJointService.GetSizeSumByUnitWorkIdAndFlowingSection(this.CurrUser.LoginProjectId, unitWorkId, flowingSection, "1"); - newPlan.CompletedCount = BLL.WeldJointService.GetSizeSum(this.CurrUser.LoginProjectId, unitWorkId, flowingSection, steelType, caliber, "2"); + newPlan.Dain = BLL.WeldJointService.GetSizeSum(projectId, unitWorkId, flowingSection, steelType, caliber, "1");//达因数 + var dyne = BLL.WeldJointService.GetSizeSumByUnitWorkIdAndFlowingSectionAndMaterial(projectId, unitWorkId, flowingSection, steelType);//总达因(按材质) + if (dyne != null) + { + newPlan.TotalDyne = dyne; + } + else + { + newPlan.TotalDyne = 0; + } + newPlan.PriorityTotalDyne = BLL.WeldJointService.GetSizeSumByUnitWorkIdAndFlowingSection(projectId, unitWorkId, flowingSection, "1");//总达因 + //当日已完成量 + var currentDay = BLL.WeldJointService.GetCurrentDaySizeSum(projectId, unitWorkId, flowingSection, steelType, caliber); + if (currentDay != null) + { + newPlan.OnDayCompleteDyne = currentDay; + } + else + { + newPlan.OnDayCompleteDyne = 0; + } + newPlan.CompletedCount = BLL.WeldJointService.GetSizeSum(projectId, unitWorkId, flowingSection, steelType, caliber, "2");//累计已完成量 if (newPlan.Dain > 0) { - newPlan.CompletedRate = (newPlan.CompletedCount / newPlan.Dain) * 100; + newPlan.CompletedRate = (newPlan.CompletedCount / newPlan.Dain) * 100;//已完成百分比 } else { newPlan.CompletedRate = 0; } - if (newPlan.TotalDyne > 0) + if (newPlan.PriorityTotalDyne > 0) { - decimal? completeDinSum = BLL.WeldJointService.GetSizeSumByUnitWorkIdAndFlowingSection(this.CurrUser.LoginProjectId, unitWorkId, flowingSection, "2"); - newPlan.TotalCompletedRate = (completeDinSum / newPlan.TotalDyne) * 100; + decimal? completeDinSum = BLL.WeldJointService.GetSizeSumByUnitWorkIdAndFlowingSection(projectId, unitWorkId, flowingSection, "2");//完成总达因 + newPlan.TotalCompletedRate = (completeDinSum / newPlan.PriorityTotalDyne) * 100;//已完成百分比汇总 } else { @@ -636,7 +676,7 @@ namespace FineUIPro.Web.HJGL.PreDesign var font = workbook.CreateFont(); font.FontHeightInPoints = 11; cellStyle.SetFont(font); - + // 第二步:创建新数据行 NPOI.SS.UserModel.ISheet sheet = workbook.GetSheetAt(0); NPOI.SS.UserModel.IRow row = sheet.GetRow(0); @@ -846,5 +886,31 @@ namespace FineUIPro.Web.HJGL.PreDesign } } #endregion + + #region Grid行绑定事件 + /// + /// 次日应完成量高于平均每日应完成工作量发出预警,预警要统一着色显示红色 + /// + /// + /// + protected void Grid1_RowDataBound(object sender, GridRowEventArgs e) + { + DataRowView row = e.DataItem as DataRowView; + double avgDailyWorkload = 0; + double nextDayCompleteDyne = 0; + if (row["AvgDailyWorkload"] != null && !string.IsNullOrEmpty(row["AvgDailyWorkload"].ToString())) + { + avgDailyWorkload = Convert.ToDouble(row["AvgDailyWorkload"]); + } + if (row["NextDayCompleteDyne"] != null && !string.IsNullOrEmpty(row["NextDayCompleteDyne"].ToString())) + { + nextDayCompleteDyne = Convert.ToDouble(row["NextDayCompleteDyne"]); + } + if (avgDailyWorkload < nextDayCompleteDyne) + { + e.RowCssClass = "color1"; + } + } + #endregion } } \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/HJGL/PreDesign/ProductionSchedulingPlan.aspx.designer.cs b/SGGL/FineUIPro.Web/HJGL/PreDesign/ProductionSchedulingPlan.aspx.designer.cs index 47f27654..04728f3a 100644 --- a/SGGL/FineUIPro.Web/HJGL/PreDesign/ProductionSchedulingPlan.aspx.designer.cs +++ b/SGGL/FineUIPro.Web/HJGL/PreDesign/ProductionSchedulingPlan.aspx.designer.cs @@ -147,15 +147,6 @@ namespace FineUIPro.Web.HJGL.PreDesign { /// protected global::FineUIPro.TextBox txtTotalPriority; - /// - /// txtPriorityTotalDyne 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.NumberBox txtPriorityTotalDyne; - /// /// txtPlanStartDate 控件。 /// @@ -183,15 +174,6 @@ namespace FineUIPro.Web.HJGL.PreDesign { /// protected global::FineUIPro.NumberBox txtAvgDailyWorkload; - /// - /// NumberBox1 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.NumberBox NumberBox1; - /// /// NumberBox2 控件。 ///