unione locations

This commit is contained in:
zaccaria.majid
2023-02-28 16:59:16 +01:00
parent d7235a19bc
commit daa7c49d30
6 changed files with 154 additions and 82 deletions
+9 -4
View File
@@ -1,9 +1,13 @@
@if (listItemByLoc != null)
@if (isLoading)
{
<LoadingData></LoadingData>
}
else
{
<div class="card">
<div class="card-header bg-primary text-light d-flex justify-content-between">
<div class="card-header @bgCard text-light d-flex justify-content-between">
<div class="py-2">
SPOSTARE DA:
@locSxoDx
</div>
<div>
<select class="form-select" @bind="@id">
@@ -73,4 +77,5 @@
</table>
</div>
</div>
}
}
+51 -10
View File
@@ -18,6 +18,7 @@ using StockMan.CORE.Data;
using StockMan.CORE.Shared;
using StockMan.Data.DbModels;
using StockMan.Data;
using StackExchange.Redis;
namespace StockMan.CORE.Components
{
@@ -26,7 +27,7 @@ namespace StockMan.CORE.Components
[Parameter]
public string locSX_ID { get; set; } = "";
[Parameter]
public bool isSX { get; set; } = false;
public bool isSX { get; set; }
[Parameter]
public string locDX_ID { get; set; } = "";
public string currLoc { get; set; } = "";
@@ -41,8 +42,13 @@ namespace StockMan.CORE.Components
public string UserName { get; set; } = "";
[Parameter]
public bool isChanged { get; set; } = false;
[Parameter]
public EventCallback<string> LocId_SX { get; set; }
[Parameter]
public EventCallback<string> LocId_DX { get; set; }
public ItemStockModel? currStock { get; set; } = null;
public int qty { get; set; } = 0;
public bool isLoading { get; set; } = false;
[Inject]
protected IJSRuntime JSRuntime { get; set; } = null!;
@@ -60,10 +66,25 @@ namespace StockMan.CORE.Components
set
{
currLoc = value;
if (isSX)
{
setLocationSX(value);
}
else
{
setLocationDX(value);
}
ReloadData();
}
}
protected async Task setLocationSX(string locId)
{
await LocId_SX.InvokeAsync(locId);
}
protected async Task setLocationDX(string locId)
{
await LocId_DX.InvokeAsync(locId);
}
protected string rawCode
{
get
@@ -73,22 +94,42 @@ namespace StockMan.CORE.Components
return answ;
}
}
protected string bgCard
{
get => isSX ? "bg-primary" : "bg-success";
}
protected string locSxoDx
{
get => isSX ? "Locazione mittente:" : "locazione destinatario:";
}
protected override async Task OnParametersSetAsync()
{
if (isSX && !isChanged)
{
currLoc = locSX_ID;
}
else if (isSX && isChanged)
{
currLoc = locDX_ID;
}
else if (!isSX && !isChanged)
{
currLoc = locDX_ID;
}
else if (!isSX && isChanged)
{
currLoc = locSX_ID;
}
await ReloadData();
}
protected async Task ReloadData()
{
if (!isSX)
{
currLoc = locSX_ID;
}
else
{
currLoc = locDX_ID;
}
isLoading = true;
listItemByLoc = await SDService.ItemsGetByLocation(currLoc);
isLoading = false;
}
protected async Task Move()
{
+73 -60
View File
@@ -1,63 +1,76 @@
@if (LocationVals != null)
@if (isLoading)
{
<table class="table table-striped table-bordered small">
<thead>
<tr class="">
<th></th>
<th>
Descrizione
</th>
<th>
Articoli
</th>
<th>
Giacenza (qta tot)
</th>
<th>
Mov. aperti
</th>
<th>
Valore Articoli
</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach (var item in LocationVals)
{
<tr>
<td style="width: 0;" class="small">
<button class="btn btn-sm btn-primary" @onclick="()=>setLocationSX(item.LocationId)"><i class="fa-solid fa-arrow-turn-down fa-flip-horizontal small"></i></button>
</td>
<td>
@item.LocationNav.Descr
</td>
<td>
@item.NumArt
</td>
<td>
@item.TotCurr
</td>
<td>
@item.TotPend
</td>
<td class="text-end">
@($"{item.TotVal:C2}")
</td>
<td style="width: 0;" class="small">
<button class="btn btn-sm btn-info text-light" @onclick="()=>setLocationDX(item.LocationId)"><i class="fa-solid fa-arrow-turn-down small"></i></button>
</td>
<LoadingData></LoadingData>
}
@if (LocationVals == null || LocationVals.Count == 0)
{
<b>nessun record</b>
}
else
{
@if (!isCompact)
{
<table class="table table-striped table-bordered small">
<thead>
<tr class="">
<th></th>
<th>
Descrizione
</th>
<th>
Articoli
</th>
<th>
Giacenza (qta tot)
</th>
<th>
Mov. aperti
</th>
<th>
Valore Articoli
</th>
<th></th>
</tr>
}
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>Tot: <b>@($"{totStockValue:C2}")</b></td>
<td></td>
</tr>
</tbody>
</table>
</thead>
<tbody>
@foreach (var item in LocationVals)
{
<tr>
<td style="width: 0;" class="small">
<button class="btn btn-sm btn-primary" @onclick="()=>setLocationSX(item.LocationId)"><i class="fa-solid fa-arrow-turn-down fa-flip-horizontal small"></i></button>
</td>
<td>
@item.LocationNav.Descr
</td>
<td>
@item.NumArt
</td>
<td>
@item.TotCurr
</td>
<td>
@item.TotPend
</td>
<td class="text-end">
@($"{item.TotVal:C2}")
</td>
<td style="width: 0;" class="small">
<button class="btn btn-sm btn-info text-light" @onclick="()=>setLocationDX(item.LocationId)"><i class="fa-solid fa-arrow-turn-down small"></i></button>
</td>
</tr>
}
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>Tot: <b>@($"{totStockValue:C2}")</b></td>
<td></td>
</tr>
</tbody>
</table>
}
}
@@ -38,14 +38,18 @@ namespace StockMan.CORE.Components
[Parameter]
public EventCallback<string> LocId_DX { get; set; }
[Parameter]
public bool isCompact { get; set; } = false;
public List<VLocationValModel>? LocationVals { get; set; } = null;
public bool isLoading { get; set; } = false;
protected override async Task OnInitializedAsync()
{
isLoading = true;
await Task.Delay(1);
LocationVals = await SDService.StockStatus();
totStockValue = LocationVals.Sum(x => x.TotVal);
isLoading = false;
}
protected async Task setLocationSX(string locId)
+14 -7
View File
@@ -5,18 +5,25 @@
@if ((string.IsNullOrEmpty(currLocId_DX) && string.IsNullOrEmpty(currLocId_SX)) || (!string.IsNullOrEmpty(currLocId_DX) && string.IsNullOrEmpty(currLocId_SX)) || (string.IsNullOrEmpty(currLocId_DX) && !string.IsNullOrEmpty(currLocId_SX)))
{
<ValStockGiac LocId_SX="catchCurrLocId_SX" LocId_DX="catchCurrLocId_DX"></ValStockGiac>
<ValStockGiac isCompact="false" LocId_SX="catchCurrLocId_SX" LocId_DX="catchCurrLocId_DX"></ValStockGiac>
}
else
{
<button class="btn btn-danger mb-2" @onclick="()=>resetIds()">RESET</button>
<ValStockGiac isCompact="true" LocId_SX="catchCurrLocId_SX" LocId_DX="catchCurrLocId_DX"></ValStockGiac>
<div class="row">
<div class="col-6">
<button class="btn btn-danger mb-2" @onclick="()=>resetIds()">RESET</button>
</div>
<div class="col-6">
<button class="btn btn-sm bg-warning" @onclick="()=>Change()"> Scambia <i class="fa-solid fa-arrow-right-arrow-left"></i> </button>
</div>
</div>
}
<div class="row">
<div class="col-5">
<Location isSX=true isChanged="@isChanged" UserName="@currOpr.Id" locSX_ID="@currLocId_SX" locDX_ID="@currLocId_DX" ListLocationByType="@listLocationByType"></Location>
<div class="col">
<Location LocId_SX="catchCurrLocId_SX" isSX="true" isChanged="@isChanged" UserName="@currOpr.Id" locSX_ID="@currLocId_SX" locDX_ID="@currLocId_DX" ListLocationByType="@listLocationByType"></Location>
</div>
<div class="col-2 text-center"><button class="btn btn-sm bg-warning py-2" @onclick="()=>Change()"> Scambia <i class="fa-solid fa-arrow-right-arrow-left"></i> </button></div>
<div class="col-5">
<Location isSX=false isChanged="@isChanged" locDX_ID="@currLocId_DX" locSX_ID="@currLocId_SX" ListLocationByType="@listLocationByType"></Location>
<div class="col">
<Location LocId_DX="catchCurrLocId_DX" isSX="false" isChanged="@isChanged" locDX_ID="@currLocId_DX" locSX_ID="@currLocId_SX" ListLocationByType="@listLocationByType"></Location>
</div>
</div>
+2
View File
@@ -29,6 +29,8 @@ namespace StockMan.CORE.Pages
protected string currLocId_DX { get; set; } = "";
public List<LocationModel>? listLocationByType { get; set; } = null;
protected OperatorModel currOpr { get; set; } = new OperatorModel();
public bool isChanged { get; set; } = false;
protected async Task catchCurrLocId_SX(string locId)
{