コード例 #1
0
        public bool ShowTrigger(Model.PSTData objPSTData)
        {
            if (objPSTData == null)
            {
                return(false);
            }
            if (objErrorDaoService == null)
            {
                objErrorDaoService = new ErrorDaoImp();
            }
            if (objErrorControllerService == null)
            {
                objErrorControllerService = new ErrorControllerImp();
            }

            int error = objErrorControllerService.GetErrorCode(objPSTData.machineChannel, objPSTData.machineCode, OpcTags.PST_L2_ErrCode);

            if (error != 0)
            {
                return(false);
            }
            TriggerData objTriggerData = new TriggerData();

            objTriggerData.MachineCode    = objPSTData.machineCode;
            objTriggerData.category       = TriggerData.triggerCategory.ERROR;
            objTriggerData.ErrorCode      = error.ToString();
            objTriggerData.TriggerEnabled = true;
            objErrorDaoService.UpdateTriggerActiveStatus(objTriggerData);
            return(true);
        }
コード例 #2
0
 public Model.ErrorData GetCommandOfActiveTrigger(string machine)
 {
     if (objErrorDaoService == null)
     {
         objErrorDaoService = new ErrorDaoImp();
     }
     return(objErrorDaoService.GetCommandOfActiveTrigger(machine));
 }
コード例 #3
0
 public bool GetTriggerActiveStatus(string machine)
 {
     if (objErrorDaoService == null)
     {
         objErrorDaoService = new ErrorDaoImp();
     }
     return(objErrorDaoService.GetTriggerActiveStatus(machine));
 }
コード例 #4
0
 public int GetTriggerAction(string machine)
 {
     if (objErrorDaoService == null)
     {
         objErrorDaoService = new ErrorDaoImp();
     }
     return(objErrorDaoService.GetTriggerAction(machine));
 }
コード例 #5
0
 public Model.ErrorData GetLiveCommandOfMachine(string machine)
 {
     if (objErrorDaoService == null)
     {
         objErrorDaoService = new ErrorDaoImp();
     }
     return(objErrorDaoService.GetLiveCommandOfMachine(machine));
 }
コード例 #6
0
 public bool UpdateLiveCommandStatusOfMachine(string machine, bool isDone)
 {
     if (objErrorDaoService == null)
     {
         objErrorDaoService = new ErrorDaoImp();
     }
     return(objErrorDaoService.UpdateLiveCommandStatusOfMachine(machine, isDone));
 }
コード例 #7
0
 public bool UpdateLiveCommandOfMachine(Model.ErrorData objErrorData)
 {
     if (objErrorDaoService == null)
     {
         objErrorDaoService = new ErrorDaoImp();
     }
     return(objErrorDaoService.UpdateLiveCommandOfMachine(objErrorData));
 }
コード例 #8
0
 public bool validate_live_command_update(Model.ErrorData objErrorData)
 {
     if (objErrorDaoService == null)
     {
         objErrorDaoService = new ErrorDaoImp();
     }
     return(objErrorDaoService.validate_live_command_update(objErrorData));
 }
