Commit 6bf6ab7b 张东亮

1

1 个父辈 a11957e5
......@@ -52,6 +52,7 @@ namespace DeviceLibrary
else
{
JobRunStep.ToNextStep(RunStep.RECY_BACK_WAIT_REACH_RECY_ST);
WarehouseSigManager.TargetWithFix.CurPlace = JobParam.TargetNode.Name;
runInfo = string.Format("从{0}去{1}", JobParam.SrcNode, JobParam.TargetNode);
JobRunStep.Msg = runInfo;
AllocateTask(agv, JobParam.TargetNode.Name);
......@@ -72,6 +73,7 @@ namespace DeviceLibrary
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.RECY_BACK_WAIT_REACH_RECY_ST);
WarehouseSigManager.TargetWithFix.CurPlace = JobParam.TargetNode.Name;
runInfo = string.Format("进门,送往{0}", JobParam.TargetNode);
JobRunStep.Msg = runInfo;
AllocateTask(agv, JobParam.TargetNode.Name);
......@@ -85,7 +87,6 @@ namespace DeviceLibrary
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
WarehouseSigManager.TargetWithFix.CurPlace = JobParam.TargetNode.Name;
JobRunStep.ToNextStep(RunStep.RECY_BACK_WAIT_RECY_ST_RESPONSE);
runInfo = "AGV到达 " + JobParam.TargetNode + ",并发送治具入库请求";
JobRunStep.Msg = runInfo;
......@@ -120,13 +121,13 @@ namespace DeviceLibrary
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.RECY_BACK_CHECK_OUT_STORE);
runInfo = $"治具{(JobParam.Shelf == null ? "" : JobParam.Shelf.RFID)}进入{JobParam.TargetNode}完成";
runInfo = $"治具{(JobParam.Shelf == null ? "" : JobParam.Shelf.RFID)}进入{JobParam.TargetNode}完成,检查是否有出库任务";
JobRunStep.Msg = runInfo;
}
else if (WarehouseSigManager.StopEnter)
{
JobRunStep.ToNextStep(RunStep.RECY_BACK_CHECK_OUT_STORE);
runInfo = $"治具{(JobParam.Shelf == null ? "" : JobParam.Shelf.RFID)}进入{JobParam.TargetNode}完成";
runInfo = $"治具{(JobParam.Shelf == null ? "" : JobParam.Shelf.RFID)}进入{JobParam.TargetNode}完成,检查是否有出库任务";
JobRunStep.Msg = runInfo;
AllocateTask(agv, SettingString.Init);
WarehouseSigManager.StopEnter = false;
......@@ -145,8 +146,9 @@ namespace DeviceLibrary
{
//调宽
JobRunStep.ToNextStep(RunStep.ADJUST_WIDTH);
runInfo = JobParam.TargetNode + " 有出库任务,开始调宽:"+ WarehouseSigManager.OutStore.Type;
runInfo = JobParam.TargetNode + " 有出库任务,开始调宽:"+ WarehouseSigManager.OutStore.Type+$",Id={WarehouseSigManager.OutStore.Id}";
JobRunStep.Msg = runInfo;
SetPlc(agv, 52, 1);
AdjustWidth(agv, WarehouseSigManager.OutStore.Type);
}
else if (OpManager.Info.GetTransfer(out string target))
......
......@@ -30,6 +30,7 @@ namespace DeviceLibrary
JobRunStep.ToNextStep(RunStep.ADJUST_WIDTH);
runInfo = "准备去" + JobParam.TargetNode + ",先调宽";
JobRunStep.Msg = runInfo;
SetPlc(agv, 52, 0);
AdjustWidth(agv, JobParam.FixMissionInfo.Type);
}
else if (JobRunStep.IsStep(RunStep.ADJUST_WIDTH))
......@@ -259,7 +260,7 @@ namespace DeviceLibrary
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
//设置音效类型并播放
//设置音效类型
SetPlcWithToInstore(agv);
AllocateTask(agv, SettingString.PlaySound);
if (JobParam.OpType.Equals(OpType.ComToLine))
......
......@@ -27,6 +27,7 @@ namespace DeviceLibrary
JobRunStep.ToNextStep(RunStep.ADJUST_WIDTH);
runInfo = "准备去" + JobParam.TargetNode + ",先调宽";
JobRunStep.Msg = runInfo;
SetPlc(agv, 52, 1);
AdjustWidth(agv, JobParam.FixMissionInfo.Type);
}
else if (JobRunStep.IsStep(RunStep.ADJUST_WIDTH))
......@@ -52,6 +53,7 @@ namespace DeviceLibrary
}
else if (!agv.IsExistShelf)
{
WarehouseSigManager.TargetWithFix.CurPlace = JobParam.TargetNode.Name;
if (JobParam.SrcNode.Area.Equals(Area.D))
{
JobRunStep.ToNextStep(RunStep.WAIT_AGV_REACH_A6);
......@@ -101,7 +103,6 @@ namespace DeviceLibrary
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.WAIT_AGV_REACH_A6);
WarehouseSigManager.TargetWithFix.CurPlace = JobParam.TargetNode.Name;
runInfo = $"去{JobParam.TargetNode.Name}接料";
JobRunStep.Msg = runInfo;
AllocateTask(agv, JobParam.TargetNode.Name);
......@@ -156,7 +157,7 @@ namespace DeviceLibrary
{
agv.HasError = false;
JobRunStep.ToNextStep(RunStep.WAIT_LEAVE_SIG);
runInfo = JobParam.TargetNode.Name + "治具进入小车完成";
runInfo = JobParam.TargetNode.Name + "治具进入小车完成,等待离开信号";
JobRunStep.Msg = runInfo;
//JobRunStep.EndJob();
// return new SendFixToLineJob(new JobParam(JobParam.TargetNode.ToCopy()),true);
......
......@@ -47,6 +47,7 @@ namespace DeviceLibrary
JobRunStep.ToNextStep(RunStep.ADJUST_WIDTH);
runInfo = "准备去" + JobParam.TargetNode + ",先调宽";
JobRunStep.Msg = runInfo;
SetPlc(agv, 52, 0);
AdjustWidth(agv, JobParam.FixMissionInfo.Type);
}
......
......@@ -99,6 +99,7 @@ namespace DeviceLibrary
/// AGV编号
/// </summary>
public string AGVNum { get; set; } = "";
public string DeviceName { get; set; } = "";
/// <summary>
/// 任务名称
/// </summary>
......@@ -176,6 +177,7 @@ namespace DeviceLibrary
}
}
private string agvname = "";
public string DeviceName { get; set; } = "";
/// <summary>
/// 开始时间
/// </summary>
......
......@@ -113,6 +113,30 @@ namespace DeviceLibrary.manager
WriteMission();
MissionChangedEvent?.Invoke();
}
public static void DeleteById(string id)
{
try
{
MissionInfo missionInfo = null;
if (Monitor.TryEnter(lockObj, 1000))
{
missionInfo = fixMissionInfos.Find(s => s.Id.Equals(id));
fixMissionInfos.Remove(missionInfo);
LogUtil.info($"入库时存在出库任务,删除呼叫的缓存任务:id={id}");
}
}
catch (Exception e)
{
LogUtil.error("操作 fixMissionInfos 超时");
}
finally
{
Monitor.Exit(lockObj);
}
WriteMission();
MissionChangedEvent?.Invoke();
}
public static MissionInfo ExecuteMission(MissionType missionType)
{
MissionInfo missionInfo=null;
......
......@@ -68,17 +68,18 @@ namespace DeviceLibrary.manager
{
public bool Has { get; set; }
public FixType Type { get; set; }
public void Set(bool has,FixType fixType)
public string Id { get; set; } = "";
public void Set(bool has,FixType fixType,string id="")
{
Has = has;
Type = fixType;
Id = id;
}
public void Reset()
{
Has = false;
Type = FixType.None;
Id = "";
}
}
......
......@@ -17,8 +17,8 @@ namespace DeviceLibrary
[WebInvoke(UriTemplate = "call", Method = "POST", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
Result CallByPost(Stream stream);
[OperationContract]
[WebInvoke(UriTemplate = "call?target={target}&type={type}", Method = "GET", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
Result CallByGet(string target, int type);
[WebInvoke(UriTemplate = "call?target={target}&type={type}&id={id}", Method = "GET", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
Result CallByGet(string target, int type,string id);
[OperationContract]
......@@ -53,8 +53,8 @@ namespace DeviceLibrary
[WebInvoke(UriTemplate = "outStore", Method = "POST", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
Result OutStoreByPost(Stream stream);
[OperationContract]
[WebInvoke(UriTemplate = "outStore?has={has}&type={type}", Method = "GET", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
Result OutStoreByGet(bool has, int type);
[WebInvoke(UriTemplate = "outStore?has={has}&type={type}&id={id}", Method = "GET", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
Result OutStoreByGet(bool has, int type,string id);
[OperationContract]
[WebInvoke(UriTemplate = "mayLeave", Method = "POST", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
......@@ -103,14 +103,14 @@ namespace DeviceLibrary
{
static log4net.ILog Log = log4net.LogManager.GetLogger("FixtureServices");
#region 呼叫
public Result CallByGet(string target, int type)
public Result CallByGet(string target, int type,string id="")
{
Result res;
MissionInfo missionInfo;
if (SettingString.Warehouse.Equals(target))
{
missionInfo = new MissionInfo(target, (FixType)type, MissionType.Warehouse);
if (!FixMissionManager.Contains(missionInfo))
missionInfo = new MissionInfo(target, (FixType)type, MissionType.Warehouse,id);
//if (!FixMissionManager.Contains(missionInfo))
{
if (AGVManager.agvInfo[0].CurJob is StandyJob || AGVManager.agvInfo[0].CurJob is ChargeJob)
{
......@@ -118,7 +118,7 @@ namespace DeviceLibrary
{
res = new Result() { Succeed = false, Data = $"target:{target},type:{type}", Msg = $"AGV has Line Misssion,{target} is not allowed to call." };
FixMissionManager.Add(missionInfo);
Log.Error("立库呼叫失败[GET](AGV正在执行任务):" + missionInfo.ToString());
Log.Error("立库呼叫失败[GET](AGV正在执行任务,暂存任务):" + missionInfo.ToString());
return res;
}
......@@ -127,7 +127,7 @@ namespace DeviceLibrary
{
res = new Result() { Succeed = false, Data = $"target:{target},type:{type}", Msg = $"AGV is doing Misssion,{target} is not allowed to call." };
FixMissionManager.Add(missionInfo);
Log.Error("立库呼叫失败[GET](AGV正在执行任务):" + missionInfo.ToString());
Log.Error("立库呼叫失败[GET](AGV正在执行任务,暂存任务):" + missionInfo.ToString());
return res;
}
}
......@@ -137,6 +137,7 @@ namespace DeviceLibrary
{
missionInfo = new MissionInfo(target, (FixType)type, MissionType.Line);
}
if (!NodeManager.HasNode(target))
{
res = new Result() { Succeed = false, Data = $"target:{target},type:{type}", Msg = $"节点名{target}不存在" };
......@@ -169,11 +170,12 @@ namespace DeviceLibrary
System.Collections.Specialized.NameValueCollection nvc = System.Web.HttpUtility.ParseQueryString(s);
string target = nvc["target"];
int type = int.Parse(nvc["type"]);
string id = nvc["id"];
MissionInfo missionInfo;
if (SettingString.Warehouse.Equals(target))
{
missionInfo = new MissionInfo(target, (FixType)type, MissionType.Warehouse);
if (!FixMissionManager.Contains(missionInfo))
missionInfo = new MissionInfo(target, (FixType)type, MissionType.Warehouse, id);
// if (!FixMissionManager.Contains(missionInfo))
{
if (AGVManager.agvInfo[0].CurJob is StandyJob || AGVManager.agvInfo[0].CurJob is ChargeJob)
{
......@@ -182,7 +184,7 @@ namespace DeviceLibrary
res = new Result() { Succeed = false, Data = $"target:{target},type:{type}", Msg = $"AGV has Line Misssion,{target} is not allowed to call." };
FixMissionManager.Add(missionInfo);
Log.Error("立库呼叫失败[POST](AGV正在执行任务):" + missionInfo.ToString());
Log.Error("立库呼叫失败[POST](AGV正在执行任务,暂存任务):" + missionInfo.ToString());
return res;
}
}
......@@ -190,7 +192,7 @@ namespace DeviceLibrary
{
res = new Result() { Succeed = false, Data = $"target:{target},type:{type}", Msg = $"AGV is doing Misssion,{target} is not allowed to call." };
FixMissionManager.Add(missionInfo);
Log.Error("立库呼叫失败[POST](AGV正在执行任务):" + missionInfo.ToString());
Log.Error("立库呼叫失败[POST](AGV正在执行任务,暂存任务):" + missionInfo.ToString());
return res;
}
}
......@@ -224,6 +226,14 @@ namespace DeviceLibrary
return res;
}
//public Result CallByPost(Stream stream)
//{
// StreamReader sr = new StreamReader(stream);
// string s = sr.ReadToEnd();
// TestClass testClass = JsonHelper.DeserializeJsonToObject<TestClass>(s);
// return new Result();
//}
#endregion
#region 获取治具类型
......@@ -329,10 +339,11 @@ namespace DeviceLibrary
return result1;
}
public Result OutStoreByGet(bool has, int type)
public Result OutStoreByGet(bool has, int type,string id="")
{
WarehouseSigManager.OutStore.Set(has, (FixType)type);
Log.Info($"Get: 收到出库信息:{has.ToString()} {type}");
WarehouseSigManager.OutStore.Set(has, (FixType)type,id);
FixMissionManager.DeleteById(id);
Log.Info($"Get: 收到出库信息:{has.ToString()},{type},{id}");
return new Result() { Succeed = true, Data = $"OutStore:{has},{type}", Msg = "" };
}
......@@ -343,8 +354,10 @@ namespace DeviceLibrary
System.Collections.Specialized.NameValueCollection nvc = System.Web.HttpUtility.ParseQueryString(s);
bool has = bool.Parse(nvc["has"]);
int type = int.Parse(nvc["type"]);
WarehouseSigManager.OutStore.Set(has, (FixType)type);
Log.Info($"Post: 收到出库信息:{has.ToString()} {type}");
string id = nvc["id"];
WarehouseSigManager.OutStore.Set(has, (FixType)type,id);
FixMissionManager.DeleteById(id);
Log.Info($"Post: 收到出库信息:{has.ToString()},{type},{id}");
return new Result() { Succeed = true, Data = $"OutStore:{has},{type}", Msg = "" };
}
......@@ -437,6 +450,11 @@ namespace DeviceLibrary
return result1;
}
}
public class TestClass
{
public string target { get; set; }
public int type { get; set; }
}
public class WebService
{
......
......@@ -21,6 +21,10 @@ namespace DeviceLibrary.manager
/// </summary>
public FixType Type { get; set; }
/// <summary>
/// 治具Id
/// </summary>
public string Id { get; set; }
/// <summary>
/// 目的地名称
/// </summary>
public string Target { get; set; }
......@@ -32,12 +36,13 @@ namespace DeviceLibrary.manager
/// 任务是否执行
/// </summary>
public bool On { get; set; } = true;
public MissionInfo(string target, FixType fixType, MissionType missionType)
public MissionInfo(string target, FixType fixType, MissionType missionType,string id="")
{
RTime = DateTime.Now;
Type = fixType;
Target = target;
MissionType = missionType;
Id = id;
}
public MissionInfo() { }
public override string ToString()
......@@ -87,7 +92,7 @@ namespace DeviceLibrary.manager
/// <summary>
/// 烧录治具
/// </summary>
BRUN = 3,
BURN = 3,
/// <summary>
/// 抓手治具
/// </summary>
......
......@@ -6,7 +6,7 @@
<appSettings>
<add key="ITS" value="10.85.17.233"/>
<add key="WebService" value="http://10.85.196.40/service/agv/"/>
<add key="WebService" value="http://127.0.0.1:8888/service/agv/"/>
<add key="http.server" value="http://10.85.199.25/myproject/"/>
<add key="FLEET" value="10.85.19.3"/>
<add key="log4net_configname" value="log4net.config"/>
......
......@@ -219,7 +219,7 @@ namespace AGVControl
private void dgvInfos_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
if (e.ColumnIndex == 4)
if (e.ColumnIndex == 5)
{
if (e.RowIndex == -1)
return;
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!