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

@@ -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; }
}