| | | 1 | | using Newtonsoft.Json; |
| | | 2 | | |
| | | 3 | | namespace Services.ApiServices._1CApi.OData.Models; |
| | | 4 | | |
| | | 5 | | public class ODataReceiptListItem |
| | | 6 | | { |
| | | 7 | | [JsonProperty("Ref_Key")] public Guid RefKey { get; set; } |
| | | 8 | | [JsonProperty("Number")] public string? Number { get; set; } = string.Empty; |
| | | 9 | | [JsonProperty("Date")] public string? Date { get; set; } = string.Empty; |
| | | 10 | | [JsonProperty("Posted")] public bool Posted { get; set; } |
| | | 11 | | [JsonProperty("DeletionMark")] public bool DeletionMark { get; set; } |
| | | 12 | | [JsonProperty("Контрагент_Key")] public Guid CounterpartyKey { get; set; } |
| | | 13 | | [JsonProperty("НомерВходящегоДокумента")] public string? IncomingDocNumber { get; set; } = string.Empty; |
| | | 14 | | [JsonProperty("ДатаВходящегоДокумента")] public string? IncomingDocDate { get; set; } = string.Empty; |
| | | 15 | | [JsonProperty("Организация_Key")] public Guid OrganizationKey { get; set; } |
| | | 16 | | [JsonProperty("СтруктурнаяЕдиница_Key")] public Guid WarehouseKey { get; set; } |
| | | 17 | | } |
| | | 18 | | |
| | | 19 | | public class ODataTransferListItem |
| | | 20 | | { |
| | | 21 | | [JsonProperty("Ref_Key")] public Guid RefKey { get; set; } |
| | | 22 | | [JsonProperty("Number")] public string? Number { get; set; } = string.Empty; |
| | | 23 | | [JsonProperty("Date")] public string? Date { get; set; } = string.Empty; |
| | | 24 | | [JsonProperty("Posted")] public bool Posted { get; set; } |
| | | 25 | | [JsonProperty("DeletionMark")] public bool DeletionMark { get; set; } |
| | | 26 | | [JsonProperty("СтруктурнаяЕдиница_Key")] public Guid WarehouseSenderKey { get; set; } |
| | | 27 | | [JsonProperty("СтруктурнаяЕдиницаПолучатель_Key")] public Guid WarehouseRecipientKey { get; set; } |
| | | 28 | | [JsonProperty("Комментарий")] public string? Comment { get; set; } |
| | | 29 | | [JsonProperty("Автор_Key")] public Guid AuthorKey { get; set; } |
| | | 30 | | [JsonProperty("Организация_Key")] public Guid OrganizationKey { get; set; } |
| | | 31 | | } |
| | | 32 | | |
| | | 33 | | public class ODataPaymentListItem |
| | | 34 | | { |
| | | 35 | | [JsonProperty("Ref_Key")] public Guid RefKey { get; set; } |
| | | 36 | | [JsonProperty("Number")] public string? Number { get; set; } = string.Empty; |
| | | 37 | | [JsonProperty("Date")] public string? Date { get; set; } = string.Empty; |
| | | 38 | | [JsonProperty("Posted")] public bool Posted { get; set; } |
| | | 39 | | [JsonProperty("DeletionMark")] public bool DeletionMark { get; set; } |
| | | 40 | | [JsonProperty("Контрагент_Key")] public Guid CounterpartyKey { get; set; } |
| | | 41 | | [JsonProperty("СуммаДокумента")] public decimal Amount { get; set; } |
| | | 42 | | [JsonProperty("НазначениеПлатежа")] public string? Purpose { get; set; } |
| | | 43 | | [JsonProperty("ВидОперации")] public string? OperationType { get; set; } |
| | | 44 | | } |
| | | 45 | | |
| | | 46 | | public class ODataCounterpartyFull |
| | | 47 | | { |
| | | 48 | | [JsonProperty("Ref_Key")] public Guid RefKey { get; set; } |
| | | 49 | | [JsonProperty("Description")] public string? Description { get; set; } = string.Empty; |
| | | 50 | | [JsonProperty("ИНН")] public string? Inn { get; set; } = string.Empty; |
| | | 51 | | [JsonProperty("КПП")] public string? Kpp { get; set; } = string.Empty; |
| | | 52 | | [JsonProperty("DeletionMark")] public bool DeletionMark { get; set; } |
| | | 53 | | [JsonProperty("IsFolder")] public bool IsFolder { get; set; } |
| | | 54 | | } |
| | | 55 | | |
| | | 56 | | public class ODataNomenclatureFull |
| | | 57 | | { |
| | | 58 | | [JsonProperty("Ref_Key")] public Guid RefKey { get; set; } |
| | | 59 | | [JsonProperty("Description")] public string? Description { get; set; } = string.Empty; |
| | | 60 | | [JsonProperty("Артикул")] public string? Article { get; set; } = string.Empty; |
| | | 61 | | [JsonProperty("IsFolder")] public bool IsFolder { get; set; } |
| | | 62 | | [JsonProperty("DeletionMark")] public bool DeletionMark { get; set; } |
| | | 63 | | } |
| | | 64 | | |
| | | 65 | | public class ODataWarehouseFull |
| | | 66 | | { |
| | | 67 | | [JsonProperty("Ref_Key")] public Guid RefKey { get; set; } |
| | | 68 | | [JsonProperty("Description")] public string? Description { get; set; } = string.Empty; |
| | | 69 | | [JsonProperty("DeletionMark")] public bool DeletionMark { get; set; } |
| | | 70 | | } |
| | | 71 | | |
| | | 72 | | public class ODataOrganizationFull |
| | | 73 | | { |
| | | 74 | | [JsonProperty("Ref_Key")] public Guid RefKey { get; set; } |
| | | 75 | | [JsonProperty("Description")] public string? Description { get; set; } = string.Empty; |
| | | 76 | | [JsonProperty("ИНН")] public string? Inn { get; set; } = string.Empty; |
| | | 77 | | [JsonProperty("КПП")] public string? Kpp { get; set; } = string.Empty; |
| | | 78 | | [JsonProperty("DeletionMark")] public bool DeletionMark { get; set; } |
| | | 79 | | } |
| | | 80 | | |
| | | 81 | | public class ODataContractFull |
| | | 82 | | { |
| | 0 | 83 | | [JsonProperty("Ref_Key")] public Guid RefKey { get; set; } |
| | 0 | 84 | | [JsonProperty("Description")] public string? Description { get; set; } = string.Empty; |
| | 0 | 85 | | [JsonProperty("Owner")] public Guid Owner { get; set; } |
| | 0 | 86 | | [JsonProperty("DeletionMark")] public bool DeletionMark { get; set; } |
| | | 87 | | } |
| | | 88 | | |
| | | 89 | | public class ODataStockRecord |
| | | 90 | | { |
| | | 91 | | [JsonProperty("Recorder")] public Guid Recorder { get; set; } |
| | | 92 | | [JsonProperty("Recorder_Type")] public string? RecorderType { get; set; } = string.Empty; |
| | | 93 | | [JsonProperty("RecordSet")] public List<ODataStockMovement>? RecordSet { get; set; } = new(); |
| | | 94 | | } |
| | | 95 | | |
| | | 96 | | public class ODataStockMovement |
| | | 97 | | { |
| | | 98 | | [JsonProperty("Period")] public string? Period { get; set; } = string.Empty; |
| | | 99 | | [JsonProperty("RecordType")] public string? RecordType { get; set; } = string.Empty; |
| | | 100 | | [JsonProperty("Номенклатура_Key")] public Guid NomenclatureKey { get; set; } |
| | | 101 | | [JsonProperty("СтруктурнаяЕдиница_Key")] public Guid WarehouseKey { get; set; } |
| | | 102 | | [JsonProperty("Количество")] public decimal Quantity { get; set; } |
| | | 103 | | [JsonProperty("Организация_Key")] public Guid OrganizationKey { get; set; } |
| | | 104 | | } |
| | | 105 | | |
| | | 106 | | public class ODataStockBalance |
| | | 107 | | { |
| | | 108 | | [JsonProperty("Номенклатура_Key")] public Guid NomenclatureKey { get; set; } |
| | | 109 | | [JsonProperty("СтруктурнаяЕдиница_Key")] public Guid WarehouseKey { get; set; } |
| | | 110 | | [JsonProperty("КоличествоBalance")] public decimal QuantityBalance { get; set; } |
| | | 111 | | |
| | | 112 | | /// <summary>Ресурс «Стоимость» — есть не во всех конфигурациях, поэтому nullable.</summary> |
| | | 113 | | [JsonProperty("СтоимостьBalance")] public decimal? CostBalance { get; set; } |
| | | 114 | | } |
| | | 115 | | |
| | | 116 | | /// <summary> |
| | | 117 | | /// Строка виртуальной таблицы «Обороты» регистра запасов за период. Приход за окно — единственный |
| | | 118 | | /// способ узнать «двигался ли товар», т.к. параметр Periodicity в 1С Fresh не поддерживается |
| | | 119 | | /// и разложить обороты по датам средствами OData нельзя. |
| | | 120 | | /// </summary> |
| | | 121 | | public class ODataStockTurnover |
| | | 122 | | { |
| | | 123 | | [JsonProperty("Номенклатура_Key")] public Guid NomenclatureKey { get; set; } |
| | | 124 | | [JsonProperty("СтруктурнаяЕдиница_Key")] public Guid WarehouseKey { get; set; } |
| | | 125 | | [JsonProperty("КоличествоReceipt")] public decimal QuantityReceipt { get; set; } |
| | | 126 | | [JsonProperty("КоличествоExpense")] public decimal QuantityExpense { get; set; } |
| | | 127 | | } |
| | | 128 | | |
| | | 129 | | /// <summary> |
| | | 130 | | /// Строка табличной части «Запасы» вместе с номенклатурой. Отличается от <see cref="ODataMovementTabRow"/> |
| | | 131 | | /// тем, что позволяет разложить один ответ на несколько номенклатур: при выборке сразу по 20 позициям |
| | | 132 | | /// без этого поля непонятно, какая строка какой относится. |
| | | 133 | | /// </summary> |
| | | 134 | | /// <summary> |
| | | 135 | | /// Строка табличной части «Запасы», прочитанная вложенным полем заголовка |
| | | 136 | | /// (<c>$select=…,Запасы/Номенклатура_Key</c>). Отдельный эндпоинт <c>Document_*_Запасы</c> |
| | | 137 | | /// 1С Fresh по <c>$filter</c> больше не отдаёт (HTTP 500), поэтому строки приходят вместе с документом. |
| | | 138 | | /// </summary> |
| | | 139 | | public class ODataDocNomenclatureLine |
| | | 140 | | { |
| | | 141 | | [JsonProperty("Номенклатура_Key")] public Guid NomenclatureKey { get; set; } |
| | | 142 | | } |
| | | 143 | | |
| | | 144 | | public class ODataMovementTabRow |
| | | 145 | | { |
| | | 146 | | [JsonProperty("Ref_Key")] public Guid RefKey { get; set; } |
| | | 147 | | [JsonProperty("Количество")] public decimal Quantity { get; set; } |
| | | 148 | | [JsonProperty("Цена")] public decimal Price { get; set; } |
| | | 149 | | } |
| | | 150 | | |
| | | 151 | | /// <summary> |
| | | 152 | | /// Строка табличной части документа «Резервирование запасов». В 1С Fresh |
| | | 153 | | /// фильтрация этой табличной части по номенклатуре недоступна, поэтому карта |
| | | 154 | | /// движений отбирает нужную строку после загрузки небольшого справочника резервов. |
| | | 155 | | /// </summary> |
| | | 156 | | public class ODataReserveTabRow |
| | | 157 | | { |
| | | 158 | | [JsonProperty("Ref_Key")] public Guid RefKey { get; set; } |
| | | 159 | | [JsonProperty("LineNumber")] public int LineNumber { get; set; } |
| | | 160 | | [JsonProperty("Номенклатура_Key")] public Guid NomenclatureKey { get; set; } |
| | | 161 | | [JsonProperty("Количество")] public decimal Quantity { get; set; } |
| | | 162 | | [JsonProperty("ИсходноеМестоРезерва")] public Guid? SourceReservePlaceKey { get; set; } |
| | | 163 | | [JsonProperty("ИсходноеМестоРезерва_Type")] public string? SourceReservePlaceType { get; set; } |
| | | 164 | | [JsonProperty("НовоеМестоРезерва")] public Guid? TargetReservePlaceKey { get; set; } |
| | | 165 | | [JsonProperty("НовоеМестоРезерва_Type")] public string? TargetReservePlaceType { get; set; } |
| | | 166 | | } |
| | | 167 | | |
| | | 168 | | public class ODataDocHeader |
| | | 169 | | { |
| | | 170 | | [JsonProperty("Ref_Key")] public Guid RefKey { get; set; } |
| | | 171 | | [JsonProperty("Number")] public string? Number { get; set; } = string.Empty; |
| | | 172 | | [JsonProperty("Date")] public string? Date { get; set; } = string.Empty; |
| | | 173 | | [JsonProperty("DeletionMark")] public bool DeletionMark { get; set; } |
| | | 174 | | [JsonProperty("Posted")] public bool Posted { get; set; } |
| | | 175 | | [JsonProperty("СтруктурнаяЕдиница_Key")] public Guid WarehouseKey { get; set; } |
| | | 176 | | } |
| | | 177 | | |
| | | 178 | | /// <summary>Заголовок приходной накладной с поставщиком для фильтра остатков склада.</summary> |
| | | 179 | | public class ODataReceiptDocHeader : ODataDocHeader |
| | | 180 | | { |
| | | 181 | | [JsonProperty("Контрагент_Key")] public Guid CounterpartyKey { get; set; } |
| | | 182 | | [JsonProperty("Запасы")] public List<ODataDocNomenclatureLine> Lines { get; set; } = []; |
| | | 183 | | } |
| | | 184 | | |
| | | 185 | | public class ODataInventoryDocumentTemplate |
| | | 186 | | { |
| | | 187 | | [JsonProperty("ХозяйственнаяОперация_Key")] public Guid OperationKey { get; set; } |
| | | 188 | | } |
| | | 189 | | |
| | | 190 | | public class ODataInventoryAdjustmentRequest |
| | | 191 | | { |
| | | 192 | | [JsonProperty("Date")] public string Date { get; set; } = string.Empty; |
| | | 193 | | [JsonProperty("Организация_Key")] public Guid OrganizationKey { get; set; } |
| | | 194 | | [JsonProperty("СтруктурнаяЕдиница_Key")] public Guid WarehouseKey { get; set; } |
| | | 195 | | [JsonProperty("ХозяйственнаяОперация_Key")] public Guid OperationKey { get; set; } |
| | | 196 | | [JsonProperty("Комментарий")] public string Comment { get; set; } = string.Empty; |
| | | 197 | | [JsonProperty("Запасы")] public List<ODataInventoryAdjustmentLine> Lines { get; set; } = []; |
| | | 198 | | } |
| | | 199 | | |
| | | 200 | | public class ODataInventoryAdjustmentLine |
| | | 201 | | { |
| | | 202 | | [JsonProperty("LineNumber")] public int LineNumber { get; set; } = 1; |
| | | 203 | | [JsonProperty("Номенклатура_Key")] public Guid NomenclatureKey { get; set; } |
| | | 204 | | [JsonProperty("Характеристика_Key")] public string CharacteristicKey { get; set; } = OneCODataConstants.ZeroGuid; |
| | | 205 | | [JsonProperty("Партия_Key")] public string BatchKey { get; set; } = OneCODataConstants.ZeroGuid; |
| | | 206 | | [JsonProperty("ЕдиницаИзмерения")] public string UnitKey { get; set; } = OneCODataConstants.UnitShtukaGuid; |
| | | 207 | | [JsonProperty("ЕдиницаИзмерения_Type")] public string UnitType { get; set; } = OneCODataConstants.UnitType; |
| | | 208 | | [JsonProperty("Количество")] public decimal ActualQuantity { get; set; } |
| | | 209 | | [JsonProperty("КоличествоУчет")] public decimal BookQuantity { get; set; } |
| | | 210 | | [JsonProperty("Отклонение")] public decimal Difference { get; set; } |
| | | 211 | | [JsonProperty("Излишки")] public decimal Surplus { get; set; } |
| | | 212 | | [JsonProperty("Недостача")] public decimal Shortage { get; set; } |
| | | 213 | | [JsonProperty("Цена")] public decimal Price { get; set; } |
| | | 214 | | [JsonProperty("Сумма")] public decimal Amount { get; set; } |
| | | 215 | | [JsonProperty("СуммаУчет")] public decimal BookAmount { get; set; } |
| | | 216 | | [JsonProperty("Ячейка_Key")] public string CellKey { get; set; } = OneCODataConstants.ZeroGuid; |
| | | 217 | | } |
| | | 218 | | |
| | | 219 | | public class ODataTransferDocHeader : ODataDocHeader |
| | | 220 | | { |
| | | 221 | | [JsonProperty("СтруктурнаяЕдиницаПолучатель_Key")] public Guid WarehouseRecipientKey { get; set; } |
| | | 222 | | [JsonProperty("Комментарий")] public string? Comment { get; set; } |
| | | 223 | | [JsonProperty("Запасы")] public List<ODataDocNomenclatureLine> Lines { get; set; } = []; |
| | | 224 | | } |
| | | 225 | | |
| | | 226 | | public class ODataExpenseDocHeader : ODataDocHeader |
| | | 227 | | { |
| | | 228 | | [JsonProperty("Контрагент_Key")] public Guid CounterpartyKey { get; set; } |
| | | 229 | | } |