| | | 1 | | using Microsoft.AspNetCore.Mvc; |
| | | 2 | | using OzonDomains; |
| | | 3 | | using OzonDomains.Models; |
| | | 4 | | using OzonOrdersWeb.Areas.Studio2.Controllers.Base; |
| | | 5 | | using OzonRepositories.Context; |
| | | 6 | | using Services.ApiServices.OzonApi; |
| | | 7 | | using Services.CacheServices.Cache.OzonOrdersCache; |
| | | 8 | | using Services.CacheServices.Cache.UserCacheService; |
| | | 9 | | using Services.DataServices; |
| | | 10 | | using OzonOrdersWeb.WebServices.Currency; |
| | | 11 | | using Services.TransactionUtilsServices; |
| | | 12 | | using Services.CacheServices.Cache; |
| | | 13 | | |
| | | 14 | | namespace OzonOrdersWeb.Areas.Studio2.Controllers.Transactions; |
| | | 15 | | |
| | | 16 | | /// <summary> |
| | | 17 | | /// Контроллер транзакции "К отмене" |
| | | 18 | | /// </summary> |
| | | 19 | | public class ToCancellationTransactionController : BaseTransactionController |
| | | 20 | | { |
| | | 21 | | public ToCancellationTransactionController( |
| | | 22 | | ApplicationDbContext context, |
| | | 23 | | AppStatusDataServices appStatusServices, |
| | | 24 | | OrdersDataServices orderServices, |
| | | 25 | | TransactionManager transactionManager, |
| | | 26 | | TransactionCache transactionCache, |
| | | 27 | | SupplierDataServices supplierDataServices, |
| | | 28 | | IUserCacheService userCacheService, |
| | | 29 | | ICurrencyRatesViewBagService currencyRatesViewBagService, |
| | | 30 | | CacheUpdater<Order> cacheUpdater, |
| | | 31 | | OrderCache orderCache, |
| | | 32 | | WarehouseDataServices warehouseDataServices, |
| | | 33 | | ExpenseTypeDataServices expenseTypeDataServices, |
| | | 34 | | OrderExtraExpenseDataServices orderExtraExpenseDataServices, |
| | | 35 | | StatusTransitionDataServices statusTransitionDataServices, |
| | | 36 | | OzonOrderCancellationService? ozonCancellationService = null) |
| | 0 | 37 | | : base(context, appStatusServices, orderServices, transactionManager, transactionCache, |
| | 0 | 38 | | supplierDataServices, userCacheService, currencyRatesViewBagService, cacheUpdater, orderCache, |
| | 0 | 39 | | warehouseDataServices: warehouseDataServices, expenseTypeDataServices: expenseTypeDataServices, |
| | 0 | 40 | | orderExtraExpenseDataServices: orderExtraExpenseDataServices, |
| | 0 | 41 | | statusTransitionDataServices: statusTransitionDataServices, |
| | 0 | 42 | | ozonCancellationService: ozonCancellationService) |
| | | 43 | | { |
| | 0 | 44 | | } |
| | | 45 | | |
| | 0 | 46 | | protected override TransactionConfig GetTransactionConfig() => new() |
| | 0 | 47 | | { |
| | 0 | 48 | | TransactionType = TransactionType.ToCancellation, |
| | 0 | 49 | | PrimaryStatusName = "К отмене", |
| | 0 | 50 | | AdditionalStatusNames = new List<string> { "Отменен" }, |
| | 0 | 51 | | ViewName = "CreateToCancellationTransaction", |
| | 0 | 52 | | RequiredSourceStatuses = new List<string> { "Заказан поставщику", "Заказан реализатору" }, |
| | 0 | 53 | | IncludeCancelledOrders = true, |
| | 0 | 54 | | SupportsOzonCancelPanel = true, |
| | 0 | 55 | | CreateTransactionMethod = (tm, orders, userName, createAt, comment) => |
| | 0 | 56 | | tm.CreateToCancellationTransaction(orders, userName, createAt, comment) |
| | 0 | 57 | | }; |
| | | 58 | | |
| | | 59 | | public Task<IActionResult> CreateToCancellationTransaction(string ids, int page) |
| | 0 | 60 | | => CreateTransactionBase(ids, page); |
| | | 61 | | |
| | | 62 | | [HttpPost] |
| | | 63 | | [ValidateAntiForgeryToken] |
| | | 64 | | public Task<IActionResult> CreateToCancellationTransaction( |
| | | 65 | | List<Order> orders, string userName, string? comment, |
| | | 66 | | int page, string? deletedOrders, Dictionary<int, string?>? orderSupplierMap) |
| | 0 | 67 | | => CreateTransactionPostBase(orders, userName, comment, page, deletedOrders, orderSupplierMap); |
| | | 68 | | } |