diff --git a/StockMan.CORE/Components/ItemFamList.razor.cs b/StockMan.CORE/Components/ItemFamList.razor.cs
index aa08162..2581fc6 100644
--- a/StockMan.CORE/Components/ItemFamList.razor.cs
+++ b/StockMan.CORE/Components/ItemFamList.razor.cs
@@ -18,6 +18,9 @@ namespace StockMan.CORE.Components
//public int CurrPage { get; set; } = 1;
[Parameter]
public ItemFamSelectFilter actFilter { get; set; } = new ItemFamSelectFilter();
+ protected ItemSelectFilter itemFilter { get; set; } = new ItemSelectFilter();
+
+
[Inject]
protected StockDataService SDService { get; set; } = null!;
@@ -103,6 +106,7 @@ namespace StockMan.CORE.Components
// await JSRuntime.InvokeVoidAsync("selectItem", id);
//}
currRowSel = item.Id;
+ itemFilter.Id = item.Id;
currModel = item;
await selectedItemFam.InvokeAsync(currModel);
}
diff --git a/StockMan.CORE/Components/ItemList.razor b/StockMan.CORE/Components/ItemList.razor
index 58d04c2..37747d8 100644
--- a/StockMan.CORE/Components/ItemList.razor
+++ b/StockMan.CORE/Components/ItemList.razor
@@ -1,7 +1,23 @@
-
-
-
+
+
+
+
+
+
+
+
+
+
diff --git a/StockMan.CORE/Components/ItemList.razor.cs b/StockMan.CORE/Components/ItemList.razor.cs
index b56495e..8a70c96 100644
--- a/StockMan.CORE/Components/ItemList.razor.cs
+++ b/StockMan.CORE/Components/ItemList.razor.cs
@@ -85,9 +85,9 @@ namespace StockMan.CORE.Components
private async Task reloadData()
{
isLoading = true;
- if (searchVal != "")
+ if (searchVal != "" || searchFamily != "*")
{
- SearchRecords = await SDService.ItemsGetSearch(searchVal);
+ SearchRecords = await SDService.ItemsGetSearch(searchVal, searchFamily);
}
else
{
@@ -209,6 +209,16 @@ namespace StockMan.CORE.Components
reloadData();
}
}
+ //protected string _searchFamily = "";
+ protected string searchFamily
+ {
+ get => actFilter.Id;
+ set
+ {
+ actFilter.Id = value;
+ reloadData();
+ }
+ }
protected string _descArt = "";
protected string descArt
diff --git a/StockMan.CORE/Data/ItemFamSelectFilter.cs b/StockMan.CORE/Data/ItemFamSelectFilter.cs
index e4ecccb..278e6d2 100644
--- a/StockMan.CORE/Data/ItemFamSelectFilter.cs
+++ b/StockMan.CORE/Data/ItemFamSelectFilter.cs
@@ -31,7 +31,7 @@
CurrPage = this.CurrPage,
MaxRecord = this.MaxRecord,
NumRec = this.NumRec,
- TotCount = this.TotCount
+ TotCount = this.TotCount,
};
return clonedData;
}
diff --git a/StockMan.CORE/Data/ItemSelectFilter.cs b/StockMan.CORE/Data/ItemSelectFilter.cs
index 60c668b..17f8520 100644
--- a/StockMan.CORE/Data/ItemSelectFilter.cs
+++ b/StockMan.CORE/Data/ItemSelectFilter.cs
@@ -19,6 +19,7 @@
public int NumRec { get; set; } = 10;
public int TotCount { get; set; } = 0;
+ public string Id { get; set; } = "*";
#endregion Public Properties
@@ -31,7 +32,8 @@
CurrPage = this.CurrPage,
MaxRecord = this.MaxRecord,
NumRec = this.NumRec,
- TotCount = this.TotCount
+ TotCount = this.TotCount,
+ Id = this.Id
};
return clonedData;
}
@@ -56,6 +58,9 @@
if (CurrPage != item.CurrPage)
return false;
+ if (Id != item.Id)
+ return false;
+
return true;
}
diff --git a/StockMan.CORE/Data/StockDataService.cs b/StockMan.CORE/Data/StockDataService.cs
index e15e37b..a007e96 100644
--- a/StockMan.CORE/Data/StockDataService.cs
+++ b/StockMan.CORE/Data/StockDataService.cs
@@ -109,7 +109,7 @@ namespace StockMan.CORE.Data
}
///
- /// Aggiornamento record selezionato
+ /// Aggiornamento record selezionato famiglia item
///
///
///
@@ -122,6 +122,20 @@ namespace StockMan.CORE.Data
await Task.Delay(1);
return dbResult;
}
+ ///
+ /// Aggiornamento record selezionato item
+ ///
+ ///
+ ///
+ public async Task
ItemMod(ItemModel currRec)
+ {
+ var dbResult = await dbController.ItemMod(currRec);
+ // elimino cache redis...
+ RedisValue pattern = new RedisValue($"{rKeyItems}:*");
+ bool answ = await ExecFlushRedisPattern(pattern);
+ await Task.Delay(1);
+ return dbResult;
+ }
///
@@ -330,6 +344,46 @@ namespace StockMan.CORE.Data
Log.Debug($"ItemsGetAll | {source} in: {ts.TotalMilliseconds} ms");
return dbResult;
}
+ ///
+ /// Lista Location
+ ///
+ ///
+ public async Task> LocationGetAll()
+ {
+ string source = "DB";
+ List? dbResult = new List();
+ string currKey = $"{rKeyLocation}:*";
+ Stopwatch stopWatch = new Stopwatch();
+ stopWatch.Start();
+ string? rawData = await redisDb.StringGetAsync(currKey);
+ if (!string.IsNullOrEmpty(rawData))
+ {
+ source = "REDIS";
+ var tempResult = JsonConvert.DeserializeObject>(rawData);
+ if (tempResult == null)
+ {
+ dbResult = new List();
+ }
+ else
+ {
+ dbResult = tempResult;
+ }
+ }
+ else
+ {
+ dbResult = dbController.LocationGetAll();
+ rawData = JsonConvert.SerializeObject(dbResult, JSSettings);
+ await redisDb.StringSetAsync(currKey, rawData, LongCache);
+ }
+ if (dbResult == null)
+ {
+ dbResult = new List();
+ }
+ stopWatch.Stop();
+ TimeSpan ts = stopWatch.Elapsed;
+ Log.Debug($"LocationGetAll | {source} in: {ts.TotalMilliseconds} ms");
+ return dbResult;
+ }
/////
///// Lista Articoli da ricerca
@@ -375,15 +429,27 @@ namespace StockMan.CORE.Data
/// Lista Articoli da ricerca
///
///
- public async Task> ItemsGetSearch(string searcVal)
+ public async Task> ItemsGetSearch(string searcVal, string itemFamId)
{
string source = "DB";
List? dbResult = new List();
- string currKey = $"{rKeyItems}:Search:{searcVal}";
+ string currKey = "";
+ if (itemFamId != "*" && string.IsNullOrEmpty(searcVal))
+ {
+ currKey = $"{rKeyItems}:Search:{searcVal}";
+ }
+ else if(!string.IsNullOrEmpty(searcVal) && itemFamId == "*")
+ {
+ currKey = $"{rKeyItems}:Family:{itemFamId}";
+ }
+ else
+ {
+ currKey = $"{rKeyItems}:Family:{itemFamId}:Search:{searcVal}";
+ }
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
string? rawData = await redisDb.StringGetAsync(currKey);
- dbResult = dbController.ItemsGetSearch(searcVal);
+ dbResult = dbController.ItemsGetSearch(searcVal, itemFamId);
rawData = JsonConvert.SerializeObject(dbResult, JSSettings);
await redisDb.StringSetAsync(currKey, rawData, LongCache);
if (dbResult == null)
diff --git a/StockMan.CORE/Pages/ItemDetails.razor b/StockMan.CORE/Pages/ItemDetails.razor
index 67503eb..3b8c94d 100644
--- a/StockMan.CORE/Pages/ItemDetails.razor
+++ b/StockMan.CORE/Pages/ItemDetails.razor
@@ -5,53 +5,78 @@
{