Commit 71ebee91 LN

1.工作界面卡死问题修改。2.选程序后自动调宽修改。

1 个父辈 1a7b7999
...@@ -575,8 +575,8 @@ namespace TSA_V.DeviceLibrary ...@@ -575,8 +575,8 @@ namespace TSA_V.DeviceLibrary
LineStep.EndMove(); LineStep.EndMove();
IOManager.IOMove(IOManager.Line_FStart, IO_VALUE.LOW); IOManager.IOMove(IOManager.Line_FStart, IO_VALUE.LOW);
LogUtil.info("StopMove,开始停止所有旋转轴");
Thread.Sleep(PUSICANControl.SleepMS);
foreach (Dictionary<int, NodeInfo> map in RotateMap.Values) foreach (Dictionary<int, NodeInfo> map in RotateMap.Values)
{ {
foreach (NodeInfo nodeid in map.Values) foreach (NodeInfo nodeid in map.Values)
...@@ -584,6 +584,7 @@ namespace TSA_V.DeviceLibrary ...@@ -584,6 +584,7 @@ namespace TSA_V.DeviceLibrary
if (PUSICANControl.IsBusy(nodeid.NodeId)) if (PUSICANControl.IsBusy(nodeid.NodeId))
{ {
PUSICANControl.StopMove(nodeid.NodeId); PUSICANControl.StopMove(nodeid.NodeId);
Thread.Sleep(PUSICANControl.SleepMS);
} }
} }
} }
......
...@@ -52,30 +52,30 @@ namespace TSA_V ...@@ -52,30 +52,30 @@ namespace TSA_V
int preIndex = -1; int preIndex = -1;
private void cmbBoardList_SelectedIndexChanged(object sender, EventArgs e) private void cmbBoardList_SelectedIndexChanged(object sender, EventArgs e)
{ {
if (cmbBoardList.Text != "" && cmbBoardList.SelectedIndex >= 0&&(!cmbBoardList.SelectedIndex.Equals(preIndex))) if (cmbBoardList.Text != "" && cmbBoardList.SelectedIndex >= 0 && (!cmbBoardList.SelectedIndex.Equals(preIndex)))
{ {
preIndex = cmbBoardList.SelectedIndex; preIndex = cmbBoardList.SelectedIndex;
BoardInfo board = (BoardInfo)cmbBoardList.SelectedItem; BoardInfo board = (BoardInfo)cmbBoardList.SelectedItem;
if (board.boardId.Equals(-1)) if (board.boardId.Equals(-1))
{ {
lblBoardMsg.Text = ResourceCulture.GetString(ResourceCulture.SelectP,"请选择程序"); lblBoardMsg.Text = ResourceCulture.GetString(ResourceCulture.SelectP, "请选择程序");
lblBoardMsg.ForeColor = Color.Red; lblBoardMsg.ForeColor = Color.Red;
return; return;
} }
if (board != null) if (board != null)
{ {
lblBoardMsg.Text = board.GetDes(); lblBoardMsg.Text = board.GetDes();
this.lblBoardMsg.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(192)))), ((int)(((byte)(192))))); this.lblBoardMsg.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(192)))), ((int)(((byte)(192)))));
BoardManager.CurrBoard = board; BoardManager.CurrBoard = board;
LogUtil.info("切换到新板子:" + board.boardName); LogUtil.info("切换到新板子:" + board.boardName);
FrmProjectorScreen.instance.ShowPoint(false,board.smtList.ToArray()); FrmProjectorScreen.instance.ShowPoint(false, board.smtList.ToArray());
} }
} }
} }
private void btnBack_Click(object sender, EventArgs e) private void btnBack_Click(object sender, EventArgs e)
{ {
if (ChangeWidthTask != null&&ChangeWidthTask.IsCompleted.Equals(false)) if (ChangeWidthTask != null && ChangeWidthTask.IsCompleted.Equals(false))
{ {
LWidthManager.StopChangeWidth(); LWidthManager.StopChangeWidth();
LogUtil.info(Name + "返回之前,停止调宽"); LogUtil.info(Name + "返回之前,停止调宽");
...@@ -198,36 +198,37 @@ namespace TSA_V ...@@ -198,36 +198,37 @@ namespace TSA_V
int p = LWidthManager.GetWidthPosition(w); int p = LWidthManager.GetWidthPosition(w);
LogUtil.info(" 选择程序[" + BoardManager.CurrBoard.boardName + "]后,开始轨道调宽:【" + w + "】【" + p + "】"); LogUtil.info(" 选择程序[" + BoardManager.CurrBoard.boardName + "]后,开始轨道调宽:【" + w + "】【" + p + "】");
DialogResult result= MessageBox.Show("当前宽度[],目标宽度[],是否开始调宽","提示",MessageBoxButtons.OKCancel,MessageBoxIcon.Question); DialogResult result = MessageBox.Show("当前宽度["+LWidthManager.Line_LastWidth+"],目标宽度["+ w + "],是否开始调宽", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
if (!result.Equals(DialogResult.OK)) if (!result.Equals(DialogResult.OK))
{ {
return; return;
} }
if (!LWidthManager.CanStartChWidth()) if (!LWidthManager.CanStartChWidth())
{ {
MessageBox.Show("启动调宽失败"); MessageBox.Show("启动调宽失败");
return; return;
} }
FormEn(false); Task.Factory.StartNew(delegate FormEn(false);
Task.Factory.StartNew(delegate
{ {
ChangeWidthTask = Task.Factory.StartNew(delegate ChangeWidthTask = Task.Factory.StartNew(delegate
{ {
//string result = LWidthManager.StartChangeWidth(w, p); string ok = LWidthManager.StartChangeWidth(w, p);
//LogUtil.info("调宽" + w + "=" + p + "结束:" + result); LogUtil.info("调宽" + w + "=" + p + "结束:" + ok);
//if (String.IsNullOrEmpty(result)) if (String.IsNullOrEmpty(ok))
//{ {
// MessageBox.Show("调宽" + w + "=" + p + "完成"); MessageBox.Show("调宽" + w + "=" + p + "完成");
//} }
//else else
//{ {
// MessageBox.Show("调宽" + w + "=" + p + "结束:" + result); MessageBox.Show("调宽" + w + "=" + p + "结束:" + ok);
//} }
Thread.Sleep(5000); //Thread.Sleep(5000);
}); });
ChangeWidthTask.Wait(); ChangeWidthTask.Wait();
FormEn(true); FormEn(true);
}); });
......
...@@ -106,7 +106,7 @@ ...@@ -106,7 +106,7 @@
// //
// timer // timer
// //
this.timer.Interval = 250; this.timer.Interval = 1000;
this.timer.Tick += new System.EventHandler(this.timer_Tick); this.timer.Tick += new System.EventHandler(this.timer_Tick);
// //
// timerShowForm // timerShowForm
......
...@@ -80,7 +80,7 @@ namespace TSA_V ...@@ -80,7 +80,7 @@ namespace TSA_V
TSAVBean.InputCodeEvent += TSAVBean_InputCodeEvent; TSAVBean.InputCodeEvent += TSAVBean_InputCodeEvent;
IsSet = true; IsSet = true;
} }
isInitOk = true; isInitOk = true;
// string ip = ConfigAppSettings.GetValue(Setting_Init.StatusServerIp); // string ip = ConfigAppSettings.GetValue(Setting_Init.StatusServerIp);
// bool result = StatusClient.instance.Connect(); // bool result = StatusClient.instance.Connect();
// LogUtil.info("连接状态服务器【" + ip + "】【" + result + "】【" + StatusClient.instance.ErrInfo + "】"); // LogUtil.info("连接状态服务器【" + ip + "】【" + result + "】【" + StatusClient.instance.ErrInfo + "】");
...@@ -219,11 +219,11 @@ namespace TSA_V ...@@ -219,11 +219,11 @@ namespace TSA_V
picPoint.Height = pHeight; picPoint.Height = pHeight;
picPoint.Width = pWidth; picPoint.Width = pWidth;
} }
} }
private void timer_Tick(object sender, EventArgs e) private void timer_Tick(object sender, EventArgs e)
{ {
try try
{ {
TimeSpan ss = DateTime.Now - LastTime; TimeSpan ss = DateTime.Now - LastTime;
if (ss.TotalSeconds > TSAVBean.AuToModeSeconds) if (ss.TotalSeconds > TSAVBean.AuToModeSeconds)
{ {
...@@ -240,10 +240,10 @@ namespace TSA_V ...@@ -240,10 +240,10 @@ namespace TSA_V
if (TSAVBean.Status.Equals(TSAVStatus.Runing)) if (TSAVBean.Status.Equals(TSAVStatus.Runing))
{ {
//如果没有开始工作,自动开始工作 //如果没有开始工作,自动开始工作
if (!TSAVBean.Work.IsWorking && btnStart.Enabled) //if (!TSAVBean.Work.IsWorking && btnStartWorking.Enabled)
{ //{
btnStart_Click(null, null); // btnStartWorking_Click(null, null);
} //}
if (!preIndex.Equals(TSAVBean.Work.currIndex) && (TSAVBean.Work.currPoint != null)) if (!preIndex.Equals(TSAVBean.Work.currIndex) && (TSAVBean.Work.currPoint != null))
{ {
ShowTSAVPoint(); ShowTSAVPoint();
...@@ -252,7 +252,7 @@ namespace TSA_V ...@@ -252,7 +252,7 @@ namespace TSA_V
{ {
ShowAOI(); ShowAOI();
} }
} }
}catch (Exception ex) }catch (Exception ex)
{ {
LogUtil.error(Name+ "timer_Tick 出错:" + ex.ToString()); LogUtil.error(Name+ "timer_Tick 出错:" + ex.ToString());
...@@ -336,13 +336,8 @@ namespace TSA_V ...@@ -336,13 +336,8 @@ namespace TSA_V
if (TSAVBean.Status.Equals(TSAVStatus.Runing)&&(!TSAVBean.IsInSuddenDown)) if (TSAVBean.Status.Equals(TSAVStatus.Runing)&&(!TSAVBean.IsInSuddenDown))
{ {
//如果没有开始工作,自动开始工作
if (!TSAVBean.Work.IsWorking && btnStart.Enabled)
{
btnStart_Click(null, null);
}
btnStartWorking.Enabled = true; btnStartWorking.Enabled = !(TSAVBean.Work.IsWorking);
btnNextPoint.Enabled = true; btnNextPoint.Enabled = true;
btnPrePoint.Enabled = true; btnPrePoint.Enabled = true;
} }
...@@ -357,7 +352,7 @@ namespace TSA_V ...@@ -357,7 +352,7 @@ namespace TSA_V
} }
} }
private void btnStart_Click(object sender, EventArgs e) private void btnStart_Click(object sender, EventArgs e)
{ {
StartRun(); StartRun();
FormStatus(); FormStatus();
...@@ -394,7 +389,7 @@ namespace TSA_V ...@@ -394,7 +389,7 @@ namespace TSA_V
private void FrmWork_Shown(object sender, EventArgs e) private void FrmWork_Shown(object sender, EventArgs e)
{ {
try try
{ {
SetSkin(this); SetSkin(this);
//lblMsg.ForeColor = Color.Red; //lblMsg.ForeColor = Color.Red;
lblNotices.ForeColor = Color.Red; lblNotices.ForeColor = Color.Red;
...@@ -413,6 +408,8 @@ namespace TSA_V ...@@ -413,6 +408,8 @@ namespace TSA_V
StartRun(); StartRun();
} }
FrmProjectorScreen.instance.ClearPoint(); FrmProjectorScreen.instance.ClearPoint();
timer.Start();
LogUtil.info(Name + " Shown end ");
} }
catch (Exception ex) catch (Exception ex)
{ {
...@@ -478,8 +475,7 @@ namespace TSA_V ...@@ -478,8 +475,7 @@ namespace TSA_V
Rectangle rec = new Rectangle((int)Math.Round(X), (int)Math.Round(Y), (int)Math.Round(width), (int)Math.Round(height)); Rectangle rec = new Rectangle((int)Math.Round(X), (int)Math.Round(Y), (int)Math.Round(width), (int)Math.Round(height));
try try
{ {
GC.Collect();
//GC.WaitForPendingFinalizers(); //GC.WaitForPendingFinalizers();
this.picPoint.Image = bitmap.Clone(rec, System.Drawing.Imaging.PixelFormat.Format32bppArgb); this.picPoint.Image = bitmap.Clone(rec, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
//bitmap.Dispose(); //bitmap.Dispose();
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!