Inizio update gestione css calcolati

This commit is contained in:
Samuele E. Locatelli
2020-01-21 10:11:58 +01:00
parent 975026ad68
commit 770e77afc8
4 changed files with 132 additions and 27 deletions
+44
View File
@@ -165,6 +165,50 @@
/// </summary>
Present
}
/// <summary>
/// Destinazioni per ITEM post CNC WORK
/// </summary>
public enum ItemDest
{
/// <summary>
/// Destinato a BIN (painting)
/// </summary>
Bin,
/// <summary>
/// Destinato a Cart (KIT)
/// </summary>
Cart,
/// <summary>
/// Indefinito
/// </summary>
Undef
}
/// <summary>
/// Stati ammessi per ITEM
/// </summary>
public enum ItemStatus
{
/// <summary>
/// Programmato
/// </summary>
Programmed,
/// <summary>
/// Completato/Fatto/tagliato
/// </summary>
Made,
/// <summary>
/// Preso da operatore
/// </summary>
PickUp,
/// <summary>
/// Depositato su Bin/Cesta
/// </summary>
Removed,
/// <summary>
/// Indefinito
/// </summary>
Undef
}
/// <summary>
/// Tipi di barcode gestiti
+21
View File
@@ -140,6 +140,27 @@ namespace NKC_SDK
/// </summary>
public Dictionary<string, string> OptParameters { get; set; } = null;
}
/// <summary>
/// Descrizione di un ITEM in fase di scarico
/// </summary>
public class PartUnload : Part
{
/// <summary>
/// Destinazione dell'item
/// </summary>
public ItemDest NextDest { get; set; } = ItemDest.Undef;
/// <summary>
/// Stato dell'item
/// </summary>
public ItemStatus Status { get; set; } = ItemStatus.Undef;
/// <summary>
/// Elenco di Secop opzionali (es T-NUT, RoundEdge)
/// </summary>
public List<string> SecOp { get; set; } = new List<string>();
}
/// <summary>
/// Classe Sheet x Nesting
/// </summary>
+35 -14
View File
@@ -1,4 +1,5 @@
using SteamWare;
using AppData;
using SteamWare;
using System.IO;
using System.Net;
using System.Net.Http;
@@ -10,12 +11,39 @@ namespace NKC_WF.Controllers
{
public class getMUCssController : ApiController
{
// GET api/<controller>
// GET api/getMUCssController
public HttpResponseMessage Get()
{
string answ = "";
string codPost = "01";
answ = getCssByPost(answ, codPost);
return new HttpResponseMessage(HttpStatusCode.OK)
{
Content = new StringContent(answ, Encoding.UTF8, "text/css")
};
}
// GET api/getMUCssController/5
public HttpResponseMessage Get(int id)
{
string answ = "";
string codPost = id.ToString("00");
answ = getCssByPost(answ, codPost);
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="codPost"></param>
/// <returns></returns>
private static string getCssByPost(string answ, string codPost)
{
// recupero da REDIS!
string redKey = memLayer.ML.redHash("MachineUnload:01:Css");
string redKey = $"{ComLib.machineUnloadArea(codPost)}:Css";// memLayer.ML.redHash($"MachineUnload:{codPost}:Css");
// se vuoto scrivo versione attuale...
if (!memLayer.ML.redKeyPresent(redKey))
{
@@ -52,21 +80,14 @@ namespace NKC_WF.Controllers
//answ = answ.Replace("#BLK-CART", "#IT000002");
// salvo redis!
memLayer.ML.setRSV(redKey, answ);
int cssCacheTTL = memLayer.ML.cdvi("cssCacheTTL");
cssCacheTTL = cssCacheTTL <= 0 ? 60: cssCacheTTL;
memLayer.ML.setRSV(redKey, answ, cssCacheTTL);
}
return new HttpResponseMessage(HttpStatusCode.OK)
{
Content = new StringContent(answ, Encoding.UTF8, "text/css")
};
return answ;
}
// GET api/<controller>/5
public string Get(int id)
{
return "value";
}
// POST api/<controller>
public void Post([FromBody]string value)
+32 -13
View File
@@ -1,31 +1,50 @@
using SteamWare;
using AppData;
using SteamWare;
using System.Web.Http;
namespace NKC_WF.Controllers
{
public class getMUCssRevController : ApiController
{
// GET api/<controller>
// GET api/getMUCssRev
public int Get()
{
int answ = 0;
// recupero da REDIS!
string redKey = memLayer.ML.redHash("MachineUnload:01:CssRev");
// se vuoto scrivo 1...
if (!memLayer.ML.redKeyPresent(redKey))
{
memLayer.ML.setRCntI(redKey);
}
answ = memLayer.ML.getRCnt(redKey);
string codPost = "01";
answ = getRevByPost(codPost);
return answ;
}
// GET api/getMUCssRev/5
public int Get(int id)
{
int answ = 0;
string codPost = id.ToString("00");
answ = getRevByPost(codPost);
return answ;
}
// GET api/<controller>/5
public string Get(int id)
private static int getRevByPost(string codPost)
{
return "value";
int answ;
// recupero da REDIS!
string redKey = $"{ComLib.machineUnloadArea(codPost)}:Css";// memLayer.ML.redHash($"MachineUnload:{codPost}:Css");
string redKeyRev = $"{ComLib.machineUnloadArea(codPost)}:CssRev";// memLayer.ML.redHash($"MachineUnload:{codPost}:CssRev");
// se vuoto scrivo 1...
if (!memLayer.ML.redKeyPresent(redKeyRev))
{
memLayer.ML.setRCntI(redKeyRev);
}
// SE fosse scaduto CSS --> aggiorno revisione...
if (!memLayer.ML.redKeyPresent(redKey))
{
// incremento...
memLayer.ML.setRCntI(redKeyRev);
}
answ = memLayer.ML.getRCnt(redKeyRev);
return answ;
}
// POST api/<controller>
public void Post([FromBody]string value)
{