Merge branch 'master' into develop

This commit is contained in:
Samuele E. Locatelli
2020-07-15 18:58:26 +02:00
109 changed files with 6714 additions and 6942 deletions
+33
View File
@@ -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
Vendored
+1 -1
View File
@@ -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}')
+1 -6
View File
@@ -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
{
+5 -5
View File
@@ -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());
}
}
}
}
+23 -23
View File
@@ -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 }
);
}
}
}
}
+12 -12
View File
@@ -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 }
);
}
}
}
}
+11 -18
View File
@@ -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
{
/// <summary>
/// Wrapper traduzione termini
/// </summary>
/// <param name="lemma"></param>
/// <returns></returns>
public string traduci(string lemma)
public class BasePage : System.Web.UI.Page
{
return SteamWare.user_std.UtSn.Traduci(lemma);
/// <summary>
/// Wrapper traduzione termini
/// </summary>
/// <param name="lemma"></param>
/// <returns></returns>
public string traduci(string lemma)
{
return SteamWare.user_std.UtSn.Traduci(lemma);
}
}
}
}
+81 -81
View File
@@ -6,92 +6,92 @@ using System.Collections.Generic;
namespace NKC_WF
{
public class BaseUserControl : System.Web.UI.UserControl
{
/// <summary>
/// Generico evento di richiesta refresh a aprent
/// </summary>
public event EventHandler eh_doRefresh;
/// <summary>
/// Generico evento di richiesta refresh a aprent
/// </summary>
public event EventHandler eh_doReset;
/// <summary>
/// Chiamata evento
/// </summary>
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());
}
}
/// <summary>
/// Chiamata evento
/// </summary>
public void raiseReset()
{
// se qualcuno ascolta sollevo evento nuovo valore...
if (eh_doReset != null)
{
eh_doReset(this, new EventArgs());
}
}
/// <summary>
/// Wrapper traduzione termini
/// </summary>
/// <param name="lemma"></param>
/// <returns></returns>
public string traduci(string lemma)
{
return SteamWare.user_std.UtSn.Traduci(lemma);
}
protected Dictionary<int, string> anagMateriali
{
set
{
string jsonData = JsonConvert.SerializeObject(value);
memLayer.ML.setRSV("anagMateriali", jsonData, 60);
}
get
{
Dictionary<int, string> answ = new Dictionary<int, string>();
//cerco in redis...
string rawData = memLayer.ML.getRSV("anagMateriali");
if (!string.IsNullOrEmpty(rawData))
/// <summary>
/// Generico evento di richiesta refresh a aprent
/// </summary>
public event EventHandler eh_doRefresh;
/// <summary>
/// Generico evento di richiesta refresh a aprent
/// </summary>
public event EventHandler eh_doReset;
/// <summary>
/// Chiamata evento
/// </summary>
public void raiseEvent()
{
answ = JsonConvert.DeserializeObject<Dictionary<int, string>>(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
/// <summary>
/// Chiamata evento
/// </summary>
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());
}
}
/// <summary>
/// Wrapper traduzione termini
/// </summary>
/// <param name="lemma"></param>
/// <returns></returns>
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<int, string> anagMateriali
{
set
{
string jsonData = JsonConvert.SerializeObject(value);
memLayer.ML.setRSV("anagMateriali", jsonData, 60);
}
get
{
Dictionary<int, string> answ = new Dictionary<int, string>();
//cerco in redis...
string rawData = memLayer.ML.getRSV("anagMateriali");
if (!string.IsNullOrEmpty(rawData))
{
answ = JsonConvert.DeserializeObject<Dictionary<int, string>>(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;
}
}
}
}
+17 -17
View File
@@ -3,24 +3,24 @@ using System.Web.Http;
namespace NKC_WF.Controllers
{
/// <summary>
/// Classe verifica stato ALIVE del servizio
/// </summary>
public class AliveController : ApiController
{
// GET: api/Alive
[HttpGet]
public string Get()
/// <summary>
/// Classe verifica stato ALIVE del servizio
/// </summary>
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");
}
}
}
}
+283 -283
View File
@@ -8,302 +8,302 @@ using System.Web.Http;
namespace NKC_WF.Controllers
{
public class BatchProcController : ApiController
{
/// <summary>
/// Restituisce SE C'E' la richiesta di elaborazione BATCH corrente
/// </summary>
/// <returns></returns>
// 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<batchRequest>(redVal);
// aggiungo LA SUA ENV NUM!!!!
answ.EnvNum = envNum;
}
catch
{ }
}
// altrimenti NULL!
else
{
answ = null;
}
return answ;
}
/// <summary>
/// Restituisce UNA SPECIFICA richiesta di elaborazione BATCH
/// </summary>
/// <returns></returns>
// 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
/// <summary>
/// Restituisce SE C'E' la richiesta di elaborazione BATCH corrente
/// </summary>
/// <returns></returns>
// GET: api/BatchProc
[HttpGet]
public batchRequest Get()
{
answ = JsonConvert.DeserializeObject<batchRequest>(redVal);
}
catch
{ }
}
return answ;
}
/// <summary>
/// Processa una chiamata POST per l'invio in blocco Batch
/// POST: api/BatchProc
/// </summary>
/// <param name="id">ID dell'IOB</param>
/// <returns></returns>
// 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<baseNestAnsw>(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<nestReplyBatchInitial>(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<batchRequest>(redVal);
// aggiungo LA SUA ENV NUM!!!!
answ.EnvNum = envNum;
}
}
// registro OK
answ = "OK";
catch
{ }
}
// altrimenti NULL!
else
{
// deserializzo come BatchreqFinale
nestReplyBatchFinal rispNest = JsonConvert.DeserializeObject<nestReplyBatchFinal>(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<nestReplyOffOrd>(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)
/// <summary>
/// Restituisce UNA SPECIFICA richiesta di elaborazione BATCH
/// </summary>
/// <returns></returns>
// 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<batchRequest>(redVal);
}
catch
{ }
}
return answ;
}
/// <summary>
/// Processa una chiamata POST per l'invio in blocco Batch
/// POST: api/BatchProc
/// </summary>
/// <param name="id">ID dell'IOB</param>
/// <returns></returns>
// 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<baseNestAnsw>(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<nestReplyBatchInitial>(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<nestReplyBatchFinal>(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<nestReplyOffOrd>(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;
}
}
}
+138 -139
View File
@@ -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
{
/// <summary>
/// Restituisce il FIRST BUNK da lavorare
/// GET: api/Bunk
/// </summary>
/// <returns></returns>
[HttpGet]
public ProdBunk Get()
public class BunkController : ApiController
{
ProdBunk answ = null;
try
{
answ = ComLib.prodGetFirstBunk();
}
catch
{ }
return answ;
}
/// <summary>
/// Ottengo NEXT BUNK
/// GET: api/Bunk/2?showNext=true
/// </summary>
/// <param name="id"></param>
/// <param name="showNext"></param>
/// <returns></returns>
[HttpGet]
public ProdBunk Get(int id, bool showNext)
{
ProdBunk answ = null;
try
{
if (showNext)
/// <summary>
/// Restituisce il FIRST BUNK da lavorare
/// GET: api/Bunk
/// </summary>
/// <returns></returns>
[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
* <!-- <add name="WebDAVModule" /> -->
* <!-- <add name="WebDAVModule" image="%windir%\System32\inetsrv\webdav.dll" /> -->
* <!-- <add name="WebDAV" path="*" verb="PROPFIND,PROPPATCH,MKCOL,PUT,COPY,DELETE,MOVE,LOCK,UNLOCK" modules="WebDAVModule" resourceType="Unspecified" requireAccess="None" /> -->
* - aggiungere PUT/DELETE a handler:
* <add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
* <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" responseBufferLimit="0" />
*
**************************************/
/// <summary>
/// Effettua la chiamata di update
/// </summary>
/// <param name="id"></param>
/// <param name="value"></param>
// 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();
}
/// <summary>
/// Processa una chiamata POST per l'invio in blocco status BUNK
/// POST: api/Bunk
/// </summary>
/// <returns></returns>
[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<ProdBunk>(content);
// se non nullo...
if (currBunk != null)
/// <summary>
/// Ottengo NEXT BUNK
/// GET: api/Bunk/2?showNext=true
/// </summary>
/// <param name="id"></param>
/// <param name="showNext"></param>
/// <returns></returns>
[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
* <!-- <add name="WebDAVModule" /> -->
* <!-- <add name="WebDAVModule" image="%windir%\System32\inetsrv\webdav.dll" /> -->
* <!-- <add name="WebDAV" path="*" verb="PROPFIND,PROPPATCH,MKCOL,PUT,COPY,DELETE,MOVE,LOCK,UNLOCK" modules="WebDAVModule" resourceType="Unspecified" requireAccess="None" /> -->
* - aggiungere PUT/DELETE a handler:
* <add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
* <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" responseBufferLimit="0" />
*
**************************************/
/// <summary>
/// Effettua la chiamata di update
/// </summary>
/// <param name="id"></param>
/// <param name="value"></param>
// 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();
}
/// <summary>
/// Processa una chiamata POST per l'invio in blocco status BUNK
/// POST: api/Bunk
/// </summary>
/// <returns></returns>
[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<ProdBunk>(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;
}
}
}
+30 -30
View File
@@ -5,37 +5,37 @@ using System.Web.Http;
namespace NKC_WF.Controllers
{
public class MaterialController : ApiController
{
/// <summary>
/// Restituisce ELENCO materiali
/// </summary>
/// <returns></returns>
// GET: api/Material
[HttpGet]
public List<Material> Get()
public class MaterialController : ApiController
{
List<Material> answ = new List<Material>();
var table = DataLayer.man.taMat.GetData();
Material currMat = new Material();
foreach (var item in table)
{
currMat = new Material()
/// <summary>
/// Restituisce ELENCO materiali
/// </summary>
/// <returns></returns>
// GET: api/Material
[HttpGet]
public List<Material> 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<Material> answ = new List<Material>();
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;
}
}
}
}
+46 -49
View File
@@ -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
{
/// <summary>
/// Restituisce un array JSon x le conf delle code di stampa
/// GET: api/PrintQueue
/// </summary>
/// <returns>lista oggetto Json in formato SteamwareSDK.queueConf</returns>
public List<queueConf> Get()
public class PrintQueueConfController : ApiController
{
List<queueConf> answ = new List<queueConf>();
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))
/// <summary>
/// Restituisce un array JSon x le conf delle code di stampa
/// GET: api/PrintQueue
/// </summary>
/// <returns>lista oggetto Json in formato SteamwareSDK.queueConf</returns>
public List<queueConf> Get()
{
try
{
answ = JsonConvert.DeserializeObject<List<queueConf>>(rawData);
}
catch(Exception exc)
{
Log.Instance.Error(exc, "Eccezione in decodifica file conf printQueue");
}
List<queueConf> answ = new List<queueConf>();
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<List<queueConf>>(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
}
}
}
+195 -199
View File
@@ -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
/// <summary>
/// chaive redis x cache conteggio coda PJQ
/// </summary>
public static string redQueueCount = "NKC:SERV:PJQ";
/// <summary>
/// Conteggio elementi in attesa stsampa da DB
/// </summary>
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
/// <summary>
/// chaive redis x cache conteggio coda PJQ
/// </summary>
internal static string redQueueCount = "NKC:SERV:PJQ";
/// <summary>
/// Conteggio elementi in attesa stsampa da DB
/// </summary>
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;
}
}
/// <summary>
/// Carica i dati richiesti dal report dalla StoredProcedure (filtrando quindi...) e restituisce Dictionary [nome RDS / tab RDS]
/// </summary>
/// <param name="tipoReport"></param>
/// <param name="keyParam">cod UDC</param>
/// <returns>tabella dati</returns>
private Dictionary<string, DataTable> caricaDati(reportRichiesto tipoReport, string keyParam)
{
int intIdx = 0;
Dictionary<string, DataTable> answ = new Dictionary<string, DataTable>();
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
/// <summary>
/// Restituisce numero jobs aperti (stato = 0...), se 0 = NESSUNO
/// GET: api/PrintQueue
/// </summary>
/// <returns></returns>
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;
}
/// <summary>
/// Elenco dei jobs aperti per la coda indicata
/// GET: api/PrintQueue/queue_01
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public List<reportData> Get(string id)
{
List<reportData> answ = new List<reportData>();
// recupero da DB...
DS_Report.PrintJobQueueDataTable tabPJQ = DataLayer.man.taPJQ.getByQueue(id);
if (tabPJQ.Count > 0)
{
reportData currReport = new reportData();
Dictionary<string, DataTable> currRdsData;
// ciclo!
foreach (var pjReq in tabPJQ)
/// <summary>
/// Carica i dati richiesti dal report dalla StoredProcedure (filtrando quindi...) e restituisce Dictionary [nome RDS / tab RDS]
/// </summary>
/// <param name="tipoReport"></param>
/// <param name="keyParam">cod UDC</param>
/// <returns>tabella dati</returns>
private Dictionary<string, DataTable> 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<string, DataTable> answ = new Dictionary<string, DataTable>();
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;
}
/// <summary>
/// Processa una chiamata POST per l'invio in blocco del risultato dell'elaborazione
/// POST: api/PrintQueue
/// </summary>
/// <returns></returns>
[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<printTask>(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
/// <summary>
/// Restituisce numero jobs aperti (stato = 0...), se 0 = NESSUNO
/// GET: api/PrintQueue
/// </summary>
/// <returns></returns>
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;
}
/// <summary>
/// Elenco dei jobs aperti per la coda indicata
/// GET: api/PrintQueue/queue_01
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public List<reportData> Get(string id)
{
List<reportData> answ = new List<reportData>();
// recupero da DB...
DS_Report.PrintJobQueueDataTable tabPJQ = DataLayer.man.taPJQ.getByQueue(id);
if (tabPJQ.Count > 0)
{
reportData currReport = new reportData();
Dictionary<string, DataTable> 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;
}
/// <summary>
/// Processa una chiamata POST per l'invio in blocco del risultato dell'elaborazione
/// POST: api/PrintQueue
/// </summary>
/// <returns></returns>
[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<printTask>(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
}
}
+74 -79
View File
@@ -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
{
/// <summary>
/// Restituisce un array JSon dei files report template del progetto
/// GET: api/Report
/// </summary>
/// <param name="id">ID della printer associata</param>
/// <returns>Oggetto Json in formato SteamwareSDK.filePack</returns>
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)
/// <summary>
/// Restituisce un array JSon dei files report template del progetto
/// GET: api/Report
/// </summary>
/// <param name="id">ID della printer associata</param>
/// <returns>Oggetto Json in formato SteamwareSDK.filePack</returns>
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;
}
/// <summary>
/// Restituisce oggetto JSon del files report template richeisto
/// GET: api/Report/print_01
/// </summary>
/// <param name="id">nome report (SENZA estensione .rdlc)</param>
/// <returns>Oggetto Json in formato SteamwareSDK.filePack</returns>
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)
/// <summary>
/// Restituisce oggetto JSon del files report template richeisto
/// GET: api/Report/print_01
/// </summary>
/// <param name="id">nome report (SENZA estensione .rdlc)</param>
/// <returns>Oggetto Json in formato SteamwareSDK.filePack</returns>
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;
}
}
}
}
+1 -6
View File
@@ -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";
}
+49 -54
View File
@@ -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")
};
}
/// <summary>
/// Calcola CSS da postsazione
/// </summary>
/// <param name="answ"></param>
/// <param name="_sheetID"></param>
/// <returns></returns>
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")
};
}
/// <summary>
/// Calcola CSS da postsazione
/// </summary>
/// <param name="answ"></param>
/// <param name="_sheetID"></param>
/// <returns></returns>
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;
}
}
}
+46 -46
View File
@@ -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;
}
/// <summary>
/// Recupera da REDIS info indice revisione x foglio
/// </summary>
/// <param name="SheetID"></param>
/// <returns></returns>
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)
/// <summary>
/// Recupera da REDIS info indice revisione x foglio
/// </summary>
/// <param name="SheetID"></param>
/// <returns></returns>
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;
}
}
}
}
+14 -16
View File
@@ -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;
}
}
}
}
+5 -10
View File
@@ -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");
}
}
}
}
+4 -9
View File
@@ -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)
{
}
}
}
}
+10 -10
View File
@@ -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);
}
}
}
}
+5 -10
View File
@@ -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/");
}
}
}
}
-1
View File
@@ -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
+23 -27
View File
@@ -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...
}
/// <summary>
/// Imposta vilibilità componente search globale
/// </summary>
public bool showSearch
{
get
{
return cmp_menuTop.showSearch;
}
set
{
cmp_menuTop.showSearch = value;
}
}
}
/// <summary>
/// Imposta vilibilità componente search globale
/// </summary>
public bool showSearch
{
get
{
return cmp_menuTop.showSearch;
}
set
{
cmp_menuTop.showSearch = value;
}
}
}
}
+18 -18
View File
@@ -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)
{
}
/// <summary>
/// Imposta vilibilità componente search globale
/// </summary>
public bool showSearch
{
get
{
return ((SiteMaster)Master).showSearch;
}
set
{
((SiteMaster)Master).showSearch = value;
}
}
}
/// <summary>
/// Imposta vilibilità componente search globale
/// </summary>
public bool showSearch
{
get
{
return ((SiteMaster)Master).showSearch;
}
set
{
((SiteMaster)Master).showSearch = value;
}
}
}
}
+108 -112
View File
@@ -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
{
}
/// <summary>
/// Batch corrente...
/// </summary>
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();
}
/// <summary>
/// comando reset
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
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();
}
/// <summary>
/// Indice selezionato
/// </summary>
public int selIndex
{
get
{
return grView.SelectedIndex;
}
set
{
grView.SelectedIndex = value;
}
}
/// <summary>
/// BunkId selezionato
/// </summary>
public int BunkIdSel
{
get
{
int answ = 0;
try
protected void Page_Load(object sender, EventArgs e)
{
int.TryParse(grView.SelectedValue.ToString(), out answ);
}
/// <summary>
/// Batch corrente...
/// </summary>
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();
}
/// <summary>
/// comando reset
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
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();
}
/// <summary>
/// Indice selezionato
/// </summary>
public int selIndex
{
get
{
return grView.SelectedIndex;
}
set
{
grView.SelectedIndex = value;
}
}
/// <summary>
/// BunkId selezionato
/// </summary>
public int BunkIdSel
{
get
{
int answ = 0;
try
{
int.TryParse(grView.SelectedValue.ToString(), out answ);
}
catch
{ }
return answ;
}
}
/// <summary>
/// Num totale bunks
/// </summary>
public int numBunks
{
get
{
return grView.Rows.Count;
}
}
catch
{ }
return answ;
}
}
/// <summary>
/// Num totale bunks
/// </summary>
public int numBunks
{
get
{
return grView.Rows.Count;
}
}
}
}
+96 -101
View File
@@ -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
{
}
/// <summary>
/// Bunk corrente...
/// </summary>
public int BunkId
{
set
{
hfStackID.Value = value.ToString();
grView.DataBind();
}
get
{
int answ = 0;
int.TryParse(hfStackID.Value, out answ);
return answ;
}
}
// <summary>
/// Indice selezionato
/// </summary>
public int selIndex
{
get
{
return grView.SelectedIndex;
}
set
{
grView.SelectedIndex = value;
}
}
/// <summary>
/// SheetId selezionato
/// </summary>
public int SheetIdSel
{
get
{
int answ = 0;
try
protected void Page_Load(object sender, EventArgs e)
{
int.TryParse(grView.SelectedValue.ToString(), out answ);
}
/// <summary>
/// Bunk corrente...
/// </summary>
public int BunkId
{
set
{
hfStackID.Value = value.ToString();
grView.DataBind();
}
get
{
int answ = 0;
int.TryParse(hfStackID.Value, out answ);
return answ;
}
}
// <summary>
/// Indice selezionato
/// </summary>
public int selIndex
{
get
{
return grView.SelectedIndex;
}
set
{
grView.SelectedIndex = value;
}
}
/// <summary>
/// SheetId selezionato
/// </summary>
public int SheetIdSel
{
get
{
int answ = 0;
try
{
int.TryParse(grView.SelectedValue.ToString(), out answ);
}
catch
{ }
return answ;
}
}
/// <summary>
/// comando reset
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void lbtReset_Click(object sender, EventArgs e)
{
resetSelezione();
}
public void resetSelezione()
{
//lblStack.Text = "";
grView.SelectedIndex = -1;
grView.DataBind();
raiseEvent();
}
catch
{ }
return answ;
}
}
/// <summary>
/// comando reset
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
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();
}
/// <summary>
/// Formatta in min/sec il tempo in sec decimale
/// </summary>
/// <param name="_timeSec"></param>
/// <returns></returns>
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();
}
/// <summary>
/// Formatta in min/sec il tempo in sec decimale
/// </summary>
/// <param name="_timeSec"></param>
/// <returns></returns>
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;
}
/// <summary>
/// Num totale Sheets
/// </summary>
public int numSheets
{
get
{
return grView.Rows.Count;
}
/// <summary>
/// Num totale Sheets
/// </summary>
public int numSheets
{
get
{
return grView.Rows.Count;
}
}
}
}
}
+19 -19
View File
@@ -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)
{
}
/// <summary>
/// PArametro filtraggio errori
/// </summary>
public string Puid
{
get
{
return hfPuid.Value;
}
set
{
hfPuid.Value = value;
grView.DataBind();
}
}
}
/// <summary>
/// PArametro filtraggio errori
/// </summary>
public string Puid
{
get
{
return hfPuid.Value;
}
set
{
hfPuid.Value = value;
grView.DataBind();
}
}
}
}
+112 -112
View File
@@ -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;
}
}
}
}
+100 -105
View File
@@ -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
{
/// <summary>
/// Sheet corrente...
/// </summary>
public int SheetID
{
set
{
hfSheetID.Value = value.ToString();
doUpdate();
}
get
{
int answ = 0;
int.TryParse(hfSheetID.Value, out answ);
return answ;
}
}
/// <summary>
/// Indica se mostrare o meno QRCode
/// </summary>
public bool ShowQr
{
set
{
hfShowQr.Value = value.ToString();
}
get
{
bool answ = false;
bool.TryParse(hfShowQr.Value, out answ);
return answ;
}
}
/// <summary>
/// restituisce URL immagine QRCode
/// </summary>
/// <param name="currId"></param>
/// <returns></returns>
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
{
/// <summary>
/// Sheet corrente...
/// </summary>
public int SheetID
{
set
{
hfSheetID.Value = value.ToString();
doUpdate();
}
get
{
int answ = 0;
int.TryParse(hfSheetID.Value, out answ);
return answ;
}
}
/// <summary>
/// Indica se mostrare o meno QRCode
/// </summary>
public bool ShowQr
{
set
{
hfShowQr.Value = value.ToString();
}
get
{
bool answ = false;
bool.TryParse(hfShowQr.Value, out answ);
return answ;
}
}
/// <summary>
/// restituisce URL immagine QRCode
/// </summary>
/// <param name="currId"></param>
/// <returns></returns>
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();
}
/// <summary>
/// Dimensione QRCode
/// </summary>
public int qrSize
{
get
{
int answ = 32;
int.TryParse(hfQrSize.Value, out answ);
return answ;
}
set
{
hfQrSize.Value = value.ToString();
doUpdate();
}
}
/// <summary>
/// Calcola css da statusID
/// </summary>
/// <param name="_statusID"></param>
/// <returns></returns>
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();
}
/// <summary>
/// Dimensione QRCode
/// </summary>
public int qrSize
{
get
{
int answ = 32;
int.TryParse(hfQrSize.Value, out answ);
return answ;
}
set
{
hfQrSize.Value = value.ToString();
doUpdate();
}
}
/// <summary>
/// Calcola css da statusID
/// </summary>
/// <param name="_statusID"></param>
/// <returns></returns>
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;
}
}
}
+108 -113
View File
@@ -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
{
/// <summary>
/// Batch corrente...
/// </summary>
public int BatchId
{
set
{
hfBatchID.Value = value.ToString();
doUpdate();
}
get
{
int answ = 0;
int.TryParse(hfBatchID.Value, out answ);
return answ;
}
}
/// <summary>
/// Indica se mostrare o meno QRCode
/// </summary>
public bool ShowQr
{
set
{
hfShowQr.Value = value.ToString();
}
get
{
bool answ = false;
bool.TryParse(hfShowQr.Value, out answ);
return answ;
}
}
/// <summary>
/// restituisce URL immagine QRCode
/// </summary>
/// <param name="currId"></param>
/// <returns></returns>
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
{
/// <summary>
/// Batch corrente...
/// </summary>
public int BatchId
{
set
{
hfBatchID.Value = value.ToString();
doUpdate();
}
get
{
int answ = 0;
int.TryParse(hfBatchID.Value, out answ);
return answ;
}
}
/// <summary>
/// Indica se mostrare o meno QRCode
/// </summary>
public bool ShowQr
{
set
{
hfShowQr.Value = value.ToString();
}
get
{
bool answ = false;
bool.TryParse(hfShowQr.Value, out answ);
return answ;
}
}
/// <summary>
/// restituisce URL immagine QRCode
/// </summary>
/// <param name="currId"></param>
/// <returns></returns>
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();
}
/// <summary>
/// Calcola il rapporto tra 2 valori
/// </summary>
/// <param name="_dividendo"></param>
/// <param name="_divisore"></param>
/// <returns></returns>
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;
}
/// <summary>
/// determina CSS x colore testo da perc svuotamento...
/// </summary>
/// <param name="ratio"></param>
/// <returns></returns>
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;
}
/// <summary>
/// Dimensione QRCode
/// </summary>
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();
}
/// <summary>
/// Calcola il rapporto tra 2 valori
/// </summary>
/// <param name="_dividendo"></param>
/// <param name="_divisore"></param>
/// <returns></returns>
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;
}
/// <summary>
/// determina CSS x colore testo da perc svuotamento...
/// </summary>
/// <param name="ratio"></param>
/// <returns></returns>
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;
}
/// <summary>
/// Dimensione QRCode
/// </summary>
public int qrSize
{
get
{
int answ = 32;
int.TryParse(hfQrSize.Value, out answ);
return answ;
}
set
{
hfQrSize.Value = value.ToString();
doUpdate();
}
}
}
}
+108 -113
View File
@@ -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
{
/// <summary>
/// Batch corrente...
/// </summary>
public int BatchId
{
set
{
hfBatchID.Value = value.ToString();
doUpdate();
}
get
{
int answ = 0;
int.TryParse(hfBatchID.Value, out answ);
return answ;
}
}
/// <summary>
/// Indica se mostrare o meno QRCode
/// </summary>
public bool ShowQr
{
set
{
hfShowQr.Value = value.ToString();
}
get
{
bool answ = false;
bool.TryParse(hfShowQr.Value, out answ);
return answ;
}
}
/// <summary>
/// restituisce URL immagine QRCode
/// </summary>
/// <param name="currId"></param>
/// <returns></returns>
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
{
/// <summary>
/// Batch corrente...
/// </summary>
public int BatchId
{
set
{
hfBatchID.Value = value.ToString();
doUpdate();
}
get
{
int answ = 0;
int.TryParse(hfBatchID.Value, out answ);
return answ;
}
}
/// <summary>
/// Indica se mostrare o meno QRCode
/// </summary>
public bool ShowQr
{
set
{
hfShowQr.Value = value.ToString();
}
get
{
bool answ = false;
bool.TryParse(hfShowQr.Value, out answ);
return answ;
}
}
/// <summary>
/// restituisce URL immagine QRCode
/// </summary>
/// <param name="currId"></param>
/// <returns></returns>
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();
}
/// <summary>
/// Calcola il rapporto tra 2 valori
/// </summary>
/// <param name="_dividendo"></param>
/// <param name="_divisore"></param>
/// <returns></returns>
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;
}
/// <summary>
/// determina CSS x colore testo da perc svuotamento...
/// </summary>
/// <param name="ratio"></param>
/// <returns></returns>
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;
}
/// <summary>
/// Dimensione QRCode
/// </summary>
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();
}
/// <summary>
/// Calcola il rapporto tra 2 valori
/// </summary>
/// <param name="_dividendo"></param>
/// <param name="_divisore"></param>
/// <returns></returns>
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;
}
/// <summary>
/// determina CSS x colore testo da perc svuotamento...
/// </summary>
/// <param name="ratio"></param>
/// <returns></returns>
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;
}
/// <summary>
/// Dimensione QRCode
/// </summary>
public int qrSize
{
get
{
int answ = 32;
int.TryParse(hfQrSize.Value, out answ);
return answ;
}
set
{
hfQrSize.Value = value.ToString();
doUpdate();
}
}
}
}
@@ -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
{
/// <summary>
/// Batch corrente...
/// </summary>
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;
}
}
/// <summary>
/// Tipo statistica richiesta
/// </summary>
public int statLevel
{
set
{
hfStatLevel.Value = value.ToString();
}
get
{
int answ = 0;
int.TryParse(hfStatLevel.Value, out answ);
return answ;
}
/// <summary>
/// Batch corrente...
/// </summary>
public int BatchId
{
set
{
hfBatchID.Value = value.ToString();
doUpdate();
}
get
{
int answ = 0;
int.TryParse(hfBatchID.Value, out answ);
return answ;
}
}
/// <summary>
/// Tipo statistica richiesta
/// </summary>
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)
{
}
/// <summary>
/// Css titolo
/// </summary>
public string titleCss { get; set; } = "bg-dark text-light";
/// <summary>
/// Valirizzazione variabili
/// </summary>
public void doUpdate()
{
frmView.DataBind();
}
}
protected void Page_Load(object sender, EventArgs e)
{
}
/// <summary>
/// Css titolo
/// </summary>
public string titleCss { get; set; } = "bg-dark text-light";
/// <summary>
/// Valirizzazione variabili
/// </summary>
public void doUpdate()
{
frmView.DataBind();
}
}
}
+91 -96
View File
@@ -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
{
/// <summary>
/// Batch corrente...
/// </summary>
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;
}
/// <summary>
/// Batch corrente...
/// </summary>
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";
}
/// <summary>
/// Calcola il rapporto tra 2 valori
/// </summary>
/// <param name="_dividendo"></param>
/// <param name="_divisore"></param>
/// <returns></returns>
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;
}
/// <summary>
/// determina CSS x colore testo da perc svuotamento...
/// </summary>
/// <param name="ratio"></param>
/// <returns></returns>
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";
}
/// <summary>
/// Calcola il rapporto tra 2 valori
/// </summary>
/// <param name="_dividendo"></param>
/// <param name="_divisore"></param>
/// <returns></returns>
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;
}
/// <summary>
/// determina CSS x colore testo da perc svuotamento...
/// </summary>
/// <param name="ratio"></param>
/// <returns></returns>
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;
}
}
}
@@ -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)
{
}
}
}
}
+87 -91
View File
@@ -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
{
/// <summary>
/// BatchId corrente...
/// </summary>
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;
}
}
/// <summary>
/// Foglio corrente...
/// </summary>
public int SheetId
{
set
{
hfSheetId.Value = value.ToString();
doUpdate();
}
get
{
int answ = 0;
int.TryParse(hfSheetId.Value, out answ);
return answ;
}
}
/// <summary>
/// Percorso file calcolato
/// </summary>
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)
/// <summary>
/// BatchId corrente...
/// </summary>
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;
}
}
/// <summary>
/// Foglio corrente...
/// </summary>
public int SheetId
{
set
{
hfSheetId.Value = value.ToString();
doUpdate();
}
get
{
int answ = 0;
int.TryParse(hfSheetId.Value, out answ);
return answ;
}
}
/// <summary>
/// Percorso file calcolato
/// </summary>
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();
}
}
}
}
+19 -19
View File
@@ -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();
}
}
}
}
+1 -1
View File
@@ -53,7 +53,7 @@ namespace NKC_WF.WebUserControls
}
else
{
if(string.IsNullOrEmpty(lastCmd))
if (string.IsNullOrEmpty(lastCmd))
{
resetMessage();
}
+290 -290
View File
@@ -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<int> partListEstim = new List<int>();
List<int> partListEstimDupl = new List<int>();
List<int> partListNest = new List<int>();
List<int> partListNestDupl = new List<int>();
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<int> materialsList = new List<int>();
double num = 0;
double den = 1;
double currRatio = 0;
List<double> workRatio = new List<double>();
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: <b>{avgRatio:P1}</b> (<b>{minRatio:P1}</b> &rarr; <b>{maxRatio:P1}</b>) | {materialsList.Count} materials";
lblProdDet.Text = $"Bunks: <b>{nestAnsw.BunkList.Count}</b> | Sheets: <b>{totSheet}</b> | Carts: <b>{nestAnsw.CartList.Count}</b> | Bins: <b>{nestAnsw.BinList.Count}</b>";
// 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 = "<hr/>" + sbDebug.Replace("\r\n", "<br/>").ToString();
}
}
}
get
{
int answ = 0;
int.TryParse(hfBatchId.Value, out answ);
return answ;
}
}
/// <summary>
/// Effettua divisione evitando zeri a den...
/// </summary>
/// <param name="num"></param>
/// <param name="den"></param>
/// <returns></returns>
protected double ratioProt(double num, double den)
{
den = den == 0 ? 1 : den;
return num / den;
}
/// <summary>
/// Controlla se lo stato sia uguale a quello richiesto
/// </summary>
/// <param name="_status"></param>
/// <param name="statusReq"></param>
/// <returns></returns>
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;
}
/// <summary>
/// Converte il codice stato in effettivo campo
/// </summary>
/// <param name="_status"></param>
/// <returns></returns>
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<int> partListEstim = new List<int>();
List<int> partListEstimDupl = new List<int>();
List<int> partListNest = new List<int>();
List<int> partListNestDupl = new List<int>();
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<int> materialsList = new List<int>();
double num = 0;
double den = 1;
double currRatio = 0;
List<double> workRatio = new List<double>();
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: <b>{avgRatio:P1}</b> (<b>{minRatio:P1}</b> &rarr; <b>{maxRatio:P1}</b>) | {materialsList.Count} materials";
lblProdDet.Text = $"Bunks: <b>{nestAnsw.BunkList.Count}</b> | Sheets: <b>{totSheet}</b> | Carts: <b>{nestAnsw.CartList.Count}</b> | Bins: <b>{nestAnsw.BinList.Count}</b>";
// 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 = "<hr/>" + sbDebug.Replace("\r\n", "<br/>").ToString();
}
}
}
get
{
int answ = 0;
int.TryParse(hfBatchId.Value, out answ);
return answ;
}
}
/// <summary>
/// Effettua divisione evitando zeri a den...
/// </summary>
/// <param name="num"></param>
/// <param name="den"></param>
/// <returns></returns>
protected double ratioProt(double num, double den)
{
den = den == 0 ? 1 : den;
return num / den;
}
/// <summary>
/// Controlla se lo stato sia uguale a quello richiesto
/// </summary>
/// <param name="_status"></param>
/// <param name="statusReq"></param>
/// <returns></returns>
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;
}
/// <summary>
/// Converte il codice stato in effettivo campo
/// </summary>
/// <param name="_status"></param>
/// <returns></returns>
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());
}
}
}
}
+1 -2
View File
@@ -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
+185 -185
View File
@@ -4,197 +4,197 @@ using System.IO;
namespace NKC_WF.WebUserContols
{
public class FileUploadEventArgs : EventArgs
{
/// <summary>
/// Evento con argomenti soppevato post fileUpload
/// </summary>
/// <param name="localPath"></param>
/// <param name="fileName"></param>
/// <param name="batchName"></param>
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
{
/// <summary>
/// Evento upload e salvataggio su server IIS del file...
/// </summary>
public event EventHandler<FileUploadEventArgs> eh_FileUploaded;
/// <summary>
/// Solelva evento salvataggio file con messaggio path/nome
/// </summary>
/// <param name="localPath"></param>
/// <param name="fileName"></param>
public void reportFileUploaded(FileUploadEventArgs e)
{
EventHandler<FileUploadEventArgs> handler = eh_FileUploaded;
if (handler != null)
{
handler(this, e);
}
}
/// <summary>
/// Folder di upload temporaneo files
/// </summary>
protected string _tempUploadDir = memLayer.ML.CRS("_tempUploadDir");
/// <summary>
/// Folder REMOTA x copia verso SQL
/// </summary>
protected string _SqlCopyDir = memLayer.ML.CRS("_SqlCopyDir");
/// <summary>
/// Folder x SQL import
/// </summary>
protected string _SqlImportDir = memLayer.ML.CRS("_SqlImportDir");
/// <summary>
/// permesso scrittura SE E' abilitato a partire dalla tab diritti...
/// </summary>
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;
}
/// <summary>
/// Procedee a bonificare la cartella di upload dei files + vecchi di 3 mesi
/// </summary>
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)
/// <summary>
/// Evento con argomenti soppevato post fileUpload
/// </summary>
/// <param name="localPath"></param>
/// <param name="fileName"></param>
/// <param name="batchName"></param>
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);
}
}
/// <summary>
/// Indica se fare redirect post upload
/// </summary>
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");
}
/// <summary>
/// fix visibilità controllo file upload
/// </summary>
/// <param name="showAdd">mostra controlli add=true oppure nasconde = false</param>
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);
}
/// <summary>
/// Evento upload e salvataggio su server IIS del file...
/// </summary>
public event EventHandler<FileUploadEventArgs> eh_FileUploaded;
/// <summary>
/// Solelva evento salvataggio file con messaggio path/nome
/// </summary>
/// <param name="localPath"></param>
/// <param name="fileName"></param>
public void reportFileUploaded(FileUploadEventArgs e)
{
EventHandler<FileUploadEventArgs> handler = eh_FileUploaded;
if (handler != null)
{
handler(this, e);
}
}
}
/// <summary>
/// Folder di upload temporaneo files
/// </summary>
protected string _tempUploadDir = memLayer.ML.CRS("_tempUploadDir");
/// <summary>
/// Folder REMOTA x copia verso SQL
/// </summary>
protected string _SqlCopyDir = memLayer.ML.CRS("_SqlCopyDir");
/// <summary>
/// Folder x SQL import
/// </summary>
protected string _SqlImportDir = memLayer.ML.CRS("_SqlImportDir");
/// <summary>
/// permesso scrittura SE E' abilitato a partire dalla tab diritti...
/// </summary>
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;
}
/// <summary>
/// Procedee a bonificare la cartella di upload dei files + vecchi di 3 mesi
/// </summary>
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);
}
}
/// <summary>
/// Indica se fare redirect post upload
/// </summary>
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");
}
/// <summary>
/// fix visibilità controllo file upload
/// </summary>
/// <param name="showAdd">mostra controlli add=true oppure nasconde = false</param>
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);
}
}
}
+30 -30
View File
@@ -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("<b>{0}</b> v.{1}", ConfigurationManager.AppSettings.Get("appName"), System.Reflection.Assembly.GetExecutingAssembly().GetName().Version);
setTimer();
setClock();
}
/// <summary>
/// imposta il tempo di scadenza del timer x il refresh della pagina (della parte top) per evitare che la sessione sul server scada
/// </summary>
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("<b>{0}</b> v.{1}", ConfigurationManager.AppSettings.Get("appName"), System.Reflection.Assembly.GetExecutingAssembly().GetName().Version);
setTimer();
setClock();
}
/// <summary>
/// imposta il tempo di scadenza del timer x il refresh della pagina (della parte top) per evitare che la sessione sul server scada
/// </summary>
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})";
}
}
}
}
+35 -39
View File
@@ -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();
}
}
/// <summary>
/// aggiornamento del menù
/// </summary>
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();
}
}
/// <summary>
/// aggiornamento del menù
/// </summary>
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);
}
}
/// <summary>
/// Wrapper traduzione termini
/// </summary>
/// <param name="lemma"></param>
/// <returns></returns>
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);
}
}
/// <summary>
/// Wrapper traduzione termini
/// </summary>
/// <param name="lemma"></param>
/// <returns></returns>
public string traduci(string lemma)
{
return SteamWare.user_std.UtSn.Traduci(lemma);
}
}
}
+154 -154
View File
@@ -4,162 +4,162 @@ using System;
namespace NKC_WF.WebUserControls
{
public partial class cmp_kitImpCheck : BaseUserControl
{
/// <summary>
/// Folder x SQL import
/// </summary>
protected string _SqlImportDir = memLayer.ML.CRS("_SqlImportDir");
protected void Page_Load(object sender, EventArgs e)
public partial class cmp_kitImpCheck : BaseUserControl
{
}
/// <summary>
/// Nome file caricato
/// </summary>
public string fileName
{
get
{
return hfFileName.Value;
}
set
{
hfFileName.Value = value;
}
}
/// <summary>
/// Nome file caricato
/// </summary>
public string batchName
{
get
{
return hfBatchName.Value;
}
set
{
hfBatchName.Value = value;
}
}
/// <summary>
/// NUM TASK eseguito
/// </summary>
public int numTask
{
get
{
int answ = 0;
int.TryParse(hfNumTask.Value, out answ);
return answ;
}
set
{
hfNumTask.Value = value.ToString();
}
}
/// <summary>
/// Esito OK a check import
/// </summary>
public bool checkOk
{
get
{
bool answ = false;
bool.TryParse(hfCheckOk.Value, out answ);
return answ;
}
set
{
hfCheckOk.Value = value.ToString();
}
}
/// <summary>
/// File effettivamente caricato
/// </summary>
public bool imported
{
get
{
bool answ = false;
bool.TryParse(hfImported.Value, out answ);
return answ;
}
set
{
hfImported.Value = value.ToString();
}
}
/// <summary>
/// Verifico il file e aggiorno visualizazione di conseguenza
/// </summary>
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();
}
/// <summary>
/// Effettua un test di importazione o l'importazione effettiva
/// </summary>
/// <param name="testOnly">true= solo test, false= vero import (SE non ci sono errori)</param>
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)
/// <summary>
/// Folder x SQL import
/// </summary>
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();
}
/// <summary>
/// Nome file caricato
/// </summary>
public string fileName
{
get
{
return hfFileName.Value;
}
set
{
hfFileName.Value = value;
}
}
/// <summary>
/// Nome file caricato
/// </summary>
public string batchName
{
get
{
return hfBatchName.Value;
}
set
{
hfBatchName.Value = value;
}
}
/// <summary>
/// NUM TASK eseguito
/// </summary>
public int numTask
{
get
{
int answ = 0;
int.TryParse(hfNumTask.Value, out answ);
return answ;
}
set
{
hfNumTask.Value = value.ToString();
}
}
/// <summary>
/// Esito OK a check import
/// </summary>
public bool checkOk
{
get
{
bool answ = false;
bool.TryParse(hfCheckOk.Value, out answ);
return answ;
}
set
{
hfCheckOk.Value = value.ToString();
}
}
/// <summary>
/// File effettivamente caricato
/// </summary>
public bool imported
{
get
{
bool answ = false;
bool.TryParse(hfImported.Value, out answ);
return answ;
}
set
{
hfImported.Value = value.ToString();
}
}
/// <summary>
/// Verifico il file e aggiorno visualizazione di conseguenza
/// </summary>
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();
}
/// <summary>
/// Effettua un test di importazione o l'importazione effettiva
/// </summary>
/// <param name="testOnly">true= solo test, false= vero import (SE non ci sono errori)</param>
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();
}
}
}
}
+62 -66
View File
@@ -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
{
}
/// <summary>
/// comando reset
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
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;
}
}
/// <summary>
/// comando reset
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
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;
}
}
}
}
}
+4 -9
View File
@@ -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)
{
}
}
}
}
@@ -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)
{
}
}
}
}
+27 -32
View File
@@ -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 "";
}
}
}
File diff suppressed because it is too large Load Diff
+62 -66
View File
@@ -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}<br>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}<br>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}<br>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}<br>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());
}
}
}
}
}
+117 -121
View File
@@ -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();
}
}
/// <summary>
/// imposta visibilità search globale
/// </summary>
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());
}
}
/// <summary>
/// Valore ricerca attivo
/// </summary>
protected string searchVal
{
get
{
return txtSearch.Text.Trim();
}
set
{
txtSearch.Text = value.Trim();
}
}
/// <summary>
/// aggiornamento del menù
/// </summary>
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();
}
}
/// <summary>
/// imposta visibilità search globale
/// </summary>
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());
}
}
/// <summary>
/// Valore ricerca attivo
/// </summary>
protected string searchVal
{
get
{
return txtSearch.Text.Trim();
}
set
{
txtSearch.Text = value.Trim();
}
}
/// <summary>
/// aggiornamento del menù
/// </summary>
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);
}
}
/// <summary>
/// click su pagina corrente, fa update!
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void lbnUpdate_Click(object sender, EventArgs e)
{
doDataUpdate(true);
}
/// <summary>
/// effettua un update completo dei valori in sessione
/// </summary>
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);
}
}
/// <summary>
/// click su pagina corrente, fa update!
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void lbnUpdate_Click(object sender, EventArgs e)
{
doDataUpdate(true);
}
/// <summary>
/// effettua un update completo dei valori in sessione
/// </summary>
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();
}
}
}
+30 -35
View File
@@ -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();
}
}
}
}
@@ -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();
}
}
}
@@ -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();
}
}
}
}
@@ -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
{
@@ -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;
+168 -173
View File
@@ -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
{
/// <summary>
/// Testo titolo...
/// </summary>
public string titleText
{
set
{
lblTitle.Text = value;
}
get
{
return lblTitle.Text;
}
}
/// <summary>
/// Classe css titolo...
/// </summary>
public string titleClass
{
set
{
lblTitle.CssClass = value;
}
get
{
return lblTitle.CssClass;
}
}
/// <summary>
/// Batch corrente...
/// </summary>
public int BatchId
{
set
{
hfBatchID.Value = value.ToString();
doUpdate();
}
get
{
int answ = 0;
int.TryParse(hfBatchID.Value, out answ);
return answ;
}
}
/// <summary>
/// Indica se mostrare o meno QRCode
/// </summary>
public bool ShowQr
{
set
{
hfShowQr.Value = value.ToString();
}
get
{
bool answ = false;
bool.TryParse(hfShowQr.Value, out answ);
return answ;
}
}
/// <summary>
/// Indica se mostrare o meno COMPLETED
/// </summary>
public bool ShowComplete
{
set
{
hfShowComplete.Value = value.ToString();
}
get
{
bool answ = false;
bool.TryParse(hfShowComplete.Value, out answ);
return answ;
}
}
/// <summary>
/// Indica se mostrare o meno PAINTED
/// </summary>
public bool ShowPainted
{
set
{
hfShowPainted.Value = value.ToString();
}
get
{
bool answ = false;
bool.TryParse(hfShowPainted.Value, out answ);
return answ;
}
}
/// <summary>
/// restituisce URL immagine QRCode
/// </summary>
/// <param name="currId"></param>
/// <returns></returns>
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
{
/// <summary>
/// Testo titolo...
/// </summary>
public string titleText
{
set
{
lblTitle.Text = value;
}
get
{
return lblTitle.Text;
}
}
/// <summary>
/// Classe css titolo...
/// </summary>
public string titleClass
{
set
{
lblTitle.CssClass = value;
}
get
{
return lblTitle.CssClass;
}
}
/// <summary>
/// Batch corrente...
/// </summary>
public int BatchId
{
set
{
hfBatchID.Value = value.ToString();
doUpdate();
}
get
{
int answ = 0;
int.TryParse(hfBatchID.Value, out answ);
return answ;
}
}
/// <summary>
/// Indica se mostrare o meno QRCode
/// </summary>
public bool ShowQr
{
set
{
hfShowQr.Value = value.ToString();
}
get
{
bool answ = false;
bool.TryParse(hfShowQr.Value, out answ);
return answ;
}
}
/// <summary>
/// Indica se mostrare o meno COMPLETED
/// </summary>
public bool ShowComplete
{
set
{
hfShowComplete.Value = value.ToString();
}
get
{
bool answ = false;
bool.TryParse(hfShowComplete.Value, out answ);
return answ;
}
}
/// <summary>
/// Indica se mostrare o meno PAINTED
/// </summary>
public bool ShowPainted
{
set
{
hfShowPainted.Value = value.ToString();
}
get
{
bool answ = false;
bool.TryParse(hfShowPainted.Value, out answ);
return answ;
}
}
/// <summary>
/// restituisce URL immagine QRCode
/// </summary>
/// <param name="currId"></param>
/// <returns></returns>
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();
}
/// <summary>
/// Calcola il rapporto tra 2 valori
/// </summary>
/// <param name="_dividendo"></param>
/// <param name="_divisore"></param>
/// <returns></returns>
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;
}
/// <summary>
/// determina CSS x colore testo da perc svuotamento...
/// </summary>
/// <param name="ratio"></param>
/// <returns></returns>
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;
}
/// <summary>
/// Dimensione QRCode
/// </summary>
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();
}
/// <summary>
/// Calcola il rapporto tra 2 valori
/// </summary>
/// <param name="_dividendo"></param>
/// <param name="_divisore"></param>
/// <returns></returns>
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;
}
/// <summary>
/// determina CSS x colore testo da perc svuotamento...
/// </summary>
/// <param name="ratio"></param>
/// <returns></returns>
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;
}
/// <summary>
/// Dimensione QRCode
/// </summary>
public int qrSize
{
get
{
int answ = 32;
int.TryParse(hfQrSize.Value, out answ);
return answ;
}
set
{
hfQrSize.Value = value.ToString();
doUpdate();
}
}
}
}
+146 -151
View File
@@ -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
{
/// <summary>
/// Comando barcode letto
/// </summary>
protected string lastCmd
public partial class cmp_painting : BaseUserControl
{
get
{
return hfLastBCode.Value;
}
set
{
hfLastBCode.Value = value;
lastValidCmd = value;
}
}
/// <summary>
/// ULTIMO Comando barcode VALIDO (!="") letto
/// </summary>
protected string lastValidCmd
{
get
{
return hfLastValidBCode.Value;
}
set
{
// solo se è !=""
if (value != "")
/// <summary>
/// Comando barcode letto
/// </summary>
protected string lastCmd
{
hfLastValidBCode.Value = value;
get
{
return hfLastBCode.Value;
}
set
{
hfLastBCode.Value = value;
lastValidCmd = value;
}
}
/// <summary>
/// ULTIMO Comando barcode VALIDO (!="") letto
/// </summary>
protected string lastValidCmd
{
get
{
return hfLastValidBCode.Value;
}
set
{
// solo se è !=""
if (value != "")
{
hfLastValidBCode.Value = value;
}
}
}
/// <summary>
/// caricamento pagina
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
fixButtons();
cmp_barcode.eh_doRefresh += Cmp_barcode_eh_doRefresh;
}
}
}
/// <summary>
/// caricamento pagina
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
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();
}
}
}
}
+71 -71
View File
@@ -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();
}
}
}
}
@@ -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
{
+84 -89
View File
@@ -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
{
/// <summary>
/// Valore min ammesso
/// </summary>
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;
}
}
/// <summary>
/// Valore MAX ammesso
/// </summary>
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)
{
}
/// <summary>
/// Valore min ammesso
/// </summary>
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;
}
}
/// <summary>
/// Valore MAX ammesso
/// </summary>
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();
}
/// <summary>
/// valore selezionato
/// </summary>
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();
}
/// <summary>
/// valore selezionato
/// </summary>
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();
}
}
}
}
@@ -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;
@@ -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();
}
}
}
@@ -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;
File diff suppressed because it is too large Load Diff
@@ -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();
}
}
/// <summary>
/// fix visibilità buttons
/// </summary>
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();
}
}
/// <summary>
/// fix visibilità buttons
/// </summary>
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();
}
/// <summary>
/// Update forzato
/// </summary>
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();
}
/// <summary>
/// Update forzato
/// </summary>
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();
}
}
}
}
+40 -40
View File
@@ -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 = "";
}
}
/// <summary>
/// aggiorna i dati mostrati
/// </summary>
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 = "";
}
}
/// <summary>
/// aggiorna i dati mostrati
/// </summary>
public void doUpdate()
{
ods.DataBind();
grView.DataBind();
}
#endregion
}
}
+172 -172
View File
@@ -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();
}
/// <summary>
/// cambiato valore in ricerca
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void txtCerca_TextChanged(object sender, EventArgs e)
{
salvaCerca();
}
/// <summary>
/// effettuato reset
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void lnkReset_Click(object sender, EventArgs e)
{
txtCerca.Text = "";
salvaCerca();
}
/// <summary>
/// pressione del button di ricerca
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnCerca_Click(object sender, EventArgs e)
{
salvaCerca();
}
/// <summary>
/// testo ricerca trimmato da spazi
/// </summary>
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)
/// <summary>
/// cambiato valore in ricerca
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void txtCerca_TextChanged(object sender, EventArgs e)
{
salvaCercaUsername();
salvaCerca();
}
// raise dell'evento
if (eh_nuovaRicerca != null)
/// <summary>
/// effettuato reset
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void lnkReset_Click(object sender, EventArgs e)
{
eh_nuovaRicerca(this, new EventArgs());
txtCerca.Text = "";
salvaCerca();
}
}
/// <summary>
/// pressione del button di ricerca
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnCerca_Click(object sender, EventArgs e)
{
salvaCerca();
}
/// <summary>
/// testo ricerca trimmato da spazi
/// </summary>
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());
}
}
}
/// <summary>
/// ricerca utenti e salva lista matricole x SQL IN
/// </summary>
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);
}
/// <summary>
/// ricerca utenti e salva lista username x SQL IN
/// </summary>
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
/// <summary>
/// aggiorna il testo cercato
/// </summary>
public void updateText()
{
if (SteamWare.memLayer.ML.StringSessionObj("valoreCercato") != "" && !Page.IsPostBack)
{
testoRicerca = SteamWare.memLayer.ML.StringSessionObj("valoreCercato");
}
}
/// <summary>
/// indica se generare da stringa search un elenco delle matricole corrispondenti
/// </summary>
public bool cercaMatricole
{
get
{
return _cercaMatricole;
}
set
{
_cercaMatricole = value;
}
}
/// <summary>
/// indica se generare da stringa search un elenco di username corrispondenti
/// </summary>
public bool cercaUsername
{
get
{
return _cercaUsername;
}
set
{
_cercaUsername = value;
}
}
#endregion
}
/// <summary>
/// ricerca utenti e salva lista matricole x SQL IN
/// </summary>
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);
}
/// <summary>
/// ricerca utenti e salva lista username x SQL IN
/// </summary>
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
/// <summary>
/// aggiorna il testo cercato
/// </summary>
public void updateText()
{
if (SteamWare.memLayer.ML.StringSessionObj("valoreCercato") != "" && !Page.IsPostBack)
{
testoRicerca = SteamWare.memLayer.ML.StringSessionObj("valoreCercato");
}
}
/// <summary>
/// indica se generare da stringa search un elenco delle matricole corrispondenti
/// </summary>
public bool cercaMatricole
{
get
{
return _cercaMatricole;
}
set
{
_cercaMatricole = value;
}
}
/// <summary>
/// indica se generare da stringa search un elenco di username corrispondenti
/// </summary>
public bool cercaUsername
{
get
{
return _cercaUsername;
}
set
{
_cercaUsername = value;
}
}
#endregion
}
}
+95 -95
View File
@@ -4,107 +4,107 @@ using System.Web.UI;
namespace NKC_WF.WebUserControls
{
public partial class mod_righePag : System.Web.UI.UserControl
{
/// <summary>
/// indicato (nuovo) numero righe x pagina
/// </summary>
public event EventHandler eh_newNum;
/// <summary>
/// caricamento pagina
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
public partial class mod_righePag : System.Web.UI.UserControl
{
if (!Page.IsPostBack)
{
numRowReq = numRowPag;
}
}
/// <summary>
/// stringa UID univoca
/// </summary>
public string uid
{
get
{
return this.UniqueID.Replace("$", "_").Replace("-", "_");
}
}
/// <summary>
/// effettua traduzione del lemma
/// </summary>
/// <param name="lemma"></param>
/// <returns></returns>
public string traduci(string lemma)
{
return user_std.UtSn.Traduci(lemma);
}
/// <summary>
/// aggiorno controllo paginazione...
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
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());
}
}
/// <summary>
/// numero righe per pagina (in sessione)
/// </summary>
public int numRowPag
{
get
{
int answ = 10;
try
/// <summary>
/// indicato (nuovo) numero righe x pagina
/// </summary>
public event EventHandler eh_newNum;
/// <summary>
/// caricamento pagina
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
answ = memLayer.ML.IntSessionObj(uid + "_numRowPag");
if (!Page.IsPostBack)
{
numRowReq = numRowPag;
}
}
catch
/// <summary>
/// stringa UID univoca
/// </summary>
public string uid
{
answ = 10;
get
{
return this.UniqueID.Replace("$", "_").Replace("-", "_");
}
}
return answ;
}
set
{
memLayer.ML.setSessionVal(uid + "_numRowPag", value);
numRowReq = value;
}
}
/// <summary>
/// numero righe gridview da mostrare legato a controllo textbox
/// </summary>
protected int numRowReq
{
get
{
int answ = numRowPag;
try
/// <summary>
/// effettua traduzione del lemma
/// </summary>
/// <param name="lemma"></param>
/// <returns></returns>
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);
}
/// <summary>
/// aggiorno controllo paginazione...
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
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());
}
}
/// <summary>
/// numero righe per pagina (in sessione)
/// </summary>
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;
}
}
/// <summary>
/// numero righe gridview da mostrare legato a controllo textbox
/// </summary>
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();
}
}
}
}
+138 -138
View File
@@ -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
/// <summary>
/// inserisco nel db il nuovo lemma...
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnNewLemma_Click(object sender, EventArgs e)
{
creaNuovoLemma();
}
/// <summary>
/// creazione nuovo lemma
/// </summary>
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();
}
/// <summary>
/// dimensione pagina grid view
/// </summary>
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 = "";
}
/// <summary>
/// inserisco nel db il nuovo lemma...
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnNewLemma_Click(object sender, EventArgs e)
{
creaNuovoLemma();
}
/// <summary>
/// creazione nuovo lemma
/// </summary>
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();
}
/// <summary>
/// dimensione pagina grid view
/// </summary>
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
/// <summary>
/// resetta la selezione dei valori in caso di modifiche su altri controlli
/// </summary>
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
/// <summary>
/// resetta la selezione dei valori in caso di modifiche su altri controlli
/// </summary>
public void resetSelezione()
{
SteamWare.memLayer.ML.emptySessionVal("lemma_sel");
grView.SelectedIndex = -1;
grView.DataBind();
if (eh_resetSelezione != null)
{
eh_resetSelezione(this, new EventArgs());
}
}
#endregion
}
}
+4 -9
View File
@@ -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)
{
}
}
}
}
+1 -1
View File
@@ -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" %>
<!DOCTYPE html>
+7 -6
View File
@@ -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)
{
+1 -1
View File
@@ -7,7 +7,7 @@
// </generato automaticamente>
//------------------------------------------------------------------------------
namespace NKC_WF.export
namespace NKC_WF
{
+4 -8
View File
@@ -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)
{
}
}
}
}
+252 -255
View File
@@ -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
{
/// <summary>
/// Batch corrente...
/// </summary>
public int BatchId
public partial class BatchPreview : System.Web.UI.Page
{
get
{
int answ = memLayer.ML.QSI("BatchId");
return answ;
}
}
/// <summary>
/// Indice bunk selezionato (0..n-1)
/// </summary>
protected int bunkIndex
{
get
{
return cmp_BP_bunkList.selIndex;
}
set
{
cmp_BP_bunkList.selIndex = value;
}
}
/// <summary>
/// BunkId selezionato
/// </summary>
protected int BunkId
{
get
{
return cmp_BP_bunkList.BunkIdSel;
}
}
/// <summary>
/// Indice sheet selezionato (0..n-1)
/// </summary>
protected int sheetIndex
{
get
{
return cmp_BP_sheetList.selIndex;
}
set
{
cmp_BP_sheetList.selIndex = value;
}
}
/// <summary>
/// BunkId selezionato
/// </summary>
protected int SheetId
{
get
{
return cmp_BP_sheetList.SheetIdSel;
}
}
/// <summary>
/// valore selezionato nello slider
/// </summary>
protected int valSlider
{
get
{
return cmp_slider.selValue;
}
set
{
cmp_slider.selValue = value;
}
}
/// <summary>
/// Chaive URL base x gestione sheet del batch corrente
/// </summary>
protected string tabSheetKey;
/// <summary>
/// Elenco fogli della gestione corrente
/// </summary>
protected DS_App.SheetListDataTable tabSheets
{
get
{
DS_App.SheetListDataTable answ = null;
string rawData = memLayer.ML.getRSV(tabSheetKey);
if (string.IsNullOrEmpty(rawData))
/// <summary>
/// Batch corrente...
/// </summary>
public int BatchId
{
answ = DataLayer.man.taSHL.getByBatch(BatchId);
tabSheets = answ;
get
{
int answ = memLayer.ML.QSI("BatchId");
return answ;
}
}
else
/// <summary>
/// Indice bunk selezionato (0..n-1)
/// </summary>
protected int bunkIndex
{
answ = JsonConvert.DeserializeObject<DS_App.SheetListDataTable>(rawData);
get
{
return cmp_BP_bunkList.selIndex;
}
set
{
cmp_BP_bunkList.selIndex = value;
}
}
/// <summary>
/// BunkId selezionato
/// </summary>
protected int BunkId
{
get
{
return cmp_BP_bunkList.BunkIdSel;
}
}
/// <summary>
/// Indice sheet selezionato (0..n-1)
/// </summary>
protected int sheetIndex
{
get
{
return cmp_BP_sheetList.selIndex;
}
set
{
cmp_BP_sheetList.selIndex = value;
}
}
/// <summary>
/// BunkId selezionato
/// </summary>
protected int SheetId
{
get
{
return cmp_BP_sheetList.SheetIdSel;
}
}
/// <summary>
/// valore selezionato nello slider
/// </summary>
protected int valSlider
{
get
{
return cmp_slider.selValue;
}
set
{
cmp_slider.selValue = value;
}
}
/// <summary>
/// Chaive URL base x gestione sheet del batch corrente
/// </summary>
protected string tabSheetKey;
/// <summary>
/// Elenco fogli della gestione corrente
/// </summary>
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<DS_App.SheetListDataTable>(rawData);
}
return answ;
}
set
{
string rawData = JsonConvert.SerializeObject(value);
memLayer.ML.setRSV(tabSheetKey, rawData, 60);
}
}
/// <summary>
/// Restituisce la riga dall'indice inserito (
/// </summary>
/// <param name="indice">valore 1..maxSheets</param>
/// <returns></returns>
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;
}
/// <summary>
/// Restituisce la PRIMA riga dal codice BUNK inserito
/// </summary>
/// <param name="BunkId">valore 1..numBunk</param>
/// <returns></returns>
protected DS_App.SheetListRow rigaByBunk(int BunkId)
{
DS_App.SheetListRow answ = null;
try
{
answ = tabSheets.First(x => x.StackID == BunkId);
}
catch
{ }
// restituisco!
return answ;
}
/// <summary>
/// Restituisce la riga dal codice Sheet inserito
/// </summary>
/// <param name="SheetId">valore 1..numBunk</param>
/// <returns></returns>
protected DS_App.SheetListRow rigaBySheet(int SheetId)
{
DS_App.SheetListRow answ = null;
try
{
answ = tabSheets.First(x => x.StackID == SheetId);
}
catch
{ }
// restituisco!
return answ;
}
/// <summary>
/// caicamento pagina
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
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;
}
/// <summary>
/// Setup slider da num fogli
/// </summary>
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);
}
}
/// <summary>
/// Restituisce la riga dall'indice inserito (
/// </summary>
/// <param name="indice">valore 1..maxSheets</param>
/// <returns></returns>
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;
}
/// <summary>
/// Restituisce la PRIMA riga dal codice BUNK inserito
/// </summary>
/// <param name="BunkId">valore 1..numBunk</param>
/// <returns></returns>
protected DS_App.SheetListRow rigaByBunk(int BunkId)
{
DS_App.SheetListRow answ = null;
try
{
answ = tabSheets.First(x => x.StackID == BunkId);
}
catch
{ }
// restituisco!
return answ;
}
/// <summary>
/// Restituisce la riga dal codice Sheet inserito
/// </summary>
/// <param name="SheetId">valore 1..numBunk</param>
/// <returns></returns>
protected DS_App.SheetListRow rigaBySheet(int SheetId)
{
DS_App.SheetListRow answ = null;
try
{
answ = tabSheets.First(x => x.StackID == SheetId);
}
catch
{ }
// restituisco!
return answ;
}
/// <summary>
/// caicamento pagina
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
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;
}
/// <summary>
/// Setup slider da num fogli
/// </summary>
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();
}
/// <summary>
/// Effettua update da Slider --> valore selezionato
/// </summary>
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();
}
/// <summary>
/// Effettua update da Slider --> valore selezionato
/// </summary>
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;
}
}
}
}
+5 -9
View File
@@ -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;
}
}
}
}
+105 -109
View File
@@ -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();
}
}
/// <summary>
/// BatchId corrente...
/// </summary>
public int BatchId
{
set
{
hfBatchID.Value = value.ToString();
}
get
{
int answ = 0;
int.TryParse(hfBatchID.Value, out answ);
return answ;
}
}/// <summary>
/// SheetId corrente...
/// </summary>
public int SheetId
{
set
{
hfSheetID.Value = value.ToString();
}
get
{
int answ = 0;
int.TryParse(hfSheetID.Value, out answ);
return answ;
}
}
/// <summary>
/// restituisce URL immagine QRCode
/// </summary>
/// <returns></returns>
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;
}
}
/// <summary>
/// Aggiorna componente principale e child components
/// </summary>
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;
}
/// <summary>
/// Imposta dati correnti (Bunk / Sheet)
/// </summary>
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();
}
}
/// <summary>
/// BatchId corrente...
/// </summary>
public int BatchId
{
set
{
hfBatchID.Value = value.ToString();
}
get
{
int answ = 0;
int.TryParse(hfBatchID.Value, out answ);
return answ;
}
}/// <summary>
/// SheetId corrente...
/// </summary>
public int SheetId
{
set
{
hfSheetID.Value = value.ToString();
}
get
{
int answ = 0;
int.TryParse(hfSheetID.Value, out answ);
return answ;
}
}
/// <summary>
/// restituisce URL immagine QRCode
/// </summary>
/// <returns></returns>
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;
}
}
/// <summary>
/// Aggiorna componente principale e child components
/// </summary>
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;
}
/// <summary>
/// Imposta dati correnti (Bunk / Sheet)
/// </summary>
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();
}
}
}
}
+14 -18
View File
@@ -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");
}
/// <summary>
/// Wrapper traduzione termini
/// </summary>
/// <param name="lemma"></param>
/// <returns></returns>
public string traduci(string lemma)
{
return SteamWare.user_std.UtSn.Traduci(lemma);
}
}
/// <summary>
/// Wrapper traduzione termini
/// </summary>
/// <param name="lemma"></param>
/// <returns></returns>
public string traduci(string lemma)
{
return SteamWare.user_std.UtSn.Traduci(lemma);
}
}
}
+1 -1
View File
@@ -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" %>
+8 -12
View File
@@ -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;
}
}
}
}
}
+10 -10
View File
@@ -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;
}
}
}
}
}
}
}
+10 -5
View File
@@ -6,9 +6,14 @@
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
<div class="display-4 text-center border border-info rounded mb-2">Advanced <span class="text-info">SEARCH</span></div>
<uc1:cmp_barcode runat="server" ID="cmp_barcode" />
<asp:HiddenField runat="server" ID="hfLastBCode" />
<asp:HiddenField runat="server" ID="hfLastValidBCode" />
<uc1:cmp_searchItems runat="server" ID="cmp_searchItems" />
<div class="card text-center" style="width: 100%;">
<h3 class="card-header"><%: traduci("Advanced") %> <span class="text-info text-uppercase"><%: traduci("Search") %></span></h3>
<div class="card-body py-1">
<div class="display-4 text-center border border-info rounded mb-2"></div>
<uc1:cmp_barcode runat="server" ID="cmp_barcode" />
<asp:HiddenField runat="server" ID="hfLastBCode" />
<asp:HiddenField runat="server" ID="hfLastValidBCode" />
<uc1:cmp_searchItems runat="server" ID="cmp_searchItems" />
</div>
</div>
</asp:Content>
+3 -7
View File
@@ -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
{
/// <summary>
/// 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;
}
+8 -12
View File
@@ -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;
}
}
}
}
}
+68 -68
View File
@@ -5,74 +5,74 @@ using System.Web.UI;
namespace NKC_WF
{
public partial class KitRequestImporter : BasePage
{
/// <summary>
/// Folder REMOTA x copia verso SQL
/// </summary>
protected string _SqlCopyDir = memLayer.ML.CRS("_SqlCopyDir");
/// <summary>
/// Folder x SQL import
/// </summary>
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;
/// <summary>
/// Folder REMOTA x copia verso SQL
/// </summary>
protected string _SqlCopyDir = memLayer.ML.CRS("_SqlCopyDir");
/// <summary>
/// Folder x SQL import
/// </summary>
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();
}
/// <summary>
/// Ora continuo processing
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
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();
}
/// <summary>
/// Ora continuo processing
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
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()
{
}
}
}
-5
View File
@@ -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
{
+8 -12
View File
@@ -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;
}
}
}
}
}
+46 -50
View File
@@ -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();
}
}
/// <summary>
/// Batch corrente...
/// </summary>
public int BatchId
{
set
{
hfBatchID.Value = value.ToString();
}
get
{
int answ = 0;
int.TryParse(hfBatchID.Value, out answ);
return answ;
}
}
/// <summary>
/// Aggiorna componente principale e child components
/// </summary>
private void doUpdate()
{
setCurrData();
// aggiorno child
cmp_kittingSmart.BatchId = BatchId;
}
/// <summary>
/// Imposta dati correnti (Bunk / Sheet)
/// </summary>
private void setCurrData()
{
// recupero bunk corrente...
DS_App.StackListRow currBunk = ComLib.getCurrBunk();
if (currBunk != null)
{
BatchId = currBunk.BatchID;
}
}
}
/// <summary>
/// Batch corrente...
/// </summary>
public int BatchId
{
set
{
hfBatchID.Value = value.ToString();
}
get
{
int answ = 0;
int.TryParse(hfBatchID.Value, out answ);
return answ;
}
}
/// <summary>
/// Aggiorna componente principale e child components
/// </summary>
private void doUpdate()
{
setCurrData();
// aggiorno child
cmp_kittingSmart.BatchId = BatchId;
}
/// <summary>
/// Imposta dati correnti (Bunk / Sheet)
/// </summary>
private void setCurrData()
{
// recupero bunk corrente...
DS_App.StackListRow currBunk = ComLib.getCurrBunk();
if (currBunk != null)
{
BatchId = currBunk.BatchID;
}
}
}
}
+8 -12
View File
@@ -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;
}
}
}
}
}
+23 -28
View File
@@ -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);
}
}
}
}
+9 -14
View File
@@ -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();
}
}
}
}
+74 -75
View File
@@ -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();
}
}
/// <summary>
/// BatchId corrente...
/// </summary>
public int BatchId
{
set
{
hfBatchID.Value = value.ToString();
}
get
{
int answ = 0;
int.TryParse(hfBatchID.Value, out answ);
return answ;
}
}
/// <summary>
/// SheetId corrente...
/// </summary>
public int SheetId
{
set
{
hfSheetID.Value = value.ToString();
}
get
{
int answ = 0;
int.TryParse(hfSheetID.Value, out answ);
return answ;
}
}
/// <summary>
/// Aggiorna componente principale e child components
/// </summary>
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;
}
/// <summary>
/// Imposta dati correnti (Bunk / Sheet)
/// </summary>
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();
}
}
/// <summary>
/// BatchId corrente...
/// </summary>
public int BatchId
{
set
{
hfBatchID.Value = value.ToString();
}
get
{
int answ = 0;
int.TryParse(hfBatchID.Value, out answ);
return answ;
}
}
/// <summary>
/// SheetId corrente...
/// </summary>
public int SheetId
{
set
{
hfSheetID.Value = value.ToString();
}
get
{
int answ = 0;
int.TryParse(hfSheetID.Value, out answ);
return answ;
}
}
/// <summary>
/// Aggiorna componente principale e child components
/// </summary>
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;
}
/// <summary>
/// Imposta dati correnti (Bunk / Sheet)
/// </summary>
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;
}
}
}
}
+46 -46
View File
@@ -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();
}
}
/// <summary>
/// Batch corrente...
/// </summary>
public int BatchId
{
set
{
hfBatchID.Value = value.ToString();
}
get
{
int answ = 0;
int.TryParse(hfBatchID.Value, out answ);
return answ;
}
}
/// <summary>
/// Aggiorna componente principale e child components
/// </summary>
private void doUpdate()
{
setCurrData();
// aggiorno child
cmp_unloadSmart.BatchId = BatchId;
}
/// <summary>
/// Imposta dati correnti (Bunk / Sheet)
/// </summary>
private void setCurrData()
{
// recupero bunk corrente...
DS_App.StackListRow currBunk = ComLib.getCurrBunk();
if (currBunk != null)
{
BatchId = currBunk.BatchID;
}
}
}
/// <summary>
/// Batch corrente...
/// </summary>
public int BatchId
{
set
{
hfBatchID.Value = value.ToString();
}
get
{
int answ = 0;
int.TryParse(hfBatchID.Value, out answ);
return answ;
}
}
/// <summary>
/// Aggiorna componente principale e child components
/// </summary>
private void doUpdate()
{
setCurrData();
// aggiorno child
cmp_unloadSmart.BatchId = BatchId;
}
/// <summary>
/// Imposta dati correnti (Bunk / Sheet)
/// </summary>
private void setCurrData()
{
// recupero bunk corrente...
DS_App.StackListRow currBunk = ComLib.getCurrBunk();
if (currBunk != null)
{
BatchId = currBunk.BatchID;
}
}
}
}
+211 -211
View File
@@ -6,228 +6,228 @@ using System.Web.UI;
namespace NKC_WF
{
public partial class OrderManager : BasePage
{
/// <summary>
/// Folder REMOTA x copia verso SQL
/// </summary>
protected string _SqlCopyDir = memLayer.ML.CRS("_SqlCopyDir");
/// <summary>
/// Folder x SQL import
/// </summary>
protected string _SqlImportDir = memLayer.ML.CRS("_SqlImportDir");
/// <summary>
/// Path base x nesting
/// </summary>
protected string cadBasePath = $"{memLayer.ML.CRS("nestBasePath")}{memLayer.ML.CRS("drawingFolder")}/";
/// <summary>
/// Path base x server
/// </summary>
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;
}
/// <summary>
/// Ora continuo processing
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Cmp_fileUpload_eh_FileUploaded(object sender, WebUserContols.FileUploadEventArgs e)
public partial class OrderManager : BasePage
{
/// <summary>
/// Folder REMOTA x copia verso SQL
/// </summary>
protected string _SqlCopyDir = memLayer.ML.CRS("_SqlCopyDir");
/// <summary>
/// Folder x SQL import
/// </summary>
protected string _SqlImportDir = memLayer.ML.CRS("_SqlImportDir");
/// <summary>
/// Path base x nesting
/// </summary>
protected string cadBasePath = $"{memLayer.ML.CRS("nestBasePath")}{memLayer.ML.CRS("drawingFolder")}/";
/// <summary>
/// Path base x server
/// </summary>
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;
}
/// <summary>
/// Ora continuo processing
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
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();
}
/// <summary>
/// Effettua validazione dati
/// </summary>
private bool doValidations(int batchID)
{
bool allOk = true;
List<string> missingDxfList = new List<string>();
// 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();
}
/// <summary>
/// Effettua validazione dati
/// </summary>
private bool doValidations(int batchID)
{
bool allOk = true;
List<string> missingDxfList = new List<string>();
// 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();
}
/// <summary>
/// Update interfaccia
/// </summary>
public void doUpdate()
{
cmp_batchList.doUpdate();
}
private void Cmp_batchList_eh_doRefresh(object sender, EventArgs e)
{
doUpdate();
}
/// <summary>
/// Update interfaccia
/// </summary>
public void doUpdate()
{
cmp_batchList.doUpdate();
}
}
}
}
-5
View File
@@ -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
{
+5 -10
View File
@@ -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;
}
}
}
}
+14 -14
View File
@@ -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();
}
}
}
}
+4 -9
View File
@@ -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)
{
}
}
}
}

Some files were not shown because too many files have changed in this diff Show More