Esempio n. 1
0
 public MainForm(bool isPreload = true)
 {
     InitializeComponent();
     this.Text       = "罗斯(无锡)PLM数据同步工具" + Application.ProductName + " v" + Application.ProductVersion;
     Utility         = new Utilities();
     SysConfig       = Utility.GetSysCfg();
     SLabelUser.Text = BasicDatas.CurrentUser;
     CurrentDgv      = this.dataGridViewMain;
     if (SysConfig != null)
     {
         RLD     = new RossLiveRespository();
         RossCfg = RLD.GetRossCfg();
         ERP     = new ERPRepository(SysConfig.ERPConn);
         PLM     = new PLMRespository(SysConfig.PLMConn, RossCfg.Units);
         BscData = new BasicDatas(SysConfig.ERPConn, SysConfig.PLMConn);
         InitData();
         if (isPreload)
         {
             FormLoading formLoad = new FormLoading(SysConfig.ERPConn, SysConfig.PLMConn);
             formLoad.ShowDialog();
             formLoad.Owner = this;
         }
     }
     else
     {
         MessageBox.Show("配置文件错误,请联系软件供应商!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Esempio n. 2
0
        public FormServer()
        {
            InitializeComponent();
            Utility   = new Utilities();
            RLD       = new RossLiveRespository();
            RossCfg   = RLD.GetRossCfg();
            SysConfig = Utility.GetSysCfg();
            ERP       = new ERPRepository(SysConfig.ERPConn);
            PLM       = new PLMRespository(SysConfig.PLMConn, RossCfg.Units);

            BscData = new BasicDatas(SysConfig.ERPConn, SysConfig.PLMConn);

            StartTime      = DateTime.Now;
            startTime.Text = "启动时间:" + StartTime.ToString();
            notifyMenuItem_start.Enabled = false;
            notifyMenuItem_stop.Enabled  = true;

            UpdateLogs UptLog = new UpdateLogs();

            UptLog.CompleteLog = "Start System Background Service";
            UptLog.LogTitle    = "Start System Service";
            UptLog.Status      = "OK";
            RLD.InsertUptLog(UptLog);

            this.Text = Application.ProductName + " v" + Application.ProductVersion;
        }
Esempio n. 3
0
 public FormMain()
 {
     InitializeComponent();
     ERP     = new ERPRepository("ERPDbContextLive");
     PLM     = new PLMRespository("PLMDbContext");
     BscData = new BasicDatas("ERPDbContextLive", "PLMDbContext");
     AutoCache();
     this.Text = "PLM_BOM自检 v" + Application.ProductVersion;
 }
        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;
                }));
            });
        }