Commit ca9e9a89 张东亮

Merge branch 'SO00075(SO1164)扫码贴标机' of http://106.15.194.121:8083/liutao/SO827-A…

…utoScanAndLabel into SO00075(SO1164)扫码贴标机
2 个父辈 d4bcf991 59a5ec4b
...@@ -147,7 +147,7 @@ namespace AutoScanAndLabel ...@@ -147,7 +147,7 @@ namespace AutoScanAndLabel
AlarmBuzzer.BuzzerStateChange += AlarmBuzzer_BuzzerStateChange; AlarmBuzzer.BuzzerStateChange += AlarmBuzzer_BuzzerStateChange;
RobotManage.LoadFinishEvent += RobotManage_LoadFinishEvent; RobotManage.LoadFinishEvent += RobotManage_LoadFinishEvent;
if (Config.Get("EnableLogWindow",false)) if (Config.Get("EnableLogWindow",false))
AddForm(crc.GetString("Res0007","日志"), lc); AddForm("Res0007", crc.GetString("Res0007","日志"), lc);
RobotManage.Init(); RobotManage.Init();
} }
...@@ -163,12 +163,12 @@ namespace AutoScanAndLabel ...@@ -163,12 +163,12 @@ namespace AutoScanAndLabel
e.NewWidth = (sender as ListView).Columns[e.ColumnIndex].Width; e.NewWidth = (sender as ListView).Columns[e.ColumnIndex].Width;
e.Cancel = true; e.Cancel = true;
} }
const int tabpagecount = 3; const int tabpagecount = 4;
void addTablePage() { void addTablePage() {
AddForm(crc.GetString("Res0008","IO调试"), ioc); AddForm("Res0008",crc.GetString("Res0008","IO调试"), ioc);
AddForm(crc.GetString("Res0009","伺服调试"), ac); AddForm("Res0009",crc.GetString("Res0009","伺服调试"), ac);
AddForm(crc.GetString("Res0070","Agv调试"), agv); AddForm("Res0070", crc.GetString("Res0070","Agv调试"), agv);
AddForm(crc.GetString("Res0010","相关设置"), sc); AddForm("Res0010", crc.GetString("Res0010","相关设置"), sc);
crc.LanguageProcess(this); crc.LanguageProcess(this);
} }
//public delegate void setstatedelegate(List<MoveInfo> moveinfoList); //public delegate void setstatedelegate(List<MoveInfo> moveinfoList);
...@@ -200,25 +200,29 @@ namespace AutoScanAndLabel ...@@ -200,25 +200,29 @@ namespace AutoScanAndLabel
this.ResumeLayout(true); this.ResumeLayout(true);
} }
private void AddForm(string text, UserControl form) private void AddForm(string id, string text, UserControl form)
{ {
//text = text.PadLeft(10, ' '); foreach (TabPage tp in tabControl1.TabPages)
{
if (tp.Name == id)
{
tp.Text = text;
return;
}
}
TabPage lineTabPage = new TabPage(text); TabPage lineTabPage = new TabPage(text);
// lineTabPage.AutoScroll = true; lineTabPage.Name = id;
//lineTabPage.Tag = robot;
Panel linePan = new Panel(); Panel linePan = new Panel();
linePan.Dock = DockStyle.Fill; linePan.Dock = DockStyle.Fill;
linePan.AutoScroll = true; linePan.AutoScroll = true;
lineTabPage.Controls.Add(linePan); lineTabPage.Controls.Add(linePan);
//form.FormBorderStyle = FormBorderStyle.None;
//form.TopLevel = false;
linePan.Controls.Add(form); linePan.Controls.Add(form);
form.Dock = DockStyle.Fill; form.Dock = DockStyle.Fill;
linePan.Anchor = ((AnchorStyles)((AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom | AnchorStyles.Left))); linePan.Anchor = ((AnchorStyles)((AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom | AnchorStyles.Left)));
form.Anchor = ((AnchorStyles)((AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom | AnchorStyles.Left))); form.Anchor = ((AnchorStyles)((AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom | AnchorStyles.Left)));
form.Show(); form.Show();
//tabPageList.Add(lineTabPage); tabControl1.TabPages.Add(lineTabPage);
tabControl1.Controls.Add(lineTabPage);
} }
private void 启用调试模式ToolStripMenuItem_Click(object sender, EventArgs e) private void 启用调试模式ToolStripMenuItem_Click(object sender, EventArgs e)
...@@ -236,9 +240,10 @@ namespace AutoScanAndLabel ...@@ -236,9 +240,10 @@ namespace AutoScanAndLabel
RobotManage.LoadDebug(); RobotManage.LoadDebug();
} }
else { else {
for (int i = tabControl1.TabPages.Count-1; i > 1; i--) var tc = tabControl1.TabPages.Count;
for (int i = 1; i <= tabpagecount; i++)
{ {
tabControl1.TabPages[i].Parent = null; tabControl1.TabPages[tc - i].Parent = null;
} }
} }
} }
...@@ -507,18 +512,21 @@ namespace AutoScanAndLabel ...@@ -507,18 +512,21 @@ namespace AutoScanAndLabel
private void 简体中文ToolStripMenuItem_Click(object sender, EventArgs e) private void 简体中文ToolStripMenuItem_Click(object sender, EventArgs e)
{ {
ConfigHelper.Config.Set("Default_Language", "zh-CN"); ConfigHelper.Config.Set("Default_Language", "zh-CN");
crc.CurrLanguage = Config.Get("Default_Language");
crc.LanguageChange(); crc.LanguageChange();
} }
private void 日本语ToolStripMenuItem_Click(object sender, EventArgs e) private void 日本语ToolStripMenuItem_Click(object sender, EventArgs e)
{ {
ConfigHelper.Config.Set("Default_Language", "ja-JP"); ConfigHelper.Config.Set("Default_Language", "ja-JP");
crc.CurrLanguage = Config.Get("Default_Language");
crc.LanguageChange(); crc.LanguageChange();
} }
private void englishToolStripMenuItem_Click(object sender, EventArgs e) private void englishToolStripMenuItem_Click(object sender, EventArgs e)
{ {
ConfigHelper.Config.Set("Default_Language", "en-US"); ConfigHelper.Config.Set("Default_Language", "en-US");
crc.CurrLanguage = Config.Get("Default_Language");
crc.LanguageChange(); crc.LanguageChange();
} }
} }
......
...@@ -14,6 +14,7 @@ using UserFromControl; ...@@ -14,6 +14,7 @@ using UserFromControl;
namespace AutoScanAndLabel namespace AutoScanAndLabel
{ {
using crc = OnlineStore.CodeResourceControl;
public partial class IOControl : UserControl public partial class IOControl : UserControl
{ {
readonly Timer t1 = new Timer(); readonly Timer t1 = new Timer();
...@@ -26,7 +27,12 @@ namespace AutoScanAndLabel ...@@ -26,7 +27,12 @@ namespace AutoScanAndLabel
GC.KeepAlive(t1); GC.KeepAlive(t1);
RobotManage.LoadFinishEvent += RobotManage_LoadFinishEvent; RobotManage.LoadFinishEvent += RobotManage_LoadFinishEvent;
crc.LanguageChangeEvent += Crc_LanguageChangeEvent;
}
private void Crc_LanguageChangeEvent(object sender, EventArgs e)
{
LoadIOList();
} }
private void RobotManage_LoadFinishEvent(bool state, string msg) private void RobotManage_LoadFinishEvent(bool state, string msg)
...@@ -51,6 +57,7 @@ namespace AutoScanAndLabel ...@@ -51,6 +57,7 @@ namespace AutoScanAndLabel
private void LoadIOList() private void LoadIOList()
{ {
t1.Stop();
this.SuspendLayout(); this.SuspendLayout();
DIControlList.Clear(); DIControlList.Clear();
DOControlList.Clear(); DOControlList.Clear();
...@@ -63,7 +70,7 @@ namespace AutoScanAndLabel ...@@ -63,7 +70,7 @@ namespace AutoScanAndLabel
//if (ioValue.SubType.Equals(0)) //if (ioValue.SubType.Equals(0))
{ {
this.tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.Absolute, 26)); this.tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.Absolute, 26));
IOTextControl control = new IOTextControl(ioValue.ElectricalDefinition + "_" + ioValue.Explain, ioValue.ProName); IOTextControl control = new IOTextControl(ioValue.ElectricalDefinition + "_" + crc.GetString(ioValue.ProName, ioValue.Explain), ioValue.ProName);
this.tableLayoutPanel1.Controls.Add(control, 0, roleindex); this.tableLayoutPanel1.Controls.Add(control, 0, roleindex);
roleindex++; roleindex++;
...@@ -79,7 +86,7 @@ namespace AutoScanAndLabel ...@@ -79,7 +86,7 @@ namespace AutoScanAndLabel
//if (ioValue.SubType.Equals(0)) //if (ioValue.SubType.Equals(0))
{ {
this.tableLayoutPanel2.RowStyles.Add(new RowStyle(SizeType.Absolute, 28)); this.tableLayoutPanel2.RowStyles.Add(new RowStyle(SizeType.Absolute, 28));
IOTextControl control = new IOTextControl(ioValue.ElectricalDefinition + "_" + ioValue.Explain, ioValue.ProName); IOTextControl control = new IOTextControl(ioValue.ElectricalDefinition + "_" + crc.GetString(ioValue.ProName, ioValue.Explain), ioValue.ProName);
control.Click += Control_Click; control.Click += Control_Click;
this.tableLayoutPanel2.Controls.Add(control, 0, roleindex); this.tableLayoutPanel2.Controls.Add(control, 0, roleindex);
roleindex++; roleindex++;
......
...@@ -100,7 +100,7 @@ namespace AutoScanAndLabel.UC ...@@ -100,7 +100,7 @@ namespace AutoScanAndLabel.UC
{ {
if (!RobotManage.isRunning) if (!RobotManage.isRunning)
{ {
MessageBox.Show(crc.GetString("Res0034","机器尚未启动不能呼叫Agv")); MessageBox.Show(crc.GetString("Res0079","机器尚未启动不能呼叫Agv"));
return; return;
} }
if (InCalling) if (InCalling)
...@@ -138,14 +138,14 @@ namespace AutoScanAndLabel.UC ...@@ -138,14 +138,14 @@ namespace AutoScanAndLabel.UC
}); });
} }
else else
MessageBox.Show(crc.GetString("Res0036","当前有料串不能请求进入料串")); MessageBox.Show(crc.GetString("Res0080","当前有料串不能请求进入料串"));
} }
private void button_rightleavefull_Click(object sender, EventArgs e) private void button_rightleavefull_Click(object sender, EventArgs e)
{ {
if (!RobotManage.isRunning) if (!RobotManage.isRunning)
{ {
MessageBox.Show(crc.GetString("Res0034","机器尚未启动不能呼叫Agv")); MessageBox.Show(crc.GetString("Res0079","机器尚未启动不能呼叫Agv"));
return; return;
} }
if (InCalling) if (InCalling)
...@@ -185,7 +185,7 @@ namespace AutoScanAndLabel.UC ...@@ -185,7 +185,7 @@ namespace AutoScanAndLabel.UC
}); });
} }
else else
MessageBox.Show(crc.GetString("Res0037","当前没有料串不能请求取料串")); MessageBox.Show(crc.GetString("Res0081","当前没有料串不能请求取料串"));
} }
private void RequestLeft() private void RequestLeft()
{ {
...@@ -224,7 +224,7 @@ namespace AutoScanAndLabel.UC ...@@ -224,7 +224,7 @@ namespace AutoScanAndLabel.UC
{ {
if (!RobotManage.isRunning) if (!RobotManage.isRunning)
{ {
MessageBox.Show(crc.GetString("Res0034","机器尚未启动不能呼叫Agv")); MessageBox.Show(crc.GetString("Res0079","机器尚未启动不能呼叫Agv"));
return; return;
} }
if (InCalling) if (InCalling)
...@@ -264,14 +264,14 @@ namespace AutoScanAndLabel.UC ...@@ -264,14 +264,14 @@ namespace AutoScanAndLabel.UC
}); });
} }
else else
MessageBox.Show(crc.GetString("Res0037","当前没有料串不能请求取料串")); MessageBox.Show(crc.GetString("Res0081","当前没有料串不能请求取料串"));
} }
private void button_leftneedempty_Click(object sender, EventArgs e) private void button_leftneedempty_Click(object sender, EventArgs e)
{ {
if (!RobotManage.isRunning) if (!RobotManage.isRunning)
{ {
MessageBox.Show(crc.GetString("Res0034","机器尚未启动不能呼叫Agv")); MessageBox.Show(crc.GetString("Res0079","机器尚未启动不能呼叫Agv"));
return; return;
} }
if (InCalling) if (InCalling)
...@@ -310,7 +310,7 @@ namespace AutoScanAndLabel.UC ...@@ -310,7 +310,7 @@ namespace AutoScanAndLabel.UC
}); });
} }
else else
MessageBox.Show(crc.GetString("Res0036","当前有料串不能请求进入料串")); MessageBox.Show(crc.GetString("Res0080","当前有料串不能请求进入料串"));
} }
private void checkBox1_CheckedChanged(object sender, EventArgs e) private void checkBox1_CheckedChanged(object sender, EventArgs e)
......
...@@ -37,9 +37,29 @@ namespace AutoScanAndLabel ...@@ -37,9 +37,29 @@ namespace AutoScanAndLabel
void LoadPosList() void LoadPosList()
{ {
if (!this.Created)
return;
if (this.InvokeRequired)
{
this.Invoke((EventHandler)delegate
{
try
{
LoadPosList();
}
catch (Exception ee)
{
MessageBox.Show("LoadPosList:" + ee.ToString());
}
});
return;
}
tableLayoutPanel1.SuspendLayout();
int maxrow = tableLayoutPanel1.Height / 34; int maxrow = tableLayoutPanel1.Height / 34;
this.tableLayoutPanel1.RowStyles.Clear();
tableLayoutPanel1.Controls.Clear(); tableLayoutPanel1.Controls.Clear();
this.tableLayoutPanel1.RowStyles.Clear();
//this.tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType., 26)); //this.tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType., 26));
int r = 0; int r = 0;
int c = 0; int c = 0;
...@@ -62,30 +82,35 @@ namespace AutoScanAndLabel ...@@ -62,30 +82,35 @@ namespace AutoScanAndLabel
color = Color.FromArgb(random.Next(30, 150), random.Next(30, 150), random.Next(30, 150)); color = Color.FromArgb(random.Next(30, 150), random.Next(30, 150), random.Next(30, 150));
} }
var tests = Config.GetType().GetProperty(configBase.ProName + "_speed");
bool hasSpeed = tests != null;
//this.tableLayoutPanel1.RowCount++; //this.tableLayoutPanel1.RowCount++;
if (configBase.SubType < 20) if (hasSpeed)//(configBase.SubType < 30)
{ {
Button button = new Button(); Button button = new Button();
button.FlatStyle = System.Windows.Forms.FlatStyle.Flat; button.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
button.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); button.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
button.Name = configBase.ProName; button.Name = configBase.ProName;
button.Size = new System.Drawing.Size(225, 27); button.Size = new System.Drawing.Size(225, 27);
button.Text = configBase.Explain; button.Text = crc.GetString(configBase.ProName, configBase.Explain);
button.Click += Button_Click; button.Click += Button_Click;
button.ForeColor = color; button.ForeColor = color;
button.Tag = configBase.SubType%10; button.Tag = configBase.SubType - 10;
tableLayoutPanel1.Controls.Add(button, c, r); tableLayoutPanel1.Controls.Add(button, c, r);
} }
else { else
{
Label button = new Label(); Label button = new Label();
button.Anchor = (AnchorStyles)(AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom); button.Anchor = (AnchorStyles)(AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom);
button.Name = configBase.ProName; button.Name = configBase.ProName;
button.Text = configBase.Explain; button.Text = crc.GetString(configBase.ProName, configBase.Explain);
button.AutoSize = false; button.AutoSize = false;
button.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; button.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
button.ForeColor = color; button.ForeColor = color;
tableLayoutPanel1.Controls.Add(button, c, r); tableLayoutPanel1.Controls.Add(button, c, r);
} }
TextBox textBox = new TextBox(); TextBox textBox = new TextBox();
textBox.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); textBox.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
...@@ -95,8 +120,6 @@ namespace AutoScanAndLabel ...@@ -95,8 +120,6 @@ namespace AutoScanAndLabel
textBox.Text = configBase.ProValue; textBox.Text = configBase.ProValue;
textBox.KeyPress += TextBox_KeyPress; textBox.KeyPress += TextBox_KeyPress;
textBox.TextChanged += TextBox_TextChanged; textBox.TextChanged += TextBox_TextChanged;
textBox.Click += TextBox_Click;
tableLayoutPanel1.Controls.Add(textBox, c + 1, r); tableLayoutPanel1.Controls.Add(textBox, c + 1, r);
...@@ -107,7 +130,7 @@ namespace AutoScanAndLabel ...@@ -107,7 +130,7 @@ namespace AutoScanAndLabel
textBox.Tag = pi.PropertyType.Name; textBox.Tag = pi.PropertyType.Name;
} }
if (configBase.SubType < 20) if (hasSpeed)//(configBase.SubType < 30)
{ {
TextBox textBox2 = new TextBox(); TextBox textBox2 = new TextBox();
textBox2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); textBox2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
...@@ -122,7 +145,8 @@ namespace AutoScanAndLabel ...@@ -122,7 +145,8 @@ namespace AutoScanAndLabel
textBox.Tag = "Int32"; textBox.Tag = "Int32";
} }
else { else
{
tableLayoutPanel1.SetColumnSpan(textBox, 2); tableLayoutPanel1.SetColumnSpan(textBox, 2);
} }
...@@ -133,10 +157,12 @@ namespace AutoScanAndLabel ...@@ -133,10 +157,12 @@ namespace AutoScanAndLabel
c += 3; c += 3;
} }
} }
if (r <= maxrow+1) { if (r <= maxrow + 1)
{
Label button1 = new Label(); Label button1 = new Label();
tableLayoutPanel1.Controls.Add(button1, c, r++); tableLayoutPanel1.Controls.Add(button1, c, r++);
} }
tableLayoutPanel1.ResumeLayout(true);
} }
private void TextBox_Click(object sender, EventArgs e) private void TextBox_Click(object sender, EventArgs e)
......
...@@ -55,7 +55,7 @@ namespace DeviceLibrary ...@@ -55,7 +55,7 @@ namespace DeviceLibrary
//左侧料串已满 //左侧料串已满
if (LeftMoveInfo.IsStep(MoveStep.Wait) && IOValue(IO_Type.LeftEnd_Check).Equals(IO_VALUE.HIGH) && LeftShelfNoTray) if (LeftMoveInfo.IsStep(MoveStep.Wait) && IOValue(IO_Type.LeftEnd_Check).Equals(IO_VALUE.HIGH) && LeftShelfNoTray)
{ {
Msg.add(crc.GetString("Res0060","侧料串已满,等待取走料串"), MsgLevel.warning); Msg.add(crc.GetString("Res0060","侧料串已满,等待取走料串"), MsgLevel.warning);
} }
} }
} }
......
...@@ -129,7 +129,7 @@ namespace DeviceLibrary ...@@ -129,7 +129,7 @@ namespace DeviceLibrary
LeftMoveInfo.NextMoveStep(MoveStep.L53); LeftMoveInfo.NextMoveStep(MoveStep.L53);
IOMove(IO_Type.LeftMoto_Run, IO_VALUE.LOW); IOMove(IO_Type.LeftMoto_Run, IO_VALUE.LOW);
IOMove(IO_Type.LeftMoto_Reverse, IO_VALUE.HIGH); IOMove(IO_Type.LeftMoto_Reverse, IO_VALUE.HIGH);
MiddleMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.LeftEnd_Check, IO_VALUE.LOW)); LeftMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.LeftEnd_Check, IO_VALUE.LOW));
LeftMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(3000)); LeftMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(3000));
LeftMoveInfo.log($"电滚筒向外滚动"); LeftMoveInfo.log($"电滚筒向外滚动");
break; break;
...@@ -163,7 +163,7 @@ namespace DeviceLibrary ...@@ -163,7 +163,7 @@ namespace DeviceLibrary
LeftMoveInfo.NextMoveStep(MoveStep.L63); LeftMoveInfo.NextMoveStep(MoveStep.L63);
IOMove(IO_Type.LeftMoto_Reverse, IO_VALUE.LOW); IOMove(IO_Type.LeftMoto_Reverse, IO_VALUE.LOW);
IOMove(IO_Type.LeftMoto_Run, IO_VALUE.HIGH); IOMove(IO_Type.LeftMoto_Run, IO_VALUE.HIGH);
MiddleMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.LeftEnd_Check, IO_VALUE.HIGH)); LeftMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.LeftEnd_Check, IO_VALUE.HIGH));
LeftMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(60000)); LeftMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(60000));
LeftMoveInfo.OneWaitCanEndStep = true; LeftMoveInfo.OneWaitCanEndStep = true;
LeftMoveInfo.log($"等待料串到位"); LeftMoveInfo.log($"等待料串到位");
......
...@@ -112,6 +112,17 @@ namespace DeviceLibrary ...@@ -112,6 +112,17 @@ namespace DeviceLibrary
InitPrint(); InitPrint();
LedProcessInit(); LedProcessInit();
crc.LanguageChangeEvent += Crc_LanguageChangeEvent;
}
private void Crc_LanguageChangeEvent(object sender, EventArgs e)
{
RightMoveInfo.Name=(crc.GetString("Res0039", "右侧取料"));
MiddleMoveInfo.Name = (crc.GetString("Res0042", "移栽"));
LeftMoveInfo.Name = (crc.GetString("Res0051", "左侧放料"));
LabelMoveInfo.Name = (crc.GetString("Res0052", "贴标"));
ResetMoveInfo.Name = (crc.GetString("Res0053", "重置"));
} }
private (bool, string) Take_Middle_Axis_interference(int from, int to) private (bool, string) Take_Middle_Axis_interference(int from, int to)
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!