179 lines
5.9 KiB
C#
179 lines
5.9 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)
|
|
{
|
|
|
|
/// <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,
|
|
// }
|
|
// }
|
|
//};
|
|
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,
|
|
}
|
|
};
|
|
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)
|
|
{
|
|
//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,
|
|
// }
|
|
// }
|
|
//};
|
|
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 ?? "请求失败,未知原因";
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|