From 0c481e51693f4dbd0253d03f3f6c4bad08a403f5 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Tue, 20 Jul 2021 15:42:36 +0200 Subject: [PATCH] Update x calcolo con ordine singolo + fix cancellazione a cascata --- .../WebUserControls/cmp_batchDetail.ascx.cs | 45 +++++-------------- .../cmp_batchDetailMongo.ascx.cs | 8 +++- .../cmp_batchDetailSplitInfo.ascx | 4 +- 3 files changed, 19 insertions(+), 38 deletions(-) diff --git a/NKC_WF/WebUserControls/cmp_batchDetail.ascx.cs b/NKC_WF/WebUserControls/cmp_batchDetail.ascx.cs index ea0222b..0074fa4 100644 --- a/NKC_WF/WebUserControls/cmp_batchDetail.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_batchDetail.ascx.cs @@ -121,40 +121,6 @@ namespace NKC_WF.WebUserControls { // effettuo VERA ri-assegnazione ordini/kit a nuovi batch DLMan.taOLT.setBatchSplit(BatchId, true); - -#if false - // invio il PRIMO batch descendant - var tabDesc = ComLib.BatchDescendant(BatchId); - if (tabDesc != null && tabDesc.Count > 0) - { - bool batchSent = false; - // ciclo fino a trovare un batch VALIDO (= contiene ordini) - foreach (var item in tabDesc) - { - // 2021.07.19 FIX x caso batch vuoto: se non ho pezzi --> approvo direttamente e passo al successivo... - var tabItems = DLMan.taIL.getByBatch(item.BatchID); - if (tabItems != null) - { - //--> approvo direttamente e passo al successivo... - if (tabItems.Count == 0) - { - // registro su DB batch DISCARDED (NON HA PEZZI...) - DLMan.taBL.updateStatus(item.BatchID, (int)BatchStatus.Discarded, "", -1); - } - // --> invio batch - else - { - ComLib.sendBatchReq(item.BatchID, "Nesting", 2, false); - // registro su DB nesting iniziato... - DLMan.taBL.updateStatus(item.BatchID, (int)BatchStatus.NestRequested, "", -1); - batchSent = true; - } - } - if (batchSent) - break; - } - } -#endif bool fatto = ComLib.checkSendBatchSplit(BatchId); } else @@ -174,6 +140,17 @@ namespace NKC_WF.WebUserControls ComLib.resetBatchReq(); // registro su DB nesting iniziato... DLMan.taBL.updateStatus(BatchId, (int)BatchStatus.Imported, "", -1); + if (BatchIsAncestor) + { + 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); + } + } + } raiseEvent(); } diff --git a/NKC_WF/WebUserControls/cmp_batchDetailMongo.ascx.cs b/NKC_WF/WebUserControls/cmp_batchDetailMongo.ascx.cs index 04ff5c3..2fe290c 100644 --- a/NKC_WF/WebUserControls/cmp_batchDetailMongo.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_batchDetailMongo.ascx.cs @@ -188,8 +188,12 @@ namespace NKC_WF.WebUserControls { // ordino le medie workRatio.Sort(); - // elimino le + basse quanti materiali ci sono... - workRatio.RemoveRange(0, materialsList.Count); + // controllo di averne + di 1... + if (workRatio.Count > materialsList.Count * 2) + { + // elimino le + basse quanti materiali ci sono... + workRatio.RemoveRange(0, materialsList.Count); + } double avgRatio = workRatio.Average(); double minRatio = workRatio.Min(); double maxRatio = workRatio.Max(); diff --git a/NKC_WF/WebUserControls/cmp_batchDetailSplitInfo.ascx b/NKC_WF/WebUserControls/cmp_batchDetailSplitInfo.ascx index cebd442..b126aa7 100644 --- a/NKC_WF/WebUserControls/cmp_batchDetailSplitInfo.ascx +++ b/NKC_WF/WebUserControls/cmp_batchDetailSplitInfo.ascx @@ -18,8 +18,8 @@
- <%# $"{Eval("Errors")} (tot: {Eval("NumErrPre")} err)" %> - <%# $"{Eval("Errors")} (tot: {Eval("NumErr")} err)" %> + <%# $"{Eval("Errors")} (tot: {Eval("NumErrPre")} err)" %> + <%# $"{Eval("Errors")} (tot: {Eval("NumErr")} err)" %>