Merge branch 'develop' of https://gitlab.steamware.net/steamware/mapo-core into develop
This commit is contained in:
@@ -1,36 +1,20 @@
|
||||
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;
|
||||
|
||||
namespace MP_TAB_SERV.Components
|
||||
{
|
||||
public partial class DisabledAlert
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public string Message { get; set; } = "";
|
||||
|
||||
[Parameter]
|
||||
public string Subtitle { get; set; } = "";
|
||||
|
||||
[Parameter]
|
||||
public string Title { get; set; } = "";
|
||||
[Parameter]
|
||||
public string Subtitle { get; set; } = "";
|
||||
[Parameter]
|
||||
public string Message { get; set; } = "";
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
<div class="card mt-2">
|
||||
<div class="card-header fs-4 bg-info fw-bold">
|
||||
Scheda Tecnica
|
||||
</div>
|
||||
<div class="card-body d-flex justify-content-between flex-wrap">
|
||||
<div class="col-6 p-1">
|
||||
<button class="w-100 btn btn-light shadow p-3">Dati Articolo</button>
|
||||
</div>
|
||||
<div class="col-6 p-1">
|
||||
<button class="w-100 btn btn-light shadow p-3">Materiali</button>
|
||||
</div>
|
||||
<div class="col-6 p-1">
|
||||
<button class="w-100 btn btn-light shadow p-3">Attrezzatura</button>
|
||||
</div>
|
||||
<div class="col-6 p-1">
|
||||
<button class="w-100 btn btn-light shadow p-3">Imballi</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,6 +0,0 @@
|
||||
namespace MP_TAB_SERV.Components
|
||||
{
|
||||
public partial class TechSheetDetail
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<div class="card mt-2">
|
||||
<div class="card-header fs-4 bg-info fw-bold">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div>
|
||||
<h4>Scheda Tecnica</h4>
|
||||
</div>
|
||||
<div>
|
||||
@if (inAttr)
|
||||
{
|
||||
<button class="btn btn-lg btn-danger text-uppercase" @onclick="() => ClearOdl()"><i class="fa-solid fa-trash"></i> reset</button>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body d-flex justify-content-between flex-wrap">
|
||||
<div class="col-12 p-1">
|
||||
<TechSheet_ST_ObjCheck></TechSheet_ST_ObjCheck>
|
||||
</div>
|
||||
@if (ListGruppi.Count == 0)
|
||||
{
|
||||
<div class="alert alert-warning fs-3">ST: Nessun Gruppo Trovato</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var item in ListGruppi)
|
||||
{
|
||||
<div class="col-6 p-1">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<b>@item.DescGruppo</b>
|
||||
</div>
|
||||
<div class="card-body small p-0">
|
||||
<TechSheet_ST_Detail CodArticolo="@CodArticolo" CodGruppo="@item.CodGruppo" IdxOdl="@IdxOdl"></TechSheet_ST_Detail>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,103 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using MP.Data.DatabaseModels;
|
||||
using MP.Data.Services;
|
||||
|
||||
namespace MP_TAB_SERV.Components
|
||||
{
|
||||
public partial class TechSheetMan
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public MappaStatoExpl? RecMSE { get; set; } = null;
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; } = null!;
|
||||
|
||||
protected List<ST_AnagGruppi> ListGruppi { get; set; } = new List<ST_AnagGruppi>();
|
||||
|
||||
[Inject]
|
||||
protected TabDataService TabServ { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected async Task ClearOdl()
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", $"Sicuro di voler resettare?"))
|
||||
return;
|
||||
if (IdxOdl > 0)
|
||||
{
|
||||
await TabServ.ST_CheckCleanByOdl(IdxOdl);
|
||||
}
|
||||
checkReset();
|
||||
}
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
if (RecMSE != null)
|
||||
{
|
||||
CodArticolo = RecMSE.CodArticolo;
|
||||
IdxMaccSel = RecMSE.IdxMacchina;
|
||||
IdxOdl = RecMSE.IdxOdl ?? 0;
|
||||
}
|
||||
await ReloadData();
|
||||
checkReset();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private string CodArticolo = "";
|
||||
|
||||
private bool inAttr = false;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private string IdxMaccSel { get; set; } = "";
|
||||
|
||||
private int IdxOdl { get; set; } = 0;
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// Verifica visibilità reset
|
||||
/// </summary>
|
||||
private void checkReset()
|
||||
{
|
||||
// condizioni booleane
|
||||
inAttr = false;
|
||||
// SOLO SE ho articolo sennò niente reset...
|
||||
if (!string.IsNullOrEmpty(CodArticolo))
|
||||
{
|
||||
// controllo se la macchina è in attrezzaggio...
|
||||
var rigaStato = TabServ.StatoMacchina(IdxMaccSel);
|
||||
if (rigaStato != null)
|
||||
{
|
||||
inAttr = (rigaStato.IdxStato == 2);
|
||||
}
|
||||
}
|
||||
#if false
|
||||
cmp_ST_objCheck.checkInputData();
|
||||
#endif
|
||||
}
|
||||
|
||||
private async Task ReloadData()
|
||||
{
|
||||
ListGruppi = await TabServ.ST_AnagGruppiList();
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
@if (showWarning)
|
||||
{
|
||||
<div class="text-danget text-center fs-3">@txtWarning</div>
|
||||
}
|
||||
|
||||
@if (ListRecord.Count == 0)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var item in ListRecord)
|
||||
{
|
||||
<TechSheet_ST_ObjView CurrRec="@item"></TechSheet_ST_ObjView>
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
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 Microsoft.Extensions.Primitives;
|
||||
|
||||
namespace MP_TAB_SERV.Components
|
||||
{
|
||||
public partial class TechSheet_ST_Detail
|
||||
{
|
||||
[Parameter]
|
||||
public string CodArticolo { get; set; } = "";
|
||||
|
||||
[Parameter]
|
||||
public string CodGruppo { get; set; } = "";
|
||||
|
||||
[Parameter]
|
||||
public int IdxOdl { get; set; } = 0;
|
||||
|
||||
|
||||
private bool showWarning = false;
|
||||
private string txtWarning = "";
|
||||
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
if (IdxOdl > 0 && !string.IsNullOrEmpty(CodGruppo))
|
||||
{
|
||||
await ReloadData();
|
||||
}
|
||||
}
|
||||
|
||||
[Inject]
|
||||
protected TabDataService TabServ { get; set; } = null!;
|
||||
|
||||
private async Task ReloadData()
|
||||
{
|
||||
await Task.Delay(1);
|
||||
ListRecord = await TabServ.STAR_byGrpOdl(CodGruppo, IdxOdl);
|
||||
}
|
||||
|
||||
protected List<ST_ActRow> ListRecord { get; set; } = new List<ST_ActRow>();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<h3>TechSheet_ObjCheck</h3>
|
||||
|
||||
@code {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<div class="row">
|
||||
<div class="col-4 pr-0 text-start">
|
||||
@CurrRec.Label
|
||||
</div>
|
||||
<div class="col-8 pl-0 text-end fw-bold @dataCss @derogaCss">
|
||||
@if (CurrRec.ShowMissingData && enableForceParamSchedaTecnica)
|
||||
{
|
||||
if (hasDeroga)
|
||||
{
|
||||
<span class="text-success">Deroga Attiva</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<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
|
||||
<span class="text-danger">
|
||||
|
||||
@if (showError)
|
||||
{
|
||||
<i class="fa-solid fa-triangle-exclamation"></i>
|
||||
}
|
||||
@if (showChecked)
|
||||
{
|
||||
<i class="fa-regular fa-square-check"></i>
|
||||
}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
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
|
||||
{
|
||||
[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
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = "";
|
||||
if (CurrRec.Required)
|
||||
{
|
||||
if (CurrRec.Value != CurrRec.ExtCode)
|
||||
{
|
||||
answ = " text-danger";
|
||||
}
|
||||
else
|
||||
{
|
||||
answ = " text-success";
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
public string derogaCss
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = enableForceParamSchedaTecnica && hasDeroga ? " bg-warning" : "";
|
||||
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private bool hasDeroga = false;
|
||||
private bool showError = false;
|
||||
private bool showChecked = false;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -9,14 +9,5 @@ else
|
||||
<MachineBlock RecMSE="CurrMSE" FullMode="false"></MachineBlock>
|
||||
<ProdConfirm RecMSE="CurrMSE" E_newVal="RefreshMBlock"></ProdConfirm>
|
||||
<ProdStat RecMSE="CurrMSE"></ProdStat>
|
||||
@*<PrintMag RecMSE="CurrMSE"></PrintMag>*@
|
||||
@*<div class="row">
|
||||
<div class="col-6">
|
||||
<a class="btn btn-info btn-lg w-100" href="scrap"><i class="fa fa-bug"></i> Reg. SCARTI</a>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<a class="btn btn-primary btn-lg w-100" href="controls"><i class="fa fa-wrench"></i> Reg. CONTROLLI</a>
|
||||
</div>
|
||||
</div>*@
|
||||
}
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ namespace MP_TAB_SERV.Pages
|
||||
var rigaEvento = SMServ.GetEventRow(IdxEv);
|
||||
if (rigaEvento != null)
|
||||
{
|
||||
var rigaStato = await TabServ.StatoMacchina(IdxMacc);
|
||||
var rigaStato = TabServ.StatoMacchina(IdxMacc);
|
||||
// processo evento...
|
||||
if (insRealtime)
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ else
|
||||
<MachineBlock RecMSE="CurrMSE" FullMode="false"></MachineBlock>
|
||||
@if (enableSchedaTecnica)
|
||||
{
|
||||
<TechSheetDetail></TechSheetDetail>
|
||||
<TechSheetMan RecMSE="CurrMSE"></TechSheetMan>
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -746,6 +746,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>
|
||||
/// Registra controllo
|
||||
/// </summary>
|
||||
|
||||
@@ -27,5 +27,10 @@ namespace MP.Data.DatabaseModels
|
||||
public string ValueRead { get; set; } = "";
|
||||
public string Note { get; set; } = "";
|
||||
|
||||
[NotMapped]
|
||||
public bool ShowMissingData
|
||||
{
|
||||
get => Required && (Value != ExtCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,7 @@ using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static System.Runtime.CompilerServices.RuntimeHelpers;
|
||||
|
||||
namespace MP.Data.Services
|
||||
{
|
||||
@@ -1024,6 +1025,59 @@ 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;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Aggiunta record RegistroScarti
|
||||
@@ -1390,7 +1444,7 @@ namespace MP.Data.Services
|
||||
/// </summary>
|
||||
/// <param name="idxMacchina"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<StatoMacchineModel> StatoMacchina(string idxMacchina)
|
||||
public StatoMacchineModel StatoMacchina(string idxMacchina)
|
||||
{
|
||||
// setup parametri costanti
|
||||
string source = "DB";
|
||||
@@ -1399,8 +1453,7 @@ namespace MP.Data.Services
|
||||
StatoMacchineModel? result = new StatoMacchineModel();
|
||||
// cerco in redis...
|
||||
string currKey = $"{redisBaseKey}:StatoMacc:{idxMacchina}";
|
||||
RedisValue rawData = await redisDb.StringGetAsync(currKey);
|
||||
//if (!string.IsNullOrEmpty($"{rawData}"))
|
||||
RedisValue rawData = redisDb.StringGet(currKey);
|
||||
if (rawData.HasValue)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<StatoMacchineModel>($"{rawData}");
|
||||
@@ -1411,7 +1464,7 @@ namespace MP.Data.Services
|
||||
result = dbTabController.StatoMacchina(idxMacchina);
|
||||
// serializzp e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
await redisDb.StringSetAsync(currKey, rawData, TimeSpan.FromSeconds(2));
|
||||
redisDb.StringSet(currKey, rawData, TimeSpan.FromSeconds(2));
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user