You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

164 lines
10 KiB

2 years ago
using System.Collections.Generic;
2 years ago
using System.Text.Json;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.BackgroundWorkers;
using Win_in.Sfs.Auth.Application.Contracts;
using Win_in.Sfs.Auth.Users;
using Win_in.Sfs.Auth.Users.Inputs;
using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Label.Application.Contracts;
2 years ago
using Win_in.Sfs.Shared.Domain.Shared;
2 years ago
using Win_in.Sfs.Wms.DataExchange.Domain;
2 years ago
using Win_in.Sfs.Wms.Inventory.Application.Contracts;
2 years ago
using Win_in.Sfs.Wms.Store.Application.Contracts;
namespace Win_in.Sfs.Wms.DataExchange.Agent;
public static class IncomingToWmsExtensions
{
public static async Task HandlePurchaseOrdersAsync(this IncomingToWms incomingConverted, PeriodicBackgroundWorkerContext workerContext)
{
var purchaseOrder = JsonSerializer.Deserialize<PurchaseOrderEditInput>(incomingConverted.DataContent);
var purchaseOrderAppService = workerContext.ServiceProvider.GetRequiredService<IPurchaseOrderAppService>();
await purchaseOrderAppService.CreateAsync(purchaseOrder).ConfigureAwait(false);
}
public static async Task HandleAsnsAsync(this IncomingToWms incomingConverted, PeriodicBackgroundWorkerContext workerContext)
{
var supplierAsn = JsonSerializer.Deserialize<SupplierAsnEditInput>(incomingConverted.DataContent);
var supplierAsnAppService = workerContext.ServiceProvider.GetRequiredService<ISupplierAsnAppService>();
await supplierAsnAppService.CreateAsync(supplierAsn).ConfigureAwait(false);
}
public static async Task HandleDictsAsync(this IncomingToWms incomingConverted, PeriodicBackgroundWorkerContext workerContext)
{
var Dict = JsonSerializer.Deserialize<DictEditInput>(incomingConverted.DataContent);
var DictBasicAppService = workerContext.ServiceProvider.GetRequiredService<IDictAppService>();
2 years ago
await DictBasicAppService.UpdateAsync(Dict).ConfigureAwait(false);
2 years ago
}
public static async Task HandleUsersAsync(this IncomingToWms incomingConverted, PeriodicBackgroundWorkerContext workerContext)
{
var user = JsonSerializer.Deserialize<IdentityUserInputDto>(incomingConverted.DataContent);
var userBasicAppService = workerContext.ServiceProvider.GetRequiredService<ISfsUserAppService>();
await userBasicAppService.UpdateByNmaeAsync(user).ConfigureAwait(false);
}
public static async Task HandleDepartmentsAsync(this IncomingToWms incomingConverted, PeriodicBackgroundWorkerContext workerContext)
{
var Department = JsonSerializer.Deserialize<DepartmentCreateInput>(incomingConverted.DataContent);
var DepartmentBasicAppService = workerContext.ServiceProvider.GetRequiredService<IDepartmentAppService>();
await DepartmentBasicAppService.UpdateAsync(Department).ConfigureAwait(false);
}
2 years ago
2 years ago
public static async Task HandleItemsAsync(this IncomingToWms incomingConverted, PeriodicBackgroundWorkerContext workerContext)
{
var item = JsonSerializer.Deserialize<ItemBasicEditInput>(incomingConverted.DataContent);
var itemBasicAppService = workerContext.ServiceProvider.GetRequiredService<IItemBasicAppService>();
2 years ago
await itemBasicAppService.UpsertAsyncByInterface(item).ConfigureAwait(false);
2 years ago
}
public static async Task HandleErpLocationsAsync(this IncomingToWms incomingConverted, PeriodicBackgroundWorkerContext workerContext)
{
var erpLocation = JsonSerializer.Deserialize<ErpLocationEditInput>(incomingConverted.DataContent);
var erpLocationAppService = workerContext.ServiceProvider.GetRequiredService<IErpLocationAppService>();
await erpLocationAppService.UpsertAsync(erpLocation).ConfigureAwait(false);
}
public static async Task HandleBomsAsync(this IncomingToWms incomingConverted, PeriodicBackgroundWorkerContext workerContext)
{
var bom = JsonSerializer.Deserialize<BomEditInput>(incomingConverted.DataContent);
var bomAppService = workerContext.ServiceProvider.GetRequiredService<IBomAppService>();
2 years ago
await bomAppService.UpsertAsyncByInterface(bom).ConfigureAwait(false);
2 years ago
}
public static async Task HandleSuppliersAsync(this IncomingToWms incomingConverted, PeriodicBackgroundWorkerContext workerContext)
{
var supplier = JsonSerializer.Deserialize<SupplierEditInput>(incomingConverted.DataContent);
var supplierAppService = workerContext.ServiceProvider.GetRequiredService<ISupplierAppService>();
2 years ago
await supplierAppService.UpsertAsyncByInterface(supplier).ConfigureAwait(false);
2 years ago
}
public static async Task HandleSupplierItemsAsync(this IncomingToWms incomingConverted, PeriodicBackgroundWorkerContext workerContext)
{
var supplierItem = JsonSerializer.Deserialize<SupplierItemEditInput>(incomingConverted.DataContent);
var supplierItemAppService = workerContext.ServiceProvider.GetRequiredService<ISupplierItemAppService>();
await supplierItemAppService.UpsertAsync(supplierItem).ConfigureAwait(false);
}
public static async Task HandleItemPacksAsync(this IncomingToWms incomingConverted, PeriodicBackgroundWorkerContext workerContext)
{
var itemPack = JsonSerializer.Deserialize<ItemPackEditInput>(incomingConverted.DataContent);
var itemPackAppService = workerContext.ServiceProvider.GetRequiredService<IItemPackAppService>();
await itemPackAppService.UpsertAsync(itemPack).ConfigureAwait(false);
}
public static async Task HandleCustomersAsync(this IncomingToWms incomingConverted, PeriodicBackgroundWorkerContext workerContext)
{
var customer = JsonSerializer.Deserialize<CustomerEditInput>(incomingConverted.DataContent);
var customerAppService = workerContext.ServiceProvider.GetRequiredService<ICustomerAppService>();
2 years ago
await customerAppService.UpsertAsyncByInterface(customer).ConfigureAwait(false);
2 years ago
}
public static async Task HandleCustomerItemsAsync(this IncomingToWms incomingConverted, PeriodicBackgroundWorkerContext workerContext)
{
var customerItem = JsonSerializer.Deserialize<CustomerItemEditInput>(incomingConverted.DataContent);
var customerItemAppService = workerContext.ServiceProvider.GetRequiredService<ICustomerItemAppService>();
await customerItemAppService.UpsertAsync(customerItem).ConfigureAwait(false);
}
2 years ago
public static async Task HandleInterfaceCalendarsAsync(this IncomingToWms incomingConverted, PeriodicBackgroundWorkerContext workerContext)
{
var interfaceCalendar = JsonSerializer.Deserialize<InterfaceCalendarEditInput>(incomingConverted.DataContent);
var interfaceCalendarAppService = workerContext.ServiceProvider.GetRequiredService<IInterfaceCalendarAppService>();
await interfaceCalendarAppService.UpsertAsync(interfaceCalendar).ConfigureAwait(false);
}
2 years ago
public static async Task HandleSaleOrdersAsync(this IncomingToWms incomingConverted, PeriodicBackgroundWorkerContext workerContext)
{
var saleOrder = JsonSerializer.Deserialize<SaleOrderEditInput>(incomingConverted.DataContent);
var saleOrderAppService = workerContext.ServiceProvider.GetRequiredService<ISaleOrderAppService>();
await saleOrderAppService.UpsertAsync(saleOrder).ConfigureAwait(false);
}
public static async Task HandleProductReceiptsAsync(this IncomingToWms incomingConverted, PeriodicBackgroundWorkerContext workerContext)
{
var productReceipt = JsonSerializer.Deserialize<ProductReceiptNoteEditInput>(incomingConverted.DataContent);
var productReceiptAppService = workerContext.ServiceProvider.GetRequiredService<IProductReceiptNoteAppService>();
await productReceiptAppService.CreateAsync(productReceipt).ConfigureAwait(false);
}
public static async Task HandleMaterialRequestsAsync(this IncomingToWms incomingConverted, PeriodicBackgroundWorkerContext workerContext)
{
var materialRequest = JsonSerializer.Deserialize<MaterialRequestEditInput>(incomingConverted.DataContent);
var materialRequestAppService = workerContext.ServiceProvider.GetRequiredService<IMaterialRequestAppService>();
2 years ago
await materialRequestAppService.CreateAndHandleByAPIAsync(materialRequest).ConfigureAwait(false);
2 years ago
}
public static async Task HandleScrapsAsync(this IncomingToWms incomingConverted, PeriodicBackgroundWorkerContext workerContext)
{
var scrap = JsonSerializer.Deserialize<ScrapNoteEditInput>(incomingConverted.DataContent);
var scrapAppService = workerContext.ServiceProvider.GetRequiredService<IScrapNoteAppService>();
await scrapAppService.CreateAsync(scrap).ConfigureAwait(false);
}
public static async Task HandleIssueNoteConfirmAsync(this IncomingToWms incomingConverted, PeriodicBackgroundWorkerContext workerContext)
{
var number = incomingConverted.DataIdentityCode;
var issueNoteAppService = workerContext.ServiceProvider.GetRequiredService<IIssueNoteAppService>();
await issueNoteAppService.ConfirmAsync(number).ConfigureAwait(false);
}
2 years ago
2 years ago
public static async Task HandleInventoryLabelsAsync(this IncomingToWms incomingConverted, PeriodicBackgroundWorkerContext workerContext)
{
var inventoryLabel = JsonSerializer.Deserialize<InventoryLabelEditInput>(incomingConverted.DataContent);
2 years ago
var inventoryLabelAppService = workerContext.ServiceProvider.GetRequiredService<IInventoryLabelAppService>();
await inventoryLabelAppService.CreateManyByNoCodeAsync(new List<InventoryLabelEditInput> { inventoryLabel }).ConfigureAwait(false);
2 years ago
}
2 years ago
public static async Task HandleBackFlushsAsync(this IncomingToWms incomingConverted, PeriodicBackgroundWorkerContext workerContext)
{
var backFlush = JsonSerializer.Deserialize<BackFlushNoteEditInput>(incomingConverted.DataContent);
var backFlushAppService = workerContext.ServiceProvider.GetRequiredService<IBackFlushNoteAppService>();
2 years ago
List<BackFlushNoteEditInput> back = new List<BackFlushNoteEditInput>();
back.Add(backFlush);
await backFlushAppService.CreateManyAsync(back).ConfigureAwait(false);
2 years ago
}
2 years ago
}