From 5207c591ebad01bf6a57a735c98c116ff194cfac Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Tue, 17 Jun 2025 18:19:11 +0200 Subject: [PATCH] Aggiunta calcolo statistiche x materiale + cache in REDIS valori yeld calcolati --- AppData/AppData.csproj | 3 + AppData/DTO/BatchYeldStatDTO.cs | 24 + AppData/DTO/MaterialYeldStatsDTO.cs | 25 + AppData/DTO/SheetYeldStatDTO.cs | 22 + AppData/DataLayer.cs | 588 +++++++++++------- AppData/Objects.cs | 2 + NKC_WF/NKC_WF.csproj | 8 + .../WebUserControls/cmp_BP_MaterialYeld.ascx | 59 ++ .../cmp_BP_MaterialYeld.ascx.cs | 92 +++ .../cmp_BP_MaterialYeld.ascx.designer.cs | 35 ++ NKC_WF/WebUserControls/cmp_BP_sheetList.ascx | 31 +- NKC_WF/site/BatchPreview.aspx | 7 +- NKC_WF/site/BatchPreview.aspx.designer.cs | 9 + 13 files changed, 662 insertions(+), 243 deletions(-) create mode 100644 AppData/DTO/BatchYeldStatDTO.cs create mode 100644 AppData/DTO/MaterialYeldStatsDTO.cs create mode 100644 AppData/DTO/SheetYeldStatDTO.cs create mode 100644 NKC_WF/WebUserControls/cmp_BP_MaterialYeld.ascx create mode 100644 NKC_WF/WebUserControls/cmp_BP_MaterialYeld.ascx.cs create mode 100644 NKC_WF/WebUserControls/cmp_BP_MaterialYeld.ascx.designer.cs diff --git a/AppData/AppData.csproj b/AppData/AppData.csproj index 86a1916..ec70ec8 100644 --- a/AppData/AppData.csproj +++ b/AppData/AppData.csproj @@ -245,6 +245,9 @@ True DS_Report.xsd + + + diff --git a/AppData/DTO/BatchYeldStatDTO.cs b/AppData/DTO/BatchYeldStatDTO.cs new file mode 100644 index 0000000..add97f1 --- /dev/null +++ b/AppData/DTO/BatchYeldStatDTO.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AppData.DTO +{ + /// + /// Statistiche in termini di Yeld e quantità produzioni relative ad un singolo batch + /// + public class BatchYeldStatDTO + { + /// + /// Statistiche YELD aggregate per Material + /// + public List ListByMaterial { get; set; } = new List(); + + /// + /// Statistiche YELD aggregate per Sheet + /// + public List ListBySheet { get; set; } = new List(); + } +} diff --git a/AppData/DTO/MaterialYeldStatsDTO.cs b/AppData/DTO/MaterialYeldStatsDTO.cs new file mode 100644 index 0000000..e6513d2 --- /dev/null +++ b/AppData/DTO/MaterialYeldStatsDTO.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AppData.DTO +{ + /// + /// Statistiche resa materiali + /// + public class MaterialYeldStatsDTO + { + public int MatId { get; set; } = 0; + public int MatCode { get; set; } = 0; + public string MatDescript { get; set; } = ""; + + public int TotSheets { get; set; } = 0; + public int TotParts { get; set; } = 0; + + public double YeldMin { get; set; } = 0; + public double YeldAvg { get; set; } = 0; + public double YeldMax { get; set; } = 0; + } +} diff --git a/AppData/DTO/SheetYeldStatDTO.cs b/AppData/DTO/SheetYeldStatDTO.cs new file mode 100644 index 0000000..3e69a92 --- /dev/null +++ b/AppData/DTO/SheetYeldStatDTO.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AppData.DTO +{ + public class SheetYeldStatDTO + { + public int SheetId { get; set; } = 0; + public int MatId { get; set; } = 0; + public int MatCode { get; set; } = 0; + public string MatDescript { get; set; } = ""; + public int BunkIdx { get; set; } = 0; + public int SheetIdx { get; set; } = 0; + + public int NumParts { get; set; } = 0; + + public double Yeld { get; set; } = 0; + } +} diff --git a/AppData/DataLayer.cs b/AppData/DataLayer.cs index 5ce40d6..f88e192 100644 --- a/AppData/DataLayer.cs +++ b/AppData/DataLayer.cs @@ -1,7 +1,9 @@ -using Newtonsoft.Json; +using AppData.DTO; +using Newtonsoft.Json; using NKC_SDK; using SteamWare; using System; +using System.Collections.Generic; using System.Globalization; using System.Linq; @@ -81,12 +83,6 @@ namespace AppData #endregion Public Constructors - #region Protected Properties - - protected int cacheDataTTL { get; set; } = 2; - - #endregion Protected Properties - #region Public Properties public string CodSoggCurrUser @@ -107,189 +103,6 @@ namespace AppData #endregion Public Properties - #region Private Methods - - /// - /// verifica esistenza record da tipo doc + chiave... - /// - /// - /// - /// - private bool checkDoc(tipoDocumento tipoDoc, string keyParam) - { - bool answ = false; - int intIdx = 0; - switch (tipoDoc) - { - case tipoDocumento.docBinPre: - case tipoDocumento.docBinPost: - int.TryParse(keyParam, out intIdx); - var tabBinPre = taBN.getByKey(intIdx); - answ = tabBinPre.Count > 0; - break; - - case tipoDocumento.docCart: - case tipoDocumento.docCartIRK: - case tipoDocumento.docCartIRKSum: - int.TryParse(keyParam, out intIdx); - var tabCarts = taCR.getByKey(intIdx); - answ = tabCarts.Count > 0; - break; - - case tipoDocumento.docPart: - int.TryParse(keyParam, out intIdx); - var tabPart = taIL.getByKey(intIdx); - answ = tabPart.Count > 0; - break; - - case tipoDocumento.docOtherPart: - int.TryParse(keyParam, out intIdx); - var tabOtherPart = taOtItem.getByKey(intIdx); - answ = tabOtherPart.Count > 0; - break; - - case tipoDocumento.docStack: - int.TryParse(keyParam, out intIdx); - var tabStack = taSTL.getByKey(intIdx); - answ = tabStack.Count > 0; - break; - - case tipoDocumento.docCartSpecialPart: - int.TryParse(keyParam, out intIdx); - var tabSpecPart = taRepSpecPart.GetData(intIdx, "", ""); - answ = tabSpecPart.Count > 0; - break; - - case tipoDocumento.docND: - break; - - default: - break; - } - return answ; - } - - private void initTA() - { - taBL = new DS_AppTableAdapters.BatchListTableAdapter(); - taBN = new DS_AppTableAdapters.BinsTableAdapter(); - taBNLS = new DS_AppTableAdapters.BinListTableAdapter(); - taBStats = new DS_AppTableAdapters.BatchStatsTableAdapter(); - taCL = new DS_AppTableAdapters.CartsTableAdapter(); - taCOK = new DS_AppTableAdapters.CartOnKitTableAdapter(); - taCount = new DS_AppTableAdapters.CountersTableAdapter(); - taCR = new DS_AppTableAdapters.CartsTableAdapter(); - taDayStats = new DS_AppTableAdapters.ProductionStatsDayTableAdapter(); - taEL = new DS_AppTableAdapters.ErrorsLogTableAdapter(); - taFV = new DS_AppTableAdapters.FileValidationTableAdapter(); - taIL = new DS_AppTableAdapters.ItemListTableAdapter(); - taImpLog = new DS_AppTableAdapters.ImportLogTableAdapter(); - taISD = new DS_AppTableAdapters.ItemSearchDetailTableAdapter(); - taIV = new DS_AppTableAdapters.ItemValidationTableAdapter(); - taKL = new DS_AppTableAdapters.KitListTableAdapter(); - taMat = new DS_AppTableAdapters.MaterialsTableAdapter(); - taNest = new DS_AppTableAdapters.NestingTableAdapter(); - taOffOL = new DS_AppTableAdapters.OfflineOrderListTableAdapter(); - taOO2I = new DS_AppTableAdapters.OffOrd2ItemTableAdapter(); - taOKIB = new DS_AppTableAdapters.OKIBTableAdapter(); - taOKIB_Sum = new DS_AppTableAdapters.OKIB_SumTableAdapter(); - taOKOI = new DS_AppTableAdapters.OKOITableAdapter(); - taOKOI_Sum = new DS_AppTableAdapters.OKOI_sumTableAdapter(); - taOL = new DS_AppTableAdapters.OrderListTableAdapter(); - taOLT = new DS_AppTableAdapters.OrderListTreeTableAdapter(); - taOtItem = new DS_AppTableAdapters.OtherItemTableAdapter(); - taPL = new DS_AppTableAdapters.PackListTableAdapter(); - taPlac = new DS_AppTableAdapters.PlacesTableAdapter(); - taPlant = new DS_AppTableAdapters.PlantListTableAdapter(); - taPLC = new DS_AppTableAdapters.PackCheckTableAdapter(); - taPLD = new DS_AppTableAdapters.PackListDetTableAdapter(); - taPLog = new DS_AppTableAdapters.PackLogTableAdapter(); - taPVP = new DS_AppTableAdapters.PartValidParetoTableAdapter(); - taRem = new DS_AppTableAdapters.RemnantsTableAdapter(); - taStatDec = new DS_AppTableAdapters.StatusDecodeTableAdapter(); - taStatLog = new DS_AppTableAdapters.StatusLogTableAdapter(); - taSTL = new DS_AppTableAdapters.StackListTableAdapter(); - taSHL = new DS_AppTableAdapters.SheetListTableAdapter(); - taSP = new DS_AppTableAdapters.SheetsPreviewTableAdapter(); - taSpecialPart = new DS_AppTableAdapters.SpecialPartsTableAdapter(); - taElPos = new DS_ReportTableAdapters.ElencoPostazioniTableAdapter(); - taPJQ = new DS_ReportTableAdapters.PrintJobQueueTableAdapter(); - taRepBin = new DS_ReportTableAdapters.stp_prt_BinTableAdapter(); - taRepBunkGroup = new DS_ReportTableAdapters.stp_prt_BunkGroupTableAdapter(); - taRepBunkList = new DS_ReportTableAdapters.stp_prt_BunkListTableAdapter(); - taRepCart = new DS_ReportTableAdapters.stp_prt_CartTableAdapter(); - taRepPart = new DS_ReportTableAdapters.stp_prt_PartTableAdapter(); - taRepSpecPart = new DS_ReportTableAdapters.stp_prt_SpecialPartTableAdapter(); - taRepOtherPart = new DS_ReportTableAdapters.stp_prt_OtherPartTableAdapter(); - taRepIRK = new DS_ReportTableAdapters.stp_prt_IRKTableAdapter(); - taRepIRKSum = new DS_ReportTableAdapters.stp_prt_IRK_SumTableAdapter(); - taShStats = new DS_AppTableAdapters.SheetStatsTableAdapter(); - taUpdMan = new DS_AppTableAdapters.UpdManTableAdapter(); - taUStat = new DS_AppTableAdapters.UnloadStatsTableAdapter(); - } - - private void setupConnString() - { - string connString = memLayer.ML.confReadString("NKC_WFConnectionString"); - taBL.Connection.ConnectionString = connString; - taBN.Connection.ConnectionString = connString; - taBNLS.Connection.ConnectionString = connString; - taBStats.Connection.ConnectionString = connString; - taCL.Connection.ConnectionString = connString; - taCOK.Connection.ConnectionString = connString; - taCount.Connection.ConnectionString = connString; - taCR.Connection.ConnectionString = connString; - taDayStats.Connection.ConnectionString = connString; - taEL.Connection.ConnectionString = connString; - taFV.Connection.ConnectionString = connString; - taIL.Connection.ConnectionString = connString; - taImpLog.Connection.ConnectionString = connString; - taISD.Connection.ConnectionString = connString; - taIV.Connection.ConnectionString = connString; - taKL.Connection.ConnectionString = connString; - taMat.Connection.ConnectionString = connString; - taNest.Connection.ConnectionString = connString; - taOffOL.Connection.ConnectionString = connString; - taOO2I.Connection.ConnectionString = connString; - taOKIB.Connection.ConnectionString = connString; - taOKIB_Sum.Connection.ConnectionString = connString; - taOKOI.Connection.ConnectionString = connString; - taOKOI_Sum.Connection.ConnectionString = connString; - taOL.Connection.ConnectionString = connString; - taOLT.Connection.ConnectionString = connString; - taOtItem.Connection.ConnectionString = connString; - taPL.Connection.ConnectionString = connString; - taPlac.Connection.ConnectionString = connString; - taPlant.Connection.ConnectionString = connString; - taPLC.Connection.ConnectionString = connString; - taPLD.Connection.ConnectionString = connString; - taPLog.Connection.ConnectionString = connString; - taPVP.Connection.ConnectionString = connString; - taRem.Connection.ConnectionString = connString; - taStatDec.Connection.ConnectionString = connString; - taStatLog.Connection.ConnectionString = connString; - taSTL.Connection.ConnectionString = connString; - taSHL.Connection.ConnectionString = connString; - taSP.Connection.ConnectionString = connString; - taSpecialPart.Connection.ConnectionString = connString; - taElPos.Connection.ConnectionString = connString; - taPJQ.Connection.ConnectionString = connString; - taRepBin.Connection.ConnectionString = connString; - taRepBunkGroup.Connection.ConnectionString = connString; - taRepBunkList.Connection.ConnectionString = connString; - taRepCart.Connection.ConnectionString = connString; - taRepPart.Connection.ConnectionString = connString; - taRepSpecPart.Connection.ConnectionString = connString; - taRepOtherPart.Connection.ConnectionString = connString; - taRepIRK.Connection.ConnectionString = connString; - taRepIRKSum.Connection.ConnectionString = connString; - taShStats.Connection.ConnectionString = connString; - taUStat.Connection.ConnectionString = connString; - taUpdMan.Connection.ConnectionString = connString; - } - - #endregion Private Methods - #region Public Methods /// @@ -476,7 +289,6 @@ namespace AppData memLayer.ML.setRSV(redKey, rawData, cacheDataTTL); } - //restituisco valore.. return answ; } @@ -516,42 +328,6 @@ namespace AppData return answ; } - - /// - /// Restituisce tabella dati SpecialPart (con cache lungo periodo) - /// - /// - public DS_App.SpecialPartsDataTable getSpecialPart() - { - DS_App.SpecialPartsDataTable answ = new DS_App.SpecialPartsDataTable(); - // controllo cache - bool trovato = false; - string redKey = memLayer.ML.redHash($"SpecialPartsTable"); - string rawData = ""; - rawData = memLayer.ML.getRSV(redKey); - if (!string.IsNullOrEmpty(rawData)) - { - try - { - answ = JsonConvert.DeserializeObject(rawData); - trovato = true; - } - catch - { } - } - if (!trovato) - { - // se non trovo leggo - answ = taSpecialPart.GetData(); - rawData = JsonConvert.SerializeObject(answ); - // salvo in redis x periodo LUNGO - memLayer.ML.setRSV(redKey, rawData, cacheDataTTL * 60); - } - - //restituisco valore.. - return answ; - } - /// /// Recupera printer dato codPostazione /// @@ -589,6 +365,41 @@ namespace AppData return printer; } + /// + /// Restituisce tabella dati SpecialPart (con cache lungo periodo) + /// + /// + public DS_App.SpecialPartsDataTable getSpecialPart() + { + DS_App.SpecialPartsDataTable answ = new DS_App.SpecialPartsDataTable(); + // controllo cache + bool trovato = false; + string redKey = memLayer.ML.redHash($"SpecialPartsTable"); + string rawData = ""; + rawData = memLayer.ML.getRSV(redKey); + if (!string.IsNullOrEmpty(rawData)) + { + try + { + answ = JsonConvert.DeserializeObject(rawData); + trovato = true; + } + catch + { } + } + if (!trovato) + { + // se non trovo leggo + answ = taSpecialPart.GetData(); + rawData = JsonConvert.SerializeObject(answ); + // salvo in redis x periodo LUNGO + memLayer.ML.setRSV(redKey, rawData, cacheDataTTL * 60); + } + + //restituisco valore.. + return answ; + } + [System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Select, false)] public DS_App.UnloadStatsDataTable getUnloadStatsByBatch(int BatchID, int StatLevel) { @@ -621,6 +432,140 @@ namespace AppData return answ; } + [System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Select, false)] + public BatchYeldStatDTO getYeldStatsByBatch(int BatchID) + { + BatchYeldStatDTO answ = new BatchYeldStatDTO(); + // controllo cache + bool trovato = false; + string redKey = memLayer.ML.redHash($"YeldStatByBatch:{BatchID}"); + string rawData = ""; + rawData = memLayer.ML.getRSV(redKey); + if (!string.IsNullOrEmpty(rawData) && rawData.Count() > 2) + { + try + { + answ = JsonConvert.DeserializeObject(rawData); + trovato = true; + } + catch + { } + } + if (!trovato) + { + // se non trovo leggo + answ = GetYeldStatsFromMongoData(BatchID); + rawData = JsonConvert.SerializeObject(answ); + // salvo in redis con cache lunga (2 volte la minima...) + memLayer.ML.setRSV(redKey, rawData, cacheDataTTL * 2); + } + + return answ; + } + + /// + /// Recupera da MongoDB le risposte dal supervisor e calcola statistiche Batch + /// NB. statistiche per singolo Sheet ed aggregate x materiale + /// + /// ID del Batch di cui recuperare le info + public BatchYeldStatDTO GetYeldStatsFromMongoData(int BatchId) + { + BatchYeldStatDTO answ = new BatchYeldStatDTO(); + if (memLayer.ML.CRB("enableMongo")) + { + List ListByMaterialTemp = new List(); + List ListBySheetTemp = new List(); + // cerco da lista salvataggi Nest... + var nestAnsw = ComLib.man.getNestAnsw(BatchId); + // recupero bunk da DB + DataLayer dlMan = new DataLayer(); + var bunkList = taSTL.getByBatch(BatchId); + var listSheets = taSHL.getByBatch(BatchId, "ND"); + var matList = taMat.GetData(); + // elenchi x ricerca duplicati + List partListNest = new List(); + List partListNestDupl = new List(); + + if (nestAnsw != null) + { + double num = 0; + double den = 1; + double currRatio = 0; + try + { + if (nestAnsw.BunkList != null) + { + foreach (var bunk in nestAnsw.BunkList) + { + // procedo SOLO per il bunk corrente... + foreach (var sheet in bunk.SheetList) + { + num = sheet.SurfaceWork > 0 ? sheet.SurfaceWork : 0; + den = sheet.SurfaceTotal > 0 ? sheet.SurfaceTotal : 1; + currRatio = ComLib.ratioProt(num, den); + // recupero sheet dettaglio x materiale ed idx vari... + var rSheet = listSheets + .Where(x => x.SheetIndex == sheet.SheetIndex && x.StackIndex == bunk.BunkIndex) + .FirstOrDefault(); + if (rSheet != null) + { + var rMat = matList + .Where(x => x.MatID == rSheet.MatID) + .FirstOrDefault(); + var rSStat = ListBySheetTemp + .Where(x => x.SheetIdx == sheet.SheetIndex && x.BunkIdx == bunk.BunkIndex) + .FirstOrDefault(); + if (rSStat != null) + { + rSStat.Yeld = currRatio; + rSStat.NumParts = sheet.PartList.Count; + } + else + { + // recupero la riga x indicare il materiale... + + rSStat = new SheetYeldStatDTO() + { + SheetId = rSheet.SheetID, + MatId = rSheet.MatID, + MatCode = rMat.MatExtCode, + MatDescript = rMat.MatDesc, + BunkIdx = bunk.BunkIndex, + SheetIdx = sheet.SheetIndex, + NumParts = sheet.PartList.Count, + Yeld = currRatio + }; + ListBySheetTemp.Add(rSStat); + } + } + } + } + // ciclo nuovamente per i dati recuperati x aggregare x materiale... + ListByMaterialTemp = ListBySheetTemp + .GroupBy(x => x.MatId) + .Select(x => new MaterialYeldStatsDTO() + { + MatId = x.Key, + MatCode = x.FirstOrDefault().MatCode, + MatDescript = x.FirstOrDefault().MatDescript, + TotParts = x.Sum(p => p.NumParts), + TotSheets = x.Count(), + YeldAvg = x.Average(p => p.Yeld), + YeldMin = x.Min(p => p.Yeld), + YeldMax = x.Max(p => p.Yeld) + }).ToList(); + } + } + catch + { } + // salvo nell'oggetto + answ.ListBySheet = ListBySheetTemp; + answ.ListByMaterial = ListByMaterialTemp; + } + } + return answ; + } + /// /// effettua la stampa di un documento /// @@ -656,5 +601,194 @@ namespace AppData } #endregion Public Methods + + #region Protected Properties + + protected int cacheDataTTL { get; set; } = 2; + + #endregion Protected Properties + + #region Private Methods + + /// + /// verifica esistenza record da tipo doc + chiave... + /// + /// + /// + /// + private bool checkDoc(tipoDocumento tipoDoc, string keyParam) + { + bool answ = false; + int intIdx = 0; + switch (tipoDoc) + { + case tipoDocumento.docBinPre: + case tipoDocumento.docBinPost: + int.TryParse(keyParam, out intIdx); + var tabBinPre = taBN.getByKey(intIdx); + answ = tabBinPre.Count > 0; + break; + + case tipoDocumento.docCart: + case tipoDocumento.docCartIRK: + case tipoDocumento.docCartIRKSum: + int.TryParse(keyParam, out intIdx); + var tabCarts = taCR.getByKey(intIdx); + answ = tabCarts.Count > 0; + break; + + case tipoDocumento.docPart: + int.TryParse(keyParam, out intIdx); + var tabPart = taIL.getByKey(intIdx); + answ = tabPart.Count > 0; + break; + + case tipoDocumento.docOtherPart: + int.TryParse(keyParam, out intIdx); + var tabOtherPart = taOtItem.getByKey(intIdx); + answ = tabOtherPart.Count > 0; + break; + + case tipoDocumento.docStack: + int.TryParse(keyParam, out intIdx); + var tabStack = taSTL.getByKey(intIdx); + answ = tabStack.Count > 0; + break; + + case tipoDocumento.docCartSpecialPart: + int.TryParse(keyParam, out intIdx); + var tabSpecPart = taRepSpecPart.GetData(intIdx, "", ""); + answ = tabSpecPart.Count > 0; + break; + + case tipoDocumento.docND: + break; + + default: + break; + } + return answ; + } + + private void initTA() + { + taBL = new DS_AppTableAdapters.BatchListTableAdapter(); + taBN = new DS_AppTableAdapters.BinsTableAdapter(); + taBNLS = new DS_AppTableAdapters.BinListTableAdapter(); + taBStats = new DS_AppTableAdapters.BatchStatsTableAdapter(); + taCL = new DS_AppTableAdapters.CartsTableAdapter(); + taCOK = new DS_AppTableAdapters.CartOnKitTableAdapter(); + taCount = new DS_AppTableAdapters.CountersTableAdapter(); + taCR = new DS_AppTableAdapters.CartsTableAdapter(); + taDayStats = new DS_AppTableAdapters.ProductionStatsDayTableAdapter(); + taEL = new DS_AppTableAdapters.ErrorsLogTableAdapter(); + taFV = new DS_AppTableAdapters.FileValidationTableAdapter(); + taIL = new DS_AppTableAdapters.ItemListTableAdapter(); + taImpLog = new DS_AppTableAdapters.ImportLogTableAdapter(); + taISD = new DS_AppTableAdapters.ItemSearchDetailTableAdapter(); + taIV = new DS_AppTableAdapters.ItemValidationTableAdapter(); + taKL = new DS_AppTableAdapters.KitListTableAdapter(); + taMat = new DS_AppTableAdapters.MaterialsTableAdapter(); + taNest = new DS_AppTableAdapters.NestingTableAdapter(); + taOffOL = new DS_AppTableAdapters.OfflineOrderListTableAdapter(); + taOO2I = new DS_AppTableAdapters.OffOrd2ItemTableAdapter(); + taOKIB = new DS_AppTableAdapters.OKIBTableAdapter(); + taOKIB_Sum = new DS_AppTableAdapters.OKIB_SumTableAdapter(); + taOKOI = new DS_AppTableAdapters.OKOITableAdapter(); + taOKOI_Sum = new DS_AppTableAdapters.OKOI_sumTableAdapter(); + taOL = new DS_AppTableAdapters.OrderListTableAdapter(); + taOLT = new DS_AppTableAdapters.OrderListTreeTableAdapter(); + taOtItem = new DS_AppTableAdapters.OtherItemTableAdapter(); + taPL = new DS_AppTableAdapters.PackListTableAdapter(); + taPlac = new DS_AppTableAdapters.PlacesTableAdapter(); + taPlant = new DS_AppTableAdapters.PlantListTableAdapter(); + taPLC = new DS_AppTableAdapters.PackCheckTableAdapter(); + taPLD = new DS_AppTableAdapters.PackListDetTableAdapter(); + taPLog = new DS_AppTableAdapters.PackLogTableAdapter(); + taPVP = new DS_AppTableAdapters.PartValidParetoTableAdapter(); + taRem = new DS_AppTableAdapters.RemnantsTableAdapter(); + taStatDec = new DS_AppTableAdapters.StatusDecodeTableAdapter(); + taStatLog = new DS_AppTableAdapters.StatusLogTableAdapter(); + taSTL = new DS_AppTableAdapters.StackListTableAdapter(); + taSHL = new DS_AppTableAdapters.SheetListTableAdapter(); + taSP = new DS_AppTableAdapters.SheetsPreviewTableAdapter(); + taSpecialPart = new DS_AppTableAdapters.SpecialPartsTableAdapter(); + taElPos = new DS_ReportTableAdapters.ElencoPostazioniTableAdapter(); + taPJQ = new DS_ReportTableAdapters.PrintJobQueueTableAdapter(); + taRepBin = new DS_ReportTableAdapters.stp_prt_BinTableAdapter(); + taRepBunkGroup = new DS_ReportTableAdapters.stp_prt_BunkGroupTableAdapter(); + taRepBunkList = new DS_ReportTableAdapters.stp_prt_BunkListTableAdapter(); + taRepCart = new DS_ReportTableAdapters.stp_prt_CartTableAdapter(); + taRepPart = new DS_ReportTableAdapters.stp_prt_PartTableAdapter(); + taRepSpecPart = new DS_ReportTableAdapters.stp_prt_SpecialPartTableAdapter(); + taRepOtherPart = new DS_ReportTableAdapters.stp_prt_OtherPartTableAdapter(); + taRepIRK = new DS_ReportTableAdapters.stp_prt_IRKTableAdapter(); + taRepIRKSum = new DS_ReportTableAdapters.stp_prt_IRK_SumTableAdapter(); + taShStats = new DS_AppTableAdapters.SheetStatsTableAdapter(); + taUpdMan = new DS_AppTableAdapters.UpdManTableAdapter(); + taUStat = new DS_AppTableAdapters.UnloadStatsTableAdapter(); + } + + private void setupConnString() + { + string connString = memLayer.ML.confReadString("NKC_WFConnectionString"); + taBL.Connection.ConnectionString = connString; + taBN.Connection.ConnectionString = connString; + taBNLS.Connection.ConnectionString = connString; + taBStats.Connection.ConnectionString = connString; + taCL.Connection.ConnectionString = connString; + taCOK.Connection.ConnectionString = connString; + taCount.Connection.ConnectionString = connString; + taCR.Connection.ConnectionString = connString; + taDayStats.Connection.ConnectionString = connString; + taEL.Connection.ConnectionString = connString; + taFV.Connection.ConnectionString = connString; + taIL.Connection.ConnectionString = connString; + taImpLog.Connection.ConnectionString = connString; + taISD.Connection.ConnectionString = connString; + taIV.Connection.ConnectionString = connString; + taKL.Connection.ConnectionString = connString; + taMat.Connection.ConnectionString = connString; + taNest.Connection.ConnectionString = connString; + taOffOL.Connection.ConnectionString = connString; + taOO2I.Connection.ConnectionString = connString; + taOKIB.Connection.ConnectionString = connString; + taOKIB_Sum.Connection.ConnectionString = connString; + taOKOI.Connection.ConnectionString = connString; + taOKOI_Sum.Connection.ConnectionString = connString; + taOL.Connection.ConnectionString = connString; + taOLT.Connection.ConnectionString = connString; + taOtItem.Connection.ConnectionString = connString; + taPL.Connection.ConnectionString = connString; + taPlac.Connection.ConnectionString = connString; + taPlant.Connection.ConnectionString = connString; + taPLC.Connection.ConnectionString = connString; + taPLD.Connection.ConnectionString = connString; + taPLog.Connection.ConnectionString = connString; + taPVP.Connection.ConnectionString = connString; + taRem.Connection.ConnectionString = connString; + taStatDec.Connection.ConnectionString = connString; + taStatLog.Connection.ConnectionString = connString; + taSTL.Connection.ConnectionString = connString; + taSHL.Connection.ConnectionString = connString; + taSP.Connection.ConnectionString = connString; + taSpecialPart.Connection.ConnectionString = connString; + taElPos.Connection.ConnectionString = connString; + taPJQ.Connection.ConnectionString = connString; + taRepBin.Connection.ConnectionString = connString; + taRepBunkGroup.Connection.ConnectionString = connString; + taRepBunkList.Connection.ConnectionString = connString; + taRepCart.Connection.ConnectionString = connString; + taRepPart.Connection.ConnectionString = connString; + taRepSpecPart.Connection.ConnectionString = connString; + taRepOtherPart.Connection.ConnectionString = connString; + taRepIRK.Connection.ConnectionString = connString; + taRepIRKSum.Connection.ConnectionString = connString; + taShStats.Connection.ConnectionString = connString; + taUStat.Connection.ConnectionString = connString; + taUpdMan.Connection.ConnectionString = connString; + } + + #endregion Private Methods } } \ No newline at end of file diff --git a/AppData/Objects.cs b/AppData/Objects.cs index cebb98c..3b20485 100644 --- a/AppData/Objects.cs +++ b/AppData/Objects.cs @@ -93,4 +93,6 @@ namespace AppData #endregion Public Properties } + + } \ No newline at end of file diff --git a/NKC_WF/NKC_WF.csproj b/NKC_WF/NKC_WF.csproj index c1d8d27..8ee825f 100644 --- a/NKC_WF/NKC_WF.csproj +++ b/NKC_WF/NKC_WF.csproj @@ -534,6 +534,7 @@ + @@ -1282,6 +1283,13 @@ cmp_BP_bunkList.ascx + + cmp_BP_MaterialYeld.ascx + ASPXCodeBehind + + + cmp_BP_MaterialYeld.ascx + cmp_BP_sheetList.ascx ASPXCodeBehind diff --git a/NKC_WF/WebUserControls/cmp_BP_MaterialYeld.ascx b/NKC_WF/WebUserControls/cmp_BP_MaterialYeld.ascx new file mode 100644 index 0000000..7546665 --- /dev/null +++ b/NKC_WF/WebUserControls/cmp_BP_MaterialYeld.ascx @@ -0,0 +1,59 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="cmp_BP_MaterialYeld.ascx.cs" Inherits="NKC_WF.WebUserControls.cmp_BP_MaterialYeld" %> + +Material's YELD + + + + + + + <%: traduci("NoRecord") %> + + + + + +
+ +
+
+ +
+
+ +
+ + +
+ Sheets + + +
+
+ Parts + + +
+
+ +
+ + +
+ Avg + + +
+
+ + + ... + + +
+
+ +
+
+
+ diff --git a/NKC_WF/WebUserControls/cmp_BP_MaterialYeld.ascx.cs b/NKC_WF/WebUserControls/cmp_BP_MaterialYeld.ascx.cs new file mode 100644 index 0000000..9c1738e --- /dev/null +++ b/NKC_WF/WebUserControls/cmp_BP_MaterialYeld.ascx.cs @@ -0,0 +1,92 @@ +using AppData; +using SteamWare; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace NKC_WF.WebUserControls +{ + public partial class cmp_BP_MaterialYeld : BaseUserControl + { + #region Public Properties + + /// + /// Batch corrente... + /// + public int BatchId + { + get + { + int answ = memLayer.ML.QSI("BatchId"); + return answ; + } + } + + #endregion Public Properties + + #region Public Methods + + public List GetMatStatList() + { + DataLayer DLMan = new DataLayer(); + MatStatList = new List(); + var statData = DLMan.GetYeldStatsFromMongoData(BatchId); + if (statData != null) + { + MatStatList = statData.ListByMaterial; + } +#if false + Random rnd = new Random(); + for (int i = 0; i < 5; i++) + { + var randDbl = rnd.NextDouble(); + MatStatList.Add(new NKC_WF.DTO.MaterialStats() { MatCode = $"{i * 100:00000}", MatDescript = $"Descrizione {i:00}", TotSheets = rnd.Next(10), TotParts = 50 * rnd.Next(1, 5), YeldAvg = randDbl, YeldMin = randDbl / 2, YeldMax = 1 - (1 - randDbl) / 2 }); + } +#endif + return MatStatList; + } + + #endregion Public Methods + + #region Protected Fields + + protected List MatStatList = new List(); + + /// + /// Tabella dei dati di quante part siano presenti x foglio recuperato dai dati nesting da mongoDB + /// + protected Dictionary SheetPartQty = new Dictionary(); + + /// + /// Tabella dei dati di resa (Yeald) x foglio recuperato dai dati nesting da mongoDB + /// + protected Dictionary SheetYeld = new Dictionary(); + + #endregion Protected Fields + + #region Protected Methods + + protected void Page_Load(object sender, EventArgs e) + { + ReloadData(); + } + + #endregion Protected Methods + + #region Private Methods + + /// + /// Legge da redis, se non trovasse legge da mongoDB e salva in redis come cache... + /// + private void ReloadData() + { + grView.DataBind(); + } + + #endregion Private Methods + + } +} \ No newline at end of file diff --git a/NKC_WF/WebUserControls/cmp_BP_MaterialYeld.ascx.designer.cs b/NKC_WF/WebUserControls/cmp_BP_MaterialYeld.ascx.designer.cs new file mode 100644 index 0000000..62a519b --- /dev/null +++ b/NKC_WF/WebUserControls/cmp_BP_MaterialYeld.ascx.designer.cs @@ -0,0 +1,35 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace NKC_WF.WebUserControls +{ + + + public partial class cmp_BP_MaterialYeld + { + + /// + /// grView control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.GridView grView; + + /// + /// ods control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.ObjectDataSource ods; + } +} diff --git a/NKC_WF/WebUserControls/cmp_BP_sheetList.ascx b/NKC_WF/WebUserControls/cmp_BP_sheetList.ascx index a18898a..06dca24 100644 --- a/NKC_WF/WebUserControls/cmp_BP_sheetList.ascx +++ b/NKC_WF/WebUserControls/cmp_BP_sheetList.ascx @@ -16,20 +16,22 @@ - + - + -
-
+
+
-
+
-
+
+
+
@@ -37,16 +39,19 @@ -
-
+
+
-
-
-
- P: +
+ ()
-
+
+
+
+ Y: +
+
diff --git a/NKC_WF/site/BatchPreview.aspx b/NKC_WF/site/BatchPreview.aspx index f917f8d..4bbb3e8 100644 --- a/NKC_WF/site/BatchPreview.aspx +++ b/NKC_WF/site/BatchPreview.aspx @@ -4,23 +4,24 @@ <%@ Register Src="~/WebUserControls/cmp_MU_svgViewer.ascx" TagPrefix="uc1" TagName="cmp_MU_svgViewer" %> <%@ Register Src="~/WebUserControls/cmp_BP_sheetList.ascx" TagPrefix="uc1" TagName="cmp_BP_sheetList" %> <%@ Register Src="~/WebUserControls/cmp_slider.ascx" TagPrefix="uc1" TagName="cmp_slider" %> +<%@ Register Src="~/WebUserControls/cmp_BP_MaterialYeld.ascx" TagPrefix="uc1" TagName="cmp_BP_MaterialYeld" %> -
+
-
+

<%# traduci("BatchPreview") %>

-
+
diff --git a/NKC_WF/site/BatchPreview.aspx.designer.cs b/NKC_WF/site/BatchPreview.aspx.designer.cs index 855ccbb..32cd717 100644 --- a/NKC_WF/site/BatchPreview.aspx.designer.cs +++ b/NKC_WF/site/BatchPreview.aspx.designer.cs @@ -41,6 +41,15 @@ namespace NKC_WF.site /// protected global::NKC_WF.WebUserControls.cmp_BP_bunkList cmp_BP_bunkList; + /// + /// cmp_BP_MaterialYeld control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::NKC_WF.WebUserControls.cmp_BP_MaterialYeld cmp_BP_MaterialYeld; + /// /// cmp_slider control. ///