change - 抽象出海康SDK,将SDK与API业务分离

dev
wenjy 2 weeks ago
parent 9891e6099a
commit d2194d17c0

@ -36,9 +36,9 @@ namespace Sln.Wcs.Common.Domain.Dto
public TCode? code { get; set; }
/// <summary>
/// 错误信息
///
/// </summary>
public string? error { get; set; }
public string? msg { get; set; }
/// <summary>
/// 结果

@ -0,0 +1,69 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* (c) 2026 WenJY
* CLR4.0.30319.42000
* T14-GEN3-7895
* Sln.Wcs.HikRoBotApi.Domain.Dto.CancelTask
* a58b49bc-2f35-43aa-95f0-bee6bd291067
*
* WenJY
*
* 2026-02-25 15:07:15
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
namespace Sln.Wcs.HikRoBotApi.Domain.Dto.CancelTask
{
/// <summary>
/// 任务取消请求参数
/// </summary>
public class CancelTaskDto
{
/// <summary>
/// 请求编号,每个请求都要一个唯一编号, 同一个请求重复提交, 使用同一编号。;
/// </summary>
public string reqCode { get; set; }
/// <summary>
/// 请求时间截 格式: “yyyy-MM-dd HH:mm:ss”。
/// </summary>
public string reqTime { get; set; }
/// <summary>
/// 客户端编号如PDAHCWMS等。
/// </summary>
public string clientCode { get; set; }
/// <summary>
/// 令牌号, 由调度系统颁发
/// </summary>
public string tokenCode { get; set; }
/// <summary>
/// 工作位与RCS-2000端配置的位置名称一致。
/// </summary>
public string forceCancel { get; set; }
/// <summary>
/// 货架号,采用货架号触发的方式。
/// </summary>
public string matterArea { get; set; }
public string agvCode { get; set; }
public string taskCode { get; set; }
}
}

@ -1,4 +1,7 @@
using System;
using Sln.Wcs.Common.Domain.Dto;
using Sln.Wcs.HikRoBotApi.Domain.Model.CancelTask;
using Sln.Wcs.HikRoBotApi.Enum;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@ -9,12 +12,12 @@ using System.Threading.Tasks;
* (c) 2026 WenJY
* CLR4.0.30319.42000
* T14-GEN3-7895
* Sln.Wcs.Api.Domain.Dto.genAgvSchedulingTask
* 8050269f-214b-4b32-96aa-f5dc77ee4f54
* Sln.Wcs.HikRoBotApi.Domain.Dto.CancelTask
* 1f582438-5412-4ae4-8fdf-cc1a2a990527
*
* WenJY
*
* 2026-02-25 10:06:10
* 2026-02-25 15:07:38
* V1.0.0
*
*
@ -26,13 +29,12 @@ using System.Threading.Tasks;
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
namespace Sln.Wcs.Api.Domain.Dto.genAgvSchedulingTask
namespace Sln.Wcs.HikRoBotApi.Domain.Dto.CancelTask
{
/// <summary>
/// 生成任务单请求参数
/// 任务继续返回参数
/// </summary>
public class GenAgvSchedulingTaskDto
public class CancelTaskResultDto : ResultDto<HikRoBotStatusEnum, CancelTaskResultModel>
{
//这里写请求参数
}
}

@ -0,0 +1,71 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* (c) 2026 WenJY
* CLR4.0.30319.42000
* T14-GEN3-7895
* Sln.Wcs.HikRoBotApi.Domain.Dto.ContinueTask
* d2278c13-5f0c-423a-b4d2-997a1aba71bc
*
* WenJY
*
* 2026-02-25 15:09:47
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
namespace Sln.Wcs.HikRoBotApi.Domain.Dto.ContinueTask
{
/// <summary>
/// 任务继续请求参数
/// </summary>
public class ContinueTaskDto
{
/// <summary>
/// 请求编号,每个请求都要一个唯一编号, 同一个请求重复提交, 使用同一编号。;
/// </summary>
public string reqCode { get; set; }
/// <summary>
/// 请求时间截 格式: “yyyy-MM-dd HH:mm:ss”。
/// </summary>
public string reqTime { get; set; }
/// <summary>
/// 客户端编号如PDAHCWMS等。
/// </summary>
public string clientCode { get; set; }
/// <summary>
/// 令牌号, 由调度系统颁发
/// </summary>
public string tokenCode { get; set; }
/// <summary>
/// 工作位与RCS-2000端配置的位置名称一致。
/// </summary>
public string wbCode { get; set; }
/// <summary>
/// 货架号,采用货架号触发的方式。
/// </summary>
public string podCode { get; set; }
public string agvCode { get; set; }
public string taskCode { get; set; }
public string taskSeq { get; set; }
public string nextPositionCode { get; set; }
}
}

