using System;
|
using System.Collections.Generic;
|
using System.Text;
|
using WIDESEA.Common;
|
using WIDESEA.Core.Utilities;
|
using WIDESEA.Entity.DomainModels;
|
using WIDESEA_Entity.DomainModels;
|
|
namespace WIDESEA_Services
|
{
|
public class WCSApi
|
{
|
|
/// <summary>
|
/// 发送任务给WCS
|
/// </summary>
|
/// <param name="taskinfo">任务信息</param>
|
/// <returns></returns>
|
public static WebResponseContent SendTaskToWCS(List<Dt_taskinfo> taskinfo)
|
{
|
WebResponseContent content = new WebResponseContent();
|
try
|
{
|
content = HttpHelper<List<Dt_taskinfo>>.GetHttpRequestData(
|
taskinfo, WCSAPIAddress.IPAddress + WCSAPIAddress.ReceiveTaskFromWMS);
|
if (!content.Status)
|
throw new Exception($"发送任务给WCS调用失败:" + content.Message);
|
|
content.OK();
|
}
|
catch (Exception ex)
|
{
|
content.Error(ex.Message);
|
}
|
return content;
|
}
|
|
|
/// <summary>
|
/// 给测量设备测量完毕后,更新WCS任务状态
|
/// </summary>
|
/// <param name="taskinfo">任务信息</param>
|
/// <returns></returns>
|
public static WebResponseContent UpdateWcsTaskState(SaveModel saveModel)
|
{
|
WebResponseContent content = new WebResponseContent();
|
try
|
{
|
content = HttpHelper<SaveModel>.GetHttpRequestData(
|
saveModel, WCSAPIAddress.IPAddress + WCSAPIAddress.UpdateWcsTaskState);
|
if (!content.Status)
|
{
|
throw new Exception($"更新WCS任务状态调用失败:" + content.Message);
|
}
|
content.OK();
|
}
|
catch (Exception ex)
|
{
|
content.Error(ex.Message);
|
}
|
return content;
|
}
|
|
|
/// <summary>
|
/// 取消WCS中的任务
|
/// </summary>
|
/// <param name="saveModel">任务信息</param>
|
/// <returns></returns>
|
public static WebResponseContent CancelTaskToWCS(SaveModel saveModel)
|
{
|
WebResponseContent content = new WebResponseContent();
|
try
|
{
|
content = HttpHelper<SaveModel>.GetHttpRequestData(
|
saveModel, WCSAPIAddress.IPAddress + WCSAPIAddress.CancelTaskFromWMS);
|
if (!content.Status)
|
{
|
throw new Exception($"发送任务给WCS调用失败:" + content.Message);
|
}
|
content.OK();
|
}
|
catch (Exception ex)
|
{
|
content.Error(ex.Message);
|
}
|
return content;
|
}
|
|
|
/// <summary>
|
/// WMS发起,由WCS去切换线体的模式
|
/// </summary>
|
/// <param name="saveModel"></param>
|
/// <returns></returns>
|
public static WebResponseContent ChangeLineModel(SaveModel saveModel)
|
{
|
WebResponseContent content = new WebResponseContent();
|
try
|
{
|
content = HttpHelper<SaveModel>.GetHttpRequestData(
|
saveModel, WCSAPIAddress.IPAddress + WCSAPIAddress.ChangeInboundLineModel);
|
if (!content.Status)
|
{
|
throw new Exception($"切换线体的模式WCS调用失败:" + content.Message);
|
}
|
content.OK();
|
}
|
catch (Exception ex)
|
{
|
content.Error(ex.Message);
|
}
|
return content;
|
}
|
|
|
/// <summary>
|
/// WMS发起,由WCS去切换线体的模式
|
/// </summary>
|
/// <param name="saveModel"></param>
|
/// <returns></returns>
|
public static WebResponseContent GetInboundLineCurrentModel(SaveModel saveModel)
|
{
|
WebResponseContent content = new WebResponseContent();
|
try
|
{
|
content = HttpHelper<SaveModel>.GetHttpRequestData(
|
saveModel, WCSAPIAddress.IPAddress + WCSAPIAddress.GetInboundLineCurrentModel);
|
if (!content.Status)
|
{
|
throw new Exception($"获取入库线体当前模式状态WCS调用失败:" + content.Message);
|
}
|
content.OK();
|
}
|
catch (Exception ex)
|
{
|
content.Error(ex.Message);
|
}
|
return content;
|
}
|
|
|
/// <summary>
|
/// 当托盘码校验不一致时,可由人工触发继续继续
|
/// </summary>
|
/// <param name="saveModel"></param>
|
/// <returns></returns>
|
public static WebResponseContent CheckBarcodeSameOk(SaveModel saveModel)
|
{
|
WebResponseContent content = new WebResponseContent();
|
try
|
{
|
content = HttpHelper<SaveModel>.GetHttpRequestData(
|
saveModel, WCSAPIAddress.IPAddress + WCSAPIAddress.CheckBarcodeSameOk);
|
if (!content.Status)
|
{
|
throw new Exception($"失败:" + content.Message);
|
}
|
content.OK();
|
}
|
catch (Exception ex)
|
{
|
content.Error(ex.Message);
|
}
|
return content;
|
}
|
|
|
|
/// <summary>
|
/// 称重后,由人工触发继续任务
|
/// </summary>
|
/// <param name="saveModel"></param>
|
/// <returns></returns>
|
public static WebResponseContent WeightCheckOk(SaveModel saveModel)
|
{
|
WebResponseContent content = new WebResponseContent();
|
try
|
{
|
content = HttpHelper<SaveModel>.GetHttpRequestData(
|
saveModel, WCSAPIAddress.IPAddress + WCSAPIAddress.WeightCheckOk);
|
if (!content.Status)
|
{
|
throw new Exception($"失败:" + content.Message);
|
}
|
content.OK();
|
}
|
catch (Exception ex)
|
{
|
content.Error(ex.Message);
|
}
|
return content;
|
}
|
|
|
/// <summary>
|
/// 当WCS执行入库任务时,检测到与测量出库任务冲突时,调用此接口更换目的货位,置位原来货位
|
/// </summary>
|
/// <param name="saveModel"></param>
|
/// <returns></returns>
|
public static WebResponseContent ChangeLocationIdWhenConflict(SaveModel saveModel)
|
{
|
WebResponseContent content = new WebResponseContent();
|
try
|
{
|
content = HttpHelper<SaveModel>.GetHttpRequestData(
|
saveModel, WCSAPIAddress.IPAddress + WCSAPIAddress.UpdateWcsTaskInformation);
|
if (!content.Status)
|
{
|
throw new Exception($"失败:" + content.Message);
|
}
|
content.OK();
|
}
|
catch (Exception ex)
|
{
|
content.Error(ex.Message);
|
}
|
return content;
|
}
|
|
|
/// <summary>
|
/// 取消测量,直接回库
|
/// </summary>
|
/// <param name="saveModel"></param>
|
/// <returns></returns>
|
public static WebResponseContent CancelAMeasureTask(SaveModel saveModel)
|
{
|
WebResponseContent content = new WebResponseContent();
|
try
|
{
|
content = HttpHelper<SaveModel>.GetHttpRequestData(
|
saveModel, WCSAPIAddress.IPAddress + WCSAPIAddress.CancelAMeasureTask);
|
if (!content.Status)
|
{
|
throw new Exception($"失败:" + content.Message);
|
}
|
content.OK();
|
}
|
catch (Exception ex)
|
{
|
content.Error(ex.Message);
|
}
|
return content;
|
}
|
}
|
}
|