Completata pag scarti
This commit is contained in:
@@ -65,7 +65,7 @@ else
|
||||
<thead>
|
||||
<tr class="text-start1">
|
||||
<th>
|
||||
Elenco Controlli
|
||||
Registro Controlli
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
@@ -12,28 +12,42 @@
|
||||
</div>
|
||||
@if (ShowDetail)
|
||||
{
|
||||
<div class="card-body p-1 bg-dark text-light">
|
||||
<div class="card-body p-1">
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<div class="col-4">
|
||||
<div class="input-group">
|
||||
<span class="input-group-text" id="basic-addon1">Data Ora</span>
|
||||
<input type="datetime-local" class="form-control" id="floatDate" @bind="@DateSel">
|
||||
<span class="input-group-text">Num Pz</span>
|
||||
<input type="number" class="form-control text-end" @bind="@NumPz">
|
||||
<button class="btn btn-secondary" @onclick="resetNumPz"><i class="fa-solid fa-arrow-rotate-right"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<button class="btn btn-warning w-100 align-middle" @onclick="doCancel"><i class="fa-solid fa-ban"></i> Annulla</button>
|
||||
<div class="col-8">
|
||||
<div class="input-group">
|
||||
<span class="input-group-text">Data Ora</span>
|
||||
<input type="datetime-local" class="form-control text-end" @bind="@DateSel">
|
||||
<button class="btn btn-secondary" @onclick="resetDate"><i class="fa-solid fa-arrow-rotate-right"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 my-1">
|
||||
<div class="form-floating">
|
||||
<textarea type="text" class="form-control" id="floatingComm" style="height: 6rem;" @bind="@UserComment"></textarea>
|
||||
<label for="floatingComm">Commento</label>
|
||||
<textarea type="text" class="form-control" id="floatingComm" @bind="@UserComment"></textarea>
|
||||
<label for="floatingComm">Commento (opzionale)</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
@if (CanSave)
|
||||
{
|
||||
<button class="btn btn-success w-100" @onclick="doSave"><i class="fa-solid fa-plus"></i> Salva</button>
|
||||
}
|
||||
<div class="row">
|
||||
@foreach (var item in ListComplete)
|
||||
{
|
||||
<div class="col-6 col-lg-4 col-xl-3 mt-2">
|
||||
<button class="btn w-100 btn-lg @($"btn-{item.cssClass}")" @onclick="() => doSave(item)">
|
||||
<i class="@item.icona"></i> @item.label
|
||||
</button>
|
||||
<asp:LinkButton ID="hlRegistra" runat="server" OnClick="hlRegistra_Click" CommandArgument='<%# Eval("value") %>' CssClass='<%# "btn w-100 btn-lg btn-" + Eval("cssClass")%>'>
|
||||
|
||||
</asp:LinkButton>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,25 +1,7 @@
|
||||
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 global::Microsoft.AspNetCore.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
|
||||
{
|
||||
@@ -27,41 +9,20 @@ namespace MP_TAB_SERV.Components
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public bool CanSave { get; set; } = false;
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<string> E_CommRec { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<DateTime> E_DateSel { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<bool> E_Updated { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public MappaStatoExpl? RecMSE { get; set; } = null;
|
||||
|
||||
protected string Title
|
||||
{
|
||||
get => ShowDetail? "Nascondi Registrazione Scarti": "Mostra Registrazione Scarti";
|
||||
}
|
||||
[Parameter]
|
||||
public EventListModel? CurrRecord
|
||||
{
|
||||
set
|
||||
{
|
||||
if (value != null)
|
||||
{
|
||||
DateSel = value.InizioStato ?? DateTime.Now;
|
||||
UserComment = value.Value;
|
||||
ShowDetail = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected int dltMinRealtime = 1;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
protected DateTime DateSel
|
||||
@@ -72,20 +33,38 @@ namespace MP_TAB_SERV.Components
|
||||
if (dateSel != value)
|
||||
{
|
||||
dateSel = value;
|
||||
E_DateSel.InvokeAsync(value).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected List<vSelCauScartoModel> ListComplete { get; set; } = new List<vSelCauScartoModel>();
|
||||
|
||||
[Inject]
|
||||
protected MessageService MServ { get; set; } = null!;
|
||||
|
||||
protected int NumPz
|
||||
{
|
||||
get => numPz;
|
||||
set
|
||||
{
|
||||
if (numPz != value)
|
||||
{
|
||||
numPz = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Inject]
|
||||
protected SharedMemService SMServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected TabDataService TabServ { get; set; } = null!;
|
||||
|
||||
protected string Title
|
||||
{
|
||||
get => ShowDetail ? "Nascondi Registrazione Scarti" : "Mostra Registrazione Scarti";
|
||||
}
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
@@ -95,83 +74,46 @@ namespace MP_TAB_SERV.Components
|
||||
DoReset();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Forza salvataggio impostando data-ora
|
||||
/// </summary>
|
||||
/// <param name="dtRif"></param>
|
||||
/// <returns></returns>
|
||||
public async Task ForceSave(DateTime dtRif)
|
||||
protected async Task doSave(vSelCauScartoModel currCau)
|
||||
{
|
||||
DateSel = dtRif;
|
||||
// ora salvo
|
||||
await doSave();
|
||||
}
|
||||
|
||||
protected async Task doSave()
|
||||
{
|
||||
// registro evento
|
||||
EventListModel newRec = new EventListModel()
|
||||
// registro scarto
|
||||
RegistroScartiModel newRec = new RegistroScartiModel()
|
||||
{
|
||||
IdxMacchina = IdxMacc,
|
||||
InizioStato = DateSel,
|
||||
IdxTipo = idxTipoCommento,
|
||||
CodArticolo = CodArt,
|
||||
Value = UserComment,
|
||||
DataOra = DateSel,
|
||||
Causale = currCau.value,
|
||||
Qta = NumPz,
|
||||
MatrOpr = MatrOpr,
|
||||
pallet = "-"
|
||||
Note=UserComment
|
||||
|
||||
};
|
||||
// elimino vecchio se c'è...
|
||||
await TabServ.EvListDelete(IdxMacc, DateSel, idxTipoCommento);
|
||||
// inserisco
|
||||
await TabServ.EvListInsert(newRec, MP.Data.Objects.Enums.tipoInputEvento.commento);
|
||||
await TabServ.RegScartiInsert(newRec);
|
||||
|
||||
// reset
|
||||
DoReset();
|
||||
//ToggleCtrl();
|
||||
await E_Updated.InvokeAsync(true);
|
||||
}
|
||||
|
||||
protected override void OnInitialized()
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
idxTipoCommento = SMServ.GetConfInt("idxTipoCommento");
|
||||
dltMinRealtime = SMServ.GetConfInt("dltMinRealtime");
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
protected async Task ReloadData()
|
||||
{
|
||||
// verifico SE ci sia una data da usare...
|
||||
bool hasDtRif = await MServ.SessHasVal(MessageService.KeyCommDtRif);
|
||||
if (hasDtRif)
|
||||
{
|
||||
await Task.Delay(1);
|
||||
ShowDetail = false;
|
||||
UserComment = await MServ.CommentoValGet(true);
|
||||
DateSel = await MServ.CommentoDtRifGet(true);
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
ListComplete = await TabServ.VSCS_getAll();
|
||||
}
|
||||
|
||||
|
||||
protected int dltMinRealtime = 1;
|
||||
/// <summary>
|
||||
/// Determina se insert sia Realtime o batch con DataOra (in base a diff tra DataOra
|
||||
/// selezionata e realtime, se superiore ad X minuti NON � realtime)
|
||||
/// </summary>
|
||||
protected bool insRealtime
|
||||
protected void resetDate()
|
||||
{
|
||||
get
|
||||
{
|
||||
bool answ = true;
|
||||
try
|
||||
{
|
||||
if (Math.Abs(DateSel.Subtract(DateTime.Now).TotalMinutes) > dltMinRealtime)
|
||||
{
|
||||
answ = false;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
DateSel = DateTime.Now;
|
||||
}
|
||||
|
||||
protected void resetNumPz()
|
||||
{
|
||||
NumPz = 1;
|
||||
}
|
||||
|
||||
protected void ToggleCtrl()
|
||||
@@ -185,12 +127,6 @@ namespace MP_TAB_SERV.Components
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private int idxTipoCommento = 0;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private string CodArt
|
||||
@@ -210,7 +146,10 @@ namespace MP_TAB_SERV.Components
|
||||
get => MServ.MatrOpr;
|
||||
}
|
||||
|
||||
private int numPz { get; set; } = 1;
|
||||
|
||||
private bool ShowDetail { get; set; } = true;
|
||||
|
||||
private string userComment { get; set; } = "";
|
||||
|
||||
private string UserComment
|
||||
@@ -221,7 +160,6 @@ namespace MP_TAB_SERV.Components
|
||||
if (userComment != value)
|
||||
{
|
||||
userComment = value;
|
||||
E_CommRec.InvokeAsync(value).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
|
||||
<ScrapEditor CanSave="true" RecMSE="@RecMSE" E_Updated="doUpdate"></ScrapEditor>
|
||||
|
||||
<MachSel RecMSE="RecMSE" E_MachSel="SetMacc"></MachSel>
|
||||
<div class="row">
|
||||
@@ -25,39 +24,7 @@ else
|
||||
<ShowProcessing Message="Caricamento" IsProcessing="@isProcessing"></ShowProcessing>
|
||||
<div class="card">
|
||||
<div class="card-header bg-dark">
|
||||
<button class="btn btn-primary btn-lg text-light w-100" @onclick="ToggleBtn">
|
||||
<i class="fa fa-wrench"></i> @ConfTitle
|
||||
</button>
|
||||
@if (showInsert)
|
||||
{
|
||||
@if (showNote)
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="">
|
||||
@* </div>
|
||||
<div class="form-floating"> *@
|
||||
<label class="form-label text-light">Note controllo NON superato (opzionali)</label>
|
||||
<textarea class="form-control" @bind="@noteKo" style="height: 6rem;"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<button class="btn btn-danger btn-lg w-100" @onclick="SaveKo">Conferma controllo KO</button>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="row my-2">
|
||||
<div class="col-6">
|
||||
<button class="btn btn-success w-100" @onclick="SaveOk">OK</button>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<button class="btn btn-danger w-100" @onclick="ShowKo">KO</button>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
<ScrapEditor RecMSE="@RecMSE" E_Updated="doUpdate"></ScrapEditor>
|
||||
</div>
|
||||
<div class="card-body bg-secondary p-1">
|
||||
<div class="row">
|
||||
@@ -67,7 +34,7 @@ else
|
||||
<thead>
|
||||
<tr class="text-start1">
|
||||
<th>
|
||||
Elenco Controlli
|
||||
Registro Scarti
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -81,33 +48,27 @@ else
|
||||
<div>
|
||||
Art: <b>@item.CodArticolo</b>
|
||||
</div>
|
||||
<div>
|
||||
ODL: <b>@($"ODL{item.IdxOdl:000000000}")</b>
|
||||
<div class="@($"text-{item.cssClass}")">
|
||||
<i class="@item.icona"></i> @item.Descrizione
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-2 px-0 text-center">
|
||||
@if (item.EsitoOk)
|
||||
{
|
||||
<i runat="server" class="fa fa-check-circle fs-1 text-success" aria-hidden="true"></i>
|
||||
}
|
||||
else
|
||||
{
|
||||
<i runat="server" class="fa fa-ban fs-1 text-danger" aria-hidden="true"></i>
|
||||
}
|
||||
<b class="fs-2">@item.Qta</b> pz
|
||||
</div>
|
||||
<div class="col-5 text-end small">
|
||||
<div class="text-truncate">
|
||||
@($"{item.DataOra:ddd dd.MM.yy HH:mm:ss}") <i class="fa fa-clock-o" aria-hidden="true"></i>
|
||||
@($"{item.DataOra:ddd dd.MM.yy HH:mm:ss}")
|
||||
<i class="fa fa-clock-o" aria-hidden="true"></i>
|
||||
</div>
|
||||
<div class="text-truncate">
|
||||
<b>@item.Operatore</b>
|
||||
<i class="fa fa-user" aria-hidden="true"></i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 small">
|
||||
<div class="col-12 small text-secondary">
|
||||
@if (!string.IsNullOrEmpty(item.Note))
|
||||
{
|
||||
<div class="text-warning">@item.Note</div>
|
||||
<span>Nota: <b>@item.Note</b></span>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace MP_TAB_SERV.Components
|
||||
await Task.Delay(1);
|
||||
if (!string.IsNullOrEmpty(IdxMaccSel))
|
||||
{
|
||||
ListComplete = await TabDServ.RegControlliFilt(IdxMaccSel, IdxOdl, CurrPeriodo.Inizio, CurrPeriodo.Fine, false);
|
||||
ListComplete = await TabDServ.RegScartiGetFilt(IdxMaccSel, IdxOdl, CurrPeriodo.Inizio, CurrPeriodo.Fine, false);
|
||||
TotalCount = ListComplete.Count;
|
||||
// esegue paginazione
|
||||
UpdateTable();
|
||||
@@ -40,13 +40,10 @@ namespace MP_TAB_SERV.Components
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
protected string ConfTitle
|
||||
{
|
||||
get => showInsert ? "Nascondi Controllo" : "Registra Controllo";
|
||||
}
|
||||
|
||||
|
||||
protected List<RegistroControlliModel> ListComplete { get; set; } = new List<RegistroControlliModel>();
|
||||
protected List<RegistroControlliModel> ListPaged { get; set; } = new List<RegistroControlliModel>();
|
||||
protected List<RegistroScartiModel> ListComplete { get; set; } = new List<RegistroScartiModel>();
|
||||
protected List<RegistroScartiModel> ListPaged { get; set; } = new List<RegistroScartiModel>();
|
||||
|
||||
[Inject]
|
||||
protected MessageService MServ { get; set; } = null!;
|
||||
@@ -69,15 +66,7 @@ namespace MP_TAB_SERV.Components
|
||||
}
|
||||
}
|
||||
|
||||
protected async Task SaveKo()
|
||||
{
|
||||
isProcessing = true;
|
||||
await TabDServ.RegControlliInsert(IdxMaccSel, MServ.MatrOpr, false, noteKo, DateTime.Now);
|
||||
showInsert = false;
|
||||
showNote = false;
|
||||
await doUpdate();
|
||||
isProcessing = false;
|
||||
}
|
||||
|
||||
|
||||
protected void SaveNumRec(int newNum)
|
||||
{
|
||||
@@ -85,15 +74,7 @@ namespace MP_TAB_SERV.Components
|
||||
UpdateTable();
|
||||
}
|
||||
|
||||
protected async Task SaveOk()
|
||||
{
|
||||
isProcessing = true;
|
||||
await TabDServ.RegControlliInsert(IdxMaccSel, MServ.MatrOpr, true, noteKo, DateTime.Now);
|
||||
showInsert = false;
|
||||
showNote = false;
|
||||
await doUpdate();
|
||||
isProcessing = false;
|
||||
}
|
||||
|
||||
|
||||
protected void SavePage(int newNum)
|
||||
{
|
||||
@@ -127,20 +108,7 @@ namespace MP_TAB_SERV.Components
|
||||
await doUpdate();
|
||||
}
|
||||
|
||||
protected void ShowKo()
|
||||
{
|
||||
showNote = true;
|
||||
}
|
||||
|
||||
protected void ToggleBtn()
|
||||
{
|
||||
showInsert = !showInsert;
|
||||
if (showInsert)
|
||||
{
|
||||
noteKo = "";
|
||||
showNote = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected void UpdateTable()
|
||||
{
|
||||
@@ -161,11 +129,8 @@ namespace MP_TAB_SERV.Components
|
||||
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
private bool isProcessing = false;
|
||||
private string noteKo = "";
|
||||
private int NumRecPage = 10;
|
||||
private int PageNum = 1;
|
||||
private bool showInsert = false;
|
||||
private bool showNote = false;
|
||||
private int TotalCount = 0;
|
||||
private bool useOdl = false;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<Version>6.16.2310.1614</Version>
|
||||
<Version>6.16.2310.1616</Version>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<RootNamespace>MP_TAB_SERV</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo MAPOSPEC </i>
|
||||
<h4>Versione: 6.16.2310.1614</h4>
|
||||
<h4>Versione: 6.16.2310.1616</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
6.16.2310.1614
|
||||
6.16.2310.1616
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>6.16.2310.1614</version>
|
||||
<version>6.16.2310.1616</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>
|
||||
|
||||
@@ -5,6 +5,7 @@ using MP.Data.DatabaseModels;
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using static MP.Data.Objects.Enums;
|
||||
@@ -754,6 +755,60 @@ namespace MP.Data.Controllers
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Aggiunta record RegistroScarti
|
||||
/// </summary>
|
||||
/// <param name="newRec"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> RegScartiInsert(RegistroScartiModel newRec)
|
||||
{
|
||||
bool fatto = false;
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
var IdxMacchina = new SqlParameter("@idxMacchina", newRec.IdxMacchina);
|
||||
var DataOra = new SqlParameter("@DataOra", newRec.DataOra);
|
||||
var Causale = new SqlParameter("@Causale", newRec.Causale);
|
||||
var Qta = new SqlParameter("@Qta", newRec.Qta);
|
||||
var Note = new SqlParameter("@Note", newRec.Note);
|
||||
var MatrOpr = new SqlParameter("@MatrOpr", newRec.MatrOpr);
|
||||
|
||||
var result = await dbCtx
|
||||
.Database
|
||||
.ExecuteSqlRawAsync("exec dbo.stp_RS_insert @idxMacchina, @DataOra, @Causale, @Qta, @Note, @MatrOpr", IdxMacchina, DataOra, Causale, Qta, Note, MatrOpr);
|
||||
// indico eseguito!
|
||||
fatto = result > 0;
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
/// <summary>
|
||||
/// Aggiunta record RegistroScarti
|
||||
/// </summary>
|
||||
/// <param name="idxMacchina"></param>
|
||||
/// <param name="idxODL"></param>
|
||||
/// <param name="dataFrom"></param>
|
||||
/// <param name="dataTo"></param>
|
||||
/// <param name="showMulti"></param>
|
||||
/// <returns></returns>
|
||||
public List<RegistroScartiModel> RegScartiGetFilt(string idxMacchina, int idxODL, DateTime dataFrom, DateTime dataTo, bool showMulti)
|
||||
{
|
||||
List<RegistroScartiModel> dbResult = new List<RegistroScartiModel>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
var IdxMacc = new SqlParameter("@IdxMacchina", idxMacchina);
|
||||
var IdxODL = new SqlParameter("@IdxODL", idxODL);
|
||||
var DataFrom = new SqlParameter("@DataFrom", dataFrom);
|
||||
var DataTo = new SqlParameter("@DataTo", dataTo);
|
||||
var ShowMulti = new SqlParameter("@showMulti", showMulti);
|
||||
|
||||
dbResult = dbCtx
|
||||
.DbSetRegScarti
|
||||
.FromSqlRaw("EXEC .stp_RS_getByFilt @IdxMacchina, @IdxODL, @DataFrom, @DataTo, @ShowMulti", IdxMacc, IdxODL, DataFrom, DataTo, ShowMulti)
|
||||
.AsNoTracking()
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua ricalcolo MSE x macchina indicata
|
||||
/// </summary>
|
||||
@@ -1042,6 +1097,23 @@ namespace MP.Data.Controllers
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco causali scarto
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<vSelCauScartoModel> VSCS_getAll()
|
||||
{
|
||||
List<vSelCauScartoModel> dbResult = new List<vSelCauScartoModel>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetVSCS
|
||||
.AsNoTracking()
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco ultimi ODL x macchina
|
||||
/// </summary>
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
|
||||
#nullable disable
|
||||
// <Auto-Generated>
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
// </Auto-Generated>
|
||||
namespace MP.Data.DatabaseModels
|
||||
{
|
||||
public partial class RegistroScartiModel
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public string IdxMacchina { get; set; } = "";
|
||||
public DateTime DataOra { get; set; } = DateTime.Now;
|
||||
public string Causale { get; set; } = "";
|
||||
public string Operatore { get; set; } = "";
|
||||
|
||||
public int Qta { get; set; } = 0;
|
||||
public string Note { get; set; } = "";
|
||||
public string CodArticolo { get; set; } = "";
|
||||
public int MatrOpr { get; set; } = 0;
|
||||
public DateTime? DataOraProdRec { get; set; } = null;
|
||||
public string Descrizione { get; set; } = "";
|
||||
public string cssClass { get; set; } = "";
|
||||
public string icona { get; set; } = "";
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
#nullable disable
|
||||
// <Auto-Generated>
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
// </Auto-Generated>
|
||||
namespace MP.Data.DatabaseModels
|
||||
{
|
||||
public partial class vSelCauScartoModel
|
||||
{
|
||||
[Key]
|
||||
public string value { get; set; } = "";
|
||||
public string label { get; set; } = "";
|
||||
public string cssClass { get; set; } = "";
|
||||
public string icona { get; set; } = "";
|
||||
}
|
||||
}
|
||||
@@ -37,7 +37,7 @@ namespace MP.Data
|
||||
|
||||
#region Public Properties
|
||||
|
||||
|
||||
|
||||
public virtual DbSet<AlarmLogModel> DbSetAlarmLog { get; set; }
|
||||
public virtual DbSet<StatsAnagArticoli> DbSetStatArticoli { get; set; }
|
||||
public virtual DbSet<AnagArticoli> DbSetArticoli { get; set; }
|
||||
@@ -58,7 +58,7 @@ namespace MP.Data
|
||||
public virtual DbSet<StatODLModel> DbSetStatOdl { get; set; }
|
||||
public virtual DbSet<PzProdModel> DbSetPzProd { get; set; }
|
||||
public virtual DbSet<EventListModel> DbSetEvList { get; set; }
|
||||
public virtual DbSet<DiarioDiBordoModel> DbSetDDB { get; set; }
|
||||
public virtual DbSet<DiarioDiBordoModel> DbSetDDB { get; set; }
|
||||
public virtual DbSet<VocabolarioModel> DbSetVocabolario { get; set; }
|
||||
public virtual DbSet<AnagOperatoriModel> DbOperatori { get; set; }
|
||||
public virtual DbSet<Gruppi2OperModel> DbSetGrp2Oper { get; set; }
|
||||
@@ -74,6 +74,7 @@ namespace MP.Data
|
||||
public virtual DbSet<StatoProdModel> DbSetStatoProd { get; set; }
|
||||
public virtual DbSet<TurniMaccModel> DbSetTurniMacc { get; set; }
|
||||
public virtual DbSet<RegistroControlliModel> DbSetRegControlli { get; set; }
|
||||
public virtual DbSet<RegistroScartiModel> DbSetRegScarti { get; set; }
|
||||
|
||||
|
||||
public virtual DbSet<ST_Act> DbSetStAct { get; set; }
|
||||
@@ -90,6 +91,7 @@ namespace MP.Data
|
||||
|
||||
public virtual DbSet<vSelEventiBCodeModel> DbSetVSEB { get; set; }
|
||||
public virtual DbSet<vSelOdlModel> DbSetVSODL { get; set; }
|
||||
public virtual DbSet<vSelCauScartoModel> DbSetVSCS { get; set; }
|
||||
|
||||
|
||||
#endregion Public Properties
|
||||
@@ -541,6 +543,10 @@ namespace MP.Data
|
||||
{
|
||||
entity.HasKey(e => new { e.IdxMacchina, e.InizioStato });
|
||||
});
|
||||
modelBuilder.Entity<RegistroScartiModel>(entity =>
|
||||
{
|
||||
entity.HasKey(e => new { e.IdxMacchina, e.DataOra, e.Causale});
|
||||
});
|
||||
|
||||
modelBuilder.Entity<FermiNonQualModel>(entity =>
|
||||
{
|
||||
@@ -548,9 +554,12 @@ namespace MP.Data
|
||||
});
|
||||
modelBuilder.Entity<vSelOdlModel>(entity =>
|
||||
{
|
||||
//entity.HasKey(e => e.value);
|
||||
entity.ToView("v_selODL");
|
||||
});
|
||||
modelBuilder.Entity<vSelCauScartoModel>(entity =>
|
||||
{
|
||||
entity.ToView("v_selCauScarto");
|
||||
});
|
||||
|
||||
|
||||
OnModelCreatingPartial(modelBuilder);
|
||||
|
||||
@@ -486,7 +486,7 @@ namespace MP.Data.Services
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string logMsg = $"Eccezione in checkCambiaStatoBatch(6) | tipoInputEvento: {tipoEv} |macchina: {newRec.IdxMacchina} | IdxTipo: {newRec.IdxTipo} | CodArticolo: {newRec.CodArticolo} | Value {newRec.Value} | MatrOpr {newRec.MatrOpr} | Pallet {newRec.pallet}{Environment.NewLine}{exc}";
|
||||
string logMsg = $"Eccezione in checkCambiaStatoBatch(6) | tipoInputEvento: {tipoEv} |macchina: {newRec.IdxMacchina} | IdxTipo: {newRec.IdxTipo} | CodArticolo: {newRec.CodArticolo} | Value: {newRec.Value} | MatrOpr: {newRec.MatrOpr} | Pallet: {newRec.pallet}{Environment.NewLine}{exc}";
|
||||
Log.Error(logMsg);
|
||||
}
|
||||
}
|
||||
@@ -670,6 +670,46 @@ namespace MP.Data.Services
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restituisce elenco RS filtrato
|
||||
/// </summary>
|
||||
/// <param name="idxMacchina"></param>
|
||||
/// <param name="idxODL"></param>
|
||||
/// <param name="dataFrom"></param>
|
||||
/// <param name="dataTo"></param>
|
||||
/// <param name="showMulti"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<RegistroScartiModel>> RegScartiGetFilt(string idxMacchina, int idxODL, DateTime dataFrom, DateTime dataTo, bool showMulti)
|
||||
{
|
||||
// setup parametri costanti
|
||||
string source = "DB";
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
List<RegistroScartiModel>? result = new List<RegistroScartiModel>();
|
||||
// cerco in redis...
|
||||
string currKey = $"{redisBaseKey}:RegScarti:{idxMacchina}:{idxODL}:{dataFrom:yyyyyMMdd-HHmm}:{dataFrom:yyyyyMMdd-HHmm}:{showMulti}";
|
||||
RedisValue rawData = await redisDb.StringGetAsync(currKey);
|
||||
if (rawData.HasValue)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<RegistroScartiModel>>($"{rawData}");
|
||||
source = "REDIS";
|
||||
}
|
||||
else
|
||||
{
|
||||
result = dbTabController.RegScartiGetFilt(idxMacchina, idxODL, dataFrom, dataTo, showMulti);
|
||||
// serializzp e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
await redisDb.StringSetAsync(currKey, rawData, FastCache);
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new List<RegistroScartiModel>();
|
||||
}
|
||||
sw.Stop();
|
||||
Log.Debug($"RegScartiGetFilt | {source} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registra controllo
|
||||
/// </summary>
|
||||
@@ -686,6 +726,29 @@ namespace MP.Data.Services
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Aggiunta record RegistroScarti
|
||||
/// </summary>
|
||||
/// <param name="newRec"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> RegScartiInsert(RegistroScartiModel newRec)
|
||||
{
|
||||
bool answ = false;
|
||||
try
|
||||
{
|
||||
// inserisco evento
|
||||
answ = await dbTabController.RegScartiInsert(newRec);
|
||||
// reset cache eventi/commenti
|
||||
await FlushCache("RegScarti");
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string logMsg = $"Eccezione in RegScartiInsert | macchina: {newRec.IdxMacchina} | DataOra: {newRec.DataOra} | Causale: {newRec.Causale} | MatrOpr: {newRec.MatrOpr} | Qta {newRec.Qta} | Note: {newRec.Note}{Environment.NewLine}{exc}";
|
||||
Log.Error(logMsg);
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resetta (rileggendo) i dati della macchina
|
||||
/// </summary>
|
||||
@@ -1163,6 +1226,40 @@ namespace MP.Data.Services
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco causali scarto
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<List<vSelCauScartoModel>> VSCS_getAll()
|
||||
{
|
||||
string source = "DB";
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
List<vSelCauScartoModel>? result = new List<vSelCauScartoModel>();
|
||||
// cerco in redis...
|
||||
string currKey = $"{redisBaseKey}:VSCS";
|
||||
RedisValue rawData = await redisDb.StringGetAsync(currKey);
|
||||
if (rawData.HasValue)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<vSelCauScartoModel>>($"{rawData}");
|
||||
source = "REDIS";
|
||||
}
|
||||
else
|
||||
{
|
||||
result = await Task.FromResult(dbTabController.VSCS_getAll());
|
||||
// serializzp e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
await redisDb.StringSetAsync(currKey, rawData, UltraLongCache);
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new List<vSelCauScartoModel>();
|
||||
}
|
||||
sw.Stop();
|
||||
Log.Debug($"VSCS_getAll | {source} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco ultimi ODL x macchina
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user