Update x logging & fix data-ora su avanzamento fogli se ci fossero mancanti
This commit is contained in:
@@ -923,6 +923,27 @@ namespace NKC_SDK
|
||||
/// </summary>
|
||||
public int SheetIndex { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Indica che tutte le date (printing, working, unloading) sono vuote = Waiting / NON iniziato
|
||||
/// </summary>
|
||||
public bool Waiting
|
||||
{
|
||||
get
|
||||
{
|
||||
return Printing.Waiting && Machining.Waiting && Unloading.Waiting;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Indica che tutte le date (printing, working, unloading) sono VALIDE = completato
|
||||
/// </summary>
|
||||
public bool Done
|
||||
{
|
||||
get
|
||||
{
|
||||
return Printing.Done && Machining.Done && Unloading.Done;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
@@ -1011,6 +1032,47 @@ namespace NKC_SDK
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Verifica data Start
|
||||
/// </summary>
|
||||
public bool OkS
|
||||
{
|
||||
get
|
||||
{
|
||||
return DtStart != null;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Verifica data End
|
||||
/// </summary>
|
||||
public bool OkE
|
||||
{
|
||||
get
|
||||
{
|
||||
return DtEnd != null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tutte date null --> in attesa
|
||||
/// </summary>
|
||||
public bool Waiting
|
||||
{
|
||||
get
|
||||
{
|
||||
return DtStart == null && DtEnd == null;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Tutte date NOT null --> completato
|
||||
/// </summary>
|
||||
public bool Done
|
||||
{
|
||||
get
|
||||
{
|
||||
return DtStart != null && DtEnd != null;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using AppData;
|
||||
using Newtonsoft.Json;
|
||||
using NKC_SDK;
|
||||
using SteamWare;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Web.Http;
|
||||
@@ -9,19 +10,17 @@ namespace NKC_WF.Controllers
|
||||
{
|
||||
public class SheetController : ApiController
|
||||
{
|
||||
#region Protected Fields
|
||||
#region Public Constructors
|
||||
|
||||
/// <summary>
|
||||
/// oggetto static/singleton per fare chiamate sul datalayer
|
||||
/// </summary>
|
||||
protected DataLayer DLMan = new DataLayer();
|
||||
public SheetController()
|
||||
{
|
||||
dfWrkStart = memLayer.ML.CRB("dateFix_WrkStart");
|
||||
dfWrkEnd = memLayer.ML.CRB("dateFix_WrkEnd");
|
||||
dfUnlStart = memLayer.ML.CRB("dateFix_UnlStart");
|
||||
dfUnlEnd = memLayer.ML.CRB("dateFix_UnlEnd");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// COdice macchina (HARD CODED)
|
||||
/// </summary>
|
||||
protected string machine = "WRK001";
|
||||
|
||||
#endregion Protected Fields
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Methods
|
||||
|
||||
@@ -65,25 +64,10 @@ namespace NKC_WF.Controllers
|
||||
{
|
||||
Log.Instance.Error($"EXCEPTION api/Sheet | get({id}){Environment.NewLine}{exc}");
|
||||
}
|
||||
Log.Instance.Trace($"api/Sheet | get({id}) | answ: {answ}");
|
||||
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>
|
||||
/// Processa una chiamata POST per l'invio in blocco status BUNK
|
||||
/// POST: api/Bunk
|
||||
@@ -116,21 +100,25 @@ namespace NKC_WF.Controllers
|
||||
|
||||
if (sheetUpdated.SheetList != null)
|
||||
{
|
||||
// salvo macchina
|
||||
machine = sheetUpdated.Machine;
|
||||
foreach (var currSheet in sheetUpdated.SheetList)
|
||||
{
|
||||
// se non nullo...
|
||||
if (currSheet != null)
|
||||
{
|
||||
DLMan.taSHL.updateDate(currSheet.SheetId, currSheet.Printing.DtStart, currSheet.Printing.DtEnd, currSheet.Machining.DtStart, currSheet.Machining.DtEnd, currSheet.Unloading.DtStart, currSheet.Unloading.DtEnd, (int)currSheet.Status);
|
||||
// verifico il fixSheet
|
||||
ProdSheetExt fixSheet = checkFixSheet(currSheet);
|
||||
DLMan.taSHL.updateDate(fixSheet.SheetId, fixSheet.Printing.DtStart, fixSheet.Printing.DtEnd, fixSheet.Machining.DtStart, fixSheet.Machining.DtEnd, fixSheet.Unloading.DtStart, fixSheet.Unloading.DtEnd, (int)fixSheet.Status);
|
||||
// SE machining completato --> status a LAVORATO x item!
|
||||
if (currSheet.Machining.DtEnd != null)
|
||||
if (fixSheet.Machining.DtEnd != null)
|
||||
{
|
||||
// hard coded su multiax
|
||||
DLMan.taIL.updateSheetStatus(currSheet.SheetId, 1, sheetUpdated.Machine);
|
||||
DLMan.taIL.updateSheetStatus(fixSheet.SheetId, 1, sheetUpdated.Machine);
|
||||
}
|
||||
// segnalo avanzamento su redis x pagina unload
|
||||
ComLib.advaceSheetRevByBunk(currSheet.BunkId);
|
||||
BunkId = currSheet.BunkId;
|
||||
ComLib.advaceSheetRevByBunk(fixSheet.BunkId);
|
||||
BunkId = fixSheet.BunkId;
|
||||
answ = "OK";
|
||||
}
|
||||
}
|
||||
@@ -150,11 +138,30 @@ namespace NKC_WF.Controllers
|
||||
{
|
||||
answ = "NO";
|
||||
}
|
||||
Log.Instance.Trace($"api/Sheet | post() | machine: {machine} | BatchId: {BatchId} | answ: {answ}");
|
||||
return answ;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Effettua la chiamata di update x SINGOLO foglio
|
||||
///
|
||||
///
|
||||
/// ***********************************
|
||||
/// 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" /r esourceType="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="%w indir/%//\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" ///t ype="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" responseBufferLimit="0" />
|
||||
///
|
||||
/// *************************************/
|
||||
/// </summary>
|
||||
/// <param name="sheetUpdated">Oggetto con Elenco fogli da aggiornare</param>
|
||||
/// PUT: api/Sheet/machine_ID
|
||||
@@ -162,8 +169,7 @@ namespace NKC_WF.Controllers
|
||||
public void Put(SheetWorkList sheetUpdated)
|
||||
{
|
||||
// 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
|
||||
// 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
|
||||
int BunkId = 0;
|
||||
int BatchId = 0;
|
||||
if (sheetUpdated != null)
|
||||
@@ -205,5 +211,121 @@ namespace NKC_WF.Controllers
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
/// <summary>
|
||||
/// oggetto static/singleton per fare chiamate sul datalayer
|
||||
/// </summary>
|
||||
protected DataLayer DLMan = new DataLayer();
|
||||
|
||||
/// <summary>
|
||||
/// COdice macchina (HARD CODED)
|
||||
/// </summary>
|
||||
protected string machine = "WRK001";
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Private Fields
|
||||
|
||||
/// <summary>
|
||||
/// Forza fix date al momento ricezione UnlEnd valido
|
||||
/// </summary>
|
||||
private bool dfUnlEnd = false;
|
||||
|
||||
/// <summary>
|
||||
/// Forza fix date al momento ricezione UnlStart valido
|
||||
/// </summary>
|
||||
private bool dfUnlStart = false;
|
||||
|
||||
/// <summary>
|
||||
/// Forza fix date al momento ricezione WrkEnd valido
|
||||
/// </summary>
|
||||
private bool dfWrkEnd = false;
|
||||
|
||||
/// <summary>
|
||||
/// Forza fix date al momento ricezione WrkStart valido
|
||||
/// </summary>
|
||||
private bool dfWrkStart = false;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// Verifica sheet loggando le eventuali anomalie sulle date e sistemando quelle mancanti in
|
||||
/// base a setup
|
||||
/// </summary>
|
||||
/// <param name="CurrSheet">Sheet da verificare ed eventualmente sistemare</param>
|
||||
/// <returns></returns>
|
||||
private ProdSheetExt checkFixSheet(ProdSheetExt CurrSheet)
|
||||
{
|
||||
var fixSheet = CurrSheet;
|
||||
// controllo SOLO SE se non sia ne in attesa ne completato...
|
||||
if (!fixSheet.Waiting || !fixSheet.Done)
|
||||
{
|
||||
// calcolo SE sia in errore secondo i 4 punti di controllo work/unload
|
||||
if (fixSheet.Unloading.OkE && dfUnlEnd)
|
||||
{
|
||||
// loggo
|
||||
LogSheetError(fixSheet);
|
||||
|
||||
// sistemo...
|
||||
fixSheet.Unloading.DtStart = fixSheet.Unloading.OkS ? fixSheet.Unloading.DtStart : fixSheet.Unloading.DtEnd;
|
||||
fixSheet.Machining.DtEnd = fixSheet.Machining.OkE ? fixSheet.Machining.DtEnd : fixSheet.Unloading.DtEnd;
|
||||
fixSheet.Machining.DtStart = fixSheet.Machining.OkS ? fixSheet.Machining.DtStart : fixSheet.Unloading.DtEnd;
|
||||
fixSheet.Printing.DtEnd = fixSheet.Printing.OkE ? fixSheet.Printing.DtEnd : fixSheet.Unloading.DtEnd;
|
||||
fixSheet.Printing.DtStart = fixSheet.Printing.OkS ? fixSheet.Printing.DtStart : fixSheet.Unloading.DtEnd;
|
||||
}
|
||||
else if (fixSheet.Unloading.OkS && dfUnlStart && (!fixSheet.Printing.Done || !fixSheet.Machining.Done))
|
||||
{
|
||||
// loggo
|
||||
LogSheetError(fixSheet);
|
||||
|
||||
// sistemo...
|
||||
fixSheet.Machining.DtEnd = fixSheet.Machining.OkE ? fixSheet.Machining.DtEnd : fixSheet.Unloading.DtEnd;
|
||||
fixSheet.Machining.DtStart = fixSheet.Machining.OkS ? fixSheet.Machining.DtStart : fixSheet.Unloading.DtEnd;
|
||||
fixSheet.Printing.DtEnd = fixSheet.Printing.OkE ? fixSheet.Printing.DtEnd : fixSheet.Unloading.DtEnd;
|
||||
fixSheet.Printing.DtStart = fixSheet.Printing.OkS ? fixSheet.Printing.DtStart : fixSheet.Unloading.DtEnd;
|
||||
}
|
||||
else if (fixSheet.Machining.OkE && dfWrkEnd && (!fixSheet.Printing.Done || !fixSheet.Machining.Done))
|
||||
{
|
||||
// loggo
|
||||
LogSheetError(fixSheet);
|
||||
|
||||
// sistemo...
|
||||
fixSheet.Machining.DtStart = fixSheet.Machining.OkS ? fixSheet.Machining.DtStart : fixSheet.Unloading.DtEnd;
|
||||
fixSheet.Printing.DtEnd = fixSheet.Printing.OkE ? fixSheet.Printing.DtEnd : fixSheet.Unloading.DtEnd;
|
||||
fixSheet.Printing.DtStart = fixSheet.Printing.OkS ? fixSheet.Printing.DtStart : fixSheet.Unloading.DtEnd;
|
||||
}
|
||||
else if (fixSheet.Machining.OkS && dfWrkStart && !fixSheet.Printing.Done)
|
||||
{
|
||||
// loggo
|
||||
LogSheetError(fixSheet);
|
||||
|
||||
// sistemo...
|
||||
fixSheet.Printing.DtEnd = fixSheet.Printing.OkE ? fixSheet.Printing.DtEnd : fixSheet.Unloading.DtEnd;
|
||||
fixSheet.Printing.DtStart = fixSheet.Printing.OkS ? fixSheet.Printing.DtStart : fixSheet.Unloading.DtEnd;
|
||||
}
|
||||
}
|
||||
|
||||
return fixSheet;
|
||||
}
|
||||
|
||||
private void LogSheetError(ProdSheetExt cSheet)
|
||||
{
|
||||
// loggo
|
||||
Log.Instance.Error($"Sheet Date error | SheetId: {cSheet.SheetId} | Print: {prtDate(cSheet.Printing)} | Work: {prtDate(cSheet.Machining)} | Unload: {prtDate(cSheet.Unloading)}");
|
||||
}
|
||||
|
||||
private string prtDate(WorkData wrkRec)
|
||||
{
|
||||
string dtSta = wrkRec.DtStart == null ? "NULL" : $"{wrkRec.DtStart:yyyy.MM.dd HH:mm:ss}";
|
||||
string dtEnd = wrkRec.DtEnd == null ? "NULL" : $"{wrkRec.DtEnd:yyyy.MM.dd HH:mm:ss}";
|
||||
return $"{dtSta} ... {dtEnd}";
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Version>1.1.2202.0117</Version>
|
||||
<Version>1.1.2401.2516</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>REMAN module for NKC</i>
|
||||
<h4>Versione: 1.1.2202.0117</h4>
|
||||
<h4>Versione: 1.1.2401.2516</h4>
|
||||
<br />
|
||||
Release Note:
|
||||
<ul>
|
||||
@@ -19,7 +19,7 @@
|
||||
<img src="logoSteamware.png" />
|
||||
</div>
|
||||
<div style="float: right;">
|
||||
<a href="https://www.steamware.net/IOT" target="_blank">© Egalware 2006-2022</a>
|
||||
<a href="https://www.steamware.net/IOT" target="_blank">© Egalware 2006-2024</a>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
@@ -1 +1 @@
|
||||
1.1.2202.0117
|
||||
1.1.2401.2516
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>1.1.2202.0117</version>
|
||||
<version>1.1.2401.2516</version>
|
||||
<url>https://nexus.steamware.net/repository/SWS/REMAN/stable/LAST/REMAN.zip</url>
|
||||
<changelog>https://nexus.steamware.net/repository/SWS/REMAN/stable/LAST/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
Reference in New Issue
Block a user