using HH.WCS.XiaoMi.util;
|
using Newtonsoft.Json;
|
using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
using static HH.WCS.XiaoMi.dispatch.HanAo;
|
|
namespace HH.WCS.XiaoMi.LISTA.dispatch
|
{
|
public class XMWcsHelper
|
{
|
private static readonly HttpHelper apiHelper = new HttpHelper();
|
private static readonly string baseUrl = Settings.WcsSeverUrl;
|
|
|
//https://wcs2-dev.ev.mioffice.cn/api/Interface/AMR/positionApply
|
|
/// <summary>
|
/// 目标位置申请接口
|
/// </summary>
|
/// <param name="model"></param>
|
/// <returns></returns>
|
public static ApplyResult GetPositionApply(ApplyModel model)
|
{
|
var msg = "";
|
var dataResult = new ApplyResult() { body = new body { },header = new header { } };
|
var request = JsonConvert.SerializeObject(model);
|
var response = apiHelper.Post(baseUrl + "/api/Interface/AMR/positionApply", request);
|
msg = $"[xiaomi-GetPositionApply] request={request} response={response}";
|
Console.WriteLine(msg);
|
if (response != "")
|
{
|
try
|
{
|
dataResult = JsonConvert.DeserializeObject<ApplyResult>(response);
|
LogHelper.Info($"GetPositionApply返回参数{JsonConvert.SerializeObject(dataResult)}", "小米");
|
return dataResult;
|
}
|
catch (Exception ex)
|
{
|
Console.WriteLine(ex.Message);
|
}
|
}
|
else
|
{
|
msg = "[xiaomi-GetPositionApply]目标位置申请失败";
|
Console.WriteLine(msg);
|
}
|
LogHelper.Info(msg, "小米");
|
return dataResult;
|
}
|
|
|
|
/// <summary>
|
/// 目标位置申请参数
|
/// </summary>
|
public class ApplyModel
|
{
|
public string wcsTaskCode { get; set; }
|
}
|
|
/// <summary>
|
/// 目标位置申请返回结果
|
/// </summary>
|
public class ApplyResult
|
{
|
public header header { get; set; }
|
public body body { get; set; }
|
}
|
public class header
|
{
|
public string code { get; set; }
|
public string desc { get; set; }
|
}
|
public class body
|
{
|
public string pointCode { get; set; }
|
public string targetType { get; set; }
|
}
|
|
}
|
}
|