From 5809a5fb483b0aaf81bb93b29cd3557d143dd8d9 Mon Sep 17 00:00:00 2001
From: fei550 <1420031550@qq.com>
Date: Wed, 15 Apr 2026 23:41:05 +0800
Subject: [PATCH 1/2] =?UTF-8?q?feat:=20=E5=8C=85=E8=A3=85=E7=AE=A1?=
=?UTF-8?q?=E7=90=86=E5=92=8C=E8=BD=A6=E6=AC=A1=E7=AE=A1=E7=90=86=E6=8E=A5?=
=?UTF-8?q?=E5=8F=A3=E5=8A=9F=E8=83=BD=E5=A2=9E=E5=BC=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 新增包装分类获取接口
- 包装列表增加分类信息、包装内数量和车次关联筛选
- 保存包装支持分类字段
- 车次关联包装增加重复校验
---
.../API/HJGL/APITrainNumberManagerService.cs | 7 +++++-
.../HJGL/PreDesign/PackagingManageService .cs | 23 +++++++++++++++++--
.../Model/APIItem/HJGL/PackagingManageItem.cs | 14 ++++++++++-
.../PackagingManage/PackagingManageInput.cs | 6 ++++-
.../PackagingManage/PackagingManageOutput.cs | 6 ++++-
.../PreDesign/PackagingManageController.cs | 22 +++++++++++++++++-
6 files changed, 71 insertions(+), 7 deletions(-)
diff --git a/SGGL/BLL/API/HJGL/APITrainNumberManagerService.cs b/SGGL/BLL/API/HJGL/APITrainNumberManagerService.cs
index 900db876..68190e7a 100644
--- a/SGGL/BLL/API/HJGL/APITrainNumberManagerService.cs
+++ b/SGGL/BLL/API/HJGL/APITrainNumberManagerService.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
namespace BLL
@@ -53,6 +53,11 @@ namespace BLL
{
throw new Exception("当前包装状态不可修改车次号");
}
+ // 检查包装是否已关联其他车次
+ if (!string.IsNullOrEmpty(packModel.TrainNumberId) && packModel.TrainNumberId != trainNumberId)
+ {
+ throw new Exception("该包装已在其他车次中存在,不能重复添加");
+ }
packModel.TrainNumberId = trainNumberId;
HJGLPackagingmanageService.UpdateHJGL_PackagingManage(packModel);
}
diff --git a/SGGL/BLL/HJGL/PreDesign/PackagingManageService .cs b/SGGL/BLL/HJGL/PreDesign/PackagingManageService .cs
index cca4cf4a..c5fd648d 100644
--- a/SGGL/BLL/HJGL/PreDesign/PackagingManageService .cs
+++ b/SGGL/BLL/HJGL/PreDesign/PackagingManageService .cs
@@ -1,4 +1,4 @@
-using FastReport.DevComponents.DotNetBar;
+using FastReport.DevComponents.DotNetBar;
using FineUIPro;
using Model;
using System;
@@ -15,7 +15,9 @@ namespace BLL
public static class HJGLPackagingmanageService
{
#region Fields
-
+ ///
+ /// 包装分类映射字典
+ ///
public static Dictionary CategoryIntMap = new Dictionary
{
{ "打捆" ,(int)CategoryInt.打捆},
@@ -528,6 +530,20 @@ namespace BLL
{
baseQuery = baseQuery.Where(z => z.train.Id != null && z.train.Id.Contains(filter.TrainNumberId));
}
+ // 是否关联车次筛选
+ if (filter.HasTrainNumber.HasValue)
+ {
+ if (filter.HasTrainNumber.Value)
+ {
+ // 已关联车次:TrainNumberId 不为空
+ baseQuery = baseQuery.Where(z => z.x.TrainNumberId != null && z.x.TrainNumberId != "");
+ }
+ else
+ {
+ // 未关联车次:TrainNumberId 为空
+ baseQuery = baseQuery.Where(z => z.x.TrainNumberId == null || z.x.TrainNumberId == "");
+ }
+ }
}
baseQuery = baseQuery.OrderByDescending(z => (z.x.ReceiveDate ?? DateTime.MinValue)).ThenBy(z => z.x.PackagingCode);
@@ -545,6 +561,9 @@ namespace BLL
ReceiveMan = z.train.ContactName,
ReceiveDate = string.Format("{0:g}", z.x.ReceiveDate),
TrainNumber = z.train.TrainNumber,
+ ComponentCount = db.HJGL_PackagingManageDetail.Count(d => d.PackagingManageId == z.x.PackagingManageId),
+ CategoryInt = z.x.CategoryInt,
+ CategoryString = z.x.CategoryInt == 10 ? "打捆" : (z.x.CategoryInt == 20 ? "装箱" : (z.x.CategoryInt == 30 ? "散装" : ""))
}).Distinct();
totalCount = q.Count();
diff --git a/SGGL/Model/APIItem/HJGL/PackagingManageItem.cs b/SGGL/Model/APIItem/HJGL/PackagingManageItem.cs
index dd25e37d..cc607dd6 100644
--- a/SGGL/Model/APIItem/HJGL/PackagingManageItem.cs
+++ b/SGGL/Model/APIItem/HJGL/PackagingManageItem.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -20,6 +20,18 @@ namespace Model
public string ReceiveMan { get; set; }
public string ReceiveDate { get; set; }
public string TrainNumber { get; set; }
+ ///
+ /// 包装内数量(预制组件或散件数量)
+ ///
+ public int ComponentCount { get; set; }
+ ///
+ /// 包装分类代码
+ ///
+ public int? CategoryInt { get; set; }
+ ///
+ /// 包装分类名称
+ ///
+ public string CategoryString { get; set; }
}
diff --git a/SGGL/Model/HJGL/PreDesign/PackagingManage/PackagingManageInput.cs b/SGGL/Model/HJGL/PreDesign/PackagingManage/PackagingManageInput.cs
index 970a6988..a7f0afab 100644
--- a/SGGL/Model/HJGL/PreDesign/PackagingManage/PackagingManageInput.cs
+++ b/SGGL/Model/HJGL/PreDesign/PackagingManage/PackagingManageInput.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -55,5 +55,9 @@ namespace Model
/// 车次id
///
public string TrainNumberId { get; set; }
+ ///
+ /// 是否关联车次(true:已关联, false:未关联, null:不筛选)
+ ///
+ public bool? HasTrainNumber { get; set; }
}
}
diff --git a/SGGL/Model/HJGL/PreDesign/PackagingManage/PackagingManageOutput.cs b/SGGL/Model/HJGL/PreDesign/PackagingManage/PackagingManageOutput.cs
index e9a984ac..e6f1fab0 100644
--- a/SGGL/Model/HJGL/PreDesign/PackagingManage/PackagingManageOutput.cs
+++ b/SGGL/Model/HJGL/PreDesign/PackagingManage/PackagingManageOutput.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -31,6 +31,10 @@ namespace Model
public string TypeString { get; set; }
public int? CategoryInt { get; set; }
public string CategoryString { get; set; }
+ ///
+ /// 包装内数量(预制组件或散件数量)
+ ///
+ public int ComponentCount { get; set; }
#endregion Properties
diff --git a/SGGL/WebAPI/Controllers/HJGL/PreDesign/PackagingManageController.cs b/SGGL/WebAPI/Controllers/HJGL/PreDesign/PackagingManageController.cs
index ff4691c2..2daf766b 100644
--- a/SGGL/WebAPI/Controllers/HJGL/PreDesign/PackagingManageController.cs
+++ b/SGGL/WebAPI/Controllers/HJGL/PreDesign/PackagingManageController.cs
@@ -1,4 +1,4 @@
-using BLL;
+using BLL;
using Model;
using System;
using System.Collections.Generic;
@@ -229,6 +229,26 @@ namespace WebAPI.Controllers
return responeData;
}
+ ///
+ /// 获取包装分类列表
+ ///
+ /// 包装分类字典
+ [HttpGet]
+ public Model.ResponeData GetPackagingCategories()
+ {
+ var responeData = new Model.ResponeData();
+ try
+ {
+ responeData.data = HJGLPackagingmanageService.CategoryIntMap;
+ }
+ catch (Exception ex)
+ {
+ responeData.code = 0;
+ responeData.message = ex.Message;
+ }
+ return responeData;
+ }
+
#endregion Methods
}
}
\ No newline at end of file
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 2/2] =?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;