Commit 3aa1afc3 张东亮

AGV点位上报

1 个父辈 55bfc1b6
正在显示 70 个修改的文件 包含 126 行增加16 行删除
<?xml version="1.0" encoding="UTF-8"?>
<config ver="10">
<item key="WebApiPort" ver="10" value="8088" />
<item key="HttpServer" ver="10" value="http://localhost:8001/smf-core" />
<item key="HttpServer" ver="10" value="http://192.168.1.62:8800" />
<item key="SharedLine" ver="10" value="A05-2FSMT-06S,A05-2FSMT-16S;A05-2FSMT-07S,A05-2FSMT-17S;A05-3FSMT-05S,A05-3FSMT-15S" />
<item key="OpenBigShelf" ver="10" value="False" />
<item key="OpenCheckLoadIO" ver="10" value="false" />
<item key="BatteryLimit" ver="10" value="" />
</config>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<config ver="10">
<item key="WebApiPort" ver="10" value="8088" />
<item key="HttpServer" ver="10" value="http://localhost:8001/smf-core" />
<item key="HttpServer" ver="10" value="http://192.168.1.62:8800" />
<item key="SharedLine" ver="10" value="A05-2FSMT-06S,A05-2FSMT-16S;A05-2FSMT-07S,A05-2FSMT-17S;A05-3FSMT-05S,A05-3FSMT-15S" />
<item key="OpenBigShelf" ver="10" value="False" />
<item key="OpenCheckLoadIO" ver="10" value="True" />
<item key="OpenCheckLoadIO" ver="10" value="false" />
</config>
\ No newline at end of file
[2023-01-08 11:09:55,595][1]INFO AGVServer 【12000】服务启动
[2023-01-08 11:09:55,597][1]INFO Server start listen : 12000
[2023-01-08 11:09:55,607][1]INFO 本机IP:[ 192.168.0.106 192.168.64.1 192.168.153.1 172.30.48.1 172.25.240.1]
[2023-02-27 14:56:37,464][1]INFO AGVServer 【12000】服务启动
[2023-02-27 14:56:37,465][1]INFO Server start listen : 12000
[2023-02-27 14:56:37,476][1]INFO 本机IP:[ 192.168.101.21 192.168.64.1 192.168.153.1 172.21.64.1]
[2023-02-27 14:57:22,426][1]INFO AGVServer 【12000】服务启动
[2023-02-27 14:57:22,428][1]INFO Server start listen : 12000
[2023-02-27 14:59:11,145][1]INFO 本机IP:[ 192.168.101.21 192.168.64.1 192.168.153.1 172.21.64.1]
[2023-02-27 15:18:42,627][15]INFO [12000]有新的客户端连接上:[127.0.0.1:60811]
[2023-02-27 15:18:42,715][20]INFO 客户端127.0.0.1离线,节点状态重置
[2023-02-27 15:18:44,173][20]INFO 客户端【127.0.0.1:60811】已断开
[2023-02-27 15:29:08,054][1]INFO AGVServer 【12000】服务启动
[2023-02-27 15:29:08,056][1]INFO Server start listen : 12000
[2023-02-27 15:29:10,971][1]INFO 本机IP:[ 192.168.101.21 192.168.64.1 192.168.153.1 172.21.64.1]
[2023-02-27 15:54:34,269][1]INFO AGVServer 【12000】服务启动
[2023-02-27 15:54:34,270][1]INFO Server start listen : 12000
[2023-02-27 15:54:36,653][1]INFO 本机IP:[ 192.168.101.21 192.168.64.1 192.168.153.1 172.21.64.1]
[2023-02-27 15:59:18,484][1]INFO AGVServer 【12000】服务启动
[2023-02-27 15:59:18,486][1]INFO Server start listen : 12000
[2023-02-27 15:59:21,638][1]INFO 本机IP:[ 192.168.101.21 192.168.64.1 192.168.153.1 172.21.64.1]
......@@ -4,6 +4,6 @@
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
<appSettings>
<add key="ProName" value="AGVDispatch-临时点不去充电桩问题" />
<add key="ProName" value="AGVDispatch-点位上报" />
</appSettings>
</configuration>
\ No newline at end of file
......@@ -39,7 +39,27 @@ namespace Common.Communication
}
return client.GetAsync(request).GetAwaiter().GetResult();
}
public string Get(string resource , object obj)
{
var response = GetResponse(JsonHelper.SerializeObject(obj), resource);
string s = response.Content ?? "";
LogUtil.Debug($"HttpGet URL:【{BaseUrl}{resource}】Return:【{response.StatusCode}】【{s}】", log);
return s;
}
public RestResponse GetResponse(object body, string resource)
{
var request = new RestRequest() { Resource = resource };
AddHeaders(request, Headers);
request.AddJsonBody(body);
return client.GetAsync(request).GetAwaiter().GetResult();
}
public RestResponse GetResponse(string body, string resource)
{
var request = new RestRequest() { Resource = resource };
AddHeaders(request, Headers);
request.AddStringBody(body,DataFormat.Json);
return client.GetAsync(request).GetAwaiter().GetResult();
}
public string Post(string body, string resource = "")
{
var request = new RestRequest() { Resource = resource };
......
......@@ -80,7 +80,7 @@ namespace DeviceLib.BLL
continue;
foreach (var item in RobotManager.GetAllRobots())
{
if (!item?.status?.is_online ?? false) continue;
// if (!item?.status?.is_online ?? false) continue;
JobManager.CheckResend(item);
JobManager.GetNewJob(item);
JobManager.Execute(item);
......
......@@ -28,11 +28,11 @@ namespace DeviceLib.BLL
}
else
{
chargePile = ChargeStandJobType.getChargePile(robot);
if(chargePile != null)
chargePile = ChargeStandJobType.getChargePile(robot);
if (chargePile != null)
{
ToNextStep(RunStep.TmpPlace_01_Start, "充电桩作为临时点任务开始");
StartCharge(robot);
MoveToNode(robot, chargePile);
}
else
{
......@@ -55,7 +55,7 @@ namespace DeviceLib.BLL
ToNextStep(RunStep.TmpPlace_04_WaitDstIdle, "检查目标点是否空闲");
}
}
if (MissionIsOk())
else if (MissionIsOk())
ToNextStep(RunStep.TmpPlace_04_WaitDstIdle, "检查目标点是否空闲");
break;
//case RunStep.TmpPlace_02_CheckIfTmpPlace:
......
......@@ -171,6 +171,34 @@ namespace DeviceLib.BLL
}
return false;
}
static string Addr_agvStatus = "/service/store/agvStatus/agvInfo";
/// <summary>
/// AGV状态上报
/// </summary>
/// <param name="agvStatuses"></param>
/// <returns></returns>
public static bool UpdateAgvStatus(List<AgvStatus> agvStatuses)
{
try
{
//Dictionary<string, string> queryStr = new Dictionary<string, string>();
//queryStr.Add("rfid", rfid);
string json = httpClient.Post(agvStatuses,Addr_agvStatus);
RtnData rtnData = JsonHelper.DeserializeJsonToObject<RtnData>(json);
if (rtnData != null && rtnData.code == 0)
{
return true;
}
}
catch (Exception ex)
{
LogUtil.Error($"UpdateAgvStatus", ex);
}
return false;
}
}
public class ServerData4
{
......@@ -243,5 +271,23 @@ namespace DeviceLib.BLL
public string data { get; set; }
public string msg { get; set; }
}
public class AgvStatus
{
/// <summary>
/// 小车名称
/// </summary>
public string name { get; set; }
/// <summary>
/// 小车电量
/// </summary>
public string elec { get; set; }
/// <summary>
/// 小车位置
/// </summary>
public string loc { get; set; }
/// <summary>
/// 错误消息
/// </summary>
public string message { get; set; }
}
}
......@@ -133,11 +133,39 @@ namespace DeviceLib.BLL
{
try
{
AgvStatus agv= new AgvStatus()
{
name = robot.name,
elec = robot?.status?.battery_percentage.ToString("f2"),
};
if(robot.job!=null)
{
if(robot.job is StandbyJob)
{
agv.loc = "STANDBY";
}
else if(robot.job is ChargeJob)
{
agv.loc = "CHARGE";
}
else if(robot.job.JobParam.LineNode!=null)
{
agv.loc = robot.job.JobParam.LineNode.name;
}
else
{
agv.loc = "STANDBY";
}
}
else
{
agv.loc = "STANDBY";
}
HttpManager.UpdateAgvStatus(new List<AgvStatus> {agv });
}
catch(Exception ex)
{
LogUtil.Error($"{robot.name} 上报状态失败",ex);
}
}
static MissionState getMissionState(int id)
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!