From 2e54ed3af7256709dd4ac77e4135a224a75b3fe7 Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Mon, 13 Jul 2020 16:52:28 +0200 Subject: [PATCH] OK caricamento singoilo bunk richiesto --- .../WebUserControls/cmp_stackLoading.ascx.cs | 94 ++++++++++++------- 1 file changed, 60 insertions(+), 34 deletions(-) diff --git a/NKC_WF/WebUserControls/cmp_stackLoading.ascx.cs b/NKC_WF/WebUserControls/cmp_stackLoading.ascx.cs index 8f46516..18bed2a 100644 --- a/NKC_WF/WebUserControls/cmp_stackLoading.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_stackLoading.ascx.cs @@ -107,44 +107,52 @@ namespace NKC_WF.WebUserControls } else { - // controllo sia quello RICHIESTO, eventualmente permetteremo TUTTI quelli del giorno in ogni ordine... - if (decoData.codeInt == cmp_stackNextloading.StackIdReq) + // verifico non sia già in lavorazione + if (currentBunkAlreadyWorking(decoData.codeInt)) { - // 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}"); - } + cmp_barcode.showOutput("badge badge-success", $"BUNK in processing, {decoData.rawData}"); } else { - cmp_barcode.showOutput("badge badge-danger", $"WRONG BUNK, {decoData.rawData}"); + // controllo sia quello RICHIESTO + if (decoData.codeInt == cmp_stackNextloading.StackIdReq) + { + // 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}"); + } + } + else + { + cmp_barcode.showOutput("badge badge-danger", $"WRONG BUNK, {decoData.rawData}"); + } } } break; @@ -167,7 +175,25 @@ namespace NKC_WF.WebUserControls 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; + } protected bool currentBunkPrinted { get