using Microsoft.AspNetCore.Mvc; using Newtonsoft.Json; using wms.sqlsugar.model.pt; using WMS.BZModels; using WMS.BZModels.Dto.PT.WareCellDtos; using WMS.BZModels.Dto.PT.TaskDtos; using WMS.BZUtil; using WMS.Core; using WMS.Info; using WMS.Util; using WMS.BZServices.PT; namespace WMS.BZWeb.Areas.PTManager.Controllers { [Area("PTManager")] public class BaseWareCellController : MvcControllerBase { private readonly WareCellService _wareCellService; public BaseWareCellController(WareCellService wareCellService) { _wareCellService = wareCellService; } public IActionResult Index() { return View(); } public ActionResult Form() { return View(); } public ActionResult GetPageList(string pagination, string queryJson) { Pagination paginationobj = InitPagination(pagination); var query = new WarecellListQueryDto(); if (!string.IsNullOrEmpty(queryJson)) { query = JsonConvert.DeserializeObject(queryJson); } var lists = _wareCellService.GetPageList(paginationobj, query ?? new WarecellListQueryDto()); var jsonData = new { rows = lists.Result, total = lists.TotalPage, page = lists.PageIndex, records = lists.TotalNum }; return Success(jsonData); } [HttpPost] public ActionResult EnableWareCells(string ids) { if (string.IsNullOrEmpty(ids)) { return Fail("没有选择货位!"); } var lists = JsonConvert.DeserializeObject>(ids); var userid = WebUtil.GetItem("userId"); _wareCellService.ChangeWareCells(lists, LocationStop.LocationInvoke, userid?.ToString()); return Success("保存成功!"); } [HttpPost] public ActionResult DisableWareCells(string ids) { if (string.IsNullOrEmpty(ids)) { return Fail("没有选择货位!"); } var lists = JsonConvert.DeserializeObject>(ids); var userid = WebUtil.GetItem("userId"); _wareCellService.ChangeWareCells(lists, LocationStop.LocationStopped, userid?.ToString()); return Success("保存成功!"); } [HttpPost] public ActionResult SaveForm(string keyValue, BaseWarecell Data) { LoginUserInfo LoginUser = GetLoginUser(); _wareCellService.Save(LoginUser, keyValue, Data); return Success("保存成功。"); } [HttpPost] public ActionResult Delete(string keyValue) { _wareCellService.Delete(keyValue); return Success("删除成功。"); } } }