Merge branch 'release/ResourceService01'
This commit is contained in:
+2
-3
@@ -204,8 +204,7 @@ EgwProxy.MagMan:release:
|
||||
- *nuspec-fix
|
||||
script:
|
||||
- dotnet build "$env:APP_NAME\$env:APP_NAME.csproj"
|
||||
#- '& "$env:MSBUILD_PATH" "$env:APP_NAME\$env:APP_NAME.csproj" -target:Build /p:Configuration=$env:CONFIG /p:Platform="Any CPU" /p:OutputPath=bin/$env:CONFIG /verbosity:minimal /m'
|
||||
- '& Remove-Item *.nupkg'
|
||||
- '& $env:NUGET_PATH pack "$env:APP_NAME.Debug.nuspec"'
|
||||
- '& $env:NUGET_PATH pack "$env:APP_NAME.Release.nuspec"'
|
||||
- '& "$env:NUGET_PATH" setapikey $NUGET_API_KEY -source http://nexus.steamware.net/repository/nuget-hosted'
|
||||
- '& "$env:NUGET_PATH" push *$env:NUM_DEB.nupkg -Source http://nexus.steamware.net/repository/nuget-hosted'
|
||||
- '& "$env:NUGET_PATH" push *$env:NUM_REL.nupkg -Source http://nexus.steamware.net/repository/nuget-hosted'
|
||||
@@ -1,5 +1,6 @@
|
||||
using Blazored.LocalStorage;
|
||||
using Blazored.SessionStorage;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using NLog;
|
||||
using StackExchange.Redis;
|
||||
using System.Diagnostics;
|
||||
@@ -25,14 +26,11 @@ namespace MagMan.Core.Services
|
||||
#region Public Events
|
||||
|
||||
public event Action EA_FilterUpdated = null!;
|
||||
|
||||
public event Action EA_HideSearch = null!;
|
||||
|
||||
public event Action EA_PageUpdated = null!;
|
||||
|
||||
public event Action EA_SearchUpdated = null!;
|
||||
|
||||
public event Action EA_ShowSearch = null!;
|
||||
public event Action EA_CustomerSel = null!;
|
||||
|
||||
#endregion Public Events
|
||||
|
||||
@@ -93,7 +91,6 @@ namespace MagMan.Core.Services
|
||||
if (_searchVal != value)
|
||||
{
|
||||
_searchVal = value;
|
||||
|
||||
if (EA_SearchUpdated != null)
|
||||
{
|
||||
EA_SearchUpdated?.Invoke();
|
||||
@@ -101,6 +98,21 @@ namespace MagMan.Core.Services
|
||||
}
|
||||
}
|
||||
}
|
||||
public int CustomerID
|
||||
{
|
||||
get => _customerID;
|
||||
set
|
||||
{
|
||||
if (_customerID != value)
|
||||
{
|
||||
_customerID = value;
|
||||
if (EA_CustomerSel != null)
|
||||
{
|
||||
EA_CustomerSel?.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string SelOrderCode { get; set; } = "";
|
||||
public string SelPlantId { get; set; } = "0";
|
||||
@@ -488,6 +500,7 @@ namespace MagMan.Core.Services
|
||||
private string _pageIcon = "";
|
||||
private string _pageName = "";
|
||||
private string _searchVal = "";
|
||||
private int _customerID = -1;
|
||||
private bool _showSearch = false;
|
||||
private Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
|
||||
@@ -439,7 +439,12 @@ namespace MagMan.Data.Admin.Services
|
||||
if (custRow != null)
|
||||
{
|
||||
answ = custRow.MainKey;
|
||||
CustMKeyList.Add(CustID, answ);
|
||||
try
|
||||
{
|
||||
CustMKeyList.Add(CustID, answ);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
Log.Info($"TokenMKeyList: added {CustID} --> {answ}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -278,7 +278,7 @@ namespace MagMan.Data.Tenant.Controllers
|
||||
} /// <summary>
|
||||
|
||||
/// Elenco Materiali gestiti a magazzino </summary> <param name="connString">Stringa
|
||||
/// connessione (variabile x cliente)</param> <param name="numKey">Materiale richiesto, 0
|
||||
/// connessione (variabile x cliente)</param> <param name="projDbId">Materiale richiesto, 0
|
||||
/// = tutti</param> <param name="withChild">Se true allora include record child
|
||||
/// (Items)</param> <returns></returns>
|
||||
public List<MaterialModel> MaterialGetFilt(string connString, int matID, bool withChild)
|
||||
@@ -420,16 +420,16 @@ namespace MagMan.Data.Tenant.Controllers
|
||||
/// Elenco Items gestiti a magazzino dato Materiale
|
||||
/// </summary>
|
||||
/// <param name="connString">Stringa connessione (variabile x cliente)</param>
|
||||
/// <param name="numKey">ID del materiale x cui filtrare, 0 = tutti</param>
|
||||
/// <param name="machineID">ID macchina, 0 = tutti</param>
|
||||
/// <returns></returns>
|
||||
public List<ProjModel> ProjectGetByNumKey(string connString, int numKey)
|
||||
public List<ProjModel> ProjectGetByMachine(string connString, int machineID)
|
||||
{
|
||||
List<ProjModel> dbResult = new List<ProjModel>();
|
||||
using (MagManContext dbCtx = new MagManContext(connString))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetProjects
|
||||
.Where(x => numKey == 0 || x.KeyNum == numKey)
|
||||
.Where(x => machineID == 0 || x.MachineID == machineID)
|
||||
.OrderBy(x => x.DtCreated)
|
||||
.ToList();
|
||||
}
|
||||
@@ -523,6 +523,148 @@ namespace MagMan.Data.Tenant.Controllers
|
||||
return done;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco risorse dato progetto e stato
|
||||
/// </summary>
|
||||
/// <param name="connString">Stringa connessione (variabile x cliente)</param>
|
||||
/// <param name="projDbId">ID progetto</param>
|
||||
/// <param name="isEstim">true = ultima stima attiva / false = consumi effettivi</param>
|
||||
/// <returns></returns>
|
||||
public List<ResourceModel> ResourcesGetByProject(string connString, int projDbId, bool isEstim)
|
||||
{
|
||||
List<ResourceModel> dbResult = new List<ResourceModel>();
|
||||
using (MagManContext dbCtx = new MagManContext(connString))
|
||||
{
|
||||
if (isEstim)
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetResources
|
||||
.Where(x => x.RequestNav.ProjDbId == projDbId && x.RequestNav.IsActive && x.RequestNav.ReqState > Core.Enums.ProjResState.ND)
|
||||
.OrderBy(x => x.ResourceId)
|
||||
.ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetResources
|
||||
.Where(x => x.RequestNav.ProjDbId == projDbId && x.RequestNav.IsActive && x.RequestNav.ReqState == Core.Enums.ProjResState.Consumed)
|
||||
.OrderBy(x => x.ResourceId)
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Aggiunge/Modifica un record ReqPlan
|
||||
/// </summary>
|
||||
/// <param name="connString">Stringa connessione (variabile x cliente)</param>
|
||||
/// <param name="rec2upd">Record da aggiungere/aggiornare</param>
|
||||
/// <returns></returns>
|
||||
public int ReqPlanUpdate(string connString, RequestPlanModel rec2upd)
|
||||
{
|
||||
int newId = 0;
|
||||
using (MagManContext dbCtx = new MagManContext(connString))
|
||||
{
|
||||
try
|
||||
{
|
||||
/*
|
||||
* Ricerca x Id corrispondente
|
||||
* */
|
||||
var currData = dbCtx
|
||||
.DbSetReqPlan
|
||||
.Where(x => x.RequestId == rec2upd.RequestId)
|
||||
.FirstOrDefault();
|
||||
|
||||
// aggiorno
|
||||
if (currData != null)
|
||||
{
|
||||
currData.ProjDbId = rec2upd.ProjDbId;
|
||||
currData.DtRequest = rec2upd.DtRequest;
|
||||
currData.ReqState = rec2upd.ReqState;
|
||||
currData.IsActive = rec2upd.IsActive;
|
||||
dbCtx.Entry(currData).State = EntityState.Modified;
|
||||
}
|
||||
else
|
||||
{
|
||||
// se NON di consumo prima rendo disattivi altri....
|
||||
if (rec2upd.ReqState > Core.Enums.ProjResState.Consumed)
|
||||
{
|
||||
var rec2disable = dbCtx
|
||||
.DbSetReqPlan
|
||||
.Where(x => x.IsActive && x.ProjDbId == rec2upd.ProjDbId && x.ReqState > Core.Enums.ProjResState.Consumed)
|
||||
.ToList();
|
||||
if (rec2disable != null)
|
||||
{
|
||||
foreach (var recAct in rec2disable)
|
||||
{
|
||||
recAct.IsActive = false;
|
||||
dbCtx.Entry(recAct).State = EntityState.Modified;
|
||||
}
|
||||
}
|
||||
}
|
||||
// aggiungo record
|
||||
dbCtx
|
||||
.DbSetReqPlan
|
||||
.Add(rec2upd);
|
||||
}
|
||||
dbCtx.SaveChanges();
|
||||
newId = rec2upd.RequestId;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione in ReqPlanUpdate{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return newId;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Aggiunge/Modifica un record Resource
|
||||
/// </summary>
|
||||
/// <param name="connString">Stringa connessione (variabile x cliente)</param>
|
||||
/// <param name="rec2upd">Record da aggiungere/aggiornare</param>
|
||||
/// <returns></returns>
|
||||
public int ResourceUpdate(string connString, ResourceModel rec2upd)
|
||||
{
|
||||
int newId = 0;
|
||||
using (MagManContext dbCtx = new MagManContext(connString))
|
||||
{
|
||||
try
|
||||
{
|
||||
/*
|
||||
* Ricerca x Id corrispondente
|
||||
* */
|
||||
var currData = dbCtx
|
||||
.DbSetResources
|
||||
.Where(x => x.ResourceId == rec2upd.ResourceId)
|
||||
.FirstOrDefault();
|
||||
|
||||
// aggiorno
|
||||
if (currData != null)
|
||||
{
|
||||
currData.Qty = rec2upd.Qty;
|
||||
currData.RawItemId = rec2upd.RawItemId;
|
||||
dbCtx.Entry(currData).State = EntityState.Modified;
|
||||
}
|
||||
else
|
||||
{
|
||||
// aggiungo record
|
||||
dbCtx
|
||||
.DbSetResources
|
||||
.Add(rec2upd);
|
||||
}
|
||||
dbCtx.SaveChanges();
|
||||
newId = rec2upd.RequestId;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione in ResourceUpdate{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return newId;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
@@ -545,19 +545,19 @@ namespace MagMan.Data.Tenant.Services
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Lista Items gestiti a magazzino x materiale
|
||||
/// Lista progetti x macchina
|
||||
/// </summary>
|
||||
/// <param name="nKey">Key di riferimento</param>
|
||||
/// <param name="numKey">ID del materiale x cui filtrare, 0 = tutti</param>
|
||||
/// <param name="machineId">ID macchina, 0 = tutti</param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<ProjModel>> ProjectGetByNumKey(int nKey, int numKey)
|
||||
public async Task<List<ProjModel>> ProjectGetByMachine(int nKey, int machineId)
|
||||
{
|
||||
string source = "DB";
|
||||
string cString = ConnString(nKey);
|
||||
List<ProjModel>? dbResult = new List<ProjModel>();
|
||||
try
|
||||
{
|
||||
string currKey = $"{Const.rKeyConfig}:{nKey}:ProjList:{numKey}";
|
||||
string currKey = $"{Const.rKeyConfig}:{nKey}:ProjList:{machineId}";
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
string? rawData = await redisDb.StringGetAsync(currKey);
|
||||
@@ -576,7 +576,7 @@ namespace MagMan.Data.Tenant.Services
|
||||
}
|
||||
else
|
||||
{
|
||||
dbResult = dbController.ProjectGetByNumKey(cString, numKey);
|
||||
dbResult = dbController.ProjectGetByMachine(cString, machineId);
|
||||
rawData = JsonConvert.SerializeObject(dbResult, JSSettings);
|
||||
await redisDb.StringSetAsync(currKey, rawData, LongCache);
|
||||
}
|
||||
@@ -586,11 +586,11 @@ namespace MagMan.Data.Tenant.Services
|
||||
}
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Debug($"ProjectGetByNumKey | {source} in: {ts.TotalMilliseconds} ms");
|
||||
Log.Debug($"ProjectGetByMachine | {source} in: {ts.TotalMilliseconds} ms");
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Error during ProjectGetByNumKey:{Environment.NewLine}{exc}");
|
||||
Log.Error($"Error during ProjectGetByMachine:{Environment.NewLine}{exc}");
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
@@ -620,6 +620,126 @@ namespace MagMan.Data.Tenant.Services
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Aggiunge/Modifica un record ReqPlan
|
||||
/// </summary>
|
||||
/// <param name="nKey">Key di riferimento</param>
|
||||
/// <param name="currItem">Record da aggiungere/aggiornare</param>
|
||||
/// <returns></returns>
|
||||
public async Task<int> ReqPlanUpdate(int nKey, RequestPlanModel currItem)
|
||||
{
|
||||
int newId = 0;
|
||||
string cString = ConnString(nKey);
|
||||
try
|
||||
{
|
||||
newId = dbController.ReqPlanUpdate(cString, currItem);
|
||||
if (newId > 0)
|
||||
{
|
||||
await FlushRedisCache();
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Error during ReqPlanUpdate:{Environment.NewLine}{exc}");
|
||||
}
|
||||
return newId;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converte il DTO in ResourceModel
|
||||
/// </summary>
|
||||
/// <param name="origItem">DTO di partenza</param>
|
||||
/// <returns></returns>
|
||||
public ResourceModel ResourceFromDto(ResourceDTO origItem, int reqId)
|
||||
{
|
||||
ResourceModel answ = new ResourceModel()
|
||||
{
|
||||
Qty = origItem.Qty,
|
||||
RawItemId = origItem.RawItemId,
|
||||
RequestId = reqId,
|
||||
ResourceId = 0
|
||||
};
|
||||
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco risorse dato progetto e stato
|
||||
/// </summary>
|
||||
/// <param name="nKey">Key di riferimento</param>
|
||||
/// <param name="projDbId">ID progetto</param>
|
||||
/// <param name="isEstim">true = ultima stima attiva / false = consumi effettivi</param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<ResourceModel>> ResourcesGetByProject(int nKey, int projDbId, bool isEstim)
|
||||
{
|
||||
string source = "DB";
|
||||
string cString = ConnString(nKey);
|
||||
List<ResourceModel>? dbResult = new List<ResourceModel>();
|
||||
try
|
||||
{
|
||||
string currKey = $"{Const.rKeyConfig}:{nKey}:ResList:{projDbId}:{isEstim}";
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
string? rawData = await redisDb.StringGetAsync(currKey);
|
||||
if (!string.IsNullOrEmpty(rawData))
|
||||
{
|
||||
source = "REDIS";
|
||||
var tempResult = JsonConvert.DeserializeObject<List<ResourceModel>>(rawData);
|
||||
if (tempResult == null)
|
||||
{
|
||||
dbResult = new List<ResourceModel>();
|
||||
}
|
||||
else
|
||||
{
|
||||
dbResult = tempResult;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dbResult = dbController.ResourcesGetByProject(cString, projDbId, isEstim);
|
||||
rawData = JsonConvert.SerializeObject(dbResult, JSSettings);
|
||||
await redisDb.StringSetAsync(currKey, rawData, FastCache);
|
||||
}
|
||||
if (dbResult == null)
|
||||
{
|
||||
dbResult = new List<ResourceModel>();
|
||||
}
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Debug($"ResourcesGetByProject | {source} in: {ts.TotalMilliseconds} ms");
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Error during ResourcesGetByProject:{Environment.NewLine}{exc}");
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Aggiunge/Modifica un record Resource
|
||||
/// </summary>
|
||||
/// <param name="nKey">Key di riferimento</param>
|
||||
/// <param name="currItem">Record da aggiungere/aggiornare</param>
|
||||
/// <returns></returns>
|
||||
public async Task<int> ResourceUpdate(int nKey, ResourceModel currItem)
|
||||
{
|
||||
int newId = 0;
|
||||
string cString = ConnString(nKey);
|
||||
try
|
||||
{
|
||||
newId = dbController.ResourceUpdate(cString, currItem);
|
||||
if (newId > 0)
|
||||
{
|
||||
await FlushRedisCache();
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Error during ResourceUpdate:{Environment.NewLine}{exc}");
|
||||
}
|
||||
return newId;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
<div class="alert alert-info">
|
||||
<div class="fs-2">
|
||||
Customer Undef
|
||||
</div>
|
||||
Prego selezionare Cliente per visualizzare i dati relativi
|
||||
</div>
|
||||
|
||||
@code {
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
<div class="input-group">
|
||||
<div class="input-group input-group-sm">
|
||||
<label class="input-group-text">Cliente</label>
|
||||
<select class="form-select" @bind="@CustomerID">
|
||||
<option value="0">--- Selezionare Cliente ---</option>
|
||||
|
||||
@@ -7,13 +7,6 @@ namespace MagMan.UI.Components
|
||||
{
|
||||
public partial class CmpSelCliente
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<int> E_CustSelected { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
@@ -27,8 +20,9 @@ namespace MagMan.UI.Components
|
||||
if (customerID != value)
|
||||
{
|
||||
customerID = value;
|
||||
E_CustSelected.InvokeAsync(value);
|
||||
InvokeAsync(() => AppMService.ClientIdSet(value));
|
||||
AppMService.CustomerID = value;
|
||||
InvokeAsync(StateHasChanged);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -42,7 +36,10 @@ namespace MagMan.UI.Components
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
CustomerID = await AppMService.ClientIdGet();
|
||||
if (firstRender || CustomerID < 0)
|
||||
{
|
||||
CustomerID = await AppMService.ClientIdGet();
|
||||
}
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
@@ -59,7 +56,7 @@ namespace MagMan.UI.Components
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private int customerID = 0;
|
||||
private int customerID = -1;
|
||||
|
||||
private List<CustomerModel>? CustomersList = null;
|
||||
|
||||
|
||||
@@ -1,14 +1,23 @@
|
||||
<div class="row pt-3">
|
||||
<div class="col-7 col-md-6 col-lg-4 col-xl-3">
|
||||
<div class="col-6 col-md-6 col-lg-4">
|
||||
<LoginDisplay></LoginDisplay>
|
||||
</div>
|
||||
<div class="col-12 col-lg-4 col-xl-6 d-none d-lg-block text-center h4 text-truncate">
|
||||
<div class="col-12 col-lg-4 d-none d-lg-block text-center h4 text-truncate">
|
||||
<span><i class="@PageIcon" aria-hidden="true"></i> @PageName</span>
|
||||
</div>
|
||||
<div class="col-5 col-md-6 col-lg-4 col-xl-3 text-right">
|
||||
<div class="col-6 col-md-6 col-lg-4 text-end d-flex flex-row-reverse">
|
||||
@if (ShowSearch)
|
||||
{
|
||||
<SearchMod></SearchMod>
|
||||
<div class="w-50">
|
||||
<SearchMod></SearchMod>
|
||||
</div>
|
||||
}
|
||||
<div class="w-50">
|
||||
<AuthorizeView Roles="SuperAdmin, Admin">
|
||||
<Authorized>
|
||||
<CmpSelCliente></CmpSelCliente>
|
||||
</Authorized>
|
||||
</AuthorizeView>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -41,11 +41,6 @@ namespace MagMan.UI.Components
|
||||
AppMessages.EA_PageUpdated += OnPageUpdate;
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await Task.Delay(0);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Properties
|
||||
@@ -57,6 +52,8 @@ namespace MagMan.UI.Components
|
||||
[CascadingParameter(Name = "ShowSearch")]
|
||||
private bool ShowSearch { get; set; } = false;
|
||||
|
||||
|
||||
|
||||
#endregion Private Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-2">
|
||||
<h3>Progetti</h3>
|
||||
</div>
|
||||
<div class="px-2">
|
||||
<div class="d-flex">
|
||||
@* <div class="px-2">
|
||||
@if (CurrItem == null)
|
||||
{
|
||||
<button class="btn btn-success" @onclick="()=>CreateNew()"><i class="fa-solid fa-square-plus"></i> Add New</button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button class="btn btn-warning" @onclick="()=> DoEdit(null)"><i class="fa-solid fa-ban"></i> Cancel</button>
|
||||
}
|
||||
</div> *@
|
||||
@* <div class="px-2">
|
||||
<div class="input-group">
|
||||
<span class="input-group-text" id="basic-addon1">Tipo Mat.</span>
|
||||
<select class="form-select" @bind="@FiltType">
|
||||
<option value="0">--- Tutti ---</option>
|
||||
<option value="1">Beam</option>
|
||||
<option value="2">Wall</option>
|
||||
</select>
|
||||
</div>
|
||||
</div> *@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@if (CurrItem != null)
|
||||
{
|
||||
@*<hr />
|
||||
<MaterialEdit CurrRecord="CurrItem" EC_update="ForceReload"></MaterialEdit> *@
|
||||
}
|
||||
</div>
|
||||
<div class="card-body p-1">
|
||||
@if (ListRecords == null || isLoading)
|
||||
{
|
||||
<EgwCoreLib.Razor.LoadingData></EgwCoreLib.Razor.LoadingData>
|
||||
}
|
||||
else if (totalCount == 0)
|
||||
{
|
||||
<div class="alert alert-info">Nessun record trovato</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<table class="table table-striped table-sm text-start">
|
||||
<thead>
|
||||
<tr class="">
|
||||
<th>
|
||||
<button class="btn btn-primary btn-sm" @onclick="() => DoSelect(null)"><i class="fa-solid fa-rotate"></i></button>
|
||||
</th>
|
||||
<th>ID <Sorter ParamName="ID" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th>Descr. <Sorter ParamName="ProjDescription" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th>Filename <Sorter ParamName="BTLFileName" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
@if (ProjDbId == 0)
|
||||
{
|
||||
<th>Macchina <Sorter ParamName="Machine" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
}
|
||||
<th class="text-end">Creato <Sorter ParamName="DtCreated" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th class="text-end">Previsione <Sorter ParamName="DtSchedule" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
<th class="text-end">Prod <Sorter ParamName="DtStartProd" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
@* <th class="text-end">Arch <Sorter ParamName="IsArchived" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th> *@
|
||||
<th class="text-end">Time <Sorter ParamName="ProcTimeEst" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
|
||||
@* <th class="text-end"></th> *@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in ListRecords)
|
||||
{
|
||||
<tr class="align-middle @CheckSel(item)">
|
||||
<td>
|
||||
<button class="btn btn-info btn-sm" @onclick="() => DoSelect(item)"><i class="fa-solid fa-search"></i></button>
|
||||
@* <button class="btn btn-primary btn-sm" @onclick="() => DoEdit(item)"><i class="fa-solid fa-edit"></i></button> *@
|
||||
</td>
|
||||
<td>
|
||||
<span title="@($"DB Id: {item.ProjExtDbId} | Ext.Id: {item.ProjExtId}")">
|
||||
@if (item.PType == Enums.BWType.BEAM)
|
||||
{
|
||||
<span class="border border-primary rounded px-1">
|
||||
<i class="fa-solid fa-lines-leaning"></i>
|
||||
</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span class="border border-info rounded px-1">
|
||||
<i class="fa-solid fa-draw-polygon"></i>
|
||||
</span>
|
||||
}
|
||||
@item.ProjExtId
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
@item.ProjDescription
|
||||
</td>
|
||||
<td>
|
||||
@item.BTLFileName
|
||||
</td>
|
||||
@if (ProjDbId == 0)
|
||||
{
|
||||
<td>
|
||||
@item.Machine
|
||||
</td>
|
||||
}
|
||||
<td class="text-end">
|
||||
@($"{item.DtCreated:yyyy-MM-dd}")
|
||||
</td>
|
||||
<td class="text-end">
|
||||
@($"{item.DtSchedule:yyyy-MM-dd}")
|
||||
</td>
|
||||
<td class="text-end">
|
||||
@if (item.DtStartProd > DateTime.MinValue)
|
||||
{
|
||||
@($"{item.DtStartProd:yyyy-MM-dd}")
|
||||
}
|
||||
else
|
||||
{
|
||||
<span>n.a.</span>
|
||||
}
|
||||
</td>
|
||||
@* <td class="text-end">
|
||||
@item.IsArchived
|
||||
</td> *@
|
||||
<td class="text-end">
|
||||
@if (item.ProcTimeReal > 0)
|
||||
{
|
||||
<span class="fw-bold" title="Reale">@($"{item.ProcTimeReal:N1}") min</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span class="text-secondary" title="Stima">@($"{item.ProcTimeEst:N1}") min</span>
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<EgwCoreLib.Razor.DataPager PageSize="@numRecord" currPage="@currPage" numRecordChanged="SetNumRec" numPageChanged="SetPage" totalCount="@totalCount" showLoading="@isLoading"></EgwCoreLib.Razor.DataPager>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -0,0 +1,417 @@
|
||||
using EgwCoreLib.Razor;
|
||||
using MagMan.Core.Services;
|
||||
using MagMan.Data.Tenant.DbModels;
|
||||
using MagMan.Data.Tenant.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
|
||||
namespace MagMan.UI.Components
|
||||
{
|
||||
public partial class ProjectMan
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public int CustomerId { get; set; } = 0;
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<ProjModel?> E_ProjSel { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public int KeyNum { get; set; } = 0;
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected MessageService AppMService { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected IConfiguration Configuration { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; } = null!;
|
||||
|
||||
protected int totalCount { get; set; } = 0;
|
||||
|
||||
[Inject]
|
||||
protected TenantService TService { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected string CheckSel(ProjModel curItem)
|
||||
{
|
||||
string answ = "";
|
||||
if (CurrItem != null)
|
||||
{
|
||||
answ = curItem.ProjDbId == CurrItem.ProjDbId ? "table-info" : "";
|
||||
}
|
||||
else
|
||||
{
|
||||
answ = curItem.ProjDbId == ProjDbId ? "table-info" : "";
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected async Task DeleteRecord(ProjModel selItem)
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sicuro di voler eliminare il record?"))
|
||||
return;
|
||||
await TService.ProjectDelete(KeyNum, selItem);
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
#if false
|
||||
protected void DoEdit(ProjModel? selItem)
|
||||
{
|
||||
CurrItem = selItem;
|
||||
if (selItem == null)
|
||||
{
|
||||
DoSelect(null);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
protected void DoSelect(ProjModel? selItem)
|
||||
{
|
||||
if (selItem != null)
|
||||
{
|
||||
ProjDbId = selItem.ProjDbId;
|
||||
}
|
||||
else
|
||||
{
|
||||
ProjDbId = 0;
|
||||
}
|
||||
E_ProjSel.InvokeAsync(selItem);
|
||||
}
|
||||
|
||||
protected async Task ForceReload(bool force)
|
||||
{
|
||||
CurrItem = null;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
currSearch = "";
|
||||
AppMService.EA_SearchUpdated += AppMService_EA_SearchUpdated;
|
||||
}
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected void SetNumRec(int newNum)
|
||||
{
|
||||
numRecord = newNum;
|
||||
currPage = 1;
|
||||
InvokeAsync(ReloadData);
|
||||
}
|
||||
|
||||
protected void SetPage(int newNum)
|
||||
{
|
||||
currPage = newNum;
|
||||
DoSelect(null);
|
||||
InvokeAsync(ReloadData);
|
||||
}
|
||||
|
||||
protected async Task SortRequested(Sorter.SortCallBack e)
|
||||
{
|
||||
sortField = e.ParamName;
|
||||
sortAsc = e.IsAscending;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private ProjModel? CurrItem = null;
|
||||
private string currSearch = "";
|
||||
private int filtType = 0;
|
||||
private List<ProjModel>? ListRecords = null;
|
||||
private int ProjDbId = 0;
|
||||
private List<ProjModel>? SearchRecords = null;
|
||||
|
||||
private bool sortAsc = true;
|
||||
|
||||
private string sortField = "";
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private int currPage { get; set; } = 1;
|
||||
|
||||
private int FiltType
|
||||
{
|
||||
get => filtType;
|
||||
set
|
||||
{
|
||||
if (filtType != value)
|
||||
{
|
||||
filtType = value;
|
||||
InvokeAsync(ReloadData);
|
||||
InvokeAsync(StateHasChanged);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool isLoading { get; set; } = false;
|
||||
|
||||
private int numRecord { get; set; } = 10;
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private async void AppMService_EA_SearchUpdated()
|
||||
{
|
||||
currSearch = AppMService.SearchVal;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
private async Task ReloadData()
|
||||
{
|
||||
isLoading = true;
|
||||
//await InvokeAsync(StateHasChanged);
|
||||
ListRecords = null;
|
||||
SearchRecords = await TService.ProjectGetByMachine(KeyNum, 0);
|
||||
#if false
|
||||
// verifico se filtrare x beam/wall
|
||||
if (FiltType > 0)
|
||||
{
|
||||
SearchRecords = SearchRecords.Where(x => (x.IsBeam && FiltType == 1) || (x.IsWall && FiltType == 2)).ToList();
|
||||
}
|
||||
#endif
|
||||
// verifico filtro per ricerca
|
||||
if (!string.IsNullOrEmpty(currSearch))
|
||||
{
|
||||
SearchRecords = SearchRecords.Where(x => x.ProjDescription.Contains(currSearch, StringComparison.InvariantCultureIgnoreCase) || x.BTLFileName.Contains(currSearch, StringComparison.InvariantCultureIgnoreCase)).ToList();
|
||||
}
|
||||
totalCount = SearchRecords.Count;
|
||||
SortTable();
|
||||
isLoading = false;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
private void SortTable()
|
||||
{
|
||||
if (SearchRecords != null)
|
||||
{
|
||||
// se ho ordinamento riordino...
|
||||
if (!string.IsNullOrEmpty(sortField))
|
||||
{
|
||||
switch (sortField)
|
||||
{
|
||||
case "ID":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.ProjExtId).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.ProjExtId).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
#if false
|
||||
case "MachineID":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.MachineID).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.MachineID).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "ProjExtDbId":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.ProjExtDbId).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.ProjExtDbId).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "ProjExtId":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.ProjExtId).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.ProjExtId).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "BTLFileName":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.BTLFileName).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.BTLFileName).ToList();
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
case "ProjDescription":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.ProjDescription).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.ProjDescription).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
#if false
|
||||
case "PType":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.PType).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.PType).ToList();
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
case "Machine":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.Machine).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.Machine).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "DtCreated":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.DtCreated).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.DtCreated).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "DtSchedule":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.DtSchedule).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.DtSchedule).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "DtStartProd":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.DtStartProd).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.DtStartProd).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "DtLastAction":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.DtLastAction).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.DtLastAction).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "ListName":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.ListName).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.ListName).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "IsActive":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.IsActive).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.IsActive).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "IsArchived":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.IsArchived).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.IsArchived).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "ProcTimeEst":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.ProcTimeEst).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.ProcTimeEst).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// filtro x display
|
||||
ListRecords = SearchRecords
|
||||
.Skip(numRecord * (currPage - 1))
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
ListRecords = new List<ProjModel>();
|
||||
}
|
||||
}
|
||||
|
||||
private string textCss(bool isActive)
|
||||
{
|
||||
return isActive ? "text-dark" : "text-secondary text-decoration-line-through";
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -61,13 +61,21 @@ namespace MagMan.UI.Controllers
|
||||
/// Elenco Macchine dato RestToken
|
||||
/// </summary>
|
||||
/// <param name="id">Rest Token cliente</param>
|
||||
/// <param name="KeyNum">Chiave associata ai progetti</param>
|
||||
/// <param name="projDbId">ID progetto</param>
|
||||
/// <param name="isEstim">true = ultima stima attiva / false = consumi effettivi</param>
|
||||
/// <returns></returns>
|
||||
// GET api/Machines/2cba60c7-7be4-40b1-aa0d-52e7c71fc1a7
|
||||
[HttpGet("{id}")]
|
||||
public async Task<List<MachineModel>> Get(string id, int KeyNum)
|
||||
public async Task<List<ResourceModel>> Get(string id, int projDbId, bool isEstim)
|
||||
{
|
||||
var ListRecords = await MTAdmService.MachineGetByToken(id);
|
||||
List<ResourceModel> ListRecords = new List<ResourceModel>();
|
||||
// verifico ci sia valore
|
||||
if (!string.IsNullOrEmpty(id))
|
||||
{
|
||||
// in primis recupero codice chiave da token...
|
||||
int nKey = await MTAdmService.MainKeyByToken(id);
|
||||
ListRecords = await TService.ResourcesGetByProject(nKey, projDbId, isEstim);
|
||||
}
|
||||
return ListRecords;
|
||||
}
|
||||
|
||||
@@ -89,24 +97,36 @@ namespace MagMan.UI.Controllers
|
||||
int nKey = await MTAdmService.MainKeyByToken(id);
|
||||
if (nKey > 0)
|
||||
{
|
||||
#if false
|
||||
// creo oggetti materiale da lista ricevuta
|
||||
List<RawItemModel> matList = item2Consume.ItemList.Select(jpl => TService.ItemFromDto(jpl, true)).ToList();
|
||||
|
||||
foreach (var item in matList)
|
||||
// in primis registro il record RequestPlan...
|
||||
var recPlan = new RequestPlanModel()
|
||||
{
|
||||
try
|
||||
DtRequest = DateTime.Now,
|
||||
IsActive = true,
|
||||
ReqState = projectData.ReqState,
|
||||
ProjDbId = projectData.ProjDbId
|
||||
};
|
||||
|
||||
int reqId = await TService.ReqPlanUpdate(nKey, recPlan);
|
||||
|
||||
// per ogni riga risorsa registro le info relative...
|
||||
List<ResourceModel> listRes = new List<ResourceModel>();
|
||||
if (projectData.ResourceList != null)
|
||||
{
|
||||
listRes = projectData.ResourceList.Select(x => TService.ResourceFromDto(x, reqId)).ToList();
|
||||
foreach (var item in listRes)
|
||||
{
|
||||
await TService.ItemUpdate(nKey, item);
|
||||
fatto = true;
|
||||
try
|
||||
{
|
||||
await TService.ResourceUpdate(nKey, item);
|
||||
fatto = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"InventoryController.upsert | Errore in fase salvataggio ResourceDto{Environment.NewLine}{exc}");
|
||||
fatto = false;
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"InventoryController.upsert | Errore in fase salvataggio ItemDto{Environment.NewLine}{exc}");
|
||||
fatto = false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
// resetto cache redis
|
||||
await MTAdmService.FlushRedisCache();
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Version>1.0.2401.2309</Version>
|
||||
<Version>1.0.2401.2418</Version>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<EnableNETAnalyzers>true</EnableNETAnalyzers>
|
||||
|
||||
@@ -19,16 +19,14 @@
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="px-0">
|
||||
@if (currMode != CtMode.Company)
|
||||
{
|
||||
<CmpSelCliente E_CustSelected="SaveCust"></CmpSelCliente>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if (currMode == CtMode.Company)
|
||||
@if (currMode == CtMode.Loading)
|
||||
{
|
||||
<LoadingData></LoadingData>
|
||||
}
|
||||
else if (currMode == CtMode.Company)
|
||||
{
|
||||
<CustomerMan></CustomerMan>
|
||||
}
|
||||
else if (currMode == CtMode.Users)
|
||||
|
||||
@@ -11,6 +11,7 @@ namespace MagMan.UI.Pages
|
||||
|
||||
protected enum CtMode
|
||||
{
|
||||
Loading,
|
||||
Company,
|
||||
Users,
|
||||
Machine,
|
||||
@@ -36,12 +37,19 @@ namespace MagMan.UI.Pages
|
||||
AppMService.ShowSearch = false;
|
||||
AppMService.PageName = "Admin Area";
|
||||
AppMService.PageIcon = "fa-solid fa-house pr-2";
|
||||
AppMService.EA_CustomerSel += AppMService_EA_CustomerSel;
|
||||
CustomerID = AppMService.CustomerID;
|
||||
}
|
||||
|
||||
protected void SaveCust(int newCustId)
|
||||
private async void AppMService_EA_CustomerSel()
|
||||
{
|
||||
CustomerID = newCustId;
|
||||
}
|
||||
var actMode = currMode;
|
||||
currMode = CtMode.Loading;
|
||||
CustomerID = AppMService.CustomerID;
|
||||
await Task.Delay(50);
|
||||
currMode = actMode;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
@attribute [AllowAnonymous]
|
||||
|
||||
<div class="mt-4 p-3 bg-light text-dark rounded shadow-lg">
|
||||
<div class="mt-4 p-3 bg-light text-dark border border-light rounded shadow-lg">
|
||||
<div class="row">
|
||||
<div class="col-6 col-md-8 pr-0">
|
||||
<h1>Mag-Man</h1>
|
||||
@@ -42,7 +42,7 @@
|
||||
</div>
|
||||
|
||||
<div class="row px-5">
|
||||
<div class="col-6 col-md-4">
|
||||
<div class="col-6 col-md-3">
|
||||
<AuthorizeView Roles="SuperAdmin, Admin">
|
||||
<Authorized>
|
||||
<NavLink type="button" class="btn btn-block btn-primary text-light p-3 m-2 w-100" title="Scheda Fornitore" href="AdminArea">
|
||||
@@ -52,7 +52,7 @@
|
||||
</Authorized>
|
||||
</AuthorizeView>
|
||||
</div>
|
||||
<div class="col-6 col-md-4">
|
||||
<div class="col-6 col-md-3">
|
||||
<AuthorizeView Roles="SuperAdmin, Admin, User">
|
||||
<Authorized>
|
||||
<NavLink type="button" class="btn btn-block btn-primary text-light p-3 m-2 w-100" title="Stato Impianti" href="MachineStatus">
|
||||
@@ -62,7 +62,17 @@
|
||||
</Authorized>
|
||||
</AuthorizeView>
|
||||
</div>
|
||||
<div class="col-6 col-md-4">
|
||||
<div class="col-6 col-md-3">
|
||||
<AuthorizeView Roles="SuperAdmin, Admin, User">
|
||||
<Authorized>
|
||||
<NavLink type="button" class="btn btn-block btn-primary text-light p-3 m-2 w-100" title="Stato Impianti" href="ProjectsStatus">
|
||||
<i class="fa-solid fa-chart-gantt fa-2x mb-2" aria-hidden="true"></i>
|
||||
<h4>Progetti</h4>
|
||||
</NavLink>
|
||||
</Authorized>
|
||||
</AuthorizeView>
|
||||
</div>
|
||||
<div class="col-6 col-md-3">
|
||||
<AuthorizeView Roles="SuperAdmin, Admin, User">
|
||||
<Authorized>
|
||||
<NavLink type="button" class="btn btn-block btn-primary text-light p-3 m-2 w-100" title="Scheda Stazione" href="WareHouse">
|
||||
|
||||
@@ -1,9 +1,86 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this
|
||||
// file to you under the MIT license.
|
||||
using MagMan.Core.Services;
|
||||
using MagMan.Data.Admin.Services;
|
||||
using MagMan.Data.Tenant.DbModels;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace MagMan.UI.Pages
|
||||
{
|
||||
public partial class MachineStatus
|
||||
{
|
||||
#region Protected Fields
|
||||
|
||||
protected int nKey = 0;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected MessageService AppMService { get; set; } = null!;
|
||||
|
||||
protected string mainCss
|
||||
{
|
||||
get => MaterialSel == null ? "col-12" : "col-6 small";
|
||||
}
|
||||
|
||||
[Inject]
|
||||
protected MTAdminService MTService { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
AppMService.ShowSearch = true;
|
||||
AppMService.PageName = "Dati Macchine";
|
||||
AppMService.PageIcon = "fa-solid fa-screwdriver-wrench pr-2";
|
||||
AppMService.EA_CustomerSel += AppMService_EA_CustomerSel;
|
||||
CustomerID = AppMService.CustomerID;
|
||||
// rileggo dati
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected void SaveMat(MaterialModel? newMat)
|
||||
{
|
||||
MaterialSel = newMat;
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private int KeyNum = 0;
|
||||
private MaterialModel? MaterialSel = null;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private int CustomerID { get; set; } = 0;
|
||||
private bool isLoading { get; set; } = false;
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private async void AppMService_EA_CustomerSel()
|
||||
{
|
||||
CustomerID = AppMService.CustomerID;
|
||||
await Task.Delay(10);
|
||||
await ReloadData();
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
private async Task ReloadData()
|
||||
{
|
||||
isLoading = true;
|
||||
nKey = await MTService.MainKeyByCustomer(CustomerID);
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
@page "/ProjectsStatus"
|
||||
|
||||
<PageTitle>Projects Status</PageTitle>
|
||||
|
||||
@if (isLoading)
|
||||
{
|
||||
<LoadingData></LoadingData>
|
||||
}
|
||||
else if (CustomerID == 0)
|
||||
{
|
||||
<CmpCustomerUndef></CmpCustomerUndef>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="row">
|
||||
<div class="@mainCss">
|
||||
<ProjectMan CustomerId="@CustomerID" KeyNum="@nKey" E_ProjSel="SaveProj"></ProjectMan>
|
||||
</div>
|
||||
@if (ProjSel != null)
|
||||
{
|
||||
<div class="col-6">
|
||||
@* <ItemMan CustomerId="@CustomerID" KeyNum="@nKey" MaterialSel="@ProjSel"></ItemMan> *@
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
using MagMan.Core.Services;
|
||||
using MagMan.Data.Admin.Services;
|
||||
using MagMan.Data.Tenant.DbModels;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace MagMan.UI.Pages
|
||||
{
|
||||
public partial class ProjectsStatus
|
||||
{
|
||||
#region Protected Fields
|
||||
|
||||
protected int nKey = 0;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected MessageService AppMService { get; set; } = null!;
|
||||
|
||||
protected string mainCss
|
||||
{
|
||||
get => ProjSel == null ? "col-12" : "col-6 small";
|
||||
}
|
||||
|
||||
[Inject]
|
||||
protected MTAdminService MTService { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
AppMService.ShowSearch = true;
|
||||
AppMService.PageName = "Progetti";
|
||||
AppMService.PageIcon = "fa-solid fa-chart-gantt pr-2";
|
||||
AppMService.EA_CustomerSel += AppMService_EA_CustomerSel;
|
||||
CustomerID = AppMService.CustomerID;
|
||||
// rileggo dati
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
|
||||
protected void SaveProj(ProjModel? newMat)
|
||||
{
|
||||
ProjSel = newMat;
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private int KeyNum = 0;
|
||||
|
||||
private ProjModel? ProjSel = null;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private int CustomerID { get; set; } = 0;
|
||||
private bool isLoading { get; set; } = false;
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private async void AppMService_EA_CustomerSel()
|
||||
{
|
||||
CustomerID = AppMService.CustomerID;
|
||||
await Task.Delay(10);
|
||||
await ReloadData();
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
private async Task ReloadData()
|
||||
{
|
||||
isLoading = true;
|
||||
nKey = await MTService.MainKeyByCustomer(CustomerID);
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,7 @@ namespace MagMan.UI.Pages
|
||||
// resetto cache redis
|
||||
await MTService.FlushRedisCache();
|
||||
string baseAppPath = Configuration["OptConf:BaseUrl"];
|
||||
NavMan.NavigateTo(baseAppPath);
|
||||
NavMan.NavigateTo(baseAppPath, true);
|
||||
}
|
||||
[Inject]
|
||||
private NavigationManager NavMan { get; set; } = null!;
|
||||
|
||||
@@ -2,21 +2,13 @@
|
||||
|
||||
<PageTitle>WareHouse Area</PageTitle>
|
||||
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-0">
|
||||
</div>
|
||||
<div class="px-0">
|
||||
<CmpSelCliente E_CustSelected="SaveCust"></CmpSelCliente>
|
||||
</div>
|
||||
</div>
|
||||
@if (CustomerID == 0)
|
||||
@if (isLoading)
|
||||
{
|
||||
<div class="alert alert-info">
|
||||
<div class="fs-2">
|
||||
Customer Undef
|
||||
</div>
|
||||
Prego selezionare Cliente per visualizzare dati Magazzino
|
||||
</div>
|
||||
<LoadingData></LoadingData>
|
||||
}
|
||||
else if (CustomerID == 0)
|
||||
{
|
||||
<CmpCustomerUndef></CmpCustomerUndef>
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -20,8 +20,6 @@ namespace MagMan.UI.Pages
|
||||
[Inject]
|
||||
protected MessageService AppMService { get; set; } = null!;
|
||||
|
||||
protected int CustomerID { get; set; } = 0;
|
||||
|
||||
protected string mainCss
|
||||
{
|
||||
get => MaterialSel == null ? "col-12" : "col-6 small";
|
||||
@@ -37,18 +35,14 @@ namespace MagMan.UI.Pages
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
AppMService.ShowSearch = true;
|
||||
AppMService.PageName = "Warehouse Area";
|
||||
AppMService.PageName = "Magazzino";
|
||||
AppMService.PageIcon = "fa-solid fa-warehouse pr-2";
|
||||
AppMService.EA_CustomerSel += AppMService_EA_CustomerSel;
|
||||
CustomerID = AppMService.CustomerID;
|
||||
// rileggo dati
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected async Task SaveCust(int newCustId)
|
||||
{
|
||||
CustomerID = newCustId;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected void SaveMat(MaterialModel? newMat)
|
||||
{
|
||||
MaterialSel = newMat;
|
||||
@@ -65,12 +59,21 @@ namespace MagMan.UI.Pages
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private int CustomerID { get; set; } = 0;
|
||||
private bool isLoading { get; set; } = false;
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private async void AppMService_EA_CustomerSel()
|
||||
{
|
||||
CustomerID = AppMService.CustomerID;
|
||||
await Task.Delay(10);
|
||||
await ReloadData();
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
private async Task ReloadData()
|
||||
{
|
||||
isLoading = true;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
</div>
|
||||
</CascadingValue>
|
||||
@* <article class="content px-4"> *@
|
||||
<article class="content pt-1 pt-lg-2 mb-5 px-0 px-lg-2">
|
||||
<article class="content pt-1 pt-lg-2 mb-5 px-0 px-lg-1">
|
||||
@Body
|
||||
</article>
|
||||
<div class="fixed-bottom bottom-row">
|
||||
|
||||
@@ -23,7 +23,7 @@ main {
|
||||
|
||||
.top-row ::deep a, .top-row .btn-link {
|
||||
white-space: nowrap;
|
||||
margin-left: 1.5rem;
|
||||
margin-left: 0.5rem;
|
||||
}
|
||||
|
||||
.top-row a:first-child {
|
||||
@@ -85,8 +85,8 @@ main {
|
||||
}
|
||||
|
||||
.top-row, article {
|
||||
padding-left: 2rem !important;
|
||||
padding-right: 1.5rem !important;
|
||||
padding-left: 1rem !important;
|
||||
padding-right: 1.0rem !important;
|
||||
}
|
||||
|
||||
.bottom-row {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>MagMan - Wood Warehouse Management System</i>
|
||||
<h4>Versione: 1.0.2401.2309</h4>
|
||||
<h4>Versione: 1.0.2401.2418</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
1.0.2401.2309
|
||||
1.0.2401.2418
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>1.0.2401.2309</version>
|
||||
<version>1.0.2401.2418</version>
|
||||
<url>http://nexus.steamware.net/repository/SWS/MagMan/stable/0/MagMan.UI.zip</url>
|
||||
<changelog>http://nexus.steamware.net/repository/SWS/MagMan/stable/0/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
@@ -44,7 +44,7 @@ Public Class Form1
|
||||
|
||||
Dim result As String = ""
|
||||
|
||||
Dim matList = Await commLib.GetMaterials()
|
||||
Dim matList = Await commLib.MaterialsGet()
|
||||
If matList IsNot Nothing Then
|
||||
|
||||
For Each item In matList
|
||||
@@ -53,7 +53,7 @@ Public Class Form1
|
||||
result += $"Dtmx Code: {item.MatDtmx}{Environment.NewLine}"
|
||||
result += $"descript: {item.MatDesc}{Environment.NewLine}"
|
||||
result += $"Dimensions W x T x L: {item.WMm:N3} x {item.TMm:N3} x {item.LMm:N3}{Environment.NewLine}"
|
||||
If item.ItemNav IsNot Nothing Then
|
||||
If item.ItemList IsNot Nothing Then
|
||||
'result += $"Items count: {item.ItemList.Count}"
|
||||
result += $"{Environment.NewLine}"
|
||||
End If
|
||||
@@ -71,7 +71,7 @@ Public Class Form1
|
||||
Dim result As String = ""
|
||||
Dim sepShort As String = "----"
|
||||
|
||||
Dim matList = Await commLib.GetInventario(0)
|
||||
Dim matList = Await commLib.InventoryGet(0)
|
||||
|
||||
If matList IsNot Nothing Then
|
||||
|
||||
@@ -81,13 +81,13 @@ Public Class Form1
|
||||
result += $"Dtmx Code: {item.MatDtmx}{Environment.NewLine}"
|
||||
result += $"descript: {item.MatDesc}{Environment.NewLine}"
|
||||
result += $"Dimensions W x T x L: {item.WMm:N3} x {item.TMm:N3} x {item.LMm:N3}{Environment.NewLine}"
|
||||
If item.ItemNav IsNot Nothing Then
|
||||
result += $"Items count: {item.ItemNav.Count}"
|
||||
If item.ItemList IsNot Nothing Then
|
||||
result += $"Items count: {item.ItemList.Count}"
|
||||
|
||||
If item.ItemNav.Count > 0 Then
|
||||
If item.ItemList.Count > 0 Then
|
||||
result += "Inventario:"
|
||||
|
||||
For Each itemInv In item.ItemNav
|
||||
For Each itemInv In item.ItemList
|
||||
result += $"{sepShort}{Environment.NewLine}"
|
||||
result += $"ID: {itemInv.ItemID}{Environment.NewLine}"
|
||||
result += $"Location: {itemInv.Location}{Environment.NewLine}"
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="EgwProxy.MagMan, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\EgwProxy.MagMan.0.9.2401-beta.1719\lib\EgwProxy.MagMan.dll</HintPath>
|
||||
<HintPath>..\packages\EgwProxy.MagMan.0.9.2401.2309\lib\EgwProxy.MagMan.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.7.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="EgwProxy.MagMan" version="0.9.2401-beta.1719" targetFramework="net472" />
|
||||
<package id="EgwProxy.MagMan" version="0.9.2401.2309" targetFramework="net472" />
|
||||
<package id="Microsoft.Bcl.AsyncInterfaces" version="7.0.0" targetFramework="net472" />
|
||||
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net472" />
|
||||
<package id="RestSharp" version="110.2.0" targetFramework="net472" />
|
||||
|
||||
Reference in New Issue
Block a user