Merge branch 'develop' of https://gitlab.steamware.net/steamware/StockMan into develop
This commit is contained in:
@@ -8,75 +8,85 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="card">
|
||||
<div class="card-header d-flex justify-content-between">
|
||||
<div>
|
||||
Famiglie Articoli
|
||||
</div>
|
||||
<div>
|
||||
<button type="button" data-bs-toggle="modal" data-bs-target="#modalNewFam" class="btn btn-sm btn-success"><i class="fa-solid fa-plus"></i> Aggiunta nuova famiglia</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<table class="table table-striped table-bordered">
|
||||
<thead>
|
||||
<tr class="small">
|
||||
@if (!editMode)
|
||||
{
|
||||
<th>
|
||||
|
||||
<table class="table table-striped table-bordered">
|
||||
<thead>
|
||||
<tr class="small">
|
||||
@if (!editMode)
|
||||
{
|
||||
<th>
|
||||
<button type="button" data-bs-toggle="modal" data-bs-target="#modalNewFam" class="buttonNew"><i class="fa-solid fa-plus"></i> Aggiunta nuova famiglia</button>
|
||||
</th>
|
||||
}
|
||||
<th>
|
||||
ID UNIVOCO
|
||||
</th>
|
||||
<th>
|
||||
CATEGORIA
|
||||
</th>
|
||||
<th>
|
||||
# ARTICOLI
|
||||
</th>
|
||||
<th>
|
||||
</th>
|
||||
}
|
||||
<th>
|
||||
ID UNIVOCO
|
||||
</th>
|
||||
<th>
|
||||
CATEGORIA
|
||||
</th>
|
||||
<th>
|
||||
# ARTICOLI
|
||||
</th>
|
||||
<th>
|
||||
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in ListRecord)
|
||||
{
|
||||
<tr class="small">
|
||||
@if (!editMode)
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in ListRecord)
|
||||
{
|
||||
<td class="d-flex justify-content-center">
|
||||
<button class="btnDet" @onclick="()=>selectItem(item)" title=@($"Selezionare la famiglia di articoli: {item.Id}")><i class="fa-solid fa-magnifying-glass"></i></button>
|
||||
<button class="btnEdit" @onclick="()=>enableEdit(item.Id)" title=@($"Modificare la famiglia di articoli: {item.Id}")><i class="fa-solid fa-pen-to-square"></i></button>
|
||||
</td>
|
||||
<tr class="small">
|
||||
@if (!editMode)
|
||||
{
|
||||
<td class="d-flex justify-content-center">
|
||||
<button class="btnDet" @onclick="()=>selectItem(item)" title=@($"Selezionare la famiglia di articoli: {item.Id}")><i class="fa-solid fa-magnifying-glass"></i></button>
|
||||
<button class="btnEdit" @onclick="()=>enableEdit(item.Id)" title=@($"Modificare la famiglia di articoli: {item.Id}")><i class="fa-solid fa-pen-to-square"></i></button>
|
||||
</td>
|
||||
}
|
||||
<td>
|
||||
@item.Id
|
||||
</td>
|
||||
<td>
|
||||
@if (editMode && (item.Id == currRowSel))
|
||||
{
|
||||
<input @bind="@item.Descr" />
|
||||
}
|
||||
else
|
||||
{
|
||||
<div>
|
||||
@item.Descr
|
||||
</div>
|
||||
}
|
||||
</td>
|
||||
<td>
|
||||
@item.NumItems
|
||||
</td>
|
||||
<td class="text-center">
|
||||
@if (item.NumItems == 0 && !editMode)
|
||||
{
|
||||
<button class="btnDel" @onclick="()=>deleteItemFam(item)"><i class="fa-solid fa-trash-can"></i></button>
|
||||
}
|
||||
else if (editMode && (item.Id == currRowSel))
|
||||
{
|
||||
<button class="btnAccept" @onclick="()=>editItemFam(item)"><i class="fa-solid fa-cloud-arrow-up"></i></button>
|
||||
<button class="btnDecline" @onclick="()=>disableEdit()"><i class="fa-solid fa-ban"></i></button>
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
<td>
|
||||
@item.Id
|
||||
</td>
|
||||
<td >
|
||||
@if (editMode && (item.Id == currRowSel))
|
||||
{
|
||||
<input @bind="@item.Descr" />
|
||||
}
|
||||
else
|
||||
{
|
||||
<div>
|
||||
@item.Descr
|
||||
</div>
|
||||
}
|
||||
</td>
|
||||
<td>
|
||||
@item.NumItems
|
||||
</td>
|
||||
<td class="text-center">
|
||||
@if (item.NumItems == 0 && !editMode)
|
||||
{
|
||||
<button class="btnDel" @onclick="()=>deleteItemFam(item)"><i class="fa-solid fa-trash-can"></i></button>
|
||||
}
|
||||
else if (editMode && (item.Id == currRowSel))
|
||||
{
|
||||
<button class="btnAccept" @onclick="()=>editItemFam(item)"><i class="fa-solid fa-cloud-arrow-up"></i></button>
|
||||
<button class="btnDecline" @onclick="()=>disableEdit()"><i class="fa-solid fa-ban"></i></button>
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Modal -->
|
||||
<div class="modal fade" id="modalNewFam" tabindex="-1" aria-hidden="true">
|
||||
@@ -84,10 +94,10 @@ else
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h1 class="modal-title fs-5" id="modalNewFamLabel">Aggiungere nuova famiglia articoli</h1>
|
||||
<button type="button" class="btn-close" aria-label="Close"></button>
|
||||
<button type="button" class="btn-close" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="d-flex justify-content-between">
|
||||
<input placeholder="ID UNIVOCO" @bind=@idUnivoco />
|
||||
<textarea placeholder="Descrizione" @bind=@descrizione></textarea>
|
||||
</div>
|
||||
|
||||
@@ -1,162 +1,166 @@
|
||||
<div class="row">
|
||||
<div class="w-50 d-flex row pb-1 col">
|
||||
<div class="form-floating col ps-1">
|
||||
<select id="fam" @bind="searchFamily" class="form-select">
|
||||
<option value="*">--TUTTI--</option>
|
||||
@if (itemFamList != null)
|
||||
{
|
||||
@foreach (var item in itemFamList)
|
||||
{
|
||||
<option value="@item.Id">@item.Descr</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
<label for="fam">Famiglia articoli</label>
|
||||
</div>
|
||||
<div class="form-floating col ps-1">
|
||||
<input id="search" @bind="searchVal" class="form-control" />
|
||||
<label for="search">Search</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col text-end pe-4">
|
||||
<button data-bs-toggle="modal" data-bs-target="#modalNewFam" class="btnAccept" title="Aggiungere nuovo articolo"><i class="fa-solid fa-plus"></i></button>
|
||||
</div>
|
||||
@*<button data-bs-toggle="modal" data-bs-target="#modalNewFam" class="h-50 mt-4 btnAccept"><i class="fa-solid fa-plus"></i></button>*@
|
||||
</div>
|
||||
@if (isLoading)
|
||||
@if (isLoading)
|
||||
{
|
||||
<LoadingData></LoadingData>
|
||||
}
|
||||
@if (ListRecord == null || ListRecord.Count == 0)
|
||||
else if (ListRecord == null || ListRecord.Count == 0)
|
||||
{
|
||||
<b>nessun record</b>
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
<table class="table table-striped table-bordered">
|
||||
<thead>
|
||||
<tr class="small row col-12">
|
||||
<th class="col-1">
|
||||
</th>
|
||||
|
||||
<th class="col-3">
|
||||
<div class="row">
|
||||
<div class="d-flex text-center" @onclick="()=>orderByCodInt()">
|
||||
COD. ARTICOLO
|
||||
@if (orderType == orderTypeEnum.codIntAscending)
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<div class="row">
|
||||
<div class="w-50 d-flex row pb-1 col">
|
||||
<div class="form-floating col ps-1">
|
||||
<select id="fam" @bind="searchFamily" class="form-select">
|
||||
<option value="*">--TUTTI--</option>
|
||||
@if (itemFamList != null)
|
||||
{
|
||||
<i class="fa-solid fa-sort-up text-primary mx-2"></i>
|
||||
@foreach (var item in itemFamList)
|
||||
{
|
||||
<option value="@item.Id">@item.Descr</option>
|
||||
}
|
||||
}
|
||||
else if (orderType == orderTypeEnum.codIntDescending)
|
||||
</select>
|
||||
<label for="fam">Famiglia articoli</label>
|
||||
</div>
|
||||
<div class="form-floating col ps-1">
|
||||
<input id="search" @bind="searchVal" class="form-control" />
|
||||
<label for="search">Search</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col text-end pe-4">
|
||||
<button data-bs-toggle="modal" data-bs-target="#modalNewFam" class="btn btn-success" title="Aggiungere nuovo articolo"><i class="fa-solid fa-plus"></i> Aggiungi nuovo articolo</button>
|
||||
</div>
|
||||
@*<button data-bs-toggle="modal" data-bs-target="#modalNewFam" class="h-50 mt-4 btnAccept"><i class="fa-solid fa-plus"></i></button>*@
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<table class="table table-striped table-bordered">
|
||||
<thead>
|
||||
<tr class="small row col-12">
|
||||
<th class="col-1">
|
||||
</th>
|
||||
|
||||
<th class="col-3">
|
||||
<div class="row">
|
||||
<div class="d-flex text-center" @onclick="()=>orderByCodInt()">
|
||||
COD. ARTICOLO
|
||||
@if (orderType == orderTypeEnum.codIntAscending)
|
||||
{
|
||||
<i class="fa-solid fa-sort-up text-primary mx-2"></i>
|
||||
}
|
||||
else if (orderType == orderTypeEnum.codIntDescending)
|
||||
{
|
||||
<i class="fa-solid fa-sort-down text-primary mx-2"></i>
|
||||
}
|
||||
else
|
||||
{
|
||||
<i class="fa-solid fa-sort text-primary mx-2"></i>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="d-flex text-secondary fst-italic text-center" @onclick="()=>orderByCodForn()">
|
||||
COD. FORNITORE
|
||||
@if (orderType == orderTypeEnum.codExtAscending)
|
||||
{
|
||||
<i class="fa-solid fa-sort-up text-primary mx-2"></i>
|
||||
}
|
||||
else if (orderType == orderTypeEnum.codExtDescending)
|
||||
{
|
||||
<i class="fa-solid fa-sort-down text-primary mx-2"></i>
|
||||
}
|
||||
else
|
||||
{
|
||||
<i class="fa-solid fa-sort text-primary mx-2"></i>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</th>
|
||||
<th class="col-4">
|
||||
<div class="row">
|
||||
<div>
|
||||
DESC. ARTICOLO
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="text-secondary fst-italic">
|
||||
DESC. FORNITORE
|
||||
</div>
|
||||
</div>
|
||||
</th>
|
||||
<th @onclick="()=>orderByStock()" class="col-1">
|
||||
STOCK
|
||||
@if (orderType == orderTypeEnum.stockAscending)
|
||||
{
|
||||
<i class="fa-solid fa-sort-down text-primary mx-2"></i>
|
||||
<i class="fa-solid fa-sort-down text-primary"></i>
|
||||
}
|
||||
else if (orderType == orderTypeEnum.stockDescending)
|
||||
{
|
||||
<i class="fa-solid fa-sort-up text-primary"></i>
|
||||
}
|
||||
else
|
||||
{
|
||||
<i class="fa-solid fa-sort text-primary mx-2"></i>
|
||||
<i class="fa-solid fa-sort text-primary"></i>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="d-flex text-secondary fst-italic text-center" @onclick="()=>orderByCodForn()">
|
||||
COD. FORNITORE
|
||||
@if (orderType == orderTypeEnum.codExtAscending)
|
||||
{
|
||||
<i class="fa-solid fa-sort-up text-primary mx-2"></i>
|
||||
}
|
||||
else if (orderType == orderTypeEnum.codExtDescending)
|
||||
{
|
||||
<i class="fa-solid fa-sort-down text-primary mx-2"></i>
|
||||
}
|
||||
else
|
||||
{
|
||||
<i class="fa-solid fa-sort text-primary mx-2"></i>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</th>
|
||||
<th class="col-4">
|
||||
<div class="row">
|
||||
<div>
|
||||
DESC. ARTICOLO
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="text-secondary fst-italic">
|
||||
DESC. FORNITORE
|
||||
</div>
|
||||
</div>
|
||||
</th>
|
||||
<th @onclick="()=>orderByStock()"class="col-1">
|
||||
STOCK
|
||||
@if (orderType == orderTypeEnum.stockAscending)
|
||||
</th>
|
||||
<th class="col-1">
|
||||
VALORE UNIT.
|
||||
</th>
|
||||
<th class="col-1">
|
||||
VALORE TOT.
|
||||
</th>
|
||||
<th class="col-1">
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in ListRecord)
|
||||
{
|
||||
<i class="fa-solid fa-sort-down text-primary"></i>
|
||||
<tr class="small row col-12">
|
||||
<td class="text-center col-1">
|
||||
<button class="btnDet" @onclick="()=>selItemToDet(item.Id)" title=@($"Mostra dettagli oggetto {item.CodInt}")><i class="fa-solid fa-magnifying-glass"></i></button>
|
||||
</td>
|
||||
<td class="col-3" style="font-size: 14px;">
|
||||
@item.CodInt
|
||||
<div class="small text-secondary fst-italic">
|
||||
@item.CodExt
|
||||
</div>
|
||||
</td>
|
||||
<td class="small col-4">
|
||||
<div class="row">
|
||||
<span class="d-inline-block text-truncate" style="max-width: 100%;" title="@item.Descr">
|
||||
@item.Descr
|
||||
</span>
|
||||
</div>
|
||||
<div class="row">
|
||||
<span class="d-inline-block text-truncate text-secondary fst-italic" style="max-width: 100%;" title="@item.DescrExt">
|
||||
@item.DescrExt
|
||||
</span>
|
||||
</div>
|
||||
</td>
|
||||
<td class="text-center col-1">
|
||||
<div>
|
||||
@item.QtaBatch
|
||||
</div>
|
||||
</td>
|
||||
<td class="small text-center col-1">
|
||||
@($"{item.CurrValue:C2}")
|
||||
</td>
|
||||
<td class="small text-center col-1">
|
||||
@($"{(item.CurrValue * item.QtaBatch):C2}")
|
||||
</td>
|
||||
<td class="text-center col-1">
|
||||
<button class="btnDup" data-bs-toggle="modal" data-bs-target="#modalNewFam" @onclick="()=>dupItem(item)" title=@($"Duplica oggetto {item.CodInt}")><i class="fa-solid fa-copy"></i></button>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
else if (orderType == orderTypeEnum.stockDescending)
|
||||
{
|
||||
<i class="fa-solid fa-sort-up text-primary"></i>
|
||||
}
|
||||
else
|
||||
{
|
||||
<i class="fa-solid fa-sort text-primary"></i>
|
||||
}
|
||||
</th>
|
||||
<th class="col-1">
|
||||
VALORE UNIT.
|
||||
</th>
|
||||
<th class="col-1">
|
||||
VALORE TOT.
|
||||
</th>
|
||||
<th class="col-1">
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in ListRecord)
|
||||
{
|
||||
<tr class="small row col-12">
|
||||
<td class="text-center col-1">
|
||||
<button class="btnDet" @onclick="()=>selItemToDet(item.Id)" title=@($"Mostra dettagli oggetto {item.CodInt}")><i class="fa-solid fa-magnifying-glass"></i></button>
|
||||
</td>
|
||||
<td class="col-3" style="font-size: 14px;">
|
||||
@item.CodInt
|
||||
<div class="small text-secondary fst-italic">
|
||||
@item.CodExt
|
||||
</div>
|
||||
</td>
|
||||
<td class="small col-4">
|
||||
<div class="row">
|
||||
<span class="d-inline-block text-truncate" style="max-width: 100%;" title="@item.Descr">
|
||||
@item.Descr
|
||||
</span>
|
||||
</div>
|
||||
<div class="row">
|
||||
<span class="d-inline-block text-truncate text-secondary fst-italic" style="max-width: 100%;" title="@item.DescrExt">
|
||||
@item.DescrExt
|
||||
</span>
|
||||
</div>
|
||||
</td>
|
||||
<td class="text-center col-1">
|
||||
<div>
|
||||
@item.QtaBatch
|
||||
</div>
|
||||
</td>
|
||||
<td class="small text-center col-1">
|
||||
@($"{item.CurrValue:C2}")
|
||||
</td>
|
||||
<td class="small text-center col-1">
|
||||
@($"{(item.CurrValue * item.QtaBatch):C2}")
|
||||
</td>
|
||||
<td class="text-center col-1">
|
||||
<button class="btnDup" data-bs-toggle="modal" data-bs-target="#modalNewFam" @onclick="()=>dupItem(item)" title=@($"Duplica oggetto {item.CodInt}")><i class="fa-solid fa-copy"></i></button>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Modal -->
|
||||
<div class="modal fade" id="modalNewFam" tabindex="-1" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
|
||||
@@ -36,10 +36,10 @@
|
||||
@flux.DtMov.Date.ToString("yyyy/MM/dd")
|
||||
</td>
|
||||
<td>
|
||||
@flux.LocationId
|
||||
@flux.Location.Descr
|
||||
</td>
|
||||
<td>
|
||||
@flux.ExtLocationId
|
||||
@flux.ExtLocation.Descr
|
||||
</td>
|
||||
@if (flux.Qta > 0)
|
||||
{
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using Newtonsoft.Json;
|
||||
using NLog;
|
||||
using StackExchange.Redis;
|
||||
using StockMan.CORE.Pages;
|
||||
using StockMan.Data.Controllers;
|
||||
using StockMan.Data.DbModels;
|
||||
using System.Diagnostics;
|
||||
@@ -123,6 +124,34 @@ namespace StockMan.CORE.Data
|
||||
return dbResult;
|
||||
}
|
||||
/// <summary>
|
||||
/// Aggiornamento record selezionato operatore
|
||||
/// </summary>
|
||||
/// <param name="currRec"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> OperatorMod(OperatorModel currRec)
|
||||
{
|
||||
var dbResult = await dbController.OperatorMod(currRec);
|
||||
// elimino cache redis...
|
||||
RedisValue pattern = new RedisValue($"{rKeyOperator}:*");
|
||||
bool answ = await ExecFlushRedisPattern(pattern);
|
||||
await Task.Delay(1);
|
||||
return dbResult;
|
||||
}
|
||||
/// <summary>
|
||||
/// Aggiunta operatore
|
||||
/// </summary>
|
||||
/// <param name="currRec"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> OperatorAddNew(OperatorModel currRec)
|
||||
{
|
||||
var dbResult = await dbController.OperatorAddNew(currRec);
|
||||
// elimino cache redis...
|
||||
RedisValue pattern = new RedisValue($"{rKeyOperator}:*");
|
||||
bool answ = await ExecFlushRedisPattern(pattern);
|
||||
await Task.Delay(1);
|
||||
return dbResult;
|
||||
}
|
||||
/// <summary>
|
||||
/// Aggiornamento record selezionato item
|
||||
/// </summary>
|
||||
/// <param name="currRec"></param>
|
||||
@@ -519,6 +548,46 @@ namespace StockMan.CORE.Data
|
||||
/// Lista Location
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<List<OperatorModel>> OperatorsGetAll()
|
||||
{
|
||||
string source = "DB";
|
||||
List<OperatorModel>? dbResult = new List<OperatorModel>();
|
||||
string currKey = $"{rKeyOperator}:*";
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
string? rawData = await redisDb.StringGetAsync(currKey);
|
||||
if (!string.IsNullOrEmpty(rawData))
|
||||
{
|
||||
source = "REDIS";
|
||||
var tempResult = JsonConvert.DeserializeObject<List<OperatorModel>>(rawData);
|
||||
if (tempResult == null)
|
||||
{
|
||||
dbResult = new List<OperatorModel>();
|
||||
}
|
||||
else
|
||||
{
|
||||
dbResult = tempResult;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dbResult = dbController.OperatorsGetAll();
|
||||
rawData = JsonConvert.SerializeObject(dbResult, JSSettings);
|
||||
await redisDb.StringSetAsync(currKey, rawData, LongCache);
|
||||
}
|
||||
if (dbResult == null)
|
||||
{
|
||||
dbResult = new List<OperatorModel>();
|
||||
}
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Debug($"OperatorsGetAll | {source} in: {ts.TotalMilliseconds} ms");
|
||||
return dbResult;
|
||||
}
|
||||
/// <summary>
|
||||
/// Lista Location
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<List<LocationModel>> LocationGetLocType()
|
||||
{
|
||||
string source = "DB";
|
||||
|
||||
@@ -2,7 +2,10 @@
|
||||
@page "/AnagraficaArticoli"
|
||||
|
||||
<div class="ps-2 pe-1">
|
||||
<ItemList updateRecordCount="UpdateTotCount" actFilter="@currFilter"></ItemList>
|
||||
|
||||
<DataPager @ref="pagerFamArt" PageSize="@numRecord" currPage="@currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="@totalCount" showLoading="@isLoading" />
|
||||
<div>
|
||||
<ItemList updateRecordCount="UpdateTotCount" actFilter="@currFilter"></ItemList>
|
||||
</div>
|
||||
<div>
|
||||
<DataPager @ref="pagerFamArt" PageSize="@numRecord" currPage="@currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="@totalCount" showLoading="@isLoading" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
@page "/Operatori"
|
||||
|
||||
|
||||
@if (isLoading)
|
||||
{
|
||||
<LoadingData></LoadingData>
|
||||
}
|
||||
else if (listOprAll == null)
|
||||
{
|
||||
<div class="alert alert-warning">Nessun record trovato</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="card">
|
||||
<div class="card-header d-flex justify-content-between">
|
||||
<div class="py-1">
|
||||
Lista Operatori
|
||||
</div>
|
||||
<div>
|
||||
<button class="btn btn-success" data-bs-toggle="modal" data-bs-target="#modalNewFam">Aggiungi Operatore</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
Id esterno
|
||||
</th>
|
||||
<th>
|
||||
Cognome
|
||||
</th>
|
||||
<th>
|
||||
Nome
|
||||
</th>
|
||||
<th>
|
||||
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in listOprAll)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@item.CodExt
|
||||
</td>
|
||||
<td>
|
||||
@item.LastName
|
||||
</td>
|
||||
<td>
|
||||
@item.FirstName
|
||||
</td>
|
||||
<td>
|
||||
<button class="btn btn-sm btn-primary" data-bs-toggle="modal" data-bs-target="#modalNewFam" @onclick="()=>setCurrOpr(item)"><i class="fa-solid fa-pen-to-square"></i></button>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="modalNewFam" tabindex="-1" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h1 class="modal-title fs-5" id="modalNewFamLabel">Aggiungere nuovo articolo</h1>
|
||||
<button type="button" class="btn-close" aria-label="Close" data-bs-dismiss="modal"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="w-100">
|
||||
<div class="form-floating">
|
||||
<input id="codExt" @bind="@CodExt" class="form-control w-100 my-1" />
|
||||
<label for="codExt" class="form-label">Codice esterno</label>
|
||||
</div>
|
||||
<div class="form-floating">
|
||||
<input id="Cognome" @bind="@Cognome" class="form-control w-100 my-1" />
|
||||
<label for="Cognome" class="form-label">Cognome</label>
|
||||
</div>
|
||||
<div class="form-floating">
|
||||
<input id="Nome" @bind="@Nome" class="form-control w-100 my-1" />
|
||||
<label for="Nome" class="form-label">Nome</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-center mt-5">
|
||||
@if (currOpr == null)
|
||||
{
|
||||
|
||||
<button class="btn btn-success" @onclick="()=>addNewItem()"><i class="fa-regular fa-circle-check"></i></button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button class="btn btn-success" @onclick="()=>ModOpr()"><i class="fa-regular fa-circle-check"></i></button>
|
||||
}
|
||||
<button class="btn btn-danger" data-bs-dismiss="modal"><i class="fa-solid fa-ban"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using System.Net.Http;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Components.Authorization;
|
||||
using Microsoft.AspNetCore.Components.Forms;
|
||||
using Microsoft.AspNetCore.Components.Routing;
|
||||
using Microsoft.AspNetCore.Components.Web;
|
||||
using Microsoft.AspNetCore.Components.Web.Virtualization;
|
||||
using Microsoft.JSInterop;
|
||||
using EgwCoreLib.Razor;
|
||||
using EgwCoreLib.Razor.Data;
|
||||
using StockMan.CORE;
|
||||
using StockMan.CORE.Data;
|
||||
using StockMan.CORE.Shared;
|
||||
using StockMan.Data.DbModels;
|
||||
using StockMan.Data;
|
||||
|
||||
namespace StockMan.CORE.Pages
|
||||
{
|
||||
public partial class Operatori
|
||||
{
|
||||
protected List<OperatorModel>? listOprAll = null;
|
||||
[Inject]
|
||||
protected StockDataService SDService { get; set; } = null!;
|
||||
[Inject]
|
||||
protected NavigationManager NavManager{ get; set; } = null!;
|
||||
public bool isLoading { get; set; } = false;
|
||||
public OperatorModel? currOpr { get; set; } = null;
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
isLoading = true;
|
||||
listOprAll = await SDService.OperatorsGetAll();
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
protected async Task ModOpr()
|
||||
{
|
||||
OperatorModel currRecToMod = new OperatorModel()
|
||||
{
|
||||
Id = Id,
|
||||
CodExt = CodExt,
|
||||
LastName = Cognome,
|
||||
FirstName = Nome
|
||||
};
|
||||
var done = await SDService.OperatorMod(currRecToMod);
|
||||
if (done)
|
||||
{
|
||||
NavManager.NavigateTo(NavManager.Uri, true);
|
||||
}
|
||||
}
|
||||
protected async Task addNewItem()
|
||||
{
|
||||
OperatorModel currRecToMod = new OperatorModel()
|
||||
{
|
||||
Id = $"{Nome.Substring(0,1)}{Cognome.Substring(0,1)}".ToUpper(),
|
||||
CodExt = CodExt,
|
||||
LastName = Cognome,
|
||||
FirstName = Nome
|
||||
};
|
||||
var done = await SDService.OperatorAddNew(currRecToMod);
|
||||
if (done)
|
||||
{
|
||||
NavManager.NavigateTo(NavManager.Uri, true);
|
||||
}
|
||||
}
|
||||
protected async Task setCurrOpr(OperatorModel currRecToMod)
|
||||
{
|
||||
await Task.Delay(1);
|
||||
Id = currRecToMod.Id;
|
||||
CodExt = currRecToMod.CodExt;
|
||||
Cognome = currRecToMod.LastName;
|
||||
Nome = currRecToMod.FirstName;
|
||||
}
|
||||
|
||||
protected string _CodExt = "";
|
||||
protected string CodExt
|
||||
{
|
||||
get => _CodExt;
|
||||
set
|
||||
{
|
||||
_CodExt = value;
|
||||
}
|
||||
}
|
||||
protected string _Id = "";
|
||||
protected string Id
|
||||
{
|
||||
get => _Id;
|
||||
set
|
||||
{
|
||||
_Id = value;
|
||||
}
|
||||
}
|
||||
protected string _Cognome = "";
|
||||
protected string Cognome
|
||||
{
|
||||
get => _Cognome;
|
||||
set
|
||||
{
|
||||
_Cognome = value;
|
||||
}
|
||||
}
|
||||
protected string _Nome= "";
|
||||
protected string Nome
|
||||
{
|
||||
get => _Nome;
|
||||
set
|
||||
{
|
||||
_Nome = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -148,6 +148,82 @@ namespace StockMan.Data.Controllers
|
||||
}
|
||||
return fatto;
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// Aggiungi Operatore
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> OperatorAddNew(OperatorModel editRec)
|
||||
{
|
||||
bool fatto = false;
|
||||
List<OperatorModel> dbResult = new List<OperatorModel>();
|
||||
using (StockManContext localDbCtx = new StockManContext(_configuration))
|
||||
{
|
||||
try
|
||||
{
|
||||
var currRec = localDbCtx
|
||||
.DbSetOperator
|
||||
.Where(x => x.CodExt == editRec.CodExt)
|
||||
.FirstOrDefault();
|
||||
if (currRec != null)
|
||||
{
|
||||
fatto = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
localDbCtx
|
||||
.DbSetOperator
|
||||
.Add(editRec);
|
||||
}
|
||||
await localDbCtx.SaveChangesAsync();
|
||||
fatto = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione durante OperatorMod{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return fatto;
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// Modifica Operatore
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> OperatorMod(OperatorModel editRec)
|
||||
{
|
||||
bool fatto = false;
|
||||
List<OperatorModel> dbResult = new List<OperatorModel>();
|
||||
using (StockManContext localDbCtx = new StockManContext(_configuration))
|
||||
{
|
||||
try
|
||||
{
|
||||
var currRec = localDbCtx
|
||||
.DbSetOperator
|
||||
.Where(x => x.Id == editRec.Id)
|
||||
.FirstOrDefault();
|
||||
if (currRec != null)
|
||||
{
|
||||
currRec.CodExt = editRec.CodExt;
|
||||
currRec.LastName = editRec.LastName;
|
||||
currRec.FirstName = editRec.FirstName;
|
||||
}
|
||||
else
|
||||
{
|
||||
localDbCtx
|
||||
.DbSetOperator
|
||||
.Add(editRec);
|
||||
}
|
||||
await localDbCtx.SaveChangesAsync();
|
||||
fatto = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione durante OperatorMod{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return fatto;
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// Modifica item,
|
||||
@@ -726,6 +802,8 @@ namespace StockMan.Data.Controllers
|
||||
{
|
||||
dbResult = localDbCtx
|
||||
.DbSetItemFlux
|
||||
.Include(l=>l.Location)
|
||||
.Include(e=>e.ExtLocation)
|
||||
.Where(x => x.ItemId == id)
|
||||
.OrderByDescending(x => x.Id)
|
||||
.ToList();
|
||||
|
||||
@@ -37,8 +37,10 @@ namespace StockMan.Data.DbModels
|
||||
public DateTime? DtExport { get; set; }
|
||||
public string ModOperatorId { get; set; } = null!;
|
||||
|
||||
[ForeignKey("ExtLocationId")]
|
||||
public virtual LocationModel ExtLocation { get; set; } = null!;
|
||||
public virtual ItemModel Item { get; set; } = null!;
|
||||
[ForeignKey("LocationId")]
|
||||
public virtual LocationModel Location { get; set; } = null!;
|
||||
public virtual OperatorModel ModOperator { get; set; } = null!;
|
||||
public virtual MovTypeModel MovType { get; set; } = null!;
|
||||
|
||||
Reference in New Issue
Block a user