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:
commit
fa1b286463
241 files changed
+31188
No files matched your search
@@ -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) });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user