Commit d18889ef LN

调宽速度bug修改。界面状态显示修改。

1 个父辈 2dbc2422
......@@ -97,5 +97,30 @@ namespace TSA_V
/// IO模块连接失败
/// </summary>
public static string IOConnectError ="IOConnectError";
/// <summary>
/// 设备急停中
/// </summary>
public static string DeviceInSuddenStop = "DeviceInSuddenStop";
/// <summary>
/// 设备未启动
/// </summary>
public static string DeviceNotStart = "DeviceNotStart";
/// <summary>
/// 设备正在原点返回中
/// </summary>
public static string DeviceInGohome = "DeviceInGohome";
/// <summary>
/// 设备工作中
/// </summary>
public static string DeviceInWork = "DeviceInWork";
/// <summary>
/// 流水线转动中
/// </summary>
public static string LineTurn = "LineTurn";
/// <summary>
/// 已工作{0},{1}块电路板
/// </summary>
public static string WorkInfoMsg = "WorkInfoMsg";
}
}
......@@ -130,7 +130,7 @@ namespace TSA_V.DeviceLibrary
if (!msg.Equals(""))
{
LogUtil.error(Name + "Can协议连接失败:" + msg);
return ResourceControl.GetString(ResourceControl.CanConnectFail,"Can协议连接失败");
return ResourceControl.GetString(ResourceControl.CanConnectFail, "Can协议连接失败");
}
else
{
......@@ -187,9 +187,9 @@ namespace TSA_V.DeviceLibrary
}
public delegate bool ShowPointDelegate(ProjectorPInfo p);
public static event ShowPointDelegate ShowPointEvent;
public static void ShowPoint(double x, double y, int type = 1, int sizex = 1,int sizey=1,int penWidth=2,string name="")
public static void ShowPoint(double x, double y, int type = 1, int sizex = 1, int sizey = 1, int penWidth = 2, string name = "")
{
ProjectorPInfo p = new ProjectorPInfo((int)x, (int)y, type, sizex, sizey,penWidth,name);
ProjectorPInfo p = new ProjectorPInfo((int)x, (int)y, type, sizex, sizey, penWidth, name);
ShowPointEvent?.Invoke(p);
}
/// <summary>
......@@ -249,7 +249,7 @@ namespace TSA_V.DeviceLibrary
Thread.Sleep(10);
}
}
PUSICANControl.InitRNodeConfig(LWidthManager.Line_NodeAddr,true);
PUSICANControl.InitRNodeConfig(LWidthManager.Line_NodeAddr, true);
Thread.Sleep(10);
//所有轴原点返回
foreach (Dictionary<int, NodeInfo> map in RotateMap.Values)
......@@ -517,7 +517,7 @@ namespace TSA_V.DeviceLibrary
Thread.Sleep(100);
if (PUSICANControl.IsDuZhuan(node.NodeId))
{
WarnMsg = GetTime() + ResourceControl.GetString(ResourceControl.DuZhuanMsg," 旋转轴[{0}]堵转,需要重置", node.NodeId);
WarnMsg = GetTime() + ResourceControl.GetString(ResourceControl.DuZhuanMsg, " 旋转轴[{0}]堵转,需要重置", node.NodeId);
LogUtil.error(Name + " " + WarnMsg);
return;
}
......@@ -525,14 +525,14 @@ namespace TSA_V.DeviceLibrary
}
}
}
public static bool NextPoint(bool isNext,bool isResetBoard)
public static bool NextPoint(bool isNext, bool isResetBoard)
{
if (Status.Equals(TSAVStatus.Runing))
{
if (!Work.IsWorking)
{
//StartWork(BoardManager.CurrBoard);
return false ;
return false;
}
if (Work.IsWaitMove)
{
......@@ -541,10 +541,11 @@ namespace TSA_V.DeviceLibrary
}
if (!(Work.IsWaitMove))
{
Work.MoveToNextPoint(isNext,isResetBoard);
Work.MoveToNextPoint(isNext, isResetBoard);
return true;
}
} return false;
}
return false;
}
public static void StopRun()
......@@ -587,7 +588,7 @@ namespace TSA_V.DeviceLibrary
TimeSpan span = DateTime.Now - Work.LastSetpTime;
List<WaitResultInfo> list = Work.waitList;
string waitMsg = "";
bool isOk = WaitResultInfo.GetWaitResult(list, span,false, out waitMsg);
bool isOk = WaitResultInfo.GetWaitResult(list, span, false, out waitMsg);
if (isOk)
{
Work.EndWait();
......@@ -596,7 +597,7 @@ namespace TSA_V.DeviceLibrary
{
if (span.TotalSeconds > 30)
{
WarnMsg = GetTime() +ResourceControl.GetString(ResourceControl.WaitTimeOutMsg, "组装中,等待【{0}】超时 已等待[{1}]秒",waitMsg, Math.Round(span.TotalSeconds, 0));
WarnMsg = GetTime() + ResourceControl.GetString(ResourceControl.WaitTimeOutMsg, "组装中,等待【{0}】超时 已等待[{1}]秒", waitMsg, Math.Round(span.TotalSeconds, 0));
LogUtil.error(WarnMsg);
}
}
......@@ -625,6 +626,45 @@ namespace TSA_V.DeviceLibrary
}
return false;
}
public static string GetShowMsg()
{
string ShowMsg = "";
if (TSAVBean.IsInSuddenDown)
{
ShowMsg = ResourceControl.GetString(ResourceControl.DeviceInSuddenStop, "设备急停中");
}
else if (TSAVBean.Status.Equals(TSAVStatus.Wait))
{
ShowMsg = ResourceControl.GetString(ResourceControl.DeviceNotStart, "设备未启动");
}
else if (TSAVBean.Status.Equals(TSAVStatus.Reset))
{
ShowMsg = ResourceControl.GetString(ResourceControl.DeviceInGohome, "设备正在原点返回中");
}
else if (TSAVBean.Status.Equals(TSAVStatus.Runing))
{
string msg = ResourceControl.GetString(ResourceControl.DeviceInWork, "设备工作中");
string lineMsg = ResourceControl.GetString(ResourceControl.LineTurn, "流水线转动中");
if (TSAVBean.Work.IsWorking)
{
TimeSpan span = DateTime.Now - TSAVBean.Work.beginWorkTime;
int count = TSAVBean.Work.BoardCount;
string time = span.Hours.ToString().PadLeft(2, '0') + ":" + span.Minutes.ToString().PadLeft(2, '0') + ":" + span.Seconds.ToString().PadLeft(2, '0');
ShowMsg = ResourceControl.GetString(ResourceControl.WorkInfoMsg, "已工作{0},{1}块电路板", time, count) + "\r\n" + TSAVBean.WarnMsg;
}
else if (TSAVBean.LineStep.moveType.Equals(1))
{
ShowMsg = lineMsg + "\r\n" + TSAVBean.WarnMsg;
}
else
{
ShowMsg = msg + "\r\n" + TSAVBean.WarnMsg;
}
}
return ShowMsg;
}
}
public class NodeInfo
{
......
......@@ -711,19 +711,11 @@ namespace PUSICANLibrary
//重置位置
SetPosition(nodeId, 0);
////重置速度
//int startSpeed = ConfigAppSettings.GetIntValue(Setting_Init.RotateNode_StartSpeed, nodeId.ToString());
//PUSICANControl.SetStartSpeed(nodeId, startSpeed);
//int stopSpeed = ConfigAppSettings.GetIntValue(Setting_Init.RotateNode_StopSpeed, nodeId.ToString());
//PUSICANControl.SetStopSpeed(nodeId, stopSpeed);
//int maxSpeed = ConfigAppSettings.GetIntValue(Setting_Init.RotateNode_MaxSpeed, nodeId.ToString());
//PUSICANControl.SetMaxSpeed(nodeId, maxSpeed);
return true;
}
public static bool SetSpeed(uint nodeId, bool isLineSlv = false)
public static bool SetSpeed(uint nodeId, bool isLineSlv )
{
//重置速度
int startSpeed = ConfigAppSettings.GetIntValue(Setting_Init.RotateNode_StartSpeed, nodeId.ToString());
......@@ -847,8 +839,7 @@ namespace PUSICANLibrary
//设置为位置模式
PUSICANControl.WriteSDO(node, CAN_Address.MoveType, movetype);
Thread.Sleep(100);
bool isLineslv = node.Equals(isLineSlv);
PUSICANControl.SetSpeed(node);
PUSICANControl.SetSpeed(node,isLineSlv);
Thread.Sleep(10);
//所有轴走到待机点
PUSICANControl.AbsMove(node, targetDefaultPosition);
......
......@@ -90,12 +90,12 @@
<add key="Line_HomeStartSpeed" value="1000" />
<add key="Line_HomeStopSpeed" value="1000" />
<add key="Line_MicroStepping" value="4" />
<add key="Line_MaxSpeed" value="1000" />
<add key="Line_MaxSpeed" value="2000" />
<add key="Line_StartSpeed" value="1000" />
<add key="Line_StopSpeed" value="1000" />
<add key="Line_AddSpeed" value="8" />
<add key="Line_DelSpeed" value="8" />
<add key="Line_MaxPhaseCurrent" value="2000" />
<add key="Line_MaxPhaseCurrent" value="2200" />
<add key="Line_DelPhaseCurrent" value="2" />
<!--调宽配置:电机回原点后的宽度-->
<add key="Line_HomeWidth" value="508" />
......
......@@ -31,6 +31,26 @@ namespace TSA_V
private void btnPosition_Click(object sender, EventArgs e)
{
string msg = "";
//复位完成才能打开
if (TSAVBean.IsInSuddenDown)
{
msg = ResourceControl.GetString(ResourceControl.DeviceInSuddenStop, "设备急停中");
}
else if (TSAVBean.Status.Equals(TSAVStatus.Wait))
{
msg = ResourceControl.GetString(ResourceControl.DeviceNotStart, "设备未启动");
}
else if (TSAVBean.Status.Equals(TSAVStatus.Reset))
{
msg = ResourceControl.GetString(ResourceControl.DeviceInGohome, "设备正在原点返回中");
}
if (!String.IsNullOrEmpty(msg))
{
MessageBox.Show(msg);
return;
}
FrmPusicanTest frmCom = new FrmPusicanTest();
this.Visible = false;
frmCom.ShowDialog();
......
......@@ -36,6 +36,7 @@ namespace TSA_V
this.btnExit = new System.Windows.Forms.Button();
this.btnWork = new System.Windows.Forms.Button();
this.panel1 = new System.Windows.Forms.Panel();
this.lblMsg = new System.Windows.Forms.Label();
this.btnHistory = new System.Windows.Forms.Button();
this.LblUserName = new System.Windows.Forms.Label();
this.btnScreenTest = new System.Windows.Forms.Button();
......@@ -58,9 +59,10 @@ namespace TSA_V
//
this.lblVersion.AutoSize = true;
this.lblVersion.BackColor = System.Drawing.Color.Transparent;
this.lblVersion.Location = new System.Drawing.Point(510, 420);
this.lblVersion.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblVersion.Location = new System.Drawing.Point(6, 435);
this.lblVersion.Name = "lblVersion";
this.lblVersion.Size = new System.Drawing.Size(77, 12);
this.lblVersion.Size = new System.Drawing.Size(75, 17);
this.lblVersion.TabIndex = 11;
this.lblVersion.Text = "版本号 1.1.2";
//
......@@ -72,7 +74,7 @@ namespace TSA_V
this.btnExit.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnExit.Font = new System.Drawing.Font("微软雅黑", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnExit.ForeColor = System.Drawing.Color.White;
this.btnExit.Location = new System.Drawing.Point(725, 16);
this.btnExit.Location = new System.Drawing.Point(725, 20);
this.btnExit.Name = "btnExit";
this.btnExit.Size = new System.Drawing.Size(89, 37);
this.btnExit.TabIndex = 9;
......@@ -98,6 +100,7 @@ namespace TSA_V
// panel1
//
this.panel1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.panel1.Controls.Add(this.lblMsg);
this.panel1.Controls.Add(this.btnHistory);
this.panel1.Controls.Add(this.LblUserName);
this.panel1.Controls.Add(this.lblVersion);
......@@ -114,6 +117,17 @@ namespace TSA_V
this.panel1.Size = new System.Drawing.Size(861, 453);
this.panel1.TabIndex = 14;
//
// lblMsg
//
this.lblMsg.BackColor = System.Drawing.Color.Transparent;
this.lblMsg.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblMsg.Location = new System.Drawing.Point(213, 384);
this.lblMsg.Name = "lblMsg";
this.lblMsg.Size = new System.Drawing.Size(636, 60);
this.lblMsg.TabIndex = 21;
this.lblMsg.Text = "版本号 1.1.2";
this.lblMsg.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// btnHistory
//
this.btnHistory.BackColor = System.Drawing.Color.Transparent;
......@@ -134,9 +148,10 @@ namespace TSA_V
//
this.LblUserName.AutoSize = true;
this.LblUserName.BackColor = System.Drawing.Color.Transparent;
this.LblUserName.Location = new System.Drawing.Point(21, 420);
this.LblUserName.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.LblUserName.Location = new System.Drawing.Point(615, 32);
this.LblUserName.Name = "LblUserName";
this.LblUserName.Size = new System.Drawing.Size(41, 12);
this.LblUserName.Size = new System.Drawing.Size(43, 17);
this.LblUserName.TabIndex = 18;
this.LblUserName.Text = "label1";
//
......@@ -301,5 +316,6 @@ namespace TSA_V
private System.Windows.Forms.Button btnScreenTest;
private System.Windows.Forms.Button btnHistory;
private System.Windows.Forms.Label LblUserName;
private System.Windows.Forms.Label lblMsg;
}
}
\ No newline at end of file
......@@ -46,6 +46,7 @@ namespace TSA_V
btnProduct.Visible = false;
btnCom.Visible = false ;
}
lblMsg.Text = "";
//if (FormManager.UserInfo.Limit.Equals(UserLimit.Admin))
//{
// btnMaintenance.Visible = true;
......@@ -293,13 +294,6 @@ namespace TSA_V
private void btnMaintenance_Click(object sender, EventArgs e)
{
//FrmPwd fw = new FrmPwd(10);
//DialogResult result = fw.ShowDialog();
//if (!result.Equals(DialogResult.OK))
//{
// LogUtil.info("点击 元器件信息,没有正确输入密码");
// return;
//}
isClick = true;
FrmMaintenance.instance.Show();
this.Visible = false;
......@@ -338,6 +332,7 @@ namespace TSA_V
{
try
{
lblMsg.Text = TSAVBean.GetShowMsg();
Screen[] sc = Screen.AllScreens;
if ((!FrmProjectorScreen.instance.ISShow) && sc.Length > FrmProjectorScreen.instance.ScreenIndex)
{
......
......@@ -55,6 +55,7 @@ namespace TSA_V
FormStatus(false);
}
SetScreen();
cmbNode.SelectedIndex = cmbNode.Items.Count - 1;
}
private void FormStatus(bool open)
{
......
......@@ -233,84 +233,15 @@ namespace TSA_V
}
}
FormStatus();
if (TSAVBean.IsInSuddenDown)
{
lblMsg.Text = ResourceCulture.GetString(ResourceCulture.DeviceInSuddenStop, "设备急停中");
//btnStart.Enabled = true;
//btnGoHome.Enabled = false;
btnStartWorking.Enabled = false;
if (TSAVBean.IsDebug.Equals(false))
{
btnNextPoint.Enabled = false;
btnPrePoint.Enabled = false;
}
}
else if (TSAVBean.Status.Equals(TSAVStatus.Wait))
{
string msg = ResourceCulture.GetString(ResourceCulture.DeviceNotStart, "设备未启动");
if (!lblMsg.Text.Equals(msg))
{
lblMsg.Text = msg;
//btnStart.Enabled = true;
//btnGoHome.Enabled = false;
btnStartWorking.Enabled = false;
if (TSAVBean.IsDebug.Equals(false))
{
btnNextPoint.Enabled = false;
btnPrePoint.Enabled = false;
}
}
}
else if (TSAVBean.Status.Equals(TSAVStatus.Reset))
{
string msg = ResourceCulture.GetString(ResourceCulture.DeviceInGohome, "设备正在原点返回中");
if (!lblMsg.Text.Equals(msg))
{
lblMsg.Text = msg + "\r\n" + TSAVBean.WarnMsg;
//btnStart.Enabled = false;
//btnGoHome.Enabled = true;
btnStartWorking.Enabled = false;
if (TSAVBean.IsDebug.Equals(false))
{
btnNextPoint.Enabled = false;
btnPrePoint.Enabled = false;
}
}
}
else if (TSAVBean.Status.Equals(TSAVStatus.Runing))
lblMsg.Text = TSAVBean.GetShowMsg();
if (TSAVBean.Status.Equals(TSAVStatus.Runing))
{
//如果没有开始工作,自动开始工作
if (!TSAVBean.Work.IsWorking && btnStart.Enabled)
{
btnStart_Click(null, null);
}
string msg = ResourceCulture.GetString(ResourceCulture.DeviceInWork, "设备工作中");
string lineMsg = ResourceCulture.GetString(ResourceCulture.LineTurn, "流水线转动中");
if (!lblMsg.Text.Equals(msg))
{
if (TSAVBean.Work.IsWorking)
{
TimeSpan span = DateTime.Now - TSAVBean.Work.beginWorkTime;
int count = TSAVBean.Work.BoardCount;
string time = span.Hours.ToString().PadLeft(2, '0') + ":" + span.Minutes.ToString().PadLeft(2, '0') + ":" + span.Seconds.ToString().PadLeft(2, '0');
lblMsg.Text = ResourceCulture.GetString(ResourceCulture.WorkInfoMsg, "已工作{0},{1}块电路板", time, count) + "\r\n" + TSAVBean.WarnMsg;
}
else if (TSAVBean.LineStep.moveType.Equals(1))
{
lblMsg.Text = lineMsg + "\r\n" + TSAVBean.WarnMsg;
}
else
{
lblMsg.Text = msg + "\r\n" + TSAVBean.WarnMsg;
}
//btnStart.Enabled = false;
//btnGoHome.Enabled = true;
btnStartWorking.Enabled = true;
btnNextPoint.Enabled = true;
btnPrePoint.Enabled = true;
}
//显示图片
if (!preIndex.Equals(TSAVBean.Work.currIndex) && (TSAVBean.Work.currPoint != null))
{
ShowTSAVPoint();
......@@ -387,7 +318,7 @@ namespace TSA_V
{
btnSave.Enabled = true;
btnGoHome.Enabled = true;
if (TSAVBean.Status <=(TSAVStatus.Wait))
if (TSAVBean.Status <= (TSAVStatus.Wait))
{
btnStart.Visible = true;
btnGoHome.Visible = false;
......@@ -397,6 +328,29 @@ namespace TSA_V
btnStart.Visible = false;
btnGoHome.Visible = true;
}
if (TSAVBean.Status.Equals(TSAVStatus.Runing)&&(!TSAVBean.IsInSuddenDown))
{
//如果没有开始工作,自动开始工作
if (!TSAVBean.Work.IsWorking && btnStart.Enabled)
{
btnStart_Click(null, null);
}
btnStartWorking.Enabled = true;
btnNextPoint.Enabled = true;
btnPrePoint.Enabled = true;
}
else
{
btnStartWorking.Enabled = false;
if (TSAVBean.IsDebug.Equals(false))
{
btnNextPoint.Enabled = false;
btnPrePoint.Enabled = false;
}
}
}
private void btnStart_Click(object sender, EventArgs e)
{
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!