update force PNG x componente

This commit is contained in:
Samuele Locatelli
2023-04-26 19:41:52 +02:00
parent 4c126045fc
commit cc6529a017
7 changed files with 219 additions and 162 deletions
+100 -106
View File
@@ -1,31 +1,11 @@
using AppData;
using NKC_SDK;
using SteamWare;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace NKC_WF.WebUserControls
{
public partial class cmp_batchDetail : BaseUserControl
{
#region Protected Properties
/// <summary>
/// verifica se il batch sia di tipo ancestor (da splittare su macchine)
/// </summary>
protected bool BatchIsAncestor
{
get
{
return ComLib.BType(BatchId) == BatchType.Ancestor;
}
}
#endregion Protected Properties
#region Public Properties
public int BatchId
@@ -61,17 +41,85 @@ namespace NKC_WF.WebUserControls
}
}
#endregion Public Properties
#region Private Methods
private void fixDisplayDesc()
/// <summary>
/// Verifica se il batch sia stato splittato
/// </summary>
public bool isSplitted
{
divSplit.Visible = BatchIsAncestor;
cmp_batchDetailMongo.Visible = !BatchIsAncestor;
get => cmp_batchDetailSplit.isSplitted;
}
#endregion Private Methods
#endregion Public Properties
#region Public Methods
/// <summary>
/// Converte il codice stato in effettivo campo
/// </summary>
/// <param name="_status"></param>
/// <returns></returns>
public string BStatus(object _status)
{
string answ = ComLib.BatchStatusDescr(_status);
return answ;
}
/// <summary>
/// Controlla se lo stato sia uguale a quello richiesto
/// </summary>
/// <param name="_status"></param>
/// <param name="statusReq"></param>
/// <returns></returns>
public bool checkStatus(object _status, BatchStatus statusReq)
{
bool answ = false;
int status = -1;
int.TryParse(_status.ToString(), out status);
answ = (status == (int)statusReq);
return answ;
}
/// <summary>
/// Controlla se il type sia uguale a quello richiesto
/// </summary>
/// <param name="_bType"></param>
/// <param name="bTypeReq"></param>
/// <returns></returns>
public bool checkType(object _bType, BatchType bTypeReq)
{
bool answ = false;
int bType = -1;
int.TryParse(_bType.ToString(), out bType);
answ = (bType == (int)bTypeReq);
return answ;
}
public void doUpdate()
{
frmView.DataBind();
fixDisplayDesc();
if (divSplit.Visible)
{
cmp_batchDetailSplit.doUpdate();
}
}
#endregion Public Methods
#region Protected Properties
/// <summary>
/// verifica se il batch sia di tipo ancestor (da splittare su macchine)
/// </summary>
protected bool BatchIsAncestor
{
get
{
return ComLib.BType(BatchId) == BatchType.Ancestor;
}
}
#endregion Protected Properties
#region Protected Methods
@@ -87,14 +135,6 @@ namespace NKC_WF.WebUserControls
raiseEvent();
}
/// <summary>
/// Verifica se il batch sia stato splittato
/// </summary>
public bool isSplitted
{
get => cmp_batchDetailSplit.isSplitted;
}
/// <summary>
/// Riporta nesting a stato ESTIMATED
/// </summary>
@@ -113,8 +153,7 @@ namespace NKC_WF.WebUserControls
{
// invia a redis una richiesta...
ComLib.sendMaterials();
ComLib.sendBatchReq(BatchId, "Estimation", 3, false, 0);
ComLib.sendBatchReq(BatchId, "Estimation", 3, false, 0, false);
// ri-assegnazione ordini/kit a batch ancestor
if (BatchIsAncestor)
@@ -133,20 +172,6 @@ namespace NKC_WF.WebUserControls
raiseEvent();
}
private void resetChildBatch()
{
var tabDesc = ComLib.BatchDescendant(BatchId);
if (tabDesc != null && tabDesc.Count > 0)
{
foreach (var item in tabDesc)
{
DLMan.taBL.updateStatus(item.BatchID, (int)BatchStatus.Imported, "", -1);
// elimino order tree eventuale...
DLMan.taOLT.deleteByBatch(item.BatchID);
}
}
}
protected void lbtSendNesting_Click(object sender, EventArgs e)
{
// invia a redis a a richiesta...
@@ -160,8 +185,8 @@ namespace NKC_WF.WebUserControls
}
else
{
// invio il batch corrente
ComLib.sendBatchReq(BatchId, "Nesting", 2, false, 1);
// invio il batch corrente, SENZA richiesta PNG
ComLib.sendBatchReq(BatchId, "Nesting", 2, false, 1, false);
// registro su DB nesting iniziato...
DLMan.taBL.updateStatus(BatchId, (int)BatchStatus.NestRequested, "", -1);
}
@@ -207,12 +232,6 @@ namespace NKC_WF.WebUserControls
cmp_batchDetailSplit.eh_doReset += Cmp_batchDetailSplit_eh_doReset;
}
private void Cmp_batchDetailSplit_eh_doReset(object sender, EventArgs e)
{
frmView.DataBind();
fixDisplayDesc();
}
/// <summary>
/// Effettua divisione evitando zeri a den...
/// </summary>
@@ -227,59 +246,34 @@ namespace NKC_WF.WebUserControls
#endregion Protected Methods
#region Public Methods
#region Private Methods
/// <summary>
/// Converte il codice stato in effettivo campo
/// </summary>
/// <param name="_status"></param>
/// <returns></returns>
public string BStatus(object _status)
{
string answ = ComLib.BatchStatusDescr(_status);
return answ;
}
/// <summary>
/// Controlla se lo stato sia uguale a quello richiesto
/// </summary>
/// <param name="_status"></param>
/// <param name="statusReq"></param>
/// <returns></returns>
public bool checkStatus(object _status, BatchStatus statusReq)
{
bool answ = false;
int status = -1;
int.TryParse(_status.ToString(), out status);
answ = (status == (int)statusReq);
return answ;
}
/// <summary>
/// Controlla se il type sia uguale a quello richiesto
/// </summary>
/// <param name="_bType"></param>
/// <param name="bTypeReq"></param>
/// <returns></returns>
public bool checkType(object _bType, BatchType bTypeReq)
{
bool answ = false;
int bType = -1;
int.TryParse(_bType.ToString(), out bType);
answ = (bType == (int)bTypeReq);
return answ;
}
public void doUpdate()
private void Cmp_batchDetailSplit_eh_doReset(object sender, EventArgs e)
{
frmView.DataBind();
fixDisplayDesc();
if (divSplit.Visible)
}
private void fixDisplayDesc()
{
divSplit.Visible = BatchIsAncestor;
cmp_batchDetailMongo.Visible = !BatchIsAncestor;
}
private void resetChildBatch()
{
var tabDesc = ComLib.BatchDescendant(BatchId);
if (tabDesc != null && tabDesc.Count > 0)
{
cmp_batchDetailSplit.doUpdate();
foreach (var item in tabDesc)
{
DLMan.taBL.updateStatus(item.BatchID, (int)BatchStatus.Imported, "", -1);
// elimino order tree eventuale...
DLMan.taOLT.deleteByBatch(item.BatchID);
}
}
}
#endregion Public Methods
#endregion Private Methods
}
}
@@ -8,6 +8,7 @@
<div class="col-12 border border-info table-info rounded py-2 mb-1" runat="server" id="divDetail">
<uc1:cmp_batchDetail runat="server" ID="cmp_batchDetail" />
<asp:HiddenField runat="server" ID="hfLastSelRow" />
<asp:HiddenField runat="server" ID="hfCreatePng" />
</div>
<div class="col-12 px-0">
<div class="row">
+20 -1
View File
@@ -100,6 +100,25 @@ namespace NKC_WF.WebUserControls
chkShowSplit.Checked = value;
}
}
/// <summary>
/// Indica se abilitare creazioen automatica dei PNG x le parts nel batch
/// </summary>
public bool forceCreatePng
{
get
{
bool answ = false;
if (!string.IsNullOrEmpty(hfCreatePng.Value))
{
bool.TryParse(hfCreatePng.Value, out answ);
}
return answ;
}
set
{
hfCreatePng.Value = $"{value}";
}
}
#endregion Public Properties
@@ -245,7 +264,7 @@ namespace NKC_WF.WebUserControls
// eseguo richiesta reset
DLMan.taBL.redoPartValid(lbt.CommandArgument);
// eventualmente mando primo batch da validare...
bool newValidSent = ComLib.sendFirstValidationBatch();
bool newValidSent = ComLib.sendFirstValidationBatch(forceCreatePng);
// refresh!
resetSelezione();
}
+9
View File
@@ -50,6 +50,15 @@ namespace NKC_WF.WebUserControls
/// </remarks>
protected global::System.Web.UI.WebControls.HiddenField hfLastSelRow;
/// <summary>
/// hfCreatePng control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.HiddenField hfCreatePng;
/// <summary>
/// chkShowSplit control.
/// </summary>
@@ -1,6 +1,7 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="cmp_validationSummary.ascx.cs" Inherits="NKC_WF.WebUserControls.cmp_validationSummary" %>
<asp:HiddenField runat="server" ID="hfCreatePng" />
<asp:UpdatePanel ID="updPanelDetail" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="row">
@@ -64,6 +65,6 @@
</ItemTemplate>
</asp:FormView>
<asp:ObjectDataSource ID="ods" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetData" TypeName="AppData.DS_AppTableAdapters.PartValidParetoTableAdapter"></asp:ObjectDataSource>
<asp:Timer ID="Timer1" runat="server" Interval="3000" OnTick="Timer1_Tick"></asp:Timer>
<asp:Timer ID="Timer1" runat="server" Interval="3000" OnTick="Timer1_Tick"></asp:Timer>
</ContentTemplate>
</asp:UpdatePanel>
@@ -7,23 +7,46 @@ namespace NKC_WF.WebUserControls
{
public partial class cmp_validationSummary : BaseUserControl
{
#region Private Methods
#region Public Properties
/// <summary>
/// fix visibilità buttons
/// Indica se abilitare creazioen automatica dei PNG x le parts nel batch
/// </summary>
private void fixVisibility()
public bool forceCreatePng
{
// controllo SE HO nuove PARTS da validare...
var tabItems2Valid = DLMan.taIL.getNeedValid();
var tabItemsUnValid = DLMan.taIL.getUnValid();
var tabItems2ReValid = DLMan.taIL.getNeedRevalid();
lbtValidateMissing.Visible = tabItems2Valid.Count > 0;
lbtRevalidate.Visible = tabItemsUnValid.Count > 0;
lbtReValidAll.Visible = tabItems2ReValid.Count > 0;
get
{
bool answ = false;
if (!string.IsNullOrEmpty(hfCreatePng.Value))
{
bool.TryParse(hfCreatePng.Value, out answ);
}
return answ;
}
set
{
hfCreatePng.Value = $"{value}";
}
}
#endregion Private Methods
#endregion Public Properties
#region Public Methods
/// <summary>
/// Update forzato
/// </summary>
public void doUpdate(bool reportEvent = true)
{
fixVisibility();
frmView.DataBind();
if (reportEvent)
{
raiseEvent();
}
}
#endregion Public Methods
#region Protected Methods
@@ -34,7 +57,7 @@ namespace NKC_WF.WebUserControls
{
DLMan.taBL.redoPartValid("*");
// eventualmente mando primo batch da validare...
bool newValidSent = ComLib.sendFirstValidationBatch();
bool newValidSent = ComLib.sendFirstValidationBatch(forceCreatePng);
}
catch
{ }
@@ -48,7 +71,7 @@ namespace NKC_WF.WebUserControls
try
{
// eventualmente mando primo batch da validare...
bool newValidSent = ComLib.sendFirstValidationBatch();
bool newValidSent = ComLib.sendFirstValidationBatch(forceCreatePng);
}
catch
{ }
@@ -63,7 +86,7 @@ namespace NKC_WF.WebUserControls
{
DLMan.taBL.resetPartUnValid();
// eventualmente mando primo batch da validare...
bool newValidSent = ComLib.sendFirstValidationBatch();
bool newValidSent = ComLib.sendFirstValidationBatch(forceCreatePng);
}
catch
{ }
@@ -79,7 +102,7 @@ namespace NKC_WF.WebUserControls
string cadBasePath = $"{memLayer.ML.CRS("nestBasePath")}{memLayer.ML.CRS("drawingFolder")}/";
DLMan.taBL.createPartValBatch(cadBasePath);
// eventualmente mando primo batch da validare...
bool newValidSent = ComLib.sendFirstValidationBatch();
bool newValidSent = ComLib.sendFirstValidationBatch(forceCreatePng);
}
catch
{ }
@@ -102,21 +125,22 @@ namespace NKC_WF.WebUserControls
#endregion Protected Methods
#region Public Methods
#region Private Methods
/// <summary>
/// Update forzato
/// fix visibilità buttons
/// </summary>
public void doUpdate(bool reportEvent = true)
private void fixVisibility()
{
fixVisibility();
frmView.DataBind();
if (reportEvent)
{
raiseEvent();
}
// controllo SE HO nuove PARTS da validare...
var tabItems2Valid = DLMan.taIL.getNeedValid();
var tabItemsUnValid = DLMan.taIL.getUnValid();
var tabItems2ReValid = DLMan.taIL.getNeedRevalid();
lbtValidateMissing.Visible = tabItems2Valid.Count > 0;
lbtRevalidate.Visible = tabItemsUnValid.Count > 0;
lbtReValidAll.Visible = tabItems2ReValid.Count > 0;
}
#endregion Public Methods
#endregion Private Methods
}
}
+38 -29
View File
@@ -1,10 +1,10 @@
//------------------------------------------------------------------------------
// <generato automaticamente>
// Codice generato da uno strumento.
// <auto-generated>
// This code was generated by a tool.
//
// Le modifiche a questo file possono causare un comportamento non corretto e verranno perse se
// il codice viene rigenerato.
// </generato automaticamente>
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace NKC_WF.WebUserControls
@@ -15,74 +15,83 @@ namespace NKC_WF.WebUserControls
{
/// <summary>
/// Controllo updPanelDetail.
/// hfCreatePng control.
/// </summary>
/// <remarks>
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.HiddenField hfCreatePng;
/// <summary>
/// updPanelDetail control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.UpdatePanel updPanelDetail;
/// <summary>
/// Controllo lbtForceRevali.
/// lbtForceRevali control.
/// </summary>
/// <remarks>
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.LinkButton lbtForceRevali;
/// <summary>
/// Controllo lbtRevalidate.
/// lbtRevalidate control.
/// </summary>
/// <remarks>
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.LinkButton lbtRevalidate;
/// <summary>
/// Controllo lbtReValidAll.
/// lbtReValidAll control.
/// </summary>
/// <remarks>
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.LinkButton lbtReValidAll;
/// <summary>
/// Controllo lbtValidateMissing.
/// lbtValidateMissing control.
/// </summary>
/// <remarks>
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.LinkButton lbtValidateMissing;
/// <summary>
/// Controllo frmView.
/// frmView control.
/// </summary>
/// <remarks>
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.FormView frmView;
/// <summary>
/// Controllo ods.
/// ods control.
/// </summary>
/// <remarks>
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.ObjectDataSource ods;
/// <summary>
/// Controllo Timer1.
/// Timer1 control.
/// </summary>
/// <remarks>
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.Timer Timer1;
}