From 7ea2473a558b4c51d3a3a08ed2f59802c3ee690f Mon Sep 17 00:00:00 2001 From: fei550 <1420031550@qq.com> Date: Thu, 16 Apr 2026 00:35:08 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E6=94=B9=E5=AE=89=E8=A3=85?= =?UTF-8?q?=E6=B8=85=E5=8D=95=E6=9F=A5=E8=AF=A2=E9=80=9F=E5=BA=A6=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DataBase/版本日志/SGGLDB_V2026-04-16-lpf.sql | 92 +++++++++++++++++++ SGGL/FineUIPro.Web/CLGL/OutPlanMaster.aspx.cs | 31 +++++-- SGGL/FineUIPro.Web/FineUIPro.Web.csproj | 2 +- .../HJGL/PreDesign/InstallList.aspx.cs | 36 +++++--- 4 files changed, 135 insertions(+), 26 deletions(-) create mode 100644 DataBase/版本日志/SGGLDB_V2026-04-16-lpf.sql diff --git a/DataBase/版本日志/SGGLDB_V2026-04-16-lpf.sql b/DataBase/版本日志/SGGLDB_V2026-04-16-lpf.sql new file mode 100644 index 00000000..c73d150b --- /dev/null +++ b/DataBase/版本日志/SGGLDB_V2026-04-16-lpf.sql @@ -0,0 +1,92 @@ +USE [SGGLDB] +GO + +/****** Object: View [dbo].[View_HJGL_InstallData] Script Date: 2026/4/16 0:12:44 ******/ +SET ANSI_NULLS ON +GO + +SET QUOTED_IDENTIFIER ON +GO + +ALTER VIEW [dbo].[View_HJGL_InstallData] + AS + WITH TwOutPutData as (select distinct twRelation.PipelineId, + outdetail.Id as TwOutputDetailId, + twRelation.MaterialCode, + master.Id as OutputMasterId + from Tw_OutputMaster master + join Tw_OutputDetail outdetail on outdetail.OutputMasterId = master.Id + join Tw_InOutPlanMaster planmaster on planmaster.Id = master.InOutPlanMasterId + join Tw_InOutPlanDetail_Relation twRelation + on twRelation.InOutPlanMasterId = planmaster.Id and + outdetail.MaterialCode = twRelation.MaterialCode + where master.TypeInt=70), + PrefabricatedData AS (SELECT pipe.PipeLineMatId as Id, + line.PipelineCode, + pipe.PrefabricatedComponents as Code, + 'Ԥ' as TypeStr, + '' as Matdef, + CAST(NULL AS DECIMAL(18, 2)) as Number, -- ȷָ + pack.PackagingCode, + trainnumber.TrainNumber, + line.FlowingSection, + line.UnitWorkId, + line.ProjectId, + pack.StackingPosition + FROM dbo.HJGL_PipeLineMat pipe + INNER JOIN dbo.HJGL_Pipeline line -- ΪINNER JOINܵ + ON pipe.PipelineId = line.PipelineId + LEFT JOIN dbo.HJGL_MaterialCodeLib lib + ON lib.MaterialCode = pipe.MaterialCode + LEFT JOIN HJGL_Pipeline_Component comonent + ON comonent.PipelineComponentCode = pipe.PrefabricatedComponents + LEFT JOIN HJGL_PackagingManageDetail packdetail + ON packdetail.PipelineComponentId = comonent.PipelineComponentId + LEFT JOIN HJGL_PackagingManage pack + ON packdetail.PackagingManageId = pack.PackagingManageId + AND pack.ProjectId = line.ProjectId -- Ŀ + LEFT JOIN HJGL_TrainNumberManage trainnumber + ON pack.TrainNumberId = trainnumber.Id + WHERE line.PipeArea = '1' + and (pipe.PrefabricatedComponents != '' + AND pipe.PrefabricatedComponents IS NOT NULL and pipe.PrefabricatedComponents not in('ԣ-'))), + LooseComponentsData AS (SELECT distinct pipe.PipeLineMatId as Id, + line.PipelineCode, + pipe.MaterialCode as Code, + 'Ԥɢ' as TypeStr, + lib.MaterialDef as Matdef, + cast( packdetail.Number as DECIMAL(18, 2)) as Number, + pack.PackagingCode, + trainnumber.TrainNumber, + line.FlowingSection, + line.UnitWorkId, + line.ProjectId, + pack.StackingPosition + FROM dbo.HJGL_PipeLineMat pipe + INNER JOIN HJGL_Pipeline line -- ΪINNER JOIN + ON pipe.PipelineId = line.PipelineId + LEFT JOIN dbo.HJGL_MaterialCodeLib lib + ON lib.MaterialCode = pipe.MaterialCode + LEFT JOIN HJGL_PackagingManageDetail packdetail + ON packdetail.MaterialCode = pipe.MaterialCode + LEFT JOIN TwOutPutData twOutPutData + ON twOutPutData.PipelineId = pipe.PipelineId and + twOutPutData.MaterialCode = packdetail.MaterialCode + LEFT JOIN HJGL_PackagingManage pack + ON packdetail.PackagingManageId = pack.PackagingManageId + AND pack.ProjectId = line.ProjectId -- Ŀ + LEFT JOIN HJGL_TrainNumberManage trainnumber + ON pack.TrainNumberId = trainnumber.Id + where line.PipeArea = '1' + and (pipe.PrefabricatedComponents is null or pipe.PrefabricatedComponents = '') ) + +-- ϲ + SELECT * + FROM PrefabricatedData + UNION ALL + SELECT * + FROM LooseComponentsData + +GO + + diff --git a/SGGL/FineUIPro.Web/CLGL/OutPlanMaster.aspx.cs b/SGGL/FineUIPro.Web/CLGL/OutPlanMaster.aspx.cs index a60ac02c..66da288a 100644 --- a/SGGL/FineUIPro.Web/CLGL/OutPlanMaster.aspx.cs +++ b/SGGL/FineUIPro.Web/CLGL/OutPlanMaster.aspx.cs @@ -474,18 +474,29 @@ namespace FineUIPro.Web.CLGL return; } string planId = Grid1.SelectedRowID; - string message = TwOutputmasterService.RevokeGenOutMasterByPlanId(planId); - if (string.IsNullOrEmpty(message)) + var planMaster = BLL.TwInOutplanmasterService.GetById(planId); + switch (planMaster.State) { - ShowNotify("撤销出库成功!", MessageBoxIcon.Success); - BindGrid(); - } - else - { - Alert.ShowInTop(message, MessageBoxIcon.Warning); - return; + case (int)TwConst.State.已审核: + planMaster.State = (int)TwConst.State.待审核; + planMaster.AuditMan = null; + planMaster.AuditDate = null; + TwInOutplanmasterService.Update(planMaster); + BindGrid(); + ShowNotify("撤销审核成功!", MessageBoxIcon.Success); - } + break; + case (int)TwConst.State.已完成: + TwOutputmasterService.RevokeGenOutMasterByPlanId(planId); + BindGrid(); + ShowNotify("撤销出库单成功!", MessageBoxIcon.Success); + break; + + + default: + Alert.ShowInTop("请选择有效的计划!", MessageBoxIcon.Warning); + break; + } } diff --git a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj index 52e87e5f..b3d0f6e1 100644 --- a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj +++ b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj @@ -17033,7 +17033,7 @@ - + diff --git a/SGGL/FineUIPro.Web/HJGL/PreDesign/InstallList.aspx.cs b/SGGL/FineUIPro.Web/HJGL/PreDesign/InstallList.aspx.cs index 61ad8ce2..a82d8ae5 100644 --- a/SGGL/FineUIPro.Web/HJGL/PreDesign/InstallList.aspx.cs +++ b/SGGL/FineUIPro.Web/HJGL/PreDesign/InstallList.aspx.cs @@ -1,4 +1,4 @@ -using BLL; +using BLL; using MiniExcelLibs; using Model; using System; @@ -213,29 +213,24 @@ namespace FineUIPro.Web.HJGL.PreDesign private void BindGrid() { if (tvControlItem.SelectedNode == null) return; - var view_HJGL_InstallDatas = BindData(Grid1.PageIndex+1, Grid1.PageSize,out int totalCount); + var view_HJGL_InstallDatas = BindData(Grid1.PageIndex+1, Grid1.PageSize,out int totalCount, out int componentCount, out int partCount); // 2.获取当前分页数据 Grid1.RecordCount = totalCount; var table = view_HJGL_InstallDatas; Grid1.DataSource = table; Grid1.DataBind(); - // 更新汇总信息 - UpdateSummary(); + // 更新汇总信息(使用已统计的数据) + UpdateSummary(componentCount, partCount); } /// /// 更新汇总信息 /// - private void UpdateSummary() + private void UpdateSummary(int componentCount, int partCount) { try { - var baseQuery = GetIQueryableInstallDatas(); - // 计算汇总数据 - var componentCount = baseQuery.Count(x => x.TypeStr == "预制组件"); - var partCount = baseQuery.Count(x => x.TypeStr == "预制散件"); - // 更新汇总标签 lblSummary1.Text = $"预制组件数量:{componentCount}"; lblSummary2.Text = $"预制散件数量:{partCount}"; @@ -252,14 +247,27 @@ namespace FineUIPro.Web.HJGL.PreDesign /// 查询数据 /// /// - private List BindData(int pageIndex, int pageSize, out int totalCount) + private List BindData(int pageIndex, int pageSize, out int totalCount, out int componentCount, out int partCount) { var baseQuery = GetIQueryableInstallDatas(); - totalCount = baseQuery.Count(); + + // 一次性统计所有需要的数据(使用 GroupBy 优化) + var stats = baseQuery + .GroupBy(x => x.TypeStr) + .Select(g => new { TypeStr = g.Key, Count = g.Count() }) + .ToList(); + + // 从统计结果中提取数据 + totalCount = stats.Sum(s => s.Count); + componentCount = stats.FirstOrDefault(s => s.TypeStr == "预制组件")?.Count ?? 0; + partCount = stats.FirstOrDefault(s => s.TypeStr == "预制散件")?.Count ?? 0; + // 分页保护 if (pageIndex <= 0) pageIndex = 1; if (pageSize <= 0) pageSize = 10; + var query = baseQuery.Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList(); + // 预制组件数量显示为1,预制散件保持原始数量 foreach (var item in query) { @@ -307,9 +315,7 @@ namespace FineUIPro.Web.HJGL.PreDesign { baseQuery = baseQuery.Where(x => x.PipelineCode.Contains(txtPipelineCode.Text.Trim())); - } - // 过滤组件编号/材料编码值为"裕-量"的记录 - baseQuery = baseQuery.Where(x => x.Code != "裕-量"); + } baseQuery = baseQuery.OrderBy(x => x.PipelineCode).ThenBy(x => x.Code); return baseQuery;