针对潍柴项目,新增模拟获取Agv信息,实时数据接口
This commit is contained in:
@@ -22,6 +22,7 @@ using Tnb.WarehouseMgr.Entities.Consts;
|
||||
using Tnb.WarehouseMgr.Entities.Dto;
|
||||
using Tnb.WarehouseMgr.Entities.Dto.Inputs;
|
||||
using Tnb.WarehouseMgr.Entities.Dto.Outputs;
|
||||
using Tnb.WarehouseMgr.Entities.Dto.Queries;
|
||||
using Tnb.WarehouseMgr.Entities.Entity;
|
||||
using Tnb.WarehouseMgr.Entities.Enums;
|
||||
using Tnb.WarehouseMgr.Interfaces;
|
||||
@@ -365,6 +366,68 @@ namespace Tnb.WarehouseMgr
|
||||
return await ToApiResult(HttpStatusCode.OK, "未启用");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据产线获取Agv列表
|
||||
/// </summary>
|
||||
/// <param name="lineId">产线Id,默认空,(潍柴的只有一条产线所以不用传)</param>
|
||||
/// <returns>
|
||||
/// returns:
|
||||
/// <br/>{
|
||||
/// <br/> name:设备名称
|
||||
/// <br/> code:设备代码
|
||||
/// <br/>}
|
||||
/// </returns>
|
||||
[HttpGet("lineId"), AllowAnonymous]
|
||||
public async Task<dynamic> GetAgvListByLineId(string lineId = "")
|
||||
{
|
||||
var devList = await _db.Queryable<EqpEquipment>().InnerJoin<EqpEquipType>((a, b) => a.equip_type_id == b.id)
|
||||
.Where((a, b) => b.code == "003" && b.status == 1)
|
||||
.Select((a, b) => new
|
||||
{
|
||||
a.name,
|
||||
a.code,
|
||||
})
|
||||
.ToListAsync();
|
||||
return devList;
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取Agv实时信息
|
||||
/// </summary>
|
||||
/// <param name="q">查询输入参数</param>
|
||||
/// <returns>
|
||||
/// <br/>{
|
||||
/// <br/> deviceCode:设备序号
|
||||
/// <br/> devicePostionRec:设备所在二维码的x,y坐标,前边的值是x,后边的是y
|
||||
/// <br/> devicePosition:设备当前位置
|
||||
/// <br/> oritation:方向
|
||||
/// <br/> speed:速度
|
||||
/// <br/> shelfNumber:当前搬运的货架编号,对应载具编号
|
||||
/// <br/>}
|
||||
/// </returns>
|
||||
[HttpGet, AllowAnonymous]
|
||||
public async Task<List<AgvRealInfoOutput>> GetAgvRealInfo([FromQuery] AgvRealInfoQuery q)
|
||||
{
|
||||
//请求Les接口,bing解析返回结果 绑定到AgvRealInfoOutput实例 此处忽略
|
||||
var devCodes = new[] { "Dev01", "Dev02", "Dev03", "Dev04", "Dev05" };
|
||||
|
||||
if (!q.deviceCode.IsNullOrWhiteSpace())
|
||||
{
|
||||
devCodes = devCodes.Where(x => q.deviceCode.Contains(x)).ToArray();
|
||||
}
|
||||
var result = new List<AgvRealInfoOutput>();
|
||||
for (int i = 0; i < devCodes.Length; i++)
|
||||
{
|
||||
AgvRealInfoOutput output = new();
|
||||
output.deviceCode = devCodes[i];
|
||||
output.oritation = 0;
|
||||
output.speed = Random.Shared.Next(0, 100);
|
||||
var x = Random.Shared.NextDouble() * 100;
|
||||
var y = Random.Shared.NextDouble() * 100;
|
||||
output.devicePostionRec = new[] { x, y };
|
||||
output.shelfNumber = "xxxx";
|
||||
result.Add(output);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user