public CheckLotAndMachineCompatibilityResult CheckLotAndMachineCompatibility(LotInfo lotInfo, MachineInfo machineInfo)
        {
            Stopwatch functionTimer = new Stopwatch();

            functionTimer.Start();
            int stepCount = 1;
            Dictionary <int, string> WarningMessage = new Dictionary <int, string>();

            //1.) machine must be set as high reliability if lot is auto motive
            if (lotInfo.IsAutomotive && !machineInfo.IsAutomotive)
            {
                functionTimer.Stop();
                SaveFunctionLog("CheckLotAndMachineCompatibility", functionTimer.ElapsedMilliseconds, DateTime.Now);
                return(new CheckLotAndMachineCompatibilityResult(11, WarningMessage, "www.google.com", stepCount));
            }
            stepCount += 1;
            //2.) check machine ...
            //  2.1) process step must be equal
            if (machineInfo.Job == null)
            {
                functionTimer.Stop();
                SaveFunctionLog("CheckLotAndMachineCompatibility", functionTimer.ElapsedMilliseconds, DateTime.Now);
                return(new CheckLotAndMachineCompatibilityResult(27, WarningMessage, "www.google.com", stepCount));
            }
            if (lotInfo.Job == null)
            {
                functionTimer.Stop();
                SaveFunctionLog("CheckLotAndMachineCompatibility", functionTimer.ElapsedMilliseconds, DateTime.Now);
                return(new CheckLotAndMachineCompatibilityResult(28, WarningMessage, "www.google.com", stepCount));
            }
            for (int i = 0; i < machineInfo.Job.Length; i++)
            {
                if (lotInfo.Job.Id == machineInfo.Job[i].Id)
                {
                    break;
                }
                if (i == machineInfo.Job.Length - 1)
                {
                    functionTimer.Stop();
                    SaveFunctionLog("CheckLotAndMachineCompatibility", functionTimer.ElapsedMilliseconds, DateTime.Now);
                    return(new CheckLotAndMachineCompatibilityResult(12, WarningMessage, "www.google.com", stepCount));
                }
            }
            //  2.2) machine type must equal to specific as the lot needed

            //3.) machine's material check
            //  3.1) material type check
            //  3.2) material life time check
            //  3.3) material usagable date check

            //4.) machine's jig check
            //  4.1) jig type check
            //  4.2) jig life time check

            //5.) machine's equipment check
            //  5.1) equipment type check
            //  5.2) equipment setting check
            //  5.3) equipment quantity check

            functionTimer.Stop();
            SaveFunctionLog("CheckLotAndMachineCompatibility", functionTimer.ElapsedMilliseconds, DateTime.Now);
            return(new CheckLotAndMachineCompatibilityResult(WarningMessage));
        }
        public CheckMachineConditionResult CheckMachineCondition(MachineInfo machineInfo)
        {
            Stopwatch functionTimer = new Stopwatch();

            functionTimer.Start();
            DatabaseAccess       db       = new DatabaseAccess();
            DatabaseAccessObject dbObject = new DatabaseAccessObject();
            int stepCount = 1;
            Dictionary <int, string> WarningMessage = new Dictionary <int, string>();

            if (machineInfo == null)
            {
                functionTimer.Stop();
                SaveFunctionLog("CheckMachineCondition", functionTimer.ElapsedMilliseconds, DateTime.Now);
                return(new CheckMachineConditionResult(6, WarningMessage, "www.google.com", stepCount));
            }
            stepCount += 1;
            if (machineInfo.IsDisable)
            {
                functionTimer.Stop();
                SaveFunctionLog("CheckMachineCondition", functionTimer.ElapsedMilliseconds, DateTime.Now);
                return(new CheckMachineConditionResult(7, WarningMessage, "www.google.com", stepCount));
            }
            if (machineInfo.MachineState == null)
            {
                functionTimer.Stop();
                SaveFunctionLog("CheckMachineCondition", functionTimer.ElapsedMilliseconds, DateTime.Now);
                return(new CheckMachineConditionResult(25, WarningMessage, "www.google.com", stepCount));
            }
            if (machineInfo.MachineState.OnlineState == 0)
            {
                functionTimer.Stop();
                SaveFunctionLog("CheckMachineCondition", functionTimer.ElapsedMilliseconds, DateTime.Now);
                return(new CheckMachineConditionResult(23, WarningMessage, "www.google.com", stepCount));
            }
            if (machineInfo.MachineState.OnlineState == 2)
            {
                functionTimer.Stop();
                SaveFunctionLog("CheckMachineCondition", functionTimer.ElapsedMilliseconds, DateTime.Now);
                return(new CheckMachineConditionResult(24, WarningMessage, "www.google.com", stepCount));
            }
            if (machineInfo.MachineState.RunState == 3)
            {
                functionTimer.Stop();
                SaveFunctionLog("CheckMachineCondition", functionTimer.ElapsedMilliseconds, DateTime.Now);
                return(new CheckMachineConditionResult(21, WarningMessage, "www.google.com", stepCount));
            }
            stepCount += 1;
            if (machineInfo.MachineState.QcState == 1)
            {
                functionTimer.Stop();
                SaveFunctionLog("CheckMachineCondition", functionTimer.ElapsedMilliseconds, DateTime.Now);
                return(new CheckMachineConditionResult(8, WarningMessage, "www.google.com", stepCount));
            }
            if (machineInfo.MachineState.QcState == 2)
            {
                WarningMessage.Add(stepCount, ErrorMessageProvider.GetErrorMessage(9));
            }
            functionTimer.Stop();
            SaveFunctionLog("CheckMachineCondition", functionTimer.ElapsedMilliseconds, DateTime.Now);
            return(new CheckMachineConditionResult(WarningMessage));
        }