1、添加四向车接口
2、添加下发任务逻辑
This commit is contained in:
parent
b5e175f497
commit
2010caa685
83
WcsMain/ApiClient/DataEntity/AGVEntity/AGVBucketMove.cs
Normal file
83
WcsMain/ApiClient/DataEntity/AGVEntity/AGVBucketMove.cs
Normal file
|
|
@ -0,0 +1,83 @@
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace WcsMain.ApiClient.DataEntity.AGVEntity;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// AGV 点对点货架搬运
|
||||||
|
/// </summary>
|
||||||
|
public class AGVBucketMove
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 起始点
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("startPoint")]
|
||||||
|
public string? StartPoint { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 起始点简码
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("startPointName")]
|
||||||
|
public string? StartPointName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 作业面
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("workFaces")]
|
||||||
|
public string? WorkFaces { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 目标区域
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("endArea")]
|
||||||
|
public string? EndArea { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 目标点
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("endPoint")]
|
||||||
|
public string? EndPoint { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 目标点简码
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("endPointName")]
|
||||||
|
public string? EndPointName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 货架类型编码
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("buckTypeCode")]
|
||||||
|
public string? BucketTypeCode { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("letDownFlag")]
|
||||||
|
public int? LetDownFlag { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否需要检验货架
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("checkCode")]
|
||||||
|
public int? CheckCode { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 实操反馈后是否需要返库
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("needReset")]
|
||||||
|
public bool? NeedReset { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否需要货架出厂
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("needOut")]
|
||||||
|
public int? NeedOut { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否AGV接力模式
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("isAgvRelay")]
|
||||||
|
public bool? IsAgvRelay { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
63
WcsMain/ApiClient/DataEntity/AGVEntity/AGVRequestLayout.cs
Normal file
63
WcsMain/ApiClient/DataEntity/AGVEntity/AGVRequestLayout.cs
Normal file
|
|
@ -0,0 +1,63 @@
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace WcsMain.ApiClient.DataEntity.AGVEntity;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// AGV 接口请求数据格式
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T"></typeparam>
|
||||||
|
public class AGVRequestLayout<T> where T : class, new()
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 头部
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("header")]
|
||||||
|
public AGVRequestHeader? Header { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 数据
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("body")]
|
||||||
|
public T? Body { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// AGV 报文请求头
|
||||||
|
/// </summary>
|
||||||
|
public class AGVRequestHeader
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 快仓唯一标识
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("appKey")]
|
||||||
|
public string? AppKey { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 应用密钥
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("appSecret")]
|
||||||
|
public string? AppSecret { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 请求ID
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("requestId")]
|
||||||
|
public string? RequestId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 时间戳
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("timestamp")]
|
||||||
|
public string? TimeStamp { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 版本号
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("version")]
|
||||||
|
public string? version { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
88
WcsMain/ApiClient/DataEntity/AGVEntity/AGVResponseLayout.cs
Normal file
88
WcsMain/ApiClient/DataEntity/AGVEntity/AGVResponseLayout.cs
Normal file
|
|
@ -0,0 +1,88 @@
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace WcsMain.ApiClient.DataEntity.AGVEntity;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// AGV 接口响应数据模板类
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T"></typeparam>
|
||||||
|
public class AGVResponseLayout<T> where T : class, new()
|
||||||
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 头部
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("header")]
|
||||||
|
public AGVResponseHeader? Header { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 数据
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("body")]
|
||||||
|
public AGVResponseBody<T>? Body { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// AGV 报文响应头
|
||||||
|
/// </summary>
|
||||||
|
public class AGVResponseHeader
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 请求ID
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("requestId")]
|
||||||
|
public string? RequestId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 时间戳
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("timestamp")]
|
||||||
|
public string? TimeStamp { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 版本号
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("version")]
|
||||||
|
public string? version { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// AGV 响应体
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T"></typeparam>
|
||||||
|
public class AGVResponseBody<T> where T : class, new()
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 是否成功
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("success")]
|
||||||
|
public bool? Success { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 条码
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("code")]
|
||||||
|
public string? Code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 响应信息
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("message")]
|
||||||
|
public string? Message { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 响应数据
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("data")]
|
||||||
|
public T? Data { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
108
WcsMain/ApiClient/DataEntity/AGVEntity/AGVTaskRequest.cs
Normal file
108
WcsMain/ApiClient/DataEntity/AGVEntity/AGVTaskRequest.cs
Normal file
|
|
@ -0,0 +1,108 @@
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace WcsMain.ApiClient.DataEntity.AGVEntity;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 向 AGV 发送任务模板数据
|
||||||
|
/// </summary>
|
||||||
|
public class AGVTaskRequest<T> where T : class, new()
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 上游任务号,唯一标识
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("robotJobId")]
|
||||||
|
public string? RobotJobId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 仓库编号
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("warehouseId")]
|
||||||
|
public long? WareHouseId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 任务组号
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("robotJobGroupId")]
|
||||||
|
public string? RobotJobGroupId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 任务组序号
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("sequence")]
|
||||||
|
public int? Sequence { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 任务组数量
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("robotJobGroupNum")]
|
||||||
|
public int? RobotJobGroupNum { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 任务优先级
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("jobPriority")]
|
||||||
|
public int? JobPriority { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 任务优先级类型
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("jobProorytyType")]
|
||||||
|
public int? JobProorytyType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 截至时间
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("deadline")]
|
||||||
|
public string? Deadline { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 任务类型
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("agvType")]
|
||||||
|
public string? AGVType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// AGV 放下对象后移动的地点
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("agvEndPoint")]
|
||||||
|
public string? AGVEndPoint { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否需要实操
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("needOperation")]
|
||||||
|
public bool? NeedOperation { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 机器人编号
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("agvCode")]
|
||||||
|
public string? AGVCode { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 任务解锁倒计时
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("taskCountDown")]
|
||||||
|
public int? TaskCountDown { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 业务类型
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("businessType")]
|
||||||
|
public string? BusinessType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 任务类型
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("jobType")]
|
||||||
|
public string? JobType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 任务数据
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("jobData")]
|
||||||
|
public T? JobData { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
29
WcsMain/ApiClient/DataEntity/AGVEntity/AGVTaskResponse.cs
Normal file
29
WcsMain/ApiClient/DataEntity/AGVEntity/AGVTaskResponse.cs
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace WcsMain.ApiClient.DataEntity.AGVEntity;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 给AGV发送任务的返回类
|
||||||
|
/// </summary>
|
||||||
|
public class AGVTaskResponse
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 响应码
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("code")]
|
||||||
|
public string? Code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 响应信息
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("message")]
|
||||||
|
public string? Message { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 任务号
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("robotJobId")]
|
||||||
|
public string? RobotJobId { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
namespace WcsMain.ApiClient.DataEntity.ContainerEntity;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 四向车库的响应
|
||||||
|
/// </summary>
|
||||||
|
public class ContainerTaskResponse
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 响应码
|
||||||
|
/// </summary>
|
||||||
|
public string? Code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// WMS 任务号
|
||||||
|
/// </summary>
|
||||||
|
public string? WmsTaskId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 信息
|
||||||
|
/// </summary>
|
||||||
|
public string? Message { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,53 @@
|
||||||
|
namespace WcsMain.ApiClient.DataEntity.ContainerEntity;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 四向车库出库移库请求
|
||||||
|
/// </summary>
|
||||||
|
public class ContainerTaskResqust
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 请求ID
|
||||||
|
/// </summary>
|
||||||
|
public string? RequestId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 密钥
|
||||||
|
/// </summary>
|
||||||
|
public string? Key { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// WMS 任务号
|
||||||
|
/// </summary>
|
||||||
|
public string? WmsTaskId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 载具号
|
||||||
|
/// </summary>
|
||||||
|
public string? PalletNo { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 起始位置
|
||||||
|
/// </summary>
|
||||||
|
public string? FromCellNo { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 目标位置
|
||||||
|
/// </summary>
|
||||||
|
public string? ToCell { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 任务类型
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// 2 - 出库
|
||||||
|
/// 3 - 移库
|
||||||
|
/// </remarks>
|
||||||
|
public string? TaskType { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
20
WcsMain/ApiServe/Controllers/AGVController/AGVController.cs
Normal file
20
WcsMain/ApiServe/Controllers/AGVController/AGVController.cs
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using WcsMain.ApiServe.ControllerFilter;
|
||||||
|
|
||||||
|
namespace WcsMain.ApiServe.Controllers.AGVController;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// AGV接口服务
|
||||||
|
/// </summary>
|
||||||
|
[Route("api/agv")]
|
||||||
|
[ApiController]
|
||||||
|
[ServiceFilter<ResponseFilterAttribute>]
|
||||||
|
public class AGVController : ControllerBase
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using WcsMain.ApiServe.ControllerFilter;
|
||||||
|
using WcsMain.ApiServe.Controllers.Dto.Container;
|
||||||
|
using WcsMain.ApiServe.Service.ContainerService;
|
||||||
|
|
||||||
|
namespace WcsMain.ApiServe.Controllers.ContainerController;
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 提供给四向车的API接口
|
||||||
|
/// </summary>
|
||||||
|
[Route("api/container")]
|
||||||
|
[ApiController]
|
||||||
|
[ServiceFilter<ResponseFilterAttribute>]
|
||||||
|
public class ContainerController(ContainerService containerService) : ControllerBase
|
||||||
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 四向车请求入库任务
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost("CreateInstoreTask")]
|
||||||
|
public CreateInstoreTaskResoponse CreateInstoreTask([FromBody] CreateInstoreTaskRequest request) => containerService.CreateInstoreTask(request);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 四向车上报任务状态
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost("TaskStateNotice")]
|
||||||
|
public TaskStateNoticeResponse TaskStateNotice([FromBody] TaskStateNoticeRequest request) => containerService.TaskStateNotice(request);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace WcsMain.ApiServe.Controllers.Dto.Container;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 四向车请求入库任务的请求类
|
||||||
|
/// </summary>
|
||||||
|
public class CreateInstoreTaskRequest
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 请求ID
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("requestId")]
|
||||||
|
public string? RequestId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 密钥
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("key")]
|
||||||
|
public string? Key { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 载具号
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("palletno")]
|
||||||
|
public string? PalleetNo { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 请求位置
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("fromcellno")]
|
||||||
|
public string? FormCellNo { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,50 @@
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace WcsMain.ApiServe.Controllers.Dto.Container;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 四向车请求任务的返回类
|
||||||
|
/// </summary>
|
||||||
|
public class CreateInstoreTaskResoponse
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 响应码
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("code")]
|
||||||
|
public string? Code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 任务号
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("wmstaskid")]
|
||||||
|
public string? WmsTaskId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 载具号
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("palletno")]
|
||||||
|
public string? PalletNo { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 起点位置
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("fromcellno")]
|
||||||
|
public string? FromCellNo { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 终点位置
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("tocellno")]
|
||||||
|
public string? ToCellNo { get;set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 响应信息
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("message")]
|
||||||
|
public string? Message { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,52 @@
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace WcsMain.ApiServe.Controllers.Dto.Container;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 四向车任务回告请求类
|
||||||
|
/// </summary>
|
||||||
|
public class TaskStateNoticeRequest
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 请求ID
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("requestid")]
|
||||||
|
public string? RequestId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 密钥
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("key")]
|
||||||
|
public string? Key { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// WMS任务号
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("wmstaskid")]
|
||||||
|
public string? WmsTaskId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 最终到达位置
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("factendcell")]
|
||||||
|
public string? FactendCell { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 任务状态
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// 20 - 完成
|
||||||
|
/// 21 - 取消
|
||||||
|
/// </remarks>
|
||||||
|
[JsonPropertyName("taskstate")]
|
||||||
|
public string? TaskState { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace WcsMain.ApiServe.Controllers.Dto.Container;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 四向车反馈任务状态的响应类
|
||||||
|
/// </summary>
|
||||||
|
public class TaskStateNoticeResponse
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 响应码
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("code")]
|
||||||
|
public string? Code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// WMS 任务号
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("wmstaskid")]
|
||||||
|
public string? WmsTaskId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 响应信息
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("message")]
|
||||||
|
public string? Message { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,88 @@
|
||||||
|
using WcsMain.ApiClient.DataEntity.WmsEntity;
|
||||||
|
using WcsMain.ApiServe.Controllers.Dto.Container;
|
||||||
|
using WcsMain.Business.CommonAction;
|
||||||
|
using WcsMain.Common;
|
||||||
|
using WcsMain.DataBase.Dao;
|
||||||
|
using WcsMain.DataBase.TableEntity;
|
||||||
|
using WcsMain.Enum;
|
||||||
|
using WcsMain.Enum.Stacker;
|
||||||
|
using WcsMain.Plugins;
|
||||||
|
using WcsMain.WcsAttribute.AutoFacAttribute;
|
||||||
|
|
||||||
|
namespace WcsMain.ApiServe.Service.ContainerService;
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
public class ContainerService(AppWmsTaskDao wmsTaskDao, WCSTaskExecuteEvent taskExecuteEvent)
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 请求四向车任务
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public CreateInstoreTaskResoponse CreateInstoreTask(CreateInstoreTaskRequest request)
|
||||||
|
{
|
||||||
|
ConsoleLog.Info($"四向车请求载具入库:{request.PalleetNo},入库点位:{request.FormCellNo}");
|
||||||
|
if (string.IsNullOrEmpty(request.FormCellNo) || string.IsNullOrEmpty(request.PalleetNo))
|
||||||
|
{
|
||||||
|
return new() { Code = "400", Message = "缺少必须参数" };
|
||||||
|
}
|
||||||
|
List<AppWmsTask>? wmsTasks = wmsTaskDao.Select(new() { VehicleNo = request.PalleetNo, TaskStatus = (int)WmsTaskStatusEnum.arriveMid })?.OrderByDescending(o => o.CreateTime).ToList();
|
||||||
|
if(wmsTasks == null)
|
||||||
|
{
|
||||||
|
return new() { Code = "400", Message = "数据连接失败,请重试" };
|
||||||
|
}
|
||||||
|
if(wmsTasks.Count == 0)
|
||||||
|
{
|
||||||
|
return new() { Code = "400", Message = "该载具暂无待执行的任务" };
|
||||||
|
}
|
||||||
|
AppWmsTask wmsTask = wmsTasks.First();
|
||||||
|
/* 更新状态为前往终点 */
|
||||||
|
var updateResult = wmsTaskDao.Update(new() { TaskId = wmsTask.TaskId, TaskStatus = (int)WmsTaskStatusEnum.toMid, ModifyTime = DateTime.Now });
|
||||||
|
ConsoleLog.Success($"API更新任务状态结果:{(updateResult > 0 ? "成功" : "失败")},任务号:{wmsTask.TaskId}");
|
||||||
|
return new()
|
||||||
|
{
|
||||||
|
Code = "200",
|
||||||
|
Message = "操作成功",
|
||||||
|
WmsTaskId = wmsTask.TaskId,
|
||||||
|
PalletNo = wmsTask.VehicleNo,
|
||||||
|
FromCellNo = request.FormCellNo,
|
||||||
|
ToCellNo = wmsTask.Destination,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 四向车任务反馈
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public TaskStateNoticeResponse TaskStateNotice(TaskStateNoticeRequest request)
|
||||||
|
{
|
||||||
|
if(string.IsNullOrEmpty(request.TaskState) || string.IsNullOrEmpty(request.WmsTaskId) || string.IsNullOrEmpty(request.FactendCell))
|
||||||
|
{
|
||||||
|
return new() { Code = "400", Message = "缺少必须的参数" };
|
||||||
|
}
|
||||||
|
List<AppWmsTask>? appWmsTasks = wmsTaskDao.Select(new() { TaskId = request.WmsTaskId });
|
||||||
|
if(appWmsTasks == null)
|
||||||
|
{
|
||||||
|
return new() { Code = "400", Message = "数据连接异常,请稍后再试" };
|
||||||
|
}
|
||||||
|
if (appWmsTasks.Count < 1)
|
||||||
|
{
|
||||||
|
return new() { Code = "400", Message = $"该任务号不存在:{request.WmsTaskId}" };
|
||||||
|
}
|
||||||
|
AppWmsTask wmsTask = appWmsTasks.First();
|
||||||
|
if (wmsTask.TaskType == (int)WmsTaskTypeEnum.inTask || wmsTask.TaskType == (int)WmsTaskTypeEnum.moveTask)
|
||||||
|
{
|
||||||
|
/* 入库/移库 完成需要反馈WMS任务完成,更新任务状态为完成 */
|
||||||
|
string? errText = taskExecuteEvent.CompleteTaskEvent(wmsTask, "四向车上报完成", request.FactendCell);
|
||||||
|
return new() { Code = string.IsNullOrEmpty(errText) ? "200" : "400", Message = string.IsNullOrEmpty(errText) ? "成功" : errText, WmsTaskId = request.WmsTaskId };
|
||||||
|
}
|
||||||
|
if(wmsTask.TaskType == (int)WmsTaskTypeEnum.outTask)
|
||||||
|
{
|
||||||
|
/* 更新任务状态为到达中间点 */
|
||||||
|
int updateResult = wmsTaskDao.Update(new() { TaskId = wmsTask.TaskId, TaskStatus = (int)WmsTaskStatusEnum.arriveMid, ModifyTime = DateTime.Now });
|
||||||
|
return new() { Code = updateResult > 0 ? "200" : "400", Message = updateResult > 0 ? "成功" : "数据异常", WmsTaskId = request.WmsTaskId };
|
||||||
|
}
|
||||||
|
return new() { Code = "400", Message = $"该任务不支持的类型:{request.WmsTaskId}" };
|
||||||
|
}
|
||||||
|
}
|
||||||
135
WcsMain/Business/AGV/AGVAction.cs
Normal file
135
WcsMain/Business/AGV/AGVAction.cs
Normal file
|
|
@ -0,0 +1,135 @@
|
||||||
|
using WcsMain.ApiClient.DataEntity.AGVEntity;
|
||||||
|
using WcsMain.Common;
|
||||||
|
using WcsMain.Constant;
|
||||||
|
using WcsMain.DataBase.TableEntity;
|
||||||
|
using WcsMain.Plugins;
|
||||||
|
using WcsMain.ExtendMethod;
|
||||||
|
using WcsMain.WcsAttribute.AutoFacAttribute;
|
||||||
|
|
||||||
|
namespace WcsMain.Business.AGV;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// AGV 动作
|
||||||
|
/// </summary>
|
||||||
|
[Component]
|
||||||
|
public class AGVAction(AGVWebApiPost webApiPost)
|
||||||
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 发送点对点搬运的任务
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="wmsTask"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string Send_NO_VERIFY_BUCKET_MOVE(AppWmsTask wmsTask)
|
||||||
|
{
|
||||||
|
AGVRequestLayout<AGVTaskRequest<AGVBucketMove>> request = new()
|
||||||
|
{
|
||||||
|
Header = new()
|
||||||
|
{
|
||||||
|
AppKey = ApplicationBaseConfig.APP_KEY,
|
||||||
|
AppSecret = ApplicationBaseConfig.APP_SECRET,
|
||||||
|
RequestId = wmsTask.TaskId,
|
||||||
|
TimeStamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||||
|
version = "2.9"
|
||||||
|
},
|
||||||
|
Body = new()
|
||||||
|
{
|
||||||
|
RobotJobId = wmsTask.TaskId,
|
||||||
|
WareHouseId = 100,
|
||||||
|
RobotJobGroupId = wmsTask.TaskId,
|
||||||
|
Sequence = 1,
|
||||||
|
RobotJobGroupNum = 1,
|
||||||
|
JobPriority = 1,
|
||||||
|
JobProorytyType = 0,
|
||||||
|
JobType = "NO_VERIFY_BUCKET_MOVE",
|
||||||
|
JobData = new()
|
||||||
|
{
|
||||||
|
StartPoint = wmsTask.Origin,
|
||||||
|
StartPointName = null,
|
||||||
|
WorkFaces = "0",
|
||||||
|
EndArea = wmsTask.Destination,
|
||||||
|
EndPoint = wmsTask.Destination,
|
||||||
|
EndPointName = null,
|
||||||
|
BucketTypeCode = "00",
|
||||||
|
LetDownFlag = 2,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var response = webApiPost.HttpPost<AGVRequestLayout<AGVTaskRequest<AGVBucketMove>>, AGVResponseLayout<AGVTaskResponse>>(request, CommonData.AppApiBaseInfos.GetAddress("AGV_NO_VERIFY_BUCKET_MOVE") ?? "");
|
||||||
|
var responseData = response.ResponseEntity;
|
||||||
|
if (!response.IsSend || responseData == null)
|
||||||
|
{
|
||||||
|
return "请求失败,网络故障";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (responseData.Body!.Success == true && responseData.Body!.Code?.ToLower() == "success")
|
||||||
|
{
|
||||||
|
// 发送成功
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
return responseData.Body.Message ?? "请求失败,未知原因";
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 发送AGV任务
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="taskId"></param>
|
||||||
|
/// <param name="origin"></param>
|
||||||
|
/// <param name="destination"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string Send_AGV_TASK(string? taskId, string? origin, string? destination)
|
||||||
|
{
|
||||||
|
AGVRequestLayout<AGVTaskRequest<AGVBucketMove>> request = new()
|
||||||
|
{
|
||||||
|
Header = new()
|
||||||
|
{
|
||||||
|
AppKey = ApplicationBaseConfig.APP_KEY,
|
||||||
|
AppSecret = ApplicationBaseConfig.APP_SECRET,
|
||||||
|
RequestId = taskId,
|
||||||
|
TimeStamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||||
|
version = "2.9"
|
||||||
|
},
|
||||||
|
Body = new()
|
||||||
|
{
|
||||||
|
RobotJobId = taskId,
|
||||||
|
WareHouseId = 100,
|
||||||
|
RobotJobGroupId = taskId,
|
||||||
|
Sequence = 1,
|
||||||
|
RobotJobGroupNum = 1,
|
||||||
|
JobPriority = 1,
|
||||||
|
JobProorytyType = 0,
|
||||||
|
JobType = "NO_VERIFY_BUCKET_MOVE",
|
||||||
|
JobData = new()
|
||||||
|
{
|
||||||
|
StartPoint = origin,
|
||||||
|
StartPointName = null,
|
||||||
|
WorkFaces = "0",
|
||||||
|
EndArea = destination,
|
||||||
|
EndPoint = destination,
|
||||||
|
EndPointName = null,
|
||||||
|
BucketTypeCode = "00",
|
||||||
|
LetDownFlag = 2,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var response = webApiPost.HttpPost<AGVRequestLayout<AGVTaskRequest<AGVBucketMove>>, AGVResponseLayout<AGVTaskResponse>>(request, CommonData.AppApiBaseInfos.GetAddress("AGV_NO_VERIFY_BUCKET_MOVE") ?? "");
|
||||||
|
var responseData = response.ResponseEntity;
|
||||||
|
if (!response.IsSend || responseData == null)
|
||||||
|
{
|
||||||
|
return "请求失败,网络故障";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (responseData.Body!.Success == true && responseData.Body!.Code?.ToLower() == "success")
|
||||||
|
{
|
||||||
|
// 发送成功
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
return responseData.Body.Message ?? "请求失败,未知原因";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,9 +1,254 @@
|
||||||
namespace WcsMain.Business.CirculationTask.Stacker;
|
using CirculateTool.Attribute;
|
||||||
|
using WcsMain.ApiClient.DataEntity.AGVEntity;
|
||||||
|
using WcsMain.Business.AGV;
|
||||||
|
using WcsMain.Business.CommonAction;
|
||||||
|
using WcsMain.Business.Container;
|
||||||
|
using WcsMain.Constant;
|
||||||
|
using WcsMain.DataBase.Dao;
|
||||||
|
using WcsMain.DataBase.TableEntity;
|
||||||
|
using WcsMain.Enum.General;
|
||||||
|
using WcsMain.Enum.Stacker;
|
||||||
|
using WcsMain.EquipOperation.StackerConvey;
|
||||||
|
|
||||||
|
namespace WcsMain.Business.CirculationTask.Stacker;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 执行立体仓库任务
|
/// 执行仓库任务
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class ExecuteWmsTask
|
[Circulation]
|
||||||
|
public class ExecuteWmsTask(AppWmsTaskDao wmsTaskDao, StackerConveyOperation stackerConveyOperation, AGVAction agvAction, ContainerAction containerAction, AppLiftInfoDao liftInfoDao)
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 开始执行任务
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[Circulation("执行任务", 1000)]
|
||||||
|
public bool ExecuteWmsTaskStarter()
|
||||||
|
{
|
||||||
|
/* 执行任务列表任务 */
|
||||||
|
List<AppWmsTask>? wmsTasks = wmsTaskDao.Select(new AppWmsTask() { TaskStatus = (int)WmsTaskStatusEnum.create });
|
||||||
|
if(wmsTasks == default)
|
||||||
|
{
|
||||||
|
ConsoleLog.Error("【异常】解析Wms任务时拉取任务列表失败,与数据库连接中断");
|
||||||
|
Thread.Sleep(5000);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
wmsTasks.ForEach(ExecuteTask);
|
||||||
|
/* 出库站台发送AGV接续任务 */
|
||||||
|
ExecuteAGVOutTask();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 执行对应的任务
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="wmsTask"></param>
|
||||||
|
private void ExecuteTask(AppWmsTask wmsTask)
|
||||||
|
{
|
||||||
|
switch (wmsTask.TaskType)
|
||||||
|
{
|
||||||
|
case (int)WmsTaskTypeEnum.agv: // AGV 点对点搬运
|
||||||
|
ExecuteAGVTask(wmsTask);
|
||||||
|
break;
|
||||||
|
case (int)WmsTaskTypeEnum.outTask:
|
||||||
|
ExecuteOutTask(wmsTask);
|
||||||
|
break;
|
||||||
|
case (int)WmsTaskTypeEnum.inTask:
|
||||||
|
ExecuteInTask(wmsTask);
|
||||||
|
break;
|
||||||
|
case (int)WmsTaskTypeEnum.moveTask:
|
||||||
|
ExecuteMoveTask(wmsTask);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 执行 AGV 任务
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="wmsTask"></param>
|
||||||
|
private void ExecuteAGVTask(AppWmsTask wmsTask)
|
||||||
|
{
|
||||||
|
string errText = agvAction.Send_NO_VERIFY_BUCKET_MOVE(wmsTask);
|
||||||
|
if(!string.IsNullOrEmpty(errText))
|
||||||
|
{
|
||||||
|
ConsoleLog.Warning($"【警告】AGV点对点搬运请求AGV服务失败,任务号:{wmsTask.TaskId},异常信息:{errText}");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ConsoleLog.Success($"AGV点对点搬运请求AGV服务成功,任务号:{wmsTask.TaskId}");
|
||||||
|
/* 更新任务状态为执行中 */
|
||||||
|
var updateResult = wmsTaskDao.Update(new() { TaskId = wmsTask.TaskId, TaskStatus = (int)WmsTaskStatusEnum.running, ModifyTime = DateTime.Now });
|
||||||
|
ConsoleLog.Success($"更新任务状态结果:{(updateResult > 0 ? "成功" : "失败")},任务号:{wmsTask.TaskId}");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 执行入库任务
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="wmsTask"></param>
|
||||||
|
private void ExecuteInTask(AppWmsTask wmsTask)
|
||||||
|
{
|
||||||
|
string? midPoint = GetEmptyInLift(wmsTask.Destination);
|
||||||
|
if (string.IsNullOrEmpty(midPoint)) return; // 没有可用的站台
|
||||||
|
/* 发送AGV 搬运任务 */
|
||||||
|
string errText = agvAction.Send_AGV_TASK(wmsTask.TaskId, wmsTask.Origin, midPoint);
|
||||||
|
if (!string.IsNullOrEmpty(errText))
|
||||||
|
{
|
||||||
|
ConsoleLog.Warning($"【警告】入库请求AGV搬运失败,任务号:{wmsTask.TaskId},异常信息:{errText}");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ConsoleLog.Success($"入库搬运请求AGV成功,任务号:{wmsTask.TaskId}");
|
||||||
|
/* 更新任务状态为前往中间点,更新中间点 */
|
||||||
|
var updateResult = wmsTaskDao.Update(new() { TaskId = wmsTask.TaskId, MidPoint = midPoint, TaskStatus = (int)WmsTaskStatusEnum.toMid, ModifyTime = DateTime.Now });
|
||||||
|
ConsoleLog.Success($"更新任务状态结果:{(updateResult > 0 ? "成功" : "失败")},任务号:{wmsTask.TaskId}");
|
||||||
|
/* 四向车任务有接口返回给四向车 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 执行出库任务
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="wmsTask"></param>
|
||||||
|
private void ExecuteOutTask(AppWmsTask wmsTask)
|
||||||
|
{
|
||||||
|
string? midPoint = GetEmptyOutLift(wmsTask.Origin);
|
||||||
|
if(string.IsNullOrEmpty(midPoint)) return; // 没有可用站台
|
||||||
|
/* 发送四向车搬运任务 */
|
||||||
|
string? errText = containerAction.ExecuteOutTask(wmsTask.TaskId, wmsTask.Origin, midPoint, wmsTask.VehicleNo);
|
||||||
|
if (!string.IsNullOrEmpty(errText))
|
||||||
|
{
|
||||||
|
ConsoleLog.Warning($"【警告】入库请求四向车搬运失败,任务号:{wmsTask.TaskId},异常信息:{errText}");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ConsoleLog.Success($"入库搬运请求四向车成功,任务号:{wmsTask.TaskId}");
|
||||||
|
/* 更新任务状态为前往中间点,更新中间点 */
|
||||||
|
var updateResult = wmsTaskDao.Update(new() { TaskId = wmsTask.TaskId, MidPoint = midPoint, TaskStatus = (int)WmsTaskStatusEnum.toMid, ModifyTime = DateTime.Now });
|
||||||
|
ConsoleLog.Success($"更新任务状态结果:{(updateResult > 0 ? "成功" : "失败")},任务号:{wmsTask.TaskId}");
|
||||||
|
/* AGV接续任务由定时器触发 */
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 执行 四向车库移库任务
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="wmsTask"></param>
|
||||||
|
private void ExecuteMoveTask(AppWmsTask wmsTask)
|
||||||
|
{
|
||||||
|
string errText = containerAction.ExecuteMoveTask(wmsTask);
|
||||||
|
if (!string.IsNullOrEmpty(errText))
|
||||||
|
{
|
||||||
|
ConsoleLog.Warning($"四向车移库任务请求四向车服务失败,任务号:{wmsTask.TaskId},异常信息:{errText}");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ConsoleLog.Success($"四向车移库任务请求四向车服务成功,任务号:{wmsTask.TaskId}");
|
||||||
|
/* 更新任务状态为执行中 */
|
||||||
|
var updateResult = wmsTaskDao.Update(new() { TaskId = wmsTask.TaskId, TaskStatus = (int)WmsTaskStatusEnum.running, ModifyTime = DateTime.Now });
|
||||||
|
ConsoleLog.Success($"更新任务状态结果:{(updateResult > 0 ? "成功" : "失败")},任务号:{wmsTask.TaskId}");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 执行AGV出库任务
|
||||||
|
/// </summary>
|
||||||
|
private void ExecuteAGVOutTask()
|
||||||
|
{
|
||||||
|
List<AppLiftInfo>? liftInfos = liftInfoDao.Query(new() { Status = (int)TrueFalseEnum.TRUE });
|
||||||
|
if (liftInfos == default || liftInfos.Count < 1) return;
|
||||||
|
foreach (var liftInfo in liftInfos)
|
||||||
|
{
|
||||||
|
(string errText, short model, short allowAction, short errCode, string code) = stackerConveyOperation.GetLiftInfo(liftInfo.LiftId ?? "");
|
||||||
|
if (!string.IsNullOrEmpty(errText))
|
||||||
|
{
|
||||||
|
ConsoleLog.Warning($"【警告】提升机站台信息获取失败,异常信息:{errText}");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (model != 2 || allowAction != (short)TrueFalseEnum.TRUE || errCode != 0) continue; // 不满足执行条件
|
||||||
|
/* 查找出库任务 */
|
||||||
|
List<AppWmsTask>? tasks = wmsTaskDao.Select(new() { VehicleNo = code, TaskStatus = (int)WmsTaskStatusEnum.arriveMid })?.OrderByDescending(o => o.CreateTime).ToList();
|
||||||
|
if(tasks == null || tasks.Count == 0) continue;
|
||||||
|
var task = tasks.First();
|
||||||
|
/* 下发任务 */
|
||||||
|
string agvErrText = agvAction.Send_AGV_TASK(task.TaskId, task.MidPoint, task.Destination);
|
||||||
|
if (!string.IsNullOrEmpty(agvErrText))
|
||||||
|
{
|
||||||
|
ConsoleLog.Warning($"【警告】AGV出库任务请求AGV服务失败,任务号:{task.TaskId},异常信息:{agvErrText}");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
/* 更新任务状态为前往终点 */
|
||||||
|
var updateResult = wmsTaskDao.Update(new() { TaskId = task.TaskId, TaskStatus = (int)WmsTaskStatusEnum.toDestination, ModifyTime = DateTime.Now });
|
||||||
|
ConsoleLog.Success($"更新任务状态结果:{(updateResult > 0 ? "成功" : "失败")},任务号:{task.TaskId}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取一个空闲的入库站台
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="destination"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
private string? GetEmptyInLift(string? destination)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(destination)) return default;
|
||||||
|
List<AppLiftInfo>? liftInfos = liftInfoDao.Query(new() { Status = (int)TrueFalseEnum.TRUE });
|
||||||
|
if (liftInfos == default || liftInfos.Count < 1) return default;
|
||||||
|
foreach (var liftInfo in liftInfos)
|
||||||
|
{
|
||||||
|
(string errText, short model, short allowAction, short errCode, string code) = stackerConveyOperation.GetLiftInfo(liftInfo.LiftId ?? "");
|
||||||
|
if(!string.IsNullOrEmpty(errText))
|
||||||
|
{
|
||||||
|
ConsoleLog.Warning($"【警告】提升机站台信息获取失败,异常信息:{errText}");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (model != 1 || allowAction != (short)TrueFalseEnum.TRUE || errCode != 0) continue;
|
||||||
|
/* 检验任务是否是第一层,若是不是第一层不能分配第一层出入口 */
|
||||||
|
if (destination.StartsWith("1")) // [TODO]
|
||||||
|
{
|
||||||
|
if (liftInfo.LiftMode != 2) continue;
|
||||||
|
}
|
||||||
|
/* 获取这个站台的任务.没有占用任务即可重新使用 */
|
||||||
|
List<AppWmsTask>? tasks = wmsTaskDao.Select(new() { MidPoint = liftInfo.Tag, TaskStatus = (int)WmsTaskStatusEnum.toMid });
|
||||||
|
if (tasks == default || tasks.Count > 0) continue;
|
||||||
|
return liftInfo.Tag;
|
||||||
|
}
|
||||||
|
return default;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取一个空闲的出库站台
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="origin"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
private string? GetEmptyOutLift(string? origin)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(origin)) return default;
|
||||||
|
Dictionary<string, int> liftTaskCount = [];
|
||||||
|
List<AppLiftInfo>? liftInfos = liftInfoDao.Query(new() { Status = (int)TrueFalseEnum.TRUE });
|
||||||
|
if (liftInfos == default || liftInfos.Count < 1) return default;
|
||||||
|
foreach (var liftInfo in liftInfos)
|
||||||
|
{
|
||||||
|
(string errText, short model, short allowAction, short errCode, string code) = stackerConveyOperation.GetLiftInfo(liftInfo.LiftId ?? "");
|
||||||
|
if (!string.IsNullOrEmpty(errText))
|
||||||
|
{
|
||||||
|
ConsoleLog.Warning($"【警告】提升机站台信息获取失败,异常信息:{errText}");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (model != 2 || allowAction != (short)TrueFalseEnum.TRUE || errCode != 0) continue;
|
||||||
|
/* 检验任务是否是第一层,若是不是第一层不能分配第一层出入口 */
|
||||||
|
if (origin.StartsWith("1")) // [TODO]
|
||||||
|
{
|
||||||
|
if (liftInfo.LiftMode != 2) continue;
|
||||||
|
}
|
||||||
|
/* 获取这个站台的任务.并计数 */
|
||||||
|
List<AppWmsTask>? tasks = wmsTaskDao.Select(new() { MidPoint = liftInfo.Tag, TaskStatus = (int)WmsTaskStatusEnum.toMid });
|
||||||
|
if (tasks == default) continue;
|
||||||
|
liftTaskCount.TryAdd(liftInfo.Tag ?? "", tasks.Count);
|
||||||
|
}
|
||||||
|
var sortLiftInfos = liftTaskCount.OrderBy(o => o.Value).ToDictionary();
|
||||||
|
if(sortLiftInfos.Count > 0) return sortLiftInfos.First().Key;
|
||||||
|
return default;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,17 +8,17 @@ using WcsMain.WcsAttribute.AutoFacAttribute;
|
||||||
namespace WcsMain.Business.CommonAction;
|
namespace WcsMain.Business.CommonAction;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// WMS 接口响应触发事件
|
/// 接口响应触发事件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Component]
|
[Component]
|
||||||
public class WMSApiResponseAction(DataBaseData dataBaseData, AppApiRequestDao apiRequestDao)
|
public class ApiResponseAction(DataBaseData dataBaseData, AppApiRequestDao apiRequestDao)
|
||||||
{
|
{
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 当请求其他系统时触发本方法
|
/// 当请求其他系统时触发本方法
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="responseInfo"></param>
|
/// <param name="responseInfo"></param>
|
||||||
public void WMSApiResponse(ApiResponseInfo responseInfo)
|
public void ApiResponse(ApiResponseInfo responseInfo)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
@ -255,7 +255,8 @@ public class SendWmsTaskStatus(AppWmsTaskDao wmsTaskDao, WmsWebApiPost wmsWebApi
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="taskId"></param>
|
/// <param name="taskId"></param>
|
||||||
/// <param name="count"></param>
|
/// <param name="count"></param>
|
||||||
public void SendTaskComplete(string? taskId, ushort count = 5)
|
/// <param name="destination"></param>
|
||||||
|
public void SendTaskComplete(string? taskId, ushort count = 5, string? destination = default)
|
||||||
{
|
{
|
||||||
Task.Factory.StartNew(() => {
|
Task.Factory.StartNew(() => {
|
||||||
AppWmsTask? wmsTask = default;
|
AppWmsTask? wmsTask = default;
|
||||||
|
|
@ -280,7 +281,7 @@ public class SendWmsTaskStatus(AppWmsTaskDao wmsTaskDao, WmsWebApiPost wmsWebApi
|
||||||
{
|
{
|
||||||
TaskId = wmsTask.TaskId,
|
TaskId = wmsTask.TaskId,
|
||||||
TaskStatus = (int)SendWmsTaskStatusEnum.complete,
|
TaskStatus = (int)SendWmsTaskStatusEnum.complete,
|
||||||
Destination = wmsTask.Destination,
|
Destination = destination ?? wmsTask.Destination,
|
||||||
VehicleNo = wmsTask.VehicleNo,
|
VehicleNo = wmsTask.VehicleNo,
|
||||||
Message = "任务完成"
|
Message = "任务完成"
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -108,6 +108,9 @@ public class WCSTaskExecuteEvent(TaskDao taskDao, SendWmsTaskStatus sendWmsTaskS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void HandleTaskData(AppWcsTask task, string msg)
|
private void HandleTaskData(AppWcsTask task, string msg)
|
||||||
{
|
{
|
||||||
string errMsg = taskDao.ComlpeteTask(task, msg);
|
string errMsg = taskDao.ComlpeteTask(task, msg);
|
||||||
|
|
@ -143,5 +146,29 @@ public class WCSTaskExecuteEvent(TaskDao taskDao, SendWmsTaskStatus sendWmsTaskS
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
#region WMS 任务完成时触发
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// WMS任务完成时触发
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="task"></param>
|
||||||
|
/// <param name="msg"></param>
|
||||||
|
/// <param name="destination"></param>
|
||||||
|
public string? CompleteTaskEvent(AppWmsTask task, string msg, string? destination)
|
||||||
|
{
|
||||||
|
/* 更新任务信息,任务完成 */
|
||||||
|
string? errText = taskDao.ComlpeteTask(task, msg);
|
||||||
|
if (!string.IsNullOrEmpty(errText))
|
||||||
|
{
|
||||||
|
ConsoleLog.Warning($"【异常】任务完成更新WMS任务状态失败,异常信息:{errText}");
|
||||||
|
}
|
||||||
|
/* 上报WMS */
|
||||||
|
sendWmsTaskStatus.SendTaskComplete(task.TaskId, destination: destination);
|
||||||
|
return errText;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
80
WcsMain/Business/Container/ContainerAction.cs
Normal file
80
WcsMain/Business/Container/ContainerAction.cs
Normal file
|
|
@ -0,0 +1,80 @@
|
||||||
|
using WcsMain.ApiClient.DataEntity.ContainerEntity;
|
||||||
|
using WcsMain.Common;
|
||||||
|
using WcsMain.DataBase.TableEntity;
|
||||||
|
using WcsMain.Plugins;
|
||||||
|
using WcsMain.ExtendMethod;
|
||||||
|
using WcsMain.WcsAttribute.AutoFacAttribute;
|
||||||
|
|
||||||
|
namespace WcsMain.Business.Container;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 四向车库
|
||||||
|
/// </summary>
|
||||||
|
[Component]
|
||||||
|
public class ContainerAction(ContainerWebApiPost webApiPost)
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 四向车库执行移库任务
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="wmsTask"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string ExecuteMoveTask(AppWmsTask wmsTask)
|
||||||
|
{
|
||||||
|
ContainerTaskResqust containerTaskResqust = new()
|
||||||
|
{
|
||||||
|
RequestId = Guid.NewGuid().ToString(),
|
||||||
|
Key = "",
|
||||||
|
WmsTaskId = wmsTask.TaskId,
|
||||||
|
FromCellNo = wmsTask.Origin,
|
||||||
|
TaskType = "3",
|
||||||
|
ToCell = wmsTask.Destination,
|
||||||
|
PalletNo = wmsTask.VehicleNo
|
||||||
|
};
|
||||||
|
var response = webApiPost.HttpPost<ContainerTaskResqust, ContainerTaskResponse>(containerTaskResqust, CommonData.AppApiBaseInfos.GetAddress("ContainerOutMoveApiAddress") ?? "");
|
||||||
|
var responseData = response.ResponseEntity;
|
||||||
|
if(!response.IsSend || responseData == null)
|
||||||
|
{
|
||||||
|
return "请求失败,网络故障";
|
||||||
|
}
|
||||||
|
if(responseData.Code == "200")
|
||||||
|
{
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
return responseData.Message ?? "请求失败,未知异常";
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 发送出库任务
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="taskId"></param>
|
||||||
|
/// <param name="origin"></param>
|
||||||
|
/// <param name="destination"></param>
|
||||||
|
/// <param name="vehicleNo"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string ExecuteOutTask(string? taskId, string? origin, string? destination, string? vehicleNo)
|
||||||
|
{
|
||||||
|
ContainerTaskResqust containerTaskResqust = new()
|
||||||
|
{
|
||||||
|
RequestId = Guid.NewGuid().ToString(),
|
||||||
|
Key = "",
|
||||||
|
WmsTaskId = taskId,
|
||||||
|
FromCellNo = origin,
|
||||||
|
TaskType = "2",
|
||||||
|
ToCell = destination,
|
||||||
|
PalletNo = vehicleNo
|
||||||
|
};
|
||||||
|
var response = webApiPost.HttpPost<ContainerTaskResqust, ContainerTaskResponse>(containerTaskResqust, CommonData.AppApiBaseInfos.GetAddress("ContainerOutMoveApiAddress") ?? "");
|
||||||
|
var responseData = response.ResponseEntity;
|
||||||
|
if (!response.IsSend || responseData == null)
|
||||||
|
{
|
||||||
|
return "请求失败,网络故障";
|
||||||
|
}
|
||||||
|
if (responseData.Code == "200")
|
||||||
|
{
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
return responseData.Message ?? "请求失败,未知异常";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
14
WcsMain/Constant/ApplicationBaseConfig.cs
Normal file
14
WcsMain/Constant/ApplicationBaseConfig.cs
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
namespace WcsMain.Constant;
|
||||||
|
|
||||||
|
public class ApplicationBaseConfig
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// AGV
|
||||||
|
/// </summary>
|
||||||
|
public const string APP_KEY = "app";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// AGV
|
||||||
|
/// </summary>
|
||||||
|
public const string APP_SECRET = "";
|
||||||
|
}
|
||||||
39
WcsMain/DataBase/Dao/AppLiftInfoDao.cs
Normal file
39
WcsMain/DataBase/Dao/AppLiftInfoDao.cs
Normal file
|
|
@ -0,0 +1,39 @@
|
||||||
|
using WcsMain.Common;
|
||||||
|
using WcsMain.DataBase.TableEntity;
|
||||||
|
using WcsMain.WcsAttribute.AutoFacAttribute;
|
||||||
|
|
||||||
|
namespace WcsMain.DataBase.Dao;
|
||||||
|
|
||||||
|
[Component]
|
||||||
|
public class AppLiftInfoDao
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 查询
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="liftInfo"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public List<AppLiftInfo>? Query(AppLiftInfo liftInfo)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var sqlFunc = CommonTool.DbServe.Queryable<AppLiftInfo>()
|
||||||
|
.WhereIF(liftInfo.LiftId != default, w => w.LiftId == liftInfo.LiftId)
|
||||||
|
.WhereIF(liftInfo.LiftName != default, w => w.LiftName == liftInfo.LiftName)
|
||||||
|
.WhereIF(liftInfo.LiftType != default, w => w.LiftType == liftInfo.LiftType)
|
||||||
|
.WhereIF(liftInfo.Tag != default, w => w.Tag == liftInfo.Tag)
|
||||||
|
.WhereIF(liftInfo.Status != default, w => w.Status == liftInfo.Status)
|
||||||
|
.WhereIF(liftInfo.LiftMode != default, w => w.LiftMode == liftInfo.LiftMode)
|
||||||
|
.WhereIF(liftInfo.Remark != default, w => w.Remark == liftInfo.Remark)
|
||||||
|
.OrderBy(o => o.LiftId);
|
||||||
|
return sqlFunc.ToList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_ = ex;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -208,5 +208,29 @@ public class TaskDao
|
||||||
return result.Data ? string.Empty : result.ErrorException.Message;
|
return result.Data ? string.Empty : result.ErrorException.Message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 完成任务
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="wcsTask"></param>
|
||||||
|
/// <param name="msg"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string? ComlpeteTask(AppWmsTask wmsTask, string msg)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var updateResult = CommonTool.DbServe
|
||||||
|
.Updateable(new AppWmsTask()
|
||||||
|
{ TaskId = wmsTask.TaskId, TaskStatus = (int)WmsTaskStatusEnum.complete, EndTime = DateTime.Now, TaskMsg = msg })
|
||||||
|
.IgnoreColumns(ignoreAllNullColumns: true)
|
||||||
|
.ExecuteCommand();
|
||||||
|
return updateResult > 0 ? null : "失败";
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return ex.Message;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
46
WcsMain/DataBase/TableEntity/AppLiftInfo.cs
Normal file
46
WcsMain/DataBase/TableEntity/AppLiftInfo.cs
Normal file
|
|
@ -0,0 +1,46 @@
|
||||||
|
namespace WcsMain.DataBase.TableEntity;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 提升机信息
|
||||||
|
/// </summary>
|
||||||
|
public class AppLiftInfo
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 提升机ID
|
||||||
|
/// </summary>
|
||||||
|
public string? LiftId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 提升机名称
|
||||||
|
/// </summary>
|
||||||
|
public string? LiftName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 提升机类型
|
||||||
|
/// </summary>
|
||||||
|
public string? LiftType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 标记
|
||||||
|
/// </summary>
|
||||||
|
public string? Tag { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 状态
|
||||||
|
/// </summary>
|
||||||
|
public int? Status { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 提升机模式
|
||||||
|
/// </summary>
|
||||||
|
public int? LiftMode { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 备注
|
||||||
|
/// </summary>
|
||||||
|
public string? Remark { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -9,5 +9,9 @@ public enum WmsTaskStatusEnum
|
||||||
queuing = 1, // 排队中
|
queuing = 1, // 排队中
|
||||||
running = 2, // 执行中
|
running = 2, // 执行中
|
||||||
complete = 3, // 执行完成
|
complete = 3, // 执行完成
|
||||||
|
toMid = 4, // 前往中间点
|
||||||
|
toDestination = 5, // 前往终点
|
||||||
|
arriveMid = 6, // 到达中间点
|
||||||
|
arriveDestination = 7, // 到达终点
|
||||||
err = 9, // 执行异常
|
err = 9, // 执行异常
|
||||||
}
|
}
|
||||||
|
|
@ -8,6 +8,7 @@ public enum WmsTaskTypeEnum
|
||||||
inTask = 1, // 入库任务
|
inTask = 1, // 入库任务
|
||||||
outTask = 2, // 出库任务
|
outTask = 2, // 出库任务
|
||||||
pick = 4, // 拣选任务
|
pick = 4, // 拣选任务
|
||||||
check = 10, // 盘点任务
|
//check = 10, // 盘点任务
|
||||||
moveTask = 9, // 移库任务
|
moveTask = 9, // 移库任务
|
||||||
|
agv = 10, // 移动机器人
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,12 @@
|
||||||
using WcsMain.Common;
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Text;
|
||||||
|
using WcsMain.AppEntity.LED;
|
||||||
|
using WcsMain.Common;
|
||||||
using WcsMain.Enum.Plc;
|
using WcsMain.Enum.Plc;
|
||||||
using WcsMain.EquipOperation.Entity;
|
using WcsMain.EquipOperation.Entity;
|
||||||
using WcsMain.EquipOperation.Entity.StackerConvey;
|
using WcsMain.EquipOperation.Entity.StackerConvey;
|
||||||
using WcsMain.WcsAttribute.AutoFacAttribute;
|
using WcsMain.WcsAttribute.AutoFacAttribute;
|
||||||
|
using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||||
|
|
||||||
namespace WcsMain.EquipOperation.StackerConvey;
|
namespace WcsMain.EquipOperation.StackerConvey;
|
||||||
|
|
||||||
|
|
@ -46,6 +50,31 @@ public class StackerConveyOperation
|
||||||
return (string.Empty, stackerConveyInfo);
|
return (string.Empty, stackerConveyInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取提升机信息 ---- 上汽项目专用
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="stackerConveyName"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public (string errText, short model, short allowAction, short errCode, string code) GetLiftInfo(string stackerConveyName)
|
||||||
|
{
|
||||||
|
if (!CommonData.IsConnectPlc || CommonTool.Siemens == default)
|
||||||
|
{
|
||||||
|
return ("设备尚未连接", 0, 0, 999, ""); // 未连接PLC
|
||||||
|
}
|
||||||
|
var readResult = CommonTool.Siemens.ReadByteWithName($"提升机信息{stackerConveyName}", 36);
|
||||||
|
if (!readResult.Success || readResult.Value == default)
|
||||||
|
{
|
||||||
|
return (readResult.Message ?? "读取失败", 0, 0, 999, ""); // 读取失败
|
||||||
|
}
|
||||||
|
var data = readResult.Value;
|
||||||
|
short model = Convert.ToInt16(CommonTool.Siemens.Trans<short>(data, 0));
|
||||||
|
short allowAction = Convert.ToInt16(CommonTool.Siemens.Trans<short>(data, 2));
|
||||||
|
short errCode = Convert.ToInt16(CommonTool.Siemens.Trans<short>(data, 4));
|
||||||
|
var str = Encoding.ASCII.GetString(data, 6, 20);
|
||||||
|
string code = Regex.Replace(str, "\\W", "");
|
||||||
|
return (string.Empty, model, allowAction, errCode, code);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取输送机任务号
|
/// 获取输送机任务号
|
||||||
|
|
|
||||||
22
WcsMain/Plugins/AGVWebApiPost.cs
Normal file
22
WcsMain/Plugins/AGVWebApiPost.cs
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
using ApiTool;
|
||||||
|
using WcsMain.Business.CommonAction;
|
||||||
|
using WcsMain.Common;
|
||||||
|
using WcsMain.ExtendMethod;
|
||||||
|
using WcsMain.WcsAttribute.AutoFacAttribute;
|
||||||
|
|
||||||
|
namespace WcsMain.Plugins;
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// AGV 接口工具
|
||||||
|
/// </summary>
|
||||||
|
[Component]
|
||||||
|
public class AGVWebApiPost : WebApiPost
|
||||||
|
{
|
||||||
|
public AGVWebApiPost(ApiResponseAction apiResponseAction)
|
||||||
|
{
|
||||||
|
SetResponseAction(apiResponseAction.ApiResponse);
|
||||||
|
SetBaseUrl(CommonData.AppApiBaseInfos.GetAddress("AGVBaseApiAddress") ?? "");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
20
WcsMain/Plugins/ContainerWebApiPost.cs
Normal file
20
WcsMain/Plugins/ContainerWebApiPost.cs
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
using ApiTool;
|
||||||
|
using WcsMain.Business.CommonAction;
|
||||||
|
using WcsMain.Common;
|
||||||
|
using WcsMain.ExtendMethod;
|
||||||
|
using WcsMain.WcsAttribute.AutoFacAttribute;
|
||||||
|
|
||||||
|
namespace WcsMain.Plugins;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 四向车库接口请求
|
||||||
|
/// </summary>
|
||||||
|
[Component]
|
||||||
|
public class ContainerWebApiPost : WebApiPost
|
||||||
|
{
|
||||||
|
public ContainerWebApiPost(ApiResponseAction apiResponseAction)
|
||||||
|
{
|
||||||
|
SetResponseAction(apiResponseAction.ApiResponse);
|
||||||
|
SetBaseUrl(CommonData.AppApiBaseInfos.GetAddress("ContainerBaseApiAddress") ?? "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -14,9 +14,9 @@ namespace WcsMain.Plugins;
|
||||||
[Component]
|
[Component]
|
||||||
public class WmsWebApiPost : WebApiPost
|
public class WmsWebApiPost : WebApiPost
|
||||||
{
|
{
|
||||||
public WmsWebApiPost(WMSApiResponseAction wmsApiResponseAction)
|
public WmsWebApiPost(ApiResponseAction wmsApiResponseAction)
|
||||||
{
|
{
|
||||||
SetResponseAction(wmsApiResponseAction.WMSApiResponse);
|
SetResponseAction(wmsApiResponseAction.ApiResponse);
|
||||||
SetBaseUrl(CommonData.AppApiBaseInfos.GetAddress("WmsBaseApiAddress") ?? "");
|
SetBaseUrl(CommonData.AppApiBaseInfos.GetAddress("WmsBaseApiAddress") ?? "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,12 +38,12 @@
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="ApiServe\Controllers\Dto\CommonEntity\" />
|
<Folder Include="ApiServe\Controllers\Dto\CommonEntity\" />
|
||||||
|
<Folder Include="ApiServe\Controllers\AGVController\" />
|
||||||
<Folder Include="ApiServe\Service\TestService\" />
|
<Folder Include="ApiServe\Service\TestService\" />
|
||||||
<Folder Include="Business\CirculationTask\Container\" />
|
<Folder Include="Business\CirculationTask\Container\" />
|
||||||
<Folder Include="Business\CirculationTask\Shuttle\" />
|
<Folder Include="Business\CirculationTask\Shuttle\" />
|
||||||
<Folder Include="Business\Stacker\" />
|
<Folder Include="Business\Stacker\" />
|
||||||
<Folder Include="Business\StackerConvey\" />
|
<Folder Include="Business\StackerConvey\" />
|
||||||
<Folder Include="Business\Container\" />
|
|
||||||
<Folder Include="Language\Entity\" />
|
<Folder Include="Language\Entity\" />
|
||||||
<Folder Include="Language\zh-CN\" />
|
<Folder Include="Language\zh-CN\" />
|
||||||
<Folder Include="Language\en-US\" />
|
<Folder Include="Language\en-US\" />
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
"AllowedHosts": "*",
|
"AllowedHosts": "*",
|
||||||
"Settings": {
|
"Settings": {
|
||||||
"DBMysql": "server=10.90.36.71;port=3306;user=developer;password=developer;database=wcs_kate_suzhou;",
|
"DBMysql": "server=10.90.36.71;port=3306;user=developer;password=developer;database=wcs_kate_suzhou;",
|
||||||
"DBMysqlLocal": "server=192.168.234.134;port=3306;user=developer;password=developer;database=wcs_kate_suzhou;",
|
"DBMysqlLocal": "server=192.168.234.134;port=3306;user=developer;password=developer;database=app_wcs_shangqi;",
|
||||||
|
|
||||||
"DBMssql": "Data Source=192.168.142.131;Initial Catalog=wcs;User Id=sa;Password=Sa123;",
|
"DBMssql": "Data Source=192.168.142.131;Initial Catalog=wcs;User Id=sa;Password=Sa123;",
|
||||||
"DBMssqlLocal": "Data Source=192.168.142.131;Initial Catalog=wcs_stacker;User Id=sa;Password=Sa123;",
|
"DBMssqlLocal": "Data Source=192.168.142.131;Initial Catalog=wcs_stacker;User Id=sa;Password=Sa123;",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user