@ -0,0 +1,41 @@
using Sln.Wcs.Common.Domain.Dto;
using Sln.Wcs.HikRoBotApi.Domain.Model.ContinueTask;
using Sln.Wcs.HikRoBotApi.Enum;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* (c) 2026 WenJY
* CLR4.0.30319.42000
* T14-GEN3-7895
* Sln.Wcs.HikRoBotApi.Domain.Dto.ContinueTask
* 5abd89da-3753-4977-8117-b4cbf9fd73d0
*
* WenJY
*
* 2026-02-25 15:10:08
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
namespace Sln.Wcs.HikRoBotApi.Domain.Dto.ContinueTask
{
/// <summary>
/// 任务继续返回参数
/// </summary>
public class ContinueTaskResultDto : ResultDto<HikRoBotStatusEnum, ContinueTaskResultModel>
{
}
}

@ -0,0 +1,175 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* (c) 2026 WenJY
* CLR4.0.30319.42000
* T14-GEN3-7895
* Sln.Wcs.HikRoBotApi.Domain.Dto.GenAgvSchedulingTask
* 3cad8de3-17fd-4714-b809-b89168713a6d
*
* WenJY
*
* 2026-02-25 15:04:31
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
namespace Sln.Wcs.HikRoBotApi.Domain.Dto.GenAgvSchedulingTask
{
/// <summary>
/// 生成任务单请求参数
/// </summary>
public class GenAgvSchedulingTaskDto
{
//这里写请求参数
/// <summary>
/// 请求编号,每个请求都要一个唯一编号, 同一个请求重复提交, 使用同一编号。;
/// </summary>
public string reqCode { get; set; }
/// <summary>
/// 请求时间截 格式: “yyyy-MM-dd HH:mm:ss”。
/// </summary>
public string reqTime { get; set; }
/// <summary>
/// 客户端编号如PDAHCWMS等。
/// </summary>
public string clientCode { get; set; }
/// <summary>
/// 令牌号, 由调度系统颁发
/// </summary>
public string tokenCode { get; set; }
/// <summary>
/// 任务类型,
/// 业务流程
/// 5层柜体来料验收拆分 柜体物料 提升机输送线对接位-验收拆分区 WMS F501 2
/// 5层柜体来料入库 柜体物料 验收拆分区-原材料周转区 WMS F502 2
/// 5层辅料立体库物料入库 辅料料箱 回转输送线回库口-辅料库货架 WMS F503 1
/// 5层辅料立体库分拣出库 辅料料箱 辅料库货架-回转输送线出库口 WMS F504 1
/// 5层辅料立体库分拣回库 辅料料箱 回转输送线回库口-辅料库货架 WMS F505 1
/// 5层辅料配送流程 辅料料箱 物料分拣位-装配区领料工位 WMS F506 空值
/// 5层背板安装区物料配送 柜体物料 原材料周转区-背板安装区 WMS F507 2
/// 5层半成品下线 半成品柜 背板安装区-半成品周转区 WMS F508 2
/// 5层半成品检验 半成品柜 半成品周转区-检测台 WMS F509 2
/// 5层成品柜体入库 成品柜体 检验台-成品区 WMS F510 2
/// 5层成品柜体出库 成品柜体 成品区-提升机输送线对接点 WMS F511 2
/// </summary>
public string taskTyp { get; set; }
/// <summary>
/// 容器类型(叉车/CTU专用叉车项目必传
/// </summary>
public string ctnrTyp { get; set; }
/// <summary>
/// 容器编号(叉车/CTU专用
/// </summary>
public string ctnrCode { get; set; }
/// <summary>
/// 容器数量叉车堆叠专用默认值1仅记录堆叠的数量不记录堆叠的每个容器号
/// </summary>
public string ctnrNum { get; set; }
/// <summary>
/// 任务模式 0-普通move 1-出库move 2-入库move 3-移库move
/// </summary>
public string taskMode { get; set; }
/// <summary>
/// 工作位一般为机台或工作台位置与RCS-2000端配置的位置名称一致, 工作位名称为字母\数字\或组合, 不超过32位。
/// </summary>
public string wbCode { get; set; }
/// <summary>
/// 位置路径AGV关键路径位置集合与任务类型中模板配置的位置路径一一对应。待现场地图部署、配置完成后可获取。
/// </summary>
public List<Position> positionCodePath { get; set; }
/// <summary>
/// “180”,”0”,”90”,”-90” 分别对应地图的”左”,”右”,”上”,”下” ,不指定方向可以为空
/// </summary>
public string podDir { get; set; }
/// <summary>
/// “180”,”0”,”90”,”-90” 分别对应地图的”左”,”右”,”上”,”下” ,不指定方向可以为空
/// </summary>
public string podTyp { get; set; }
/// <summary>
/// “180”,”0”,”90”,”-90” 分别对应地图的”左”,”右”,”上”,”下” ,不指定方向可以为空
/// </summary>
public string podCode { get; set; }
/// <summary>
/// 物料批次或货架上的物料唯一编码,
/// </summary>
public string materialLot { get; set; }
/// <summary>
/// 物料类型, 仅移载机器人协议专用必填, 其它车型任务不填
/// </summary>
public string materialType { get; set; }
/// <summary>
/// 优先级1~127最大优先级最高。为空时采用任务模板的优先级。
/// </summary>
public string priority { get; set; }
/// <summary>
/// 任务单号,选填, 不填系统自动生成UUID小于等于64位
/// </summary>
public string taskCode { get; set; }
/// <summary>
/// AGV编号填写表示指定某一编号的AGV执行该任务
/// </summary>
public string agvCode { get; set; }
/// <summary>
/// 组编号
/// </summary>
public string groupId { get; set; }
/// <summary>
/// 设备类型
/// </summary>
public string agvTyp { get; set; }
/// <summary>
/// 区域/策略中挑选货架以及根据物料批次挑选货架时的先进先出规则
/// </summary>
public string positionSelStrategy { get; set; }
public string data { get; set; }
}
public class Position
{
/// <summary>
/// 货架编号,不指定货架可以为空
/// </summary>
public string positionCode { get; set; }
/// <summary>
/// 货架类型, 传空时表示随机找个货架
/// </summary>
public string type { get; set; }
}
}

