53 lines
1.6 KiB
C#
53 lines
1.6 KiB
C#
using Microsoft.AspNetCore.Mvc;
|
|
using HHWMS.Web.Models;
|
|
using System.Threading.Tasks;
|
|
using WalkingTec.Mvvm.Core;
|
|
using System.Collections.Generic;
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using System;
|
|
using WalkingTec.Mvvm.Core;
|
|
using WalkingTec.Mvvm.Mvc;
|
|
using WalkingTec.Mvvm.Core.Extensions;
|
|
|
|
namespace HHWMS.Web.Controllers
|
|
{
|
|
[Area("WCS")]
|
|
[ActionDescription("WCS任务测试")]
|
|
public class WCSTaskController : BaseController
|
|
{
|
|
/// <summary>
|
|
/// WCS任务下发页面
|
|
/// </summary>
|
|
public IActionResult Index()
|
|
{
|
|
return PartialView("Index");
|
|
}
|
|
|
|
/// <summary>
|
|
/// 提交WCS任务
|
|
/// </summary>
|
|
[HttpPost]
|
|
public IActionResult SubmitTask([FromBody] WCSTaskModel model)
|
|
{
|
|
try
|
|
{
|
|
// 调用WCS任务下发接口
|
|
var result = Wtm.CallAPI<WCSTaskResponse>("WCS", "TaskAssign", HttpMethodEnum.POST, model).Result.Data;
|
|
|
|
if (result != null && result.Success)
|
|
{
|
|
return Json(new { Success = true, Msg = result.Msg ?? "接收任务成功", Data = (object)null });
|
|
}
|
|
else
|
|
{
|
|
return Json(new { Success = false, Msg = result?.Msg ?? "任务下发失败", Data = (object)null });
|
|
}
|
|
}
|
|
catch (System.Exception ex)
|
|
{
|
|
return Json(new { Success = false, Msg = $"任务下发失败:{ex.Message}", Data = (object)null });
|
|
}
|
|
}
|
|
}
|
|
} |