예제 #1
0
 public void ChangeProcess()
 {
     processID = 1;
     //plcProcess[processID].StartThread();
     thrShutdown     = false;
     mainStepProcess = _StepProcess.ChangeProcess;
     StartThread();
 }
예제 #2
0
 public void ChangeProcess()
 {
     processID += 1;
     if (processID >= cboComport.Items.Count)
     {
         processID = 0;
     }
     thrShutdown     = false;
     mainStepProcess = _StepProcess.ChangeProcess;
     StartThread();
 }
예제 #3
0
        private void RunProcess()
        {
            thrRunning = true;
            System.Threading.Thread.Sleep(1000);
            if (mainStepProcess != _StepProcess.ChangeProcess)
            {
                InitialDataBase();
                mainStepProcess = _StepProcess.InitialDatabase;
            }
            AddListBox = "Initial report path " + App_Path.ToString() + "\\Report File\\";
            while (thrRunning)
            {
                try
                {
                    if (thrShutdown)
                    {
                        return;
                    }
                    switch (mainStepProcess)
                    {
                    case _StepProcess.InitialDatabase:
                        if (OraDb.ConnectStatus())
                        {
                            mainStepProcess = _StepProcess.InitialPrint;
                            //AddListBoxItem(mStepProcess.ToString());
                        }

                        Thread.Sleep(500);
                        break;

                    case _StepProcess.InitialPrint:
                        Thread.Sleep(500);
                        InitialDataGrid();
                        if (InitialPrintProcess())
                        {
                            mainStepProcess = _StepProcess.InitialDataGrid;
                            PrintProcess[processID].StartThread();
                        }

                        if (InitialPrintInstructionProcess())
                        {
                            mainStepProcess = _StepProcess.InitialDataGrid;
                            PrintInstructionProcess[processID].StartThread();
                        }
                        if (InitialPrintProcessWeight())
                        {
                            mainStepProcess = _StepProcess.InitialDataGrid;
                            PrintProcessWeight[processID].StartThread();
                        }
                        if (InitialPrintEndOfDayProcess())
                        {
                            mainStepProcess = _StepProcess.InitialDataGrid;
                            PrintEndOfDayProcess[processID].StartThread();
                        }
                        break;

                    case _StepProcess.InitialDataGrid:
                        //thrRunning = false;
                        // InitialDataGrid();
                        //AddListBoxItem(mStepProcess.ToString());
                        mainStepProcess = _StepProcess.InitialClassEvent;
                        break;

                    case _StepProcess.InitialClassEvent:
                        //thrRunning = false;
                        thrShutdown = true;
                        InitialClassEvent();
                        break;

                    case _StepProcess.ChangeProcess:
                        thrShutdown = true;
                        Thread.Sleep(300);
                        while (PrintProcess[processID].IsThreadAlive)
                        {
                        }
                        //PrintProcess[processID].StartThread();
                        break;
                    }
                    DisplayDateTime();
                    Thread.Sleep(300);
                }
                catch (Exception exp)
                { AddListBoxItem(DateTime.Now + ">" + exp.Message + "[" + exp.Source + "-" + mainStepProcess.ToString() + "]"); }
                //finally
                //{
                //    mShutdown = true;
                //    mRunning = false;
                //}
            }
        }
예제 #4
0
        private void RunProcess()
        {
            thrRunning = true;
            System.Threading.Thread.Sleep(1000);
            if (mainStepProcess != _StepProcess.ChangeProcess)
            {
                InitialDataBase();
                mainStepProcess = _StepProcess.InitialDatabase;
            }
            while (thrRunning)
            {
                try
                {
                    if (thrShutdown)
                    {
                        return;
                    }
                    switch (mainStepProcess)
                    {
                    case _StepProcess.InitialDatabase:
                        if (OraDb.IsConnect())
                        {
                            mainStepProcess = _StepProcess.InitialCardReader;
                            GetIntervalTimeRestart();
                            //AddListBoxItem(mStepProcess.ToString());
                        }
                        Thread.Sleep(500);
                        break;

                    case _StepProcess.InitialCardReader:
                        //thrRunning = true;
                        //Thread.Sleep(500);
                        if (InitialCardReader())
                        {
                            if (InitialComportCardReader())
                            {
                                mainStepProcess = _StepProcess.InitialDataGrid;
                                //atgProcess[processID].StartThread();
                                for (int i = 0; i < crProcess.Length; i++)
                                {
                                    crProcess[i].StartThread();
                                }
                            }
                            //AddListBoxItem(mStepProcess.ToString());
                        }
                        break;

                    case _StepProcess.InitialDataGrid:
                        //thrRunning = false;
                        InitialDataGrid();
                        //AddListBoxItem(mStepProcess.ToString());
                        mainStepProcess = _StepProcess.InitialClassEvent;
                        break;

                    case _StepProcess.InitialClassEvent:
                        thrRunning = false;
                        InitialClassEvent();
                        mainStepProcess = _StepProcess.ChangeProcess;
                        break;

                    case _StepProcess.ChangeProcess:
                        currentDay  = DateTime.Now.Day - 1;
                        thrShutdown = true;
                        //thrShutdown = true;
                        //Thread.Sleep(300);
                        //while(atgProcess[processID].IsThreadAlive)
                        //{}
                        //atgProcess[processID].StartThread();
                        break;
                    }
                    DisplayDateTime();
                    Thread.Sleep(300);
                }
                catch (Exception exp)
                { AddListBoxItem(DateTime.Now + ">" + exp.Message + "[" + exp.Source + "-" + mainStepProcess.ToString() + "]"); }
                //finally
                //{
                //    mShutdown = true;
                //    mRunning = false;
                //}
            }
        }