@ -1,6 +1,6 @@
using Sln.Wcs.Api.Domain.Enum;
using Sln.Wcs.Api.Domain.Model.genAgvSchedulingTask;
using Sln.Wcs.Common.Domain.Dto;
using Sln.Wcs.Common.Domain.Dto;
using Sln.Wcs.HikRoBotApi.Domain.Model.GenAgvSchedulingTask;
using Sln.Wcs.HikRoBotApi.Enum;
using System;
using System.Collections.Generic;
using System.Linq;
@ -12,12 +12,12 @@ using System.Threading.Tasks;
* (c) 2026 WenJY
* CLR4.0.30319.42000
* T14-GEN3-7895
* Sln.Wcs.Api.Domain.Dto.genAgvSchedulingTask
* 9a4a5630-b508-4b56-a5c1-240b156c6af1
* Sln.Wcs.HikRoBotApi.Domain.Dto.GenAgvSchedulingTask
* cc400640-5628-41bf-90d5-f0926202bc34
*
* WenJY
*
* 2026-02-25 10:06:22
* 2026-02-25 15:05:12
* V1.0.0
*
*
@ -29,12 +29,14 @@ using System.Threading.Tasks;
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
namespace Sln.Wcs.Api.Domain.Dto.genAgvSchedulingTask
namespace Sln.Wcs.HikRoBotApi.Domain.Dto.GenAgvSchedulingTask
{
/// <summary>
/// 生成任务单返回参数
/// </summary>
public class GenAgvSchedulingTaskResultDto:ResultDto<ApiBaseStatusEnum, GenAgvSchedulingTaskResultModel>
public class GenAgvSchedulingTaskResultDto : ResultDto<HikRoBotStatusEnum, GenAgvSchedulingTaskResultModel>
{
}
}

