示例#1
0
        private bool CheckOnBegin()
        {
            bool ret = false;

            ret = ControlDevice.SetHouseFCSAlarm(false);
            if (ret != true)
            {
                return(ret);
            }

            ret = ControlDevice.SetHouseFCSReset(false);
            if (ret != true)
            {
                return(ret);
            }

            ret = ControlDevice.SetHouseRequestFCSFin(false);
            if (ret != true)
            {
                return(ret);
            }

            ret = ControlDevice.SetHouseRequestInfoFCSFin(false);
            if (ret != true)
            {
                return(ret);
            }

            return(true);
        }
示例#2
0
        public void Start()
        {
            SendLeftMaterialServiceStateMessage(
                new LeftMaterialServiceState {
                State = LeftMaterialServiceStateEnum.INFO, Message = "左侧料库服务启动!", ErrorCode = LeftMaterialServiceErrorCodeEnum.NORMAL
            });


            Temp_S_House_RequestFCS_Last = false;

            bool ret = false;

            #region 初始化
            bool temp_S_House_RequestFCS_Last = false;
            ret = ControlDevice.GetHouseRequestFCS(ref temp_S_House_RequestFCS_Last);
            if (ret == false)
            {
                while (ret == false)
                {
                    ret = ControlDevice.SetHouseFCSAlarm(true);
                    SendLeftMaterialServiceStateMessage(
                        new LeftMaterialServiceState {
                        State = LeftMaterialServiceStateEnum.ERROR, Message = "初始化连接,请检查网络连接与配置后复位!", ErrorCode = LeftMaterialServiceErrorCodeEnum.INI_GETREQ
                    });
                    Thread.Sleep(1000);
                }


                bool dev_reset = false;
                while (dev_reset == false)
                {
                    ControlDevice.GetHouseFCSReset(ref dev_reset);
                    SendLeftMaterialServiceStateMessage(
                        new LeftMaterialServiceState {
                        State = LeftMaterialServiceStateEnum.WARN, Message = "初始化失败,等待设备的复位信号", ErrorCode = LeftMaterialServiceErrorCodeEnum.NORMAL
                    });
                    Thread.Sleep(1000);
                }
            }
            Temp_S_House_RequestFCS_Last = temp_S_House_RequestFCS_Last;

            #endregion

            while (!token.IsCancellationRequested)
            {
                //料库请求
                var ret_tuple = LeftMaterialFlow().Result;
                if (ret_tuple.Item1 == false)
                {
                    ret = false;
                    while (ret == false)
                    {
                        ret = ControlDevice.SetHouseFCSAlarm(true);
                        SendLeftMaterialServiceStateMessage(
                            new LeftMaterialServiceState {
                            State = LeftMaterialServiceStateEnum.ERROR, Message = "左侧料库请求调用失败,请检查后复位!", ErrorCode = ret_tuple.Item2
                        });
                        Thread.Sleep(1000);
                    }

                    bool dev_reset = false;
                    while (dev_reset == false)
                    {
                        ControlDevice.GetHouseFCSReset(ref dev_reset);
                        SendLeftMaterialServiceStateMessage(
                            new LeftMaterialServiceState {
                            State = LeftMaterialServiceStateEnum.WARN, Message = "左侧料库请求调用失败,等待设备的复位信号", ErrorCode = LeftMaterialServiceErrorCodeEnum.NORMAL
                        });
                        Thread.Sleep(1000);
                    }

                    SendLeftMaterialServiceStateMessage(
                        new LeftMaterialServiceState {
                        State = LeftMaterialServiceStateEnum.WARN, Message = "左侧料库请求调用失败,设备复位", ErrorCode = LeftMaterialServiceErrorCodeEnum.NORMAL
                    });
                }
                else
                {
                }
                Thread.Sleep(1000);
            }
        }