Parziale integrazione INVE/Arca x lettura lotti
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
</div>
|
||||
<div class="d-flex justify-content-between flex-wrap">
|
||||
<div class="col-12 p-1">
|
||||
<TechSheet_ST_ObjCheck></TechSheet_ST_ObjCheck>
|
||||
<TechSheet_ST_ObjCheck CodArticolo="@CodArticolo"></TechSheet_ST_ObjCheck>
|
||||
</div>
|
||||
@if (ListGruppi.Count == 0)
|
||||
{
|
||||
@@ -29,7 +29,7 @@
|
||||
<div class="card-header">
|
||||
<b>@item.DescGruppo</b>
|
||||
</div>
|
||||
<div class="card-body small p-1">
|
||||
<div class="card-body small py-1">
|
||||
<TechSheet_ST_Detail CodArticolo="@CodArticolo" CodGruppo="@item.CodGruppo" IdxOdl="@IdxOdl"></TechSheet_ST_Detail>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
@if (showWarning)
|
||||
{
|
||||
<div class="text-danget text-center fs-3">@txtWarning</div>
|
||||
<div class="text-danger text-center fs-3">@txtWarning</div>
|
||||
}
|
||||
|
||||
@if (ListRecord.Count == 0)
|
||||
{
|
||||
<div class="alert alert-warning">NO record found</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<h3>TechSheet_ObjCheck</h3>
|
||||
|
||||
@code {
|
||||
|
||||
}
|
||||
<div class="input-group input-group-lg">
|
||||
<span class="input-group-text" id="inputGroup-sizing-default">Verifica</span>
|
||||
<input type="text" class="form-control" @bind="ScanValue">
|
||||
<button class="btn btn-warning text-uppercase"><i class="fa-solid fa-barcode"></i> read</button>
|
||||
</div>
|
||||
@@ -0,0 +1,167 @@
|
||||
using global::System;
|
||||
using global::System.Collections.Generic;
|
||||
using global::System.Linq;
|
||||
using global::System.Threading.Tasks;
|
||||
using global::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 MP_TAB_SERV;
|
||||
using MP_TAB_SERV.Shared;
|
||||
using MP_TAB_SERV.Components;
|
||||
using MP.Data;
|
||||
using MP.Data.DatabaseModels;
|
||||
using MP.Data.DTO;
|
||||
using MP.Data.Services;
|
||||
using Newtonsoft.Json;
|
||||
using NLog;
|
||||
using Amazon.Runtime.Internal.Util;
|
||||
|
||||
namespace MP_TAB_SERV.Components
|
||||
{
|
||||
public partial class TechSheet_ST_ObjCheck
|
||||
{
|
||||
[Parameter]
|
||||
public string CodArticolo { get; set; } = "";
|
||||
[Parameter]
|
||||
public int idxOdl { get; set; } = 0;
|
||||
|
||||
protected string ScanValue
|
||||
{
|
||||
get => "";
|
||||
set
|
||||
{
|
||||
lastScan = value;
|
||||
// processo
|
||||
processInput();
|
||||
}
|
||||
}
|
||||
[Inject]
|
||||
protected SharedMemService SMServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected TabDataService TabDServ { get; set; } = null!;
|
||||
/// <summary>
|
||||
/// procedura pricipale decodifica Barcode
|
||||
/// </summary>
|
||||
private void processInput()
|
||||
{
|
||||
bool found = false;
|
||||
bool batchOk = false;
|
||||
|
||||
List<ST_ActRow> tabRichieste = TabDServ.STAR_pendByOdl(idxOdl);
|
||||
List<AnagLottiArca> tabGiacenzeLotto = new List<AnagLottiArca>();
|
||||
|
||||
ST_ActRow datiBatchCheck;
|
||||
AnagLottiArca datiLotto;
|
||||
// per prima cosa recupero i valori "Pending" da leggere come candidati...
|
||||
#if false
|
||||
if (tabRichieste != null && tabRichieste.Count > 0)
|
||||
{
|
||||
// cerco per EQ come primo step...
|
||||
var trovatoEq = tabRichieste.Where(x => x.CheckType == "EQ" && x.Value == BCodeVal);
|
||||
if (trovatoEq != null && trovatoEq.Count() > 0)
|
||||
{
|
||||
// recupero record..
|
||||
var datiEqCheck = trovatoEq.FirstOrDefault();
|
||||
// registro trovato
|
||||
found = true;
|
||||
lblMessage.Text = $"Parametro acquisito: {BCodeVal}";
|
||||
lblMessage.CssClass = "text-success";
|
||||
// upsert controllo
|
||||
DataLayerObj.taSTChk.upsertQuery(idxOdl, datiEqCheck.IdxST, datiEqCheck.Oggetto, datiEqCheck.Num, BCodeVal, BCodeVal, true, user_std.UtSn.utente, false);
|
||||
}
|
||||
|
||||
// se non trovato
|
||||
if (!found)
|
||||
{
|
||||
// recupero record.. cercando in giacenza il LOTTO...
|
||||
tabGiacenzeLotto = DataLayerObj.taArcaGiac.getBySearch(null, "", BCodeVal, "", false);
|
||||
// controllo condizione tipo BATCH (speciale) - prima solo che CI SIA una richiesta di questo tipo
|
||||
var trovatoBatch = tabRichieste.Where(x => x.CheckType == "BATCH");
|
||||
if (trovatoBatch != null && trovatoBatch.Count() > 0)
|
||||
{
|
||||
datiBatchCheck = trovatoBatch.FirstOrDefault();
|
||||
if (tabGiacenzeLotto != null && tabGiacenzeLotto.Count > 0)
|
||||
{
|
||||
datiLotto = tabGiacenzeLotto.FirstOrDefault();
|
||||
|
||||
// registro trovato
|
||||
found = true;
|
||||
// upsert controllo
|
||||
DataLayerObj.taSTChk.upsertQuery(idxOdl, datiBatchCheck.IdxST, datiBatchCheck.Oggetto, datiBatchCheck.Num, BCodeVal, datiLotto.Cd_AR, true, user_std.UtSn.utente, false);
|
||||
// conto quanti check ci sono dopo, se calati --> ok altrimenti errore
|
||||
var tabRichiestePost = DataLayerObj.taSTAR.getPendingByOdl(idxOdl);
|
||||
if (tabRichiestePost.Count < tabRichieste.Count)
|
||||
{
|
||||
lblMessage.Text = $"Lotto riconosciuto: {BCodeVal} --> {datiLotto.Cd_AR} | Articolo acquisito";
|
||||
lblMessage.CssClass = "text-success";
|
||||
batchOk = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
lblMessage.Text = $"Lotto: {BCodeVal} --> {datiLotto.Cd_AR} | Articolo NON richiesto";
|
||||
lblMessage.CssClass = "text-danger";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!batchOk)
|
||||
{
|
||||
var currDeroga = DataLayerObj.getDerogaSt(tabRichieste[0].IdxST);
|
||||
// ciclo tra TUTTE le richeiste attive
|
||||
foreach (var item in tabRichieste)
|
||||
{
|
||||
// verifico EVENTUALI deroghe
|
||||
// se è deroga x gruppo/tipo/num corretto...
|
||||
if (currDeroga.CanForce && item.CodGruppo == currDeroga.CodGruppo && item.CodTipo == currDeroga.CodTipo && item.Num == currDeroga.Num && item.Oggetto == currDeroga.Oggetto)
|
||||
{
|
||||
// ... forzo accettazione deroga
|
||||
DataLayerObj.taSTChk.upsertQuery(idxOdl, item.IdxST, item.Oggetto, item.Num, BCodeVal, item.Value, true, user_std.UtSn.utente, true);
|
||||
lblMessage.Text = $"Lotto/articolo non valido: {BCodeVal} --> Forzato a valido per articolo {item.Value}";
|
||||
lblMessage.CssClass = "text-warning";
|
||||
DataLayerObj.setDerogaSt(new MapoSDK.StCheckOverride() { IdxST = item.IdxST, CanForce = false });
|
||||
batchOk = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// se non trovato
|
||||
if (!found)
|
||||
{
|
||||
if (tabGiacenzeLotto != null && tabGiacenzeLotto.Count > 0)
|
||||
{
|
||||
datiLotto = tabGiacenzeLotto.FirstOrDefault();
|
||||
lblMessage.Text = $"Lotto: {BCodeVal} --> {datiLotto.Cd_AR} | Articolo NON richiesto";
|
||||
lblMessage.CssClass = "text-danger";
|
||||
}
|
||||
else
|
||||
{
|
||||
lblMessage.Text = $"Parametro non riconosciuto: {BCodeVal}";
|
||||
lblMessage.CssClass = "text-secondary";
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
lblMessage.Text = $"Parametro non valido: {BCodeVal}";
|
||||
lblMessage.CssClass = "text-secondary";
|
||||
}
|
||||
|
||||
// sistemo visualizzaizone componente
|
||||
BCodeVal = "";
|
||||
checkInputData();
|
||||
// sollevo evento
|
||||
reportUpdate();
|
||||
#endif
|
||||
}
|
||||
|
||||
private string lastScan = "";
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
@if (CurrRec.CodTipo == "IMG")
|
||||
{
|
||||
<div class="row">
|
||||
<div class="row border-bottom">
|
||||
<div class="col-4 pr-0 text-start">
|
||||
@(Traduci(CurrRec.Label))
|
||||
</div>
|
||||
@@ -11,7 +11,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="row">
|
||||
<div class="row border-bottom">
|
||||
<div class="col-4 pr-0 text-start">
|
||||
@(Traduci(CurrRec.Label))
|
||||
</div>
|
||||
@@ -31,13 +31,15 @@ else
|
||||
{
|
||||
<small>(@CurrRec.ValueRead) </small>
|
||||
}
|
||||
@CurrRec.Value
|
||||
<span class="text-danger">
|
||||
|
||||
<span class="px-1">@CurrRec.Value</span>
|
||||
<span>
|
||||
@if (CurrRec.ShowMissingData)
|
||||
{
|
||||
<i class="fa-solid fa-triangle-exclamation"></i>
|
||||
<i class="fa-regular fa-square-check"></i>
|
||||
<i class="fa-solid fa-triangle-exclamation text-danger"></i>
|
||||
}
|
||||
@if (CurrRec.ShowCheckedData)
|
||||
{
|
||||
<i class="fa-regular fa-square-check text-success"></i>
|
||||
}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<Version>6.16.2310.2616</Version>
|
||||
<Version>6.16.2310.2619</Version>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<RootNamespace>MP_TAB_SERV</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo MAPOSPEC </i>
|
||||
<h4>Versione: 6.16.2310.2616</h4>
|
||||
<h4>Versione: 6.16.2310.2619</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
6.16.2310.2616
|
||||
6.16.2310.2619
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>6.16.2310.2616</version>
|
||||
<version>6.16.2310.2619</version>
|
||||
<url>https://nexus.steamware.net/repository/SWS/MP-TAB-SERV/stable/LAST/MP-TAB-SERV.zip</url>
|
||||
<changelog>https://nexus.steamware.net/repository/SWS/MP-TAB-SERV/stable/LAST/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
//"Redis": "localhost:6379,DefaultDatabase=1,connectTimeout=5000,syncTimeout=5000,asyncTimeout=5000,abortConnect=false,ssl=false",
|
||||
"MP.All": "Server=SQL2016DEV;Database=MoonPro; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=Blazor.ServerApp;",
|
||||
"MP.Mon": "Server=SQL2016DEV;Database=MoonPro; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=Blazor.ServerApp;",
|
||||
"Mp.IS": "Server=SQL2016DEV;Database=MoonPro_IS_EdilChim; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=MP.INVE;",
|
||||
"MP.Tab": "Server=SQL2016DEV;Database=MoonPro; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=Blazor.ServerApp;"
|
||||
},
|
||||
"ServerConf": {
|
||||
|
||||
@@ -1054,6 +1054,27 @@ namespace MP.Data.Controllers
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupero Righe pending da ODL
|
||||
/// </summary>
|
||||
/// <param name="idxODL"></param>
|
||||
/// <returns></returns>
|
||||
public List<ST_ActRow> STAR_pendByOdl(int idxODL)
|
||||
{
|
||||
List<ST_ActRow> dbResult = new List<ST_ActRow>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
var IdxODL = new SqlParameter("@IdxODL", idxODL);
|
||||
|
||||
dbResult = dbCtx
|
||||
.DbSetStActRow
|
||||
.FromSqlRaw("exec dbo.stp_ST_AR_getPendingOdl @IdxODL", IdxODL)
|
||||
.AsNoTracking()
|
||||
//.AsEnumerable()
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
/// <summary>
|
||||
/// Recupero Righe (Actual) della scheda tecnica da GRUPPO + ODL
|
||||
/// </summary>
|
||||
@@ -1072,7 +1093,7 @@ namespace MP.Data.Controllers
|
||||
.DbSetStActRow
|
||||
.FromSqlRaw("exec dbo.stp_ST_AR_getByGrpOdl @CodGruppo, @IdxODL", CodGruppo, IdxODL)
|
||||
.AsNoTracking()
|
||||
.AsEnumerable()
|
||||
//.AsEnumerable()
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
@@ -1098,7 +1119,7 @@ namespace MP.Data.Controllers
|
||||
.DbSetStActRow
|
||||
.FromSqlRaw("exec dbo.stp_ST_AR_getGrpOdlLabel @CodGruppo, @Label, @IdxODL", CodGruppo, Label, IdxODL)
|
||||
.AsNoTracking()
|
||||
.AsEnumerable()
|
||||
//.AsEnumerable()
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
|
||||
@@ -30,7 +30,13 @@ namespace MP.Data.DatabaseModels
|
||||
[NotMapped]
|
||||
public bool ShowMissingData
|
||||
{
|
||||
get => Required && (Value != ExtCode);
|
||||
get => Required && (Value != ExtCode);
|
||||
}
|
||||
|
||||
[NotMapped]
|
||||
public bool ShowCheckedData
|
||||
{
|
||||
get => Required && (Value == ExtCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
+291
-211
@@ -13,7 +13,6 @@ using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static System.Runtime.CompilerServices.RuntimeHelpers;
|
||||
|
||||
namespace MP.Data.Services
|
||||
{
|
||||
@@ -46,6 +45,8 @@ namespace MP.Data.Services
|
||||
sb.AppendLine($"TabDataService | MpTabController OK");
|
||||
dbIocController = new Controllers.MpIocController(configuration);
|
||||
sb.AppendLine($"TabDataService | MpIocController OK");
|
||||
dbInveController = new Controllers.MpInveController(configuration);
|
||||
sb.AppendLine($"TabDataService | MpInveController OK");
|
||||
Log.Info(sb.ToString());
|
||||
// sistemo i parametri x redHas...
|
||||
CodModulo = _configuration.GetValue<string>("OptConf:CodModulo");
|
||||
@@ -69,97 +70,14 @@ namespace MP.Data.Services
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Conmfig attivo da DB
|
||||
/// </summary>
|
||||
public List<ConfigModel> CurrConfig { get; set; } = new List<ConfigModel>();
|
||||
|
||||
/// <summary>
|
||||
/// Setup oggetto config con lettura da DB
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public void SetupConfig()
|
||||
{
|
||||
CurrConfig = ConfigGetAll();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupera il valore in formato STRING
|
||||
/// </summary>
|
||||
/// <param name="chiave">Valore da cercare</param>
|
||||
/// <param name="varObj">String in cui salvare il valore se trovato</param>
|
||||
/// <returns></returns>
|
||||
public bool ConfigGetVal(string chiave, ref string varObj)
|
||||
{
|
||||
bool answ = false;
|
||||
// se mancasse provo a configurare..
|
||||
if (CurrConfig == null || CurrConfig.Count == 0)
|
||||
{
|
||||
SetupConfig();
|
||||
}
|
||||
if (CurrConfig != null && CurrConfig.Count > 0)
|
||||
{
|
||||
// sistemo i parametri opzionali...
|
||||
ConfigModel? risultato = CurrConfig.FirstOrDefault(x => x.Chiave == chiave);
|
||||
if (risultato != null)
|
||||
{
|
||||
varObj = risultato.Valore;
|
||||
answ = !string.IsNullOrEmpty(risultato.Valore);
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// Recupera il valore in formato INT
|
||||
/// </summary>
|
||||
/// <param name="chiave">Valore da cercare</param>
|
||||
/// <param name="varObj">Int in cui salvare il valore se trovato</param>
|
||||
/// <returns></returns>
|
||||
public bool ConfigGetVal(string chiave, ref int varObj)
|
||||
{
|
||||
bool answ = false;
|
||||
// se mancasse provo a configurare..
|
||||
if (CurrConfig == null || CurrConfig.Count == 0)
|
||||
{
|
||||
SetupConfig();
|
||||
}
|
||||
if (CurrConfig != null && CurrConfig.Count > 0)
|
||||
{
|
||||
// sistemo i parametri opzionali...
|
||||
ConfigModel? risultato = CurrConfig.FirstOrDefault(x => x.Chiave == chiave);
|
||||
if (risultato != null)
|
||||
{
|
||||
answ = int.TryParse(risultato.Valore, out varObj);
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// Recupera il valore in formato BOOL
|
||||
/// </summary>
|
||||
/// <param name="chiave">Valore da cercare</param>
|
||||
/// <param name="varObj">Boolean in cui salvare il valore se trovato</param>
|
||||
/// <returns></returns>
|
||||
public bool ConfigGetVal(string chiave, ref bool varObj)
|
||||
{
|
||||
bool answ = false;
|
||||
// se mancasse provo a configurare..
|
||||
if (CurrConfig == null || CurrConfig.Count == 0)
|
||||
{
|
||||
SetupConfig();
|
||||
}
|
||||
if (CurrConfig != null && CurrConfig.Count > 0)
|
||||
{
|
||||
// sistemo i parametri opzionali...
|
||||
ConfigModel? risultato = CurrConfig.FirstOrDefault(x => x.Chiave == chiave);
|
||||
if (risultato != null)
|
||||
{
|
||||
answ = bool.TryParse(risultato.Valore, out varObj);
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
@@ -540,6 +458,84 @@ namespace MP.Data.Services
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupera il valore in formato STRING
|
||||
/// </summary>
|
||||
/// <param name="chiave">Valore da cercare</param>
|
||||
/// <param name="varObj">String in cui salvare il valore se trovato</param>
|
||||
/// <returns></returns>
|
||||
public bool ConfigGetVal(string chiave, ref string varObj)
|
||||
{
|
||||
bool answ = false;
|
||||
// se mancasse provo a configurare..
|
||||
if (CurrConfig == null || CurrConfig.Count == 0)
|
||||
{
|
||||
SetupConfig();
|
||||
}
|
||||
if (CurrConfig != null && CurrConfig.Count > 0)
|
||||
{
|
||||
// sistemo i parametri opzionali...
|
||||
ConfigModel? risultato = CurrConfig.FirstOrDefault(x => x.Chiave == chiave);
|
||||
if (risultato != null)
|
||||
{
|
||||
varObj = risultato.Valore;
|
||||
answ = !string.IsNullOrEmpty(risultato.Valore);
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupera il valore in formato INT
|
||||
/// </summary>
|
||||
/// <param name="chiave">Valore da cercare</param>
|
||||
/// <param name="varObj">Int in cui salvare il valore se trovato</param>
|
||||
/// <returns></returns>
|
||||
public bool ConfigGetVal(string chiave, ref int varObj)
|
||||
{
|
||||
bool answ = false;
|
||||
// se mancasse provo a configurare..
|
||||
if (CurrConfig == null || CurrConfig.Count == 0)
|
||||
{
|
||||
SetupConfig();
|
||||
}
|
||||
if (CurrConfig != null && CurrConfig.Count > 0)
|
||||
{
|
||||
// sistemo i parametri opzionali...
|
||||
ConfigModel? risultato = CurrConfig.FirstOrDefault(x => x.Chiave == chiave);
|
||||
if (risultato != null)
|
||||
{
|
||||
answ = int.TryParse(risultato.Valore, out varObj);
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupera il valore in formato BOOL
|
||||
/// </summary>
|
||||
/// <param name="chiave">Valore da cercare</param>
|
||||
/// <param name="varObj">Boolean in cui salvare il valore se trovato</param>
|
||||
/// <returns></returns>
|
||||
public bool ConfigGetVal(string chiave, ref bool varObj)
|
||||
{
|
||||
bool answ = false;
|
||||
// se mancasse provo a configurare..
|
||||
if (CurrConfig == null || CurrConfig.Count == 0)
|
||||
{
|
||||
SetupConfig();
|
||||
}
|
||||
if (CurrConfig != null && CurrConfig.Count > 0)
|
||||
{
|
||||
// sistemo i parametri opzionali...
|
||||
ConfigModel? risultato = CurrConfig.FirstOrDefault(x => x.Chiave == chiave);
|
||||
if (risultato != null)
|
||||
{
|
||||
answ = bool.TryParse(risultato.Valore, out varObj);
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Inserimento record in DDB
|
||||
@@ -574,6 +570,7 @@ namespace MP.Data.Services
|
||||
// Clear database controller
|
||||
dbTabController.Dispose();
|
||||
dbIocController.Dispose();
|
||||
dbInveController.Dispose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -806,6 +803,44 @@ namespace MP.Data.Services
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco lotti esterni presenti sul db di ARCA
|
||||
/// </summary>
|
||||
/// <param name="codArt">Codice articolo</param>
|
||||
/// <param name="codLotto">Codice lotto</param>
|
||||
/// <param name="codMagazzino">Codice magazzino</param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<AnagLottiArca>> LottoEsterno(string codArt, string codLotto, string codMagazzino)
|
||||
{
|
||||
// setup parametri costanti
|
||||
string source = "DB";
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
List<AnagLottiArca> result = new List<AnagLottiArca>();
|
||||
// cerco in redis...
|
||||
string currKey = $"{redisBaseKey}:LottoExt:{codMagazzino}:{codArt}:{codLotto}";
|
||||
RedisValue rawData = await redisDb.StringGetAsync(currKey);
|
||||
if (rawData.HasValue)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<AnagLottiArca>>($"{rawData}");
|
||||
source = "REDIS";
|
||||
}
|
||||
else
|
||||
{
|
||||
result = dbInveController.LottoEsterno(codArt, codLotto, codMagazzino);
|
||||
// serializzp e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
await redisDb.StringSetAsync(currKey, rawData, UltraLongCache);
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new List<AnagLottiArca>();
|
||||
}
|
||||
sw.Stop();
|
||||
Log.Debug($"LottoEsterno | {source} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua ricalcolo MSE x macchina indicata
|
||||
/// </summary>
|
||||
@@ -1025,127 +1060,6 @@ namespace MP.Data.Services
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
public async Task<bool> ST_CheckCleanByOdl(int idxOdl)
|
||||
{
|
||||
bool answ = false;
|
||||
try
|
||||
{
|
||||
// inserisco evento
|
||||
answ = dbTabController.ST_CheckCleanByOdl(idxOdl);
|
||||
await FlushCache("ST");
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string logMsg = $"Eccezione in ST_CheckCleanByOdl | idxOdl: {idxOdl}{Environment.NewLine}{exc}";
|
||||
Log.Error(logMsg);
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Restituisce elenco gruppi Scheda tecnica
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<List<ST_AnagGruppi>> ST_AnagGruppiList()
|
||||
{
|
||||
// setup parametri costanti
|
||||
string source = "DB";
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
List<ST_AnagGruppi>? result = new List<ST_AnagGruppi>();
|
||||
// cerco in redis...
|
||||
string currKey = $"{redisBaseKey}:ST:AnagGruppi";
|
||||
RedisValue rawData = await redisDb.StringGetAsync(currKey);
|
||||
if (rawData.HasValue)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<ST_AnagGruppi>>($"{rawData}");
|
||||
source = "REDIS";
|
||||
}
|
||||
else
|
||||
{
|
||||
result = dbTabController.ST_AnagGruppiList();
|
||||
// serializzp e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
await redisDb.StringSetAsync(currKey, rawData, UltraLongCache);
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new List<ST_AnagGruppi>();
|
||||
}
|
||||
sw.Stop();
|
||||
Log.Debug($"ST_AnagGruppiList | {source} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
public bool ST_DerogaSet(StCheckOverride deroga)
|
||||
{
|
||||
bool fatto = false;
|
||||
try
|
||||
{
|
||||
string keyDerogaST = redHash($"DerogaSt:{deroga.Utente}:{deroga.IdxST:000}");
|
||||
string rawData = JsonConvert.SerializeObject(deroga);
|
||||
redisDb.StringSet(keyDerogaST, rawData, TimeSpan.FromMinutes(2));
|
||||
fatto = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione in ST_DerogaSet | Utente: {deroga.Utente} | IdxST: {deroga.IdxST}{Environment.NewLine}{exc}");
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dati deroga SchedaTecnica serializzati in REDIS
|
||||
/// </summary>
|
||||
public StCheckOverride ST_DerogaGet(string Utente, int IdxST)
|
||||
{
|
||||
StCheckOverride answ = new StCheckOverride() { IdxST = 0 };
|
||||
string keyDerogaST = redHash($"DerogaSt:{Utente}:{IdxST:000}");
|
||||
string rawData = redisDb.StringGet(keyDerogaST);
|
||||
if (!string.IsNullOrEmpty(rawData))
|
||||
{
|
||||
try
|
||||
{
|
||||
answ = JsonConvert.DeserializeObject<StCheckOverride>(rawData);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione in ST_DerogaSet | Utente: {Utente} | IdxST: {IdxST}{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
public List<VocabolarioModel> VocabolarioGetAll()
|
||||
{
|
||||
// setup parametri costanti
|
||||
string source = "DB";
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
List<VocabolarioModel>? result = new List<VocabolarioModel>();
|
||||
// cerco in redis...
|
||||
string currKey = $"{redisBaseKey}:Vocab";
|
||||
RedisValue rawData = redisDb.StringGet(currKey);
|
||||
if (rawData.HasValue)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<VocabolarioModel>>($"{rawData}");
|
||||
source = "REDIS";
|
||||
}
|
||||
else
|
||||
{
|
||||
result = dbTabController.VocabolarioGetAll();
|
||||
// serializzp e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
redisDb.StringSet(currKey, rawData, UltraLongCache);
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new List<VocabolarioModel>();
|
||||
}
|
||||
sw.Stop();
|
||||
Log.Debug($"VocabolarioGetAll | {source} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Aggiunta record RegistroScarti
|
||||
@@ -1430,6 +1344,141 @@ namespace MP.Data.Services
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Setup oggetto config con lettura da DB
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public void SetupConfig()
|
||||
{
|
||||
CurrConfig = ConfigGetAll();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restituisce elenco gruppi Scheda tecnica
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<List<ST_AnagGruppi>> ST_AnagGruppiList()
|
||||
{
|
||||
// setup parametri costanti
|
||||
string source = "DB";
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
List<ST_AnagGruppi>? result = new List<ST_AnagGruppi>();
|
||||
// cerco in redis...
|
||||
string currKey = $"{redisBaseKey}:ST:AnagGruppi";
|
||||
RedisValue rawData = await redisDb.StringGetAsync(currKey);
|
||||
if (rawData.HasValue)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<ST_AnagGruppi>>($"{rawData}");
|
||||
source = "REDIS";
|
||||
}
|
||||
else
|
||||
{
|
||||
result = dbTabController.ST_AnagGruppiList();
|
||||
// serializzp e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
await redisDb.StringSetAsync(currKey, rawData, UltraLongCache);
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new List<ST_AnagGruppi>();
|
||||
}
|
||||
sw.Stop();
|
||||
Log.Debug($"ST_AnagGruppiList | {source} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
public async Task<bool> ST_CheckCleanByOdl(int idxOdl)
|
||||
{
|
||||
bool answ = false;
|
||||
try
|
||||
{
|
||||
// inserisco evento
|
||||
answ = dbTabController.ST_CheckCleanByOdl(idxOdl);
|
||||
await FlushCache("ST");
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string logMsg = $"Eccezione in ST_CheckCleanByOdl | idxOdl: {idxOdl}{Environment.NewLine}{exc}";
|
||||
Log.Error(logMsg);
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dati deroga SchedaTecnica serializzati in REDIS
|
||||
/// </summary>
|
||||
public StCheckOverride ST_DerogaGet(string Utente, int IdxST)
|
||||
{
|
||||
StCheckOverride answ = new StCheckOverride() { IdxST = 0 };
|
||||
string keyDerogaST = redHash($"DerogaSt:{Utente}:{IdxST:000}");
|
||||
string rawData = redisDb.StringGet(keyDerogaST);
|
||||
if (!string.IsNullOrEmpty(rawData))
|
||||
{
|
||||
try
|
||||
{
|
||||
answ = JsonConvert.DeserializeObject<StCheckOverride>(rawData);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione in ST_DerogaSet | Utente: {Utente} | IdxST: {IdxST}{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
public bool ST_DerogaSet(StCheckOverride deroga)
|
||||
{
|
||||
bool fatto = false;
|
||||
try
|
||||
{
|
||||
string keyDerogaST = redHash($"DerogaSt:{deroga.Utente}:{deroga.IdxST:000}");
|
||||
string rawData = JsonConvert.SerializeObject(deroga);
|
||||
redisDb.StringSet(keyDerogaST, rawData, TimeSpan.FromMinutes(2));
|
||||
fatto = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione in ST_DerogaSet | Utente: {deroga.Utente} | IdxST: {deroga.IdxST}{Environment.NewLine}{exc}");
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupero Righe pending da ODL
|
||||
/// </summary>
|
||||
/// <param name="idxODL"></param>
|
||||
/// <returns></returns>
|
||||
public List<ST_ActRow> STAR_pendByOdl(int idxODL)
|
||||
{
|
||||
// setup parametri costanti
|
||||
string source = "DB";
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
List<ST_ActRow>? result = new List<ST_ActRow>();
|
||||
// cerco in redis...
|
||||
string currKey = $"{redisBaseKey}:STAR:Pend:{idxODL}";
|
||||
RedisValue rawData = redisDb.StringGet(currKey);
|
||||
if (rawData.HasValue)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<ST_ActRow>>($"{rawData}");
|
||||
source = "REDIS";
|
||||
}
|
||||
else
|
||||
{
|
||||
result = dbTabController.STAR_pendByOdl(idxODL);
|
||||
// serializzp e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
redisDb.StringSet(currKey, rawData, LongCache);
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new List<ST_ActRow>();
|
||||
}
|
||||
sw.Stop();
|
||||
Log.Debug($"STAR_pendByOdl | {source} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
/// <summary>
|
||||
/// Recupero Righe (Actual) della scheda tecnica da GRUPPO + ODL
|
||||
/// </summary>
|
||||
@@ -1444,7 +1493,7 @@ namespace MP.Data.Services
|
||||
sw.Start();
|
||||
List<ST_ActRow>? result = new List<ST_ActRow>();
|
||||
// cerco in redis...
|
||||
string currKey = $"{redisBaseKey}:START:{codGruppo}:{idxODL}";
|
||||
string currKey = $"{redisBaseKey}:STAR:{codGruppo}:{idxODL}";
|
||||
RedisValue rawData = await redisDb.StringGetAsync(currKey);
|
||||
//if (!string.IsNullOrEmpty($"{rawData}"))
|
||||
if (rawData.HasValue)
|
||||
@@ -1483,7 +1532,7 @@ namespace MP.Data.Services
|
||||
sw.Start();
|
||||
List<ST_ActRow>? result = new List<ST_ActRow>();
|
||||
// cerco in redis...
|
||||
string currKey = $"{redisBaseKey}:START:{codGruppo}:{label}:{idxODL}";
|
||||
string currKey = $"{redisBaseKey}:STAR:{codGruppo}:{label}:{idxODL}";
|
||||
RedisValue rawData = await redisDb.StringGetAsync(currKey);
|
||||
//if (!string.IsNullOrEmpty($"{rawData}"))
|
||||
if (rawData.HasValue)
|
||||
@@ -1784,6 +1833,37 @@ namespace MP.Data.Services
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<VocabolarioModel> VocabolarioGetAll()
|
||||
{
|
||||
// setup parametri costanti
|
||||
string source = "DB";
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
List<VocabolarioModel>? result = new List<VocabolarioModel>();
|
||||
// cerco in redis...
|
||||
string currKey = $"{redisBaseKey}:Vocab";
|
||||
RedisValue rawData = redisDb.StringGet(currKey);
|
||||
if (rawData.HasValue)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<VocabolarioModel>>($"{rawData}");
|
||||
source = "REDIS";
|
||||
}
|
||||
else
|
||||
{
|
||||
result = dbTabController.VocabolarioGetAll();
|
||||
// serializzp e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
redisDb.StringSet(currKey, rawData, UltraLongCache);
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new List<VocabolarioModel>();
|
||||
}
|
||||
sw.Stop();
|
||||
Log.Debug($"VocabolarioGetAll | {source} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco causali scarto
|
||||
/// </summary>
|
||||
@@ -1890,8 +1970,8 @@ namespace MP.Data.Services
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private static Controllers.MpInveController dbInveController { get; set; } = null!;
|
||||
private static Controllers.MpIocController dbIocController { get; set; } = null!;
|
||||
|
||||
private static Controllers.MpTabController dbTabController { get; set; } = null!;
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
Reference in New Issue
Block a user