feat: 全系统窗体升级 - 配置驱动通用单据页(BillPage)、原料专用单据页、宽屏弹窗及日期转换优化

This commit is contained in:
2026-08-16 03:58:22 +08:00
parent 1bec470647
commit 9f416561d6
33 changed files with 3379 additions and 96 deletions
@@ -282,14 +282,19 @@ public class DataController : ControllerBase
return matches.Count == 1 ? matches[0] : null;
}
/// <summary>请求体 JSON 序列化选项:大小写不敏感 + 宽松日期解析(兼容 "yyyy-MM-dd HH:mm:ss"</summary>
private static readonly System.Text.Json.JsonSerializerOptions BodyJsonOptions = new()
{
PropertyNameCaseInsensitive = true,
Converters = { new Converters.FlexibleDateTimeConverter() }
};
/// <summary>将请求体 JSON 转换为目标实体对象</summary>
private object? ConvertBody(string table, object body)
{
if (!EntityCatalog.TryGet(table, out var entityType)) return null;
var json = System.Text.Json.JsonSerializer.Serialize(body,
new System.Text.Json.JsonSerializerOptions { PropertyNameCaseInsensitive = true });
return System.Text.Json.JsonSerializer.Deserialize(json, entityType,
new System.Text.Json.JsonSerializerOptions { PropertyNameCaseInsensitive = true });
var json = System.Text.Json.JsonSerializer.Serialize(body, BodyJsonOptions);
return System.Text.Json.JsonSerializer.Deserialize(json, entityType, BodyJsonOptions);
}
/// <summary>提取请求体中出现的字段名(用于部分更新,属性名大小写不敏感)</summary>
@@ -57,7 +57,8 @@ public class MetaController : ControllerBase
["PackageId"] = ("Fims_Package", "PackageNo", null, null),
["GradeId"] = ("BaseCommon_GradeStandard", "Name", null, null),
["RepackId"] = ("RawMaterial_Repack", "PlanNo", null, null),
["PurchaseId"] = ("RawMaterial_Purchase", "BillNo", null, null)
["PurchaseId"] = ("RawMaterial_Purchase", "BillNo", null, null),
["WarehouseId"] = ("RawMaterial_Warehouse", "Name", null, null)
};
/// <summary>
@@ -71,6 +72,8 @@ public class MetaController : ControllerBase
["RawMaterial_Repack"] = ("PlanNo", "RZ", "yyyyMMdd", 3, "", "-"),
["RawMaterial_OutStock"] = ("BillNo", "YLC", "yyyyMMdd", 4, "", "-"),
["RawMaterial_Purchase"] = ("BillNo", "CG", "yyyyMMdd", 4, "", "-"),
["RawMaterial_Warehouse"] = ("Code", "CK", "yyyyMMdd", 3, "", "-"),
["RawMaterial_Inspect"] = ("Code", "YJ", "yyyyMMdd", 3, "", "-"),
["Process_Trial"] = ("BillNo", "SY", "yyyyMMdd", 3, "", "-"),
["Process_ProcessZhuangkou"] = ("Code", "GYZ", "yyyy", 3, "-", "-"),
["Process_Sheet"] = ("SheetNo", "GYD", "yyyyMMdd", 3, "", "-"),
@@ -78,8 +78,20 @@ public class WorkBenchController : ControllerBase
trend.Add(new { date = day.ToString("MM-dd"), weight = sum });
}
// ===== 待办列表(工单 + 工作流审批)=====
var pendingOrders = await _db.Select<ProPlan_WorkOrder>()
.Where(w => w.Flag == 1 && (w.Status == 0 || w.Status == 1 || w.Status == 2 || w.Status == 4))
.OrderByDescending(w => w.AddTime)
.Limit(8)
.ToListAsync(w => new { w.Id, w.OrderNo, w.ProcessZhuangkouId, w.Status, w.PlanStartDate });
// ===== 庄口产量占比(近30天,Top 8=====
var zkIds = trendRaw.Select(x => x.ProcessZhuangkouId).Distinct().ToList();
var zkIds = trendRaw.Select(x => x.ProcessZhuangkouId)
.Concat(warnList.Select(x => x.ProcessZhuangkouId))
.Concat(pendingOrders.Select(x => x.ProcessZhuangkouId))
.Where(id => id > 0)
.Distinct()
.ToList();
var zkNames = new List<Process_ProcessZhuangkou>();
if (zkIds.Count > 0)
{
@@ -88,22 +100,16 @@ public class WorkBenchController : ControllerBase
.ToListAsync();
}
var nameMap = zkNames.ToDictionary(x => x.Id, x => string.IsNullOrEmpty(x.Name) ? $"庄口{x.Id}" : x.Name);
// 庄口名称优先取 Name,其次庄口编号 Code(明码),避免把内部 Id 展示出来
var nameMap = zkNames.ToDictionary(x => x.Id, x => string.IsNullOrEmpty(x.Name) ? (string.IsNullOrEmpty(x.Code) ? $"庄口{x.Id}" : x.Code) : x.Name);
var zhuangkou = trendRaw
.GroupBy(x => x.ProcessZhuangkouId)
.Select(g => new { name = nameMap.GetValueOrDefault(g.Key) ?? $"庄口{g.Key}", value = g.Sum(x => x.OutputWeight) })
.Select(g => new { name = nameMap.GetValueOrDefault(g.Key) ?? "未知庄口", value = g.Sum(x => x.OutputWeight) })
.OrderByDescending(x => x.value)
.Take(8)
.Select(x => (object)x)
.ToList();
// ===== 待办列表(工单 + 工作流审批)=====
var pendingOrders = await _db.Select<ProPlan_WorkOrder>()
.Where(w => w.Flag == 1 && (w.Status == 0 || w.Status == 1 || w.Status == 2 || w.Status == 4))
.OrderByDescending(w => w.AddTime)
.Limit(8)
.ToListAsync(w => new { w.Id, w.OrderNo, w.ProcessZhuangkouId, w.Status, w.PlanStartDate });
var todos = new List<object>();
foreach (var o in pendingOrders)
{