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] =?UTF-8?q?feat:=20=E5=8C=85=E8=A3=85=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=92=8C=E8=BD=A6=E6=AC=A1=E7=AE=A1=E7=90=86=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=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