WIP
This commit is contained in:
@@ -41,6 +41,66 @@ namespace PartSource.Api.Controllers
|
|||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Item[] items = new[]
|
||||||
|
{
|
||||||
|
new Item { PartNumber = vehicleFitment.PartNumber, MfrCode = vehicleFitment.LineCode }
|
||||||
|
};
|
||||||
|
|
||||||
|
SmartPageDataSearch smartPageDataSearch = new SmartPageDataSearch
|
||||||
|
{
|
||||||
|
Items = items
|
||||||
|
};
|
||||||
|
|
||||||
|
SmartPageDataSearchResponse smartPageResponse = await _nexpartService.SendRequest<SmartPageDataSearch, SmartPageDataSearchResponse>(smartPageDataSearch);
|
||||||
|
if (smartPageResponse.ResponseBody?.Item != null)
|
||||||
|
{
|
||||||
|
PartType[] partTypes = smartPageResponse.ResponseBody.Item.Select(i => new PartType
|
||||||
|
{
|
||||||
|
Id = i.Part.PartType.Id
|
||||||
|
})
|
||||||
|
.ToArray();
|
||||||
|
|
||||||
|
ApplicationSearch applicationSearch = new ApplicationSearch
|
||||||
|
{
|
||||||
|
VehicleIdentifier = new VehicleIdentifier
|
||||||
|
{
|
||||||
|
BaseVehicleId = vehicleFitment.BaseVehicleId,
|
||||||
|
EngineConfigId = vehicleFitment.EngineConfigId
|
||||||
|
},
|
||||||
|
MfrCode = new[] { vehicleFitment.LineCode },
|
||||||
|
PartType = partTypes,
|
||||||
|
GroupBy = "MFR",
|
||||||
|
QuestionOption = "QUESTION_OTHERWISE_APP"
|
||||||
|
};
|
||||||
|
|
||||||
|
ApplicationSearchResponse response = await _nexpartService.SendRequest<ApplicationSearch, ApplicationSearchResponse>(applicationSearch);
|
||||||
|
if (response.ResponseBody != null)
|
||||||
|
{
|
||||||
|
vehicleFitment.DriveTypes = new List<string>();
|
||||||
|
|
||||||
|
Question driveTypeQuestion = ((Questions)response.ResponseBody).Question
|
||||||
|
.Where(q => q.Attribute == "DRIVE_TYPE")
|
||||||
|
.FirstOrDefault();
|
||||||
|
|
||||||
|
if (driveTypeQuestion != null)
|
||||||
|
{
|
||||||
|
foreach (Answer answer in driveTypeQuestion.Answer)
|
||||||
|
{
|
||||||
|
applicationSearch.Criterion = new[]
|
||||||
|
{
|
||||||
|
new Criterion { Attribute = "DRIVE_TYPE", Id = answer.Id}
|
||||||
|
};
|
||||||
|
|
||||||
|
ApplicationSearchResponse driveTypeResponse = await _nexpartService.SendRequest<ApplicationSearch, ApplicationSearchResponse>(applicationSearch);
|
||||||
|
if (driveTypeResponse.ResponseBody != null && ((Apps)driveTypeResponse.ResponseBody).App.Where(a => a.Part == vehicleFitment.PartNumber).Any())
|
||||||
|
{
|
||||||
|
vehicleFitment.DriveTypes.Add(answer.Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return Ok(vehicleFitment);
|
return Ok(vehicleFitment);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -129,7 +189,7 @@ namespace PartSource.Api.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
IList<string> positions = new List<string>();
|
IList<string> positions = new List<string>();
|
||||||
foreach (App app in response.ResponseBody?.App)
|
foreach (App app in ((Apps)response.ResponseBody)?.App)
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(app.Position) && app.Part == part.PartNumber)
|
if (!string.IsNullOrEmpty(app.Position) && app.Part == part.PartNumber)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ namespace PartSource.Api.Controllers
|
|||||||
|
|
||||||
if (response.ResponseBody != null)
|
if (response.ResponseBody != null)
|
||||||
{
|
{
|
||||||
return NexpartResponse<ApplicationSearchResponse, Apps>(response);
|
return NexpartResponse<ApplicationSearchResponse, object>(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -1,13 +1,4 @@
|
|||||||
{
|
{
|
||||||
"iisSettings": {
|
|
||||||
"windowsAuthentication": false,
|
|
||||||
"anonymousAuthentication": true,
|
|
||||||
"iisExpress": {
|
|
||||||
"applicationUrl": "http://localhost:31337",
|
|
||||||
"sslPort": 0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"$schema": "http://json.schemastore.org/launchsettings.json",
|
|
||||||
"profiles": {
|
"profiles": {
|
||||||
"IIS Express": {
|
"IIS Express": {
|
||||||
"commandName": "IISExpress",
|
"commandName": "IISExpress",
|
||||||
@@ -18,12 +9,20 @@
|
|||||||
},
|
},
|
||||||
"PartSource.Api": {
|
"PartSource.Api": {
|
||||||
"commandName": "Project",
|
"commandName": "Project",
|
||||||
"launchBrowser": true,
|
|
||||||
"launchUrl": "api/values",
|
"launchUrl": "api/values",
|
||||||
"environmentVariables": {
|
"environmentVariables": {
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
},
|
},
|
||||||
"applicationUrl": "https://localhost:5001;http://localhost:5000"
|
"applicationUrl": "https://localhost:5001;http://localhost:5000"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"$schema": "http://json.schemastore.org/launchsettings.json",
|
||||||
|
"iisSettings": {
|
||||||
|
"windowsAuthentication": false,
|
||||||
|
"anonymousAuthentication": true,
|
||||||
|
"iisExpress": {
|
||||||
|
"applicationUrl": "http://localhost:31337",
|
||||||
|
"sslPort": 0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -17,7 +17,7 @@ namespace PartSource.Automation.Jobs
|
|||||||
private readonly ILogger<ExecuteSsisPackages> _logger;
|
private readonly ILogger<ExecuteSsisPackages> _logger;
|
||||||
|
|
||||||
// TODO: set from config
|
// TODO: set from config
|
||||||
private readonly string[] _ssisPackages = {"Parts Price" };
|
private readonly string[] _ssisPackages = {"Parts Availability" };
|
||||||
|
|
||||||
public ExecuteSsisPackages(EmailService emailService, IConfiguration configuration, SsisService ssisService, ILogger<ExecuteSsisPackages> logger)
|
public ExecuteSsisPackages(EmailService emailService, IConfiguration configuration, SsisService ssisService, ILogger<ExecuteSsisPackages> logger)
|
||||||
{
|
{
|
||||||
@@ -36,7 +36,7 @@ namespace PartSource.Automation.Jobs
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_ftpService.Download($"{package}.txt");
|
// _ftpService.Download($"{package}.txt");
|
||||||
_ssisService.Execute($"{package}.dtsx");
|
_ssisService.Execute($"{package}.dtsx");
|
||||||
|
|
||||||
_logger.LogInformation($"Execution of SSIS package {package} completed successfully.");
|
_logger.LogInformation($"Execution of SSIS package {package} completed successfully.");
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ namespace PartSource.Automation.Jobs.POC
|
|||||||
ApplicationSearchResponse response = await _nexpartService.SendRequest<ApplicationSearch, ApplicationSearchResponse>(applicationSearch);
|
ApplicationSearchResponse response = await _nexpartService.SendRequest<ApplicationSearch, ApplicationSearchResponse>(applicationSearch);
|
||||||
if (response.ResponseBody != null)
|
if (response.ResponseBody != null)
|
||||||
{
|
{
|
||||||
foreach (App app in response.ResponseBody.App)
|
foreach (App app in ((Apps)response.ResponseBody).App)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ namespace PartSource.Automation.Jobs.POC
|
|||||||
ApplicationSearchResponse response = await _nexpartService.SendRequest<ApplicationSearch, ApplicationSearchResponse>(applicationSearch);
|
ApplicationSearchResponse response = await _nexpartService.SendRequest<ApplicationSearch, ApplicationSearchResponse>(applicationSearch);
|
||||||
if (response.ResponseBody != null)
|
if (response.ResponseBody != null)
|
||||||
{
|
{
|
||||||
foreach (App app in response.ResponseBody.App)
|
foreach (App app in ((Apps)response.ResponseBody).App)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ namespace PartSource.Automation.Jobs
|
|||||||
fileGroups.Enqueue(fileGroup);
|
fileGroups.Enqueue(fileGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
Task[] taskArray = new Task[8];
|
Task[] taskArray = new Task[12];
|
||||||
|
|
||||||
for (int i = 0; i < taskArray.Length; i++)
|
for (int i = 0; i < taskArray.Length; i++)
|
||||||
{
|
{
|
||||||
@@ -95,10 +95,9 @@ namespace PartSource.Automation.Jobs
|
|||||||
}
|
}
|
||||||
|
|
||||||
Task.WaitAll(taskArray);
|
Task.WaitAll(taskArray);
|
||||||
|
_whiSeoService.SaveNotes(_noteDictionary);
|
||||||
|
|
||||||
// _whiSeoService.CreateFitmentView();
|
_whiSeoService.CreateFitmentView();
|
||||||
|
|
||||||
//_whiSeoService.SaveNotes(_noteDictionary);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Decompress(FileInfo fileInfo)
|
public string Decompress(FileInfo fileInfo)
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ namespace PartSource.Automation
|
|||||||
|
|
||||||
.AddAutomation(options =>
|
.AddAutomation(options =>
|
||||||
{
|
{
|
||||||
options.HasBaseInterval(new TimeSpan(0, 15, 0))
|
options.HasBaseInterval(new TimeSpan(0, 1, 0))
|
||||||
.HasMaxFailures(1)
|
.HasMaxFailures(1)
|
||||||
//.HasJob<TestJob>(options => options.HasInterval(new TimeSpan(7, 0, 0, 0)));
|
//.HasJob<TestJob>(options => options.HasInterval(new TimeSpan(7, 0, 0, 0)));
|
||||||
//
|
//
|
||||||
@@ -95,14 +95,14 @@ namespace PartSource.Automation
|
|||||||
//.HasJob<StatusCheck>(options => options.HasInterval(new TimeSpan(24, 0, 0))
|
//.HasJob<StatusCheck>(options => options.HasInterval(new TimeSpan(24, 0, 0))
|
||||||
// .StartsAt(DateTime.Parse("2021-04-01 08:00:00"))
|
// .StartsAt(DateTime.Parse("2021-04-01 08:00:00"))
|
||||||
//)
|
//)
|
||||||
//.HasJob<ExecuteSsisPackages>(options =>
|
.HasJob<ProcessWhiFitment>(options =>
|
||||||
// options.HasInterval(new TimeSpan(24, 0, 0))
|
options.HasInterval(new TimeSpan(24, 0, 0))
|
||||||
// //.StartsAt(DateTime.Today.AddHours(25))
|
//.StartsAt(DateTime.Today.AddHours(25))
|
||||||
// )
|
// )
|
||||||
|
|
||||||
.HasJob<UpdatePricing>(options => options.HasInterval(new TimeSpan(24, 0, 0))
|
//.HasJob<UpdatePricing>(options => options.HasInterval(new TimeSpan(24, 0, 0))
|
||||||
//.HasDependency<ExecuteSsisPackages>()
|
// .HasDependency<ExecuteSsisPackages>()
|
||||||
// .StartsAt(DateTime.Today.AddHours(28))
|
// // .StartsAt(DateTime.Today.AddHours(28))
|
||||||
);
|
);
|
||||||
//);
|
//);
|
||||||
//.AddApiServer();
|
//.AddApiServer();
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ namespace PartSource.Automation.Services
|
|||||||
command.ExecuteNonQuery();
|
command.ExecuteNonQuery();
|
||||||
|
|
||||||
using SqlCommand command2 = new SqlCommand($"exec CreateFitmentIndexes", connection);
|
using SqlCommand command2 = new SqlCommand($"exec CreateFitmentIndexes", connection);
|
||||||
command.CommandTimeout = 1800;
|
command.CommandTimeout = 3600;
|
||||||
command2.ExecuteNonQuery();
|
command2.ExecuteNonQuery();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"ConnectionStrings": {
|
"ConnectionStrings": {
|
||||||
"FitmentDatabase": "Data Source=localhost;Initial Catalog=WhiFitment;Integrated Security=true;TrustServerCertificate=True",
|
"FitmentDatabase": "Data Source=omg-optiplex;Initial Catalog=WhiFitment;User ID=sa;Password=TNG497us?4TW!;TrustServerCertificate=True",
|
||||||
"PartSourceDatabase": "Server=tcp:ps-whi.database.windows.net,1433;Initial Catalog=ps-whi-stage;Persist Security Info=False;User ID=ps-whi;Password=9-^*N5dw!6:|.5Q;MultipleActiveResultSets=True;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;"
|
"PartSourceDatabase": "Server=tcp:ps-whi.database.windows.net,1433;Initial Catalog=ps-whi-stage;Persist Security Info=False;User ID=ps-whi;Password=9-^*N5dw!6:|.5Q;MultipleActiveResultSets=True;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;"
|
||||||
},
|
},
|
||||||
"emailConfiguration": {
|
"emailConfiguration": {
|
||||||
|
|||||||
@@ -8,5 +8,7 @@ namespace PartSource.Data.Dtos
|
|||||||
public class VehicleFitmentDto : VehicleFitment
|
public class VehicleFitmentDto : VehicleFitment
|
||||||
{
|
{
|
||||||
public IList<string> SubmodelNames { get; set; }
|
public IList<string> SubmodelNames { get; set; }
|
||||||
|
|
||||||
|
public IList<string> DriveTypes { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
22
PartSource.Data/Nexpart/Answer.cs
Normal file
22
PartSource.Data/Nexpart/Answer.cs
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Xml.Serialization;
|
||||||
|
|
||||||
|
namespace PartSource.Data.Nexpart
|
||||||
|
{
|
||||||
|
[XmlType(Namespace = "http://whisolutions.com/pss/common/helper/parts")]
|
||||||
|
public class Answer
|
||||||
|
{
|
||||||
|
[XmlAttribute]
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
[XmlAttribute]
|
||||||
|
public int Count { get; set; }
|
||||||
|
|
||||||
|
[XmlText]
|
||||||
|
public string Value { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -35,5 +35,8 @@ namespace PartSource.Data.Nexpart
|
|||||||
|
|
||||||
[XmlElement(Order = 7)]
|
[XmlElement(Order = 7)]
|
||||||
public string GroupBy { get; set; }
|
public string GroupBy { get; set; }
|
||||||
|
|
||||||
|
[XmlElement(Order = 8)]
|
||||||
|
public string QuestionOption { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,13 +9,13 @@ using PartSource.Data.Nexpart.Interfaces;
|
|||||||
namespace PartSource.Data.Nexpart
|
namespace PartSource.Data.Nexpart
|
||||||
{
|
{
|
||||||
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/model/parts")]
|
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/model/parts")]
|
||||||
public class ApplicationSearchResponse : IResponseElement<Apps>
|
public class ApplicationSearchResponse : IResponseElement<object>
|
||||||
{
|
{
|
||||||
|
|
||||||
[XmlElement]
|
[XmlElement]
|
||||||
public PSResponseHeader PSResponseHeader { get; set; }
|
public PSResponseHeader PSResponseHeader { get; set; }
|
||||||
|
|
||||||
[XmlElement(ElementName = nameof(Apps))]
|
[XmlElement(ElementName = nameof(Apps), Namespace = "http://whisolutions.com/pss/common/model/parts", Type = typeof(Apps))]
|
||||||
public Apps ResponseBody { get; set; }
|
[XmlElement(ElementName = nameof(Questions), Namespace = "http://whisolutions.com/pss/common/model/parts", Type = typeof(Questions))]
|
||||||
|
public object ResponseBody { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
25
PartSource.Data/Nexpart/Question.cs
Normal file
25
PartSource.Data/Nexpart/Question.cs
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Xml.Serialization;
|
||||||
|
|
||||||
|
namespace PartSource.Data.Nexpart
|
||||||
|
{
|
||||||
|
[XmlType(Namespace = "http://whisolutions.com/pss/common/helper/parts")]
|
||||||
|
public class Question
|
||||||
|
{
|
||||||
|
[XmlAttribute(AttributeName = "Attrib")]
|
||||||
|
public string Attribute { get; set; }
|
||||||
|
|
||||||
|
[XmlAttribute]
|
||||||
|
public int Count { get; set; }
|
||||||
|
|
||||||
|
[XmlAttribute]
|
||||||
|
public string Text { get; set; }
|
||||||
|
|
||||||
|
[XmlElement]
|
||||||
|
public Answer[] Answer { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
19
PartSource.Data/Nexpart/Questions.cs
Normal file
19
PartSource.Data/Nexpart/Questions.cs
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Xml.Serialization;
|
||||||
|
|
||||||
|
namespace PartSource.Data.Nexpart
|
||||||
|
{
|
||||||
|
[XmlType(Namespace = "http://whisolutions.com/pss/common/model/parts")]
|
||||||
|
public class Questions
|
||||||
|
{
|
||||||
|
[XmlElement(Namespace = "http://whisolutions.com/pss/common/helper/parts")]
|
||||||
|
public Question[] Question { get; set; }
|
||||||
|
|
||||||
|
[XmlAttribute]
|
||||||
|
public int NumApps { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -35,7 +35,8 @@ namespace PartSource.Services
|
|||||||
ModelName = vf.ModelName,
|
ModelName = vf.ModelName,
|
||||||
BaseVehicleId = vf.BaseVehicleId,
|
BaseVehicleId = vf.BaseVehicleId,
|
||||||
EngineConfigId = vf.EngineConfigId,
|
EngineConfigId = vf.EngineConfigId,
|
||||||
VehicleToEngineConfigId = vf.VehicleToEngineConfigId
|
VehicleToEngineConfigId = vf.VehicleToEngineConfigId,
|
||||||
|
SubmodelName = vf.SubmodelName
|
||||||
})
|
})
|
||||||
.FirstOrDefaultAsync();
|
.FirstOrDefaultAsync();
|
||||||
|
|
||||||
@@ -44,12 +45,6 @@ namespace PartSource.Services
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
vehicleFitment.SubmodelNames = await _fitmentContext.VehicleFitments
|
|
||||||
.Where(vf => vf.BaseVehicleId == vehicleFitment.BaseVehicleId && vf.Sku == sku)
|
|
||||||
.Select(vf => vf.SubmodelName)
|
|
||||||
.Distinct()
|
|
||||||
.ToListAsync();
|
|
||||||
|
|
||||||
return vehicleFitment;
|
return vehicleFitment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user