123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- using Microsoft.AspNetCore.Mvc;
- using Newtonsoft.Json;
- using WMS.BZModels;
- using WMS.BZUtil;
- using WMS.Core;
- using WMS.Info;
- using WMS.Util;
- using PdfSharp.Pdf;
- using System.Threading.Tasks;
- using WMS.BZServices.KLHC;
- using WMS.BZModels.Dto.KLHC.WareCellDtos;
- using WMS.BZModels.Models.KLHC;
- namespace WMS.BZWeb.Areas.KLHCManager.Controllers
- {
- [Area("KLHCManager")]
- 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 SizeForm()
- {
- return View();
- }
-
- public ActionResult GetPageList(string pagination, string queryJson)
- {
- Pagination paginationobj = InitPagination(pagination);
- var query = new WarecellListQueryDto();
- if (!string.IsNullOrEmpty(queryJson))
- {
- query = JsonConvert.DeserializeObject<WarecellListQueryDto>(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);
- }
- public ActionResult GetListsByGroupID(string groupId)
- {
- if (string.IsNullOrEmpty(groupId))
- {
- return Fail("编号不能为空");
- }
- var list = _wareCellService.GetListsByGroupID(Convert.ToInt64(groupId));
- return Success(list);
- }
- [HttpPost]
- public ActionResult EnableWareCells(string ids)
- {
- if (string.IsNullOrEmpty(ids))
- {
- return Fail("没有选择货位!");
- }
- var lists = JsonConvert.DeserializeObject<List<string>>(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<List<string>>(ids);
- var userid = WebUtil.GetItem("userId");
- _wareCellService.ChangeWareCells(lists, LocationStop.LocationStopped, userid?.ToString());
- return Success("保存成功!");
- }
- [HttpPost]
- public ActionResult SaveForm(string keyValue, BaseWarecell Data)
- {
- if(!long.TryParse(keyValue, out var _keyvalue))
- {
- return Fail("货位编号错误!");
- }
- LoginUserInfo LoginUser = GetLoginUser();
- _wareCellService.Save(LoginUser, _keyvalue, Data);
- return Success("保存成功。");
- }
- [HttpPost]
- public ActionResult Delete(string keyValue)
- {
- _wareCellService.Delete(keyValue);
- return Success("删除成功。");
- }
- [HttpPost]
- public ActionResult UpdateCellState(string CellCode, string Status)
- {
- if (string.IsNullOrWhiteSpace(CellCode))
- {
- return Fail("货位不能为空!");
- }
- if(!int.TryParse(Status,out var status))
- {
- return Fail("货位状态值不对!");
- }
-
- var userid = WebUtil.GetItem("userId");
- LoginUserInfo LoginUser = GetLoginUser();
- _wareCellService.UpdateCellState(CellCode, status, LoginUser);
- return Success("保存成功。");
- }
- [HttpPost]
- public ActionResult UpdateSize(string ids, string size)
- {
- if (string.IsNullOrEmpty(ids))
- {
- return Fail("没有选择货位!");
- }
- if (string.IsNullOrEmpty(size))
- {
- return Fail("货位值不能为空!");
- }
- if(!int.TryParse(size,out var _size))
- {
- return Fail("货位值不正确!");
- }
- var lists = JsonConvert.DeserializeObject<List<string>>(ids);
- var userid = WebUtil.GetItem("userId");
- _wareCellService.UpdateSize(lists, userid?.ToString(), _size);
- return Success("修改成功!");
- }
- }
- }
|