diff --git a/NKC_WF/Controllers/SheetController.cs b/NKC_WF/Controllers/SheetController.cs index d9bdb2a..b16f1e1 100644 --- a/NKC_WF/Controllers/SheetController.cs +++ b/NKC_WF/Controllers/SheetController.cs @@ -79,6 +79,7 @@ namespace NKC_WF.Controllers // https://weblog.west-wind.com/posts/2013/dec/13/accepting-raw-request-body-content-with-aspnet-web-api // https://weblog.west-wind.com/posts/2017/sep/14/accepting-raw-request-body-content-in-aspnet-core-api-controllers int BunkId = 0; + int BatchId = 0; if (sheetUpdated != null) { // 2020.01.16 salvo su mongoDb la risposta... @@ -104,12 +105,18 @@ namespace NKC_WF.Controllers } // segnalo avanzamento su redis x pagina unload ComLib.advaceSheetRevByBunk(currSheet.BunkId); + // calcolo Batch BunkId = currSheet.BunkId; } } + var tabBunks = DataLayer.man.taSTL.getByKey(BunkId); + if (tabBunks.Count > 0) + { + BatchId = tabBunks[0].BatchID; + } } // ricalcolo stato BUNK - ComLib.updateBatchPosition(BunkId); + ComLib.updateBatchPosition(BatchId); // INVALIDO eventuale valore BUNK in REDIS... ComLib.resetRedisBunkData(); } @@ -154,7 +161,7 @@ namespace NKC_WF.Controllers DataLayer.man.taSHL.updateDate(currSheet.SheetId, currSheet.Printing.DtStart, currSheet.Printing.DtEnd, currSheet.Machining.DtStart, currSheet.Machining.DtEnd, currSheet.Unloading.DtStart, currSheet.Unloading.DtEnd, (int)currSheet.Status); // SE machining completato --> status a LAVORATO x item! if (currSheet.Machining.DtEnd != null) - { + { // hard coded su multiax DataLayer.man.taIL.updateSheetStatus(currSheet.SheetId, 1, "WRK001"); } diff --git a/NKC_WF/WebUserControls/cmp_barcode.ascx b/NKC_WF/WebUserControls/cmp_barcode.ascx index c5663ef..dc5f8d2 100644 --- a/NKC_WF/WebUserControls/cmp_barcode.ascx +++ b/NKC_WF/WebUserControls/cmp_barcode.ascx @@ -2,4 +2,5 @@
+
diff --git a/NKC_WF/WebUserControls/cmp_barcode.ascx.cs b/NKC_WF/WebUserControls/cmp_barcode.ascx.cs index 0364ae2..17f0903 100644 --- a/NKC_WF/WebUserControls/cmp_barcode.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_barcode.ascx.cs @@ -3,56 +3,99 @@ using System.Web.UI; namespace NKC_WF.WebUserControls { - public partial class cmp_barcode : BaseUserControl - { - protected void Page_Load(object sender, EventArgs e) + public partial class cmp_barcode : BaseUserControl { - if (!Page.IsPostBack) - { - resetMessage(); - } - else if (inputAcquired == "") - { - raiseEvent(); - } - } + protected void Page_Load(object sender, EventArgs e) + { + if (!Page.IsPostBack) + { + resetMessage(); + } + else if (string.IsNullOrEmpty(inputAcquired)) + { + checkRaiseEv(); + } + } - public void resetMessage() - { - lblOutput.Visible = false; - lblOutput.Text = ""; - } + protected string lastCmd + { + get + { + return hfLastCmd.Value; + } + set + { + hfLastCmd.Value = value; + } + } - protected void txtBarcode_TextChanged(object sender, EventArgs e) - { - raiseEvent(); + public void resetMessage() + { + lblOutput.Visible = false; + lblOutput.Text = ""; + } + + protected void txtBarcode_TextChanged(object sender, EventArgs e) + { + checkRaiseEv(); + } + + private void checkRaiseEv() + { + if (lastCmd != inputAcquired) + { + // alzo evento SOLO SE il nuovo valore รจ diverso da null... + lastCmd = inputAcquired; + if (!string.IsNullOrEmpty(inputAcquired)) + { + raiseEvent(); + } + } + else + { + if(string.IsNullOrEmpty(lastCmd)) + { + resetMessage(); + } + } + txtBarcode.Focus(); + } + + /// + /// Valore acquisito in lettura barcode + /// + public string inputAcquired + { + get + { + return txtBarcode.Text.Trim(); + } + set + { + txtBarcode.Text = ""; + } + } + /// + /// Reset input del barcode SENZA generare evento... + /// + /// + public void resetInput() + { + inputAcquired = ""; + txtBarcode.Focus(); + } + /// + /// Gestione output da mostrare (opzionale + /// + /// + /// + public void showOutput(string cssClass, string messaggio) + { + // In primis: mostro qualcosa SOLO SE ho del testo + lblOutput.Visible = (messaggio != ""); + lblOutput.Text = messaggio; + lblOutput.Attributes.Remove("class"); + lblOutput.Attributes.Add("class", cssClass); + } } - /// - /// Valore acquisito in lettura barcode - /// - public string inputAcquired - { - get - { - return txtBarcode.Text.Trim(); - } - set - { - txtBarcode.Text = ""; - } - } - /// - /// Gestione output da mostrare (opzionale - /// - /// - /// - public void showOutput(string cssClass, string messaggio) - { - // In primis: mostro qualcosa SOLO SE ho del testo - lblOutput.Visible = (messaggio != ""); - lblOutput.Text = messaggio; - lblOutput.Attributes.Remove("class"); - lblOutput.Attributes.Add("class", cssClass); - } - } } \ No newline at end of file diff --git a/NKC_WF/WebUserControls/cmp_barcode.ascx.designer.cs b/NKC_WF/WebUserControls/cmp_barcode.ascx.designer.cs index 7acd04b..6f70ae0 100644 --- a/NKC_WF/WebUserControls/cmp_barcode.ascx.designer.cs +++ b/NKC_WF/WebUserControls/cmp_barcode.ascx.designer.cs @@ -7,11 +7,13 @@ // //------------------------------------------------------------------------------ -namespace NKC_WF.WebUserControls { - - - public partial class cmp_barcode { - +namespace NKC_WF.WebUserControls +{ + + + public partial class cmp_barcode + { + /// /// Controllo txtBarcode. /// @@ -20,7 +22,7 @@ namespace NKC_WF.WebUserControls { /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. /// protected global::System.Web.UI.WebControls.TextBox txtBarcode; - + /// /// Controllo lblOutput. /// @@ -29,5 +31,14 @@ namespace NKC_WF.WebUserControls { /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. /// protected global::System.Web.UI.WebControls.Label lblOutput; + + /// + /// Controllo hfLastCmd. + /// + /// + /// Campo generato automaticamente. + /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// + protected global::System.Web.UI.WebControls.HiddenField hfLastCmd; } } diff --git a/NKC_WF/WebUserControls/cmp_stackBuilding.ascx.cs b/NKC_WF/WebUserControls/cmp_stackBuilding.ascx.cs index fe279e0..f685012 100644 --- a/NKC_WF/WebUserControls/cmp_stackBuilding.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_stackBuilding.ascx.cs @@ -5,161 +5,161 @@ using System.Web.UI; namespace NKC_WF.WebUserControls { - public partial class cmp_stackBuilding : BaseUserControl - { - protected void Page_Load(object sender, EventArgs e) + public partial class cmp_stackBuilding : BaseUserControl { - if (!Page.IsPostBack) - { - // svuoto input barcode... - cmp_barcode.inputAcquired = ""; - lastCmd = ""; - // pulisco dir temp dai file dei cartellini stampati - reportPrinter.obj.pulisciDir(); - } - cmp_barcode.eh_doRefresh += Cmp_barcode_eh_doRefresh; - } - // se NON ci sono altri campi "next" allora posso msotrare stampa... - private void checkPrint() - { - DS_App.SheetListDataTable nextTbl = DataLayer.man.taSHL.getNextByStack(StackId); - // se tab vuota --> HO FINITO, mostro stampa... - divPrint.Visible = (nextTbl.Count == 0); - } - - /// - /// Comando barcode letto - /// - protected string lastCmd - { - get - { - return hfBarcode.Value; - } - set - { - hfBarcode.Value = value; - } - } - - private void Cmp_barcode_eh_doRefresh(object sender, EventArgs e) - { - // processo evento.. - lastCmd = cmp_barcode.inputAcquired.ToUpper(); - // processiamo barcode letto - decodedData decoData = DataLayer.man.decodeBcode(lastCmd); - switch (decoData.codeType) - { - case codeType.UNK: - cmp_barcode.showOutput("text-danger", "Unknown Data"); - break; - case codeType.Item: - case codeType.ItemGeneric: - cmp_barcode.showOutput("text-warning", "Item - ignored"); - break; - case codeType.Material: - // verifico SE il materiale SIA quello dello sheet richiesto dallo stack/bunk corrente... - DS_App.SheetListDataTable nextTbl = DataLayer.man.taSHL.getNextByStack(StackId); - // se tab vuota --> HO FINITO!!!! - if (nextTbl.Count == 0) - { - cmp_barcode.showOutput("badge badge-warning", $"STACK IS COMPLETED, {decoData.description}"); - } - // se ho valori --> controllo se corretto... - else - { - string codReq = nextTbl[0].MatExtCode.ToString(); - if (codReq == decoData.codeInt.ToString()) + protected void Page_Load(object sender, EventArgs e) + { + if (!Page.IsPostBack) { - cmp_barcode.showOutput("badge badge-success", $"SHEET RECORDED: {decoData.description}"); - // chiamo stored x indicare preparato - DataLayer.man.taSHL.setPrepared(nextTbl[0].SheetID); + // svuoto input barcode... + cmp_barcode.inputAcquired = ""; + lastCmd = ""; + // pulisco dir temp dai file dei cartellini stampati + reportPrinter.obj.pulisciDir(); + } + cmp_barcode.eh_doRefresh += Cmp_barcode_eh_doRefresh; + } + // se NON ci sono altri campi "next" allora posso msotrare stampa... + private void checkPrint() + { + DS_App.SheetListDataTable nextTbl = DataLayer.man.taSHL.getNextByStack(StackId); + // se tab vuota --> HO FINITO, mostro stampa... + divPrint.Visible = (nextTbl.Count == 0); + } + + /// + /// Comando barcode letto + /// + protected string lastCmd + { + get + { + return hfBarcode.Value; + } + set + { + hfBarcode.Value = value; + } + } + + private void Cmp_barcode_eh_doRefresh(object sender, EventArgs e) + { + // processo evento.. + lastCmd = cmp_barcode.inputAcquired.ToUpper(); + // processiamo barcode letto + decodedData decoData = DataLayer.man.decodeBcode(lastCmd); + switch (decoData.codeType) + { + case codeType.UNK: + cmp_barcode.showOutput("text-danger", "Unknown Data"); + break; + case codeType.Item: + case codeType.ItemGeneric: + cmp_barcode.showOutput("text-warning", "Item - ignored"); + break; + case codeType.Material: + // verifico SE il materiale SIA quello dello sheet richiesto dallo stack/bunk corrente... + DS_App.SheetListDataTable nextTbl = DataLayer.man.taSHL.getNextByStack(StackId); + // se tab vuota --> HO FINITO!!!! + if (nextTbl.Count == 0) + { + cmp_barcode.showOutput("badge badge-warning", $"STACK IS COMPLETED, {decoData.description}"); + } + // se ho valori --> controllo se corretto... + else + { + string codReq = nextTbl[0].MatExtCode.ToString(); + if (codReq == decoData.codeInt.ToString()) + { + cmp_barcode.showOutput("badge badge-success", $"SHEET RECORDED: {decoData.description}"); + // chiamo stored x indicare preparato + DataLayer.man.taSHL.setPrepared(nextTbl[0].SheetID); + } + else + { + cmp_barcode.showOutput("badge badge-danger", $"WRONG SHEET: {decoData.description}"); + } + } + break; + case codeType.Sheet: + cmp_barcode.showOutput("badge badge-warning", "Sheet - ignored"); + break; + case codeType.Stack: + cmp_barcode.showOutput("badge badge-warning", "Stack - ignored"); + break; + case codeType.Batch: + cmp_barcode.showOutput("badge badge-warning", "Batch - ignored"); + break; + default: + break; + } + // reset comando + cmp_barcode.resetInput(); + // aggiorno... + doUpdate(); + } + + public void doUpdate() + { + repCtrl.DataBind(); + checkPrint(); + } + + public int StackId + { + set + { + hfStackId.Value = value.ToString(); + lastCmd = ""; + cmp_barcode.resetMessage(); + ComLib.updateBatchPositionByBunk(value); + doUpdate(); + } + get + { + int answ = 0; + int.TryParse(hfStackId.Value, out answ); + return answ; + } + } + + public string cssFlashNext(object _isNext) + { + string answ = ""; + if (_isNext.ToString() == "1") + { + answ = " flashColor"; + } + return answ; + } + public string cssByPrepared(object _prepared, object _isNext) + { + string answ = "table-secondary border border-secondary border-thick rounded"; + if (_isNext.ToString() == "1") + { + answ = "table-primary flashColor rounded"; } else { - cmp_barcode.showOutput("badge badge-danger", $"WRONG SHEET: {decoData.description}"); + if (_prepared.ToString() != "") + { + answ = "table-success border border-success border-thick rounded"; + } } - } - break; - case codeType.Sheet: - cmp_barcode.showOutput("badge badge-warning", "Sheet - ignored"); - break; - case codeType.Stack: - cmp_barcode.showOutput("badge badge-warning", "Stack - ignored"); - break; - case codeType.Batch: - cmp_barcode.showOutput("badge badge-warning", "Batch - ignored"); - break; - default: - break; - } - // reset comando - cmp_barcode.inputAcquired = ""; - // aggiorno... - doUpdate(); - } - - public void doUpdate() - { - repCtrl.DataBind(); - checkPrint(); - } - - public int StackId - { - set - { - hfStackId.Value = value.ToString(); - lastCmd = ""; - cmp_barcode.resetMessage(); - ComLib.updateBatchPositionByBunk(value); - doUpdate(); - } - get - { - int answ = 0; - int.TryParse(hfStackId.Value, out answ); - return answ; - } - } - - public string cssFlashNext(object _isNext) - { - string answ = ""; - if (_isNext.ToString() == "1") - { - answ = " flashColor"; - } - return answ; - } - public string cssByPrepared(object _prepared, object _isNext) - { - string answ = "table-secondary border border-secondary border-thick rounded"; - if (_isNext.ToString() == "1") - { - answ = "table-primary flashColor rounded"; - } - else - { - if (_prepared.ToString() != "") - { - answ = "table-success border border-success border-thick rounded"; + return answ; + } + /// + /// Chiesta stampa stack corrente + /// + /// + /// + protected void lbtPrint_Click(object sender, EventArgs e) + { + // chiamo procedura stampa report x stack + string printer = DataLayer.man.getPrinter("PC-MACHINE-STACK-BUILD"); + DataLayer.man.stampaDoc(StackId.ToString(), printer, tipoDocumento.docStack, Request.UserHostName); + // aggiorno stato BATCH + ComLib.updateBatchPositionByBunk(StackId); } - } - return answ; } - /// - /// Chiesta stampa stack corrente - /// - /// - /// - protected void lbtPrint_Click(object sender, EventArgs e) - { - // chiamo procedura stampa report x stack - string printer = DataLayer.man.getPrinter("PC-MACHINE-STACK-BUILD"); - DataLayer.man.stampaDoc(StackId.ToString(), printer, tipoDocumento.docStack, Request.UserHostName); - // aggiorno stato BATCH - ComLib.updateBatchPositionByBunk(StackId); - } - } } \ No newline at end of file diff --git a/NKC_WF/WebUserControls/cmp_stackLoading.ascx b/NKC_WF/WebUserControls/cmp_stackLoading.ascx index d3caba1..7e8b620 100644 --- a/NKC_WF/WebUserControls/cmp_stackLoading.ascx +++ b/NKC_WF/WebUserControls/cmp_stackLoading.ascx @@ -28,7 +28,7 @@
- <%: traduci("BunkReading") %> + <%: traduci("BatchCurrent") %>
TOT SHEETS: diff --git a/NKC_WF/WebUserControls/cmp_stackLoading.ascx.cs b/NKC_WF/WebUserControls/cmp_stackLoading.ascx.cs index 7908706..2610210 100644 --- a/NKC_WF/WebUserControls/cmp_stackLoading.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_stackLoading.ascx.cs @@ -76,7 +76,10 @@ namespace NKC_WF.WebUserControls bool doRaiseEv = false; // processo evento.. lastCmd = cmp_barcode.inputAcquired.ToUpper(); - if (lastCmd == "") doRaiseEv = true; + if (lastCmd == "") + { + doRaiseEv = true; + } // processiamo barcode letto decodedData decoData = DataLayer.man.decodeBcode(lastCmd); switch (decoData.codeType) @@ -178,7 +181,7 @@ namespace NKC_WF.WebUserControls break; } // reset comando - cmp_barcode.inputAcquired = ""; + cmp_barcode.resetInput(); // aggiorno... doUpdate(); // se richiesto faccio raiseEvent @@ -280,13 +283,11 @@ namespace NKC_WF.WebUserControls cmp_stackNextloading.doUpdate(); // segnalo avanzamento su redis x pagina unload ComLib.advaceSheetRevByBunk(BatchIdCurr); + // controllo update stato BATCH/BUNK + ComLib.updateBatchPosition(BatchIdCurr); raiseEvent(); } } - protected void lbtAdvanceBunk_Click(object sender, EventArgs e) - { - // simula invio barcode del PROSSIMO BUNK (SE necessario) - } } } \ No newline at end of file diff --git a/NKC_WF/WebUserControls/cmp_stackNextloading.ascx b/NKC_WF/WebUserControls/cmp_stackNextloading.ascx index 021445d..5dbbb7c 100644 --- a/NKC_WF/WebUserControls/cmp_stackNextloading.ascx +++ b/NKC_WF/WebUserControls/cmp_stackNextloading.ascx @@ -20,12 +20,12 @@
PREVIOUS BUNK: - (/2) + ()
CURRENT BUNK: - (/2) + ()
@@ -61,7 +61,7 @@
- <%: traduci("CollectRedo") %> + <%: traduci("CollectRedo") %>
@@ -70,7 +70,7 @@
NEXT BUNK: - (/2) + ()
sheets: | printed: @@ -103,7 +103,7 @@
- <%: traduci("CollectRedoOnEnd") %> + <%: traduci("CollectRedoOnEnd") %>
diff --git a/NKC_WF/site/MachineLoad.aspx.cs b/NKC_WF/site/MachineLoad.aspx.cs index f290b92..1f5a2fe 100644 --- a/NKC_WF/site/MachineLoad.aspx.cs +++ b/NKC_WF/site/MachineLoad.aspx.cs @@ -2,28 +2,34 @@ namespace NKC_WF { - public partial class MachineLoad : BasePage - { - protected void Page_Load(object sender, EventArgs e) + public partial class MachineLoad : BasePage { - if (!Page.IsPostBack) - { - ((SiteContent)this.Master).showSearch = false; - } - cmp_stackLoading.eh_doRefresh += Cmp_stackLoading_eh_doRefresh; - } + protected void Page_Load(object sender, EventArgs e) + { + if (!Page.IsPostBack) + { + ((SiteContent)this.Master).showSearch = false; + } + forceRefresh(); + cmp_stackLoading.eh_doRefresh += Cmp_stackLoading_eh_doRefresh; + } - private void Cmp_stackLoading_eh_doRefresh(object sender, EventArgs e) - { - cmp_ML_ShDet.BatchId = cmp_stackLoading.BatchIdCurr; - cmp_ML_ShDet1.BatchId = cmp_stackLoading.BatchIdCurr; - cmp_ML_ShDet2.BatchId = cmp_stackLoading.BatchIdCurr; - cmp_ML_ShDet3.BatchId = cmp_stackLoading.BatchIdCurr; - // refresh vari! - cmp_ML_ShDet.doUpdate(); - cmp_ML_ShDet1.doUpdate(); - cmp_ML_ShDet2.doUpdate(); - cmp_ML_ShDet3.doUpdate(); + private void Cmp_stackLoading_eh_doRefresh(object sender, EventArgs e) + { + forceRefresh(); + } + + private void forceRefresh() + { + cmp_ML_ShDet.BatchId = cmp_stackLoading.BatchIdCurr; + cmp_ML_ShDet1.BatchId = cmp_stackLoading.BatchIdCurr; + cmp_ML_ShDet2.BatchId = cmp_stackLoading.BatchIdCurr; + cmp_ML_ShDet3.BatchId = cmp_stackLoading.BatchIdCurr; + // refresh vari! + cmp_ML_ShDet.doUpdate(); + cmp_ML_ShDet1.doUpdate(); + cmp_ML_ShDet2.doUpdate(); + cmp_ML_ShDet3.doUpdate(); + } } - } } \ No newline at end of file