< Summary

Information
Class: Services.OzonHandoverServices.OzonHandoverItemDto
Assembly: Services
File(s): /home/runner/work/Studio2Prod/Studio2Prod/AppRepository/OzonHandoverServices/OzonHandoverImportModels.cs
Line coverage
100%
Covered lines: 34
Uncovered lines: 0
Coverable lines: 34
Total lines: 321
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_RowNo()100%11100%
get_ItemNo()100%11100%
get_ProductName()100%11100%
get_Barcode()100%11100%
get_Value()100%11100%
get_ValueApi()100%11100%
get_WeightG()100%11100%
get_Status()100%11100%
get_Defect()100%11100%
get_Missort()100%11100%
get_Comment()100%11100%
get_MarkedAt()100%11100%
get_Sku()100%11100%
get_OfferId()100%11100%
get_Account()100%11100%
get_ReturnId()100%11100%
get_OzonStatus()100%11100%
get_OzonStatusName()100%11100%
get_ReturnType()100%11100%
get_BoxBarcode()100%11100%
get_Reason()100%11100%
get_ReasonIsDefect()100%11100%
get_ClientComment()100%11100%
get_ClientPhotos()100%11100%
get_ClientPhotosExpiresAt()100%11100%
get_PhotosCount()100%11100%
get_PhotosError()100%11100%
get_RejectionComment()100%11100%
get_RejectionReason()100%11100%
get_RuPostTracking()100%11100%
get_ReturnNumber()100%11100%
get_OrderNumber()100%11100%
get_ClientReturnMethod()100%11100%
get_WarehouseId()100%11100%

File(s)

/home/runner/work/Studio2Prod/Studio2Prod/AppRepository/OzonHandoverServices/OzonHandoverImportModels.cs

