From f1a0f68a019d2045eb72547a3cefaec610c69452 Mon Sep 17 00:00:00 2001 From: fei550 <1420031550@qq.com> Date: Wed, 15 Apr 2026 16:31:33 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E5=AE=89=E8=A3=85=E6=B8=85=E5=8D=95?= =?UTF-8?q?=E9=A1=B5=E9=9D=A24=E9=A1=B9=E4=BF=AE=E6=94=B9=EF=BC=88?= =?UTF-8?q?=E8=BF=87=E6=BB=A4=E8=A3=95-=E9=87=8F=E3=80=81=E9=A2=84?= =?UTF-8?q?=E5=88=B6=E7=BB=84=E4=BB=B6=E6=95=B0=E9=87=8F=3D1=E3=80=81?= =?UTF-8?q?=E9=9A=90=E8=97=8F=E9=A2=84=E5=88=B6=E5=B7=A5=E4=BD=9C=E5=8C=85?= =?UTF-8?q?=E5=88=97=E3=80=81=E4=BF=AE=E5=A4=8D=E5=AF=BC=E5=87=BAIOExcepti?= =?UTF-8?q?on=EF=BC=89=E3=80=81=E9=A2=84=E5=88=B6=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E9=A1=B5=E9=9D=A2=E8=BF=87=E6=BB=A4=E8=A3=95?= =?UTF-8?q?-=E9=87=8F=E3=80=81=E6=9D=90=E6=96=99=E5=8C=B9=E9=85=8D?= =?UTF-8?q?=E7=AE=97=E6=B3=95=E9=A2=84=E6=89=A3=E9=99=A4=E5=87=BA=E5=BA=93?= =?UTF-8?q?=E7=94=B3=E8=AF=B7=E5=8D=95=E6=9D=90=E6=96=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SGGL/BLL/CLGL/TwArrivalStatisticsService.cs | 30 +++++- .../File/Fastreport/组件打印.frx | 4 +- SGGL/FineUIPro.Web/FineUIPro.Web.csproj | 3 - .../HJGL/PreDesign/InstallList.aspx | 2 +- .../HJGL/PreDesign/InstallList.aspx.cs | 92 ++++++++----------- .../HJGL/PreDesign/PrePipeline.aspx.cs | 5 +- 6 files changed, 76 insertions(+), 60 deletions(-) diff --git a/SGGL/BLL/CLGL/TwArrivalStatisticsService.cs b/SGGL/BLL/CLGL/TwArrivalStatisticsService.cs index 5ac03dab..ef19aeb9 100644 --- a/SGGL/BLL/CLGL/TwArrivalStatisticsService.cs +++ b/SGGL/BLL/CLGL/TwArrivalStatisticsService.cs @@ -86,7 +86,35 @@ namespace BLL WarehouseCode = warehouseCode, ProjectId = projectId }; - var stockList = TwMaterialstockService.GetTw_MaterialStockByModle(twMaterialStockOutput).ToList();//获取库存列表 +var stockList = TwMaterialstockService.GetTw_MaterialStockByModle(twMaterialStockOutput).ToList();//获取库存列表 + + // 预扣除出库申请单中状态为待审核/已审核的材料数量 + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var outboundMaterials = from detail in db.Tw_InOutPlanDetail + join master in db.Tw_InOutPlanMaster on detail.InOutPlanMasterId equals master.Id + where master.InOutType == (int)TwConst.InOutType.出库 + && (master.State == (int)TwConst.State.待审核 || master.State == (int)TwConst.State.已审核) + && master.WarehouseCode == warehouseCode + && master.ProjectId == projectId + group detail by detail.MaterialCode into g + select new + { + MaterialCode = g.Key, + TotalPlanNum = g.Sum(d => d.PlanNum) ?? 0 + }; + + var outboundList = outboundMaterials.ToList(); + foreach (var outbound in outboundList) + { + var stock = stockList.FirstOrDefault(x => x.PipeLineMatCode == outbound.MaterialCode); + if (stock != null) + { + stock.StockNum -= outbound.TotalPlanNum; + } + } + } + foreach (var material in requiredMaterials) { material.Id = Guid.NewGuid().ToString(); diff --git a/SGGL/FineUIPro.Web/File/Fastreport/组件打印.frx b/SGGL/FineUIPro.Web/File/Fastreport/组件打印.frx index 79825788..6892e540 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/FineUIPro.Web.csproj b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj index bd3dc5dd..b3d0f6e1 100644 --- a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj +++ b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj @@ -17033,10 +17033,7 @@ - - - diff --git a/SGGL/FineUIPro.Web/HJGL/PreDesign/InstallList.aspx b/SGGL/FineUIPro.Web/HJGL/PreDesign/InstallList.aspx index 46f9cce2..ec822dc6 100644 --- a/SGGL/FineUIPro.Web/HJGL/PreDesign/InstallList.aspx +++ b/SGGL/FineUIPro.Web/HJGL/PreDesign/InstallList.aspx @@ -128,7 +128,7 @@ + TextAlign="Left" Hidden="true"> diff --git a/SGGL/FineUIPro.Web/HJGL/PreDesign/InstallList.aspx.cs b/SGGL/FineUIPro.Web/HJGL/PreDesign/InstallList.aspx.cs index b5f57662..61ad8ce2 100644 --- a/SGGL/FineUIPro.Web/HJGL/PreDesign/InstallList.aspx.cs +++ b/SGGL/FineUIPro.Web/HJGL/PreDesign/InstallList.aspx.cs @@ -13,7 +13,6 @@ namespace FineUIPro.Web.HJGL.PreDesign public partial class InstallList : PageBase { public int pageSize = 20; - public static IQueryable GridDataTable = null; protected void Page_Load(object sender, EventArgs e) { @@ -232,35 +231,7 @@ namespace FineUIPro.Web.HJGL.PreDesign { try { - var baseQuery = from x in Funs.DB.View_HJGL_InstallData select x; - - // 应用与数据绑定相同的筛选条件 - if (tvControlItem.SelectedNode.CommandName.Split('|').Length == 2) - { - baseQuery = baseQuery.Where(x => x.UnitWorkId == tvControlItem.SelectedNode.NodeID); - } - else if (tvControlItem.SelectedNode.CommandName == "流水段") - { - baseQuery = baseQuery.Where(x => x.UnitWorkId == tvControlItem.SelectedNode.ParentNode.NodeID && x.FlowingSection == tvControlItem.SelectedNode.Text); - } - - if (!string.IsNullOrEmpty(txtPipelineCode2.Text)) - { - baseQuery = baseQuery.Where(x => x.PipelineCode.Contains(txtPipelineCode2.Text.Trim())); - } - if (!string.IsNullOrEmpty(txtPipelineComponentCode.Text)) - { - baseQuery = baseQuery.Where(x => x.Code.Contains(txtPipelineComponentCode.Text.Trim())); - } - if (!string.IsNullOrEmpty(drpTypeStr.SelectedValue)) - { - baseQuery = baseQuery.Where(x => x.TypeStr.Contains(drpTypeStr.SelectedValue)); - } - if (!string.IsNullOrEmpty(txtPipelineCode.Text)) - { - baseQuery = baseQuery.Where(x => x.PipelineCode.Contains(txtPipelineCode.Text.Trim())); - } - + var baseQuery = GetIQueryableInstallDatas(); // 计算汇总数据 var componentCount = baseQuery.Count(x => x.TypeStr == "预制组件"); var partCount = baseQuery.Count(x => x.TypeStr == "预制散件"); @@ -283,27 +254,46 @@ namespace FineUIPro.Web.HJGL.PreDesign /// private List BindData(int pageIndex, int pageSize, out int totalCount) { + var baseQuery = GetIQueryableInstallDatas(); + totalCount = baseQuery.Count(); + // 分页保护 + 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) + { + if (item.TypeStr == "预制组件") + { + item.Number = 1; + } + } + return query; + } - var baseQuery=from x in Funs.DB.View_HJGL_InstallData - select x; + + private IQueryable GetIQueryableInstallDatas() + { + var baseQuery = from x in Funs.DB.View_HJGL_InstallData + select x; if (tvControlItem.SelectedNode.CommandName.Split('|').Length == 2) { - baseQuery = baseQuery.Where(x => x.UnitWorkId == tvControlItem.SelectedNode.NodeID); + baseQuery = baseQuery.Where(x => x.UnitWorkId == tvControlItem.SelectedNode.NodeID); } else if (tvControlItem.SelectedNode.CommandName == "流水段") { baseQuery = baseQuery.Where(x => x.UnitWorkId == tvControlItem.SelectedNode.ParentNode.NodeID && x.FlowingSection == tvControlItem.SelectedNode.Text); - } + } if (!string.IsNullOrEmpty(txtPipelineCode2.Text)) { baseQuery = baseQuery.Where(x => x.PipelineCode.Contains(txtPipelineCode2.Text.Trim())); - } + } if (!string.IsNullOrEmpty(txtPipelineComponentCode.Text)) { baseQuery = baseQuery.Where(x => x.Code.Contains(txtPipelineComponentCode.Text.Trim())); - } + } if (!string.IsNullOrEmpty(drpTypeStr.SelectedValue)) { baseQuery = baseQuery.Where(x => x.TypeStr.Contains(drpTypeStr.SelectedValue)); @@ -315,19 +305,15 @@ namespace FineUIPro.Web.HJGL.PreDesign //} if (!string.IsNullOrEmpty(txtPipelineCode.Text)) { - baseQuery = baseQuery.Where(x => x.PipelineCode.Contains(txtPipelineCode.Text.Trim())); + 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); - totalCount = baseQuery.Count(); - GridDataTable = baseQuery; - // 分页保护 - if (pageIndex <= 0) pageIndex = 1; - if (pageSize <= 0) pageSize = 10; - var query = baseQuery.Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList(); - return query; - } + return baseQuery; + } #endregion #region 分页排序 @@ -418,16 +404,18 @@ namespace FineUIPro.Web.HJGL.PreDesign /// protected void btnOut_Click(object sender, EventArgs e) { - if (GridDataTable != null) - { - var q = (from x in GridDataTable + + var baseQuery = GetIQueryableInstallDatas(); + + var q = (from x in baseQuery + where x.Code != "裕-量" select new { 管线号 = x.PipelineCode, 类型 = x.TypeStr, 编号 = x.Code, 预制散件材料描述 = (x.Matdef=="" || x.Matdef==null)?"-":x.Matdef, - 数量 = x.Number??1, + 数量 = x.TypeStr == "预制组件" ? 1 : (x.Number ?? 1), 所在包装编号 = x.PackagingCode, 车次 = x.TrainNumber, 流水段 = x.FlowingSection @@ -435,7 +423,7 @@ namespace FineUIPro.Web.HJGL.PreDesign string path = Funs.RootPath + @"File\Excel\Temp\PrePipelineInstallList.xlsx"; path = path.Replace(".xlsx", string.Format("{0:yyyy-MM-dd}", DateTime.Now) + ".xlsx"); - MiniExcel.SaveAs(path, q); + MiniExcel.SaveAs(path, q, overwriteFile: true); string fileName = $"安装清单-" + this.tvControlItem.SelectedNode.Text + "-" + string.Format("{0:yyyy-MM-dd}", DateTime.Now) + ".xlsx"; FileInfo info = new FileInfo(path); @@ -448,7 +436,7 @@ namespace FineUIPro.Web.HJGL.PreDesign System.Web.HttpContext.Current.Response.Flush(); System.Web.HttpContext.Current.Response.Close(); File.Delete(path); - } + } } } \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/HJGL/PreDesign/PrePipeline.aspx.cs b/SGGL/FineUIPro.Web/HJGL/PreDesign/PrePipeline.aspx.cs index 30f98afb..416882b3 100644 --- a/SGGL/FineUIPro.Web/HJGL/PreDesign/PrePipeline.aspx.cs +++ b/SGGL/FineUIPro.Web/HJGL/PreDesign/PrePipeline.aspx.cs @@ -292,11 +292,14 @@ namespace FineUIPro.Web.HJGL.PreDesign listStr.Add(new SqlParameter("@ProductionState", drpProductionState.SelectedValue.ToString())); } - if (!string.IsNullOrEmpty(drpFlowingSection.SelectedValue) && drpFlowingSection.SelectedValue != Const._Null) +if (!string.IsNullOrEmpty(drpFlowingSection.SelectedValue) && drpFlowingSection.SelectedValue != Const._Null) { strSql += " AND pipe.FlowingSection =@FlowingSection"; listStr.Add(new SqlParameter("@FlowingSection", drpFlowingSection.SelectedValue.ToString())); } + // 过滤组件编号值为"裕-量"的行 + strSql += " AND com.PipelineComponentCode != @ExcludeYuliang"; + listStr.Add(new SqlParameter("@ExcludeYuliang", "裕-量")); SqlParameter[] parameter = listStr.ToArray(); DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); GridDataTable = tb;