diff --git a/.editorconfig b/.editorconfig index 32a8a48..73e79f3 100644 --- a/.editorconfig +++ b/.editorconfig @@ -2,3 +2,36 @@ # IDE0058: Il valore dell'espressione non viene mai usato csharp_style_unused_value_expression_statement_preference = discard_variable:none + +# IDE1006: Stili di denominazione +dotnet_diagnostic.IDE1006.severity = none + +# CA5368: Impostare ViewStateUserKey per classi derivate da Page +dotnet_diagnostic.CA5368.severity = none + +# CA1707: Gli identificatori non devono contenere caratteri di sottolineatura +dotnet_diagnostic.CA1707.severity = none + +# CA1822: Contrassegnare i membri come static +dotnet_diagnostic.CA1822.severity = none + +# CA1051: Non dichiarare campi di istanza visibili +dotnet_diagnostic.CA1051.severity = none + +# IDE0055: Correggi formattazione +dotnet_diagnostic.IDE0055.severity = none + +# CA1305: Specificare IFormatProvider +dotnet_diagnostic.CA1305.severity = none + +# IDE0071: Semplifica l'interpolazione +dotnet_style_prefer_simplified_interpolation = true:none + +# Default severity for analyzer diagnostics with category 'Globalization' +dotnet_analyzer_diagnostic.category-Globalization.severity = none + +# CA1806: Non ignorare i risultati del metodo +dotnet_diagnostic.CA1806.severity = none + +# Default severity for analyzer diagnostics with category 'Design' +dotnet_analyzer_diagnostic.category-Design.severity = none diff --git a/Jenkinsfile b/Jenkinsfile index f5474a0..6e73a80 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -11,7 +11,7 @@ pipeline { steps { /* calcolo numero versione... diverso x branch MASTER/DEVELOP */ script { - withEnv(['NEXT_BUILD_NUMBER=280']) { + withEnv(['NEXT_BUILD_NUMBER=281']) { // env.versionNumber = VersionNumber(versionNumberString : '0.9.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2019-07-01', skipFailedBuilds: true) env.versionNumber = VersionNumber(versionNumberString : '0.9.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2019-07-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}') env.versionNumberBeta = VersionNumber(versionNumberString : '0.9.${BUILD_DATE_FORMATTED, "yyMM"}-beta.${BUILDS_ALL_TIME}', projectStartDate : '2019-07-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}') diff --git a/NKC_WF/App_Start/BundleConfig.cs b/NKC_WF/App_Start/BundleConfig.cs index ae2f6ec..bc02923 100644 --- a/NKC_WF/App_Start/BundleConfig.cs +++ b/NKC_WF/App_Start/BundleConfig.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using System.Web.Optimization; -using System.Web.UI; +using System.Web.Optimization; namespace NKC_WF { diff --git a/NKC_WF/App_Start/FilterConfig.cs b/NKC_WF/App_Start/FilterConfig.cs index 66e972f..0fadbb7 100644 --- a/NKC_WF/App_Start/FilterConfig.cs +++ b/NKC_WF/App_Start/FilterConfig.cs @@ -2,11 +2,11 @@ namespace NKC_WF { - public class FilterConfig - { - public static void RegisterGlobalFilters(GlobalFilterCollection filters) + public class FilterConfig { - filters.Add(new HandleErrorAttribute()); + public static void RegisterGlobalFilters(GlobalFilterCollection filters) + { + filters.Add(new HandleErrorAttribute()); + } } - } } diff --git a/NKC_WF/App_Start/RouteConfig.cs b/NKC_WF/App_Start/RouteConfig.cs index 0cf871b..574d715 100644 --- a/NKC_WF/App_Start/RouteConfig.cs +++ b/NKC_WF/App_Start/RouteConfig.cs @@ -4,31 +4,31 @@ using System.Web.Routing; namespace NKC_WF { - public static class RouteConfig - { - public static void RegisterRoutes(RouteCollection routes) + public static class RouteConfig { - var settings = new FriendlyUrlSettings(); - settings.AutoRedirectMode = RedirectMode.Permanent; - routes.EnableFriendlyUrls(settings); + public static void RegisterRoutes(RouteCollection routes) + { + var settings = new FriendlyUrlSettings(); + settings.AutoRedirectMode = RedirectMode.Permanent; + routes.EnableFriendlyUrls(settings); - routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); - - // route default URL to index.aspx - routes.MapPageRoute( - routeName: "DefaultToHTML", - routeUrl: "", - physicalFile: "~/Default.aspx", - checkPhysicalUrlAccess: false, - defaults: new RouteValueDictionary(), - constraints: new RouteValueDictionary { { "placeholder", "" } } - ); + routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); - routes.MapRoute( - name: "Default", - url: "{controller}/{action}/{id}", - defaults: new { controller = "Browser", action = "Index", id = UrlParameter.Optional } - ); + // route default URL to index.aspx + routes.MapPageRoute( + routeName: "DefaultToHTML", + routeUrl: "", + physicalFile: "~/Default.aspx", + checkPhysicalUrlAccess: false, + defaults: new RouteValueDictionary(), + constraints: new RouteValueDictionary { { "placeholder", "" } } + ); + + routes.MapRoute( + name: "Default", + url: "{controller}/{action}/{id}", + defaults: new { controller = "Browser", action = "Index", id = UrlParameter.Optional } + ); + } } - } } diff --git a/NKC_WF/App_Start/WebApiConfig.cs b/NKC_WF/App_Start/WebApiConfig.cs index b650a84..da552dc 100644 --- a/NKC_WF/App_Start/WebApiConfig.cs +++ b/NKC_WF/App_Start/WebApiConfig.cs @@ -2,20 +2,20 @@ namespace NKC_WF { - public static class WebApiConfig - { - public static void Register(HttpConfiguration config) + public static class WebApiConfig { - // Servizi e configurazione dell'API Web + public static void Register(HttpConfiguration config) + { + // Servizi e configurazione dell'API Web - // Route dell'API Web - config.MapHttpAttributeRoutes(); + // Route dell'API Web + config.MapHttpAttributeRoutes(); - config.Routes.MapHttpRoute( - name: "DefaultApi", - routeTemplate: "api/{controller}/{id}", - defaults: new { id = RouteParameter.Optional } - ); + config.Routes.MapHttpRoute( + name: "DefaultApi", + routeTemplate: "api/{controller}/{id}", + defaults: new { id = RouteParameter.Optional } + ); + } } - } } diff --git a/NKC_WF/BasePage.cs b/NKC_WF/BasePage.cs index 338b565..86bdf2a 100644 --- a/NKC_WF/BasePage.cs +++ b/NKC_WF/BasePage.cs @@ -1,22 +1,15 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using System.Web.UI; -using System.Web.UI.WebControls; - -namespace NKC_WF +namespace NKC_WF { - public class BasePage : System.Web.UI.Page - { - /// - /// Wrapper traduzione termini - /// - /// - /// - public string traduci(string lemma) + public class BasePage : System.Web.UI.Page { - return SteamWare.user_std.UtSn.Traduci(lemma); + /// + /// Wrapper traduzione termini + /// + /// + /// + public string traduci(string lemma) + { + return SteamWare.user_std.UtSn.Traduci(lemma); + } } - } } \ No newline at end of file diff --git a/NKC_WF/BaseUserControl.cs b/NKC_WF/BaseUserControl.cs index 1c75a29..36dee73 100644 --- a/NKC_WF/BaseUserControl.cs +++ b/NKC_WF/BaseUserControl.cs @@ -6,92 +6,92 @@ using System.Collections.Generic; namespace NKC_WF { - public class BaseUserControl : System.Web.UI.UserControl - { - /// - /// Generico evento di richiesta refresh a aprent - /// - public event EventHandler eh_doRefresh; - /// - /// Generico evento di richiesta refresh a aprent - /// - public event EventHandler eh_doReset; - /// - /// Chiamata evento - /// - public void raiseEvent() + public class BaseUserControl : System.Web.UI.UserControl { - // se qualcuno ascolta sollevo evento nuovo valore... - if (eh_doRefresh != null) - { - eh_doRefresh(this, new EventArgs()); - } - } - /// - /// Chiamata evento - /// - public void raiseReset() - { - // se qualcuno ascolta sollevo evento nuovo valore... - if (eh_doReset != null) - { - eh_doReset(this, new EventArgs()); - } - } - /// - /// Wrapper traduzione termini - /// - /// - /// - public string traduci(string lemma) - { - return SteamWare.user_std.UtSn.Traduci(lemma); - } - - protected Dictionary anagMateriali - { - set - { - string jsonData = JsonConvert.SerializeObject(value); - memLayer.ML.setRSV("anagMateriali", jsonData, 60); - } - get - { - Dictionary answ = new Dictionary(); - //cerco in redis... - string rawData = memLayer.ML.getRSV("anagMateriali"); - if (!string.IsNullOrEmpty(rawData)) + /// + /// Generico evento di richiesta refresh a aprent + /// + public event EventHandler eh_doRefresh; + /// + /// Generico evento di richiesta refresh a aprent + /// + public event EventHandler eh_doReset; + /// + /// Chiamata evento + /// + public void raiseEvent() { - answ = JsonConvert.DeserializeObject>(rawData); + // se qualcuno ascolta sollevo evento nuovo valore... + if (eh_doRefresh != null) + { + eh_doRefresh(this, new EventArgs()); + } } - // sennò nel DB e salvo in redis... - else + /// + /// Chiamata evento + /// + public void raiseReset() { - var tabMat = DataLayer.man.taMat.GetData(); - foreach (var item in tabMat) - { - answ.Add(item.MatID, item.MatDesc); - } - // salvo in redis - anagMateriali = answ; + // se qualcuno ascolta sollevo evento nuovo valore... + if (eh_doReset != null) + { + eh_doReset(this, new EventArgs()); + } + } + /// + /// Wrapper traduzione termini + /// + /// + /// + public string traduci(string lemma) + { + return SteamWare.user_std.UtSn.Traduci(lemma); } - // restituisco - return answ; - } - } - public string matByKey(object _matId) - { - string answ = ""; - int matId = 0; - int.TryParse(_matId.ToString(), out matId); - try - { - answ = anagMateriali[matId]; - } - catch - { } - return answ; + protected Dictionary anagMateriali + { + set + { + string jsonData = JsonConvert.SerializeObject(value); + memLayer.ML.setRSV("anagMateriali", jsonData, 60); + } + get + { + Dictionary answ = new Dictionary(); + //cerco in redis... + string rawData = memLayer.ML.getRSV("anagMateriali"); + if (!string.IsNullOrEmpty(rawData)) + { + answ = JsonConvert.DeserializeObject>(rawData); + } + // sennò nel DB e salvo in redis... + else + { + var tabMat = DataLayer.man.taMat.GetData(); + foreach (var item in tabMat) + { + answ.Add(item.MatID, item.MatDesc); + } + // salvo in redis + anagMateriali = answ; + } + // restituisco + return answ; + } + } + + public string matByKey(object _matId) + { + string answ = ""; + int matId = 0; + int.TryParse(_matId.ToString(), out matId); + try + { + answ = anagMateriali[matId]; + } + catch + { } + return answ; + } } - } } \ No newline at end of file diff --git a/NKC_WF/Controllers/AliveController.cs b/NKC_WF/Controllers/AliveController.cs index cd34f69..730fd50 100644 --- a/NKC_WF/Controllers/AliveController.cs +++ b/NKC_WF/Controllers/AliveController.cs @@ -3,24 +3,24 @@ using System.Web.Http; namespace NKC_WF.Controllers { - /// - /// Classe verifica stato ALIVE del servizio - /// - public class AliveController : ApiController - { - // GET: api/Alive - [HttpGet] - public string Get() + /// + /// Classe verifica stato ALIVE del servizio + /// + public class AliveController : ApiController { - return "OK"; - } + // GET: api/Alive + [HttpGet] + public string Get() + { + return "OK"; + } - // GET: api/Alive/Clock - [HttpGet] - public string Get(int id) - { - return DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); - } + // GET: api/Alive/Clock + [HttpGet] + public string Get(int id) + { + return DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); + } - } + } } diff --git a/NKC_WF/Controllers/BatchProcController.cs b/NKC_WF/Controllers/BatchProcController.cs index 1b02751..e06bd62 100644 --- a/NKC_WF/Controllers/BatchProcController.cs +++ b/NKC_WF/Controllers/BatchProcController.cs @@ -8,302 +8,302 @@ using System.Web.Http; namespace NKC_WF.Controllers { - public class BatchProcController : ApiController - { - - /// - /// Restituisce SE C'E' la richiesta di elaborazione BATCH corrente - /// - /// - // GET: api/BatchProc - [HttpGet] - public batchRequest Get() + public class BatchProcController : ApiController { - batchRequest answ = new batchRequest(); - string redKey = ""; - string redVal = ""; - // in primis: controllo su redis SE HO una richiesta CURRENT di processing... - string envNum = ComLib.currBatchReq; - // se c'è carico "la busta" come ID - if (!string.IsNullOrEmpty(envNum)) - { - // cerco in REDIS se ci sia l'item richiesto - redKey = $"{ComLib.redOutPath}:{envNum}"; - // leggo da redis la stringa... - redVal = memLayer.ML.getRSV(redKey); - // PROVO a deserializzare... - try - { - answ = JsonConvert.DeserializeObject(redVal); - // aggiungo LA SUA ENV NUM!!!! - answ.EnvNum = envNum; - } - catch - { } - } - // altrimenti NULL! - else - { - answ = null; - } - return answ; - } - /// - /// Restituisce UNA SPECIFICA richiesta di elaborazione BATCH - /// - /// - // GET: api/BatchProc/5 - [HttpGet] - public batchRequest Get(int id) - { - batchRequest answ = new batchRequest(); - // in primis: controllo su redis SE HO una richiista CURRENT di processing... - string redKey = $"{ComLib.redOutPath}:{id}"; - string redVal = memLayer.ML.getRSV(redKey); - // se c'è carico "la busta" come ID - if (!string.IsNullOrEmpty(redVal)) - { - // PROVO a deserializzare... - try + /// + /// Restituisce SE C'E' la richiesta di elaborazione BATCH corrente + /// + /// + // GET: api/BatchProc + [HttpGet] + public batchRequest Get() { - answ = JsonConvert.DeserializeObject(redVal); - } - catch - { } - } - return answ; - } - - /// - /// Processa una chiamata POST per l'invio in blocco Batch - /// POST: api/BatchProc - /// - /// ID dell'IOB - /// - // POST: api/BatchProc - [HttpPost] - public string Post() - { - string answ = ""; - // questa classe è derivata da Controller.Response... x cui recupero lo stream in altro modo... - string content = ""; - System.Web.HttpContext.Current.Request.InputStream.Position = 0; - using (var reader = new StreamReader(System.Web.HttpContext.Current.Request.InputStream, System.Text.Encoding.UTF8, true, 4096, true)) - { - content = reader.ReadToEnd(); - } - //Rest - System.Web.HttpContext.Current.Request.InputStream.Position = 0; - // procedo a deserializzare in blocco l'oggetto... - try - { - // DEBUG: salvo su redis x fare DEBUG - string redKey = $"{ComLib.redNestAnsw}:LAST_CALL"; - memLayer.ML.setRSV(redKey, content); - - // deserializzo. - baseNestAnsw batchProcAnsw = JsonConvert.DeserializeObject(content); - // procedura idempotente: elimino eventuali dati della "busta" precedente... - DataLayer.man.taEL.deteteByParent("", batchProcAnsw.EnvNum); - // se ho errori inizio a salvarli... - if (batchProcAnsw.ErrorList.Count > 0) - { - // ora insert - foreach (var item in batchProcAnsw.ErrorList) - { - // salvo log errore... - DataLayer.man.taEL.insertQuery(DateTime.Now, item.ErrType, $"{batchProcAnsw.EnvNum}", $"{item.Uid}", $"{item.Description}"); - } - } - // se non nullo... - if (batchProcAnsw != null) - { - /************************************************* - * IN BASE al tipo di risposta saprò se - * - è BatchReq / OfflineOrder - * - è stima iniziale o NEST dettagliato - * - si tratta di una stima di validazione ITEM ... - * - *************************************************/ - if (batchProcAnsw.OrderType == oType.BatchRequest) - { - if (batchProcAnsw.ProcType == 1) + batchRequest answ = new batchRequest(); + string redKey = ""; + string redVal = ""; + // in primis: controllo su redis SE HO una richiesta CURRENT di processing... + string envNum = ComLib.currBatchReq; + // se c'è carico "la busta" come ID + if (!string.IsNullOrEmpty(envNum)) { - int bStatus = 0; - // deserializzo come BatchreqIniziale (stima) - nestReplyBatchInitial rispStima = JsonConvert.DeserializeObject(content); - - // 2020.01.16 salvo su mongoDb la risposta... - ComLib.man.saveEstAnsw(rispStima); - - // recupero info sul batch / KIT specifico x capire se sia di tipo "validation" - bool isValidation = false; - var tabOrd = DataLayer.man.taOL.getByBatch(rispStima.BatchID); - if (tabOrd.Count > 0) - { - isValidation = tabOrd[0].OrdType == "V"; - } - // calcolo status del batch... - switch (rispStima.ProcessStatus) - { - case procStatus.waiting: - case procStatus.running: - bStatus = 1; - break; - case procStatus.completed: - if (isValidation) - { - // verifico se il tempo di procesisng stimato sia > minimo... - if (rispStima.EstimatedWorktime > memLayer.ML.CRI("minValidEstSec")) - { - bStatus = 10; - } - else - { - bStatus = 9; - } - } - else - { - bStatus = 2; - } - break; - case procStatus.accepted: - bStatus = 5; - break; - case procStatus.refused: - if (isValidation) - { - bStatus = 9; - } - else - { - bStatus = 6; - } - break; - case procStatus.error: - if (isValidation) - { - bStatus = 9; - } - else - { - bStatus = 7; - } - break; - case procStatus.aborted: - default: - if (isValidation) - { - bStatus = 9; - } - else - { - bStatus = 0; - } - break; - } - // SALVO info riguardo al batch running - DataLayer.man.taBL.updateStatus(rispStima.BatchID, bStatus, rispStima.EnvNum, (decimal)rispStima.EstimatedWorktime / 60); - // salvo udpate elenco ITEMS - ComLib.updatePartsFromNesting(rispStima.PartList); - // aggiorno cadPath x items che non abbiano valorizzato... - string cadBasePath = $"{memLayer.ML.CRS("nestBasePath")}{memLayer.ML.CRS("drawingFolder")}/"; - DataLayer.man.taIL.updateCadPath(cadBasePath, rispStima.BatchID, false); - // verifico IN CASO di validazione andata a buon fine --> valorizzo tabella! - if (bStatus > 7) - { - // recupero ordine da batch - if (tabOrd.Count > 0) + // cerco in REDIS se ci sia l'item richiesto + redKey = $"{ComLib.redOutPath}:{envNum}"; + // leggo da redis la stringa... + redVal = memLayer.ML.getRSV(redKey); + // PROVO a deserializzare... + try { - DataLayer.man.taIV.upsertQuery(tabOrd[0].OrderExtCode, rispStima.BatchID, bStatus, rispStima.EstimatedWorktime); + answ = JsonConvert.DeserializeObject(redVal); + // aggiungo LA SUA ENV NUM!!!! + answ.EnvNum = envNum; } - } - // registro OK - answ = "OK"; + catch + { } } + // altrimenti NULL! else { - // deserializzo come BatchreqFinale - nestReplyBatchFinal rispNest = JsonConvert.DeserializeObject(content); - - // 2020.01.16 salvo su mongoDb la risposta... - ComLib.man.saveNestAnsw(rispNest); - - // calcolo status del batch... - int bStatus = 2; - switch (rispNest.ProcessStatus) - { - case procStatus.waiting: - case procStatus.running: - bStatus = 3; - break; - case procStatus.completed: - bStatus = 4; - break; - case procStatus.accepted: - bStatus = 5; - break; - case procStatus.refused: - bStatus = 6; - break; - case procStatus.error: - bStatus = 7; - break; - case procStatus.aborted: - default: - bStatus = 2; - break; - } - // aggiorno il resto SOLO SE status == completo... - if (rispNest.ProcessStatus == procStatus.completed || rispNest.ProcessStatus == procStatus.error) - { - // resetto le precedenti elaborazioni: elimino dati child MA NON il batch... - DataLayer.man.taBL.resetTree(rispNest.BatchID); - // SALVO info riguardo al batch completato - DataLayer.man.taBL.updateStatus(rispNest.BatchID, bStatus, rispNest.EnvNum, (decimal)rispNest.EstimatedWorktime / 60); - // salvo info riguardo ai vari Bunk / Sheets / Items... - ComLib.updateBunksFromNesting(rispNest.BatchID, rispNest.BunkList); - // salvo info x CART & BINS previsti - ComLib.updateBinsFromNesting(rispNest.BatchID, rispNest.BinList); - ComLib.updateCartsFromNesting(rispNest.BatchID, rispNest.CartList); - } - // registro OK - answ = "OK"; + answ = null; } - } - else if (batchProcAnsw.OrderType == oType.OfflineOrder) - { - // deserializzo come OfflineOrder - nestReplyOffOrd rispNest = JsonConvert.DeserializeObject(content); - // SALVO!!! - answ = "OK"; - } + return answ; } - else - { - answ = "WRONG DATA (expected baseNestAnsw object)"; - } - } - catch (Exception exc) - { - answ = "NO"; - } - // se tutto OK --> tolgo ultimo batch - if (answ == "OK") - { - // invio notifica che c'è una busta da processare - bool resetOk = ComLib.resetBatchReq(); - // se tutto ok e ci sono da validare parts --> procedo! - if (resetOk) + /// + /// Restituisce UNA SPECIFICA richiesta di elaborazione BATCH + /// + /// + // GET: api/BatchProc/5 + [HttpGet] + public batchRequest Get(int id) { - bool nextValidSent = ComLib.sendFirstValidationBatch(); + batchRequest answ = new batchRequest(); + // in primis: controllo su redis SE HO una richiista CURRENT di processing... + string redKey = $"{ComLib.redOutPath}:{id}"; + string redVal = memLayer.ML.getRSV(redKey); + // se c'è carico "la busta" come ID + if (!string.IsNullOrEmpty(redVal)) + { + // PROVO a deserializzare... + try + { + answ = JsonConvert.DeserializeObject(redVal); + } + catch + { } + } + return answ; + } + + /// + /// Processa una chiamata POST per l'invio in blocco Batch + /// POST: api/BatchProc + /// + /// ID dell'IOB + /// + // POST: api/BatchProc + [HttpPost] + public string Post() + { + string answ = ""; + // questa classe è derivata da Controller.Response... x cui recupero lo stream in altro modo... + string content = ""; + System.Web.HttpContext.Current.Request.InputStream.Position = 0; + using (var reader = new StreamReader(System.Web.HttpContext.Current.Request.InputStream, System.Text.Encoding.UTF8, true, 4096, true)) + { + content = reader.ReadToEnd(); + } + //Rest + System.Web.HttpContext.Current.Request.InputStream.Position = 0; + // procedo a deserializzare in blocco l'oggetto... + try + { + // DEBUG: salvo su redis x fare DEBUG + string redKey = $"{ComLib.redNestAnsw}:LAST_CALL"; + memLayer.ML.setRSV(redKey, content); + + // deserializzo. + baseNestAnsw batchProcAnsw = JsonConvert.DeserializeObject(content); + // procedura idempotente: elimino eventuali dati della "busta" precedente... + DataLayer.man.taEL.deteteByParent("", batchProcAnsw.EnvNum); + // se ho errori inizio a salvarli... + if (batchProcAnsw.ErrorList.Count > 0) + { + // ora insert + foreach (var item in batchProcAnsw.ErrorList) + { + // salvo log errore... + DataLayer.man.taEL.insertQuery(DateTime.Now, item.ErrType, $"{batchProcAnsw.EnvNum}", $"{item.Uid}", $"{item.Description}"); + } + } + // se non nullo... + if (batchProcAnsw != null) + { + /************************************************* + * IN BASE al tipo di risposta saprò se + * - è BatchReq / OfflineOrder + * - è stima iniziale o NEST dettagliato + * - si tratta di una stima di validazione ITEM ... + * + *************************************************/ + if (batchProcAnsw.OrderType == oType.BatchRequest) + { + if (batchProcAnsw.ProcType == 1) + { + int bStatus = 0; + // deserializzo come BatchreqIniziale (stima) + nestReplyBatchInitial rispStima = JsonConvert.DeserializeObject(content); + + // 2020.01.16 salvo su mongoDb la risposta... + ComLib.man.saveEstAnsw(rispStima); + + // recupero info sul batch / KIT specifico x capire se sia di tipo "validation" + bool isValidation = false; + var tabOrd = DataLayer.man.taOL.getByBatch(rispStima.BatchID); + if (tabOrd.Count > 0) + { + isValidation = tabOrd[0].OrdType == "V"; + } + // calcolo status del batch... + switch (rispStima.ProcessStatus) + { + case procStatus.waiting: + case procStatus.running: + bStatus = 1; + break; + case procStatus.completed: + if (isValidation) + { + // verifico se il tempo di procesisng stimato sia > minimo... + if (rispStima.EstimatedWorktime > memLayer.ML.CRI("minValidEstSec")) + { + bStatus = 10; + } + else + { + bStatus = 9; + } + } + else + { + bStatus = 2; + } + break; + case procStatus.accepted: + bStatus = 5; + break; + case procStatus.refused: + if (isValidation) + { + bStatus = 9; + } + else + { + bStatus = 6; + } + break; + case procStatus.error: + if (isValidation) + { + bStatus = 9; + } + else + { + bStatus = 7; + } + break; + case procStatus.aborted: + default: + if (isValidation) + { + bStatus = 9; + } + else + { + bStatus = 0; + } + break; + } + // SALVO info riguardo al batch running + DataLayer.man.taBL.updateStatus(rispStima.BatchID, bStatus, rispStima.EnvNum, (decimal)rispStima.EstimatedWorktime / 60); + // salvo udpate elenco ITEMS + ComLib.updatePartsFromNesting(rispStima.PartList); + // aggiorno cadPath x items che non abbiano valorizzato... + string cadBasePath = $"{memLayer.ML.CRS("nestBasePath")}{memLayer.ML.CRS("drawingFolder")}/"; + DataLayer.man.taIL.updateCadPath(cadBasePath, rispStima.BatchID, false); + // verifico IN CASO di validazione andata a buon fine --> valorizzo tabella! + if (bStatus > 7) + { + // recupero ordine da batch + if (tabOrd.Count > 0) + { + DataLayer.man.taIV.upsertQuery(tabOrd[0].OrderExtCode, rispStima.BatchID, bStatus, rispStima.EstimatedWorktime); + } + } + // registro OK + answ = "OK"; + } + else + { + // deserializzo come BatchreqFinale + nestReplyBatchFinal rispNest = JsonConvert.DeserializeObject(content); + + // 2020.01.16 salvo su mongoDb la risposta... + ComLib.man.saveNestAnsw(rispNest); + + // calcolo status del batch... + int bStatus = 2; + switch (rispNest.ProcessStatus) + { + case procStatus.waiting: + case procStatus.running: + bStatus = 3; + break; + case procStatus.completed: + bStatus = 4; + break; + case procStatus.accepted: + bStatus = 5; + break; + case procStatus.refused: + bStatus = 6; + break; + case procStatus.error: + bStatus = 7; + break; + case procStatus.aborted: + default: + bStatus = 2; + break; + } + // aggiorno il resto SOLO SE status == completo... + if (rispNest.ProcessStatus == procStatus.completed || rispNest.ProcessStatus == procStatus.error) + { + // resetto le precedenti elaborazioni: elimino dati child MA NON il batch... + DataLayer.man.taBL.resetTree(rispNest.BatchID); + // SALVO info riguardo al batch completato + DataLayer.man.taBL.updateStatus(rispNest.BatchID, bStatus, rispNest.EnvNum, (decimal)rispNest.EstimatedWorktime / 60); + // salvo info riguardo ai vari Bunk / Sheets / Items... + ComLib.updateBunksFromNesting(rispNest.BatchID, rispNest.BunkList); + // salvo info x CART & BINS previsti + ComLib.updateBinsFromNesting(rispNest.BatchID, rispNest.BinList); + ComLib.updateCartsFromNesting(rispNest.BatchID, rispNest.CartList); + } + // registro OK + answ = "OK"; + } + } + else if (batchProcAnsw.OrderType == oType.OfflineOrder) + { + // deserializzo come OfflineOrder + nestReplyOffOrd rispNest = JsonConvert.DeserializeObject(content); + // SALVO!!! + answ = "OK"; + } + } + else + { + answ = "WRONG DATA (expected baseNestAnsw object)"; + } + } + catch + { + answ = "NO"; + } + // se tutto OK --> tolgo ultimo batch + if (answ == "OK") + { + + // invio notifica che c'è una busta da processare + bool resetOk = ComLib.resetBatchReq(); + // se tutto ok e ci sono da validare parts --> procedo! + if (resetOk) + { + bool nextValidSent = ComLib.sendFirstValidationBatch(); + } + } + // restituisco risposta + return answ; } - } - // restituisco risposta - return answ; } - } } diff --git a/NKC_WF/Controllers/BunkController.cs b/NKC_WF/Controllers/BunkController.cs index b34ae4c..a657d43 100644 --- a/NKC_WF/Controllers/BunkController.cs +++ b/NKC_WF/Controllers/BunkController.cs @@ -1,159 +1,158 @@ using AppData; using Newtonsoft.Json; using NKC_SDK; -using System; using System.IO; using System.Web.Http; namespace NKC_WF.Controllers { - public class BunkController : ApiController - { - /// - /// Restituisce il FIRST BUNK da lavorare - /// GET: api/Bunk - /// - /// - [HttpGet] - public ProdBunk Get() + public class BunkController : ApiController { - ProdBunk answ = null; - try - { - answ = ComLib.prodGetFirstBunk(); - } - catch - { } - return answ; - } - - /// - /// Ottengo NEXT BUNK - /// GET: api/Bunk/2?showNext=true - /// - /// - /// - /// - [HttpGet] - public ProdBunk Get(int id, bool showNext) - { - ProdBunk answ = null; - try - { - if (showNext) + /// + /// Restituisce il FIRST BUNK da lavorare + /// GET: api/Bunk + /// + /// + [HttpGet] + public ProdBunk Get() { - answ = ComLib.prodGetNextBunk(id); - } - else - { - answ = ComLib.prodGetBunk(id); - } - } - catch - { } - return answ; - } - - /************************************ - * METODI PUT - * - * per abilitare è necessario agire sulla conf di IIS: - * - * - modificare il file applicationHost.config che si trova in C:\Windows\System32\inetsrv\config - * - disinstallare webDav oppure commentare le righe - * - * - * - * - aggiungere PUT/DELETE a handler: - * - * - * - **************************************/ - - - /// - /// Effettua la chiamata di update - /// - /// - /// - // PUT: api/Bunk/5 - [HttpPut] - public void Put(ProdBunk currBunk) - { - // NB. decodifico direttamente come oggetto, vedere qui: - // 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 - - // se non nullo... - if (currBunk != null) - { - foreach (var item in currBunk.SheetList) - { - DataLayer.man.taSHL.updateDate(item.SheetId, item.Printing.DtStart, item.Printing.DtEnd, item.Machining.DtStart, item.Machining.DtEnd, item.Unloading.DtStart, item.Unloading.DtEnd, (int)item.Status); - // verifico SE SIA AVVENUTO CON SUCCESSO lo step di lavorazione... - if (item.Machining.Success) - { - // SE machining completato --> status a LAVORATO! - if (item.Machining.DtEnd != null) + ProdBunk answ = null; + try { - DataLayer.man.taIL.updateSheetStatus(item.SheetId, 1, "PROD"); + answ = ComLib.prodGetFirstBunk(); } - } + catch + { } + return answ; } - } - // INVALIDO eventuale valore BUNK in REDIS... - ComLib.resetRedisBunkData(); - } - /// - /// Processa una chiamata POST per l'invio in blocco status BUNK - /// POST: api/Bunk - /// - /// - [HttpPost] - public string Post() - { - string answ = ""; - // questa classe è derivata da Controller.Response... x cui recupero lo stream in altro modo... - string content = ""; - System.Web.HttpContext.Current.Request.InputStream.Position = 0; - using (var reader = new StreamReader(System.Web.HttpContext.Current.Request.InputStream, System.Text.Encoding.UTF8, true, 4096, true)) - { - content = reader.ReadToEnd(); - } - //Rest - System.Web.HttpContext.Current.Request.InputStream.Position = 0; - // procedo a deserializzare in blocco l'oggetto... - try - { - // deserializzo. - ProdBunk currBunk = JsonConvert.DeserializeObject(content); - // se non nullo... - if (currBunk != null) + /// + /// Ottengo NEXT BUNK + /// GET: api/Bunk/2?showNext=true + /// + /// + /// + /// + [HttpGet] + public ProdBunk Get(int id, bool showNext) { - foreach (var item in currBunk.SheetList) - { - // calcolo stsatus dalle date valide... - - - DataLayer.man.taSHL.updateDate(item.SheetId, item.Printing.DtStart, item.Printing.DtEnd, item.Machining.DtStart, item.Machining.DtEnd, item.Unloading.DtStart, item.Unloading.DtEnd, (int)item.Status); - // SE machining completato --> status a LAVORATO! - if (item.Machining.DtEnd != null) + ProdBunk answ = null; + try { - DataLayer.man.taIL.updateSheetStatus(item.SheetId, 1, "PROD"); + if (showNext) + { + answ = ComLib.prodGetNextBunk(id); + } + else + { + answ = ComLib.prodGetBunk(id); + } } - } - // segnalo avanzamento su redis x pagina unload - ComLib.advaceSheetRevByBunk(currBunk.BunkId); + catch + { } + return answ; } - answ = "OK"; - } - catch (Exception exc) - { - answ = "NO"; - } - return answ; - } - } + /************************************ + * METODI PUT + * + * per abilitare è necessario agire sulla conf di IIS: + * + * - modificare il file applicationHost.config che si trova in C:\Windows\System32\inetsrv\config + * - disinstallare webDav oppure commentare le righe + * + * + * + * - aggiungere PUT/DELETE a handler: + * + * + * + **************************************/ + + + /// + /// Effettua la chiamata di update + /// + /// + /// + // PUT: api/Bunk/5 + [HttpPut] + public void Put(ProdBunk currBunk) + { + // NB. decodifico direttamente come oggetto, vedere qui: + // 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 + + // se non nullo... + if (currBunk != null) + { + foreach (var item in currBunk.SheetList) + { + DataLayer.man.taSHL.updateDate(item.SheetId, item.Printing.DtStart, item.Printing.DtEnd, item.Machining.DtStart, item.Machining.DtEnd, item.Unloading.DtStart, item.Unloading.DtEnd, (int)item.Status); + // verifico SE SIA AVVENUTO CON SUCCESSO lo step di lavorazione... + if (item.Machining.Success) + { + // SE machining completato --> status a LAVORATO! + if (item.Machining.DtEnd != null) + { + DataLayer.man.taIL.updateSheetStatus(item.SheetId, 1, "PROD"); + } + } + } + } + // INVALIDO eventuale valore BUNK in REDIS... + ComLib.resetRedisBunkData(); + } + + /// + /// Processa una chiamata POST per l'invio in blocco status BUNK + /// POST: api/Bunk + /// + /// + [HttpPost] + public string Post() + { + string answ = ""; + // questa classe è derivata da Controller.Response... x cui recupero lo stream in altro modo... + string content = ""; + System.Web.HttpContext.Current.Request.InputStream.Position = 0; + using (var reader = new StreamReader(System.Web.HttpContext.Current.Request.InputStream, System.Text.Encoding.UTF8, true, 4096, true)) + { + content = reader.ReadToEnd(); + } + //Rest + System.Web.HttpContext.Current.Request.InputStream.Position = 0; + // procedo a deserializzare in blocco l'oggetto... + try + { + // deserializzo. + ProdBunk currBunk = JsonConvert.DeserializeObject(content); + // se non nullo... + if (currBunk != null) + { + foreach (var item in currBunk.SheetList) + { + // calcolo stsatus dalle date valide... + + + DataLayer.man.taSHL.updateDate(item.SheetId, item.Printing.DtStart, item.Printing.DtEnd, item.Machining.DtStart, item.Machining.DtEnd, item.Unloading.DtStart, item.Unloading.DtEnd, (int)item.Status); + // SE machining completato --> status a LAVORATO! + if (item.Machining.DtEnd != null) + { + DataLayer.man.taIL.updateSheetStatus(item.SheetId, 1, "PROD"); + } + } + // segnalo avanzamento su redis x pagina unload + ComLib.advaceSheetRevByBunk(currBunk.BunkId); + } + answ = "OK"; + } + catch + { + answ = "NO"; + } + return answ; + } + + } } diff --git a/NKC_WF/Controllers/MaterialController.cs b/NKC_WF/Controllers/MaterialController.cs index 3f8650c..08a47ef 100644 --- a/NKC_WF/Controllers/MaterialController.cs +++ b/NKC_WF/Controllers/MaterialController.cs @@ -5,37 +5,37 @@ using System.Web.Http; namespace NKC_WF.Controllers { - public class MaterialController : ApiController - { - /// - /// Restituisce ELENCO materiali - /// - /// - // GET: api/Material - [HttpGet] - public List Get() + public class MaterialController : ApiController { - List answ = new List(); - var table = DataLayer.man.taMat.GetData(); - Material currMat = new Material(); - foreach (var item in table) - { - currMat = new Material() + /// + /// Restituisce ELENCO materiali + /// + /// + // GET: api/Material + [HttpGet] + public List Get() { - MatId = item.MatID, - MatDesc = item.MatDesc, - MatExtCode = item.MatExtCode, - MatDtmx = item.MatDtmx, - ApprovDate = item.ApprovDate, - ApprovUser = item.ApprovUser, - L_mm = item.L_mm, - W_mm = item.W_mm, - T_mm = item.T_mm - }; - answ.Add(currMat); - } - return answ; - } + List answ = new List(); + var table = DataLayer.man.taMat.GetData(); + Material currMat = new Material(); + foreach (var item in table) + { + currMat = new Material() + { + MatId = item.MatID, + MatDesc = item.MatDesc, + MatExtCode = item.MatExtCode, + MatDtmx = item.MatDtmx, + ApprovDate = item.ApprovDate, + ApprovUser = item.ApprovUser, + L_mm = item.L_mm, + W_mm = item.W_mm, + T_mm = item.T_mm + }; + answ.Add(currMat); + } + return answ; + } - } + } } diff --git a/NKC_WF/Controllers/PrintQueueConfController.cs b/NKC_WF/Controllers/PrintQueueConfController.cs index 0f4c971..3a7da8f 100644 --- a/NKC_WF/Controllers/PrintQueueConfController.cs +++ b/NKC_WF/Controllers/PrintQueueConfController.cs @@ -3,62 +3,59 @@ using SteamWare; using System; using System.Collections.Generic; using System.IO; -using System.Linq; -using System.Net; -using System.Net.Http; using System.Web; using System.Web.Http; namespace NKC_WF.Controllers { - public class PrintQueueConfController : ApiController - { - /// - /// Restituisce un array JSon x le conf delle code di stampa - /// GET: api/PrintQueue - /// - /// lista oggetto Json in formato SteamwareSDK.queueConf - public List Get() + public class PrintQueueConfController : ApiController { - List answ = new List(); - string dirPath = HttpContext.Current.Server.MapPath("~/Reports/"); - string nomeFile = "queueConf.json"; - bool fileExist = fileMover.obj.fileExist(dirPath, nomeFile); - if (fileExist) - { - string rawData = File.ReadAllText($"{dirPath}\\{nomeFile}"); - if(!string.IsNullOrEmpty(rawData)) + /// + /// Restituisce un array JSon x le conf delle code di stampa + /// GET: api/PrintQueue + /// + /// lista oggetto Json in formato SteamwareSDK.queueConf + public List Get() { - try - { - answ = JsonConvert.DeserializeObject>(rawData); - } - catch(Exception exc) - { - Log.Instance.Error(exc, "Eccezione in decodifica file conf printQueue"); - } + List answ = new List(); + string dirPath = HttpContext.Current.Server.MapPath("~/Reports/"); + string nomeFile = "queueConf.json"; + bool fileExist = fileMover.obj.fileExist(dirPath, nomeFile); + if (fileExist) + { + string rawData = File.ReadAllText($"{dirPath}\\{nomeFile}"); + if (!string.IsNullOrEmpty(rawData)) + { + try + { + answ = JsonConvert.DeserializeObject>(rawData); + } + catch (Exception exc) + { + Log.Instance.Error(exc, "Eccezione in decodifica file conf printQueue"); + } + } + } + // se vuoto... creo! + if (answ.Count == 0) + { + queueConf currConf; + string outForm = "EMF"; + string pagWidth = "8.5in"; + string pagHeigth = "11in"; + string margin = "0.5in"; + devInfoParam currDevInfoParam = new devInfoParam(outForm, pagHeigth, pagWidth, margin, margin, margin, margin); + currConf = new queueConf() + { + name = "default", + template = "missing.rdlc", + printerName = "Microsoft Print to PDF", + deviceInfoParam = currDevInfoParam + }; + answ.Add(currConf); + } + return answ; } - } - // se vuoto... creo! - if (answ.Count==0) - { - queueConf currConf; - string outForm = "EMF"; - string pagWidth = "8.5in"; - string pagHeigth = "11in"; - string margin = "0.5in"; - devInfoParam currDevInfoParam = new devInfoParam(outForm, pagHeigth, pagWidth, margin, margin, margin, margin); - currConf = new queueConf() - { - name = "default", - template = "missing.rdlc", - printerName = "Microsoft Print to PDF", - deviceInfoParam = currDevInfoParam - }; - answ.Add(currConf); - } - return answ; - } #if false // GET: api/PrintQueue/5 @@ -68,5 +65,5 @@ namespace NKC_WF.Controllers } #endif - } + } } diff --git a/NKC_WF/Controllers/PrintQueueController.cs b/NKC_WF/Controllers/PrintQueueController.cs index c6f45d0..c3f613e 100644 --- a/NKC_WF/Controllers/PrintQueueController.cs +++ b/NKC_WF/Controllers/PrintQueueController.cs @@ -1,214 +1,210 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Net.Http; -using System.Web.Http; +using AppData; using Newtonsoft.Json; -using SteamWare; -using System.IO; -using System.Web; -using AppData; -using System.Data; using NKC_SDK; +using SteamWare; +using System.Collections.Generic; +using System.Data; +using System.IO; +using System.Web.Http; namespace NKC_WF.Controllers { - public class PrintQueueController : ApiController - { - #region classi gestione PJQ - - /// - /// chaive redis x cache conteggio coda PJQ - /// - public static string redQueueCount = "NKC:SERV:PJQ"; - /// - /// Conteggio elementi in attesa stsampa da DB - /// - protected int countWaitingDb + public class PrintQueueController : ApiController { - get - { - int answ = 0; - // resetto conteggio in redis... - DS_Report.PrintJobQueueDataTable nextJob = DataLayer.man.taPJQ.getWaiting(); - if (nextJob != null) + #region classi gestione PJQ + + /// + /// chaive redis x cache conteggio coda PJQ + /// + internal static string redQueueCount = "NKC:SERV:PJQ"; + /// + /// Conteggio elementi in attesa stsampa da DB + /// + protected int countWaitingDb { - answ = nextJob.Count; + get + { + int answ = 0; + // resetto conteggio in redis... + DS_Report.PrintJobQueueDataTable nextJob = DataLayer.man.taPJQ.getWaiting(); + if (nextJob != null) + { + answ = nextJob.Count; + } + return answ; + } } - return answ; - } - } - /// - /// Carica i dati richiesti dal report dalla StoredProcedure (filtrando quindi...) e restituisce Dictionary [nome RDS / tab RDS] - /// - /// - /// cod UDC - /// tabella dati - private Dictionary caricaDati(reportRichiesto tipoReport, string keyParam) - { - int intIdx = 0; - Dictionary answ = new Dictionary(); - DataTable tab = new DataTable(); - switch (tipoReport) - { - case reportRichiesto.cartLabel: - // int.TryParse(keyParam, out intIdx); - // tab = (DataTable)DataLayer.man.taRepStack.GetData(intIdx); - break; - case reportRichiesto.paintLabelPre: - // int.TryParse(keyParam, out intIdx); - // tab = (DataTable)DataLayer.man.taRepStack.GetData(intIdx); - break; - case reportRichiesto.paintLabelPost: - // int.TryParse(keyParam, out intIdx); - // tab = (DataTable)DataLayer.man.taRepStack.GetData(intIdx); - break; - case reportRichiesto.partLabel: - int.TryParse(keyParam, out intIdx); - tab = (DataTable)DataLayer.man.taIL.getByKey(intIdx); - answ.Add("stp_prt_PartLabel", tab); - break; - case reportRichiesto.stackLabel: - int.TryParse(keyParam, out intIdx); - tab = (DataTable)DataLayer.man.taRepStack.GetData(intIdx); - answ.Add("stp_prt_StackLabel", tab); - break; - default: - break; - } - return answ; - } - - - protected reportRichiesto reportByTipo(string tipo) - { - reportRichiesto report = reportRichiesto.stackLabel; - switch (tipo) - { - case "docPaint": - report = reportRichiesto.paintLabelPre; - break; - case "docPaintPost": - report = reportRichiesto.paintLabelPost; - break; - case "docCart": - report = reportRichiesto.cartLabel; - break; - case "docPart": - report = reportRichiesto.partLabel; - break; - case "docStack": - report = reportRichiesto.stackLabel; - break; - default: - break; - } - return report; - } - - #endregion - - #region REST api call - - /// - /// Restituisce numero jobs aperti (stato = 0...), se 0 = NESSUNO - /// GET: api/PrintQueue - /// - /// - public int Get() - { - // restituisco... - int answ = 0; - string redVal = memLayer.ML.getRSV(redQueueCount); - // cerco in redis se ci sia chiave.. - if (!string.IsNullOrEmpty(redVal)) - { - // recupero - int.TryParse(redVal, out answ); - } - else - { - // recupero da dbe e salvo - answ = countWaitingDb; - memLayer.ML.setRSV(redQueueCount, answ.ToString(), 30); - } - return answ; - } - - /// - /// Elenco dei jobs aperti per la coda indicata - /// GET: api/PrintQueue/queue_01 - /// - /// - /// - public List Get(string id) - { - List answ = new List(); - // recupero da DB... - DS_Report.PrintJobQueueDataTable tabPJQ = DataLayer.man.taPJQ.getByQueue(id); - if (tabPJQ.Count > 0) - { - reportData currReport = new reportData(); - Dictionary currRdsData; - // ciclo! - foreach (var pjReq in tabPJQ) + /// + /// Carica i dati richiesti dal report dalla StoredProcedure (filtrando quindi...) e restituisce Dictionary [nome RDS / tab RDS] + /// + /// + /// cod UDC + /// tabella dati + private Dictionary caricaDati(reportRichiesto tipoReport, string keyParam) { - currRdsData = caricaDati(reportByTipo(pjReq.TipoReport), pjReq.KeyParam); - // in base alla coda --> recupero i dati - currReport = new reportData() - { - ticketNum = pjReq.IdxPrintJob.ToString(), - rdsData = currRdsData - }; - answ.Add(currReport); + int intIdx = 0; + Dictionary answ = new Dictionary(); + DataTable tab = new DataTable(); + switch (tipoReport) + { + case reportRichiesto.cartLabel: + // int.TryParse(keyParam, out intIdx); + // tab = (DataTable)DataLayer.man.taRepStack.GetData(intIdx); + break; + case reportRichiesto.paintLabelPre: + // int.TryParse(keyParam, out intIdx); + // tab = (DataTable)DataLayer.man.taRepStack.GetData(intIdx); + break; + case reportRichiesto.paintLabelPost: + // int.TryParse(keyParam, out intIdx); + // tab = (DataTable)DataLayer.man.taRepStack.GetData(intIdx); + break; + case reportRichiesto.partLabel: + int.TryParse(keyParam, out intIdx); + tab = (DataTable)DataLayer.man.taIL.getByKey(intIdx); + answ.Add("stp_prt_PartLabel", tab); + break; + case reportRichiesto.stackLabel: + int.TryParse(keyParam, out intIdx); + tab = (DataTable)DataLayer.man.taRepStack.GetData(intIdx); + answ.Add("stp_prt_StackLabel", tab); + break; + default: + break; + } + tab.Dispose(); + return answ; } - } - // compongo risposta... - return answ; - } - /// - /// Processa una chiamata POST per l'invio in blocco del risultato dell'elaborazione - /// POST: api/PrintQueue - /// - /// - [HttpPost] - public string Post() - { - string answ = "UNKN"; - // questa classe è derivata da Controller.Response... x cui recupero lo stream in altro modo... - string content = ""; - System.Web.HttpContext.Current.Request.InputStream.Position = 0; - using (var reader = new StreamReader(System.Web.HttpContext.Current.Request.InputStream, System.Text.Encoding.UTF8, true, 4096, true)) - { - content = reader.ReadToEnd(); - } - //Rest - System.Web.HttpContext.Current.Request.InputStream.Position = 0; - // procedo a deserializzare in blocco l'oggetto... - try - { - // deserializzo. - printTask printAnsw = JsonConvert.DeserializeObject(content); - // verifico se mi abbia dato esito 1 --> aggiorno DB! - if (printAnsw != null) + + protected reportRichiesto reportByTipo(string tipo) { - int idxPJQ = 0; - int.TryParse(printAnsw.ticketNum, out idxPJQ); - DataLayer.man.taPJQ.updateStato(idxPJQ, printAnsw.newStatus); - // resetto conteggio in redis... - memLayer.ML.setRSV(redQueueCount, countWaitingDb.ToString(), 30); - answ = "OK"; + reportRichiesto report = reportRichiesto.stackLabel; + switch (tipo) + { + case "docPaint": + report = reportRichiesto.paintLabelPre; + break; + case "docPaintPost": + report = reportRichiesto.paintLabelPost; + break; + case "docCart": + report = reportRichiesto.cartLabel; + break; + case "docPart": + report = reportRichiesto.partLabel; + break; + case "docStack": + report = reportRichiesto.stackLabel; + break; + default: + break; + } + return report; } - } - catch - { } - // restituisco esito! - return answ; + + #endregion + + #region REST api call + + /// + /// Restituisce numero jobs aperti (stato = 0...), se 0 = NESSUNO + /// GET: api/PrintQueue + /// + /// + public int Get() + { + // restituisco... + int answ = 0; + string redVal = memLayer.ML.getRSV(redQueueCount); + // cerco in redis se ci sia chiave.. + if (!string.IsNullOrEmpty(redVal)) + { + // recupero + int.TryParse(redVal, out answ); + } + else + { + // recupero da dbe e salvo + answ = countWaitingDb; + memLayer.ML.setRSV(redQueueCount, answ.ToString(), 30); + } + return answ; + } + + /// + /// Elenco dei jobs aperti per la coda indicata + /// GET: api/PrintQueue/queue_01 + /// + /// + /// + public List Get(string id) + { + List answ = new List(); + // recupero da DB... + DS_Report.PrintJobQueueDataTable tabPJQ = DataLayer.man.taPJQ.getByQueue(id); + if (tabPJQ.Count > 0) + { + reportData currReport = new reportData(); + Dictionary currRdsData; + // ciclo! + foreach (var pjReq in tabPJQ) + { + currRdsData = caricaDati(reportByTipo(pjReq.TipoReport), pjReq.KeyParam); + // in base alla coda --> recupero i dati + currReport = new reportData() + { + ticketNum = pjReq.IdxPrintJob.ToString(), + rdsData = currRdsData + }; + answ.Add(currReport); + } + } + // compongo risposta... + return answ; + } + + /// + /// Processa una chiamata POST per l'invio in blocco del risultato dell'elaborazione + /// POST: api/PrintQueue + /// + /// + [HttpPost] + public string Post() + { + string answ = "UNKN"; + // questa classe è derivata da Controller.Response... x cui recupero lo stream in altro modo... + string content = ""; + System.Web.HttpContext.Current.Request.InputStream.Position = 0; + using (var reader = new StreamReader(System.Web.HttpContext.Current.Request.InputStream, System.Text.Encoding.UTF8, true, 4096, true)) + { + content = reader.ReadToEnd(); + } + //Rest + System.Web.HttpContext.Current.Request.InputStream.Position = 0; + // procedo a deserializzare in blocco l'oggetto... + try + { + // deserializzo. + printTask printAnsw = JsonConvert.DeserializeObject(content); + // verifico se mi abbia dato esito 1 --> aggiorno DB! + if (printAnsw != null) + { + int idxPJQ = 0; + int.TryParse(printAnsw.ticketNum, out idxPJQ); + DataLayer.man.taPJQ.updateStato(idxPJQ, printAnsw.newStatus); + // resetto conteggio in redis... + memLayer.ML.setRSV(redQueueCount, countWaitingDb.ToString(), 30); + answ = "OK"; + } + } + catch + { } + // restituisco esito! + return answ; + } + + #endregion + } - - #endregion - - } } diff --git a/NKC_WF/Controllers/ReportController.cs b/NKC_WF/Controllers/ReportController.cs index fec9da5..1c185bf 100644 --- a/NKC_WF/Controllers/ReportController.cs +++ b/NKC_WF/Controllers/ReportController.cs @@ -1,97 +1,92 @@ -using Newtonsoft.Json; -using SteamWare; +using SteamWare; using System; -using System.Collections.Generic; using System.IO; -using System.Linq; -using System.Net; -using System.Net.Http; using System.Web; using System.Web.Http; namespace NKC_WF.Controllers { - public class ReportController : ApiController - { - - /// - /// Restituisce un array JSon dei files report template del progetto - /// GET: api/Report - /// - /// ID della printer associata - /// Oggetto Json in formato SteamwareSDK.filePack - public filePack Get() + public class ReportController : ApiController { - filePack answ = new filePack(); - // procedo a deserializzare in blocco l'oggetto... - try - { - // recupero TUTTI i files della folder della printer richiesta - string dirPath = HttpContext.Current.Server.MapPath("~/Reports/"); - var fileList = fileMover.obj.elencoFilesDir(dirPath); - smallFile currFile = null; - string fileContent = ""; - foreach (var item in fileList) + + /// + /// Restituisce un array JSon dei files report template del progetto + /// GET: api/Report + /// + /// ID della printer associata + /// Oggetto Json in formato SteamwareSDK.filePack + public filePack Get() { - // SOLO rdlc... - if (item.Nome.EndsWith("rdlc")) - { - fileContent = File.ReadAllText($"{dirPath}\\{item.Nome}"); - currFile = new smallFile() + filePack answ = new filePack(); + // procedo a deserializzare in blocco l'oggetto... + try { - fileName = item.Nome, - content = fileContent.Replace("\r\n", Environment.NewLine) - }; - answ.fileList.Add(currFile); - } + // recupero TUTTI i files della folder della printer richiesta + string dirPath = HttpContext.Current.Server.MapPath("~/Reports/"); + var fileList = fileMover.obj.elencoFilesDir(dirPath); + smallFile currFile = null; + string fileContent = ""; + foreach (var item in fileList) + { + // SOLO rdlc... + if (item.Nome.EndsWith("rdlc")) + { + fileContent = File.ReadAllText($"{dirPath}\\{item.Nome}"); + currFile = new smallFile() + { + fileName = item.Nome, + content = fileContent.Replace("\r\n", Environment.NewLine) + }; + answ.fileList.Add(currFile); + } + } + } + catch (Exception exc) + { + logger.lg.scriviLog($"Errore in get elenco reports{Environment.NewLine}{exc}"); + } + return answ; } - } - catch (Exception exc) - { - logger.lg.scriviLog($"Errore in get elenco reports{Environment.NewLine}{exc}"); - } - return answ; - } - /// - /// Restituisce oggetto JSon del files report template richeisto - /// GET: api/Report/print_01 - /// - /// nome report (SENZA estensione .rdlc) - /// Oggetto Json in formato SteamwareSDK.filePack - public filePack Get(string id) - { - filePack answ = new filePack(); - // procedo a deserializzare in blocco l'oggetto... - try - { - // recupero TUTTI i files della folder della printer richiesta - string dirPath = HttpContext.Current.Server.MapPath("~/Reports/"); - var fileList = fileMover.obj.elencoFilesDir(dirPath); - smallFile currFile = null; - string fileContent = ""; - foreach (var item in fileList) + /// + /// Restituisce oggetto JSon del files report template richeisto + /// GET: api/Report/print_01 + /// + /// nome report (SENZA estensione .rdlc) + /// Oggetto Json in formato SteamwareSDK.filePack + public filePack Get(string id) { - // se è uguale all'id richeisto... - if (item.Nome.Replace(".rdlc", "") == id.Replace(".rdlc", "")) - { - fileContent = File.ReadAllText($"{dirPath}\\{item.Nome}"); - currFile = new smallFile() + filePack answ = new filePack(); + // procedo a deserializzare in blocco l'oggetto... + try { - fileName = item.Nome, - content = fileContent.Replace("\r\n", Environment.NewLine) - }; - answ.fileList.Add(currFile); - } + // recupero TUTTI i files della folder della printer richiesta + string dirPath = HttpContext.Current.Server.MapPath("~/Reports/"); + var fileList = fileMover.obj.elencoFilesDir(dirPath); + smallFile currFile = null; + string fileContent = ""; + foreach (var item in fileList) + { + // se è uguale all'id richeisto... + if (item.Nome.Replace(".rdlc", "") == id.Replace(".rdlc", "")) + { + fileContent = File.ReadAllText($"{dirPath}\\{item.Nome}"); + currFile = new smallFile() + { + fileName = item.Nome, + content = fileContent.Replace("\r\n", Environment.NewLine) + }; + answ.fileList.Add(currFile); + } + } + } + catch (Exception exc) + { + logger.lg.scriviLog($"Errore in get singolo report{Environment.NewLine}{exc}"); + } + return answ; } - } - catch (Exception exc) - { - logger.lg.scriviLog($"Errore in get singolo report{Environment.NewLine}{exc}"); - } - return answ; - } - } + } } diff --git a/NKC_WF/Controllers/SheetController.cs b/NKC_WF/Controllers/SheetController.cs index 1a951ea..7b9e50a 100644 --- a/NKC_WF/Controllers/SheetController.cs +++ b/NKC_WF/Controllers/SheetController.cs @@ -1,12 +1,7 @@ using AppData; using Newtonsoft.Json; using NKC_SDK; -using System; -using System.Collections.Generic; using System.IO; -using System.Linq; -using System.Net; -using System.Net.Http; using System.Web.Http; namespace NKC_WF.Controllers @@ -182,7 +177,7 @@ namespace NKC_WF.Controllers ComLib.updateBatchPosition(BatchId); } } - catch (Exception exc) + catch { answ = "NO"; } diff --git a/NKC_WF/Controllers/getMUCssController.cs b/NKC_WF/Controllers/getMUCssController.cs index 6fd410f..c1e012d 100644 --- a/NKC_WF/Controllers/getMUCssController.cs +++ b/NKC_WF/Controllers/getMUCssController.cs @@ -1,68 +1,63 @@ using AppData; -using Newtonsoft.Json; using SteamWare; -using System; -using System.Collections.Generic; -using System.IO; using System.Net; using System.Net.Http; using System.Text; -using System.Web; using System.Web.Http; namespace NKC_WF.Controllers { - public class getMUCssController : ApiController - { - // GET api/getMUCssController - public HttpResponseMessage Get() + public class getMUCssController : ApiController { - string answ = getCssByPost(0); - return new HttpResponseMessage(HttpStatusCode.OK) - { - Content = new StringContent(answ, Encoding.UTF8, "text/css") - }; - } - - // GET api/getMUCssController/5 - public HttpResponseMessage Get(int id) - { - string answ = getCssByPost(id); - return new HttpResponseMessage(HttpStatusCode.OK) - { - Content = new StringContent(answ, Encoding.UTF8, "text/css") - }; - } - /// - /// Calcola CSS da postsazione - /// - /// - /// - /// - private static string getCssByPost(int sheetID) - { - // var base - string answ = ""; - if (sheetID > 0) - { - // recupero da REDIS! - string redKey = $"{ComLib.machineUnloadArea(sheetID)}:Css"; - // se vuoto scrivo VUOTO... - if (!memLayer.ML.redKeyPresent(redKey)) + // GET api/getMUCssController + public HttpResponseMessage Get() { - memLayer.ML.setRSV(redKey, answ); + string answ = getCssByPost(0); + return new HttpResponseMessage(HttpStatusCode.OK) + { + Content = new StringContent(answ, Encoding.UTF8, "text/css") + }; } - answ = memLayer.ML.getRSV(redKey); - // RICALCOLO SOLO SE non trovo in REDIS (perché invalidato) - if (answ == "") - // se vuoto lo calcolo... - { - answ = ComLib.getCurrentCss(sheetID); - } - } - // restituisco css - return answ; - } - } + // GET api/getMUCssController/5 + public HttpResponseMessage Get(int id) + { + string answ = getCssByPost(id); + return new HttpResponseMessage(HttpStatusCode.OK) + { + Content = new StringContent(answ, Encoding.UTF8, "text/css") + }; + } + /// + /// Calcola CSS da postsazione + /// + /// + /// + /// + private static string getCssByPost(int sheetID) + { + // var base + string answ = ""; + if (sheetID > 0) + { + // recupero da REDIS! + string redKey = $"{ComLib.machineUnloadArea(sheetID)}:Css"; + // se vuoto scrivo VUOTO... + if (!memLayer.ML.redKeyPresent(redKey)) + { + memLayer.ML.setRSV(redKey, answ); + } + answ = memLayer.ML.getRSV(redKey); + // RICALCOLO SOLO SE non trovo in REDIS (perché invalidato) + if (string.IsNullOrEmpty(answ)) + // se vuoto lo calcolo... + { + answ = ComLib.getCurrentCss(sheetID); + } + } + // restituisco css + return answ; + } + + } } \ No newline at end of file diff --git a/NKC_WF/Controllers/getMUCssRevController.cs b/NKC_WF/Controllers/getMUCssRevController.cs index 93f862b..74bfaf0 100644 --- a/NKC_WF/Controllers/getMUCssRevController.cs +++ b/NKC_WF/Controllers/getMUCssRevController.cs @@ -5,58 +5,58 @@ using System.Web.Http; namespace NKC_WF.Controllers { - public class getMUCssRevController : ApiController - { - // GET api/getMUCssRev - public int Get() + public class getMUCssRevController : ApiController { - int answ = getRevBySheet(0); - return answ; - } - // GET api/getMUCssRev/5 - public int Get(int id) - { - int answ = getRevBySheet(id); - return answ; - } - /// - /// Recupera da REDIS info indice revisione x foglio - /// - /// - /// - private static int getRevBySheet(int SheetID) - { - int answ = 0; - if (SheetID > 0) - { - // recupero da REDIS! - string redKeyExp = memLayer.ML.redHash($"DataExp"); - string redKey = $"{ComLib.machineUnloadArea(SheetID)}:Css"; - string redKeyRev = $"{ComLib.machineUnloadArea(SheetID)}:CssRev"; - // controllo expiry globale... se manca SVUOTO area - string rawData = memLayer.ML.getRSV(redKeyExp); - if (string.IsNullOrEmpty(rawData)) + // GET api/getMUCssRev + public int Get() { - // svuoto e scrivo... - memLayer.ML.redFlushKey(memLayer.ML.redHash($"MachineUnload")); - memLayer.ML.redFlushKey(memLayer.ML.redHash($"TabSheets")); - memLayer.ML.setRSV(redKeyExp, $"Reload Data {DateTime.Now}", 3600); + int answ = getRevBySheet(0); + return answ; } - // SE fosse scaduto CSS --> aggiorno revisione... - if (!memLayer.ML.redKeyPresent(redKey)) + // GET api/getMUCssRev/5 + public int Get(int id) { - // incremento... - memLayer.ML.setRCntI(redKeyRev); + int answ = getRevBySheet(id); + return answ; } - answ = memLayer.ML.getRCnt(redKeyRev); - // se > 999 --> resetto - if (answ > 999) + /// + /// Recupera da REDIS info indice revisione x foglio + /// + /// + /// + private static int getRevBySheet(int SheetID) { - memLayer.ML.resetRCnt(redKeyRev); + int answ = 0; + if (SheetID > 0) + { + // recupero da REDIS! + string redKeyExp = memLayer.ML.redHash($"DataExp"); + string redKey = $"{ComLib.machineUnloadArea(SheetID)}:Css"; + string redKeyRev = $"{ComLib.machineUnloadArea(SheetID)}:CssRev"; + // controllo expiry globale... se manca SVUOTO area + string rawData = memLayer.ML.getRSV(redKeyExp); + if (string.IsNullOrEmpty(rawData)) + { + // svuoto e scrivo... + memLayer.ML.redFlushKey(memLayer.ML.redHash($"MachineUnload")); + memLayer.ML.redFlushKey(memLayer.ML.redHash($"TabSheets")); + memLayer.ML.setRSV(redKeyExp, $"Reload Data {DateTime.Now}", 3600); + } + // SE fosse scaduto CSS --> aggiorno revisione... + if (!memLayer.ML.redKeyPresent(redKey)) + { + // incremento... + memLayer.ML.setRCntI(redKeyRev); + } + answ = memLayer.ML.getRCnt(redKeyRev); + // se > 999 --> resetto + if (answ > 999) + { + memLayer.ML.resetRCnt(redKeyRev); + } + } + return answ; } - } - return answ; - } - } + } } \ No newline at end of file diff --git a/NKC_WF/Controllers/getMUSheetRevController.cs b/NKC_WF/Controllers/getMUSheetRevController.cs index cc1c8de..55edc99 100644 --- a/NKC_WF/Controllers/getMUSheetRevController.cs +++ b/NKC_WF/Controllers/getMUSheetRevController.cs @@ -1,24 +1,22 @@ using AppData; -using SteamWare; -using System; using System.Web.Http; namespace NKC_WF.Controllers { - public class getMUSheetRevController : ApiController - { - // GET api/getMUSheetRevController - public int Get() + public class getMUSheetRevController : ApiController { - int answ = ComLib.getSheetRevByBunk(0); - return answ; - } - // GET api/getMUSheetRevController/5 - public int Get(int id) - { - int answ = ComLib.getSheetRevByBunk(id); - return answ; - } + // GET api/getMUSheetRevController + public int Get() + { + int answ = ComLib.getSheetRevByBunk(0); + return answ; + } + // GET api/getMUSheetRevController/5 + public int Get(int id) + { + int answ = ComLib.getSheetRevByBunk(id); + return answ; + } - } + } } \ No newline at end of file diff --git a/NKC_WF/Default.aspx.cs b/NKC_WF/Default.aspx.cs index 6228fc4..963670f 100644 --- a/NKC_WF/Default.aspx.cs +++ b/NKC_WF/Default.aspx.cs @@ -1,17 +1,12 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using System.Web.UI; -using System.Web.UI.WebControls; namespace NKC_WF { - public partial class Default : System.Web.UI.Page - { - protected void Page_Load(object sender, EventArgs e) + public partial class Default : System.Web.UI.Page { - Response.Redirect("site/Default"); + protected void Page_Load(object sender, EventArgs e) + { + Response.Redirect("site/Default"); + } } - } } \ No newline at end of file diff --git a/NKC_WF/ErrorPages/Oops.aspx.cs b/NKC_WF/ErrorPages/Oops.aspx.cs index 8d0b95c..f03fb9e 100644 --- a/NKC_WF/ErrorPages/Oops.aspx.cs +++ b/NKC_WF/ErrorPages/Oops.aspx.cs @@ -1,17 +1,12 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using System.Web.UI; -using System.Web.UI.WebControls; namespace NKC_WF.ErrorPages { - public partial class Oops : System.Web.UI.Page - { - protected void Page_Load(object sender, EventArgs e) + public partial class Oops : System.Web.UI.Page { + protected void Page_Load(object sender, EventArgs e) + { + } } - } } \ No newline at end of file diff --git a/NKC_WF/Global.asax.cs b/NKC_WF/Global.asax.cs index d36b691..b41015a 100644 --- a/NKC_WF/Global.asax.cs +++ b/NKC_WF/Global.asax.cs @@ -7,16 +7,16 @@ using System.Web.Routing; namespace NKC_WF { - public class Global : HttpApplication - { - void Application_Start(object sender, EventArgs e) + public class Global : HttpApplication { - // Codice eseguito all'avvio dell'applicazione - AreaRegistration.RegisterAllAreas(); - GlobalConfiguration.Configure(WebApiConfig.Register); - FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); - RouteConfig.RegisterRoutes(RouteTable.Routes); - BundleConfig.RegisterBundles(BundleTable.Bundles); + void Application_Start(object sender, EventArgs e) + { + // Codice eseguito all'avvio dell'applicazione + AreaRegistration.RegisterAllAreas(); + GlobalConfiguration.Configure(WebApiConfig.Register); + FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); + RouteConfig.RegisterRoutes(RouteTable.Routes); + BundleConfig.RegisterBundles(BundleTable.Bundles); + } } - } } \ No newline at end of file diff --git a/NKC_WF/Home.aspx.cs b/NKC_WF/Home.aspx.cs index 79a73fa..f056404 100644 --- a/NKC_WF/Home.aspx.cs +++ b/NKC_WF/Home.aspx.cs @@ -1,17 +1,12 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using System.Web.UI; -using System.Web.UI.WebControls; namespace NKC_WF { - public partial class Home1 : System.Web.UI.Page - { - protected void Page_Load(object sender, EventArgs e) + public partial class Home1 : System.Web.UI.Page { - Response.Redirect("site/"); + protected void Page_Load(object sender, EventArgs e) + { + Response.Redirect("site/"); + } } - } } \ No newline at end of file diff --git a/NKC_WF/Properties/AssemblyInfo.cs b/NKC_WF/Properties/AssemblyInfo.cs index 795ae13..c1c5023 100644 --- a/NKC_WF/Properties/AssemblyInfo.cs +++ b/NKC_WF/Properties/AssemblyInfo.cs @@ -1,5 +1,4 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // Le informazioni generali relative a un assembly sono controllate dal seguente diff --git a/NKC_WF/Site.Master.cs b/NKC_WF/Site.Master.cs index 67ee19a..5e10eda 100644 --- a/NKC_WF/Site.Master.cs +++ b/NKC_WF/Site.Master.cs @@ -1,36 +1,32 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; using System.Web.UI; -using System.Web.UI.WebControls; namespace NKC_WF { - public partial class SiteMaster : MasterPage - { - protected void Page_Load(object sender, EventArgs e) + public partial class SiteMaster : MasterPage { - cmp_footer.eh_doRefresh += Cmp_footer_eh_doRefresh; - } + protected void Page_Load(object sender, EventArgs e) + { + cmp_footer.eh_doRefresh += Cmp_footer_eh_doRefresh; + } - private void Cmp_footer_eh_doRefresh(object sender, EventArgs e) - { - // faccio refresh pagina... + private void Cmp_footer_eh_doRefresh(object sender, EventArgs e) + { + // faccio refresh pagina... + } + /// + /// Imposta vilibilità componente search globale + /// + public bool showSearch + { + get + { + return cmp_menuTop.showSearch; + } + set + { + cmp_menuTop.showSearch = value; + } + } } - /// - /// Imposta vilibilità componente search globale - /// - public bool showSearch - { - get - { - return cmp_menuTop.showSearch; - } - set - { - cmp_menuTop.showSearch = value; - } - } - } } \ No newline at end of file diff --git a/NKC_WF/SiteContent.master.cs b/NKC_WF/SiteContent.master.cs index 841e703..6f02653 100644 --- a/NKC_WF/SiteContent.master.cs +++ b/NKC_WF/SiteContent.master.cs @@ -2,25 +2,25 @@ namespace NKC_WF { - public partial class SiteContent : System.Web.UI.MasterPage - { - protected void Page_Load(object sender, EventArgs e) + public partial class SiteContent : System.Web.UI.MasterPage { + protected void Page_Load(object sender, EventArgs e) + { + } + /// + /// Imposta vilibilità componente search globale + /// + public bool showSearch + { + get + { + return ((SiteMaster)Master).showSearch; + } + set + { + ((SiteMaster)Master).showSearch = value; + } + } } - /// - /// Imposta vilibilità componente search globale - /// - public bool showSearch - { - get - { - return ((SiteMaster)Master).showSearch; - } - set - { - ((SiteMaster)Master).showSearch = value; - } - } - } } \ No newline at end of file diff --git a/NKC_WF/WebUserControls/cmp_BP_bunkList.ascx.cs b/NKC_WF/WebUserControls/cmp_BP_bunkList.ascx.cs index 20e8b02..d3e4422 100644 --- a/NKC_WF/WebUserControls/cmp_BP_bunkList.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_BP_bunkList.ascx.cs @@ -1,122 +1,118 @@ 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_bunkList : BaseUserControl - { - protected void Page_Load(object sender, EventArgs e) + public partial class cmp_BP_bunkList : BaseUserControl { - - } - /// - /// Batch corrente... - /// - public int BatchId - { - set - { - hfBatchID.Value = value.ToString(); - } - get - { - int answ = 0; - int.TryParse(hfBatchID.Value, out answ); - return answ; - } - } - - protected void grView_RowCommand(object sender, GridViewCommandEventArgs e) - { - // recupero argomento = Takt... - try - { - string stack = e.CommandArgument.ToString(); - //lblStack.Text = stack; - } - catch - { } - } - protected void grView_SelectedIndexChanged(object sender, EventArgs e) - { - checkVisibility(); - raiseEvent(); - } - /// - /// comando reset - /// - /// - /// - protected void lbtReset_Click(object sender, EventArgs e) - { - resetSelezione(); - } - - private void checkVisibility() - { - //divSelected.Visible = StackIdSel > 0; - //grView.Visible = !divSelected.Visible; - //// imposto css titolo... - //string titleClass = "row font-weight-bold"; - //if (divSelected.Visible) - //{ - // titleClass += " table-info"; - //} - //divTitle.Attributes.Remove("class"); - //divTitle.Attributes.Add("class", titleClass); - } - public void resetSelezione() - { - //lblStack.Text = ""; - grView.SelectedIndex = -1; - grView.DataBind(); - checkVisibility(); - raiseEvent(); - } - /// - /// Indice selezionato - /// - public int selIndex - { - get - { - return grView.SelectedIndex; - } - set - { - grView.SelectedIndex = value; - } - } - /// - /// BunkId selezionato - /// - public int BunkIdSel - { - get - { - int answ = 0; - try + protected void Page_Load(object sender, EventArgs e) { - int.TryParse(grView.SelectedValue.ToString(), out answ); + + } + /// + /// Batch corrente... + /// + public int BatchId + { + set + { + hfBatchID.Value = value.ToString(); + } + get + { + int answ = 0; + int.TryParse(hfBatchID.Value, out answ); + return answ; + } + } + + protected void grView_RowCommand(object sender, GridViewCommandEventArgs e) + { + // recupero argomento = Takt... + try + { + string stack = e.CommandArgument.ToString(); + //lblStack.Text = stack; + } + catch + { } + } + protected void grView_SelectedIndexChanged(object sender, EventArgs e) + { + checkVisibility(); + raiseEvent(); + } + /// + /// comando reset + /// + /// + /// + protected void lbtReset_Click(object sender, EventArgs e) + { + resetSelezione(); + } + + private void checkVisibility() + { + //divSelected.Visible = StackIdSel > 0; + //grView.Visible = !divSelected.Visible; + //// imposto css titolo... + //string titleClass = "row font-weight-bold"; + //if (divSelected.Visible) + //{ + // titleClass += " table-info"; + //} + //divTitle.Attributes.Remove("class"); + //divTitle.Attributes.Add("class", titleClass); + } + public void resetSelezione() + { + //lblStack.Text = ""; + grView.SelectedIndex = -1; + grView.DataBind(); + checkVisibility(); + raiseEvent(); + } + /// + /// Indice selezionato + /// + public int selIndex + { + get + { + return grView.SelectedIndex; + } + set + { + grView.SelectedIndex = value; + } + } + /// + /// BunkId selezionato + /// + public int BunkIdSel + { + get + { + int answ = 0; + try + { + int.TryParse(grView.SelectedValue.ToString(), out answ); + } + catch + { } + return answ; + } + } + /// + /// Num totale bunks + /// + public int numBunks + { + get + { + return grView.Rows.Count; + } } - catch - { } - return answ; - } } - /// - /// Num totale bunks - /// - public int numBunks - { - get - { - return grView.Rows.Count; - } - } - } } \ No newline at end of file diff --git a/NKC_WF/WebUserControls/cmp_BP_sheetList.ascx.cs b/NKC_WF/WebUserControls/cmp_BP_sheetList.ascx.cs index 0ef10ba..f433ec7 100644 --- a/NKC_WF/WebUserControls/cmp_BP_sheetList.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_BP_sheetList.ascx.cs @@ -1,112 +1,107 @@ 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_sheetList : BaseUserControl - { - protected void Page_Load(object sender, EventArgs e) + public partial class cmp_BP_sheetList : BaseUserControl { - - } - /// - /// Bunk corrente... - /// - public int BunkId - { - set - { - hfStackID.Value = value.ToString(); - grView.DataBind(); - } - get - { - int answ = 0; - int.TryParse(hfStackID.Value, out answ); - return answ; - } - } - // - /// Indice selezionato - /// - public int selIndex - { - get - { - return grView.SelectedIndex; - } - set - { - grView.SelectedIndex = value; - } - } - /// - /// SheetId selezionato - /// - public int SheetIdSel - { - get - { - int answ = 0; - try + protected void Page_Load(object sender, EventArgs e) { - int.TryParse(grView.SelectedValue.ToString(), out answ); + + } + /// + /// Bunk corrente... + /// + public int BunkId + { + set + { + hfStackID.Value = value.ToString(); + grView.DataBind(); + } + get + { + int answ = 0; + int.TryParse(hfStackID.Value, out answ); + return answ; + } + } + // + /// Indice selezionato + /// + public int selIndex + { + get + { + return grView.SelectedIndex; + } + set + { + grView.SelectedIndex = value; + } + } + /// + /// SheetId selezionato + /// + public int SheetIdSel + { + get + { + int answ = 0; + try + { + int.TryParse(grView.SelectedValue.ToString(), out answ); + } + catch + { } + return answ; + } + } + /// + /// comando reset + /// + /// + /// + protected void lbtReset_Click(object sender, EventArgs e) + { + resetSelezione(); + } + public void resetSelezione() + { + //lblStack.Text = ""; + grView.SelectedIndex = -1; + grView.DataBind(); + raiseEvent(); } - catch - { } - return answ; - } - } - /// - /// comando reset - /// - /// - /// - protected void lbtReset_Click(object sender, EventArgs e) - { - resetSelezione(); - } - public void resetSelezione() - { - //lblStack.Text = ""; - grView.SelectedIndex = -1; - grView.DataBind(); - raiseEvent(); - } - protected void grView_SelectedIndexChanged(object sender, EventArgs e) - { - raiseEvent(); - } - /// - /// Formatta in min/sec il tempo in sec decimale - /// - /// - /// - public string formatMinSec(object _timeSec) - { - int totSec = 0; - string answ = ""; - int.TryParse(_timeSec.ToString().Replace(".",""), out totSec); - int numMin = totSec / 60; - int numSec = totSec - (60 * numMin); - answ = $"{numMin:00}:{numSec:00}"; - return answ; - } + protected void grView_SelectedIndexChanged(object sender, EventArgs e) + { + raiseEvent(); + } + /// + /// Formatta in min/sec il tempo in sec decimale + /// + /// + /// + public string formatMinSec(object _timeSec) + { + int totSec = 0; + string answ = ""; + int.TryParse(_timeSec.ToString().Replace(".", ""), out totSec); + int numMin = totSec / 60; + int numSec = totSec - (60 * numMin); + answ = $"{numMin:00}:{numSec:00}"; + return answ; + } - /// - /// Num totale Sheets - /// - public int numSheets - { - get - { - return grView.Rows.Count; - } + /// + /// Num totale Sheets + /// + public int numSheets + { + get + { + return grView.Rows.Count; + } + } } - } } \ No newline at end of file diff --git a/NKC_WF/WebUserControls/cmp_ErrorsLog.ascx.cs b/NKC_WF/WebUserControls/cmp_ErrorsLog.ascx.cs index c3ff8c6..ef53342 100644 --- a/NKC_WF/WebUserControls/cmp_ErrorsLog.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_ErrorsLog.ascx.cs @@ -2,26 +2,26 @@ namespace NKC_WF.WebUserControls { - public partial class cmp_ErrorsLog : System.Web.UI.UserControl - { - protected void Page_Load(object sender, EventArgs e) + public partial class cmp_ErrorsLog : System.Web.UI.UserControl { + protected void Page_Load(object sender, EventArgs e) + { + } + /// + /// PArametro filtraggio errori + /// + public string Puid + { + get + { + return hfPuid.Value; + } + set + { + hfPuid.Value = value; + grView.DataBind(); + } + } } - /// - /// PArametro filtraggio errori - /// - public string Puid - { - get - { - return hfPuid.Value; - } - set - { - hfPuid.Value = value; - grView.DataBind(); - } - } - } } \ No newline at end of file diff --git a/NKC_WF/WebUserControls/cmp_ML_ShDet.ascx.cs b/NKC_WF/WebUserControls/cmp_ML_ShDet.ascx.cs index 7f5a8b3..0a436fe 100644 --- a/NKC_WF/WebUserControls/cmp_ML_ShDet.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_ML_ShDet.ascx.cs @@ -2,123 +2,123 @@ namespace NKC_WF.WebUserControls { - public partial class cmp_ML_ShDet : BaseUserControl - { - protected void Page_Load(object sender, EventArgs e) + public partial class cmp_ML_ShDet : BaseUserControl { + protected void Page_Load(object sender, EventArgs e) + { - } + } - public int StatusReqStart - { - get - { - int answ = 0; - int.TryParse(hfStatus.Value, out answ); - return answ; - } - set - { - hfStatus.Value = value.ToString(); - // update generale - doUpdate(); - } - } - public int StatusReqEnd - { - get - { - int answ = 0; - int.TryParse(hfStatusEnd.Value, out answ); - return answ; - } - set - { - hfStatusEnd.Value = value.ToString(); - // update generale - doUpdate(); - } - } - public int BatchId - { - set - { - hfBatchID.Value = value.ToString(); - doUpdate(); - } - get - { - int answ = 0; - int.TryParse(hfBatchID.Value, out answ); - return answ; - } - } + public int StatusReqStart + { + get + { + int answ = 0; + int.TryParse(hfStatus.Value, out answ); + return answ; + } + set + { + hfStatus.Value = value.ToString(); + // update generale + doUpdate(); + } + } + public int StatusReqEnd + { + get + { + int answ = 0; + int.TryParse(hfStatusEnd.Value, out answ); + return answ; + } + set + { + hfStatusEnd.Value = value.ToString(); + // update generale + doUpdate(); + } + } + public int BatchId + { + set + { + hfBatchID.Value = value.ToString(); + doUpdate(); + } + get + { + int answ = 0; + int.TryParse(hfBatchID.Value, out answ); + return answ; + } + } - public string getCss(object _status) - { - string answ = ""; - int status = -10; - int.TryParse(_status.ToString(), out status); - string colore = "dark"; - switch (status) - { - case 1: - case 3: - case 5: - colore = "success"; - break; - case 2: - case 4: - case 6: - colore = "warning"; - break; - default: - colore = "secondary"; - break; - } - answ = $"alert-{colore} border border-{colore}"; - return answ; - } + public string getCss(object _status) + { + string answ = ""; + int status = -10; + int.TryParse(_status.ToString(), out status); + string colore = "dark"; + switch (status) + { + case 1: + case 3: + case 5: + colore = "success"; + break; + case 2: + case 4: + case 6: + colore = "warning"; + break; + default: + colore = "secondary"; + break; + } + answ = $"alert-{colore} border border-{colore}"; + return answ; + } - public void doUpdate() - { - // sistemo filtraggio frmView - frmView.DataBind(); - } + public void doUpdate() + { + // sistemo filtraggio frmView + frmView.DataBind(); + } - public string getTitle(object _status) - { - string answ = ""; - int status = -10; - int.TryParse(_status.ToString(), out status); - switch (status) - { - case 0: - answ = traduci("Loading"); - break; - case 1: - answ = traduci("Printing"); - break; - case 2: - answ = traduci("Printed"); - break; - case 3: - answ = traduci("Machining"); - break; - case 4: - answ = traduci("Machined"); - break; - case 5: - answ = traduci("Unloading"); - break; - case 6: - answ = traduci("Unloaded"); - break; - default: - answ = traduci("NotStarted"); - break; - } - return answ; + public string getTitle(object _status) + { + string answ = ""; + int status = -10; + int.TryParse(_status.ToString(), out status); + switch (status) + { + case 0: + answ = traduci("Loading"); + break; + case 1: + answ = traduci("Printing"); + break; + case 2: + answ = traduci("Printed"); + break; + case 3: + answ = traduci("Machining"); + break; + case 4: + answ = traduci("Machined"); + break; + case 5: + answ = traduci("Unloading"); + break; + case 6: + answ = traduci("Unloaded"); + break; + default: + answ = traduci("NotStarted"); + break; + } + return answ; + } } - } } \ No newline at end of file diff --git a/NKC_WF/WebUserControls/cmp_MU_Items.ascx.cs b/NKC_WF/WebUserControls/cmp_MU_Items.ascx.cs index 3ec3810..5c95027 100644 --- a/NKC_WF/WebUserControls/cmp_MU_Items.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_MU_Items.ascx.cs @@ -1,113 +1,108 @@ 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_MU_Items : System.Web.UI.UserControl - { - /// - /// Sheet corrente... - /// - public int SheetID - { - set - { - hfSheetID.Value = value.ToString(); - doUpdate(); - } - get - { - int answ = 0; - int.TryParse(hfSheetID.Value, out answ); - return answ; - } - } - /// - /// Indica se mostrare o meno QRCode - /// - public bool ShowQr - { - set - { - hfShowQr.Value = value.ToString(); - } - get - { - bool answ = false; - bool.TryParse(hfShowQr.Value, out answ); - return answ; - } - } - /// - /// restituisce URL immagine QRCode - /// - /// - /// - public string getImgUrl(object currId) - { - string baseUrl = "https://qrcode.steamware.net/HOME/QR_site/JSON?val="; - string payload = "{'baseUrl':'{0}','parameters':['" + currId.ToString() + "']}"; - string answ = $"{baseUrl}{payload}"; - return answ; - } - protected void Page_Load(object sender, EventArgs e) + public partial class cmp_MU_Items : System.Web.UI.UserControl { + /// + /// Sheet corrente... + /// + public int SheetID + { + set + { + hfSheetID.Value = value.ToString(); + doUpdate(); + } + get + { + int answ = 0; + int.TryParse(hfSheetID.Value, out answ); + return answ; + } + } + /// + /// Indica se mostrare o meno QRCode + /// + public bool ShowQr + { + set + { + hfShowQr.Value = value.ToString(); + } + get + { + bool answ = false; + bool.TryParse(hfShowQr.Value, out answ); + return answ; + } + } + /// + /// restituisce URL immagine QRCode + /// + /// + /// + public string getImgUrl(object currId) + { + string baseUrl = "https://qrcode.steamware.net/HOME/QR_site/JSON?val="; + string payload = "{'baseUrl':'{0}','parameters':['" + currId.ToString() + "']}"; + string answ = $"{baseUrl}{payload}"; + return answ; + } + protected void Page_Load(object sender, EventArgs e) + { + } + public void doUpdate() + { + grView.DataBind(); + } + /// + /// Dimensione QRCode + /// + public int qrSize + { + get + { + int answ = 32; + int.TryParse(hfQrSize.Value, out answ); + return answ; + } + set + { + hfQrSize.Value = value.ToString(); + doUpdate(); + } + } + /// + /// Calcola css da statusID + /// + /// + /// + public string cssByStatus(object _statusID) + { + string answ = "text-secondary"; + int statusID = 0; + int.TryParse(_statusID.ToString(), out statusID); + switch (statusID) + { + case 1: + answ = "text-dark"; + break; + case 2: + answ = "text-warning"; + break; + case 3: + answ = "text-success"; + break; + case 4: + answ = "text-info"; + break; + default: + answ = "text-danger"; + break; + } + return answ; + } } - public void doUpdate() - { - grView.DataBind(); - } - /// - /// Dimensione QRCode - /// - public int qrSize - { - get - { - int answ = 32; - int.TryParse(hfQrSize.Value, out answ); - return answ; - } - set - { - hfQrSize.Value = value.ToString(); - doUpdate(); - } - } - /// - /// Calcola css da statusID - /// - /// - /// - public string cssByStatus(object _statusID) - { - string answ = "text-secondary"; - int statusID = 0; - int.TryParse(_statusID.ToString(), out statusID); - switch (statusID) - { - case 1: - answ = "text-dark"; - break; - case 2: - answ = "text-warning"; - break; - case 3: - answ = "text-success"; - break; - case 4: - answ = "text-info"; - break; - default: - answ = "text-danger"; - break; - } - return answ; - } - } } \ No newline at end of file diff --git a/NKC_WF/WebUserControls/cmp_MU_bins.ascx.cs b/NKC_WF/WebUserControls/cmp_MU_bins.ascx.cs index 3a5b60e..fa65a36 100644 --- a/NKC_WF/WebUserControls/cmp_MU_bins.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_MU_bins.ascx.cs @@ -1,121 +1,116 @@ 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_MU_bins : System.Web.UI.UserControl - { - /// - /// Batch corrente... - /// - public int BatchId - { - set - { - hfBatchID.Value = value.ToString(); - doUpdate(); - } - get - { - int answ = 0; - int.TryParse(hfBatchID.Value, out answ); - return answ; - } - } - /// - /// Indica se mostrare o meno QRCode - /// - public bool ShowQr - { - set - { - hfShowQr.Value = value.ToString(); - } - get - { - bool answ = false; - bool.TryParse(hfShowQr.Value, out answ); - return answ; - } - } - /// - /// restituisce URL immagine QRCode - /// - /// - /// - public string getImgUrl(object currId) - { - string baseUrl = "https://qrcode.steamware.net/HOME/QR_site/JSON?val="; - string payload = "{'baseUrl':'{0}','parameters':['" + currId.ToString() + "']}"; - string answ = $"{baseUrl}{payload}"; - return answ; - } - protected void Page_Load(object sender, EventArgs e) + public partial class cmp_MU_bins : System.Web.UI.UserControl { + /// + /// Batch corrente... + /// + public int BatchId + { + set + { + hfBatchID.Value = value.ToString(); + doUpdate(); + } + get + { + int answ = 0; + int.TryParse(hfBatchID.Value, out answ); + return answ; + } + } + /// + /// Indica se mostrare o meno QRCode + /// + public bool ShowQr + { + set + { + hfShowQr.Value = value.ToString(); + } + get + { + bool answ = false; + bool.TryParse(hfShowQr.Value, out answ); + return answ; + } + } + /// + /// restituisce URL immagine QRCode + /// + /// + /// + public string getImgUrl(object currId) + { + string baseUrl = "https://qrcode.steamware.net/HOME/QR_site/JSON?val="; + string payload = "{'baseUrl':'{0}','parameters':['" + currId.ToString() + "']}"; + string answ = $"{baseUrl}{payload}"; + return answ; + } + protected void Page_Load(object sender, EventArgs e) + { + } + public void doUpdate() + { + grView.DataBind(); + } + /// + /// Calcola il rapporto tra 2 valori + /// + /// + /// + /// + public double getRatio(object _dividendo, object _divisore) + { + double ratio = 0; + double dividendo = 0; + double divisore = 1; + double.TryParse(_dividendo.ToString(), out dividendo); + double.TryParse(_divisore.ToString(), out divisore); + ratio = dividendo / divisore; + return ratio; + } + /// + /// determina CSS x colore testo da perc svuotamento... + /// + /// + /// + public string getCssByRatio(double ratio) + { + string answ = "text-dark"; + if (ratio == 0) + { + answ = "text-danger"; + } + else if (ratio == 1) + { + answ = "text-success"; + } + else + { + answ = "text-warning"; + } + return answ; + } + /// + /// Dimensione QRCode + /// + public int qrSize + { + get + { + int answ = 32; + int.TryParse(hfQrSize.Value, out answ); + return answ; + } + set + { + hfQrSize.Value = value.ToString(); + doUpdate(); + } + } } - public void doUpdate() - { - grView.DataBind(); - } - /// - /// Calcola il rapporto tra 2 valori - /// - /// - /// - /// - public double getRatio(object _dividendo, object _divisore) - { - double ratio = 0; - double dividendo = 0; - double divisore = 1; - double.TryParse(_dividendo.ToString(), out dividendo); - double.TryParse(_divisore.ToString(), out divisore); - ratio = dividendo / divisore; - return ratio; - } - /// - /// determina CSS x colore testo da perc svuotamento... - /// - /// - /// - public string getCssByRatio(double ratio) - { - string answ = "text-dark"; - if (ratio == 0) - { - answ = "text-danger"; - } - else if (ratio == 1) - { - answ = "text-success"; - } - else - { - answ = "text-warning"; - } - return answ; - } - /// - /// Dimensione QRCode - /// - public int qrSize - { - get - { - int answ = 32; - int.TryParse(hfQrSize.Value, out answ); - return answ; - } - set - { - hfQrSize.Value = value.ToString(); - doUpdate(); - } - } - } } \ No newline at end of file diff --git a/NKC_WF/WebUserControls/cmp_MU_carts.ascx.cs b/NKC_WF/WebUserControls/cmp_MU_carts.ascx.cs index 81e42f7..4bb41fe 100644 --- a/NKC_WF/WebUserControls/cmp_MU_carts.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_MU_carts.ascx.cs @@ -1,121 +1,116 @@ 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_MU_carts : System.Web.UI.UserControl - { - /// - /// Batch corrente... - /// - public int BatchId - { - set - { - hfBatchID.Value = value.ToString(); - doUpdate(); - } - get - { - int answ = 0; - int.TryParse(hfBatchID.Value, out answ); - return answ; - } - } - /// - /// Indica se mostrare o meno QRCode - /// - public bool ShowQr - { - set - { - hfShowQr.Value = value.ToString(); - } - get - { - bool answ = false; - bool.TryParse(hfShowQr.Value, out answ); - return answ; - } - } - /// - /// restituisce URL immagine QRCode - /// - /// - /// - public string getImgUrl(object currId) - { - string baseUrl = "https://qrcode.steamware.net/HOME/QR_site/JSON?val="; - string payload = "{'baseUrl':'{0}','parameters':['" + currId.ToString() + "']}"; - string answ = $"{baseUrl}{payload}"; - return answ; - } - protected void Page_Load(object sender, EventArgs e) + public partial class cmp_MU_carts : System.Web.UI.UserControl { + /// + /// Batch corrente... + /// + public int BatchId + { + set + { + hfBatchID.Value = value.ToString(); + doUpdate(); + } + get + { + int answ = 0; + int.TryParse(hfBatchID.Value, out answ); + return answ; + } + } + /// + /// Indica se mostrare o meno QRCode + /// + public bool ShowQr + { + set + { + hfShowQr.Value = value.ToString(); + } + get + { + bool answ = false; + bool.TryParse(hfShowQr.Value, out answ); + return answ; + } + } + /// + /// restituisce URL immagine QRCode + /// + /// + /// + public string getImgUrl(object currId) + { + string baseUrl = "https://qrcode.steamware.net/HOME/QR_site/JSON?val="; + string payload = "{'baseUrl':'{0}','parameters':['" + currId.ToString() + "']}"; + string answ = $"{baseUrl}{payload}"; + return answ; + } + protected void Page_Load(object sender, EventArgs e) + { + } + public void doUpdate() + { + grView.DataBind(); + } + /// + /// Calcola il rapporto tra 2 valori + /// + /// + /// + /// + public double getRatio(object _dividendo, object _divisore) + { + double ratio = 0; + double dividendo = 0; + double divisore = 1; + double.TryParse(_dividendo.ToString(), out dividendo); + double.TryParse(_divisore.ToString(), out divisore); + ratio = dividendo / divisore; + return ratio; + } + /// + /// determina CSS x colore testo da perc svuotamento... + /// + /// + /// + public string getCssByRatio(double ratio) + { + string answ = "text-dark"; + if (ratio == 0) + { + answ = "text-danger"; + } + else if (ratio == 1) + { + answ = "text-success"; + } + else + { + answ = "text-warning"; + } + return answ; + } + /// + /// Dimensione QRCode + /// + public int qrSize + { + get + { + int answ = 32; + int.TryParse(hfQrSize.Value, out answ); + return answ; + } + set + { + hfQrSize.Value = value.ToString(); + doUpdate(); + } + } } - public void doUpdate() - { - grView.DataBind(); - } - /// - /// Calcola il rapporto tra 2 valori - /// - /// - /// - /// - public double getRatio(object _dividendo, object _divisore) - { - double ratio = 0; - double dividendo = 0; - double divisore = 1; - double.TryParse(_dividendo.ToString(), out dividendo); - double.TryParse(_divisore.ToString(), out divisore); - ratio = dividendo / divisore; - return ratio; - } - /// - /// determina CSS x colore testo da perc svuotamento... - /// - /// - /// - public string getCssByRatio(double ratio) - { - string answ = "text-dark"; - if (ratio == 0) - { - answ = "text-danger"; - } - else if (ratio == 1) - { - answ = "text-success"; - } - else - { - answ = "text-warning"; - } - return answ; - } - /// - /// Dimensione QRCode - /// - public int qrSize - { - get - { - int answ = 32; - int.TryParse(hfQrSize.Value, out answ); - return answ; - } - set - { - hfQrSize.Value = value.ToString(); - doUpdate(); - } - } - } } \ No newline at end of file diff --git a/NKC_WF/WebUserControls/cmp_MU_singleStat.ascx.cs b/NKC_WF/WebUserControls/cmp_MU_singleStat.ascx.cs index 6c2dcb7..af413f8 100644 --- a/NKC_WF/WebUserControls/cmp_MU_singleStat.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_MU_singleStat.ascx.cs @@ -1,62 +1,56 @@ -using AppData; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using System.Web.UI; -using System.Web.UI.WebControls; +using System; namespace NKC_WF.WebUserControls { - public partial class cmp_MU_singleStat : System.Web.UI.UserControl - { - /// - /// Batch corrente... - /// - public int BatchId + public partial class cmp_MU_singleStat : System.Web.UI.UserControl { - set - { - hfBatchID.Value = value.ToString(); - doUpdate(); - } - get - { - int answ = 0; - int.TryParse(hfBatchID.Value, out answ); - return answ; - } - } - /// - /// Tipo statistica richiesta - /// - public int statLevel - { - set - { - hfStatLevel.Value = value.ToString(); - } - get - { - int answ = 0; - int.TryParse(hfStatLevel.Value, out answ); - return answ; - } + /// + /// Batch corrente... + /// + public int BatchId + { + set + { + hfBatchID.Value = value.ToString(); + doUpdate(); + } + get + { + int answ = 0; + int.TryParse(hfBatchID.Value, out answ); + return answ; + } + } + /// + /// Tipo statistica richiesta + /// + public int statLevel + { + set + { + hfStatLevel.Value = value.ToString(); + } + get + { + int answ = 0; + int.TryParse(hfStatLevel.Value, out answ); + return answ; + } + } + protected void Page_Load(object sender, EventArgs e) + { + } + /// + /// Css titolo + /// + public string titleCss { get; set; } = "bg-dark text-light"; + /// + /// Valirizzazione variabili + /// + public void doUpdate() + { + frmView.DataBind(); + } } - protected void Page_Load(object sender, EventArgs e) - { - } - /// - /// Css titolo - /// - public string titleCss { get; set; } = "bg-dark text-light"; - /// - /// Valirizzazione variabili - /// - public void doUpdate() - { - frmView.DataBind(); - } - } } \ No newline at end of file diff --git a/NKC_WF/WebUserControls/cmp_MU_stats.ascx.cs b/NKC_WF/WebUserControls/cmp_MU_stats.ascx.cs index 38f5b3a..b8d0b17 100644 --- a/NKC_WF/WebUserControls/cmp_MU_stats.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_MU_stats.ascx.cs @@ -1,104 +1,99 @@ using AppData; 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_MU_stats : System.Web.UI.UserControl - { - /// - /// Batch corrente... - /// - public int BatchId + public partial class cmp_MU_stats : System.Web.UI.UserControl { - set - { - hfBatchID.Value = value.ToString(); - doUpdate(); - } - get - { - int answ = 0; - int.TryParse(hfBatchID.Value, out answ); - return answ; - } + /// + /// Batch corrente... + /// + public int BatchId + { + set + { + hfBatchID.Value = value.ToString(); + doUpdate(); + } + get + { + int answ = 0; + int.TryParse(hfBatchID.Value, out answ); + return answ; + } + } + protected void Page_Load(object sender, EventArgs e) + { + + } + public void doUpdate() + { + + // fix x BIN + cmp_MU_singleStatBin.BatchId = BatchId; + cmp_MU_singleStatBin.statLevel = (int)StatType.BIN; + cmp_MU_singleStatBin.titleCss = "bg-primary text-light"; + + + // fix x BATCH + cmp_MU_singleStatBatch.BatchId = BatchId; + cmp_MU_singleStatBatch.statLevel = (int)StatType.BATCH; + cmp_MU_singleStatBatch.titleCss = "bg-info"; + + // fix x BUNK + cmp_MU_singleStatBunk.BatchId = BatchId; + cmp_MU_singleStatBunk.statLevel = (int)StatType.BUNK; + cmp_MU_singleStatBunk.titleCss = "bg-secondary text-light"; + + + // fix x SHEET + cmp_MU_singleStatSheet.BatchId = BatchId; + cmp_MU_singleStatSheet.statLevel = (int)StatType.SHEET; + cmp_MU_singleStatSheet.titleCss = "bg-warning"; + + // fix x CART + cmp_MU_singleStatCart.BatchId = BatchId; + cmp_MU_singleStatCart.statLevel = (int)StatType.CART; + cmp_MU_singleStatCart.titleCss = "bg-success"; + + } + /// + /// Calcola il rapporto tra 2 valori + /// + /// + /// + /// + public double getRatio(object _dividendo, object _divisore) + { + double ratio = 0; + double dividendo = 0; + double divisore = 1; + double.TryParse(_dividendo.ToString(), out dividendo); + double.TryParse(_divisore.ToString(), out divisore); + ratio = dividendo / divisore; + return ratio; + } + /// + /// determina CSS x colore testo da perc svuotamento... + /// + /// + /// + public string getCssByRatio(double ratio) + { + string answ = "text-dark"; + if (ratio == 0) + { + answ = "text-danger"; + } + else if (ratio == 1) + { + answ = "text-success"; + } + else + { + answ = "text-warning"; + } + return answ; + } } - protected void Page_Load(object sender, EventArgs e) - { - - } - public void doUpdate() - { - - // fix x BIN - cmp_MU_singleStatBin.BatchId = BatchId; - cmp_MU_singleStatBin.statLevel = (int)StatType.BIN; - cmp_MU_singleStatBin.titleCss = "bg-primary text-light"; - - - // fix x BATCH - cmp_MU_singleStatBatch.BatchId = BatchId; - cmp_MU_singleStatBatch.statLevel = (int)StatType.BATCH; - cmp_MU_singleStatBatch.titleCss = "bg-info"; - - // fix x BUNK - cmp_MU_singleStatBunk.BatchId = BatchId; - cmp_MU_singleStatBunk.statLevel = (int)StatType.BUNK; - cmp_MU_singleStatBunk.titleCss = "bg-secondary text-light"; - - - // fix x SHEET - cmp_MU_singleStatSheet.BatchId = BatchId; - cmp_MU_singleStatSheet.statLevel = (int)StatType.SHEET; - cmp_MU_singleStatSheet.titleCss = "bg-warning"; - - // fix x CART - cmp_MU_singleStatCart.BatchId = BatchId; - cmp_MU_singleStatCart.statLevel = (int)StatType.CART; - cmp_MU_singleStatCart.titleCss = "bg-success"; - - } - /// - /// Calcola il rapporto tra 2 valori - /// - /// - /// - /// - public double getRatio(object _dividendo, object _divisore) - { - double ratio = 0; - double dividendo = 0; - double divisore = 1; - double.TryParse(_dividendo.ToString(), out dividendo); - double.TryParse(_divisore.ToString(), out divisore); - ratio = dividendo / divisore; - return ratio; - } - /// - /// determina CSS x colore testo da perc svuotamento... - /// - /// - /// - public string getCssByRatio(double ratio) - { - string answ = "text-dark"; - if (ratio == 0) - { - answ = "text-danger"; - } - else if (ratio == 1) - { - answ = "text-success"; - } - else - { - answ = "text-warning"; - } - return answ; - } - } } \ No newline at end of file diff --git a/NKC_WF/WebUserControls/cmp_MU_suggestions.ascx.cs b/NKC_WF/WebUserControls/cmp_MU_suggestions.ascx.cs index cc34ba7..83992c7 100644 --- a/NKC_WF/WebUserControls/cmp_MU_suggestions.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_MU_suggestions.ascx.cs @@ -1,17 +1,12 @@ 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_MU_suggestions : System.Web.UI.UserControl - { - protected void Page_Load(object sender, EventArgs e) + public partial class cmp_MU_suggestions : System.Web.UI.UserControl { + protected void Page_Load(object sender, EventArgs e) + { + } } - } } \ No newline at end of file diff --git a/NKC_WF/WebUserControls/cmp_MU_svgViewer.ascx.cs b/NKC_WF/WebUserControls/cmp_MU_svgViewer.ascx.cs index 3e946b4..6a3b99a 100644 --- a/NKC_WF/WebUserControls/cmp_MU_svgViewer.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_MU_svgViewer.ascx.cs @@ -1,104 +1,100 @@ using AppData; using SteamWare; using System; -using System.Collections.Generic; using System.IO; -using System.Linq; -using System.Web; using System.Web.UI; -using System.Web.UI.WebControls; namespace NKC_WF.WebUserControls { - public partial class cmp_MU_svgViewer : System.Web.UI.UserControl - { - /// - /// BatchId corrente... - /// - public int BatchId + public partial class cmp_MU_svgViewer : System.Web.UI.UserControl { - set - { - hfBatchId.Value = value.ToString(); - doUpdate(); - } - get - { - int answ = 0; - int.TryParse(hfBatchId.Value, out answ); - return answ; - } - } - /// - /// Foglio corrente... - /// - public int SheetId - { - set - { - hfSheetId.Value = value.ToString(); - doUpdate(); - } - get - { - int answ = 0; - int.TryParse(hfSheetId.Value, out answ); - return answ; - } - } - /// - /// Percorso file calcolato - /// - public string filename - { - get - { - return hfFilename.Value; - } - set - { - hfFilename.Value = value; - } - } - public void doUpdate() - { - // recupero ID del foglio corrente - string answ = ""; - string baseOrig = memLayer.ML.CRS("nestBasePath").ToLower(); - string baseCurr = memLayer.ML.CRS("servBasePath").ToLower(); - try - { - var tabSheets = DataLayer.man.taSHL.getBySheetId(SheetId); - if (tabSheets.Count > 0) + /// + /// BatchId corrente... + /// + public int BatchId { - filename = tabSheets[0].DrawFilePath.ToLower().Replace(baseOrig, baseCurr); - if (memLayer.ML.CRB("userVirtDir")) - { - filename = Server.MapPath(filename); - } - answ = File.ReadAllText(filename); + set + { + hfBatchId.Value = value.ToString(); + doUpdate(); + } + get + { + int answ = 0; + int.TryParse(hfBatchId.Value, out answ); + return answ; + } + } + /// + /// Foglio corrente... + /// + public int SheetId + { + set + { + hfSheetId.Value = value.ToString(); + doUpdate(); + } + get + { + int answ = 0; + int.TryParse(hfSheetId.Value, out answ); + return answ; + } + } + /// + /// Percorso file calcolato + /// + public string filename + { + get + { + return hfFilename.Value; + } + set + { + hfFilename.Value = value; + } + } + public void doUpdate() + { + // recupero ID del foglio corrente + string answ = ""; + string baseOrig = memLayer.ML.CRS("nestBasePath").ToLower(); + string baseCurr = memLayer.ML.CRS("servBasePath").ToLower(); + try + { + var tabSheets = DataLayer.man.taSHL.getBySheetId(SheetId); + if (tabSheets.Count > 0) + { + filename = tabSheets[0].DrawFilePath.ToLower().Replace(baseOrig, baseCurr); + if (memLayer.ML.CRB("userVirtDir")) + { + filename = Server.MapPath(filename); + } + answ = File.ReadAllText(filename); + } + } + catch + { } + if (string.IsNullOrEmpty(answ)) + { + // loggo... + logger.lg.scriviLog($"SVG not found | filename: {filename} | baseOrig: {baseOrig} | baseCurr: {baseCurr} | used default SVG"); + // leggo SVG DI DEFAULT che indica NON PRESENTE... + filename = Server.MapPath("~/Images/NoData.svg"); + answ = File.ReadAllText(filename); + } + // update componente svg! + svgTable.InnerHtml = answ; + } + protected void Page_Load(object sender, EventArgs e) + { + if (!Page.IsPostBack) + { + // scrivo valore revisione batch! + hfCurrBunkRev.Value = ComLib.getSheetRevByBunk(BatchId).ToString(); + } } - } - catch - { } - if (string.IsNullOrEmpty(answ)) - { - // loggo... - logger.lg.scriviLog($"SVG not found | filename: {filename} | baseOrig: {baseOrig} | baseCurr: {baseCurr} | used default SVG"); - // leggo SVG DI DEFAULT che indica NON PRESENTE... - filename = Server.MapPath("~/Images/NoData.svg"); - answ = File.ReadAllText(filename); - } - // update componente svg! - svgTable.InnerHtml = answ; } - protected void Page_Load(object sender, EventArgs e) - { - if (!Page.IsPostBack) - { - // scrivo valore revisione batch! - hfCurrBunkRev.Value = ComLib.getSheetRevByBunk(BatchId).ToString(); - } - } - } } \ No newline at end of file diff --git a/NKC_WF/WebUserControls/cmp_OOLI_detail.ascx.cs b/NKC_WF/WebUserControls/cmp_OOLI_detail.ascx.cs index e78916b..a54a589 100644 --- a/NKC_WF/WebUserControls/cmp_OOLI_detail.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_OOLI_detail.ascx.cs @@ -2,26 +2,26 @@ namespace NKC_WF.WebUserControls { - public partial class cmp_OOLI_detail : BaseUserControl - { - protected void Page_Load(object sender, EventArgs e) + public partial class cmp_OOLI_detail : BaseUserControl { + protected void Page_Load(object sender, EventArgs e) + { + } + public int OffOrdId + { + get + { + int answ = 0; + int.TryParse(hfOffOrderId.Value, out answ); + return answ; + } + set + { + hfOffOrderId.Value = value.ToString(); + // faccio udpate svg... + grView.DataBind(); + } + } } - public int OffOrdId - { - get - { - int answ = 0; - int.TryParse(hfOffOrderId.Value, out answ); - return answ; - } - set - { - hfOffOrderId.Value = value.ToString(); - // faccio udpate svg... - grView.DataBind(); - } - } - } } \ No newline at end of file diff --git a/NKC_WF/WebUserControls/cmp_barcode.ascx.cs b/NKC_WF/WebUserControls/cmp_barcode.ascx.cs index 17f0903..237df94 100644 --- a/NKC_WF/WebUserControls/cmp_barcode.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_barcode.ascx.cs @@ -53,7 +53,7 @@ namespace NKC_WF.WebUserControls } else { - if(string.IsNullOrEmpty(lastCmd)) + if (string.IsNullOrEmpty(lastCmd)) { resetMessage(); } diff --git a/NKC_WF/WebUserControls/cmp_batchDetail.ascx.cs b/NKC_WF/WebUserControls/cmp_batchDetail.ascx.cs index e968941..be1c7ac 100644 --- a/NKC_WF/WebUserControls/cmp_batchDetail.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_batchDetail.ascx.cs @@ -9,299 +9,299 @@ using System.Text; namespace NKC_WF.WebUserControls { - public partial class cmp_batchDetail : System.Web.UI.UserControl - { - public event EventHandler eh_doRefresh; - protected void Page_Load(object sender, EventArgs e) + public partial class cmp_batchDetail : System.Web.UI.UserControl { - - } - - public int BatchId - { - set - { - hfBatchId.Value = value.ToString(); - frmView.DataBind(); - lblMatDet.Text = ""; - lblProdDet.Text = ""; - if (memLayer.ML.CRB("enableMongo")) + public event EventHandler eh_doRefresh; + protected void Page_Load(object sender, EventArgs e) { - // cerco da lista salvataggi Estim/Nest... - var estimAnsw = ComLib.man.getEstAnsw(value); - var nestAnsw = ComLib.man.getNestAnsw(value); - StringBuilder sbDebug = new StringBuilder(); - sbDebug.AppendLine("Debug Info:"); - // elenchi x ricerca duplicati - List partListEstim = new List(); - List partListEstimDupl = new List(); - List partListNest = new List(); - List partListNestDupl = new List(); - if (estimAnsw != null) - { - try - { - foreach (var part in estimAnsw.PartList) - { - if (partListEstim.Contains(part.PartId)) - { - partListEstimDupl.Add(part.PartId); - } - else - { - partListEstim.Add(part.PartId); - } - } - } - catch - { } - try - { - sbDebug.AppendLine($"ESTIM: EnvNum: {estimAnsw.EnvNum} | Worktime: {estimAnsw.EstimatedWorktime / 60:N2} min | Processing Runtime {estimAnsw.ProcessingRuntime / 60:N2} min | Parts #: {estimAnsw.PartList.Count} | Distinct Part # {partListEstim.Count}"); - // se ho duplicati indico: - if (partListEstimDupl.Count > 0) - { - sbDebug.AppendLine("---------------------"); - sbDebug.AppendLine($"ESTIM: FOUND {partListEstimDupl.Count} duplicate:"); - foreach (var partId in partListEstimDupl) - { - sbDebug.AppendLine($"{partId}"); - } - sbDebug.AppendLine("---------------------"); - } - } - catch - { } - } - if (nestAnsw != null) - { - try - { - foreach (var bunk in nestAnsw.BunkList) - { - foreach (var sheet in bunk.SheetList) - { - foreach (var part in sheet.PartList) - { - if (partListNest.Contains(part.PartId)) - { - partListNestDupl.Add(part.PartId); - } - else - { - partListNest.Add(part.PartId); - } - } - } - } - } - catch - { } - int totKit = 0; - try - { - foreach (var cart in nestAnsw.CartList) - { - totKit += cart.KitList.Count; - } - } - catch - { } - //il tot delle part è in bunk > Sheet > part - int totPartNum = 0; - int totSheet = 0; - List materialsList = new List(); - double num = 0; - double den = 1; - double currRatio = 0; - List workRatio = new List(); - try - { - foreach (var bunk in nestAnsw.BunkList) - { - totSheet += bunk.SheetList.Count; - foreach (var sheet in bunk.SheetList) - { - totPartNum += sheet.PartList.Count; - num = sheet.SurfaceWork > 0 ? sheet.SurfaceWork : 0; - den = sheet.SurfaceTotal > 0 ? sheet.SurfaceTotal : 1; - currRatio = ratioProt(num, den); - workRatio.Add(currRatio); - if (!materialsList.Contains(sheet.MatId)) - { - materialsList.Add(sheet.MatId); - } - } - } - } - catch - { } - try - { - // ordino le medie - workRatio.Sort(); - // elimino le + basse quanti materiali ci sono... - workRatio.RemoveRange(0, materialsList.Count); - double avgRatio = workRatio.Average(); - double minRatio = workRatio.Min(); - double maxRatio = workRatio.Max(); - sbDebug.AppendLine($"NEST: EnvNum: {nestAnsw.EnvNum} | Worktime: {nestAnsw.EstimatedWorktime / 60:N2} min | Processing Runtime {nestAnsw.ProcessingRuntime / 60:N2} min"); - lblMatDet.Text = $"avg: {avgRatio:P1} ({minRatio:P1}{maxRatio:P1}) | {materialsList.Count} materials"; - lblProdDet.Text = $"Bunks: {nestAnsw.BunkList.Count} | Sheets: {totSheet} | Carts: {nestAnsw.CartList.Count} | Bins: {nestAnsw.BinList.Count}"; - // se ho duplicati indico: - if (partListNestDupl.Count > 0) - { - sbDebug.AppendLine("---------------------"); - sbDebug.AppendLine($"NEST: FOUND {partListNestDupl.Count} duplicate:"); - foreach (var partId in partListNestDupl) - { - sbDebug.AppendLine($"{partId}"); - } - sbDebug.AppendLine("---------------------"); - } - // s enon corrispondono - if (partListEstim.Count != partListNest.Count) - { - sbDebug.AppendLine("---------------------"); - if (partListEstim.Count > partListNest.Count) - { - sbDebug.AppendLine($"EST OK | NEST missing:"); - foreach (var partId in partListEstim) - { - if (!partListNest.Contains(partId)) - { - sbDebug.AppendLine($"{partId}"); - } - } - } - else - { - sbDebug.AppendLine($"EST missing | NEST OK:"); - foreach (var partId in partListNest) - { - if (!partListEstim.Contains(partId)) - { - sbDebug.AppendLine($"{partId}"); - } - } - } - sbDebug.AppendLine("---------------------"); - } - } - catch - { } - } - if (memLayer.ML.CRS("environment") == "DEV") - { - lblTestJson.Text = "
" + sbDebug.Replace("\r\n", "
").ToString(); - } + } - } - get - { - int answ = 0; - int.TryParse(hfBatchId.Value, out answ); - return answ; - } - } - /// - /// Effettua divisione evitando zeri a den... - /// - /// - /// - /// - protected double ratioProt(double num, double den) - { - den = den == 0 ? 1 : den; - return num / den; - } - /// - /// Controlla se lo stato sia uguale a quello richiesto - /// - /// - /// - /// - public bool checkStatus(object _status, BatchStatus statusReq) - { - bool answ = false; - int status = -1; - int.TryParse(_status.ToString(), out status); - answ = (status == (int)statusReq); - return answ; - } - public bool canStartNew(object _status) - { - bool answ = false; - // in primis controllo SE ci siano task running, nel qual caso è false e basta... - int numEst = DataLayer.man.taBL.getByStatus((int)BatchStatus.EstimationRequested, "", 0).Count; - int numNest = DataLayer.man.taBL.getByStatus((int)BatchStatus.NestRequested, "", 0).Count; - answ = ((numEst + numNest) == 0); - return answ; - } - /// - /// Converte il codice stato in effettivo campo - /// - /// - /// - public string BStatus(object _status) - { - string answ = ComLib.BatchStatusDescr(_status); - return answ; - } - protected void lbtAccept_Click(object sender, EventArgs e) - { - // registro accettazione Nesting - DataLayer.man.taBL.acceptBatch(BatchId, DataLayer.man.CodSoggCurrUser); - raiseEvent(); + public int BatchId + { + set + { + hfBatchId.Value = value.ToString(); + frmView.DataBind(); + lblMatDet.Text = ""; + lblProdDet.Text = ""; + if (memLayer.ML.CRB("enableMongo")) + { + // cerco da lista salvataggi Estim/Nest... + var estimAnsw = ComLib.man.getEstAnsw(value); + var nestAnsw = ComLib.man.getNestAnsw(value); + StringBuilder sbDebug = new StringBuilder(); + sbDebug.AppendLine("Debug Info:"); + // elenchi x ricerca duplicati + List partListEstim = new List(); + List partListEstimDupl = new List(); + List partListNest = new List(); + List partListNestDupl = new List(); + if (estimAnsw != null) + { + try + { + foreach (var part in estimAnsw.PartList) + { + if (partListEstim.Contains(part.PartId)) + { + partListEstimDupl.Add(part.PartId); + } + else + { + partListEstim.Add(part.PartId); + } + } + } + catch + { } + try + { + sbDebug.AppendLine($"ESTIM: EnvNum: {estimAnsw.EnvNum} | Worktime: {estimAnsw.EstimatedWorktime / 60:N2} min | Processing Runtime {estimAnsw.ProcessingRuntime / 60:N2} min | Parts #: {estimAnsw.PartList.Count} | Distinct Part # {partListEstim.Count}"); + // se ho duplicati indico: + if (partListEstimDupl.Count > 0) + { + sbDebug.AppendLine("---------------------"); + sbDebug.AppendLine($"ESTIM: FOUND {partListEstimDupl.Count} duplicate:"); + foreach (var partId in partListEstimDupl) + { + sbDebug.AppendLine($"{partId}"); + } + sbDebug.AppendLine("---------------------"); + } + } + catch + { } + } + if (nestAnsw != null) + { + try + { + foreach (var bunk in nestAnsw.BunkList) + { + foreach (var sheet in bunk.SheetList) + { + foreach (var part in sheet.PartList) + { + if (partListNest.Contains(part.PartId)) + { + partListNestDupl.Add(part.PartId); + } + else + { + partListNest.Add(part.PartId); + } + } + } + } + } + catch + { } + int totKit = 0; + try + { + foreach (var cart in nestAnsw.CartList) + { + totKit += cart.KitList.Count; + } + } + catch + { } + //il tot delle part è in bunk > Sheet > part + int totPartNum = 0; + int totSheet = 0; + List materialsList = new List(); + double num = 0; + double den = 1; + double currRatio = 0; + List workRatio = new List(); + try + { + foreach (var bunk in nestAnsw.BunkList) + { + totSheet += bunk.SheetList.Count; + foreach (var sheet in bunk.SheetList) + { + totPartNum += sheet.PartList.Count; + num = sheet.SurfaceWork > 0 ? sheet.SurfaceWork : 0; + den = sheet.SurfaceTotal > 0 ? sheet.SurfaceTotal : 1; + currRatio = ratioProt(num, den); + workRatio.Add(currRatio); + if (!materialsList.Contains(sheet.MatId)) + { + materialsList.Add(sheet.MatId); + } + } + } + } + catch + { } + try + { + // ordino le medie + workRatio.Sort(); + // elimino le + basse quanti materiali ci sono... + workRatio.RemoveRange(0, materialsList.Count); + double avgRatio = workRatio.Average(); + double minRatio = workRatio.Min(); + double maxRatio = workRatio.Max(); + sbDebug.AppendLine($"NEST: EnvNum: {nestAnsw.EnvNum} | Worktime: {nestAnsw.EstimatedWorktime / 60:N2} min | Processing Runtime {nestAnsw.ProcessingRuntime / 60:N2} min"); + lblMatDet.Text = $"avg: {avgRatio:P1} ({minRatio:P1}{maxRatio:P1}) | {materialsList.Count} materials"; + lblProdDet.Text = $"Bunks: {nestAnsw.BunkList.Count} | Sheets: {totSheet} | Carts: {nestAnsw.CartList.Count} | Bins: {nestAnsw.BinList.Count}"; + // se ho duplicati indico: + if (partListNestDupl.Count > 0) + { + sbDebug.AppendLine("---------------------"); + sbDebug.AppendLine($"NEST: FOUND {partListNestDupl.Count} duplicate:"); + foreach (var partId in partListNestDupl) + { + sbDebug.AppendLine($"{partId}"); + } + sbDebug.AppendLine("---------------------"); + } + // s enon corrispondono + if (partListEstim.Count != partListNest.Count) + { + sbDebug.AppendLine("---------------------"); + if (partListEstim.Count > partListNest.Count) + { + sbDebug.AppendLine($"EST OK | NEST missing:"); + foreach (var partId in partListEstim) + { + if (!partListNest.Contains(partId)) + { + sbDebug.AppendLine($"{partId}"); + } + } + } + else + { + sbDebug.AppendLine($"EST missing | NEST OK:"); + foreach (var partId in partListNest) + { + if (!partListEstim.Contains(partId)) + { + sbDebug.AppendLine($"{partId}"); + } + } + } + sbDebug.AppendLine("---------------------"); + } + } + catch + { } + } + if (memLayer.ML.CRS("environment") == "DEV") + { + lblTestJson.Text = "
" + sbDebug.Replace("\r\n", "
").ToString(); + } + } + } + get + { + int answ = 0; + int.TryParse(hfBatchId.Value, out answ); + return answ; + } + } + /// + /// Effettua divisione evitando zeri a den... + /// + /// + /// + /// + protected double ratioProt(double num, double den) + { + den = den == 0 ? 1 : den; + return num / den; + } + /// + /// Controlla se lo stato sia uguale a quello richiesto + /// + /// + /// + /// + public bool checkStatus(object _status, BatchStatus statusReq) + { + bool answ = false; + int status = -1; + int.TryParse(_status.ToString(), out status); + answ = (status == (int)statusReq); + return answ; + } + public bool canStartNew(object _status) + { + bool answ = false; + // in primis controllo SE ci siano task running, nel qual caso è false e basta... + int numEst = DataLayer.man.taBL.getByStatus((int)BatchStatus.EstimationRequested, "", 0).Count; + int numNest = DataLayer.man.taBL.getByStatus((int)BatchStatus.NestRequested, "", 0).Count; + answ = ((numEst + numNest) == 0); + return answ; + } + /// + /// Converte il codice stato in effettivo campo + /// + /// + /// + public string BStatus(object _status) + { + string answ = ComLib.BatchStatusDescr(_status); + return answ; + } + + protected void lbtAccept_Click(object sender, EventArgs e) + { + // registro accettazione Nesting + DataLayer.man.taBL.acceptBatch(BatchId, DataLayer.man.CodSoggCurrUser); + raiseEvent(); + } + + protected void lbtStopEstim_Click(object sender, EventArgs e) + { + // !!!FIXME!!! inviare a redis... + + // registro su DB nesting iniziato... + DataLayer.man.taBL.updateStatus(BatchId, (int)BatchStatus.Imported, "", -1); + raiseEvent(); + } + + protected void lbtSendEstim_Click(object sender, EventArgs e) + { + // invia a redis una richiesta... + ComLib.sendMaterials(); + ComLib.sendBatchReq(BatchId, "Estimation", 1); + + // registro su DB nesting iniziato... + DataLayer.man.taBL.updateStatus(BatchId, (int)BatchStatus.EstimationRequested, "", 0); + raiseEvent(); + } + protected void lbtStopNesting_Click(object sender, EventArgs e) + { + // !!!FIXME!!! inviare a redis... + + // registro su DB nesting iniziato... + DataLayer.man.taBL.updateStatus(BatchId, (int)BatchStatus.EstimationDone, "", -1); + raiseEvent(); + } + + protected void lbtSendNesting_Click(object sender, EventArgs e) + { + // invia a redis a a richiesta... + ComLib.sendMaterials(); + ComLib.sendBatchReq(BatchId, "Nesting", 2); + + // registro su DB nesting iniziato... + DataLayer.man.taBL.updateStatus(BatchId, (int)BatchStatus.NestRequested, "", -1); + raiseEvent(); + } + + private void raiseEvent() + { + // se qualcuno ascolta sollevo evento nuovo valore... + if (eh_doRefresh != null) + { + eh_doRefresh(this, new EventArgs()); + } + } } - - protected void lbtStopEstim_Click(object sender, EventArgs e) - { - // !!!FIXME!!! inviare a redis... - - // registro su DB nesting iniziato... - DataLayer.man.taBL.updateStatus(BatchId, (int)BatchStatus.Imported, "", -1); - raiseEvent(); - } - - protected void lbtSendEstim_Click(object sender, EventArgs e) - { - // invia a redis una richiesta... - ComLib.sendMaterials(); - ComLib.sendBatchReq(BatchId, "Estimation", 1); - - // registro su DB nesting iniziato... - DataLayer.man.taBL.updateStatus(BatchId, (int)BatchStatus.EstimationRequested, "", 0); - raiseEvent(); - } - protected void lbtStopNesting_Click(object sender, EventArgs e) - { - // !!!FIXME!!! inviare a redis... - - // registro su DB nesting iniziato... - DataLayer.man.taBL.updateStatus(BatchId, (int)BatchStatus.EstimationDone, "", -1); - raiseEvent(); - } - - protected void lbtSendNesting_Click(object sender, EventArgs e) - { - // invia a redis a a richiesta... - ComLib.sendMaterials(); - ComLib.sendBatchReq(BatchId, "Nesting", 2); - - // registro su DB nesting iniziato... - DataLayer.man.taBL.updateStatus(BatchId, (int)BatchStatus.NestRequested, "", -1); - raiseEvent(); - } - - private void raiseEvent() - { - // se qualcuno ascolta sollevo evento nuovo valore... - if (eh_doRefresh != null) - { - eh_doRefresh(this, new EventArgs()); - } - } - } } \ No newline at end of file diff --git a/NKC_WF/WebUserControls/cmp_batchList.ascx.cs b/NKC_WF/WebUserControls/cmp_batchList.ascx.cs index 611fe5a..6595051 100644 --- a/NKC_WF/WebUserControls/cmp_batchList.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_batchList.ascx.cs @@ -1,6 +1,5 @@ using AppData; using NKC_SDK; -using SteamWare; using System; using System.Web.UI; using System.Web.UI.WebControls; @@ -243,7 +242,7 @@ namespace NKC_WF.WebUserControls deleteEnabled = false; resetSelezione(); } - + public bool deleteEnabled { get diff --git a/NKC_WF/WebUserControls/cmp_fileUpload.ascx.cs b/NKC_WF/WebUserControls/cmp_fileUpload.ascx.cs index 2dfdc0f..23b287a 100644 --- a/NKC_WF/WebUserControls/cmp_fileUpload.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_fileUpload.ascx.cs @@ -4,197 +4,197 @@ using System.IO; namespace NKC_WF.WebUserContols { - public class FileUploadEventArgs : EventArgs - { - /// - /// Evento con argomenti soppevato post fileUpload - /// - /// - /// - /// - public FileUploadEventArgs(string localPath, string fileName, string batchName) + public class FileUploadEventArgs : EventArgs { - _localPath = localPath; - _fileName = fileName; - _batchName = batchName; - } - private string _localPath; - private string _fileName; - private string _batchName; - - public string LocalPath - { - get { return _localPath; } - set { _localPath = value; } - } - public string FileName - { - get { return _fileName; } - set { _fileName = value; } - } - public string BatchName - { - get { return _batchName; } - set { _batchName = value; } - } - } - - - public partial class cmp_fileUpload : BaseUserControl - { - /// - /// Evento upload e salvataggio su server IIS del file... - /// - public event EventHandler eh_FileUploaded; - /// - /// Solelva evento salvataggio file con messaggio path/nome - /// - /// - /// - public void reportFileUploaded(FileUploadEventArgs e) - { - EventHandler handler = eh_FileUploaded; - if (handler != null) - { - handler(this, e); - } - } - - /// - /// Folder di upload temporaneo files - /// - protected string _tempUploadDir = memLayer.ML.CRS("_tempUploadDir"); - /// - /// Folder REMOTA x copia verso SQL - /// - protected string _SqlCopyDir = memLayer.ML.CRS("_SqlCopyDir"); - /// - /// Folder x SQL import - /// - protected string _SqlImportDir = memLayer.ML.CRS("_SqlImportDir"); - - - /// - /// permesso scrittura SE E' abilitato a partire dalla tab diritti... - /// - public bool userIsAuth - { - get - { - return true; - //return (idxAmm + idxFornitore > 0); - } - } - public bool isWriteEnabled - { - get - { - bool answ = false; - bool.TryParse(hfWriteEnabled.Value, out answ); - return answ; - } - set - { - hfWriteEnabled.Value = value.ToString(); - } - } - protected void Page_Load(object sender, EventArgs e) - { - if (!IsPostBack) - { - fisVisFU(false); - deleteOldFiles(); - } - divNewEdit.Visible = userIsAuth && isWriteEnabled; - } - /// - /// Procedee a bonificare la cartella di upload dei files + vecchi di 3 mesi - /// - private void deleteOldFiles() - { - string dirPath = Server.MapPath(_tempUploadDir); - // elenco files nella directory - string[] files = Directory.GetFiles(dirPath); - // li guardo tutti e se vecchi li elimino... - foreach (string file in files) - { - FileInfo fi = new FileInfo(file); - if (fi.LastAccessTime < DateTime.Now.AddMonths(-3)) - fi.Delete(); - } - } - - protected void Upload(object sender, EventArgs e) - { - string csvFileName = ""; - string uploadedFilename = ""; - string batchName = ""; - string savedFilename = ""; - string contentType = ""; - DateTime adesso = DateTime.Now; - string dirFrom = Server.MapPath(_tempUploadDir); - // se c'è un file - if (FileUpload1.PostedFile != null) - { - uploadedFilename = Path.GetFileName(FileUpload1.PostedFile.FileName.Replace(" ", "_")); - csvFileName = $"{adesso.ToString("dd-HHmmss")}_{uploadedFilename}"; - batchName = uploadedFilename.ToLower().Replace(".csv", "").Replace("cnc", "").Replace("kit", ""); - savedFilename = Server.MapPath($"{_tempUploadDir}{csvFileName}"); - contentType = FileUpload1.PostedFile.ContentType; - // accedo allo stream del file allegato - using (Stream fs = FileUpload1.PostedFile.InputStream) + /// + /// Evento con argomenti soppevato post fileUpload + /// + /// + /// + /// + public FileUploadEventArgs(string localPath, string fileName, string batchName) { - // scrivo su file - FileStream file = new FileStream(savedFilename, FileMode.Create, FileAccess.Write); - fs.CopyTo(file); - file.Close(); + _localPath = localPath; + _fileName = fileName; + _batchName = batchName; + } + private string _localPath; + private string _fileName; + private string _batchName; + + public string LocalPath + { + get { return _localPath; } + set { _localPath = value; } + } + public string FileName + { + get { return _fileName; } + set { _fileName = value; } + } + public string BatchName + { + get { return _batchName; } + set { _batchName = value; } } - // segnaloc he ho CARICATO IN LOCALE il file - reportFileUploaded(new FileUploadEventArgs(dirFrom, csvFileName, batchName)); - } - if (forceRedirect) - { - Response.Redirect(Request.RawUrl); - } - } - /// - /// Indica se fare redirect post upload - /// - public bool forceRedirect - { - get - { - bool answ = true; - bool.TryParse(hfForceRedirect.Value, out answ); - return answ; - } - set - { - hfForceRedirect.Value = value.ToString(); - } } - protected void btnAdd_Click(object sender, EventArgs e) - { - fisVisFU(true); - lbtUpload.Text = traduci("AddNew"); - } - /// - /// fix visibilità controllo file upload - /// - /// mostra controlli add=true oppure nasconde = false - private void fisVisFU(bool showAdd) - { - divFileUpl.Visible = showAdd; - btnAdd.Visible = !showAdd; - lbtCancel.Visible = showAdd; - } - protected void btnCancel_Click(object sender, EventArgs e) + public partial class cmp_fileUpload : BaseUserControl { - //fisVisFU(false); - Response.Redirect(Request.RawUrl); - } + /// + /// Evento upload e salvataggio su server IIS del file... + /// + public event EventHandler eh_FileUploaded; + /// + /// Solelva evento salvataggio file con messaggio path/nome + /// + /// + /// + public void reportFileUploaded(FileUploadEventArgs e) + { + EventHandler handler = eh_FileUploaded; + if (handler != null) + { + handler(this, e); + } + } - } + /// + /// Folder di upload temporaneo files + /// + protected string _tempUploadDir = memLayer.ML.CRS("_tempUploadDir"); + /// + /// Folder REMOTA x copia verso SQL + /// + protected string _SqlCopyDir = memLayer.ML.CRS("_SqlCopyDir"); + /// + /// Folder x SQL import + /// + protected string _SqlImportDir = memLayer.ML.CRS("_SqlImportDir"); + + + /// + /// permesso scrittura SE E' abilitato a partire dalla tab diritti... + /// + public bool userIsAuth + { + get + { + return true; + //return (idxAmm + idxFornitore > 0); + } + } + public bool isWriteEnabled + { + get + { + bool answ = false; + bool.TryParse(hfWriteEnabled.Value, out answ); + return answ; + } + set + { + hfWriteEnabled.Value = value.ToString(); + } + } + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + fisVisFU(false); + deleteOldFiles(); + } + divNewEdit.Visible = userIsAuth && isWriteEnabled; + } + /// + /// Procedee a bonificare la cartella di upload dei files + vecchi di 3 mesi + /// + private void deleteOldFiles() + { + string dirPath = Server.MapPath(_tempUploadDir); + // elenco files nella directory + string[] files = Directory.GetFiles(dirPath); + // li guardo tutti e se vecchi li elimino... + foreach (string file in files) + { + FileInfo fi = new FileInfo(file); + if (fi.LastAccessTime < DateTime.Now.AddMonths(-3)) + fi.Delete(); + } + } + + protected void Upload(object sender, EventArgs e) + { + string csvFileName = ""; + string uploadedFilename = ""; + string batchName = ""; + string savedFilename = ""; + string contentType = ""; + DateTime adesso = DateTime.Now; + string dirFrom = Server.MapPath(_tempUploadDir); + // se c'è un file + if (FileUpload1.PostedFile != null) + { + uploadedFilename = Path.GetFileName(FileUpload1.PostedFile.FileName.Replace(" ", "_")); + csvFileName = $"{adesso.ToString("dd-HHmmss")}_{uploadedFilename}"; + batchName = uploadedFilename.ToLower().Replace(".csv", "").Replace("cnc", "").Replace("kit", ""); + savedFilename = Server.MapPath($"{_tempUploadDir}{csvFileName}"); + contentType = FileUpload1.PostedFile.ContentType; + // accedo allo stream del file allegato + using (Stream fs = FileUpload1.PostedFile.InputStream) + { + // scrivo su file + FileStream file = new FileStream(savedFilename, FileMode.Create, FileAccess.Write); + fs.CopyTo(file); + file.Close(); + } + // segnaloc he ho CARICATO IN LOCALE il file + reportFileUploaded(new FileUploadEventArgs(dirFrom, csvFileName, batchName)); + } + if (forceRedirect) + { + Response.Redirect(Request.RawUrl); + } + } + /// + /// Indica se fare redirect post upload + /// + public bool forceRedirect + { + get + { + bool answ = true; + bool.TryParse(hfForceRedirect.Value, out answ); + return answ; + } + set + { + hfForceRedirect.Value = value.ToString(); + } + } + + protected void btnAdd_Click(object sender, EventArgs e) + { + fisVisFU(true); + lbtUpload.Text = traduci("AddNew"); + } + /// + /// fix visibilità controllo file upload + /// + /// mostra controlli add=true oppure nasconde = false + private void fisVisFU(bool showAdd) + { + divFileUpl.Visible = showAdd; + btnAdd.Visible = !showAdd; + lbtCancel.Visible = showAdd; + } + + protected void btnCancel_Click(object sender, EventArgs e) + { + //fisVisFU(false); + Response.Redirect(Request.RawUrl); + } + + } } \ No newline at end of file diff --git a/NKC_WF/WebUserControls/cmp_footer.ascx.cs b/NKC_WF/WebUserControls/cmp_footer.ascx.cs index 2cb1b95..4728345 100644 --- a/NKC_WF/WebUserControls/cmp_footer.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_footer.ascx.cs @@ -4,37 +4,37 @@ using System.Configuration; namespace NKC_WF.WebUserControls { - public partial class cmp_footer : System.Web.UI.UserControl - { - public event EventHandler eh_doRefresh; - protected void Page_Load(object sender, EventArgs e) + public partial class cmp_footer : System.Web.UI.UserControl { - // sistemo le stringhe... - lblApp.Text = string.Format("{0} v.{1}", ConfigurationManager.AppSettings.Get("appName"), System.Reflection.Assembly.GetExecutingAssembly().GetName().Version); - setTimer(); - setClock(); - } - /// - /// imposta il tempo di scadenza del timer x il refresh della pagina (della parte top) per evitare che la sessione sul server scada - /// - private void setTimer() - { - Timer1.Interval = SteamWare.memLayer.ML.confReadInt("intUpdatePagina_ms"); - } - protected void Timer1_Tick(object sender, EventArgs e) - { - setClock(); - // se qualcuno ascolta sollevo evento nuovo valore... - if (eh_doRefresh != null) - { - eh_doRefresh(this, new EventArgs()); - } - } + public event EventHandler eh_doRefresh; + protected void Page_Load(object sender, EventArgs e) + { + // sistemo le stringhe... + lblApp.Text = string.Format("{0} v.{1}", ConfigurationManager.AppSettings.Get("appName"), System.Reflection.Assembly.GetExecutingAssembly().GetName().Version); + setTimer(); + setClock(); + } + /// + /// imposta il tempo di scadenza del timer x il refresh della pagina (della parte top) per evitare che la sessione sul server scada + /// + private void setTimer() + { + Timer1.Interval = SteamWare.memLayer.ML.confReadInt("intUpdatePagina_ms"); + } + protected void Timer1_Tick(object sender, EventArgs e) + { + setClock(); + // se qualcuno ascolta sollevo evento nuovo valore... + if (eh_doRefresh != null) + { + eh_doRefresh(this, new EventArgs()); + } + } - private void setClock() - { - lblDateTime.Text = DateTime.Now.ToString("ddd dd.MM.yyyy, HH:mm:ss"); - lblCodOperatore.Text = $"{user_std.UtSn.CognomeNome} ({Page.User.Identity.Name})"; + private void setClock() + { + lblDateTime.Text = DateTime.Now.ToString("ddd dd.MM.yyyy, HH:mm:ss"); + lblCodOperatore.Text = $"{user_std.UtSn.CognomeNome} ({Page.User.Identity.Name})"; + } } - } } \ No newline at end of file diff --git a/NKC_WF/WebUserControls/cmp_homeButtons.ascx.cs b/NKC_WF/WebUserControls/cmp_homeButtons.ascx.cs index cd43e8b..4980554 100644 --- a/NKC_WF/WebUserControls/cmp_homeButtons.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_homeButtons.ascx.cs @@ -1,50 +1,46 @@ 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_homeButtons : System.Web.UI.UserControl - { - protected void Page_Load(object sender, EventArgs e) + public partial class cmp_homeButtons : System.Web.UI.UserControl { - if(!Page.IsPostBack) - { - updateTreeMenu(); - } - } - /// - /// aggiornamento del menù - /// - private void updateTreeMenu() - { - try - { - if (string.IsNullOrEmpty(user_std.UtSn.mappaSito)) + protected void Page_Load(object sender, EventArgs e) { - Response.Redirect("Default", false); + if (!Page.IsPostBack) + { + updateTreeMenu(); + } + } + /// + /// aggiornamento del menù + /// + private void updateTreeMenu() + { + try + { + if (string.IsNullOrEmpty(user_std.UtSn.mappaSito)) + { + Response.Redirect("Default", false); + } + XmlMenu.Data = user_std.UtSn.mappaSito; + XmlMenu.XPath = "mainMenu/menu"; + XmlMenu.DataBind(); + } + catch + { + Response.Redirect("Default", false); + } + } + /// + /// Wrapper traduzione termini + /// + /// + /// + public string traduci(string lemma) + { + return SteamWare.user_std.UtSn.Traduci(lemma); } - XmlMenu.Data = user_std.UtSn.mappaSito; - XmlMenu.XPath = "mainMenu/menu"; - XmlMenu.DataBind(); - } - catch - { - Response.Redirect("Default", false); - } } - /// - /// Wrapper traduzione termini - /// - /// - /// - public string traduci(string lemma) - { - return SteamWare.user_std.UtSn.Traduci(lemma); - } - } } \ No newline at end of file diff --git a/NKC_WF/WebUserControls/cmp_kitImpCheck.ascx.cs b/NKC_WF/WebUserControls/cmp_kitImpCheck.ascx.cs index 5e53a73..8ddab31 100644 --- a/NKC_WF/WebUserControls/cmp_kitImpCheck.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_kitImpCheck.ascx.cs @@ -4,162 +4,162 @@ using System; namespace NKC_WF.WebUserControls { - public partial class cmp_kitImpCheck : BaseUserControl - { - /// - /// Folder x SQL import - /// - protected string _SqlImportDir = memLayer.ML.CRS("_SqlImportDir"); - protected void Page_Load(object sender, EventArgs e) + public partial class cmp_kitImpCheck : BaseUserControl { - - } - /// - /// Nome file caricato - /// - public string fileName - { - get - { - return hfFileName.Value; - } - set - { - hfFileName.Value = value; - } - } - /// - /// Nome file caricato - /// - public string batchName - { - get - { - return hfBatchName.Value; - } - set - { - hfBatchName.Value = value; - } - } - /// - /// NUM TASK eseguito - /// - public int numTask - { - get - { - int answ = 0; - int.TryParse(hfNumTask.Value, out answ); - return answ; - } - set - { - hfNumTask.Value = value.ToString(); - } - } - /// - /// Esito OK a check import - /// - public bool checkOk - { - get - { - bool answ = false; - bool.TryParse(hfCheckOk.Value, out answ); - return answ; - } - set - { - hfCheckOk.Value = value.ToString(); - } - } - /// - /// File effettivamente caricato - /// - public bool imported - { - get - { - bool answ = false; - bool.TryParse(hfImported.Value, out answ); - return answ; - } - set - { - hfImported.Value = value.ToString(); - } - } - /// - /// Verifico il file e aggiorno visualizazione di conseguenza - /// - private void processValidation() - { - // controllo ed aggiorno... - bool fileOk = !string.IsNullOrEmpty(fileName); - - string newClass1 = fileOk ? "alert alert-success" : "alert alert-secondary"; - string newClass2 = checkOk ? "alert alert-success" : "alert alert-secondary"; - string newClass3 = imported? "alert alert-success" : "alert alert-secondary"; - updateClass(divStep1, newClass1); - updateClass(divStep2, newClass2); - updateClass(divStep3, newClass3); - } - - private static void updateClass(System.Web.UI.HtmlControls.HtmlGenericControl currControl, string newClass) - { - currControl.Attributes.Remove("class"); - currControl.Attributes.Add("class", newClass); - currControl.DataBind(); - } - - - /// - /// Effettua un test di importazione o l'importazione effettiva - /// - /// true= solo test, false= vero import (SE non ci sono errori) - public void tryImport(bool testOnly) - { - DateTime adesso = DateTime.Now; - string dirImport = $"{_SqlImportDir}{adesso.ToString("yyyy-MM")}\\"; - try - { - // chiamo procedura SQL x import BATCH... come test o reale secondo del parametro - var tabCount = DataLayer.man.taCount.getNextNum("NumTicket"); - if (tabCount.Count == 1) + /// + /// Folder x SQL import + /// + protected string _SqlImportDir = memLayer.ML.CRS("_SqlImportDir"); + protected void Page_Load(object sender, EventArgs e) { - numTask = tabCount[0].LastNum; - } - var risultati = DataLayer.man.taImpLog.importCsvKit($"{dirImport}", fileName, batchName, ";", "\n", "2", numTask, 0, 0, testOnly); - // se ho delle righe di log processo... - bool allCheck = true; - foreach (var item in risultati) - { - if (!item.IsOk) - { - allCheck = false; - } - } - checkOk = allCheck; - // ho importato SOLO SE era stato richiesto e se NON HO avuto errori - imported = checkOk && !testOnly; - // ora effettua validazione e mostra eventuale esito... - processValidation(); - } - catch (Exception exc) - { - logger.lg.scriviLog($"KitCsvMan: Eccezione in IMPORT file:{Environment.NewLine}{exc}"); - } - } - protected void lbtDoAction_Click(object sender, EventArgs e) - { - // in base a cosa ho in memoria procedo con successivo step, qui FAKE... - if(checkOk && !imported) - { - tryImport(false); - } - processValidation(); + } + /// + /// Nome file caricato + /// + public string fileName + { + get + { + return hfFileName.Value; + } + set + { + hfFileName.Value = value; + } + } + /// + /// Nome file caricato + /// + public string batchName + { + get + { + return hfBatchName.Value; + } + set + { + hfBatchName.Value = value; + } + } + /// + /// NUM TASK eseguito + /// + public int numTask + { + get + { + int answ = 0; + int.TryParse(hfNumTask.Value, out answ); + return answ; + } + set + { + hfNumTask.Value = value.ToString(); + } + } + /// + /// Esito OK a check import + /// + public bool checkOk + { + get + { + bool answ = false; + bool.TryParse(hfCheckOk.Value, out answ); + return answ; + } + set + { + hfCheckOk.Value = value.ToString(); + } + } + /// + /// File effettivamente caricato + /// + public bool imported + { + get + { + bool answ = false; + bool.TryParse(hfImported.Value, out answ); + return answ; + } + set + { + hfImported.Value = value.ToString(); + } + } + /// + /// Verifico il file e aggiorno visualizazione di conseguenza + /// + private void processValidation() + { + // controllo ed aggiorno... + bool fileOk = !string.IsNullOrEmpty(fileName); + + string newClass1 = fileOk ? "alert alert-success" : "alert alert-secondary"; + string newClass2 = checkOk ? "alert alert-success" : "alert alert-secondary"; + string newClass3 = imported ? "alert alert-success" : "alert alert-secondary"; + updateClass(divStep1, newClass1); + updateClass(divStep2, newClass2); + updateClass(divStep3, newClass3); + } + + private static void updateClass(System.Web.UI.HtmlControls.HtmlGenericControl currControl, string newClass) + { + currControl.Attributes.Remove("class"); + currControl.Attributes.Add("class", newClass); + currControl.DataBind(); + } + + + /// + /// Effettua un test di importazione o l'importazione effettiva + /// + /// true= solo test, false= vero import (SE non ci sono errori) + public void tryImport(bool testOnly) + { + DateTime adesso = DateTime.Now; + string dirImport = $"{_SqlImportDir}{adesso.ToString("yyyy-MM")}\\"; + try + { + // chiamo procedura SQL x import BATCH... come test o reale secondo del parametro + var tabCount = DataLayer.man.taCount.getNextNum("NumTicket"); + if (tabCount.Count == 1) + { + numTask = tabCount[0].LastNum; + } + var risultati = DataLayer.man.taImpLog.importCsvKit($"{dirImport}", fileName, batchName, ";", "\n", "2", numTask, 0, 0, testOnly); + // se ho delle righe di log processo... + bool allCheck = true; + foreach (var item in risultati) + { + if (!item.IsOk) + { + allCheck = false; + } + } + checkOk = allCheck; + // ho importato SOLO SE era stato richiesto e se NON HO avuto errori + imported = checkOk && !testOnly; + // ora effettua validazione e mostra eventuale esito... + processValidation(); + } + catch (Exception exc) + { + logger.lg.scriviLog($"KitCsvMan: Eccezione in IMPORT file:{Environment.NewLine}{exc}"); + } + } + + protected void lbtDoAction_Click(object sender, EventArgs e) + { + // in base a cosa ho in memoria procedo con successivo step, qui FAKE... + if (checkOk && !imported) + { + tryImport(false); + } + processValidation(); + } } - } } \ No newline at end of file diff --git a/NKC_WF/WebUserControls/cmp_kitList.ascx.cs b/NKC_WF/WebUserControls/cmp_kitList.ascx.cs index 8813c3c..0f25046 100644 --- a/NKC_WF/WebUserControls/cmp_kitList.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_kitList.ascx.cs @@ -1,77 +1,73 @@ using AppData; 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_kitList : System.Web.UI.UserControl - { - protected void Page_Load(object sender, EventArgs e) + public partial class cmp_kitList : System.Web.UI.UserControl { - - } - /// - /// comando reset - /// - /// - /// - protected void lbtReset_Click(object sender, EventArgs e) - { - resetSelezione(); - } - - protected string task - { - get - { - return hfTask.Value; - } - set - { - hfTask.Value = value; - } - } - - private void resetSelezione() - { - grView.SelectedIndex = -1; - grView.DataBind(); - } - - protected void grView_SelectedIndexChanged(object sender, EventArgs e) - { - // se selezionato --> passo da status 1 a 2... - - int packListId = 0; - int.TryParse(grView.SelectedValue.ToString(), out packListId); - if (packListId > 0) - { - // verifico richiesta... - switch (task) + protected void Page_Load(object sender, EventArgs e) { - case "Appr": - DataLayer.man.taPLD.updateStatus(packListId, 2); - break; - default: - break; - } - // refresh! - resetSelezione(); - } - } - protected void lbtCheck_Click(object sender, EventArgs e) - { - LinkButton lbt = (LinkButton)sender; - if (!string.IsNullOrEmpty(lbt.CommandArgument)) - { - // salvo richiesta... - task = lbt.CommandArgument; - } + } + /// + /// comando reset + /// + /// + /// + protected void lbtReset_Click(object sender, EventArgs e) + { + resetSelezione(); + } + + protected string task + { + get + { + return hfTask.Value; + } + set + { + hfTask.Value = value; + } + } + + private void resetSelezione() + { + grView.SelectedIndex = -1; + grView.DataBind(); + } + + protected void grView_SelectedIndexChanged(object sender, EventArgs e) + { + // se selezionato --> passo da status 1 a 2... + + int packListId = 0; + int.TryParse(grView.SelectedValue.ToString(), out packListId); + if (packListId > 0) + { + // verifico richiesta... + switch (task) + { + case "Appr": + DataLayer.man.taPLD.updateStatus(packListId, 2); + break; + default: + break; + } + // refresh! + resetSelezione(); + } + } + + protected void lbtCheck_Click(object sender, EventArgs e) + { + LinkButton lbt = (LinkButton)sender; + if (!string.IsNullOrEmpty(lbt.CommandArgument)) + { + // salvo richiesta... + task = lbt.CommandArgument; + } + } } - } } \ No newline at end of file diff --git a/NKC_WF/WebUserControls/cmp_kitting.ascx.cs b/NKC_WF/WebUserControls/cmp_kitting.ascx.cs index 7db889e..4778704 100644 --- a/NKC_WF/WebUserControls/cmp_kitting.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_kitting.ascx.cs @@ -1,17 +1,12 @@ 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_kitting : BaseUserControl - { - protected void Page_Load(object sender, EventArgs e) + public partial class cmp_kitting : BaseUserControl { + protected void Page_Load(object sender, EventArgs e) + { + } } - } } \ No newline at end of file diff --git a/NKC_WF/WebUserControls/cmp_kittingBin.ascx.cs b/NKC_WF/WebUserControls/cmp_kittingBin.ascx.cs index 997a71e..067eb8a 100644 --- a/NKC_WF/WebUserControls/cmp_kittingBin.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_kittingBin.ascx.cs @@ -1,17 +1,12 @@ 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_kittingBin : System.Web.UI.UserControl - { - protected void Page_Load(object sender, EventArgs e) + public partial class cmp_kittingBin : System.Web.UI.UserControl { + protected void Page_Load(object sender, EventArgs e) + { + } } - } } \ No newline at end of file diff --git a/NKC_WF/WebUserControls/cmp_kittingCart.ascx.cs b/NKC_WF/WebUserControls/cmp_kittingCart.ascx.cs index 4cce933..af4aae8 100644 --- a/NKC_WF/WebUserControls/cmp_kittingCart.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_kittingCart.ascx.cs @@ -1,41 +1,36 @@ 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_kittingCart : System.Web.UI.UserControl - { - protected void Page_Load(object sender, EventArgs e) + public partial class cmp_kittingCart : System.Web.UI.UserControl { + protected void Page_Load(object sender, EventArgs e) + { - } + } - public string getCssByNums(object _numWait, object _numReady) - { - string answ = "alert-success border-success"; - int numWait = 0; - int numReady = 0; - int.TryParse(_numWait.ToString(), out numWait); - int.TryParse(_numReady.ToString(), out numReady); - if (numWait > 0) - { - answ = "alert-danger border-danger"; - } - else if (numReady > 0) - { answ = "alert-warning border-warning"; } - else - { - answ = "alert-success border-success"; - } - return answ; + public string getCssByNums(object _numWait, object _numReady) + { + string answ = "alert-success border-success"; + int numWait = 0; + int numReady = 0; + int.TryParse(_numWait.ToString(), out numWait); + int.TryParse(_numReady.ToString(), out numReady); + if (numWait > 0) + { + answ = "alert-danger border-danger"; + } + else if (numReady > 0) + { answ = "alert-warning border-warning"; } + else + { + answ = "alert-success border-success"; + } + return answ; + } + public string getTitle(object val) + { + return ""; + } } - public string getTitle(object val) - { - return ""; - } - } } \ No newline at end of file diff --git a/NKC_WF/WebUserControls/cmp_kittingSmart.ascx.cs b/NKC_WF/WebUserControls/cmp_kittingSmart.ascx.cs index fbcfcd3..4728b9f 100644 --- a/NKC_WF/WebUserControls/cmp_kittingSmart.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_kittingSmart.ascx.cs @@ -4,684 +4,684 @@ using System; namespace NKC_WF.WebUserControls { - public partial class cmp_kittingSmart : BaseUserControl - { - protected bool showBin + public partial class cmp_kittingSmart : BaseUserControl { - set - { - hfShowBin.Value = value.ToString(); - } - get - { - bool answ = false; - bool.TryParse(hfShowBin.Value, out answ); - return answ; - } - } - protected bool showCart - { - set - { - hfShowCart.Value = value.ToString(); - } - get - { - bool answ = false; - bool.TryParse(hfShowCart.Value, out answ); - return answ; - } - } - protected bool showSecOp - { - set - { - hfShowSecOp.Value = value.ToString(); - } - get - { - bool answ = false; - bool.TryParse(hfShowSecOp.Value, out answ); - return answ; - } - } - /// - /// ID univoco da IP - /// - protected string DeviceId - { - set - { - hfDeviceId.Value = value; - } - get - { - return hfDeviceId.Value; - } - } - /// - /// Postazione attuale (per ora cablata) - /// - protected string PlaceId - { - get - { - return "WRK001"; - } - } - - /// - /// Sheet selezionato... - /// - protected int SheetID - { - set - { - hfSheetID.Value = value.ToString(); - } - get - { - int answ = 0; - int.TryParse(hfSheetID.Value, out answ); - return answ; - } - } - protected string secOp - { - get - { - return hfSecOp.Value; - } - set - { - hfSecOp.Value = value; - } - } - /// - /// Aggiorna dati correnti (IP, batch, sheet...) - /// - protected void updateCurrData() - { - // FORSE 5/5?!? - var sheetList = DataLayer.man.taSHL.getByMLStatus(BatchId, 3, 5); - if (sheetList.Count > 0) - { - SheetID = sheetList[0].SheetID; - } - DeviceId = ComLib.GetIPAddress().Replace(".", "0").Replace(":", "0"); - } - /// - /// Batch corrente... - /// - public int BatchId - { - set - { - hfBatchID.Value = value.ToString(); - } - get - { - int answ = 0; - int.TryParse(hfBatchID.Value, out answ); - return answ; - } - } - protected void Page_Load(object sender, EventArgs e) - { - if (!Page.IsPostBack) - { - resetShowData(); - resetIcons(); - updateCurrData(); - } - cmp_barcode.eh_doRefresh += Cmp_barcode_eh_doRefresh; - cmp_barcode.eh_doReset += Cmp_barcode_eh_doReset; - // resetto - lblLastBCode.Text = "------"; - lblMessage.Text = "----"; - lblDestination.Text = "--"; - } - - private void resetShowData() - { - showCart = false; - showBin = false; - showSecOp = false; - } - - /// - /// Comando barcode letto - /// - protected string lastCmd - { - get - { - return hfLastBCode.Value; - } - set - { - hfLastBCode.Value = value; - lastValidCmd = value; - } - } - /// - /// ULTIMO Comando barcode VALIDO (!="") letto - /// - protected string lastValidCmd - { - get - { - return hfLastValidBCode.Value; - } - set - { - // solo se è !="" - if (value != "") + protected bool showBin { - hfLastValidBCode.Value = value; - } - } - } - private void Cmp_barcode_eh_doReset(object sender, EventArgs e) - { - resetIcons(); - } - - private void Cmp_barcode_eh_doRefresh(object sender, EventArgs e) - { - bool doRaiseEv = false; - // processo evento.. - lastCmd = cmp_barcode.inputAcquired.ToUpper(); - doRaiseEv = processLastCmd(doRaiseEv); - - // reset comando - cmp_barcode.inputAcquired = ""; - // aggiorno... - doUpdate(); - } - - private bool processLastCmd(bool doRaiseEv) - { - if (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"); - resetSelection(false); - doRaiseEv = true; - break; - case codeType.Item: - cmp_barcode.showOutput("badge badge-success", $"Valid IT Code: {decoData.rawData}"); - processItemSuggestion(decoData.codeType, decoData.rawData, decoData.codeInt); - break; - case codeType.ItemGeneric: - cmp_barcode.showOutput("badge badge-success", $"Valid IG Code: {decoData.rawData}"); - processItemSuggestion(decoData.codeType, decoData.rawData, decoData.codeInt); - break; - case codeType.OtherItem: - cmp_barcode.showOutput("badge badge-success", $"Valid Generic PART Code: {decoData.rawData}"); - processItemSuggestion(decoData.codeType, decoData.rawData, decoData.codeInt); - 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: - cmp_barcode.showOutput("badge badge-warning", $"BUNK - ignored: {decoData.description}"); - doRaiseEv = true; - break; - case codeType.Batch: - cmp_barcode.showOutput("badge badge-warning", $"Batch - ignored: {decoData.description}"); - doRaiseEv = true; - break; - case codeType.Cart: - cmp_barcode.showOutput("badge badge-success", $"Valid CR Code: {decoData.description}"); - processItemSuggestion(decoData.codeType, decoData.rawData, decoData.codeInt); - break; - case codeType.Bin: - cmp_barcode.showOutput("badge badge-success", $"Valid BN Code: {decoData.description}"); - processItemSuggestion(decoData.codeType, decoData.rawData, decoData.codeInt); - break; - default: - cmp_barcode.showOutput("text-danger", $"Unknown Data: {decoData.rawData} --> no action"); - resetSelection(false); - break; - } - - return doRaiseEv; - } - - - /// - /// Processo il DataMatrix letto - /// - /// - /// - /// - private void processItemSuggestion(codeType tipoCod, string rawData, int codeInt) - { - DS_App.ItemListDataTable tabItem = null; - // processo suggerimenti x ITEM / cart / bin dato suo RawData (Dtmx) e Cod univoco (intero) - switch (tipoCod) - { - case codeType.OtherItem: - var tabOtherItem = DataLayer.man.taOtItem.getByKey(codeInt); - if (tabOtherItem.Count == 1) - { - showOtherItemDetail(true, tabOtherItem[0], false); - } - break; - case codeType.Item: - tabItem = DataLayer.man.taIL.getBySearch(codeInt, rawData, 0, 999); - if (tabItem.Count == 1) - { - showItemDetail(true, tabItem[0], false); - } - else if (tabItem.Count == 0) - { - showItemDetail(false, null, true); - } - break; - case codeType.ItemGeneric: - // PRIMA CERCSE ne ho in stato 1..3 - tabItem = DataLayer.man.taIL.getBySearch(0, rawData, 1, 3); - if (tabItem.Count == 0) - { - // se NON ne trovo cerci FINO a stato 5... - tabItem = DataLayer.man.taIL.getBySearch(0, rawData, 1, 5); - } - if (tabItem.Count == 1) - { - showItemDetail(true, tabItem[0], false); - } - else if (tabItem.Count == 0) - { - showItemDetail(false, null, true); - } - break; - case codeType.Cart: - // verifico NON SIA richiesto PAINT - if (showBin) - { - displError("PAINT: BIN REQUESTED: please retry", true); - } - else - { - if (currCartTab.Count == 1) + set { - // controllo se sia quello corretto - if (rawData != currCartTab[0].CartDtmx) - { - displError("INCORRECT CART: please retry", true); - } - else - { - // dichiaro che è depositato - DataLayer.man.taIL.updateStatus(itemIdSelected, 3, PlaceId); - lblDestination.Text = $"Item {itemIdSelected} PUT IN CART {rawData}"; - resetSelection(false); - } + hfShowBin.Value = value.ToString(); } - } - break; - case codeType.Bin: - // verifico NON SIA richiesto PAINT - if (showCart) - { - displError("NOT PAINTED: CART REQUESTED: please retry", true); - } - else - { - if (currBinTab.Count == 1) + get { - // controllo se sia quello corretto - if (rawData != currBinTab[0].BinDtmx) - { - displError("INCORRECT BIN: please retry", true); - } - else - { - // dichiaro che è depositato - DataLayer.man.taIL.updateStatus(itemIdSelected, 4, PlaceId); - lblDestination.Text = $"Item {itemIdSelected} PUT IN BIN {rawData}"; - resetSelection(false); - } + bool answ = false; + bool.TryParse(hfShowBin.Value, out answ); + return answ; } - } - break; - default: - break; - } - - - // cerco su DB - - // certo lavorazioni accessorie - - // cerco destinazione CART/BIN - - // salvo in hiddenField - - // mostro output (compreso che mi aspetto entro 30 sec lettura cart/Bin) - - - } - /// - /// Mostra errore ed effettua reset vari... - /// - /// - /// - protected void displError(string errorMessage, bool resetStatus) - { - lblErrorMsg.Text = errorMessage; - divItemError.Visible = true; - resetSelection(resetStatus); - } - /// - /// Reset selezione item + blocchi suggerimento + sel REDIS x pagina unload - /// - /// - protected void resetSelection(bool resetStatus) - { - if (resetStatus) - { - try - { - // SE item esiste... - var tabItem = DataLayer.man.taIL.getBySearch(itemIdSelected, itemIdSelected.ToString(), 0, 999); - if (tabItem.Count == 1) - { - // riposto item a status 1... - DataLayer.man.taIL.updateStatus(itemIdSelected, 1, PlaceId); - } } - catch - { } - } - // elimino item sel... - itemIdSelected = 0; - resetShowData(); - ComLib.resetItemPickup(SheetID, DeviceId); - } - /// - /// Mostra o nasconde dettaglio su ITEM letto - /// - /// - /// - /// - private void showItemDetail(bool showItem, DS_App.ItemListRow itemRow, bool showError) - { - resetShowData(); - divItemDet.Visible = showItem; - divItemError.Visible = showError; - if (showError) - { - displError("Item not found", true); - } - if (showItem) - { - lblItemCode.Text = itemRow.ItemExtCode; - lblItemDesc.Text = itemRow.ItemDesc; - lblItemDtmx.Text = itemRow.ItemDtmx; - itemIdSelected = itemRow.ItemID; - // CONTROLLO SIA in stato 1 --> worked, 2--> selected, 100--> parked... - switch (itemRow.StatusID) + protected bool showCart { - case 0: - displError("ERROR: Item not ready", false); - break; - case 1: - case 2: - case 100: - // salvo che è in STATO 2 (picked up) - DataLayer.man.taIL.updateStatus(itemRow.ItemID, 2, PlaceId); - // verifico cosa devo mostrare come PROX passaggio... - showCart = itemRow.ProcessesReq == ""; - showBin = (itemRow.ProcessesReq.Contains("PaintFlag")); - secOp = itemRow.PostProcList; - showSecOp = (secOp != ""); + set + { + hfShowCart.Value = value.ToString(); + } + get + { + bool answ = false; + bool.TryParse(hfShowCart.Value, out answ); + return answ; + } + } + protected bool showSecOp + { + set + { + hfShowSecOp.Value = value.ToString(); + } + get + { + bool answ = false; + bool.TryParse(hfShowSecOp.Value, out answ); + return answ; + } + } + /// + /// ID univoco da IP + /// + protected string DeviceId + { + set + { + hfDeviceId.Value = value; + } + get + { + return hfDeviceId.Value; + } + } + /// + /// Postazione attuale (per ora cablata) + /// + protected string PlaceId + { + get + { + return "WRK001"; + } + } + + /// + /// Sheet selezionato... + /// + protected int SheetID + { + set + { + hfSheetID.Value = value.ToString(); + } + get + { + int answ = 0; + int.TryParse(hfSheetID.Value, out answ); + return answ; + } + } + protected string secOp + { + get + { + return hfSecOp.Value; + } + set + { + hfSecOp.Value = value; + } + } + /// + /// Aggiorna dati correnti (IP, batch, sheet...) + /// + protected void updateCurrData() + { + // FORSE 5/5?!? + var sheetList = DataLayer.man.taSHL.getByMLStatus(BatchId, 3, 5); + if (sheetList.Count > 0) + { + SheetID = sheetList[0].SheetID; + } + DeviceId = ComLib.GetIPAddress().Replace(".", "0").Replace(":", "0"); + } + /// + /// Batch corrente... + /// + public int BatchId + { + set + { + hfBatchID.Value = value.ToString(); + } + get + { + int answ = 0; + int.TryParse(hfBatchID.Value, out answ); + return answ; + } + } + protected void Page_Load(object sender, EventArgs e) + { + if (!Page.IsPostBack) + { + resetShowData(); + resetIcons(); + updateCurrData(); + } + cmp_barcode.eh_doRefresh += Cmp_barcode_eh_doRefresh; + cmp_barcode.eh_doReset += Cmp_barcode_eh_doReset; + // resetto + lblLastBCode.Text = "------"; + lblMessage.Text = "----"; + lblDestination.Text = "--"; + } + + private void resetShowData() + { + showCart = false; + showBin = false; + showSecOp = false; + } + + /// + /// Comando barcode letto + /// + protected string lastCmd + { + get + { + return hfLastBCode.Value; + } + set + { + hfLastBCode.Value = value; + lastValidCmd = value; + } + } + /// + /// ULTIMO Comando barcode VALIDO (!="") letto + /// + protected string lastValidCmd + { + get + { + return hfLastValidBCode.Value; + } + set + { + // solo se è !="" + if (value != "") + { + hfLastValidBCode.Value = value; + } + } + } + private void Cmp_barcode_eh_doReset(object sender, EventArgs e) + { + resetIcons(); + } + + private void Cmp_barcode_eh_doRefresh(object sender, EventArgs e) + { + bool doRaiseEv = false; + // processo evento.. + lastCmd = cmp_barcode.inputAcquired.ToUpper(); + doRaiseEv = processLastCmd(doRaiseEv); + + // reset comando + cmp_barcode.inputAcquired = ""; + // aggiorno... doUpdate(); - break; - case 3: - displError("Item already on CART!", false); - break; - case 4: - // fino a concorrenza qta richiesta sposto, POI do errori - displError("ALL Item already scanned on BIN!", false); - break; - case 5: - displError("Item already at KIT STATION!", false); - break; - case 990: - displError("Item declared SCRAP!", false); - break; - case 991: - displError("Item declared SCRAP with CNC program created!", false); - break; - default: - displError("ERROR: Item status UNKNOWN!", false); - break; } - } - lbtResetSel.Visible = (itemIdSelected != 0); - } - /// - /// Mostra o nasconde dettaglio su OTHER ITEM letto - /// - /// - /// - /// - private void showOtherItemDetail(bool showItem, DS_App.OtherItemRow otherItemRow, bool showError) - { - resetShowData(); - divItemDet.Visible = showItem; - divItemError.Visible = showError; - if (showError) - { - displError("Other Item not found", true); - } - if (showItem) - { - lblItemCode.Text = otherItemRow.OtherItemExtCode; - lblItemDesc.Text = otherItemRow.OtherItemDesc; - lblItemDtmx.Text = otherItemRow.OtherItemDtmx; - itemIdSelected = otherItemRow.OtherItemID; - //// CONTROLLO SIA in stato 1 --> worked, 2--> selected, 100--> parked... - //switch (otherItemRow.StatusID) - //{ - // case 0: - // displError("ERROR: Item not ready", false); - // break; - // case 1: - // case 2: - // case 100: - // // salvo che è in STATO 2 (picked up) - // DataLayer.man.taIL.updateStatus(otherItemRow.ItemID, 2, PlaceId); - // // verifico cosa devo mostrare come PROX passaggio... - // showCart = otherItemRow.ProcessesReq == ""; - // showBin = (otherItemRow.ProcessesReq.Contains("PaintFlag")); - // secOp = otherItemRow.PostProcList; - // showSecOp = (secOp != ""); - // doUpdate(); - // break; - // case 3: - // displError("Item already on CART!", false); - // break; - // case 4: - // // fino a concorrenza qta richiesta sposto, POI do errori - // displError("ALL Item already scanned on BIN!", false); - // break; - // case 5: - // displError("Item already at KIT STATION!", false); - // break; - // case 990: - // displError("Item declared SCRAP!", false); - // break; - // case 991: - // displError("Item declared SCRAP with CNC program created!", false); - // break; - // default: - // displError("ERROR: Item status UNKNOWN!", false); - // break; - //} - } - lbtResetSel.Visible = (itemIdSelected != 0); - } - public int itemIdSelected - { - get - { - int answ = 0; - int.TryParse(hfItemID.Value, out answ); - return answ; - } - set - { - hfItemID.Value = value.ToString(); - bool showBtn = value != 0; - // fix visibilità - lbtCancel.Visible = showBtn; - lbtScrapped.Visible = showBtn; - lbtParkArea.Visible = showBtn; - } - } - - private void resetIcons() - { - lblDestination.CssClass = "text-secondary"; - lblMessage.Text = ""; - lblDestination.Text = ""; - lblLastBCode.Text = ""; - lbtCancel.Visible = false; - lbtScrapped.Visible = false; - lbtParkArea.Visible = false; - lbtResetSel.Visible = (itemIdSelected != 0); - } - - protected DS_App.BinsDataTable currBinTab - { - get - { - return DataLayer.man.taBN.getByItemID(itemIdSelected); - } - } - protected DS_App.CartsDataTable currCartTab - { - get - { - return DataLayer.man.taCR.getByItemID(itemIdSelected); - } - } - - private void doUpdate() - { - // reset grafico - icnCart.Attributes.Remove("class"); - icnCart.Attributes.Add("class", "btn btn-sm btn-block btn-outline-secondary"); - icnBin.Attributes.Remove("class"); - icnBin.Attributes.Add("class", "btn btn-sm btn-block btn-outline-secondary"); - icnSecOp.Attributes.Remove("class"); - icnSecOp.Attributes.Add("class", "btn btn-sm btn-block btn-outline-secondary"); - - // in base al secondo mostro uno o altro... - if (showCart) - { - icnCart.Attributes.Remove("class"); - icnCart.Attributes.Add("class", "btn btn-sm btn-block btn-success"); - lblMessage.Text = "Item recognized"; - // controllo SE HO cart - if (currCartTab.Count == 1) + private bool processLastCmd(bool doRaiseEv) { - var cartRow = currCartTab[0]; - // imposto OUT - lblDestination.Text = $"SEND TO CART C{cartRow.CartIndex} ({cartRow.CartDtmx})"; - } - else - { - lblDestination.Text = $"ERROR SEARCHING CART: {currCartTab.Count} found!"; - } - lblDestination.CssClass = "text-success"; - } - else if (showBin) - { - icnBin.Attributes.Remove("class"); - icnBin.Attributes.Add("class", "btn btn-sm btn-block btn-primary"); - lblMessage.Text = "Item recognized"; - if (currBinTab.Count == 1) - { - var binRow = currBinTab[0]; - lblDestination.Text = $"SEND TO BIN B{binRow.BinIndex} ({binRow.BinDtmx})"; - } - else - { - lblDestination.Text = $"ERROR SEARCHING BIN: {currBinTab.Count} found!"; - } - lblDestination.CssClass = "text-primary"; - } - if (showSecOp) - { - icnSecOp.Attributes.Remove("class"); - icnSecOp.Attributes.Add("class", "btn btn-sm btn-block btn-info"); - lblMessage.Text = "Item recognized"; - lblLastBCode.Text = $"DO SEC OP: {secOp}"; - lblLastBCode.CssClass = "text-info"; - } - // fix btn reset! - lbtResetSel.Visible = (itemIdSelected != 0); - } + if (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"); + resetSelection(false); + doRaiseEv = true; + break; + case codeType.Item: + cmp_barcode.showOutput("badge badge-success", $"Valid IT Code: {decoData.rawData}"); + processItemSuggestion(decoData.codeType, decoData.rawData, decoData.codeInt); + break; + case codeType.ItemGeneric: + cmp_barcode.showOutput("badge badge-success", $"Valid IG Code: {decoData.rawData}"); + processItemSuggestion(decoData.codeType, decoData.rawData, decoData.codeInt); + break; + case codeType.OtherItem: + cmp_barcode.showOutput("badge badge-success", $"Valid Generic PART Code: {decoData.rawData}"); + processItemSuggestion(decoData.codeType, decoData.rawData, decoData.codeInt); + 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: + cmp_barcode.showOutput("badge badge-warning", $"BUNK - ignored: {decoData.description}"); + doRaiseEv = true; + break; + case codeType.Batch: + cmp_barcode.showOutput("badge badge-warning", $"Batch - ignored: {decoData.description}"); + doRaiseEv = true; + break; + case codeType.Cart: + cmp_barcode.showOutput("badge badge-success", $"Valid CR Code: {decoData.description}"); + processItemSuggestion(decoData.codeType, decoData.rawData, decoData.codeInt); + break; + case codeType.Bin: + cmp_barcode.showOutput("badge badge-success", $"Valid BN Code: {decoData.description}"); + processItemSuggestion(decoData.codeType, decoData.rawData, decoData.codeInt); + break; + default: + cmp_barcode.showOutput("text-danger", $"Unknown Data: {decoData.rawData} --> no action"); + resetSelection(false); + break; + } - protected void lbtCancel_Click(object sender, EventArgs e) - { - // resetto item selezionato... - DataLayer.man.taIL.updateStatus(itemIdSelected, 1, PlaceId); - resetSelection(true); - showItemDetail(false, null, false); + return doRaiseEv; + } + + + /// + /// Processo il DataMatrix letto + /// + /// + /// + /// + private void processItemSuggestion(codeType tipoCod, string rawData, int codeInt) + { + DS_App.ItemListDataTable tabItem = null; + // processo suggerimenti x ITEM / cart / bin dato suo RawData (Dtmx) e Cod univoco (intero) + switch (tipoCod) + { + case codeType.OtherItem: + var tabOtherItem = DataLayer.man.taOtItem.getByKey(codeInt); + if (tabOtherItem.Count == 1) + { + showOtherItemDetail(true, tabOtherItem[0], false); + } + break; + case codeType.Item: + tabItem = DataLayer.man.taIL.getBySearch(codeInt, rawData, 0, 999); + if (tabItem.Count == 1) + { + showItemDetail(true, tabItem[0], false); + } + else if (tabItem.Count == 0) + { + showItemDetail(false, null, true); + } + break; + case codeType.ItemGeneric: + // PRIMA CERCSE ne ho in stato 1..3 + tabItem = DataLayer.man.taIL.getBySearch(0, rawData, 1, 3); + if (tabItem.Count == 0) + { + // se NON ne trovo cerci FINO a stato 5... + tabItem = DataLayer.man.taIL.getBySearch(0, rawData, 1, 5); + } + if (tabItem.Count == 1) + { + showItemDetail(true, tabItem[0], false); + } + else if (tabItem.Count == 0) + { + showItemDetail(false, null, true); + } + break; + case codeType.Cart: + // verifico NON SIA richiesto PAINT + if (showBin) + { + displError("PAINT: BIN REQUESTED: please retry", true); + } + else + { + if (currCartTab.Count == 1) + { + // controllo se sia quello corretto + if (rawData != currCartTab[0].CartDtmx) + { + displError("INCORRECT CART: please retry", true); + } + else + { + // dichiaro che è depositato + DataLayer.man.taIL.updateStatus(itemIdSelected, 3, PlaceId); + lblDestination.Text = $"Item {itemIdSelected} PUT IN CART {rawData}"; + resetSelection(false); + } + } + } + break; + case codeType.Bin: + // verifico NON SIA richiesto PAINT + if (showCart) + { + displError("NOT PAINTED: CART REQUESTED: please retry", true); + } + else + { + if (currBinTab.Count == 1) + { + // controllo se sia quello corretto + if (rawData != currBinTab[0].BinDtmx) + { + displError("INCORRECT BIN: please retry", true); + } + else + { + // dichiaro che è depositato + DataLayer.man.taIL.updateStatus(itemIdSelected, 4, PlaceId); + lblDestination.Text = $"Item {itemIdSelected} PUT IN BIN {rawData}"; + resetSelection(false); + } + } + } + break; + default: + break; + } + + + // cerco su DB + + // certo lavorazioni accessorie + + // cerco destinazione CART/BIN + + // salvo in hiddenField + + // mostro output (compreso che mi aspetto entro 30 sec lettura cart/Bin) + + + } + /// + /// Mostra errore ed effettua reset vari... + /// + /// + /// + protected void displError(string errorMessage, bool resetStatus) + { + lblErrorMsg.Text = errorMessage; + divItemError.Visible = true; + resetSelection(resetStatus); + } + /// + /// Reset selezione item + blocchi suggerimento + sel REDIS x pagina unload + /// + /// + protected void resetSelection(bool resetStatus) + { + if (resetStatus) + { + try + { + // SE item esiste... + var tabItem = DataLayer.man.taIL.getBySearch(itemIdSelected, itemIdSelected.ToString(), 0, 999); + if (tabItem.Count == 1) + { + // riposto item a status 1... + DataLayer.man.taIL.updateStatus(itemIdSelected, 1, PlaceId); + } + } + catch + { } + } + // elimino item sel... + itemIdSelected = 0; + resetShowData(); + ComLib.resetItemPickup(SheetID, DeviceId); + } + /// + /// Mostra o nasconde dettaglio su ITEM letto + /// + /// + /// + /// + private void showItemDetail(bool showItem, DS_App.ItemListRow itemRow, bool showError) + { + resetShowData(); + divItemDet.Visible = showItem; + divItemError.Visible = showError; + if (showError) + { + displError("Item not found", true); + } + if (showItem) + { + lblItemCode.Text = itemRow.ItemExtCode; + lblItemDesc.Text = itemRow.ItemDesc; + lblItemDtmx.Text = itemRow.ItemDtmx; + itemIdSelected = itemRow.ItemID; + // CONTROLLO SIA in stato 1 --> worked, 2--> selected, 100--> parked... + switch (itemRow.StatusID) + { + case 0: + displError("ERROR: Item not ready", false); + break; + case 1: + case 2: + case 100: + // salvo che è in STATO 2 (picked up) + DataLayer.man.taIL.updateStatus(itemRow.ItemID, 2, PlaceId); + // verifico cosa devo mostrare come PROX passaggio... + showCart = itemRow.ProcessesReq == ""; + showBin = (itemRow.ProcessesReq.Contains("PaintFlag")); + secOp = itemRow.PostProcList; + showSecOp = (secOp != ""); + doUpdate(); + break; + case 3: + displError("Item already on CART!", false); + break; + case 4: + // fino a concorrenza qta richiesta sposto, POI do errori + displError("ALL Item already scanned on BIN!", false); + break; + case 5: + displError("Item already at KIT STATION!", false); + break; + case 990: + displError("Item declared SCRAP!", false); + break; + case 991: + displError("Item declared SCRAP with CNC program created!", false); + break; + default: + displError("ERROR: Item status UNKNOWN!", false); + break; + } + } + lbtResetSel.Visible = (itemIdSelected != 0); + } + /// + /// Mostra o nasconde dettaglio su OTHER ITEM letto + /// + /// + /// + /// + private void showOtherItemDetail(bool showItem, DS_App.OtherItemRow otherItemRow, bool showError) + { + resetShowData(); + divItemDet.Visible = showItem; + divItemError.Visible = showError; + if (showError) + { + displError("Other Item not found", true); + } + if (showItem) + { + lblItemCode.Text = otherItemRow.OtherItemExtCode; + lblItemDesc.Text = otherItemRow.OtherItemDesc; + lblItemDtmx.Text = otherItemRow.OtherItemDtmx; + itemIdSelected = otherItemRow.OtherItemID; + //// CONTROLLO SIA in stato 1 --> worked, 2--> selected, 100--> parked... + //switch (otherItemRow.StatusID) + //{ + // case 0: + // displError("ERROR: Item not ready", false); + // break; + // case 1: + // case 2: + // case 100: + // // salvo che è in STATO 2 (picked up) + // DataLayer.man.taIL.updateStatus(otherItemRow.ItemID, 2, PlaceId); + // // verifico cosa devo mostrare come PROX passaggio... + // showCart = otherItemRow.ProcessesReq == ""; + // showBin = (otherItemRow.ProcessesReq.Contains("PaintFlag")); + // secOp = otherItemRow.PostProcList; + // showSecOp = (secOp != ""); + // doUpdate(); + // break; + // case 3: + // displError("Item already on CART!", false); + // break; + // case 4: + // // fino a concorrenza qta richiesta sposto, POI do errori + // displError("ALL Item already scanned on BIN!", false); + // break; + // case 5: + // displError("Item already at KIT STATION!", false); + // break; + // case 990: + // displError("Item declared SCRAP!", false); + // break; + // case 991: + // displError("Item declared SCRAP with CNC program created!", false); + // break; + // default: + // displError("ERROR: Item status UNKNOWN!", false); + // break; + //} + } + lbtResetSel.Visible = (itemIdSelected != 0); + } + + public int itemIdSelected + { + get + { + int answ = 0; + int.TryParse(hfItemID.Value, out answ); + return answ; + } + set + { + hfItemID.Value = value.ToString(); + bool showBtn = value != 0; + // fix visibilità + lbtCancel.Visible = showBtn; + lbtScrapped.Visible = showBtn; + lbtParkArea.Visible = showBtn; + } + } + + private void resetIcons() + { + lblDestination.CssClass = "text-secondary"; + lblMessage.Text = ""; + lblDestination.Text = ""; + lblLastBCode.Text = ""; + lbtCancel.Visible = false; + lbtScrapped.Visible = false; + lbtParkArea.Visible = false; + lbtResetSel.Visible = (itemIdSelected != 0); + } + + protected DS_App.BinsDataTable currBinTab + { + get + { + return DataLayer.man.taBN.getByItemID(itemIdSelected); + } + } + protected DS_App.CartsDataTable currCartTab + { + get + { + return DataLayer.man.taCR.getByItemID(itemIdSelected); + } + } + + private void doUpdate() + { + // reset grafico + icnCart.Attributes.Remove("class"); + icnCart.Attributes.Add("class", "btn btn-sm btn-block btn-outline-secondary"); + icnBin.Attributes.Remove("class"); + icnBin.Attributes.Add("class", "btn btn-sm btn-block btn-outline-secondary"); + icnSecOp.Attributes.Remove("class"); + icnSecOp.Attributes.Add("class", "btn btn-sm btn-block btn-outline-secondary"); + + // in base al secondo mostro uno o altro... + if (showCart) + { + icnCart.Attributes.Remove("class"); + icnCart.Attributes.Add("class", "btn btn-sm btn-block btn-success"); + lblMessage.Text = "Item recognized"; + // controllo SE HO cart + if (currCartTab.Count == 1) + { + var cartRow = currCartTab[0]; + // imposto OUT + lblDestination.Text = $"SEND TO CART C{cartRow.CartIndex} ({cartRow.CartDtmx})"; + } + else + { + lblDestination.Text = $"ERROR SEARCHING CART: {currCartTab.Count} found!"; + } + lblDestination.CssClass = "text-success"; + } + else if (showBin) + { + icnBin.Attributes.Remove("class"); + icnBin.Attributes.Add("class", "btn btn-sm btn-block btn-primary"); + lblMessage.Text = "Item recognized"; + if (currBinTab.Count == 1) + { + var binRow = currBinTab[0]; + lblDestination.Text = $"SEND TO BIN B{binRow.BinIndex} ({binRow.BinDtmx})"; + } + else + { + lblDestination.Text = $"ERROR SEARCHING BIN: {currBinTab.Count} found!"; + } + lblDestination.CssClass = "text-primary"; + } + if (showSecOp) + { + icnSecOp.Attributes.Remove("class"); + icnSecOp.Attributes.Add("class", "btn btn-sm btn-block btn-info"); + lblMessage.Text = "Item recognized"; + lblLastBCode.Text = $"DO SEC OP: {secOp}"; + lblLastBCode.CssClass = "text-info"; + } + // fix btn reset! + lbtResetSel.Visible = (itemIdSelected != 0); + } + + protected void lbtCancel_Click(object sender, EventArgs e) + { + // resetto item selezionato... + DataLayer.man.taIL.updateStatus(itemIdSelected, 1, PlaceId); + resetSelection(true); + showItemDetail(false, null, false); + } + protected void lbtResetSel_Click(object sender, EventArgs e) + { + var tabSheet = DataLayer.man.taSHL.getByItemID(itemIdSelected); + if (tabSheet.Count == 1) + { + resetShowData(); + // resetto sheet selezionato... + DataLayer.man.taIL.updateSheetStatusPU(tabSheet[0].SheetID, PlaceId); + resetSelection(true); + showItemDetail(false, null, false); + } + } + /// + /// imposto a parcheggiato + /// + /// + /// + protected void lbtParkArea_Click(object sender, EventArgs e) + { + // resetto item selezionato... + DataLayer.man.taIL.updateStatus(itemIdSelected, 100, PlaceId); + resetSelection(true); + showItemDetail(false, null, false); + lblMessage.Text = "Item Parked"; + } + /// + /// Imposto come danneggiato/scrapped da rilavorare offline + /// + /// + /// + protected void lbtScrapped_Click(object sender, EventArgs e) + { + // resetto item selezionato... + DataLayer.man.taIL.updateStatus(itemIdSelected, 990, PlaceId); + lblMessage.Text = "Item Set SCRAPPED"; + // rirprocesso barcode... + lastCmd = lastValidCmd; + processLastCmd(false); + } } - protected void lbtResetSel_Click(object sender, EventArgs e) - { - var tabSheet = DataLayer.man.taSHL.getByItemID(itemIdSelected); - if (tabSheet.Count == 1) - { - resetShowData(); - // resetto sheet selezionato... - DataLayer.man.taIL.updateSheetStatusPU(tabSheet[0].SheetID, PlaceId); - resetSelection(true); - showItemDetail(false, null, false); - } - } - /// - /// imposto a parcheggiato - /// - /// - /// - protected void lbtParkArea_Click(object sender, EventArgs e) - { - // resetto item selezionato... - DataLayer.man.taIL.updateStatus(itemIdSelected, 100, PlaceId); - resetSelection(true); - showItemDetail(false, null, false); - lblMessage.Text = "Item Parked"; - } - /// - /// Imposto come danneggiato/scrapped da rilavorare offline - /// - /// - /// - protected void lbtScrapped_Click(object sender, EventArgs e) - { - // resetto item selezionato... - DataLayer.man.taIL.updateStatus(itemIdSelected, 990, PlaceId); - lblMessage.Text = "Item Set SCRAPPED"; - // rirprocesso barcode... - lastCmd = lastValidCmd; - processLastCmd(false); - } - } } \ No newline at end of file diff --git a/NKC_WF/WebUserControls/cmp_login.ascx.cs b/NKC_WF/WebUserControls/cmp_login.ascx.cs index be54c77..aa666b7 100644 --- a/NKC_WF/WebUserControls/cmp_login.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_login.ascx.cs @@ -1,82 +1,78 @@ 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_login : System.Web.UI.UserControl - { - #region eventi pubblici esposti - - public event EventHandler Login_ok; - public event EventHandler Login_Error; - - #endregion - - protected void Page_Load(object sender, EventArgs e) + public partial class cmp_login : System.Web.UI.UserControl { - if (!Page.IsPostBack) - { - AdLogin(); - } - } + #region eventi pubblici esposti - private void AdLogin() - { - lblMessage.Text = "User not authenticated..."; - if (Page.User.Identity.IsAuthenticated) - { - //recupera user windows se c'è... - string ad_name = Page.User.Identity.Name; - string delimStr = "\\"; - char[] delimiter = delimStr.ToCharArray(); - string[] dom_user = ad_name.Split(delimiter, 2); - // passo al controllo di verifica ADuserOk... - user_std _utente = new user_std(); - if (_utente.ADuserOk(dom_user[0], dom_user[1])) + public event EventHandler Login_ok; + public event EventHandler Login_Error; + + #endregion + + protected void Page_Load(object sender, EventArgs e) { - bool fatto = _utente.startUpUtente(dom_user[0], dom_user[1]); - if (fatto) - { - logger.lg.scriviLog(string.Format("L'utente {0} ({1}) ha effettuato il login correttamente", _utente.CognomeNome, _utente.userNameAD), SteamWare.tipoLog.INFO); - if (Login_ok != null) + if (!Page.IsPostBack) { - Login_ok(this, new EventArgs()); + AdLogin(); } - } - else - { - lblMessage.Text = String.Format("{0}
There are some problems instatiating user: {1}/{2}", user_std.UtSn.Traduci("AccessFail"), dom_user[0], dom_user[1]); - logger.lg.scriviLog(String.Format("Accesso fallito, problemi ad istanziare l'utente {0}/{1}", dom_user[0], dom_user[1]), SteamWare.tipoLog.ERROR); - if (Login_Error != null) + } + + private void AdLogin() + { + lblMessage.Text = "User not authenticated..."; + if (Page.User.Identity.IsAuthenticated) { - Login_Error(this, new EventArgs()); + //recupera user windows se c'è... + string ad_name = Page.User.Identity.Name; + string delimStr = "\\"; + char[] delimiter = delimStr.ToCharArray(); + string[] dom_user = ad_name.Split(delimiter, 2); + // passo al controllo di verifica ADuserOk... + user_std _utente = new user_std(); + if (_utente.ADuserOk(dom_user[0], dom_user[1])) + { + bool fatto = _utente.startUpUtente(dom_user[0], dom_user[1]); + if (fatto) + { + logger.lg.scriviLog(string.Format("L'utente {0} ({1}) ha effettuato il login correttamente", _utente.CognomeNome, _utente.userNameAD), SteamWare.tipoLog.INFO); + if (Login_ok != null) + { + Login_ok(this, new EventArgs()); + } + } + else + { + lblMessage.Text = String.Format("{0}
There are some problems instatiating user: {1}/{2}", user_std.UtSn.Traduci("AccessFail"), dom_user[0], dom_user[1]); + logger.lg.scriviLog(String.Format("Accesso fallito, problemi ad istanziare l'utente {0}/{1}", dom_user[0], dom_user[1]), SteamWare.tipoLog.ERROR); + if (Login_Error != null) + { + Login_Error(this, new EventArgs()); + } + } + } + else + { + lblMessage.Text = String.Format("{0}
user not allowed: {1}/{2}", user_std.UtSn.Traduci("AccessFail"), dom_user[0], dom_user[1]); + logger.lg.scriviLog(String.Format("Utente non autorizzato: {0}/{1}", dom_user[0], dom_user[1]), SteamWare.tipoLog.WARNING); + if (Login_Error != null) + { + Login_Error(this, new EventArgs()); + } + } + } + else + { + lblMessage.Text = user_std.UtSn.Traduci("AccessFail") + user_std.UtSn.Traduci("UsrNotAuth"); + logger.lg.scriviLog(String.Format("Accesso fallito, utente non autenticato"), SteamWare.tipoLog.WARNING); + if (Login_Error != null) + { + Login_Error(this, new EventArgs()); + } } - } } - else - { - lblMessage.Text = String.Format("{0}
user not allowed: {1}/{2}", user_std.UtSn.Traduci("AccessFail"), dom_user[0], dom_user[1]); - logger.lg.scriviLog(String.Format("Utente non autorizzato: {0}/{1}", dom_user[0], dom_user[1]), SteamWare.tipoLog.WARNING); - if (Login_Error != null) - { - Login_Error(this, new EventArgs()); - } - } - } - else - { - lblMessage.Text = user_std.UtSn.Traduci("AccessFail") + user_std.UtSn.Traduci("UsrNotAuth"); - logger.lg.scriviLog(String.Format("Accesso fallito, utente non autenticato"), SteamWare.tipoLog.WARNING); - if (Login_Error != null) - { - Login_Error(this, new EventArgs()); - } - } } - } } \ No newline at end of file diff --git a/NKC_WF/WebUserControls/cmp_menuTop.ascx.cs b/NKC_WF/WebUserControls/cmp_menuTop.ascx.cs index 513656e..ee9d359 100644 --- a/NKC_WF/WebUserControls/cmp_menuTop.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_menuTop.ascx.cs @@ -1,133 +1,129 @@ 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_menuTop : System.Web.UI.UserControl - { - public event EventHandler eh_doRefresh; - protected void Page_Load(object sender, EventArgs e) + public partial class cmp_menuTop : System.Web.UI.UserControl { - if (!Page.IsPostBack) - { - searchVal = ""; - doSearch(); - updateTreeMenu(); - } - } - /// - /// imposta visibilità search globale - /// - public bool showSearch - { - get - { - return divSearch.Visible; - } - set - { - divSearch.Visible = value; - } - } - - protected void txtSearch_TextChanged(object sender, EventArgs e) - { - doSearch(); - } - - private void doSearch() - { - // se searchVal !="" - if (searchVal != "") - { - memLayer.ML.setSessionVal("valoreSearch", searchVal); - } - else - { - memLayer.ML.emptySessionVal("valoreSearch"); - } - // se qualcuno ascolta sollevo evento nuovo valore... - if (eh_doRefresh != null) - { - eh_doRefresh(this, new EventArgs()); - } - } - - /// - /// Valore ricerca attivo - /// - protected string searchVal - { - get - { - return txtSearch.Text.Trim(); - } - set - { - txtSearch.Text = value.Trim(); - } - } - /// - /// aggiornamento del menù - /// - private void updateTreeMenu() - { - try - { - if (string.IsNullOrEmpty(user_std.UtSn.mappaSito)) + public event EventHandler eh_doRefresh; + protected void Page_Load(object sender, EventArgs e) { - Response.Redirect("Default", false); + if (!Page.IsPostBack) + { + searchVal = ""; + doSearch(); + updateTreeMenu(); + } + } + /// + /// imposta visibilità search globale + /// + public bool showSearch + { + get + { + return divSearch.Visible; + } + set + { + divSearch.Visible = value; + } + } + + protected void txtSearch_TextChanged(object sender, EventArgs e) + { + doSearch(); + } + + private void doSearch() + { + // se searchVal !="" + if (searchVal != "") + { + memLayer.ML.setSessionVal("valoreSearch", searchVal); + } + else + { + memLayer.ML.emptySessionVal("valoreSearch"); + } + // se qualcuno ascolta sollevo evento nuovo valore... + if (eh_doRefresh != null) + { + eh_doRefresh(this, new EventArgs()); + } + } + + /// + /// Valore ricerca attivo + /// + protected string searchVal + { + get + { + return txtSearch.Text.Trim(); + } + set + { + txtSearch.Text = value.Trim(); + } + } + /// + /// aggiornamento del menù + /// + private void updateTreeMenu() + { + try + { + if (string.IsNullOrEmpty(user_std.UtSn.mappaSito)) + { + Response.Redirect("Default", false); + } + XmlMenu.Data = user_std.UtSn.mappaSito; + XmlMenu.XPath = "mainMenu/menu"; + XmlMenu.DataBind(); + } + catch + { + Response.Redirect("Default", false); + } + } + /// + /// click su pagina corrente, fa update! + /// + /// + /// + protected void lbnUpdate_Click(object sender, EventArgs e) + { + doDataUpdate(true); + } + /// + /// effettua un update completo dei valori in sessione + /// + private void doDataUpdate(bool doFullReset) + { + if (doFullReset) + { + // reset REDIS x css + ComLib.man.resetSheetUnload(); + // aggiorno vocabolario + DataWrap.DW.resetVocabolario(); + // reset dati in cache x DbConfig... + memLayer.ML.resetAppConf(); + // svuoto session e cache per rileggere i dati da Db + Session.RemoveAll(); + memLayer.ML.setSessionVal("nextPage", user_std.pagCorrente); + Response.Redirect("login"); + } + else + { + Response.Redirect(user_std.pagCorrente); + } + } + protected void lbtSearch_Click(object sender, EventArgs e) + { + doSearch(); } - XmlMenu.Data = user_std.UtSn.mappaSito; - XmlMenu.XPath = "mainMenu/menu"; - XmlMenu.DataBind(); - } - catch - { - Response.Redirect("Default", false); - } } - /// - /// click su pagina corrente, fa update! - /// - /// - /// - protected void lbnUpdate_Click(object sender, EventArgs e) - { - doDataUpdate(true); - } - /// - /// effettua un update completo dei valori in sessione - /// - private void doDataUpdate(bool doFullReset) - { - if (doFullReset) - { - // reset REDIS x css - ComLib.man.resetSheetUnload(); - // aggiorno vocabolario - DataWrap.DW.resetVocabolario(); - // reset dati in cache x DbConfig... - memLayer.ML.resetAppConf(); - // svuoto session e cache per rileggere i dati da Db - Session.RemoveAll(); - memLayer.ML.setSessionVal("nextPage", user_std.pagCorrente); - Response.Redirect("login"); - } - else - { - Response.Redirect(user_std.pagCorrente); - } - } - protected void lbtSearch_Click(object sender, EventArgs e) - { - doSearch(); - } - } } \ No newline at end of file diff --git a/NKC_WF/WebUserControls/cmp_numRow.ascx.cs b/NKC_WF/WebUserControls/cmp_numRow.ascx.cs index 9ecdf4e..f7bbd08 100644 --- a/NKC_WF/WebUserControls/cmp_numRow.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_numRow.ascx.cs @@ -1,45 +1,40 @@ 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_numRow : System.Web.UI.UserControl - { - public event EventHandler eh_doRefresh; - protected void Page_Load(object sender, EventArgs e) + public partial class cmp_numRow : System.Web.UI.UserControl { + public event EventHandler eh_doRefresh; + protected void Page_Load(object sender, EventArgs e) + { - } + } - private void raiseEvent() - { - // se qualcuno ascolta sollevo evento nuovo valore... - if (eh_doRefresh != null) - { - eh_doRefresh(this, new EventArgs()); - } - } - public int numRow - { - set - { - txtNumRow.Text = value.ToString(); - } - get - { - int answ = 10; - int.TryParse(txtNumRow.Text, out answ); - return answ; - } - } + private void raiseEvent() + { + // se qualcuno ascolta sollevo evento nuovo valore... + if (eh_doRefresh != null) + { + eh_doRefresh(this, new EventArgs()); + } + } + public int numRow + { + set + { + txtNumRow.Text = value.ToString(); + } + get + { + int answ = 10; + int.TryParse(txtNumRow.Text, out answ); + return answ; + } + } - protected void txtNumRow_TextChanged(object sender, EventArgs e) - { - raiseEvent(); + protected void txtNumRow_TextChanged(object sender, EventArgs e) + { + raiseEvent(); + } } - } } \ No newline at end of file diff --git a/NKC_WF/WebUserControls/cmp_offOrderDetail.ascx.cs b/NKC_WF/WebUserControls/cmp_offOrderDetail.ascx.cs index b0a7b2b..1ac5939 100644 --- a/NKC_WF/WebUserControls/cmp_offOrderDetail.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_offOrderDetail.ascx.cs @@ -8,105 +8,105 @@ using System.Web.UI.WebControls; namespace NKC_WF.WebUserControls { - public partial class cmp_offOrderDetail : BaseUserControl - { - protected void Page_Load(object sender, EventArgs e) + public partial class cmp_offOrderDetail : BaseUserControl { - if (!Page.IsPostBack) - { - // pulisco dir temp dai file dei cartellini stampati - reportPrinter.obj.pulisciDir(); - } - } - - public int OffOrdId - { - get - { - int answ = 0; - int.TryParse(hfOffOrderId.Value, out answ); - return answ; - } - set - { - hfOffOrderId.Value = value.ToString(); - // faccio udpate svg... - frmView.DataBind(); - } - } - - protected void frmView_DataBound(object sender, EventArgs e) - { - try - { - Label filePath = (Label)frmView.FindControl("DrawFilePathLabel"); - // se ho una stringa valida mostro svg, altrimenti NOT PROCESSED... - if (filePath.Text != "") + protected void Page_Load(object sender, EventArgs e) { - string filename = Server.MapPath(filePath.Text); - string svgRawData = File.ReadAllText(filename); - HtmlGenericControl svgControl = (HtmlGenericControl)frmView.FindControl("svgTable"); - svgControl.InnerHtml = svgRawData; + if (!Page.IsPostBack) + { + // pulisco dir temp dai file dei cartellini stampati + reportPrinter.obj.pulisciDir(); + } } - } - catch (Exception exc) - { - logger.lg.scriviLog($"Eccezione in tentativo display file svg da ordine offline{Environment.NewLine}{exc}"); - } + + public int OffOrdId + { + get + { + int answ = 0; + int.TryParse(hfOffOrderId.Value, out answ); + return answ; + } + set + { + hfOffOrderId.Value = value.ToString(); + // faccio udpate svg... + frmView.DataBind(); + } + } + + protected void frmView_DataBound(object sender, EventArgs e) + { + try + { + Label filePath = (Label)frmView.FindControl("DrawFilePathLabel"); + // se ho una stringa valida mostro svg, altrimenti NOT PROCESSED... + if (filePath.Text != "") + { + string filename = Server.MapPath(filePath.Text); + string svgRawData = File.ReadAllText(filename); + HtmlGenericControl svgControl = (HtmlGenericControl)frmView.FindControl("svgTable"); + svgControl.InnerHtml = svgRawData; + } + } + catch (Exception exc) + { + logger.lg.scriviLog($"Eccezione in tentativo display file svg da ordine offline{Environment.NewLine}{exc}"); + } + } + + protected void lbtMakeCnc_Click(object sender, EventArgs e) + { + bool allOk = true; + // invio tramite redis... + try + { + // ...inizio dai materiali + ComLib.sendMaterials(); + // invio VERA richeista come OFFLINE ORDER... + allOk = ComLib.sendOfflineOrderReq(OffOrdId, "OffOrdCalculation"); + } + catch (Exception exc) + { + logger.lg.scriviLog($"Eccezione in tentativo creazione file CNC da ordine offline{Environment.NewLine}{exc}"); + } + + if (allOk) + { + // registro che ho stampato... 2! + DataLayer.man.taOffOL.updateStatus(OffOrdId, 1); + } + frmView.DataBind(); + raiseEvent(); + } + + protected void lbtPrintLabels_Click(object sender, EventArgs e) + { + bool allOk = true; + // chiamo procedura stampa report x etichette dei pezzi lavorati offline + string printer = DataLayer.man.getPrinter("PC-MACHINE-OFFLINE"); + // ciclo tra TUTTI gli item compresi in questo Offline Order + var tabItems = DataLayer.man.taIL.getByOfflineOrder(OffOrdId); + foreach (var item in tabItems) + { + // lancio stampa + allOk = allOk && DataLayer.man.stampaDoc(item.ItemID.ToString(), printer, tipoDocumento.docPart, Request.UserHostName); + } + if (allOk) + { + // registro che ho stampato... 2! + DataLayer.man.taOffOL.updateStatus(OffOrdId, 2); + } + frmView.DataBind(); + raiseEvent(); + } + + protected void lblDone_Click(object sender, EventArgs e) + { + // registro che ho COMPLETATO... 3! + DataLayer.man.taOffOL.updateStatus(OffOrdId, 3); + raiseReset(); + } + } - - protected void lbtMakeCnc_Click(object sender, EventArgs e) - { - bool allOk = true; - // invio tramite redis... - try - { - // ...inizio dai materiali - ComLib.sendMaterials(); - // invio VERA richeista come OFFLINE ORDER... - allOk = ComLib.sendOfflineOrderReq(OffOrdId, "OffOrdCalculation"); - } - catch (Exception exc) - { - logger.lg.scriviLog($"Eccezione in tentativo creazione file CNC da ordine offline{Environment.NewLine}{exc}"); - } - - if (allOk) - { - // registro che ho stampato... 2! - DataLayer.man.taOffOL.updateStatus(OffOrdId, 1); - } - frmView.DataBind(); - raiseEvent(); - } - - protected void lbtPrintLabels_Click(object sender, EventArgs e) - { - bool allOk = true; - // chiamo procedura stampa report x etichette dei pezzi lavorati offline - string printer = DataLayer.man.getPrinter("PC-MACHINE-OFFLINE"); - // ciclo tra TUTTI gli item compresi in questo Offline Order - var tabItems = DataLayer.man.taIL.getByOfflineOrder(OffOrdId); - foreach (var item in tabItems) - { - // lancio stampa - allOk = allOk && DataLayer.man.stampaDoc(item.ItemID.ToString(), printer, tipoDocumento.docPart, Request.UserHostName); - } - if (allOk) - { - // registro che ho stampato... 2! - DataLayer.man.taOffOL.updateStatus(OffOrdId, 2); - } - frmView.DataBind(); - raiseEvent(); - } - - protected void lblDone_Click(object sender, EventArgs e) - { - // registro che ho COMPLETATO... 3! - DataLayer.man.taOffOL.updateStatus(OffOrdId, 3); - raiseReset(); - } - - } } \ No newline at end of file diff --git a/NKC_WF/WebUserControls/cmp_offlineOrders.ascx.cs b/NKC_WF/WebUserControls/cmp_offlineOrders.ascx.cs index 8471e82..6bb8c85 100644 --- a/NKC_WF/WebUserControls/cmp_offlineOrders.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_offlineOrders.ascx.cs @@ -4,86 +4,86 @@ using System.Web.UI; namespace NKC_WF.WebUserControls { - public partial class cmp_offlineOrders : System.Web.UI.UserControl - { - protected void Page_Load(object sender, EventArgs e) + public partial class cmp_offlineOrders : System.Web.UI.UserControl { - if (!Page.IsPostBack) - { - mod_righePag.numRowPag = 10; - cmp_offOrderDetail.Visible = false; - } - mod_righePag.eh_newNum += Mod_righePag_eh_newNum; - cmp_offOrderDetail.eh_doRefresh += Cmp_offOrderDetail_eh_doRefresh; - cmp_offOrderDetail.eh_doReset += Cmp_offOrderDetail_eh_doReset; - } - - private void Cmp_offOrderDetail_eh_doReset(object sender, EventArgs e) - { - forceReset(); - } - - private void Cmp_offOrderDetail_eh_doRefresh(object sender, EventArgs e) - { - doUpdate(); - } - - private void Mod_righePag_eh_newNum(object sender, EventArgs e) - { - grView.PageSize = mod_righePag.numRowPag; - } - public void doUpdate() - { - grView.DataBind(); - } - - protected void lbtReset_Click(object sender, EventArgs e) - { - forceReset(); - } - - private void forceReset() - { - grView.SelectedIndex = -1; - grView.DataBind(); - cmp_offOrderDetail.Visible = false; - } - - protected int selOrdId - { - get - { - int answ = 0; - int.TryParse(grView.SelectedValue.ToString(), out answ); - return answ; - } - } - - protected void grView_SelectedIndexChanged(object sender, EventArgs e) - { - // controllo update... SOLO SE status è 1... - var currOrd = DataLayer.man.taOffOL.getByKey(selOrdId); - bool fatto = false; - try - { - if (currOrd.Count == 1) + protected void Page_Load(object sender, EventArgs e) { - if (currOrd[0].OrdStatus == 1 && currOrd[0].DrawFilePath == "") - { - fatto = ComLib.checkOfflineOrderReq(selOrdId); - } + if (!Page.IsPostBack) + { + mod_righePag.numRowPag = 10; + cmp_offOrderDetail.Visible = false; + } + mod_righePag.eh_newNum += Mod_righePag_eh_newNum; + cmp_offOrderDetail.eh_doRefresh += Cmp_offOrderDetail_eh_doRefresh; + cmp_offOrderDetail.eh_doReset += Cmp_offOrderDetail_eh_doReset; } - } - catch - { } - // visualizzo dettaglio ordine... - cmp_offOrderDetail.OffOrdId = selOrdId; - cmp_offOrderDetail.Visible = true; - if (fatto) - { - grView.DataBind(); - } - } - } + private void Cmp_offOrderDetail_eh_doReset(object sender, EventArgs e) + { + forceReset(); + } + + private void Cmp_offOrderDetail_eh_doRefresh(object sender, EventArgs e) + { + doUpdate(); + } + + private void Mod_righePag_eh_newNum(object sender, EventArgs e) + { + grView.PageSize = mod_righePag.numRowPag; + } + public void doUpdate() + { + grView.DataBind(); + } + + protected void lbtReset_Click(object sender, EventArgs e) + { + forceReset(); + } + + private void forceReset() + { + grView.SelectedIndex = -1; + grView.DataBind(); + cmp_offOrderDetail.Visible = false; + } + + protected int selOrdId + { + get + { + int answ = 0; + int.TryParse(grView.SelectedValue.ToString(), out answ); + return answ; + } + } + + protected void grView_SelectedIndexChanged(object sender, EventArgs e) + { + // controllo update... SOLO SE status è 1... + var currOrd = DataLayer.man.taOffOL.getByKey(selOrdId); + bool fatto = false; + try + { + if (currOrd.Count == 1) + { + if (currOrd[0].OrdStatus == 1 && currOrd[0].DrawFilePath == "") + { + fatto = ComLib.checkOfflineOrderReq(selOrdId); + } + } + } + catch + { } + // visualizzo dettaglio ordine... + cmp_offOrderDetail.OffOrdId = selOrdId; + cmp_offOrderDetail.Visible = true; + if (fatto) + { + grView.DataBind(); + } + } + + } } \ No newline at end of file diff --git a/NKC_WF/WebUserControls/cmp_orderRunning.ascx.cs b/NKC_WF/WebUserControls/cmp_orderRunning.ascx.cs index cd5b68a..6ecf508 100644 --- a/NKC_WF/WebUserControls/cmp_orderRunning.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_orderRunning.ascx.cs @@ -1,10 +1,4 @@ -using AppData; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using System.Web.UI; -using System.Web.UI.WebControls; +using System; namespace NKC_WF.WebUserControls { diff --git a/NKC_WF/WebUserControls/cmp_orderSched.ascx.cs b/NKC_WF/WebUserControls/cmp_orderSched.ascx.cs index 55093f0..e9418f3 100644 --- a/NKC_WF/WebUserControls/cmp_orderSched.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_orderSched.ascx.cs @@ -1,9 +1,5 @@ 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; diff --git a/NKC_WF/WebUserControls/cmp_paint_bins.ascx.cs b/NKC_WF/WebUserControls/cmp_paint_bins.ascx.cs index 8b5f225..3fb136c 100644 --- a/NKC_WF/WebUserControls/cmp_paint_bins.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_paint_bins.ascx.cs @@ -1,181 +1,176 @@ 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_paint_bins : System.Web.UI.UserControl - { - /// - /// Testo titolo... - /// - public string titleText - { - set - { - lblTitle.Text = value; - } - get - { - return lblTitle.Text; - } - } - /// - /// Classe css titolo... - /// - public string titleClass - { - set - { - lblTitle.CssClass = value; - } - get - { - return lblTitle.CssClass; - } - } - /// - /// Batch corrente... - /// - public int BatchId - { - set - { - hfBatchID.Value = value.ToString(); - doUpdate(); - } - get - { - int answ = 0; - int.TryParse(hfBatchID.Value, out answ); - return answ; - } - } - /// - /// Indica se mostrare o meno QRCode - /// - public bool ShowQr - { - set - { - hfShowQr.Value = value.ToString(); - } - get - { - bool answ = false; - bool.TryParse(hfShowQr.Value, out answ); - return answ; - } - } - /// - /// Indica se mostrare o meno COMPLETED - /// - public bool ShowComplete - { - set - { - hfShowComplete.Value = value.ToString(); - } - get - { - bool answ = false; - bool.TryParse(hfShowComplete.Value, out answ); - return answ; - } - } - /// - /// Indica se mostrare o meno PAINTED - /// - public bool ShowPainted - { - set - { - hfShowPainted.Value = value.ToString(); - } - get - { - bool answ = false; - bool.TryParse(hfShowPainted.Value, out answ); - return answ; - } - } - /// - /// restituisce URL immagine QRCode - /// - /// - /// - public string getImgUrl(object currId) - { - string baseUrl = "https://qrcode.steamware.net/HOME/QR_site/JSON?val="; - string payload = "{'baseUrl':'{0}','parameters':['" + currId.ToString() + "']}"; - string answ = $"{baseUrl}{payload}"; - return answ; - } - protected void Page_Load(object sender, EventArgs e) + public partial class cmp_paint_bins : System.Web.UI.UserControl { + /// + /// Testo titolo... + /// + public string titleText + { + set + { + lblTitle.Text = value; + } + get + { + return lblTitle.Text; + } + } + /// + /// Classe css titolo... + /// + public string titleClass + { + set + { + lblTitle.CssClass = value; + } + get + { + return lblTitle.CssClass; + } + } + /// + /// Batch corrente... + /// + public int BatchId + { + set + { + hfBatchID.Value = value.ToString(); + doUpdate(); + } + get + { + int answ = 0; + int.TryParse(hfBatchID.Value, out answ); + return answ; + } + } + /// + /// Indica se mostrare o meno QRCode + /// + public bool ShowQr + { + set + { + hfShowQr.Value = value.ToString(); + } + get + { + bool answ = false; + bool.TryParse(hfShowQr.Value, out answ); + return answ; + } + } + /// + /// Indica se mostrare o meno COMPLETED + /// + public bool ShowComplete + { + set + { + hfShowComplete.Value = value.ToString(); + } + get + { + bool answ = false; + bool.TryParse(hfShowComplete.Value, out answ); + return answ; + } + } + /// + /// Indica se mostrare o meno PAINTED + /// + public bool ShowPainted + { + set + { + hfShowPainted.Value = value.ToString(); + } + get + { + bool answ = false; + bool.TryParse(hfShowPainted.Value, out answ); + return answ; + } + } + /// + /// restituisce URL immagine QRCode + /// + /// + /// + public string getImgUrl(object currId) + { + string baseUrl = "https://qrcode.steamware.net/HOME/QR_site/JSON?val="; + string payload = "{'baseUrl':'{0}','parameters':['" + currId.ToString() + "']}"; + string answ = $"{baseUrl}{payload}"; + return answ; + } + protected void Page_Load(object sender, EventArgs e) + { + } + public void doUpdate() + { + grView.DataBind(); + } + /// + /// Calcola il rapporto tra 2 valori + /// + /// + /// + /// + public double getRatio(object _dividendo, object _divisore) + { + double ratio = 0; + double dividendo = 0; + double divisore = 1; + double.TryParse(_dividendo.ToString(), out dividendo); + double.TryParse(_divisore.ToString(), out divisore); + ratio = dividendo / divisore; + return ratio; + } + /// + /// determina CSS x colore testo da perc svuotamento... + /// + /// + /// + public string getCssByRatio(double ratio) + { + string answ = "text-dark"; + if (ratio == 0) + { + answ = "text-danger"; + } + else if (ratio == 1) + { + answ = "text-success"; + } + else + { + answ = "text-warning"; + } + return answ; + } + /// + /// Dimensione QRCode + /// + public int qrSize + { + get + { + int answ = 32; + int.TryParse(hfQrSize.Value, out answ); + return answ; + } + set + { + hfQrSize.Value = value.ToString(); + doUpdate(); + } + } } - public void doUpdate() - { - grView.DataBind(); - } - /// - /// Calcola il rapporto tra 2 valori - /// - /// - /// - /// - public double getRatio(object _dividendo, object _divisore) - { - double ratio = 0; - double dividendo = 0; - double divisore = 1; - double.TryParse(_dividendo.ToString(), out dividendo); - double.TryParse(_divisore.ToString(), out divisore); - ratio = dividendo / divisore; - return ratio; - } - /// - /// determina CSS x colore testo da perc svuotamento... - /// - /// - /// - public string getCssByRatio(double ratio) - { - string answ = "text-dark"; - if (ratio == 0) - { - answ = "text-danger"; - } - else if (ratio == 1) - { - answ = "text-success"; - } - else - { - answ = "text-warning"; - } - return answ; - } - /// - /// Dimensione QRCode - /// - public int qrSize - { - get - { - int answ = 32; - int.TryParse(hfQrSize.Value, out answ); - return answ; - } - set - { - hfQrSize.Value = value.ToString(); - doUpdate(); - } - } - } } \ No newline at end of file diff --git a/NKC_WF/WebUserControls/cmp_painting.ascx.cs b/NKC_WF/WebUserControls/cmp_painting.ascx.cs index 44a75a3..de2aa08 100644 --- a/NKC_WF/WebUserControls/cmp_painting.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_painting.ascx.cs @@ -1,168 +1,163 @@ using AppData; using NKC_SDK; 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_painting : BaseUserControl - { - /// - /// Comando barcode letto - /// - protected string lastCmd + public partial class cmp_painting : BaseUserControl { - get - { - return hfLastBCode.Value; - } - set - { - hfLastBCode.Value = value; - lastValidCmd = value; - } - } - /// - /// ULTIMO Comando barcode VALIDO (!="") letto - /// - protected string lastValidCmd - { - get - { - return hfLastValidBCode.Value; - } - set - { - // solo se è !="" - if (value != "") + /// + /// Comando barcode letto + /// + protected string lastCmd { - hfLastValidBCode.Value = value; + get + { + return hfLastBCode.Value; + } + set + { + hfLastBCode.Value = value; + lastValidCmd = value; + } + } + /// + /// ULTIMO Comando barcode VALIDO (!="") letto + /// + protected string lastValidCmd + { + get + { + return hfLastValidBCode.Value; + } + set + { + // solo se è !="" + if (value != "") + { + hfLastValidBCode.Value = value; + } + } + } + /// + /// caricamento pagina + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) + { + fixButtons(); + cmp_barcode.eh_doRefresh += Cmp_barcode_eh_doRefresh; } - } - } - /// - /// caricamento pagina - /// - /// - /// - protected void Page_Load(object sender, EventArgs e) - { - fixButtons(); - cmp_barcode.eh_doRefresh += Cmp_barcode_eh_doRefresh; - } - private void fixButtons() - { - lbtConfirmPaint.Visible = false; - } + private void fixButtons() + { + lbtConfirmPaint.Visible = false; + } - private void doUpdate() - { - cmp_paint_binsIN.doUpdate(); - cmp_paint_binsOUT.doUpdate(); - } + private void doUpdate() + { + cmp_paint_binsIN.doUpdate(); + cmp_paint_binsOUT.doUpdate(); + } - private void Cmp_barcode_eh_doRefresh(object sender, EventArgs e) - { - bool doRaiseEv = false; - // processo evento.. - lastCmd = cmp_barcode.inputAcquired.ToUpper(); - doRaiseEv = processLastCmd(doRaiseEv); - // reset comando - cmp_barcode.inputAcquired = ""; - // aggiorno... - doUpdate(); - } + private void Cmp_barcode_eh_doRefresh(object sender, EventArgs e) + { + bool doRaiseEv = false; + // processo evento.. + lastCmd = cmp_barcode.inputAcquired.ToUpper(); + doRaiseEv = processLastCmd(doRaiseEv); + // reset comando + cmp_barcode.inputAcquired = ""; + // aggiorno... + doUpdate(); + } - private bool processLastCmd(bool doRaiseEv) - { - // verifico il datamatrix dei BIN da pitturare - if (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: - cmp_barcode.showOutput("badge badge-warning", $"Item - ignored: {decoData.description}"); - doRaiseEv = true; - break; - case codeType.ItemGeneric: - cmp_barcode.showOutput("badge badge-warning", $"Item Generic - 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: - cmp_barcode.showOutput("badge badge-warning", $"BUNK - ignored: {decoData.description}"); - doRaiseEv = true; - break; - case codeType.Batch: - cmp_barcode.showOutput("badge badge-warning", $"Batch - ignored: {decoData.description}"); - doRaiseEv = true; - break; - case codeType.Cart: - cmp_barcode.showOutput("badge badge-warning", $"Cart - ignored: {decoData.description}"); - doRaiseEv = true; - break; - case codeType.Bin: - var tabBin = DataLayer.man.taBN.getByKey(decoData.codeInt); - bool allOk = false; - // se ne trovo 1 --> OK verde - if (tabBin.Count == 1) - { - // se NON E' PAINTED ma è COMPLETE - var riga = tabBin[0]; - allOk = (riga.Complete == 1 && riga.Painted == 0); - } - if (allOk) - { - cmp_barcode.showOutput("badge badge-success", $"Valid BN Code: {decoData.description}"); - } - else - { - cmp_barcode.showOutput("badge badge-danger", $"{decoData.description} --> no valid action"); - } - lbtConfirmPaint.Visible = allOk; - break; - case codeType.BinProcessed: - cmp_barcode.showOutput("text-danger", $"BinProcessed - ignored: {decoData.rawData} --> no action"); - doRaiseEv = true; - break; - case codeType.SecScreen: - cmp_barcode.showOutput("badge badge-warning", $"SecScreen - ignored: {decoData.description}"); - doRaiseEv = true; - break; - default: - cmp_barcode.showOutput("text-danger", $"Unknown Data: {decoData.rawData} --> no action"); - doRaiseEv = true; - break; - } - return doRaiseEv; - } + private bool processLastCmd(bool doRaiseEv) + { + // verifico il datamatrix dei BIN da pitturare + if (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: + cmp_barcode.showOutput("badge badge-warning", $"Item - ignored: {decoData.description}"); + doRaiseEv = true; + break; + case codeType.ItemGeneric: + cmp_barcode.showOutput("badge badge-warning", $"Item Generic - 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: + cmp_barcode.showOutput("badge badge-warning", $"BUNK - ignored: {decoData.description}"); + doRaiseEv = true; + break; + case codeType.Batch: + cmp_barcode.showOutput("badge badge-warning", $"Batch - ignored: {decoData.description}"); + doRaiseEv = true; + break; + case codeType.Cart: + cmp_barcode.showOutput("badge badge-warning", $"Cart - ignored: {decoData.description}"); + doRaiseEv = true; + break; + case codeType.Bin: + var tabBin = DataLayer.man.taBN.getByKey(decoData.codeInt); + bool allOk = false; + // se ne trovo 1 --> OK verde + if (tabBin.Count == 1) + { + // se NON E' PAINTED ma è COMPLETE + var riga = tabBin[0]; + allOk = (riga.Complete == 1 && riga.Painted == 0); + } + if (allOk) + { + cmp_barcode.showOutput("badge badge-success", $"Valid BN Code: {decoData.description}"); + } + else + { + cmp_barcode.showOutput("badge badge-danger", $"{decoData.description} --> no valid action"); + } + lbtConfirmPaint.Visible = allOk; + break; + case codeType.BinProcessed: + cmp_barcode.showOutput("text-danger", $"BinProcessed - ignored: {decoData.rawData} --> no action"); + doRaiseEv = true; + break; + case codeType.SecScreen: + cmp_barcode.showOutput("badge badge-warning", $"SecScreen - ignored: {decoData.description}"); + doRaiseEv = true; + break; + default: + cmp_barcode.showOutput("text-danger", $"Unknown Data: {decoData.rawData} --> no action"); + doRaiseEv = true; + break; + } + return doRaiseEv; + } - protected void lbtConfirmPaint_Click(object sender, EventArgs e) - { - // processiamo barcode letto - decodedData decoData = DataLayer.man.decodeBcode(lastValidCmd); - // lo indico come painted (update dtPainted) - DataLayer.man.taBN.updatePainted(decoData.codeInt, DateTime.Now); - // udpate tabelle! - doUpdate(); + protected void lbtConfirmPaint_Click(object sender, EventArgs e) + { + // processiamo barcode letto + decodedData decoData = DataLayer.man.decodeBcode(lastValidCmd); + // lo indico come painted (update dtPainted) + DataLayer.man.taBN.updatePainted(decoData.codeInt, DateTime.Now); + // udpate tabelle! + doUpdate(); + } } - } } \ No newline at end of file diff --git a/NKC_WF/WebUserControls/cmp_scrapList.ascx.cs b/NKC_WF/WebUserControls/cmp_scrapList.ascx.cs index 7de1e89..aa790f8 100644 --- a/NKC_WF/WebUserControls/cmp_scrapList.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_scrapList.ascx.cs @@ -4,81 +4,81 @@ using System.Web.UI.WebControls; namespace NKC_WF.WebUserControls { - public partial class cmp_scrapList : BaseUserControl - { - protected void Page_Load(object sender, EventArgs e) + public partial class cmp_scrapList : BaseUserControl { - if (!Page.IsPostBack) - { - mod_righePag.numRowPag = 10; - } - mod_righePag.eh_newNum += Mod_righePag_eh_newNum; - } - - private void Mod_righePag_eh_newNum(object sender, EventArgs e) - { - grView.PageSize = mod_righePag.numRowPag; - } - - - protected void chkToggle_CheckedChanged(object sender, EventArgs e) - { - // seleziono TUTTI i checkbox presenti - foreach (GridViewRow row in grView.Rows) - { - try + protected void Page_Load(object sender, EventArgs e) { - CheckBox chkb = (CheckBox)row.FindControl("chkSelected"); - chkb.Checked = !chkb.Checked; - } - catch { } - } - } - public string cssByStatus(object _statusId) - { - int statusId = 0; - int.TryParse(_statusId.ToString(), out statusId); - string answ = statusId == 990 ? "text-dark" : "text-secondary font-italic"; - - return answ; - } - protected void lbtCreateOffOrd_Click(object sender, EventArgs e) - { - bool doReport = false; - // creo NUOVO ordine offline... - DS_App.OfflineOrderListDataTable tabOrdini = DataLayer.man.taOffOL.insertNew(); - int itemId = 0; - // se ho la riga new in risposta... - if (tabOrdini.Count == 1) - { - // ciclo sulla grView x i selezionati - foreach (GridViewRow row in grView.Rows) - { - itemId = 0; - try - { - CheckBox chkb = (CheckBox)row.FindControl("chkSelected"); - if (chkb.Checked) + if (!Page.IsPostBack) { - // recupero valore - HiddenField hfid = (HiddenField)row.FindControl("hfItemID"); - int.TryParse(hfid.Value, out itemId); - // aggiungo ad ordine - if (itemId > 0) - { - DataLayer.man.taOO2I.insertQuery(tabOrdini[0].OrdID, itemId); - doReport = true; - } + mod_righePag.numRowPag = 10; + } + mod_righePag.eh_newNum += Mod_righePag_eh_newNum; + } + + private void Mod_righePag_eh_newNum(object sender, EventArgs e) + { + grView.PageSize = mod_righePag.numRowPag; + } + + + protected void chkToggle_CheckedChanged(object sender, EventArgs e) + { + // seleziono TUTTI i checkbox presenti + foreach (GridViewRow row in grView.Rows) + { + try + { + CheckBox chkb = (CheckBox)row.FindControl("chkSelected"); + chkb.Checked = !chkb.Checked; + } + catch { } + } + } + public string cssByStatus(object _statusId) + { + int statusId = 0; + int.TryParse(_statusId.ToString(), out statusId); + string answ = statusId == 990 ? "text-dark" : "text-secondary font-italic"; + + return answ; + } + protected void lbtCreateOffOrd_Click(object sender, EventArgs e) + { + bool doReport = false; + // creo NUOVO ordine offline... + DS_App.OfflineOrderListDataTable tabOrdini = DataLayer.man.taOffOL.insertNew(); + int itemId = 0; + // se ho la riga new in risposta... + if (tabOrdini.Count == 1) + { + // ciclo sulla grView x i selezionati + foreach (GridViewRow row in grView.Rows) + { + itemId = 0; + try + { + CheckBox chkb = (CheckBox)row.FindControl("chkSelected"); + if (chkb.Checked) + { + // recupero valore + HiddenField hfid = (HiddenField)row.FindControl("hfItemID"); + int.TryParse(hfid.Value, out itemId); + // aggiungo ad ordine + if (itemId > 0) + { + DataLayer.man.taOO2I.insertQuery(tabOrdini[0].OrdID, itemId); + doReport = true; + } + } + } + catch { } + } + } + if (doReport) + { + grView.DataBind(); + raiseEvent(); } - } - catch { } } - } - if (doReport) - { - grView.DataBind(); - raiseEvent(); - } } - } } \ No newline at end of file diff --git a/NKC_WF/WebUserControls/cmp_searchItems.ascx.cs b/NKC_WF/WebUserControls/cmp_searchItems.ascx.cs index 488cc4e..83cdbfc 100644 --- a/NKC_WF/WebUserControls/cmp_searchItems.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_searchItems.ascx.cs @@ -1,10 +1,4 @@ -using SteamWare.DS_loggingTableAdapters; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using System.Web.UI; -using System.Web.UI.WebControls; +using System; namespace NKC_WF.WebUserControls { diff --git a/NKC_WF/WebUserControls/cmp_slider.ascx.cs b/NKC_WF/WebUserControls/cmp_slider.ascx.cs index a4d2dd8..b6cf5e7 100644 --- a/NKC_WF/WebUserControls/cmp_slider.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_slider.ascx.cs @@ -1,100 +1,95 @@ 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_slider : BaseUserControl - { - /// - /// Valore min ammesso - /// - public int minVal + public partial class cmp_slider : BaseUserControl { - set - { - lblMin.Text = value.ToString(); - txtSlider.Attributes.Remove("min"); - txtSlider.Attributes.Add("min", value.ToString()); - } - get - { - int answ = 1; - int.TryParse(lblMin.Text, out answ); - return answ; - } - } - /// - /// Valore MAX ammesso - /// - public int maxVal - { - set - { - lblMax.Text = value.ToString(); - txtSlider.Attributes.Remove("max"); - txtSlider.Attributes.Add("max", value.ToString()); - } - get - { - int answ = 100; - int.TryParse(lblMax.Text, out answ); - return answ; - } - } - protected void Page_Load(object sender, EventArgs e) - { - } + /// + /// Valore min ammesso + /// + public int minVal + { + set + { + lblMin.Text = value.ToString(); + txtSlider.Attributes.Remove("min"); + txtSlider.Attributes.Add("min", value.ToString()); + } + get + { + int answ = 1; + int.TryParse(lblMin.Text, out answ); + return answ; + } + } + /// + /// Valore MAX ammesso + /// + public int maxVal + { + set + { + lblMax.Text = value.ToString(); + txtSlider.Attributes.Remove("max"); + txtSlider.Attributes.Add("max", value.ToString()); + } + get + { + int answ = 100; + int.TryParse(lblMax.Text, out answ); + return answ; + } + } + protected void Page_Load(object sender, EventArgs e) + { + } - protected void txtSlider_TextChanged(object sender, EventArgs e) - { - // segnala evento registrazione valore - txtSelVal.Text = txtSlider.Text; - raiseEvent(); - } - /// - /// valore selezionato - /// - public int selValue - { - get - { - int answ = 0; - int.TryParse(txtSlider.Text, out answ); - return answ; - } - set - { - // lo imposto sapendo che HO LIMITE... - value = value > maxVal ? maxVal : value; - value = value < minVal ? minVal : value; - txtSlider.Text = value.ToString(); - txtSelVal.Text = txtSlider.Text; - } - } + protected void txtSlider_TextChanged(object sender, EventArgs e) + { + // segnala evento registrazione valore + txtSelVal.Text = txtSlider.Text; + raiseEvent(); + } + /// + /// valore selezionato + /// + public int selValue + { + get + { + int answ = 0; + int.TryParse(txtSlider.Text, out answ); + return answ; + } + set + { + // lo imposto sapendo che HO LIMITE... + value = value > maxVal ? maxVal : value; + value = value < minVal ? minVal : value; + txtSlider.Text = value.ToString(); + txtSelVal.Text = txtSlider.Text; + } + } - protected void lbtRem_Click(object sender, EventArgs e) - { - selValue--; - raiseEvent(); - } + protected void lbtRem_Click(object sender, EventArgs e) + { + selValue--; + raiseEvent(); + } - protected void lbtAdd_Click(object sender, EventArgs e) - { - selValue++; - raiseEvent(); - } + protected void lbtAdd_Click(object sender, EventArgs e) + { + selValue++; + raiseEvent(); + } - protected void txtSelVal_TextChanged(object sender, EventArgs e) - { - // salvo valore! - int newVal = selValue; - int.TryParse(txtSelVal.Text, out newVal); - selValue = newVal; - raiseEvent(); + protected void txtSelVal_TextChanged(object sender, EventArgs e) + { + // salvo valore! + int newVal = selValue; + int.TryParse(txtSelVal.Text, out newVal); + selValue = newVal; + raiseEvent(); + } } - } } \ No newline at end of file diff --git a/NKC_WF/WebUserControls/cmp_stackList.ascx.cs b/NKC_WF/WebUserControls/cmp_stackList.ascx.cs index 1e21d0d..26125ec 100644 --- a/NKC_WF/WebUserControls/cmp_stackList.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_stackList.ascx.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; using System.Web.UI; using System.Web.UI.WebControls; diff --git a/NKC_WF/WebUserControls/cmp_stackNextloading.ascx.cs b/NKC_WF/WebUserControls/cmp_stackNextloading.ascx.cs index 0fc2712..f03b1ad 100644 --- a/NKC_WF/WebUserControls/cmp_stackNextloading.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_stackNextloading.ascx.cs @@ -1,6 +1,5 @@ using AppData; using System; -using System.Collections.Generic; namespace NKC_WF.WebUserControls { @@ -78,6 +77,6 @@ namespace NKC_WF.WebUserControls doUpdate(); } - + } } \ No newline at end of file diff --git a/NKC_WF/WebUserControls/cmp_taktList.ascx.cs b/NKC_WF/WebUserControls/cmp_taktList.ascx.cs index 426ab4f..b23e0a1 100644 --- a/NKC_WF/WebUserControls/cmp_taktList.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_taktList.ascx.cs @@ -1,8 +1,5 @@ using AppData; using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; using System.Web.UI; using System.Web.UI.WebControls; diff --git a/NKC_WF/WebUserControls/cmp_unloadSmart.ascx.cs b/NKC_WF/WebUserControls/cmp_unloadSmart.ascx.cs index 843164b..785d47c 100644 --- a/NKC_WF/WebUserControls/cmp_unloadSmart.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_unloadSmart.ascx.cs @@ -4,625 +4,625 @@ using System; namespace NKC_WF.WebUserControls { - public partial class cmp_unloadSmart : BaseUserControl - { - protected bool showBin + public partial class cmp_unloadSmart : BaseUserControl { - set - { - hfShowBin.Value = value.ToString(); - } - get - { - bool answ = false; - bool.TryParse(hfShowBin.Value, out answ); - return answ; - } - } - protected bool showCart - { - set - { - hfShowCart.Value = value.ToString(); - } - get - { - bool answ = false; - bool.TryParse(hfShowCart.Value, out answ); - return answ; - } - } - protected bool showSecOp - { - set - { - hfShowSecOp.Value = value.ToString(); - } - get - { - bool answ = false; - bool.TryParse(hfShowSecOp.Value, out answ); - return answ; - } - } - /// - /// ID univoco da IP - /// - protected string DeviceId - { - set - { - hfDeviceId.Value = value; - } - get - { - return hfDeviceId.Value; - } - } - /// - /// Postazione attuale (per ora cablata) - /// - protected string PlaceId - { - get - { - return "WRK001"; - } - } - - /// - /// Sheet selezionato... - /// - protected int SheetID - { - set - { - hfSheetID.Value = value.ToString(); - } - get - { - int answ = 0; - int.TryParse(hfSheetID.Value, out answ); - return answ; - } - } - protected string secOp - { - get - { - return hfSecOp.Value; - } - set - { - hfSecOp.Value = value; - } - } - /// - /// Aggiorna dati correnti (IP, batch, sheet...) - /// - protected void updateCurrData() - { - // FORSE 5/5?!? - var sheetList = DataLayer.man.taSHL.getByMLStatus(BatchId, 3, 5); - if (sheetList.Count > 0) - { - SheetID = sheetList[0].SheetID; - } - DeviceId = ComLib.GetIPAddress().Replace(".", "0").Replace(":", "0"); - } - /// - /// Batch corrente... - /// - public int BatchId - { - set - { - hfBatchID.Value = value.ToString(); - } - get - { - int answ = 0; - int.TryParse(hfBatchID.Value, out answ); - return answ; - } - } - protected void Page_Load(object sender, EventArgs e) - { - if (!Page.IsPostBack) - { - resetShowData(); - resetIcons(); - updateCurrData(); - } - cmp_barcode.eh_doRefresh += Cmp_barcode_eh_doRefresh; - cmp_barcode.eh_doReset += Cmp_barcode_eh_doReset; - // resetto - lblLastBCode.Text = "------"; - lblMessage.Text = "----"; - lblDestination.Text = "--"; - } - - private void resetShowData() - { - showCart = false; - showBin = false; - showSecOp = false; - } - - /// - /// Comando barcode letto - /// - protected string lastCmd - { - get - { - return hfLastBCode.Value; - } - set - { - hfLastBCode.Value = value; - lastValidCmd = value; - } - } - /// - /// ULTIMO Comando barcode VALIDO (!="") letto - /// - protected string lastValidCmd - { - get - { - return hfLastValidBCode.Value; - } - set - { - // solo se è !="" - if (value != "") + protected bool showBin { - hfLastValidBCode.Value = value; - } - } - } - private void Cmp_barcode_eh_doReset(object sender, EventArgs e) - { - resetIcons(); - } - - private void Cmp_barcode_eh_doRefresh(object sender, EventArgs e) - { - bool doRaiseEv = false; - // processo evento.. - lastCmd = cmp_barcode.inputAcquired.ToUpper(); - doRaiseEv = processLastCmd(doRaiseEv); - - // reset comando - cmp_barcode.inputAcquired = ""; - // aggiorno... - doUpdate(); - } - - private bool processLastCmd(bool doRaiseEv) - { - if (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"); - resetSelection(false); - doRaiseEv = true; - break; - case codeType.Item: - tryPickup(decoData.rawData); - cmp_barcode.showOutput("badge badge-success", $"Valid IT Code: {decoData.rawData}"); - processItemSuggestion(decoData.codeType, decoData.rawData, decoData.codeInt); - break; - case codeType.ItemGeneric: - tryPickup(decoData.rawData); - cmp_barcode.showOutput("badge badge-success", $"Valid IG Code: {decoData.rawData}"); - processItemSuggestion(decoData.codeType, decoData.rawData, decoData.codeInt); - 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: - cmp_barcode.showOutput("badge badge-warning", $"BUNK - ignored: {decoData.description}"); - doRaiseEv = true; - break; - case codeType.OtherItem: - cmp_barcode.showOutput("badge badge-warning", $"Generic PART - ignored: {decoData.description}"); - doRaiseEv = true; - break; - case codeType.Batch: - cmp_barcode.showOutput("badge badge-warning", $"Batch - ignored: {decoData.description}"); - doRaiseEv = true; - break; - case codeType.Cart: - cmp_barcode.showOutput("badge badge-success", $"Valid CR Code: {decoData.description}"); - processItemSuggestion(decoData.codeType, decoData.rawData, decoData.codeInt); - break; - case codeType.Bin: - cmp_barcode.showOutput("badge badge-success", $"Valid BN Code: {decoData.description}"); - processItemSuggestion(decoData.codeType, decoData.rawData, decoData.codeInt); - break; - default: - cmp_barcode.showOutput("text-danger", $"Unknown Data: {decoData.rawData} --> no action"); - resetSelection(false); - break; - } - - return doRaiseEv; - } - /// - /// Prova a fare pickup (SOLO SE il mio item è nel foglio corrente...) - /// - /// - protected void tryPickup(string itemDtmx) - { - // salvo in item sel... - updateCurrData(); - ComLib.saveItemPickup(SheetID, DeviceId, itemDtmx); - } - - /// - /// Processo il DataMatrix letto - /// - /// - /// - /// - private void processItemSuggestion(codeType tipoCod, string rawData, int codeInt) - { - DS_App.ItemListDataTable tabItem = null; - // processo suggerimenti x ITEM / cart / bin dato suo RawData (Dtmx) e Cod univoco (intero) - switch (tipoCod) - { - case codeType.Item: - tabItem = DataLayer.man.taIL.getBySearch(codeInt, rawData, 0, 999); - if (tabItem.Count == 1) - { - showItemDetail(true, tabItem[0], false); - } - else if (tabItem.Count == 0) - { - showItemDetail(false, null, true); - } - break; - case codeType.ItemGeneric: - // PRIMA CERCSE ne ho in stato 1..3 - tabItem = DataLayer.man.taIL.getBySearch(0, rawData, 1, 3); - if (tabItem.Count == 0) - { - // se NON ne trovo cerci FINO a stato 5... - tabItem = DataLayer.man.taIL.getBySearch(0, rawData, 1, 5); - } - if (tabItem.Count == 1) - { - showItemDetail(true, tabItem[0], false); - } - else if (tabItem.Count == 0) - { - showItemDetail(false, null, true); - } - break; - case codeType.Cart: - // verifico NON SIA richiesto PAINT - if (showBin) - { - displError("PAINT: BIN REQUESTED: please retry", true); - } - else - { - if (currCartTab.Count == 1) + set { - // controllo se sia quello corretto - if (rawData != currCartTab[0].CartDtmx) - { - displError("INCORRECT CART: please retry", true); - } - else - { - // dichiaro che è depositato - DataLayer.man.taIL.updateStatus(itemIdSelected, 3, PlaceId); - lblDestination.Text = $"Item {itemIdSelected} PUT IN CART {rawData}"; - resetSelection(false); - } + hfShowBin.Value = value.ToString(); } - } - break; - case codeType.Bin: - // verifico NON SIA richiesto PAINT - if (showCart) - { - displError("NOT PAINTED: CART REQUESTED: please retry", true); - } - else - { - if (currBinTab.Count == 1) + get { - // controllo se sia quello corretto - if (rawData != currBinTab[0].BinDtmx) - { - displError("INCORRECT BIN: please retry", true); - } - else - { - // dichiaro che è depositato - DataLayer.man.taIL.updateStatus(itemIdSelected, 4, PlaceId); - lblDestination.Text = $"Item {itemIdSelected} PUT IN BIN {rawData}"; - resetSelection(false); - } + bool answ = false; + bool.TryParse(hfShowBin.Value, out answ); + return answ; } - } - break; - default: - break; - } - - - // cerco su DB - - // certo lavorazioni accessorie - - // cerco destinazione CART/BIN - - // salvo in hiddenField - - // mostro output (compreso che mi aspetto entro 30 sec lettura cart/Bin) - - - } - /// - /// Mostra errore ed effettua reset vari... - /// - /// - /// - protected void displError(string errorMessage, bool resetStatus) - { - lblErrorMsg.Text = errorMessage; - divItemError.Visible = true; - resetSelection(resetStatus); - } - /// - /// Reset selezione item + blocchi suggerimento + sel REDIS x pagina unload - /// - /// - protected void resetSelection(bool resetStatus) - { - if (resetStatus) - { - try - { - // SE item esiste... - var tabItem = DataLayer.man.taIL.getBySearch(itemIdSelected, itemIdSelected.ToString(), 0, 999); - if (tabItem.Count == 1) - { - // riposto item a status 1... - DataLayer.man.taIL.updateStatus(itemIdSelected, 1, PlaceId); - } } - catch - { } - } - // elimino item sel... - itemIdSelected = 0; - resetShowData(); - ComLib.resetItemPickup(SheetID, DeviceId); - } - /// - /// Mostra o nasconde dettaglio su ITEM letto - /// - /// - /// - private void showItemDetail(bool showItem, DS_App.ItemListRow itemRow, bool showError) - { - resetShowData(); - divItemDet.Visible = showItem; - divItemError.Visible = showError; - if (showError) - { - displError("Item not found", true); - } - if (showItem) - { - lblItemCode.Text = itemRow.ItemExtCode; - lblItemDesc.Text = itemRow.ItemDesc; - lblItemDtmx.Text = itemRow.ItemDtmx; - itemIdSelected = itemRow.ItemID; - // CONTROLLO SIA in stato 1 --> worked, 2--> selected, 100--> parked... - switch (itemRow.StatusID) + protected bool showCart { - case 0: - displError("ERROR: Item not ready", false); - break; - case 1: - case 2: - case 100: - // salvo che è in STATO 2 (picked up) - DataLayer.man.taIL.updateStatus(itemRow.ItemID, 2, PlaceId); - // verifico cosa devo mostrare come PROX passaggio... - showCart = itemRow.ProcessesReq == ""; - showBin = (itemRow.ProcessesReq.Contains("PaintFlag")); - secOp = itemRow.PostProcList; - showSecOp = (secOp != ""); + set + { + hfShowCart.Value = value.ToString(); + } + get + { + bool answ = false; + bool.TryParse(hfShowCart.Value, out answ); + return answ; + } + } + protected bool showSecOp + { + set + { + hfShowSecOp.Value = value.ToString(); + } + get + { + bool answ = false; + bool.TryParse(hfShowSecOp.Value, out answ); + return answ; + } + } + /// + /// ID univoco da IP + /// + protected string DeviceId + { + set + { + hfDeviceId.Value = value; + } + get + { + return hfDeviceId.Value; + } + } + /// + /// Postazione attuale (per ora cablata) + /// + protected string PlaceId + { + get + { + return "WRK001"; + } + } + + /// + /// Sheet selezionato... + /// + protected int SheetID + { + set + { + hfSheetID.Value = value.ToString(); + } + get + { + int answ = 0; + int.TryParse(hfSheetID.Value, out answ); + return answ; + } + } + protected string secOp + { + get + { + return hfSecOp.Value; + } + set + { + hfSecOp.Value = value; + } + } + /// + /// Aggiorna dati correnti (IP, batch, sheet...) + /// + protected void updateCurrData() + { + // FORSE 5/5?!? + var sheetList = DataLayer.man.taSHL.getByMLStatus(BatchId, 3, 5); + if (sheetList.Count > 0) + { + SheetID = sheetList[0].SheetID; + } + DeviceId = ComLib.GetIPAddress().Replace(".", "0").Replace(":", "0"); + } + /// + /// Batch corrente... + /// + public int BatchId + { + set + { + hfBatchID.Value = value.ToString(); + } + get + { + int answ = 0; + int.TryParse(hfBatchID.Value, out answ); + return answ; + } + } + protected void Page_Load(object sender, EventArgs e) + { + if (!Page.IsPostBack) + { + resetShowData(); + resetIcons(); + updateCurrData(); + } + cmp_barcode.eh_doRefresh += Cmp_barcode_eh_doRefresh; + cmp_barcode.eh_doReset += Cmp_barcode_eh_doReset; + // resetto + lblLastBCode.Text = "------"; + lblMessage.Text = "----"; + lblDestination.Text = "--"; + } + + private void resetShowData() + { + showCart = false; + showBin = false; + showSecOp = false; + } + + /// + /// Comando barcode letto + /// + protected string lastCmd + { + get + { + return hfLastBCode.Value; + } + set + { + hfLastBCode.Value = value; + lastValidCmd = value; + } + } + /// + /// ULTIMO Comando barcode VALIDO (!="") letto + /// + protected string lastValidCmd + { + get + { + return hfLastValidBCode.Value; + } + set + { + // solo se è !="" + if (value != "") + { + hfLastValidBCode.Value = value; + } + } + } + private void Cmp_barcode_eh_doReset(object sender, EventArgs e) + { + resetIcons(); + } + + private void Cmp_barcode_eh_doRefresh(object sender, EventArgs e) + { + bool doRaiseEv = false; + // processo evento.. + lastCmd = cmp_barcode.inputAcquired.ToUpper(); + doRaiseEv = processLastCmd(doRaiseEv); + + // reset comando + cmp_barcode.inputAcquired = ""; + // aggiorno... doUpdate(); - break; - case 3: - displError("Item already on CART!", false); - break; - case 4: - // fino a concorrenza qta richiesta sposto, POI do errori - displError("ALL Item already scanned on BIN!", false); - break; - case 5: - displError("Item already at KIT STATION!", false); - break; - case 990: - displError("Item declared SCRAP!", false); - break; - case 991: - displError("Item declared SCRAP with CNC program created!", false); - break; - default: - displError("ERROR: Item status UNKNOWN!", false); - break; } - } - lbtResetSel.Visible = (itemIdSelected != 0); - } - public int itemIdSelected - { - get - { - int answ = 0; - int.TryParse(hfItemID.Value, out answ); - return answ; - } - set - { - hfItemID.Value = value.ToString(); - bool showBtn = value != 0; - // fix visibilità - lbtCancel.Visible = showBtn; - lbtScrapped.Visible = showBtn; - lbtParkArea.Visible = showBtn; - } - } - - private void resetIcons() - { - lblDestination.CssClass = "text-secondary"; - lblMessage.Text = ""; - lblDestination.Text = ""; - lblLastBCode.Text = ""; - lbtCancel.Visible = false; - lbtScrapped.Visible = false; - lbtParkArea.Visible = false; - lbtResetSel.Visible = (itemIdSelected != 0); - } - - protected DS_App.BinsDataTable currBinTab - { - get - { - return DataLayer.man.taBN.getByItemID(itemIdSelected); - } - } - protected DS_App.CartsDataTable currCartTab - { - get - { - return DataLayer.man.taCR.getByItemID(itemIdSelected); - } - } - - private void doUpdate() - { - // reset grafico - icnCart.Attributes.Remove("class"); - icnCart.Attributes.Add("class", "btn btn-sm btn-block btn-outline-secondary"); - icnBin.Attributes.Remove("class"); - icnBin.Attributes.Add("class", "btn btn-sm btn-block btn-outline-secondary"); - icnSecOp.Attributes.Remove("class"); - icnSecOp.Attributes.Add("class", "btn btn-sm btn-block btn-outline-secondary"); - - // in base al secondo mostro uno o altro... - if (showCart) - { - icnCart.Attributes.Remove("class"); - icnCart.Attributes.Add("class", "btn btn-sm btn-block btn-success"); - lblMessage.Text = "Item recognized"; - // controllo SE HO cart - if (currCartTab.Count == 1) + private bool processLastCmd(bool doRaiseEv) { - var cartRow = currCartTab[0]; - // imposto OUT - lblDestination.Text = $"SEND TO CART C{cartRow.CartIndex} ({cartRow.CartDtmx})"; - } - else - { - lblDestination.Text = $"ERROR SEARCHING CART: {currCartTab.Count} found!"; - } - lblDestination.CssClass = "text-success"; - } - else if (showBin) - { - icnBin.Attributes.Remove("class"); - icnBin.Attributes.Add("class", "btn btn-sm btn-block btn-primary"); - lblMessage.Text = "Item recognized"; - if (currBinTab.Count == 1) - { - var binRow = currBinTab[0]; - lblDestination.Text = $"SEND TO BIN B{binRow.BinIndex} ({binRow.BinDtmx})"; - } - else - { - lblDestination.Text = $"ERROR SEARCHING BIN: {currBinTab.Count} found!"; - } - lblDestination.CssClass = "text-primary"; - } - if (showSecOp) - { - icnSecOp.Attributes.Remove("class"); - icnSecOp.Attributes.Add("class", "btn btn-sm btn-block btn-info"); - lblMessage.Text = "Item recognized"; - lblLastBCode.Text = $"DO SEC OP: {secOp}"; - lblLastBCode.CssClass = "text-info"; - } - // fix btn reset! - lbtResetSel.Visible = (itemIdSelected != 0); - } + if (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"); + resetSelection(false); + doRaiseEv = true; + break; + case codeType.Item: + tryPickup(decoData.rawData); + cmp_barcode.showOutput("badge badge-success", $"Valid IT Code: {decoData.rawData}"); + processItemSuggestion(decoData.codeType, decoData.rawData, decoData.codeInt); + break; + case codeType.ItemGeneric: + tryPickup(decoData.rawData); + cmp_barcode.showOutput("badge badge-success", $"Valid IG Code: {decoData.rawData}"); + processItemSuggestion(decoData.codeType, decoData.rawData, decoData.codeInt); + 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: + cmp_barcode.showOutput("badge badge-warning", $"BUNK - ignored: {decoData.description}"); + doRaiseEv = true; + break; + case codeType.OtherItem: + cmp_barcode.showOutput("badge badge-warning", $"Generic PART - ignored: {decoData.description}"); + doRaiseEv = true; + break; + case codeType.Batch: + cmp_barcode.showOutput("badge badge-warning", $"Batch - ignored: {decoData.description}"); + doRaiseEv = true; + break; + case codeType.Cart: + cmp_barcode.showOutput("badge badge-success", $"Valid CR Code: {decoData.description}"); + processItemSuggestion(decoData.codeType, decoData.rawData, decoData.codeInt); + break; + case codeType.Bin: + cmp_barcode.showOutput("badge badge-success", $"Valid BN Code: {decoData.description}"); + processItemSuggestion(decoData.codeType, decoData.rawData, decoData.codeInt); + break; + default: + cmp_barcode.showOutput("text-danger", $"Unknown Data: {decoData.rawData} --> no action"); + resetSelection(false); + break; + } - protected void lbtCancel_Click(object sender, EventArgs e) - { - // resetto item selezionato... - DataLayer.man.taIL.updateStatus(itemIdSelected, 1, PlaceId); - resetSelection(true); - showItemDetail(false, null, false); + return doRaiseEv; + } + /// + /// Prova a fare pickup (SOLO SE il mio item è nel foglio corrente...) + /// + /// + protected void tryPickup(string itemDtmx) + { + // salvo in item sel... + updateCurrData(); + ComLib.saveItemPickup(SheetID, DeviceId, itemDtmx); + } + + /// + /// Processo il DataMatrix letto + /// + /// + /// + /// + private void processItemSuggestion(codeType tipoCod, string rawData, int codeInt) + { + DS_App.ItemListDataTable tabItem = null; + // processo suggerimenti x ITEM / cart / bin dato suo RawData (Dtmx) e Cod univoco (intero) + switch (tipoCod) + { + case codeType.Item: + tabItem = DataLayer.man.taIL.getBySearch(codeInt, rawData, 0, 999); + if (tabItem.Count == 1) + { + showItemDetail(true, tabItem[0], false); + } + else if (tabItem.Count == 0) + { + showItemDetail(false, null, true); + } + break; + case codeType.ItemGeneric: + // PRIMA CERCSE ne ho in stato 1..3 + tabItem = DataLayer.man.taIL.getBySearch(0, rawData, 1, 3); + if (tabItem.Count == 0) + { + // se NON ne trovo cerci FINO a stato 5... + tabItem = DataLayer.man.taIL.getBySearch(0, rawData, 1, 5); + } + if (tabItem.Count == 1) + { + showItemDetail(true, tabItem[0], false); + } + else if (tabItem.Count == 0) + { + showItemDetail(false, null, true); + } + break; + case codeType.Cart: + // verifico NON SIA richiesto PAINT + if (showBin) + { + displError("PAINT: BIN REQUESTED: please retry", true); + } + else + { + if (currCartTab.Count == 1) + { + // controllo se sia quello corretto + if (rawData != currCartTab[0].CartDtmx) + { + displError("INCORRECT CART: please retry", true); + } + else + { + // dichiaro che è depositato + DataLayer.man.taIL.updateStatus(itemIdSelected, 3, PlaceId); + lblDestination.Text = $"Item {itemIdSelected} PUT IN CART {rawData}"; + resetSelection(false); + } + } + } + break; + case codeType.Bin: + // verifico NON SIA richiesto PAINT + if (showCart) + { + displError("NOT PAINTED: CART REQUESTED: please retry", true); + } + else + { + if (currBinTab.Count == 1) + { + // controllo se sia quello corretto + if (rawData != currBinTab[0].BinDtmx) + { + displError("INCORRECT BIN: please retry", true); + } + else + { + // dichiaro che è depositato + DataLayer.man.taIL.updateStatus(itemIdSelected, 4, PlaceId); + lblDestination.Text = $"Item {itemIdSelected} PUT IN BIN {rawData}"; + resetSelection(false); + } + } + } + break; + default: + break; + } + + + // cerco su DB + + // certo lavorazioni accessorie + + // cerco destinazione CART/BIN + + // salvo in hiddenField + + // mostro output (compreso che mi aspetto entro 30 sec lettura cart/Bin) + + + } + /// + /// Mostra errore ed effettua reset vari... + /// + /// + /// + protected void displError(string errorMessage, bool resetStatus) + { + lblErrorMsg.Text = errorMessage; + divItemError.Visible = true; + resetSelection(resetStatus); + } + /// + /// Reset selezione item + blocchi suggerimento + sel REDIS x pagina unload + /// + /// + protected void resetSelection(bool resetStatus) + { + if (resetStatus) + { + try + { + // SE item esiste... + var tabItem = DataLayer.man.taIL.getBySearch(itemIdSelected, itemIdSelected.ToString(), 0, 999); + if (tabItem.Count == 1) + { + // riposto item a status 1... + DataLayer.man.taIL.updateStatus(itemIdSelected, 1, PlaceId); + } + } + catch + { } + } + // elimino item sel... + itemIdSelected = 0; + resetShowData(); + ComLib.resetItemPickup(SheetID, DeviceId); + } + /// + /// Mostra o nasconde dettaglio su ITEM letto + /// + /// + /// + private void showItemDetail(bool showItem, DS_App.ItemListRow itemRow, bool showError) + { + resetShowData(); + divItemDet.Visible = showItem; + divItemError.Visible = showError; + if (showError) + { + displError("Item not found", true); + } + if (showItem) + { + lblItemCode.Text = itemRow.ItemExtCode; + lblItemDesc.Text = itemRow.ItemDesc; + lblItemDtmx.Text = itemRow.ItemDtmx; + itemIdSelected = itemRow.ItemID; + // CONTROLLO SIA in stato 1 --> worked, 2--> selected, 100--> parked... + switch (itemRow.StatusID) + { + case 0: + displError("ERROR: Item not ready", false); + break; + case 1: + case 2: + case 100: + // salvo che è in STATO 2 (picked up) + DataLayer.man.taIL.updateStatus(itemRow.ItemID, 2, PlaceId); + // verifico cosa devo mostrare come PROX passaggio... + showCart = itemRow.ProcessesReq == ""; + showBin = (itemRow.ProcessesReq.Contains("PaintFlag")); + secOp = itemRow.PostProcList; + showSecOp = (secOp != ""); + doUpdate(); + break; + case 3: + displError("Item already on CART!", false); + break; + case 4: + // fino a concorrenza qta richiesta sposto, POI do errori + displError("ALL Item already scanned on BIN!", false); + break; + case 5: + displError("Item already at KIT STATION!", false); + break; + case 990: + displError("Item declared SCRAP!", false); + break; + case 991: + displError("Item declared SCRAP with CNC program created!", false); + break; + default: + displError("ERROR: Item status UNKNOWN!", false); + break; + } + } + lbtResetSel.Visible = (itemIdSelected != 0); + } + + public int itemIdSelected + { + get + { + int answ = 0; + int.TryParse(hfItemID.Value, out answ); + return answ; + } + set + { + hfItemID.Value = value.ToString(); + bool showBtn = value != 0; + // fix visibilità + lbtCancel.Visible = showBtn; + lbtScrapped.Visible = showBtn; + lbtParkArea.Visible = showBtn; + } + } + + private void resetIcons() + { + lblDestination.CssClass = "text-secondary"; + lblMessage.Text = ""; + lblDestination.Text = ""; + lblLastBCode.Text = ""; + lbtCancel.Visible = false; + lbtScrapped.Visible = false; + lbtParkArea.Visible = false; + lbtResetSel.Visible = (itemIdSelected != 0); + } + + protected DS_App.BinsDataTable currBinTab + { + get + { + return DataLayer.man.taBN.getByItemID(itemIdSelected); + } + } + protected DS_App.CartsDataTable currCartTab + { + get + { + return DataLayer.man.taCR.getByItemID(itemIdSelected); + } + } + + private void doUpdate() + { + // reset grafico + icnCart.Attributes.Remove("class"); + icnCart.Attributes.Add("class", "btn btn-sm btn-block btn-outline-secondary"); + icnBin.Attributes.Remove("class"); + icnBin.Attributes.Add("class", "btn btn-sm btn-block btn-outline-secondary"); + icnSecOp.Attributes.Remove("class"); + icnSecOp.Attributes.Add("class", "btn btn-sm btn-block btn-outline-secondary"); + + // in base al secondo mostro uno o altro... + if (showCart) + { + icnCart.Attributes.Remove("class"); + icnCart.Attributes.Add("class", "btn btn-sm btn-block btn-success"); + lblMessage.Text = "Item recognized"; + // controllo SE HO cart + if (currCartTab.Count == 1) + { + var cartRow = currCartTab[0]; + // imposto OUT + lblDestination.Text = $"SEND TO CART C{cartRow.CartIndex} ({cartRow.CartDtmx})"; + } + else + { + lblDestination.Text = $"ERROR SEARCHING CART: {currCartTab.Count} found!"; + } + lblDestination.CssClass = "text-success"; + } + else if (showBin) + { + icnBin.Attributes.Remove("class"); + icnBin.Attributes.Add("class", "btn btn-sm btn-block btn-primary"); + lblMessage.Text = "Item recognized"; + if (currBinTab.Count == 1) + { + var binRow = currBinTab[0]; + lblDestination.Text = $"SEND TO BIN B{binRow.BinIndex} ({binRow.BinDtmx})"; + } + else + { + lblDestination.Text = $"ERROR SEARCHING BIN: {currBinTab.Count} found!"; + } + lblDestination.CssClass = "text-primary"; + } + if (showSecOp) + { + icnSecOp.Attributes.Remove("class"); + icnSecOp.Attributes.Add("class", "btn btn-sm btn-block btn-info"); + lblMessage.Text = "Item recognized"; + lblLastBCode.Text = $"DO SEC OP: {secOp}"; + lblLastBCode.CssClass = "text-info"; + } + // fix btn reset! + lbtResetSel.Visible = (itemIdSelected != 0); + } + + protected void lbtCancel_Click(object sender, EventArgs e) + { + // resetto item selezionato... + DataLayer.man.taIL.updateStatus(itemIdSelected, 1, PlaceId); + resetSelection(true); + showItemDetail(false, null, false); + } + protected void lbtResetSel_Click(object sender, EventArgs e) + { + var tabSheet = DataLayer.man.taSHL.getByItemID(itemIdSelected); + if (tabSheet.Count == 1) + { + resetShowData(); + // resetto sheet selezionato... + DataLayer.man.taIL.updateSheetStatusPU(tabSheet[0].SheetID, PlaceId); + resetSelection(true); + showItemDetail(false, null, false); + } + } + /// + /// imposto a parcheggiato + /// + /// + /// + protected void lbtParkArea_Click(object sender, EventArgs e) + { + // resetto item selezionato... + DataLayer.man.taIL.updateStatus(itemIdSelected, 100, PlaceId); + resetSelection(true); + showItemDetail(false, null, false); + lblMessage.Text = "Item Parked"; + } + /// + /// Imposto come danneggiato/scrapped da rilavorare offline + /// + /// + /// + protected void lbtScrapped_Click(object sender, EventArgs e) + { + // resetto item selezionato... + DataLayer.man.taIL.updateStatus(itemIdSelected, 990, PlaceId); + lblMessage.Text = "Item Set SCRAPPED"; + // rirprocesso barcode... + lastCmd = lastValidCmd; + processLastCmd(false); + } } - protected void lbtResetSel_Click(object sender, EventArgs e) - { - var tabSheet = DataLayer.man.taSHL.getByItemID(itemIdSelected); - if (tabSheet.Count == 1) - { - resetShowData(); - // resetto sheet selezionato... - DataLayer.man.taIL.updateSheetStatusPU(tabSheet[0].SheetID, PlaceId); - resetSelection(true); - showItemDetail(false, null, false); - } - } - /// - /// imposto a parcheggiato - /// - /// - /// - protected void lbtParkArea_Click(object sender, EventArgs e) - { - // resetto item selezionato... - DataLayer.man.taIL.updateStatus(itemIdSelected, 100, PlaceId); - resetSelection(true); - showItemDetail(false, null, false); - lblMessage.Text = "Item Parked"; - } - /// - /// Imposto come danneggiato/scrapped da rilavorare offline - /// - /// - /// - protected void lbtScrapped_Click(object sender, EventArgs e) - { - // resetto item selezionato... - DataLayer.man.taIL.updateStatus(itemIdSelected, 990, PlaceId); - lblMessage.Text = "Item Set SCRAPPED"; - // rirprocesso barcode... - lastCmd = lastValidCmd; - processLastCmd(false); - } - } } \ No newline at end of file diff --git a/NKC_WF/WebUserControls/cmp_validationSummary.ascx.cs b/NKC_WF/WebUserControls/cmp_validationSummary.ascx.cs index 59f78bb..b5f14fe 100644 --- a/NKC_WF/WebUserControls/cmp_validationSummary.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_validationSummary.ascx.cs @@ -5,99 +5,99 @@ using System.Web.UI; namespace NKC_WF.WebUserControls { - public partial class cmp_validationSummary : BaseUserControl - { - protected void Page_Load(object sender, EventArgs e) + public partial class cmp_validationSummary : BaseUserControl { - if (!Page.IsPostBack) - { - fixVisibility(); - } - } - /// - /// fix visibilità buttons - /// - private void fixVisibility() - { - // controllo SE HO nuove PARTS da validare... - var tabItems2Valid = DataLayer.man.taIL.getNeedValid(); - var tabItemsUnValid = DataLayer.man.taIL.getUnValid(); - var tabItems2ReValid = DataLayer.man.taIL.getNeedRevalid(); - lbtValidateMissing.Visible = tabItems2Valid.Count > 0; - lbtRevalidate.Visible = tabItemsUnValid.Count > 0; - lbtReValidAll.Visible = tabItems2ReValid.Count > 0; - } + protected void Page_Load(object sender, EventArgs e) + { + if (!Page.IsPostBack) + { + fixVisibility(); + } + } + /// + /// fix visibilità buttons + /// + private void fixVisibility() + { + // controllo SE HO nuove PARTS da validare... + var tabItems2Valid = DataLayer.man.taIL.getNeedValid(); + var tabItemsUnValid = DataLayer.man.taIL.getUnValid(); + var tabItems2ReValid = DataLayer.man.taIL.getNeedRevalid(); + lbtValidateMissing.Visible = tabItems2Valid.Count > 0; + lbtRevalidate.Visible = tabItemsUnValid.Count > 0; + lbtReValidAll.Visible = tabItems2ReValid.Count > 0; + } - protected void lbtValidateMissing_Click(object sender, EventArgs e) - { - // chiamo stored x creazione NUOVI BATCH... - try - { - string cadBasePath = $"{memLayer.ML.CRS("nestBasePath")}{memLayer.ML.CRS("drawingFolder")}/"; - DataLayer.man.taBL.createPartValBatch(cadBasePath); - // eventualmente mando primo batch da validare... - bool newValidSent = ComLib.sendFirstValidationBatch(); - } - catch - { } - // update! - doUpdate(); - } + protected void lbtValidateMissing_Click(object sender, EventArgs e) + { + // chiamo stored x creazione NUOVI BATCH... + try + { + string cadBasePath = $"{memLayer.ML.CRS("nestBasePath")}{memLayer.ML.CRS("drawingFolder")}/"; + DataLayer.man.taBL.createPartValBatch(cadBasePath); + // eventualmente mando primo batch da validare... + bool newValidSent = ComLib.sendFirstValidationBatch(); + } + catch + { } + // update! + doUpdate(); + } - protected void lbtRevalidate_Click(object sender, EventArgs e) - { - // rimetto da validare tramite stored - try - { - DataLayer.man.taBL.resetPartUnValid(); - // eventualmente mando primo batch da validare... - bool newValidSent = ComLib.sendFirstValidationBatch(); - } - catch - { } - // update! - doUpdate(); - } - /// - /// Update forzato - /// - public void doUpdate(bool reportEvent = true) - { - fixVisibility(); - frmView.DataBind(); - if (reportEvent) - { - raiseEvent(); - } - } + protected void lbtRevalidate_Click(object sender, EventArgs e) + { + // rimetto da validare tramite stored + try + { + DataLayer.man.taBL.resetPartUnValid(); + // eventualmente mando primo batch da validare... + bool newValidSent = ComLib.sendFirstValidationBatch(); + } + catch + { } + // update! + doUpdate(); + } + /// + /// Update forzato + /// + public void doUpdate(bool reportEvent = true) + { + fixVisibility(); + frmView.DataBind(); + if (reportEvent) + { + raiseEvent(); + } + } - protected void lbtRevalAll_Click(object sender, EventArgs e) - { - // rimetto da validare tramite stored - try - { - // eventualmente mando primo batch da validare... - bool newValidSent = ComLib.sendFirstValidationBatch(); - } - catch - { } - // update! - doUpdate(); - } + protected void lbtRevalAll_Click(object sender, EventArgs e) + { + // rimetto da validare tramite stored + try + { + // eventualmente mando primo batch da validare... + bool newValidSent = ComLib.sendFirstValidationBatch(); + } + catch + { } + // update! + doUpdate(); + } - protected void lbtForceRevali_Click(object sender, EventArgs e) - { - // rimetto da validare tramite stored - try - { - DataLayer.man.taBL.redoPartValid("*"); - // eventualmente mando primo batch da validare... - bool newValidSent = ComLib.sendFirstValidationBatch(); - } - catch - { } - // update! - doUpdate(); + protected void lbtForceRevali_Click(object sender, EventArgs e) + { + // rimetto da validare tramite stored + try + { + DataLayer.man.taBL.redoPartValid("*"); + // eventualmente mando primo batch da validare... + bool newValidSent = ComLib.sendFirstValidationBatch(); + } + catch + { } + // update! + doUpdate(); + } } - } } \ No newline at end of file diff --git a/NKC_WF/WebUserControls/mod_lemmiVocab.ascx.cs b/NKC_WF/WebUserControls/mod_lemmiVocab.ascx.cs index 70b2f32..3b2f2d4 100644 --- a/NKC_WF/WebUserControls/mod_lemmiVocab.ascx.cs +++ b/NKC_WF/WebUserControls/mod_lemmiVocab.ascx.cs @@ -5,49 +5,49 @@ using System.Web.UI.WebControls; namespace NKC_WF.WebUserControls { - public partial class mod_lemmiVocab : ApplicationUserControl - { - #region protected - - protected override void aggiornaControlliDataGL() + public partial class mod_lemmiVocab : ApplicationUserControl { - base.aggiornaControlliDataGL(); - grView.PageSize = _righeDataGridAnagr; - } + #region protected - protected void grView_DataBound(object sender, EventArgs e) - { - if (grView.Rows.Count > 0) - { - LinkButton lb; - // aggiorno gli headers - foreach (TableCell cella in grView.HeaderRow.Cells) + protected override void aggiornaControlliDataGL() { - try - { - lb = (LinkButton)cella.Controls[0]; - lb.Text = traduci(lb.Text); - } - catch - { } + base.aggiornaControlliDataGL(); + grView.PageSize = _righeDataGridAnagr; } - int totRecord = grView.Rows.Count + grView.PageSize * (grView.PageCount - 1); - lblNumRec.Text = string.Format("{0} records of ~ {1}", grView.Rows.Count, totRecord); - } - else - { - lblNumRec.Text = ""; - } - } - /// - /// aggiorna i dati mostrati - /// - public void doUpdate() - { - ods.DataBind(); - grView.DataBind(); - } - #endregion - } + protected void grView_DataBound(object sender, EventArgs e) + { + if (grView.Rows.Count > 0) + { + LinkButton lb; + // aggiorno gli headers + foreach (TableCell cella in grView.HeaderRow.Cells) + { + try + { + lb = (LinkButton)cella.Controls[0]; + lb.Text = traduci(lb.Text); + } + catch + { } + } + int totRecord = grView.Rows.Count + grView.PageSize * (grView.PageCount - 1); + lblNumRec.Text = string.Format("{0} records of ~ {1}", grView.Rows.Count, totRecord); + } + else + { + lblNumRec.Text = ""; + } + } + /// + /// aggiorna i dati mostrati + /// + public void doUpdate() + { + ods.DataBind(); + grView.DataBind(); + } + + #endregion + } } \ No newline at end of file diff --git a/NKC_WF/WebUserControls/mod_ricercaGenerica.ascx.cs b/NKC_WF/WebUserControls/mod_ricercaGenerica.ascx.cs index 2eaee3b..524bf16 100644 --- a/NKC_WF/WebUserControls/mod_ricercaGenerica.ascx.cs +++ b/NKC_WF/WebUserControls/mod_ricercaGenerica.ascx.cs @@ -5,186 +5,186 @@ using System.Web.UI; namespace NKC_WF.WebUserControls { - public partial class mod_ricercaGenerica : ApplicationUserControl - { - - #region gestione eventi - - public event EventHandler eh_nuovaRicerca; - - #endregion - - #region area protected - - #region area ricerche dettaglio specifiche - - protected bool _cercaMatricole = false; - protected bool _cercaUsername = false; - //protected bool _cercaManufacturer = false; - //protected bool _cercaCategorie = false; - protected bool _cercaModelli = false; - protected bool _cercaMag = false; - - #endregion - - protected override void Page_Load(object sender, EventArgs e) + public partial class mod_ricercaGenerica : ApplicationUserControl { - base.Page_Load(sender, e); - updateText(); - } - /// - /// cambiato valore in ricerca - /// - /// - /// - protected void txtCerca_TextChanged(object sender, EventArgs e) - { - salvaCerca(); - } - /// - /// effettuato reset - /// - /// - /// - protected void lnkReset_Click(object sender, EventArgs e) - { - txtCerca.Text = ""; - salvaCerca(); - } - /// - /// pressione del button di ricerca - /// - /// - /// - protected void btnCerca_Click(object sender, EventArgs e) - { - salvaCerca(); - } - /// - /// testo ricerca trimmato da spazi - /// - protected string testoRicerca - { - get - { - return txtCerca.Text.Trim(); - } - set - { - txtCerca.Text = value; - } - } + #region gestione eventi - protected void salvaCerca() - { - if (string.IsNullOrEmpty(testoRicerca)) - { - SteamWare.memLayer.ML.emptySessionVal("valoreCercato"); - SteamWare.memLayer.ML.emptySessionVal("listaMatricoleSearch"); - } - else - { - SteamWare.memLayer.ML.setSessionVal("valoreCercato", testoRicerca); - // verifico ricerche accessorie - if (_cercaMatricole) + public event EventHandler eh_nuovaRicerca; + + #endregion + + #region area protected + + #region area ricerche dettaglio specifiche + + protected bool _cercaMatricole = false; + protected bool _cercaUsername = false; + //protected bool _cercaManufacturer = false; + //protected bool _cercaCategorie = false; + protected bool _cercaModelli = false; + protected bool _cercaMag = false; + + #endregion + + protected override void Page_Load(object sender, EventArgs e) { - salvaCercaMatricole(); + base.Page_Load(sender, e); + updateText(); } - if (_cercaUsername) + /// + /// cambiato valore in ricerca + /// + /// + /// + protected void txtCerca_TextChanged(object sender, EventArgs e) { - salvaCercaUsername(); + salvaCerca(); } - // raise dell'evento - if (eh_nuovaRicerca != null) + + /// + /// effettuato reset + /// + /// + /// + protected void lnkReset_Click(object sender, EventArgs e) { - eh_nuovaRicerca(this, new EventArgs()); + txtCerca.Text = ""; + salvaCerca(); } - } + /// + /// pressione del button di ricerca + /// + /// + /// + protected void btnCerca_Click(object sender, EventArgs e) + { + salvaCerca(); + } + /// + /// testo ricerca trimmato da spazi + /// + protected string testoRicerca + { + get + { + return txtCerca.Text.Trim(); + } + set + { + txtCerca.Text = value; + } + } + + protected void salvaCerca() + { + if (string.IsNullOrEmpty(testoRicerca)) + { + SteamWare.memLayer.ML.emptySessionVal("valoreCercato"); + SteamWare.memLayer.ML.emptySessionVal("listaMatricoleSearch"); + } + else + { + SteamWare.memLayer.ML.setSessionVal("valoreCercato", testoRicerca); + // verifico ricerche accessorie + if (_cercaMatricole) + { + salvaCercaMatricole(); + } + if (_cercaUsername) + { + salvaCercaUsername(); + } + // raise dell'evento + if (eh_nuovaRicerca != null) + { + eh_nuovaRicerca(this, new EventArgs()); + } + } + } + /// + /// ricerca utenti e salva lista matricole x SQL IN + /// + protected void salvaCercaMatricole() + { + // salvo anche l'elenco delle matricole compatibili... + DataLayer_AnagGen.UTENTEDataTable righeUtenti = DataWrap.DW.taUtente.getByRicercaNomeCognome(testoRicerca); + string listaMatricoleSearch = ""; + foreach (DataLayer_AnagGen.UTENTERow riga in righeUtenti) + { + listaMatricoleSearch += string.Format("'{0}', ", riga.MATRICOLA); + } + if (listaMatricoleSearch.Length > 0) + { + listaMatricoleSearch = listaMatricoleSearch.Remove(listaMatricoleSearch.Length - 2); + } + SteamWare.memLayer.ML.setSessionVal("listaMatricoleSearch", listaMatricoleSearch); + } + /// + /// ricerca utenti e salva lista username x SQL IN + /// + protected void salvaCercaUsername() + { + // salvo anche l'elenco delle matricole compatibili... + DataLayer_AnagGen.UTENTEDataTable righeUtenti = DataWrap.DW.taUtente.getByRicercaNomeCognome(testoRicerca); + string listaUsernameSearch = ""; + foreach (DataLayer_AnagGen.UTENTERow riga in righeUtenti) + { + listaUsernameSearch += string.Format("'{0}', ", riga.USER_NAME); + } + if (listaUsernameSearch.Length > 0) + { + listaUsernameSearch = listaUsernameSearch.Remove(listaUsernameSearch.Length - 2); + } + SteamWare.memLayer.ML.setSessionVal("listaUsernameSearch", listaUsernameSearch); + } + + #endregion + + #region area public + + /// + /// aggiorna il testo cercato + /// + public void updateText() + { + if (SteamWare.memLayer.ML.StringSessionObj("valoreCercato") != "" && !Page.IsPostBack) + { + testoRicerca = SteamWare.memLayer.ML.StringSessionObj("valoreCercato"); + } + } + + /// + /// indica se generare da stringa search un elenco delle matricole corrispondenti + /// + public bool cercaMatricole + { + get + { + return _cercaMatricole; + } + set + { + _cercaMatricole = value; + } + } + /// + /// indica se generare da stringa search un elenco di username corrispondenti + /// + public bool cercaUsername + { + get + { + return _cercaUsername; + } + set + { + _cercaUsername = value; + } + } + + + #endregion + } - /// - /// ricerca utenti e salva lista matricole x SQL IN - /// - protected void salvaCercaMatricole() - { - // salvo anche l'elenco delle matricole compatibili... - DataLayer_AnagGen.UTENTEDataTable righeUtenti = DataWrap.DW.taUtente.getByRicercaNomeCognome(testoRicerca); - string listaMatricoleSearch = ""; - foreach (DataLayer_AnagGen.UTENTERow riga in righeUtenti) - { - listaMatricoleSearch += string.Format("'{0}', ", riga.MATRICOLA); - } - if (listaMatricoleSearch.Length > 0) - { - listaMatricoleSearch = listaMatricoleSearch.Remove(listaMatricoleSearch.Length - 2); - } - SteamWare.memLayer.ML.setSessionVal("listaMatricoleSearch", listaMatricoleSearch); - } - /// - /// ricerca utenti e salva lista username x SQL IN - /// - protected void salvaCercaUsername() - { - // salvo anche l'elenco delle matricole compatibili... - DataLayer_AnagGen.UTENTEDataTable righeUtenti = DataWrap.DW.taUtente.getByRicercaNomeCognome(testoRicerca); - string listaUsernameSearch = ""; - foreach (DataLayer_AnagGen.UTENTERow riga in righeUtenti) - { - listaUsernameSearch += string.Format("'{0}', ", riga.USER_NAME); - } - if (listaUsernameSearch.Length > 0) - { - listaUsernameSearch = listaUsernameSearch.Remove(listaUsernameSearch.Length - 2); - } - SteamWare.memLayer.ML.setSessionVal("listaUsernameSearch", listaUsernameSearch); - } - - #endregion - - #region area public - - /// - /// aggiorna il testo cercato - /// - public void updateText() - { - if (SteamWare.memLayer.ML.StringSessionObj("valoreCercato") != "" && !Page.IsPostBack) - { - testoRicerca = SteamWare.memLayer.ML.StringSessionObj("valoreCercato"); - } - } - - /// - /// indica se generare da stringa search un elenco delle matricole corrispondenti - /// - public bool cercaMatricole - { - get - { - return _cercaMatricole; - } - set - { - _cercaMatricole = value; - } - } - /// - /// indica se generare da stringa search un elenco di username corrispondenti - /// - public bool cercaUsername - { - get - { - return _cercaUsername; - } - set - { - _cercaUsername = value; - } - } - - - #endregion - - } } \ No newline at end of file diff --git a/NKC_WF/WebUserControls/mod_righePag.ascx.cs b/NKC_WF/WebUserControls/mod_righePag.ascx.cs index 41a6ba0..c5ca498 100644 --- a/NKC_WF/WebUserControls/mod_righePag.ascx.cs +++ b/NKC_WF/WebUserControls/mod_righePag.ascx.cs @@ -4,107 +4,107 @@ using System.Web.UI; namespace NKC_WF.WebUserControls { - public partial class mod_righePag : System.Web.UI.UserControl - { - /// - /// indicato (nuovo) numero righe x pagina - /// - public event EventHandler eh_newNum; - /// - /// caricamento pagina - /// - /// - /// - protected void Page_Load(object sender, EventArgs e) + public partial class mod_righePag : System.Web.UI.UserControl { - if (!Page.IsPostBack) - { - numRowReq = numRowPag; - } - } - /// - /// stringa UID univoca - /// - public string uid - { - get - { - return this.UniqueID.Replace("$", "_").Replace("-", "_"); - } - } - /// - /// effettua traduzione del lemma - /// - /// - /// - public string traduci(string lemma) - { - return user_std.UtSn.Traduci(lemma); - } - /// - /// aggiorno controllo paginazione... - /// - /// - /// - protected void txtNumRighe_TextChanged(object sender, EventArgs e) - { - // salvo num righe... - numRowPag = numRowReq; - // sollevo evento nuovo valore... - if (eh_newNum != null) - { - eh_newNum(this, new EventArgs()); - } - } - /// - /// numero righe per pagina (in sessione) - /// - public int numRowPag - { - get - { - int answ = 10; - try + /// + /// indicato (nuovo) numero righe x pagina + /// + public event EventHandler eh_newNum; + /// + /// caricamento pagina + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) { - answ = memLayer.ML.IntSessionObj(uid + "_numRowPag"); + if (!Page.IsPostBack) + { + numRowReq = numRowPag; + } } - catch + /// + /// stringa UID univoca + /// + public string uid { - answ = 10; + get + { + return this.UniqueID.Replace("$", "_").Replace("-", "_"); + } } - return answ; - } - set - { - memLayer.ML.setSessionVal(uid + "_numRowPag", value); - numRowReq = value; - } - } - /// - /// numero righe gridview da mostrare legato a controllo textbox - /// - protected int numRowReq - { - get - { - int answ = numRowPag; - try + /// + /// effettua traduzione del lemma + /// + /// + /// + public string traduci(string lemma) { - answ = Convert.ToInt32(txtNumRighe.Text.Trim()); - if (answ == 0) - { - answ = numRowPag; - txtNumRighe.Text = answ.ToString(); - } + return user_std.UtSn.Traduci(lemma); + } + /// + /// aggiorno controllo paginazione... + /// + /// + /// + protected void txtNumRighe_TextChanged(object sender, EventArgs e) + { + // salvo num righe... + numRowPag = numRowReq; + // sollevo evento nuovo valore... + if (eh_newNum != null) + { + eh_newNum(this, new EventArgs()); + } + } + /// + /// numero righe per pagina (in sessione) + /// + public int numRowPag + { + get + { + int answ = 10; + try + { + answ = memLayer.ML.IntSessionObj(uid + "_numRowPag"); + } + catch + { + answ = 10; + } + return answ; + } + set + { + memLayer.ML.setSessionVal(uid + "_numRowPag", value); + numRowReq = value; + } + } + /// + /// numero righe gridview da mostrare legato a controllo textbox + /// + protected int numRowReq + { + get + { + int answ = numRowPag; + try + { + answ = Convert.ToInt32(txtNumRighe.Text.Trim()); + if (answ == 0) + { + answ = numRowPag; + txtNumRighe.Text = answ.ToString(); + } + } + catch + { } + return answ; + } + set + { + txtNumRighe.Text = value.ToString(); + } } - catch - { } - return answ; - } - set - { - txtNumRighe.Text = value.ToString(); - } } - } } \ No newline at end of file diff --git a/NKC_WF/WebUserControls/mod_vocabolario.ascx.cs b/NKC_WF/WebUserControls/mod_vocabolario.ascx.cs index 72dd2f0..1ea7c66 100644 --- a/NKC_WF/WebUserControls/mod_vocabolario.ascx.cs +++ b/NKC_WF/WebUserControls/mod_vocabolario.ascx.cs @@ -5,151 +5,151 @@ using System.Web.UI.WebControls; namespace NKC_WF.WebUserControls { - public partial class mod_vocabolario : ApplicationUserControl - { - - #region gestione eventi - - public event EventHandler eh_selezioneValore; - public event EventHandler eh_resetSelezione; - - #endregion - - #region protected - - protected override void traduciObj() + public partial class mod_vocabolario : ApplicationUserControl { - base.traduciObj(); - btnNewLemma.Text = user_std.UtSn.Traduci("btnNewLemma"); - txtNewLemma.Text = ""; - } + #region gestione eventi - /// - /// inserisco nel db il nuovo lemma... - /// - /// - /// - protected void btnNewLemma_Click(object sender, EventArgs e) - { - creaNuovoLemma(); - } - /// - /// creazione nuovo lemma - /// - private void creaNuovoLemma() - { - if (txtNewLemma.Text != "") - { - // inserisco - DataWrap.DW.creaNuovoLemmaVoc(txtNewLemma.Text.Trim()); - // metto in campo ricerca... - memLayer.ML.setSessionVal("valoreCercato", txtNewLemma.Text.Trim()); - // svuoto campo text - txtNewLemma.Text = ""; - // aggiorno il vocabolario in memoria... - DataWrap.DW.resetVocabolario(); - // riparto... - Response.Redirect(_paginaCorrente); - } - } + public event EventHandler eh_selezioneValore; + public event EventHandler eh_resetSelezione; - protected override void aggiornaControlliDataGL() - { - base.aggiornaControlliDataGL(); - ods.DataBind(); - } - /// - /// dimensione pagina grid view - /// - public int pageSize - { - get - { - return grView.PageSize; - } - set - { - grView.PageSize = value; - } - } + #endregion - protected void grView_DataBound(object sender, EventArgs e) - { - if (grView.Rows.Count > 0) - { - LinkButton lb; - // aggiorno gli headers - foreach (TableCell cella in grView.HeaderRow.Cells) + #region protected + + protected override void traduciObj() { - try - { - lb = (LinkButton)cella.Controls[0]; - lb.Text = traduci(lb.Text); - } - catch - { } + base.traduciObj(); + btnNewLemma.Text = user_std.UtSn.Traduci("btnNewLemma"); + txtNewLemma.Text = ""; } - int totRecord = grView.Rows.Count + grView.PageSize * (grView.PageCount - 1); - lblNumRec.Text = string.Format("{0} records of ~ {1}", grView.Rows.Count, totRecord); - } - else - { - lblNumRec.Text = ""; - } + + + /// + /// inserisco nel db il nuovo lemma... + /// + /// + /// + protected void btnNewLemma_Click(object sender, EventArgs e) + { + creaNuovoLemma(); + } + /// + /// creazione nuovo lemma + /// + private void creaNuovoLemma() + { + if (txtNewLemma.Text != "") + { + // inserisco + DataWrap.DW.creaNuovoLemmaVoc(txtNewLemma.Text.Trim()); + // metto in campo ricerca... + memLayer.ML.setSessionVal("valoreCercato", txtNewLemma.Text.Trim()); + // svuoto campo text + txtNewLemma.Text = ""; + // aggiorno il vocabolario in memoria... + DataWrap.DW.resetVocabolario(); + // riparto... + Response.Redirect(_paginaCorrente); + } + } + + protected override void aggiornaControlliDataGL() + { + base.aggiornaControlliDataGL(); + ods.DataBind(); + } + /// + /// dimensione pagina grid view + /// + public int pageSize + { + get + { + return grView.PageSize; + } + set + { + grView.PageSize = value; + } + } + + protected void grView_DataBound(object sender, EventArgs e) + { + if (grView.Rows.Count > 0) + { + LinkButton lb; + // aggiorno gli headers + foreach (TableCell cella in grView.HeaderRow.Cells) + { + try + { + lb = (LinkButton)cella.Controls[0]; + lb.Text = traduci(lb.Text); + } + catch + { } + } + int totRecord = grView.Rows.Count + grView.PageSize * (grView.PageCount - 1); + lblNumRec.Text = string.Format("{0} records of ~ {1}", grView.Rows.Count, totRecord); + } + else + { + lblNumRec.Text = ""; + } + } + + protected void btnReset_Click(object sender, EventArgs e) + { + resetSelezione(); + } + + protected void grView_SelectedIndexChanged(object sender, EventArgs e) + { + selezionatoValore(); + } + + private void selezionatoValore() + { + SteamWare.memLayer.ML.setSessionVal("lemma_sel", grView.SelectedDataKey.Values[1]); + if (eh_selezioneValore != null) + { + eh_selezioneValore(this, new EventArgs()); + } + } + + protected void grView_RowEditing(object sender, GridViewEditEventArgs e) + { + // seleziono la riga corrente... + grView.SelectedIndex = e.NewEditIndex; + selezionatoValore(); + } + + protected void ods_Updated(object sender, ObjectDataSourceStatusEventArgs e) + { + selezionatoValore(); + } + + #endregion + + #region area public + + /// + /// resetta la selezione dei valori in caso di modifiche su altri controlli + /// + public void resetSelezione() + { + SteamWare.memLayer.ML.emptySessionVal("lemma_sel"); + grView.SelectedIndex = -1; + grView.DataBind(); + if (eh_resetSelezione != null) + { + eh_resetSelezione(this, new EventArgs()); + } + } + + #endregion + } - - protected void btnReset_Click(object sender, EventArgs e) - { - resetSelezione(); - } - - protected void grView_SelectedIndexChanged(object sender, EventArgs e) - { - selezionatoValore(); - } - - private void selezionatoValore() - { - SteamWare.memLayer.ML.setSessionVal("lemma_sel", grView.SelectedDataKey.Values[1]); - if (eh_selezioneValore != null) - { - eh_selezioneValore(this, new EventArgs()); - } - } - - protected void grView_RowEditing(object sender, GridViewEditEventArgs e) - { - // seleziono la riga corrente... - grView.SelectedIndex = e.NewEditIndex; - selezionatoValore(); - } - - protected void ods_Updated(object sender, ObjectDataSourceStatusEventArgs e) - { - selezionatoValore(); - } - - #endregion - - #region area public - - /// - /// resetta la selezione dei valori in caso di modifiche su altri controlli - /// - public void resetSelezione() - { - SteamWare.memLayer.ML.emptySessionVal("lemma_sel"); - grView.SelectedIndex = -1; - grView.DataBind(); - if (eh_resetSelezione != null) - { - eh_resetSelezione(this, new EventArgs()); - } - } - - #endregion - - } } diff --git a/NKC_WF/WebUserControls/tpl_WIP.ascx.cs b/NKC_WF/WebUserControls/tpl_WIP.ascx.cs index 9281305..eb7424b 100644 --- a/NKC_WF/WebUserControls/tpl_WIP.ascx.cs +++ b/NKC_WF/WebUserControls/tpl_WIP.ascx.cs @@ -1,17 +1,12 @@ 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 tpl_WIP : System.Web.UI.UserControl - { - protected void Page_Load(object sender, EventArgs e) + public partial class tpl_WIP : System.Web.UI.UserControl { + protected void Page_Load(object sender, EventArgs e) + { + } } - } } \ No newline at end of file diff --git a/NKC_WF/export/BunkDetail.aspx b/NKC_WF/export/BunkDetail.aspx index 127e816..200e28a 100644 --- a/NKC_WF/export/BunkDetail.aspx +++ b/NKC_WF/export/BunkDetail.aspx @@ -1,4 +1,4 @@ -<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="BunkDetail.aspx.cs" Inherits="NKC_WF.export.BunkDetail" %> +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="BunkDetail.aspx.cs" Inherits="NKC_WF.BunkDetail" %> diff --git a/NKC_WF/export/BunkDetail.aspx.cs b/NKC_WF/export/BunkDetail.aspx.cs index 9001b36..38e30d5 100644 --- a/NKC_WF/export/BunkDetail.aspx.cs +++ b/NKC_WF/export/BunkDetail.aspx.cs @@ -3,7 +3,7 @@ using System; using System.Web; using System.Web.UI; -namespace NKC_WF.export +namespace NKC_WF { public partial class BunkDetail : System.Web.UI.Page { @@ -34,11 +34,12 @@ namespace NKC_WF.export Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.ContentType = "application/vnd.xls"; System.IO.StringWriter stringWrite = new System.IO.StringWriter(); - System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite); - grView.RenderControl(htmlWrite); - Response.Write(stringWrite.ToString()); - Response.End(); - + using (var htmlWrite = new HtmlTextWriter(stringWrite)) + { + grView.RenderControl(htmlWrite); + Response.Write(stringWrite.ToString()); + Response.End(); + } } protected void Page_Load(object sender, EventArgs e) { diff --git a/NKC_WF/export/BunkDetail.aspx.designer.cs b/NKC_WF/export/BunkDetail.aspx.designer.cs index 940455f..a04480e 100644 --- a/NKC_WF/export/BunkDetail.aspx.designer.cs +++ b/NKC_WF/export/BunkDetail.aspx.designer.cs @@ -7,7 +7,7 @@ // //------------------------------------------------------------------------------ -namespace NKC_WF.export +namespace NKC_WF { diff --git a/NKC_WF/site/About.aspx.cs b/NKC_WF/site/About.aspx.cs index 4666aad..4634c49 100644 --- a/NKC_WF/site/About.aspx.cs +++ b/NKC_WF/site/About.aspx.cs @@ -1,17 +1,13 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; using System.Web.UI; -using System.Web.UI.WebControls; namespace NKC_WF { - public partial class About : Page - { - protected void Page_Load(object sender, EventArgs e) + public partial class About : Page { + protected void Page_Load(object sender, EventArgs e) + { + } } - } } \ No newline at end of file diff --git a/NKC_WF/site/BatchPreview.aspx.cs b/NKC_WF/site/BatchPreview.aspx.cs index c527b82..3ff5158 100644 --- a/NKC_WF/site/BatchPreview.aspx.cs +++ b/NKC_WF/site/BatchPreview.aspx.cs @@ -2,278 +2,275 @@ using Newtonsoft.Json; 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.site { - public partial class BatchPreview : System.Web.UI.Page - { - /// - /// Batch corrente... - /// - public int BatchId + public partial class BatchPreview : System.Web.UI.Page { - get - { - int answ = memLayer.ML.QSI("BatchId"); - return answ; - } - } - /// - /// Indice bunk selezionato (0..n-1) - /// - protected int bunkIndex - { - get - { - return cmp_BP_bunkList.selIndex; - } - set - { - cmp_BP_bunkList.selIndex = value; - } - } - /// - /// BunkId selezionato - /// - protected int BunkId - { - get - { - return cmp_BP_bunkList.BunkIdSel; - } - } - /// - /// Indice sheet selezionato (0..n-1) - /// - protected int sheetIndex - { - get - { - return cmp_BP_sheetList.selIndex; - } - set - { - cmp_BP_sheetList.selIndex = value; - } - } - /// - /// BunkId selezionato - /// - protected int SheetId - { - get - { - return cmp_BP_sheetList.SheetIdSel; - } - } - /// - /// valore selezionato nello slider - /// - protected int valSlider - { - get - { - return cmp_slider.selValue; - } - set - { - cmp_slider.selValue = value; - } - } - /// - /// Chaive URL base x gestione sheet del batch corrente - /// - protected string tabSheetKey; - /// - /// Elenco fogli della gestione corrente - /// - protected DS_App.SheetListDataTable tabSheets - { - get - { - DS_App.SheetListDataTable answ = null; - string rawData = memLayer.ML.getRSV(tabSheetKey); - if (string.IsNullOrEmpty(rawData)) + /// + /// Batch corrente... + /// + public int BatchId { - answ = DataLayer.man.taSHL.getByBatch(BatchId); - tabSheets = answ; + get + { + int answ = memLayer.ML.QSI("BatchId"); + return answ; + } } - else + /// + /// Indice bunk selezionato (0..n-1) + /// + protected int bunkIndex { - answ = JsonConvert.DeserializeObject(rawData); + get + { + return cmp_BP_bunkList.selIndex; + } + set + { + cmp_BP_bunkList.selIndex = value; + } + } + /// + /// BunkId selezionato + /// + protected int BunkId + { + get + { + return cmp_BP_bunkList.BunkIdSel; + } + } + /// + /// Indice sheet selezionato (0..n-1) + /// + protected int sheetIndex + { + get + { + return cmp_BP_sheetList.selIndex; + } + set + { + cmp_BP_sheetList.selIndex = value; + } + } + /// + /// BunkId selezionato + /// + protected int SheetId + { + get + { + return cmp_BP_sheetList.SheetIdSel; + } + } + /// + /// valore selezionato nello slider + /// + protected int valSlider + { + get + { + return cmp_slider.selValue; + } + set + { + cmp_slider.selValue = value; + } + } + /// + /// Chaive URL base x gestione sheet del batch corrente + /// + protected string tabSheetKey; + /// + /// Elenco fogli della gestione corrente + /// + protected DS_App.SheetListDataTable tabSheets + { + get + { + DS_App.SheetListDataTable answ = null; + string rawData = memLayer.ML.getRSV(tabSheetKey); + if (string.IsNullOrEmpty(rawData)) + { + answ = DataLayer.man.taSHL.getByBatch(BatchId); + tabSheets = answ; + } + else + { + answ = JsonConvert.DeserializeObject(rawData); + } + return answ; + } + set + { + string rawData = JsonConvert.SerializeObject(value); + memLayer.ML.setRSV(tabSheetKey, rawData, 60); + } + } + /// + /// Restituisce la riga dall'indice inserito ( + /// + /// valore 1..maxSheets + /// + protected DS_App.SheetListRow rigaSel(int indice) + { + DS_App.SheetListRow answ = null; + // init var + int maxNum = tabSheets.Count; + // base 0 --> riduco di 1... + indice--; + // controllo valore sia accettabile... + indice = indice < 0 ? 0 : indice; + indice = indice >= maxNum ? maxNum - 1 : indice; + try + { + answ = tabSheets[indice]; + } + catch + { } + // restituisco! + return answ; + } + /// + /// Restituisce la PRIMA riga dal codice BUNK inserito + /// + /// valore 1..numBunk + /// + protected DS_App.SheetListRow rigaByBunk(int BunkId) + { + DS_App.SheetListRow answ = null; + try + { + answ = tabSheets.First(x => x.StackID == BunkId); + } + catch + { } + // restituisco! + return answ; + } + /// + /// Restituisce la riga dal codice Sheet inserito + /// + /// valore 1..numBunk + /// + protected DS_App.SheetListRow rigaBySheet(int SheetId) + { + DS_App.SheetListRow answ = null; + try + { + answ = tabSheets.First(x => x.StackID == SheetId); + } + catch + { } + // restituisco! + return answ; + } + /// + /// caicamento pagina + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) + { + if (!Page.IsPostBack) + { + tabSheetKey = $"{memLayer.ML.redHash($"TabSheets")}:{BatchId}"; + // imposto bunk! + cmp_BP_bunkList.BatchId = BatchId; + setupSlider(); + doUpdate(); + } + cmp_BP_bunkList.eh_doRefresh += Cmp_BP_bunkList_eh_doRefresh; + cmp_BP_sheetList.eh_doRefresh += Cmp_BP_sheetList_eh_doRefresh; + cmp_slider.eh_doRefresh += Cmp_slider_eh_doRefresh; + } + /// + /// Setup slider da num fogli + /// + private void setupSlider() + { + cmp_slider.minVal = 1; + cmp_slider.maxVal = tabSheets.Count; + cmp_slider.selValue = 1; } - return answ; - } - set - { - string rawData = JsonConvert.SerializeObject(value); - memLayer.ML.setRSV(tabSheetKey, rawData, 60); - } - } - /// - /// Restituisce la riga dall'indice inserito ( - /// - /// valore 1..maxSheets - /// - protected DS_App.SheetListRow rigaSel(int indice) - { - DS_App.SheetListRow answ = null; - // init var - int maxNum = tabSheets.Count; - // base 0 --> riduco di 1... - indice--; - // controllo valore sia accettabile... - indice = indice < 0 ? 0 : indice; - indice = indice >= maxNum ? maxNum - 1 : indice; - try - { - answ = tabSheets[indice]; - } - catch - { } - // restituisco! - return answ; - } - /// - /// Restituisce la PRIMA riga dal codice BUNK inserito - /// - /// valore 1..numBunk - /// - protected DS_App.SheetListRow rigaByBunk(int BunkId) - { - DS_App.SheetListRow answ = null; - try - { - answ = tabSheets.First(x => x.StackID == BunkId); - } - catch - { } - // restituisco! - return answ; - } - /// - /// Restituisce la riga dal codice Sheet inserito - /// - /// valore 1..numBunk - /// - protected DS_App.SheetListRow rigaBySheet(int SheetId) - { - DS_App.SheetListRow answ = null; - try - { - answ = tabSheets.First(x => x.StackID == SheetId); - } - catch - { } - // restituisco! - return answ; - } - /// - /// caicamento pagina - /// - /// - /// - protected void Page_Load(object sender, EventArgs e) - { - if (!Page.IsPostBack) - { - tabSheetKey = $"{memLayer.ML.redHash($"TabSheets")}:{BatchId}"; - // imposto bunk! - cmp_BP_bunkList.BatchId = BatchId; - setupSlider(); - doUpdate(); - } - cmp_BP_bunkList.eh_doRefresh += Cmp_BP_bunkList_eh_doRefresh; - cmp_BP_sheetList.eh_doRefresh += Cmp_BP_sheetList_eh_doRefresh; - cmp_slider.eh_doRefresh += Cmp_slider_eh_doRefresh; - } - /// - /// Setup slider da num fogli - /// - private void setupSlider() - { - cmp_slider.minVal = 1; - cmp_slider.maxVal = tabSheets.Count; - cmp_slider.selValue = 1; - } - private void doUpdate() - { - updateBySlider(); - } - private void Cmp_slider_eh_doRefresh(object sender, EventArgs e) - { - updateBySlider(); - } - /// - /// Effettua update da Slider --> valore selezionato - /// - private void updateBySlider() - { - // il valore assoluto dello slider è già corretto... cerco nella tab! - DS_App.SheetListRow currRow = rigaSel(valSlider); - if (currRow != null) - { - // recupero indice bunk e sheets e seleziono - bunkIndex = currRow.StackIndex - 1; - cmp_BP_sheetList.BunkId = cmp_BP_bunkList.BunkIdSel; - sheetIndex = currRow.SheetIndex - 1; - // update svg... - cmp_MU_svgViewer.SheetId = currRow.SheetID; - } - } + private void doUpdate() + { + updateBySlider(); + } + private void Cmp_slider_eh_doRefresh(object sender, EventArgs e) + { + updateBySlider(); + } + /// + /// Effettua update da Slider --> valore selezionato + /// + private void updateBySlider() + { + // il valore assoluto dello slider è già corretto... cerco nella tab! + DS_App.SheetListRow currRow = rigaSel(valSlider); + if (currRow != null) + { + // recupero indice bunk e sheets e seleziono + bunkIndex = currRow.StackIndex - 1; + cmp_BP_sheetList.BunkId = cmp_BP_bunkList.BunkIdSel; + sheetIndex = currRow.SheetIndex - 1; + // update svg... + cmp_MU_svgViewer.SheetId = currRow.SheetID; + } + } - private void Cmp_BP_sheetList_eh_doRefresh(object sender, EventArgs e) - { - // calcolo indice slider da chiave sheet... - int num = 1; - foreach (var item in tabSheets) - { - if (item.SheetID == cmp_BP_sheetList.SheetIdSel) + private void Cmp_BP_sheetList_eh_doRefresh(object sender, EventArgs e) { - break; + // calcolo indice slider da chiave sheet... + int num = 1; + foreach (var item in tabSheets) + { + if (item.SheetID == cmp_BP_sheetList.SheetIdSel) + { + break; + } + else + { + num++; + } + } + cmp_slider.selValue = num; + // update svg... + cmp_MU_svgViewer.SheetId = cmp_BP_sheetList.SheetIdSel; } - else - { - num++; - } - } - cmp_slider.selValue = num; - // update svg... - cmp_MU_svgViewer.SheetId = cmp_BP_sheetList.SheetIdSel; - } - private void Cmp_BP_bunkList_eh_doRefresh(object sender, EventArgs e) - { - DS_App.SheetListRow currRow = rigaByBunk(cmp_BP_bunkList.BunkIdSel); - if (currRow != null) - { - // calcolo indice slider da chiave sheet... - int num = 1; - foreach (var item in tabSheets) + private void Cmp_BP_bunkList_eh_doRefresh(object sender, EventArgs e) { - if (item.SheetID == currRow.SheetID) - { - break; - } - else - { - num++; - } + DS_App.SheetListRow currRow = rigaByBunk(cmp_BP_bunkList.BunkIdSel); + if (currRow != null) + { + // calcolo indice slider da chiave sheet... + int num = 1; + foreach (var item in tabSheets) + { + if (item.SheetID == currRow.SheetID) + { + break; + } + else + { + num++; + } + } + cmp_slider.selValue = num; + // recupero bunk e sheets e seleziono + cmp_BP_sheetList.BunkId = cmp_BP_bunkList.BunkIdSel; + sheetIndex = currRow.SheetIndex - 1; + // update svg... + cmp_MU_svgViewer.SheetId = currRow.SheetID; + } } - cmp_slider.selValue = num; - // recupero bunk e sheets e seleziono - cmp_BP_sheetList.BunkId = cmp_BP_bunkList.BunkIdSel; - sheetIndex = currRow.SheetIndex - 1; - // update svg... - cmp_MU_svgViewer.SheetId = currRow.SheetID; - } } - } } \ No newline at end of file diff --git a/NKC_WF/site/Contact.aspx.cs b/NKC_WF/site/Contact.aspx.cs index efed593..7957beb 100644 --- a/NKC_WF/site/Contact.aspx.cs +++ b/NKC_WF/site/Contact.aspx.cs @@ -1,17 +1,13 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; using System.Web.UI; -using System.Web.UI.WebControls; namespace NKC_WF { - public partial class Contact : Page - { - protected void Page_Load(object sender, EventArgs e) + public partial class Contact : Page { - ((SiteMaster)this.Master).showSearch = false; + protected void Page_Load(object sender, EventArgs e) + { + ((SiteMaster)this.Master).showSearch = false; + } } - } } \ No newline at end of file diff --git a/NKC_WF/site/DBG_QRCode_Unload.aspx.cs b/NKC_WF/site/DBG_QRCode_Unload.aspx.cs index f43c3b9..6ca375b 100644 --- a/NKC_WF/site/DBG_QRCode_Unload.aspx.cs +++ b/NKC_WF/site/DBG_QRCode_Unload.aspx.cs @@ -1,124 +1,120 @@ 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.site { - public partial class DBG_QRCode_Unload : System.Web.UI.Page - { - protected void Page_Load(object sender, EventArgs e) + public partial class DBG_QRCode_Unload : System.Web.UI.Page { - if (!Page.IsPostBack) - { - doUpdate(); - } - } - /// - /// BatchId corrente... - /// - public int BatchId - { - set - { - hfBatchID.Value = value.ToString(); - } - get - { - int answ = 0; - int.TryParse(hfBatchID.Value, out answ); - return answ; - } - }/// - /// SheetId corrente... - /// - public int SheetId - { - set - { - hfSheetID.Value = value.ToString(); - } - get - { - int answ = 0; - int.TryParse(hfSheetID.Value, out answ); - return answ; - } - } - /// - /// restituisce URL immagine QRCode - /// - /// - public string getLoginUrl() - { - string baseUrl = "https://qrcode.steamware.net/HOME/QR_site/JSON?val="; - string payload = "{'baseUrl':'{0}','parameters':['" + memLayer.ML.CRS("BaseUrl") + "']}"; - string answ = $"{baseUrl}{payload}"; - return answ; - } - protected int qrSize - { - get - { - int answ = 32; - int.TryParse(ddlQrSize.SelectedValue, out answ); - return answ; - } - } - /// - /// Aggiorna componente principale e child components - /// - private void doUpdate() - { - imgQrLogin.ImageUrl = getLoginUrl(); - updateSize(); - setCurrData(); - // aggiorno child - cmp_MU_bins.ShowQr = true; - cmp_MU_bins.BatchId = BatchId; - cmp_MU_carts.ShowQr = true; - cmp_MU_carts.BatchId = BatchId; - cmp_MU_Items.ShowQr = true; - cmp_MU_Items.SheetID = SheetId; - } - /// - /// Imposta dati correnti (Bunk / Sheet) - /// - private void setCurrData() - { - // recupero bunk corrente... - DS_App.StackListRow currBunk = ComLib.getCurrBunk(); - if (currBunk != null) - { - BatchId = currBunk.BatchID; - DS_App.SheetListRow currSheet = ComLib.getCurrSheet(BatchId); - if (currSheet != null) + protected void Page_Load(object sender, EventArgs e) { - SheetId = currSheet.SheetID; + if (!Page.IsPostBack) + { + doUpdate(); + } + } + /// + /// BatchId corrente... + /// + public int BatchId + { + set + { + hfBatchID.Value = value.ToString(); + } + get + { + int answ = 0; + int.TryParse(hfBatchID.Value, out answ); + return answ; + } + }/// + /// SheetId corrente... + /// + public int SheetId + { + set + { + hfSheetID.Value = value.ToString(); + } + get + { + int answ = 0; + int.TryParse(hfSheetID.Value, out answ); + return answ; + } + } + /// + /// restituisce URL immagine QRCode + /// + /// + public string getLoginUrl() + { + string baseUrl = "https://qrcode.steamware.net/HOME/QR_site/JSON?val="; + string payload = "{'baseUrl':'{0}','parameters':['" + memLayer.ML.CRS("BaseUrl") + "']}"; + string answ = $"{baseUrl}{payload}"; + return answ; + } + protected int qrSize + { + get + { + int answ = 32; + int.TryParse(ddlQrSize.SelectedValue, out answ); + return answ; + } + } + /// + /// Aggiorna componente principale e child components + /// + private void doUpdate() + { + imgQrLogin.ImageUrl = getLoginUrl(); + updateSize(); + setCurrData(); + // aggiorno child + cmp_MU_bins.ShowQr = true; + cmp_MU_bins.BatchId = BatchId; + cmp_MU_carts.ShowQr = true; + cmp_MU_carts.BatchId = BatchId; + cmp_MU_Items.ShowQr = true; + cmp_MU_Items.SheetID = SheetId; + } + /// + /// Imposta dati correnti (Bunk / Sheet) + /// + private void setCurrData() + { + // recupero bunk corrente... + DS_App.StackListRow currBunk = ComLib.getCurrBunk(); + if (currBunk != null) + { + BatchId = currBunk.BatchID; + DS_App.SheetListRow currSheet = ComLib.getCurrSheet(BatchId); + if (currSheet != null) + { + SheetId = currSheet.SheetID; + } + } } - } - } - protected void ddlQrSize_SelectedIndexChanged(object sender, EventArgs e) - { - updateSize(); - } + protected void ddlQrSize_SelectedIndexChanged(object sender, EventArgs e) + { + updateSize(); + } - private void updateSize() - { - imgQrLogin.Height = qrSize * 2; - cmp_MU_bins.qrSize = qrSize; - cmp_MU_carts.qrSize = qrSize; - cmp_MU_Items.qrSize = qrSize; - } + private void updateSize() + { + imgQrLogin.Height = qrSize * 2; + cmp_MU_bins.qrSize = qrSize; + cmp_MU_carts.qrSize = qrSize; + cmp_MU_Items.qrSize = qrSize; + } - protected void timerRefresh_Tick(object sender, EventArgs e) - { - doUpdate(); + protected void timerRefresh_Tick(object sender, EventArgs e) + { + doUpdate(); + } } - } } \ No newline at end of file diff --git a/NKC_WF/site/Default.aspx.cs b/NKC_WF/site/Default.aspx.cs index 0ac6841..8edae34 100644 --- a/NKC_WF/site/Default.aspx.cs +++ b/NKC_WF/site/Default.aspx.cs @@ -1,26 +1,22 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; using System.Web.UI; -using System.Web.UI.WebControls; namespace NKC_WF { - public partial class _Default : Page - { - protected void Page_Load(object sender, EventArgs e) + public partial class _Default : Page { - Response.Redirect("Login"); + protected void Page_Load(object sender, EventArgs e) + { + Response.Redirect("Login"); + } + /// + /// Wrapper traduzione termini + /// + /// + /// + public string traduci(string lemma) + { + return SteamWare.user_std.UtSn.Traduci(lemma); + } } - /// - /// Wrapper traduzione termini - /// - /// - /// - public string traduci(string lemma) - { - return SteamWare.user_std.UtSn.Traduci(lemma); - } - } } \ No newline at end of file diff --git a/NKC_WF/site/DevUtils.aspx b/NKC_WF/site/DevUtils.aspx index 6807d76..1689d9f 100644 --- a/NKC_WF/site/DevUtils.aspx +++ b/NKC_WF/site/DevUtils.aspx @@ -1,4 +1,4 @@ -<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="DevUtils.aspx.cs" Inherits="NKC_WF.DevUtils" %> +<%@ Page Title="" Language="C#" MasterPageFile="~/SiteContent.Master" AutoEventWireup="true" CodeBehind="DevUtils.aspx.cs" Inherits="NKC_WF.DevUtils" %> <%@ Register Src="~/WebUserControls/cmp_devUtils.ascx" TagPrefix="uc1" TagName="cmp_devUtils" %> diff --git a/NKC_WF/site/DevUtils.aspx.cs b/NKC_WF/site/DevUtils.aspx.cs index 454aa9a..3cb1da2 100644 --- a/NKC_WF/site/DevUtils.aspx.cs +++ b/NKC_WF/site/DevUtils.aspx.cs @@ -1,20 +1,16 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; using System.Web.UI; -using System.Web.UI.WebControls; namespace NKC_WF { - public partial class DevUtils : System.Web.UI.Page - { - protected void Page_Load(object sender, EventArgs e) + public partial class DevUtils : System.Web.UI.Page { - if (!Page.IsPostBack) - { - ((SiteMaster)this.Master).showSearch = false; - } + protected void Page_Load(object sender, EventArgs e) + { + if (!Page.IsPostBack) + { + ((SiteContent)this.Master).showSearch = false; + } + } } - } } \ No newline at end of file diff --git a/NKC_WF/site/ErrorsLog.aspx.cs b/NKC_WF/site/ErrorsLog.aspx.cs index 973883f..f6dc24b 100644 --- a/NKC_WF/site/ErrorsLog.aspx.cs +++ b/NKC_WF/site/ErrorsLog.aspx.cs @@ -4,18 +4,18 @@ using System.Web.UI; namespace NKC_WF { - public partial class ErrorsLog : System.Web.UI.Page - { - protected void Page_Load(object sender, EventArgs e) + public partial class ErrorsLog : System.Web.UI.Page { - if (!Page.IsPostBack) - { - string PUID = memLayer.ML.QSS("PUID"); - if (PUID != "") + protected void Page_Load(object sender, EventArgs e) { - cmp_ErrorsLog.Puid = PUID; + if (!Page.IsPostBack) + { + string PUID = memLayer.ML.QSS("PUID"); + if (!string.IsNullOrEmpty(PUID)) + { + cmp_ErrorsLog.Puid = PUID; + } + } } - } } - } } \ No newline at end of file diff --git a/NKC_WF/site/GlobalSearch.aspx b/NKC_WF/site/GlobalSearch.aspx index 0e707ad..e528e0b 100644 --- a/NKC_WF/site/GlobalSearch.aspx +++ b/NKC_WF/site/GlobalSearch.aspx @@ -6,9 +6,14 @@ -
Advanced SEARCH
- - - - +
+

<%: traduci("Advanced") %> <%: traduci("Search") %>

+
+
+ + + + +
+
diff --git a/NKC_WF/site/GlobalSearch.aspx.cs b/NKC_WF/site/GlobalSearch.aspx.cs index 9a13be7..4be9e43 100644 --- a/NKC_WF/site/GlobalSearch.aspx.cs +++ b/NKC_WF/site/GlobalSearch.aspx.cs @@ -1,15 +1,11 @@ using AppData; using NKC_SDK; using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; using System.Web.UI; -using System.Web.UI.WebControls; namespace NKC_WF.site { - public partial class GlobalSearch : System.Web.UI.Page + public partial class GlobalSearch : BasePage { /// /// Comando barcode letto @@ -38,7 +34,7 @@ namespace NKC_WF.site set { // solo se è !="" - if (value != "") + if (!string.IsNullOrEmpty(value)) { hfLastValidBCode.Value = value; } @@ -125,7 +121,7 @@ namespace NKC_WF.site cmp_barcode.showOutput("text-danger", $"Unknown Data: {decoData.rawData} --> no action"); doShowResults = false; break; - } + } return doShowResults; } diff --git a/NKC_WF/site/Home.aspx.cs b/NKC_WF/site/Home.aspx.cs index 7779564..4e5995a 100644 --- a/NKC_WF/site/Home.aspx.cs +++ b/NKC_WF/site/Home.aspx.cs @@ -1,20 +1,16 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; using System.Web.UI; -using System.Web.UI.WebControls; namespace NKC_WF { - public partial class Home : BasePage - { - protected void Page_Load(object sender, EventArgs e) + public partial class Home : BasePage { - if (!Page.IsPostBack) - { - ((SiteContent)this.Master).showSearch = false; - } + protected void Page_Load(object sender, EventArgs e) + { + if (!Page.IsPostBack) + { + ((SiteContent)this.Master).showSearch = false; + } + } } - } } \ No newline at end of file diff --git a/NKC_WF/site/KitRequestImporter.aspx.cs b/NKC_WF/site/KitRequestImporter.aspx.cs index 493dfda..6007e13 100644 --- a/NKC_WF/site/KitRequestImporter.aspx.cs +++ b/NKC_WF/site/KitRequestImporter.aspx.cs @@ -5,74 +5,74 @@ using System.Web.UI; namespace NKC_WF { - public partial class KitRequestImporter : BasePage - { - /// - /// Folder REMOTA x copia verso SQL - /// - protected string _SqlCopyDir = memLayer.ML.CRS("_SqlCopyDir"); - /// - /// Folder x SQL import - /// - protected string _SqlImportDir = memLayer.ML.CRS("_SqlImportDir"); - - protected void Page_Load(object sender, EventArgs e) + public partial class KitRequestImporter : BasePage { - if (!Page.IsPostBack) - { - ((SiteContent)this.Master).showSearch = false; - doUpdate(); - cmp_kitImpCheck.Visible = false; - } - cmp_kitImpCheck.eh_doRefresh += Cmp_kitImpCheck_eh_doRefresh; - cmp_fileUpload.eh_doRefresh += Cmp_fileUpload_eh_doRefresh; - cmp_fileUpload.eh_FileUploaded += Cmp_fileUpload_eh_FileUploaded; + /// + /// Folder REMOTA x copia verso SQL + /// + protected string _SqlCopyDir = memLayer.ML.CRS("_SqlCopyDir"); + /// + /// Folder x SQL import + /// + protected string _SqlImportDir = memLayer.ML.CRS("_SqlImportDir"); + + protected void Page_Load(object sender, EventArgs e) + { + if (!Page.IsPostBack) + { + ((SiteContent)this.Master).showSearch = false; + doUpdate(); + cmp_kitImpCheck.Visible = false; + } + cmp_kitImpCheck.eh_doRefresh += Cmp_kitImpCheck_eh_doRefresh; + cmp_fileUpload.eh_doRefresh += Cmp_fileUpload_eh_doRefresh; + cmp_fileUpload.eh_FileUploaded += Cmp_fileUpload_eh_FileUploaded; + } + + private void Cmp_kitImpCheck_eh_doRefresh(object sender, EventArgs e) + { + doUpdate(); + } + + /// + /// Ora continuo processing + /// + /// + /// + private void Cmp_fileUpload_eh_FileUploaded(object sender, WebUserContols.FileUploadEventArgs e) + { + cmp_kitImpCheck.Visible = true; + DateTime adesso = DateTime.Now; + string dirFrom = e.LocalPath; + string dirTo = $"{_SqlCopyDir}{adesso.ToString("yyyy-MM")}\\"; + string dirImport = $"{_SqlImportDir}{adesso.ToString("yyyy-MM")}\\"; + // copio su server SQL + try + { + // copio su SQL... + fileMover.obj.copiaFile(dirFrom, dirTo, e.FileName); + } + catch (Exception exc) + { + logger.lg.scriviLog($"KitCsvMan: Eccezione in Copia SQL file:{Environment.NewLine}{exc}"); + } + // salvo dati + cmp_kitImpCheck.fileName = e.FileName; + cmp_kitImpCheck.batchName = e.BatchName; + // chiamo procedure check... + cmp_kitImpCheck.tryImport(true); + doUpdate(); + } + + private void Cmp_fileUpload_eh_doRefresh(object sender, EventArgs e) + { + doUpdate(); + } + + + public void doUpdate() + { + + } } - - private void Cmp_kitImpCheck_eh_doRefresh(object sender, EventArgs e) - { - doUpdate(); - } - - /// - /// Ora continuo processing - /// - /// - /// - private void Cmp_fileUpload_eh_FileUploaded(object sender, WebUserContols.FileUploadEventArgs e) - { - cmp_kitImpCheck.Visible = true; - DateTime adesso = DateTime.Now; - string dirFrom = e.LocalPath; - string dirTo = $"{_SqlCopyDir}{adesso.ToString("yyyy-MM")}\\"; - string dirImport = $"{_SqlImportDir}{adesso.ToString("yyyy-MM")}\\"; - // copio su server SQL - try - { - // copio su SQL... - fileMover.obj.copiaFile(dirFrom, dirTo, e.FileName); - } - catch (Exception exc) - { - logger.lg.scriviLog($"KitCsvMan: Eccezione in Copia SQL file:{Environment.NewLine}{exc}"); - } - // salvo dati - cmp_kitImpCheck.fileName = e.FileName; - cmp_kitImpCheck.batchName = e.BatchName; - // chiamo procedure check... - cmp_kitImpCheck.tryImport(true); - doUpdate(); - } - - private void Cmp_fileUpload_eh_doRefresh(object sender, EventArgs e) - { - doUpdate(); - } - - - public void doUpdate() - { - - } - } } \ No newline at end of file diff --git a/NKC_WF/site/KitRequestSched.aspx.cs b/NKC_WF/site/KitRequestSched.aspx.cs index 02cceb7..63d9858 100644 --- a/NKC_WF/site/KitRequestSched.aspx.cs +++ b/NKC_WF/site/KitRequestSched.aspx.cs @@ -1,9 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using System.Web.UI; -using System.Web.UI.WebControls; namespace NKC_WF.site { diff --git a/NKC_WF/site/Kitting.aspx.cs b/NKC_WF/site/Kitting.aspx.cs index 4d9f1e7..025a43b 100644 --- a/NKC_WF/site/Kitting.aspx.cs +++ b/NKC_WF/site/Kitting.aspx.cs @@ -1,20 +1,16 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; using System.Web.UI; -using System.Web.UI.WebControls; namespace NKC_WF { - public partial class Kitting : System.Web.UI.Page - { - protected void Page_Load(object sender, EventArgs e) + public partial class Kitting : System.Web.UI.Page { - if (!Page.IsPostBack) - { - ((SiteMaster)this.Master).showSearch = false; - } + protected void Page_Load(object sender, EventArgs e) + { + if (!Page.IsPostBack) + { + ((SiteMaster)this.Master).showSearch = false; + } + } } - } } \ No newline at end of file diff --git a/NKC_WF/site/KittingSmart.aspx.cs b/NKC_WF/site/KittingSmart.aspx.cs index 14b5c2e..38814f8 100644 --- a/NKC_WF/site/KittingSmart.aspx.cs +++ b/NKC_WF/site/KittingSmart.aspx.cs @@ -1,59 +1,55 @@ using AppData; using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; using System.Web.UI; -using System.Web.UI.WebControls; namespace NKC_WF.site { - public partial class KittingSmart : BasePage - { - protected void Page_Load(object sender, EventArgs e) + public partial class KittingSmart : BasePage { - if (!Page.IsPostBack) - { - ((SiteMaster)this.Master).showSearch = false; - doUpdate(); - } + protected void Page_Load(object sender, EventArgs e) + { + if (!Page.IsPostBack) + { + ((SiteMaster)this.Master).showSearch = false; + doUpdate(); + } + } + /// + /// Batch corrente... + /// + public int BatchId + { + set + { + hfBatchID.Value = value.ToString(); + } + get + { + int answ = 0; + int.TryParse(hfBatchID.Value, out answ); + return answ; + } + } + /// + /// Aggiorna componente principale e child components + /// + private void doUpdate() + { + setCurrData(); + // aggiorno child + cmp_kittingSmart.BatchId = BatchId; + } + /// + /// Imposta dati correnti (Bunk / Sheet) + /// + private void setCurrData() + { + // recupero bunk corrente... + DS_App.StackListRow currBunk = ComLib.getCurrBunk(); + if (currBunk != null) + { + BatchId = currBunk.BatchID; + } + } } - /// - /// Batch corrente... - /// - public int BatchId - { - set - { - hfBatchID.Value = value.ToString(); - } - get - { - int answ = 0; - int.TryParse(hfBatchID.Value, out answ); - return answ; - } - } - /// - /// Aggiorna componente principale e child components - /// - private void doUpdate() - { - setCurrData(); - // aggiorno child - cmp_kittingSmart.BatchId = BatchId; - } - /// - /// Imposta dati correnti (Bunk / Sheet) - /// - private void setCurrData() - { - // recupero bunk corrente... - DS_App.StackListRow currBunk = ComLib.getCurrBunk(); - if (currBunk != null) - { - BatchId = currBunk.BatchID; - } - } - } } \ No newline at end of file diff --git a/NKC_WF/site/LabelsPrint.aspx.cs b/NKC_WF/site/LabelsPrint.aspx.cs index 3bc6e4b..59d680f 100644 --- a/NKC_WF/site/LabelsPrint.aspx.cs +++ b/NKC_WF/site/LabelsPrint.aspx.cs @@ -1,20 +1,16 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; using System.Web.UI; -using System.Web.UI.WebControls; namespace NKC_WF.site { - public partial class LabelsPrint : System.Web.UI.Page - { - protected void Page_Load(object sender, EventArgs e) + public partial class LabelsPrint : System.Web.UI.Page { - if (!Page.IsPostBack) - { - ((SiteContent)this.Master).showSearch = false; - } + protected void Page_Load(object sender, EventArgs e) + { + if (!Page.IsPostBack) + { + ((SiteContent)this.Master).showSearch = false; + } + } } - } } \ No newline at end of file diff --git a/NKC_WF/site/Login.aspx.cs b/NKC_WF/site/Login.aspx.cs index 15a60f0..d3032ff 100644 --- a/NKC_WF/site/Login.aspx.cs +++ b/NKC_WF/site/Login.aspx.cs @@ -1,41 +1,36 @@ 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 { - public partial class Login : System.Web.UI.Page - { - protected string _nextPage + public partial class Login : System.Web.UI.Page { - get - { - string pagina = memLayer.ML.StringSessionObj("nextPage"); - if (pagina == "") + protected string _nextPage { - pagina = "Home"; + get + { + string pagina = memLayer.ML.StringSessionObj("nextPage"); + if (string.IsNullOrEmpty(pagina)) + { + pagina = "Home"; + } + return pagina; + } } - return pagina; - } - } - protected void Page_Load(object sender, EventArgs e) - { - cmp_login.Login_ok += Cmp_login_Login_ok; - cmp_login.Login_Error += Cmp_login_Login_Error; + protected void Page_Load(object sender, EventArgs e) + { + cmp_login.Login_ok += Cmp_login_Login_ok; + cmp_login.Login_Error += Cmp_login_Login_Error; } - private void Cmp_login_Login_Error(object sender, EventArgs e) - { - Response.Redirect("./Unauth"); - } + private void Cmp_login_Login_Error(object sender, EventArgs e) + { + Response.Redirect("./Unauth"); + } - private void Cmp_login_Login_ok(object sender, EventArgs e) - { - Response.Redirect(_nextPage); + private void Cmp_login_Login_ok(object sender, EventArgs e) + { + Response.Redirect(_nextPage); + } } - } } \ No newline at end of file diff --git a/NKC_WF/site/MachineOffline.aspx.cs b/NKC_WF/site/MachineOffline.aspx.cs index 39b7faf..0955e6c 100644 --- a/NKC_WF/site/MachineOffline.aspx.cs +++ b/NKC_WF/site/MachineOffline.aspx.cs @@ -1,22 +1,17 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using System.Web.UI; -using System.Web.UI.WebControls; namespace NKC_WF { - public partial class MachineOffline : System.Web.UI.Page - { - protected void Page_Load(object sender, EventArgs e) + public partial class MachineOffline : System.Web.UI.Page { - cmp_scrapList.eh_doRefresh += Cmp_scrapList_eh_doRefresh; - } + protected void Page_Load(object sender, EventArgs e) + { + cmp_scrapList.eh_doRefresh += Cmp_scrapList_eh_doRefresh; + } - private void Cmp_scrapList_eh_doRefresh(object sender, EventArgs e) - { - cmp_offlineOrders.doUpdate(); + private void Cmp_scrapList_eh_doRefresh(object sender, EventArgs e) + { + cmp_offlineOrders.doUpdate(); + } } - } } \ No newline at end of file diff --git a/NKC_WF/site/MachineUnload.aspx.cs b/NKC_WF/site/MachineUnload.aspx.cs index 8ee3978..1882ceb 100644 --- a/NKC_WF/site/MachineUnload.aspx.cs +++ b/NKC_WF/site/MachineUnload.aspx.cs @@ -1,85 +1,84 @@ using AppData; using System; -using System.IO; namespace NKC_WF { - public partial class MachineUnload : BasePage - { - protected void Page_Load(object sender, EventArgs e) + public partial class MachineUnload : BasePage { - if (!Page.IsPostBack) - { - ((SiteMaster)this.Master).showSearch = false; - doUpdate(); - } - } - /// - /// BatchId corrente... - /// - public int BatchId - { - set - { - hfBatchID.Value = value.ToString(); - } - get - { - int answ = 0; - int.TryParse(hfBatchID.Value, out answ); - return answ; - } - } - /// - /// SheetId corrente... - /// - public int SheetId - { - set - { - hfSheetID.Value = value.ToString(); - } - get - { - int answ = 0; - int.TryParse(hfSheetID.Value, out answ); - return answ; - } - } - /// - /// Aggiorna componente principale e child components - /// - private void doUpdate() - { - // imposto dati correnti - setCurrData(); - // aggiorno child - cmp_MU_stats.BatchId = BatchId; - cmp_MU_bins.BatchId = BatchId; - cmp_MU_carts.BatchId = BatchId; - cmp_MU_svgViewer.BatchId = BatchId; - cmp_MU_svgViewer.SheetId = SheetId; - } - /// - /// Imposta dati correnti (Bunk / Sheet) - /// - private void setCurrData() - { - // recupero bunk corrente... - DS_App.StackListRow currBunk = ComLib.getCurrBunk(); - if (currBunk != null) - { - BatchId = currBunk.BatchID; - DS_App.SheetListRow currSheet = ComLib.getCurrSheet(BatchId); - if (currSheet != null) + protected void Page_Load(object sender, EventArgs e) { - SheetId = currSheet.SheetID; + if (!Page.IsPostBack) + { + ((SiteMaster)this.Master).showSearch = false; + doUpdate(); + } + } + /// + /// BatchId corrente... + /// + public int BatchId + { + set + { + hfBatchID.Value = value.ToString(); + } + get + { + int answ = 0; + int.TryParse(hfBatchID.Value, out answ); + return answ; + } + } + /// + /// SheetId corrente... + /// + public int SheetId + { + set + { + hfSheetID.Value = value.ToString(); + } + get + { + int answ = 0; + int.TryParse(hfSheetID.Value, out answ); + return answ; + } + } + /// + /// Aggiorna componente principale e child components + /// + private void doUpdate() + { + // imposto dati correnti + setCurrData(); + // aggiorno child + cmp_MU_stats.BatchId = BatchId; + cmp_MU_bins.BatchId = BatchId; + cmp_MU_carts.BatchId = BatchId; + cmp_MU_svgViewer.BatchId = BatchId; + cmp_MU_svgViewer.SheetId = SheetId; + } + /// + /// Imposta dati correnti (Bunk / Sheet) + /// + private void setCurrData() + { + // recupero bunk corrente... + DS_App.StackListRow currBunk = ComLib.getCurrBunk(); + if (currBunk != null) + { + BatchId = currBunk.BatchID; + DS_App.SheetListRow currSheet = ComLib.getCurrSheet(BatchId); + if (currSheet != null) + { + SheetId = currSheet.SheetID; + } + } + else + { + BatchId = 0; + } } - } - else - { - BatchId = 0; - } } - } } \ No newline at end of file diff --git a/NKC_WF/site/MachineUnloadSmart.aspx.cs b/NKC_WF/site/MachineUnloadSmart.aspx.cs index f83e5ab..8774222 100644 --- a/NKC_WF/site/MachineUnloadSmart.aspx.cs +++ b/NKC_WF/site/MachineUnloadSmart.aspx.cs @@ -3,52 +3,52 @@ using System; namespace NKC_WF { - public partial class MachineUnloadSmart : BasePage - { - protected void Page_Load(object sender, EventArgs e) + public partial class MachineUnloadSmart : BasePage { - if (!Page.IsPostBack) - { - ((SiteMaster)this.Master).showSearch = false; - doUpdate(); - } + protected void Page_Load(object sender, EventArgs e) + { + if (!Page.IsPostBack) + { + ((SiteMaster)this.Master).showSearch = false; + doUpdate(); + } + } + /// + /// Batch corrente... + /// + public int BatchId + { + set + { + hfBatchID.Value = value.ToString(); + } + get + { + int answ = 0; + int.TryParse(hfBatchID.Value, out answ); + return answ; + } + } + /// + /// Aggiorna componente principale e child components + /// + private void doUpdate() + { + setCurrData(); + // aggiorno child + cmp_unloadSmart.BatchId = BatchId; + } + /// + /// Imposta dati correnti (Bunk / Sheet) + /// + private void setCurrData() + { + // recupero bunk corrente... + DS_App.StackListRow currBunk = ComLib.getCurrBunk(); + if (currBunk != null) + { + BatchId = currBunk.BatchID; + } + } } - /// - /// Batch corrente... - /// - public int BatchId - { - set - { - hfBatchID.Value = value.ToString(); - } - get - { - int answ = 0; - int.TryParse(hfBatchID.Value, out answ); - return answ; - } - } - /// - /// Aggiorna componente principale e child components - /// - private void doUpdate() - { - setCurrData(); - // aggiorno child - cmp_unloadSmart.BatchId = BatchId; - } - /// - /// Imposta dati correnti (Bunk / Sheet) - /// - private void setCurrData() - { - // recupero bunk corrente... - DS_App.StackListRow currBunk = ComLib.getCurrBunk(); - if (currBunk != null) - { - BatchId = currBunk.BatchID; - } - } - } } \ No newline at end of file diff --git a/NKC_WF/site/OrderManager.aspx.cs b/NKC_WF/site/OrderManager.aspx.cs index 3a3a8af..87c3133 100644 --- a/NKC_WF/site/OrderManager.aspx.cs +++ b/NKC_WF/site/OrderManager.aspx.cs @@ -6,228 +6,228 @@ using System.Web.UI; namespace NKC_WF { - public partial class OrderManager : BasePage - { - /// - /// Folder REMOTA x copia verso SQL - /// - protected string _SqlCopyDir = memLayer.ML.CRS("_SqlCopyDir"); - /// - /// Folder x SQL import - /// - protected string _SqlImportDir = memLayer.ML.CRS("_SqlImportDir"); - /// - /// Path base x nesting - /// - protected string cadBasePath = $"{memLayer.ML.CRS("nestBasePath")}{memLayer.ML.CRS("drawingFolder")}/"; - /// - /// Path base x server - /// - protected string srvCadBasePath = $"{memLayer.ML.CRS("servBasePath")}{memLayer.ML.CRS("drawingFolder")}/"; - - protected void Page_Load(object sender, EventArgs e) - { - if (!Page.IsPostBack) - { - doUpdate(); - } - cmp_batchList.eh_doRefresh += Cmp_batchList_eh_doRefresh; - cmp_fileUpload.eh_doRefresh += Cmp_fileUpload_eh_doRefresh; - cmp_fileUpload.eh_FileUploaded += Cmp_fileUpload_eh_FileUploaded; - } - /// - /// Ora continuo processing - /// - /// - /// - private void Cmp_fileUpload_eh_FileUploaded(object sender, WebUserContols.FileUploadEventArgs e) + public partial class OrderManager : BasePage { + /// + /// Folder REMOTA x copia verso SQL + /// + protected string _SqlCopyDir = memLayer.ML.CRS("_SqlCopyDir"); + /// + /// Folder x SQL import + /// + protected string _SqlImportDir = memLayer.ML.CRS("_SqlImportDir"); + /// + /// Path base x nesting + /// + protected string cadBasePath = $"{memLayer.ML.CRS("nestBasePath")}{memLayer.ML.CRS("drawingFolder")}/"; + /// + /// Path base x server + /// + protected string srvCadBasePath = $"{memLayer.ML.CRS("servBasePath")}{memLayer.ML.CRS("drawingFolder")}/"; - /*-------------------------------------------- - * Note validazione: - * - leggo cSV - * - carico su DB - * - verifico (come ora x DXF) TUTTI i particolari - * - cerco su tab ItemValidation - * --> NON TROVATO --> creo record IV + record Batch stato 8, con KitID = OrdID = 0, DA VALUTARE!!! - * - se valutazione tempo <= 1 sec --> NON VALIDO - * - se valutazione tempo > 1 sec --> VALIDO - * - * --> trovato - * - se valido --> check DXF, - * --> dxf ok --> finito - * --> dxf non trovato --> NON VALIDO, segnalo errore su part - * - se NON valido --> segnalo errore su part - * - *--------------------------------------------*/ - - bool dataValidated = true; - DateTime adesso = DateTime.Now; - string dirFrom = e.LocalPath; - string dirTo = $"{_SqlCopyDir}{adesso.ToString("yyyy-MM")}\\"; - string dirImport = $"{_SqlImportDir}{adesso.ToString("yyyy-MM")}\\"; - int batchID = 0; - // recupero elenco parti validate... - DS_App.ItemListDataTable ItemValitadion = DataLayer.man.taIL.GetData(); - // preporcessing file: leggo e correggo: - // - sostituisco "," --> ";" come separatore - // - tolgo "" e spazi da stringa - string[] rawLines = System.IO.File.ReadAllLines($"{e.LocalPath}{e.FileName}"); - string[] fixLines = new string[rawLines.Length]; - int numRow = 0; - if (memLayer.ML.CRB("preFixCsv")) - { - foreach (var riga in rawLines) + protected void Page_Load(object sender, EventArgs e) { - string newLine = ""; - // splitto con " - string[] rowPart = riga.Split('"'); - int i = 0; - foreach (var parte in rowPart) - { - if (i % 2 == 0) + if (!Page.IsPostBack) { - // pari --> sostituisco , --> ; - newLine += parte.Replace(",", ";"); + doUpdate(); } - else + cmp_batchList.eh_doRefresh += Cmp_batchList_eh_doRefresh; + cmp_fileUpload.eh_doRefresh += Cmp_fileUpload_eh_doRefresh; + cmp_fileUpload.eh_FileUploaded += Cmp_fileUpload_eh_FileUploaded; + } + /// + /// Ora continuo processing + /// + /// + /// + private void Cmp_fileUpload_eh_FileUploaded(object sender, WebUserContols.FileUploadEventArgs e) + { + + /*-------------------------------------------- + * Note validazione: + * - leggo cSV + * - carico su DB + * - verifico (come ora x DXF) TUTTI i particolari + * - cerco su tab ItemValidation + * --> NON TROVATO --> creo record IV + record Batch stato 8, con KitID = OrdID = 0, DA VALUTARE!!! + * - se valutazione tempo <= 1 sec --> NON VALIDO + * - se valutazione tempo > 1 sec --> VALIDO + * + * --> trovato + * - se valido --> check DXF, + * --> dxf ok --> finito + * --> dxf non trovato --> NON VALIDO, segnalo errore su part + * - se NON valido --> segnalo errore su part + * + *--------------------------------------------*/ + + bool dataValidated = true; + DateTime adesso = DateTime.Now; + string dirFrom = e.LocalPath; + string dirTo = $"{_SqlCopyDir}{adesso.ToString("yyyy-MM")}\\"; + string dirImport = $"{_SqlImportDir}{adesso.ToString("yyyy-MM")}\\"; + int batchID = 0; + // recupero elenco parti validate... + DS_App.ItemListDataTable ItemValitadion = DataLayer.man.taIL.GetData(); + // preporcessing file: leggo e correggo: + // - sostituisco "," --> ";" come separatore + // - tolgo "" e spazi da stringa + string[] rawLines = System.IO.File.ReadAllLines($"{e.LocalPath}{e.FileName}"); + string[] fixLines = new string[rawLines.Length]; + int numRow = 0; + if (memLayer.ML.CRB("preFixCsv")) { - // dispari: trimmo - newLine += parte.Trim(); + foreach (var riga in rawLines) + { + string newLine = ""; + // splitto con " + string[] rowPart = riga.Split('"'); + int i = 0; + foreach (var parte in rowPart) + { + if (i % 2 == 0) + { + // pari --> sostituisco , --> ; + newLine += parte.Replace(",", ";"); + } + else + { + // dispari: trimmo + newLine += parte.Trim(); + } + i++; + } + // ricombino! + fixLines[numRow] = newLine; + numRow++; + } + // salvo NUOVO file... + System.IO.File.WriteAllLines($"{e.LocalPath}{e.FileName}", fixLines); } - i++; - } - // ricombino! - fixLines[numRow] = newLine; - numRow++; - } - // salvo NUOVO file... - System.IO.File.WriteAllLines($"{e.LocalPath}{e.FileName}", fixLines); - } - // copio su server SQL - try - { - // copio su SQL... - fileMover.obj.copiaFile(dirFrom, dirTo, e.FileName); - } - catch (Exception exc) - { - logger.lg.scriviLog($"Eccezione in Copia SQL file:{Environment.NewLine}{exc}"); - DataLayer.man.taEL.insertQuery(DateTime.Now, "Copy CSV", $"{e.BatchName}", $"{e.BatchName}.{e.FileName}", $"Exception: {exc}"); - } - // chiamo stored caricamento - DS_App.ImportLogDataTable tabDati = null; - try - { - // chiamo procedura SQL x import... - tabDati = DataLayer.man.taImpLog.importCsvOrd($"{dirImport}", e.FileName, e.BatchName, ";", "\n", "2", 0, 0, 0); - } - catch (Exception exc) - { - logger.lg.scriviLog($"Eccezione in IMPORT file:{Environment.NewLine}{exc}"); - // salvo log errore... - DataLayer.man.taEL.insertQuery(DateTime.Now, "Upload CSV", $"{e.BatchName}", $"{e.BatchName}.{e.FileName}", $"Exception: {exc}"); - dataValidated = false; - } - // FIX eventuali cadFilePath... - DataLayer.man.taIL.updateCadPath(cadBasePath, 0, false); - // recupero da batch la riga impostata... - try - { - var tabBatch = DataLayer.man.taBL.getLastByTakt(e.BatchName); - if (tabBatch != null) - { - if (tabBatch.Count > 0) - { - batchID = tabBatch[0].BatchID; - } - } - } - catch (Exception exc) - { - logger.lg.scriviLog($"Eccezione in verifica file:{Environment.NewLine}{exc}"); - dataValidated = false; - } - if (dataValidated && batchID > 0) - { - dataValidated = doValidations(batchID); - } - if (!dataValidated) - { - try - { - var newBatch = tabDati[0]; - int bStatus = 7; - DataLayer.man.taBL.updateStatus(batchID, bStatus, e.BatchName, -1); - } - catch - { } - } - doUpdate(); - } - /// - /// Effettua validazione dati - /// - private bool doValidations(int batchID) - { - bool allOk = true; - List missingDxfList = new List(); - // faccio un ciclo su OGNI record Part --> cerco se mancassero dei file dxf... - try - { - var tabParts = DataLayer.man.taIL.getByBatch(batchID); - if (tabParts.Count > 0) - { - bool fileOk = false; - string localPath = ""; - foreach (var item in tabParts) - { - // verifico SE già processato... - if (!missingDxfList.Contains(item.ItemExtCode)) + // copio su server SQL + try { - // cerco file! sostituisco cadBasePath --> srvCadBasePath - if (string.IsNullOrEmpty(item.CadFilePath)) - { - localPath = $"{srvCadBasePath}{item.ItemExtCode}.dxf"; - } - else - { - localPath = item.CadFilePath.Replace(cadBasePath, srvCadBasePath); - } - // verifico - fileOk = System.IO.File.Exists(localPath); - if (!fileOk) - { - DataLayer.man.taEL.insertQuery(DateTime.Now, "I.1", $"B.{batchID}", $"{item.ItemExtCode}.dxf", $"DXF File not found {localPath} | part {item.ItemExtCode} | {item.ItemDesc}"); - allOk = false; - missingDxfList.Add(item.ItemExtCode); - } + // copio su SQL... + fileMover.obj.copiaFile(dirFrom, dirTo, e.FileName); } - } + catch (Exception exc) + { + logger.lg.scriviLog($"Eccezione in Copia SQL file:{Environment.NewLine}{exc}"); + DataLayer.man.taEL.insertQuery(DateTime.Now, "Copy CSV", $"{e.BatchName}", $"{e.BatchName}.{e.FileName}", $"Exception: {exc}"); + } + // chiamo stored caricamento + DS_App.ImportLogDataTable tabDati = null; + try + { + // chiamo procedura SQL x import... + tabDati = DataLayer.man.taImpLog.importCsvOrd($"{dirImport}", e.FileName, e.BatchName, ";", "\n", "2", 0, 0, 0); + } + catch (Exception exc) + { + logger.lg.scriviLog($"Eccezione in IMPORT file:{Environment.NewLine}{exc}"); + // salvo log errore... + DataLayer.man.taEL.insertQuery(DateTime.Now, "Upload CSV", $"{e.BatchName}", $"{e.BatchName}.{e.FileName}", $"Exception: {exc}"); + dataValidated = false; + } + // FIX eventuali cadFilePath... + DataLayer.man.taIL.updateCadPath(cadBasePath, 0, false); + // recupero da batch la riga impostata... + try + { + var tabBatch = DataLayer.man.taBL.getLastByTakt(e.BatchName); + if (tabBatch != null) + { + if (tabBatch.Count > 0) + { + batchID = tabBatch[0].BatchID; + } + } + } + catch (Exception exc) + { + logger.lg.scriviLog($"Eccezione in verifica file:{Environment.NewLine}{exc}"); + dataValidated = false; + } + if (dataValidated && batchID > 0) + { + dataValidated = doValidations(batchID); + } + if (!dataValidated) + { + try + { + var newBatch = tabDati[0]; + int bStatus = 7; + DataLayer.man.taBL.updateStatus(batchID, bStatus, e.BatchName, -1); + } + catch + { } + } + doUpdate(); + } + /// + /// Effettua validazione dati + /// + private bool doValidations(int batchID) + { + bool allOk = true; + List missingDxfList = new List(); + // faccio un ciclo su OGNI record Part --> cerco se mancassero dei file dxf... + try + { + var tabParts = DataLayer.man.taIL.getByBatch(batchID); + if (tabParts.Count > 0) + { + bool fileOk = false; + string localPath = ""; + foreach (var item in tabParts) + { + // verifico SE già processato... + if (!missingDxfList.Contains(item.ItemExtCode)) + { + // cerco file! sostituisco cadBasePath --> srvCadBasePath + if (string.IsNullOrEmpty(item.CadFilePath)) + { + localPath = $"{srvCadBasePath}{item.ItemExtCode}.dxf"; + } + else + { + localPath = item.CadFilePath.Replace(cadBasePath, srvCadBasePath); + } + // verifico + fileOk = System.IO.File.Exists(localPath); + if (!fileOk) + { + DataLayer.man.taEL.insertQuery(DateTime.Now, "I.1", $"B.{batchID}", $"{item.ItemExtCode}.dxf", $"DXF File not found {localPath} | part {item.ItemExtCode} | {item.ItemDesc}"); + allOk = false; + missingDxfList.Add(item.ItemExtCode); + } + } + } + } + } + catch + { } + // cerco errori preesistenti + return allOk; } - } - catch - { } - // cerco errori preesistenti - return allOk; - } - private void Cmp_fileUpload_eh_doRefresh(object sender, EventArgs e) - { - doUpdate(); - } + private void Cmp_fileUpload_eh_doRefresh(object sender, EventArgs e) + { + doUpdate(); + } - private void Cmp_batchList_eh_doRefresh(object sender, EventArgs e) - { - doUpdate(); - } - /// - /// Update interfaccia - /// - public void doUpdate() - { - cmp_batchList.doUpdate(); - } + private void Cmp_batchList_eh_doRefresh(object sender, EventArgs e) + { + doUpdate(); + } + /// + /// Update interfaccia + /// + public void doUpdate() + { + cmp_batchList.doUpdate(); + } - } + } } \ No newline at end of file diff --git a/NKC_WF/site/OrderScheduler.aspx.cs b/NKC_WF/site/OrderScheduler.aspx.cs index 58c6670..2644c20 100644 --- a/NKC_WF/site/OrderScheduler.aspx.cs +++ b/NKC_WF/site/OrderScheduler.aspx.cs @@ -1,9 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using System.Web.UI; -using System.Web.UI.WebControls; namespace NKC_WF.site { diff --git a/NKC_WF/site/Painting.aspx.cs b/NKC_WF/site/Painting.aspx.cs index 9a5a1b5..6cebd41 100644 --- a/NKC_WF/site/Painting.aspx.cs +++ b/NKC_WF/site/Painting.aspx.cs @@ -1,17 +1,12 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using System.Web.UI; -using System.Web.UI.WebControls; namespace NKC_WF { - public partial class Painting : BasePage - { - protected void Page_Load(object sender, EventArgs e) + public partial class Painting : BasePage { - ((SiteContent)this.Master).showSearch = false; + protected void Page_Load(object sender, EventArgs e) + { + ((SiteContent)this.Master).showSearch = false; + } } - } } \ No newline at end of file diff --git a/NKC_WF/site/PartValidation.aspx.cs b/NKC_WF/site/PartValidation.aspx.cs index 3e27ea1..6566339 100644 --- a/NKC_WF/site/PartValidation.aspx.cs +++ b/NKC_WF/site/PartValidation.aspx.cs @@ -2,22 +2,22 @@ namespace NKC_WF { - public partial class PartValidation : BasePage - { - protected void Page_Load(object sender, EventArgs e) + public partial class PartValidation : BasePage { - cmp_validationSummary.eh_doRefresh += Cmp_validationSummary_eh_doRefresh; - cmp_batchList.eh_doReset += Cmp_batchList_eh_doReset; - } + protected void Page_Load(object sender, EventArgs e) + { + cmp_validationSummary.eh_doRefresh += Cmp_validationSummary_eh_doRefresh; + cmp_batchList.eh_doReset += Cmp_batchList_eh_doReset; + } - private void Cmp_batchList_eh_doReset(object sender, EventArgs e) - { - cmp_validationSummary.doUpdate(false); - } + private void Cmp_batchList_eh_doReset(object sender, EventArgs e) + { + cmp_validationSummary.doUpdate(false); + } - private void Cmp_validationSummary_eh_doRefresh(object sender, EventArgs e) - { - cmp_batchList.doUpdate(); + private void Cmp_validationSummary_eh_doRefresh(object sender, EventArgs e) + { + cmp_batchList.doUpdate(); + } } - } } \ No newline at end of file diff --git a/NKC_WF/site/Reordering.aspx.cs b/NKC_WF/site/Reordering.aspx.cs index 46aa983..5b10236 100644 --- a/NKC_WF/site/Reordering.aspx.cs +++ b/NKC_WF/site/Reordering.aspx.cs @@ -1,17 +1,12 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using System.Web.UI; -using System.Web.UI.WebControls; namespace NKC_WF { - public partial class Reordering : System.Web.UI.Page - { - protected void Page_Load(object sender, EventArgs e) + public partial class Reordering : System.Web.UI.Page { + protected void Page_Load(object sender, EventArgs e) + { + } } - } } \ No newline at end of file diff --git a/NKC_WF/site/SecondScreen.aspx.cs b/NKC_WF/site/SecondScreen.aspx.cs index bc6860d..a3888f1 100644 --- a/NKC_WF/site/SecondScreen.aspx.cs +++ b/NKC_WF/site/SecondScreen.aspx.cs @@ -1,20 +1,16 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; using System.Web.UI; -using System.Web.UI.WebControls; namespace NKC_WF { - public partial class SecondScreen : System.Web.UI.Page - { - protected void Page_Load(object sender, EventArgs e) + public partial class SecondScreen : System.Web.UI.Page { - if (!Page.IsPostBack) - { - ((SiteContent)this.Master).showSearch = false; - } + protected void Page_Load(object sender, EventArgs e) + { + if (!Page.IsPostBack) + { + ((SiteContent)this.Master).showSearch = false; + } + } } - } } \ No newline at end of file diff --git a/NKC_WF/site/StackManager.aspx.cs b/NKC_WF/site/StackManager.aspx.cs index 3443147..a46ace2 100644 --- a/NKC_WF/site/StackManager.aspx.cs +++ b/NKC_WF/site/StackManager.aspx.cs @@ -3,48 +3,48 @@ using System.Web.UI; namespace NKC_WF { - public partial class StackManager : BasePage - { - protected void Page_Load(object sender, EventArgs e) + public partial class StackManager : BasePage { - if (!Page.IsPostBack) - { - ((SiteMaster)this.Master).showSearch = false; - checkVisibility(); - } - cmp_taktList.eh_doRefresh += Cmp_taktList_eh_doRefresh; - cmp_taktList.eh_doReset += Cmp_taktList_eh_doReset; - cmp_stackList.eh_doRefresh += Cmp_stackList_eh_doRefresh; - } + protected void Page_Load(object sender, EventArgs e) + { + if (!Page.IsPostBack) + { + ((SiteMaster)this.Master).showSearch = false; + checkVisibility(); + } + cmp_taktList.eh_doRefresh += Cmp_taktList_eh_doRefresh; + cmp_taktList.eh_doReset += Cmp_taktList_eh_doReset; + cmp_stackList.eh_doRefresh += Cmp_stackList_eh_doRefresh; + } - private void Cmp_stackList_eh_doRefresh(object sender, EventArgs e) - { - checkVisibility(); - // imposto Stack! - cmp_stackBuilding.StackId = cmp_stackList.StackIdSel; - } + private void Cmp_stackList_eh_doRefresh(object sender, EventArgs e) + { + checkVisibility(); + // imposto Stack! + cmp_stackBuilding.StackId = cmp_stackList.StackIdSel; + } - private void Cmp_taktList_eh_doReset(object sender, EventArgs e) - { - checkVisibility(); - cmp_stackList.BatchId = 0; - cmp_stackList.resetSelezione(); - } + private void Cmp_taktList_eh_doReset(object sender, EventArgs e) + { + checkVisibility(); + cmp_stackList.BatchId = 0; + cmp_stackList.resetSelezione(); + } - private void Cmp_taktList_eh_doRefresh(object sender, EventArgs e) - { - checkVisibility(); - // imposto batch! - cmp_stackList.BatchId = cmp_taktList.BatchIdSel; - cmp_stackBuilding.StackId = cmp_stackList.StackIdSel; - } + private void Cmp_taktList_eh_doRefresh(object sender, EventArgs e) + { + checkVisibility(); + // imposto batch! + cmp_stackList.BatchId = cmp_taktList.BatchIdSel; + cmp_stackBuilding.StackId = cmp_stackList.StackIdSel; + } - private void checkVisibility() - { - // Di default nascondo i dettagli... - cmp_stackList.Visible = (cmp_taktList.BatchIdSel > 0); - cmp_stackBuilding.Visible = (cmp_taktList.BatchIdSel > 0) && (cmp_stackList.StackIdSel > 0); - } + private void checkVisibility() + { + // Di default nascondo i dettagli... + cmp_stackList.Visible = (cmp_taktList.BatchIdSel > 0); + cmp_stackBuilding.Visible = (cmp_taktList.BatchIdSel > 0) && (cmp_stackList.StackIdSel > 0); + } - } + } } \ No newline at end of file diff --git a/NKC_WF/site/SyncData.aspx.cs b/NKC_WF/site/SyncData.aspx.cs index 182eb85..176ff82 100644 --- a/NKC_WF/site/SyncData.aspx.cs +++ b/NKC_WF/site/SyncData.aspx.cs @@ -3,21 +3,21 @@ using System; namespace NKC_WF { - public partial class SyncData : System.Web.UI.Page - { - protected void Page_Load(object sender, EventArgs e) + public partial class SyncData : System.Web.UI.Page { - processRedisRequest(); + protected void Page_Load(object sender, EventArgs e) + { + processRedisRequest(); + } + /// + /// Effettua le operaizoni di SYNC tra REDIS e DB + /// + private void processRedisRequest() + { + // processa richieste lettura del PROD + SyncLib.procProdReadReq(); + // processa richieste scrittura del PROD + SyncLib.procProdWriteReq(); + } } - /// - /// Effettua le operaizoni di SYNC tra REDIS e DB - /// - private void processRedisRequest() - { - // processa richieste lettura del PROD - SyncLib.procProdReadReq(); - // processa richieste scrittura del PROD - SyncLib.procProdWriteReq(); - } - } } \ No newline at end of file diff --git a/NKC_WF/site/TestAuth.aspx.cs b/NKC_WF/site/TestAuth.aspx.cs index 58393fc..a8a377f 100644 --- a/NKC_WF/site/TestAuth.aspx.cs +++ b/NKC_WF/site/TestAuth.aspx.cs @@ -1,51 +1,46 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using System.Web.UI; -using System.Web.UI.WebControls; namespace NKC_WF.site { - public partial class TestAuth : System.Web.UI.Page - { - protected void Page_Load(object sender, EventArgs e) + public partial class TestAuth : System.Web.UI.Page { + protected void Page_Load(object sender, EventArgs e) + { - } + } - protected void ddlSelData_SelectedIndexChanged(object sender, EventArgs e) - { - // a seconda delal richeista mostro qualcosa di diverso... - string selVal = ddlSelData.SelectedValue; - string dataVal = $"

{selVal}

"; - dataVal += "
    "; - switch (selVal) - { - case "diritti": - var diritti = SteamWare.user_std.UtSn.diritti; - foreach (var item in diritti) - { - dataVal += $"
  • CDC {item.COD_CDC} | MOD {item.COD_MODULO} | FUN {item.COD_FUNZIONE}
  • "; - } - break; - case "mappa": - var mappa = SteamWare.user_std.UtSn.mappaSito; - dataVal += $"
  • {mappa}
  • "; - break; - case "permessi": - var permessi = SteamWare.user_std.UtSn.permessi; - foreach (var item in permessi) - { - dataVal += $"
  • COD {item.COD_PERMESSO} | NOME {item.NOME} | URL {item.URL}
  • "; - } - break; - case "0": - default: - break; - } - dataVal += "
"; - litOut.Text = dataVal; + protected void ddlSelData_SelectedIndexChanged(object sender, EventArgs e) + { + // a seconda delal richeista mostro qualcosa di diverso... + string selVal = ddlSelData.SelectedValue; + string dataVal = $"

{selVal}

"; + dataVal += "
    "; + switch (selVal) + { + case "diritti": + var diritti = SteamWare.user_std.UtSn.diritti; + foreach (var item in diritti) + { + dataVal += $"
  • CDC {item.COD_CDC} | MOD {item.COD_MODULO} | FUN {item.COD_FUNZIONE}
  • "; + } + break; + case "mappa": + var mappa = SteamWare.user_std.UtSn.mappaSito; + dataVal += $"
  • {mappa}
  • "; + break; + case "permessi": + var permessi = SteamWare.user_std.UtSn.permessi; + foreach (var item in permessi) + { + dataVal += $"
  • COD {item.COD_PERMESSO} | NOME {item.NOME} | URL {item.URL}
  • "; + } + break; + case "0": + default: + break; + } + dataVal += "
"; + litOut.Text = dataVal; + } } - } } \ No newline at end of file diff --git a/NKC_WF/site/Unauth.aspx.cs b/NKC_WF/site/Unauth.aspx.cs index 4509b21..a386e74 100644 --- a/NKC_WF/site/Unauth.aspx.cs +++ b/NKC_WF/site/Unauth.aspx.cs @@ -1,17 +1,12 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using System.Web.UI; -using System.Web.UI.WebControls; namespace NKC_WF { - public partial class Unauth : System.Web.UI.Page - { - protected void Page_Load(object sender, EventArgs e) + public partial class Unauth : System.Web.UI.Page { + protected void Page_Load(object sender, EventArgs e) + { + } } - } } \ No newline at end of file diff --git a/NKC_WF/site/UpdateVoc.aspx.cs b/NKC_WF/site/UpdateVoc.aspx.cs index cc970af..3b3e7de 100644 --- a/NKC_WF/site/UpdateVoc.aspx.cs +++ b/NKC_WF/site/UpdateVoc.aspx.cs @@ -3,16 +3,16 @@ using System; namespace NKC_WF { - public partial class UpdateVoc : System.Web.UI.Page - { - protected void Page_Load(object sender, EventArgs e) + public partial class UpdateVoc : System.Web.UI.Page { - // aggiorno vocabolario - DataWrap.DW.resetVocabolario(); - // reset dati in cache x DbConfig... - memLayer.ML.resetAppConf(); - // torno a menu... - Response.Redirect("default"); + protected void Page_Load(object sender, EventArgs e) + { + // aggiorno vocabolario + DataWrap.DW.resetVocabolario(); + // reset dati in cache x DbConfig... + memLayer.ML.resetAppConf(); + // torno a menu... + Response.Redirect("default"); + } } - } } \ No newline at end of file diff --git a/NKC_WF/site/Utility.aspx.cs b/NKC_WF/site/Utility.aspx.cs index d91e5d9..734620f 100644 --- a/NKC_WF/site/Utility.aspx.cs +++ b/NKC_WF/site/Utility.aspx.cs @@ -6,109 +6,109 @@ using System.Web.UI; namespace NKC_WF { - public partial class Utility : System.Web.UI.Page - { - protected void Page_Load(object sender, EventArgs e) + public partial class Utility : System.Web.UI.Page { - if (!Page.IsPostBack) - { - txtCodTakt.Text = $"{DateTime.Now:yyyyMMdd}.1"; - txtNumStaks.Text = "3"; - txtNumPanels.Text = "5"; - } - } - - protected int numStackReq - { - get - { - int answ = 0; - Int32.TryParse(txtNumStaks.Text, out answ); - return answ; - } - } - protected int numPanels - { - get - { - int answ = 0; - Int32.TryParse(txtNumPanels.Text, out answ); - return answ; - } - } - - - protected void lbtMakeSim_Click(object sender, EventArgs e) - { - // creazione degli stack e dei pannelli... - List stackList = new List(); - List panelList; - ProdBunk currStack; - ProdSheet currPanel; - MaterialData currMaterial; - WorkData currPrintData; - WorkData currMachiningData; - WorkData currUnloadData; - for (int i = 1; i <= numStackReq; i++) - { - // devo creare fino a maxNumPanels - panelList = new List(); - for (int j = 1; j <= numPanels; j++) + protected void Page_Load(object sender, EventArgs e) { - currMaterial = new MaterialData() - { - MaterialId = 1, - MaterialPN = "6120", - MaterialDescription = "BOARD, WAFER, 1/4 X 48 X 96" - }; - currPrintData = new WorkData() - { - ProgramPath = @"c:\temp\PrintProgram.cnc" - }; - currMachiningData = new WorkData() - { - ProgramPath = @"c:\temp\MachiningProgram.cnc" - }; - currUnloadData = new WorkData() - { - ProgramPath = @"" - }; - currPanel = new ProdSheet() - { - SheetId = j, - Status = PStatus.Programmed, - Material = currMaterial, - Printing = currPrintData, - Machining = currMachiningData, - Unloading = currUnloadData - }; - panelList.Add(currPanel); + if (!Page.IsPostBack) + { + txtCodTakt.Text = $"{DateTime.Now:yyyyMMdd}.1"; + txtNumStaks.Text = "3"; + txtNumPanels.Text = "5"; + } } - currStack = new ProdBunk() + protected int numStackReq { - DataMatrix = $"DM{txtCodTakt.Text}.{i}", - BunkId = i, - Status = CStatus.Programmed, - SheetList = panelList - }; - stackList.Add(currStack); - } - // creazione oggetto takt - ComLib.Takt currTakt = new ComLib.Takt() - { - TaktId = txtCodTakt.Text, - Status = CStatus.Programmed, - StackList = stackList - }; - // serializzo - //string jsonData = JsonConvert.SerializeObject(currTakt); - string jsonData = ComLib.serializeTakt(currTakt); + get + { + int answ = 0; + Int32.TryParse(txtNumStaks.Text, out answ); + return answ; + } + } + protected int numPanels + { + get + { + int answ = 0; + Int32.TryParse(txtNumPanels.Text, out answ); + return answ; + } + } - // scrivo su label - lblOut.Text = jsonData; - // salvo in redis / DB - ComLib.saveTakt("SERV", currTakt); + + protected void lbtMakeSim_Click(object sender, EventArgs e) + { + // creazione degli stack e dei pannelli... + List stackList = new List(); + List panelList; + ProdBunk currStack; + ProdSheet currPanel; + MaterialData currMaterial; + WorkData currPrintData; + WorkData currMachiningData; + WorkData currUnloadData; + for (int i = 1; i <= numStackReq; i++) + { + // devo creare fino a maxNumPanels + panelList = new List(); + for (int j = 1; j <= numPanels; j++) + { + currMaterial = new MaterialData() + { + MaterialId = 1, + MaterialPN = "6120", + MaterialDescription = "BOARD, WAFER, 1/4 X 48 X 96" + }; + currPrintData = new WorkData() + { + ProgramPath = @"c:\temp\PrintProgram.cnc" + }; + currMachiningData = new WorkData() + { + ProgramPath = @"c:\temp\MachiningProgram.cnc" + }; + currUnloadData = new WorkData() + { + ProgramPath = @"" + }; + currPanel = new ProdSheet() + { + SheetId = j, + Status = PStatus.Programmed, + Material = currMaterial, + Printing = currPrintData, + Machining = currMachiningData, + Unloading = currUnloadData + }; + panelList.Add(currPanel); + } + + currStack = new ProdBunk() + { + DataMatrix = $"DM{txtCodTakt.Text}.{i}", + BunkId = i, + Status = CStatus.Programmed, + SheetList = panelList + }; + stackList.Add(currStack); + } + // creazione oggetto takt + ComLib.Takt currTakt = new ComLib.Takt() + { + TaktId = txtCodTakt.Text, + Status = CStatus.Programmed, + StackList = stackList + }; + // serializzo + //string jsonData = JsonConvert.SerializeObject(currTakt); + string jsonData = ComLib.serializeTakt(currTakt); + + // scrivo su label + lblOut.Text = jsonData; + // salvo in redis / DB + ComLib.saveTakt("SERV", currTakt); + } } - } } \ No newline at end of file diff --git a/NKC_WF/site/vocabolario.aspx b/NKC_WF/site/vocabolario.aspx index 8eca11e..73d0d63 100644 --- a/NKC_WF/site/vocabolario.aspx +++ b/NKC_WF/site/vocabolario.aspx @@ -1,5 +1,5 @@ -<%@ Page Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" - Inherits="NKC_WF.vocabolario" Title="Vocabolario" CodeBehind="vocabolario.aspx.cs" %> +<%@ Page Language="C#" MasterPageFile="~/SiteContent.master" AutoEventWireup="true" + Inherits="NKC_WF.vocabolario" Title="Vocabolario" CodeBehind="vocabolario.aspx.cs" %> <%@ Register Src="~/WebUserControls/mod_lemmiVocab.ascx" TagName="mod_lemmiVocab" TagPrefix="uc2" %> @@ -7,34 +7,36 @@ <%@ Register Src="~/WebUserControls/mod_ricercaGenerica.ascx" TagPrefix="uc4" TagName="mod_ricercaGenerica" %> <%@ Register Src="~/WebUserControls/mod_vocabolario.ascx" TagPrefix="uc2" TagName="mod_vocabolario" %> - - - -
-
-
-
+
+

<%: traduci("Vocabolario") %>

+
+
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+
+
+ +
+
+ +
+
+
+
-
- -
-
- -
-
-
-
-
-
-
- -
-
- -
-
-
-
diff --git a/NKC_WF/site/vocabolario.aspx.cs b/NKC_WF/site/vocabolario.aspx.cs index f150c50..237ea3b 100644 --- a/NKC_WF/site/vocabolario.aspx.cs +++ b/NKC_WF/site/vocabolario.aspx.cs @@ -3,51 +3,51 @@ using System.Web.UI; namespace NKC_WF { - public partial class vocabolario : System.Web.UI.Page - { - protected override void OnInit(EventArgs e) + public partial class vocabolario : BasePage { - base.OnInit(e); + protected override void OnInit(EventArgs e) + { + base.OnInit(e); - if (!Page.IsPostBack) - { - ((SiteMaster)this.Master).showSearch = false; - mod_righePag.numRowPag = 10; - mod_vocabolario.pageSize = mod_righePag.numRowPag; - } - // imposto controlli eventi - mod_vocabolario.eh_selezioneValore += new EventHandler(mod_vocabolario_eh_selezioneValore); - mod_vocabolario.eh_resetSelezione += new EventHandler(mod_vocabolario_eh_resetSelezione); - // setto visibilità dettaglio termini - mod_lemmiVocab.Visible = false; - mod_righePag.eh_newNum += mod_righePag_eh_newNum; - } - /// - /// aggiornato numero righe datagrid... aggiorno visualizzazione - /// - /// - /// - void mod_righePag_eh_newNum(object sender, EventArgs e) - { - mod_vocabolario.pageSize = mod_righePag.numRowPag; - } - void mod_vocabolario_eh_resetSelezione(object sender, EventArgs e) - { - mod_lemmiVocab.Visible = false; - Session.Remove("lemma_sel"); - } + if (!Page.IsPostBack) + { + ((SiteContent)this.Master).showSearch = false; + mod_righePag.numRowPag = 10; + mod_vocabolario.pageSize = mod_righePag.numRowPag; + } + // imposto controlli eventi + mod_vocabolario.eh_selezioneValore += new EventHandler(mod_vocabolario_eh_selezioneValore); + mod_vocabolario.eh_resetSelezione += new EventHandler(mod_vocabolario_eh_resetSelezione); + // setto visibilità dettaglio termini + mod_lemmiVocab.Visible = false; + mod_righePag.eh_newNum += mod_righePag_eh_newNum; + } + /// + /// aggiornato numero righe datagrid... aggiorno visualizzazione + /// + /// + /// + void mod_righePag_eh_newNum(object sender, EventArgs e) + { + mod_vocabolario.pageSize = mod_righePag.numRowPag; + } + void mod_vocabolario_eh_resetSelezione(object sender, EventArgs e) + { + mod_lemmiVocab.Visible = false; + Session.Remove("lemma_sel"); + } - void mod_vocabolario_eh_selezioneValore(object sender, EventArgs e) - { - mod_lemmiVocab.Visible = true; - mod_lemmiVocab.doUpdate(); - } + void mod_vocabolario_eh_selezioneValore(object sender, EventArgs e) + { + mod_lemmiVocab.Visible = true; + mod_lemmiVocab.doUpdate(); + } - protected override void OnUnload(EventArgs e) - { - base.OnUnload(e); - mod_vocabolario.eh_selezioneValore -= new EventHandler(mod_vocabolario_eh_selezioneValore); - mod_vocabolario.eh_resetSelezione -= new EventHandler(mod_vocabolario_eh_resetSelezione); + protected override void OnUnload(EventArgs e) + { + base.OnUnload(e); + mod_vocabolario.eh_selezioneValore -= new EventHandler(mod_vocabolario_eh_selezioneValore); + mod_vocabolario.eh_resetSelezione -= new EventHandler(mod_vocabolario_eh_resetSelezione); + } } - } }