MainMachine _BtnProcess.cs 1.8 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, Config).Equals(IO_VALUE.HIGH))
            {
                MsgService.Add(crc.GetString("Res0131","按下复位按钮."), MsgLevel.info, ErrInfo.ResetBtn);
                //if (!RobotManage.isRunning)
                    RobotManage.Start(MachineSideE.Left | MachineSideE.Right);
            }
            else
            {
                MsgService.Add(crc.GetString("Res0132","急停未解除,按下复位按钮尝试复位安全继电器."), MsgLevel.info);
            }

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

        void HomeReset_BTN()
        {
            if (IOValue(IO_Type.SuddenStop_BTN, Config).Equals(IO_VALUE.HIGH))
            {
                MsgService.Add(crc.GetString("Res0131", "按下复位按钮."), MsgLevel.info, ErrInfo.ResetBtn);
            }
            else
            {
                MsgService.Add(crc.GetString("Res0132", "急停未解除,按下复位按钮尝试复位安全继电器."), MsgLevel.info, ErrInfo.SuddenStop);
            }

                LogUtil.info("长按下复位按钮,系统正在运行,开始复位");
            RobotManage.Stores.ForEach(s => {
                if (s.isRunning)
                {
                    LogUtil.info($"{s.MachineSide}侧回原");
                    s.BeginHomeReset();
                }
            });

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