namespace Admin.NET.Plugin.AiDOP.Infrastructure; /// /// S0 产销(Batch2)可单测的业务规则:与控制器中的赋值保持一致。 /// public static class AdoS0SalesRules { public static string ForbidStatusFromIsEnabled(bool isEnabled) => isEnabled ? "normal" : "forbidden"; /// /// 创建规则:未填编码时按时间戳与后缀生成,与控制器原逻辑一致。 /// public static string ResolveOrderPriorityRuleCodeForCreate(string? dtoCode, DateTime now, int randomSuffix) { if (!string.IsNullOrWhiteSpace(dtoCode)) return dtoCode; return $"RULE-{now:yyyyMMddHHmmss}-{randomSuffix}"; } /// /// 更新规则:空编码表示不修改原编码。 /// public static string ResolveOrderPriorityRuleCodeForUpdate(string? dtoCode, string existingCode) => string.IsNullOrWhiteSpace(dtoCode) ? existingCode : dtoCode; }