change - 推送

dev
wenjy 2 days ago
parent f646478eed
commit 6a28f14fb1

@ -1,38 +0,0 @@
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.Api.Domain.Dto.genAgvSchedulingTask
* 8050269f-214b-4b32-96aa-f5dc77ee4f54
*
* WenJY
*
* 2026-02-25 10:06:10
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
namespace Sln.Wcs.Api.Domain.Dto.genAgvSchedulingTask
{
/// <summary>
/// 生成任务单请求参数
/// </summary>
public class GenAgvSchedulingTaskDto
{
//这里写请求参数
}
}

@ -1,40 +0,0 @@
using Sln.Wcs.Api.Domain.Enum;
using Sln.Wcs.Api.Domain.Model.genAgvSchedulingTask;
using Sln.Wcs.Common.Domain.Dto;
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.Api.Domain.Dto.genAgvSchedulingTask
* 9a4a5630-b508-4b56-a5c1-240b156c6af1
*
* WenJY
*
* 2026-02-25 10:06:22
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
namespace Sln.Wcs.Api.Domain.Dto.genAgvSchedulingTask
{
/// <summary>
/// 生成任务单返回参数
/// </summary>
public class GenAgvSchedulingTaskResultDto:ResultDto<ApiBaseStatusEnum, GenAgvSchedulingTaskResultModel>
{
}
}

@ -1,40 +0,0 @@
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.Api.Domain.Enum
* 7d0a31f2-ad5a-475d-97a3-f3c124bdb776
*
* WenJY
*
* 2026-02-25 10:09:13
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
namespace Sln.Wcs.Api.Domain.Enum
{
public enum ApiBaseStatusEnum
{
= 0,
= 1,
= 6,
= 99,
=100,
=101,
}
}

@ -1,56 +0,0 @@
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.Api.Domain.Model
* a31bd1f2-40e6-4286-82a8-aeb545a5db4c
*
* WenJY
*
* 2026-02-25 10:15:15
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
namespace Sln.Wcs.Api.Domain.Model.genAgvSchedulingTask
{
/// <summary>
/// 生成任务单返回实体
/// </summary>
public class GenAgvSchedulingTaskResultModel
{
/// <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; }
}
}

@ -1,87 +0,0 @@
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.Api.Sdk.Config
* f241e008-1718-4e55-824f-703286c352d6
*
* WenJY
*
* 2026-02-25 13:59:37
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
namespace Sln.Wcs.Api.Sdk.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";
}
}
}

@ -1,65 +0,0 @@
using Flurl.Http;
using Newtonsoft.Json;
using Sln.Wcs.Api.Domain.Dto.genAgvSchedulingTask;
using Sln.Wcs.Api.Domain.Model.genAgvSchedulingTask;
using Sln.Wcs.Api.Sdk.Config;
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.Api.Sdk
* f8cfdb3b-3003-42b8-bc90-efec24e2d19a
*
* WenJY
*
* 2026-02-25 13:54:00
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
namespace Sln.Wcs.Api.Sdk.HikRoBot
{
/// <summary>
/// HIKROBOT RCS-2000接口协议
/// </summary>
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 GenAgvSchedulingTaskResultModel genAgvSchedulingTask(GenAgvSchedulingTaskDto genAgvSchedulingTask)
{
Console.WriteLine($"请求报文:{JsonConvert.SerializeObject(genAgvSchedulingTask)}");
return this.hikRoBotConfig.api.PostJsonAsync(genAgvSchedulingTask).Result.GetJsonAsync<GenAgvSchedulingTaskResultModel>().Result;
}
}
}

@ -1,36 +0,0 @@
using Sln.Wcs.Api.Domain.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.Api.Service
* fe0d8af4-b1ee-44eb-8b23-1ed90413f351
*
* WenJY
*
* 2026-02-25 14:12:17
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
namespace Sln.Wcs.Api.Service
{
public interface IHikRoBotService
{
GenAgvSchedulingTaskResultDto GenAgvSchedulingTask(GenAgvSchedulingTaskDto genAgvSchedulingTask);
}
}

@ -1,83 +0,0 @@
using Sln.Wcs.Api.Domain.Dto.genAgvSchedulingTask;
using Sln.Wcs.Api.Domain.Enum;
using Sln.Wcs.Api.Domain.Model.genAgvSchedulingTask;
using Sln.Wcs.Api.Sdk.HikRoBot;
using Sln.Wcs.Api.Util;
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.Api.Service.Impl
* f7a3e236-5c29-4a01-84a7-28666abe7962
*
* WenJY
*
* 2026-02-25 14:12:46
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
namespace Sln.Wcs.Api.Service.Impl
{
public class HikRoBotServiceImpl : IHikRoBotService
{
private readonly HIkRoBotSdk hikRoBotSdk;
private readonly ApiResultCodeUtil codeUtil;
public HikRoBotServiceImpl(HIkRoBotSdk hikRoBotSdk,ApiResultCodeUtil codeUtil)
{
this.hikRoBotSdk = hikRoBotSdk;
this.codeUtil = codeUtil;
}
/// <summary>
/// 生成任务单
/// </summary>
/// <param name="genAgvSchedulingTask"></param>
/// <returns></returns>
public GenAgvSchedulingTaskResultDto GenAgvSchedulingTask(GenAgvSchedulingTaskDto genAgvSchedulingTask)
{
try
{
if (genAgvSchedulingTask == null) //根据文档要求判断参数值是否合法
{
throw new ArgumentException($"输入参数为空。");
}
var data = this.hikRoBotSdk.genAgvSchedulingTask(genAgvSchedulingTask);
bool parseRes = this.codeUtil.parse(data.code, data.message, out ApiBaseStatusEnum apiBaseStatusEnumCode);
return new GenAgvSchedulingTaskResultDto()
{
code = apiBaseStatusEnumCode,
msg = data.message,
data = data,
};
}
catch (Exception ex)
{
return new GenAgvSchedulingTaskResultDto()
{
code = ApiBaseStatusEnum.,
msg = ex.Message,
};
}
}
}
}

@ -1,20 +0,0 @@
<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>
<ItemGroup>
<ProjectReference Include="..\Sln.Wcs.Common\Sln.Wcs.Common.csproj" />
</ItemGroup>
</Project>

@ -1,77 +0,0 @@
using Sln.Wcs.Api.Domain.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.Api.Util
* e56e7c9d-8004-4482-bf8b-6b479ae06dd0
*
* WenJY
*
* 2026-02-25 13:37:47
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
namespace Sln.Wcs.Api.Util
{
public class ApiResultCodeUtil
{
/// <summary>
///
/// </summary>
/// <param name="respCode"></param>
/// <param name="respMsg"></param>
/// <param name="apiBaseStatusEnumCode"></param>
/// <returns></returns>
public bool parse(string respCode, string respMsg, out ApiBaseStatusEnum apiBaseStatusEnumCode)
{
bool isRes = false;
apiBaseStatusEnumCode = ApiBaseStatusEnum.;
switch (respCode)
{
case "0":
if (respMsg.Contains("成功"))
{
apiBaseStatusEnumCode = ApiBaseStatusEnum.;
isRes = true;
}
break;
case "1":
apiBaseStatusEnumCode = ApiBaseStatusEnum.;
break;
case "6":
apiBaseStatusEnumCode = ApiBaseStatusEnum.;
break;
case "99":
apiBaseStatusEnumCode = ApiBaseStatusEnum.;
break;
case "100":
apiBaseStatusEnumCode = ApiBaseStatusEnum.;
break;
default:
isRes = true;
break;
}
return isRes;
}
}
}
Loading…
Cancel
Save