using Newtonsoft.Json;
|
using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
using WIDESEAWCS_Core.Helper;
|
using WIDESEAWCS_Core;
|
using WIDESEAWCS_DTO.WMSInfo;
|
using WIDESEAWCS_Model.Models;
|
using WIDESEAWCS_QuartzJob.Models;
|
|
namespace WIDESEAWCS_TaskInfoService
|
{
|
public partial class TaskService
|
{
|
|
/// <summary>
|
/// 输送线检测口向WMS申请入库
|
/// </summary>
|
/// <param name="palletCode">托盘号</param>
|
/// <param name="sourceAddress">起始地址</param>
|
/// <returns></returns>
|
public WebResponseContent RequestWMSTask(ConveyorLineDTO lineDTO)
|
{
|
WebResponseContent content = new WebResponseContent();
|
|
#region 向WMS申请
|
var ResultData = HttpHelper.PostAsync(WMSInterfaceAddress.ConveyorLineRequestInbound, lineDTO.ToJson(), headers: new Dictionary<string, string>());
|
if (ResultData.Result == null) throw new Exception($"向WMS请求入库超时");
|
|
return JsonConvert.DeserializeObject<WebResponseContent>(ResultData.Result);
|
|
#endregion
|
}
|
|
/// <summary>
|
/// 输送线入库完成向WMS申请入库/堆垛机申请入库
|
/// </summary>
|
/// <param name="task"></param>
|
/// <returns></returns>
|
public WebResponseContent StackerCraneRequestInbound(Dt_Task task)
|
{
|
WebResponseContent content = new WebResponseContent();
|
try
|
{
|
ConveyorLineDTO lineDTO = new ConveyorLineDTO()
|
{
|
stationCode = task.CurrentAddress,
|
TaskNum = task.TaskNum,
|
Barcode = task.PalletCode
|
};
|
var ResultData = HttpHelper.PostAsync(WMSInterfaceAddress.StackerCraneRequestInbound, lineDTO.ToJson(), headers: new Dictionary<string, string>());
|
if (ResultData.Result == null) throw new Exception($"向WMS请求入库分配货位超时!任务号:{task.TaskNum}");
|
content = JsonConvert.DeserializeObject<WebResponseContent>(ResultData.Result);
|
if (!content.Status) throw new Exception(content.Message);
|
|
var receiveWMSInfo = JsonConvert.DeserializeObject<ReceiveWMSInfo>(content.Data.ToJson());
|
task.IsPickPlace = receiveWMSInfo.IsPickPlace;
|
task.TargetAddress = receiveWMSInfo.TargetAddress;
|
task.NextAddress = task.TargetAddress;
|
BaseDal.UpdateData(task);
|
}
|
catch (Exception ex)
|
{
|
content.Error(ex.Message);
|
}
|
return content;
|
}
|
}
|
}
|