MainMachine _BtnProcess.cs 2.1 KB
using CodeLibrary;
using OnlineStore;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace DeviceLibrary
{
    partial class MainMachine
    {
        void BtnProcess()
        { 
            
        }
        void Reset_BTN() {
            if (IOValue(IO_Type.SuddenStop_BTN).Equals(IO_VALUE.HIGH))
            {
                foreach (var al in AxisBean.List.Values.ToList())
                {
                    if (!AxisBean.ClearMultiAlarm(out string msg, al))
                        Msg.add(msg, MsgLevel.warning);
                }
                Msg.add(crc.GetString("Res0161","按下复位按钮."), MsgLevel.info, ErrInfo.ResetBtn);
            }
            else
            {
                Msg.add(crc.GetString("Res0162","急停未解除,按下复位按钮尝试复位安全继电器."), MsgLevel.info);
            }

            LogUtil.info("按下复位按钮");
            Msg.Show();

            //暂停时按下reaet按钮
            if (RobotManage.isRunning && RobotManage.mainMachine.UserPause)
            {
                RobotManage.UserPause("Reset_BTN", false);
            }
        }
        bool isfirstrun = true;
        void Run_BTN() {
            if (IOValue(IO_Type.SuddenStop_BTN).Equals(IO_VALUE.HIGH))
            {
                if (!RobotManage.isRunning)
                {
                    if (isfirstrun)
                    {
                        isfirstrun = false;
                        Msg.add(crc.GetString("Res0163", "检测到自动运行状态,开始启动."), MsgLevel.info, ErrInfo.RunBtn);
                    }
                }
                else
                    Msg.add(crc.GetString("Res0164", "系统正在运行."), MsgLevel.info);
            }
            else 
            {
                Msg.add(crc.GetString("Res0165","急停中,按下启动按钮,无法启动."), MsgLevel.warning);
            }
            LogUtil.info("按下启动按钮");
            Msg.Show();
        }
    }
}