| | | 1 | | namespace OzonOrdersWeb.WebServices.Orders.Grid; |
| | | 2 | | |
| | | 3 | | /// <summary>Поле строки грида, доступное в формулах вычисляемых столбцов (ключ → поле DTO, тип, гейт колонки).</summary |
| | 2425 | 4 | | public sealed record OrdersGridFormulaField(string Key, string Field, string Label, string Type, string? Gate); |
| | | 5 | | |
| | | 6 | | /// <summary> |
| | | 7 | | /// Единый каталог полей для формул: сервер отдаёт клиенту только разрешённые пользователю (гейтинг колонок), |
| | | 8 | | /// а при сохранении проверяет, что формула не ссылается на скрытые поля. |
| | | 9 | | /// </summary> |
| | | 10 | | public static class OrdersGridFormulaFields |
| | | 11 | | { |
| | | 12 | | public static readonly IReadOnlyList<OrdersGridFormulaField> All = |
| | | 13 | | [ |
| | | 14 | | new("shipmentNumber", "shipmentNumber", "Номер заказа", "text", "ShipmentNumber"), |
| | | 15 | | new("ozonClient", "ozonClient", "Клиент", "text", "OzonClient"), |
| | | 16 | | new("deliveryCity", "deliveryCity", "Город доставки", "text", "DeliveryCity"), |
| | | 17 | | new("processingDate", "processingDate", "Дата принятия", "date", "ProcessingDate"), |
| | | 18 | | new("shippingDate", "shippingDate", "Дата отгрузки", "date", "ShippingDate"), |
| | | 19 | | new("deliveryPeriod", "deliveryPeriodText", "Срок доставки (текст)", "text", "DeliveryPeriod"), |
| | | 20 | | new("timeLeftDays", "timeLeftDays", "Осталось дней", "number", "DeliveryPeriod"), |
| | | 21 | | new("deliveryOverdue", "deliveryOverdue", "Просрочена доставка", "bool", "DeliveryPeriod"), |
| | | 22 | | new("lastStatusChangeDate", "lastStatusChangeDate", "Дата изм. статуса", "date", "LastStatusChangeDate"), |
| | | 23 | | new("productKey", "productKey", "Key", "text", "ProductKey"), |
| | | 24 | | new("manufacturer", "manufacturer", "Производитель", "text", "Manufacturer"), |
| | | 25 | | new("article", "article", "Код товара", "text", "Article"), |
| | | 26 | | new("productName", "productName", "Наименование", "text", "ProductName"), |
| | | 27 | | new("category", "category", "Категория", "text", "Category"), |
| | | 28 | | new("volumetricWeight", "volumetricWeight", "Вес объёмный", "number", "VolumeWeight"), |
| | | 29 | | new("weight", "weight", "Вес", "number", "VolumeWeight"), |
| | | 30 | | new("clientStatus", "clientStatus", "Статус клиента", "text", "ClientStatus"), |
| | | 31 | | new("appStatus", "appStatus", "Наш статус", "text", "AppStatus"), |
| | | 32 | | new("supplierStatus", "supplierStatus", "Статус поставщика", "text", "AppStatus"), |
| | | 33 | | new("cartItemStatus", "cartItemStatus", "Статус корзины", "text", "AppStatus"), |
| | | 34 | | new("returnStatus", "returnStatusText", "Возврат", "text", "AppStatus"), |
| | | 35 | | new("shipmentWarehouse", "shipmentWarehouse", "Склад отгрузки", "text", "ShipmentWarehouse"), |
| | | 36 | | new("deliveryProvider", "deliveryProvider", "Доставка", "text", "Delivery"), |
| | | 37 | | new("deliveryName", "deliveryName", "Тип доставки", "text", "DeliveryType"), |
| | | 38 | | new("trackingNumber", "trackingNumber", "Трек-номер", "text", "TrackingNumber"), |
| | | 39 | | new("scanit", "scanit", "ScanIt", "text", "ShipmentNumber"), |
| | | 40 | | new("supplier", "supplier", "Поставщик", "text", "Supplier"), |
| | | 41 | | new("orderNumberToSupplier", "orderNumberToSupplier", "Номер заказа поставщику", "text", "SupplierOrderNumber"), |
| | | 42 | | new("sitePrice", "sitePrice", "Цена сайта", "number", "SitePrice"), |
| | | 43 | | new("quantity", "quantity", "Количество", "number", "Quantity"), |
| | | 44 | | new("price", "price", "Цена продажи", "number", "Price"), |
| | | 45 | | new("currency", "currency", "Валюта", "text", "Price"), |
| | | 46 | | new("shipmentAmount", "shipmentAmount", "Сумма отправления", "number", "ShipmentTotal"), |
| | | 47 | | new("purchasePrice", "purchasePrice", "Цена закупки", "number", "PurchasePrice"), |
| | | 48 | | new("costPrice", "costPrice", "Себестоимость", "number", "Cost"), |
| | | 49 | | new("extraExpenses", "extraExpenses", "Доп. расходы", "number", "Cost"), |
| | | 50 | | new("ozonCommissionMin", "ozonCommissionMin", "Комиссия Ozon min", "number", "OzonCommission"), |
| | | 51 | | new("ozonCommissionMax", "ozonCommissionMax", "Комиссия Ozon max", "number", "OzonCommission"), |
| | | 52 | | new("profitMin", "profitMin", "Прибыль min", "number", "Profit"), |
| | | 53 | | new("profitMax", "profitMax", "Прибыль max", "number", "Profit"), |
| | | 54 | | new("targetProfit135", "targetProfit135", "Прибыль при цели 13,5 %", "number", "Profit"), |
| | | 55 | | new("discountMin", "discountMin", "Наценка % min", "number", "MarkupPercent"), |
| | | 56 | | new("discountMax", "discountMax", "Наценка % max", "number", "MarkupPercent"), |
| | | 57 | | new("hasOzonPromotion", "hasOzonPromotion", "Акция Ozon", "bool", "Price"), |
| | | 58 | | new("isArchived", "isArchived", "В архиве", "bool", null), |
| | | 59 | | new("isCancelled", "isCancelled", "Отменён", "bool", null), |
| | | 60 | | new("isReturned", "isReturned", "Возврат оформлен", "bool", null), |
| | | 61 | | new("fromFile", "fromFile", "Загружен из файла", "bool", null) |
| | | 62 | | ]; |
| | | 63 | | |
| | | 64 | | /// <summary>Поля, которые видит пользователь с данным набором разрешённых колонок (FieldName из OrderListColumnCata |
| | | 65 | | public static IReadOnlyList<OrdersGridFormulaField> ForAllowed(IEnumerable<string> allowedColumns) |
| | | 66 | | { |
| | | 67 | | var allowed = new HashSet<string>(allowedColumns, StringComparer.OrdinalIgnoreCase); |
| | | 68 | | return All.Where(f => f.Gate is null || allowed.Contains(f.Gate)).ToList(); |
| | | 69 | | } |
| | | 70 | | } |