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.
147 lines
8.7 KiB
147 lines
8.7 KiB
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;
|
||
|
using Win_in.Sfs.Wms.DataExchange.Domain;
|
||
|
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>();
|
||
|
await DictBasicAppService.UpdateAsync(Dict).ConfigureAwait(false);
|
||
|
}
|
||
|
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);
|
||
|
}
|
||
|
|
||
|
public static async Task HandleItemsAsync(this IncomingToWms incomingConverted, PeriodicBackgroundWorkerContext workerContext)
|
||
|
{
|
||
|
var item = JsonSerializer.Deserialize<ItemBasicEditInput>(incomingConverted.DataContent);
|
||
|
var itemBasicAppService = workerContext.ServiceProvider.GetRequiredService<IItemBasicAppService>();
|
||
|
await itemBasicAppService.UpsertAsync(item).ConfigureAwait(false);
|
||
|
}
|
||
|
|
||
|
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>();
|
||
|
await bomAppService.UpsertAsync(bom).ConfigureAwait(false);
|
||
|
}
|
||
|
|
||
|
public static async Task HandleSuppliersAsync(this IncomingToWms incomingConverted, PeriodicBackgroundWorkerContext workerContext)
|
||
|
{
|
||
|
var supplier = JsonSerializer.Deserialize<SupplierEditInput>(incomingConverted.DataContent);
|
||
|
var supplierAppService = workerContext.ServiceProvider.GetRequiredService<ISupplierAppService>();
|
||
|
await supplierAppService.UpsertAsync(supplier).ConfigureAwait(false);
|
||
|
}
|
||
|
|
||
|
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>();
|
||
|
await customerAppService.UpsertAsync(customer).ConfigureAwait(false);
|
||
|
}
|
||
|
|
||
|
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);
|
||
|
}
|
||
|
|
||
|
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>();
|
||
|
await materialRequestAppService.CreateAndHandleAsync(materialRequest).ConfigureAwait(false);
|
||
|
}
|
||
|
|
||
|
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);
|
||
|
}
|
||
|
|
||
|
public static async Task HandleInventoryLabelsAsync(this IncomingToWms incomingConverted, PeriodicBackgroundWorkerContext workerContext)
|
||
|
{
|
||
|
var inventoryLabel = JsonSerializer.Deserialize<InventoryLabelEditInput>(incomingConverted.DataContent);
|
||
|
var inventoryLabelAppService = workerContext.ServiceProvider.GetRequiredService<IInventoryLabelAppService>();
|
||
|
await inventoryLabelAppService.CreateAsync(inventoryLabel).ConfigureAwait(false);
|
||
|
}
|
||
|
}
|