This commit is contained in:
2026-04-16 09:42:32 +08:00
10 changed files with 206 additions and 33 deletions
@@ -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);
}
@@ -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
/// <summary>
/// 包装分类映射字典
/// </summary>
public static Dictionary<string, int> CategoryIntMap = new Dictionary<string, int>
{
{ "打捆" ,(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();
+21 -10
View File
@@ -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;
}
}
+1 -1
View File
@@ -17033,7 +17033,7 @@
</COMReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v15.0\WebApplications\Microsoft.WebApplication.targets" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v18.0\WebApplications\Microsoft.WebApplication.targets" />
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
@@ -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);
}
/// <summary>
/// 更新汇总信息
/// </summary>
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
/// 查询数据
/// </summary>
/// <returns></returns>
private List<View_HJGL_InstallData> BindData(int pageIndex, int pageSize, out int totalCount)
private List<View_HJGL_InstallData> 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;
+13 -1
View File
@@ -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; }
/// <summary>
/// 包装内数量(预制组件或散件数量)
/// </summary>
public int ComponentCount { get; set; }
/// <summary>
/// 包装分类代码
/// </summary>
public int? CategoryInt { get; set; }
/// <summary>
/// 包装分类名称
/// </summary>
public string CategoryString { get; set; }
}
@@ -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
/// </summary>
public string TrainNumberId { get; set; }
/// <summary>
/// 是否关联车次(true:已关联, false:未关联, null:不筛选)
/// </summary>
public bool? HasTrainNumber { get; set; }
}
}
@@ -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; }
/// <summary>
/// 包装内数量(预制组件或散件数量)
/// </summary>
public int ComponentCount { get; set; }
#endregion Properties
@@ -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;
}
/// <summary>
/// 获取包装分类列表
/// </summary>
/// <returns>包装分类字典</returns>
[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
}
}