Commit 41b85e1f LN

agv对接功能。

1 个父辈 2c48ddc1
...@@ -42,6 +42,19 @@ namespace OnlineStore.Common ...@@ -42,6 +42,19 @@ namespace OnlineStore.Common
[MyConfigComment("二维码扫码超时毫秒")] [MyConfigComment("二维码扫码超时毫秒")]
public static MyConfig<int> Device_RfidServer_Port = 30001; public static MyConfig<int> Device_RfidServer_Port = 30001;
[MyConfigComment("Agv服务器地址")]
public static MyConfig<string> Device_AgvServer = "127.0.0.1";
[MyConfigComment("AGV服务器端口号")]
public static MyConfig<int> Device_AgvPort = 12000;
[MyConfigComment("Agv节点ID列表")]
public static MyConfig<string[]> Device_AgvNodeId =new string[] { "1","2","3","4"};
[MyConfigComment("AGV节点名称")]
public static MyConfig<string[]> Device_AgvNodeName=new string[] { "A1", "A2", "A3", "A4" };
[MyConfigComment("管理员密码")] [MyConfigComment("管理员密码")]
public static MyConfig<string> User_AdminPassword = "123456"; public static MyConfig<string> User_AdminPassword = "123456";
[MyConfigComment("启用管理员密码")] [MyConfigComment("启用管理员密码")]
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<config ver="10"> <config ver="10">
<item key="App_Title" ver="10" value="SMD-BOX-XLC" /> <item key="App_Title" ver="10" value="出料机构" />
<item key="EnableBuzzer" ver="10" value="False" /> <item key="EnableBuzzer" ver="10" value="False" />
</config> </config>
\ No newline at end of file \ No newline at end of file
...@@ -32,6 +32,9 @@ ...@@ -32,6 +32,9 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="AGVLib">
<HintPath>..\SharedDLL\agv\AGVLib.dll</HintPath>
</Reference>
<Reference Include="Asa.Camera.VisionLib, Version=1.3.8479.24297, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Asa.Camera.VisionLib, Version=1.3.8479.24297, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\SharedDLL\Asa.Camera.VisionLib.dll</HintPath> <HintPath>..\SharedDLL\Asa.Camera.VisionLib.dll</HintPath>
...@@ -79,6 +82,7 @@ ...@@ -79,6 +82,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="DeviceLibrary\AcSerialBean.cs" /> <Compile Include="DeviceLibrary\AcSerialBean.cs" />
<Compile Include="DeviceLibrary\agv\AgvClient.cs" />
<Compile Include="DeviceLibrary\Camera.cs" /> <Compile Include="DeviceLibrary\Camera.cs" />
<Compile Include="DeviceLibrary\CylinderManger.cs" /> <Compile Include="DeviceLibrary\CylinderManger.cs" />
<Compile Include="DeviceLibrary\HttpServer.cs" /> <Compile Include="DeviceLibrary\HttpServer.cs" />
...@@ -89,7 +93,9 @@ ...@@ -89,7 +93,9 @@
<Compile Include="DeviceLibrary\ReelParam.cs" /> <Compile Include="DeviceLibrary\ReelParam.cs" />
<Compile Include="DeviceLibrary\ServerCommunication.cs" /> <Compile Include="DeviceLibrary\ServerCommunication.cs" />
<Compile Include="DeviceLibrary\AxisBean.cs" /> <Compile Include="DeviceLibrary\AxisBean.cs" />
<Compile Include="DeviceLibrary\WaitUtil.cs" />
<Compile Include="theMachine\BaseBean.cs" /> <Compile Include="theMachine\BaseBean.cs" />
<Compile Include="theMachine\OutShelfBean_AgvPro.cs" />
<Compile Include="theMachine\ReelTransport.cs" /> <Compile Include="theMachine\ReelTransport.cs" />
<Compile Include="theMachine\Common.cs" /> <Compile Include="theMachine\Common.cs" />
<Compile Include="theMachine\InReelBean.cs" /> <Compile Include="theMachine\InReelBean.cs" />
......
...@@ -2,10 +2,7 @@ ...@@ -2,10 +2,7 @@
using OnlineStore.LoadCSVLibrary; using OnlineStore.LoadCSVLibrary;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks;
using System.Timers; using System.Timers;
namespace DeviceLibrary namespace DeviceLibrary
...@@ -27,6 +24,10 @@ namespace DeviceLibrary ...@@ -27,6 +24,10 @@ namespace DeviceLibrary
} }
private static void T1_Elapsed(object sender, ElapsedEventArgs e) private static void T1_Elapsed(object sender, ElapsedEventArgs e)
{ {
if (RobotManage.mainMachine == null || (!RobotManage.mainMachine.LoadOk))
{
return;
}
foreach (var iOMonitorStrut in iOMonitorStruts) foreach (var iOMonitorStrut in iOMonitorStruts)
{ {
var current_iovalue = IOManager.IOValue(iOMonitorStrut.ioType, iOMonitorStrut.Config); var current_iovalue = IOManager.IOValue(iOMonitorStrut.ioType, iOMonitorStrut.Config);
......
...@@ -5,10 +5,7 @@ using System; ...@@ -5,10 +5,7 @@ using System;
using System.Collections.Concurrent; using System.Collections.Concurrent;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks;
namespace DeviceLibrary namespace DeviceLibrary
{ {
public class ServerCommunication public class ServerCommunication
......
using OnlineStore.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace DeviceLibrary.DeviceLibrary
{
public class WaitUtil
{
public delegate bool IsOk();
/// <summary>
/// 使用异步委托检测超时,防止isOk方法不返回结果导致卡死的问题
/// </summary>
/// <param name="waitName"></param>
/// <param name="timeout"></param>
/// <param name="isOk"></param>
public static bool Wait(int timeout, IsOk isOk, string waitName = "")
{
DateTime startTime = System.DateTime.Now;
TimeSpan timoutSpan = TimeSpan.FromMilliseconds(timeout);
TimeSpan waitSpan = TimeSpan.FromMilliseconds(0);
int sleepTime = 10;
while (true)
{
TimeSpan remainTimes = timoutSpan.Subtract(waitSpan);
if (remainTimes.TotalMilliseconds < 0)
{
//已经超时
throw new TimeoutException(waitName + "超时");
}
try
{
IAsyncResult re = isOk.BeginInvoke(null, null);
var waitResult = re.AsyncWaitHandle.WaitOne(remainTimes);
if (waitResult)
{
bool okResult = isOk.EndInvoke(re);
if (okResult)
{
return true;
}
}
}
catch (Exception ex)
{
LogUtil.error("同步等待出现异常:", ex);
}
Thread.Sleep(sleepTime);
waitSpan = System.DateTime.Now.Subtract(startTime);
}
}
}
}
using AGVLib;
using OnlineStore.Common;
using System;
using System.Collections.Generic;
namespace DeviceLibrary
{
public class AgvClient
{
public static bool DisAgv = false;
private static Client client;
/// <summary>
/// key=agvId
/// </summary>
public static Dictionary<int, AGVLib.NodeStatus> nodeStatusMap = new Dictionary<int, NodeStatus>();
private static bool isInit = false;
public static void Init()
{
LogUtil.info("开始 Init client");
if (!isInit)
{
isInit = true;
client = new Client();
client.ConnectedEvent += Client_ConnectedEvent;
client.ReceivedEvent += Client_ReceivedEvent;
client.IsAutoReconnect = true;
LogUtil.info($" 开始 client.Connect: {Setting_Init.Device_AgvServer},{Setting_Init.Device_AgvPort}");
client.Connect(Setting_Init.Device_AgvServer, Setting_Init.Device_AgvPort);
}
}
public static void setDisAgv(bool disAgv)
{
LogUtil.info("设置:DisAgv=" + disAgv);
DisAgv = disAgv;
}
private static string getNodeStr(Node node)
{
return $"nodeInfo: id={node.id},name={node.name},level={node.level},status={node.status} ,shelf_id={node.shelf_id}";
}
private static OutShelfBean GetShelfBean(string nodeName)
{
List<OutShelfBean> outShelfBeans = new List<OutShelfBean>(RobotManage.mainMachine.outShelfBeans.Values);
foreach (OutShelfBean bean in outShelfBeans)
{
if (bean.agvName.Equals(nodeName))
{
return bean;
}
}
return null;
}
private static void Client_ReceivedEvent(Node node)
{
LogUtil.info($"Client_ReceivedEvent : node={getNodeStr(node)}" );
OutShelfBean outShelfBean = GetShelfBean(node.name);
if (outShelfBean == null)
{
LogUtil.info($"Client_ReceivedEvent : node={getNodeStr(node)} ,未找到对应的OutShelfBean ");
return;
}
if (node.status.Equals(NodeStatus.Arrive))
{
outShelfBean.AgvArrive(node);
}else if (node.status.Equals(NodeStatus.RequestEnter))
{
outShelfBean.AgvRequestEnter(node);
}
else if (node.status.Equals(NodeStatus.RequestLeave))
{
outShelfBean.AgvRequestLeave(node);
}
}
private static void Client_ConnectedEvent(bool status)
{
LogUtil.info("Client_ConnectedEvent := " + status);
}
internal static bool ISConnected()
{
if (client == null)
{
return false;
}
return client.Connected;
}
public static void SetStatus(int agvId,string agvName, string shelfId = "", NodeStatus status = NodeStatus.None, NodeLevel level = NodeLevel.Low, bool isMust = false)
{
if (!isMust && level.Equals(NodeLevel.Low))
{
if (nodeStatusMap.ContainsKey(agvId))
{
NodeStatus currA = nodeStatusMap[agvId]; //相同状态就设置一次
if (currA.Equals(status))
{
return;
}
}
}
string mark = "";
if (shelfId != "")
{
int index = shelfId.IndexOf(',');
if (index > 0)
{
//紧急出料模块,料架离开时,mark=紧急料或者分配料,rfid=料架号
mark = shelfId.Substring(index + 1, shelfId.Length - index - 1);
shelfId = shelfId.Substring(0, index);
}
}
Node node = new Node(agvId, agvName);
node.SetState(status, level, shelfId);
client.SetStatus(node);
UpdateStatus(agvId, node);
}
public static bool SetToNone(int agvId, string agvName, string shelfId = "")
{
NodeStatus currA = GetCurrStatus(agvId);
if (currA.Equals(NodeStatus.None) || currA.Equals(NodeStatus.NeedLeave) || currA.Equals(NodeStatus.NeedEnter))
{
SetStatus(agvId,agvName, shelfId, NodeStatus.None);
return true;
}
return false;
}
public static bool NeedEnter(int agvId, string agvName, string shelfId = "", NodeLevel level = NodeLevel.Low)
{
NodeStatus currA = GetCurrStatus(agvId);
if (currA.Equals(NodeStatus.None) || currA.Equals(NodeStatus.NeedLeave) || currA.Equals(NodeStatus.NeedEnter))
{
SetStatus(agvId,agvName, shelfId, NodeStatus.NeedEnter, level);
return true;
}
return false;
}
public static bool NeedLeave(int agvId, string agvName, string shelfId = "", NodeLevel level = NodeLevel.Low)
{
NodeStatus currA = GetCurrStatus(agvId);
if (currA.Equals(NodeStatus.None) || currA.Equals(NodeStatus.NeedLeave) || currA.Equals(NodeStatus.NeedEnter))
{
SetStatus(agvId,agvName, shelfId, NodeStatus.NeedLeave, level);
return true;
}
return false;
}
public static NodeStatus GetCurrStatus(int agvId)
{
if (nodeStatusMap.ContainsKey(agvId))
{
return nodeStatusMap[agvId];
}
return NodeStatus.None;
}
public static void UpdateStatus(int agvId, Node node)
{
if (nodeStatusMap.ContainsKey(agvId))
{
nodeStatusMap[agvId] = node.status;
}
else
{
nodeStatusMap.Add(agvId, node.status);
}
}
public static void Dispose()
{
try
{
if (client != null)
{
client.Close();
}
}
catch (Exception ex)
{
LogUtil.error("释放 client " + Setting_Init.Device_AgvServer + " 出错:", ex);
}
}
}
}
...@@ -117,13 +117,40 @@ namespace DeviceLibrary ...@@ -117,13 +117,40 @@ namespace DeviceLibrary
InReelBean inReel = new InReelBean("IN_"+i); InReelBean inReel = new InReelBean("IN_"+i);
inReelBeans.Add(inReel); inReelBeans.Add(inReel);
} }
List<string> rfidIp = new List<string> { Config.RFID_U1, Config.RFID_U2, Config.RFID_U3, Config.RFID_U4 };
for (int i = 1; i <= 4; i++)
{
string rfidip = rfidIp[i - 1];
string[] agvNodeIds = Setting_Init.Device_AgvNodeId;
string[] agvNodeNames = Setting_Init.Device_AgvNodeName;
if (agvNodeIds == null || agvNodeIds.Length <= 0)
{
agvNodeIds = new string[] { "1", "2", "3", "4" };
}
if (agvNodeNames == null || agvNodeNames.Length <= 0)
{
agvNodeNames = new string[] { "A1", "A2", "A3", "A4" };
}
int agvid = 0;
try
{
agvid = Convert.ToInt32(agvNodeIds[i - 1]);
}
catch (Exception ex)
{
LogUtil.error($"U{i}的agvID转为int失败,默认=0:" + ex.ToString());
}
string agvname = agvNodeNames[i - 1];
outShelfBeans.Add("U" + i, new OutShelfBean("U" + i, rfidip, agvid, agvname));
}
outShelfBeans.Add("U1", new OutShelfBean("U1", Config.RFID_U1));
outShelfBeans.Add("U2", new OutShelfBean("U2", Config.RFID_U2));
outShelfBeans.Add("U3", new OutShelfBean("U3", Config.RFID_U3));
outShelfBeans.Add("U4", new OutShelfBean("U4", Config.RFID_U4));
//outShelfBeans.Add("U1", new OutShelfBean("U1", Config.RFID_U1));
//outShelfBeans.Add("U2", new OutShelfBean("U2", Config.RFID_U2));
//outShelfBeans.Add("U3", new OutShelfBean("U3", Config.RFID_U3));
//outShelfBeans.Add("U4", new OutShelfBean("U4", Config.RFID_U4));
AgvClient.Init();
LedProcessInit(); LedProcessInit();
LoadOk = true; LoadOk = true;
} }
......
...@@ -156,18 +156,18 @@ namespace DeviceLibrary ...@@ -156,18 +156,18 @@ namespace DeviceLibrary
S21_ShelfNeedLeave, S21_ShelfNeedLeave,
//呼叫agv拉料 //呼叫agv拉料
S22_WaitAGV, S22_WaitAGV,
//agv到位 ////agv到位
S23_AgvDetect, //S23_AgvDetect,
//定位气缸下降 ////定位气缸下降
S24_LocationDown, //S24_LocationDown,
//电机反转 ////电机反转
S25_LineRRun, //S25_LineRRun,
//等待前端料格检测 On变OFF ////等待前端料格检测 On变OFF
S26_ShelfBackHigh, //S26_ShelfBackHigh,
//等待前端料格检测 On变OFF ////等待前端料格检测 On变OFF
S27_ShelfBackLow, //S27_ShelfBackLow,
//电机反转延时2秒OFF ////电机反转延时2秒OFF
S28_WaitTime, //S28_WaitTime,
/// <summary> /// <summary>
......
...@@ -6,7 +6,7 @@ using System.Text; ...@@ -6,7 +6,7 @@ using System.Text;
namespace DeviceLibrary namespace DeviceLibrary
{ {
public class OutShelfBean: BaseBean public partial class OutShelfBean: BaseBean
{ {
public static PuYueRFID_C2S RFID = null; public static PuYueRFID_C2S RFID = null;
...@@ -16,11 +16,15 @@ namespace DeviceLibrary ...@@ -16,11 +16,15 @@ namespace DeviceLibrary
private CylinderManger locationCylinder; private CylinderManger locationCylinder;
public ShelfInfo CurrShelf; public ShelfInfo CurrShelf;
public string rfidIp; public string rfidIp;
public int agvId;
public string agvName;
public OutShelfBean(string name, string ip) public OutShelfBean(string name, string ip,int agvid,string agvname)
{ {
this.Name = name; this.Name = name;
this.rfidIp = ip; this.rfidIp = ip;
this.agvId = agvid;
this.agvName = agvname;
MoveInfo = new MoveInfo(name); MoveInfo = new MoveInfo(name);
#region 初始化IO #region 初始化IO
...@@ -45,9 +49,16 @@ namespace DeviceLibrary ...@@ -45,9 +49,16 @@ namespace DeviceLibrary
public void Reset() public void Reset()
{ {
MoveInfo.NewMove(MoveStep.SR01_LocationDown); MoveInfo.NewMove(MoveStep.SR01_LocationDown);
if (ProcessShelfEnter || ProcessShelfOut)
{
LogUtil.info(Name + " 开始复位: agv 处理中,暂不动作");
}
else
{
MoveInfo.log("执行重置,定位气缸下降"); MoveInfo.log("执行重置,定位气缸下降");
locationCylinder.ToLow(MoveInfo); locationCylinder.ToLow(MoveInfo);
WarnMsg = ""; WarnMsg = "";
}
pause = false; pause = false;
} }
...@@ -187,29 +198,28 @@ namespace DeviceLibrary ...@@ -187,29 +198,28 @@ namespace DeviceLibrary
#endregion #endregion
public bool Process() private void ShelfCheck()
{ {
if (pause) if (ProcessShelfEnter || ProcessShelfOut)
return false;
if (RobotManage.mainMachine.CheckWait(MoveInfo))
return false;
switch (MoveInfo.MoveStep)
{ {
case MoveStep.Wait: }//判断定位气缸是否下降到位
//判断定位气缸是否下降到位
if (locationCylinder.IsLow()) else if (locationCylinder.IsLow())
{ {
if (CheckShelf(IO_VALUE.HIGH)) if (CheckShelf(IO_VALUE.HIGH))
{ {
//料架已到位 //料架已到位
MoveInfo.NewMove(MoveStep.S04_WaitTime); MoveInfo.NewMove(MoveStep.S04_WaitTime);
MoveInfo.log("检测到料架已到位");
AgvClient.SetToNone(agvId, agvName);
} }
else if (IOManager.IOValue(Shelf_Front_Check).Equals(IO_VALUE.HIGH) || IOManager.IOValue(Shelf_Back_Check).Equals(IO_VALUE.HIGH)) else if (IOManager.IOValue(Shelf_Front_Check).Equals(IO_VALUE.HIGH) || IOManager.IOValue(Shelf_Back_Check).Equals(IO_VALUE.HIGH))
{ {
//默认是进来的料架 //默认是进来的料架
MoveInfo.NewMove(MoveStep.S02_LineFRun); MoveInfo.NewMove(MoveStep.S02_LineFRun);
MoveInfo.log("检测到料架信号,电机正传"); MoveInfo.log("检测到料架信号,电机正传");
AgvClient.SetToNone(agvId, agvName);
LineFRun(); LineFRun();
//等待后端料格检测 //等待后端料格检测
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(Shelf_Front_Check, IO_VALUE.HIGH)); MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(Shelf_Front_Check, IO_VALUE.HIGH));
...@@ -220,6 +230,7 @@ namespace DeviceLibrary ...@@ -220,6 +230,7 @@ namespace DeviceLibrary
//默认是进来的料架 //默认是进来的料架
MoveInfo.NewMove(MoveStep.S02_LineFRun); MoveInfo.NewMove(MoveStep.S02_LineFRun);
MoveInfo.log("检测到AGV小车,电机正传"); MoveInfo.log("检测到AGV小车,电机正传");
AgvClient.SetToNone(agvId, agvName);
LineFRun(); LineFRun();
//等待后端料格检测 //等待后端料格检测
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(Shelf_Front_Check, IO_VALUE.HIGH)); MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(Shelf_Front_Check, IO_VALUE.HIGH));
...@@ -229,6 +240,23 @@ namespace DeviceLibrary ...@@ -229,6 +240,23 @@ namespace DeviceLibrary
//TODO 暂无料架,呼叫小车 //TODO 暂无料架,呼叫小车
} }
} }
}
public bool Process()
{
if (pause)
return false;
if (RobotManage.mainMachine.CheckWait(MoveInfo))
return false;
switch (MoveInfo.MoveStep)
{
case MoveStep.Wait:
ShelfCheck();
AgvStatusPro();
break; break;
case MoveStep.SR01_LocationDown: case MoveStep.SR01_LocationDown:
MoveInfo.NewMove(MoveStep.Wait); MoveInfo.NewMove(MoveStep.Wait);
...@@ -282,59 +310,61 @@ namespace DeviceLibrary ...@@ -282,59 +310,61 @@ namespace DeviceLibrary
case MoveStep.S21_ShelfNeedLeave: case MoveStep.S21_ShelfNeedLeave:
MoveInfo.NextMoveStep(MoveStep.S22_WaitAGV); MoveInfo.NextMoveStep(MoveStep.S22_WaitAGV);
MoveInfo.log("呼叫AGV小车"); AgvClient.NeedLeave(agvId, agvName, CurrShelf.rfid);
MoveInfo.log("呼叫AGV小车,结束");
MoveInfo.EndMove();
break; break;
case MoveStep.S22_WaitAGV: //case MoveStep.S22_WaitAGV:
//呼叫agv拉料 // //呼叫agv拉料
MoveInfo.NextMoveStep(MoveStep.S23_AgvDetect); // MoveInfo.NextMoveStep(MoveStep.S23_AgvDetect);
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(Agv_Detect, IO_VALUE.HIGH)); // MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(Agv_Detect, IO_VALUE.HIGH));
MoveInfo.log("等待AGV到达"); // MoveInfo.log("等待AGV到达");
break; // break;
case MoveStep.S23_AgvDetect: //case MoveStep.S23_AgvDetect:
if (!locationCylinder.IsLow()) // if (!locationCylinder.IsLow())
{ // {
MoveInfo.NextMoveStep(MoveStep.S24_LocationDown); // MoveInfo.NextMoveStep(MoveStep.S24_LocationDown);
MoveInfo.log("定位气缸下降"); // MoveInfo.log("定位气缸下降");
locationCylinder.ToLow(MoveInfo); // locationCylinder.ToLow(MoveInfo);
} // }
else // else
{ // {
MoveInfo.NextMoveStep(MoveStep.S25_LineRRun); // MoveInfo.NextMoveStep(MoveStep.S25_LineRRun);
MoveInfo.log("电机反转"); // MoveInfo.log("电机反转");
LineRRun(); // LineRRun();
} // }
break; // break;
case MoveStep.S24_LocationDown: //case MoveStep.S24_LocationDown:
MoveInfo.NextMoveStep(MoveStep.S25_LineRRun); // MoveInfo.NextMoveStep(MoveStep.S25_LineRRun);
MoveInfo.log("电机反转"); // MoveInfo.log("电机反转");
LineRRun(); // LineRRun();
break; // break;
case MoveStep.S25_LineRRun: //case MoveStep.S25_LineRRun:
MoveInfo.NextMoveStep(MoveStep.S26_ShelfBackHigh); // MoveInfo.NextMoveStep(MoveStep.S26_ShelfBackHigh);
MoveInfo.log("等待后端检测信号亮"); // MoveInfo.log("等待后端检测信号亮");
LineRRun(); // LineRRun();
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(Shelf_Back_Check, IO_VALUE.HIGH)); // MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(Shelf_Back_Check, IO_VALUE.HIGH));
break; // break;
case MoveStep.S26_ShelfBackHigh: //case MoveStep.S26_ShelfBackHigh:
MoveInfo.NextMoveStep(MoveStep.S27_ShelfBackLow); // MoveInfo.NextMoveStep(MoveStep.S27_ShelfBackLow);
MoveInfo.log("等待后端检测信号灭"); // MoveInfo.log("等待后端检测信号灭");
LineRRun(); // LineRRun();
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(Shelf_Back_Check, IO_VALUE.LOW)); // MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(Shelf_Back_Check, IO_VALUE.LOW));
break; // break;
case MoveStep.S27_ShelfBackLow: //case MoveStep.S27_ShelfBackLow:
MoveInfo.NextMoveStep(MoveStep.S28_WaitTime); // MoveInfo.NextMoveStep(MoveStep.S28_WaitTime);
MoveInfo.log("继续转动2秒"); // MoveInfo.log("继续转动2秒");
LineRRun(); // LineRRun();
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(Shelf_Back_Check, IO_VALUE.LOW)); // MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(Shelf_Back_Check, IO_VALUE.LOW));
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(2000)); // MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(2000));
break; // break;
case MoveStep.S28_WaitTime: //case MoveStep.S28_WaitTime:
MoveInfo.NextMoveStep(MoveStep.Wait); // MoveInfo.NextMoveStep(MoveStep.Wait);
MoveInfo.log("料架已离开,清空料架:"+CurrShelf.ToStr()); // MoveInfo.log("料架已离开,清空料架:"+CurrShelf.ToStr());
CurrShelf = new ShelfInfo(); // CurrShelf = new ShelfInfo();
LineStopRun(); // LineStopRun();
break; // break;
default: default:
MoveInfo.log($"{storeMoveType}:未找到对应步骤:{MoveInfo.MoveStep}"); MoveInfo.log($"{storeMoveType}:未找到对应步骤:{MoveInfo.MoveStep}");
return true; return true;
......
using AGVLib;
using DeviceLibrary.DeviceLibrary;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Threading;
using System.Threading.Tasks;
namespace DeviceLibrary
{
partial class OutShelfBean
{
internal bool CheckNeedLeave(bool IsReset = true)
{
if (IsDis())
{
return false;
}
if (CurrShelf.IsNeedLeave)
{
return true;
}
if (CurrShelf.EmptyPos <= 0)
{
CurrShelf.IsNeedLeave = true;
LogUtil.info(Name + " " + CurrShelf.ToStr() + " 没有空位需要离开 ");
if (IsReset)
{
Reset();
}
return true;
}
return false;
}
#region AGV状态处理
private void AgvStatusPro()
{
if (ShelfReady())
{
if (CheckNeedLeave())
{
return;
}
AgvClient.SetToNone(agvId, agvName);
}
else if (CurrShelf.realRFID.Equals("") && IOManager.IOValue(Shelf_Front_Check).Equals(IO_VALUE.LOW) && IOManager.IOValue(Shelf_Back_Check).Equals(IO_VALUE.LOW))
{
if (locationCylinder.IsLow())
{
//暂无料架,需要料架
AgvClient.NeedEnter(agvId, agvName, "");
}
else
{
locationCylinder.ToLow(null);
AgvClient.SetToNone(agvId, agvName);
}
}
else if (IOManager.IOValue(Shelf_Front_Check).Equals(IO_VALUE.HIGH) && IOManager.IOValue(Shelf_Back_Check).Equals(IO_VALUE.HIGH) && CurrShelf.IsNeedLeave)
{
if ( locationCylinder.IsLow())
{
//设置等待离开
AgvClient.NeedLeave(agvId, agvName, CurrShelf.realRFID);
}
else
{
locationCylinder.ToLow(null);
AgvClient.SetToNone(agvId, agvName);
}
}
else
{
AgvClient.SetToNone(agvId, agvName);
}
}
#endregion
internal void AgvArrive(Node node)
{
string theAgvName = node.name;
string logN = Name + "收到 AgvArrive 事件 [" + node.id + "-"+node.name+"] [" + node.shelf_id + "] ";
if (theAgvName.Equals(agvName))
{
}
LogUtil.info(logN + ":" + "暂无处理");
}
internal void AgvRequestEnter(Node node)
{
string theAgvName = node.name;
string logN = Name + "收到 AgvRequestEnter 事件 [" + node.id + "-" + node.name + "] [" + node.shelf_id + "] ";
if (theAgvName.Equals(agvName))
{
if (IOManager.IOValue(Shelf_Front_Check).Equals(IO_VALUE.HIGH) || IOManager.IOValue(Shelf_Back_Check).Equals(IO_VALUE.HIGH))
{
LogUtil.info(logN + " ,已有料架,暂不处理,设置 [" + theAgvName + "] 状态为 RejectEnter");
AgvClient.SetStatus(node.id,node.name,"",NodeStatus.RejectEnter,NodeLevel.High);
return;
}
ShelfEnterProcess();
}
}
internal void AgvRequestLeave(Node node)
{
string theAgvName = node.name;
string logN = Name + "收到 AgvRequestLeave 事件 [" + node.id + "-" + node.name + "] [" + node.shelf_id + "] ";
if (theAgvName.Equals(agvName))
{
if (IOManager.IOValue(Shelf_Front_Check).Equals(IO_VALUE.LOW) && IOManager.IOValue(Shelf_Back_Check).Equals(IO_VALUE.LOW))
{
LogUtil.info(logN + " ,未检测到料架,暂不处理,设置 [" + theAgvName + "] 状态为 RejectLeave");
AgvClient.SetStatus(node.id,node.name,"",NodeStatus.RejectLeave, NodeLevel.High);
return;
}
ShelfLeaveProcess();
}
}
private bool ProcessShelfEnter = false;
private bool ProcessShelfOut = false;
internal void ShelfLeaveProcess()
{
//AGV已到达,将料架送入AGV中
Task.Factory.StartNew(delegate
{
string logName = Name + "[" + agvName + "] 料架送入AGV ";
try
{
LogUtil.info(logName + "开始,先设置状态为 MayLeave");
AgvClient.SetStatus(agvId,agvName, CurrShelf.realRFID, NodeStatus.MayLeave, NodeLevel.High);
ProcessShelfOut = true;
LineRRun();
bool result = WaitIo(Shelf_Front_Check, IO_VALUE.LOW, 60000);
if (!result)
{
LogUtil.info(logName + " 等待 " + Shelf_Front_Check + "=LOW超时,等待60000后停止线体转动,发送FinishLeave");
}
else
{
LogUtil.info(logName + " 已收到" + Shelf_Front_Check + "=LOW ,等待60000后停止线体转动,发送FinishLeave");
}
result = WaitIo(Shelf_Back_Check, IO_VALUE.LOW, 60000);
if (!result)
{
LogUtil.info(logName + " 等待 " + Shelf_Back_Check + "=LOW超时,等待60000后停止线体转动,发送FinishLeave");
}
else
{
LogUtil.info(logName + " 已收到" + Shelf_Back_Check + "=LOW ,等待60000后停止线体转动,发送FinishLeave");
}
Thread.Sleep(8000);
LineStopRun();
AgvClient.SetStatus(agvId, agvName, CurrShelf.realRFID, NodeStatus.FinishLeave, NodeLevel.High);
Thread.Sleep(2000);
AgvClient.SetStatus(agvId, agvName, "", NodeStatus.None, NodeLevel.High);
ProcessShelfOut = false;
LogUtil.info(logName + ",停止转动,清空" + CurrShelf.ToStr() + ", 结束");
CurrShelf = new ShelfInfo();
}
catch (TimeoutException te)
{
LogUtil.error(logName + " 超时:" + te);
}
catch (Exception ex)
{
LogUtil.error(logName + " 出错:", ex);
}
finally
{
AgvClient.SetStatus(agvId, agvName, "", NodeStatus.None, NodeLevel.High);
LineStopRun();
ProcessShelfOut = false;
}
});
}
internal void ShelfEnterProcess()
{
Task.Factory.StartNew(delegate
{
string logName = Name + "AGV料架进入 [" + agvName + "] ";
try
{
CurrShelf = new ShelfInfo();
LogUtil.info(logName + " 开始,清空料架信息,设置状态=MayEnter");
AgvClient.SetStatus(agvId,agvName, "", NodeStatus.MayEnter, NodeLevel.High, true);
ProcessShelfEnter = true;
LineFRun();
bool result = false;
//等待进料检测信号
result = WaitIo(Shelf_Back_Check, IO_VALUE.HIGH, 600000, logName + "等待" + Shelf_Back_Check + "信号");
LogUtil.info(logName + " 等待 " + Shelf_Back_Check + "=High 结果: " + result + ", 开始等待 " + Shelf_Front_Check + " 信号");
result = WaitIo(Shelf_Front_Check, IO_VALUE.HIGH, 600000, logName + "等待" + Shelf_Front_Check + "信号");
LogUtil.info(logName + " 等待 " + Shelf_Front_Check + "=High 结果: " + result + ",开始等待 FinishEnter 超时10分钟");
try
{
result = WaitUtil.Wait(600000, delegate ()
{
return AgvClient.GetCurrStatus(agvId).Equals(NodeStatus.FinishEnter);
}, logName + "等待FinishEnter超时");
}
catch (TimeoutException te)
{
LogUtil.error(logName + " 超时:" + te);
}
LogUtil.info(logName + ",完成,信号已到位");
LineStopRun();
Thread.Sleep(2000);
AgvClient.SetStatus(agvId,agvName, "", NodeStatus.None, NodeLevel.High, true);
ProcessShelfEnter = false;
Reset();
}
catch (TimeoutException te)
{
LogUtil.error(logName + " 超时:" + te);
}
catch (Exception ex)
{
LogUtil.error(logName + " 出错:", ex);
}
finally
{
AgvClient.SetStatus(agvId, agvName, "", NodeStatus.None, NodeLevel.High, true);
LineStopRun();
ProcessShelfEnter = false;
}
});
}
public string getAgvStatus()
{
return AgvClient.GetCurrStatus(agvId).ToString();
}
protected bool WaitIo(string ioType, IO_VALUE value, int timeOut, string errName = "")
{
try
{
return WaitUtil.Wait(timeOut, delegate ()
{
return value.Equals(IOManager.IOValue(ioType));
}, errName);
}
catch (Exception ex)
{
LogUtil.error(Name + "等待" + ioType + "=" + value + "超时:" + ex.ToString());
return false;
}
}
}
}
...@@ -99,7 +99,7 @@ namespace DeviceLibrary ...@@ -99,7 +99,7 @@ namespace DeviceLibrary
} }
catch (Exception ex) catch (Exception ex)
{ {
LoadFinishEvent?.Invoke(false, ex.Message); LoadFinishEvent?.Invoke(false, ex.Message+":"+ex.ToString());
return; return;
} }
LoadFinishEvent?.Invoke(IsConfigMode ? IsConfigMode : IsLoadOk, msg); LoadFinishEvent?.Invoke(IsConfigMode ? IsConfigMode : IsLoadOk, msg);
......
此文件类型无法预览
...@@ -49,6 +49,8 @@ namespace TheMachine ...@@ -49,6 +49,8 @@ namespace TheMachine
this.tabc = new System.Windows.Forms.TabControl(); this.tabc = new System.Windows.Forms.TabControl();
this.tabP1 = new System.Windows.Forms.TabPage(); this.tabP1 = new System.Windows.Forms.TabPage();
this.pnl = new System.Windows.Forms.Panel(); this.pnl = new System.Windows.Forms.Panel();
this.btnDownScan = new System.Windows.Forms.Button();
this.btnUpScan = new System.Windows.Forms.Button();
this.btnResetOut4 = new System.Windows.Forms.Button(); this.btnResetOut4 = new System.Windows.Forms.Button();
this.btnResetOut3 = new System.Windows.Forms.Button(); this.btnResetOut3 = new System.Windows.Forms.Button();
this.btnResetOut2 = new System.Windows.Forms.Button(); this.btnResetOut2 = new System.Windows.Forms.Button();
...@@ -60,8 +62,7 @@ namespace TheMachine ...@@ -60,8 +62,7 @@ namespace TheMachine
this.btn_IgnoreX09 = new System.Windows.Forms.Button(); this.btn_IgnoreX09 = new System.Windows.Forms.Button();
this.btn_PauseBuzzer = new System.Windows.Forms.Button(); this.btn_PauseBuzzer = new System.Windows.Forms.Button();
this.listView1 = new System.Windows.Forms.ListView(); this.listView1 = new System.Windows.Forms.ListView();
this.btnUpScan = new System.Windows.Forms.Button(); this.chbDIsAgv = new System.Windows.Forms.CheckBox();
this.btnDownScan = new System.Windows.Forms.Button();
this.menuStrip1.SuspendLayout(); this.menuStrip1.SuspendLayout();
this.tabc.SuspendLayout(); this.tabc.SuspendLayout();
this.tabP1.SuspendLayout(); this.tabP1.SuspendLayout();
...@@ -106,32 +107,32 @@ namespace TheMachine ...@@ -106,32 +107,32 @@ namespace TheMachine
// btn_run // btn_run
// //
this.btn_run.Name = "btn_run"; this.btn_run.Name = "btn_run";
this.btn_run.Size = new System.Drawing.Size(176, 26); this.btn_run.Size = new System.Drawing.Size(180, 26);
this.btn_run.Text = "启动"; this.btn_run.Text = "启动";
this.btn_run.Click += new System.EventHandler(this.btn_run_Click); this.btn_run.Click += new System.EventHandler(this.btn_run_Click);
// //
// toolStripSeparator2 // toolStripSeparator2
// //
this.toolStripSeparator2.Name = "toolStripSeparator2"; this.toolStripSeparator2.Name = "toolStripSeparator2";
this.toolStripSeparator2.Size = new System.Drawing.Size(173, 6); this.toolStripSeparator2.Size = new System.Drawing.Size(177, 6);
// //
// btn_stop // btn_stop
// //
this.btn_stop.Name = "btn_stop"; this.btn_stop.Name = "btn_stop";
this.btn_stop.Size = new System.Drawing.Size(176, 26); this.btn_stop.Size = new System.Drawing.Size(180, 26);
this.btn_stop.Text = "停止"; this.btn_stop.Text = "停止";
this.btn_stop.Click += new System.EventHandler(this.btn_stop_Click); this.btn_stop.Click += new System.EventHandler(this.btn_stop_Click);
// //
// toolStripSeparator3 // toolStripSeparator3
// //
this.toolStripSeparator3.Name = "toolStripSeparator3"; this.toolStripSeparator3.Name = "toolStripSeparator3";
this.toolStripSeparator3.Size = new System.Drawing.Size(173, 6); this.toolStripSeparator3.Size = new System.Drawing.Size(177, 6);
// //
// 启用调试模式ToolStripMenuItem // 启用调试模式ToolStripMenuItem
// //
this.启用调试模式ToolStripMenuItem.Enabled = false; this.启用调试模式ToolStripMenuItem.Enabled = false;
this.启用调试模式ToolStripMenuItem.Name = "启用调试模式ToolStripMenuItem"; this.启用调试模式ToolStripMenuItem.Name = "启用调试模式ToolStripMenuItem";
this.启用调试模式ToolStripMenuItem.Size = new System.Drawing.Size(176, 26); this.启用调试模式ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.启用调试模式ToolStripMenuItem.Tag = "not"; this.启用调试模式ToolStripMenuItem.Tag = "not";
this.启用调试模式ToolStripMenuItem.Text = "启用配置模式"; this.启用调试模式ToolStripMenuItem.Text = "启用配置模式";
this.启用调试模式ToolStripMenuItem.Click += new System.EventHandler(this.启用调试模式ToolStripMenuItem_Click); this.启用调试模式ToolStripMenuItem.Click += new System.EventHandler(this.启用调试模式ToolStripMenuItem_Click);
...@@ -139,36 +140,36 @@ namespace TheMachine ...@@ -139,36 +140,36 @@ namespace TheMachine
// toolStripSeparator4 // toolStripSeparator4
// //
this.toolStripSeparator4.Name = "toolStripSeparator4"; this.toolStripSeparator4.Name = "toolStripSeparator4";
this.toolStripSeparator4.Size = new System.Drawing.Size(173, 6); this.toolStripSeparator4.Size = new System.Drawing.Size(177, 6);
// //
// 禁用蜂鸣器ToolStripMenuItem // 禁用蜂鸣器ToolStripMenuItem
// //
this.禁用蜂鸣器ToolStripMenuItem.Name = "禁用蜂鸣器ToolStripMenuItem"; this.禁用蜂鸣器ToolStripMenuItem.Name = "禁用蜂鸣器ToolStripMenuItem";
this.禁用蜂鸣器ToolStripMenuItem.Size = new System.Drawing.Size(176, 26); this.禁用蜂鸣器ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.禁用蜂鸣器ToolStripMenuItem.Text = "禁用蜂鸣器"; this.禁用蜂鸣器ToolStripMenuItem.Text = "禁用蜂鸣器";
this.禁用蜂鸣器ToolStripMenuItem.Click += new System.EventHandler(this.禁用蜂鸣器ToolStripMenuItem_Click); this.禁用蜂鸣器ToolStripMenuItem.Click += new System.EventHandler(this.禁用蜂鸣器ToolStripMenuItem_Click);
// //
// toolStripSeparator1 // toolStripSeparator1
// //
this.toolStripSeparator1.Name = "toolStripSeparator1"; this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(173, 6); this.toolStripSeparator1.Size = new System.Drawing.Size(177, 6);
// //
// toolStripMenuItem1 // toolStripMenuItem1
// //
this.toolStripMenuItem1.Name = "toolStripMenuItem1"; this.toolStripMenuItem1.Name = "toolStripMenuItem1";
this.toolStripMenuItem1.Size = new System.Drawing.Size(176, 26); this.toolStripMenuItem1.Size = new System.Drawing.Size(180, 26);
this.toolStripMenuItem1.Text = "扫码测试"; this.toolStripMenuItem1.Text = "扫码测试";
this.toolStripMenuItem1.Click += new System.EventHandler(this.toolStripMenuItem1_Click); this.toolStripMenuItem1.Click += new System.EventHandler(this.toolStripMenuItem1_Click);
// //
// toolStripSeparator5 // toolStripSeparator5
// //
this.toolStripSeparator5.Name = "toolStripSeparator5"; this.toolStripSeparator5.Name = "toolStripSeparator5";
this.toolStripSeparator5.Size = new System.Drawing.Size(173, 6); this.toolStripSeparator5.Size = new System.Drawing.Size(177, 6);
// //
// 退出ToolStripMenuItem // 退出ToolStripMenuItem
// //
this.退出ToolStripMenuItem.Name = "退出ToolStripMenuItem"; this.退出ToolStripMenuItem.Name = "退出ToolStripMenuItem";
this.退出ToolStripMenuItem.Size = new System.Drawing.Size(176, 26); this.退出ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.退出ToolStripMenuItem.Text = "退出"; this.退出ToolStripMenuItem.Text = "退出";
this.退出ToolStripMenuItem.Click += new System.EventHandler(this.退出ToolStripMenuItem_Click); this.退出ToolStripMenuItem.Click += new System.EventHandler(this.退出ToolStripMenuItem_Click);
// //
...@@ -185,7 +186,7 @@ namespace TheMachine ...@@ -185,7 +186,7 @@ namespace TheMachine
// 简体中文ToolStripMenuItem // 简体中文ToolStripMenuItem
// //
this.简体中文ToolStripMenuItem.Name = "简体中文ToolStripMenuItem"; this.简体中文ToolStripMenuItem.Name = "简体中文ToolStripMenuItem";
this.简体中文ToolStripMenuItem.Size = new System.Drawing.Size(144, 26); this.简体中文ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.简体中文ToolStripMenuItem.Tag = "not"; this.简体中文ToolStripMenuItem.Tag = "not";
this.简体中文ToolStripMenuItem.Text = "简体中文"; this.简体中文ToolStripMenuItem.Text = "简体中文";
this.简体中文ToolStripMenuItem.Click += new System.EventHandler(this.简体中文ToolStripMenuItem_Click); this.简体中文ToolStripMenuItem.Click += new System.EventHandler(this.简体中文ToolStripMenuItem_Click);
...@@ -193,7 +194,7 @@ namespace TheMachine ...@@ -193,7 +194,7 @@ namespace TheMachine
// englishToolStripMenuItem // englishToolStripMenuItem
// //
this.englishToolStripMenuItem.Name = "englishToolStripMenuItem"; this.englishToolStripMenuItem.Name = "englishToolStripMenuItem";
this.englishToolStripMenuItem.Size = new System.Drawing.Size(144, 26); this.englishToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.englishToolStripMenuItem.Tag = "not"; this.englishToolStripMenuItem.Tag = "not";
this.englishToolStripMenuItem.Text = "English"; this.englishToolStripMenuItem.Text = "English";
this.englishToolStripMenuItem.Click += new System.EventHandler(this.englishToolStripMenuItem_Click); this.englishToolStripMenuItem.Click += new System.EventHandler(this.englishToolStripMenuItem_Click);
...@@ -231,6 +232,7 @@ namespace TheMachine ...@@ -231,6 +232,7 @@ namespace TheMachine
// //
// pnl // pnl
// //
this.pnl.Controls.Add(this.chbDIsAgv);
this.pnl.Controls.Add(this.btnDownScan); this.pnl.Controls.Add(this.btnDownScan);
this.pnl.Controls.Add(this.btnUpScan); this.pnl.Controls.Add(this.btnUpScan);
this.pnl.Controls.Add(this.btnResetOut4); this.pnl.Controls.Add(this.btnResetOut4);
...@@ -248,6 +250,30 @@ namespace TheMachine ...@@ -248,6 +250,30 @@ namespace TheMachine
this.pnl.Size = new System.Drawing.Size(1000, 576); this.pnl.Size = new System.Drawing.Size(1000, 576);
this.pnl.TabIndex = 273; this.pnl.TabIndex = 273;
// //
// btnDownScan
//
this.btnDownScan.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnDownScan.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnDownScan.Location = new System.Drawing.Point(862, 209);
this.btnDownScan.Name = "btnDownScan";
this.btnDownScan.Size = new System.Drawing.Size(130, 32);
this.btnDownScan.TabIndex = 276;
this.btnDownScan.Text = "下层扫码测试";
this.btnDownScan.UseVisualStyleBackColor = true;
this.btnDownScan.Click += new System.EventHandler(this.btnDownScan_Click);
//
// btnUpScan
//
this.btnUpScan.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnUpScan.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnUpScan.Location = new System.Drawing.Point(862, 171);
this.btnUpScan.Name = "btnUpScan";
this.btnUpScan.Size = new System.Drawing.Size(130, 32);
this.btnUpScan.TabIndex = 275;
this.btnUpScan.Text = "上层扫码测试";
this.btnUpScan.UseVisualStyleBackColor = true;
this.btnUpScan.Click += new System.EventHandler(this.btnUpScan_Click);
//
// btnResetOut4 // btnResetOut4
// //
this.btnResetOut4.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btnResetOut4.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
...@@ -390,29 +416,16 @@ namespace TheMachine ...@@ -390,29 +416,16 @@ namespace TheMachine
this.listView1.TabIndex = 2; this.listView1.TabIndex = 2;
this.listView1.UseCompatibleStateImageBehavior = false; this.listView1.UseCompatibleStateImageBehavior = false;
// //
// btnUpScan // chbDIsAgv
// //
this.btnUpScan.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.chbDIsAgv.AutoSize = true;
this.btnUpScan.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.chbDIsAgv.Location = new System.Drawing.Point(862, 263);
this.btnUpScan.Location = new System.Drawing.Point(862, 171); this.chbDIsAgv.Name = "chbDIsAgv";
this.btnUpScan.Name = "btnUpScan"; this.chbDIsAgv.Size = new System.Drawing.Size(127, 25);
this.btnUpScan.Size = new System.Drawing.Size(130, 32); this.chbDIsAgv.TabIndex = 277;
this.btnUpScan.TabIndex = 275; this.chbDIsAgv.Text = "禁用AGV对接";
this.btnUpScan.Text = "上层扫码测试"; this.chbDIsAgv.UseVisualStyleBackColor = true;
this.btnUpScan.UseVisualStyleBackColor = true; this.chbDIsAgv.CheckedChanged += new System.EventHandler(this.chbDIsAgv_CheckedChanged);
this.btnUpScan.Click += new System.EventHandler(this.btnUpScan_Click);
//
// btnDownScan
//
this.btnDownScan.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnDownScan.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnDownScan.Location = new System.Drawing.Point(862, 209);
this.btnDownScan.Name = "btnDownScan";
this.btnDownScan.Size = new System.Drawing.Size(130, 32);
this.btnDownScan.TabIndex = 276;
this.btnDownScan.Text = "下层扫码测试";
this.btnDownScan.UseVisualStyleBackColor = true;
this.btnDownScan.Click += new System.EventHandler(this.btnDownScan_Click);
// //
// FormMain // FormMain
// //
...@@ -434,6 +447,7 @@ namespace TheMachine ...@@ -434,6 +447,7 @@ namespace TheMachine
this.tabc.ResumeLayout(false); this.tabc.ResumeLayout(false);
this.tabP1.ResumeLayout(false); this.tabP1.ResumeLayout(false);
this.pnl.ResumeLayout(false); this.pnl.ResumeLayout(false);
this.pnl.PerformLayout();
this.groupBox1.ResumeLayout(false); this.groupBox1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
...@@ -476,6 +490,7 @@ namespace TheMachine ...@@ -476,6 +490,7 @@ namespace TheMachine
private System.Windows.Forms.ToolStripSeparator toolStripSeparator5; private System.Windows.Forms.ToolStripSeparator toolStripSeparator5;
private System.Windows.Forms.Button btnDownScan; private System.Windows.Forms.Button btnDownScan;
private System.Windows.Forms.Button btnUpScan; private System.Windows.Forms.Button btnUpScan;
private System.Windows.Forms.CheckBox chbDIsAgv;
} }
} }
...@@ -228,7 +228,7 @@ namespace TheMachine ...@@ -228,7 +228,7 @@ namespace TheMachine
OutShelfBean bean = RobotManage.mainMachine.getOutShelf(name); OutShelfBean bean = RobotManage.mainMachine.getOutShelf(name);
if (bean != null && bean.CurrShelf != null) if (bean != null && bean.CurrShelf != null)
{ {
stateinfo += "[" + bean.CurrShelf.ToStr() + "]"; stateinfo += "[" + bean.CurrShelf.ToStr() + "]["+bean.getAgvStatus()+"]";
} }
else else
{ {
...@@ -740,5 +740,16 @@ namespace TheMachine ...@@ -740,5 +740,16 @@ namespace TheMachine
LogUtil.info("[" + String.Join(",", camers) + "]扫码测试结果:\r\n" + lastCode); LogUtil.info("[" + String.Join(",", camers) + "]扫码测试结果:\r\n" + lastCode);
MessageBox.Show("[" + String.Join(",", camers) + crc.GetString("Res0109", "]扫码测试结果:") + lastCode); MessageBox.Show("[" + String.Join(",", camers) + crc.GetString("Res0109", "]扫码测试结果:") + lastCode);
} }
private void chbDIsAgv_CheckedChanged(object sender, EventArgs e)
{
if (chbDIsAgv.Checked.Equals(AgvClient.DisAgv))
{
return;
}
LogUtil.info("勾选:" + chbDIsAgv.Text + " =" +( chbDIsAgv.Checked ? "√" : "×"));
AgvClient.setDisAgv(chbDIsAgv.Checked);
}
} }
} }
\ No newline at end of file \ No newline at end of file
using DeviceLibrary; using DeviceLibrary;
using log4net;
using OnlineStore; using OnlineStore;
using OnlineStore.Common; using OnlineStore.Common;
using OnlineStore.DeviceLibrary;
using OnlineStore.LoadCSVLibrary; using OnlineStore.LoadCSVLibrary;
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing; using System.Drawing;
using System.IO; using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
namespace TheMachine namespace TheMachine
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!