SPEC:
- continuo implementazione gestione KIT
This commit is contained in:
+2
-1
@@ -70,8 +70,9 @@ namespace MP.Core
|
||||
|
||||
public const string redisXdlData = redisBaseAddr + "Cache:XDL:";
|
||||
|
||||
public const string redisKitTempl = redisBaseAddr + "Cache:Kit:Templ";
|
||||
public const string redisKitInst = redisBaseAddr + "Cache:Kit:Inst";
|
||||
public const string redisKitTempl = redisBaseAddr + "Cache:Kit:Templ";
|
||||
public const string redisKitWip = redisBaseAddr + "Cache:Kit:Wip";
|
||||
|
||||
#endregion Public Fields
|
||||
|
||||
|
||||
@@ -812,6 +812,87 @@ namespace MP.Data.Controllers
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elimina record
|
||||
/// </summary>
|
||||
/// <param name="rec2del"></param>
|
||||
public bool IstKitDelete(IstanzeKitModel rec2del)
|
||||
{
|
||||
bool fatto = false;
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
var actRec = dbCtx
|
||||
.DbSetInstKit
|
||||
.Where(x => x.KeyKit == rec2del.KeyKit && x.KeyExtOrd == rec2del.KeyExtOrd)
|
||||
.FirstOrDefault();
|
||||
// se ci fosse aggiorno...
|
||||
if (actRec != null)
|
||||
{
|
||||
dbCtx
|
||||
.DbSetInstKit
|
||||
.Remove(actRec);
|
||||
}
|
||||
var res = dbCtx.SaveChanges();
|
||||
fatto = res != 0;
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco istanze KIT da ricerca
|
||||
/// </summary>
|
||||
/// <param name="keyKit"></param>
|
||||
/// <param name="keyExtOrd"></param>
|
||||
/// <returns></returns>
|
||||
public List<IstanzeKitModel> IstKitFilt(string keyKit, string keyExtOrd)
|
||||
{
|
||||
List<IstanzeKitModel> dbResult = new List<IstanzeKitModel>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetInstKit
|
||||
.Where(x => (string.IsNullOrEmpty(keyKit) && string.IsNullOrEmpty(keyExtOrd)) || (x.KeyKit.Contains(keyKit) && !string.IsNullOrEmpty(keyKit)) || (x.KeyExtOrd.Contains(keyExtOrd) && !string.IsNullOrEmpty(keyExtOrd)))
|
||||
.AsNoTracking()
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Esegue upsert record
|
||||
/// </summary>
|
||||
/// <param name="editRec"></param>
|
||||
public bool IstKitUpsert(IstanzeKitModel editRec)
|
||||
{
|
||||
bool fatto = false;
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
var actRec = dbCtx
|
||||
.DbSetInstKit
|
||||
.Where(x => x.KeyKit == editRec.KeyKit && x.KeyExtOrd == editRec.KeyExtOrd)
|
||||
.FirstOrDefault();
|
||||
|
||||
// se ci fosse aggiorno...
|
||||
if (actRec == null)
|
||||
{
|
||||
dbCtx
|
||||
.DbSetInstKit
|
||||
.Add(editRec);
|
||||
}
|
||||
else
|
||||
{
|
||||
actRec.CodArtParent = editRec.CodArtParent;
|
||||
actRec.CodArtChild = editRec.CodArtChild;
|
||||
actRec.QtyART = editRec.QtyART;
|
||||
actRec.QtyKIT = editRec.QtyKIT;
|
||||
dbCtx.Entry(actRec).State = EntityState.Modified;
|
||||
}
|
||||
var res = dbCtx.SaveChanges();
|
||||
fatto = res != 0;
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco giacenze
|
||||
/// </summary>
|
||||
@@ -1658,19 +1739,19 @@ namespace MP.Data.Controllers
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco template da ricerca
|
||||
/// Elenco template KIT da ricerca
|
||||
/// </summary>
|
||||
/// <param name="codParent"></param>
|
||||
/// <param name="codCHild"></param>
|
||||
/// <param name="KitCode"></param>
|
||||
/// <param name="codChild"></param>
|
||||
/// <returns></returns>
|
||||
public List<TemplateKitModel> TemplateKitFilt(string codParent, string codChild)
|
||||
public List<TemplateKitModel> TemplateKitFilt(string KitCode, string codChild)
|
||||
{
|
||||
List<TemplateKitModel> dbResult = new List<TemplateKitModel>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetTempKit
|
||||
.Where(x => (string.IsNullOrEmpty(codParent) && string.IsNullOrEmpty(codChild)) || (x.CodArtParent.Contains(codParent) && !string.IsNullOrEmpty(codParent)) || (x.CodArtChild.Contains(codChild) && !string.IsNullOrEmpty(codChild)))
|
||||
.Where(x => (string.IsNullOrEmpty(KitCode) && string.IsNullOrEmpty(codChild)) || (x.CodArtParent.Contains(KitCode) && !string.IsNullOrEmpty(KitCode)) || (x.CodArtChild.Contains(codChild) && !string.IsNullOrEmpty(codChild)))
|
||||
.AsNoTracking()
|
||||
.ToList();
|
||||
}
|
||||
@@ -1700,8 +1781,6 @@ namespace MP.Data.Controllers
|
||||
}
|
||||
else
|
||||
{
|
||||
actRec.CodArtParent = editRec.CodArtParent;
|
||||
actRec.CodArtChild = editRec.CodArtChild;
|
||||
actRec.Qty = editRec.Qty;
|
||||
dbCtx.Entry(actRec).State = EntityState.Modified;
|
||||
}
|
||||
@@ -1729,6 +1808,143 @@ namespace MP.Data.Controllers
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elimina record
|
||||
/// </summary>
|
||||
/// <param name="rec2del"></param>
|
||||
public bool WipKitDelete(WipSetupKitModel rec2del)
|
||||
{
|
||||
bool fatto = false;
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
var actRec = dbCtx
|
||||
.DbSetWipKit
|
||||
.Where(x => x.KeyFilt == rec2del.KeyFilt && x.CodOrd == rec2del.CodOrd)
|
||||
.FirstOrDefault();
|
||||
// se ci fosse aggiorno...
|
||||
if (actRec != null)
|
||||
{
|
||||
dbCtx
|
||||
.DbSetWipKit
|
||||
.Remove(actRec);
|
||||
}
|
||||
var res = dbCtx.SaveChanges();
|
||||
fatto = res != 0;
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elimina i record associati al KeyFilt indicato
|
||||
/// </summary>
|
||||
/// <param name="KeyFilt"></param>
|
||||
public bool WipKitDeleteGroup(string KeyFilt)
|
||||
{
|
||||
bool fatto = false;
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
var actRec = dbCtx
|
||||
.DbSetWipKit
|
||||
.Where(x => x.KeyFilt == KeyFilt)
|
||||
.ToList();
|
||||
// se ci fosse aggiorno...
|
||||
if (actRec != null)
|
||||
{
|
||||
dbCtx
|
||||
.DbSetWipKit
|
||||
.RemoveRange(actRec);
|
||||
}
|
||||
var res = dbCtx.SaveChanges();
|
||||
fatto = res != 0;
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elimina record + vecchi della data-ora indicata
|
||||
/// </summary>
|
||||
/// <param name="dateLimit"></param>
|
||||
/// <returns></returns>
|
||||
public bool WipKitDeleteOlder(DateTime dateLimit)
|
||||
{
|
||||
bool fatto = false;
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
var actRec = dbCtx
|
||||
.DbSetWipKit
|
||||
.Where(x => x.DataIns < dateLimit)
|
||||
.ToList();
|
||||
// se ci fosse aggiorno...
|
||||
if (actRec != null)
|
||||
{
|
||||
dbCtx
|
||||
.DbSetWipKit
|
||||
.RemoveRange(actRec);
|
||||
}
|
||||
var res = dbCtx.SaveChanges();
|
||||
fatto = res != 0;
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco record WipSetupKit da KeyFilt
|
||||
/// </summary>
|
||||
/// <param name="KeyFilt"></param>
|
||||
/// <returns></returns>
|
||||
public List<WipSetupKitModel> WipKitFilt(string KeyFilt)
|
||||
{
|
||||
List<WipSetupKitModel> dbResult = new List<WipSetupKitModel>();
|
||||
// solo se filtro valido...
|
||||
if (!string.IsNullOrEmpty(KeyFilt))
|
||||
{
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetWipKit
|
||||
.Where(x => x.KeyFilt.Contains(KeyFilt))
|
||||
.AsNoTracking()
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Esegue upsert record
|
||||
/// </summary>
|
||||
/// <param name="editRec"></param>
|
||||
public bool WipKitUpsert(WipSetupKitModel editRec)
|
||||
{
|
||||
bool fatto = false;
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
var actRec = dbCtx
|
||||
.DbSetWipKit
|
||||
.Where(x => x.KeyFilt == editRec.KeyFilt && x.CodOrd == editRec.CodOrd)
|
||||
.FirstOrDefault();
|
||||
|
||||
// se ci fosse aggiorno...
|
||||
if (actRec == null)
|
||||
{
|
||||
dbCtx
|
||||
.DbSetWipKit
|
||||
.Add(editRec);
|
||||
}
|
||||
else
|
||||
{
|
||||
actRec.CodArt = editRec.CodArt;
|
||||
actRec.DescArt = editRec.DescArt;
|
||||
actRec.Qta = editRec.Qta;
|
||||
actRec.DataIns = editRec.DataIns;
|
||||
dbCtx.Entry(actRec).State = EntityState.Modified;
|
||||
}
|
||||
var res = dbCtx.SaveChanges();
|
||||
fatto = res != 0;
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
// <Auto-Generated>
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
// </Auto-Generated>
|
||||
namespace MP.Data.DbModels
|
||||
{
|
||||
/// <summary>
|
||||
/// Classe gestione item temporaneo x setup KIT di lavorazione
|
||||
/// </summary>
|
||||
[Table("WipSetupKit")]
|
||||
public class WipSetupKitModel
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Ticket composizione KIT
|
||||
/// </summary>
|
||||
[MaxLength(50)]
|
||||
public string KeyFilt { get; set; } = "-";
|
||||
|
||||
/// <summary>
|
||||
/// Cod esterno ordine (KeyRif ordine ERP)
|
||||
/// </summary>
|
||||
[MaxLength(50)]
|
||||
public string CodOrd { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Codice Articolo
|
||||
/// </summary>
|
||||
[MaxLength(50)]
|
||||
public string CodArt { get; set; } = "";
|
||||
/// <summary>
|
||||
/// Descrizione Articolo
|
||||
/// </summary>
|
||||
[MaxLength(250)]
|
||||
public string DescArt { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Quantità articoli dell'ordine
|
||||
/// </summary>
|
||||
public int Qta { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// DataOra inserimento record
|
||||
/// </summary>
|
||||
public DateTime DataIns { get; set; } = DateTime.Now;
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -101,6 +101,7 @@ namespace MP.Data
|
||||
public virtual DbSet<AnagCountersModel> DbSetAnagCount { get; set; }
|
||||
public virtual DbSet<IstanzeKitModel> DbSetInstKit { get; set; }
|
||||
public virtual DbSet<TemplateKitModel> DbSetTempKit { get; set; }
|
||||
public virtual DbSet<WipSetupKitModel> DbSetWipKit { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
@@ -584,6 +585,10 @@ namespace MP.Data
|
||||
{
|
||||
entity.HasKey(e => new { e.CodArtParent, e.CodArtChild });
|
||||
});
|
||||
modelBuilder.Entity<WipSetupKitModel>(entity =>
|
||||
{
|
||||
entity.HasKey(e => new { e.KeyFilt, e.CodOrd});
|
||||
});
|
||||
|
||||
OnModelCreatingPartial(modelBuilder);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
<div class="card">
|
||||
<div class="card-header bg-danger text-light">
|
||||
<h4>KIT e Promesse</h4>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<b>Elenco KIT associati ad ordini</b>
|
||||
<p>...tabella...</p>
|
||||
@* <asp:GridView runat="server" ID="grViewIstanzeKIT" DataSourceID="odsIstanzeKIT" AutoGenerateColumns="False" DataKeyNames="KeyKit,KeyExtOrd" CssClass="table table-sm table-striped">
|
||||
<EmptyDataTemplate>
|
||||
Nessun Record (Ordini associati a KIT)
|
||||
</EmptyDataTemplate>
|
||||
<Columns>
|
||||
<asp:BoundField DataField="KeyKit" HeaderText="OPR.KIT" ReadOnly="True" SortExpression="KeyKit" ItemStyle-CssClass="font-weight-bold" />
|
||||
<asp:BoundField DataField="CodArtParent" HeaderText="Cod.KIT" SortExpression="CodArtParent" />
|
||||
<asp:BoundField DataField="KeyExtOrd" HeaderText="OPR" ReadOnly="True" SortExpression="KeyExtOrd" ItemStyle-CssClass="text-danger" />
|
||||
<asp:BoundField DataField="CodArtChild" HeaderText="Cod.Art" SortExpression="CodArtChild" />
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
<asp:ObjectDataSource ID="odsIstanzeKIT" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="getByExtOrd" TypeName="MapoDb.DS_IntServTableAdapters.IstanzeKITTableAdapter">
|
||||
<SelectParameters>
|
||||
<asp:ControlParameter ControlID="hlCodKitTemp" Name="KeyFilt" PropertyName="Value" Type="String" />
|
||||
</SelectParameters>
|
||||
</asp:ObjectDataSource> *@
|
||||
</div>
|
||||
<div class="card-footer py-1 bg-danger text-light">
|
||||
Attenzione: non associare OPR a più KIT!
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace MP.SPEC.Components
|
||||
{
|
||||
public partial class GestKitPodl
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
<div class="card">
|
||||
<div class="card-header bg-success text-light">
|
||||
<h4>Verifica KIT</h4>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<b>Elenco KIT compatibili</b>
|
||||
<p>...tabella...</p>
|
||||
@* <asp:GridView runat="server" ID="grViewKitSel" DataSourceID="odsKitSel" AutoGenerateColumns="False" CssClass="table table-striped table-sm" DataKeyNames="CodArtParent" OnSelectedIndexChanged="grViewKitSel_SelectedIndexChanged">
|
||||
<EmptyDataTemplate>
|
||||
Nessun KIT trovato
|
||||
</EmptyDataTemplate>
|
||||
<Columns>
|
||||
<asp:BoundField DataField="CodArtParent" HeaderText="Codice KIT" SortExpression="CodArtParent" />
|
||||
<asp:BoundField DataField="TotalScore" HeaderText="Coerenza KIT" ReadOnly="True" SortExpression="TotalScore" DataFormatString="{0:P2}" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:TemplateField HeaderText="Azione">
|
||||
<ItemTemplate>
|
||||
<asp:LinkButton runat="server" ID="lbtCreatePODL" Visible='<%# Eval("TotalScore","{0:P0}") == "100%" %>' CssClass="btn btn-success btn-sm" ToolTip="Crea ordine KIT" CommandName="select">
|
||||
<i class="fa fa-plus-square"></i> Prom.ODL <i class="fa fa-plus-square"></i>
|
||||
</asp:LinkButton>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
<asp:ObjectDataSource runat="server" ID="odsKitSel" OldValuesParameterFormatString="original_{0}" SelectMethod="GetData" TypeName="MapoDb.DS_IntServTableAdapters.TKS_SearchTableAdapter">
|
||||
<SelectParameters>
|
||||
<asp:ControlParameter ControlID="hlCodKitTemp" Name="KeyFilt" PropertyName="Value" Type="String" />
|
||||
<asp:Parameter DefaultValue="2" Name="maxResult" Type="Int32" />
|
||||
</SelectParameters>
|
||||
</asp:ObjectDataSource> *@
|
||||
<div runat="server" id="divPODL">
|
||||
<b>Elenco promesse per KIT (100%)</b>
|
||||
<p>...tabella...</p>
|
||||
@* <asp:GridView runat="server" ID="grViewPODL" DataSourceID="odsPODL" CssClass="table table-sm table-striped" AutoGenerateColumns="False" DataKeyNames="idxPromessa">
|
||||
<Columns>
|
||||
<asp:BoundField DataField="idxPromessa" HeaderText="#" InsertVisible="False" ReadOnly="True" SortExpression="idxPromessa" />
|
||||
<asp:TemplateField HeaderText="Cod.KIT" SortExpression="KeyRichiesta">
|
||||
<ItemTemplate>
|
||||
<div style="float: left;">
|
||||
<b>
|
||||
<asp:Label runat="server" ID="txtCodArticolo" Text='<%# Eval("CodArticolo") %>' /></b>
|
||||
</div>
|
||||
<div style="float: right; font-size: 0.8em;">
|
||||
<asp:Label runat="server" ID="Label3" Text='<%# Eval("KeyRichiesta") %>' />
|
||||
</div>
|
||||
<div style="float: none; clear: both;">
|
||||
<asp:Label runat="server" ID="txtDescArticolo" Text='<%# Eval("DescArticolo") %>' />
|
||||
</div>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField HeaderText="Nome" SortExpression="Nome">
|
||||
<ItemTemplate>
|
||||
<b>
|
||||
<asp:Label runat="server" ID="txtCodMacchina" Text='<%# Eval("CodMacchina") %>' /></b>
|
||||
<br />
|
||||
<asp:Label runat="server" ID="txtNome" Text='<%# Eval("Nome") %>' />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:BoundField DataField="NumPezzi" HeaderText="NumPezzi" SortExpression="NumPezzi" />
|
||||
</Columns>
|
||||
<EmptyDataTemplate>
|
||||
Nessun Record (P.ODL da eseguire)
|
||||
</EmptyDataTemplate>
|
||||
</asp:GridView>
|
||||
<asp:ObjectDataSource ID="odsPODL" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="getByCodArt" TypeName="MapoDb.DS_ProdTempiTableAdapters.PromesseODLTableAdapter">
|
||||
<SelectParameters>
|
||||
<asp:ControlParameter ControlID="hfCodArtKit" DefaultValue="###" Name="CodArticolo" PropertyName="Value" Type="String" />
|
||||
<asp:Parameter DefaultValue="true" Name="onlyAvail" Type="Boolean" />
|
||||
</SelectParameters>
|
||||
</asp:ObjectDataSource>
|
||||
<asp:HiddenField runat="server" ID="hfCodArtKit" /> *@
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer py-1 bg-success text-light">
|
||||
Abilitato se = 100%
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace MP.SPEC.Components
|
||||
{
|
||||
public partial class GestKitVerif
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
<div class="card">
|
||||
<div class="card-header bg-primary text-light">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-0">
|
||||
<h4>Composizione KIT</h4>
|
||||
</div>
|
||||
<div class="px-0">
|
||||
<button @onclick="() => CleanupOld()" class="btn btn-danger btn-sm2"><i class="fa-solid fa-recycle"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
@* <asp:GridView runat="server" ID="grViewWSK" DataSourceID="odsWSK" AutoGenerateColumns="False" DataKeyNames="KeyFilt,CodOrd" CssClass="table table-sm table-striped">
|
||||
<EmptyDataTemplate>
|
||||
Nessun Ordine caricato
|
||||
</EmptyDataTemplate>
|
||||
<Columns>
|
||||
<asp:BoundField DataField="CodOrd" HeaderText="OPR" ReadOnly="True" SortExpression="CodOrd" ItemStyle-CssClass="text-nowrap" />
|
||||
<asp:BoundField DataField="CodArt" HeaderText="Cod.Art" SortExpression="CodArt" ItemStyle-CssClass="font-weight-bold" />
|
||||
<asp:BoundField DataField="DescArt" HeaderText="Desc.Art" SortExpression="DescArt" ItemStyle-CssClass="small" />
|
||||
<asp:BoundField DataField="Qta" HeaderText="Qta" SortExpression="Qta" />
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
<asp:ObjectDataSource runat="server" ID="odsWSK" OldValuesParameterFormatString="original_{0}" SelectMethod="getByFilt" TypeName="MapoDb.DS_IntServTableAdapters.WipSetupKitTableAdapter">
|
||||
<SelectParameters>
|
||||
<asp:ControlParameter ControlID="hlCodKitTemp" Name="KeyFilt" PropertyName="Value" Type="String" />
|
||||
</SelectParameters>
|
||||
</asp:ObjectDataSource> *@
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<table class="table table-sm table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Cod Ordine</th>
|
||||
<th>Cod Articolo</th>
|
||||
<th>Descr. Art.</th>
|
||||
<th>Qty</th>
|
||||
<th>Data</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var record in ListRecords)
|
||||
{
|
||||
<tr>
|
||||
<td>@record.CodOrd</td>
|
||||
<td>@record.CodArt</td>
|
||||
<td>@record.DescArt</td>
|
||||
<td>@record.Qta</td>
|
||||
<td>@($"{record.DataIns:yyyy.MM.dd HH:mm:ss}")</td>
|
||||
<td>
|
||||
<button @onclick="() => DoDelete(record)" class="btn btn-danger btn-sm"><i class="bi bi-trash-fill"></i></button>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer py-1 bg-primary text-light">
|
||||
Cod temp: <b>@KeyFilt</b>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using MP.Data.DbModels;
|
||||
using MP.SPEC.Data;
|
||||
|
||||
namespace MP.SPEC.Components.ProdKit
|
||||
{
|
||||
public partial class Composer
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public PODLExpModel? Rec2Add
|
||||
{
|
||||
get => currRec;
|
||||
set
|
||||
{
|
||||
if (currRec != value)
|
||||
{
|
||||
currRec = value;
|
||||
if (value != null)
|
||||
{
|
||||
// chiamo tentativo update!
|
||||
WipSetupKitModel newRec = new WipSetupKitModel()
|
||||
{
|
||||
KeyFilt = KeyFilt,
|
||||
CodArt = value.CodArticolo,
|
||||
CodOrd = value.KeyRichiesta,
|
||||
DescArt = value.DescArticolo,
|
||||
Qta = value.NumPezzi,
|
||||
DataIns = DateTime.Now
|
||||
};
|
||||
bool fatto = MDService.WipKitUpsert(newRec);
|
||||
}
|
||||
// rileggoi
|
||||
ReloadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected MpDataService MDService { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected async Task CleanupOld()
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sicuro di voler eliminare tutti i record temporanei della procedura di composizione KIT?"))
|
||||
return;
|
||||
|
||||
// elimino TUTTO...
|
||||
DateTime dtLimit = DateTime.Now;//.AddHours(-1);
|
||||
var done = MDService.WipKitDeleteOlder(dtLimit);
|
||||
ReloadData();
|
||||
}
|
||||
|
||||
protected async Task DoDelete(WipSetupKitModel rec2del)
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Eliminazione riga KIT: sei sicuro di voler procedere?"))
|
||||
return;
|
||||
|
||||
var done = MDService.WipKitDelete(rec2del);
|
||||
ReloadData();
|
||||
}
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
// calcolo codice temporaneo utente...da apertura KIT
|
||||
if (string.IsNullOrEmpty(KeyFilt))
|
||||
{
|
||||
DateTime adesso = DateTime.Now;
|
||||
KeyFilt = $"KIT_{adesso:yyMMdd}_{adesso:HHmmss}";
|
||||
// elimino dati + vecchi di 2h...
|
||||
DateTime dtLimit = DateTime.Now.AddHours(-2);
|
||||
var done = MDService.WipKitDeleteOlder(dtLimit);
|
||||
}
|
||||
|
||||
ReloadData();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private PODLExpModel? currRec = null;
|
||||
private string KeyFilt = "";
|
||||
private List<WipSetupKitModel> ListRecords = new List<WipSetupKitModel>();
|
||||
|
||||
private List<WipSetupKitModel> SearchRecord = new List<WipSetupKitModel>();
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private void ReloadData()
|
||||
{
|
||||
SearchRecord = MDService.WipKitFilt(KeyFilt);
|
||||
ListRecords = SearchRecord.ToList();
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<PodlMan PadCodXdl="@padCodXdl" EC_RecordSel="SavePodl"></PodlMan>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<Composer Rec2Add="@currPodlRec"></Composer>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<GestKitVerif></GestKitVerif>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<GestKitPodl></GestKitPodl>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using MP.Data.DbModels;
|
||||
using MP.SPEC.Data;
|
||||
|
||||
namespace MP.SPEC.Components.ProdKit
|
||||
{
|
||||
public partial class Manager
|
||||
{
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected MpDataService MDService { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
if (string.IsNullOrEmpty(padCodXdl))
|
||||
{
|
||||
padCodXdl = MDService.ConfigTryGet("padCodXdl");
|
||||
}
|
||||
currPodlRec = null;
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private string padCodXdl = "00000";
|
||||
|
||||
/// <summary>
|
||||
/// Salvataggio su Tab WIP dei dati del PODL ricevuto...
|
||||
/// </summary>
|
||||
/// <param name="selRec"></param>
|
||||
protected void SavePodl(PODLExpModel selRec)
|
||||
{
|
||||
currPodlRec = selRec;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Record PODL corrente da inserire
|
||||
/// </summary>
|
||||
private PODLExpModel? currPodlRec = null;
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
<div class="card mb-2">
|
||||
<div class="card-header">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-0">
|
||||
<b>PODL</b> disponibili
|
||||
</div>
|
||||
<div class="px-0 align-content-center d-flex justify-content-end">
|
||||
<div class="input-group me-2" style="min-width: 20rem;">
|
||||
<span class="input-group-text"><i class="fa fa-search"></i></span>
|
||||
<input type="text" class="form-control" placeholder="@($"Cod Commessa | Ctrl-R")" aria-label="Ricerca" title="@($"Ricerca Commessa | Ctrl-R")" @bind="@SearchVal" accesskey="R">
|
||||
@* <button class="btn @sSearchtCss" @onclick="() => ResetSearch()"><i class="fa fa-ban"></i></button> *@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body p-0">
|
||||
@if (ListRecords == null || isLoading)
|
||||
{
|
||||
<LoadingData></LoadingData>
|
||||
}
|
||||
else if (totalCount == 0)
|
||||
{
|
||||
<div class="alert alert-warning text-center display-4">Nessun record trovato</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<table class="table table-sm table-striped small">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
@if (currRecord != null)
|
||||
{
|
||||
<button @onclick="() => resetSel(true)" class="btn btn-primary btn-sm"><i class="bi bi-arrow-counterclockwise"></i></button>
|
||||
}
|
||||
</th>
|
||||
<th><i class="fa-solid fa-circle-info"></i> Info ciclo</th>
|
||||
<th><i class="fa-solid fa-file"></i> Articolo</th>
|
||||
<th title="Attivabile"><i class="fa-regular fa-square-check"></i> Att</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var record in ListRecords)
|
||||
{
|
||||
<tr class="@checkSelect(@record)">
|
||||
<td class="text-nowrap">
|
||||
<button @onclick="() => selRecord(record)" class="btn btn-primary btn-sm" title="Aggiunta Commessa"><i class="fa-regular fa-plus"></i></button>
|
||||
</td>
|
||||
<td>
|
||||
<div class="small">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-0">
|
||||
<b>PODL</b>
|
||||
</div>
|
||||
<div class="px-0">
|
||||
@($"{record.IdxPromessa.ToString(PadCodXdl)}")
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="textConsensed d-flex justify-content-between">
|
||||
<div class="px-0"><b>N° pezzi:</b> </div>
|
||||
<div class="px-0"> @record.NumPezzi</div>
|
||||
</div>
|
||||
<div class="textConsensed d-flex justify-content-between">
|
||||
<div class="px-0"><b>T. Ciclo:</b> </div>
|
||||
<div class="px-0">@record.Tcassegnato.ToString("N2")</div>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<i class="fa-solid fa-key"></i> @record.KeyRichiesta
|
||||
</div>
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-0">
|
||||
<i class="fa-solid fa-box"></i> @record.CodArticolo
|
||||
</div>
|
||||
<div class="px-0">
|
||||
<div class="small textConsensed text-secondary">@record.DescArticolo</div>
|
||||
</div>
|
||||
</div>
|
||||
@if (record.Note != "")
|
||||
{
|
||||
<div class="small textConsensed text-secondary badge text-bg-light border border-primary rounded text-truncate" style="max-width: 25rem;" title="@record.Note">
|
||||
<b class="text-dark text-truncate">Note:</b> @record.Note
|
||||
</div>
|
||||
}
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
@if (@record.Attivabile)
|
||||
{
|
||||
<i class="fa-regular fa-square-check text-success"></i>
|
||||
}
|
||||
else
|
||||
{
|
||||
<i class="fa-regular fa-square text-secondary"></i>
|
||||
}
|
||||
</div>
|
||||
@if (!string.IsNullOrEmpty(record.Recipe))
|
||||
{
|
||||
<div>
|
||||
<i class="fa-solid fa-flask"></i>
|
||||
</div>
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div class="card-footer py-1">
|
||||
@if (totalCount > numRecord)
|
||||
{
|
||||
}
|
||||
<DataPager PageSize="numRecord" currPage="currPage" numRecordChanged="SetNumRec" numPageChanged="SetNumPage" totalCount="totalCount" showLoading="isLoading" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,331 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using MP.Data;
|
||||
using MP.Data.DbModels;
|
||||
using MP.SPEC.Data;
|
||||
using MP.SPEC.Services;
|
||||
using NLog;
|
||||
|
||||
namespace MP.SPEC.Components.ProdKit
|
||||
{
|
||||
public partial class PodlMan : IDisposable
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public string PadCodXdl { get; set; } = "0000";
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<bool> PagerResetReq { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<PODLExpModel> EC_RecordSel { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<int> UpdateRecordCount { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public string checkSelect(PODLExpModel record)
|
||||
{
|
||||
string answ = "";
|
||||
if (currRecord != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
answ = (currRecord.IdxPromessa == record.IdxPromessa) ? "table-info" : "";
|
||||
//answ = ((EditRecord.IdxMacchina == record.IdxMacchina) && (EditRecord.CodArticolo == record.CodArticolo) && (EditRecord.CodFase == record.CodFase)) ? "table-info" : "";
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
currRecord = null;
|
||||
SearchRecords = null;
|
||||
ListRecords = null;
|
||||
ListStati = null;
|
||||
GC.Collect();
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
|
||||
protected void ResetParent()
|
||||
{
|
||||
SearchVal = "";
|
||||
UpdateTable();
|
||||
}
|
||||
|
||||
protected string sParentCss
|
||||
{
|
||||
get => string.IsNullOrEmpty(SearchVal) ? "btn-secondary" : "btn-primary";
|
||||
}
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
protected SelectXdlParams ActFilter { get; set; } = new SelectXdlParams();
|
||||
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected MpDataService MDService { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected IOApiService MpIoApiCall { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected NavigationManager NavManager { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
ListStati = await MDService.AnagStatiComm();
|
||||
string SPEC_PODL_gest = await MDService.ConfigTryGetAsync("SPEC_PODL_gest");
|
||||
DateTime oggi = DateTime.Today;
|
||||
ActFilter = new SelectXdlParams()
|
||||
{
|
||||
DtEnd = oggi.AddDays(1),
|
||||
DtStart = oggi.AddYears(-1),
|
||||
HasOdl = false,
|
||||
MaxRecord = 1000,
|
||||
NumRec = 5
|
||||
};
|
||||
}
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
if (!lastFilter.Equals(ActFilter))
|
||||
{
|
||||
lastFilter = ActFilter.clone();
|
||||
await ReloadData();
|
||||
}
|
||||
}
|
||||
|
||||
protected async void OnSeachUpdated()
|
||||
{
|
||||
await InvokeAsync(() =>
|
||||
{
|
||||
PagerResetReq.InvokeAsync(true);
|
||||
Task task = UpdateData();
|
||||
StateHasChanged();
|
||||
});
|
||||
}
|
||||
|
||||
protected async Task ReloadData()
|
||||
{
|
||||
ListRecords = null;
|
||||
isLoading = true;
|
||||
SearchRecords = await MDService.POdlListGetFilt(hasOdl, StatoSel, macchina, reparto, selDtStart, selDtEnd);
|
||||
// filtro tenendo SOLO se hanno keyRichiesta CodExt... Hard Coded...
|
||||
SearchRecords = SearchRecords
|
||||
.Where(x => !string.IsNullOrEmpty(x.KeyRichiesta))
|
||||
.ToList();
|
||||
|
||||
UpdateTable();
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
protected async Task resetSel(bool forceUpdate)
|
||||
{
|
||||
currRecord = null;
|
||||
if (forceUpdate)
|
||||
{
|
||||
await ReloadData();
|
||||
}
|
||||
}
|
||||
|
||||
protected async Task selRecord(PODLExpModel? selRec)
|
||||
{
|
||||
currRecord = selRec;
|
||||
await EC_RecordSel.InvokeAsync(selRec);
|
||||
#if false
|
||||
// rimuovo selezione
|
||||
currRecord = null;
|
||||
#endif
|
||||
}
|
||||
|
||||
protected void SetNumPage(int newNum)
|
||||
{
|
||||
currPage = newNum;
|
||||
UpdateTable();
|
||||
}
|
||||
|
||||
protected void SetNumRec(int newNum)
|
||||
{
|
||||
currPage = 1;
|
||||
numRecord = newNum;
|
||||
UpdateTable();
|
||||
}
|
||||
|
||||
protected async Task UpdateData()
|
||||
{
|
||||
currRecord = null;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
|
||||
private PODLExpModel? currRecord = null;
|
||||
|
||||
private List<PODLExpModel>? ListRecords;
|
||||
|
||||
private List<ListValues>? ListStati;
|
||||
|
||||
/// <summary>
|
||||
/// Elenco ODL correnti...
|
||||
/// </summary>
|
||||
private List<string> odlCurrList = new List<string>();
|
||||
|
||||
private List<PODLExpModel>? SearchRecords;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private int _totalCount { get; set; } = -1;
|
||||
|
||||
private int currPage
|
||||
{
|
||||
get => ActFilter.CurrPage;
|
||||
set => ActFilter.CurrPage = value;
|
||||
}
|
||||
|
||||
private bool hasOdl
|
||||
{
|
||||
get => ActFilter.HasOdl;
|
||||
set => ActFilter.HasOdl = value;
|
||||
}
|
||||
|
||||
private bool isLoading { get; set; } = false;
|
||||
|
||||
private SelectXdlParams lastFilter { get; set; } = new SelectXdlParams() { CurrPage = -1 };
|
||||
|
||||
private string macchina
|
||||
{
|
||||
get => ActFilter.IdxMacchina;
|
||||
set => ActFilter.IdxMacchina = value;
|
||||
}
|
||||
|
||||
private int numRecord
|
||||
{
|
||||
get => ActFilter.NumRec;
|
||||
set => ActFilter.NumRec = value;
|
||||
}
|
||||
|
||||
private string reparto
|
||||
{
|
||||
get => ActFilter.CodReparto;
|
||||
set => ActFilter.CodReparto = value;
|
||||
}
|
||||
|
||||
protected string SearchVal
|
||||
{
|
||||
get => searchVal;
|
||||
set
|
||||
{
|
||||
if (searchVal != value)
|
||||
{
|
||||
searchVal = value;
|
||||
UpdateTable();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string searchVal = "";
|
||||
|
||||
private DateTime selDtEnd
|
||||
{
|
||||
get => ActFilter.DtEnd;
|
||||
set
|
||||
{
|
||||
if (!ActFilter.DtEnd.Equals(value))
|
||||
{
|
||||
ActFilter.DtEnd = value;
|
||||
currPage = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private DateTime selDtStart
|
||||
{
|
||||
get => ActFilter.DtStart;
|
||||
set
|
||||
{
|
||||
if (!ActFilter.DtStart.Equals(value))
|
||||
{
|
||||
ActFilter.DtStart = value;
|
||||
currPage = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string StatoSel
|
||||
{
|
||||
get => ActFilter.CodFase;
|
||||
set => ActFilter.CodFase = value;
|
||||
}
|
||||
|
||||
private int totalCount
|
||||
{
|
||||
get => _totalCount;
|
||||
set
|
||||
{
|
||||
if (_totalCount != value)
|
||||
{
|
||||
_totalCount = value;
|
||||
UpdateRecordCount.InvokeAsync(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private void UpdateTable()
|
||||
{
|
||||
totalCount = 0;
|
||||
if (SearchRecords != null)
|
||||
{
|
||||
var filtRec = new List<PODLExpModel>(SearchRecords);
|
||||
// se ho ricerca filtro!
|
||||
if (!string.IsNullOrEmpty(searchVal))
|
||||
{
|
||||
int idxPodl = 0;
|
||||
// SE la ricerca contiene PODL filtro e cerco...
|
||||
if (searchVal.Contains("PODL"))
|
||||
{
|
||||
}
|
||||
int.TryParse(searchVal.Replace("PODL", ""), out idxPodl);
|
||||
filtRec = SearchRecords
|
||||
.Where(x => (x.KeyRichiesta.Contains(searchVal) || x.KeyBCode.Contains(searchVal) || (x.IdxPromessa == idxPodl && idxPodl > 0)))
|
||||
.ToList();
|
||||
}
|
||||
// fix conteggi
|
||||
totalCount = filtRec.Count;
|
||||
ListRecords = filtRec
|
||||
.Skip(numRecord * (currPage - 1))
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,195 @@
|
||||
<div class="card mb-5">
|
||||
<div class="card-header table-primary">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-0">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-2">
|
||||
<span class="fw-bold fs-5">Elenco istanze KIT di produzione</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="px-0 align-content-center d-flex justify-content-end">
|
||||
|
||||
<div class="input-group me-2" style="min-width: 20rem;">
|
||||
<span class="input-group-text"><i class="fa fa-search"></i></span>
|
||||
<input type="text" class="form-control" placeholder="@($"Cod Commessa | Ctrl-R")" aria-label="Ricerca" title="@($"Ricerca Commessa | Ctrl-R")" @bind="@SearchComm" accesskey="R">
|
||||
<button class="btn @sParentCss" @onclick="() => ResetParent()"><i class="fa fa-ban"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if (EditRecord != null)
|
||||
{
|
||||
|
||||
@* @if (doSearchArt)
|
||||
{
|
||||
<dialog class="modal fade show" tabindex="-1" style="display:block; background-color: rgba(10,10,10,.6);" aria-modal="true" role="dialog">
|
||||
<div class="modal-dialog modal-xl">
|
||||
<div class="modal-content p-2">
|
||||
<div class="modal-title d-flex justify-content-between">
|
||||
<div class="px-0">
|
||||
<h3>Selezione Articoli da ricerca</h3>
|
||||
</div>
|
||||
<div class="px-0">
|
||||
<button class="btn btn-outline-dark" @onclick="() => SearchArtToggle()"><i class="fa-solid fa-xmark"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<SelectCodArt SearchMinChar="@minChar" E_CodArt="SetCodArtChild"></SelectCodArt>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</dialog>
|
||||
}
|
||||
<div class="row mt-2">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-header bg-primary text-light">Modifica</div>
|
||||
<div class="card-body">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-3">
|
||||
<div class="form-floating">
|
||||
@if (string.IsNullOrEmpty(EditRecord.CodArtParent))
|
||||
{
|
||||
<input type="text" class="form-control" placeholder="Cod Parent" @bind="@EditRecord.CodArtParent">
|
||||
}
|
||||
else
|
||||
{
|
||||
<input type="text" class="form-control disabled" disabled placeholder="Cod Parent" @bind="@EditRecord.CodArtParent">
|
||||
}
|
||||
<label>Cod Art Parent</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
@if (string.IsNullOrEmpty(EditRecord.CodArtChild))
|
||||
{
|
||||
<div class="input-group">
|
||||
<button class="btn btn-success" @onclick="() => SearchArtToggle()"><i class="fa-brands fa-searchengin fa-2x"></i></button>
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" placeholder="CodChild" @bind-value="@EditRecord.CodArtChild">
|
||||
<label>Cod Art Child</label>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control disabled" disabled placeholder="CodChild" @bind-value="@EditRecord.CodArtChild">
|
||||
<label>Cod Art Child</label>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<div class="form-floating">
|
||||
<input type="number" class="form-control text-end" placeholder="Qty child/parent" @bind-value="@EditRecord.Qty">
|
||||
<label>Qty rel Art/Kit</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-2 align-content-center">
|
||||
<button class="btn btn-lg btn-warning w-100" @onclick="() => DoCancel()">Annulla <i class="bi bi-x-circle"></i></button>
|
||||
</div>
|
||||
<div class="col-2 align-content-center">
|
||||
@if (EditRecord.Qty > 0 && !string.IsNullOrEmpty(EditRecord.CodArtParent) && !string.IsNullOrEmpty(EditRecord.CodArtChild))
|
||||
{
|
||||
<button class="btn btn-lg btn-success w-100" @onclick="() => DoUpdate(EditRecord)">Salva <i class="bi bi-save"></i></button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button class="btn btn-secondary w-100 disabled">Salva <i class="bi bi-save"></i></button>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> *@
|
||||
}
|
||||
</div>
|
||||
<div class="card-body">
|
||||
|
||||
@if (ListRecords == null)
|
||||
{
|
||||
<LoadingData></LoadingData>
|
||||
}
|
||||
else if (totalCount == 0)
|
||||
{
|
||||
<div class="alert alert-warning text-center display-4">
|
||||
Nessun record trovato
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<table class="table table-sm table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
@if (EditRecord != null)
|
||||
{
|
||||
<button @onclick="() => ResetSel()" class="btn btn-primary btn-sm"><i class="bi bi-arrow-counterclockwise"></i></button>
|
||||
}
|
||||
</th>
|
||||
<th><i class="fa-solid fa-object-group"></i> Kit Istanza</th>
|
||||
<th><i class="fa-solid fa-file-invoice"></i> Cod Ext</th>
|
||||
<th><i class="fa-solid fa-sitemap"></i> Cod Kit (Parent)</th>
|
||||
<th><i class="fa-solid fa-file"></i> Articolo (Child)</th>
|
||||
<th><i class="fa-solid fa-hashtag"></i> Qty Kit</th>
|
||||
<th><i class="fa-solid fa-hashtag"></i> Qty Art</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var record in ListRecords)
|
||||
{
|
||||
<tr class="@checkSelect(record)">
|
||||
<td>
|
||||
<button @onclick="() => SelRecord(record)" class="btn btn-primary btn-sm" title="Seleziona Record"><i class="bi bi-search"></i></button>
|
||||
</td>
|
||||
<td>
|
||||
<div>@record.KeyKit</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>@record.KeyExtOrd</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>@record.CodArtParent</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>@record.CodArtChild</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>@record.QtyKIT</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>@record.QtyART</div>
|
||||
</td>
|
||||
<td>
|
||||
@if (DelEnabled(record))
|
||||
{
|
||||
<button @onclick="() => DoDelete(record)" class="btn btn-danger btn-sm"><i class="bi bi-trash-fill"></i></button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button class="btn btn-secondary disabled btn-sm"><i class="bi bi-trash-fill"></i></button>
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div class="card-footer py-1">
|
||||
@if (totalCount > numRecord)
|
||||
{
|
||||
<DataPager PageSize="numRecord" currPage="currPage" numRecordChanged="SetNumRec" numPageChanged="SetNumPage" totalCount="totalCount" showLoading="isLoading" />
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,534 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using MP.Data.DbModels;
|
||||
using MP.SPEC.Data;
|
||||
|
||||
namespace MP.SPEC.Components
|
||||
{
|
||||
public partial class ScratchPodlKit : ComponentBase, IDisposable
|
||||
{
|
||||
#region Public Methods
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
EditRecord = null;
|
||||
SearchRecords = null;
|
||||
ListRecords = null;
|
||||
GC.Collect();
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected int kitCount = 0;
|
||||
|
||||
protected int totalCount = 0;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected MpDataService MDService { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected NavigationManager NavManager { get; set; } = null!;
|
||||
|
||||
protected string SearchComm
|
||||
{
|
||||
get => sCodComm;
|
||||
set
|
||||
{
|
||||
if (sCodComm != value)
|
||||
{
|
||||
sCodComm = value;
|
||||
currPage = 1;
|
||||
ListRecords = null;
|
||||
ReloadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected string sParentCss
|
||||
{
|
||||
get => string.IsNullOrEmpty(sCodComm) ? "btn-secondary" : "btn-primary";
|
||||
}
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected string checkSelect(IstanzeKitModel currRec)
|
||||
{
|
||||
string answ = "";
|
||||
if (EditRecord != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
answ = (EditRecord.KeyKit == currRec.KeyKit && EditRecord.KeyExtOrd == currRec.KeyExtOrd) ? "table-info" : "";
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
protected bool DelEnabled(IstanzeKitModel reqRec)
|
||||
{
|
||||
bool answ = false;
|
||||
|
||||
return answ;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Verifica eliminabilità del record: se è avviato il PODL non è liminabile...
|
||||
/// </summary>
|
||||
/// <param name="reqRec"></param>
|
||||
/// <returns></returns>
|
||||
protected async Task DoCancel()
|
||||
{
|
||||
EditRecord = null;
|
||||
ReloadData();
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Eliminazione record selezionato (previa conferma)
|
||||
/// </summary>
|
||||
/// <param name="selRec"></param>
|
||||
/// <returns></returns>
|
||||
protected async Task DoDelete(IstanzeKitModel selRec)
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Eliminazione riga Istanza KIT: sei sicuro di voler procedere?"))
|
||||
return;
|
||||
|
||||
await Task.Delay(1);
|
||||
var done = await MDService.IstKitDelete(selRec);
|
||||
EditRecord = null;
|
||||
ReloadData();
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
protected async Task DoUpdate(IstanzeKitModel selRec)
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Confermi di voler salvare le modifiche?"))
|
||||
return;
|
||||
|
||||
await Task.Delay(1);
|
||||
var done = await MDService.IstKitUpsert(selRec);
|
||||
EditRecord = null;
|
||||
ReloadData();
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
private bool OptAdmKitEnabled = false;
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
numRecord = 10;
|
||||
// gestione di base dei KIT
|
||||
string rawVal = MDService.ConfigTryGet("OptAdmKitEnabled");
|
||||
if (!string.IsNullOrEmpty(rawVal))
|
||||
{
|
||||
bool.TryParse(rawVal, out OptAdmKitEnabled);
|
||||
}
|
||||
// conf variabili decodifica
|
||||
regExp_KO = MDService.ConfigTryGet("regExp_KO");
|
||||
regExp_OK = MDService.ConfigTryGet("regExp_OK");
|
||||
regExp_KitStart = MDService.ConfigTryGet("regExp_KitStart");
|
||||
regExp_KitSave = MDService.ConfigTryGet("regExp_KitSave");
|
||||
// altre variabili
|
||||
rawVal = MDService.ConfigTryGet("SPEC_nArtSearch");
|
||||
if (!string.IsNullOrEmpty(rawVal))
|
||||
{
|
||||
int.TryParse(rawVal, out minChar);
|
||||
}
|
||||
}
|
||||
|
||||
#if false
|
||||
protected override void OnAfterRender(bool firstRender)
|
||||
{
|
||||
if (firstRender)
|
||||
{
|
||||
if (OptAdmKitEnabled)
|
||||
{
|
||||
doReset();
|
||||
}
|
||||
}
|
||||
//base.OnAfterRender(firstRender);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
ReloadData();
|
||||
}
|
||||
|
||||
protected void ResetData()
|
||||
{
|
||||
EditRecord = null;
|
||||
}
|
||||
|
||||
protected void ResetParent()
|
||||
{
|
||||
SearchComm = "";
|
||||
ReloadData();
|
||||
}
|
||||
|
||||
protected void ResetSel()
|
||||
{
|
||||
EditRecord = null;
|
||||
}
|
||||
|
||||
protected void SelRecord(IstanzeKitModel selRec)
|
||||
{
|
||||
EditRecord = selRec;
|
||||
}
|
||||
|
||||
protected void SetNumPage(int newNum)
|
||||
{
|
||||
currPage = newNum;
|
||||
}
|
||||
|
||||
protected void SetNumRec(int newNum)
|
||||
{
|
||||
currPage = 1;
|
||||
numRecord = newNum;
|
||||
}
|
||||
|
||||
protected void UpdateData()
|
||||
{
|
||||
EditRecord = null;
|
||||
ReloadData();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
/// <summary>
|
||||
/// Boolear controllo visualizzazione ricerca articoli
|
||||
/// </summary>
|
||||
private bool doSearchArt = false;
|
||||
|
||||
private IstanzeKitModel? EditRecord = null;
|
||||
|
||||
private List<IstanzeKitModel>? ListRecords;
|
||||
|
||||
private int minChar = 2;
|
||||
|
||||
/// <summary>
|
||||
/// RegExp x SAVE KIT
|
||||
/// </summary>
|
||||
private string regExp_KitSave = "#RKE";
|
||||
|
||||
/// <summary>
|
||||
/// RegExp x START KIT
|
||||
/// </summary>
|
||||
private string regExp_KitStart = "#RKS";
|
||||
|
||||
/// <summary>
|
||||
/// RegExp x RESET / CANCEL
|
||||
/// </summary>
|
||||
private string regExp_KO = "#RKO";
|
||||
|
||||
/// <summary>
|
||||
/// RegExp x CONFERMA
|
||||
/// </summary>
|
||||
private string regExp_OK = "#ROK";
|
||||
|
||||
private List<IstanzeKitModel>? SearchRecords;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private int _currPage { get; set; } = 1;
|
||||
|
||||
private int _numRecord { get; set; } = 10;
|
||||
|
||||
private int currPage
|
||||
{
|
||||
get => _currPage;
|
||||
set
|
||||
{
|
||||
if (_currPage != value)
|
||||
{
|
||||
_currPage = value;
|
||||
ReloadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool isLoading { get; set; } = false;
|
||||
|
||||
private int numRecord
|
||||
{
|
||||
get => _numRecord;
|
||||
set
|
||||
{
|
||||
if (_numRecord != value)
|
||||
{
|
||||
_numRecord = value;
|
||||
ReloadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string sCodComm { get; set; } = "";
|
||||
|
||||
private bool ShowCharts { get; set; } = false;
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private void ReloadData()
|
||||
{
|
||||
isLoading = true;
|
||||
SearchRecords = MDService.IstKitFilt("", "");
|
||||
totalCount = SearchRecords.Count;
|
||||
// conto i kit = distinct...
|
||||
kitCount = SearchRecords.GroupBy(x => x.CodArtParent).Count();
|
||||
ListRecords = SearchRecords
|
||||
.Skip(numRecord * (currPage - 1))
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Toggle modale ricerca articoli
|
||||
/// </summary>
|
||||
private void SearchArtToggle()
|
||||
{
|
||||
doSearchArt = !doSearchArt;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Salva selezione articolo
|
||||
/// </summary>
|
||||
/// <param name="codArt"></param>
|
||||
private void SetCodArtChild(string codArt)
|
||||
{
|
||||
if (EditRecord != null)
|
||||
{
|
||||
EditRecord.CodArtChild = codArt;
|
||||
doSearchArt = false;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
|
||||
#if false
|
||||
|
||||
|
||||
public string codKitTemp
|
||||
{
|
||||
get
|
||||
{
|
||||
return memLayer.ML.StringSessionObj(string.Format("codKitTemp_{0}", uid));
|
||||
}
|
||||
set
|
||||
{
|
||||
memLayer.ML.setSessionVal(string.Format("codKitTemp_{0}", uid), value);
|
||||
hlCodKitTemp.Value = value;
|
||||
grViewWSK.DataBind();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ultimo Codice KIT creato
|
||||
/// </summary>
|
||||
public string lastKitMade
|
||||
{
|
||||
get
|
||||
{
|
||||
return memLayer.ML.StringSessionObj("lastKitMade");
|
||||
}
|
||||
set
|
||||
{
|
||||
memLayer.ML.setSessionVal("lastKitMade", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Aggiunge (in obj OrdineKit) l'ordine coi parametri indicati
|
||||
/// </summary>
|
||||
/// <param name="codOrd"></param>
|
||||
/// <param name="codArt"></param>
|
||||
/// <param name="descArt"></param>
|
||||
/// <param name="qta"></param>
|
||||
/// <returns></returns>
|
||||
public bool addOrdArt(string codOrd, string codArt, string descArt, int qta)
|
||||
{
|
||||
bool answ = false;
|
||||
// verifico di avere un codiceKIT
|
||||
checkCodKit();
|
||||
// salvo info x il cod temporaneo...
|
||||
DataLayerObj.taWKS.insertQuery(codKitTemp, codOrd, codArt, descArt, qta);
|
||||
// verifico SE HO un KIT riconosciuto e quindi un CodArt di KIT valido...
|
||||
string currCodArtKit = "###";
|
||||
var TksTab = DataLayerObj.taTKS.GetData(codKitTemp, 1);
|
||||
bool showPODL = false;
|
||||
if (TksTab.Rows.Count > 0)
|
||||
{
|
||||
// verifico se ho aderenza 100%...
|
||||
if (TksTab[0].TotalScore == 1)
|
||||
{
|
||||
currCodArtKit = TksTab[0].CodArtParent;
|
||||
showPODL = true;
|
||||
}
|
||||
}
|
||||
hfCodArtKit.Value = currCodArtKit;
|
||||
divPODL.Visible = showPODL;
|
||||
answ = true;
|
||||
grViewWSK.DataBind();
|
||||
grViewKitSel.DataBind();
|
||||
grViewPODL.DataBind();
|
||||
grViewIstanzeKIT.DataBind();
|
||||
return answ;
|
||||
}
|
||||
|
||||
|
||||
private void doReset()
|
||||
{
|
||||
// elimino eventuali record ODL
|
||||
DataLayerObj.taWKS.deleteQuery(codKitTemp);
|
||||
codKitTemp = "";
|
||||
divPODL.Visible = false;
|
||||
checkCodKit();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ultimo input registrato
|
||||
/// </summary>
|
||||
public string lastInput
|
||||
{
|
||||
get
|
||||
{
|
||||
return hlLastInput.Value;
|
||||
}
|
||||
set
|
||||
{
|
||||
hlLastInput.Value = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Aggiorno controllo secondo ULTIMO input
|
||||
/// </summary>
|
||||
public void doUpdate()
|
||||
{
|
||||
// aggiorno label...
|
||||
messOut = "";
|
||||
// controllo input (reset/inizio o salva...)
|
||||
if (lastInput == regExp_KO)
|
||||
{
|
||||
// resetto dati
|
||||
doReset();
|
||||
messOut = "Effettuato reset!";
|
||||
}
|
||||
else if (lastInput == regExp_KitStart)
|
||||
{
|
||||
// resetto dati
|
||||
doReset();
|
||||
messOut = "Inizio configurazione KIT";
|
||||
}
|
||||
else if (lastInput == regExp_KitSave)
|
||||
{
|
||||
// controllo SE HO un kit selezionato...
|
||||
string currCodArtKit = "###";
|
||||
var TksTab = DataLayerObj.taTKS.GetData(codKitTemp, 1);
|
||||
bool showPODL = false;
|
||||
if (TksTab.Rows.Count > 0)
|
||||
{
|
||||
// verifico se ho aderenza 100%...
|
||||
if (TksTab[0].TotalScore == 1)
|
||||
{
|
||||
currCodArtKit = TksTab[0].CodArtParent;
|
||||
showPODL = true;
|
||||
}
|
||||
}
|
||||
if (showPODL)
|
||||
{
|
||||
// in questo caso creo istanza!
|
||||
creazioneIstanzaKit(currCodArtKit);
|
||||
}
|
||||
}
|
||||
else if (lastInput == regExp_OK)
|
||||
{
|
||||
}
|
||||
// ennesimo check cod TEMP
|
||||
checkCodKit();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifico SE HO un codKit Temporaneo sennò lo creo...
|
||||
/// </summary>
|
||||
private void checkCodKit()
|
||||
{
|
||||
if (codKitTemp == "")
|
||||
{
|
||||
// genero un NUOVO cod temp kit...
|
||||
codKitTemp = string.Format("KIT_{0:yyMMdd_HHmmss}", DateTime.Now);
|
||||
}
|
||||
}
|
||||
|
||||
public string messOut
|
||||
{
|
||||
set
|
||||
{
|
||||
lblOut.Text = value;
|
||||
}
|
||||
get
|
||||
{
|
||||
return lblOut.Text;
|
||||
}
|
||||
}
|
||||
|
||||
protected void grViewKitSel_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
// se ho selezionato recupero CHIAVE = CodArticolo del KIT
|
||||
string CodArtParent = grViewKitSel.SelectedValue.ToString();
|
||||
// crea KIT x quel CodArtParent...
|
||||
creazioneIstanzaKit(CodArtParent);
|
||||
}
|
||||
/// <summary>
|
||||
/// Crea una NUOVA istanza KIT
|
||||
/// </summary>
|
||||
/// <param name="CodArtParent">CodArt dell'Assieme/KIT</param>
|
||||
private void creazioneIstanzaKit(string CodArtParent)
|
||||
{
|
||||
// calcolo NUOVO codice kit...
|
||||
var tabKey = DataLayerObj.taIstK.getNewKey();
|
||||
if (tabKey.Rows.Count == 1)
|
||||
{
|
||||
// stacco un NUOVO codice KIT
|
||||
lastKitMade = tabKey[0].KeyKit;
|
||||
// inserisco ISTANZA KIT!
|
||||
DataLayerObj.taIstK.insertByWKS(lastKitMade, CodArtParent, codKitTemp);
|
||||
// faccio reset valori WKS...
|
||||
doReset();
|
||||
// ora resetto ordine caricato...
|
||||
messOut = string.Format("Creato NUOVA P.ODL cod {0} per il KIT {1}", lastKitMade, CodArtParent);
|
||||
// sollevo evento x impostare lettura KIT a BARCODE (x conferma successiva...)
|
||||
// sollevo evento nuovo valore...
|
||||
if (eh_selKit != null)
|
||||
{
|
||||
eh_selKit(this, new EventArgs());
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
+361
-195
@@ -1,4 +1,5 @@
|
||||
using EgwCoreLib.Utils;
|
||||
using DnsClient.Protocol;
|
||||
using EgwCoreLib.Utils;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Options;
|
||||
using MP.Core.Conf;
|
||||
@@ -138,6 +139,22 @@ namespace MP.SPEC.Data
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stacca un nuovo counter x il tipo richiesto
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public AnagCountersModel AnagCountersGetNext(string cntType)
|
||||
{
|
||||
AnagCountersModel result = new AnagCountersModel();
|
||||
string source = "DB";
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
result = dbController.AnagCountersGetNext(cntType);
|
||||
sw.Stop();
|
||||
Log.Debug($"AnagCountersGetNext | {source} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco Gruppi
|
||||
/// </summary>
|
||||
@@ -402,6 +419,39 @@ namespace MP.SPEC.Data
|
||||
return mongoController.CalcRecipe(currRecipe);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupero tab config in modalità Sincrona
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<ConfigModel> ConfigGetAll()
|
||||
{
|
||||
string currMode = "REDIS";
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
List<ConfigModel>? result = new List<ConfigModel>();
|
||||
// cerco in redis...
|
||||
RedisValue rawData = redisDb.StringGet(Utils.redisConfKey);
|
||||
if (!string.IsNullOrEmpty($"{rawData}"))
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<ConfigModel>>($"{rawData}");
|
||||
}
|
||||
else
|
||||
{
|
||||
currMode = "DB";
|
||||
result = dbController.ConfigGetAll();
|
||||
// serializzo e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
redisDb.StringSet(Utils.redisConfKey, rawData, getRandTOut(redisLongTimeCache));
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new List<ConfigModel>();
|
||||
}
|
||||
stopWatch.Stop();
|
||||
Log.Debug($"ConfigGetAll Read from {currMode}: {stopWatch.Elapsed.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupero tab config in modalità Asincrona
|
||||
/// </summary>
|
||||
@@ -437,39 +487,6 @@ namespace MP.SPEC.Data
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupero tab config in modalità Sincrona
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<ConfigModel> ConfigGetAll()
|
||||
{
|
||||
string currMode = "REDIS";
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
List<ConfigModel>? result = new List<ConfigModel>();
|
||||
// cerco in redis...
|
||||
RedisValue rawData = redisDb.StringGet(Utils.redisConfKey);
|
||||
if (!string.IsNullOrEmpty($"{rawData}"))
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<ConfigModel>>($"{rawData}");
|
||||
}
|
||||
else
|
||||
{
|
||||
currMode = "DB";
|
||||
result = dbController.ConfigGetAll();
|
||||
// serializzo e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
redisDb.StringSet(Utils.redisConfKey, rawData, getRandTOut(redisLongTimeCache));
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new List<ConfigModel>();
|
||||
}
|
||||
stopWatch.Stop();
|
||||
Log.Debug($"ConfigGetAll Read from {currMode}: {stopWatch.Elapsed.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reset dati cache config
|
||||
/// </summary>
|
||||
@@ -488,7 +505,7 @@ namespace MP.SPEC.Data
|
||||
{
|
||||
string answ = "";
|
||||
// preselezione valori
|
||||
if(configData==null || configData.Count==0)
|
||||
if (configData == null || configData.Count == 0)
|
||||
{
|
||||
configData = ConfigGetAll();
|
||||
}
|
||||
@@ -537,11 +554,6 @@ namespace MP.SPEC.Data
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Cache dati config
|
||||
/// </summary>
|
||||
private List<ConfigModel> configData { get; set; } = new List<ConfigModel>();
|
||||
|
||||
/// <summary>
|
||||
/// Update chiave config
|
||||
/// </summary>
|
||||
@@ -752,6 +764,58 @@ namespace MP.SPEC.Data
|
||||
return await dbController.EvListInsert(newRec);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Esegue flush memoria redis dato keyVal
|
||||
/// </summary>
|
||||
/// <param name="pattern"></param>
|
||||
/// <returns></returns>
|
||||
public bool ExecFlushRedisPattern(string pattern)
|
||||
{
|
||||
bool answ = false;
|
||||
var listEndpoints = redisConnAdmin.GetEndPoints();
|
||||
foreach (var endPoint in listEndpoints)
|
||||
{
|
||||
//var server = redisConnAdmin.GetServer(listEndpoints[0]);
|
||||
var server = redisConnAdmin.GetServer(endPoint);
|
||||
if (server != null)
|
||||
{
|
||||
var keyList = server.Keys(redisDb.Database, pattern);
|
||||
foreach (var item in keyList)
|
||||
{
|
||||
redisDb.KeyDelete(item);
|
||||
}
|
||||
answ = true;
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Esegue flush memoria redis dato keyVal, async
|
||||
/// </summary>
|
||||
/// <param name="pattern"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> ExecFlushRedisPatternAsync(RedisValue pattern)
|
||||
{
|
||||
bool answ = false;
|
||||
var listEndpoints = redisConnAdmin.GetEndPoints();
|
||||
foreach (var endPoint in listEndpoints)
|
||||
{
|
||||
var server = redisConnAdmin.GetServer(endPoint);
|
||||
if (server != null)
|
||||
{
|
||||
var keyList = server.Keys(redisDb.Database, pattern);
|
||||
foreach (var item in keyList)
|
||||
{
|
||||
await redisDb.KeyDeleteAsync(item);
|
||||
}
|
||||
answ = true;
|
||||
}
|
||||
}
|
||||
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Imposta in redis la scadenza della pagina x il reload
|
||||
/// </summary>
|
||||
@@ -792,6 +856,20 @@ namespace MP.SPEC.Data
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Flush cache relativa a MP-IO x dati ODL
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> FlushMpIoOdlCache()
|
||||
{
|
||||
// svuoto dalla cache REDIS del server IO...
|
||||
bool ok01 = await ResetIoCache("CurrODL");
|
||||
bool ok02 = await ResetIoCache("CurrOdlRow");
|
||||
bool ok03 = await ResetIoCache("CurrStatoMacc");
|
||||
bool ok04 = await ResetIoCache("DtMac");
|
||||
return ok01 && ok02 && ok03 && ok04;
|
||||
}
|
||||
|
||||
public async Task<bool> FlushRedisCache()
|
||||
{
|
||||
await Task.Delay(1);
|
||||
@@ -1002,6 +1080,72 @@ namespace MP.SPEC.Data
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elimina record + svuotamento cache
|
||||
/// </summary>
|
||||
/// <param name="currRecord"></param>
|
||||
public async Task<bool> IstKitDelete(IstanzeKitModel currRecord)
|
||||
{
|
||||
bool fatto = false;
|
||||
// salvo
|
||||
fatto = dbController.IstKitDelete(currRecord);
|
||||
// svuoto cache
|
||||
RedisValue pattern = $"{Utils.redisKitInst}:*";
|
||||
await ExecFlushRedisPatternAsync(pattern);
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco Istanze KIT da ricerca
|
||||
/// </summary>
|
||||
/// <param name="keyKit"></param>
|
||||
/// <param name="keyExtOrd"></param>
|
||||
/// <returns></returns>
|
||||
public List<IstanzeKitModel> IstKitFilt(string keyKit, string keyExtOrd)
|
||||
{
|
||||
string source = "DB";
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
List<IstanzeKitModel>? result = new List<IstanzeKitModel>();
|
||||
// cerco in redis...
|
||||
string currKey = $"{Utils.redisKitInst}:{keyKit}:{keyExtOrd}";
|
||||
RedisValue rawData = redisDb.StringGet(currKey);
|
||||
if (rawData.HasValue)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<IstanzeKitModel>>($"{rawData}");
|
||||
source = "REDIS";
|
||||
}
|
||||
else
|
||||
{
|
||||
result = dbController.IstKitFilt(keyKit, keyExtOrd);
|
||||
// serializzo e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
redisDb.StringSet(currKey, rawData, TimeSpan.FromMinutes(redisLongTimeCache));
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new List<IstanzeKitModel>();
|
||||
}
|
||||
sw.Stop();
|
||||
Log.Debug($"IstKitFilt | {source} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Esegue salvataggio record + svuotamento cache
|
||||
/// </summary>
|
||||
/// <param name="currRecord"></param>
|
||||
public async Task<bool> IstKitUpsert(IstanzeKitModel currRecord)
|
||||
{
|
||||
bool fatto = false;
|
||||
// salvo
|
||||
fatto = dbController.IstKitUpsert(currRecord);
|
||||
// svuoto cache
|
||||
RedisValue pattern = $"{Utils.redisKitInst}:*";
|
||||
await ExecFlushRedisPatternAsync(pattern);
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
/// <param name="IdxOdl">id odl da cercare</param>
|
||||
@@ -1214,6 +1358,7 @@ namespace MP.SPEC.Data
|
||||
Log.Debug($"MachIobConf per {IdxMacchina} | {source} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupero singolo recordo info Machine-IOB x TAB (da info registrate IOB-WIN --> MP-IO)
|
||||
/// </summary>
|
||||
@@ -1779,58 +1924,6 @@ namespace MP.SPEC.Data
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Esegue flush memoria redis dato keyVal
|
||||
/// </summary>
|
||||
/// <param name="pattern"></param>
|
||||
/// <returns></returns>
|
||||
public bool ExecFlushRedisPattern(string pattern)
|
||||
{
|
||||
bool answ = false;
|
||||
var listEndpoints = redisConnAdmin.GetEndPoints();
|
||||
foreach (var endPoint in listEndpoints)
|
||||
{
|
||||
//var server = redisConnAdmin.GetServer(listEndpoints[0]);
|
||||
var server = redisConnAdmin.GetServer(endPoint);
|
||||
if (server != null)
|
||||
{
|
||||
var keyList = server.Keys(redisDb.Database, pattern);
|
||||
foreach (var item in keyList)
|
||||
{
|
||||
redisDb.KeyDelete(item);
|
||||
}
|
||||
answ = true;
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Esegue flush memoria redis dato keyVal, async
|
||||
/// </summary>
|
||||
/// <param name="pattern"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> ExecFlushRedisPatternAsync(RedisValue pattern)
|
||||
{
|
||||
bool answ = false;
|
||||
var listEndpoints = redisConnAdmin.GetEndPoints();
|
||||
foreach (var endPoint in listEndpoints)
|
||||
{
|
||||
var server = redisConnAdmin.GetServer(endPoint);
|
||||
if (server != null)
|
||||
{
|
||||
var keyList = server.Keys(redisDb.Database, pattern);
|
||||
foreach (var item in keyList)
|
||||
{
|
||||
await redisDb.KeyDeleteAsync(item);
|
||||
}
|
||||
answ = true;
|
||||
}
|
||||
}
|
||||
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reset della cache IO post operazioni come setup ODL...
|
||||
/// </summary>
|
||||
@@ -1844,25 +1937,10 @@ namespace MP.SPEC.Data
|
||||
{
|
||||
pattern = new RedisValue($"{MpIoNS}:{baseMem}:*");
|
||||
}
|
||||
bool answ = await ExecFlushRedisPattern(pattern);
|
||||
bool answ = await ExecFlushRedisPatternAsync(pattern);
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Flush cache relativa a MP-IO x dati ODL
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> FlushMpIoOdlCache()
|
||||
{
|
||||
// svuoto dalla cache REDIS del server IO...
|
||||
bool ok01 = await ResetIoCache("CurrODL");
|
||||
bool ok02 = await ResetIoCache("CurrOdlRow");
|
||||
bool ok03 = await ResetIoCache("CurrStatoMacc");
|
||||
bool ok04 = await ResetIoCache("DtMac");
|
||||
return ok01 && ok02 && ok03 && ok04;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Statistiche ODL calcolate (da stored stp_STAT_ODL)
|
||||
/// </summary>
|
||||
@@ -1898,6 +1976,72 @@ namespace MP.SPEC.Data
|
||||
return Task.FromResult(currTagConf);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elimina record + svuotamento cache
|
||||
/// </summary>
|
||||
/// <param name="currRecord"></param>
|
||||
public async Task<bool> TemplateKitDelete(TemplateKitModel currRecord)
|
||||
{
|
||||
bool fatto = false;
|
||||
// salvo
|
||||
fatto = dbController.TemplateKitDelete(currRecord);
|
||||
// svuoto cache
|
||||
RedisValue pattern = $"{Utils.redisKitTempl}:*";
|
||||
await ExecFlushRedisPatternAsync(pattern);
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco Template KIT da ricerca
|
||||
/// </summary>
|
||||
/// <param name="codParent"></param>
|
||||
/// <param name="codChild"></param>
|
||||
/// <returns></returns>
|
||||
public List<TemplateKitModel> TemplateKitFilt(string codParent, string codChild)
|
||||
{
|
||||
string source = "DB";
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
List<TemplateKitModel>? result = new List<TemplateKitModel>();
|
||||
// cerco in redis...
|
||||
string currKey = $"{Utils.redisKitTempl}:{codParent}:{codChild}";
|
||||
RedisValue rawData = redisDb.StringGet(currKey);
|
||||
if (rawData.HasValue)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<TemplateKitModel>>($"{rawData}");
|
||||
source = "REDIS";
|
||||
}
|
||||
else
|
||||
{
|
||||
result = dbController.TemplateKitFilt(codParent, codChild);
|
||||
// serializzo e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
redisDb.StringSet(currKey, rawData, TimeSpan.FromMinutes(redisLongTimeCache));
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new List<TemplateKitModel>();
|
||||
}
|
||||
sw.Stop();
|
||||
Log.Debug($"TemplateKitFilt | {source} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Esegue salvataggio record + svuotamento cache
|
||||
/// </summary>
|
||||
/// <param name="currRecord"></param>
|
||||
public async Task<bool> TemplateKitUpsert(TemplateKitModel currRecord)
|
||||
{
|
||||
bool fatto = false;
|
||||
// salvo
|
||||
fatto = dbController.TemplateKitUpsert(currRecord);
|
||||
// svuoto cache
|
||||
RedisValue pattern = $"{Utils.redisKitTempl}:*";
|
||||
await ExecFlushRedisPatternAsync(pattern);
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Esegue traduzione dato vocabolario da Lingua + Lemma
|
||||
/// </summary>
|
||||
@@ -1961,91 +2105,6 @@ namespace MP.SPEC.Data
|
||||
return answ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Elimina record + svuotamento cache
|
||||
/// </summary>
|
||||
/// <param name="currRecord"></param>
|
||||
public async Task<bool> TemplateKitDelete(TemplateKitModel currRecord)
|
||||
{
|
||||
bool fatto = false;
|
||||
// salvo
|
||||
fatto = dbController.TemplateKitDelete(currRecord);
|
||||
// svuoto cache
|
||||
RedisValue pattern = $"{Utils.redisKitTempl}:*";
|
||||
await ExecFlushRedisPatternAsync(pattern);
|
||||
return fatto;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Stacca un nuovo counter x il tipo richiesto
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public AnagCountersModel AnagCountersGetNext(string cntType)
|
||||
{
|
||||
AnagCountersModel result = new AnagCountersModel();
|
||||
string source = "DB";
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
result = dbController.AnagCountersGetNext(cntType);
|
||||
sw.Stop();
|
||||
Log.Debug($"AnagCountersGetNext | {source} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco template da ricerca
|
||||
/// </summary>
|
||||
/// <param name="codParent"></param>
|
||||
/// <param name="codChild"></param>
|
||||
/// <returns></returns>
|
||||
public List<TemplateKitModel> TemplateKitFilt(string codParent, string codChild)
|
||||
{
|
||||
string source = "DB";
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
List<TemplateKitModel>? result = new List<TemplateKitModel>();
|
||||
// cerco in redis...
|
||||
string currKey = $"{Utils.redisKitTempl}:{codParent}:{codChild}";
|
||||
RedisValue rawData = redisDb.StringGet(currKey);
|
||||
if (rawData.HasValue)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<TemplateKitModel>>($"{rawData}");
|
||||
source = "REDIS";
|
||||
}
|
||||
else
|
||||
{
|
||||
result = dbController.TemplateKitFilt(codParent, codChild);
|
||||
// serializzo e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
redisDb.StringSet(currKey, rawData, TimeSpan.FromMinutes(redisLongTimeCache));
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new List<TemplateKitModel>();
|
||||
}
|
||||
sw.Stop();
|
||||
Log.Debug($"TemplateKitFilt | {source} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Esegue salvataggio record + svuotamento cache
|
||||
/// </summary>
|
||||
/// <param name="currRecord"></param>
|
||||
public async Task<bool> TemplateKitUpsert(TemplateKitModel currRecord)
|
||||
{
|
||||
bool fatto = false;
|
||||
// salvo
|
||||
fatto = dbController.TemplateKitUpsert(currRecord);
|
||||
// svuoto cache
|
||||
RedisValue pattern = $"{Utils.redisKitTempl}:*";
|
||||
await ExecFlushRedisPatternAsync(pattern);
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco completo tabella Vocabolario
|
||||
/// </summary>
|
||||
@@ -2080,6 +2139,101 @@ namespace MP.SPEC.Data
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elimina record + svuotamento cache
|
||||
/// </summary>
|
||||
/// <param name="currRecord"></param>
|
||||
public bool WipKitDelete(WipSetupKitModel currRecord)
|
||||
{
|
||||
bool fatto = false;
|
||||
// salvo
|
||||
fatto = dbController.WipKitDelete(currRecord);
|
||||
// svuoto cache
|
||||
RedisValue pattern = $"{Utils.redisKitWip}:*";
|
||||
ExecFlushRedisPattern(pattern);
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elimina i record associati al KeyFilt indicato
|
||||
/// </summary>
|
||||
/// <param name="KeyFilt"></param>
|
||||
public bool WipKitDeleteGroup(string KeyFilt)
|
||||
{
|
||||
bool fatto = false;
|
||||
// salvo
|
||||
fatto = dbController.WipKitDeleteGroup(KeyFilt);
|
||||
// svuoto cache
|
||||
RedisValue pattern = $"{Utils.redisKitWip}:*";
|
||||
ExecFlushRedisPattern(pattern);
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elimina i record più vecchi della data-ora indicata
|
||||
/// </summary>
|
||||
/// <param name="DateLimit"></param>
|
||||
public bool WipKitDeleteOlder(DateTime DateLimit)
|
||||
{
|
||||
bool fatto = false;
|
||||
// salvo
|
||||
fatto = dbController.WipKitDeleteOlder(DateLimit);
|
||||
// svuoto cache
|
||||
RedisValue pattern = $"{Utils.redisKitWip}:*";
|
||||
ExecFlushRedisPattern(pattern);
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco Template KIT da ricerca
|
||||
/// </summary>
|
||||
/// <param name="KeyFilt"></param>
|
||||
/// <returns></returns>
|
||||
public List<WipSetupKitModel> WipKitFilt(string KeyFilt)
|
||||
{
|
||||
string source = "DB";
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
List<WipSetupKitModel>? result = new List<WipSetupKitModel>();
|
||||
// cerco in redis...
|
||||
string currKey = $"{Utils.redisKitWip}:{KeyFilt}";
|
||||
RedisValue rawData = redisDb.StringGet(currKey);
|
||||
if (rawData.HasValue)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<WipSetupKitModel>>($"{rawData}");
|
||||
source = "REDIS";
|
||||
}
|
||||
else
|
||||
{
|
||||
result = dbController.WipKitFilt(KeyFilt);
|
||||
// serializzo e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
redisDb.StringSet(currKey, rawData, TimeSpan.FromMinutes(redisLongTimeCache));
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new List<WipSetupKitModel>();
|
||||
}
|
||||
sw.Stop();
|
||||
Log.Debug($"WipKitFilt | {source} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Esegue salvataggio record + svuotamento cache
|
||||
/// </summary>
|
||||
/// <param name="currRecord"></param>
|
||||
public bool WipKitUpsert(WipSetupKitModel currRecord)
|
||||
{
|
||||
bool fatto = false;
|
||||
// salvo
|
||||
fatto = dbController.WipKitUpsert(currRecord);
|
||||
// svuoto cache
|
||||
RedisValue pattern = $"{Utils.redisKitWip}:*";
|
||||
ExecFlushRedisPattern(pattern);
|
||||
return fatto;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Fields
|
||||
@@ -2174,8 +2328,11 @@ namespace MP.SPEC.Data
|
||||
#region Private Fields
|
||||
|
||||
private static IConfiguration _configuration = null!;
|
||||
|
||||
private static ILogger<MpDataService> _logger = null!;
|
||||
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
private string MpIoNS = "";
|
||||
|
||||
/// <summary>
|
||||
@@ -2204,6 +2361,15 @@ namespace MP.SPEC.Data
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
/// <summary>
|
||||
/// Cache dati config
|
||||
/// </summary>
|
||||
private List<ConfigModel> configData { get; set; } = new List<ConfigModel>();
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
@@ -2211,7 +2377,7 @@ namespace MP.SPEC.Data
|
||||
/// </summary>
|
||||
/// <param name="pattern"></param>
|
||||
/// <returns></returns>
|
||||
private async Task<bool> ExecFlushRedisPattern(RedisValue pattern)
|
||||
private bool ExecFlushRedisPattern(RedisValue pattern)
|
||||
{
|
||||
bool answ = false;
|
||||
var listEndpoints = redisConn.GetEndPoints();
|
||||
@@ -2224,7 +2390,7 @@ namespace MP.SPEC.Data
|
||||
var keyList = server.Keys(redisDb.Database, pattern);
|
||||
foreach (var item in keyList)
|
||||
{
|
||||
await redisDb.KeyDeleteAsync(item);
|
||||
redisDb.KeyDelete(item);
|
||||
}
|
||||
answ = true;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<RootNamespace>MP.SPEC</RootNamespace>
|
||||
<Version>6.16.2504.1007</Version>
|
||||
<Version>6.16.2504.1019</Version>
|
||||
<UserSecretsId>1800a78a-6ff1-40f9-b490-87fb8bfc1394</UserSecretsId>
|
||||
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -167,6 +167,10 @@
|
||||
{
|
||||
<button @onclick="() => deleteRecord(record)" class="btn btn-danger btn-sm"><i class="bi bi-trash-fill"></i></button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button class="btn btn-secondary disabled btn-sm"><i class="bi bi-trash-fill"></i></button>
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
@@ -177,6 +181,9 @@
|
||||
}
|
||||
</div>
|
||||
<div class="card-footer py-1">
|
||||
@if (totalCount > numRecord)
|
||||
{
|
||||
<DataPager PageSize="numRecord" currPage="currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="totalCount" showLoading="isLoading" />
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,84 @@
|
||||
@page "/force-reset"
|
||||
@using MP.SPEC.Data
|
||||
|
||||
<div class="d-flex justify-content-around">
|
||||
<div class="col-12 col-md-10 col-lg-8 col-xl-6 ">
|
||||
|
||||
<div class="card shadow mt-5">
|
||||
<div class="card-header">
|
||||
<img class="img-fluid" src="./images/LogoMapoFull.png" />
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<ProgressDisplay RefreshInterval="50" Title="@title" MaxVal="100" CurrVal="@currVal" NextVal="@nextVal" ExpTimeMSec="@expTimeMsec" DisplaySize="ProgressDisplay.ModalSize.Medium"></ProgressDisplay>
|
||||
<LoadingData DisplaySize="LoadingData.CtrlSize.Large" Title="Cleaning Up cache..." DisplayMode="LoadingData.SpinMode.Growl"></LoadingData>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@code {
|
||||
|
||||
[Inject]
|
||||
protected NavigationManager NavMan { get; set; } = null!;
|
||||
[Inject]
|
||||
protected MsgServiceSpec MsgServ { get; set; } = null!;
|
||||
[Inject]
|
||||
protected MpDataService MDService { get; set; } = null!;
|
||||
|
||||
private int currVal = 0;
|
||||
private int nextVal = 0;
|
||||
private int expTimeMsec = 10;
|
||||
private int bDelay = 150;
|
||||
private string title = "...";
|
||||
/// <summary>
|
||||
/// Esecuzione task di reset...
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
title = "Reset and Reload Data";
|
||||
currVal = 0;
|
||||
nextVal = 10;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
await Task.Delay(bDelay);
|
||||
// title = "Clearing Local Browser Data";
|
||||
// currVal = 10;
|
||||
// nextVal = 30;loca
|
||||
// await InvokeAsync(StateHasChanged);
|
||||
// await MsgServ.ClearLocalStor();
|
||||
// await Task.Delay(bDelay);
|
||||
// title = "Clearing Session Browser Data";
|
||||
// currVal = 30;
|
||||
// nextVal = 50;
|
||||
// await InvokeAsync(StateHasChanged);
|
||||
// await MsgServ.ClearSessionStor();
|
||||
// await Task.Delay(bDelay);
|
||||
// title = "Final Cache cleanup...";
|
||||
// currVal = 50;
|
||||
// nextVal = 80;
|
||||
// MsgServ.RigaOper = null;
|
||||
// MsgServ.LastIdxMacchina = "";
|
||||
// await InvokeAsync(StateHasChanged);
|
||||
// await Task.Delay(2 * bDelay);
|
||||
// // attendo
|
||||
// title = "Reload!";
|
||||
// currVal = 80;
|
||||
// nextVal = 100;
|
||||
// await InvokeAsync(StateHasChanged);
|
||||
// // rimando alla home...
|
||||
// await Task.Delay(bDelay);
|
||||
// NavMan.NavigateTo("Index", true);
|
||||
|
||||
|
||||
await Task.Delay(bDelay);
|
||||
await MDService.FlushRedisCache();
|
||||
title = "Reload!";
|
||||
currVal = 80;
|
||||
nextVal = 100;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
await Task.Delay(bDelay);
|
||||
// rimando a pagina corrente
|
||||
NavMan.NavigateTo("Index", true);
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,7 @@ namespace MP.SPEC.Pages
|
||||
await MDService.ConfigResetCache();
|
||||
giacenzeConf = await MDService.ConfigTryGetAsync("SPEC_ShowGiacenze");
|
||||
await Task.Delay(1);
|
||||
padCodXdl = await MDService.ConfigTryGetAsync("padCodXdl");
|
||||
padCodXdl = await MDService.ConfigTryGetAsync("PadCodXdl");
|
||||
var uri = NavManager.ToAbsoluteUri(NavManager.Uri);
|
||||
if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("IdxOdl", out var _idxOdl))
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
@page "/"
|
||||
@page "/Index"
|
||||
|
||||
<PageTitle>Index</PageTitle>
|
||||
|
||||
|
||||
@@ -7,9 +7,7 @@
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-2">
|
||||
<span class="fs-3 mb-0">KIT</span>
|
||||
<small class="small">Definizione KIT multiprodotto per singolo ciclo</small>
|
||||
</div>
|
||||
<div class="px-2">
|
||||
<small class="small">Definizione KIT multiprodotto per singolo ciclo | <b>@kitCount</b> Kit disp.</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -27,7 +25,7 @@
|
||||
</div>
|
||||
<div class="input-group" style="min-width: 20rem;">
|
||||
<span class="input-group-text"><i class="fa fa-search"></i></span>
|
||||
<input type="text" class="form-control" placeholder="@($"Child {minChar}+ | Ctrl-R")" aria-label="Ricerca" title="@($"Ricerca Child | {minChar}+ | Ctrl-R")" @bind="@SearchChild" accesskey="R">
|
||||
<input type="text" class="form-control" placeholder="@($"Child {minChar}+ | Ctrl-R")" aria-label="Ricerca" title="@($"Ricerca Child | {minChar}+ | Ctrl-T")" @bind="@SearchChild" accesskey="T">
|
||||
<button class="btn @sChildCss" @onclick="() => ResetChild()"><i class="fa fa-ban"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+27
-48
@@ -10,28 +10,9 @@ namespace MP.SPEC.Pages
|
||||
{
|
||||
#region Public Methods
|
||||
|
||||
public string checkSelect(TemplateKitModel currRec)
|
||||
{
|
||||
string answ = "";
|
||||
#if false
|
||||
if (currRecord != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
answ = (currRecord.CodArticolo == CodArticolo) ? "table-info" : "";
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
#endif
|
||||
return answ;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
EditRecord = null;
|
||||
ListTipoArt = null;
|
||||
ListAziende = null;
|
||||
SearchRecords = null;
|
||||
ListRecords = null;
|
||||
GC.Collect();
|
||||
@@ -39,6 +20,14 @@ namespace MP.SPEC.Pages
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected int kitCount = 0;
|
||||
|
||||
protected int totalCount = 0;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
@@ -67,15 +56,6 @@ namespace MP.SPEC.Pages
|
||||
{
|
||||
sCodChild = value;
|
||||
currPage = 1;
|
||||
#if false
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
ListRecords = null;
|
||||
await Task.Delay(1);
|
||||
await ReloadData();
|
||||
});
|
||||
pUpd.Wait();
|
||||
#endif
|
||||
ListRecords = null;
|
||||
ReloadData();
|
||||
}
|
||||
@@ -107,23 +87,25 @@ namespace MP.SPEC.Pages
|
||||
get => string.IsNullOrEmpty(sCodParent) ? "btn-secondary" : "btn-primary";
|
||||
}
|
||||
|
||||
protected int totalCount
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = 0;
|
||||
if (SearchRecords != null)
|
||||
{
|
||||
answ = SearchRecords.Count;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected string checkSelect(TemplateKitModel currRec)
|
||||
{
|
||||
string answ = "";
|
||||
if (EditRecord != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
answ = (EditRecord.CodArtParent == currRec.CodArtParent && EditRecord.CodArtChild == currRec.CodArtChild) ? "table-info" : "";
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Crea nuovo record e va in editing...
|
||||
/// </summary>
|
||||
@@ -204,7 +186,7 @@ namespace MP.SPEC.Pages
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
numRecord = 10;
|
||||
string rawVal = MDService.ConfigTryGet("SPEC_nArtSearch");
|
||||
@@ -222,8 +204,6 @@ namespace MP.SPEC.Pages
|
||||
{
|
||||
bool.TryParse(rawVal, out enabKitSearch);
|
||||
}
|
||||
ListAziende = await MDService.ElencoAziende();
|
||||
ListTipoArt = await MDService.AnagTipoArtLV();
|
||||
}
|
||||
|
||||
protected override void OnParametersSet()
|
||||
@@ -290,12 +270,8 @@ namespace MP.SPEC.Pages
|
||||
|
||||
private bool enabKitSearch = false;
|
||||
|
||||
private List<AnagGruppi>? ListAziende;
|
||||
|
||||
private List<TemplateKitModel>? ListRecords;
|
||||
|
||||
private List<ListValues>? ListTipoArt;
|
||||
|
||||
private int minChar = 2;
|
||||
|
||||
private string sCodChild = "";
|
||||
@@ -350,6 +326,9 @@ namespace MP.SPEC.Pages
|
||||
{
|
||||
isLoading = true;
|
||||
SearchRecords = MDService.TemplateKitFilt(SearchParent, SearchChild);
|
||||
totalCount = SearchRecords.Count;
|
||||
// conto i kit = distinct...
|
||||
kitCount = SearchRecords.GroupBy(x => x.CodArtParent).Count();
|
||||
ListRecords = SearchRecords
|
||||
.Skip(numRecord * (currPage - 1))
|
||||
.Take(numRecord)
|
||||
|
||||
@@ -112,7 +112,7 @@ namespace MP.SPEC.Pages
|
||||
}
|
||||
ListStati = await MDService.AnagStatiComm();
|
||||
ListMacchine = await MDService.MacchineGetFilt(selReparto);
|
||||
padCodXdl = await MDService.ConfigTryGetAsync("padCodXdl");
|
||||
padCodXdl = await MDService.ConfigTryGetAsync("PadCodXdl");
|
||||
}
|
||||
|
||||
protected async Task pgResetReq(bool doReset)
|
||||
|
||||
@@ -294,6 +294,9 @@
|
||||
}
|
||||
</div>
|
||||
<div class="card-footer py-1">
|
||||
<DataPager @ref="pagerODL" PageSize="numRecord" currPage="currPage" numRecordChanged="SetNumRec" numPageChanged="SetPage" totalCount="totalCount" showLoading="@isLoading" />
|
||||
@if (totalCount > numRecord)
|
||||
{
|
||||
<DataPager @ref="pagerODL" PageSize="numRecord" currPage="currPage" numRecordChanged="SetNumRec" numPageChanged="SetPage" totalCount="totalCount" showLoading="@isLoading" />
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
@@ -240,6 +240,7 @@ namespace MP.SPEC.Pages
|
||||
|
||||
protected void SetNumRec(int newNum)
|
||||
{
|
||||
currPage = 1;
|
||||
numRecord = newNum;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
@page "/PoKit"
|
||||
@page "/podl-kit"
|
||||
@page "/podl2kit"
|
||||
|
||||
<div class="card mb-5">
|
||||
<div class="card-header table-primary">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-0">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-2">
|
||||
<span class="fs-3 mb-0">PODL - KIT</span>
|
||||
<small class="small">Raggruppamento PODL in KIT di produzione</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="px-0 align-content-center d-flex justify-content-end">
|
||||
<div class="input-group me-2">
|
||||
<button class="btn @addNewBtnCss" style="min-width: 8rem;" @onclick="() => DoAddNew()">@addNewBtnText <i class="bi bi-plus-square"></i></button>
|
||||
</div>
|
||||
@* <div class="input-group me-2" style="min-width: 20rem;">
|
||||
<span class="input-group-text"><i class="fa fa-search"></i></span>
|
||||
<input type="text" class="form-control" placeholder="@($"Cod Commessa | Ctrl-R")" aria-label="Ricerca" title="@($"Ricerca Commessa | Ctrl-R")" @bind="@SearchComm" accesskey="R">
|
||||
<button class="btn @sParentCss" @onclick="() => ResetParent()"><i class="fa fa-ban"></i></button>
|
||||
</div> *@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
|
||||
@if (doAddNew)
|
||||
{
|
||||
<MP.SPEC.Components.ProdKit.Manager></MP.SPEC.Components.ProdKit.Manager>
|
||||
}
|
||||
else
|
||||
{
|
||||
<ScratchPodlKit></ScratchPodlKit>
|
||||
}
|
||||
</div>
|
||||
@* <div class="card-footer py-1">
|
||||
</div> *@
|
||||
</div>
|
||||
|
||||
|
||||
@@ -0,0 +1,581 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using Microsoft.JSInterop;
|
||||
using MP.Data.DbModels;
|
||||
using MP.SPEC.Data;
|
||||
using NLog.Layouts;
|
||||
|
||||
namespace MP.SPEC.Pages
|
||||
{
|
||||
public partial class Podl2Kit : ComponentBase, IDisposable
|
||||
{
|
||||
#region Public Methods
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
EditRecord = null;
|
||||
SearchRecords = null;
|
||||
ListRecords = null;
|
||||
GC.Collect();
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected int kitCount = 0;
|
||||
|
||||
protected int totalCount = 0;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected MpDataService MDService { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected NavigationManager NavManager { get; set; } = null!;
|
||||
|
||||
protected string SearchComm
|
||||
{
|
||||
get => sCodComm;
|
||||
set
|
||||
{
|
||||
if (sCodComm != value)
|
||||
{
|
||||
sCodComm = value;
|
||||
currPage = 1;
|
||||
ListRecords = null;
|
||||
ReloadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected string sParentCss
|
||||
{
|
||||
get => string.IsNullOrEmpty(sCodComm) ? "btn-secondary" : "btn-primary";
|
||||
}
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected string checkSelect(IstanzeKitModel currRec)
|
||||
{
|
||||
string answ = "";
|
||||
if (EditRecord != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
answ = (EditRecord.KeyKit == currRec.KeyKit && EditRecord.KeyExtOrd == currRec.KeyExtOrd) ? "table-info" : "";
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
protected bool DelEnabled(IstanzeKitModel reqRec)
|
||||
{
|
||||
bool answ = false;
|
||||
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Apre procedura creazione nuova istanza KIT
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected async Task DoAddNew()
|
||||
{
|
||||
doAddNew = !doAddNew;
|
||||
#if false
|
||||
// imposto a ricerca x iniziare
|
||||
string codParent = SearchParent;
|
||||
// se deve essere autogenerato da counter...
|
||||
if (AutoGen)
|
||||
{
|
||||
var cntRec = MDService.AnagCountersGetNext("NumKitArt");
|
||||
if (cntRec != null)
|
||||
{
|
||||
codParent = $"{cntRec.CntCode}{cntRec.LastNum:000000}";
|
||||
}
|
||||
else
|
||||
{
|
||||
codParent = "";
|
||||
}
|
||||
}
|
||||
EditRecord = new IstanzeKitModel()
|
||||
{
|
||||
CodArtParent = codParent,
|
||||
CodArtChild = "",
|
||||
QtyKIT = 1,
|
||||
QtyART = 1
|
||||
};
|
||||
#endif
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifica eliminabilità del record: se è avviato il PODL non è liminabile...
|
||||
/// </summary>
|
||||
/// <param name="reqRec"></param>
|
||||
/// <returns></returns>
|
||||
protected async Task DoCancel()
|
||||
{
|
||||
EditRecord = null;
|
||||
ReloadData();
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Eliminazione record selezionato (previa conferma)
|
||||
/// </summary>
|
||||
/// <param name="selRec"></param>
|
||||
/// <returns></returns>
|
||||
protected async Task DoDelete(IstanzeKitModel selRec)
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Eliminazione riga Istanza KIT: sei sicuro di voler procedere?"))
|
||||
return;
|
||||
|
||||
await Task.Delay(1);
|
||||
var done = await MDService.IstKitDelete(selRec);
|
||||
EditRecord = null;
|
||||
ReloadData();
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
protected async Task DoUpdate(IstanzeKitModel selRec)
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Confermi di voler salvare le modifiche?"))
|
||||
return;
|
||||
|
||||
await Task.Delay(1);
|
||||
var done = await MDService.IstKitUpsert(selRec);
|
||||
EditRecord = null;
|
||||
ReloadData();
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
private bool OptAdmKitEnabled = false;
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
numRecord = 10;
|
||||
// gestione di base dei KIT
|
||||
string rawVal = MDService.ConfigTryGet("OptAdmKitEnabled");
|
||||
if (!string.IsNullOrEmpty(rawVal))
|
||||
{
|
||||
bool.TryParse(rawVal, out OptAdmKitEnabled);
|
||||
}
|
||||
// conf variabili decodifica
|
||||
regExp_KO = MDService.ConfigTryGet("regExp_KO");
|
||||
regExp_OK = MDService.ConfigTryGet("regExp_OK");
|
||||
regExp_KitStart = MDService.ConfigTryGet("regExp_KitStart");
|
||||
regExp_KitSave = MDService.ConfigTryGet("regExp_KitSave");
|
||||
// altre variabili
|
||||
rawVal = MDService.ConfigTryGet("SPEC_nArtSearch");
|
||||
if (!string.IsNullOrEmpty(rawVal))
|
||||
{
|
||||
int.TryParse(rawVal, out minChar);
|
||||
}
|
||||
}
|
||||
|
||||
#if false
|
||||
protected override void OnAfterRender(bool firstRender)
|
||||
{
|
||||
if (firstRender)
|
||||
{
|
||||
if (OptAdmKitEnabled)
|
||||
{
|
||||
doReset();
|
||||
}
|
||||
}
|
||||
//base.OnAfterRender(firstRender);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
ReloadData();
|
||||
}
|
||||
|
||||
protected void ResetData()
|
||||
{
|
||||
EditRecord = null;
|
||||
}
|
||||
|
||||
protected void ResetParent()
|
||||
{
|
||||
SearchComm = "";
|
||||
ReloadData();
|
||||
}
|
||||
|
||||
protected void ResetSel()
|
||||
{
|
||||
EditRecord = null;
|
||||
}
|
||||
|
||||
protected void SelRecord(IstanzeKitModel selRec)
|
||||
{
|
||||
EditRecord = selRec;
|
||||
}
|
||||
|
||||
protected void SetNumPage(int newNum)
|
||||
{
|
||||
currPage = newNum;
|
||||
}
|
||||
|
||||
protected void SetNumRec(int newNum)
|
||||
{
|
||||
currPage = 1;
|
||||
numRecord = newNum;
|
||||
}
|
||||
|
||||
protected void UpdateData()
|
||||
{
|
||||
EditRecord = null;
|
||||
ReloadData();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private bool doAddNew = false;
|
||||
|
||||
/// <summary>
|
||||
/// Boolear controllo visualizzazione ricerca articoli
|
||||
/// </summary>
|
||||
private bool doSearchArt = false;
|
||||
|
||||
private IstanzeKitModel? EditRecord = null;
|
||||
|
||||
private List<IstanzeKitModel>? ListRecords;
|
||||
|
||||
private int minChar = 2;
|
||||
|
||||
/// <summary>
|
||||
/// RegExp x SAVE KIT
|
||||
/// </summary>
|
||||
private string regExp_KitSave = "#RKE";
|
||||
|
||||
/// <summary>
|
||||
/// RegExp x START KIT
|
||||
/// </summary>
|
||||
private string regExp_KitStart = "#RKS";
|
||||
|
||||
/// <summary>
|
||||
/// RegExp x RESET / CANCEL
|
||||
/// </summary>
|
||||
private string regExp_KO = "#RKO";
|
||||
|
||||
/// <summary>
|
||||
/// RegExp x CONFERMA
|
||||
/// </summary>
|
||||
private string regExp_OK = "#ROK";
|
||||
|
||||
private List<IstanzeKitModel>? SearchRecords;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private int _currPage { get; set; } = 1;
|
||||
|
||||
private int _numRecord { get; set; } = 10;
|
||||
|
||||
private int currPage
|
||||
{
|
||||
get => _currPage;
|
||||
set
|
||||
{
|
||||
if (_currPage != value)
|
||||
{
|
||||
_currPage = value;
|
||||
ReloadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool isLoading { get; set; } = false;
|
||||
|
||||
private int numRecord
|
||||
{
|
||||
get => _numRecord;
|
||||
set
|
||||
{
|
||||
if (_numRecord != value)
|
||||
{
|
||||
_numRecord = value;
|
||||
ReloadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string sCodComm { get; set; } = "";
|
||||
|
||||
private bool ShowCharts { get; set; } = false;
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private void ReloadData()
|
||||
{
|
||||
isLoading = true;
|
||||
SearchRecords = MDService.IstKitFilt("", "");
|
||||
totalCount = SearchRecords.Count;
|
||||
// conto i kit = distinct...
|
||||
kitCount = SearchRecords.GroupBy(x => x.CodArtParent).Count();
|
||||
ListRecords = SearchRecords
|
||||
.Skip(numRecord * (currPage - 1))
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Toggle modale ricerca articoli
|
||||
/// </summary>
|
||||
private void SearchArtToggle()
|
||||
{
|
||||
doSearchArt = !doSearchArt;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Salva selezione articolo
|
||||
/// </summary>
|
||||
/// <param name="codArt"></param>
|
||||
private void SetCodArtChild(string codArt)
|
||||
{
|
||||
if (EditRecord != null)
|
||||
{
|
||||
EditRecord.CodArtChild = codArt;
|
||||
doSearchArt = false;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
|
||||
private string addNewBtnText
|
||||
{
|
||||
get => doAddNew ? "Annulla creazione Istanza KIT" : "Composizione Nuovo KIT";
|
||||
}
|
||||
private string addNewBtnCss
|
||||
{
|
||||
get => doAddNew ? "btn-secondary" : "btn-primary";
|
||||
}
|
||||
|
||||
|
||||
#if false
|
||||
|
||||
|
||||
public string codKitTemp
|
||||
{
|
||||
get
|
||||
{
|
||||
return memLayer.ML.StringSessionObj(string.Format("codKitTemp_{0}", uid));
|
||||
}
|
||||
set
|
||||
{
|
||||
memLayer.ML.setSessionVal(string.Format("codKitTemp_{0}", uid), value);
|
||||
hlCodKitTemp.Value = value;
|
||||
grViewWSK.DataBind();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ultimo Codice KIT creato
|
||||
/// </summary>
|
||||
public string lastKitMade
|
||||
{
|
||||
get
|
||||
{
|
||||
return memLayer.ML.StringSessionObj("lastKitMade");
|
||||
}
|
||||
set
|
||||
{
|
||||
memLayer.ML.setSessionVal("lastKitMade", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Aggiunge (in obj OrdineKit) l'ordine coi parametri indicati
|
||||
/// </summary>
|
||||
/// <param name="codOrd"></param>
|
||||
/// <param name="codArt"></param>
|
||||
/// <param name="descArt"></param>
|
||||
/// <param name="qta"></param>
|
||||
/// <returns></returns>
|
||||
public bool addOrdArt(string codOrd, string codArt, string descArt, int qta)
|
||||
{
|
||||
bool answ = false;
|
||||
// verifico di avere un codiceKIT
|
||||
checkCodKit();
|
||||
// salvo info x il cod temporaneo...
|
||||
DataLayerObj.taWKS.insertQuery(codKitTemp, codOrd, codArt, descArt, qta);
|
||||
// verifico SE HO un KIT riconosciuto e quindi un CodArt di KIT valido...
|
||||
string currCodArtKit = "###";
|
||||
var TksTab = DataLayerObj.taTKS.GetData(codKitTemp, 1);
|
||||
bool showPODL = false;
|
||||
if (TksTab.Rows.Count > 0)
|
||||
{
|
||||
// verifico se ho aderenza 100%...
|
||||
if (TksTab[0].TotalScore == 1)
|
||||
{
|
||||
currCodArtKit = TksTab[0].CodArtParent;
|
||||
showPODL = true;
|
||||
}
|
||||
}
|
||||
hfCodArtKit.Value = currCodArtKit;
|
||||
divPODL.Visible = showPODL;
|
||||
answ = true;
|
||||
grViewWSK.DataBind();
|
||||
grViewKitSel.DataBind();
|
||||
grViewPODL.DataBind();
|
||||
grViewIstanzeKIT.DataBind();
|
||||
return answ;
|
||||
}
|
||||
|
||||
|
||||
private void doReset()
|
||||
{
|
||||
// elimino eventuali record ODL
|
||||
DataLayerObj.taWKS.deleteQuery(codKitTemp);
|
||||
codKitTemp = "";
|
||||
divPODL.Visible = false;
|
||||
checkCodKit();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ultimo input registrato
|
||||
/// </summary>
|
||||
public string lastInput
|
||||
{
|
||||
get
|
||||
{
|
||||
return hlLastInput.Value;
|
||||
}
|
||||
set
|
||||
{
|
||||
hlLastInput.Value = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Aggiorno controllo secondo ULTIMO input
|
||||
/// </summary>
|
||||
public void doUpdate()
|
||||
{
|
||||
// aggiorno label...
|
||||
messOut = "";
|
||||
// controllo input (reset/inizio o salva...)
|
||||
if (lastInput == regExp_KO)
|
||||
{
|
||||
// resetto dati
|
||||
doReset();
|
||||
messOut = "Effettuato reset!";
|
||||
}
|
||||
else if (lastInput == regExp_KitStart)
|
||||
{
|
||||
// resetto dati
|
||||
doReset();
|
||||
messOut = "Inizio configurazione KIT";
|
||||
}
|
||||
else if (lastInput == regExp_KitSave)
|
||||
{
|
||||
// controllo SE HO un kit selezionato...
|
||||
string currCodArtKit = "###";
|
||||
var TksTab = DataLayerObj.taTKS.GetData(codKitTemp, 1);
|
||||
bool showPODL = false;
|
||||
if (TksTab.Rows.Count > 0)
|
||||
{
|
||||
// verifico se ho aderenza 100%...
|
||||
if (TksTab[0].TotalScore == 1)
|
||||
{
|
||||
currCodArtKit = TksTab[0].CodArtParent;
|
||||
showPODL = true;
|
||||
}
|
||||
}
|
||||
if (showPODL)
|
||||
{
|
||||
// in questo caso creo istanza!
|
||||
creazioneIstanzaKit(currCodArtKit);
|
||||
}
|
||||
}
|
||||
else if (lastInput == regExp_OK)
|
||||
{
|
||||
}
|
||||
// ennesimo check cod TEMP
|
||||
checkCodKit();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifico SE HO un codKit Temporaneo sennò lo creo...
|
||||
/// </summary>
|
||||
private void checkCodKit()
|
||||
{
|
||||
if (codKitTemp == "")
|
||||
{
|
||||
// genero un NUOVO cod temp kit...
|
||||
codKitTemp = string.Format("KIT_{0:yyMMdd_HHmmss}", DateTime.Now);
|
||||
}
|
||||
}
|
||||
|
||||
public string messOut
|
||||
{
|
||||
set
|
||||
{
|
||||
lblOut.Text = value;
|
||||
}
|
||||
get
|
||||
{
|
||||
return lblOut.Text;
|
||||
}
|
||||
}
|
||||
|
||||
protected void grViewKitSel_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
// se ho selezionato recupero CHIAVE = CodArticolo del KIT
|
||||
string CodArtParent = grViewKitSel.SelectedValue.ToString();
|
||||
// crea KIT x quel CodArtParent...
|
||||
creazioneIstanzaKit(CodArtParent);
|
||||
}
|
||||
/// <summary>
|
||||
/// Crea una NUOVA istanza KIT
|
||||
/// </summary>
|
||||
/// <param name="CodArtParent">CodArt dell'Assieme/KIT</param>
|
||||
private void creazioneIstanzaKit(string CodArtParent)
|
||||
{
|
||||
// calcolo NUOVO codice kit...
|
||||
var tabKey = DataLayerObj.taIstK.getNewKey();
|
||||
if (tabKey.Rows.Count == 1)
|
||||
{
|
||||
// stacco un NUOVO codice KIT
|
||||
lastKitMade = tabKey[0].KeyKit;
|
||||
// inserisco ISTANZA KIT!
|
||||
DataLayerObj.taIstK.insertByWKS(lastKitMade, CodArtParent, codKitTemp);
|
||||
// faccio reset valori WKS...
|
||||
doReset();
|
||||
// ora resetto ordine caricato...
|
||||
messOut = string.Format("Creato NUOVA P.ODL cod {0} per il KIT {1}", lastKitMade, CodArtParent);
|
||||
// sollevo evento x impostare lettura KIT a BARCODE (x conferma successiva...)
|
||||
// sollevo evento nuovo valore...
|
||||
if (eh_selKit != null)
|
||||
{
|
||||
eh_selKit(this, new EventArgs());
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo MAPOSPEC </i>
|
||||
<h4>Versione: 6.16.2504.1007</h4>
|
||||
<h4>Versione: 6.16.2504.1019</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
6.16.2504.1007
|
||||
6.16.2504.1019
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>6.16.2504.1007</version>
|
||||
<version>6.16.2504.1019</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>
|
||||
|
||||
Reference in New Issue
Block a user