@ -9,12 +9,12 @@ using System.Threading.Tasks;
* (c) 2026 WenJY
* CLR4.0.30319.42000
* T14-GEN3-7895
* Sln.Wcs.Api.Domain.Enum
* 7d0a31f2-ad5a-475d-97a3-f3c124bdb776
* Sln.Wcs.HikRoBotSdk.Enum
* 011d2435-3325-4055-b1ec-a3e1834e3af6
*
* WenJY
*
* 2026-02-25 10:09:13
* 2026-02-25 14:52:00
* V1.0.0
*
*
@ -26,13 +26,15 @@ using System.Threading.Tasks;
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
namespace Sln.Wcs.Api.Domain.Enum
namespace Sln.Wcs.HikRoBotApi.Enum
{
public enum ApiBaseStatusEnum
public enum HikRoBotStatusEnum
{
SUCCESS = 0,
= 1,
API = 2,
API = 3,
= 0,
= 1,
= 6,
= 99,
=100,
SDK=101,
}
}

@ -0,0 +1,51 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* (c) 2026 WenJY
* CLR4.0.30319.42000
* T14-GEN3-7895
* Sln.Wcs.HikRoBotApi.Domain.Model.CancelTask
* ac71b2ae-be38-49b0-88ae-982226661531
*
* WenJY
*
* 2026-02-25 15:08:30
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
namespace Sln.Wcs.HikRoBotApi.Domain.Model.CancelTask
{
/// <summary>
/// 取消任务返回实体
/// </summary>
public class CancelTaskResultModel
{
/// <summary>
/// 返回码
/// </summary>
public string code { get; set; }
/// <summary>
/// 返回消息
/// </summary>
public string message { get; set; }
/// <summary>
/// 请求编号
/// </summary>
public string reqCode { get; set; }
}
}

@ -0,0 +1,51 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* (c) 2026 WenJY
* CLR4.0.30319.42000
* T14-GEN3-7895
* Sln.Wcs.HikRoBotApi.Domain.Model.ContinueTask
* 4cf335d2-ab55-4c40-9a23-f2bf5ce7f597
*
* WenJY
*
* 2026-02-25 15:09:13
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
namespace Sln.Wcs.HikRoBotApi.Domain.Model.ContinueTask
{
/// <summary>
/// 任务继续返回实体
/// </summary>
public class ContinueTaskResultModel
{
/// <summary>
/// 返回码
/// </summary>
public string code { get; set; }
/// <summary>
/// 返回消息
/// </summary>
public string message { get; set; }
/// <summary>
/// 请求编号
/// </summary>
public string reqCode { get; set; }
}
}

