diff --git a/NKC_WF/WebUserControls/cmp_ML_smart.ascx b/NKC_WF/WebUserControls/cmp_ML_smart.ascx index 3726c24..546cf81 100644 --- a/NKC_WF/WebUserControls/cmp_ML_smart.ascx +++ b/NKC_WF/WebUserControls/cmp_ML_smart.ascx @@ -1,15 +1,20 @@ <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="cmp_ML_smart.ascx.cs" Inherits="NKC_WF.WebUserControls.cmp_ML_smart" %> +<%@ Register Src="~/WebUserControls/cmp_barcode.ascx" TagPrefix="uc1" TagName="cmp_barcode" %> +

<%: traduci("MachineLoadSmart") %>

-
- BARCODE +
+ <%: traduci("StackLoaded") %>
- out messages + + + +
diff --git a/NKC_WF/WebUserControls/cmp_ML_smart.ascx.cs b/NKC_WF/WebUserControls/cmp_ML_smart.ascx.cs index b5a7214..c1b4716 100644 --- a/NKC_WF/WebUserControls/cmp_ML_smart.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_ML_smart.ascx.cs @@ -1,4 +1,6 @@ -using System; +using AppData; +using NKC_SDK; +using System; using System.Collections.Generic; using System.Linq; using System.Web; @@ -9,9 +11,208 @@ namespace NKC_WF.WebUserControls { public partial class cmp_ML_smart : BaseUserControl { + /// + /// Comando barcode letto + /// + protected string lastCmd + { + get + { + return hfBarcode.Value; + } + set + { + hfBarcode.Value = value; + } + } + public int BatchIdCurr + { + get + { + int answ = 0; + int.TryParse(hfBatchId.Value, out answ); + return answ; + } + set + { + hfBatchId.Value = value.ToString(); + } + } + public int StackId + { + set + { + hfStackId.Value = value.ToString(); + lastCmd = ""; + cmp_barcode.resetMessage(); + doUpdate(); + } + get + { + int answ = 0; + int.TryParse(hfStackId.Value, out answ); + return answ; + } + } protected void Page_Load(object sender, EventArgs e) { + if (!Page.IsPostBack) + { + // svuoto input barcode... + cmp_barcode.inputAcquired = ""; + lastCmd = ""; + raiseEvent(); + doUpdate(); + } + cmp_barcode.eh_doRefresh += Cmp_barcode_eh_doRefresh; + } + private void Cmp_barcode_eh_doRefresh(object sender, EventArgs e) + { + bool doRaiseEv = false; + // processo evento.. + lastCmd = cmp_barcode.inputAcquired.ToUpper(); + if (string.IsNullOrEmpty(lastCmd)) + { + doRaiseEv = true; + } + // processiamo barcode letto + decodedData decoData = DataLayer.man.decodeBcode(lastCmd); + switch (decoData.codeType) + { + case codeType.UNK: + cmp_barcode.showOutput("text-danger", $"Unknown Data: {decoData.rawData} --> no action"); + doRaiseEv = true; + break; + case codeType.Item: + case codeType.ItemGeneric: + cmp_barcode.showOutput("text-warning", $"Item - ignored: {decoData.description}"); + doRaiseEv = true; + break; + case codeType.Material: + cmp_barcode.showOutput("badge badge-warning", $"Material - ignored: {decoData.description}"); + doRaiseEv = true; + break; + case codeType.Sheet: + cmp_barcode.showOutput("badge badge-warning", $"Sheet - ignored: {decoData.description}"); + doRaiseEv = true; + break; + case codeType.Stack: + // verifico SE lo stack esista... + DS_App.StackListDataTable tabStack = DataLayer.man.taSTL.getByKey(decoData.codeInt); + if (tabStack.Count == 0) + { + cmp_barcode.showOutput("badge badge-danger", $"BUNK NOT FOUND: {decoData.description}"); + doRaiseEv = true; + } + else + { + // verifico non sia già in lavorazione + if (currentBunkAlreadyWorking(decoData.codeInt)) + { + cmp_barcode.showOutput("badge badge-success", $"BUNK in processing, {decoData.rawData}"); + doRaiseEv = true; + } + else + { + // controllo sia quello RICHIESTO + if (decoData.codeInt == cmp_stackNextloading.StackIdReq) + { + // controllo se il bunk richiesto sia stato caricato coi materiali... + if (!isBunkFilled(decoData.codeInt)) + { + cmp_barcode.showOutput("badge badge-danger", $"NEXT BUNK NOT PREPARED, {decoData.rawData}"); + doRaiseEv = true; + } + else + { + // verifico SE i BUNKS correnti siano tutti stati completati (NumSheet == NumWorking) + if (currentBunkPrinted) + { + cmp_barcode.showOutput("badge badge-success", $"BUNK OK, {decoData.rawData}"); + ComLib.taktMLCurrStack = decoData.code; + // processo DB e salvo che lo stack è stato caricato in MACHINE LOAD + int stackId = 0; + try + { + var tabStacks = DataLayer.man.taSTL.getByDtmx(decoData.rawData); + if (tabStack.Count == 1) + { + stackId = tabStack[0].StackID; + } + } + catch + { } + // SE HO uno stackId valido (>0)... + if (stackId > 0) + { + DataLayer.man.taSTL.updatePos(stackId, 5); + // controllo status del bunk nel suo insieme... + ComLib.updateBatchPositionByBunk(stackId); + doRaiseEv = true; + } + } + // altrimenti segnalo NON pronto x caricare prossimo + else + { + cmp_barcode.showOutput("badge badge-danger", $"PREV BUNK NOT COMPLETED, {decoData.rawData}"); + doRaiseEv = true; + } + } + } + else + { + cmp_barcode.showOutput("badge badge-danger", $"WRONG BUNK, {decoData.rawData}"); + doRaiseEv = true; + } + } + } + break; + case codeType.Batch: + cmp_barcode.showOutput("badge badge-warning", $"Batch - ignored: {decoData.description}"); + doRaiseEv = true; + break; + default: + doRaiseEv = true; + break; + } + // reset comando + cmp_barcode.resetInput(); + // aggiorno... + doUpdate(); + // se richiesto faccio raiseEvent + if (doRaiseEv) + { + cmp_stackNextloading.doUpdate(); + raiseEvent(); + } + } + protected bool currentBunkAlreadyWorking(int StackIdRequested) + { + bool answ = false; + // leggo i dati del bunk... + var currBunks = DataLayer.man.taSTL.getCurrByBatch(BatchIdCurr); + if (currBunks.Count > 0) + { + // verifico x ogni bunk corrente + foreach (var item in currBunks) + { + // verifico se numSheet = NumWorging + bool checkFound = item.StackID == StackIdRequested; + // update answ + answ = answ || checkFound; + } + } + return answ; + } + + public void doUpdate() + { + checkVisibility(); + } + protected void checkVisibility() + { + lblLoaded.Visible = StackId != 0; } } } \ No newline at end of file diff --git a/NKC_WF/WebUserControls/cmp_ML_smart.ascx.designer.cs b/NKC_WF/WebUserControls/cmp_ML_smart.ascx.designer.cs index 353a9cc..05fd64f 100644 --- a/NKC_WF/WebUserControls/cmp_ML_smart.ascx.designer.cs +++ b/NKC_WF/WebUserControls/cmp_ML_smart.ascx.designer.cs @@ -13,5 +13,50 @@ namespace NKC_WF.WebUserControls public partial class cmp_ML_smart { + + /// + /// Controllo lblLoaded. + /// + /// + /// 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.Label lblLoaded; + + /// + /// Controllo cmp_barcode. + /// + /// + /// Campo generato automaticamente. + /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// + protected global::NKC_WF.WebUserControls.cmp_barcode cmp_barcode; + + /// + /// Controllo hfBarcode. + /// + /// + /// 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 hfBarcode; + + /// + /// Controllo hfBatchId. + /// + /// + /// 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 hfBatchId; + + /// + /// Controllo hfStackId. + /// + /// + /// 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 hfStackId; } } diff --git a/NKC_WF/WebUserControls/cmp_stackLoading.ascx b/NKC_WF/WebUserControls/cmp_stackLoading.ascx index 7e8b620..2d88a09 100644 --- a/NKC_WF/WebUserControls/cmp_stackLoading.ascx +++ b/NKC_WF/WebUserControls/cmp_stackLoading.ascx @@ -14,8 +14,6 @@
- - <%: traduci("StackLoaded") %> @@ -47,6 +45,8 @@
+ +
diff --git a/NKC_WF/WebUserControls/cmp_stackLoading.ascx.designer.cs b/NKC_WF/WebUserControls/cmp_stackLoading.ascx.designer.cs index 865ffe1..ffc217f 100644 --- a/NKC_WF/WebUserControls/cmp_stackLoading.ascx.designer.cs +++ b/NKC_WF/WebUserControls/cmp_stackLoading.ascx.designer.cs @@ -11,88 +11,88 @@ namespace NKC_WF.WebUserControls { - public partial class cmp_stackLoading - { + public partial class cmp_stackLoading + { - /// - /// Controllo divSim. - /// - /// - /// Campo generato automaticamente. - /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. - /// - protected global::System.Web.UI.HtmlControls.HtmlGenericControl divSim; + /// + /// Controllo divSim. + /// + /// + /// Campo generato automaticamente. + /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// + protected global::System.Web.UI.HtmlControls.HtmlGenericControl divSim; - /// - /// Controllo lbtAdvanceProd. - /// - /// - /// 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.LinkButton lbtAdvanceProd; + /// + /// Controllo lbtAdvanceProd. + /// + /// + /// 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.LinkButton lbtAdvanceProd; - /// - /// Controllo hfBarcode. - /// - /// - /// 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 hfBarcode; + /// + /// Controllo lblLoaded. + /// + /// + /// 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.Label lblLoaded; - /// - /// Controllo hfStackId. - /// - /// - /// 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 hfStackId; + /// + /// Controllo frmView. + /// + /// + /// 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.FormView frmView; - /// - /// Controllo lblLoaded. - /// - /// - /// 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.Label lblLoaded; + /// + /// Controllo ods. + /// + /// + /// 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.ObjectDataSource ods; - /// - /// Controllo frmView. - /// - /// - /// 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.FormView frmView; + /// + /// Controllo cmp_barcode. + /// + /// + /// Campo generato automaticamente. + /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// + protected global::NKC_WF.WebUserControls.cmp_barcode cmp_barcode; - /// - /// Controllo ods. - /// - /// - /// 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.ObjectDataSource ods; + /// + /// Controllo hfBarcode. + /// + /// + /// 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 hfBarcode; - /// - /// Controllo cmp_barcode. - /// - /// - /// Campo generato automaticamente. - /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. - /// - protected global::NKC_WF.WebUserControls.cmp_barcode cmp_barcode; + /// + /// Controllo hfStackId. + /// + /// + /// 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 hfStackId; - /// - /// Controllo cmp_stackNextloading. - /// - /// - /// Campo generato automaticamente. - /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. - /// - protected global::NKC_WF.WebUserControls.cmp_stackNextloading cmp_stackNextloading; - } + /// + /// Controllo cmp_stackNextloading. + /// + /// + /// Campo generato automaticamente. + /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// + protected global::NKC_WF.WebUserControls.cmp_stackNextloading cmp_stackNextloading; + } }