Commit 11df1e5f 张东亮

20220908

1 个父辈 6d9325f0
......@@ -12,12 +12,6 @@
<!--二维码参数文件所在路径,文件名与二维码类型名一样-->
<add key="CodeParamPath" value="Conifg\" />
<add key="CodeCount" value="3" />
<!--斯坦德AGV配置-->
<add key="STD_IP" value="127.0.0.1" />
<add key="LStation" value="1" />
<add key="RStation" value="2" />
<add key="ShelfInAGV" value="3" />
<add key="ShelfOutAGV" value="4" />
</appSettings>
<log4net>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
......
......@@ -194,7 +194,7 @@ namespace AutoScanAndLabel
ListViewItem lvi = new ListViewItem(new string[] { "", moveInfo.Name, moveInfo.MoveStep.ToString(),moveInfo.GetStateStr() });
stateView.Items.Add(lvi);
}
var printstatus = RobotManage.mainMachine.LastPrintStatus;
var printstatus = RobotManage.mainMachine?.LastPrintStatus;
ListViewItem lvi1 = new ListViewItem(new string[] { "", crc.GetString("Res0216", "打印机"), (printstatus == Asa.PrintLabel.PrinterStatus.Unknown)?"Wait": printstatus.ToString(), ConfigHelper.Config.Get(Setting_Init.PrinterName) });
stateView.Items.Add(lvi1);
this.ResumeLayout(true);
......
......@@ -54,6 +54,9 @@ namespace AutoScanAndLabel.UC
this.txtMoveLSTId = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.checkBox1 = new System.Windows.Forms.CheckBox();
this.txtStandbyId = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.button2 = new System.Windows.Forms.Button();
this.groupBox_right.SuspendLayout();
this.groupBox_left.SuspendLayout();
this.groupBox2.SuspendLayout();
......@@ -173,6 +176,9 @@ namespace AutoScanAndLabel.UC
//
// groupBox3
//
this.groupBox3.Controls.Add(this.button2);
this.groupBox3.Controls.Add(this.txtStandbyId);
this.groupBox3.Controls.Add(this.label1);
this.groupBox3.Controls.Add(this.label7);
this.groupBox3.Controls.Add(this.button1);
this.groupBox3.Controls.Add(this.txtMissionId);
......@@ -194,7 +200,7 @@ namespace AutoScanAndLabel.UC
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(4, 154);
this.label7.Location = new System.Drawing.Point(47, 186);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(77, 14);
this.label7.TabIndex = 11;
......@@ -202,9 +208,9 @@ namespace AutoScanAndLabel.UC
//
// button1
//
this.button1.Location = new System.Drawing.Point(223, 136);
this.button1.Location = new System.Drawing.Point(264, 159);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(122, 45);
this.button1.Size = new System.Drawing.Size(122, 41);
this.button1.TabIndex = 10;
this.button1.Text = "手动任务测试";
this.button1.UseVisualStyleBackColor = true;
......@@ -212,7 +218,7 @@ namespace AutoScanAndLabel.UC
//
// txtMissionId
//
this.txtMissionId.Location = new System.Drawing.Point(87, 150);
this.txtMissionId.Location = new System.Drawing.Point(130, 182);
this.txtMissionId.Name = "txtMissionId";
this.txtMissionId.Size = new System.Drawing.Size(100, 23);
this.txtMissionId.TabIndex = 9;
......@@ -296,6 +302,33 @@ namespace AutoScanAndLabel.UC
this.checkBox1.UseVisualStyleBackColor = true;
this.checkBox1.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged);
//
// txtStandbyId
//
this.txtStandbyId.Enabled = false;
this.txtStandbyId.Location = new System.Drawing.Point(187, 124);
this.txtStandbyId.Name = "txtStandbyId";
this.txtStandbyId.Size = new System.Drawing.Size(100, 23);
this.txtStandbyId.TabIndex = 13;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(6, 127);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(175, 14);
this.label1.TabIndex = 12;
this.label1.Text = "移动到待机点的任务编号:";
//
// button2
//
this.button2.Location = new System.Drawing.Point(449, 159);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(122, 41);
this.button2.TabIndex = 14;
this.button2.Text = "重置呼叫状态";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// AgvControl
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
......@@ -345,5 +378,8 @@ namespace AutoScanAndLabel.UC
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.TextBox txtMissionId;
private System.Windows.Forms.TextBox txtStandbyId;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button button2;
}
}
......@@ -20,7 +20,7 @@ namespace AutoScanAndLabel.UC
public AgvControl()
{
InitializeComponent();
serverIp = ConfigAppSettings.GetValue(Setting_Init.STD_IP);
serverIp = ConfigHelper.Config.Get(Setting_Init.STD_IP, "127.0.0.1");
AGVManager.Connect(serverIp);
load();
groupBox2.Text = "AGV状态"+"["+ serverIp + "]";
......@@ -34,17 +34,11 @@ namespace AutoScanAndLabel.UC
}
private void load()
{
txtEnterId.Text = ConfigHelper.Config.Get(Setting_Init.ShelfInAGV, "1");
txtLeaveId.Text = ConfigHelper.Config.Get(Setting_Init.ShelfOutAGV, "2");
txtMoveLSTId.Text = ConfigHelper.Config.Get(Setting_Init.LStation, "3");
txtMoveRSTId.Text = ConfigHelper.Config.Get(Setting_Init.RStation, "4");
}
private void save()
{
ConfigHelper.Config.Set(Setting_Init.ShelfInAGV, txtEnterId.Text);
ConfigHelper.Config.Set(Setting_Init.ShelfOutAGV, txtLeaveId.Text);
ConfigHelper.Config.Set(Setting_Init.LStation, txtMoveLSTId.Text);
ConfigHelper.Config.Set(Setting_Init.RStation, txtMoveRSTId.Text);
txtEnterId.Text = ConfigHelper.Config.Get(Setting_Init.ShelfInAGV, "8");
txtLeaveId.Text = ConfigHelper.Config.Get(Setting_Init.ShelfOutAGV, "10");
txtMoveLSTId.Text = ConfigHelper.Config.Get(Setting_Init.LStation, "7");
txtMoveRSTId.Text = ConfigHelper.Config.Get(Setting_Init.RStation, "9");
txtStandbyId.Text = ConfigHelper.Config.Get(Setting_Init.Standby, "11");
}
MissionState curState;
private void MissionStateChanged(MissionState state)
......@@ -66,6 +60,7 @@ namespace AutoScanAndLabel.UC
}
}));
}
public bool InCalling = false;
private void button_rightneedempty_Click(object sender, EventArgs e)
{
if (!RobotManage.isRunning)
......@@ -73,21 +68,36 @@ namespace AutoScanAndLabel.UC
MessageBox.Show("机器尚未启动不能呼叫Agv");
return;
}
if (InCalling)
{
MessageBox.Show("已呼叫Agv,不能重复呼叫");
return;
}
if (RobotManage.mainMachine.IOValue(IO_Type.RightEnd_Check).Equals(IO_VALUE.LOW))
{
//请求AGV代码放这里
RequestRight();
//等待agv到位
RobotManage.mainMachine.RightMoveInfo.NewMove(MoveStep.R40_InShelf);//等待agv到位后执行,启动进入
Task.Run(() =>
{
InCalling = true;
//请求AGV代码放这里
RequestRight();
//等待agv到位
while (!WaitMissionOk())
{
Task.Delay(1000).Wait();
}
RobotManage.mainMachine.RightMoveInfo.NewMove(MoveStep.R40_InShelf);//等待agv到位后执行,启动进入
ShelfOutAgv();
while (RobotManage.mainMachine.RightMoveInfo.MoveStep >= MoveStep.R40_InShelf)
{
Task.Delay(1000).Wait();
}
while (!WaitMissionOk())
{
Task.Delay(1000).Wait();
}
ToStandby();
//通知agv上料结束, 也可以把上料结束的代码放到 R40_InShelf的结束步骤里去
InCalling = false;
});
}
else
......@@ -101,19 +111,37 @@ namespace AutoScanAndLabel.UC
MessageBox.Show("机器尚未启动不能呼叫Agv");
return;
}
if (InCalling)
{
MessageBox.Show("已呼叫Agv,不能重复呼叫");
return;
}
if (RobotManage.mainMachine.IOValue(IO_Type.RightEnd_Check).Equals(IO_VALUE.HIGH))
{
//请求AGV代码放这里
RequestRight();
//等待agv到位
RobotManage.mainMachine.RightMoveInfo.NewMove(MoveStep.R30_OutShelf);//等待agv到位后执行,启动料串离开
Task.Run(() =>
{
InCalling = true;
//请求AGV代码放这里
RequestRight();
//等待agv到位
while (!WaitMissionOk())
{
Task.Delay(1000).Wait();
}
RobotManage.mainMachine.RightMoveInfo.NewMove(MoveStep.R30_OutShelf);//等待agv到位后执行,启动料串离开
ShelfEnterAgv();
while (RobotManage.mainMachine.RightMoveInfo.MoveStep >= MoveStep.R30_OutShelf)
{
Task.Delay(1000).Wait();
}
//通知agv上料结束, 也可以把上料结束的代码放到R30_OutShelf的结束步骤里去
while (!WaitMissionOk())
{
Task.Delay(1000).Wait();
}
ToStandby();
InCalling = false;
});
}
else
......@@ -139,10 +167,19 @@ namespace AutoScanAndLabel.UC
int.TryParse(ConfigHelper.Config.Get(Setting_Init.ShelfOutAGV, "4"), out int val);
AGVManager.AddMission(val);
}
private void ToStandby()
{
int.TryParse(ConfigHelper.Config.Get(Setting_Init.Standby, "4"), out int val);
AGVManager.AddMission(val);
}
private bool WaitMissionOk(uint missionId)
{
return curState != null && curState.RunMissionId.Equals(missionId) && curState.MissionResult.Equals(MissionResult.任务执行成功);
}
private bool WaitMissionOk()
{
return curState != null && curState.MissionResult.Equals(MissionResult.任务执行成功);
}
private void button_Leftleavefull_Click(object sender, EventArgs e)
{
if (!RobotManage.isRunning)
......@@ -150,20 +187,37 @@ namespace AutoScanAndLabel.UC
MessageBox.Show("机器尚未启动不能呼叫Agv");
return;
}
if (InCalling)
{
MessageBox.Show("已呼叫Agv,不能重复呼叫");
return;
}
if (RobotManage.mainMachine.IOValue(IO_Type.LeftEnd_Check).Equals(IO_VALUE.HIGH))
{
//请求AGV代码放这里
RequestLeft();
//等待agv到位
RobotManage.mainMachine.LeftMoveInfo.NewMove(MoveStep.L50_OutShelf);//等待agv到位后执行,启动料串离开
Task.Run(() =>
{
InCalling = true;
//请求AGV代码放这里
RequestLeft();
//等待agv到位
while(!WaitMissionOk())
{
Task.Delay(1000).Wait();
}
RobotManage.mainMachine.LeftMoveInfo.NewMove(MoveStep.L50_OutShelf);//等待agv到位后执行,启动料串离开
ShelfEnterAgv();
while (RobotManage.mainMachine.LeftMoveInfo.MoveStep >= MoveStep.L50_OutShelf)
{
Task.Delay(1000).Wait();
}
//通知agv上料结束, 也可以把上料结束的代码放到L50_OutShelf的结束步骤里去
//等待agv到位
while (!WaitMissionOk())
{
Task.Delay(1000).Wait();
}
ToStandby();
InCalling = false;
});
}
else
......@@ -177,19 +231,36 @@ namespace AutoScanAndLabel.UC
MessageBox.Show("机器尚未启动不能呼叫Agv");
return;
}
if (InCalling)
{
MessageBox.Show("已呼叫Agv,不能重复呼叫");
return;
}
if (RobotManage.mainMachine.IOValue(IO_Type.LeftEnd_Check).Equals(IO_VALUE.LOW))
{
//请求AGV代码放这里
RequestLeft();
//等待agv到位
RobotManage.mainMachine.LeftMoveInfo.NewMove(MoveStep.L60_InShelf);//等待agv到位后执行,启动进入
Task.Run(() =>
{
InCalling = true;
//请求AGV代码放这里
RequestLeft();
//等待agv到位
while (!WaitMissionOk())
{
Task.Delay(1000).Wait();
}
RobotManage.mainMachine.LeftMoveInfo.NewMove(MoveStep.L60_InShelf);//等待agv到位后执行,启动进入
ShelfOutAgv();
while (RobotManage.mainMachine.LeftMoveInfo.MoveStep >= MoveStep.L60_InShelf)
{
Task.Delay(1000).Wait();
}
//通知agv上料结束, 也可以把上料结束的代码放到 L60_InShelf的结束步骤里去
while (!WaitMissionOk())
{
Task.Delay(1000).Wait();
}
ToStandby();
InCalling = false;
});
}
else
......@@ -209,5 +280,10 @@ namespace AutoScanAndLabel.UC
int.TryParse(txtMissionId.Text,out int val);
AGVManager.AddMission(val);
}
private void button2_Click(object sender, EventArgs e)
{
InCalling = false;
}
}
}
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
......@@ -53,11 +54,11 @@ namespace OnlineStore.Common
public static string CodeParamPath = "CodeParamPath";
public static string QRCodeCount = "QRCodeCount";
public static string STD_IP = "STD_IP";
public static string LStation = "LStation";
public static string RStation = "RStation";
public static string ShelfInAGV = "ShelfInAGV";
public static string ShelfOutAGV = "ShelfOutAGV";
public static string LStation = "LStation";
public static string RStation = "RStation";
public static string Standby = "Standby";
public static string STD_IP = "STD_IP";
}
}
......@@ -32,16 +32,17 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\dll\log4net.dll</HintPath>
<Reference Include="log4net, Version=2.0.12.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.2.0.12\lib\net45\log4net.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\dll\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Web" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
......@@ -68,6 +69,7 @@
<Compile Include="TCP\TcpServer.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="Protocol\Modbus\_system~.ini" />
<None Include="Protocol\_system~.ini" />
<None Include="TCP\_system~.ini" />
......
......@@ -57,9 +57,9 @@ namespace DL.StandardRobot
{
if (data.Length >= 240)
{
preState.RunMissionId = GetUInt32(new byte[] { data[196], data[195], data[194], data[193] });
preState.MissionRunState = (MissionRunState)GetUInt16(data[198], data[197]);
preState.MissionResult = (MissionResult)GetUInt16(data[200], data[199]);
preState.RunMissionId = GetUInt32(new byte[] { data[195], data[194], data[193], data[192] });
preState.MissionRunState = (MissionRunState)GetUInt16(data[197], data[196]);
preState.MissionResult = (MissionResult)GetUInt16(data[199], data[198]);
if (!missionState.Equals(preState))
{
missionState.RunMissionId = preState.RunMissionId;
......
......@@ -51,19 +51,9 @@ namespace DL.Com.TCP
start = true;
thread = new Thread(sendQueueRequest);
thread.IsBackground = true;
//thread = new System.Timers.Timer();
//thread.Interval = 100;
//thread.Elapsed += Thread_Elapsed;
//thread.AutoReset = true;
//thread.Enabled = true;
thread.Start();
}
private void Thread_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
sendQueueRequest();
}
~ModbusTCPMaster()
{
start = false;
......@@ -95,7 +85,6 @@ namespace DL.Com.TCP
continue;
}
}
}
}
else
......
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="log4net" version="2.0.12" targetFramework="net461" />
</packages>
\ No newline at end of file
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!