using AppData; using SteamWare; using System.Web.Http; namespace NKC_WF.Controllers { public class getMUCssRevController : ApiController { // GET api/getMUCssRev public int Get() { int answ = getRevBySheet(0); return answ; } // GET api/getMUCssRev/5 public int Get(int id) { int answ = getRevBySheet(id); return answ; } /// /// Recupera da REDIS info indice revisione x foglio /// /// /// private static int getRevBySheet(int SheetID) { int answ; // recupero da REDIS! string redKey = $"{ComLib.machineUnloadArea(SheetID)}:Css"; string redKeyRev = $"{ComLib.machineUnloadArea(SheetID)}: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); // se > 999 --> resetto if (answ > 999) { memLayer.ML.resetRCnt(redKeyRev); } return answ; } } }