Exemple #1
0
 private void AutoCache()
 {
     tProgBar.Value         = 0;
     labelLoadDatas.Text    = "正在更新缓存......";
     timerMain.Enabled      = true;
     toolBtnRefresh.Enabled = false;
     Task.Run(() =>
     {
         BscData.LoadERPPart();
         BscData.LoadERPPartMtl();
         BscData.LoadPLM_MPART();
         BscData.LoadPLM_MBOM();
         BscData.LoadPLM_CONS();
         BscData.LoadPLM_CONS_OBJOF();
         BscData.LoadPLM_MATERIAL();
         BscData.LoadPLM_PRODUCT();
         BscData.LoadPLM_MTL();
         this.BeginInvoke(new Action(() =>
         {
             labelLoadDatas.Text    = "更新成功";
             groupBoxTools.Enabled  = true;
             tProgBar.Value         = 100;
             timerMain.Enabled      = false;
             toolBtnRefresh.Enabled = true;
         }));
     });
 }
Exemple #2
0
 private void AutoCache()
 {
     lblAutoUpdate.Text = "Start Update Cache.";
     Task.Run(() =>
     {
         BscData.LoadPLM_MPART();
         BscData.LoadPLM_MBOM();
         BscData.LoadPLM_CONS();
         BscData.LoadPLM_CONS_OBJOF();
         BscData.LoadPLM_MATERIAL();
         BscData.LoadPLM_PRODUCT();
         BscData.LoadPLM_MTL();
         this.BeginInvoke(new Action(() =>
         {
             lblAutoUpdate.Text = DateTime.Now.ToString() + ". Update OK!";
         }));
     });
 }
        public void LoadDatas(string ERPConn, string PLMConn)
        {
            progressBarLoad.Value   = 0;
            progressBarLoad.Maximum = 100;
            timerLoad.Enabled       = true;
            timerLoad.Interval      = 1000;

            tasks = new Task[9];
            BasicDatas BscData = new BasicDatas(ERPConn, PLMConn);

            tasks[0] = Task.Run(() =>
            {
                BscData.LoadERPPart();
                this.BeginInvoke(new Action(() =>
                {
                    labelStatus.Text       = "ERP_PART数据加载完毕";
                    progressBarLoad.Value += 10;
                }));
            });
            tasks[1] = Task.Run(() =>
            {
                BscData.LoadERPPartMtl();
                this.BeginInvoke(new Action(() =>
                {
                    labelStatus.Text       = "ERP_PART_MTL数据加载完毕";
                    progressBarLoad.Value += 10;
                }));
            });
            tasks[2] = Task.Run(() =>
            {
                BscData.LoadPLM_MPART();
                this.BeginInvoke(new Action(() =>
                {
                    labelStatus.Text       = "PLM_MPART数据加载完毕";
                    progressBarLoad.Value += 20;
                }));
            });
            tasks[3] = Task.Run(() =>
            {
                BscData.LoadPLM_MBOM();
                this.BeginInvoke(new Action(() =>
                {
                    labelStatus.Text       = "PLM_MBOM数据加载完毕";
                    progressBarLoad.Value += 10;
                }));
            });
            tasks[4] = Task.Run(() =>
            {
                BscData.LoadPLM_CONS();
                this.BeginInvoke(new Action(() =>
                {
                    labelStatus.Text       = "PLM_CONS数据加载完毕";
                    progressBarLoad.Value += 10;
                }));
            });
            tasks[5] = Task.Run(() =>
            {
                BscData.LoadPLM_CONS_OBJOF();
                this.BeginInvoke(new Action(() =>
                {
                    labelStatus.Text       = "PLM_CONS_OBJOF数据加载完毕";
                    progressBarLoad.Value += 10;
                }));
            });
            tasks[6] = Task.Run(() =>
            {
                BscData.LoadPLM_MATERIAL();
                this.BeginInvoke(new Action(() =>
                {
                    labelStatus.Text       = "PLM_MATERIAL数据加载完毕";
                    progressBarLoad.Value += 10;
                }));
            });
            tasks[7] = Task.Run(() =>
            {
                BscData.LoadPLM_PRODUCT();
                this.BeginInvoke(new Action(() =>
                {
                    labelStatus.Text       = "PLM_PRODUCT数据加载完毕";
                    progressBarLoad.Value += 10;
                }));
            });
            tasks[8] = Task.Run(() =>
            {
                BscData.LoadPLM_MTL();
                this.BeginInvoke(new Action(() =>
                {
                    labelStatus.Text       = "PLM_MTL数据加载完毕";
                    progressBarLoad.Value += 10;
                }));
            });
        }