@ -9,12 +9,12 @@ using System.Threading.Tasks;
* (c) 2026 WenJY
* CLR4.0.30319.42000
* T14-GEN3-7895
* Sln.Wcs.Api.Domain.Model
* a31bd1f2-40e6-4286-82a8-aeb545a5db4c
* Sln.Wcs.HikRoBotApi.Domain.Model
* b61df9f9-1fcc-46ac-b3e9-4d37a3fd0d29
*
* WenJY
*
* 2026-02-25 10:15:15
* 2026-02-25 15:06:37
* V1.0.0
*
*
@ -26,7 +26,7 @@ using System.Threading.Tasks;
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
namespace Sln.Wcs.Api.Domain.Model.genAgvSchedulingTask
namespace Sln.Wcs.HikRoBotApi.Domain.Model.GenAgvSchedulingTask
{
/// <summary>
/// 生成任务单返回实体

@ -0,0 +1,77 @@
using Sln.Wcs.HikRoBotApi.Enum;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* (c) 2026 WenJY
* CLR4.0.30319.42000
* T14-GEN3-7895
* Sln.Wcs.HikRoBotApi.Util
* 7cea7d00-c417-480f-b2af-ff47d07e25d8
*
* WenJY
*
* 2026-02-25 15:11:14
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
namespace Sln.Wcs.HikRoBotApi.Util
{
public class ApiResultCodeUtil
{
/// <summary>
///
/// </summary>
/// <param name="respCode"></param>
/// <param name="respMsg"></param>
/// <param name="hikRoBotStatus"></param>
/// <returns></returns>
public bool parse(string respCode, string respMsg, out HikRoBotStatusEnum hikRoBotStatus)
{
bool isRes = false;
hikRoBotStatus = HikRoBotStatusEnum.;
switch (respCode)
{
case "0":
if (respMsg.Contains("成功"))
{
hikRoBotStatus = HikRoBotStatusEnum.;
isRes = true;
}
break;
case "1":
hikRoBotStatus = HikRoBotStatusEnum.;
break;
case "6":
hikRoBotStatus = HikRoBotStatusEnum.;
break;
case "99":
hikRoBotStatus = HikRoBotStatusEnum.;
break;
case "100":
hikRoBotStatus = HikRoBotStatusEnum.;
break;
default:
isRes = true;
break;
}
return isRes;
}
}
}

@ -0,0 +1,87 @@
using Microsoft.Extensions.Configuration;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* (c) 2026 WenJY
* CLR4.0.30319.42000
* T14-GEN3-7895
* Sln.Wcs.HikRoBotSdk.Config
* c1ac02e9-7ad4-4356-8043-2cf04a09ede8
*
* WenJY
*
* 2026-02-25 14:42:08
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
namespace Sln.Wcs.HikRoBotSdk.Config
{
public class HikRoBotConfig
{
public readonly string api = "";
public readonly string partnerId;
public readonly string accesskey;
public readonly string secretkey;
public readonly string version;
public readonly string test;
/// <summary>
/// 注入海康 SDK 配置参数
/// </summary>
/// <param name="configuration"></param>
/// <exception cref="Exception"></exception>IConfiguration configuration
public HikRoBotConfig(IConfiguration configuration)
{
if (string.IsNullOrEmpty(configuration["sdk_api"]))
{
throw new Exception("sdk_api 配置不正确,请检查Apollo配置.");
}
if (string.IsNullOrEmpty(configuration["sdk_partner_id"]))
{
throw new Exception("sdk_partner_id 配置不正确,请检查Apollo配置.");
}
if (string.IsNullOrEmpty(configuration["sdk_accesskey"]))
{
throw new Exception("sdk_accesskey 配置不正确,请检查Apollo配置.");
}
if (string.IsNullOrEmpty(configuration["sdk_secretkey"]))
{
throw new Exception("sdk_secretkey 配置不正确,请检查Apollo配置.");
}
if (string.IsNullOrEmpty(configuration["sdk_partner_id"]))
{
throw new Exception("sdk_partner_id 配置不正确,请检查Apollo配置.");
}
if (string.IsNullOrEmpty(configuration["sdk_version"]))
{
throw new Exception("sdk_version 配置不正确,请检查Apollo配置.");
}
api = configuration["sdk_api"];
accesskey = configuration["sdk_accesskey"];
secretkey = configuration["sdk_secretkey"];
version = configuration["sdk_version"];
test = configuration["sdk_test"];
// api = "http://www.fangcang.com/tmc-hub/queryProductDetail";
// partnerId = "P10000408";
// accesskey = "";
// secretkey = "lwdmmuVfbKLRhgihMycWTz6T";
// version = "1.0.0";
}
}
}

@ -0,0 +1,70 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* (c) 2026 WenJY
* CLR4.0.30319.42000
* T14-GEN3-7895
* Sln.Wcs.HikRoBotSdk.Dto.CancelTask
* 88e5b038-9755-4141-8ba6-15cafafddc3f
*
* WenJY
*
* 2026-02-25 14:49:37
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
namespace Sln.Wcs.HikRoBotSdk.Dto.CancelTask
{
/// <summary>
/// 任务取消请求参数
/// </summary>
public class CancelTaskDto
{
/// <summary>
/// 请求编号,每个请求都要一个唯一编号, 同一个请求重复提交, 使用同一编号。;
/// </summary>
public string reqCode { get; set; }
/// <summary>
/// 请求时间截 格式: “yyyy-MM-dd HH:mm:ss”。
/// </summary>
public string reqTime { get; set; }
/// <summary>
/// 客户端编号如PDAHCWMS等。
/// </summary>
public string clientCode { get; set; }
/// <summary>
/// 令牌号, 由调度系统颁发
/// </summary>
public string tokenCode { get; set; }
/// <summary>
/// 工作位与RCS-2000端配置的位置名称一致。
/// </summary>
public string forceCancel { get; set; }
/// <summary>
/// 货架号,采用货架号触发的方式。
/// </summary>
public string matterArea { get; set; }
public string agvCode { get; set; }
public string taskCode { get; set; }
}
}

@ -0,0 +1,48 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* (c) 2026 WenJY
* CLR4.0.30319.42000
* T14-GEN3-7895
* Sln.Wcs.HikRoBotSdk.Dto.CancelTask
* 5476e634-dee3-4540-bdaa-26c83eddab5b
*
* WenJY
*
* 2026-02-25 14:49:03
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
namespace Sln.Wcs.HikRoBotSdk.Dto.CancelTask
{
public class CancelTaskResultDto
{
/// <summary>
/// 返回码
/// </summary>
public string code { get; set; }
/// <summary>
/// 返回消息
/// </summary>
public string message { get; set; }
/// <summary>
/// 请求编号
/// </summary>
public string reqCode { get; set; }
}
}

@ -0,0 +1,71 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* (c) 2026 WenJY
* CLR4.0.30319.42000
* T14-GEN3-7895
* Sln.Wcs.HikRoBotSdk.Dto.ContinueTask
* 8e27fc6d-93df-4b51-983a-02aaa3772137
*
* WenJY
*
* 2026-02-25 14:50:23
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
namespace Sln.Wcs.HikRoBotSdk.Dto.ContinueTask
{
/// <summary>
/// 任务继续请求参数
/// </summary>
public class ContinueTaskDto
{
/// <summary>
/// 请求编号,每个请求都要一个唯一编号, 同一个请求重复提交, 使用同一编号。;
/// </summary>
public string reqCode { get; set; }
/// <summary>
/// 请求时间截 格式: “yyyy-MM-dd HH:mm:ss”。
/// </summary>
public string reqTime { get; set; }
/// <summary>
/// 客户端编号如PDAHCWMS等。
/// </summary>
public string clientCode { get; set; }
/// <summary>
/// 令牌号, 由调度系统颁发
/// </summary>
public string tokenCode { get; set; }
/// <summary>
/// 工作位与RCS-2000端配置的位置名称一致。
/// </summary>
public string wbCode { get; set; }
/// <summary>
/// 货架号,采用货架号触发的方式。
/// </summary>
public string podCode { get; set; }
public string agvCode { get; set; }
public string taskCode { get; set; }
public string taskSeq { get; set; }
public string nextPositionCode { get; set; }
}
}

@ -0,0 +1,48 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* (c) 2026 WenJY
* CLR4.0.30319.42000
* T14-GEN3-7895
* Sln.Wcs.HikRoBotSdk.Dto.ContinueTask
* ba99f261-feee-4344-8529-0fafb4785fe9
*
* WenJY
*
* 2026-02-25 14:50:44
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
namespace Sln.Wcs.HikRoBotSdk.Dto.ContinueTask
{
public class ContinueTaskResultDto
{
/// <summary>
/// 返回码
/// </summary>
public string code { get; set; }
/// <summary>
/// 返回消息
/// </summary>
public string message { get; set; }
/// <summary>
/// 请求编号
/// </summary>
public string reqCode { get; set; }
}
}

@ -0,0 +1,158 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* (c) 2026 WenJY
* CLR4.0.30319.42000
* T14-GEN3-7895
* Sln.Wcs.HikRoBotSdk.Dto
* 19479d6e-828e-4406-a182-b32aed64a718
*
* WenJY
*
* 2026-02-25 14:38:41
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
namespace Sln.Wcs.HikRoBotSdk.Dto.GenAgvSchedulingTask
{
public class GenAgvSchedulingTaskDto
{
//这里写请求参数
/// <summary>
/// 请求编号,每个请求都要一个唯一编号, 同一个请求重复提交, 使用同一编号。;
/// </summary>
public string reqCode { get; set; }
/// <summary>
/// 请求时间截 格式: “yyyy-MM-dd HH:mm:ss”。
/// </summary>
public string reqTime { get; set; }
/// <summary>
/// 客户端编号如PDAHCWMS等。
/// </summary>
public string clientCode { get; set; }
/// <summary>
/// 令牌号, 由调度系统颁发
/// </summary>
public string tokenCode { get; set; }
/// <summary>
/// 任务类型,
/// 业务流程
/// 5层柜体来料验收拆分 柜体物料 提升机输送线对接位-验收拆分区 WMS F501 2
/// 5层柜体来料入库 柜体物料 验收拆分区-原材料周转区 WMS F502 2
/// 5层辅料立体库物料入库 辅料料箱 回转输送线回库口-辅料库货架 WMS F503 1
/// 5层辅料立体库分拣出库 辅料料箱 辅料库货架-回转输送线出库口 WMS F504 1
/// 5层辅料立体库分拣回库 辅料料箱 回转输送线回库口-辅料库货架 WMS F505 1
/// 5层辅料配送流程 辅料料箱 物料分拣位-装配区领料工位 WMS F506 空值
/// 5层背板安装区物料配送 柜体物料 原材料周转区-背板安装区 WMS F507 2
/// 5层半成品下线 半成品柜 背板安装区-半成品周转区 WMS F508 2
/// 5层半成品检验 半成品柜 半成品周转区-检测台 WMS F509 2
/// 5层成品柜体入库 成品柜体 检验台-成品区 WMS F510 2
/// 5层成品柜体出库 成品柜体 成品区-提升机输送线对接点 WMS F511 2
/// </summary>
public string taskTyp { get; set; }
/// <summary>
/// 容器类型(叉车/CTU专用叉车项目必传
/// </summary>
public string ctnrTyp { get; set; }
/// <summary>
/// 容器编号(叉车/CTU专用
/// </summary>
public string ctnrCode { get; set; }
/// <summary>
/// 容器数量叉车堆叠专用默认值1仅记录堆叠的数量不记录堆叠的每个容器号
/// </summary>
public string ctnrNum { get; set; }
/// <summary>
/// 任务模式 0-普通move 1-出库move 2-入库move 3-移库move
/// </summary>
public string taskMode { get; set; }
/// <summary>
/// 工作位一般为机台或工作台位置与RCS-2000端配置的位置名称一致, 工作位名称为字母\数字\或组合, 不超过32位。
/// </summary>
public string wbCode { get; set; }
/// <summary>
/// 位置路径AGV关键路径位置集合与任务类型中模板配置的位置路径一一对应。待现场地图部署、配置完成后可获取。
/// </summary>
public List<Position> positionCodePath { get; set; }
/// <summary>
/// “180”,”0”,”90”,”-90” 分别对应地图的”左”,”右”,”上”,”下” ,不指定方向可以为空
/// </summary>
public string podDir { get; set; }
/// <summary>
/// “180”,”0”,”90”,”-90” 分别对应地图的”左”,”右”,”上”,”下” ,不指定方向可以为空
/// </summary>
public string podTyp { get; set; }
/// <summary>
/// “180”,”0”,”90”,”-90” 分别对应地图的”左”,”右”,”上”,”下” ,不指定方向可以为空
/// </summary>
public string podCode { get; set; }
/// <summary>
/// 物料批次或货架上的物料唯一编码,
/// </summary>
public string materialLot { get; set; }
/// <summary>
/// 物料类型, 仅移载机器人协议专用必填, 其它车型任务不填
/// </summary>
public string materialType { get; set; }
/// <summary>
/// 优先级1~127最大优先级最高。为空时采用任务模板的优先级。
/// </summary>
public string priority { get; set; }
/// <summary>
/// 任务单号,选填, 不填系统自动生成UUID小于等于64位
/// </summary>
public string taskCode { get; set; }
/// <summary>
/// AGV编号填写表示指定某一编号的AGV执行该任务
/// </summary>
public string agvCode { get; set; }
/// <summary>
/// 组编号
/// </summary>
public string groupId { get; set; }
/// <summary>
/// 设备类型
/// </summary>
public string agvTyp { get; set; }
/// <summary>
/// 区域/策略中挑选货架以及根据物料批次挑选货架时的先进先出规则
/// </summary>
public string positionSelStrategy { get; set; }
public string data { get; set; }
}
}

@ -0,0 +1,56 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* (c) 2026 WenJY
* CLR4.0.30319.42000
* T14-GEN3-7895
* Sln.Wcs.HikRoBotSdk.Dto
* fb6be58f-7b1d-4ad6-8987-6dd041ca769d
*
* WenJY
*
* 2026-02-25 14:36:27
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
namespace Sln.Wcs.HikRoBotSdk.Dto.GenAgvSchedulingTask
{
/// <summary>
/// 生成任务单返回实体
/// </summary>
public class GenAgvSchedulingTaskResultDto
{
/// <summary>
/// 返回码
/// </summary>
public string code { get; set; }
/// <summary>
/// 返回消息
/// </summary>
public string message { get; set; }
/// <summary>
/// 请求编号
/// </summary>
public string reqCode { get; set; }
/// <summary>
/// 自定义返回(返回任务单号)
/// </summary>
public string data { get; set; }
}
}

@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* (c) 2026 WenJY
* CLR4.0.30319.42000
* T14-GEN3-7895
* Sln.Wcs.HikRoBotSdk.Dto.GenAgvSchedulingTask
* 2edaa5c5-0df6-4f36-8764-86f0ca2070da
*
* WenJY
*
* 2026-02-25 14:54:19
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
namespace Sln.Wcs.HikRoBotSdk.Dto.GenAgvSchedulingTask
{
public class Position
{
/// <summary>
/// 货架编号,不指定货架可以为空
/// </summary>
public string positionCode { get; set; }
/// <summary>
/// 货架类型, 传空时表示随机找个货架
/// </summary>
public string type { get; set; }
}
}

@ -0,0 +1,94 @@
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
* CLR4.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;
}
}
}

