WMS主数据结构升级,支持仓库/物料类型等新实体

后端:重构WmsController/WmsService,新增仓库、库区、货位、物料类型等实体及其增删改查接口,支持批量生成网格货位、货位/容器锁定与启用、物料归档与批量清理。数据库模型新增Warehouse、MaterialType、StockEvent等表,调整索引和字段,支持SQLite自动补表/补列及数据迁移,接口兼容旧语义。

前端:wms.ts/types/wms.ts全面适配新结构,升级API路由和类型定义。WarehouseManagementView.vue重构,支持仓库、物料类型管理、货位网格可视化、库存事件展示等。WmsEntityDialog.vue支持新字段编辑及联动选择。新增AreaFacadePanel.vue实现库区网格立面可视化。wmsOptions.ts新增相关常量及UI优化。

兼容性:后端自动迁移旧数据,接口兼容旧绑定语义,提升灵活性、可维护性和可视化能力。
This commit is contained in:
2026-07-24 10:19:36 +08:00
parent ce66da772e
commit bdcd88608c
12 changed files with 1794 additions and 288 deletions
+12
View File
@@ -12,6 +12,12 @@ public sealed class WmsReferenceValidator
_db = db;
}
public async Task EnsureWarehouseAsync(Guid id)
{
if (!await _db.Warehouses.AnyAsync(x => x.Id == id))
throw new InvalidOperationException("仓库不存在");
}
public async Task EnsureAreaAsync(Guid id)
{
if (!await _db.WarehouseAreas.AnyAsync(x => x.Id == id))
@@ -36,6 +42,12 @@ public sealed class WmsReferenceValidator
throw new InvalidOperationException("物料不存在");
}
public async Task EnsureMaterialTypeCodeAsync(string typeCode)
{
if (!await _db.MaterialTypes.AnyAsync(x => x.Code == typeCode))
throw new InvalidOperationException("物料类型不存在");
}
public async Task<(string Code, string Name)> ResolveLocationSnapshotAsync(string locationType, string locationId)
{
if (!ContainerLocationTypes.All.Contains(locationType))