Commit c0e49397 张东亮

料架通过rfid解绑

1 个父辈 9ea1b3d5
正在显示 31 个修改的文件 包含 380 行增加100 行删除
......@@ -43,7 +43,8 @@
<add key="FLEET" value="10.85.199.3" />
<add key="AutoCharge" value="True" />
<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>
</configuration>
\ No newline at end of file
......@@ -5,9 +5,10 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using AGVControl;
using BLL;
using RestSharp;
namespace BLL
namespace AGVControl
{
public class AGVManager
{
......@@ -331,7 +332,12 @@ namespace BLL
{
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";
/// <summary>
/// 异常看板
......@@ -420,6 +426,88 @@ namespace BLL
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 ",,,D22";
else
{
Common.log.Debug(string.Format("{0}接驳台状态:{1}",lineName,msgs.Msg));
return msgs.Msg;
}
}
}
catch (Exception ex)
{
Common.log.Error(ex.Message);
return ",,,D22";
}
return ",,,D22";
}
/// <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;
}
}
public class ShelfLockInfo
{
......
......@@ -22,10 +22,9 @@ namespace AGVControl.BLL
private const int REG_STATUS = 20;
//private List<string> shelfLockedNodeNames;
public delegate void AgvChangedEvent(int agvIndex);
public delegate void AgvMissionEvent();
public event AgvChangedEvent AgvChanged;
public event AgvChangedEvent AgvOnline;
public event AgvChangedEvent NodeChangedEvent;
public Control()
{
AgvCallTimer = new System.Timers.Timer
......@@ -38,7 +37,7 @@ namespace AGVControl.BLL
AgvStateTimer = new System.Timers.Timer
{
Interval = 1500,
Interval = 3000,
AutoReset = true,
Enabled = false
};
......@@ -71,8 +70,23 @@ namespace AGVControl.BLL
if (AgvStateInProcess) return;
AgvStateInProcess = true;
List<AlarmMsg> msglist = new List<AlarmMsg>();
String tmp = "";
for (int j = 0; j < Common.nodeInfo.Count; j++)
{
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.GetRFIDs(Common.nodeInfo[j].Name).Split(',')[3];
if(!tmp.Equals(Common.nodeInfo[j].RFID))
{
Common.nodeInfo[j].RFID = tmp;
NodeChangedEvent?.Invoke(j);
}
}
}
if (!Common.nodeInfo[j].Online)
{
msglist.Add(new AlarmMsg(Common.nodeInfo[j].AliceName, "lineAgv." + Common.nodeInfo[j].Name + ".OffLine", "离线"));
......@@ -148,7 +162,6 @@ namespace AGVControl.BLL
}
}
AgvStateInProcess = false;
}
......
......@@ -4,7 +4,7 @@ using System;
using System.Collections.Generic;
using System.IO;
namespace BLL
namespace AGVControl
{
/// <summary>
/// Json帮助类
......
......@@ -79,7 +79,7 @@ namespace BLL
{
res = new Result() { Succeed = true, ResultData = rfid, ErrorMessage = "" };
Log.Info(string.Format("Unlock Request(POST) [emptyStation={0},rfid={1}]", emptyStation, rfid.ToUpper()));
if (!Common.AddEmptyShelfTask(value, rfid.ToUpper()))
if (!Common.missionManager.AddMission(value, rfid.ToUpper()))
{
Common.log.Error("CreateEmptyRecycleTask(POST) 节点[" + value + "]不存在");
res = new Result() { Succeed = false, ResultData = null, ErrorMessage = "CreateEmptyRecycleTask failed: " + emptyStation + " rfid=" + rfid };
......@@ -112,7 +112,7 @@ namespace BLL
if (Common.GetNodeNameByLineName(line, out string value))
{
if (!Common.AddEmptyShelfTask(value,RFID.ToUpper()))
if (!Common.missionManager.AddMission(value,RFID.ToUpper()))
{
Common.log.Error("CreateEmptyRecycleTask 节点[" + value + "]不存在");
res = new Result() { Succeed = false, ResultData = null, ErrorMessage = "CreateEmptyRecycleTask failed: " + line };
......
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AGVControl.BLL
namespace AGVControl
{
/// <summary>
///解绑料架任务管理
/// </summary>
public class UnlockMissionManager
{
public delegate void MissionChangedHandler();
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(item.Name));
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)
{
......@@ -30,16 +52,92 @@ namespace AGVControl.BLL
}
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();
MissionChanged?.Invoke(UnlockMissions);
}
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();
MissionChanged?.Invoke(UnlockMissions);
}
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 void AddMission(string nodeName,string rfid)
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)
{
NodeUnlockMissions[nodeName].Add(rfid);
MissionChanged?.Invoke();
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 void DelMission(string nodeName,string rfid)
}
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)
{
NodeUnlockMissions[nodeName].Delete(rfid);
MissionChanged?.Invoke();
Time = time;
RFID = rfid;
Line = line;
}
}
}
......@@ -5,6 +5,7 @@ using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
......@@ -61,7 +62,7 @@ namespace AGVControl
cmbBoxLineName.Items.Add("产线名称");
foreach (var item in Common.nodeInfo)
{
if (item.Name.StartsWith("A"))
if (item.Name.StartsWith("A") || item.Name.Equals(SettingString.D4FeederIn) || item.Name.Equals(SettingString.C4FeederIn))
continue;
cmbBoxLineName.Items.Add(item.AliceName);
}
......@@ -172,13 +173,59 @@ namespace AGVControl
Common.control.AgvChanged += Control_AgvChanged;
Common.control.AgvOnline += Control_AgvOnline;
Common.server.NodeChanged += Server_NodeChanged;
Common.control.NodeChangedEvent += Server_NodeChanged;
Common.server.NodeOnline += Server_NodeOnline;
//foreach (var item in Common.agvInfo)
//{
// cmbBoxAGVName.Items.Add(item.Name);
//}
//cmbBoxAGVName.Items.Add("None");
//cmbBoxAGVName.SelectedIndex = Common.agvInfo.Count;
ReadUnlockLineInfo();
}
void ReadUnlockLineInfo()
{
if (!System.IO.File.Exists(Common.CONFIG_PATH + "UnlockInfo.json"))
{
File.Create(Common.CONFIG_PATH + "UnlockInfo.json");
Common.missionManager = new UnlockMissionManager(Common.nodeInfo);
Common.missionManager.MissionChanged += MissionManager_MissionChanged;
return;
}
string s = File.ReadAllText(Common.CONFIG_PATH + "UnlockInfo.json");
Common.missionManager = JsonHelper.DeserializeJsonToObject<UnlockMissionManager>(s);
if (Common.missionManager == null)
Common.missionManager = new UnlockMissionManager(Common.nodeInfo);
Common.missionManager.MissionChanged += MissionManager_MissionChanged;
Common.missionManager.Init();
}
private void MissionManager_MissionChanged(Dictionary<string, UnlockInfo> pairs)
{
BindingSource bs = new BindingSource();
BindingSource bs2 = new BindingSource();
try
{
dgvUnlockInfo.BeginInvoke(new MethodInvoker(delegate
{
foreach (var item in pairs.Values)
{
if (item.Count > 0)
{
bs.Add(item);
foreach (var item1 in item.UnlockRfids)
{
bs2.Add(item1);
}
}
}
dgvUnlockInfo.DataSource = bs; //赋值控件自动更新
dgvUnlockDetail.DataSource = bs2;
}));
this.Invoke(new Action(()=>
{
//grpUnlock.Text = "解绑总数:"+count;
}
));
}
catch (Exception e)
{
Common.log.Error("ShowUnlockInfo", e);
}
}
private void FrmMain_FormClosing(object sender, FormClosingEventArgs e)
......@@ -231,7 +278,8 @@ namespace AGVControl
Common.LogInfo(string.Format("手动开启小车自动模式,并清除上一次的自动模式的运行信息{0} {1}", Common.agvInfo[e.RowIndex].Name, Common.agvInfo[e.RowIndex].RunInfo()));
//Common.agvInfo[e.RowIndex].CurJob = null;
Common.agvInfo[e.RowIndex].RFID = "";
// Common.agvInfo[e.RowIndex].Place = "";
if (Common.agvInfo[e.RowIndex].Place.Equals(SettingString.AutoCharge) || Common.agvInfo[e.RowIndex].Place.Equals(SettingString.Standby))
Common.agvInfo[e.RowIndex].Place = "";
Common.agvInfo[e.RowIndex].IsUse = true;
// }
//else
......@@ -264,8 +312,7 @@ namespace AGVControl
else if (e.ColumnIndex == 8) //清除缓存
{
//清除节点缓存
Common.LogInfo(string.Format("手动清除缓存,{0}",Common.nodeInfo[e.RowIndex].Name));
Common.nodeInfo[e.RowIndex].AgvName = "";
Common.LogInfo(string.Format("手动清除缓存,{0}", Common.nodeInfo[e.RowIndex].Name));
DgvNode.Rows[e.RowIndex].Cells[5].Value = "";
Common.nodeInfo[e.RowIndex].RFID = "";
DgvNode.Rows[e.RowIndex].Cells[4].Value = "";
......@@ -360,18 +407,19 @@ namespace AGVControl
}
catch (Exception ex)
{
Common.log.Error("显示"+ Common.agvInfo[i].Name+"运行信息异常");
Common.log.Error("显示" + Common.agvInfo[i].Name + "运行信息异常");
}
}
if (!Common.doubleLine_WO.Equals(""))
lblWO.Text = Common.doubleLine_WO;
if (!AGVManager.A6_Target.Equals(""))
lblDestInfo.Text = AGVManager.A6_Target;
//if (!Common.doubleLine_WO.Equals(""))
lblWO.Text = Common.doubleLine_WO;
// if (!AGVManager.A6_Target.Equals(""))
lblDestInfo.Text = AGVManager.A6_Target;
lblCharge3.Text = "充电桩3:" + Common.chargeStatus.charge3;
lblCharge4.Text = "充电桩6:" + Common.chargeStatus.charge6;
lblStandy1.Text = "4C待机位1:" + Common.StandbyStation.C4_Station1;
lblStandy2.Text = "4C待机位2:" + Common.StandbyStation.C4_Station2;
lblWarn.Text = Common.warnMsg;
}));
InShhow = false;
......@@ -400,9 +448,9 @@ namespace AGVControl
int idx = Common.nodeInfo.FindIndex(s => s.AliceName.Equals(cmbBoxLineName.SelectedItem.ToString()));
if (idx > -1)
{
if (Common.nodeInfo[idx].UnlockedShelf.Delete(txtRfid.Text.ToUpper()))
if (Common.missionManager.DelMission(Common.nodeInfo[idx].Name, txtRfid.Text.ToUpper()))
{
Common.LogInfo(string.Format("手动删除任务成功:{0} {1}",cmbBoxLineName.SelectedItem.ToString(),txtRfid.Text.ToUpper()));
Common.LogInfo(string.Format("手动删除任务成功:{0} {1}", cmbBoxLineName.SelectedItem.ToString(), txtRfid.Text.ToUpper()));
}
else
{
......@@ -437,9 +485,9 @@ namespace AGVControl
int idx = Common.nodeInfo.FindIndex(s => s.AliceName.Equals(cmbBoxLineName.SelectedItem.ToString()));
if (idx > -1)
{
if (Common.nodeInfo[idx].UnlockedShelf.Add(txtRfid.Text.ToUpper()))
if (Common.missionManager.AddMission(Common.nodeInfo[idx].Name, txtRfid.Text.ToUpper()))
{
Common.LogInfo(string.Format("手动添加任务成功:{0} {1}", cmbBoxLineName.SelectedItem.ToString(),txtRfid.Text.ToUpper()));
Common.LogInfo(string.Format("手动添加任务成功:{0} {1}", cmbBoxLineName.SelectedItem.ToString(), txtRfid.Text.ToUpper()));
}
else
{
......@@ -613,5 +661,6 @@ namespace AGVControl
DgvAgv.Rows[idx].SetValues(Common.agvInfo[idx].ToRow());
}
}
}
}
......@@ -42,17 +42,16 @@ namespace AGVControl
}
//Common.logTextBox = new TextBox();
//Common.missionView = new DataGridView();
Common.missionManager = new MissionManager();
Common.log = log4net.LogManager.GetLogger("AgvServer");
Common.log.Info("=====程序开始=====");
ReadConfig();
Common.ReadLinePlace();
//Common.ReadUnlockLineInfo();
Common.mir = new MiR_API();
Common.control = new BLL.Control();
//获取节点位置
Common.GetNodesPosition();
//Common.GetNodesPosition();
Common.control.Start();
Common.server = new AgvServer();
Common.server.Start();
......
......@@ -14,31 +14,31 @@ namespace AGVControl
/// <param name="nodeName"></param>
public UnlockedShelf(string nodeName)
{
NodeName = nodeName;
this.NodeName = nodeName;
Rfids = new Dictionary<string, string>();
}
/// <summary>
/// 空料架数量
/// </summary>
public int EmptyCnt
{
get { return emptyCnt; }
set
{
EmptyCnt = emptyCnt;
}
}
/// <summary>
/// 节点名
/// </summary>
public string NodeName { get; private set; }
private int emptyCnt = 0;
public int EmptyCnt { get; set; }
public string NodeName;
/// <summary>
/// 解绑的所有RFID
/// 解绑的RFID及时间
/// </summary>
private Dictionary<string,string> Rfids;
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>
......@@ -46,10 +46,25 @@ namespace AGVControl
{
if (!rfid.Equals("") && !Rfids.Keys.Contains(rfid))
{
System.Threading.Interlocked.Increment(ref emptyCnt);
Rfids.Add(rfid,DateTime.Now.ToString("yyyy/MM/dd/HH:mm:ss,fff"));
Common.WriteIni(NodeName, SettingString.EmptyShelfRFIDs, string.Join(",", Rfids.Keys.ToArray()));
Common.WriteIni(NodeName, SettingString.EmptyShelfCnt, emptyCnt.ToString());
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"));
// Common.WriteIni(NodeName, SettingString.EmptyShelfCnt, emptyCnt.ToString());
//using (System.IO.StreamWriter file = new System.IO.StreamWriter(Common.CONFIG_PATH + "UnlockInfo.txt"))
//{
// foreach (var item in Rfids.Keys)
// {
// file.WriteLine(string.Format("{0},{1}", Rfids[item], item));
// }
//}
Common.LogInfo(string.Format("{0}解绑任务添加成功:RFID={1}", NodeName, rfid));
return true;
}
......@@ -61,24 +76,30 @@ namespace AGVControl
/// </summary>
public bool Delete(string rfid)
{
if (emptyCnt > 0)
if (EmptyCnt > 0)
{
if (!rfid.Equals("") && Rfids.Keys.Contains(rfid))
{
System.Threading.Interlocked.Decrement(ref emptyCnt);
int tmp = EmptyCnt;
System.Threading.Interlocked.Decrement(ref tmp);
EmptyCnt = tmp;
Rfids.Remove(rfid);
Common.WriteIni(NodeName, SettingString.EmptyShelfCnt, emptyCnt.ToString());
Common.WriteIni(NodeName, SettingString.EmptyShelfRFIDs, string.Join(",", Rfids.Keys.ToArray()));
using ()
{
//Common.WriteIni(nodeName, SettingString.EmptyShelfCnt, emptyCnt.ToString());
//using (System.IO.StreamWriter file = new System.IO.StreamWriter(Common.CONFIG_PATH + "UnlockInfo.txt"))
//{
// foreach (var item in Rfids.Keys)
// {
// file.WriteLine(string.Format("{0},{1}", Rfids[item], item));
// }
}
Common.LogInfo(string.Format("{0}解绑任务删除成功:RFID={1}", NodeName, rfid));
//}
Common.LogInfo(string.Format("{0}解绑任务删除成功:RFID={1}", NodeName, rfid));
return true;
}
}
else if (Rfids.Count > 0)
{
EmptyCnt = 0;
Rfids.Clear();
return true;
}
......
......@@ -58,7 +58,7 @@ namespace AGVControl
if (EmptyAGVBackStep.IsStep(EMPTY_AGV_BACK_STEP.NONE))
{
if (Common.FindEmptyShelfNode(agv, out string nodeName, true))
if (Common.FindEmptyShelfNode(agv, out string nodeName,out string rfid, true))
{
int i = Common.agvInfo.FindIndex(s => s.CurJob is GoEmptyShelfLineJob && ((GoEmptyShelfLineJob)s.CurJob).EmptyShelfPlace.Equals(nodeName));
if(i==-1)
......@@ -66,7 +66,7 @@ namespace AGVControl
runInfo= "小车在产线 " + agvPlace + " 准备返回时检测到 " + nodeName + " 有空料架";
msg += runInfo;
EmptyAGVBackStep.Msg = msg;
return new GoEmptyShelfLineJob(agvPlace, nodeName);
return new GoEmptyShelfLineJob(agvPlace, nodeName,rfid);
}
else
{
......
......@@ -176,7 +176,7 @@ namespace AGVControl
runInfo = "料架在" + LineName + "出去完成 [" + RFID + "]";
msg += runInfo;
EnterLeaveShelfStep.Msg = msg;
Common.DelEmptyShelfTask(LineName,RFID);
Common.missionManager.DelMission(LineName,RFID);
return new EmptyShelfBackJob(LineName,eShelfType.BigShelf);
}
else if (EnterLeaveShelfStep.IsTimeOut(60000, out double timeOutValue))
......
......@@ -259,9 +259,8 @@ namespace AGVControl
if (Common.CheckEnterOrLeaveFinished(agv, "Enter", CurTaskState))
{
ClientNode node = Common.nodeInfo[nodeIdx];
node.AgvName = "";
//回收空料架数量减少1
Common.DelEmptyShelfTask(EmptyShelfPlace,RFID);
Common.missionManager.DelMission(EmptyShelfPlace,RFID);
runInfo= "空料架在[" + EmptyShelfPlace + "]进入小车完成" + "[RFID=" + RFID + "]";
msg += runInfo;
TakeEmptyStep.Msg = msg;
......@@ -271,7 +270,10 @@ namespace AGVControl
else if(agv.Place.Equals(SettingString.C4FeederOut))
return new EmptyShelfBackJob(EmptyShelfPlace, eShelfType.BigShelf);
else if (agv.RFID.StartsWith("D"))
{
AGVManager.ClearRFID(EmptyShelfPlace, RFID);
return new EmptyShelfBackJob(EmptyShelfPlace, eShelfType.SmallShelf);
}
else if (agv.RFID.StartsWith("C"))
{
return new EmptyShelfBackJob(EmptyShelfPlace, eShelfType.BigShelf);
......
......@@ -50,9 +50,19 @@ namespace AGVControl
/// </summary>
public PositionStru position;
/// <summary>
/// 料架解绑信息
/// 料架数量信息
/// </summary>
public UnlockedShelf UnlockedShelf { get; set; }
public int EmptyShelfCnt
{
get
{
if(Common.missionManager !=null && Common.missionManager.GetUnlockInfo(Name) !=null)
{
return Common.missionManager.GetUnlockCnt(Name);
}
return -1;
}
}
public string AliceName { get; set; }
/// <summary>
/// 客户端节点
......@@ -70,7 +80,6 @@ namespace AGVControl
this.Pos_name = pos_name;
this.Pos_guid = pos_guid;
LineName = lineName;
UnlockedShelf = new UnlockedShelf(name);
}
/// <summary>
......
......@@ -30,6 +30,7 @@ namespace AGVControl
return null;
//执行空料架任务的小车数量
int emptyJobCnt = 0;
string rfid = "";
foreach (Agv_Info agv in Common.agvInfo)
{
if (!SettingString.C4_AGV_IPs.Contains(agv.IP))
......@@ -44,7 +45,7 @@ namespace AGVControl
return null;
}
//出工单料的目的地是否有空料架
if (Common.FindEmptyShelfBeforeSendFullShelf(out string nodeName))
if (Common.FindEmptyShelfBeforeSendFullShelf(out string nodeName,out rfid))
{
if (nodeName.StartsWith(SettingString.C4_Name_Prefix) && SettingString.C4_AGV_IPs.Contains(currentAgv.IP))
{
......@@ -60,20 +61,20 @@ namespace AGVControl
}
if (cnt < clientNode.EmptyShelfCnt)
{
return new GoEmptyShelfLineJob(currentAgv.Place, nodeName);
return new GoEmptyShelfLineJob(currentAgv.Place, nodeName,rfid);
}
}
}
//回收空料架
if (Common.FindEmptyShelfNode(currentAgv, out string emptyNodeName))
if (Common.FindEmptyShelfNode(currentAgv, out string emptyNodeName,out rfid))
{
if (SettingString.C4_AGV_IPs.Contains(currentAgv.IP))
{
int i = Common.agvInfo.FindIndex(s => s.CurJob is GoEmptyShelfLineJob && ((GoEmptyShelfLineJob)s.CurJob).EmptyShelfPlace.Equals(emptyNodeName));
if (i == -1)
return new GoEmptyShelfLineJob(currentAgv.Place, emptyNodeName);
return new GoEmptyShelfLineJob(currentAgv.Place, emptyNodeName,rfid);
}
}
......
......@@ -33,6 +33,7 @@ namespace AGVControl
return null;
//执行空料架任务的小车数量
int emptyJobCnt = 0;
string rfid = "";
foreach (Agv_Info agv in Common.agvInfo)
{
if (SettingString.C4_AGV_IPs.Contains(agv.IP))
......@@ -47,7 +48,7 @@ namespace AGVControl
return null;
}
//出工单料的目的地是否有空料架
if (Common.FindEmptyShelfBeforeSendFullShelf(out string nodeName))
if (Common.FindEmptyShelfBeforeSendFullShelf(out string nodeName,out rfid))
{
if (nodeName.StartsWith(SettingString.D4_Name_Prefix) && !SettingString.C4_AGV_IPs.Contains(currentAgv.IP))
{
......@@ -65,19 +66,19 @@ namespace AGVControl
}
if (cnt < clientNode.EmptyShelfCnt)
{
return new GoEmptyShelfLineJob(currentAgv.Place, nodeName);
return new GoEmptyShelfLineJob(currentAgv.Place, nodeName,rfid);
}
}
}
//回收空料架
if (Common.FindEmptyShelfNode(currentAgv, out string emptyNodeName))
if (Common.FindEmptyShelfNode(currentAgv, out string emptyNodeName,out rfid))
{
if (!SettingString.C4_AGV_IPs.Contains(currentAgv.IP))
{
int i = Common.agvInfo.FindIndex(s => s.CurJob is GoEmptyShelfLineJob && ((GoEmptyShelfLineJob)s.CurJob).EmptyShelfPlace.Equals(emptyNodeName));
if (i == -1)
return new GoEmptyShelfLineJob(currentAgv.Place, emptyNodeName);
return new GoEmptyShelfLineJob(currentAgv.Place, emptyNodeName,rfid);
}
}
......
......@@ -43,7 +43,8 @@
<add key="FLEET" value="10.85.199.3" />
<add key="AutoCharge" value="True" />
<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>
</configuration>
\ No newline at end of file
......@@ -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
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
FeederIn,FeederIn,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
FeederIn,D21,10.85.199.1,4D-FeedeerIn,FI,1e546c3a-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
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
......@@ -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
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
4CFeederIn,4CFeederIn,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
4CFeederIn,C21,10.85.199.1,4C-FeederIn,G21,cb7f117b-ca88-11ea-9b28-0001299981d4
4CFeederOut,C22,10.85.199.1,4C-FeederOut,G22,0fcf606c-d417-11ea-9b6b-0001299981d4
2020-11-03 14:08:42,D1,D11
2020-11-03 14:10:26,D1,D4
2020-11-03 14:12:43,D1,D5
{"NodeUnlockMissions":{"D1":{"NodeName":"D1","EmptyCnt":1,"Rfids":{"D3":"2020/12/02/14:12:20,387"}},"D2":{"NodeName":"D2","EmptyCnt":0,"Rfids":{}},"D3":{"NodeName":"D3","EmptyCnt":0,"Rfids":{}},"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":{}}}}
......@@ -10,5 +10,4 @@ RFID=
RFID=
[MiR_R1580]
RFID=
[D1]
EmptyShelfCnt=9
ce147cdc7d5f84ac5eea7abfb5866dce563042b6
c1dcc8c90bc02014bb2dcb74bc1a4ab9d348762e
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!