コード例 #9
0
        public bool CheckVLCCommandDone(Model.VLCData objVLCData)
        {
            Logger.WriteLogger(GlobalValues.PARKING_LOG, "Queue Id:" + objVLCData.queueId + ":--Entering 'CheckVLCCommandDone' ");
            bool result = false;

            bool isWaitingForCmdDoneOn = false;
            int  counter = 1;
            OpcOperationsService opcd = null;

            if (objQueueControllerService == null)
            {
                objQueueControllerService = new QueueControllerImp();
            }
            if (objErrorControllerService == null)
            {
                objErrorControllerService = new ErrorControllerImp();
            }
            if (objErrorDaoService == null)
            {
                objErrorDaoService = new ErrorDaoImp();
            }
            bool        triggerAlreadyEnabled = false;
            TriggerData objTriggerData        = null;

            try
            {
                opcd = new OpcOperationsImp(OpcConnection.GetOPCServerConnection());

                Thread.Sleep(3000);
                result = false;
                //TimeSpan startTime = System.DateTime.Now.TimeOfDay;

                do
                {
                    triggerAlreadyEnabled = objErrorControllerService.GetTriggerActiveStatus(objVLCData.machineCode);
                    if (!triggerAlreadyEnabled)
                    {
                        objTriggerData = NeedToShowTrigger(objVLCData);
                    }
                    if (triggerAlreadyEnabled || objTriggerData.TriggerEnabled)
                    {
                        if (!triggerAlreadyEnabled)
                        {
                            objErrorDaoService.UpdateTriggerActiveStatus(objTriggerData);
                        }


                        while (objErrorControllerService.GetTriggerActiveStatus(objVLCData.machineCode))
                        {
                            /**checking transaction deleted or not****/
                            objQueueControllerService.CancelIfRequested(objVLCData.queueId);
                            /******/
                            Thread.Sleep(1000);
                        }
                        if (objQueueControllerService.NeedToOptimizePath(objVLCData.queueId))
                        {
                            break;
                        }
                        if (objErrorControllerService.GetTriggerAction(objVLCData.machineCode) == 1)
                        {
                            VLCMove(objVLCData);

                            Thread.Sleep(2000);
                        }
                    }


                    result = opcd.ReadTag <bool>(objVLCData.machineChannel, objVLCData.machineCode, OpcTags.VLC_CP_Done);

                    if (counter > 3)
                    {
                        counter = 1;
                        /**checking transaction deleted or not****/
                        objQueueControllerService.CancelIfRequested(objVLCData.queueId);
                        /******/
                        Thread.Sleep(700);
                    }
                    counter += 1;
                } while (!result);
            }
            catch (OperationCanceledException errMsg)
            {
                Logger.WriteLogger(GlobalValues.PARKING_LOG, "Queue Id:" + objVLCData.queueId + ": CM=" + objVLCData.machineCode + " --TaskCanceledException 'CheckVLCCommandDone':: " + errMsg.Message);
                throw new OperationCanceledException();
            }
            catch (Exception errMsg)
            {
                Logger.WriteLogger(GlobalValues.PARKING_LOG, "Queue Id:" + objVLCData.queueId + ":--Exception 'CheckVLCCommandDone':: " + errMsg.Message);
                if (errMsg is TaskCanceledException)
                {
                    throw new Exception();
                }
            }
            finally
            {
                if (opcd != null)
                {
                    opcd.Dispose();
                }
            }
            Logger.WriteLogger(GlobalValues.PARKING_LOG, "Queue Id:" + objVLCData.queueId + ":--Exitting 'CheckVLCCommandDone' ");
            return(result);
        }
