Fix traduzione scheda tecnica
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<div class="row">
|
||||
<div class="col-4 pr-0 text-start">
|
||||
@CurrRec.Label
|
||||
@(Traduci(CurrRec.Label))
|
||||
</div>
|
||||
<div class="col-8 pl-0 text-end fw-bold @dataCss @derogaCss">
|
||||
@if (CurrRec.ShowMissingData && enableForceParamSchedaTecnica)
|
||||
@@ -14,15 +14,16 @@
|
||||
<button class=" btn btn-sm btn-danger py-0 text-light"><i class="fa-solid fa-kit-medical"></i></button>
|
||||
}
|
||||
}
|
||||
<small>(@CurrRec.ValueRead)</small> @CurrRec.Value
|
||||
@if (!string.IsNullOrEmpty(CurrRec.ValueRead))
|
||||
{
|
||||
<small>(@CurrRec.ValueRead) </small>
|
||||
}
|
||||
@CurrRec.Value
|
||||
<span class="text-danger">
|
||||
|
||||
@if (showError)
|
||||
@if (CurrRec.ShowMissingData)
|
||||
{
|
||||
<i class="fa-solid fa-triangle-exclamation"></i>
|
||||
}
|
||||
@if (showChecked)
|
||||
{
|
||||
<i class="fa-regular fa-square-check"></i>
|
||||
}
|
||||
</span>
|
||||
|
||||
@@ -1,56 +1,15 @@
|
||||
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 System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace MP_TAB_SERV.Components
|
||||
{
|
||||
public partial class TechSheet_ST_ObjView
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public ST_ActRow CurrRec { get; set; } = null!;
|
||||
[Inject]
|
||||
protected SharedMemService SMServ { get; set; } = null!;
|
||||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
enableForceParamSchedaTecnica = SMServ.GetConfBool("enableForceParamSchedaTecnica");
|
||||
hasDeroga = false;
|
||||
#if false
|
||||
try
|
||||
{
|
||||
var currDeroga = DataLayerObj.getDerogaSt(idxST);
|
||||
answ = (currDeroga != null);
|
||||
if (answ)
|
||||
{
|
||||
answ = (currDeroga.CanForce && currDeroga.Num == dataNum && currDeroga.CodGruppo == dataGroup && currDeroga.CodTipo == dataType && currDeroga.Oggetto == dataOggetto);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
#endif
|
||||
}
|
||||
|
||||
private bool enableForceParamSchedaTecnica = false;
|
||||
|
||||
public string dataCss
|
||||
{
|
||||
@@ -82,11 +41,54 @@ namespace MP_TAB_SERV.Components
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public string Traduci(string lemma)
|
||||
{
|
||||
return SMServ.Traduci($"{baseLang}_{lemma}");
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected SharedMemService SMServ { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
enableForceParamSchedaTecnica = SMServ.GetConfBool("enableForceParamSchedaTecnica");
|
||||
baseLang = SMServ.GetConf("baseLang");
|
||||
hasDeroga = false;
|
||||
#if false
|
||||
try
|
||||
{
|
||||
var currDeroga = DataLayerObj.getDerogaSt(idxST);
|
||||
answ = (currDeroga != null);
|
||||
if (answ)
|
||||
{
|
||||
answ = (currDeroga.CanForce && currDeroga.Num == dataNum && currDeroga.CodGruppo == dataGroup && currDeroga.CodTipo == dataType && currDeroga.Oggetto == dataOggetto);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
#endif
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private string baseLang = "IT";
|
||||
private bool enableForceParamSchedaTecnica = false;
|
||||
private bool hasDeroga = false;
|
||||
private bool showError = false;
|
||||
private bool showChecked = false;
|
||||
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<Version>6.16.2310.2612</Version>
|
||||
<Version>6.16.2310.2615</Version>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<RootNamespace>MP_TAB_SERV</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo MAPOSPEC </i>
|
||||
<h4>Versione: 6.16.2310.2612</h4>
|
||||
<h4>Versione: 6.16.2310.2615</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
6.16.2310.2612
|
||||
6.16.2310.2615
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>6.16.2310.2612</version>
|
||||
<version>6.16.2310.2615</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>
|
||||
|
||||
@@ -126,6 +126,10 @@ namespace MP_TAB_SERV.Shared
|
||||
// MDataService.MacchineByMatrOper(0); MStor.DictMacchine = allMach.ToDictionary(x =>
|
||||
// x.IdxMacchina, x => $"{x.IdxMacchina} | {x.Nome}");
|
||||
|
||||
// fix vocabolario
|
||||
var allVoc = TDataService.VocabolarioGetAll();
|
||||
MStor.SetVocab(allVoc);
|
||||
|
||||
// resetto il tabDServ
|
||||
await TDataService.FlushCache();
|
||||
// ricarica la config...
|
||||
|
||||
@@ -746,39 +746,6 @@ namespace MP.Data.Controllers
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restituisce elenco gruppi Scheda tecnica
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<ST_AnagGruppi> ST_AnagGruppiList()
|
||||
{
|
||||
List<ST_AnagGruppi> dbResult = new List<ST_AnagGruppi>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetStAnagGruppi
|
||||
.OrderBy(x => x.OrdVisual)
|
||||
.AsNoTracking()
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
public bool ST_CheckCleanByOdl(int idxOdl)
|
||||
{
|
||||
bool fatto = false;
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
var IdxOdl = new SqlParameter("@IdxOdl", idxOdl);
|
||||
|
||||
var result = dbCtx
|
||||
.Database
|
||||
.ExecuteSqlRaw("EXEC stp_ST_CHK_cleanByOdl @IdxOdl", IdxOdl);
|
||||
fatto = result != 0;
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registra controllo
|
||||
/// </summary>
|
||||
@@ -1053,6 +1020,39 @@ namespace MP.Data.Controllers
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restituisce elenco gruppi Scheda tecnica
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<ST_AnagGruppi> ST_AnagGruppiList()
|
||||
{
|
||||
List<ST_AnagGruppi> dbResult = new List<ST_AnagGruppi>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetStAnagGruppi
|
||||
.OrderBy(x => x.OrdVisual)
|
||||
.AsNoTracking()
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
public bool ST_CheckCleanByOdl(int idxOdl)
|
||||
{
|
||||
bool fatto = false;
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
var IdxOdl = new SqlParameter("@IdxOdl", idxOdl);
|
||||
|
||||
var result = dbCtx
|
||||
.Database
|
||||
.ExecuteSqlRaw("EXEC stp_ST_CHK_cleanByOdl @IdxOdl", IdxOdl);
|
||||
fatto = result != 0;
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupero Righe (Actual) della scheda tecnica da GRUPPO + ODL
|
||||
/// </summary>
|
||||
@@ -1230,6 +1230,24 @@ namespace MP.Data.Controllers
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco Vocabolario (completo)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<VocabolarioModel> VocabolarioGetAll()
|
||||
{
|
||||
List<VocabolarioModel> dbResult = new List<VocabolarioModel>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetVocabolario
|
||||
.AsNoTracking()
|
||||
.OrderBy(x => x.Lemma)
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco causali scarto
|
||||
/// </summary>
|
||||
|
||||
@@ -45,6 +45,11 @@ namespace MP.Data.Services
|
||||
/// </summary>
|
||||
public Dictionary<int, AnagStatiModel> DictStati { get; set; } = new Dictionary<int, AnagStatiModel>();
|
||||
|
||||
/// <summary>
|
||||
/// Dizionario globale (key: lingua_lemma, lowercase)
|
||||
/// </summary>
|
||||
public Dictionary<string, string> DictVocab { get; set; } = new Dictionary<string, string>();
|
||||
|
||||
/// <summary>
|
||||
/// Lista completa eventi
|
||||
/// </summary>
|
||||
@@ -60,6 +65,11 @@ namespace MP.Data.Services
|
||||
/// </summary>
|
||||
public List<AnagStatiModel> ListStati { get; set; } = new List<AnagStatiModel>();
|
||||
|
||||
/// <summary>
|
||||
/// Lista completa stati
|
||||
/// </summary>
|
||||
public List<VocabolarioModel> ListVocab { get; set; } = new List<VocabolarioModel>();
|
||||
|
||||
public bool MenuOk
|
||||
{
|
||||
get => AllMenuData.Count > 0;
|
||||
@@ -81,6 +91,7 @@ namespace MP.Data.Services
|
||||
DictConfig = new Dictionary<string, string>();
|
||||
DictEventi = new Dictionary<int, AnagEventiModel>();
|
||||
DictStati = new Dictionary<int, AnagStatiModel>();
|
||||
DictVocab = new Dictionary<string, string>();
|
||||
Log.Info("SharedMemService | Cache resetted!");
|
||||
}
|
||||
|
||||
@@ -224,12 +235,49 @@ namespace MP.Data.Services
|
||||
Log.Info("SharedMemService | SetupMenu executed!");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua setup vocabolario
|
||||
/// </summary>
|
||||
/// <param name="allVoc"></param>
|
||||
public void SetVocab(List<VocabolarioModel> allVoc)
|
||||
{
|
||||
ListVocab = allVoc ?? new List<VocabolarioModel>();
|
||||
// salvo dizionario
|
||||
DictVocab = ListVocab.ToDictionary(x => $"{x.Lingua}_{x.Lemma.ToUpper()}", x => x.Traduzione);
|
||||
Log.Info("SharedMemService | SetVocab executed!");
|
||||
}
|
||||
|
||||
public string Traduci(string lingua, string lemma)
|
||||
{
|
||||
return Traduci($"{lingua}_{lemma}".ToUpper());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Traduzione diretta vocabolario
|
||||
/// </summary>
|
||||
/// <param name="lingua_lemma">Formato {lingua}_{lemma}, lowercase</param>
|
||||
/// <returns></returns>
|
||||
public string Traduci(string lingua_lemma)
|
||||
{
|
||||
string answ = $"[{lingua_lemma}]";
|
||||
if (DictVocab.ContainsKey(lingua_lemma))
|
||||
{
|
||||
answ = DictVocab[lingua_lemma];
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
/// <summary>
|
||||
/// Oggetto vocabolario x uso continuo traduzione
|
||||
/// </summary>
|
||||
private List<VocabolarioModel> ObjVocabolario = new List<VocabolarioModel>();
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
@@ -1078,6 +1078,36 @@ 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>
|
||||
/// Aggiunta record RegistroScarti
|
||||
|
||||
Reference in New Issue
Block a user