using Microsoft.Extensions.Configuration; using MP.MONO.Core; using MP.MONO.Core.DTO; using NLog; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace MP.MONO.Data.Controllers { public class MpDbController : IDisposable { private static IConfiguration _configuration; private static NLog.Logger Log = LogManager.GetCurrentClassLogger(); public MpDbController(IConfiguration configuration) { _configuration = configuration; } public void Dispose() { // Clear database context //Log.Info("Dispose di GWMSController"); } /// /// Restituisce stato Macchina /// /// public MachineDTO MachineGetStatus() { // !!!FIXME TODO... è fake... Random rand = new Random(); int maxRun = 5; int maxExe = 7; MachineDTO currMachDto = new MachineDTO() { Manufacturer = "Egalware", Model = "SIM Machine", Name = "DEMO 01", SerNumber = "2022-0001", Mode = $"{(Enums.MachRunMode)rand.Next(0, maxRun)}", Status = $"{(Enums.MachExeStatus)rand.Next(0, maxExe)}" }; Task.Delay(200).Wait(); return currMachDto; } public ProductionDTO MachineGetProd() { // !!!FIXME TODO... è fake... Random rand = new Random(); int stdCycle = 5; ProductionDTO currMachDto = new ProductionDTO() { Order = "ODL Test", ItemCode = "ART.0000123", ProgName = "P000012", CurrQty = DateTime.Now.Minute, OrderQty = 100, CycleTime = rand.NextDouble() * stdCycle, Message = "Sim data" }; Task.Delay(200).Wait(); return currMachDto; } } }