Przeglądaj źródła

api服务开发

样式分支
pry 2 lat temu
rodzic
commit
298aa6769d
19 zmienionych plików z 268 dodań i 113 usunięć
  1. +32
    -31
      BPASmartClient.AGV/Enums/BinTask.cs
  2. +28
    -27
      BPASmartClient.AGV/Enums/CTC.cs
  3. +41
    -0
      BPASmartClient.AGV/Feedback/AGVToUpSystem.cs
  4. +23
    -0
      BPASmartClient.AGV/Feedback/JobData.cs
  5. +54
    -0
      BPASmartClient.AGV/Feedback/Upstreamrequest.cs
  6. +0
    -22
      BPASmartClient.AGV/Feedback/event.cs
  7. +4
    -0
      BPASmartClient.AgvApi/BPASmartClient.AgvApi.csproj
  8. +0
    -16
      BPASmartClient.AgvApi/Controllers/AgvStatusController.cs
  9. +42
    -0
      BPASmartClient.AgvApi/Controllers/robotjobController.cs
  10. +25
    -0
      BPASmartClient.AgvApi/Factory.cs
  11. +6
    -1
      BPASmartClient.AgvApi/PersonHub.cs
  12. +2
    -0
      BPASmartClient.AgvApi/Program.cs
  13. +0
    -10
      BPASmartClient.AgvApi/Sign.cs
  14. +1
    -1
      BPASmartClient.Business/BPASmartClient.Business.csproj
  15. +1
    -1
      BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj
  16. +1
    -1
      BPASmartClient.Device/BPASmartClient.Device.csproj
  17. +1
    -1
      BPASmartClient.Model/BPASmartClient.Model.csproj
  18. +1
    -1
      DosingSystem/BPASmartClient.DosingSystem.csproj
  19. +6
    -1
      FryPot_DosingSystem/Helper/HubHelper.cs

+ 32
- 31
BPASmartClient.AGV/Enums/BinTask.cs Wyświetl plik

@@ -1,36 +1,37 @@
namespace BPASmartClient.AGV.Enums
/// <summary>
/// 纯料箱任务枚举
/// </summary>
public enum BinTask
{
/// <summary>
/// 开始移动(仅单插臂或单夹报,2.8.1后)
/// </summary>
MOVE_BEGIN,
/// <summary>
/// 到站
/// </summary>
ENTER_STATION,
/// <summary>
/// 任务完成
/// </summary>
DONE,
/// <summary>
/// 取料完成
/// </summary>
LOAD_COMPLETED,
/// <summary>
/// 放料完成
/// </summary>
UNLOAD_COMPLETED,
/// <summary>
/// 任务异常取消
/// </summary>
ABNORMAL_CANCEL,
/// <summary>
/// 任务异常完成
/// 纯料箱任务枚举
/// </summary>
ABNORMAL_COMPLETED,
}
public enum BinTask
{
/// <summary>
/// 开始移动(仅单插臂或单夹报,2.8.1后)
/// </summary>
MOVE_BEGIN,
/// <summary>
/// 到站
/// </summary>
ENTER_STATION,
/// <summary>
/// 任务完成
/// </summary>
DONE,
/// <summary>
/// 取料完成
/// </summary>
LOAD_COMPLETED,
/// <summary>
/// 放料完成
/// </summary>
UNLOAD_COMPLETED,
/// <summary>
/// 任务异常取消
/// </summary>
ABNORMAL_CANCEL,
/// <summary>
/// 任务异常完成
/// </summary>
ABNORMAL_COMPLETED,
}
}

+ 28
- 27
BPASmartClient.AGV/Enums/CTC.cs Wyświetl plik

@@ -1,32 +1,33 @@
namespace BPASmartClient.AGV.Enums
/// <summary>
/// 货位到货位/点到点辊筒料箱搬运任务枚举
/// </summary>
public enum CTC
{
/// <summary>
/// 正在上料
/// </summary>
ROLLER_LOAD_DOING,
/// <summary>
/// 上料完成
/// </summary>
ROLLER_LOAD_FINISH,
/// <summary>
/// 正在下料
/// </summary>
ROLLER_UNLOAD_DOING,
/// <summary>
/// 下料完成
/// </summary>
DONE,
/// <summary>
/// 任务异常取消
/// </summary>
ABNORMAL_CANCEL,
/// <summary>
/// 任务异常完成
/// 货位到货位/点到点辊筒料箱搬运任务枚举
/// </summary>
ABNORMAL_COMPLETED,
}
public enum CTC
{
/// <summary>
/// 正在上料
/// </summary>
ROLLER_LOAD_DOING,
/// <summary>
/// 上料完成
/// </summary>
ROLLER_LOAD_FINISH,
/// <summary>
/// 正在下料
/// </summary>
ROLLER_UNLOAD_DOING,
/// <summary>
/// 下料完成
/// </summary>
DONE,
/// <summary>
/// 任务异常取消
/// </summary>
ABNORMAL_CANCEL,
/// <summary>
/// 任务异常完成
/// </summary>
ABNORMAL_COMPLETED,
}
}

