2024-11-23 20:47:14 +08:00
|
|
|
|
using Epost.BLL;
|
|
|
|
|
using Epost.Common;
|
2024-11-22 15:31:46 +08:00
|
|
|
|
using Epost.DAL.Cache;
|
|
|
|
|
using Epost.Model;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Net;
|
|
|
|
|
using System.Net.Http;
|
|
|
|
|
using System.Web.Helpers;
|
|
|
|
|
using System.Web.Http;
|
|
|
|
|
|
|
|
|
|
namespace Epost.DPS.Controllers
|
|
|
|
|
{
|
|
|
|
|
[RoutePrefix("api/AgvTaskApi")]
|
|
|
|
|
public class AgvTaskApiController : ApiController
|
|
|
|
|
{
|
2024-11-23 20:47:14 +08:00
|
|
|
|
InboundOrdersBLL inboundBLL = new InboundOrdersBLL();
|
2024-11-22 15:31:46 +08:00
|
|
|
|
[Route("agvCallback")]
|
|
|
|
|
[HttpPost]
|
2024-11-23 20:47:14 +08:00
|
|
|
|
public AgvResultModel agvCallback([FromBody]agvCallbackModel data)
|
2024-11-22 15:31:46 +08:00
|
|
|
|
{
|
|
|
|
|
AgvResultModel retModel = new AgvResultModel();
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
2024-11-23 20:47:14 +08:00
|
|
|
|
LogHelper.WriteLogInfo("请求报文" + JsonHelper.SerializeObject(data));
|
|
|
|
|
string state = string.Empty;
|
|
|
|
|
if (data.method == "start")
|
|
|
|
|
{
|
2024-11-27 18:33:35 +08:00
|
|
|
|
state = "2";//任务开始启动
|
2024-11-23 20:47:14 +08:00
|
|
|
|
}
|
|
|
|
|
else if (data.method == "outbin") {
|
2024-11-27 18:33:35 +08:00
|
|
|
|
state = "3";//走出储位
|
2024-11-23 20:47:14 +08:00
|
|
|
|
}
|
|
|
|
|
else if (data.method == "end")
|
|
|
|
|
{
|
2024-11-27 18:33:35 +08:00
|
|
|
|
state = "4";
|
2024-11-23 20:47:14 +08:00
|
|
|
|
//更新任务已完成
|
|
|
|
|
}
|
2024-11-27 10:39:18 +08:00
|
|
|
|
else if (data.method == "cancel") {
|
|
|
|
|
state = "88";
|
|
|
|
|
}
|
2024-11-23 20:47:14 +08:00
|
|
|
|
else { }
|
2024-11-22 15:31:46 +08:00
|
|
|
|
|
2024-11-23 20:47:14 +08:00
|
|
|
|
inboundBLL.UpInOrderListByAgvid(data.taskCode,state);
|
|
|
|
|
//ResultMessageModel data = new ResultMessageModel();
|
|
|
|
|
//data.Parameter = model.reqCode;
|
|
|
|
|
//data.Status = model.method;
|
|
|
|
|
//data.Address = model.taskCode;
|
|
|
|
|
//JobCache.UpdateJobDownModelList(new List<ResultMessageModel>() { data }, EdownCommend.Create);
|
2024-11-22 15:31:46 +08:00
|
|
|
|
retModel.message = "成功!";
|
|
|
|
|
retModel.code = "0";
|
2024-11-23 20:47:14 +08:00
|
|
|
|
retModel.reqCode = data.reqCode;
|
2024-11-22 15:31:46 +08:00
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
LogHelper.WriteLogInfo("agvPutTask异常:" + ex.ToString(), LogHelper.Log_Type.ERROR);
|
|
|
|
|
retModel.message = "请求接口异常!";
|
|
|
|
|
retModel.code = "-1";
|
2024-11-23 20:47:14 +08:00
|
|
|
|
retModel.reqCode = data.reqCode;
|
2024-11-22 15:31:46 +08:00
|
|
|
|
}
|
2024-11-23 20:47:14 +08:00
|
|
|
|
|
2024-11-22 15:31:46 +08:00
|
|
|
|
return retModel;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|