|
|
using Flurl.Http;
|
|
|
using Newtonsoft.Json;
|
|
|
using Sln.Wcs.HikRoBotSdk.Config;
|
|
|
using Sln.Wcs.HikRoBotSdk.Dto.CancelTask;
|
|
|
using Sln.Wcs.HikRoBotSdk.Dto.ContinueTask;
|
|
|
using Sln.Wcs.HikRoBotSdk.Dto.GenAgvSchedulingTask;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Linq;
|
|
|
using System.Text;
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
#region << 版 本 注 释 >>
|
|
|
/*--------------------------------------------------------------------
|
|
|
* 版权所有 (c) 2026 WenJY 保留所有权利。
|
|
|
* CLR版本:4.0.30319.42000
|
|
|
* 机器名称:T14-GEN3-7895
|
|
|
* 命名空间:Sln.Wcs.HikRoBotSdk
|
|
|
* 唯一标识:17e983b2-0c7e-4b27-ae05-e333d623b85d
|
|
|
*
|
|
|
* 创建者:WenJY
|
|
|
* 电子邮箱:
|
|
|
* 创建时间:2026-02-25 14:40:23
|
|
|
* 版本:V1.0.0
|
|
|
* 描述:
|
|
|
*
|
|
|
*--------------------------------------------------------------------
|
|
|
* 修改人:
|
|
|
* 时间:
|
|
|
* 修改说明:
|
|
|
*
|
|
|
* 版本:V1.0.0
|
|
|
*--------------------------------------------------------------------*/
|
|
|
#endregion << 版 本 注 释 >>
|
|
|
namespace Sln.Wcs.HikRoBotSdk
|
|
|
{
|
|
|
public class HIKRoBotSdk
|
|
|
{
|
|
|
|
|
|
private readonly HikRoBotConfig hikRoBotConfig;
|
|
|
|
|
|
public HIKRoBotSdk(HikRoBotConfig hikRoBotConfig)
|
|
|
{
|
|
|
this.hikRoBotConfig = hikRoBotConfig;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 生成任务单
|
|
|
///
|
|
|
/// 上层系统平台发送调度请求, RCS通过请求参数, 生成调度AGV任务单。
|
|
|
///
|
|
|
/// 生成所有车型的搬运任务。
|
|
|
/// </summary>
|
|
|
/// <param name="genAgvSchedulingTask"></param>
|
|
|
/// <returns></returns>
|
|
|
public GenAgvSchedulingTaskResultDto GenAgvSchedulingTask(GenAgvSchedulingTaskDto genAgvSchedulingTask)
|
|
|
{
|
|
|
|
|
|
Console.WriteLine($"请求报文:{JsonConvert.SerializeObject(genAgvSchedulingTask)}");
|
|
|
|
|
|
return this.hikRoBotConfig.api.PostJsonAsync(genAgvSchedulingTask).Result.GetJsonAsync<GenAgvSchedulingTaskResultDto>().Result;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 继续执行任务
|
|
|
///
|
|
|
/// 上层系统平台发送继续调度请求,RCS-2000获取AGV下一个动作,继续执行。
|
|
|
/// </summary>
|
|
|
/// <param name="continueTask"></param>
|
|
|
/// <returns></returns>
|
|
|
public ContinueTaskResultDto ContinueTask(ContinueTaskDto continueTask)
|
|
|
{
|
|
|
|
|
|
Console.WriteLine($"请求报文:{JsonConvert.SerializeObject(continueTask)}");
|
|
|
|
|
|
return this.hikRoBotConfig.api.PostJsonAsync(continueTask).Result.GetJsonAsync<ContinueTaskResultDto>().Result;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 取消任务
|
|
|
///
|
|
|
/// 通过正在执行的任务编号,取消该任务,不再执行,AGV如果背着货架, 取消类型为0时,会把货架直接放在路上, AGV为空闲状态,需要人工介入发指令搬走或拖走货架; 取消类型为1时,称为软取消, AGV仍然背着货架,通过货架所属库区或回库区域执行回库指令,如果回库区域没有位置,返回错误信息,取消不成功。CTU取到料箱后取消,取消类型为0时,会把料箱留在CTU上,需要人工取走;取消类型为1时,CTU将料箱搬回指定的区域的空仓位,若区域没位置,返回错误信息,取消不成功。CTU只能软取消回库区,支持双伸位场景,不支持软取消回输送线等工作位。叉车、辊筒车不支持软取消
|
|
|
/// </summary>
|
|
|
/// <param name="cancelTask"></param>
|
|
|
/// <returns></returns>
|
|
|
public CancelTaskResultDto CancelTask(CancelTaskDto cancelTask)
|
|
|
{
|
|
|
|
|
|
Console.WriteLine($"请求报文:{JsonConvert.SerializeObject(cancelTask)}");
|
|
|
|
|
|
return this.hikRoBotConfig.api.PostJsonAsync(cancelTask).Result.GetJsonAsync<CancelTaskResultDto>().Result;
|
|
|
}
|
|
|
}
|
|
|
}
|