Beispiel #1
0
        public void RunWorkTest()
        {
            string routinepath = @"F:\Prepare\SOFTWARE_PUB\Autorivet_team_manage\settings\PartDBRoutine";
            //检查配置文件
            var PartRoutine = jsonMethod.ReadFromFile(routinepath);
            var lastrocord  = PartRoutine.Last();
            var lastDate    = DateTime.Parse(lastrocord.date);
            var span        = DateTime.Now.Date - lastDate;

            //If the span is so long, then update the database
            if (span.Days > 7)
            {
                //Get the update path
                var up = GoumangToolKit.localMethod.GetConfigValue("UPDATE_PATH", "PartDBCfg.py");
                GoumangToolKit.PartDB pd = new PartDB("filepath");
                foreach (dynamic pp in up)
                {
                    var kk = pd.UpdatePartDB((string)pp);
                }
            }

            PartRoutine.Add(new historyJsonModel()
            {
                writer    = "System",
                date      = DateTime.Now.ToShortDateString(),
                operation = "Done"
            });
            var rr = PartRoutine.WriteToFile(routinepath);

            Assert.AreEqual(rr, true);
        }
Beispiel #2
0
        public void UpdatePartDBTest()
        {
            PartDB pd = new PartDB("filePath");
            //var dd= pd.UpdatePartDB(@"");
            var dd = pd.UpdatePartDB(@"\\192.168.2.10\Cseries-data1");

            Assert.AreEqual(dd.Result, true);
        }
Beispiel #3
0
        public void UpdateFTPPartDBTest()
        {
            PartDB pd = new PartDB("FTPfilePath");
            var    dd = pd.UpdateFTPPartDB("/");

            //var dd = pd.UpdatePartDB(new List<string>() { @"\\192.168.2.10\Cseries-data1" });
            Assert.AreEqual(dd.Result, true);
        }
Beispiel #4
0
 public void LoadComboboxes() {
     List<Part> partList = PartDB.GetPartList();
     cboCurPartNum.DataSource = partList;
     cboCurPartNum.SelectedIndex = -1;
     var addEngOrd = false;
     if (addEngOrd  == false) {
       //MessageBox.Show("assign here " + 1);
       cboCurPartNum.SelectedItem = partList[1];
     }
 }
        public async void RunWork(object source, System.Timers.ElapsedEventArgs e)
        {
            try
            {
                //检查配置文件
                string routinepath = @"F:\Prepare\SOFTWARE_PUB\Autorivet_team_manage\settings\PartDBRoutine";
                //检查配置文件
                var PartRoutine = jsonMethod.ReadFromFile(routinepath);
                var lastrocord  = PartRoutine.Last();
                var lastDate    = DateTime.Parse(lastrocord.date);
                var span        = DateTime.Now.Date - lastDate;
                //If the span is so long, then update the database
                if (span.Days > 7)
                {
                    //Get the update path
                    var    up  = GoumangToolKit.localMethod.GetConfigValue("UPDATE_PATH", "PartDBCfg.py");
                    var    col = GoumangToolKit.localMethod.GetConfigValue("PART_MONGO_COLNAME", "PartDBCfg.py");
                    PartDB pd  = new PartDB(col);
                    foreach (dynamic pp in up)
                    {
                        await pd.UpdatePartDB((string)pp);
                    }

                    var ftpup  = GoumangToolKit.localMethod.GetConfigValue("FTP_UPDATE_PATH", "PartDBCfg.py");
                    var ftpcol = GoumangToolKit.localMethod.GetConfigValue("FTP_PART_MONGO_COLNAME", "PartDBCfg.py");
                    var ftppd  = new PartDB(ftpcol);
                    foreach (dynamic pp in ftpup)
                    {
                        await ftppd.UpdateFTPPartDB((string)pp);
                    }
                    //Clean backup files
                    var cleanpath = GoumangToolKit.localMethod.GetConfigValue("InfoPath");
                    BackupOperation.CleanBackup(cleanpath);
                }

                PartRoutine.Add(new historyJsonModel()
                {
                    writer    = "System",
                    date      = DateTime.Now.ToShortDateString(),
                    operation = "Done"
                });
                PartRoutine.WriteToFile(routinepath);
            }
            catch
            {
                //Do nothing
            }
        }