Commit 8e420219 张东亮

添加4楼在电梯口查询接口,在电梯口等待时电量充足时去待机点

1 个父辈 952af3b5
......@@ -395,7 +395,11 @@ namespace DeviceLibrary
return job;
}
}
else if(agv.Battery>50&& agv.IsInCharge)
{
ChargePileManager.StopCharge(agv);
ToStandby(agv); return job;
}
JobRunStep.ToNextStep(RunStep.SD_LiftToLine_12_WaitDoorOpen);
//请求电梯
lift.LiftContext.Request(JobParam.GetMissionInfo(), agv, true);
......
......@@ -224,6 +224,11 @@ namespace DeviceLibrary
return job;
}
}
else if (agv.Battery > 50 && agv.IsInCharge)
{
ChargePileManager.StopCharge(agv);
ToStandby(agv); return job;
}
JobRunStep.ToNextStep(RunStep.LineToLift_04_CheckLiftStatus);
//请求电梯
lift.LiftContext.Request(JobParam.GetMissionInfo(), agv);
......
......@@ -378,6 +378,11 @@ namespace DeviceLibrary.bean.job
return job;
}
}
else if (agv.Battery > 50 && agv.IsInCharge)
{
ChargePileManager.StopCharge(agv);
ToStandby(agv); return job;
}
JobRunStep.ToNextStep(RunStep.Steel_LiftToLine_21_WaitDoorOpen);
//请求电梯
lift.LiftContext.Request(JobParam.GetMissionInfo(), agv);
......
......@@ -208,6 +208,11 @@ namespace DeviceLibrary
return job;
}
}
else if (agv.Battery > 50 && agv.IsInCharge)
{
ChargePileManager.StopCharge(agv);
ToStandby(agv); return job;
}
JobRunStep.ToNextStep(RunStep.LineToLift_04_CheckLiftStatus);
//请求电梯
lift.LiftContext.Request(JobParam.GetMissionInfo(), agv);
......
......@@ -68,7 +68,7 @@ namespace DeviceLibrary.lift
foreach (var item in lifts)
{
sb.Append(item.Key + ":");
sb.AppendLine("[电梯占用:" + string.Join(";", item.Value.Agvs) +"]");
sb.AppendLine("[电梯占用:" + string.Join(";", item.Value.Agvs) + "]");
}
return sb.ToString();
}
......@@ -94,7 +94,7 @@ namespace DeviceLibrary.lift
if (item.Agvs != null && item.Agvs.Contains(agv.Name))
{
item.Agvs.Remove(agv.Name);
LogUtil.info($"【{agv.Name}】清除电梯节点占用:{string.Join(",",item.Agvs)}");
LogUtil.info($"【{agv.Name}】清除电梯节点占用:{string.Join(",", item.Agvs)}");
}
}
}
......@@ -122,7 +122,7 @@ namespace DeviceLibrary.lift
{
try
{
AgvInfo agvInfo = AGVManager.agvInfo.Find(s =>
AgvInfo agvInfo = AGVManager.agvInfo.Find(s =>
s.Scope.Workshop.Equals(agv.Scope.Workshop) && !s.IP.Equals(agv.IP));
if (agvInfo != null)
{
......@@ -131,9 +131,35 @@ namespace DeviceLibrary.lift
else
return false;
}
catch(Exception ex)
catch (Exception ex)
{
LogUtil.error($"OtherAGVIsInLift: {agv.Name},{liftName}", ex);
}
return false;
}
/// <summary>
/// 4楼AGV是否在D2电梯
/// </summary>
/// <param name="liftName"></param>
/// <returns></returns>
public static bool F4AGVIsInD2Lift()
{
try
{
var agvs = AGVManager.agvInfo.FindAll(s =>
s.Scope.Workshop.Equals(SettingString._4D));
foreach (var item in agvs)
{
if(lifts.ContainsKey(SettingString.LIFT_D2) && lifts[SettingString.LIFT_D2].Agvs.Contains(item.Name))
{
return true;
}
}
return false;
}
catch (Exception ex)
{
LogUtil.error($"OtherAGVIsInLift: {agv.Name},{liftName}",ex);
LogUtil.error($"OtherAGVIsInLift: {SettingString.LIFT_D2}", ex);
}
return false;
}
......@@ -142,12 +168,12 @@ namespace DeviceLibrary.lift
/// </summary>
/// <param name="liftId"></param>
/// <returns></returns>
public static bool IsDoorOpen(string liftId, int floor,AgvInfo agv)
public static bool IsDoorOpen(string liftId, int floor, AgvInfo agv)
{
LiftStatus liftStatus = GetLiftStatus(liftId);
{
LogUtil.debug($"检查电梯{liftId}门是否开开启");
if (liftStatus.door.Equals("opened") && liftStatus.floor.Equals(floor) && !OtherAGVIsInLift(agv,liftId))
if (liftStatus.door.Equals("opened") && liftStatus.floor.Equals(floor) && !OtherAGVIsInLift(agv, liftId))
return true;
}
return false;
......@@ -245,7 +271,7 @@ namespace DeviceLibrary.lift
sourceFloor = missionInfo.destinationFloor,
sourceClient = agvInfo.Client,
missionId = missionInfo.missionId,
updateInfo =true
updateInfo = true
};
}
else
......
......@@ -35,7 +35,11 @@ namespace DeviceLibrary
StealResult Storage(string Place);
[OperationContract]
[WebInvoke(UriTemplate = "/StealAgv/sendNew?From={From}&Place={Place}", Method = "GET", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
StealResult SendNew(string From,string Place);
StealResult SendNew(string From, string Place);
[OperationContract]
[WebInvoke(UriTemplate = "/position/state?name={name}", Method = "GET", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
Result GetPositionState(string name);
}
[DataContract]
......
......@@ -9,6 +9,7 @@ using DeviceLibrary.service.model;
using DeviceLibrary.manager;
using System.Reflection;
using System.Windows.Forms;
using DeviceLibrary.lift;
namespace DeviceLibrary
{
......@@ -284,6 +285,18 @@ namespace DeviceLibrary
Log.Info($"收到立库调用SendNew接口:【From={From}】【Place={Place}】【{JsonHelper.SerializeObject(stealResult)}】");
return stealResult;
}
public Result GetPositionState(string name)
{
Result result = new Result();
bool rtn = LiftContext.F4AGVIsInD2Lift();
if (rtn)
{
result.code = -1;
result.msg = "agv in lift";
}
return result;
}
}
public class Service
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!