243 lines
6.4 KiB
C#
243 lines
6.4 KiB
C#
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
|
|
{
|
|
[Area("shipment")]
|
|
[ActionDescription("出库单明细历史")]
|
|
public partial class ShipmentDetailHistoryController : BaseController
|
|
{
|
|
private readonly IUnitWork _unitwork;
|
|
|
|
public ShipmentDetailHistoryController(IUnitWork unitwork)
|
|
{
|
|
_unitwork = unitwork;
|
|
}
|
|
|
|
#region Search
|
|
|
|
[ActionDescription("Sys.Search")]
|
|
public ActionResult Index()
|
|
{
|
|
var vm = Wtm.CreateVM<ShipmentDetailHistoryListVM>();
|
|
return PartialView(vm);
|
|
}
|
|
|
|
[ActionDescription("Sys.Search")]
|
|
[HttpPost]
|
|
public string Search(ShipmentDetailHistorySearcher searcher)
|
|
{
|
|
var vm = Wtm.CreateVM<ShipmentDetailHistoryListVM>(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<ShipmentDetailHistoryVM>();
|
|
return PartialView(vm);
|
|
}
|
|
|
|
[HttpPost]
|
|
[ActionDescription("Sys.Create")]
|
|
public ActionResult Create(ShipmentDetailHistoryVM 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<ShipmentDetailHistoryVM>(id);
|
|
return PartialView(vm);
|
|
}
|
|
|
|
[ActionDescription("Sys.Edit")]
|
|
[HttpPost]
|
|
[ValidateFormItemOnly]
|
|
public ActionResult Edit(ShipmentDetailHistoryVM 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<ShipmentDetailHistoryVM>(id);
|
|
return PartialView(vm);
|
|
}
|
|
|
|
[ActionDescription("Sys.Delete")]
|
|
[HttpPost]
|
|
public ActionResult Delete(string id, IFormCollection nouse)
|
|
{
|
|
var vm = Wtm.CreateVM<ShipmentDetailHistoryVM>(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<ShipmentDetailHistoryVM>(id);
|
|
return PartialView(vm);
|
|
}
|
|
|
|
#endregion Details
|
|
|
|
#region BatchEdit
|
|
|
|
[HttpPost]
|
|
[ActionDescription("Sys.BatchEdit")]
|
|
public ActionResult BatchEdit(string[] IDs)
|
|
{
|
|
var vm = Wtm.CreateVM<ShipmentDetailHistoryBatchVM>(Ids: IDs);
|
|
return PartialView(vm);
|
|
}
|
|
|
|
[HttpPost]
|
|
[ActionDescription("Sys.BatchEdit")]
|
|
public ActionResult DoBatchEdit(ShipmentDetailHistoryBatchVM vm, IFormCollection nouse)
|
|
{
|
|
if (!ModelState.IsValid || !vm.DoBatchEdit())
|
|
{
|
|
return PartialView("BatchEdit", vm);
|
|
}
|
|
else
|
|
{
|
|
return FFResult().CloseDialog().RefreshGrid().Alert(Localizer["Sys.BatchEditSuccess", vm.Ids.Length]);
|
|
}
|
|
}
|
|
|
|
#endregion BatchEdit
|
|
|
|
#region BatchDelete
|
|
|
|
[HttpPost]
|
|
[ActionDescription("Sys.BatchDelete")]
|
|
public ActionResult BatchDelete(string[] IDs)
|
|
{
|
|
var vm = Wtm.CreateVM<ShipmentDetailHistoryBatchVM>(Ids: IDs);
|
|
return PartialView(vm);
|
|
}
|
|
|
|
[HttpPost]
|
|
[ActionDescription("Sys.BatchDelete")]
|
|
public ActionResult DoBatchDelete(ShipmentDetailHistoryBatchVM vm, IFormCollection nouse)
|
|
{
|
|
if (!ModelState.IsValid || !vm.DoBatchDelete())
|
|
{
|
|
return PartialView("BatchDelete", vm);
|
|
}
|
|
else
|
|
{
|
|
return FFResult().CloseDialog().RefreshGrid().Alert(Localizer["Sys.BatchDeleteSuccess", vm.Ids.Length]);
|
|
}
|
|
}
|
|
|
|
#endregion BatchDelete
|
|
|
|
#region Import
|
|
|
|
[ActionDescription("Sys.Import")]
|
|
public ActionResult Import()
|
|
{
|
|
var vm = Wtm.CreateVM<ShipmentDetailHistoryImportVM>();
|
|
return PartialView(vm);
|
|
}
|
|
|
|
[HttpPost]
|
|
[ActionDescription("Sys.Import")]
|
|
public ActionResult Import(ShipmentDetailHistoryImportVM vm, IFormCollection nouse)
|
|
{
|
|
if (vm.ErrorListVM.EntityList.Count > 0 || !vm.BatchSaveData())
|
|
{
|
|
return PartialView(vm);
|
|
}
|
|
else
|
|
{
|
|
return FFResult().CloseDialog().RefreshGrid().Alert(Localizer["Sys.ImportSuccess", vm.EntityList.Count.ToString()]);
|
|
}
|
|
}
|
|
|
|
#endregion Import
|
|
|
|
#region Export
|
|
|
|
[ActionDescription("Sys.Export")]
|
|
[HttpPost]
|
|
public IActionResult ExportExcel(ShipmentDetailHistoryListVM vm)
|
|
{
|
|
return vm.GetExportData();
|
|
}
|
|
|
|
#endregion Export
|
|
}
|
|
}
|