@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Flurl" Version="4.0.0" />
<PackageReference Include="Flurl.Http" Version="4.0.2" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="10.0.3" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
</ItemGroup>
</Project>

@ -3,11 +3,13 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.10.35122.118
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sln.Wcs", "Sln.Wcs\Sln.Wcs.csproj", "{747BB353-A39B-4C49-A729-0260CC5A0C16}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sln.Wcs", "Sln.Wcs\Sln.Wcs.csproj", "{747BB353-A39B-4C49-A729-0260CC5A0C16}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sln.Wcs.Common", "Sln.Wcs.Common\Sln.Wcs.Common.csproj", "{D94D5F31-AA0D-4F60-A3B4-667A1FFCD6ED}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sln.Wcs.Common", "Sln.Wcs.Common\Sln.Wcs.Common.csproj", "{D94D5F31-AA0D-4F60-A3B4-667A1FFCD6ED}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sln.Wcs.Api", "Sln.Wcs.Api\Sln.Wcs.Api.csproj", "{4C6BE335-DC72-4369-AEA8-AE812C849A12}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sln.Wcs.HikRoBotSdk", "Sln.Wcs.HikRoBotSdk\Sln.Wcs.HikRoBotSdk.csproj", "{F2956A97-69F4-4073-B4C6-72CB7B945565}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sln.Wcs.HikRoBotApi", "Sln.Wcs.HikRoBotApi\Sln.Wcs.HikRoBotApi.csproj", "{9E3193CA-590C-4965-B2EF-02C2AE252095}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -23,10 +25,14 @@ Global
{D94D5F31-AA0D-4F60-A3B4-667A1FFCD6ED}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D94D5F31-AA0D-4F60-A3B4-667A1FFCD6ED}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D94D5F31-AA0D-4F60-A3B4-667A1FFCD6ED}.Release|Any CPU.Build.0 = Release|Any CPU
{4C6BE335-DC72-4369-AEA8-AE812C849A12}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4C6BE335-DC72-4369-AEA8-AE812C849A12}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4C6BE335-DC72-4369-AEA8-AE812C849A12}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4C6BE335-DC72-4369-AEA8-AE812C849A12}.Release|Any CPU.Build.0 = Release|Any CPU
{F2956A97-69F4-4073-B4C6-72CB7B945565}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F2956A97-69F4-4073-B4C6-72CB7B945565}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F2956A97-69F4-4073-B4C6-72CB7B945565}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F2956A97-69F4-4073-B4C6-72CB7B945565}.Release|Any CPU.Build.0 = Release|Any CPU
{9E3193CA-590C-4965-B2EF-02C2AE252095}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9E3193CA-590C-4965-B2EF-02C2AE252095}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9E3193CA-590C-4965-B2EF-02C2AE252095}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9E3193CA-590C-4965-B2EF-02C2AE252095}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

Loading…
Cancel
Save