using Learun.Util; using System.Data; using Learun.Application.TwoDevelopment.AssetManagementSystem; using System.Web.Mvc; using System.Collections.Generic; using System.Linq; using Learun.Application.Base.SystemModule; using Learun.Application.Organization; namespace Learun.Application.Web.Areas.AssetManagementSystem.Controllers { /// /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园 /// Copyright (c) 2013-2018 北京泉江科技有限公司 /// 创 建:超级管理员 /// 日 期:2020-08-07 16:34 /// 描 述:耗材领取 /// public class Ass_ReceiveController : MvcControllerBase { private Ass_ReceiveIBLL ass_ReceiveIBLL = new Ass_ReceiveBLL(); private Ass_ReceiveItemIBLL assReceiveItemIbll = new Ass_ReceiveItemBLL(); private DataItemIBLL dataItemIbll = new DataItemBLL(); private Ass_AssetsInfoIBLL assAssetsInfoIbll = new Ass_AssetsInfoBLL(); private UserIBLL userIbll=new UserBLL(); #region 视图功能 /// /// 主页面 /// /// [HttpGet] public ActionResult Index() { return View(); } /// /// 表单页 /// /// [HttpGet] public ActionResult Form() { return View(); } [HttpGet] public ActionResult FormView() { return View(); } [HttpGet] public ActionResult Inventory() { return View(); } #endregion #region 获取数据 /// /// 获取页面显示列表数据 /// /// 查询参数 /// [HttpGet] [AjaxOnly] public ActionResult GetPageList(string pagination, string queryJson) { Pagination paginationobj = pagination.ToObject(); var data = ass_ReceiveIBLL.GetPageList(paginationobj, queryJson); var jsonData = new { rows = data, total = paginationobj.total, page = paginationobj.page, records = paginationobj.records }; return Success(jsonData); } /// /// 获取表单数据 /// /// [HttpGet] [AjaxOnly] public ActionResult GetFormData(string keyValue) { var Ass_ReceiveData = ass_ReceiveIBLL.GetAss_ReceiveEntity(keyValue); var Ass_ReceiveItem = assReceiveItemIbll.GetList(keyValue); var jsonData = new { Ass_Receive = Ass_ReceiveData, Ass_ReceiveItem }; return Success(jsonData); } /// /// 获取表单数据 /// /// [HttpGet] [AjaxOnly] public ActionResult GetFormDataByProcessId(string processId) { var Ass_Receive = ass_ReceiveIBLL.GetEntityByProcessId(processId); var Ass_ReceiveItem = assReceiveItemIbll.GetList(Ass_Receive.RID); var jsonData = new { Ass_Receive, Ass_ReceiveItem, }; return Success(jsonData); } #endregion /// /// 获取出库清单数据 /// /// 出库单id /// [HttpGet] [AjaxOnly] public ActionResult GetInventoryInfo(string applyId) { var outEntity = ass_ReceiveIBLL.GetAss_ReceiveEntity(applyId); var outItem = assReceiveItemIbll.GetList(applyId).ToList(); var unitList = dataItemIbll.GetDetailList("sldw"); var ItemList = new List(); foreach (var item in outItem) { var entity = assAssetsInfoIbll.GetAss_AssetsInfoEntity(item.AID); ItemList.Add(new { aOrder = outItem.IndexOf(item),//序号 aName = entity.AName,//名字 aUnit = unitList.FirstOrDefault(a => a.F_ItemValue == entity.AUnit)?.F_ItemName,//单位 aNum = item.ANum, aPrice = entity.APrice,//价格 aAllPrice = entity.APrice * int.Parse(item.ANum),//总价格 }); } var data = new { projectName = "", departmentId=outEntity.PDepartment, applyData=outEntity.RTime.ToDate().ToString("yyyy年MM月dd日"), list = ItemList }; return Success(data); } #region 提交数据 /// /// 删除实体数据 /// 主键 /// /// [HttpPost] [AjaxOnly] public ActionResult DeleteForm(string keyValue) { ass_ReceiveIBLL.DeleteEntity(keyValue); return Success("删除成功!"); } /// /// 保存实体数据(新增、修改) /// 主键 /// /// [HttpPost] [ValidateAntiForgeryToken] [AjaxOnly] public ActionResult SaveForm(string keyValue, string strEntity, string receItemList) { Ass_ReceiveEntity entity = strEntity.ToObject(); var list = receItemList.ToObject>(); ass_ReceiveIBLL.SaveEntity(keyValue, entity, list); return Success("保存成功!"); } [HttpPost] [AjaxOnly] public ActionResult ChangeStatusById(string keyValue, string processId) { ass_ReceiveIBLL.ChangeStatusById(keyValue, 1, processId); return Success("操作成功!"); } #endregion } }