#LineLine coverage
 1using System.ComponentModel.DataAnnotations;
 2using System.Text.Json.Serialization;
 3
 4namespace Services.OzonHandoverServices;
 5
 6/// <summary>
 7/// Контракт JSON-документа выдачи/приёма-передачи Ozon, экспортируемого приложением "Telegram Lite".
 8/// Имена свойств — snake_case, как в исходном файле (document_type, closed, groups[].acts[].items[] и т.д.).
 9/// </summary>
 10public sealed class OzonHandoverImportRequest
 11{
 12    [JsonPropertyName("document_type")]
 13    [Required, StringLength(50)]
 14    public string DocumentType { get; set; } = string.Empty;
 15
 16    [JsonPropertyName("generated_at")]
 17    public DateTime GeneratedAt { get; set; }
 18
 19    [JsonPropertyName("return_type")]
 20    [StringLength(20)]
 21    public string? ReturnType { get; set; }
 22
 23    [JsonPropertyName("closed")]
 24    [Required]
 25    public OzonHandoverClosedDto Closed { get; set; } = new();
 26
 27    [JsonPropertyName("summary")]
 28    public OzonHandoverSummaryDto? Summary { get; set; }
 29
 30    [JsonPropertyName("groups")]
 31    [Required, MinLength(1)]
 32    public List<OzonHandoverGroupDto> Groups { get; set; } = new();
 33}
 34
 35public sealed class OzonHandoverClosedDto
 36{
 37    [JsonPropertyName("kind")]
 38    [StringLength(50)]
 39    public string? Kind { get; set; }
 40
 41    /// <summary>Уникальный идентификатор батча источника — ключ идемпотентности импорта.</summary>
 42    [JsonPropertyName("id")]
 43    [Required, StringLength(300)]
 44    public string Id { get; set; } = string.Empty;
 45
 46    [JsonPropertyName("return_type")]
 47    [StringLength(20)]
 48    public string? ReturnType { get; set; }
 49}
 50
 51public sealed class OzonHandoverSummaryDto
 52{
 53    [JsonPropertyName("acts_count")]
 54    public int ActsCount { get; set; }
 55
 56    [JsonPropertyName("items_count")]
 57    public int ItemsCount { get; set; }
 58
 59    [JsonPropertyName("total_value")]
 60    public decimal TotalValue { get; set; }
 61
 62    [JsonPropertyName("accepted")]
 63    public OzonHandoverSummaryBucketDto? Accepted { get; set; }
 64
 65    [JsonPropertyName("rejected")]
 66    public OzonHandoverSummaryBucketDto? Rejected { get; set; }
 67
 68    [JsonPropertyName("pending")]
 69    public OzonHandoverSummaryBucketDto? Pending { get; set; }
 70
 71    [JsonPropertyName("defect_count")]
 72    public int DefectCount { get; set; }
 73
 74    [JsonPropertyName("missort_count")]
 75    public int MissortCount { get; set; }
 76}
 77
 78public sealed class OzonHandoverSummaryBucketDto
 79{
 80    [JsonPropertyName("items_count")]
 81    public int ItemsCount { get; set; }
 82
 83    [JsonPropertyName("total_value")]
 84    public decimal TotalValue { get; set; }
 85}
 86
 87public sealed class OzonHandoverGroupDto
 88{
 89    [JsonPropertyName("group_key")]
 90    [StringLength(50)]
 91    public string? GroupKey { get; set; }
 92
 93    [JsonPropertyName("group_name")]
 94    [StringLength(100)]
 95    public string? GroupName { get; set; }
 96
 97    [JsonPropertyName("return_type")]
 98    [StringLength(20)]
 99    public string? ReturnType { get; set; }
 100
 101    [JsonPropertyName("acts_count")]
 102    public int ActsCount { get; set; }
 103
 104    [JsonPropertyName("items_count")]
 105    public int ItemsCount { get; set; }
 106
 107    [JsonPropertyName("total_value")]
 108    public decimal TotalValue { get; set; }
 109
 110    [JsonPropertyName("acts")]
 111    [Required]
 112    public List<OzonHandoverActDto> Acts { get; set; } = new();
 113}
 114
 115public sealed class OzonHandoverActDto
 116{
 117    [JsonPropertyName("act_no")]
 118    [StringLength(100)]
 119    public string? ActNo { get; set; }
 120
 121    [JsonPropertyName("act_date")]
 122    public DateTime ActDate { get; set; }
 123
 124    [JsonPropertyName("act_type")]
 125    [StringLength(100)]
 126    public string? ActType { get; set; }
 127
 128    [JsonPropertyName("pvz")]
 129    [StringLength(100)]
 130    public string? Pvz { get; set; }
 131
 132    [JsonPropertyName("account")]
 133    [StringLength(50)]
 134    public string? Account { get; set; }
 135
 136    [JsonPropertyName("source")]
 137    [StringLength(500)]
 138    public string? Source { get; set; }
 139
 140    [JsonPropertyName("box_barcode")]
 141    [StringLength(100)]
 142    public string? BoxBarcode { get; set; }
 143
 144    [JsonPropertyName("return_id")]
 145    public long? ReturnId { get; set; }
 146
 147    [JsonPropertyName("return_type")]
 148    [StringLength(20)]
 149    public string? ReturnType { get; set; }
 150
 151    /// <summary>Статус акта из источника. Игнорируется при импорте — пересчитывается из позиций.</summary>
 152    [JsonPropertyName("status")]
 153    public string? Status { get; set; }
 154
 155    [JsonPropertyName("items")]
 156    [Required]
 157    public List<OzonHandoverItemDto> Items { get; set; } = new();
 158}
 159
 160public sealed class OzonHandoverItemDto
 161{
 162    [JsonPropertyName("row_no")]
 14163    public int RowNo { get; set; }
 164
 165    [JsonPropertyName("item_no")]
 166    [Required, StringLength(50)]
 51167    public string ItemNo { get; set; } = string.Empty;
 168
 169    [JsonPropertyName("product_name")]
 170    [StringLength(500)]
 14171    public string? ProductName { get; set; }
 172
 173    [JsonPropertyName("barcode")]
 174    [StringLength(100)]
 14175    public string? Barcode { get; set; }
 176
 177    [JsonPropertyName("value")]
 14178    public decimal Value { get; set; }
 179
 180    [JsonPropertyName("value_api")]
 14181    public decimal? ValueApi { get; set; }
 182
 183    [JsonPropertyName("weight_g")]
 14184    public int? WeightG { get; set; }
 185
 186    /// <summary>accepted / rejected / pending.</summary>
 187    [JsonPropertyName("status")]
 188    [Required, StringLength(30)]
 26189    public string Status { get; set; } = string.Empty;
 190
 191    [JsonPropertyName("defect")]
 14192    public bool Defect { get; set; }
 193
 194    [JsonPropertyName("missort")]
 14195    public bool Missort { get; set; }
 196
 197    [JsonPropertyName("comment")]
 198    [StringLength(1000)]
 14199    public string? Comment { get; set; }
 200
 201    [JsonPropertyName("marked_at")]
 14202    public DateTime? MarkedAt { get; set; }
 203
 204    [JsonPropertyName("sku")]
 14205    public long? Sku { get; set; }
 206
 207    [JsonPropertyName("offer_id")]
 208    [StringLength(100)]
 14209    public string? OfferId { get; set; }
 210
 211    [JsonPropertyName("account")]
 212    [StringLength(50)]
 14213    public string? Account { get; set; }
 214
 215    [JsonPropertyName("return_id")]
 23216    public long? ReturnId { get; set; }
 217
 218    [JsonPropertyName("ozon_status")]
 219    [StringLength(50)]
 14220    public string? OzonStatus { get; set; }
 221
 222    [JsonPropertyName("ozon_status_name")]
 223    [StringLength(200)]
 17224    public string? OzonStatusName { get; set; }
 225
 226    [JsonPropertyName("return_type")]
 227    [StringLength(20)]
 19228    public string? ReturnType { get; set; }
 229
 230    [JsonPropertyName("box_barcode")]
 231    [StringLength(100)]
 15232    public string? BoxBarcode { get; set; }
 233
 234    [JsonPropertyName("reason")]
 235    [StringLength(1000)]
 15236    public string? Reason { get; set; }
 237
 238    [JsonPropertyName("reason_is_defect")]
 16239    public bool ReasonIsDefect { get; set; }
 240
 241    [JsonPropertyName("client_comment")]
 16242    public string? ClientComment { get; set; }
 243
 244    [JsonPropertyName("client_photos")]
 40245    public List<string> ClientPhotos { get; set; } = new();
 246
 247    [JsonPropertyName("client_photos_expires_at")]
 14248    public DateTime? ClientPhotosExpiresAt { get; set; }
 249
 250    [JsonPropertyName("photos_count")]
 16251    public int PhotosCount { get; set; }
 252
 253    [JsonPropertyName("photos_error")]
 14254    public string? PhotosError { get; set; }
 255
 256    [JsonPropertyName("rejection_comment")]
 14257    public string? RejectionComment { get; set; }
 258
 259    [JsonPropertyName("rejection_reason")]
 260    [StringLength(1000)]
 14261    public string? RejectionReason { get; set; }
 262
 263    [JsonPropertyName("ru_post_tracking")]
 264    [StringLength(100)]
 15265    public string? RuPostTracking { get; set; }
 266
 267    [JsonPropertyName("return_number")]
 268    [StringLength(100)]
 14269    public string? ReturnNumber { get; set; }
 270
 271    [JsonPropertyName("order_number")]
 272    [StringLength(100)]
 14273    public string? OrderNumber { get; set; }
 274
 275    [JsonPropertyName("client_return_method")]
 276    [StringLength(100)]
 14277    public string? ClientReturnMethod { get; set; }
 278
 279    [JsonPropertyName("warehouse_id")]
 16280    public long? WarehouseId { get; set; }
 281}
 282
 283/// <summary>Результат импорта, возвращаемый клиенту.</summary>
 284public sealed class OzonHandoverImportResult
 285{
 286    public int BatchId { get; set; }
 287    public bool WasUpdated { get; set; }
 288    public int ActsCount { get; set; }
 289    public int ItemsCount { get; set; }
 290    public int MatchedItemsCount { get; set; }
 291    public int UnmatchedItemsCount { get; set; }
 292    public List<string> UnmatchedItemNumbers { get; set; } = new();
 293
 294    /// <summary>Позиции, сопоставленные с заказами — номер заказа (ShipmentNumber) по каждой позиции.</summary>
 295    public List<OzonHandoverMatchedOrderDto> MatchedOrders { get; set; } = new();
 296
 297    public int SavedPhotosCount { get; set; }
 298    public int FailedPhotosCount { get; set; }
 299    public List<string> Warnings { get; set; } = new();
 300}
 301
 302/// <summary>Одна позиция акта, сопоставленная с заказом в системе.</summary>
 303public sealed class OzonHandoverMatchedOrderDto
 304{
 305    public string ItemNo { get; set; } = string.Empty;
 306    public int OrderId { get; set; }
 307
 308    /// <summary>Номер отправления заказа (Order.ShipmentNumber).</summary>
 309    public string? OrderNumber { get; set; }
 310
 311    public string? Article { get; set; }
 312    public string? ClientName { get; set; }
 313
 314    /// <summary>Статус клиента (Ozon) — имя и его системный цвет (StatusColor.ColorCode).</summary>
 315    public string? ClientStatus { get; set; }
 316    public string? ClientStatusColor { get; set; }
 317
 318    /// <summary>Статус в отчёте (внутренний, AppStatus) — имя и его системный цвет.</summary>
 319    public string? AppStatus { get; set; }
 320    public string? AppStatusColor { get; set; }
 321}