123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235 |
- using Mapster;
- using Microsoft.AspNetCore.Mvc;
- using Newtonsoft.Json;
- using wms.sqlsugar.model.fj;
- using WMS.BZModels;
- using WMS.BZModels.Dto.FJ.BillBom;
- using WMS.BZModels.Models.FJ;
- using WMS.BZServices.FJ;
- using WMS.Info;
- using WMS.Util;
- namespace WMS.BZWeb.Areas.FJManager.Controllers
- {
- [Area("FJManager")]
- public class BillBomSetController : MvcControllerBase
- {
- private readonly BillBomSetService _billBomSetService;
- public BillBomSetController(BillBomSetService billBomSetService)
- {
- _billBomSetService = billBomSetService;
- }
- #region 视图功能
- public IActionResult Index()
- {
- return View();
- }
- public IActionResult DFM09()
- {
- return View();
- }
- public IActionResult DFM1509()
- {
- return View();
- }
- public IActionResult DOF2()
- {
- return View();
- }
- public IActionResult DOF4()
- {
- return View();
- }
- public IActionResult DFM6()
- {
- return View();
- }
- public IActionResult Exception()
- {
- return View();
- }
- public IActionResult DFMAll()
- {
- return View();
- }
- public IActionResult PaiKu()
- {
- return View();
- }
- #endregion
- public ActionResult GetPageList(string pagination, string queryJson)
- {
- Pagination paginationobj = InitPagination(pagination);
- var query = new BillBomsetgrpQueryDto();
- if (!string.IsNullOrEmpty(queryJson))
- {
- query = JsonConvert.DeserializeObject<BillBomsetgrpQueryDto>(queryJson);
- }
- var lists = _billBomSetService.GetPageList(paginationobj, query ?? new BillBomsetgrpQueryDto());
- var jsonData = new
- {
- rows = lists.Result,
- total = lists.TotalPage,
- page = lists.PageIndex,
- records = lists.TotalNum
- };
- return Success(jsonData);
- }
- public ActionResult GetPaiKuList(string pagination, string queryJson)
- {
- Pagination paginationobj = InitPagination(pagination);
- var query = new BillPaiKuQueryDto();
- if (!string.IsNullOrEmpty(queryJson))
- {
- query = JsonConvert.DeserializeObject<BillPaiKuQueryDto>(queryJson);
- }
- var lists = _billBomSetService.GetPaiKuList(paginationobj, query ?? new BillPaiKuQueryDto());
- var jsonData = new
- {
- rows = lists.Result,
- total = lists.TotalPage,
- page = lists.PageIndex,
- records = lists.TotalNum
- };
- return Success(jsonData);
- }
- public ActionResult GetBillBomSetInfoItem(string bomSetHdrId)
- {
- if (string.IsNullOrWhiteSpace(bomSetHdrId))
- {
- return Fail("跺型Id不能为空");
- }
- if (!long.TryParse(bomSetHdrId, out var id))
- {
- return Fail("跺型Id不能为空");
- }
- var list = _billBomSetService.GetBillBomsetinfoItem(id);
- return Success(list);
- }
- public ActionResult GetBillBomsetinfo(string id)
- {
- if (string.IsNullOrWhiteSpace(id))
- {
- return Fail("跺型Id不能为空");
- }
- if (!long.TryParse(id, out var bomsetid))
- {
- return Fail("跺型Id不能为空");
- }
- var dto = _billBomSetService.GetBillBomsetinfo(bomsetid);
- return Success(dto);
- }
- public ActionResult GetSelectCodeListByType(string typenum)
- {
- var list = _billBomSetService.GetSelectCodeListByType(typenum);
- return Success(list);
- }
- [HttpPost]
- public ActionResult Save09Form(string keyValue, BillBomsetDto Data)
- {
- LoginUserInfo LoginUser = GetLoginUser();
- _billBomSetService.Save09(LoginUser, keyValue, Data.Adapt<BillBomsetgrp>(), Data.Bomsetinfos.Adapt<List<BillBomsetinfo>>());
- return Success("保存成功。");
- }
- [HttpPost]
- public ActionResult SaveForm(string keyValue, BillBomsetDto Data)
- {
- LoginUserInfo LoginUser = GetLoginUser();
- _billBomSetService.Save(LoginUser, keyValue, Data.Adapt<BillBomsetgrp>(), Data.Bomsetinfos.Adapt<List<BillBomsetinfo>>());
- return Success("保存成功。");
- }
- [HttpPost]
- public ActionResult SaveFormPK(string keyValue, BillPaiKu Data)
- {
- LoginUserInfo LoginUser = GetLoginUser();
- _billBomSetService.SavePK(LoginUser,keyValue,Data);
- return Success("保存成功");
- }
- [HttpPost]
- public ActionResult DeletePK(long keyValue)
- {
- _billBomSetService.DeletePK(keyValue);
- return Success("删除成功。");
- }
- [HttpPost]
- public ActionResult SaveExceptionForm(string keyValue, BillBomsetDto Data)
- {
- LoginUserInfo LoginUser = GetLoginUser();
- _billBomSetService.SaveException(LoginUser, keyValue, Data.Adapt<BillBomsetgrp>(), Data.Bomsetinfos.Adapt<List<BillBomsetinfo>>());
- return Success("保存成功。");
- }
- [HttpPost]
- public ActionResult Delete(string keyValue)
- {
- if (string.IsNullOrWhiteSpace(keyValue))
- {
- return Fail("跺型Id不能为空");
- }
- if (!long.TryParse(keyValue, out var id))
- {
- return Fail("跺型Id不能为空");
- }
- _billBomSetService.Delete(id);
- return Success("删除成功。");
- }
- [HttpPost]
- public ActionResult Deletes(string[] keyValue)
- {
- if (keyValue == null || keyValue.Length == 0)
- {
- return Fail("跺型Id不能为空");
- }
- var userid = WebUtil.GetItem("userId");
- _billBomSetService.Deletes(keyValue, userid?.ToString());
- return Success("删除成功。");
- }
- [HttpPost]
- public ActionResult Enables(string ids)
- {
- if (string.IsNullOrEmpty(ids))
- {
- return Fail("没有选择跺型!");
- }
- var lists = JsonConvert.DeserializeObject<List<string>>(ids);
- var userid = WebUtil.GetItem("userId");
- _billBomSetService.ChangeEnableds(lists, LocationStop.LocationInvoke, userid?.ToString());
- return Success("保存成功!");
- }
- [HttpPost]
- public ActionResult Disables(string ids)
- {
- if (string.IsNullOrEmpty(ids))
- {
- return Fail("没有选择跺型!");
- }
- var lists = JsonConvert.DeserializeObject<List<string>>(ids);
- var userid = WebUtil.GetItem("userId");
- _billBomSetService.ChangeEnableds(lists, LocationStop.LocationStopped, userid?.ToString());
- return Success("保存成功!");
- }
- }
- }
|