選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 
 
 
 

219 行
6.4 KiB

  1. using System;
  2. using Learun.Util;
  3. using System.Data;
  4. using Learun.Application.TwoDevelopment.AssetManagementSystem;
  5. using System.Web.Mvc;
  6. using System.Collections.Generic;
  7. using System.Linq;
  8. using ClosedXML.Excel;
  9. using Learun.Application.Base.SystemModule;
  10. namespace Learun.Application.Web.Areas.AssetManagementSystem.Controllers
  11. {
  12. /// <summary>
  13. /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
  14. /// Copyright (c) 2013-2018 北京泉江科技有限公司
  15. /// 创 建:超级管理员
  16. /// 日 期:2019-03-29 11:22
  17. /// 描 述:登记在册资产
  18. /// </summary>
  19. public class Ass_AssetsInfoController : MvcControllerBase
  20. {
  21. private Ass_AssetsInfoIBLL ass_AssetsInfoIBLL = new Ass_AssetsInfoBLL();
  22. private DataItemIBLL dataItemIbll=new DataItemBLL();
  23. #region 视图功能
  24. /// <summary>
  25. /// 主页面
  26. /// <summary>
  27. /// <returns></returns>
  28. [HttpGet]
  29. public ActionResult Index()
  30. {
  31. return View();
  32. }
  33. /// <summary>
  34. /// 表单页
  35. /// <summary>
  36. /// <returns></returns>
  37. [HttpGet]
  38. public ActionResult Form()
  39. {
  40. return View();
  41. }
  42. /// <summary>
  43. /// 打印清单
  44. /// <summary>
  45. /// <returns></returns>
  46. [HttpGet]
  47. public ActionResult Inventory()
  48. {
  49. return View();
  50. }
  51. #endregion
  52. #region 获取数据
  53. /// <summary>
  54. /// 获取页面显示列表数据
  55. /// <summary>
  56. /// <param name="queryJson">查询参数</param>
  57. /// <returns></returns>
  58. [HttpGet]
  59. [AjaxOnly]
  60. public ActionResult GetPageList(string pagination, string queryJson)
  61. {
  62. Pagination paginationobj = pagination.ToObject<Pagination>();
  63. var data = ass_AssetsInfoIBLL.GetPageList(paginationobj, queryJson);
  64. var jsonData = new
  65. {
  66. rows = data,
  67. total = paginationobj.total,
  68. page = paginationobj.page,
  69. records = paginationobj.records
  70. };
  71. return Success(jsonData);
  72. }
  73. /// <summary>
  74. /// 获取列表不带分页
  75. /// </summary>
  76. /// <param name="queryJson"></param>
  77. /// <returns></returns>
  78. [HttpGet]
  79. [AjaxOnly]
  80. public ActionResult GetList(string queryJson)
  81. {
  82. var data = ass_AssetsInfoIBLL.GetList(queryJson);
  83. return Success(data);
  84. }
  85. /// <summary>
  86. /// 获取列表不带分页
  87. /// </summary>
  88. /// <param name="queryJson"></param>
  89. /// <returns></returns>
  90. [HttpGet]
  91. [AjaxOnly]
  92. public ActionResult GetListHaoCai(string queryJson)
  93. {
  94. var data = ass_AssetsInfoIBLL.GetListHaoCai(queryJson);
  95. return Success(data);
  96. }
  97. /// <summary>
  98. /// 获取左侧树形数据
  99. /// <summary>
  100. /// <returns></returns>
  101. [HttpGet]
  102. [AjaxOnly]
  103. public ActionResult GetTree()
  104. {
  105. var data = ass_AssetsInfoIBLL.GetTree();
  106. return Success(data);
  107. }
  108. /// <summary>
  109. /// 获取表单数据
  110. /// <summary>
  111. /// <returns></returns>
  112. [HttpGet]
  113. [AjaxOnly]
  114. public ActionResult GetFormData(string keyValue)
  115. {
  116. var Ass_AssetsInfoData = ass_AssetsInfoIBLL.GetAss_AssetsInfoEntity( keyValue );
  117. var jsonData = new {
  118. Ass_AssetsInfo = Ass_AssetsInfoData,
  119. };
  120. return Success(jsonData);
  121. }
  122. [HttpPost]
  123. [AjaxOnly]
  124. public ActionResult GetFormDataByCode(string code)
  125. {
  126. var Ass_AssetsInfoData = ass_AssetsInfoIBLL.GetAss_AssetsInfoEntityByCode( code );
  127. var jsonData = new {
  128. Ass_AssetsInfo = Ass_AssetsInfoData,
  129. };
  130. return Success(jsonData);
  131. }
  132. #endregion
  133. #region 提交数据
  134. /// <summary>
  135. /// 删除实体数据
  136. /// <param name="keyValue">主键</param>
  137. /// <summary>
  138. /// <returns></returns>
  139. [HttpPost]
  140. [AjaxOnly]
  141. public ActionResult DeleteForm(string keyValue)
  142. {
  143. ass_AssetsInfoIBLL.DeleteEntity(keyValue);
  144. return Success("删除成功!");
  145. }
  146. public ActionResult ArrangementAss()
  147. {
  148. ass_AssetsInfoIBLL.ArrangementAss();
  149. return Success("整理成功");
  150. }
  151. /// <summary>
  152. /// 根据资产id 获取资产信息
  153. /// </summary>
  154. /// <param name="assIds">资产id</param>
  155. /// <returns></returns>
  156. [HttpGet]
  157. [AjaxOnly]
  158. public ActionResult GetInventoryInfo(string assIds)
  159. {
  160. var ids = assIds.Split(',').ToList();
  161. var assList = ass_AssetsInfoIBLL.GetListByIds(ids).ToList();
  162. var unitList = dataItemIbll.GetDetailList("sldw");
  163. var ItemList = new List<object>();
  164. foreach (var item in assList)
  165. {
  166. ItemList.Add(new
  167. {
  168. aOrder = assList.IndexOf(item),//序号
  169. aName = item.AName,//名字
  170. aUnit = unitList.FirstOrDefault(a => a.F_ItemValue == item.AUnit)?.F_ItemName,//单位
  171. aNum = item.AStock,
  172. aPrice = item.APrice,//价格
  173. aAllPrice = item.APrice * item.AStock,//总价格
  174. });
  175. }
  176. var data = new
  177. {
  178. projectName = "",
  179. applyData = DateTime.Now.ToString("yyyy年MM月dd日"),
  180. list = ItemList
  181. };
  182. return Success(data);
  183. }
  184. /// <summary>
  185. /// 保存实体数据(新增、修改)
  186. /// <param name="keyValue">主键</param>
  187. /// <summary>
  188. /// <returns></returns>
  189. [HttpPost]
  190. [ValidateAntiForgeryToken]
  191. [AjaxOnly]
  192. public ActionResult SaveForm(string keyValue, string strEntity)
  193. {
  194. Ass_AssetsInfoEntity entity = strEntity.ToObject<Ass_AssetsInfoEntity>();
  195. ass_AssetsInfoIBLL.SaveEntity(keyValue,entity);
  196. return Success("保存成功!");
  197. }
  198. #endregion
  199. }
  200. }