新增 WMS 搬运规则与任务管理

支持搬运规则维护、候选预览、任务生成、预占、下发、取消和完成,并完善仓储管理前端交互。
This commit is contained in:
ArtoriasWu
2026-06-25 11:02:22 +08:00
parent 1cb8091bbe
commit 15405ba114
101 changed files with 4167704 additions and 152 deletions
+23
View File
@@ -84,6 +84,12 @@ public sealed class WmsService
entity.StorageType = req.StorageType.TrimOr("Storage");
entity.SiteId = req.SiteId.TrimOr("");
entity.Capacity = req.Capacity;
entity.Status = req.Status.TrimOr(StorageStatuses.Available);
entity.Usage = req.Usage.TrimOr("");
entity.Priority = req.Priority;
entity.ZoneCode = req.ZoneCode.TrimOr("");
entity.AllowInbound = req.AllowInbound;
entity.AllowOutbound = req.AllowOutbound;
entity.Enabled = req.Enabled;
ApplyCommon(entity, req, actor);
await _db.SaveChangesAsync();
@@ -157,6 +163,17 @@ public sealed class WmsService
if (!ContainerLocationStatuses.All.Contains(req.Status))
throw new InvalidOperationException("容器位置状态无效");
if (string.Equals(req.LocationType, ContainerLocationTypes.Storage, StringComparison.OrdinalIgnoreCase) &&
Guid.TryParse(req.LocationId, out var targetStorageId))
{
var occupied = await _db.ContainerLocations.AsNoTracking()
.AnyAsync(x => x.LocationType == ContainerLocationTypes.Storage &&
x.LocationId == req.LocationId &&
x.ContainerId != req.ContainerId);
if (occupied)
throw new InvalidOperationException("目标库位已被其他容器占用,库位与容器为 1 对 1");
}
var current = await _db.ContainerLocations.FirstOrDefaultAsync(x => x.ContainerId == req.ContainerId);
var before = current == null ? null : Snapshot(current);
var now = DateTimeOffset.UtcNow;
@@ -449,6 +466,12 @@ public sealed record StorageRequest(
string StorageType,
string SiteId,
int Capacity,
string Status,
string Usage,
int Priority,
string ZoneCode,
bool AllowInbound,
bool AllowOutbound,
bool Enabled,
bool IsLock,
string Remark,