114 lines
3.7 KiB
C#
114 lines
3.7 KiB
C#
using WcsMain.ApiClient.AGV.Dto;
|
|
using WcsMain.Common;
|
|
using WcsMain.Constant;
|
|
using WcsMain.DataBase.TableEntity;
|
|
using WcsMain.Constant.WcsAttribute.AutoFacAttribute;
|
|
using WcsMain.Constant.ExtendMethod;
|
|
using System.Collections.Generic;
|
|
|
|
namespace WcsMain.ApiClient.AGV;
|
|
|
|
/// <summary>
|
|
/// AGV 动作
|
|
/// </summary>
|
|
[Component]
|
|
public class AGVWebApiAction(AGVBaseWebApi webApiPost)
|
|
{
|
|
private readonly string[] stand = ["FaaZHG", "kzxhes", "yDN8ZZ", "6cDXzi", "ranQyi", "SxjX8e", "jC6x3C", "MSP3te"];
|
|
/// <summary>
|
|
/// 发送点对点搬运的任务
|
|
/// </summary>
|
|
/// <param name="wmsTask"></param>
|
|
/// <returns></returns>
|
|
public string Send_NO_VERIFY_BUCKET_MOVE(AppWmsTask wmsTask)
|
|
{
|
|
AGVTaskRequest<AGVBucketMove> request = new()
|
|
{
|
|
RobotJobId = wmsTask.TaskId,
|
|
WareHouseId = 1,
|
|
RobotJobGroupNum = 1,
|
|
JobPriority = 1,
|
|
JobProorytyType = 0,
|
|
JobType = "NO_VERIFY_BUCKET_MOVE",
|
|
OrderSource = "BK",
|
|
JobData = new()
|
|
{
|
|
StartPoint = wmsTask.Origin,
|
|
StartPointName = null,
|
|
WorkFaces = "0",
|
|
EndArea = wmsTask.Destination,
|
|
EndPoint = wmsTask.Destination,
|
|
EndPointName = null,
|
|
BucketTypeCode = "TP",
|
|
LetDownFlag = 2,
|
|
NeedOut = stand.Contains(wmsTask.Destination) ? 2 : null
|
|
}
|
|
};
|
|
var response = webApiPost.HttpPost<List<AGVTaskRequest<AGVBucketMove>>, AGVResponseBody<List<AGVTaskResponse>>> ([request], CommonData.AppApiBaseInfos.GetAddress("AGV_NO_VERIFY_BUCKET_MOVE") ?? "");
|
|
var responseData = response.ResponseEntity;
|
|
if (!response.IsSend || responseData == null)
|
|
{
|
|
return "请求失败,网络故障";
|
|
}
|
|
|
|
if (responseData.Success == true && responseData.Code?.ToLower() == "success")
|
|
{
|
|
// 发送成功
|
|
return string.Empty;
|
|
}
|
|
return responseData.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, int needOut = 0)
|
|
{
|
|
AGVTaskRequest<AGVBucketMove> request = new()
|
|
{
|
|
RobotJobId = taskId,
|
|
WareHouseId = 1,
|
|
RobotJobGroupNum = 1,
|
|
JobPriority = 1,
|
|
JobProorytyType = 0,
|
|
JobType = "NO_VERIFY_BUCKET_MOVE",
|
|
OrderSource = "BK",
|
|
JobData = new()
|
|
{
|
|
StartPoint = origin,
|
|
StartPointName = null,
|
|
WorkFaces = "0",
|
|
EndPoint = destination,
|
|
EndPointName = null,
|
|
BucketTypeCode = "TP",
|
|
LetDownFlag = 2,
|
|
NeedOut = needOut
|
|
}
|
|
};
|
|
|
|
var response = webApiPost.HttpPost<List<AGVTaskRequest<AGVBucketMove>>, AGVResponseBody<List<AGVTaskResponse>>>([request], CommonData.AppApiBaseInfos.GetAddress("AGV_NO_VERIFY_BUCKET_MOVE") ?? "");
|
|
var responseData = response.ResponseEntity;
|
|
if (!response.IsSend || responseData == null)
|
|
{
|
|
return "请求失败,网络故障";
|
|
}
|
|
|
|
if (responseData.Success == true && responseData.Code?.ToLower() == "success")
|
|
{
|
|
// 发送成功
|
|
return string.Empty;
|
|
}
|
|
return responseData.Message ?? "请求失败,未知原因";
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|