Merge remote-tracking branch 'origin/develop' into develop

This commit is contained in:
Samuele Locatelli
2022-12-12 12:38:47 +01:00
21 changed files with 128 additions and 174 deletions
+34 -2
View File
@@ -1,4 +1,5 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Data.SqlClient;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using MP.Data.DatabaseModels;
using NLog;
@@ -27,12 +28,43 @@ namespace MP.Data.Controllers
{
_configuration = null;
}
#region gestione lotti esterni
/// <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 List<AnagLottiArca> ListLottiEsterni(string codArt, string codLotto, string codMagazzino)
{
List<AnagLottiArca> dbResult = new List<AnagLottiArca>();
using (var dbCtx = new MoonPro_InveContext(_configuration))
{
var DataGiac = new SqlParameter("@DataGiac", DateTime.Now);
var CodArt = new SqlParameter("@CodArt", codArt);
var CodLotto = new SqlParameter("@CodLotto", codLotto);
var CodMagaz = new SqlParameter("@CodMagaz", codMagazzino);
var OnlyTest = new SqlParameter("@OnlyTest", false);
dbResult = dbCtx
.DbLottoArca
.FromSqlRaw("exec dbo.stp_GIAC_getByDate @DataGiac,@CodArt,@CodLotto,@CodMagaz,@OnlyTest", DataGiac, CodArt, CodLotto, CodMagaz, OnlyTest)
.AsNoTracking()
//.AsEnumerable()
.ToList();
}
return dbResult;
}
#endregion gestione lotti esterni
#region gestione articoli
/// <summary>
/// articolo MAG corrispondente all' articolo selezionato
/// </summary>
/// <param name="artSearch"></param>
/// <param name="artSearch"></param>
/// <returns></returns>
public AnagArticoli_MAG artBySearch(string artSearch)
{
+5 -1
View File
@@ -1,13 +1,17 @@
using System;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MP.Data.DatabaseModels
{
[Keyless]
public partial class AnagLottiArca
{
public string Cd_MGEsercizio { get; set; }
public string Cd_MG { get; set; }
public string Cd_AR { get; set; }
+1
View File
@@ -53,6 +53,7 @@ namespace MP.Data
public virtual DbSet<AnagUdcModel> DbUdcData { get; set; }
public virtual DbSet<AnagLottoModel> DbLottoData { get; set; }
public virtual DbSet<AnagArticoli_MAG> DbArtMag { get; set; }
public virtual DbSet<AnagLottiArca> DbLottoArca { get; set; }
#endregion PER INVE
#region PER SPEC
+1 -1
View File
@@ -94,7 +94,7 @@
{
<td>
<!-- Button trigger modal -->
<button type="button" class="btn btn-dark" data-bs-toggle="modal" data-bs-target="#exampleModal" @onclick="()=> getCurrSess(item.InveSessID)" title="Apri qr per connettersi alla sessione">
<button type="button" class="btn btn-dark" data-bs-toggle="modal" data-bs-target="#exampleModal" @onclick="()=> getCurrSess(item.InveSessID, item.AnagMagNav.MagID)" title="Apri qr per connettersi alla sessione">
<i class="fa-solid fa-qrcode"></i>
</button>
</td>
+5 -2
View File
@@ -97,7 +97,7 @@ namespace MP.INVE.Components
get
{
string answ = "";
answ = $"{BaseUrlTab}IdSessione={currIdSess}&MatrOpr={idOperatore}&UserAuthKey={authKey}";
answ = $"{BaseUrlTab}IdSessione={currIdSess}&IdMag={currIdMag}&MatrOpr={idOperatore}&UserAuthKey={authKey}";
return answ;
}
}
@@ -111,9 +111,10 @@ namespace MP.INVE.Components
}
}
protected async Task getCurrSess(int idSess)
protected async Task getCurrSess(int idSess, int idMag)
{
currIdSess = idSess;
currIdMag = idMag;
await JSRuntime.InvokeVoidAsync("clearContent", $"qrCodeImg_{101}");
await JSRuntime.InvokeVoidAsync("displayQr", $"qrCodeImg_{101}", rawCode);
}
@@ -188,6 +189,8 @@ namespace MP.INVE.Components
[Parameter]
public int currIdSess { get; set; }
[Parameter]
public int currIdMag { get; set; }
[Inject]
private MiDataService MIDataservice { get; set; } = null!;
+14 -8
View File
@@ -34,6 +34,8 @@ namespace MP.INVE.Components
public string userScan { get; set; } = null!;
[Parameter]
public int sessID { get; set; } = 0;
[Parameter]
public int magID { get; set; } = 0;
[Inject]
public IJSRuntime JSRuntime { get; set; } = null!;
[Inject]
@@ -42,10 +44,12 @@ namespace MP.INVE.Components
private string canMod = "false";
protected List<AnagUdcModel>? searchRecordsUDC;
protected List<AnagLottoModel>? searchRecordsLotto;
protected List<AnagLottoModel>? searchRecordsLottoInterni;
protected List<AnagLottiArca>? searchRecordsLottoEsterni;
protected List<ScanDataModel>? elencoScansioni;
protected AnagUdcModel? udc;
protected AnagLottoModel? lotto;
protected AnagLottoModel? lottoInterno;
protected AnagLottiArca? lottoEsterno;
protected ScanDataModel? alreadyScan;
protected AnagUdcModel? currUdc;
@@ -109,18 +113,20 @@ namespace MP.INVE.Components
}
else
{
searchRecordsLotto = MIService.ElencoLotti();
lotto = searchRecordsLotto.Where(x => x.Lotto == lastScan).FirstOrDefault();
if (lotto != null)
searchRecordsLottoInterni = MIService.ElencoLotti();
lottoInterno = searchRecordsLottoInterni.Where(x => x.Lotto == lastScan).FirstOrDefault();
if (lottoInterno != null)
{
tipo = "LOTTO";
currLotto = lotto;
lottoScan = lotto.Lotto;
articoloScan = lotto.CodArt;
currLotto = lottoInterno;
lottoScan = lottoInterno.Lotto;
articoloScan = lottoInterno.CodArt;
quantitaScan = 0;
}
else
{
searchRecordsLottoEsterni = MIService.ListLottiEsterni(articoloScan, lastScan, magID.ToString());
lottoEsterno = searchRecordsLottoEsterni.FirstOrDefault();
currLotto = null;
currUdc = null;
alreadyScan = null;
+38 -3
View File
@@ -297,6 +297,39 @@ namespace MP.INVE.Data
return result;
}
public List<AnagLottiArca> ListLottiEsterni(string codArt, string codLotto, string codMagazzino)
{
string source = "";
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
List<AnagLottiArca>? result = new List<AnagLottiArca>();
// cerco in redis...
RedisValue rawData = redisDb.StringGet(redisLottiEsterni);
if (!string.IsNullOrEmpty($"{rawData}"))
{
result = JsonConvert.DeserializeObject<List<AnagLottiArca>>($"{rawData}");
source = "REDIS";
}
else
{
result = dbController.ListLottiEsterni(codArt, codLotto, codMagazzino);
// serializzo e salvo...
rawData = JsonConvert.SerializeObject(result);
redisDb.StringSetAsync(redisLottiEsterni, rawData, getRandTOut(redisLongTimeCache));
source = "DB";
}
if (result == null)
{
result = new List<AnagLottiArca>();
}
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Debug($"ListLottiEsterni Read from {source}: {ts.TotalMilliseconds}ms");
return result;
}
public List<ScanDataModel> ScanList()
{
string source = "";
@@ -413,7 +446,7 @@ namespace MP.INVE.Data
stopWatch.Start();
List<AnagLottoModel>? result = new List<AnagLottoModel>();
// cerco in redis...
RedisValue rawData = redisDb.StringGet(redisLottiBaseAddr);
RedisValue rawData = redisDb.StringGet(redisLottiInterni);
if (!string.IsNullOrEmpty($"{rawData}"))
{
result = JsonConvert.DeserializeObject<List<AnagLottoModel>>($"{rawData}");
@@ -425,7 +458,7 @@ namespace MP.INVE.Data
result = dbController.ElencoLotti();
// serializzo e salvo...
rawData = JsonConvert.SerializeObject(result);
redisDb.StringSetAsync(redisLottiBaseAddr, rawData, getRandTOut(redisLongTimeCache));
redisDb.StringSetAsync(redisLottiInterni, rawData, getRandTOut(redisLongTimeCache));
source = "DB";
}
if (result == null)
@@ -599,8 +632,10 @@ namespace MP.INVE.Data
private const string redisBaseAddr = "MP:INVE";
private const string redisSessionBaseAddr = ":Session";
private const string redisOperatoriBaseAddr = ":Operatore";
private const string redisUdcBaseAddr = ":UDC";
private const string redisLottiBaseAddr = ":Lotti";
private const string redisUdcBaseAddr = ":UDC";
private const string redisLottiInterni = redisLottiBaseAddr + ":LottiInterni";
private const string redisLottiEsterni = redisLottiBaseAddr + ":LottiEsterni";
private const string redisConfigBaseAddr = ":Config";
private const string redisScanBaseAddr = redisBaseAddr + ":Scan";
private const string redisElencoOperatori = redisBaseAddr + redisOperatoriBaseAddr + ":ListOperatori";
+4
View File
@@ -21,6 +21,7 @@ namespace MP.INVE.Data
public string idOperatore { get; set; } = "";
public string authKey { get; set; } = "";
public int currIdSession { get; set; } = 0;
public int currIdMag { get; set; } = 0;
public bool reqNew { get; set; } = false;
#endregion Public Properties
@@ -52,6 +53,9 @@ namespace MP.INVE.Data
if (currIdSession != item.currIdSession)
return false;
if (currIdMag != item.currIdMag)
return false;
if (authKey != item.authKey)
return false;
+1 -1
View File
@@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MP.INVE</RootNamespace>
<Version>6.16.2212.713</Version>
<Version>6.16.2212.1212</Version>
</PropertyGroup>
<ItemGroup>
+1 -1
View File
@@ -21,7 +21,7 @@
{
}*@
<div class="col-12">
<ProcSuggestion lastScan="@rawScan" sessID="@sessionId" userScan="@idOPeratore"></ProcSuggestion>
<ProcSuggestion lastScan="@rawScan" sessID="@sessionId" magID="@magazzinoId" userScan="@idOPeratore"></ProcSuggestion>
</div>
</div>
+3 -1
View File
@@ -37,6 +37,7 @@ namespace MP.INVE.Pages
protected string rawScan { get; set; } = null!;
protected string idOPeratore { get; set; } = null!;
protected int sessionId { get; set; } = 0;
protected int magazzinoId { get; set; } = 0;
protected int nScansioniTot { get; set; } = 0;
protected List<ScanDataModel>? eleScansioni;
//protected AnagUdcModel currUdc{ get; set; } = null!;
@@ -44,10 +45,11 @@ namespace MP.INVE.Pages
{
await Task.Delay(1);
var uri = NavManager.ToAbsoluteUri(NavManager.Uri);
if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("idOperatore", out var _matrOpr) && QueryHelpers.ParseQuery(uri.Query).TryGetValue("idSessione", out var _inveSessionId))
if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("idOperatore", out var _matrOpr) && QueryHelpers.ParseQuery(uri.Query).TryGetValue("idSessione", out var _inveSessionId) && QueryHelpers.ParseQuery(uri.Query).TryGetValue("IdMag", out var _idMag))
{
idOPeratore = _matrOpr;
sessionId = int.Parse(_inveSessionId);
magazzinoId = int.Parse(_idMag);
eleScansioni = MIService.ScanBySession(sessionId);
nScansioniTot = eleScansioni.Count();
+1 -146
View File
@@ -32,156 +32,11 @@
}
else
{
<InveSessionList currParams="@currParams" isLoading="@isLoading" ></InveSessionList>
@*@if (reqNew)
{
<div class="row">
<div class="col-12">
<div class="card mb-5">
<div class="card-header bg-primary text-light d-flex justify-content-between">
<div>
Avvia una nuova sessione
</div>
<div>
</div>
</div>
<div class="card-body">
<div class="row">
<div class="col-4 pe-0">
<div class="input-group input-group-sm">
<span class="input-group-text" id="inputGroup-sizing-sm">Magazzino</span>
<select class="form-select" @bind="@magazzino">
<option value="-1" selected>--Selezionare magazzino--</option>
@if (ElencoMagazzini != null)
{
@foreach (var item in ElencoMagazzini)
{
<option value="@item.MagID">@item.CodMag @item.CodCS | @item.DescMag</option>
}
}
</select>
</div>
</div>
<div class="col-8 pe-0">
<div class="input-group input-group-sm">
<span class="input-group-text" id="inputGroup-sizing-sm">Descrizione</span>
<input type="text" class="form-control" aria-label="Art search" aria-describedby="inputGroup-sizing-sm" @bind="@desc">
</div>
</div>
</div>
<div class="row pt-4" style="visibility:">
<div class="col-3 pe-0">
</div>
<div class="col-3 pe-0">
</div>
<div class="col-3 pe-0">
<div class="d-grid gap-2">
<button class="btn btn-warning" @onclick="closeNew">Annulla <i class="bi bi-x-circle"></i></button>
</div>
</div>
<div class="col-3 pe-0">
@if (magazzino != -1)
{
<div class="d-grid gap-2">
<button class="btn btn-success" @onclick="insertNewSession">Save <i class="bi bi-save"></i></button>
</div>
}
</div>
</div>
</div>
</div>
</div>
</div>
}
<table class="table">
<thead>
<tr>
@if (inCorso)
{
<th scope="col">QR</th>
}
<th scope="col">ID sessione</th>
<th scope="col">Magazzino</th>
<th scope="col">Operatore</th>
<th scope="col">Data inizio</th>
<th scope="col">Data fine</th>
<th scope="col">Description</th>
<th scope="col">Trasferita</th>
<th scope="col"></th>
</tr>
</thead>
<tbody>
@if (elencoSessioni != null)
{
@foreach (var item in elencoSessioni)
{
<tr>
@if (inCorso)
{
<td>
<!-- Button trigger modal -->
<button type="button" class="btn btn-dark" data-bs-toggle="modal" data-bs-target="#exampleModal" @onclick="()=> getCurrSess(item.InveSessID)" title="Apri qr per connettersi alla sessione">
<i class="fa-solid fa-qrcode"></i>
</button>
</td>
}
<td>
@item.InveSessID
</td>
<td>
@item.AnagMagNav.DescMag
</td>
<td>
@item.UserCrea
</td>
<td>
@item.DtStart
</td>
@if (item.DtEnd != null)
{
<td>
@item.DtEnd
</td>
}
else
{
<td>
In corso...
</td>
}
<td>
@item.Description
</td>
<td>
@if (item.Transferred)
{
<i class="fa-regular fa-square-check text-success"></i>
}
else
{
<i class="fa-regular fa-square text-dark"></i>
}
</td>
<td>
<button class="btn btn-danger btn-sm" @onclick="()=>deleteSession(item)">
<i class="fa-solid fa-trash-can"></i>
</button>
</td>
</tr>
}
}
</tbody>
</table>*@
<InveSessionList currParams="@currParams" isLoading="@isLoading" ></InveSessionList>
}
</div>
<div class="card-footer py-1">
@*<DataPager @ref="pagerSession" PageSize="numRecord" currPage="currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="totalCount" showLoading="@isLoading" />*@
<DataPager PageSize="numRecord" currPage="currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="totalCount" showLoading="@isLoading" />
</div>
</div>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MAPOINVE </i>
<h4>Versione: 6.16.2212.713</h4>
<h4>Versione: 6.16.2212.1212</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
6.16.2212.713
6.16.2212.1212
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2212.713</version>
<version>6.16.2212.1212</version>
<url>https://nexus.steamware.net/repository/SWS/MP-INVE/stable/LAST/MP.INVE.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-INVE/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
+8
View File
@@ -167,9 +167,17 @@ namespace MP.SPEC.Components
{
get => selMacchina != "*" || selFlux != "*";
}
protected int refreshRate = 2;
protected override async Task OnInitializedAsync()
{
SelFilter = new SelectFluxParams();
await MDService.ConfigResetCache();
var result = await MDService.tryGetConfig("SPEC_ParamTempoAgg");
if (result != null)
{
refreshRate = int.Parse(result);
}
selTempoAgg = refreshRate;
setDtSnap();
DateTime dtStart = SelFilter.dtMin != null ? (DateTime)SelFilter.dtMin : DateTime.Now.AddMonths(-1);
DateTime dtEnd = SelFilter.dtMax != null ? (DateTime)SelFilter.dtMax : DateTime.Today.AddDays(1);
+5 -1
View File
@@ -613,7 +613,11 @@ namespace MP.SPEC.Data
result = await Task.FromResult(dbController.FluxLogGetLastFilt(DtMax, DtMin, IdxMacchina, CodFlux, MaxRec));
// serializzo e salvo...
rawData = JsonConvert.SerializeObject(result);
redisDb.StringSet(currKey, rawData, TimeSpan.FromSeconds(redisCacheSec / 2));
var canCache = await tryGetConfig("SPEC_ParametriEnableReidsCache");
if (canCache != "false")
{
redisDb.StringSet(currKey, rawData, TimeSpan.FromSeconds(redisCacheSec / 2));
}
}
if (result == null)
{
+1 -1
View File
@@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MP.SPEC</RootNamespace>
<Version>6.16.2212.919</Version>
<Version>6.16.2212.1211</Version>
</PropertyGroup>
<ItemGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MAPOSPEC </i>
<h4>Versione: 6.16.2212.919</h4>
<h4>Versione: 6.16.2212.1211</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
6.16.2212.919
6.16.2212.1211
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2212.919</version>
<version>6.16.2212.1211</version>
<url>https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/MP.SPEC.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>