Commit 5340dbb9 张东亮

1

2 个父辈 40aa4308 927a4371
正在显示 44 个修改的文件 包含 812 行增加262 行删除
...@@ -83,6 +83,7 @@ ...@@ -83,6 +83,7 @@
<Compile Include="bean\node\ClientNode.cs" /> <Compile Include="bean\node\ClientNode.cs" />
<Compile Include="bean\node\DoubleLineNodeFor4D.cs" /> <Compile Include="bean\node\DoubleLineNodeFor4D.cs" />
<Compile Include="bean\node\DoubleLineNodeFor4C.cs" /> <Compile Include="bean\node\DoubleLineNodeFor4C.cs" />
<Compile Include="bean\UnlockedShelf.cs" />
<Compile Include="BLL\AGVManager.cs" /> <Compile Include="BLL\AGVManager.cs" />
<Compile Include="BLL\AgvServer.cs" /> <Compile Include="BLL\AgvServer.cs" />
<Compile Include="BLL\Common.cs" /> <Compile Include="BLL\Common.cs" />
...@@ -95,6 +96,8 @@ ...@@ -95,6 +96,8 @@
<SubType>Component</SubType> <SubType>Component</SubType>
</Compile> </Compile>
<Compile Include="BLL\LineWebService.cs" /> <Compile Include="BLL\LineWebService.cs" />
<Compile Include="BLL\StationRFIDManager.cs" />
<Compile Include="BLL\UnlockMissionManager.cs" />
<Compile Include="FrmMain.cs"> <Compile Include="FrmMain.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
......
...@@ -18,13 +18,17 @@ ...@@ -18,13 +18,17 @@
</layout> </layout>
</appender> </appender>
<appender name="LineWebService" type="log4net.Appender.RollingFileAppender"> <appender name="LineWebService" type="log4net.Appender.RollingFileAppender">
<file value="logs/LineWebService.log"/> <file value="logs/UnlockInfo.log"/>
<param name="Encoding" value="UTF-8"/> <param name="Encoding" value="UTF-8"/>
<appendToFile value="true"/> <appendToFile value="true"/>
<rollingStyle value="Date"/> <param name="MaxSizeRollBackups" value="10" />
<datePattern value="yyyy-MM-dd"/> <!-- 切割最多文件数 -->
<param name="MaximumFileSize" value="100MB" />
<!-- 每个文件的大小 -->
<param name="RollingStyle" value="Size" />
<param name="StaticLogFileName" value="true" />
<layout type="log4net.Layout.PatternLayout"> <layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%date][%t][%c:%L]%-5p %m%n"/> <conversionPattern value="[%date]%-5p %m%n"/>
</layout> </layout>
</appender> </appender>
<logger name ="LineWebService"> <logger name ="LineWebService">
...@@ -43,7 +47,8 @@ ...@@ -43,7 +47,8 @@
<add key="FLEET" value="10.85.199.3" /> <add key="FLEET" value="10.85.199.3" />
<add key="AutoCharge" value="True" /> <add key="AutoCharge" value="True" />
<add key="ChargeWait" value="1" /> <add key="ChargeWait" value="1" />
<add key="ChargeThreshold" value="20,70" /> <add key="ChargeThreshold" value="20,90" />
<add key="IP_4D_Light" value="10.85.196.40:8088" />
<add key="IP_4C_Light" value="10.85.197.40:8088" />
</appSettings> </appSettings>
</configuration> </configuration>
\ No newline at end of file \ No newline at end of file
...@@ -5,9 +5,10 @@ using System.Linq; ...@@ -5,9 +5,10 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using AGVControl; using AGVControl;
using BLL;
using RestSharp; using RestSharp;
namespace BLL namespace AGVControl
{ {
public class AGVManager public class AGVManager
{ {
...@@ -42,7 +43,7 @@ namespace BLL ...@@ -42,7 +43,7 @@ namespace BLL
} }
else else
{ {
if(workOrder.data.line !=null) if (workOrder.data.line != null)
{ {
string tempLocation = workOrder.data.line; string tempLocation = workOrder.data.line;
if (workOrder.data.line.Equals("Feeder")) if (workOrder.data.line.Equals("Feeder"))
...@@ -57,9 +58,9 @@ namespace BLL ...@@ -57,9 +58,9 @@ namespace BLL
woData = workOrder.data; woData = workOrder.data;
return true; return true;
} }
} }
} }
} }
...@@ -90,7 +91,7 @@ namespace BLL ...@@ -90,7 +91,7 @@ namespace BLL
public string ToTxt(string nodeName) public string ToTxt(string nodeName)
{ {
return string.Format("[hSerial={0},line={1}[{3}],so={2}]", hSerial,line,so,nodeName); return string.Format("[hSerial={0},line={1}[{3}],so={2}]", hSerial, line, so, nodeName);
} }
} }
public static string A6_Target = ""; public static string A6_Target = "";
...@@ -167,7 +168,7 @@ namespace BLL ...@@ -167,7 +168,7 @@ namespace BLL
#endregion #endregion
res[0].location = loc; res[0].location = loc;
dest = res[0]; dest = res[0];
Common.GetLineNameByNodeName(loc,out string line); Common.GetLineNameByNodeName(loc, out string line);
A6_Target = res[0].ShowInfo(line); A6_Target = res[0].ShowInfo(line);
Common.log.Debug("查找满料架任务[RFID=" + rfid + "]:目的地为 " + loc + " [产线名 " + line + "]"); Common.log.Debug("查找满料架任务[RFID=" + rfid + "]:目的地为 " + loc + " [产线名 " + line + "]");
return true; return true;
...@@ -203,7 +204,7 @@ namespace BLL ...@@ -203,7 +204,7 @@ namespace BLL
public string ShowInfo(string loc) public string ShowInfo(string loc)
{ {
return string.Format("RFID={0},SO={1},location={2}[{3}]", id, SO, loc,location); return string.Format("RFID={0},SO={1},location={2}[{3}]", id, SO, loc, location);
} }
} }
...@@ -331,7 +332,12 @@ namespace BLL ...@@ -331,7 +332,12 @@ namespace BLL
{ {
public string msg { get; set; } public string msg { get; set; }
} }
public class Msg1
{
//{"Code":0,"Msg":"D14,,D7,D33"}
public int Code { get; set; }
public string Msg { get; set; }
}
private static string Addr_updateDeviceAlarmMsg = "/rest/api/qisda/device/updateDeviceAlarmMsg"; private static string Addr_updateDeviceAlarmMsg = "/rest/api/qisda/device/updateDeviceAlarmMsg";
/// <summary> /// <summary>
/// 异常看板 /// 异常看板
...@@ -420,6 +426,178 @@ namespace BLL ...@@ -420,6 +426,178 @@ namespace BLL
return e.ToString(); return e.ToString();
} }
} }
/// <summary>
/// 获取接驳台料架情况
/// </summary>
/// <param name="lineName"></param>
/// <returns></returns>
public static string GetRFIDs(string lineName)
{
string addr = "";
if (lineName.StartsWith(SettingString.D4_Name_Prefix))
{
addr = string.Format("http://{0}/LineGetRFID?line={1}", ConfigAppSettings.GetValue(SettingString.IP_4D_Light), lineName);
}
else if (lineName.StartsWith(SettingString.C4_Name_Prefix))
{
addr = string.Format("http://{0}/LineGetRFID?line={1}", ConfigAppSettings.GetValue(SettingString.IP_4C_Light), lineName);
}
try
{
string result = HttpHelper.Get(addr);
if (!result.Equals(""))
{
Msg1 msgs = JsonHelper.DeserializeJsonToObject<Msg1>(result);
if (msgs == null)
return ",,,";
else
{
Common.log.Debug(string.Format("{0}接驳台状态:{1}", lineName, msgs.Msg));
return msgs.Msg;
}
}
}
catch (Exception ex)
{
Common.log.Error(ex.Message);
return ",,,";
}
return ",,,";
}
/// <summary>
/// 获取接驳台最外面料架
/// </summary>
/// <param name="lineName"></param>
/// <returns></returns>
public static string GetFirstRFID(string lineName)
{
string addr = "";
if (lineName.StartsWith(SettingString.D4_Name_Prefix))
{
addr = string.Format("http://{0}/LineGetRFID?line={1}", ConfigAppSettings.GetValue(SettingString.IP_4D_Light), lineName);
}
else if (lineName.StartsWith(SettingString.C4_Name_Prefix))
{
addr = string.Format("http://{0}/LineGetRFID?line={1}", ConfigAppSettings.GetValue(SettingString.IP_4C_Light), lineName);
}
try
{
string result = HttpHelper.Get(addr);
if (!result.Equals(""))
{
Msg1 msgs = JsonHelper.DeserializeJsonToObject<Msg1>(result);
if (msgs == null)
return "";
else
{
Common.log.Debug(string.Format("{0}接驳台状态:{1}", lineName, msgs.Msg));
string rfid = "";
foreach (string item in msgs.Msg.Split(','))
{
if (!item.Equals(""))
{
rfid = item;
}
}
return rfid;
}
}
}
catch (Exception ex)
{
Common.log.Error(ex.Message);
return "";
}
return "";
}
/// <summary>
/// 删除接驳台料架
/// </summary>
/// <param name="lineName"></param>
/// <param name="rfid"></param>
/// <returns></returns>
public static bool ClearRFID(string lineName, string rfid)
{
string addr = "";
if (lineName.StartsWith(SettingString.D4_Name_Prefix))
{
addr = string.Format("http://{0}/LineClearRFID?line={1}&rfid={2}", ConfigAppSettings.GetValue(SettingString.IP_4D_Light), lineName, rfid);
}
else if (lineName.StartsWith(SettingString.C4_Name_Prefix))
{
addr = string.Format("http://{0}/LineClearRFID?line={1}&rfid={2}", ConfigAppSettings.GetValue(SettingString.IP_4C_Light), lineName, rfid);
}
try
{
string result = HttpHelper.Get(addr);
if (!result.Equals(""))
{
Msg1 msgs = JsonHelper.DeserializeJsonToObject<Msg1>(result);
if (msgs == null)
return false;
else
{
Common.log.Info(string.Format("删除{0}接驳台料架{1}:{2}", lineName, rfid, msgs.Msg));
return true;
}
}
}
catch (Exception ex)
{
Common.log.Error(ex.Message);
return false;
}
return false;
}
private static string Addr_agvRemoveRfid = "/rest/api/qisda/device/agvRemoveRfid";
/// <summary>
/// 根据RFID清理料架的缓存信息
/// </summary>
/// <param name="rfid"></param>
/// <returns></returns>
public static bool AgvRemoveRfid(string rfid)
{
try
{
Dictionary<string, string> paramMap = new Dictionary<string, string>();
paramMap.Add("rfid", rfid.ToUpper());
string server = GetAddr(Addr_agvRemoveRfid, paramMap);
DateTime startTime = DateTime.Now;
string resultStr = HttpHelper.Get(server);
Common.log.Info("清理料架的缓存信息【" + server + "】【" + resultStr + "】");
RfidData rfidData = JsonHelper.DeserializeJsonToObject<RfidData>(resultStr);
if (rfidData == null)
{
return false;
}
else
{
if (rfidData.code.Equals(0))
{
return true;
}
}
}
catch (Exception ex)
{
Common.log.Error(ex);
return false;
}
return false;
}
} }
public class ShelfLockInfo public class ShelfLockInfo
{ {
...@@ -514,7 +692,7 @@ namespace BLL ...@@ -514,7 +692,7 @@ namespace BLL
/// <param name="name">异常位置名称</param> /// <param name="name">异常位置名称</param>
/// <param name="key">异常信息唯一标识</param> /// <param name="key">异常信息唯一标识</param>
/// <param name="value">异常信息</param> /// <param name="value">异常信息</param>
public AlarmMsg(string name, string key, string value,int type=0) public AlarmMsg(string name, string key, string value, int type = 0)
{ {
this.name = name; this.name = name;
this.msgKey = key; this.msgKey = key;
......
...@@ -7,24 +7,25 @@ using System.Threading; ...@@ -7,24 +7,25 @@ using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Web.Script.Serialization; using System.Web.Script.Serialization;
using AGVControl; using AGVControl;
using BLL;
using log4net.Util; using log4net.Util;
using RestSharp; using RestSharp;
namespace BLL namespace AGVControl.BLL
{ {
public class Control public class Control
{ {
//private int areaC_Index; //private int areaC_Index;
private System.Timers.Timer AgvCallTimer; private System.Timers.Timer AgvCallTimer;
private System.Timers.Timer AgvStateTimer; private System.Timers.Timer AgvStateTimer;
private System.Timers.Timer NodeStateTimer;
//public List<string> Marks; //public List<string> Marks;
private const int REG_STATUS = 20; private const int REG_STATUS = 20;
//private List<string> shelfLockedNodeNames; //private List<string> shelfLockedNodeNames;
public delegate void AgvChangedEvent(int agvIndex); public delegate void AgvChangedEvent(int agvIndex);
public delegate void AgvMissionEvent();
public event AgvChangedEvent AgvChanged; public event AgvChangedEvent AgvChanged;
public event AgvChangedEvent AgvOnline; public event AgvChangedEvent AgvOnline;
public event AgvChangedEvent NodeChangedEvent;
public Control() public Control()
{ {
AgvCallTimer = new System.Timers.Timer AgvCallTimer = new System.Timers.Timer
...@@ -37,11 +38,18 @@ namespace BLL ...@@ -37,11 +38,18 @@ namespace BLL
AgvStateTimer = new System.Timers.Timer AgvStateTimer = new System.Timers.Timer
{ {
Interval = 1500, Interval = 3000,
AutoReset = true, AutoReset = true,
Enabled = false Enabled = false
}; };
AgvStateTimer.Elapsed += AgvStateTimer_Elapsed; AgvStateTimer.Elapsed += AgvStateTimer_Elapsed;
NodeStateTimer = new System.Timers.Timer
{
Interval = 5000,
AutoReset = true,
Enabled = false
};
NodeStateTimer.Elapsed += NodeStateTimer_Elapsed;
} }
...@@ -49,42 +57,93 @@ namespace BLL ...@@ -49,42 +57,93 @@ namespace BLL
{ {
AgvCallTimer.Enabled = true; AgvCallTimer.Enabled = true;
AgvStateTimer.Enabled = true; AgvStateTimer.Enabled = true;
NodeStateTimer.Enabled = true;
AgvCallTimer.Start(); AgvCallTimer.Start();
AgvStateTimer.Start(); AgvStateTimer.Start();
NodeStateTimer.Start();
} }
public void Stop() public void Stop()
{ {
AgvCallTimer.Enabled = false; AgvCallTimer.Enabled = false;
AgvStateTimer.Enabled = false; AgvStateTimer.Enabled = false;
NodeStateTimer.Enabled = false;
AgvCallTimer.Stop(); AgvCallTimer.Stop();
AgvStateTimer.Stop(); AgvStateTimer.Stop();
NodeStateTimer.Stop();
} }
private bool NodeStateInProcess = false;
private void NodeStateTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
if (NodeStateInProcess) return;
NodeStateInProcess = true;
List<AlarmMsg> msglist = new List<AlarmMsg>();
try
{
String tmp = "";
for (int j = 0; j < Common.nodeInfo.Count; j++)
{
bool isAlarm = false;
if (!Common.UpdateStationState(Common.nodeInfo[j]))
{
isAlarm = true;
msglist.Add(new AlarmMsg(Common.nodeInfo[j].AliceName, "lineAgv." + Common.nodeInfo[j].Name + ".WarnMsg", Common.nodeInfo[j].WarnMsg));
}
if (!isAlarm && !Common.nodeInfo[j].Online)
{
msglist.Add(new AlarmMsg(Common.nodeInfo[j].AliceName, "lineAgv." + Common.nodeInfo[j].Name + ".OffLine", "离线"));
}
if (Common.nodeInfo[j].Name.StartsWith(SettingString.D4_Name_Prefix) || Common.nodeInfo[j].Name.StartsWith(SettingString.C4_Name_Prefix))
{
if (!Common.nodeInfo[j].Name.Equals(SettingString.C4FeederIn) && !Common.nodeInfo[j].Name.Equals(SettingString.C4FeederOut) &&
!Common.nodeInfo[j].Name.Equals(SettingString.D4FeederIn) && !Common.nodeInfo[j].Name.Equals(SettingString.D4FeederOut))
{
tmp = AGVManager.GetFirstRFID(Common.nodeInfo[j].Name);
if (!tmp.Equals(Common.nodeInfo[j].RFID))
{
Common.nodeInfo[j].RFID = tmp;
NodeChangedEvent?.Invoke(j);
}
}
if (Common.nodeInfo[j].Name.Equals(SettingString.C4FeederOut) || Common.nodeInfo[j].Name.Equals(SettingString.D4FeederOut))
{
if (Common.missionManager.GetUnlockCnt(Common.nodeInfo[j].Name) > 0)
{
tmp = Common.missionManager.GetUnlockRfids(Common.nodeInfo[j].Name)[0];
if (!tmp.Equals(Common.nodeInfo[j].RFID))
{
Common.nodeInfo[j].RFID = tmp;
NodeChangedEvent?.Invoke(j);
}
}
}
}
}
AGVManager.updateDeviceAlarmMsg(msglist);
}
catch(Exception ex)
{
Common.log.Error("NodeStateTimer " + ex.Message + ex.StackTrace);
}
NodeStateInProcess = false;
}
private bool AgvStateInProcess = false; private bool AgvStateInProcess = false;
private eAGVState preAGVState = eAGVState.None; //private eAGVState preAGVState = eAGVState.None;
private void AgvStateTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) private void AgvStateTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{ {
bool rtn; bool rtn;
if (AgvStateInProcess) return; if (AgvStateInProcess) return;
AgvStateInProcess = true; AgvStateInProcess = true;
List<AlarmMsg> msglist = new List<AlarmMsg>(); List<AlarmMsg> msglist = new List<AlarmMsg>();
for (int j = 0; j < Common.nodeInfo.Count; j++)
{
if (!Common.nodeInfo[j].Online)
{
msglist.Add(new AlarmMsg(Common.nodeInfo[j].AliceName, "lineAgv." + Common.nodeInfo[j].Name + ".OffLine", "离线"));
}
}
BLL.AGVManager.updateDeviceAlarmMsg(msglist);
for (int i = 0; i < Common.agvInfo.Count; i++) for (int i = 0; i < Common.agvInfo.Count; i++)
{ {
//上报异常 //上报异常
bool isAlarm = false; bool isAlarm = false;
if (msglist.Count > 0) //if (msglist.Count > 0)
msglist.Clear(); // msglist.Clear();
try try
{ {
if (!CheckOnline(i)) continue; if (!CheckOnline(i)) continue;
...@@ -96,30 +155,24 @@ namespace BLL ...@@ -96,30 +155,24 @@ namespace BLL
Thread.Sleep(50); Thread.Sleep(50);
if (rtn) change = Common.agvInfo[i].SetState(stateID, stateStr, battery, mission_text, position); if (rtn) change = Common.agvInfo[i].SetState(stateID, stateStr, battery, mission_text, position);
//更新状态stateID.Equals(eAGVState.Executing) // if (change)
if (change)
{ {
AgvChanged?.Invoke(i); AgvChanged?.Invoke(i);
} }
Common.log.Debug("获取AGV状态");
Thread.Sleep(50); Thread.Sleep(50);
rtn = Common.mir.Get_IO_Status(Common.agvInfo[i], out bool[] input, out bool[] output); if (stateText.Equals("Error") || stateText.Equals("EmergencyStop") || stateText.Equals("Pause"))
Common.log.Debug("获取IO状态");
preAGVState = Common.agvInfo[i].StateID;
if (Common.agvInfo[i].StandTimeOut)
{ {
isAlarm = true; isAlarm = true;
msglist.Add(new AlarmMsg(Common.agvInfo[i].Name, "lineAgv." + Common.agvInfo[i].Name + ".StandTimeOut", "在" + Common.agvInfo[i].PlaceAliceName + "停留超时" + (DateTime.Now - Common.agvInfo[i].StandStartTime).TotalMinutes.ToString("f2") + "分钟")); msglist.Add(new AlarmMsg(Common.agvInfo[i].Name, "lineAgv." + Common.agvInfo[i].Name + ".Error.EmergencyStop", "agv状态:" + stateText + ""));
} }
if (stateText.Equals("Error") || stateText.Equals("EmergencyStop") || stateText.Equals("Pause")) if (!isAlarm && Common.agvInfo[i].StandTimeOut)
{ {
isAlarm = true; isAlarm = true;
msglist.Add(new AlarmMsg(Common.agvInfo[i].Name, "lineAgv." + Common.agvInfo[i].Name + ".Error.EmergencyStop", "agv状态:" + stateText + "")); msglist.Add(new AlarmMsg(Common.agvInfo[i].Name, "lineAgv." + Common.agvInfo[i].Name + ".StandTimeOut", "在" + Common.agvInfo[i].PlaceAliceName + "停留超时" + (DateTime.Now - Common.agvInfo[i].StandStartTime).TotalMinutes.ToString("f2") + "分钟"));
} }
if (!isAlarm) if (!isAlarm)
{ {
try try
...@@ -139,7 +192,7 @@ namespace BLL ...@@ -139,7 +192,7 @@ namespace BLL
Common.log.Error(Common.agvInfo[i].Name + "上报小车运行步骤失败" + ex.Message + ex.StackTrace); Common.log.Error(Common.agvInfo[i].Name + "上报小车运行步骤失败" + ex.Message + ex.StackTrace);
} }
} }
BLL.AGVManager.updateDeviceAlarmMsg(msglist); AGVManager.updateDeviceAlarmMsg(msglist);
} }
catch (Exception ex) catch (Exception ex)
{ {
...@@ -147,7 +200,6 @@ namespace BLL ...@@ -147,7 +200,6 @@ namespace BLL
} }
} }
AgvStateInProcess = false; AgvStateInProcess = false;
} }
......
...@@ -4,7 +4,7 @@ using System; ...@@ -4,7 +4,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
namespace BLL namespace AGVControl
{ {
/// <summary> /// <summary>
/// Json帮助类 /// Json帮助类
......
...@@ -20,7 +20,7 @@ namespace BLL ...@@ -20,7 +20,7 @@ namespace BLL
//?emptyStation={line} //?emptyStation={line}
[OperationContract] [OperationContract]
[WebInvoke(UriTemplate = "CreateEmptyRecycleTask?emptyStation={line}&rfid={RFID}", Method = "GET", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Xml)] [WebInvoke(UriTemplate = "CreateEmptyRecycleTask?emptyStation={line}&rfid={RFID}", Method = "GET", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Xml)]
string CreateEmptyRecycleTaskGET(string line,string RFID=""); string CreateEmptyRecycleTaskGET(string line, string RFID = "");
} }
...@@ -70,38 +70,35 @@ namespace BLL ...@@ -70,38 +70,35 @@ namespace BLL
} }
if (Common.GetNodeNameByLineName(emptyStation, out string value)) if (Common.GetNodeNameByLineName(emptyStation, out string value))
{ {
if (!Common.AddEmptyShelfTask(value)) if (rfid == null)
{ {
Common.log.Error("CreateEmptyRecycleTask(POST) 节点[" + value + "]不存在"); res = new Result() { Succeed = false, ResultData = null, ErrorMessage = "rfid=null" };
res = new Result() { Succeed = false, ResultData = null, ErrorMessage = "CreateEmptyRecycleTask failed: " + emptyStation }; Log.Error(string.Format("Unlock Request(POST) Failed [emptyStation={0},rfid=null]", emptyStation));
} }
else else
{ {
if (rfid == null) res = new Result() { Succeed = true, ResultData = rfid, ErrorMessage = "" };
Log.Info(string.Format("Unlock Request(POST) [emptyStation={0},rfid={1}]", emptyStation, rfid.ToUpper()));
if (!Common.missionManager.AddMission(value, rfid.ToUpper()))
{ {
res = new Result() { Succeed = true, ResultData = null, ErrorMessage = "" }; Common.log.Error("CreateEmptyRecycleTask(POST) 节点[" + value + "]不存在");
Log.Info(string.Format("WebService Request(POST) emptyStation={0},rfid=null", emptyStation)); res = new Result() { Succeed = false, ResultData = null, ErrorMessage = "CreateEmptyRecycleTask failed: " + emptyStation + " rfid=" + rfid };
Common.LogInfo("任务[POST]:" + value + " 出空料架 [" + emptyStation + "]");
} }
else else
{ Common.LogInfo("任务[POST]:" + value + " 出空料架 [location=" + emptyStation + ",rfid=" + rfid.ToUpper() + "]");
res = new Result() { Succeed = true, ResultData = rfid, ErrorMessage = "" };
Log.Info(string.Format("WebService Request(POST) emptyStation={0},rfid={1}", emptyStation, rfid));
Common.LogInfo("任务[POST]:" + value + " 出空料架 [location=" + emptyStation + ",rfid=" + rfid + "]");
}
} }
// AGVControl.Common.log.Debug("WebService POST Response OK"); // AGVControl.Common.log.Debug("WebService POST Response OK");
} }
else else
{ {
res = new Result() { Succeed = false, ResultData = null, ErrorMessage = "Not find " + emptyStation }; res = new Result() { Succeed = false, ResultData = null, ErrorMessage = "Not find " + emptyStation };
AGVControl.Common.log.Error("WebService POST Response false " + "Not find " + emptyStation); AGVControl.Common.log.Error("Unlock POST Response false " + "Not find " + emptyStation);
} }
} }
return JsonHelper.SerializeObject(res); return JsonHelper.SerializeObject(res);
} }
public string CreateEmptyRecycleTaskGET(string line,string RFID) public string CreateEmptyRecycleTaskGET(string line, string RFID)
{ {
Result res; Result res;
if (line.Equals("Feeder")) if (line.Equals("Feeder"))
...@@ -115,7 +112,7 @@ namespace BLL ...@@ -115,7 +112,7 @@ namespace BLL
if (Common.GetNodeNameByLineName(line, out string value)) if (Common.GetNodeNameByLineName(line, out string value))
{ {
if (!Common.AddEmptyShelfTask(value)) if (!Common.missionManager.AddMission(value,RFID.ToUpper()))
{ {
Common.log.Error("CreateEmptyRecycleTask 节点[" + value + "]不存在"); Common.log.Error("CreateEmptyRecycleTask 节点[" + value + "]不存在");
res = new Result() { Succeed = false, ResultData = null, ErrorMessage = "CreateEmptyRecycleTask failed: " + line }; res = new Result() { Succeed = false, ResultData = null, ErrorMessage = "CreateEmptyRecycleTask failed: " + line };
...@@ -123,14 +120,14 @@ namespace BLL ...@@ -123,14 +120,14 @@ namespace BLL
else else
{ {
res = new Result() { Succeed = true, ResultData = RFID, ErrorMessage = "" }; res = new Result() { Succeed = true, ResultData = RFID, ErrorMessage = "" };
Log.Info(string.Format("WebService Request(GET) emptyStation={0},rfid={1}", line, RFID)); Log.Info(string.Format("Unlock Request(GET) [emptyStation={0},rfid={1}]", line, RFID.ToUpper()));
Common.LogInfo("任务[GET]:" + value + " 出空料架 [emptyStation=" + line + ",rfid="+RFID+"]"); Common.LogInfo("任务[GET]:" + value + " 出空料架 [emptyStation=" + line + ",rfid=" + RFID.ToUpper() + "]");
} }
} }
else else
{ {
res = new Result() { Succeed = false, ResultData = null, ErrorMessage = "Not find " + line }; res = new Result() { Succeed = false, ResultData = null, ErrorMessage = "Not find " + line };
AGVControl.Common.LogInfo("WebService GET Response false " + "Not find " + line); AGVControl.Common.LogInfo("Unlock GET Response false " + "Not find " + line);
} }
//Log.Info(string.Format("WebService GET Request emptyStation={0},rfid={1}", line, RFID)); //Log.Info(string.Format("WebService GET Request emptyStation={0},rfid={1}", line, RFID));
return JsonHelper.SerializeObject(res); return JsonHelper.SerializeObject(res);
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AGVControl.BLL
{
/// <summary>
/// 接驳台RFID管理
/// </summary>
public class StationRFIDManager
{
}
}
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AGVControl
{
/// <summary>
///解绑料架任务管理
/// </summary>
public class UnlockMissionManager
{
public delegate void MissionChangedHandler(Dictionary<string, UnlockInfo> pairs);
public event MissionChangedHandler MissionChanged;
/// <summary>
/// 任务列表
/// </summary>
public Dictionary<string, UnlockedShelf> NodeUnlockMissions { get; private set; }
Dictionary<string, UnlockInfo> UnlockMissions;
public UnlockMissionManager(List<ClientNode> clientNodes)
{
NodeUnlockMissions = new Dictionary<string, UnlockedShelf>();
UnlockMissions = new Dictionary<string, UnlockInfo>();
foreach (ClientNode item in clientNodes)
{
if (item.Name.StartsWith("A") || item.Name.Equals(SettingString.D4FeederIn) || item.Name.Equals(SettingString.C4FeederIn))
continue;
NodeUnlockMissions.Add(item.Name, new UnlockedShelf());
UnlockMissions = new Dictionary<string, UnlockInfo>();
}
}
public UnlockMissionManager()
{
NodeUnlockMissions = new Dictionary<string, UnlockedShelf>();
UnlockMissions = new Dictionary<string, UnlockInfo>();
}
public void Init()
{
foreach (var item in NodeUnlockMissions.Keys)
{
UnlockMissions.Add(item, new UnlockInfo(item, NodeUnlockMissions[item].EmptyCnt, NodeUnlockMissions[item].GetRfidWithTime()));
}
MissionChanged?.Invoke(UnlockMissions);
}
public UnlockedShelf GetUnlockInfo(string nodeName)
{
if (NodeUnlockMissions.ContainsKey(nodeName))
{
return NodeUnlockMissions[nodeName];
}
return null;
}
public int GetUnlockCnt(string nodeName)
{
if (NodeUnlockMissions.ContainsKey(nodeName))
{
return NodeUnlockMissions[nodeName].EmptyCnt;
}
return -1;
}
public List<string> GetUnlockRfids(string nodeName)
{
if (NodeUnlockMissions.ContainsKey(nodeName))
{
return NodeUnlockMissions[nodeName].GetRfids();
}
return new List<string>();
}
public bool AddMission(string nodeName, string rfid)
{
bool rtn = NodeUnlockMissions[nodeName].Add(rfid);
if (rtn)
{
UnlockMissions[nodeName] = new UnlockInfo(nodeName, NodeUnlockMissions[nodeName].EmptyCnt, NodeUnlockMissions[nodeName].GetRfidWithTime());
WriteUnlockLineInfo();
Common.WriteIni(nodeName, SettingString.EmptyShelfCnt, NodeUnlockMissions[nodeName].EmptyCnt.ToString());
Common.LogInfo(string.Format("{0}解绑任务添加成功:RFID={1}", nodeName, rfid));
MissionChanged?.Invoke(UnlockMissions);
}
else
Common.LogInfo(string.Format("{0}解绑任务添加失败:RFID={1}", nodeName, rfid));
return rtn;
}
public bool DelMission(string nodeName, string rfid)
{
bool rtn = NodeUnlockMissions[nodeName].Delete(rfid);
if (rtn)
{
UnlockMissions[nodeName] = new UnlockInfo(nodeName, NodeUnlockMissions[nodeName].EmptyCnt, NodeUnlockMissions[nodeName].GetRfidWithTime());
WriteUnlockLineInfo();
Common.WriteIni(nodeName, SettingString.EmptyShelfCnt, NodeUnlockMissions[nodeName].EmptyCnt.ToString());
Common.LogInfo(string.Format("{0}解绑任务删除成功:RFID={1}", nodeName, rfid));
MissionChanged?.Invoke(UnlockMissions);
}
else
Common.LogInfo(string.Format("{0}解绑任务删除失败:RFID={1}", nodeName, rfid));
return rtn;
}
/// <summary>
/// 保存料架解绑信息
/// </summary>
void WriteUnlockLineInfo()
{
using (System.IO.StreamWriter file = new System.IO.StreamWriter(Common.CONFIG_PATH + "UnlockInfo.json"))
{
string s = JsonHelper.SerializeObject(this);
file.WriteLine(s);
}
}
}
public class UnlockInfo
{
public string Line { get; set; }
public int Count { get; set; }
public string RFID { get; set; }
public List<UnlockRfid> UnlockRfids { get; private set; }
public UnlockInfo(string nodeName, int count, Dictionary<string, string> rfids)
{
if (Common.GetLineNameByNodeName(nodeName, out string line))
{
Line = line;
}
else
{
Line = nodeName;
}
Count = count;
RFID = string.Join(",", rfids.Keys);
UnlockRfids = new List<UnlockRfid>();
foreach (var item in rfids.Keys)
{
UnlockRfids.Add(new UnlockRfid(nodeName, rfids[item], item));
}
}
}
public class UnlockRfid
{
public String Line { get; set; }
public string RFID { get; set; }
public string Time { get; set; }
public UnlockRfid(string line, string time, string rfid)
{
Time = time;
RFID = rfid;
Line = line;
}
}
}
...@@ -42,11 +42,10 @@ namespace AGVControl ...@@ -42,11 +42,10 @@ namespace AGVControl
} }
//Common.logTextBox = new TextBox(); //Common.logTextBox = new TextBox();
//Common.missionView = new DataGridView(); //Common.missionView = new DataGridView();
Common.missionManager = new MissionManager();
Common.log = log4net.LogManager.GetLogger("AgvServer"); Common.log = log4net.LogManager.GetLogger("AgvServer");
Common.log.Info("=====程序开始====="); Common.log.Info("=====程序开始=====");
ReadConfig(); ReadConfig();
Common.ReadLinePlace(); //Common.ReadUnlockLineInfo();
Common.mir = new MiR_API(); Common.mir = new MiR_API();
Common.control = new BLL.Control(); Common.control = new BLL.Control();
......
...@@ -195,27 +195,10 @@ namespace AGVControl ...@@ -195,27 +195,10 @@ namespace AGVControl
else else
return string.Format("设备:{1}{0}RFID:{2}{0}任务信息:[任务名称={3}][任务状态={4}]{0}当前步骤:{5}{0}执行信息:{6}", return string.Format("设备:{1}{0}RFID:{2}{0}任务信息:[任务名称={3}][任务状态={4}]{0}当前步骤:{5}{0}执行信息:{6}",
"\r\n", Name, RFID, curJobTaskName, curJobTaskState, Msg, MissionText); "\r\n", Name, RFID, curJobTaskName, curJobTaskState, Msg, MissionText);
//if (RFID.StartsWith("C"))
//{
// return string.Format("Name:{1}{0}RFID:{2}{0}CurJob:{3}{0}CurJobTaskInfo:[TaskName={4}][TaskID={5}][TaskState={6}]{0}RunInfo:{7}{0}BoxDestInfo:{8}{0}GetRack:{9}{0}MissionText:{10}",
// "\r\n", Name, RFID, CurJob.ToString(), curJobTaskName, curJobTaskID, curJobTaskState, Msg, BoxDestInfo, BLL.AGVManager.GetRackBy(RFID), MissionText);
//}
//else if (RFID.StartsWith("D"))
//{
// return string.Format("Name:{1}{0}RFID:{2}{0}CurJob:{3}{0}CurJobTaskInfo:[TaskName={4}][TaskID={5}][TaskState={6}]{0}RunInfo:{7}{0}BoxDestInfo:{8}{0}MissionText:{9}",
// "\r\n", Name, RFID, CurJob.ToString(), curJobTaskName, curJobTaskID, curJobTaskState, Msg, BoxDestInfo, MissionText);
//}
//else
// return string.Format("Name:{1}{0}RFID:{2}{0}CurJob:{3}{0}CurJobTaskInfo:[TaskName={4}][TaskID={5}][TaskState={6}]{0}RunInfo:{7}{0}MissionText:{8}",
// "\r\n", Name, RFID, CurJob.ToString(), curJobTaskName, curJobTaskID, curJobTaskState, Msg, MissionText);
} }
else else
return string.Format("设备:{1}{0}RFID:{2}{0}任务信息:[任务名称={3}][任务状态={4}]{0}执行信息:{5}", return string.Format("设备:{1}{0}RFID:{2}{0}任务信息:[任务名称={3}][任务状态={4}]{0}执行信息:{5}",
"\r\n", Name, RFID, curJobTaskName, curJobTaskState, MissionText); "\r\n", Name, RFID, curJobTaskName, curJobTaskState, MissionText);
//return string.Format("Name:{1}{0}RFID:{2}{0}CurTaskInfo:[TaskName={3}][TaskID={4}][TaskState={5}]{0}MissionText:{6}",
// "\r\n", Name, RFID, curJobTaskName, curJobTaskID, curJobTaskState, MissionText);
} }
/// <summary> /// <summary>
/// 任务重发 /// 任务重发
...@@ -365,39 +348,6 @@ namespace AGVControl ...@@ -365,39 +348,6 @@ namespace AGVControl
} }
Position = position; Position = position;
} }
//public void GetPlace(int value)
//{
// // Common.log.Debug(Name + " PLC20=" + value);
// if (value == 0)
// {
// Place = "";
// PlaceState = ePlaceState.None;
// }
// else if (value > 0 && value < 1000)
// {
// //Place = "";
// //PlaceState = PlaceState.None;
// //TaskSend = "";
// }
// else if (value >= 1000)
// {
// int a = value / 1000;
// int b = (value - a * 1000) / 10;
// int c = value - a * 1000 - b * 10;
// //if (c.Equals(1) || c.Equals(3) || c.Equals(5))//Move,Enter,Leave
// // TaskSend = "";
// Place = (char)(64 + a) + b.ToString();
// if (Common.nodeInfo != null && Common.nodeInfo.Count != 0)
// {
// ClientNode node = Common.nodeInfo.Find(s => s.Name == Place);
// if (node != null)
// PlaceAliceName = node.AliceName;
// else
// PlaceAliceName = Place;
// }
// PlaceState = (ePlaceState)c;
// }
//}
public string[] ToRow() public string[] ToRow()
{ {
......
...@@ -41,7 +41,11 @@ namespace AGVControl ...@@ -41,7 +41,11 @@ namespace AGVControl
{ {
Name = name; Name = name;
} }
/// <summary>
/// 状态比较
/// </summary>
/// <param name="obj"></param>
/// <returns></returns>
public bool StateEquals(eNodeStatus obj) public bool StateEquals(eNodeStatus obj)
{ {
return nodeStatus.Equals(obj); return nodeStatus.Equals(obj);
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AGVControl
{
public class UnlockedShelf
{
/// <summary>
/// 已解绑料架信息
/// </summary>
/// <param name="nodeName"></param>
public UnlockedShelf()
{
Rfids = new Dictionary<string, string>();
}
/// <summary>
/// 空料架数量
/// </summary>
public int EmptyCnt { get; set; }
public string NodeName;
/// <summary>
/// 解绑的RFID及时间
/// </summary>
public Dictionary<string, string> Rfids { get; set; }
public List<string> GetRfids()
{
if (Rfids == null || Rfids.Count <= 0)
return new List<string>();
return Rfids.Keys.ToList<string>();
}
public Dictionary<string, string> GetRfidWithTime()
{
if (Rfids == null || Rfids.Count <= 0)
return new Dictionary<string, string>();
return Rfids;
}
/// <summary>
///添加解绑的空料架,如果RFID相同,不增加数量
/// </summary>
public bool Add(string rfid)
{
if (!rfid.Equals("") && !Rfids.Keys.Contains(rfid))
{
if (EmptyCnt < 0)
{
EmptyCnt = 0;
if (Rfids.Count > 0)
Rfids.Clear();
}
int tmp = EmptyCnt;
System.Threading.Interlocked.Increment(ref tmp);
EmptyCnt = tmp;
Rfids.Add(rfid, DateTime.Now.ToString("yyyy/MM/dd/HH:mm:ss,fff"));
return true;
}
return false;
}
/// <summary>
/// 删除一个解绑任务
/// </summary>
public bool Delete(string rfid)
{
if (EmptyCnt > 0)
{
if (!rfid.Equals("") && Rfids.Keys.Contains(rfid))
{
int tmp = EmptyCnt;
System.Threading.Interlocked.Decrement(ref tmp);
EmptyCnt = tmp;
if (EmptyCnt.Equals(0) && Rfids.Count > 0)
{
Rfids.Clear();
}
if (rfid.Equals(SettingString.C4FeederOut) || rfid.Equals(SettingString.D4FeederOut))
Rfids.Remove(rfid);
return true;
}
}
else if (Rfids.Count > 0)
{
EmptyCnt = 0;
Rfids.Clear();
return true;
}
return false;
}
}
}
...@@ -49,23 +49,31 @@ namespace AGVControl ...@@ -49,23 +49,31 @@ namespace AGVControl
{ {
string msg = agv.Name + " "; string msg = agv.Name + " ";
bool rtn = false; bool rtn = false;
runInfo = "";
agv.Msg = runInfo; agv.Msg = runInfo;
//if (!CurTaskID.Equals(-1) && Common.mir.Get_Task_State(CurTaskID, out string st)) //runInfo = "充电任务:";
// CurTaskState = st;
CurTaskState = Common.GetTakJobState(CurTaskID); CurTaskState = Common.GetTakJobState(CurTaskID);
if (ChargeStep.IsStep(CHARGE_STEP.NONE)) if (ChargeStep.IsStep(CHARGE_STEP.NONE))
{ {
if (agv.Battery > Common.chargeStatus.chargeMax) if (agv.Battery > Common.chargeStatus.chargeMax)
{ {
if (agv.Place.Equals(SettingString.Standby))//在待机位不操作 if (agvPlace.Equals(SettingString.Standby) || agvPlace.Equals(""))//在待机位不操作
{ {
ChargeStep.ToNextStep(CHARGE_STEP.END); ChargeStep.ToNextStep(CHARGE_STEP.END);
runInfo = "在待机位,电量充足[" + agv.Battery + "%],等待任务"; runInfo = "在待机位,电量充足[" + agv.Battery + "%],等待任务";
msg += runInfo; msg += runInfo;
ChargeStep.Msg = msg; ChargeStep.Msg = msg;
Common.MoveToNode(agv, SettingString.Standby);
UpdateJobTaskInfo(agv.CurTaskName, agv.CurTaskID);
}
else if (agvPlace.StartsWith(SettingString.C4_Name_Prefix) && Common.CheckIsInAirDoor(agvPlace))
{
ChargeStep.ToNextStep(CHARGE_STEP.WAIT_AGV_REACH_AIR_DOOR);
runInfo = "电量充足[" + agv.Battery + "%],从当前位置" + agvPlace + "回到待机位,先过4C风淋门";
msg += runInfo;
ChargeStep.Msg = msg;
Common.DoorMission(agv, SettingString.DoorAirOut);
UpdateJobTaskInfo(agv.CurTaskName, agv.CurTaskID);
} }
else if (agvPlace.StartsWith(SettingString.C4_Name_Prefix)) else if (agvPlace.StartsWith(SettingString.C4_Name_Prefix))
{ {
ChargeStep.ToNextStep(CHARGE_STEP.WAIT_AGV_REACH_4D_DOOR); ChargeStep.ToNextStep(CHARGE_STEP.WAIT_AGV_REACH_4D_DOOR);
...@@ -89,7 +97,17 @@ namespace AGVControl ...@@ -89,7 +97,17 @@ namespace AGVControl
} }
else else
{ {
if (agvPlace.StartsWith(SettingString.C4_Name_Prefix)) if (agvPlace.StartsWith(SettingString.C4_Name_Prefix) && Common.CheckIsInAirDoor(agvPlace))
{
ChargeStep.ToNextStep(CHARGE_STEP.WAIT_AGV_REACH_AIR_DOOR);
runInfo = "电量[" + agv.Battery + "%]小于最大电量[" + Common.chargeStatus.chargeMax + "%],从当前位置" + agvPlace + "回到充电位,先过4C风淋门";
msg += runInfo;
ChargeStep.Msg = msg;
Common.DoorMission(agv, SettingString.DoorAirOut);
UpdateJobTaskInfo(agv.CurTaskName, agv.CurTaskID);
}
else if (agvPlace.StartsWith(SettingString.C4_Name_Prefix))
{ {
ChargeStep.ToNextStep(CHARGE_STEP.WAIT_AGV_REACH_4D_DOOR); ChargeStep.ToNextStep(CHARGE_STEP.WAIT_AGV_REACH_4D_DOOR);
runInfo = "电量[" + agv.Battery + "%]小于最大电量[" + Common.chargeStatus.chargeMax + "%],从当前位置" + agvPlace + "回到充电位,先到4D门"; runInfo = "电量[" + agv.Battery + "%]小于最大电量[" + Common.chargeStatus.chargeMax + "%],从当前位置" + agvPlace + "回到充电位,先到4D门";
...@@ -123,7 +141,18 @@ namespace AGVControl ...@@ -123,7 +141,18 @@ namespace AGVControl
} }
} }
else if (ChargeStep.IsStep(CHARGE_STEP.WAIT_AGV_REACH_AIR_DOOR))
{
if (Common.CheckTaskFinished(agv, SettingString.DoorAirOut, CurTaskState))
{
ChargeStep.ToNextStep(CHARGE_STEP.WAIT_AGV_REACH_4D_DOOR);
runInfo = "电量充足[" + agv.Battery + "%],从当前位置" + agvPlace + "回到待机位,先到4D门";
msg += runInfo;
ChargeStep.Msg = msg;
Common.DoorMission(agv, SettingString.DoorCToD);
UpdateJobTaskInfo(agv.CurTaskName, agv.CurTaskID);
}
}
else if (ChargeStep.IsStep(CHARGE_STEP.WAIT_AGV_REACH_4D_DOOR)) else if (ChargeStep.IsStep(CHARGE_STEP.WAIT_AGV_REACH_4D_DOOR))
{ {
if (Common.CheckTaskFinished(agv, SettingString.DoorCToD, CurTaskState)) if (Common.CheckTaskFinished(agv, SettingString.DoorCToD, CurTaskState))
...@@ -166,7 +195,7 @@ namespace AGVControl ...@@ -166,7 +195,7 @@ namespace AGVControl
if (Common.CheckTaskFinished(agv, CurTaskName)) if (Common.CheckTaskFinished(agv, CurTaskName))
{ {
ChargeStep.ToNextStep(CHARGE_STEP.WAIT_REACH_CHARGE_OK); ChargeStep.ToNextStep(CHARGE_STEP.WAIT_REACH_CHARGE_OK);
runInfo = "充电任务分配完成,去充电等待任务"; runInfo = "充电任务分配完成,去充电等待任务";
msg += runInfo; msg += runInfo;
ChargeStep.Msg = msg; ChargeStep.Msg = msg;
} }
...@@ -213,20 +242,12 @@ namespace AGVControl ...@@ -213,20 +242,12 @@ namespace AGVControl
Job job = Common.control.GetJob(agv); Job job = Common.control.GetJob(agv);
if (job != null && !(job is ChargeJob)) if (job != null && !(job is ChargeJob))
{ {
runInfo = "充电过程检测到任务,电量[" + agv.Battery + "%]大于最小电量[" + Common.chargeStatus.chargeMin + "%],中断充电执行任务"; runInfo = "充电过程检测到任务,电量[" + agv.Battery + "%]大于最小电量[" + Common.chargeStatus.chargeMin + "%],中断充电执行任务";
msg += runInfo; msg += runInfo;
ChargeStep.Msg = msg; ChargeStep.Msg = msg;
Common.chargeStatus.ClearRandomChargeInfo(agv); Common.chargeStatus.ClearRandomChargeInfo(agv);
return job; return job;
} }
//else if (job == null && agv.Battery < Common.chargeStatus.chargeMax / 2)
//{
// ChargeStep.ToNextStep(CHARGE_STEP.NONE);
// runInfo = "在待机位暂无任务,且当前电量小于" + Common.chargeStatus.chargeMax / 2 + "%,去充电位";
// msg += runInfo;
// ChargeStep.Msg = msg;
// Common.chargeStatus.ClearRandomChargeInfo(agv);
//}
} }
} }
...@@ -291,7 +312,10 @@ namespace AGVControl ...@@ -291,7 +312,10 @@ namespace AGVControl
/// ///
/// </summary> /// </summary>
NONE, NONE,
/// <summary>
/// 等待到达风淋门
/// </summary>
WAIT_AGV_REACH_AIR_DOOR,
/// <summary> /// <summary>
/// 等待到达4D门 /// 等待到达4D门
/// </summary> /// </summary>
......
...@@ -176,7 +176,7 @@ namespace AGVControl ...@@ -176,7 +176,7 @@ namespace AGVControl
runInfo = "料架在" + LineName + "出去完成 [" + RFID + "]"; runInfo = "料架在" + LineName + "出去完成 [" + RFID + "]";
msg += runInfo; msg += runInfo;
EnterLeaveShelfStep.Msg = msg; EnterLeaveShelfStep.Msg = msg;
Common.DelEmptyShelfTask(LineName); Common.missionManager.DelMission(LineName,RFID);
return new EmptyShelfBackJob(LineName,eShelfType.BigShelf); return new EmptyShelfBackJob(LineName,eShelfType.BigShelf);
} }
else if (EnterLeaveShelfStep.IsTimeOut(60000, out double timeOutValue)) else if (EnterLeaveShelfStep.IsTimeOut(60000, out double timeOutValue))
......
...@@ -56,7 +56,8 @@ namespace AGVControl ...@@ -56,7 +56,8 @@ namespace AGVControl
{ {
string msg = agv.Name + " "; string msg = agv.Name + " ";
bool rtn = false; bool rtn = false;
agv.Msg = runInfo; agv.Msg = "去云仓接满料任务:"+runInfo;
//runInfo = "去云仓接满料任务:";
//if (!CurTaskID.Equals(-1) && Common.mir.Get_Task_State(CurTaskID, out string st)) //if (!CurTaskID.Equals(-1) && Common.mir.Get_Task_State(CurTaskID, out string st))
// CurTaskState = st; // CurTaskState = st;
if (GoFullShelfStationStep.IsStep(GO_FULL_SHELF_STATION_STEP.NONE)) if (GoFullShelfStationStep.IsStep(GO_FULL_SHELF_STATION_STEP.NONE))
...@@ -89,7 +90,7 @@ namespace AGVControl ...@@ -89,7 +90,7 @@ namespace AGVControl
} }
else if (input != null && !input[3]) else if (input != null && !input[3])
{ {
if (agvPlace.Equals(SettingString.Standby) || agvPlace.StartsWith(SettingString.AutoCharge))//待机位/充电位接到任务 if (agvPlace.Equals("") || agvPlace.Equals(SettingString.Standby) || agvPlace.StartsWith(SettingString.AutoCharge))//待机位/充电位接到任务
{ {
GoFullShelfStationStep.ToNextStep(GO_FULL_SHELF_STATION_STEP.WAIT_AGV_REACH_A6); GoFullShelfStationStep.ToNextStep(GO_FULL_SHELF_STATION_STEP.WAIT_AGV_REACH_A6);
runInfo = "无负载,准备运动到入料口" + FullShelfStationPlace; runInfo = "无负载,准备运动到入料口" + FullShelfStationPlace;
...@@ -98,6 +99,15 @@ namespace AGVControl ...@@ -98,6 +99,15 @@ namespace AGVControl
Common.MoveToNode(agv, FullShelfStationPlace); Common.MoveToNode(agv, FullShelfStationPlace);
UpdateJobTaskInfo(agv.CurTaskName, agv.CurTaskID); UpdateJobTaskInfo(agv.CurTaskName, agv.CurTaskID);
} }
else if (Common.CheckIsInAirDoor(agvPlace))
{
GoFullShelfStationStep.ToNextStep(GO_FULL_SHELF_STATION_STEP.WAIT_AGV_REACH_AIR_DOOR);
runInfo = "在4C风淋门内,先过风淋门";
msg += runInfo;
GoFullShelfStationStep.Msg = msg;
Common.DoorMission(agv, SettingString.DoorAirOut);
UpdateJobTaskInfo(agv.CurTaskName, agv.CurTaskID);
}
else if (agvPlace.StartsWith(SettingString.C4_Name_Prefix))//4C车间 else if (agvPlace.StartsWith(SettingString.C4_Name_Prefix))//4C车间
{ {
GoFullShelfStationStep.ToNextStep(GO_FULL_SHELF_STATION_STEP.WAIT_AGV_REACH_DOOR); GoFullShelfStationStep.ToNextStep(GO_FULL_SHELF_STATION_STEP.WAIT_AGV_REACH_DOOR);
...@@ -132,6 +142,15 @@ namespace AGVControl ...@@ -132,6 +142,15 @@ namespace AGVControl
Common.MoveToNode(agv, FullShelfStationPlace); Common.MoveToNode(agv, FullShelfStationPlace);
UpdateJobTaskInfo(agv.CurTaskName, agv.CurTaskID); UpdateJobTaskInfo(agv.CurTaskName, agv.CurTaskID);
} }
else if(Common.CheckIsInAirDoor(agvPlace))
{
GoFullShelfStationStep.ToNextStep(GO_FULL_SHELF_STATION_STEP.WAIT_AGV_REACH_AIR_DOOR);
runInfo = "在4C风淋门内,先过风淋门";
msg += runInfo;
GoFullShelfStationStep.Msg = msg;
Common.DoorMission(agv, SettingString.DoorAirOut);
UpdateJobTaskInfo(agv.CurTaskName, agv.CurTaskID);
}
else if (agvPlace.StartsWith(SettingString.C4_Name_Prefix))//4C车间 else if (agvPlace.StartsWith(SettingString.C4_Name_Prefix))//4C车间
{ {
GoFullShelfStationStep.ToNextStep(GO_FULL_SHELF_STATION_STEP.WAIT_AGV_REACH_DOOR); GoFullShelfStationStep.ToNextStep(GO_FULL_SHELF_STATION_STEP.WAIT_AGV_REACH_DOOR);
...@@ -147,6 +166,20 @@ namespace AGVControl ...@@ -147,6 +166,20 @@ namespace AGVControl
} }
} }
else if (GoFullShelfStationStep.IsStep(GO_FULL_SHELF_STATION_STEP.WAIT_AGV_REACH_AIR_DOOR))
{
CurTaskState = Common.GetTakJobState(CurTaskID);
if (Common.CheckTaskFinished(agv, SettingString.DoorAirOut, CurTaskState))
{
GoFullShelfStationStep.ToNextStep(GO_FULL_SHELF_STATION_STEP.WAIT_AGV_REACH_DOOR);
runInfo = "过风淋门,向4D门运行,再到双层线入料口" + FullShelfStationPlace;
msg += runInfo;
GoFullShelfStationStep.Msg = msg;
Common.MoveToNode(agv, SettingString.DoorCToD);
UpdateJobTaskInfo(agv.CurTaskName, agv.CurTaskID);
}
}
else if (GoFullShelfStationStep.IsStep(GO_FULL_SHELF_STATION_STEP.WAIT_AGV_REACH_DOOR)) else if (GoFullShelfStationStep.IsStep(GO_FULL_SHELF_STATION_STEP.WAIT_AGV_REACH_DOOR))
{ {
CurTaskState = Common.GetTakJobState(CurTaskID); CurTaskState = Common.GetTakJobState(CurTaskID);
...@@ -268,17 +301,12 @@ namespace AGVControl ...@@ -268,17 +301,12 @@ namespace AGVControl
runInfo = FullShelfStationPlace + "满料架进入小车完成"; runInfo = FullShelfStationPlace + "满料架进入小车完成";
msg += runInfo; msg += runInfo;
GoFullShelfStationStep.Msg = msg; GoFullShelfStationStep.Msg = msg;
//if (FullShelfDestInfo.location.StartsWith("G"))
//{
// return new SendFullShelfToLineJob(FullShelfDestInfo, true);
//}
//else
return new SendFullShelfToLineJob(FullShelfDestInfo); return new SendFullShelfToLineJob(FullShelfDestInfo);
} }
else if (GoFullShelfStationStep.IsTimeOut(60000, out double timeOutValue)) else if (GoFullShelfStationStep.IsTimeOut(60000, out double timeOutValue))
{ {
//链条停止 //链条停止
runInfo= "满料架在[" + FullShelfStationPlace + "]进入小车超时[" + timeOutValue.ToString("f1") + "秒],请检查料架进入小车的情况"; runInfo = "满料架在[" + FullShelfStationPlace + "]进入小车超时[" + timeOutValue.ToString("f1") + "秒],请检查料架进入小车的情况";
//msg +=runInfo; //msg +=runInfo;
//GoFullShelfStationStep.Msg = msg; //GoFullShelfStationStep.Msg = msg;
} }
...@@ -303,6 +331,10 @@ namespace AGVControl ...@@ -303,6 +331,10 @@ namespace AGVControl
/// </summary> /// </summary>
WAIT_CHECK_RESULT, WAIT_CHECK_RESULT,
/// <summary> /// <summary>
/// 等待到达4C风淋门
/// </summary>
WAIT_AGV_REACH_AIR_DOOR,
/// <summary>
/// 等待AGV到达门 /// 等待AGV到达门
/// </summary> /// </summary>
WAIT_AGV_REACH_DOOR, WAIT_AGV_REACH_DOOR,
......
...@@ -60,16 +60,17 @@ namespace AGVControl ...@@ -60,16 +60,17 @@ namespace AGVControl
string msg = agv.Name + " "; string msg = agv.Name + " ";
bool rtn = false; bool rtn = false;
agv.RFID = RFID; agv.RFID = RFID;
agv.Msg = runInfo; agv.Msg = "送满料任务:"+runInfo;
//runInfo = "送满料任务:";
//if (!CurTaskID.Equals(-1) && Common.mir.Get_Task_State(CurTaskID, out string st)) //if (!CurTaskID.Equals(-1) && Common.mir.Get_Task_State(CurTaskID, out string st))
// CurTaskState = st; // CurTaskState = st;
if (SendFullShelfStep.IsStep(SEND_FULL_SHELF_STEP.NONE)) if (SendFullShelfStep.IsStep(SEND_FULL_SHELF_STEP.NONE))
{ {
AGVManager.AgvRemoveRfid(RFID);
if (FullShelfPlace.StartsWith(SettingString.C4_Name_Prefix)) if (FullShelfPlace.StartsWith(SettingString.C4_Name_Prefix))
{ {
SendFullShelfStep.ToNextStep(SEND_FULL_SHELF_STEP.WAIT_AGV_REACH_DOOR); SendFullShelfStep.ToNextStep(SEND_FULL_SHELF_STEP.WAIT_AGV_REACH_DOOR);
runInfo = "满料架前往4C门,从双层线A6送往[" + FullShelfPlace + "][RFID=" + RFID + "]"; runInfo = "前往4C门,从双层线A6送往[" + FullShelfPlace + "][RFID=" + RFID + "]";
msg += runInfo; msg += runInfo;
SendFullShelfStep.Msg = msg; SendFullShelfStep.Msg = msg;
Common.DoorMission(agv, SettingString.DoorDToC); Common.DoorMission(agv, SettingString.DoorDToC);
...@@ -78,7 +79,7 @@ namespace AGVControl ...@@ -78,7 +79,7 @@ namespace AGVControl
else else
{ {
SendFullShelfStep.ToNextStep(SEND_FULL_SHELF_STEP.WAIT_AGV_REACH_LINE); SendFullShelfStep.ToNextStep(SEND_FULL_SHELF_STEP.WAIT_AGV_REACH_LINE);
runInfo = "满料架从双层线A6送往[" + FullShelfPlace + "][RFID=" + RFID + "]"; runInfo = "从双层线A6送往[" + FullShelfPlace + "][RFID=" + RFID + "]";
msg += runInfo; msg += runInfo;
SendFullShelfStep.Msg = msg; SendFullShelfStep.Msg = msg;
Common.MoveToNode(agv, FullShelfPlace); Common.MoveToNode(agv, FullShelfPlace);
...@@ -86,7 +87,6 @@ namespace AGVControl ...@@ -86,7 +87,6 @@ namespace AGVControl
} }
} }
else if (SendFullShelfStep.IsStep(SEND_FULL_SHELF_STEP.WAIT_AGV_REACH_DOOR)) else if (SendFullShelfStep.IsStep(SEND_FULL_SHELF_STEP.WAIT_AGV_REACH_DOOR))
{ {
CurTaskState = Common.GetTakJobState(CurTaskID); CurTaskState = Common.GetTakJobState(CurTaskID);
...@@ -103,14 +103,39 @@ namespace AGVControl ...@@ -103,14 +103,39 @@ namespace AGVControl
} }
else else
{ {
if(Common.CheckIsInAirDoor(FullShelfPlace))
{
SendFullShelfStep.ToNextStep(SEND_FULL_SHELF_STEP.WAIT_AGV_REACH_AIR_DOOR);
runInfo = "到达4C门,过风淋门[" + FullShelfPlace + "][RFID=" + RFID + "]";
msg += runInfo;
SendFullShelfStep.Msg = msg;
Common.DoorMission(agv, SettingString.DoorAirIn);
UpdateJobTaskInfo(agv.CurTaskName, agv.CurTaskID);
}
else
{
SendFullShelfStep.ToNextStep(SEND_FULL_SHELF_STEP.WAIT_AGV_REACH_LINE);
runInfo = "从双层线A6送往[" + FullShelfPlace + "][RFID=" + RFID + "]";
msg += runInfo;
SendFullShelfStep.Msg = msg;
Common.MoveToNode(agv, FullShelfPlace);
UpdateJobTaskInfo(agv.CurTaskName, agv.CurTaskID);
}
}
}
}
else if (SendFullShelfStep.IsStep(SEND_FULL_SHELF_STEP.WAIT_AGV_REACH_AIR_DOOR))
{
CurTaskState = Common.GetTakJobState(CurTaskID);
if (Common.CheckTaskFinished(agv, SettingString.DoorAirIn, CurTaskState))
{
SendFullShelfStep.ToNextStep(SEND_FULL_SHELF_STEP.WAIT_AGV_REACH_LINE); SendFullShelfStep.ToNextStep(SEND_FULL_SHELF_STEP.WAIT_AGV_REACH_LINE);
runInfo = "满料架从双层线A6送往[" + FullShelfPlace + "][RFID=" + RFID + "]"; runInfo = "送往[" + FullShelfPlace + "][RFID=" + RFID + "]";
msg += runInfo; msg += runInfo;
SendFullShelfStep.Msg = msg; SendFullShelfStep.Msg = msg;
Common.MoveToNode(agv, FullShelfPlace); Common.MoveToNode(agv, FullShelfPlace);
UpdateJobTaskInfo(agv.CurTaskName, agv.CurTaskID); UpdateJobTaskInfo(agv.CurTaskName, agv.CurTaskID);
}
} }
} }
else if (SendFullShelfStep.IsStep(SEND_FULL_SHELF_STEP.WAIT_REACH_TEMP_PLACE)) else if (SendFullShelfStep.IsStep(SEND_FULL_SHELF_STEP.WAIT_REACH_TEMP_PLACE))
...@@ -120,13 +145,25 @@ namespace AGVControl ...@@ -120,13 +145,25 @@ namespace AGVControl
{ {
if (!Common.Check4CTarget(agv, FullShelfPlace))//未占用 if (!Common.Check4CTarget(agv, FullShelfPlace))//未占用
{ {
SendFullShelfStep.ToNextStep(SEND_FULL_SHELF_STEP.WAIT_AGV_REACH_LINE); if (Common.CheckIsInAirDoor(FullShelfPlace))
runInfo = "满料架从临时待机位送往[" + FullShelfPlace + "][RFID=" + RFID + "]"; {
msg += runInfo; SendFullShelfStep.ToNextStep(SEND_FULL_SHELF_STEP.WAIT_AGV_REACH_AIR_DOOR);
SendFullShelfStep.Msg = msg; runInfo = "到临时待机位,去产线先过风淋门[" + FullShelfPlace + "][RFID=" + RFID + "]";
Common.DeleteStandyInfo(agv); msg += runInfo;
Common.MoveToNode(agv, FullShelfPlace); SendFullShelfStep.Msg = msg;
UpdateJobTaskInfo(agv.CurTaskName, agv.CurTaskID); Common.DoorMission(agv, SettingString.DoorAirIn);
UpdateJobTaskInfo(agv.CurTaskName, agv.CurTaskID);
}
else
{
SendFullShelfStep.ToNextStep(SEND_FULL_SHELF_STEP.WAIT_AGV_REACH_LINE);
runInfo = "从临时待机位送往[" + FullShelfPlace + "][RFID=" + RFID + "]";
msg += runInfo;
SendFullShelfStep.Msg = msg;
Common.DeleteStandyInfo(agv);
Common.MoveToNode(agv, FullShelfPlace);
UpdateJobTaskInfo(agv.CurTaskName, agv.CurTaskID);
}
} }
} }
} }
...@@ -226,7 +263,7 @@ namespace AGVControl ...@@ -226,7 +263,7 @@ namespace AGVControl
CurTaskState = Common.GetTakJobState(CurTaskID); CurTaskState = Common.GetTakJobState(CurTaskID);
if (Common.CheckEnterOrLeaveFinished(agv, "Leave", CurTaskState)) if (Common.CheckEnterOrLeaveFinished(agv, "Leave", CurTaskState))
{ {
runInfo = "满料进入" + FullShelfPlace + "完成 [RFID=" + RFID + "] [" + agv.BoxDestInfo + "]"; runInfo = "满料进入" + FullShelfPlace + "完成 [RFID=" + RFID + "] [" + agv.BoxDestInfo + "]";
msg += runInfo; msg += runInfo;
SendFullShelfStep.Msg = msg; SendFullShelfStep.Msg = msg;
agv.RFID = ""; agv.RFID = "";
...@@ -237,7 +274,7 @@ namespace AGVControl ...@@ -237,7 +274,7 @@ namespace AGVControl
else if (SendFullShelfStep.IsTimeOut(60000, out double timeOutValue)) else if (SendFullShelfStep.IsTimeOut(60000, out double timeOutValue))
{ {
//链条停止 //链条停止
runInfo = "满料在[" + FullShelfPlace + "]离开小车超时[" + timeOutValue.ToString("f1") + "秒],请检查料架离开小车的情况"; runInfo = "满料在[" + FullShelfPlace + "]离开小车超时[" + timeOutValue.ToString("f1") + "秒],请检查料架离开小车的情况";
//msg += runInfo; //msg += runInfo;
//SendFullShelfStep.Msg = msg; //SendFullShelfStep.Msg = msg;
} }
...@@ -270,6 +307,10 @@ namespace AGVControl ...@@ -270,6 +307,10 @@ namespace AGVControl
/// </summary> /// </summary>
WAIT_REACH_TEMP_PLACE, WAIT_REACH_TEMP_PLACE,
/// <summary> /// <summary>
/// 等待到达4C风淋门
/// </summary>
WAIT_AGV_REACH_AIR_DOOR,
/// <summary>
/// 等待小车到达目的地 /// 等待小车到达目的地
/// </summary> /// </summary>
WAIT_AGV_REACH_LINE, WAIT_AGV_REACH_LINE,
......
...@@ -32,11 +32,6 @@ namespace AGVControl ...@@ -32,11 +32,6 @@ namespace AGVControl
} }
/// <summary> /// <summary>
/// 小车名称
/// </summary>
public string AgvName { set; get; }
/// <summary>
/// 线体名(佳世达) /// 线体名(佳世达)
/// </summary> /// </summary>
public string LineName { set; get; } public string LineName { set; get; }
...@@ -54,24 +49,20 @@ namespace AGVControl ...@@ -54,24 +49,20 @@ namespace AGVControl
/// 节点位置坐标 /// 节点位置坐标
/// </summary> /// </summary>
public PositionStru position; public PositionStru position;
/// <summary> /// <summary>
/// 空料架数量 /// 料架数量信息
/// </summary> /// </summary>
public int EmptyShelfCnt public int EmptyShelfCnt
{ {
get { return _EmptyShelfCnt; } get
set
{ {
EmptyShelfCnt = _EmptyShelfCnt; if(Common.missionManager !=null && Common.missionManager.GetUnlockInfo(Name) !=null)
} {
return Common.missionManager.GetUnlockCnt(Name);
}
return 0;
}
} }
/// <summary>
/// 空架子的RFID
/// </summary>
public List<string> EmptyShelfRFIDs;
private int _EmptyShelfCnt = 0;
public string AliceName { get; set; } public string AliceName { get; set; }
/// <summary> /// <summary>
/// 客户端节点 /// 客户端节点
...@@ -79,21 +70,18 @@ namespace AGVControl ...@@ -79,21 +70,18 @@ namespace AGVControl
/// <param name="name"></param> /// <param name="name"></param>
/// <param name="ip"></param> /// <param name="ip"></param>
/// <param name="isUse"></param> /// <param name="isUse"></param>
public ClientNode(string name, string ip, string aliceName,string lineName, string pos_name, string pos_guid, bool isUse,int emptyCnt) : base(name, ip, isUse) public ClientNode(string name, string ip, string aliceName, string lineName, string pos_name, string pos_guid, bool isUse, int emptyCnt) : base(name, ip, isUse)
{ {
AliceName = aliceName; AliceName = aliceName;
RFID = rfid; RFID = rfid;
AgvName = "";
Online = false; Online = false;
IsUse = isUse; IsUse = isUse;
_EmptyShelfCnt = emptyCnt;
this.Pos_name = pos_name; this.Pos_name = pos_name;
this.Pos_guid = pos_guid; this.Pos_guid = pos_guid;
LineName = lineName; LineName = lineName;
EmptyShelfRFIDs = new List<string>();
} }
public string WarnMsg { get; set; } = "";
/// <summary> /// <summary>
/// 客户端节点 /// 客户端节点
/// </summary> /// </summary>
...@@ -106,41 +94,8 @@ namespace AGVControl ...@@ -106,41 +94,8 @@ namespace AGVControl
RFID = rfid; RFID = rfid;
nodeStatus = status; nodeStatus = status;
AgvName = "";
} }
/// <summary>
///空料架数量增加,如果RFID相同,不增加数量
/// </summary>
public void IncreEmptyShelfCnt(string rfid="")
{
if(!rfid.Equals("") && !EmptyShelfRFIDs.Contains(rfid))
{
System.Threading.Interlocked.Increment(ref _EmptyShelfCnt);
EmptyShelfRFIDs.Add(rfid);
Common.WriteIni(Name, SettingString.EmptyShelfCnt,_EmptyShelfCnt.ToString());
}
else if(rfid.Equals(""))
{
System.Threading.Interlocked.Increment(ref _EmptyShelfCnt);
Common.WriteIni(Name, SettingString.EmptyShelfCnt, _EmptyShelfCnt.ToString());
}
}
/// <summary>
/// 空料架数量减少1
/// </summary>
public void DecreEmptyShelfCnt()
{
if (_EmptyShelfCnt > 0)
{
System.Threading.Interlocked.Decrement(ref _EmptyShelfCnt);
Common.WriteIni(Name, SettingString.EmptyShelfCnt, _EmptyShelfCnt.ToString());
}
if(_EmptyShelfCnt.Equals(0) && EmptyShelfRFIDs.Count>0)
{
EmptyShelfRFIDs.Clear();
}
}
/// <summary> /// <summary>
/// 节点状态的文本形式 /// 节点状态的文本形式
/// </summary> /// </summary>
...@@ -163,11 +118,11 @@ namespace AGVControl ...@@ -163,11 +118,11 @@ namespace AGVControl
s[3] = nodeStatus.ToString(); s[3] = nodeStatus.ToString();
s[4] = ClientLevel.ToString(); s[4] = ClientLevel.ToString();
s[5] = RFID; s[5] = RFID;
// s[5] = AgvName; // s[5] = AgvName;
// } // }
s[6] = Online ? "在线" : "离线"; s[6] = Online ? "在线" : "离线";
s[7] = IsUse ? "是" : "否"; s[7] = IsUse ? "是" : "否";
// s[8] = "清除"; // s[8] = "清除";
return s; return s;
} }
...@@ -178,7 +133,6 @@ namespace AGVControl ...@@ -178,7 +133,6 @@ namespace AGVControl
{ {
RFID = "00"; RFID = "00";
nodeStatus = eNodeStatus.None; nodeStatus = eNodeStatus.None;
AgvName = "";
Online = false; Online = false;
} }
......
...@@ -30,19 +30,17 @@ namespace AGVControl ...@@ -30,19 +30,17 @@ namespace AGVControl
return null; return null;
//执行空料架任务的小车数量 //执行空料架任务的小车数量
int emptyJobCnt = 0; int emptyJobCnt = 0;
string rfid = "";
foreach (Agv_Info agv in Common.agvInfo) foreach (Agv_Info agv in Common.agvInfo)
{ {
if (!SettingString.C4_AGV_IPs.Contains(agv.IP)) if (!SettingString.C4_AGV_IPs.Contains(agv.IP))
continue; continue;
if (agv.CurJob is GoEmptyShelfLineJob || agv.CurJob is EmptyShelfBackJob) if (agv.CurJob is GoEmptyShelfLineJob || (agv.CurJob is EmptyShelfBackJob))
{ {
emptyJobCnt++; emptyJobCnt++;
} }
} }
if ((SettingString.AGVCNT - emptyJobCnt).Equals(2))//保留2辆小车出满料架
{
return null;
}
//出工单料的目的地是否有空料架 //出工单料的目的地是否有空料架
if (Common.FindEmptyShelfBeforeSendFullShelf(out string nodeName)) if (Common.FindEmptyShelfBeforeSendFullShelf(out string nodeName))
{ {
...@@ -60,7 +58,8 @@ namespace AGVControl ...@@ -60,7 +58,8 @@ namespace AGVControl
} }
if (cnt < clientNode.EmptyShelfCnt) if (cnt < clientNode.EmptyShelfCnt)
{ {
return new GoEmptyShelfLineJob(currentAgv.Place, nodeName); if (Common.CheckStationState(clientNode, out rfid) && CanEmptyTask(emptyJobCnt))
return new GoEmptyShelfLineJob(currentAgv.Place, nodeName, rfid);
} }
} }
...@@ -73,7 +72,11 @@ namespace AGVControl ...@@ -73,7 +72,11 @@ namespace AGVControl
{ {
int i = Common.agvInfo.FindIndex(s => s.CurJob is GoEmptyShelfLineJob && ((GoEmptyShelfLineJob)s.CurJob).EmptyShelfPlace.Equals(emptyNodeName)); int i = Common.agvInfo.FindIndex(s => s.CurJob is GoEmptyShelfLineJob && ((GoEmptyShelfLineJob)s.CurJob).EmptyShelfPlace.Equals(emptyNodeName));
if (i == -1) if (i == -1)
return new GoEmptyShelfLineJob(currentAgv.Place, emptyNodeName); {
ClientNode clientNode = Common.nodeInfo.Find(s => s.Name.Equals(emptyNodeName));
if (Common.CheckStationState(clientNode, out rfid) && CanEmptyTask(emptyJobCnt))
return new GoEmptyShelfLineJob(currentAgv.Place, emptyNodeName, rfid);
}
} }
} }
...@@ -83,13 +86,43 @@ namespace AGVControl ...@@ -83,13 +86,43 @@ namespace AGVControl
if (SettingString.C4_AGV_IPs.Contains(currentAgv.IP)) if (SettingString.C4_AGV_IPs.Contains(currentAgv.IP))
{ {
ClientNode node = Common.nodeInfo.Find(s => s.Name.Equals(SettingString.A6)
&& (s.StateEquals(eNodeStatus.NeedLeave) || s.StateEquals(eNodeStatus.NeedEnterLeave)) && !s.RFID.Equals("00"));
if (node != null && node.Name.Equals(SettingString.A6))
{
if (AGVManager.FindFullShelfTarget(node.RFID, out AGVManager.BoxDestInfo boxDestInfo))
{
if (boxDestInfo != null)
{
ClientNode clientNode = Common.nodeInfo.Find(s => s.Name.Equals(boxDestInfo.location));
if (!Common.CheckStationState(clientNode))
{
return null;
}
}
}
}
int i = Common.agvInfo.FindIndex(s => s.CurJob is GoFullShelfStationJob && !s.IP.Equals(currentAgv.IP)); int i = Common.agvInfo.FindIndex(s => s.CurJob is GoFullShelfStationJob && !s.IP.Equals(currentAgv.IP));
if (i == -1) if (i == -1)
return new GoFullShelfStationJob(currentAgv.Place); return new GoFullShelfStationJob(currentAgv.Place);
} }
} }
return null; return null;
} }
/// <summary>
/// 控制出空架小车数量
/// </summary>
/// <param name="emptytASKAGV"></param>
/// <returns></returns>
private bool CanEmptyTask(int emptytASKAGV)
{
if ((SettingString.AGVCNT / 2 - emptytASKAGV).Equals(2))//保留1辆小车出满料架
{
return false;
}
return true;
}
} }
} }
...@@ -33,19 +33,16 @@ namespace AGVControl ...@@ -33,19 +33,16 @@ namespace AGVControl
return null; return null;
//执行空料架任务的小车数量 //执行空料架任务的小车数量
int emptyJobCnt = 0; int emptyJobCnt = 0;
string rfid = "";
foreach (Agv_Info agv in Common.agvInfo) foreach (Agv_Info agv in Common.agvInfo)
{ {
if (SettingString.C4_AGV_IPs.Contains(agv.IP)) if (SettingString.C4_AGV_IPs.Contains(agv.IP))
continue; continue;
if (agv.CurJob is GoEmptyShelfLineJob || agv.CurJob is EmptyShelfBackJob) if (agv.CurJob is GoEmptyShelfLineJob || agv.CurJob is EmptyShelfBackJob)//
{ {
emptyJobCnt++; emptyJobCnt++;
} }
} }
if ((SettingString.AGVCNT / 2 - emptyJobCnt).Equals(1))//保留1辆小车出满料架
{
return null;
}
//出工单料的目的地是否有空料架 //出工单料的目的地是否有空料架
if (Common.FindEmptyShelfBeforeSendFullShelf(out string nodeName)) if (Common.FindEmptyShelfBeforeSendFullShelf(out string nodeName))
{ {
...@@ -65,7 +62,9 @@ namespace AGVControl ...@@ -65,7 +62,9 @@ namespace AGVControl
} }
if (cnt < clientNode.EmptyShelfCnt) if (cnt < clientNode.EmptyShelfCnt)
{ {
return new GoEmptyShelfLineJob(currentAgv.Place, nodeName);
if (Common.CheckStationState(clientNode, out rfid) && CanEmptyTask(emptyJobCnt))
return new GoEmptyShelfLineJob(currentAgv.Place, nodeName, rfid);
} }
} }
...@@ -77,7 +76,11 @@ namespace AGVControl ...@@ -77,7 +76,11 @@ namespace AGVControl
{ {
int i = Common.agvInfo.FindIndex(s => s.CurJob is GoEmptyShelfLineJob && ((GoEmptyShelfLineJob)s.CurJob).EmptyShelfPlace.Equals(emptyNodeName)); int i = Common.agvInfo.FindIndex(s => s.CurJob is GoEmptyShelfLineJob && ((GoEmptyShelfLineJob)s.CurJob).EmptyShelfPlace.Equals(emptyNodeName));
if (i == -1) if (i == -1)
return new GoEmptyShelfLineJob(currentAgv.Place, emptyNodeName); {
ClientNode clientNode = Common.nodeInfo.Find(s => s.Name.Equals(emptyNodeName));
if (Common.CheckStationState(clientNode, out rfid) && CanEmptyTask(emptyJobCnt))
return new GoEmptyShelfLineJob(currentAgv.Place, emptyNodeName, rfid);
}
} }
} }
...@@ -100,6 +103,11 @@ namespace AGVControl ...@@ -100,6 +103,11 @@ namespace AGVControl
{ {
if (boxDestInfo != null) if (boxDestInfo != null)
{ {
ClientNode clientNode = Common.nodeInfo.Find(s => s.Name.Equals(boxDestInfo.location));
if (!Common.CheckStationState(clientNode))
{
return null;
}
i = Common.agvInfo.FindIndex(s => s.CurJob is SendFullShelfToLineJob && !s.IP.Equals(currentAgv.IP) i = Common.agvInfo.FindIndex(s => s.CurJob is SendFullShelfToLineJob && !s.IP.Equals(currentAgv.IP)
&& ((SendFullShelfToLineJob)s.CurJob).FullShelfPlace.Equals(boxDestInfo.location)); && ((SendFullShelfToLineJob)s.CurJob).FullShelfPlace.Equals(boxDestInfo.location));
if (i > -1) if (i > -1)
...@@ -114,5 +122,18 @@ namespace AGVControl ...@@ -114,5 +122,18 @@ namespace AGVControl
return null; return null;
} }
/// <summary>
/// 控制出空架小车数量
/// </summary>
/// <param name="emptytASKAGV"></param>
/// <returns></returns>
private bool CanEmptyTask(int emptytASKAGV)
{
if ((SettingString.AGVCNT / 2 - emptytASKAGV).Equals(1))//保留1辆小车出满料架
{
return false;
}
return true;
}
} }
} }
...@@ -18,13 +18,17 @@ ...@@ -18,13 +18,17 @@
</layout> </layout>
</appender> </appender>
<appender name="LineWebService" type="log4net.Appender.RollingFileAppender"> <appender name="LineWebService" type="log4net.Appender.RollingFileAppender">
<file value="logs/LineWebService.log"/> <file value="logs/UnlockInfo.log"/>
<param name="Encoding" value="UTF-8"/> <param name="Encoding" value="UTF-8"/>
<appendToFile value="true"/> <appendToFile value="true"/>
<rollingStyle value="Date"/> <param name="MaxSizeRollBackups" value="10" />
<datePattern value="yyyy-MM-dd"/> <!-- 切割最多文件数 -->
<param name="MaximumFileSize" value="100MB" />
<!-- 每个文件的大小 -->
<param name="RollingStyle" value="Size" />
<param name="StaticLogFileName" value="true" />
<layout type="log4net.Layout.PatternLayout"> <layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%date][%t][%c:%L]%-5p %m%n"/> <conversionPattern value="[%date]%-5p %m%n"/>
</layout> </layout>
</appender> </appender>
<logger name ="LineWebService"> <logger name ="LineWebService">
...@@ -43,7 +47,8 @@ ...@@ -43,7 +47,8 @@
<add key="FLEET" value="10.85.199.3" /> <add key="FLEET" value="10.85.199.3" />
<add key="AutoCharge" value="True" /> <add key="AutoCharge" value="True" />
<add key="ChargeWait" value="1" /> <add key="ChargeWait" value="1" />
<add key="ChargeThreshold" value="20,70" /> <add key="ChargeThreshold" value="20,90" />
<add key="IP_4D_Light" value="10.85.196.40:8088" />
<add key="IP_4C_Light" value="10.85.197.40:8088" />
</appSettings> </appSettings>
</configuration> </configuration>
\ No newline at end of file \ No newline at end of file
...@@ -15,8 +15,8 @@ D12,D12,10.85.199.183,4D-12,DL12,d6e0b92a-b432-11ea-a1a5-00012999830e ...@@ -15,8 +15,8 @@ D12,D12,10.85.199.183,4D-12,DL12,d6e0b92a-b432-11ea-a1a5-00012999830e
D14,D14,10.85.199.184,4D-14线,DL14,efb04c55-b432-11ea-a1a5-00012999830e D14,D14,10.85.199.184,4D-14线,DL14,efb04c55-b432-11ea-a1a5-00012999830e
D15,D15,10.85.199.185,4D-15线,DL15,fd6b1f95-b432-11ea-a1a5-00012999830e D15,D15,10.85.199.185,4D-15线,DL15,fd6b1f95-b432-11ea-a1a5-00012999830e
D16,D16,10.85.199.96,4D-16线,line_16,ac6c413e-895e-11ea-9374-000129922ca6 D16,D16,10.85.199.96,4D-16线,line_16,ac6c413e-895e-11ea-9374-000129922ca6
FeederIn,FeederIn,10.85.199.1,4D-FeedeerIn,FI,1e546c3a-8abe-11ea-ab63-000129922ca6 FeederIn,D21,10.85.199.1,4D-FeedeerIn,FI,1e546c3a-8abe-11ea-ab63-000129922ca6
FeederOut,FeederOut,10.85.199.1,4D-FeederOut,FO,431649a4-8abe-11ea-ab63-000129922ca6 FeederOut,D22,10.85.199.1,4D-FeederOut,FO,431649a4-8abe-11ea-ab63-000129922ca6
C1,C1,10.85.199.50,4C-1线,G1,d402fbc2-cdac-11ea-a3e4-94c691a7387d C1,C1,10.85.199.50,4C-1线,G1,d402fbc2-cdac-11ea-a3e4-94c691a7387d
C2,C2,10.85.199.51,4C-2线,G2,ce0d60e9-cdac-11ea-a3e4-94c691a7387d C2,C2,10.85.199.51,4C-2线,G2,ce0d60e9-cdac-11ea-a3e4-94c691a7387d
C3,C3,10.85.199.52,4C-3线,G3,c768170a-cdac-11ea-a3e4-94c691a7387d C3,C3,10.85.199.52,4C-3线,G3,c768170a-cdac-11ea-a3e4-94c691a7387d
...@@ -29,5 +29,5 @@ C9,C9,10.85.199.62,4C-9,G9,a64bdbbb-cdac-11ea-a3e4-94c691a7387d ...@@ -29,5 +29,5 @@ C9,C9,10.85.199.62,4C-9,G9,a64bdbbb-cdac-11ea-a3e4-94c691a7387d
C10,C10,10.85.199.59,4C-10线,G10,604b1c3c-ca4e-11ea-810b-00012999830e C10,C10,10.85.199.59,4C-10线,G10,604b1c3c-ca4e-11ea-810b-00012999830e
C14,C14,10.85.199.60,4C-14线,G14,07841fc6-d0d4-11ea-a3e4-94c691a7387d C14,C14,10.85.199.60,4C-14线,G14,07841fc6-d0d4-11ea-a3e4-94c691a7387d
C15,C15,10.85.199.61,4C-15线,G15,0efca2c6-d0d4-11ea-a3e4-94c691a7387d C15,C15,10.85.199.61,4C-15线,G15,0efca2c6-d0d4-11ea-a3e4-94c691a7387d
4CFeederIn,4CFeederIn,10.85.199.1,4C-FeederIn,G21,cb7f117b-ca88-11ea-9b28-0001299981d4 4CFeederIn,C21,10.85.199.1,4C-FeederIn,G21,cb7f117b-ca88-11ea-9b28-0001299981d4
4CFeederOut,4CFeederOut,10.85.199.1,4C-FeederOut,G22,0fcf606c-d417-11ea-9b6b-0001299981d4 4CFeederOut,C22,10.85.199.1,4C-FeederOut,G22,0fcf606c-d417-11ea-9b6b-0001299981d4
2020-11-03 14:08:42,D1
2020-11-03 14:10:26,D1
2020-11-03 14:12:43,D1
2020-11-03 14:20:20,D1
2020-11-03 14:22:26,D1
2020-11-03 14:22:31,D1
2020-11-03 14:22:37,D1
2020-11-03 14:22:48,D1
2020-11-03 14:22:59,D1
{"NodeUnlockMissions":{"D1":{"NodeName":"D1","EmptyCnt":0,"Rfids":{}},"D2":{"NodeName":"D2","EmptyCnt":1,"Rfids":{"D4":"2020/12/06/11:51:42,731"}},"D3":{"NodeName":"D3","EmptyCnt":1,"Rfids":{"D3":"2020/12/05/22:50:48,047"}},"D4":{"NodeName":"D4","EmptyCnt":0,"Rfids":{}},"D5":{"NodeName":"D5","EmptyCnt":0,"Rfids":{}},"D6":{"NodeName":"D6","EmptyCnt":0,"Rfids":{}},"D8":{"NodeName":"D8","EmptyCnt":0,"Rfids":{}},"D9":{"NodeName":"D9","EmptyCnt":0,"Rfids":{}},"D10":{"NodeName":"D10","EmptyCnt":0,"Rfids":{}},"D11":{"NodeName":"D11","EmptyCnt":0,"Rfids":{}},"D12":{"NodeName":"D12","EmptyCnt":0,"Rfids":{}},"D14":{"NodeName":"D14","EmptyCnt":0,"Rfids":{}},"D15":{"NodeName":"D15","EmptyCnt":0,"Rfids":{}},"D16":{"NodeName":"D16","EmptyCnt":0,"Rfids":{}},"D22":{"NodeName":"D22","EmptyCnt":0,"Rfids":{}},"C1":{"NodeName":"C1","EmptyCnt":0,"Rfids":{}},"C2":{"NodeName":"C2","EmptyCnt":0,"Rfids":{}},"C3":{"NodeName":"C3","EmptyCnt":0,"Rfids":{}},"C4":{"NodeName":"C4","EmptyCnt":0,"Rfids":{}},"C5":{"NodeName":"C5","EmptyCnt":0,"Rfids":{}},"C6":{"NodeName":"C6","EmptyCnt":0,"Rfids":{}},"C7":{"NodeName":"C7","EmptyCnt":0,"Rfids":{}},"C8":{"NodeName":"C8","EmptyCnt":0,"Rfids":{}},"C9":{"NodeName":"C9","EmptyCnt":0,"Rfids":{}},"C10":{"NodeName":"C10","EmptyCnt":0,"Rfids":{}},"C14":{"NodeName":"C14","EmptyCnt":0,"Rfids":{}},"C15":{"NodeName":"C15","EmptyCnt":0,"Rfids":{}},"C22":{"NodeName":"C22","EmptyCnt":0,"Rfids":{}}}}
[D3]
EmptyShelfCnt=1
[MiR_R1763] [MiR_R1763]
RFID= RFID=
[MiR_R1764] [MiR_R1764]
...@@ -10,5 +12,5 @@ RFID= ...@@ -10,5 +12,5 @@ RFID=
RFID= RFID=
[MiR_R1580] [MiR_R1580]
RFID= RFID=
[D1] [D2]
EmptyShelfCnt=9 EmptyShelfCnt=1
ce147cdc7d5f84ac5eea7abfb5866dce563042b6 c1dcc8c90bc02014bb2dcb74bc1a4ab9d348762e
...@@ -70,5 +70,5 @@ E:\Neotel\Projects\Gitee\AGVControl-Qisda-ProductionLine\AGVControl-ProductionLi ...@@ -70,5 +70,5 @@ E:\Neotel\Projects\Gitee\AGVControl-Qisda-ProductionLine\AGVControl-ProductionLi
E:\Neotel\Projects\Gitee\AGVControl-Qisda-ProductionLine\AGVControl-ProductionLine\obj\Debug\AGVControl-ProductionLine.csproj.CopyComplete E:\Neotel\Projects\Gitee\AGVControl-Qisda-ProductionLine\AGVControl-ProductionLine\obj\Debug\AGVControl-ProductionLine.csproj.CopyComplete
E:\Neotel\Projects\Gitee\AGVControl-Qisda-ProductionLine\AGVControl-ProductionLine\obj\Debug\AGVControl-ProductionLine.exe E:\Neotel\Projects\Gitee\AGVControl-Qisda-ProductionLine\AGVControl-ProductionLine\obj\Debug\AGVControl-ProductionLine.exe
E:\Neotel\Projects\Gitee\AGVControl-Qisda-ProductionLine\AGVControl-ProductionLine\obj\Debug\AGVControl-ProductionLine.pdb E:\Neotel\Projects\Gitee\AGVControl-Qisda-ProductionLine\AGVControl-ProductionLine\obj\Debug\AGVControl-ProductionLine.pdb
E:\Neotel\Projects\Gitee\AGVControl-Qisda-ProductionLine\AGVControl-ProductionLine\obj\Debug\AGVControl-ProductionLine.csprojAssemblyReference.cache
C:\myproject\Gitee\AGVControl-Qisda-ProductionLine\AGVControl-ProductionLine\obj\Debug\AGVControl-ProductionLine.csprojAssemblyReference.cache C:\myproject\Gitee\AGVControl-Qisda-ProductionLine\AGVControl-ProductionLine\obj\Debug\AGVControl-ProductionLine.csprojAssemblyReference.cache
E:\Neotel\Projects\Gitee\AGVControl-Qisda-ProductionLine\AGVControl-ProductionLine\obj\Debug\AGVControl-ProductionLine.csprojAssemblyReference.cache
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!