Aggiunti:

-metodi per controllo username
-message service
-metodi per estrapolare username da db
-metodi per eliminare i duplicati
-tooltip vari
This commit is contained in:
zaccaria.majid
2023-02-21 16:17:14 +01:00
parent 114e7a6ea3
commit 6ba5ea0083
35 changed files with 466 additions and 164 deletions
@@ -24,6 +24,8 @@ namespace StockMan.CORE.Components
{
[Parameter]
public int ItemID { get; set; } = 0;
[Parameter]
public string userName { get; set; } = "";
[Inject]
protected StockDataService SDService { get; set; } = null!;
[Inject]
@@ -13,7 +13,6 @@
border: none;
padding: 0;
text-align: center;
margin-right: 1rem;
}
.btnMod {
border-radius: 50%;
@@ -23,7 +22,6 @@
border: none;
padding: 0;
text-align: center;
margin-right: 1rem;
background-color: rgba(52, 152, 219, 0.2);
color: #3498DB;
}
@@ -35,7 +33,6 @@
border: none;
padding: 0;
text-align: center;
margin-right: 1rem;
background-color: rgba(86, 184, 167, 0.2);
color: #56b8a7;
}
@@ -47,7 +44,6 @@
border: none;
padding: 0;
text-align: center;
margin-right: 1rem;
background-color: rgba(192, 57, 43, 0.2);
color: #C0392B;
}
@@ -12,7 +12,7 @@
border: none;
padding: 0;
text-align: center;
margin-right: 1rem;
//margin-right: 1rem;
}
.btnMod {
+1 -1
View File
@@ -1 +1 @@
.modItem input,.modItem textarea,.modItem select{font-size:.8rem;background-color:#e9ecef;height:auto;}.buttonGlobal{border-radius:50%;padding:.5rem;width:2.8rem;height:2.8rem;border:0;padding:0;text-align:center;margin-right:1rem;}.btnMod{border-radius:50%;padding:.5rem;width:2.8rem;height:2.8rem;border:0;padding:0;text-align:center;margin-right:1rem;background-color:rgba(52,152,219,.2);color:#3498db;}.btnAccept{border-radius:50%;padding:.5rem;width:2.8rem;height:2.8rem;border:0;padding:0;text-align:center;margin-right:1rem;background-color:rgba(86,184,167,.2);color:#56b8a7;}.btnDecline{border-radius:50%;padding:.5rem;width:2.8rem;height:2.8rem;border:0;padding:0;text-align:center;margin-right:1rem;background-color:rgba(192,57,43,.2);color:#c0392b;}
.modItem input,.modItem textarea,.modItem select{font-size:.8rem;background-color:#e9ecef;height:auto;}.buttonGlobal{border-radius:50%;padding:.5rem;width:2.8rem;height:2.8rem;border:0;padding:0;text-align:center;}.btnMod{border-radius:50%;padding:.5rem;width:2.8rem;height:2.8rem;border:0;padding:0;text-align:center;background-color:rgba(52,152,219,.2);color:#3498db;}.btnAccept{border-radius:50%;padding:.5rem;width:2.8rem;height:2.8rem;border:0;padding:0;text-align:center;background-color:rgba(86,184,167,.2);color:#56b8a7;}.btnDecline{border-radius:50%;padding:.5rem;width:2.8rem;height:2.8rem;border:0;padding:0;text-align:center;background-color:rgba(192,57,43,.2);color:#c0392b;}
@@ -106,7 +106,6 @@ namespace StockMan.CORE.Components
// await JSRuntime.InvokeVoidAsync("selectItem", id);
//}
currRowSel = item.Id;
itemFilter.Id = item.Id;
currModel = item;
await selectedItemFam.InvokeAsync(currModel);
NavManager.NavigateTo($"/AnagraficaArticoli?itemFamId={item.Id}", true);
@@ -249,7 +249,6 @@ td {
border: none;
padding: 0;
text-align: center;
margin-right: 1rem;
}
.btnEdit {
border-radius: 50%;
@@ -259,7 +258,6 @@ td {
border: none;
padding: 0;
text-align: center;
margin-right: 1rem;
background-color: rgba(254, 152, 83, 0.2);
color: #fe9853;
}
@@ -272,7 +270,6 @@ td {
border: none;
padding: 0;
text-align: center;
margin-right: 1rem;
background-color: rgba(86, 184, 167, 0.2);
color: #56b8a7;
}
@@ -285,7 +282,6 @@ td {
border: none;
padding: 0;
text-align: center;
margin-right: 1rem;
background-color: rgba(192, 57, 43, 0.2);
color: #C0392B;
}
@@ -253,7 +253,7 @@ td {
border: none;
padding: 0;
text-align: center;
margin-right: 1rem;
//margin-right: 1rem;
}
.btnEdit {
+1 -1
View File
@@ -1 +1 @@
body{width:100%;}td{height:3.8rem;}.buttonGlobal{border-radius:50%;padding:.5rem;width:2.8rem;height:2.8rem;border:0;padding:0;text-align:center;margin-right:1rem;}.btnEdit{border-radius:50%;padding:.5rem;width:2.8rem;height:2.8rem;border:0;padding:0;text-align:center;margin-right:1rem;background-color:rgba(254,152,83,.2);color:#fe9853;}.btnDet,.btnAccept{border-radius:50%;padding:.5rem;width:2.8rem;height:2.8rem;border:0;padding:0;text-align:center;margin-right:1rem;background-color:rgba(86,184,167,.2);color:#56b8a7;}.btnDel,.btnDecline{border-radius:50%;padding:.5rem;width:2.8rem;height:2.8rem;border:0;padding:0;text-align:center;margin-right:1rem;background-color:rgba(192,57,43,.2);color:#c0392b;}.buttonNew{border:0;border-radius:.4rem;padding:.2rem;background-color:#27ae60;color:#fff;}input,textarea{border:0;border-bottom:1px solid #000;background:none;}input:focus,textarea:focus{outline:0;}
body{width:100%;}td{height:3.8rem;}.buttonGlobal{border-radius:50%;padding:.5rem;width:2.8rem;height:2.8rem;border:0;padding:0;text-align:center;}.btnEdit{border-radius:50%;padding:.5rem;width:2.8rem;height:2.8rem;border:0;padding:0;text-align:center;background-color:rgba(254,152,83,.2);color:#fe9853;}.btnDet,.btnAccept{border-radius:50%;padding:.5rem;width:2.8rem;height:2.8rem;border:0;padding:0;text-align:center;background-color:rgba(86,184,167,.2);color:#56b8a7;}.btnDel,.btnDecline{border-radius:50%;padding:.5rem;width:2.8rem;height:2.8rem;border:0;padding:0;text-align:center;background-color:rgba(192,57,43,.2);color:#c0392b;}.buttonNew{border:0;border-radius:.4rem;padding:.2rem;background-color:#27ae60;color:#fff;}input,textarea{border:0;border-bottom:1px solid #000;background:none;}input:focus,textarea:focus{outline:0;}
+95 -67
View File
@@ -1,6 +1,6 @@
<div class="d-flex justify-content-between">
<div class="w-50 d-flex row py-1">
<div class="form-floating col">
<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)
@@ -13,12 +13,15 @@
</select>
<label for="fam">Famiglia articoli</label>
</div>
<div class="form-floating col">
<div class="form-floating col ps-1">
<input id="search" @bind="searchVal" class="form-control" />
<label for="search">Search</label>
</div>
</div>
<button data-bs-toggle="modal" data-bs-target="#modalNewFam" class="h-50 mt-4 buttonNew"><i class="fa-solid fa-plus"></i>&nbsp; NUOVO ARTICOLO</button>
<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)
{
@@ -33,96 +36,121 @@ else
<table class="table table-striped table-bordered">
<thead>
<tr class="small">
<th>
<tr class="small row col-12">
<th class="col-1">
</th>
<th>
COD. ARTICOLO
<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>
DESC. ARTICOLO
<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>
@if (orderType == orderTypeEnum.codExtAscending)
{
<th @onclick="()=>orderByCodForn()" >
COD. FORNITORE
<i class="fa-solid fa-sort-up text-primary"></i>
</th>
}
else if (orderType == orderTypeEnum.codExtDescending)
{
<th @onclick="()=>orderByCodForn()" >
COD. FORNITORE
<th @onclick="()=>orderByStock()"class="col-1">
STOCK
@if (orderType == orderTypeEnum.stockAscending)
{
<i class="fa-solid fa-sort-down text-primary"></i>
</th>
}
else
{
<th @onclick="()=>orderByCodForn()" >
COD. FORNITORE
<i class="fa-solid fa-sort text-primary"></i>
</th>
}
@if (orderType == orderTypeEnum.stockAscending)
{
<th @onclick="()=>orderByStock()" >
STOCK
<i class="fa-solid fa-sort-down text-primary"></i>
</th>
}
else if (orderType == orderTypeEnum.stockDescending)
{
<th @onclick="()=>orderByStock()" >
STOCK
}
else if (orderType == orderTypeEnum.stockDescending)
{
<i class="fa-solid fa-sort-up text-primary"></i>
</th>
}
else
{
<th @onclick="()=>orderByStock()">
STOCK
}
else
{
<i class="fa-solid fa-sort text-primary"></i>
</th>
}
<th>
}
</th>
<th class="col-1">
VALORE UNIT.
</th>
<th>
<th class="col-1">
VALORE TOT.
</th>
<th>
<th class="col-1">
</th>
</tr>
</thead>
<tbody>
@foreach (var item in ListRecord)
{
<tr class="small">
<td class="d-flex justify-content-center">
<button class="btnDet" @onclick="()=>selItemToDet(item.Id)"><i class="fa-solid fa-magnifying-glass"></i></button>
<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>
<td class="col-3">
@item.CodInt
<div class="small text-secondary fst-italic">
@item.CodExt
</div>
</td>
<td style="width: 34rem;" class="small">
@item.Descr
<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="small">
@item.CodExt
</td>
<td>
<td class="text-center col-1">
<div>
@item.QtaBatch
</div>
</td>
<td class="small">
<td class="small text-center col-1">
@($"{item.CurrValue:C2}")
</td>
<td class="small">
<td class="small text-center col-1">
@($"{(item.CurrValue * item.QtaBatch):C2}")
</td>
<td class="d-flex justify-content-center">
<button class="btnDup" data-bs-toggle="modal" data-bs-target="#modalNewFam" @onclick="()=>dupItem(item)"><i class="fa-solid fa-copy"></i></button>
<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>
}
+34 -2
View File
@@ -3,6 +3,7 @@ using Microsoft.AspNetCore.WebUtilities;
using Microsoft.JSInterop;
using StockMan.CORE.Data;
using StockMan.Data.DbModels;
using System.Text;
namespace StockMan.CORE.Components
{
@@ -91,6 +92,7 @@ namespace StockMan.CORE.Components
protected orderTypeEnum orderType = orderTypeEnum.none;
protected bool isStockAscending = false;
protected bool isCodExtAscending = false;
protected bool isCodIntAscending = false;
private async Task reloadData()
{
@@ -104,7 +106,7 @@ namespace StockMan.CORE.Components
SearchRecords = await SDService.ItemsGetAll();
}
totalCount = SearchRecords.Count;
if ( orderType == orderTypeEnum.stockAscending)
if (orderType == orderTypeEnum.stockAscending)
{
SearchRecords = SearchRecords.OrderBy(x => x.QtaBatch).ToList();
}
@@ -120,6 +122,14 @@ namespace StockMan.CORE.Components
{
SearchRecords = SearchRecords.OrderByDescending(x => x.CodExt).ToList();
}
else if (orderType == orderTypeEnum.codIntAscending)
{
SearchRecords = SearchRecords.OrderBy(x => x.CodInt).ToList();
}
else if (orderType == orderTypeEnum.codIntDescending)
{
SearchRecords = SearchRecords.OrderByDescending(x => x.CodInt).ToList();
}
ListRecord = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
itemFamList = await SDService.ItemFamilyGetAll();
await Task.Delay(1);
@@ -139,7 +149,9 @@ namespace StockMan.CORE.Components
stockAscending,
stockDescending,
codExtAscending,
codExtDescending
codExtDescending,
codIntAscending,
codIntDescending
}
protected async Task orderByStock()
@@ -168,6 +180,23 @@ namespace StockMan.CORE.Components
}
await reloadData();
}
//protected StringBuilder uriNew
protected async Task orderByCodInt()
{
isCodIntAscending = !isCodIntAscending;
if (isCodIntAscending)
{
orderType = orderTypeEnum.codIntAscending;
}
else
{
orderType = orderTypeEnum.codIntDescending;
}
await reloadData();
}
protected async Task addNewItem()
{
ItemModel newRec = new ItemModel()
@@ -216,6 +245,8 @@ namespace StockMan.CORE.Components
set
{
_searchVal = value;
currPage = 1;
StateHasChanged();
reloadData();
}
}
@@ -226,6 +257,7 @@ namespace StockMan.CORE.Components
set
{
_searchFamily = value;
//NavManager.NavigateTo($"AnagraficaArticoli?itemFamId={value}");
reloadData();
}
}
@@ -9,7 +9,6 @@
border: none;
padding: 0;
text-align: center;
margin-right: 1rem;
}
.btnDup {
border-radius: 50%;
@@ -19,7 +18,6 @@
border: none;
padding: 0;
text-align: center;
margin-right: 1rem;
background-color: rgba(254, 152, 83, 0.2);
color: #fe9853;
}
@@ -32,7 +30,6 @@
border: none;
padding: 0;
text-align: center;
margin-right: 1rem;
background-color: rgba(86, 184, 167, 0.2);
color: #56b8a7;
}
@@ -44,7 +41,6 @@
border: none;
padding: 0;
text-align: center;
margin-right: 1rem;
background-color: rgba(192, 57, 43, 0.2);
color: #C0392B;
}
+1 -1
View File
@@ -10,7 +10,7 @@
border: none;
padding: 0;
text-align: center;
margin-right: 1rem;
//margin-right: 1rem;
}
.btnDup {
+1 -1
View File
@@ -1 +1 @@
td{height:3.8rem;}.buttonGlobal{border-radius:50%;padding:.5rem;width:2.8rem;height:2.8rem;border:0;padding:0;text-align:center;margin-right:1rem;}.btnDup{border-radius:50%;padding:.5rem;width:2.8rem;height:2.8rem;border:0;padding:0;text-align:center;margin-right:1rem;background-color:rgba(254,152,83,.2);color:#fe9853;}.btnDet,.btnAccept{border-radius:50%;padding:.5rem;width:2.8rem;height:2.8rem;border:0;padding:0;text-align:center;margin-right:1rem;background-color:rgba(86,184,167,.2);color:#56b8a7;}.btnDecline{border-radius:50%;padding:.5rem;width:2.8rem;height:2.8rem;border:0;padding:0;text-align:center;margin-right:1rem;background-color:rgba(192,57,43,.2);color:#c0392b;}.buttonNew{border:0;border-radius:.4rem;padding:.2rem;background-color:#27ae60;color:#fff;}
td{height:3.8rem;}.buttonGlobal{border-radius:50%;padding:.5rem;width:2.8rem;height:2.8rem;border:0;padding:0;text-align:center;}.btnDup{border-radius:50%;padding:.5rem;width:2.8rem;height:2.8rem;border:0;padding:0;text-align:center;background-color:rgba(254,152,83,.2);color:#fe9853;}.btnDet,.btnAccept{border-radius:50%;padding:.5rem;width:2.8rem;height:2.8rem;border:0;padding:0;text-align:center;background-color:rgba(86,184,167,.2);color:#56b8a7;}.btnDecline{border-radius:50%;padding:.5rem;width:2.8rem;height:2.8rem;border:0;padding:0;text-align:center;background-color:rgba(192,57,43,.2);color:#c0392b;}.buttonNew{border:0;border-radius:.4rem;padding:.2rem;background-color:#27ae60;color:#fff;}
+2
View File
@@ -106,6 +106,7 @@
<div class="form-floating col">
<select id="forn" @bind="@fluxToShow.ExtLocationId" class="form-select" style="@enable">
<option value="">---Selezionare Fornitore---</option>
@if (listLocation != null)
{
@foreach (var item in listLocation.Where(x => x.LocTypeId == "FOR").ToList())
@@ -125,6 +126,7 @@
</div>
<div class="form-floating col">
<select id="cliente" @bind="@fluxToShow.ExtLocationId" class="form-select" style="@enable">
<option value="">---Selezionare Cliente---</option>
@if (listLocation != null)
{
@foreach (var item in listLocation.Where(x => x.LocTypeId == "CLI").ToList())
+19 -10
View File
@@ -1,5 +1,6 @@
using EgwCoreLib.Razor;
using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
using StockMan.CORE.Data;
using StockMan.Data.DbModels;
@@ -12,7 +13,8 @@ namespace StockMan.CORE.Components
[Inject]
protected StockDataService SDService { get; set; } = null!;
[Parameter]
public string userName { get; set; } = "";
protected List<ItemFluxModel> searchtemFlux { get; set; } = new List<ItemFluxModel>();
protected List<ItemFluxModel> itemFlux { get; set; } = new List<ItemFluxModel>();
protected List<LocationModel> listLocation { get; set; } = new List<LocationModel>();
@@ -102,10 +104,10 @@ namespace StockMan.CORE.Components
Qta = qta,
TotValue = importo,
UnitVal = (importo / qta),
OperatorId = "ND",
OperatorId = userName,
Note = note,
CodDoc = documento,
ModOperatorId = "ND"
ModOperatorId = userName
};
var done = await SDService.FluxAdd(newRec);
@@ -126,7 +128,7 @@ namespace StockMan.CORE.Components
protected bool isRettifica { get; set; } = false;
protected string enable
{
get => (isDup || isMod ) ? "Background-color: #fff" : "Background-color: #e9ecef; pointer-events: none";
get => (isDup || isMod) ? "Background-color: #fff" : "Background-color: #e9ecef; pointer-events: none";
}
protected async Task dupMode()
@@ -147,10 +149,10 @@ namespace StockMan.CORE.Components
DtMov = DateTime.Now.Date,
Qta = fluxToShow.Qta,
TotValue = fluxToShow.TotValue,
OperatorId = "ND",
OperatorId = userName,
Note = "---DUPLICATED---",
CodDoc = fluxToShow.CodDoc,
ModOperatorId = "ND"
ModOperatorId = userName
};
var done = await SDService.FluxAdd(newRec);
@@ -160,15 +162,22 @@ namespace StockMan.CORE.Components
}
}
[Inject]
protected IJSRuntime JSRuntime { get; set; } = null!;
protected async Task delete(ItemFluxModel flux)
{
await Task.Delay(1);
var done = await SDService.DeleteFlux(flux);
if (done)
var ok = await JSRuntime.InvokeAsync<bool>("confirm", $"Confermare di voler eliminare il movimento in data {flux.DtMov.Date}");
if (ok)
{
NavManager.NavigateTo(NavManager.Uri, true);
var done = await SDService.DeleteFlux(flux);
if (done)
{
NavManager.NavigateTo(NavManager.Uri, true);
}
}
}
protected async Task edit()
@@ -261,7 +270,7 @@ namespace StockMan.CORE.Components
protected string dateCss(DateTime? dataToCheck)
{
string answ = "";
if(dataToCheck == null)
if (dataToCheck != null)
{
answ = "text-decoration-line-through";
}
@@ -12,7 +12,6 @@
border: none;
padding: 0;
text-align: center;
margin-right: 1rem;
}
.btnMod {
border-radius: 50%;
@@ -22,7 +21,6 @@
border: none;
padding: 0;
text-align: center;
margin-right: 1rem;
background-color: rgba(52, 152, 219, 0.2);
color: #3498DB;
}
@@ -34,7 +32,6 @@
border: none;
padding: 0;
text-align: center;
margin-right: 1rem;
background-color: rgba(86, 184, 167, 0.2);
color: #56b8a7;
}
@@ -46,7 +43,6 @@
border: none;
padding: 0;
text-align: center;
margin-right: 1rem;
background-color: rgba(192, 57, 43, 0.2);
color: #C0392B;
}
@@ -58,7 +54,6 @@
border: none;
padding: 0;
text-align: center;
margin-right: 1rem;
background-color: rgba(254, 152, 83, 0.2);
color: #fe9853;
}
@@ -11,7 +11,7 @@
border: none;
padding: 0;
text-align: center;
margin-right: 1rem;
//margin-right: 1rem;
}
.btnMod {
+1 -1
View File
@@ -1 +1 @@
.modItem input,.modItem textarea,.modItem select{font-size:.8rem;background-color:#e9ecef;}.buttonGlobal{border-radius:50%;padding:.5rem;width:2.8rem;height:2.8rem;border:0;padding:0;text-align:center;margin-right:1rem;}.btnMod{border-radius:50%;padding:.5rem;width:2.8rem;height:2.8rem;border:0;padding:0;text-align:center;margin-right:1rem;background-color:rgba(52,152,219,.2);color:#3498db;}.btnAccept{border-radius:50%;padding:.5rem;width:2.8rem;height:2.8rem;border:0;padding:0;text-align:center;margin-right:1rem;background-color:rgba(86,184,167,.2);color:#56b8a7;}.btnDecline{border-radius:50%;padding:.5rem;width:2.8rem;height:2.8rem;border:0;padding:0;text-align:center;margin-right:1rem;background-color:rgba(192,57,43,.2);color:#c0392b;}.btnDup{border-radius:50%;padding:.5rem;width:2.8rem;height:2.8rem;border:0;padding:0;text-align:center;margin-right:1rem;background-color:rgba(254,152,83,.2);color:#fe9853;}
.modItem input,.modItem textarea,.modItem select{font-size:.8rem;background-color:#e9ecef;}.buttonGlobal{border-radius:50%;padding:.5rem;width:2.8rem;height:2.8rem;border:0;padding:0;text-align:center;}.btnMod{border-radius:50%;padding:.5rem;width:2.8rem;height:2.8rem;border:0;padding:0;text-align:center;background-color:rgba(52,152,219,.2);color:#3498db;}.btnAccept{border-radius:50%;padding:.5rem;width:2.8rem;height:2.8rem;border:0;padding:0;text-align:center;background-color:rgba(86,184,167,.2);color:#56b8a7;}.btnDecline{border-radius:50%;padding:.5rem;width:2.8rem;height:2.8rem;border:0;padding:0;text-align:center;background-color:rgba(192,57,43,.2);color:#c0392b;}.btnDup{border-radius:50%;padding:.5rem;width:2.8rem;height:2.8rem;border:0;padding:0;text-align:center;background-color:rgba(254,152,83,.2);color:#fe9853;}
+21 -15
View File
@@ -15,26 +15,24 @@
</tr>
</thead>
<tbody>
@if (itemFlux != null)
@if (itemStock != null)
{
foreach (var flux in itemFlux)
{
<tr>
<td>
@flux.LocationId
</td>
<td>
@flux.Qta
</td>
</tr>
}
<tr>
<td>
@itemStock.LocationId
</td>
<td>
@itemStock.QtyConf
</td>
</tr>
}
</tbody>
</table>
<div class="row">
<button class="btn btn-outline-primary col mx-1" @onclick="()=>confermaMovimenti()"><i class="fa-solid fa-download"></i>&nbsp; Conferma Movimenti</button>
<button class="btn btn-outline-primary col mx-1">Elimina Duplicati &nbsp;<i class="fa-solid fa-delete-left"></i></button>
<button class="btn btn-outline-primary col mx-1" @onclick="()=>eliminaDuplicati()">Elimina Duplicati &nbsp;<i class="fa-solid fa-delete-left"></i></button>
</div>
<div class="row mt-2">
@if (!isCarico)
@@ -130,8 +128,16 @@
<label for="qta" class="form-label">Quantità</label>
</div>
<div class="form-floating col">
<input id="importo" type="number" @bind="@importo" class="form-control w-100 my-1" />
<label for="importo" class="form-label">Importo</label>
@if (isScarico || isRettifica)
{
<input id="importo" type="number" @bind="@importo" class="form-control w-100 my-1" disabled />
<label for="importo" class="form-label">Importo</label>
}
else
{
<input id="importo" type="number" @bind="@importo" class="form-control w-100 my-1" />
<label for="importo" class="form-label">Importo</label>
}
</div>
</div>
<div class="form-floating col">
@@ -12,8 +12,10 @@ namespace StockMan.CORE.Components
[Inject]
protected StockDataService SDService { get; set; } = null!;
[Parameter]
public string userName { get; set; } = "";
protected List<ItemFluxModel> itemFlux { get; set; } = new List<ItemFluxModel>();
protected ItemStockModel itemStock { get; set; } = new ItemStockModel();
protected List<LocationModel> listLocation { get; set; } = new List<LocationModel>();
protected DataPager? pagerItemDetails = null!;
@@ -27,6 +29,11 @@ namespace StockMan.CORE.Components
await Task.Delay(1);
itemFlux = await SDService.ItemFluxGetById(ItemID);
var Stock = await SDService.ItemsStockGetById(ItemID);
if (Stock != null)
{
itemStock = Stock.FirstOrDefault();
}
listLocation = await SDService.LocationGetAll();
}
@@ -39,6 +46,14 @@ namespace StockMan.CORE.Components
NavManager.NavigateTo(NavManager.Uri, true);
}
}
private async Task eliminaDuplicati()
{
var done = await SDService.EliminaDup(ItemID);
if (done)
{
NavManager.NavigateTo(NavManager.Uri, true);
}
}
private async Task saveCarico()
{
@@ -51,13 +66,13 @@ namespace StockMan.CORE.Components
{
movTipo = "CAR";
cliOrForn = fornitore;
qtaScarCar = 0+qta;
qtaScarCar = 0 + qta;
}
else if (isScarico)
{
movTipo = "SCAR";
cliOrForn = cliente;
qtaScarCar = 0-qta;
qtaScarCar = 0 - qta;
}
else if (isRettifica)
{
@@ -74,10 +89,10 @@ namespace StockMan.CORE.Components
DtMov = DateTime.Now.Date,
Qta = qtaScarCar,
TotValue = importo,
OperatorId = "ND",
OperatorId = userName,
Note = note,
CodDoc = documento,
ModOperatorId = "ND"
ModOperatorId = userName
};
var done = await SDService.FluxAdd(newRec);
@@ -85,12 +100,12 @@ namespace StockMan.CORE.Components
{
NavManager.NavigateTo(NavManager.Uri, true);
}
}
}
[Parameter]
public int ItemID { get; set; } = 0;
[Parameter]
public decimal valoreUnit { get; set; } = 0.0M;
public decimal valoreUnit { get; set; } = 0.0M;
protected bool isCarico { get; set; } = false;
protected bool isScarico { get; set; } = false;
@@ -12,7 +12,6 @@
border: none;
padding: 0;
text-align: center;
margin-right: 1rem;
}
.btnMod {
border-radius: 50%;
@@ -22,7 +21,6 @@
border: none;
padding: 0;
text-align: center;
margin-right: 1rem;
background-color: rgba(52, 152, 219, 0.2);
color: #3498DB;
}
@@ -34,7 +32,6 @@
border: none;
padding: 0;
text-align: center;
margin-right: 1rem;
background-color: rgba(86, 184, 167, 0.2);
color: #56b8a7;
}
@@ -46,7 +43,6 @@
border: none;
padding: 0;
text-align: center;
margin-right: 1rem;
background-color: rgba(192, 57, 43, 0.2);
color: #C0392B;
}
@@ -11,7 +11,7 @@
border: none;
padding: 0;
text-align: center;
margin-right: 1rem;
//margin-right: 1rem;
}
.btnMod {
+1 -1
View File
@@ -1 +1 @@
.modItem input,.modItem textarea,.modItem select{font-size:.8rem;background-color:#e9ecef;}.buttonGlobal{border-radius:50%;padding:.5rem;width:2.8rem;height:2.8rem;border:0;padding:0;text-align:center;margin-right:1rem;}.btnMod{border-radius:50%;padding:.5rem;width:2.8rem;height:2.8rem;border:0;padding:0;text-align:center;margin-right:1rem;background-color:rgba(52,152,219,.2);color:#3498db;}.btnAccept{border-radius:50%;padding:.5rem;width:2.8rem;height:2.8rem;border:0;padding:0;text-align:center;margin-right:1rem;background-color:rgba(86,184,167,.2);color:#56b8a7;}.btnDecline{border-radius:50%;padding:.5rem;width:2.8rem;height:2.8rem;border:0;padding:0;text-align:center;margin-right:1rem;background-color:rgba(192,57,43,.2);color:#c0392b;}
.modItem input,.modItem textarea,.modItem select{font-size:.8rem;background-color:#e9ecef;}.buttonGlobal{border-radius:50%;padding:.5rem;width:2.8rem;height:2.8rem;border:0;padding:0;text-align:center;}.btnMod{border-radius:50%;padding:.5rem;width:2.8rem;height:2.8rem;border:0;padding:0;text-align:center;background-color:rgba(52,152,219,.2);color:#3498db;}.btnAccept{border-radius:50%;padding:.5rem;width:2.8rem;height:2.8rem;border:0;padding:0;text-align:center;background-color:rgba(86,184,167,.2);color:#56b8a7;}.btnDecline{border-radius:50%;padding:.5rem;width:2.8rem;height:2.8rem;border:0;padding:0;text-align:center;background-color:rgba(192,57,43,.2);color:#c0392b;}
+49
View File
@@ -0,0 +1,49 @@
namespace StockMan.CORE.Data
{
public class MessageService
{
#region Public Events
public event Action EA_UserName = null!;
#endregion Public Events
#region Public Properties
public string newUserName
{
get => _newUserName;
set
{
if (_newUserName != value)
{
_newUserName = value;
reportUserName();
}
}
}
#endregion Public Properties
#region Protected Methods
protected void reportUserName()
{
if (EA_UserName != null)
{
EA_UserName?.Invoke();
}
}
#endregion Protected Methods
#region Private Fields
#endregion Private Fields
#region Private Properties
private string _newUserName { get; set; } = "";
#endregion Private Properties
}
}
+77
View File
@@ -345,6 +345,46 @@ namespace StockMan.CORE.Data
Log.Debug($"ItemFluxGetById | {source} in: {ts.TotalMilliseconds} ms");
return dbResult;
}
/// <summary>
/// Lista flussi x item da cercare
/// </summary>
/// <returns></returns>
public async Task<OperatorModel> OperatorsGetByCodExt(string id)
{
string source = "DB";
OperatorModel? dbResult = new OperatorModel();
string currKey = $"{rKeyOperator}:Id:{id}";
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
string? rawData = await redisDb.StringGetAsync(currKey);
if (!string.IsNullOrEmpty(rawData))
{
source = "REDIS";
var tempResult = JsonConvert.DeserializeObject<OperatorModel>(rawData);
if (tempResult == null)
{
dbResult = new OperatorModel();
}
else
{
dbResult = tempResult;
}
}
else
{
dbResult = dbController.OperatorsGetByCodExt(id);
rawData = JsonConvert.SerializeObject(dbResult, JSSettings);
await redisDb.StringSetAsync(currKey, rawData, LongCache);
}
if (dbResult == null)
{
dbResult = new OperatorModel();
}
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Debug($"OperatorsGetByCodExt | {source} in: {ts.TotalMilliseconds} ms");
return dbResult;
}
public async Task<bool> ConfermaMov(int itemID)
{
@@ -358,6 +398,18 @@ namespace StockMan.CORE.Data
Log.Debug($"ConfermaMov Read from {source}: {ts.TotalMilliseconds}ms");
return result;
}
public async Task<bool> EliminaDup(int itemID)
{
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
bool result = false;
string source = "DB";
result = await dbController.EliminaDup(itemID);
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Debug($"EliminaDup Read from {source}: {ts.TotalMilliseconds}ms");
return result;
}
/// <summary>
/// Lista Articoli da ricerca
@@ -541,6 +593,31 @@ namespace StockMan.CORE.Data
Log.Debug($"ItemsGetByID | {source} in: {ts.TotalMilliseconds} ms");
return dbResult;
}
/// <summary>
/// Lista Stock da cercare
/// </summary>
/// <returns></returns>
public async Task<List<ItemStockModel>> ItemsStockGetById(int ItemID)
{
string source = "DB";
List<ItemStockModel>? dbResult = new List<ItemStockModel>();
string currKey = "";
currKey = $"{rKeyItemStock}:Id:{ItemID}";
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
string? rawData = await redisDb.StringGetAsync(currKey);
dbResult = dbController.ItemsStockGetById(ItemID);
rawData = JsonConvert.SerializeObject(dbResult, JSSettings);
await redisDb.StringSetAsync(currKey, rawData, LongCache);
if (dbResult == null)
{
dbResult = new List<ItemStockModel>();
}
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Debug($"ItemsStockGetById | {source} in: {ts.TotalMilliseconds} ms");
return dbResult;
}
#endregion Public Methods
+4 -2
View File
@@ -1,6 +1,8 @@
@using StockMan.CORE.Components;
@page "/AnagraficaArticoli"
<ItemList updateRecordCount="UpdateTotCount" actFilter="@currFilter"></ItemList>
<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" />
<DataPager @ref="pagerFamArt" PageSize="@numRecord" currPage="@currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="@totalCount" showLoading="@isLoading" />
</div>
+25 -3
View File
@@ -6,11 +6,33 @@
{
<div class="row">
<div class="col-5">
<DettagliArticolo ItemID="@ItemID"></DettagliArticolo>
@if (currOpr != null)
{
<DettagliArticolo userName="@currOpr.Id" ItemID="@ItemID"></DettagliArticolo>
}
else
{
<DettagliArticolo userName="ND" ItemID="@ItemID"></DettagliArticolo>
}
</div>
<div class="col-7">
<StockGiacenze ItemID="@ItemID"></StockGiacenze>
<Movimenti valoreUnit="@itemToDet.CurrValue" ItemID="@ItemID"></Movimenti>
@if (currOpr != null)
{
<StockGiacenze userName="@currOpr.Id" ItemID="@ItemID"></StockGiacenze>
}
else
{
<StockGiacenze userName="ND" ItemID="@ItemID"></StockGiacenze>
}
@if (currOpr != null)
{
<Movimenti userName="@currOpr.Id" valoreUnit="@itemToDet.CurrValue" ItemID="@ItemID"></Movimenti>
}
else
{
<Movimenti userName="ND" valoreUnit="@itemToDet.CurrValue" ItemID="@ItemID"></Movimenti>
}
</div>
</div>
}
+9 -15
View File
@@ -32,6 +32,7 @@ namespace StockMan.CORE.Pages
protected List<ItemFamilyModel> itemFams { get; set; } = new List<ItemFamilyModel>();
//protected ItemFluxModel? flux { get; set; } = null;
protected List<LocationModel> listLocation { get; set; } = new List<LocationModel>();
protected OperatorModel currOpr { get; set; } = new OperatorModel();
protected DataPager? pagerItemDetails = null!;
protected override async Task OnInitializedAsync()
{
@@ -59,6 +60,7 @@ namespace StockMan.CORE.Pages
itemFams = await SDService.ItemFamilyGetAll();
listLocation = await SDService.LocationGetAll();
currOpr = await SDService.OperatorsGetByCodExt(userName);
await Task.Delay(1);
}
@@ -67,21 +69,13 @@ namespace StockMan.CORE.Pages
await Task.Delay(1);
isMod = true;
}
//protected void setFlux(ItemFluxModel currFlux)
//{
// ItemID = currFlux.ItemId;
// pos = currFlux.LocationId,
// movTipo = currFlux.MovTypeId,
// ExtLocationId = cliOrForn,
// DtMov = DateTime.Now.Date,
// Qta = qtaScarCar,
// TotValue = importo,
// OperatorId = "ND",
// Note = note,
// CodDoc = documento,
// ModOperatorId = "ND"
// fornitore = currFlux.;
//}
[Inject]
protected MessageService MService { get; set; } = null!;
protected string userName
{
get => MService.newUserName;
}
protected int ItemID { get; set; } = 0;
protected decimal valoreUnit { get; set; } = 0.00M;
protected bool isMod { get; set; } = false;
@@ -12,7 +12,6 @@
border: none;
padding: 0;
text-align: center;
margin-right: 1rem;
}
.btnMod {
border-radius: 50%;
@@ -22,7 +21,6 @@
border: none;
padding: 0;
text-align: center;
margin-right: 1rem;
background-color: rgba(52, 152, 219, 0.2);
color: #3498DB;
}
@@ -34,7 +32,6 @@
border: none;
padding: 0;
text-align: center;
margin-right: 1rem;
background-color: rgba(86, 184, 167, 0.2);
color: #56b8a7;
}
@@ -46,7 +43,6 @@
border: none;
padding: 0;
text-align: center;
margin-right: 1rem;
background-color: rgba(192, 57, 43, 0.2);
color: #C0392B;
}
+1 -1
View File
@@ -11,7 +11,7 @@
border: none;
padding: 0;
text-align: center;
margin-right: 1rem;
//margin-right: 1rem;
}
.btnMod {
+1 -1
View File
@@ -1 +1 @@
.modItem input,.modItem textarea,.modItem select{font-size:.8rem;background-color:#e9ecef;}.buttonGlobal{border-radius:50%;padding:.5rem;width:2.8rem;height:2.8rem;border:0;padding:0;text-align:center;margin-right:1rem;}.btnMod{border-radius:50%;padding:.5rem;width:2.8rem;height:2.8rem;border:0;padding:0;text-align:center;margin-right:1rem;background-color:rgba(52,152,219,.2);color:#3498db;}.btnAccept{border-radius:50%;padding:.5rem;width:2.8rem;height:2.8rem;border:0;padding:0;text-align:center;margin-right:1rem;background-color:rgba(86,184,167,.2);color:#56b8a7;}.btnDecline{border-radius:50%;padding:.5rem;width:2.8rem;height:2.8rem;border:0;padding:0;text-align:center;margin-right:1rem;background-color:rgba(192,57,43,.2);color:#c0392b;}
.modItem input,.modItem textarea,.modItem select{font-size:.8rem;background-color:#e9ecef;}.buttonGlobal{border-radius:50%;padding:.5rem;width:2.8rem;height:2.8rem;border:0;padding:0;text-align:center;}.btnMod{border-radius:50%;padding:.5rem;width:2.8rem;height:2.8rem;border:0;padding:0;text-align:center;background-color:rgba(52,152,219,.2);color:#3498db;}.btnAccept{border-radius:50%;padding:.5rem;width:2.8rem;height:2.8rem;border:0;padding:0;text-align:center;background-color:rgba(86,184,167,.2);color:#56b8a7;}.btnDecline{border-radius:50%;padding:.5rem;width:2.8rem;height:2.8rem;border:0;padding:0;text-align:center;background-color:rgba(192,57,43,.2);color:#c0392b;}
+1 -1
View File
@@ -46,7 +46,7 @@ builder.Services.Configure<MailKitEmailSenderOptions>(options =>
builder.Services.AddRazorPages();
builder.Services.AddServerSideBlazor();
builder.Services.AddSingleton<StockDataService>();
//builder.Services.AddScoped<MessageService>();
builder.Services.AddScoped<MessageService>();
builder.Services.AddHttpContextAccessor();
builder.Services.AddSingleton<IConnectionMultiplexer>(redisMultiplexer);
+1 -1
View File
@@ -16,7 +16,7 @@
<a href="https://docs.microsoft.com/aspnet/" target="_blank">About</a>
</div>*@
<article class="content px-1 mb-3">
<article class="content px-3 mb-3">
@Body
</article>
</main>
+30 -3
View File
@@ -13,18 +13,45 @@ namespace StockMan.CORE.Shared
protected StockDataService SDService { get; set; } = null!;
protected List<PermessiModel>? navMenuLinks { get; set; } = null;
protected string userName { get; set; } = "";
public EventCallback<string> UserNameCB { get; set; }
public string userName
{
get
{
return MService.newUserName;
}
set
{
MService.newUserName = value;
reportChange();
}
}
[Inject]
protected AuthenticationStateProvider AuthenticationStateProvider { get; set; } = null!;
[Inject]
protected MessageService MService { get; set; } = null!;
#endregion Protected Properties
#region Protected Methods
protected override async Task OnInitializedAsync()
{
await forceReload();
await forceReload();
navMenuLinks = await SDService.PermessiGetAll();
MService.EA_UserName += OnNewUserName;
}
public async void OnNewUserName()
{
await InvokeAsync(() =>
{
StateHasChanged();
});
}
private void reportChange()
{
UserNameCB.InvokeAsync(userName);
}
private async Task forceReload()
{
@@ -548,6 +548,24 @@ namespace StockMan.Data.Controllers
}
return dbResult;
}
/// <summary>
/// Lista Item Stock (By ID)
/// </summary>
/// <param name="ItemID"></param>
/// <returns></returns>
public List<ItemStockModel> ItemsStockGetById(int ItemID)
{
List<ItemStockModel> dbResult = new List<ItemStockModel>();
using (StockManContext localDbCtx = new StockManContext(_configuration))
{
dbResult = localDbCtx
.DbSetItemStock
.Where(x=>x.ItemId == ItemID)
.OrderBy(x => x.Id)
.ToList();
}
return dbResult;
}
/// <summary>
/// Lista Locazioni
@@ -617,6 +635,31 @@ namespace StockMan.Data.Controllers
}
return dbResult;
}
/// <summary>
/// Operatore cercato
/// </summary>
/// <returns></returns>
public OperatorModel OperatorsGetByCodExt(string codExt)
{
OperatorModel dbResult = new OperatorModel();
using (StockManContext localDbCtx = new StockManContext(_configuration))
{
var risultato = localDbCtx
.DbSetOperator
.Where(x=>x.CodExt == codExt)
.OrderBy(x => x.LastName)
.ThenBy(x => x.FirstName)
.FirstOrDefault();
if(risultato != null)
{
dbResult = risultato;
}
}
return dbResult;
}
/// <summary>
/// Lista Flux x item
/// </summary>
@@ -656,6 +699,26 @@ namespace StockMan.Data.Controllers
}
return answ;
}
/// <summary>
/// Elimina movimenti duplicati
/// </summary>
/// <param name="itemID"></param>
/// <returns></returns>
public async Task<bool> EliminaDup(int itemID)
{
bool answ = false;
using (var dbCtx = new StockManContext(_configuration))
{
var ItemID = new SqlParameter("@ItemID", itemID);
var callResulr = await dbCtx
.Database
.ExecuteSqlRawAsync("exec dbo.stp_ItemShrinkHist @ItemID", ItemID);
answ = true;
}
return answ;
}
#endregion Public Methods