All checks were successful
Build and Deploy / deploy (push) Successful in 1m47s
Co-authored-by: Cursor <cursoragent@cursor.com>
40 lines
1.1 KiB
C#
40 lines
1.1 KiB
C#
namespace Oms.Domain.OrdersAggregate.Consts;
|
|
|
|
/// <summary>
|
|
/// 揽收方向:正向(客户地址→仓库)/ 逆向(仓库→客户地址)。
|
|
/// </summary>
|
|
public static class PickupDirectionCodes
|
|
{
|
|
/// <summary>正向:客户揽收地址 → 仓库</summary>
|
|
public const string Forward = "forward";
|
|
|
|
/// <summary>逆向:仓库 → 客户揽收地址</summary>
|
|
public const string Reverse = "reverse";
|
|
|
|
public static readonly HashSet<string> All = new(StringComparer.OrdinalIgnoreCase)
|
|
{
|
|
Forward,
|
|
Reverse
|
|
};
|
|
|
|
public static string NormalizeOrDefault(string? direction)
|
|
{
|
|
var code = string.IsNullOrWhiteSpace(direction) ? Forward : direction.Trim();
|
|
if (!All.Contains(code))
|
|
{
|
|
return Forward;
|
|
}
|
|
|
|
return All.First(x => string.Equals(x, code, StringComparison.OrdinalIgnoreCase));
|
|
}
|
|
|
|
public static string GetDisplayName(string? direction)
|
|
{
|
|
return NormalizeOrDefault(direction) switch
|
|
{
|
|
Reverse => "逆向",
|
|
_ => "正向"
|
|
};
|
|
}
|
|
}
|