Exemple #1
0
        private async Task   ConnectionAsync()
        {
            string ErrMsg = await Task.Run(() => CreateDataChange()); //创建

            FmInfo.GetTaskInfo(plc.ReadAndWriteCGYTaskConpelte());    //获取常规烟未取走完成信号
            FmInfo.GetTaskInfo(plc.ReadAndWriteYXYTaskConpelte());    //获取异形烟未取走完成信号
            if (string.IsNullOrWhiteSpace(ErrMsg))                    //事件创建成功
            {
                if (modbus.Connection())
                {
                    FmInfo.GetTaskInfo("机械手连接成功!");
                    Task.Run(() => modbus.ReadAsync());
                }
                else
                {
                    FmInfo.GetTaskInfo("机械手连接失败!");
                }
                FmInfo.GetTaskInfo("启动定时器,触发倍速链,翻版跳变!");
                FmInfo.Func(1);
                EnabletStartAndStop(1);
                timer1.Interval = 1000 * GlobalPara.TimerIntervalStart;
                timer1.Start(); //启动定时器
            }
            else
            {
                FmInfo.GetTaskInfo("客户端初始化失败!错误:" + ErrMsg);
            }

            FmInfo.Func(1);
            EnabletStartAndStop(1);
        }