Commit 2a98a472 张东亮

1

1 个父辈 e8101af2
...@@ -21,7 +21,8 @@ namespace OnlineStore ...@@ -21,7 +21,8 @@ namespace OnlineStore
public static readonly ILog LOG = LogManager.GetLogger("LngResource"); public static readonly ILog LOG = LogManager.GetLogger("LngResource");
public static bool OpenResourceLog = false; public static bool OpenResourceLog = false;
public static string China = "zh-CN"; public static string China = "zh-CN";
public static string Japan = "ja-JP";
public static string English = "en-US";
private static Dictionary<string,Dictionary<string, string>> LangMap = new Dictionary<string, Dictionary<string, string>>(); private static Dictionary<string,Dictionary<string, string>> LangMap = new Dictionary<string, Dictionary<string, string>>();
public delegate string GetLanguageDelegate(); public delegate string GetLanguageDelegate();
......
此文件类型无法预览
...@@ -8,6 +8,7 @@ using System.Linq; ...@@ -8,6 +8,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Web.Management;
namespace DeviceLibrary namespace DeviceLibrary
{ {
...@@ -104,6 +105,12 @@ namespace DeviceLibrary ...@@ -104,6 +105,12 @@ namespace DeviceLibrary
return ""; return "";
} }
/// <summary>
/// 入库请求
/// </summary>
/// <param name="codelist"></param>
/// <param name="reel"></param>
/// <param name="printlog"></param>
public void SendInStoreRequest(string[] codelist, ReelParam reel, bool printlog = false) public void SendInStoreRequest(string[] codelist, ReelParam reel, bool printlog = false)
{ {
...@@ -137,41 +144,54 @@ namespace DeviceLibrary ...@@ -137,41 +144,54 @@ namespace DeviceLibrary
} }
public bool SendStoreState(string posid, StoreStatus storeStatus) public bool SendStoreState(string posid, StoreStatus storeStatus)
{ {
lock (serverclock) if (Monitor.TryEnter(serverclock, 300))
{ {
Operation operation = getLineBoxStatus(); try
if (!string.IsNullOrEmpty(posid)) {
operation.boxStatus[StoreID].data.Add(ParamDefine.posId, posid);
operation.boxStatus[StoreID].status = (int)storeStatus; Operation operation = getLineBoxStatus();
if (!string.IsNullOrEmpty(posid))
operation.boxStatus[StoreID].data.Add(ParamDefine.posId, posid);
LogUtil.info(JsonHelper.SerializeObject(operation)); operation.boxStatus[StoreID].status = (int)storeStatus;
if (RobotManage.InoutDebugMode)
return true;
Operation resultOperation = HttpHelper.Post(GetPostApi(), operation, 5000, true);
if (resultOperation == null) LogUtil.info($"SendStoreState 【{posid}】【{storeStatus}】【{JsonHelper.SerializeObject(operation)}】");
{ if (RobotManage.InoutDebugMode)
LogUtil.info($"SendStoreState error,posid:{posid}, storeStatus:{storeStatus}"); return true;
return false; Operation resultOperation = HttpHelper.Post(GetPostApi(), operation, 5000, true);
}
if (operation.seq != resultOperation.seq)
{
LogUtil.info($"SendStoreState seq error,posid:{posid}, storeStatus:{storeStatus}");
return false;
}
LogUtil.info($"SendStoreState success,posid:{posid}, storeStatus:{storeStatus}"); if (resultOperation == null)
ResultProcess(resultOperation); {
LogUtil.info($"SendStoreState error,posid:{posid}, storeStatus:{storeStatus}");
return false;
}
if (operation.seq != resultOperation.seq)
{
LogUtil.info($"SendStoreState seq error,posid:{posid}, storeStatus:{storeStatus}");
return false;
}
LogUtil.info($"SendStoreState success,posid:{posid}, storeStatus:{storeStatus}");
ResultProcess(resultOperation);
if (storeStatus == StoreStatus.OutStoreEnd ||
storeStatus == StoreStatus.OutStoreBoxEnd ||
storeStatus == StoreStatus.InStoreEnd)
{
this.storeStatus = StoreStatus.StoreOnline;
}
if (storeStatus == StoreStatus.OutStoreEnd || }
storeStatus == StoreStatus.OutStoreBoxEnd || finally
storeStatus == StoreStatus.InStoreEnd)
{ {
this.storeStatus = StoreStatus.StoreOnline; Monitor.Exit(serverclock);
} }
return true;
}
else
{
return false;
} }
return true;
} }
public string spiltStr = "##"; public string spiltStr = "##";
private string ProcessCode(string[] codeList, int reelw, int reelh) private string ProcessCode(string[] codeList, int reelw, int reelh)
...@@ -293,42 +313,48 @@ namespace DeviceLibrary ...@@ -293,42 +313,48 @@ namespace DeviceLibrary
{ {
if (RobotManage.InoutDebugMode) if (RobotManage.InoutDebugMode)
return; return;
if (Monitor.TryEnter(serverclock, 50))
lock (serverclock)
{ {
bool printlog = false; try
DateTime time = DateTime.Now;
//构建发送给服务器的对象
Operation lineOperation = getLineBoxStatus();
//如果还没湿度范围,先获取
if (getthtime < 3)
{ {
if (Max_Humidity <= 0 || (Max_Temperature <= 0)) bool printlog = false;
DateTime time = DateTime.Now;
//构建发送给服务器的对象
Operation lineOperation = getLineBoxStatus();
//如果还没湿度范围,先获取
if (getthtime < 3)
{ {
lineOperation.op = 5; if (Max_Humidity <= 0 || (Max_Temperature <= 0))
LogUtil.info(StoreName + "没有湿度预警范围,需要从服务器获取,发送OP=" + lineOperation.op); {
getthtime++; lineOperation.op = 5;
LogUtil.info(StoreName + "没有湿度预警范围,需要从服务器获取,发送OP=" + lineOperation.op);
getthtime++;
}
} }
}
if (lineOperation.status != laststatus) if (lineOperation.status != laststatus)
{ {
laststatus = lineOperation.status; laststatus = lineOperation.status;
printlog = true; printlog = true;
} }
Operation resultOperation = HttpHelper.Post(GetPostApi(), lineOperation, 1700, printlog); Operation resultOperation = HttpHelper.Post(GetPostApi(), lineOperation, 1700, printlog);
if (resultOperation != null) if (resultOperation != null)
getthtime = 0; getthtime = 0;
//LogUtil.info(JsonHelper.SerializeObject(resultOperation.data)); //LogUtil.info(JsonHelper.SerializeObject(resultOperation.data));
ResultProcess(resultOperation); ResultProcess(resultOperation);
TimeSpan span = DateTime.Now - time; TimeSpan span = DateTime.Now - time;
if (span.TotalMilliseconds > 1700) if (span.TotalMilliseconds > 1700)
{ {
LogUtil.info(StoreName + "TimerProcess[" + span.TotalMilliseconds + "]"); LogUtil.info(StoreName + "TimerProcess[" + span.TotalMilliseconds + "]");
}
ServerCommStr = $"Send:{JsonHelper.SerializeObject(lineOperation)}\r\n Recv:{JsonHelper.SerializeObject(resultOperation)}";
}
finally
{
Monitor.Exit(serverclock);
} }
ServerCommStr = $"Send:{JsonHelper.SerializeObject(lineOperation)}\r\n Recv:{JsonHelper.SerializeObject(resultOperation)}";
} }
} }
public int queueTaskCount = -1; public int queueTaskCount = -1;
......
...@@ -36,7 +36,7 @@ namespace DeviceLibrary ...@@ -36,7 +36,7 @@ namespace DeviceLibrary
ProcessMsgEvent?.Invoke(Msg.get()); ProcessMsgEvent?.Invoke(Msg.get());
//暂停时按下reaet按钮 //暂停时按下reaet按钮
if (RobotManage.isRunning && RobotManage.mainMachine.UserPause) if (RobotManage.isRunning && UserPause)
{ {
RobotManage.UserPause("Reset_BTN", false); RobotManage.UserPause("Reset_BTN", false);
} }
......
...@@ -341,6 +341,7 @@ namespace DeviceLibrary ...@@ -341,6 +341,7 @@ namespace DeviceLibrary
} }
} }
RobotManage.isRunning = false; RobotManage.isRunning = false;
RobotManage.UserPause($"isRunning = false", false);
LogUtil.info("主线程已退出."); LogUtil.info("主线程已退出.");
} }
public void Start() public void Start()
...@@ -359,8 +360,7 @@ namespace DeviceLibrary ...@@ -359,8 +360,7 @@ namespace DeviceLibrary
StopMove(true); StopMove(true);
IOMove(IO_Type.LineRun, IO_VALUE.LOW); IOMove(IO_Type.LineRun, IO_VALUE.LOW);
LedProcess(null); LedProcess(null);
LogUtil.info("开始停止系统3.");
} }
public void BeginHomeReset(bool firstRun = false) public void BeginHomeReset(bool firstRun = false)
{ {
......
...@@ -66,7 +66,7 @@ namespace DeviceLibrary ...@@ -66,7 +66,7 @@ namespace DeviceLibrary
} }
else else
{ {
RobotManage.UserPause("", false); RobotManage.UserPause("单口料盘已取走", false);
} }
} }
LogUtil.info($"取料机构当前没有在等待单盘入库:{ClampMoveInfo.MoveStep}"); LogUtil.info($"取料机构当前没有在等待单盘入库:{ClampMoveInfo.MoveStep}");
......
...@@ -20,34 +20,42 @@ namespace DeviceLibrary ...@@ -20,34 +20,42 @@ namespace DeviceLibrary
public static bool IsLoadOk = true; public static bool IsLoadOk = true;
public static bool IsConfigMode = false; public static bool IsConfigMode = false;
public static bool InoutDebugMode = false; public static bool InoutDebugMode = false;
public static bool DisableUpdownProtect { public static bool DisableUpdownProtect
{
get => ConfigHelper.Config.Get("Device_DisableUpdownProtect", false); get => ConfigHelper.Config.Get("Device_DisableUpdownProtect", false);
} }
public delegate void LoadFinish(bool state,string msg); public delegate void LoadFinish(bool state, string msg);
public static event LoadFinish LoadFinishEvent; public static event LoadFinish LoadFinishEvent;
public static event EventHandler<bool> UserPauseSet; public static event EventHandler<bool> UserPauseSet;
/// <summary>
/// 系统是否运行的标志
/// </summary>
public static bool isRunning = false; public static bool isRunning = false;
public static Dictionary<string, ACStorePosition> allPositionMap { get => CSVPositionReader<ACStorePosition>.allPositionMap; } public static Dictionary<string, ACStorePosition> allPositionMap { get => CSVPositionReader<ACStorePosition>.allPositionMap; }
static List<string> _positionNumList=null; static List<string> _positionNumList = null;
public static List<string> PositionNumList { get { public static List<string> PositionNumList
{
get
{
if (_positionNumList == null) if (_positionNumList == null)
_positionNumList = CSVPositionReader<ACStorePosition>.allPositionMap.Keys.ToList(); _positionNumList = CSVPositionReader<ACStorePosition>.allPositionMap.Keys.ToList();
return _positionNumList; return _positionNumList;
} }
} }
static string baseDir = Application.StartupPath; static string baseDir = Application.StartupPath;
static Thread mainThread; static Thread mainThread;
public static bool haveFixpos=false; public static bool haveFixpos = false;
public static HIKCamera CameraA=new HIKCamera(); public static HIKCamera CameraA = new HIKCamera();
public static void Init(params object[] param) { public static void Init(params object[] param)
{
string msg = ""; string msg = "";
try try
{ {
mainMachine = null; mainMachine = null;
string configFile = Path.Combine(baseDir, "config\\Config.csv"); string configFile = Path.Combine(baseDir, "config\\Config.csv");
Config = new Robot_Config(0, "", configFile); Config = new Robot_Config(0, "", configFile);
Config = (Robot_Config)CSVConfigReader.LoadConfig(Config); Config = (Robot_Config)CSVConfigReader.LoadConfig(Config);
...@@ -59,9 +67,10 @@ namespace DeviceLibrary ...@@ -59,9 +67,10 @@ namespace DeviceLibrary
LogUtil.info("加载位置文件:" + positionConfigFile); LogUtil.info("加载位置文件:" + positionConfigFile);
CSVPositionReader<ACStorePosition>.AddCSVFile(positionConfigFile); CSVPositionReader<ACStorePosition>.AddCSVFile(positionConfigFile);
} }
else { else
{
IsLoadOk = false; IsLoadOk = false;
msg += crc.GetString(L.cant_find_storeposfile, "找不到库位配置文件")+ "\n"; msg += crc.GetString(L.cant_find_storeposfile, "找不到库位配置文件") + "\n";
} }
string fixpositionConfigFile = Path.Combine(baseDir, "StoreConfig\\fixPositions.csv"); string fixpositionConfigFile = Path.Combine(baseDir, "StoreConfig\\fixPositions.csv");
if (File.Exists(fixpositionConfigFile)) if (File.Exists(fixpositionConfigFile))
...@@ -77,17 +86,18 @@ namespace DeviceLibrary ...@@ -77,17 +86,18 @@ namespace DeviceLibrary
if (!IOManager.ConnectionIOList(new List<string>())) if (!IOManager.ConnectionIOList(new List<string>()))
{ {
IsLoadOk = false; IsLoadOk = false;
msg += crc.GetString(L.iocard_init_fail, "IO板卡初始化失败")+ "\n"; msg += crc.GetString(L.iocard_init_fail, "IO板卡初始化失败") + "\n";
} }
// IOManager.CloseAllConnection(); // IOManager.CloseAllConnection();
//if (!CameraA.LoadCameraConfig(out string errmsg, param[0])) //if (!CameraA.LoadCameraConfig(out string errmsg, param[0]))
//{ //{
// IsLoadOk = false; // IsLoadOk = false;
// msg += errmsg + "\r\n"; // msg += errmsg + "\r\n";
//} //}
if (!HumitureController.Init(ConfigHelper.Config.Get("Device_Humiture_Port"))) { if (!HumitureController.Init(ConfigHelper.Config.Get("Device_Humiture_Port")))
{
IsLoadOk = false; IsLoadOk = false;
msg += crc.GetString(L.tempnhum_sensor_init_fail, $"温湿度传感器初始化失败,端口:")+ $"{ConfigHelper.Config.Get("Device_Humiture_Port")}\n"; msg += crc.GetString(L.tempnhum_sensor_init_fail, $"温湿度传感器初始化失败,端口:") + $"{ConfigHelper.Config.Get("Device_Humiture_Port")}\n";
} }
//Thread.Sleep(1000); //Thread.Sleep(1000);
//if (!IOManager.ConnectionIOList(new List<string>())) //if (!IOManager.ConnectionIOList(new List<string>()))
...@@ -99,17 +109,20 @@ namespace DeviceLibrary ...@@ -99,17 +109,20 @@ namespace DeviceLibrary
IOManager.IOMove(IO_Type.Camera_Led, IO_VALUE.HIGH); IOManager.IOMove(IO_Type.Camera_Led, IO_VALUE.HIGH);
} }
catch (Exception ex) { catch (Exception ex)
{
LogUtil.error("Init ", ex); LogUtil.error("Init ", ex);
LoadFinishEvent?.Invoke(false, ex.Message); LoadFinishEvent?.Invoke(false, ex.Message);
return; return;
} }
LoadFinishEvent?.Invoke(IsConfigMode ? IsConfigMode : IsLoadOk, msg); LoadFinishEvent?.Invoke(IsConfigMode ? IsConfigMode : IsLoadOk, msg);
} }
public static void LoadDebug() { public static void LoadDebug()
LoadFinishEvent?.Invoke(true, crc.GetString(L.open_debug_mode,"打开调试模式")); {
LoadFinishEvent?.Invoke(true, crc.GetString(L.open_debug_mode, "打开调试模式"));
} }
public static void Start() { public static void Start()
{
if (!IsLoadOk) if (!IsLoadOk)
{ {
...@@ -125,29 +138,26 @@ namespace DeviceLibrary ...@@ -125,29 +138,26 @@ namespace DeviceLibrary
return; return;
} }
isRunning = true; isRunning = true;
UserPause($"isRunning = true", false);
mainThread = new Thread(new ThreadStart(mainMachine.Start)); mainThread = new Thread(new ThreadStart(mainMachine.Start));
mainThread.Start(); mainThread.Start();
CameraA.startCamera(); CameraA.startCamera();
} }
GC.KeepAlive(mainThread); GC.KeepAlive(mainThread);
Task.Run(()=> { Task.Run(() =>
{
Task.Delay(1000).Wait(); Task.Delay(1000).Wait();
if (mainMachine.DeviceCheck()) if (mainMachine.DeviceCheck())
mainMachine.BeginHomeReset(true); mainMachine.BeginHomeReset(true);
}); });
} }
public static void Stop() public static void Stop()
{ {
LogUtil.info("开始停止系统."); LogUtil.info("开始停止系统.");
mainMachine?.Stop();
if (mainMachine != null)
{
mainMachine.Stop();
mainMachine.UserPause = false;
}
} }
public static void ShutDown() public static void ShutDown()
{ {
...@@ -155,22 +165,31 @@ namespace DeviceLibrary ...@@ -155,22 +165,31 @@ namespace DeviceLibrary
IOManager.CloseAllConnection(); IOManager.CloseAllConnection();
CameraA.stopCamera(); CameraA.stopCamera();
} }
public static void UserPause(bool userpause) public static bool IsUserPause
{ {
UserPause("", userpause); get { return mainMachine.UserPause; }
} }
public static void UserPause(string msg="",bool userpause=true) { /// <summary>
/// 用户暂停
/// </summary>
/// <param name="msg"></param>
/// <param name="userpause"></param>
public static void UserPause(string msg = "", bool userpause = true)
{
UserPauseSet?.Invoke(null, userpause); UserPauseSet?.Invoke(null, userpause);
mainMachine.UserPause = userpause; if (userpause != mainMachine.UserPause)
if (userpause)
{ {
if(string.IsNullOrEmpty(msg)) if (userpause)
LogUtil.info("用户暂停"); {
if (string.IsNullOrEmpty(msg))
LogUtil.info("用户暂停");
else
LogUtil.info("系统暂停: " + msg);
}
else else
LogUtil.info("系统暂停: "+msg); LogUtil.info("用户取消暂停:" + msg);
} }
else mainMachine.UserPause = userpause;
LogUtil.info("用户取消暂停:"+ msg);
} }
public static void IgnoreSafecheck(bool s) public static void IgnoreSafecheck(bool s)
{ {
...@@ -194,32 +213,33 @@ namespace DeviceLibrary ...@@ -194,32 +213,33 @@ namespace DeviceLibrary
reelParam = null; reelParam = null;
try try
{ {
string fix = ConfigHelper.Config.Get(Setting_Init.FixBuffInfo,""); string fix = ConfigHelper.Config.Get(Setting_Init.FixBuffInfo, "");
if(!string.IsNullOrEmpty(fix)) if (!string.IsNullOrEmpty(fix))
{ {
reelParam=JsonHelper.DeserializeJsonToObject<ReelParam>(fix); reelParam = JsonHelper.DeserializeJsonToObject<ReelParam>(fix);
return true; return true;
} }
} }
catch (Exception e) catch (Exception e)
{ {
LogUtil.error("解析校准库位缓存异常",e); LogUtil.error("解析校准库位缓存异常", e);
} }
return false; return false;
} }
public static void PutReelInFixPos(ReelParam reelParam) public static void PutReelInFixPos(ReelParam reelParam)
{ {
if (mainMachine.AutoInOutTest) return; if (mainMachine.AutoInOutTest) return;
ConfigHelper.Config.Set(Setting_Init.FixBuffInfo,JsonHelper.SerializeObject(reelParam)); ConfigHelper.Config.Set(Setting_Init.FixBuffInfo, JsonHelper.SerializeObject(reelParam));
} }
public static void ClearReelInFixPos() public static void ClearReelInFixPos()
{ {
ConfigHelper.Config.Set(Setting_Init.FixBuffInfo,""); ConfigHelper.Config.Set(Setting_Init.FixBuffInfo, "");
} }
#endregion #endregion
} }
public enum StoreType { public enum StoreType
TypeA,TypeB {
TypeA, TypeB
} }
} }
...@@ -39,16 +39,6 @@ ...@@ -39,16 +39,6 @@
<conversionPattern value="%m%n"/> <conversionPattern value="%m%n"/>
</layout> </layout>
</appender> </appender>
<appender name="HIK.IPCamera" type="log4net.Appender.RollingFileAppender">
<file value="logs/HIKIPCamera.log"/>
<param name="Encoding" value="UTF-8"/>
<appendToFile value="true"/>
<rollingStyle value="Date"/>
<datePattern value="yyyy-MM-dd"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%date][%t][%C:%L]%-5p %m%n"/>
</layout>
</appender>
<logger name="RollingLogFileAppender"> <logger name="RollingLogFileAppender">
<level value="ALL"/> <level value="ALL"/>
<appender-ref ref="RollingLogFileAppender"/> <appender-ref ref="RollingLogFileAppender"/>
...@@ -61,10 +51,6 @@ ...@@ -61,10 +51,6 @@
<level value="ALL"/> <level value="ALL"/>
<appender-ref ref="LngResource"/> <appender-ref ref="LngResource"/>
</logger> </logger>
<logger name="HIK.IPCamera" additivity="false">
<level value="ALL"/>
<appender-ref ref="HIK.IPCamera"/>
</logger>
<!--<root> <!--<root>
<level value="Info" /> <level value="Info" />
<appender-ref ref="RollingLogFileAppender" /> <appender-ref ref="RollingLogFileAppender" />
......
...@@ -14,6 +14,7 @@ using System.Runtime.Serialization.Formatters.Binary; ...@@ -14,6 +14,7 @@ using System.Runtime.Serialization.Formatters.Binary;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.StartPanel;
namespace TheMachine namespace TheMachine
{ {
...@@ -182,7 +183,7 @@ namespace TheMachine ...@@ -182,7 +183,7 @@ namespace TheMachine
{ {
SetState(MoveInfo.List); SetState(MoveInfo.List);
} }
void SetState(List<MoveInfo> moveInfoList) void SetState(List<MoveInfo> moveInfoList)
{ {
if (RobotManage.mainMachine == null) if (RobotManage.mainMachine == null)
...@@ -331,7 +332,7 @@ namespace TheMachine ...@@ -331,7 +332,7 @@ namespace TheMachine
// }); // });
// return; // return;
//} //}
if(Monitor.TryEnter(showMsgLoc)) if (Monitor.TryEnter(showMsgLoc))
{ {
try try
{ {
...@@ -390,8 +391,6 @@ namespace TheMachine ...@@ -390,8 +391,6 @@ namespace TheMachine
} }
} }
bool userpause = false;
private void btn_run_Click(object sender, EventArgs e) private void btn_run_Click(object sender, EventArgs e)
{ {
...@@ -403,25 +402,17 @@ namespace TheMachine ...@@ -403,25 +402,17 @@ namespace TheMachine
MainMachine_ProcessMsgEvent(Msg.get()); MainMachine_ProcessMsgEvent(Msg.get());
return; return;
} }
btn_run.Enabled = false;
LogUtil.info("用户按下启动按钮"); LogUtil.info("用户按下启动按钮");
RobotManage.Start(); RobotManage.Start();
userpause = false;
if (RobotManage.isRunning)
{
btn_stop.Enabled = true;
RobotManage_UserPauseSet(this, false);
}
} }
else if (!userpause) else if (!RobotManage.IsUserPause)
{ {
userpause = true; RobotManage.UserPause("用户按下启动按钮", true);
RobotManage.UserPause(userpause);
} }
else if (userpause) else if (RobotManage.IsUserPause)
{ {
userpause = false; RobotManage.UserPause("用户按下启动按钮", false);
RobotManage.UserPause(userpause);
} }
} }
private void RobotManage_UserPauseSet(object sender, bool e) private void RobotManage_UserPauseSet(object sender, bool e)
...@@ -434,17 +425,27 @@ namespace TheMachine ...@@ -434,17 +425,27 @@ namespace TheMachine
}, sender, e); }, sender, e);
return; return;
} }
btn_run.Enabled = true;
if (RobotManage.isRunning)
{
btn_stop.Enabled = true;
}
else
{
btn_stop.Enabled = false;
btn_run.Text = crc.GetString(L.start, "启动");
btn_run.BackColor = Color.Transparent;
cb_IgnoreSafecheck.Enabled = true;
return;
}
if (e) if (e)
{ {
userpause = true;
(btn_run as Button).Text = crc.GetString(L.device_resume, "恢复运行"); (btn_run as Button).Text = crc.GetString(L.device_resume, "恢复运行");
(btn_run as Button).BackColor = Color.LightGreen; (btn_run as Button).BackColor = Color.LightGreen;
cb_IgnoreSafecheck.Enabled = true; cb_IgnoreSafecheck.Enabled = true;
} }
else else
{ {
userpause = false;
(btn_run as Button).Text = crc.GetString(L.device_pause, "暂停运行"); (btn_run as Button).Text = crc.GetString(L.device_pause, "暂停运行");
(btn_run as Button).BackColor = Color.Yellow; (btn_run as Button).BackColor = Color.Yellow;
cb_IgnoreSafecheck.Enabled = false; cb_IgnoreSafecheck.Enabled = false;
...@@ -461,17 +462,15 @@ namespace TheMachine ...@@ -461,17 +462,15 @@ namespace TheMachine
}, sender, e); }, sender, e);
return; return;
} }
if (!btn_stop.Enabled) if (!btn_stop.Enabled)//已经停止,无需重复调用停止
return; return;
btn_stop.Enabled = false; btn_stop.Enabled = false;
LogUtil.info("用户按下停止按钮"); LogUtil.info("用户按下停止按钮");
RobotManage.UserPause(false);
userpause = false;
Task.Run(() => { RobotManage.Stop(); }); Task.Run(() => { RobotManage.Stop(); });
btn_run.Text = crc.GetString(L.start, "启动"); //btn_run.Text = crc.GetString(L.start, "启动");
btn_run.BackColor = Color.Transparent; //btn_run.BackColor = Color.Transparent;
cb_IgnoreSafecheck.Enabled = true; //cb_IgnoreSafecheck.Enabled = true;
} }
private void 退出ToolStripMenuItem_Click(object sender, EventArgs e) private void 退出ToolStripMenuItem_Click(object sender, EventArgs e)
...@@ -670,28 +669,25 @@ namespace TheMachine ...@@ -670,28 +669,25 @@ namespace TheMachine
if (RobotManage.isRunning) if (RobotManage.isRunning)
{ {
if (userpause) RobotManage_UserPauseSet(null, RobotManage.IsUserPause);
(btn_run as Button).Text = crc.GetString(L.device_resume, "恢复运行");
else
(btn_run as Button).Text = crc.GetString(L.device_pause, "暂停运行");
} }
} }
private void 简体中文ToolStripMenuItem_Click(object sender, EventArgs e) private void 简体中文ToolStripMenuItem_Click(object sender, EventArgs e)
{ {
Config.Set("Device_Default_Language", "zh-CN"); Config.Set("Device_Default_Language", crc.China);
crc.LanguageChange(); crc.LanguageChange();
} }
private void 日本语ToolStripMenuItem_Click(object sender, EventArgs e) private void 日本语ToolStripMenuItem_Click(object sender, EventArgs e)
{ {
Config.Set("Device_Default_Language", "ja-JP"); Config.Set("Device_Default_Language", crc.Japan);
crc.LanguageChange(); crc.LanguageChange();
} }
private void englishToolStripMenuItem_Click(object sender, EventArgs e) private void englishToolStripMenuItem_Click(object sender, EventArgs e)
{ {
Config.Set("Device_Default_Language", "en-US"); Config.Set("Device_Default_Language", crc.English);
crc.LanguageChange(); crc.LanguageChange();
} }
#region 窗口管理 #region 窗口管理
......
...@@ -98,7 +98,7 @@ namespace TheMachine ...@@ -98,7 +98,7 @@ namespace TheMachine
} }
else else
{ {
FrmPositionTool frmPositionTool = new FrmPositionTool(RobotManage.mainMachine.UpDown_Axis, IO_Type.Laser_Location); FrmPositionTool frmPositionTool = new FrmPositionTool(RobotManage.mainMachine.UpDown_Axis, IO_Type.TrayCheck_Fixture);
frmPositionTool.ShowDialog(); frmPositionTool.ShowDialog();
} }
} }
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!