Add WmsLite monorepo with JWT auth, tenant context, and project READMEs.

Implement API security baseline (sys_user, JWT, audit fields, transactions,
unique constraints) and Web real login with 401 handling. Document setup
and development workflows in root, WmsLite.Api, and WmsLite.Web README files.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
zhougfandCursor committed 2026-05-24 14:17:47 +08:00
commit fa1b286463
241 files changed
+31188

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
using System.ComponentModel.DataAnnotations;
using WmsLite.Api.Dtos.Common;
namespace WmsLite.Api.Dtos.Area;
public class AreaPagedQuery : BasePagedQuery
{
[StringLength(64)]
public string? WarehouseCode { get; set; }
[StringLength(64)]
public string? Code { get; set; }
[StringLength(256)]
public string? Name { get; set; }
[StringLength(128)]
public string? Keyword { get; set; }
}
+22
View File
@@ -0,0 +1,22 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using WmsLite.Api.Dtos.Common;
namespace WmsLite.Api.Dtos.Area;
public class AreaSaveRequest : TenantOwnerRequest
{
[Required(ErrorMessage = "仓库编码不能为空。")]
[StringLength(64)]
public string WarehouseCode { get; set; } = string.Empty;
[Required(ErrorMessage = "库区编码不能为空。")]
[StringLength(64)]
public string Code { get; set; } = string.Empty;
[Required(ErrorMessage = "库区名称不能为空。")]
[StringLength(256)]
public string Name { get; set; } = string.Empty;
public Dictionary<string, object>? Attrs { get; set; }
}
@@ -0,0 +1,25 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using WmsLite.Api.Dtos.Common;
namespace WmsLite.Api.Dtos.Area;
public class AreaUpdateRequest : TenantOwnerRequest
{
[Range(1, long.MaxValue, ErrorMessage = "Id 必须大于 0。")]
public long Id { get; set; }
[Required(ErrorMessage = "仓库编码不能为空。")]
[StringLength(64)]
public string WarehouseCode { get; set; } = string.Empty;
[Required(ErrorMessage = "库区编码不能为空。")]
[StringLength(64)]
public string Code { get; set; } = string.Empty;
[Required(ErrorMessage = "库区名称不能为空。")]
[StringLength(256)]
public string Name { get; set; } = string.Empty;
public Dictionary<string, object>? Attrs { get; set; }
}
+20
View File
@@ -0,0 +1,20 @@
using System.Collections.Generic;
namespace WmsLite.Api.Dtos.Area;
public class AreaViewDto
{
public long Id { get; set; }
public string TenantId { get; set; } = string.Empty;
public string OwnerCode { get; set; } = string.Empty;
public string WarehouseCode { get; set; } = string.Empty;
public string Code { get; set; } = string.Empty;
public string Name { get; set; } = string.Empty;
public Dictionary<string, object>? Attrs { get; set; }
}
+40
View File
@@ -0,0 +1,40 @@
namespace WmsLite.Api.Dtos.Auth;
public class LoginRequest
{
public string Username { get; set; } = string.Empty;
public string Password { get; set; } = string.Empty;
/// <summary>可选;默认 default。</summary>
public string? TenantId { get; set; }
/// <summary>可选;默认 default。</summary>
public string? OwnerCode { get; set; }
}
public class LoginResponseDto
{
public string Token { get; set; } = string.Empty;
public DateTime ExpiresAt { get; set; }
public string UserId { get; set; } = string.Empty;
public string TenantId { get; set; } = string.Empty;
public string OwnerCode { get; set; } = string.Empty;
public string DisplayName { get; set; } = string.Empty;
}
public class MeResponseDto
{
public string UserId { get; set; } = string.Empty;
public string TenantId { get; set; } = string.Empty;
public string OwnerCode { get; set; } = string.Empty;
public string DisplayName { get; set; } = string.Empty;
}
+20
View File
@@ -0,0 +1,20 @@
using System.ComponentModel.DataAnnotations;
namespace WmsLite.Api.Dtos.Common;
public class BasePagedQuery
{
[Obsolete("Ignored; tenant is resolved from the authenticated user context.")]
[StringLength(64)]
public string TenantId { get; set; } = string.Empty;
[Obsolete("Ignored; owner is resolved from the authenticated user context.")]
[StringLength(64)]
public string OwnerCode { get; set; } = string.Empty;
[Range(1, int.MaxValue, ErrorMessage = "PageIndex must be greater than or equal to 1.")]
public int PageIndex { get; set; } = 1;
[Range(1, 500, ErrorMessage = "PageSize must be between 1 and 500.")]
public int PageSize { get; set; } = 20;
}
@@ -0,0 +1,14 @@
using System.ComponentModel.DataAnnotations;
namespace WmsLite.Api.Dtos.Common;
public class TenantOwnerQuery
{
[Required(ErrorMessage = "TenantId is required.")]
[StringLength(64)]
public string TenantId { get; set; } = string.Empty;
[Required(ErrorMessage = "OwnerCode is required.")]
[StringLength(64)]
public string OwnerCode { get; set; } = string.Empty;
}
@@ -0,0 +1,14 @@
using System.ComponentModel.DataAnnotations;
namespace WmsLite.Api.Dtos.Common;
public abstract class TenantOwnerRequest
{
[Obsolete("Ignored; tenant is resolved from the authenticated user context.")]
[StringLength(64)]
public string TenantId { get; set; } = string.Empty;
[Obsolete("Ignored; owner is resolved from the authenticated user context.")]
[StringLength(64)]
public string OwnerCode { get; set; } = string.Empty;
}
@@ -0,0 +1,20 @@
using System.ComponentModel.DataAnnotations;
using WmsLite.Api.Dtos.Common;
namespace WmsLite.Api.Dtos.Container;
public class ContainerPagedQuery : BasePagedQuery
{
[StringLength(64)]
public string? Code { get; set; }
[StringLength(256)]
public string? Name { get; set; }
[StringLength(64)]
public string? ContainerType { get; set; }
/// <summary>同时模糊匹配编码或名称(与单独 Code、Name 条件可叠加)。</summary>
[StringLength(128)]
public string? Keyword { get; set; }
}
@@ -0,0 +1,20 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using WmsLite.Api.Dtos.Common;
namespace WmsLite.Api.Dtos.Container;
public class ContainerSaveRequest : TenantOwnerRequest
{
[Required(ErrorMessage = "容器编码不能为空。")]
[StringLength(64)]
public string Code { get; set; } = string.Empty;
[StringLength(256)]
public string? Name { get; set; }
[StringLength(64)]
public string? ContainerType { get; set; }
public Dictionary<string, object>? Attrs { get; set; }
}
@@ -0,0 +1,23 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using WmsLite.Api.Dtos.Common;
namespace WmsLite.Api.Dtos.Container;
public class ContainerUpdateRequest : TenantOwnerRequest
{
[Range(1, long.MaxValue, ErrorMessage = "Id 必须大于 0。")]
public long Id { get; set; }
[Required(ErrorMessage = "容器编码不能为空。")]
[StringLength(64)]
public string Code { get; set; } = string.Empty;
[StringLength(256)]
public string? Name { get; set; }
[StringLength(64)]
public string? ContainerType { get; set; }
public Dictionary<string, object>? Attrs { get; set; }
}
@@ -0,0 +1,20 @@
using System.Collections.Generic;
namespace WmsLite.Api.Dtos.Container;
public class ContainerViewDto
{
public long Id { get; set; }
public string TenantId { get; set; } = string.Empty;
public string OwnerCode { get; set; } = string.Empty;
public string Code { get; set; } = string.Empty;
public string? Name { get; set; }
public string? ContainerType { get; set; }
public Dictionary<string, object>? Attrs { get; set; }
}
@@ -0,0 +1,9 @@
using WmsLite.Api.Dtos.Common;
namespace WmsLite.Api.Dtos.Dictionary;
public class SysDictionaryMapRequest : TenantOwnerRequest
{
/// <summary>Optional filter; omit to return all merged categories visible to tenant.</summary>
public List<string>? Categories { get; set; }
}
@@ -0,0 +1,23 @@
using System.ComponentModel.DataAnnotations;
using WmsLite.Api.Dtos.Common;
using WmsLite.Api.Enums;
namespace WmsLite.Api.Dtos.Inventory;
public class InventoryMoveRequest : TenantOwnerRequest
{
[Range(1, long.MaxValue)]
public long InventoryId { get; set; }
[Required]
public InventoryMoveAction MovementType { get; set; }
[Range(typeof(decimal), "0.000001", "9999999999999999")]
public decimal Qty { get; set; }
[StringLength(128)]
public string? BizNo { get; set; }
[StringLength(512)]
public string? Remark { get; set; }
}
@@ -0,0 +1,96 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using WmsLite.Api.Dtos.Common;
using WmsLite.Api.Enums;
namespace WmsLite.Api.Dtos.Inventory;
public abstract class InventoryMutationRequestBase : TenantOwnerRequest, IValidatableObject
{
[Required(ErrorMessage = "BizType is required.")]
[StringLength(64)]
public string BizType { get; set; } = string.Empty;
[Required(ErrorMessage = "InventoryKind is required.")]
[EnumDataType(typeof(InventoryKind), ErrorMessage = "InventoryKind is invalid.")]
public InventoryKind InventoryKind { get; set; } = InventoryKind.Material;
[Required]
[EnumDataType(typeof(InventoryStatus), ErrorMessage = "InventoryStatus is invalid.")]
public InventoryStatus InventoryStatus { get; set; } = InventoryStatus.Available;
[StringLength(64)]
public string? MaterialCode { get; set; }
[StringLength(64)]
public string? ContainerCode { get; set; }
[Required(ErrorMessage = "WarehouseCode is required.")]
[StringLength(64)]
public string WarehouseCode { get; set; } = string.Empty;
[Required(ErrorMessage = "AreaCode is required.")]
[StringLength(64)]
public string AreaCode { get; set; } = string.Empty;
[Required(ErrorMessage = "分区编码不能为空。")]
[StringLength(64)]
public string ZoneCode { get; set; } = string.Empty;
[Required(ErrorMessage = "LocationCode is required.")]
[StringLength(64)]
public string LocationCode { get; set; } = string.Empty;
[Range(typeof(decimal), "0", "9999999999999999", ErrorMessage = "Qty must be greater than or equal to 0.")]
public decimal Qty { get; set; }
[Range(typeof(decimal), "0", "9999999999999999", ErrorMessage = "PendingInboundQty must be greater than or equal to 0.")]
public decimal PendingInboundQty { get; set; }
[Range(typeof(decimal), "0", "9999999999999999", ErrorMessage = "PendingOutboundQty must be greater than or equal to 0.")]
public decimal PendingOutboundQty { get; set; }
[Range(typeof(decimal), "0", "9999999999999999", ErrorMessage = "FrozenQty must be greater than or equal to 0.")]
public decimal FrozenQty { get; set; }
[Required(ErrorMessage = "Unit is required.")]
[StringLength(32)]
public string Unit { get; set; } = string.Empty;
public Dictionary<string, object>? Attrs { get; set; }
public virtual IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
{
if (!Enum.IsDefined(typeof(InventoryKind), InventoryKind)
|| (InventoryKind != InventoryKind.Material && InventoryKind != InventoryKind.EmptyContainer))
{
yield return new ValidationResult("InventoryKind is invalid.", new[] { nameof(InventoryKind) });
yield break;
}
if (InventoryKind == InventoryKind.Material)
{
if (string.IsNullOrWhiteSpace(MaterialCode))
{
yield return new ValidationResult("MaterialCode is required for material inventory.", new[] { nameof(MaterialCode) });
}
if (!string.IsNullOrWhiteSpace(ContainerCode))
{
yield return new ValidationResult("ContainerCode must be empty for material inventory.", new[] { nameof(ContainerCode) });
}
}
else if (InventoryKind == InventoryKind.EmptyContainer)
{
if (string.IsNullOrWhiteSpace(ContainerCode))
{
yield return new ValidationResult("ContainerCode is required for empty container inventory.", new[] { nameof(ContainerCode) });
}
if (!string.IsNullOrWhiteSpace(MaterialCode))
{
yield return new ValidationResult("MaterialCode must be empty for empty container inventory.", new[] { nameof(MaterialCode) });
}
}
}
}
@@ -0,0 +1,34 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using WmsLite.Api.Dtos.Common;
using WmsLite.Api.Enums;
namespace WmsLite.Api.Dtos.Inventory;
public class InventoryPagedQuery : BasePagedQuery
{
[StringLength(64)]
public string? BizType { get; set; }
public InventoryKind? InventoryKind { get; set; }
public InventoryStatus? InventoryStatus { get; set; }
[StringLength(64)]
public string? WarehouseCode { get; set; }
[StringLength(64)]
public string? AreaCode { get; set; }
/// <summary>分区编码筛选。</summary>
[StringLength(64)]
public string? ZoneCode { get; set; }
[StringLength(64)]
public string? MaterialCode { get; set; }
[StringLength(64)]
public string? ContainerCode { get; set; }
public Dictionary<string, object>? SearchParam { get; set; }
}
@@ -0,0 +1,5 @@
namespace WmsLite.Api.Dtos.Inventory;
public class InventorySaveRequest : InventoryMutationRequestBase
{
}
@@ -0,0 +1,16 @@
using System.ComponentModel.DataAnnotations;
using WmsLite.Api.Dtos.Common;
using WmsLite.Api.Enums;
namespace WmsLite.Api.Dtos.Inventory;
public class InventoryTransactionPagedQuery : BasePagedQuery
{
[Range(1, long.MaxValue)]
public long? InventoryId { get; set; }
public InventoryMovementType? MovementType { get; set; }
[StringLength(128)]
public string? BizNo { get; set; }
}
@@ -0,0 +1,62 @@
using System;
using System.Collections.Generic;
using WmsLite.Api.Enums;
namespace WmsLite.Api.Dtos.Inventory;
public class InventoryTransactionViewDto
{
public long Id { get; set; }
public string TenantId { get; set; } = string.Empty;
public string OwnerCode { get; set; } = string.Empty;
public long InventoryId { get; set; }
public InventoryMovementType MovementType { get; set; }
public InventoryStatus InventoryStatus { get; set; }
public string? BizNo { get; set; }
public decimal BeforeQty { get; set; }
public decimal AfterQty { get; set; }
public decimal BeforePendingInboundQty { get; set; }
public decimal AfterPendingInboundQty { get; set; }
public decimal BeforePendingOutboundQty { get; set; }
public decimal AfterPendingOutboundQty { get; set; }
public decimal BeforeFrozenQty { get; set; }
public decimal AfterFrozenQty { get; set; }
public decimal ChangeQty { get; set; }
/// <summary>流水快照:物料编码(追溯)。</summary>
public string? MaterialCode { get; set; }
/// <summary>流水快照:容器编码(追溯)。</summary>
public string? ContainerCode { get; set; }
/// <summary>流水快照:仓库编码。</summary>
public string WarehouseCode { get; set; } = string.Empty;
/// <summary>流水快照:库区编码。</summary>
public string AreaCode { get; set; } = string.Empty;
/// <summary>流水快照:分区编码。</summary>
public string ZoneCode { get; set; } = string.Empty;
/// <summary>流水快照:库位编码(追溯)。</summary>
public string? LocationCode { get; set; }
public Dictionary<string, object>? Attrs { get; set; }
public DateTime? CreateTime { get; set; }
}
@@ -0,0 +1,9 @@
using System.ComponentModel.DataAnnotations;
namespace WmsLite.Api.Dtos.Inventory;
public class InventoryUpdateRequest : InventoryMutationRequestBase
{
[Range(1, long.MaxValue, ErrorMessage = "Id 必须大于 0。")]
public long Id { get; set; }
}
@@ -0,0 +1,66 @@
using System.Collections.Generic;
using WmsLite.Api.Enums;
namespace WmsLite.Api.Dtos.Inventory;
public class InventoryViewDto
{
public long Id { get; set; }
public string TenantId { get; set; } = string.Empty;
public string OwnerCode { get; set; } = string.Empty;
public InventoryKind InventoryKind { get; set; }
public InventoryStatus InventoryStatus { get; set; }
public string? MaterialCode { get; set; }
public string? ContainerCode { get; set; }
public string WarehouseCode { get; set; } = string.Empty;
/// <summary>主数据解析,非库存表字段。</summary>
public string WarehouseName { get; set; } = string.Empty;
public string AreaCode { get; set; } = string.Empty;
/// <summary>主数据解析。</summary>
public string AreaName { get; set; } = string.Empty;
public string ZoneCode { get; set; } = string.Empty;
/// <summary>主数据解析,分区名称。</summary>
public string ZoneName { get; set; } = string.Empty;
public string LocationCode { get; set; } = string.Empty;
/// <summary>主数据解析,非库存表字段。</summary>
public string MaterialName { get; set; } = string.Empty;
public decimal Qty { get; set; }
public decimal PendingInboundQty { get; set; }
public decimal PendingOutboundQty { get; set; }
public decimal FrozenQty { get; set; }
public string Unit { get; set; } = string.Empty;
public Dictionary<string, object>? Attrs { get; set; }
public List<TemplateFieldDto>? ConfigFields { get; set; }
}
public class TemplateFieldDto
{
public string Field { get; set; } = string.Empty;
public string Label { get; set; } = string.Empty;
public string Type { get; set; } = string.Empty;
public object? Value { get; set; }
}
@@ -0,0 +1,58 @@
using System.ComponentModel.DataAnnotations;
using WmsLite.Api.Dtos.Common;
using WmsLite.Api.Enums;
namespace WmsLite.Api.Dtos.Location;
public class LocationBatchCreateRequest : TenantOwnerRequest
{
[Required(ErrorMessage = "仓库编码不能为空。")]
[StringLength(64)]
public string WarehouseCode { get; set; } = string.Empty;
[Required(ErrorMessage = "库区编码不能为空。")]
[StringLength(64)]
public string AreaCode { get; set; } = string.Empty;
[Required(ErrorMessage = "分区编码不能为空。")]
[StringLength(64)]
public string ZoneCode { get; set; } = string.Empty;
[Required(ErrorMessage = "伸位编码不能为空。")]
[StringLength(64)]
public string AisleCode { get; set; } = string.Empty;
[Required]
[EnumDataType(typeof(ShelfDepthKind), ErrorMessage = "伸位类型无效。")]
public ShelfDepthKind ShelfDepthKind { get; set; }
[Range(1, int.MaxValue, ErrorMessage = "列起始须 ≥ 1。")]
public int ColumnFrom { get; set; }
[Range(1, int.MaxValue, ErrorMessage = "列结束须 ≥ 1。")]
public int ColumnTo { get; set; }
[Range(1, int.MaxValue, ErrorMessage = "层起始须 ≥ 1。")]
public int LayerFrom { get; set; }
[Range(1, int.MaxValue, ErrorMessage = "层结束须 ≥ 1。")]
public int LayerTo { get; set; }
public decimal? Height { get; set; }
[Required]
[EnumDataType(typeof(LocationStatus), ErrorMessage = "LocationStatus 无效。")]
public LocationStatus LocationStatus { get; set; } = LocationStatus.Empty;
/// <summary>占位符含 Warehouse Area Zone Aisle Row Col Layer(Zone 为分区编码),可加格式如 Row:D2。</summary>
[Required(ErrorMessage = "库位编码模板不能为空。")]
[StringLength(512)]
public string CodeTemplate { get; set; } = string.Empty;
[StringLength(512)]
public string? NameTemplate { get; set; }
[Required]
[EnumDataType(typeof(LocationBatchDuplicatePolicy), ErrorMessage = "重复策略无效。")]
public LocationBatchDuplicatePolicy DuplicatePolicy { get; set; }
}
@@ -0,0 +1,11 @@
namespace WmsLite.Api.Dtos.Location;
public class LocationBatchCreateResultDto
{
public int CreatedCount { get; set; }
/// <summary>跳过(已在库中存在)或整批中止时重复的编码。</summary>
public List<string> SkippedCodes { get; set; } = new();
public string? FailedReason { get; set; }
}
@@ -0,0 +1,34 @@
using System.ComponentModel.DataAnnotations;
using WmsLite.Api.Dtos.Common;
using WmsLite.Api.Enums;
namespace WmsLite.Api.Dtos.Location;
public class LocationPagedQuery : BasePagedQuery
{
[StringLength(64)]
public string? WarehouseCode { get; set; }
[StringLength(64)]
public string? AreaCode { get; set; }
/// <summary>分区编码筛选。</summary>
[StringLength(64)]
public string? ZoneCode { get; set; }
[StringLength(64)]
public string? AisleCode { get; set; }
[StringLength(64)]
public string? Code { get; set; }
[StringLength(256)]
public string? Name { get; set; }
public LocationStatus? LocationStatus { get; set; }
public bool? IsOuter { get; set; }
[StringLength(64)]
public string? ContainerCode { get; set; }
}
@@ -0,0 +1,50 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using WmsLite.Api.Dtos.Common;
using WmsLite.Api.Enums;
namespace WmsLite.Api.Dtos.Location;
public class LocationSaveRequest : TenantOwnerRequest
{
[Required(ErrorMessage = "仓库编码不能为空。")]
[StringLength(64)]
public string WarehouseCode { get; set; } = string.Empty;
[Required(ErrorMessage = "库区编码不能为空。")]
[StringLength(64)]
public string AreaCode { get; set; } = string.Empty;
[Required(ErrorMessage = "分区编码不能为空。")]
[StringLength(64)]
public string ZoneCode { get; set; } = string.Empty;
[StringLength(64)]
public string? AisleCode { get; set; }
[Required(ErrorMessage = "储位编码不能为空。")]
[StringLength(64)]
public string Code { get; set; } = string.Empty;
[StringLength(256)]
public string? Name { get; set; }
public int? RowNo { get; set; }
public int? ColumnNo { get; set; }
public int? LayerNo { get; set; }
public decimal? Height { get; set; }
[Required]
[EnumDataType(typeof(LocationStatus), ErrorMessage = "LocationStatus 无效。")]
public LocationStatus LocationStatus { get; set; } = LocationStatus.Empty;
public bool IsOuter { get; set; }
[StringLength(64)]
public string? ContainerCode { get; set; }
public Dictionary<string, object>? Attrs { get; set; }
}
@@ -0,0 +1,53 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using WmsLite.Api.Dtos.Common;
using WmsLite.Api.Enums;
namespace WmsLite.Api.Dtos.Location;
public class LocationUpdateRequest : TenantOwnerRequest
{
[Range(1, long.MaxValue, ErrorMessage = "Id 必须大于 0。")]
public long Id { get; set; }
[Required(ErrorMessage = "仓库编码不能为空。")]
[StringLength(64)]
public string WarehouseCode { get; set; } = string.Empty;
[Required(ErrorMessage = "库区编码不能为空。")]
[StringLength(64)]
public string AreaCode { get; set; } = string.Empty;
[Required(ErrorMessage = "分区编码不能为空。")]
[StringLength(64)]
public string ZoneCode { get; set; } = string.Empty;
[StringLength(64)]
public string? AisleCode { get; set; }
[Required(ErrorMessage = "储位编码不能为空。")]
[StringLength(64)]
public string Code { get; set; } = string.Empty;
[StringLength(256)]
public string? Name { get; set; }
public int? RowNo { get; set; }
public int? ColumnNo { get; set; }
public int? LayerNo { get; set; }
public decimal? Height { get; set; }
[Required]
[EnumDataType(typeof(LocationStatus), ErrorMessage = "LocationStatus 无效。")]
public LocationStatus LocationStatus { get; set; } = LocationStatus.Empty;
public bool IsOuter { get; set; }
[StringLength(64)]
public string? ContainerCode { get; set; }
public Dictionary<string, object>? Attrs { get; set; }
}
@@ -0,0 +1,41 @@
using System.Collections.Generic;
using WmsLite.Api.Enums;
namespace WmsLite.Api.Dtos.Location;
public class LocationViewDto
{
public long Id { get; set; }
public string TenantId { get; set; } = string.Empty;
public string OwnerCode { get; set; } = string.Empty;
public string WarehouseCode { get; set; } = string.Empty;
public string AreaCode { get; set; } = string.Empty;
public string ZoneCode { get; set; } = string.Empty;
public string? AisleCode { get; set; }
public string Code { get; set; } = string.Empty;
public string? Name { get; set; }
public int? RowNo { get; set; }
public int? ColumnNo { get; set; }
public int? LayerNo { get; set; }
public decimal? Height { get; set; }
public LocationStatus LocationStatus { get; set; }
public bool IsOuter { get; set; }
public string? ContainerCode { get; set; }
public Dictionary<string, object>? Attrs { get; set; }
}
@@ -0,0 +1,22 @@
using System.ComponentModel.DataAnnotations;
using WmsLite.Api.Dtos.Common;
namespace WmsLite.Api.Dtos.Material;
public class MaterialPagedQuery : BasePagedQuery
{
[StringLength(64)]
public string? Code { get; set; }
[StringLength(256)]
public string? Name { get; set; }
[StringLength(512)]
public string? Spec { get; set; }
/// <summary>
/// 同时模糊匹配编码或名称(与单独 Code、Name 条件可叠加)。
/// </summary>
[StringLength(128)]
public string? Keyword { get; set; }
}
@@ -0,0 +1,25 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using WmsLite.Api.Dtos.Common;
namespace WmsLite.Api.Dtos.Material;
public class MaterialSaveRequest : TenantOwnerRequest
{
[Required(ErrorMessage = "物料编码不能为空。")]
[StringLength(64)]
public string Code { get; set; } = string.Empty;
[Required(ErrorMessage = "物料名称不能为空。")]
[StringLength(256)]
public string Name { get; set; } = string.Empty;
[StringLength(512)]
public string? Spec { get; set; }
[Required(ErrorMessage = "单位不能为空。")]
[StringLength(32)]
public string Unit { get; set; } = string.Empty;
public Dictionary<string, object>? Attrs { get; set; }
}
@@ -0,0 +1,28 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using WmsLite.Api.Dtos.Common;
namespace WmsLite.Api.Dtos.Material;
public class MaterialUpdateRequest : TenantOwnerRequest
{
[Range(1, long.MaxValue, ErrorMessage = "Id 必须大于 0。")]
public long Id { get; set; }
[Required(ErrorMessage = "物料编码不能为空。")]
[StringLength(64)]
public string Code { get; set; } = string.Empty;
[Required(ErrorMessage = "物料名称不能为空。")]
[StringLength(256)]
public string Name { get; set; } = string.Empty;
[StringLength(512)]
public string? Spec { get; set; }
[Required(ErrorMessage = "单位不能为空。")]
[StringLength(32)]
public string Unit { get; set; } = string.Empty;
public Dictionary<string, object>? Attrs { get; set; }
}
@@ -0,0 +1,22 @@
using System.Collections.Generic;
namespace WmsLite.Api.Dtos.Material;
public class MaterialViewDto
{
public long Id { get; set; }
public string TenantId { get; set; } = string.Empty;
public string OwnerCode { get; set; } = string.Empty;
public string Code { get; set; } = string.Empty;
public string Name { get; set; } = string.Empty;
public string? Spec { get; set; }
public string Unit { get; set; } = string.Empty;
public Dictionary<string, object>? Attrs { get; set; }
}
+244
View File
@@ -0,0 +1,244 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using WmsLite.Api.Dtos.Common;
using WmsLite.Api.Enums;
namespace WmsLite.Api.Dtos.Orders;
public abstract class OrderSaveRequestBase : TenantOwnerRequest
{
[Required]
[StringLength(128)]
public string OrderNo { get; set; } = string.Empty;
[StringLength(64)]
public string? BizType { get; set; }
[StringLength(512)]
public string? Remark { get; set; }
public Dictionary<string, object>? Attrs { get; set; }
}
public abstract class OrderPagedQueryBase : BasePagedQuery
{
[StringLength(128)]
public string? OrderNo { get; set; }
[StringLength(64)]
public string? BizType { get; set; }
public OrderStatus? OrderStatus { get; set; }
}
public class OrderActionRequest : TenantOwnerRequest
{
[Range(1, long.MaxValue)]
public long Id { get; set; }
}
public class InventoryOrderLineRequest
{
[Required]
[EnumDataType(typeof(InventoryKind))]
public InventoryKind InventoryKind { get; set; } = InventoryKind.Material;
[StringLength(64)]
public string? MaterialCode { get; set; }
[StringLength(64)]
public string? ContainerCode { get; set; }
[Required]
[StringLength(64)]
public string WarehouseCode { get; set; } = string.Empty;
[Required]
[StringLength(64)]
public string AreaCode { get; set; } = string.Empty;
[Required]
[StringLength(64)]
public string LocationCode { get; set; } = string.Empty;
[Range(typeof(decimal), "0.000001", "9999999999999999")]
public decimal Qty { get; set; }
[Required]
[StringLength(32)]
public string Unit { get; set; } = string.Empty;
public Dictionary<string, object>? Attrs { get; set; }
}
public class TransferOrderLineRequest
{
[Required]
[EnumDataType(typeof(InventoryKind))]
public InventoryKind InventoryKind { get; set; } = InventoryKind.Material;
[StringLength(64)]
public string? MaterialCode { get; set; }
[StringLength(64)]
public string? ContainerCode { get; set; }
[Required]
[StringLength(64)]
public string FromWarehouseCode { get; set; } = string.Empty;
[Required]
[StringLength(64)]
public string FromAreaCode { get; set; } = string.Empty;
[Required]
[StringLength(64)]
public string FromLocationCode { get; set; } = string.Empty;
[Required]
[StringLength(64)]
public string ToWarehouseCode { get; set; } = string.Empty;
[Required]
[StringLength(64)]
public string ToAreaCode { get; set; } = string.Empty;
[Required]
[StringLength(64)]
public string ToLocationCode { get; set; } = string.Empty;
[Range(typeof(decimal), "0.000001", "9999999999999999")]
public decimal Qty { get; set; }
[Required]
[StringLength(32)]
public string Unit { get; set; } = string.Empty;
public Dictionary<string, object>? Attrs { get; set; }
}
public class StocktakeOrderLineRequest : InventoryOrderLineRequest
{
[Range(typeof(decimal), "0", "9999999999999999")]
public decimal CountedQty { get; set; }
}
/// <summary>入库单新建:单号后端生成,无单头扩展 JSON。</summary>
public class InboundOrderCreateRequest : TenantOwnerRequest
{
[StringLength(64)]
public string? BizType { get; set; }
[StringLength(512)]
public string? Remark { get; set; }
[MinLength(1)]
public List<InboundOrderLineSaveRequest> Lines { get; set; } = new();
}
public class InboundOrderLineSaveRequest
{
[Required]
[EnumDataType(typeof(InventoryKind))]
public InventoryKind InventoryKind { get; set; } = InventoryKind.Material;
[StringLength(64)]
public string? MaterialCode { get; set; }
[Required]
[StringLength(64)]
public string WarehouseCode { get; set; } = string.Empty;
[Required]
[StringLength(64)]
public string AreaCode { get; set; } = string.Empty;
[Range(typeof(decimal), "0.000001", "9999999999999999")]
public decimal Qty { get; set; }
public Dictionary<string, object>? Attrs { get; set; }
}
public class InboundOrderLineConfirmRequest : TenantOwnerRequest
{
[Required]
public string LineId { get; set; } = string.Empty;
[Required]
[StringLength(64)]
public string LocationCode { get; set; } = string.Empty;
[Range(typeof(decimal), "0.000001", "9999999999999999")]
public decimal Qty { get; set; }
/// <summary>空容器行必填;物料行可选(绑定容器)。</summary>
[StringLength(64)]
public string? ContainerCode { get; set; }
/// <summary>物料行可省略,以物料主数据单位写入库存;空容器行必填。</summary>
[StringLength(32)]
public string? Unit { get; set; }
}
public class InboundConfirmLineResultDto
{
public OrderViewDto Order { get; set; } = null!;
public InventoryOrderLineViewDto Line { get; set; } = null!;
}
public class OutboundOrderSaveRequest : OrderSaveRequestBase
{
[MinLength(1)]
public List<InventoryOrderLineRequest> Lines { get; set; } = new();
}
public class TransferOrderSaveRequest : OrderSaveRequestBase
{
[MinLength(1)]
public List<TransferOrderLineRequest> Lines { get; set; } = new();
}
public class StocktakeOrderSaveRequest : OrderSaveRequestBase
{
[MinLength(1)]
public List<StocktakeOrderLineRequest> Lines { get; set; } = new();
}
public class InboundOrderPagedQuery : OrderPagedQueryBase
{
}
public class OutboundOrderPagedQuery : OrderPagedQueryBase
{
}
public class TransferOrderPagedQuery : OrderPagedQueryBase
{
}
public class StocktakeOrderPagedQuery : OrderPagedQueryBase
{
}
public class OrderViewDto
{
/// <summary>雪花主键,用字符串避免 JSON number + 前端精度丢失。</summary>
public string Id { get; set; } = string.Empty;
public string TenantId { get; set; } = string.Empty;
public string OwnerCode { get; set; } = string.Empty;
public string OrderNo { get; set; } = string.Empty;
public string? BizType { get; set; }
public OrderStatus OrderStatus { get; set; }
public string? Remark { get; set; }
public Dictionary<string, object>? Attrs { get; set; }
public DateTime? CreateTime { get; set; }
}
@@ -0,0 +1,81 @@
using System.Collections.Generic;
using WmsLite.Api.Enums;
namespace WmsLite.Api.Dtos.Orders;
/// <summary>入库/出库订单行(结构一致)。</summary>
public class InventoryOrderLineViewDto
{
public string Id { get; set; } = string.Empty;
public string OrderId { get; set; } = string.Empty;
public int LineNo { get; set; }
public InventoryKind InventoryKind { get; set; }
public string? MaterialCode { get; set; }
public string? ContainerCode { get; set; }
public string WarehouseCode { get; set; } = string.Empty;
public string AreaCode { get; set; } = string.Empty;
public string LocationCode { get; set; } = string.Empty;
public decimal Qty { get; set; }
/// <summary>已入库数量(累计)。</summary>
public decimal ReceivedQty { get; set; }
/// <summary>剩余可入库数量(计划 − 已收)。</summary>
public decimal RemainingQty { get; set; }
public OrderLineStatus LineStatus { get; set; }
public string Unit { get; set; } = string.Empty;
/// <summary>物料主数据计量单位(物料行可由列表接口联表带出,用于入库确认的展示与单位依据)。</summary>
public string? MaterialMasterUnit { get; set; }
public Dictionary<string, object>? Attrs { get; set; }
}
public class TransferOrderLineViewDto
{
public string Id { get; set; } = string.Empty;
public string OrderId { get; set; } = string.Empty;
public int LineNo { get; set; }
public InventoryKind InventoryKind { get; set; }
public string? MaterialCode { get; set; }
public string? ContainerCode { get; set; }
public string FromWarehouseCode { get; set; } = string.Empty;
public string FromAreaCode { get; set; } = string.Empty;
public string FromLocationCode { get; set; } = string.Empty;
public string ToWarehouseCode { get; set; } = string.Empty;
public string ToAreaCode { get; set; } = string.Empty;
public string ToLocationCode { get; set; } = string.Empty;
public decimal Qty { get; set; }
public string Unit { get; set; } = string.Empty;
public Dictionary<string, object>? Attrs { get; set; }
}
public class StocktakeOrderLineViewDto : InventoryOrderLineViewDto
{
public decimal CountedQty { get; set; }
}
@@ -0,0 +1,48 @@
using System.ComponentModel.DataAnnotations;
using WmsLite.Api.Dtos.Common;
namespace WmsLite.Api.Dtos.Template;
public class SysTemplatePagedQuery : BasePagedQuery
{
[StringLength(64)]
public string? BizType { get; set; }
[StringLength(128)]
public string? BizName { get; set; }
}
public class SysTemplateSaveRequest : TenantOwnerRequest
{
[Required]
[StringLength(64)]
public string BizType { get; set; } = string.Empty;
[Required]
[StringLength(128)]
public string BizName { get; set; } = string.Empty;
[Required]
public string ConfigJson { get; set; } = "[]";
}
public class SysTemplateUpdateRequest : SysTemplateSaveRequest
{
[Range(1, long.MaxValue)]
public long Id { get; set; }
}
public class SysTemplateViewDto
{
public long Id { get; set; }
public string TenantId { get; set; } = string.Empty;
public string OwnerCode { get; set; } = string.Empty;
public string BizType { get; set; } = string.Empty;
public string BizName { get; set; } = string.Empty;
public string? ConfigJson { get; set; }
}
@@ -0,0 +1,17 @@
using System.ComponentModel.DataAnnotations;
using WmsLite.Api.Dtos.Common;
namespace WmsLite.Api.Dtos.Warehouse;
public class WarehousePagedQuery : BasePagedQuery
{
[StringLength(64)]
public string? Code { get; set; }
[StringLength(256)]
public string? Name { get; set; }
/// <summary>同时模糊匹配编码或名称(与单独 Code、Name 条件可叠加)。</summary>
[StringLength(128)]
public string? Keyword { get; set; }
}
@@ -0,0 +1,18 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using WmsLite.Api.Dtos.Common;
namespace WmsLite.Api.Dtos.Warehouse;
public class WarehouseSaveRequest : TenantOwnerRequest
{
[Required(ErrorMessage = "仓库编码不能为空。")]
[StringLength(64)]
public string Code { get; set; } = string.Empty;
[Required(ErrorMessage = "仓库名称不能为空。")]
[StringLength(256)]
public string Name { get; set; } = string.Empty;
public Dictionary<string, object>? Attrs { get; set; }
}
@@ -0,0 +1,21 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using WmsLite.Api.Dtos.Common;
namespace WmsLite.Api.Dtos.Warehouse;
public class WarehouseUpdateRequest : TenantOwnerRequest
{
[Range(1, long.MaxValue, ErrorMessage = "Id 必须大于 0。")]
public long Id { get; set; }
[Required(ErrorMessage = "仓库编码不能为空。")]
[StringLength(64)]
public string Code { get; set; } = string.Empty;
[Required(ErrorMessage = "仓库名称不能为空。")]
[StringLength(256)]
public string Name { get; set; } = string.Empty;
public Dictionary<string, object>? Attrs { get; set; }
}
@@ -0,0 +1,18 @@
using System.Collections.Generic;
namespace WmsLite.Api.Dtos.Warehouse;
public class WarehouseViewDto
{
public long Id { get; set; }
public string TenantId { get; set; } = string.Empty;
public string OwnerCode { get; set; } = string.Empty;
public string Code { get; set; } = string.Empty;
public string Name { get; set; } = string.Empty;
public Dictionary<string, object>? Attrs { get; set; }
}
+23
View File
@@ -0,0 +1,23 @@
using System.ComponentModel.DataAnnotations;
using WmsLite.Api.Dtos.Common;
namespace WmsLite.Api.Dtos.Zone;
public class ZonePagedQuery : BasePagedQuery
{
[StringLength(64)]
public string? WarehouseCode { get; set; }
[StringLength(64)]
public string? AreaCode { get; set; }
[StringLength(64)]
public string? Code { get; set; }
[StringLength(256)]
public string? Name { get; set; }
/// <summary>同时模糊匹配库区编码或名称(与其它条件可叠加)。</summary>
[StringLength(128)]
public string? Keyword { get; set; }
}
+26
View File
@@ -0,0 +1,26 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using WmsLite.Api.Dtos.Common;
namespace WmsLite.Api.Dtos.Zone;
public class ZoneSaveRequest : TenantOwnerRequest
{
[Required(ErrorMessage = "仓库编码不能为空。")]
[StringLength(64)]
public string WarehouseCode { get; set; } = string.Empty;
[Required(ErrorMessage = "库区编码不能为空。")]
[StringLength(64)]
public string AreaCode { get; set; } = string.Empty;
[Required(ErrorMessage = "分区编码不能为空。")]
[StringLength(64)]
public string Code { get; set; } = string.Empty;
[Required(ErrorMessage = "分区名称不能为空。")]
[StringLength(256)]
public string Name { get; set; } = string.Empty;
public Dictionary<string, object>? Attrs { get; set; }
}
@@ -0,0 +1,29 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using WmsLite.Api.Dtos.Common;
namespace WmsLite.Api.Dtos.Zone;
public class ZoneUpdateRequest : TenantOwnerRequest
{
[Range(1, long.MaxValue, ErrorMessage = "Id 必须大于 0。")]
public long Id { get; set; }
[Required(ErrorMessage = "仓库编码不能为空。")]
[StringLength(64)]
public string WarehouseCode { get; set; } = string.Empty;
[Required(ErrorMessage = "库区编码不能为空。")]
[StringLength(64)]
public string AreaCode { get; set; } = string.Empty;
[Required(ErrorMessage = "分区编码不能为空。")]
[StringLength(64)]
public string Code { get; set; } = string.Empty;
[Required(ErrorMessage = "分区名称不能为空。")]
[StringLength(256)]
public string Name { get; set; } = string.Empty;
public Dictionary<string, object>? Attrs { get; set; }
}
+22
View File
@@ -0,0 +1,22 @@
using System.Collections.Generic;
namespace WmsLite.Api.Dtos.Zone;
public class ZoneViewDto
{
public long Id { get; set; }
public string TenantId { get; set; } = string.Empty;
public string OwnerCode { get; set; } = string.Empty;
public string WarehouseCode { get; set; } = string.Empty;
public string AreaCode { get; set; } = string.Empty;
public string Code { get; set; } = string.Empty;
public string Name { get; set; } = string.Empty;
public Dictionary<string, object>? Attrs { get; set; }
}