+ 41
- 0
BPASmartClient.AGV/Feedback/AGVToUpSystem.cs Wyświetl plik

@@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.AGV.Feedback
{
public class AGVToUpSystem
{
/// <summary>
/// 上游系统任务号,全局唯一
/// </summary>
public string robotJobId { get; set; }

/// <summary>
/// 仓库编号
/// </summary>
public int warehouseId { get; set; }

/// <summary>
/// 任务快仓系统编号
/// </summary>
public string jobId { get; set; }

/// <summary>
/// 任务状态
/// </summary>
public string state { get; set; }

/// <summary>
/// 内部任务类型
/// </summary>
public string jobType { get; set; }

/// <summary>
/// 数据字段
/// </summary>
public JobData jobData { get; set; } = new JobData();
}
}

+ 23
- 0
BPASmartClient.AGV/Feedback/JobData.cs Wyświetl plik

@@ -8,16 +8,39 @@ namespace BPASmartClient.AGV.Feedback
{
public class JobData
{
/// <summary>
/// AGV编号
/// </summary>
public string agvCode { get; set; }

/// <summary>
/// 容器编号
/// </summary>
public string containerCode { get; set; }

/// <summary>
/// 上料点位
/// </summary>
public string startPointCode { get; set; }

/// <summary>
/// 上料货位编号
/// </summary>
public string startSlotCode { get; set; }

/// <summary>
/// 下料点位
/// </summary>
public string targetPointCode { get; set; }

/// <summary>
/// 下料货位编号
/// </summary>
public string targetSlotCode { get; set; }

/// <summary>
/// 是否需要上料交互
/// </summary>
public bool loadInteractive { get; set; }
}
}

+ 54
- 0
BPASmartClient.AGV/Feedback/Upstreamrequest.cs Wyświetl plik

@@ -0,0 +1,54 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.AGV.Feedback
{
public class Upstreamrequest
{
/// <summary>
/// AGV编号
/// </summary>
public string agvCode { get; set; }

/// <summary>
/// 容器编号,如果一次上/下多个容器,则多个容器用英文逗号分隔
/// </summary>
public string containerCode { get; set; }

/// <summary>
/// 上游设备ID 本字段适用于只有一个辊筒设备的时候使用
/// </summary>
public long equipmentId { get; set; }

/// <summary>
/// 上游设备ID,多个用英文逗号分隔 本字段适用于多辊筒同时上下料的时候使用
/// </summary>
public string equipmentIds { get; set; }

/// <summary>
/// 快仓任务编号
/// </summary>
public string jobId { get; set; }

/// <summary>
/// 消息ID
/// </summary>
public string msgId { get; set; }

/// <summary>
/// 交互阶段
/// LOAD:上料阶段
/// UNLOAD:下料阶段
/// </summary>
public string command { get; set; }

/// <summary>
/// 上游任务号
/// </summary>
public string robotJobId { get; set; }

}
}

+ 0
- 22
BPASmartClient.AGV/Feedback/event.cs Wyświetl plik

@@ -1,22 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.AGV.Feedback
{
public class @event
{
public string robotJobId { get; set; }

public int warehouseId { get; set; }

public string jobId { get; set; }

public string state { get; set; }
public string jobType { get; set; }

public JobData jobData { get; set; } = new JobData();
}
}

+ 4
- 0
BPASmartClient.AgvApi/BPASmartClient.AgvApi.csproj Wyświetl plik

@@ -10,4 +10,8 @@
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\BPASmartClient.AGV\BPASmartClient.AGV.csproj" />
</ItemGroup>

</Project>

+ 0
- 16
BPASmartClient.AgvApi/Controllers/AgvStatusController.cs Wyświetl plik

@@ -1,16 +0,0 @@
using Microsoft.AspNetCore.Mvc;

namespace BPASmartClient.AgvApi.Controllers
{
[ApiController]
[Route("apicallback/quicktron/[Controller]")]
public class AgvStatusController : ControllerBase
{

[HttpPost("AgvCallback")]
public string AgvCallback(Sign sign)
{
return "SUCCESS";
}
}
}

+ 42
- 0
BPASmartClient.AgvApi/Controllers/robotjobController.cs Wyświetl plik

@@ -0,0 +1,42 @@
using BPASmartClient.AGV.Feedback;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.SignalR;
using Newtonsoft.Json;

