| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- 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
- {
- /// <summary>
- /// AGV相关接口控制器
- /// </summary>
- public static class WmsApi
- {
- public static string WMSUrl = null!;
- public static string wareHouseId = null!;
- /// <summary>
- /// 分配货位
- /// </summary>
- /// <param name="wcsTaskNum">WMS任务ID</param>
- /// <param name="tunnel">巷道</param>
- /// <param name="device">设备号</param>
- /// <returns></returns>
- /// <exception cref="Exception"></exception>
- public static I_WCS_GetWareCellResponse GetLocalIn(int wcsTaskNum, string tunnel, string device)
- {
- var res = APICaller.CallApi2<I_WCS_GetWareCellResponse>(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;
- }
- /// <summary>
- /// 向WMS获取入库任务 一次单卷
- /// </summary>
- /// <param name="barcode">产品条码</param>
- /// <param name="devCode">设备条码</param>
- /// <param name="getTunnel"></param>
- /// <returns></returns>
- /// <exception cref="Exception"></exception>
- public static I_WCS_GetInTaskResponse I_WCS_GetInTask(string barcode, string devCode, bool getTunnel = false)
- {
- var res = APICaller.CallApi<I_WCS_GetInTaskResponse>(WMSUrl + "/api/Task/I_WCS_GetInTask", new List<I_WCS_GetInTaskRequest>()
- {
- 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;
- }
- }
- }
|