Commit 8dcd1291 张东亮

1

1 个父辈 bbf89a45
正在显示 1 个修改的文件 包含 36 行增加28 行删除
...@@ -23,7 +23,7 @@ namespace TheMachine ...@@ -23,7 +23,7 @@ namespace TheMachine
crc.OpenResourceLog = true; crc.OpenResourceLog = true;
InitializeComponent(); InitializeComponent();
this.FormClosing += Form1_FormClosing; this.FormClosing += Form1_FormClosing;
this.Text = Config.Get(Setting_Init.App_Title) +" "+ Config.Get("CID"); this.Text = Config.Get(Setting_Init.App_Title) + " " + Config.Get("CID");
crc.GetLanguageEvent += Crc_GetLanguageEvent; crc.GetLanguageEvent += Crc_GetLanguageEvent;
crc.LanguageChangeEvent += Crc_LanguageChangeEvent; crc.LanguageChangeEvent += Crc_LanguageChangeEvent;
crc.CurrLanguage = Crc_GetLanguageEvent(); crc.CurrLanguage = Crc_GetLanguageEvent();
...@@ -44,7 +44,7 @@ namespace TheMachine ...@@ -44,7 +44,7 @@ namespace TheMachine
private string Crc_GetLanguageEvent() private string Crc_GetLanguageEvent()
{ {
return ConfigHelper.Config.Get("Device_Default_Language","zh-CN"); return ConfigHelper.Config.Get("Device_Default_Language", "zh-CN");
} }
private void Form1_FormClosing(object sender, FormClosingEventArgs e) private void Form1_FormClosing(object sender, FormClosingEventArgs e)
...@@ -123,7 +123,7 @@ namespace TheMachine ...@@ -123,7 +123,7 @@ namespace TheMachine
cb_EnableBuzzer.Checked = Config.Get("Device_EnableBuzzer", true); cb_EnableBuzzer.Checked = Config.Get("Device_EnableBuzzer", true);
AlarmBuzzer.BuzzerStateChange += AlarmBuzzer_BuzzerStateChange; AlarmBuzzer.BuzzerStateChange += AlarmBuzzer_BuzzerStateChange;
RobotManage.LoadFinishEvent += RobotManage_LoadFinishEvent; RobotManage.LoadFinishEvent += RobotManage_LoadFinishEvent;
if (!Config.Get("Device_DisableLogWindow",true)) if (!Config.Get("Device_DisableLogWindow", true))
AddForm("tab_log", crc.GetString(L.tab_log, "日志"), lc); AddForm("tab_log", crc.GetString(L.tab_log, "日志"), lc);
RobotManage.UserPauseSet += RobotManage_UserPauseSet; RobotManage.UserPauseSet += RobotManage_UserPauseSet;
...@@ -142,17 +142,14 @@ namespace TheMachine ...@@ -142,17 +142,14 @@ namespace TheMachine
// Thread.Sleep(100); // Thread.Sleep(100);
// Application.DoEvents(); // Application.DoEvents();
//} //}
this.DoubleBuffered = true;
pnl.Enabled = false; pnl.Enabled = false;
} }
private void CameraA_camera_event(object sender, Bitmap e) private void CameraA_camera_event(object sender, Bitmap e)
{ {
this.Invoke((EventHandler<Bitmap>)delegate this.Invoke((EventHandler<Bitmap>)delegate
{ {
pictureBox1.Visible = true; pictureBox1.Visible = true;
pictureBox1.Image = e; pictureBox1.Image = e;
Application.DoEvents();
}, sender, e); }, sender, e);
} }
private void CameraB_camera_event(object sender, Bitmap e) private void CameraB_camera_event(object sender, Bitmap e)
...@@ -165,7 +162,8 @@ namespace TheMachine ...@@ -165,7 +162,8 @@ namespace TheMachine
} }
private void AlarmBuzzer_BuzzerStateChange(object sender, bool e) private void AlarmBuzzer_BuzzerStateChange(object sender, bool e)
{ {
this.Invoke((EventHandler<bool>)delegate { this.Invoke((EventHandler<bool>)delegate
{
btn_PauseBuzzer.Visible = e; btn_PauseBuzzer.Visible = e;
}, sender, e); }, sender, e);
} }
...@@ -176,8 +174,9 @@ namespace TheMachine ...@@ -176,8 +174,9 @@ namespace TheMachine
e.Cancel = true; e.Cancel = true;
} }
const int tabpagecount = 4; const int tabpagecount = 4;
void addTablePage() { void addTablePage()
AddForm("tab_io",crc.GetString(L.tab_io,"IO调试"), ioc); {
AddForm("tab_io", crc.GetString(L.tab_io, "IO调试"), ioc);
AddForm("tab_axis", crc.GetString(L.tab_axis, "伺服调试"), ac); AddForm("tab_axis", crc.GetString(L.tab_axis, "伺服调试"), ac);
AddForm("tab_store", crc.GetString(L.tab_store, "库位调试"), bd); AddForm("tab_store", crc.GetString(L.tab_store, "库位调试"), bd);
AddForm("tab_setting", crc.GetString(L.tab_setting, "相关设置"), sc); AddForm("tab_setting", crc.GetString(L.tab_setting, "相关设置"), sc);
...@@ -205,7 +204,7 @@ namespace TheMachine ...@@ -205,7 +204,7 @@ namespace TheMachine
{ {
continue; continue;
} }
ListViewItem lvi = new ListViewItem(new string[] { "", moveInfo.Name, moveInfo.MoveStep.ToString(),moveInfo.GetStateStr() }); ListViewItem lvi = new ListViewItem(new string[] { "", moveInfo.Name, moveInfo.MoveStep.ToString(), moveInfo.GetStateStr() });
stateView.Items.Add(lvi); stateView.Items.Add(lvi);
} }
this.ResumeLayout(true); this.ResumeLayout(true);
...@@ -242,7 +241,7 @@ namespace TheMachine ...@@ -242,7 +241,7 @@ namespace TheMachine
return; return;
RobotManage.IsConfigMode = RobotManage.IsConfigMode ? false : true; RobotManage.IsConfigMode = RobotManage.IsConfigMode ? false : true;
(sender as ToolStripMenuItem).Text = !RobotManage.IsConfigMode ? crc.GetString(L.enable_config_mode,"启用配置模式") : crc.GetString(L.disable_config_mode, "停用配置模式"); (sender as ToolStripMenuItem).Text = !RobotManage.IsConfigMode ? crc.GetString(L.enable_config_mode, "启用配置模式") : crc.GetString(L.disable_config_mode, "停用配置模式");
if (RobotManage.IsConfigMode) if (RobotManage.IsConfigMode)
...@@ -254,9 +253,9 @@ namespace TheMachine ...@@ -254,9 +253,9 @@ namespace TheMachine
else else
{ {
var tc = tabc.TabPages.Count; var tc = tabc.TabPages.Count;
for (int i = 1; i <=tabpagecount; i++) for (int i = 1; i <= tabpagecount; i++)
{ {
tabc.TabPages[tc-i].Parent = null; tabc.TabPages[tc - i].Parent = null;
} }
} }
} }
...@@ -271,7 +270,8 @@ namespace TheMachine ...@@ -271,7 +270,8 @@ namespace TheMachine
var d = new setmsgdelegate(SetMsg); var d = new setmsgdelegate(SetMsg);
this.Invoke(d, msgs); this.Invoke(d, msgs);
} }
catch(Exception e) { catch (Exception e)
{
LogUtil.info("MainMachine_ProcessMsgEvent:" + e.ToString()); LogUtil.info("MainMachine_ProcessMsgEvent:" + e.ToString());
} }
} }
...@@ -299,8 +299,9 @@ namespace TheMachine ...@@ -299,8 +299,9 @@ namespace TheMachine
LogUtil.error($"测试拍照:{cameraName}完成"); LogUtil.error($"测试拍照:{cameraName}完成");
bmp.Dispose(); bmp.Dispose();
} }
catch (Exception ex) { catch (Exception ex)
LogUtil.error($"测试拍照错误:{cameraName}:"+ex.ToString()); {
LogUtil.error($"测试拍照错误:{cameraName}:" + ex.ToString());
} }
} }
btn_run.Enabled = true; btn_run.Enabled = true;
...@@ -311,7 +312,7 @@ namespace TheMachine ...@@ -311,7 +312,7 @@ namespace TheMachine
ioc.Config = RobotManage.Config; ioc.Config = RobotManage.Config;
bd.Config = RobotManage.Config; bd.Config = RobotManage.Config;
var lm = new List<Msg>(); var lm = new List<Msg>();
foreach (string ms in msg.Split(new char[] { '\n' },StringSplitOptions.RemoveEmptyEntries)) foreach (string ms in msg.Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries))
{ {
var m = new Msg(); var m = new Msg();
m.datetime = DateTime.Now; m.datetime = DateTime.Now;
...@@ -335,7 +336,7 @@ namespace TheMachine ...@@ -335,7 +336,7 @@ namespace TheMachine
listView1.Items.Clear(); listView1.Items.Clear();
foreach (Msg msg in msgs) foreach (Msg msg in msgs)
{ {
if (string.IsNullOrEmpty(msg.msgtxt) || msg.datetime==null) if (string.IsNullOrEmpty(msg.msgtxt) || msg.datetime == null)
continue; continue;
ListViewItem lvi = new ListViewItem(new string[] { "", msg.datetime.ToString(), msg.msgtxt }); ListViewItem lvi = new ListViewItem(new string[] { "", msg.datetime.ToString(), msg.msgtxt });
...@@ -347,13 +348,15 @@ namespace TheMachine ...@@ -347,13 +348,15 @@ namespace TheMachine
if (msg.errInfo == ErrInfo.X09_BoxNotDetect) if (msg.errInfo == ErrInfo.X09_BoxNotDetect)
{ {
btn_IgnoreX09.Visible = true; btn_IgnoreX09.Visible = true;
}else if (msg.errInfo == ErrInfo.X09_Clear) }
else if (msg.errInfo == ErrInfo.X09_Clear)
{ {
btn_IgnoreX09.Visible = false; btn_IgnoreX09.Visible = false;
} }
else if (msg.errInfo == ErrInfo.RunBtn||msg.errInfo == ErrInfo.ResetBtn) else if (msg.errInfo == ErrInfo.RunBtn || msg.errInfo == ErrInfo.ResetBtn)
{
Task.Run(() =>
{ {
Task.Run(()=> {
Task.Delay(2000).Wait(); Task.Delay(2000).Wait();
if (!RobotManage.isRunning) if (!RobotManage.isRunning)
btn_run_Click(this, EventArgs.Empty); btn_run_Click(this, EventArgs.Empty);
...@@ -362,7 +365,8 @@ namespace TheMachine ...@@ -362,7 +365,8 @@ namespace TheMachine
} }
else if (msg.errInfo == ErrInfo.SuddenStop) else if (msg.errInfo == ErrInfo.SuddenStop)
{ {
Task.Run(()=> { Task.Run(() =>
{
if (RobotManage.isRunning) if (RobotManage.isRunning)
btn_stop_Click(this, EventArgs.Empty); btn_stop_Click(this, EventArgs.Empty);
}); });
...@@ -458,9 +462,12 @@ namespace TheMachine ...@@ -458,9 +462,12 @@ namespace TheMachine
private void 退出ToolStripMenuItem_Click(object sender, EventArgs e) private void 退出ToolStripMenuItem_Click(object sender, EventArgs e)
{ {
if (RobotManage.isRunning) { if (RobotManage.isRunning)
{
MessageBox.Show(crc.GetString(L.device_isrunning_cant_exit, "机器尚在运行,不能退出,请先停止运行.")); MessageBox.Show(crc.GetString(L.device_isrunning_cant_exit, "机器尚在运行,不能退出,请先停止运行."));
} else { }
else
{
RobotManage.Stop(); RobotManage.Stop();
RobotManage.ShutDown(); RobotManage.ShutDown();
Thread.Sleep(2000); Thread.Sleep(2000);
...@@ -557,13 +564,14 @@ namespace TheMachine ...@@ -557,13 +564,14 @@ namespace TheMachine
MessageBox.Show(crc.GetString(L.safty_releaseed_string, "料串已是释放状态")); MessageBox.Show(crc.GetString(L.safty_releaseed_string, "料串已是释放状态"));
return; return;
} }
else if (RobotManage.mainMachine.StringMoveInfo.MoveStep>=MoveStep.StringOut_01) else if (RobotManage.mainMachine.StringMoveInfo.MoveStep >= MoveStep.StringOut_01)
{ {
MessageBox.Show(crc.GetString(L.safty_releaseing_string, "正在执行料串释放")); MessageBox.Show(crc.GetString(L.safty_releaseing_string, "正在执行料串释放"));
return; return;
} }
Task.Run(() => { Task.Run(() =>
{
int timeout = 2 * 60; int timeout = 2 * 60;
while (timeout > 0) while (timeout > 0)
{ {
...@@ -573,12 +581,12 @@ namespace TheMachine ...@@ -573,12 +581,12 @@ namespace TheMachine
{ {
Invoke((EventHandler)delegate Invoke((EventHandler)delegate
{ {
(sender as Button).Text = crc.GetString(L.safty_releaseing_string, $"正在执行料串释放")+$"({timeout / 2})"; (sender as Button).Text = crc.GetString(L.safty_releaseing_string, $"正在执行料串释放") + $"({timeout / 2})";
}); });
} }
var step = RobotManage.mainMachine.StringMoveInfo.MoveStep; var step = RobotManage.mainMachine.StringMoveInfo.MoveStep;
var clampstep = RobotManage.mainMachine.ClampMoveInfo.MoveStep; var clampstep = RobotManage.mainMachine.ClampMoveInfo.MoveStep;
if (step == MoveStep.StringReadyGet && clampstep>= MoveStep.ReelClamp_GetHeight) if (step == MoveStep.StringReadyGet && clampstep >= MoveStep.ReelClamp_GetHeight)
{ {
RobotManage.mainMachine.StringMoveInfo.NextMoveStep(MoveStep.StringOut_01); RobotManage.mainMachine.StringMoveInfo.NextMoveStep(MoveStep.StringOut_01);
break; break;
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!