152 lines
3.8 KiB
C#
152 lines
3.8 KiB
C#
using HHWMS.Web.Models.Agv;
|
||
using Microsoft.AspNetCore.Http;
|
||
using Microsoft.AspNetCore.Mvc;
|
||
using WalkingTec.Mvvm.Core;
|
||
using WalkingTec.Mvvm.Core.Extensions;
|
||
using WalkingTec.Mvvm.Mvc;
|
||
|
||
namespace HHWMS.Web.Controllers
|
||
{
|
||
/// <summary>
|
||
/// AGV 任务场景配置管理页(映射上游任务类型 → AGV 场景,方案 5.6)
|
||
/// </summary>
|
||
[Area("agv")]
|
||
[ActionDescription("AGV场景配置")]
|
||
public partial class AgvTaskSceneConfigController : BaseController
|
||
{
|
||
#region Search
|
||
|
||
[ActionDescription("Sys.Search")]
|
||
public ActionResult Index()
|
||
{
|
||
var vm = Wtm.CreateVM<AgvTaskSceneConfigListVM>();
|
||
return PartialView(vm);
|
||
}
|
||
|
||
[ActionDescription("Sys.Search")]
|
||
[HttpPost]
|
||
public string Search(AgvTaskSceneConfigSearcher searcher)
|
||
{
|
||
var vm = Wtm.CreateVM<AgvTaskSceneConfigListVM>(passInit: true);
|
||
if (ModelState.IsValid)
|
||
{
|
||
vm.Searcher = searcher;
|
||
return vm.GetJson(false);
|
||
}
|
||
else
|
||
{
|
||
return vm.GetError();
|
||
}
|
||
}
|
||
|
||
#endregion Search
|
||
|
||
#region Create
|
||
|
||
[ActionDescription("Sys.Create")]
|
||
public ActionResult Create()
|
||
{
|
||
var vm = Wtm.CreateVM<AgvTaskSceneConfigVM>();
|
||
return PartialView(vm);
|
||
}
|
||
|
||
[HttpPost]
|
||
[ActionDescription("Sys.Create")]
|
||
public ActionResult Create(AgvTaskSceneConfigVM vm)
|
||
{
|
||
if (!ModelState.IsValid)
|
||
{
|
||
return PartialView(vm);
|
||
}
|
||
else
|
||
{
|
||
vm.DoAdd();
|
||
if (!ModelState.IsValid)
|
||
{
|
||
vm.DoReInit();
|
||
return PartialView(vm);
|
||
}
|
||
else
|
||
{
|
||
return FFResult().CloseDialog().RefreshGrid();
|
||
}
|
||
}
|
||
}
|
||
|
||
#endregion Create
|
||
|
||
#region Edit
|
||
|
||
[ActionDescription("Sys.Edit")]
|
||
public ActionResult Edit(string id)
|
||
{
|
||
var vm = Wtm.CreateVM<AgvTaskSceneConfigVM>(id);
|
||
return PartialView(vm);
|
||
}
|
||
|
||
[ActionDescription("Sys.Edit")]
|
||
[HttpPost]
|
||
[ValidateFormItemOnly]
|
||
public ActionResult Edit(AgvTaskSceneConfigVM vm)
|
||
{
|
||
if (!ModelState.IsValid)
|
||
{
|
||
return PartialView(vm);
|
||
}
|
||
else
|
||
{
|
||
vm.DoEdit();
|
||
if (!ModelState.IsValid)
|
||
{
|
||
vm.DoReInit();
|
||
return PartialView(vm);
|
||
}
|
||
else
|
||
{
|
||
return FFResult().CloseDialog().RefreshGridRow(vm.Entity.ID);
|
||
}
|
||
}
|
||
}
|
||
|
||
#endregion Edit
|
||
|
||
#region Delete
|
||
|
||
[ActionDescription("Sys.Delete")]
|
||
public ActionResult Delete(string id)
|
||
{
|
||
var vm = Wtm.CreateVM<AgvTaskSceneConfigVM>(id);
|
||
return PartialView(vm);
|
||
}
|
||
|
||
[ActionDescription("Sys.Delete")]
|
||
[HttpPost]
|
||
public ActionResult Delete(string id, IFormCollection nouse)
|
||
{
|
||
var vm = Wtm.CreateVM<AgvTaskSceneConfigVM>(id);
|
||
vm.DoDelete();
|
||
if (!ModelState.IsValid)
|
||
{
|
||
return PartialView(vm);
|
||
}
|
||
else
|
||
{
|
||
return FFResult().CloseDialog().RefreshGrid();
|
||
}
|
||
}
|
||
|
||
#endregion Delete
|
||
|
||
#region Details
|
||
|
||
[ActionDescription("Sys.Details")]
|
||
public ActionResult Details(string id)
|
||
{
|
||
var vm = Wtm.CreateVM<AgvTaskSceneConfigVM>(id);
|
||
return PartialView(vm);
|
||
}
|
||
|
||
#endregion Details
|
||
}
|
||
}
|