namespace BPASmartClient.AgvApi.Controllers
{
[ApiController]
[Route("apicallback/quicktron/[Controller]")]
public class robotjobController : ControllerBase
{
/// <summary>
/// 搬运任务状态上报
/// </summary>
/// <param name="sign"></param>
/// <returns></returns>
[HttpPost("report")]
public string report(AGVToUpSystem ent)
{
if (ent != null)
{
Factory.GetInstance.SendReport(ent);
}
return "SUCCESS";
}

/// <summary>
/// AGV上下料交互请求接口
/// </summary>
/// <param name="upstreamrequest"></param>
/// <returns></returns>
[HttpPost("upstreamrequest")]
public string upstreamrequest(Upstreamrequest upstreamrequest)
{
if (upstreamrequest != null)
{
Factory.GetInstance.SendUpstreamrequest(upstreamrequest);
}
return "SUCCESS";
}
}
}

+ 25
- 0
BPASmartClient.AgvApi/Factory.cs Wyświetl plik

@@ -0,0 +1,25 @@
using Microsoft.AspNetCore.SignalR;

namespace BPASmartClient.AgvApi
{
public class Factory
{

private volatile static Factory _Instance;
public static Factory GetInstance => _Instance ?? (_Instance = new Factory());
private Factory() { }

public IHubCallerClients HubCallerClient { get; set; }

public Task SendReport(object obj)
{
return HubCallerClient?.Caller.SendAsync("Report", obj);
}

public Task SendUpstreamrequest(object obj)
{
return HubCallerClient?.Caller.SendAsync("Upstreamrequest", obj);
}

}
}

+ 6
- 1
BPASmartClient.AgvApi/PersonHub.cs Wyświetl plik

@@ -4,9 +4,11 @@ namespace BPASmartClient.AgvApi
{
public class PersonHub : Hub
{

public override Task OnConnectedAsync()
{
Console.WriteLine($"{Context.ConnectionId}:= 连接成功");
Factory.GetInstance.HubCallerClient = Clients;
return base.OnConnectedAsync();
}

@@ -21,9 +23,12 @@ namespace BPASmartClient.AgvApi
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
public Task Send(string str)
public Task Send(object str)
{
return Clients.Caller.SendAsync("SendMessage", str);
}



}
}

+ 2
- 0
BPASmartClient.AgvApi/Program.cs Wyświetl plik

@@ -1,4 +1,5 @@
using BPASmartClient.AgvApi;
using Microsoft.AspNetCore.Cors.Infrastructure;

var builder = WebApplication.CreateBuilder(args);

@@ -28,6 +29,7 @@ app.Use(async (context, next) =>
await next();
});


app.UseAuthorization();

app.MapControllers();


+ 0
- 10
BPASmartClient.AgvApi/Sign.cs Wyświetl plik

@@ -1,10 +0,0 @@
namespace BPASmartClient.AgvApi
{
public class Sign
{
public int a { get; set; }
public int b { get; set; }
public string c { get; set; }
public string d { get; set; }
}
}

+ 1
- 1
BPASmartClient.Business/BPASmartClient.Business.csproj Wyświetl plik

@@ -8,7 +8,7 @@

<ItemGroup>
<PackageReference Include="BPA.ApolloClient" Version="1.0.12" />
<PackageReference Include="BPA.Message" Version="1.0.45" />
<PackageReference Include="BPA.Message" Version="1.0.46" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="6.0.0" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="6.0.0" />


+ 1
- 1
BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj Wyświetl plik

@@ -242,7 +242,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="BPA.Message" Version="1.0.45" />
<PackageReference Include="BPA.Message" Version="1.0.46" />
<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" />
</ItemGroup>



+ 1
- 1
BPASmartClient.Device/BPASmartClient.Device.csproj Wyświetl plik

@@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BPA.Message" Version="1.0.45" />
<PackageReference Include="BPA.Message" Version="1.0.46" />
</ItemGroup>

<ItemGroup>


+ 1
- 1
BPASmartClient.Model/BPASmartClient.Model.csproj Wyświetl plik

@@ -17,7 +17,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="BPA.Message" Version="1.0.45" />
<PackageReference Include="BPA.Message" Version="1.0.46" />
<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" />
</ItemGroup>



+ 1
- 1
DosingSystem/BPASmartClient.DosingSystem.csproj Wyświetl plik

@@ -15,7 +15,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="BPA.Message" Version="1.0.45" />
<PackageReference Include="BPA.Message" Version="1.0.46" />
<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>


+ 6
- 1
FryPot_DosingSystem/Helper/HubHelper.cs Wyświetl plik

@@ -20,7 +20,12 @@ namespace FryPot_DosingSystem.Helper
hubConnection = new HubConnectionBuilder().WithAutomaticReconnect().WithUrl("http://localhost:5175/personhub").Build();//连接


hubConnection.On<string>("", (s) =>
hubConnection.On<object>("Report", (s) =>
{
//注册接收消息的委托
});

hubConnection.On<object>("Upstreamrequest", (s) =>
{
//注册接收消息的委托
});


Ładowanie…
Anuluj
Zapisz