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()
        {

        }
        bool lastSuddenStop = true;
        void Reset_BTN()
        {
            LogUtil.info("按下复位按钮");
            if (!lastSuddenStop && IOValue(IO_Type.SuddenStop_BTN).Equals(IO_VALUE.HIGH))
            {
                Msg.add(crc.GetString(L.reset_press, "按下复位按钮."), MsgLevel.info, ErrInfo.ResetBtn);
            }
            else
            {
                Msg.add(crc.GetString(L.reset_press_with_sudden, "急停未解除,按下复位按钮尝试复位安全继电器."), MsgLevel.info, ErrInfo.SuddenStop);
                return;
            }
            lastSuddenStop = false;

            ProcessMsgEvent?.Invoke(Msg.get());

            //暂停时按下reaet按钮
            if (RobotManage.isRunning && RobotManage.mainMachine.UserPause)
            {
                RobotManage.UserPause("Reset_BTN", false);
            }
        }
        void Run_BTN()
        {
            if (!lastSuddenStop && IOValue(IO_Type.SuddenStop_BTN).Equals(IO_VALUE.HIGH))
            {
                if (!RobotManage.isRunning)
                    Msg.add(crc.GetString(L.runbtn_press, "按下启动按钮,开始启动."), MsgLevel.info, ErrInfo.RunBtn);
                else
                    Msg.add(crc.GetString(L.system_is_running, "系统正在运行."), MsgLevel.info);
            }
            else
            {
                Msg.add(crc.GetString(L.runbtn_press_with_sudden, "急停中,按下启动按钮,无法启动."), MsgLevel.warning);
            }
            lastSuddenStop = false;
            LogUtil.info("按下启动按钮");
            ProcessMsgEvent?.Invoke(Msg.get());
        }
        void SuddenStop_BTN()
        {
            lastSuddenStop = true;
            RobotManage.Stop();
        }
    }
}