Merge conflicts

This commit is contained in:
2025-05-28 10:35:06 -04:00
5 changed files with 26 additions and 15 deletions

View File

@@ -24,7 +24,7 @@ namespace PartSource.Automation.Jobs
public BulkUpdateInventory(IConfiguration configuration, ILogger<BulkUpdateInventory> logger) public BulkUpdateInventory(IConfiguration configuration, ILogger<BulkUpdateInventory> logger)
{ {
FtpConfiguration ftpConfiguration = configuration.GetSection("FtpServers:AzureConfiguration").Get<FtpConfiguration>(); FtpConfiguration ftpConfiguration = configuration.GetSection("FtpServers:AutomationConfiguration").Get<FtpConfiguration>();
_ftpService = new FtpService(ftpConfiguration); _ftpService = new FtpService(ftpConfiguration);
_connectionString = configuration.GetConnectionString("PartSourceDatabase"); _connectionString = configuration.GetConnectionString("PartSourceDatabase");

View File

@@ -1,9 +1,11 @@
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using PartSource.Automation.Models.Configuration; using PartSource.Automation.Models.Configuration;
using PartSource.Automation.Models.Ftp;
using PartSource.Automation.Services; using PartSource.Automation.Services;
using Ratermania.Automation.Interfaces; using Ratermania.Automation.Interfaces;
using System; using System;
using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
@@ -21,7 +23,7 @@ namespace PartSource.Automation.Jobs
public ExecuteSsisPackages(EmailService emailService, IConfiguration configuration, SsisService ssisService, ILogger<ExecuteSsisPackages> logger) public ExecuteSsisPackages(EmailService emailService, IConfiguration configuration, SsisService ssisService, ILogger<ExecuteSsisPackages> logger)
{ {
FtpConfiguration ftpConfiguration = configuration.GetSection("FtpServers:AzureConfiguration").Get<FtpConfiguration>(); FtpConfiguration ftpConfiguration = configuration.GetSection("FtpServers:AutomationConfiguration").Get<FtpConfiguration>();
_emailService = emailService; _emailService = emailService;
_ftpService = new FtpService(ftpConfiguration); _ftpService = new FtpService(ftpConfiguration);
@@ -36,6 +38,17 @@ namespace PartSource.Automation.Jobs
{ {
try try
{ {
FtpFileInfo lastUploadedFile = _ftpService.ListFilesExtended()
.Where(f => f.FileType == FtpFileType.File && f.Filename.IndexOf(package) > -1)
.OrderByDescending(f => f.Modified)
.FirstOrDefault();
if (lastUploadedFile == null)
{
_logger.LogInformation($"No {package} file available.");
return;
}
_ftpService.Download($"{package}.txt"); _ftpService.Download($"{package}.txt");
_ssisService.Execute($"{package}.dtsx"); _ssisService.Execute($"{package}.dtsx");
@@ -45,7 +58,6 @@ namespace PartSource.Automation.Jobs
catch (Exception ex) catch (Exception ex)
{ {
_logger.LogError($"Execution of SSIS package {package} failed.", ex); _logger.LogError($"Execution of SSIS package {package} failed.", ex);
throw; throw;
} }
} }

View File

@@ -18,13 +18,13 @@ using Ratermania.Shopify.Resources;
namespace PartSource.Automation.Jobs.POC namespace PartSource.Automation.Jobs.POC
{ {
public class AlsoGetImageUrls : IAutomationJob public class ImageList : IAutomationJob
{ {
private readonly NexpartService _nexpartService; private readonly NexpartService _nexpartService;
private readonly PartSourceContext _partSourceContext; private readonly PartSourceContext _partSourceContext;
private readonly FitmentContext _fitmentContext; private readonly FitmentContext _fitmentContext;
public AlsoGetImageUrls(NexpartService nexpartService, PartSourceContext partSourceContext, FitmentContext fitmentContext) public GetImageUrls(NexpartService nexpartService, PartSourceContext partSourceContext, FitmentContext fitmentContext)
{ {
_nexpartService = nexpartService; _nexpartService = nexpartService;
_partSourceContext = partSourceContext; _partSourceContext = partSourceContext;

View File

@@ -24,7 +24,7 @@ namespace PartSource.Automation.Jobs
public PartialInventoryUpdate(IConfiguration configuration, ILogger<PartialInventoryUpdate> logger) public PartialInventoryUpdate(IConfiguration configuration, ILogger<PartialInventoryUpdate> logger)
{ {
FtpConfiguration ftpConfiguration = configuration.GetSection("FtpServers:AzureConfiguration").Get<FtpConfiguration>(); FtpConfiguration ftpConfiguration = configuration.GetSection("FtpServers:AutomationConfiguration").Get<FtpConfiguration>();
_ftpService = new FtpService(ftpConfiguration); _ftpService = new FtpService(ftpConfiguration);
_connectionString = _connectionString = configuration.GetConnectionString("PartSourceDatabase"); _connectionString = _connectionString = configuration.GetConnectionString("PartSourceDatabase");

View File

@@ -11,19 +11,18 @@
"SmtpHost": "localhost" "SmtpHost": "localhost"
}, },
"FtpServers": { "FtpServers": {
"AzureConfiguration": {
"Username": "ps-ftp\\$ps-ftp",
"Password": "ycvXptffBxqkBXW4vuRYqn4Zi1soCvnvMMolTe5HNSeAlcl3bAyJYtNhG579",
"Url": "ftp://waws-prod-yq1-007.ftp.azurewebsites.windows.net/site/wwwroot",
"Destination": "C:\\Partsource.Automation\\Downloads",
"Port": 21
},
"WhiConfiguration": { "WhiConfiguration": {
"Username": "ctc_seo", "Username": "ctc_seo",
"Password": "YD3gtaQ5kPdtNKs", "Password": "YD3gtaQ5kPdtNKs",
"Url": "ftp://ftp.whisolutions.com", "Url": "ftp://ftp.whisolutions.com",
"Destination": "C:\\Partsource.Automation\\Downloads\\WHI", "Destination": "C:\\Partsource.Automation\\Downloads\\WHI",
"Port": 3001 "Port": 3001
},
"AutomationConfiguration": {
"Username": "stageuser",
"Password": "FXepK^cFYS|[H<",
"Url": "ftp://localhost",
"Destination": "C:\\Partsource.Automation\\Downloads"
} }
}, },
"ssisConfiguration": { "ssisConfiguration": {