Exemplo n.º 1
0
 public Jobs(MakinoDB db, BlackMaple.MachineFramework.JobDB jdb, string xmlPath, bool onlyOrders)
 {
     _db         = db;
     _jobDB      = jdb;
     _xmlPath    = xmlPath;
     _onlyOrders = onlyOrders;
 }
Exemplo n.º 2
0
        public MakinoBackend(IConfiguration config, FMSSettings st)
        {
            try
            {
                var cfg = config.GetSection("Makino");

                string adePath = cfg.GetValue <string>("ADE Path");
                if (string.IsNullOrEmpty(adePath))
                {
                    adePath = @"c:\Makino\ADE";
                }

                string dbConnStr = cfg.GetValue <string>("SQL Server Connection String");
                if (string.IsNullOrEmpty(dbConnStr))
                {
                    dbConnStr = DetectSqlConnectionStr();
                }

                bool downloadOnlyOrders = cfg.GetValue <bool>("Download Only Orders");

                Log.Information(
                    "Starting makino backend. Connection Str: {connStr}, ADE Path: {path}, DownloadOnlyOrders: {downOnlyOrders}",
                    dbConnStr, adePath, downloadOnlyOrders);

                _dataDirectory = st.DataDirectory;

                _log = new JobLogDB(st);
                _log.Open(
                    System.IO.Path.Combine(_dataDirectory, "log.db"),
                    System.IO.Path.Combine(_dataDirectory, "inspections.db"),
                    startingSerial: st.StartingSerial
                    );

                _jobDB = new BlackMaple.MachineFramework.JobDB();
                _jobDB.Open(System.IO.Path.Combine(_dataDirectory, "jobs.db"));

                _status = new StatusDB(System.IO.Path.Combine(_dataDirectory, "makino.db"));

#if DEBUG
                _makinoDB = new MakinoDB(MakinoDB.DBTypeEnum.SqlLocal, "", _status, _log);
#else
                _makinoDB = new MakinoDB(MakinoDB.DBTypeEnum.SqlConnStr, dbConnStr, _status, _log);
#endif

                _logTimer = new LogTimer(_log, _jobDB, _makinoDB, _status, st);

                _jobs = new Jobs(_makinoDB, _jobDB, adePath, downloadOnlyOrders);

                _logTimer.LogsProcessed += OnLogsProcessed;
            }
            catch (Exception ex)
            {
                Log.Error(ex, "Error when initializing makino backend");
            }
        }
Exemplo n.º 3
0
 public LogTimer(
     JobLogDB log, JobDB jobDB, MakinoDB makinoDB, StatusDB status, FMSSettings settings)
 {
     _lock     = new object();
     _log      = log;
     _jobDB    = jobDB;
     Settings  = settings;
     _makinoDB = makinoDB;
     _status   = status;
     TimerSignaled(null, null);
     _timer          = new System.Timers.Timer(TimeSpan.FromMinutes(1).TotalMilliseconds);
     _timer.Elapsed += TimerSignaled;
     _timer.Start();
 }