| | | 1 | | using OzonDomains.Models; |
| | | 2 | | using OzonDomains.Models.Partners; |
| | | 3 | | using OzonOrdersWeb.WebServices.Grid; |
| | | 4 | | |
| | | 5 | | namespace OzonOrdersWeb.WebServices.Journals; |
| | | 6 | | |
| | | 7 | | /// <summary> |
| | | 8 | | /// Серверные гриды журналов (сотни тысяч строк): whitelist колонок (colId → выражение EF), поиск и порядок по умолчанию |
| | | 9 | | /// colId совпадают с колонками гридов на страницах журналов. |
| | | 10 | | /// </summary> |
| | | 11 | | public static class JournalGridDefinitions |
| | | 12 | | { |
| | | 13 | | /// <summary>Журнал кабинета партнёров (PartnerAuditLogs): входы, отказы, действия партнёров и настройки владельца.< |
| | 1 | 14 | | public static readonly ServerGridDefinition<PartnerAuditLog> PartnerAudit = |
| | 1 | 15 | | new ServerGridDefinition<PartnerAuditLog> |
| | 1 | 16 | | { |
| | 1 | 17 | | DefaultOrder = q => q.OrderByDescending(x => x.OccurredAtUtc).ThenByDescending(x => x.Id), |
| | 1 | 18 | | TieBreaker = x => x.Id |
| | 1 | 19 | | } |
| | 1 | 20 | | .Col("id", x => x.Id) |
| | 1 | 21 | | .Col("occurredAtUtc", x => x.OccurredAtUtc) |
| | 1 | 22 | | .Col("partnerId", x => x.PartnerId) |
| | 1 | 23 | | .Col("actor", x => x.Actor) |
| | 1 | 24 | | // Подписи те же, что показывает грид: фильтр и счётчики значений работают по тексту, а не по числу enum. |
| | 1 | 25 | | .Col("actorKind", x => x.ActorKind == PartnerActorKind.Owner ? "Владелец" : x.ActorKind == PartnerActorKind. |
| | 1 | 26 | | .Col("action", x => x.Action) |
| | 1 | 27 | | .Col("orderNumber", x => x.OrderNumber) |
| | 1 | 28 | | .Col("success", x => x.Success) |
| | 1 | 29 | | .Col("details", x => x.Details) |
| | 1 | 30 | | .Col("ipAddress", x => x.IpAddress) |
| | 1 | 31 | | .Search(x => x.Actor, x => x.Action, x => x.OrderNumber, x => x.Details, x => x.IpAddress); |
| | | 32 | | |
| | | 33 | | /// <summary>Аудит вызовов API-поставщиков (ApiSupplierRequestAudit). Поиск — без longtext запроса/ответа: они в «От |
| | 1 | 34 | | public static readonly ServerGridDefinition<ApiSupplierRequestAuditEntry> ApiSupplierAudit = |
| | 1 | 35 | | new ServerGridDefinition<ApiSupplierRequestAuditEntry> |
| | 1 | 36 | | { |
| | 0 | 37 | | DefaultOrder = q => q.OrderByDescending(x => x.OccurredAtUtc).ThenByDescending(x => x.Id), |
| | 1 | 38 | | TieBreaker = x => x.Id |
| | 1 | 39 | | } |
| | 1 | 40 | | .Col("id", x => x.Id) |
| | 1 | 41 | | .Col("occurredAtUtc", x => x.OccurredAtUtc) |
| | 1 | 42 | | .Col("providerKey", x => x.ProviderKey) |
| | 1 | 43 | | .Col("isSuccess", x => x.IsSuccess) |
| | 1 | 44 | | .Col("statusCode", x => x.StatusCode) |
| | 1 | 45 | | .Col("method", x => x.Method) |
| | 1 | 46 | | .Col("endpoint", x => x.Endpoint) |
| | 1 | 47 | | .Col("source", x => x.Source) |
| | 1 | 48 | | .Col("actor", x => x.Actor) |
| | 1 | 49 | | .Col("durationMs", x => x.DurationMs) |
| | 1 | 50 | | .Search(x => x.ProviderKey, x => x.Source, x => x.Endpoint, x => x.Actor); |
| | | 51 | | |
| | | 52 | | /// <summary> |
| | | 53 | | /// Остатки 1С из Google Sheet (WarehouseStockSnapshot, /Studio2/WarehouseStock): все числовые колонки листа, |
| | | 54 | | /// поиск по артикулу, производителю и наименованию. Порядок по умолчанию — по артикулу, как на прежней странице. |
| | | 55 | | /// </summary> |
| | 1 | 56 | | public static readonly ServerGridDefinition<WarehouseStockSnapshot> WarehouseStock = |
| | 1 | 57 | | new ServerGridDefinition<WarehouseStockSnapshot> |
| | 1 | 58 | | { |
| | 0 | 59 | | DefaultOrder = q => q.OrderBy(x => x.Article).ThenBy(x => x.Id), |
| | 1 | 60 | | TieBreaker = x => x.Id |
| | 1 | 61 | | } |
| | 1 | 62 | | .Col("id", x => x.Id) |
| | 1 | 63 | | .Col("sourceRowNumber", x => x.SourceRowNumber) |
| | 1 | 64 | | .Col("manufacturer", x => x.Manufacturer) |
| | 1 | 65 | | .Col("article", x => x.Article) |
| | 1 | 66 | | .Col("productName", x => x.ProductName) |
| | 1 | 67 | | .Col("saleFlag", x => x.SaleFlag) |
| | 1 | 68 | | .Col("m2Qty", x => x.M2Qty) |
| | 1 | 69 | | .Col("m1Qty", x => x.M1Qty) |
| | 1 | 70 | | .Col("m3Qty", x => x.M3Qty) |
| | 1 | 71 | | .Col("b1Qty", x => x.B1Qty) |
| | 1 | 72 | | .Col("b2Qty", x => x.B2Qty) |
| | 1 | 73 | | .Col("unitCost", x => x.UnitCost) |
| | 1 | 74 | | .Col("totalCost", x => x.TotalCost) |
| | 1 | 75 | | .Col("salePriceUnit", x => x.SalePriceUnit) |
| | 1 | 76 | | .Col("accountingPriceUnit", x => x.AccountingPriceUnit) |
| | 1 | 77 | | .Col("priceDiffAccountingMinusSale", x => x.PriceDiffAccountingMinusSale) |
| | 1 | 78 | | .Col("c0", x => x.C0) |
| | 1 | 79 | | .Col("stockAmountByC0", x => x.StockAmountByC0) |
| | 1 | 80 | | .Col("existPrice", x => x.ExistPrice) |
| | 1 | 81 | | .Col("c1ExistMinus5Percent", x => x.C1ExistMinus5Percent) |
| | 1 | 82 | | .Col("c1PercentToC0", x => x.C1PercentToC0) |
| | 1 | 83 | | .Col("warehouse", x => x.Warehouse) |
| | 1 | 84 | | .Col("syncedAtUtc", x => x.SyncedAtUtc) |
| | 1 | 85 | | .Search(x => x.Article, x => x.Manufacturer, x => x.ProductName); |
| | | 86 | | |
| | | 87 | | /// <summary>Возвраты Ozon (OrderReturns). Параметр orderId (ссылка из заказа) накладывает контроллер.</summary> |
| | 1 | 88 | | public static readonly ServerGridDefinition<OrderReturn> OrderReturns = |
| | 1 | 89 | | new ServerGridDefinition<OrderReturn> |
| | 1 | 90 | | { |
| | 0 | 91 | | DefaultOrder = q => q.OrderByDescending(r => r.VisualStatusChangeMoment).ThenByDescending(r => r.Id), |
| | 1 | 92 | | TieBreaker = r => r.Id |
| | 1 | 93 | | } |
| | 1 | 94 | | .Col("id", r => r.Id) |
| | 1 | 95 | | .Col("postingNumber", r => r.PostingNumber) |
| | 1 | 96 | | .Col("orderNumber", r => r.OrderNumber) |
| | 1 | 97 | | .Col("clientName", r => r.OzonClient != null ? r.OzonClient.Name : null) |
| | 1 | 98 | | .Col("productName", r => r.ProductName) |
| | 1 | 99 | | .Col("productOfferId", r => r.ProductOfferId) |
| | 1 | 100 | | .Col("productQuantity", r => r.ProductQuantity) |
| | 1 | 101 | | .Col("productPrice", r => r.ProductPrice) |
| | 1 | 102 | | .Col("visualStatus", r => r.VisualStatusSysName) |
| | 1 | 103 | | .Col("returnReasonName", r => r.ReturnReasonName) |
| | 1 | 104 | | .Col("returnType", r => r.ReturnType) |
| | 1 | 105 | | .Col("schema", r => r.Schema) |
| | 1 | 106 | | .Col("placeName", r => r.PlaceName) |
| | 1 | 107 | | .Col("compensationStatus", r => r.CompensationStatusDisplayName) |
| | 1 | 108 | | .Col("orderId", r => r.OrderId) |
| | 1 | 109 | | .Col("visualStatusChangeMoment", r => r.VisualStatusChangeMoment) |
| | 1 | 110 | | .Col("returnDate", r => r.ReturnDate) |
| | 1 | 111 | | .Search(r => r.PostingNumber, r => r.OrderNumber, r => r.ProductName, r => r.ProductOfferId, r => r.ReturnRe |
| | | 112 | | |
| | | 113 | | /// <summary>Архив заказов (OrderArchives + заказ): поля заказа — на момент архивации.</summary> |
| | 1 | 114 | | public static readonly ServerGridDefinition<OrderArchive> OrderArchive = |
| | 1 | 115 | | new ServerGridDefinition<OrderArchive> |
| | 1 | 116 | | { |
| | 0 | 117 | | DefaultOrder = q => q.OrderByDescending(a => a.ArchivedAt).ThenByDescending(a => a.Id), |
| | 1 | 118 | | TieBreaker = a => a.Id |
| | 1 | 119 | | } |
| | 1 | 120 | | .Col("archivedAt", a => a.ArchivedAt) |
| | 1 | 121 | | .Col("archivedBy", a => a.ArchivedBy) |
| | 1 | 122 | | .Col("archiveReason", a => a.ArchiveReason) |
| | 1 | 123 | | .Col("orderId", a => a.OrderId) |
| | 1 | 124 | | .Col("shipmentNumber", a => a.Order.ShipmentNumber) |
| | 1 | 125 | | .Col("processingDate", a => a.Order.ProcessingDate) |
| | 1 | 126 | | .Col("productName", a => a.Order.ProductName) |
| | 1 | 127 | | .Col("article", a => a.Order.Article) |
| | 1 | 128 | | .Col("quantity", a => a.Order.Quantity) |
| | 1 | 129 | | .Col("purchasePrice", a => a.Order.PurchasePrice) |
| | 1 | 130 | | .Col("appStatus", a => a.Order.AppStatus != null ? a.Order.AppStatus.Name : null) |
| | 1 | 131 | | .Col("clientStatus", a => a.Order.ClientStatus != null ? a.Order.ClientStatus.Name : null) |
| | 1 | 132 | | .Col("clientName", a => a.Order.OzonClient != null ? a.Order.OzonClient.Name : null) |
| | 1 | 133 | | .Search(a => a.Order.ShipmentNumber, a => a.Order.ProductName, a => a.Order.Article, a => a.ArchivedBy, a => |
| | | 134 | | |
| | | 135 | | /// <summary> |
| | | 136 | | /// Результаты обработки вложений почты (EmailRoutingResults). Дата — письма, а если IMAP её не отдал — обработки. |
| | | 137 | | /// </summary> |
| | 1 | 138 | | public static readonly ServerGridDefinition<EmailAttachmentProcessingResult> EmailResults = |
| | 1 | 139 | | new ServerGridDefinition<EmailAttachmentProcessingResult> |
| | 1 | 140 | | { |
| | 0 | 141 | | DefaultOrder = q => q.OrderByDescending(r => r.CreatedAt).ThenByDescending(r => r.Id), |
| | 1 | 142 | | TieBreaker = r => r.Id |
| | 1 | 143 | | } |
| | 1 | 144 | | .Col("id", r => r.Id) |
| | 1 | 145 | | .Col("date", r => r.EmailMessage != null && r.EmailMessage.ReceivedAtUtc != null ? r.EmailMessage.ReceivedAt |
| | 1 | 146 | | .Col("createdAt", r => r.CreatedAt) |
| | 1 | 147 | | .Col("status", r => r.Status) |
| | 1 | 148 | | .Col("ruleName", r => r.Rule != null ? r.Rule.Name : null) |
| | 1 | 149 | | .Col("sender", r => r.EmailMessage != null ? r.EmailMessage.SenderEmail : null) |
| | 1 | 150 | | .Col("subject", r => r.EmailMessage != null ? r.EmailMessage.Subject : null) |
| | 1 | 151 | | .Col("fileName", r => r.Attachment != null ? r.Attachment.FileName : r.DropboxFileName) |
| | 1 | 152 | | .Col("dropboxFolderPath", r => r.DropboxFolderPath) |
| | 1 | 153 | | .Col("reason", r => r.Error ?? r.Reason) |
| | 1 | 154 | | .Search(r => r.Attachment != null ? r.Attachment.FileName : r.DropboxFileName, |
| | 1 | 155 | | r => r.EmailMessage != null ? r.EmailMessage.SenderEmail : null, |
| | 1 | 156 | | r => r.EmailMessage != null ? r.EmailMessage.Subject : null, |
| | 1 | 157 | | r => r.Error, r => r.Reason, r => r.DropboxFolderPath); |
| | | 158 | | } |