コード例 #10
0
        public bool VLCMove(Model.VLCData objVLCData)
        {
            Logger.WriteLogger(GlobalValues.PARKING_LOG, "Queue Id:" + objVLCData.queueId + ":--Entering 'VLCMove' ");
            bool isCMHealthy = false;
            bool success     = false;

            if (objQueueControllerService == null)
            {
                objQueueControllerService = new QueueControllerImp();
            }
            if (objErrorDaoService == null)
            {
                objErrorDaoService = new ErrorDaoImp();
            }

            do
            {
                /**checking transaction deleted or not****/
                objQueueControllerService.CancelIfRequested(objVLCData.queueId);
                /******/
                try
                {
                    TriggerData objTriggerData = NeedToShowTrigger(objVLCData);
                    if (objTriggerData.TriggerEnabled)
                    {
                        objErrorDaoService.UpdateTriggerActiveStatus(objTriggerData);
                        break;
                    }
                    isCMHealthy = CheckVLCHealthy(objVLCData);

                    if (!isCMHealthy)
                    {
                        Thread.Sleep(200);
                        continue;
                    }

                    using (OpcOperationsService opcd = new OpcOperationsImp(OpcConnection.GetOPCServerConnection()))
                    {
                        objVLCData.floor = opcd.ReadTag <Int32>(objVLCData.machineChannel, objVLCData.machineCode, OpcTags.VLC_At_Floor);
                        if (objVLCData.floor != objVLCData.destFloor)
                        {
                            opcd.WriteTag <int>(objVLCData.machineChannel, objVLCData.machineCode, OpcTags.VLC_DestFloor, objVLCData.destFloor);
                            success = opcd.WriteTag <bool>(objVLCData.machineChannel, objVLCData.machineCode, objVLCData.command, true);
                        }
                        else
                        {
                            success = opcd.WriteTag <bool>(objVLCData.machineChannel, objVLCData.machineCode, objVLCData.command, true);
                            success = true;
                        }
                    }
                }
                catch (OperationCanceledException errMsg)
                {
                    Logger.WriteLogger(GlobalValues.PARKING_LOG, "Queue Id:" + objVLCData.queueId + ": CM=" + objVLCData.machineCode + " --TaskCanceledException 'VLCMove':: " + errMsg.Message);
                    throw new OperationCanceledException();
                }
                catch (Exception ex)
                {
                    Logger.WriteLogger(GlobalValues.PARKING_LOG, "Queue Id:" + objVLCData.queueId + ":--Exception 'VLCMove':: " + ex.Message);
                    /**checking transaction deleted or not****/
                    objQueueControllerService.CancelIfRequested(objVLCData.queueId);
                    /******/
                    if (ex is TaskCanceledException)
                    {
                        throw new Exception();
                    }
                    success = false;
                }
            } while (!success);
            Logger.WriteLogger(GlobalValues.PARKING_LOG, "Queue Id:" + objVLCData.queueId + ":--Exitting 'VLCMove' ");
            return(success);
        }
コード例 #11
0
        public bool CheckPVLCommandDone(Model.PVLData objPVLData)
        {
            bool result = false;

            int counter = 1;
            OpcOperationsService opcd = null;

            int    commandType  = 0;
            string doneCheckTag = null;
            int    error        = 0;

            try
            {
                opcd = new OpcOperationsImp(OpcConnection.GetOPCServerConnection());
                if (objErrorControllerService == null)
                {
                    objErrorControllerService = new ErrorControllerImp();
                }
                if (objErrorDaoService == null)
                {
                    objErrorDaoService = new ErrorDaoImp();
                }
                Thread.Sleep(2000);
                result = false;
                FindCommandTypeAndDoneTag(objPVLData, out commandType, out doneCheckTag);


                do
                {
                    error = objErrorControllerService.GetErrorCode(objPVLData.machineChannel, objPVLData.machineCode, OpcTags.PVL_L2_ErrCode);
                    if (error > 0)
                    {
                        TriggerData objTriggerData = new TriggerData();
                        objTriggerData.MachineCode    = objPVLData.machineCode;
                        objTriggerData.category       = TriggerData.triggerCategory.ERROR;
                        objTriggerData.ErrorCode      = error.ToString();
                        objTriggerData.TriggerEnabled = true;
                        objErrorDaoService.UpdateTriggerActiveStatus(objTriggerData);


                        while (objErrorControllerService.GetTriggerActiveStatus(objPVLData.machineCode))
                        {
                            Thread.Sleep(1000);
                        }
                        if (objErrorControllerService.GetTriggerAction(objPVLData.machineCode) == 1)
                        {
                            DoTriggerAction(objPVLData, commandType);

                            Thread.Sleep(2000);
                        }
                    }

                    result = opcd.ReadTag <bool>(objPVLData.machineChannel, objPVLData.machineCode, doneCheckTag);

                    if (counter > 3)
                    {
                        Thread.Sleep(700);
                    }
                    counter += 1;
                } while (!result);
            }
            catch (Exception errMsg)
            {
                Console.WriteLine(errMsg.Message);
            }
            finally
            {
                if (opcd != null)
                {
                    opcd.Dispose();
                }
            }
            return(result);
        }