using ServiceCenter.WebApi;
using WCS.WorkEngineering.WebApi.Models.WMS.Request;
using WCS.WorkEngineering.WebApi.Models.WMS.Response;
using WCS.WorkEngineering.Worlds.Logs;
namespace WCS.WorkEngineering.WebApi.Controllers
{
///
/// AGV相关接口控制器
///
public static class WmsApi
{
public static string WMSUrl = null!;
public static string wareHouseId = null!;
///
/// 分配货位
///
/// WMS任务ID
/// 巷道
/// 设备号
///
///
public static I_WCS_GetWareCellResponse GetLocalIn(int wcsTaskNum, string tunnel, string device)
{
var res = APICaller.CallApi2(WMSUrl + "/api/Task/I_WCS_GetWareCell", new I_WCS_GetWareCellRequest
{
PickUpEquipmentNo = device,
TunnelNum = tunnel.Last().ToString(),
WCSTaskNum = wcsTaskNum.ToString(),
});
if (!res.ResType)
{
throw new KnownException(res.ResMessage, LogLevelEnum.High);
}
return res;
}
///
/// 向WMS获取入库任务 一次单卷
///
/// 产品条码
/// 设备条码
///
///
///
public static I_WCS_GetInTaskResponse I_WCS_GetInTask(string barcode, string devCode, bool getTunnel = false)
{
var res = APICaller.CallApi(WMSUrl + "/api/Task/I_WCS_GetInTask", new List()
{
new I_WCS_GetInTaskRequest(){
ContainerBarCode = barcode,
WareHouseId = wareHouseId,
EquipmentNo = devCode,
Memo1 = getTunnel ? "1" : "" //1:分巷道 2:分货位
}
});
if (!res.ResType) throw new KnownException(res.ResMessage, LogLevelEnum.High);
return res;
}
}
}