Merge branch 'feature/CostingDtoSetup' into develop

This commit is contained in:
Samuele Locatelli
2023-05-19 16:30:03 +02:00
29 changed files with 304 additions and 80 deletions
@@ -0,0 +1,43 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using NLog;
using WebDoorCreator.Data.DTO;
using WebDoorCreator.Data.Services;
namespace WebDoorCreator.API.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class OrderController : ControllerBase
{
public OrderController(IConfiguration configuration, QueueDataService DataService)
{
Log.Info("Starting OrderController");
_configuration = configuration;
QDataServ = DataService;
Log.Info("Avviato OrderController");
}
// GET: api/Alive
[HttpGet]
public string Get()
{
return "OK";
}
/// <summary>
/// Order detail for cost evaluation
/// </summary>
/// <param name="OrderId"></param>
/// <returns></returns>
[HttpGet("OrderDetail")]
public async Task<OrderDetailsDTO> OrderDetail(int OrderId)
{
OrderDetailsDTO answ = new OrderDetailsDTO();
return answ;
}
private static IConfiguration _configuration = null!;
private static Logger Log = LogManager.GetCurrentClassLogger();
private QueueDataService QDataServ { get; set; } = null!;
}
}
@@ -130,6 +130,8 @@ namespace WebDoorCreator.API.Controllers
return actQueue;
}
#endregion Public Methods
#region Private Fields
+21
View File
@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WebDoorCreator.Data.DTO
{
public class CostingDTO
{
/// <summary>
/// Order's UID
/// </summary>
public int OrderId { get; set; }
/// <summary>
/// Dictionary of evaluated unit cost for each Door in Order
/// </summary>
public Dictionary<int, double> DoorUnitCost { get; set; } = new Dictionary<int, double>();
}
}
+59
View File
@@ -0,0 +1,59 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WebDoorCreator.Data.DTO
{
/// <summary>
/// COmpany data DTO
/// </summary>
[Serializable]
public class CustomerDTO
{
public int CompanyId { get; set; }
/// <summary>
/// Codice esterno x riferimento (es ERP)
/// </summary>
[MaxLength(250)]
public string CompanyExtCode { get; set; } = "";
/// <summary>
/// Nome / ragione Sociale
/// </summary>
[MaxLength(500)]
public string CompanyName { get; set; } = "";
/// <summary>
/// indirizzo
/// </summary>
[MaxLength(250)]
public string Address { get; set; } = "";
/// <summary>
/// CAP
/// </summary>
public int ZipCode { get; set; } = 0;
/// <summary>
/// Citta
/// </summary>
[MaxLength(50)]
public string City { get; set; } = "";
/// <summary>
/// Stato
/// </summary>
[MaxLength(50)]
public string State { get; set; } = "";
/// <summary>
/// VAT / P.Iva
/// </summary>
[MaxLength(50)]
public string VAT { get; set; } = "";
}
}
+25
View File
@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WebDoorCreator.Data.DTO
{
/// <summary>
/// Serialized door data for cost evaluation
/// </summary>
[Serializable]
public class DoorCostingDTO
{
public int DoorId { get; set; } = 0;
public double SizeX { get; set; } = 0;
public double SizeY { get; set; } = 0;
public double SizeZ { get; set; } = 0;
public double EstimatedWorkTime { get; set; } = 0;
public Dictionary<string, double> BOMList { get; set; }= new Dictionary<string, double>();
}
}
@@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WebDoorCreator.Data.DTO
{
/// <summary>
/// Serialized order data
/// </summary>
[Serializable]
public class OrderDetailsDTO
{
/// <summary>
/// Order UID (DB)
/// </summary>
public int OrderId { get; set; }
/// <summary>
/// Customer Info
/// </summary>
public CustomerDTO CustomerInfo { get; set; } = new CustomerDTO();
/// <summary>
/// Order reference / Ext code
/// </summary>
public string OrderExtCode { get; set; } = "";
/// <summary>
/// Order description
/// </summary>
public string OrderDescript { get; set; } = "";
/// <summary>
/// Door list for current order
/// </summary>
public List<DoorCostingDTO> DoorsList { get; set; } = new List<DoorCostingDTO>();
}
}
@@ -1,6 +1,7 @@
using EgwCoreLib.Razor.Data;
using EgwCoreLib.Utils;
using Microsoft.AspNetCore.Identity.UI.Services;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Newtonsoft.Json;
using NLog;
using StackExchange.Redis;
@@ -10,7 +11,7 @@ using WebDoorCreator.Core;
using WebDoorCreator.Data.Controllers;
using WebDoorCreator.Data.DbModels;
namespace WebDoorCreator.UI.Data
namespace WebDoorCreator.Data.Services
{
public class WebDoorCreatorService
{
@@ -13,6 +13,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="EgwCoreLib.Utils" Version="1.4.2305.1916" />
<PackageReference Include="EntityFrameworkCore.SqlServer.HierarchyId" Version="3.0.1" />
<PackageReference Include="MailKit" Version="3.5.0" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="6.0.11" />
@@ -1,6 +1,7 @@
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Identity;
using Microsoft.JSInterop;
using WebDoorCreator.Data.Services;
using WebDoorCreator.UI.Data;
namespace WebDoorCreator.UI.Components.Buttons
@@ -1,5 +1,6 @@
using Microsoft.AspNetCore.Components;
using WebDoorCreator.Data.DbModels;
using WebDoorCreator.Data.Services;
using WebDoorCreator.UI.Data;
namespace WebDoorCreator.UI.Components.CompMan
@@ -1,5 +1,6 @@
using Microsoft.AspNetCore.Components;
using WebDoorCreator.Data.DbModels;
using WebDoorCreator.Data.Services;
using WebDoorCreator.UI.Data;
namespace WebDoorCreator.UI.Components.DoorDef
@@ -1,6 +1,7 @@
using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
using WebDoorCreator.Data.DbModels;
using WebDoorCreator.Data.Services;
using WebDoorCreator.UI.Data;
namespace WebDoorCreator.UI.Components.DoorDef
@@ -1,6 +1,7 @@
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Server.ProtectedBrowserStorage;
using WebDoorCreator.Data.DbModels;
using WebDoorCreator.Data.Services;
using WebDoorCreator.UI.Data;
namespace WebDoorCreator.UI.Components.DoorDef
@@ -1,6 +1,7 @@
using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
using WebDoorCreator.Data.DbModels;
using WebDoorCreator.Data.Services;
using WebDoorCreator.UI.Components.SvgComp;
using WebDoorCreator.UI.Data;
@@ -1,5 +1,6 @@
using Microsoft.AspNetCore.Components;
using WebDoorCreator.Data.DbModels;
using WebDoorCreator.Data.Services;
using WebDoorCreator.UI.Data;
namespace WebDoorCreator.UI.Components.Filters
@@ -2,6 +2,7 @@ using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.AspNetCore.Identity;
using WebDoorCreator.Data.DbModels;
using WebDoorCreator.Data.Services;
using WebDoorCreator.UI.Data;
namespace WebDoorCreator.UI.Components.Gen
@@ -1,6 +1,7 @@
using Microsoft.AspNetCore.Components;
using Newtonsoft.Json;
using WebDoorCreator.Data.DbModels;
using WebDoorCreator.Data.Services;
using WebDoorCreator.UI.Data;
namespace WebDoorCreator.UI.Components.Hardware
@@ -21,7 +22,6 @@ namespace WebDoorCreator.UI.Components.Hardware
[CascadingParameter]
public string UserId { get; set; } = "";
#endregion Public Properties
#region Protected Properties
@@ -43,6 +43,21 @@ namespace WebDoorCreator.UI.Components.Hardware
#region Protected Methods
protected int getInstNumber(string hwCode)
{
int answ = 0;
if (DoorOpList != null)
{
answ = DoorOpList
.Where(x => x.ObjectId == hwCode)
.ToList()
.Count();
}
return answ;
}
protected async Task hwToAdd()
{
await Task.Delay(1);
@@ -200,6 +215,15 @@ namespace WebDoorCreator.UI.Components.Hardware
return answ;
}
protected async Task setRefOnDelete(bool isDel)
{
if (isDel)
{
HwToShow = null;
await ReloadData();
}
}
//CultureInfo ci = CultureInfo.InstalledUICulture;
protected string translate(string lemma)
{
@@ -236,30 +260,6 @@ namespace WebDoorCreator.UI.Components.Hardware
}
}
protected async Task setRefOnDelete(bool isDel)
{
if (isDel)
{
HwToShow = null;
await ReloadData();
}
}
protected int getInstNumber(string hwCode)
{
int answ = 0;
if (DoorOpList != null)
{
answ = DoorOpList
.Where(x => x.ObjectId == hwCode)
.ToList()
.Count();
}
return answ;
}
#endregion Private Methods
}
}
@@ -1,6 +1,7 @@
using Microsoft.AspNetCore.Components;
using Newtonsoft.Json;
using WebDoorCreator.Data.DbModels;
using WebDoorCreator.Data.Services;
using WebDoorCreator.UI.Components.SvgComp;
using WebDoorCreator.UI.Data;
using static WebDoorCreator.UI.Data.WDCRefreshService;
@@ -2,6 +2,7 @@
using Microsoft.AspNetCore.Components;
using WebDoorCreator.Data.DbModels;
using WebDoorCreator.Data.DTO;
using WebDoorCreator.Data.Services;
using WebDoorCreator.UI.Data;
namespace WebDoorCreator.UI.Components.Order
@@ -10,7 +11,14 @@ namespace WebDoorCreator.UI.Components.Order
{
#region Public Properties
protected DataPager? pagerDoors = null!;
[Parameter]
public EventCallback<bool> E_isEmpty { get; set; }
[Parameter]
public EventCallback<DoorModel> E_SendDoor { get; set; }
[Parameter]
public OrderStatusViewModel? OrderView { get; set; }
public string userId
{
@@ -19,23 +27,24 @@ namespace WebDoorCreator.UI.Components.Order
return WDCUService.userId;
}
}
[Parameter]
public EventCallback<DoorModel> E_SendDoor { get; set; }
protected async Task SetCurrDoor(DoorModel door)
{
await Task.Delay(1);
//currDoor = door;
await E_SendDoor.InvokeAsync(door);
}
#endregion Public Properties
#region Protected Fields
protected DataPager? pagerDoors = null!;
#endregion Protected Fields
#region Protected Properties
protected DoorModel? currDoor { get; set; } = null;
protected int currDoorType { get; set; } = 0;
[Parameter]
public OrderStatusViewModel? OrderView { get; set; }
protected DDFDto CurrentConf { get; set; } = new DDFDto();
protected DoorsSelectFilter currFilter { get; set; } = new DoorsSelectFilter();
/// <summary>
/// Unit di misura selezionata
@@ -43,15 +52,27 @@ namespace WebDoorCreator.UI.Components.Order
protected string currMeaUnit { get; set; } = "mm";
protected List<DoorModel>? DoorsList { get; set; } = null;
protected WebDoorCreator.Data.DbModels.Edges edgesFirstInst { get; set; } = new WebDoorCreator.Data.DbModels.Edges();
protected int idOrd { get; set; } = -1;
protected int orderStat { get; set; } = -1;
[Inject]
protected NavigationManager NavManager { get; set; } = null!;
protected int orderStat { get; set; } = -1;
protected OrderStatusViewModel? OrderStatus { get; set; } = null;
protected string stepColor { get; set; } = "";
protected int totalCount { get; set; }
protected int userCurrCompany
{
get => WDCUService.userCurrComp;
}
[Inject]
protected WDCUserService WDCUService { get; set; } = null!;
@@ -62,11 +83,8 @@ namespace WebDoorCreator.UI.Components.Order
#region Protected Methods
protected DDFDto CurrentConf { get; set; } = new DDFDto();
protected async Task createDoor()
{
int doorId = await WDService.createDoor(idOrd, userId, currMeaUnit);
if (doorId > 0)
{
@@ -77,20 +95,32 @@ namespace WebDoorCreator.UI.Components.Order
NavManager.NavigateTo($"DoorDefinition?idOrd={idOrd}&idDoor={doorId}");
}
protected int userCurrCompany
protected void ForceReload(int newNum)
{
get => WDCUService.userCurrComp;
numRecord = newNum;
}
protected async override Task OnParametersSetAsync()
protected void ForceReloadPage(int newNum)
{
await Task.Delay(1);
currPage = newNum;
}
protected string stepColor { get; set; } = "";
protected override async Task OnParametersSetAsync()
{
await Task.Delay(1);
}
protected async Task SetCurrDoor(DoorModel door)
{
await Task.Delay(1);
//currDoor = door;
await E_SendDoor.InvokeAsync(door);
}
protected async Task setEmpty()
{
await E_isEmpty.InvokeAsync(true);
}
protected async Task setStepColor(string StepColor)
{
@@ -99,22 +129,14 @@ namespace WebDoorCreator.UI.Components.Order
StateHasChanged();
}
[Parameter]
public EventCallback<bool> E_isEmpty { get; set; }
protected async Task setEmpty()
protected void UpdateTotCount(int newTotCount)
{
await E_isEmpty.InvokeAsync(true);
totalCount = newTotCount;
}
#endregion Protected Methods
#region Private Fields
#endregion Private Fields
protected DoorsSelectFilter currFilter { get; set; } = new DoorsSelectFilter();
#region Private Properties
private int currPage
{
@@ -129,27 +151,16 @@ namespace WebDoorCreator.UI.Components.Order
get => currFilter.NumRec;
set => currFilter.NumRec = value;
}
private string searchValue
{
get => currFilter.searchValue;
set => currFilter.searchValue = value;
}
protected int totalCount { get; set; }
#endregion Private Properties
protected void ForceReload(int newNum)
{
numRecord = newNum;
}
protected void ForceReloadPage(int newNum)
{
currPage = newNum;
}
protected void UpdateTotCount(int newTotCount)
{
totalCount = newTotCount;
}
#region Private Methods
private async Task updateFilter(DoorsSelectFilter newParams)
{
@@ -162,5 +173,7 @@ namespace WebDoorCreator.UI.Components.Order
currFilter = newParams;
isLoading = false;
}
#endregion Private Methods
}
}
@@ -10,6 +10,7 @@ using Microsoft.JSInterop;
using NLog.LayoutRenderers;
using System.Linq;
using WebDoorCreator.Data.DbModels;
using WebDoorCreator.Data.Services;
using WebDoorCreator.UI.Data;
using static Microsoft.AspNetCore.Razor.Language.TagHelperMetadata;
using static WebDoorCreator.Core.Enum;
@@ -1,6 +1,7 @@
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Server.ProtectedBrowserStorage;
using WebDoorCreator.Data.DbModels;
using WebDoorCreator.Data.Services;
using WebDoorCreator.UI.Data;
namespace WebDoorCreator.UI.Components.Order
@@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Razor.Language.Extensions;
using Microsoft.Build.Framework;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using WebDoorCreator.Data.DbModels;
using WebDoorCreator.Data.Services;
using WebDoorCreator.UI.Data;
namespace WebDoorCreator.UI.Components.Report
@@ -1,6 +1,7 @@
using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
using WebDoorCreator.Data.DbModels;
using WebDoorCreator.Data.Services;
using WebDoorCreator.UI.Data;
namespace WebDoorCreator.UI.Components.Users
@@ -2,6 +2,7 @@ using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.WebUtilities;
using Newtonsoft.Json;
using WebDoorCreator.Data.DbModels;
using WebDoorCreator.Data.Services;
using WebDoorCreator.UI.Data;
namespace WebDoorCreator.UI.Pages
@@ -5,6 +5,7 @@ using Microsoft.JSInterop;
using System;
using System.Runtime.InteropServices;
using WebDoorCreator.Data.DbModels;
using WebDoorCreator.Data.Services;
using WebDoorCreator.UI.Data;
namespace WebDoorCreator.UI.Pages
@@ -6,6 +6,7 @@ using Microsoft.AspNetCore.WebUtilities;
using System.Text;
using System.Text.Encodings.Web;
using WebDoorCreator.Data.DbModels;
using WebDoorCreator.Data.Services;
using WebDoorCreator.UI.Data;
namespace WebDoorCreator.UI.Pages
+3 -2
View File
@@ -1,5 +1,6 @@
@using WebDoorCreator.UI.Components.SvgComp
@using WebDoorCreator.UI.Data
@using WebDoorCreator.Data.Services;
@using WebDoorCreator.UI.Components.SvgComp
@using WebDoorCreator.Data
@page "/TestAnim"
@inject WebDoorCreatorService WDCService
+2 -1
View File
@@ -1,4 +1,5 @@
@using WebDoorCreator.UI.Components.SvgComp
@using WebDoorCreator.Data.Services;
@using WebDoorCreator.UI.Components.SvgComp
@using WebDoorCreator.UI.Data
@page "/TestPage"
+3 -2
View File
@@ -6,6 +6,9 @@
@using Microsoft.AspNetCore.Components.Web
@using Microsoft.AspNetCore.Components.Web.Virtualization
@using Microsoft.JSInterop
@using EgwCoreLib.Razor
@using WebDoorCreator.Data
@using WebDoorCreator.Data.DbModels
@using WebDoorCreator.UI
@using WebDoorCreator.UI.Components
@using WebDoorCreator.UI.Components.Buttons
@@ -20,7 +23,5 @@
@using WebDoorCreator.UI.Components.Filters
@using WebDoorCreator.UI.Components.Report
@using WebDoorCreator.UI.Shared
@using WebDoorCreator.Data.DbModels
@using EgwCoreLib.Razor