using Microsoft.AspNetCore.Mvc; using Newtonsoft.Json; using WMS.BZModels; using WMS.BZModels.Dto.FJ.WCSCachelineDtos; using WMS.BZModels.Dto.FJ.WCSPalletizingDtos; using WMS.BZServices.FJ; using WMS.Info; using WMS.Util; namespace WMS.BZWeb.Areas.FJManager.Controllers { [Area("FJManager")] public class WCSPalletizingController : MvcControllerBase { private readonly WCSPalletizingService _WCSPalletizingServiceService; private readonly WCSPalletizingDtlService _WCSPalletizingDtlService; public WCSPalletizingController(WCSPalletizingService wCSPalletizingServiceService, WCSPalletizingDtlService wCSPalletizingDtlService) { _WCSPalletizingServiceService = wCSPalletizingServiceService; _WCSPalletizingDtlService = wCSPalletizingDtlService; } #region 视图功能 public IActionResult Index() { return View(); } public IActionResult Form() { return View(); } public IActionResult PalleCodeForm() { return View(); } #endregion public ActionResult GetPageList(string pagination, string queryJson) { Pagination paginationobj = InitPagination(pagination); var query = new WCSPalletizingQueryDto(); if (!string.IsNullOrEmpty(queryJson)) { query = JsonConvert.DeserializeObject(queryJson); } var lists = _WCSPalletizingServiceService.GetPageList(paginationobj, query ?? new WCSPalletizingQueryDto()); var jsonData = new { rows = lists.Result, total = lists.TotalPage, page = lists.PageIndex, records = lists.TotalNum }; return Success(jsonData); } public ActionResult GetPalletizingItem(string palletizingId) { if (string.IsNullOrEmpty(palletizingId)) { return Fail("码垛id不能为空"); } var list = _WCSPalletizingDtlService.GetDtlById(Convert.ToInt32(palletizingId)); return Success(list); } [HttpPost] public ActionResult UpdateFinish(string ids, int state) { if (string.IsNullOrEmpty(ids)) { return Fail("没有选择任务!"); } var lists = JsonConvert.DeserializeObject>(ids); var userid = WebUtil.GetItem("userId"); _WCSPalletizingServiceService.UpdateFinish(lists, userid?.ToString(), state); return Success("修改成功!"); } [HttpPost] public ActionResult UpdatePalleCode(string ids, string palleCode) { if (string.IsNullOrEmpty(ids)) { return Fail("没有选择任务!"); } if (string.IsNullOrEmpty(palleCode)) { return Fail("托盘条码不能为空!"); } var lists = JsonConvert.DeserializeObject>(ids); var userid = WebUtil.GetItem("userId"); _WCSPalletizingServiceService.UpdatePalleCode(lists, userid?.ToString(), palleCode); return Success("修改成功!"); } [HttpPost] public ActionResult PalletizingStation(string ids) { if (string.IsNullOrEmpty(ids)) { return Fail("没有选择跺型!"); } var lists = JsonConvert.DeserializeObject>(ids); var userid = WebUtil.GetItem("userId"); _WCSPalletizingServiceService.PalletizingStation(lists, userid?.ToString()); return Success("保存成功!"); } } }