You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Ass_ReceiveController.cs 6.2 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. using Learun.Util;
  2. using System.Data;
  3. using Learun.Application.TwoDevelopment.AssetManagementSystem;
  4. using System.Web.Mvc;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using Learun.Application.Base.SystemModule;
  8. using Learun.Application.Organization;
  9. namespace Learun.Application.Web.Areas.AssetManagementSystem.Controllers
  10. {
  11. /// <summary>
  12. /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
  13. /// Copyright (c) 2013-2018 北京泉江科技有限公司
  14. /// 创 建:超级管理员
  15. /// 日 期:2020-08-07 16:34
  16. /// 描 述:耗材领取
  17. /// </summary>
  18. public class Ass_ReceiveController : MvcControllerBase
  19. {
  20. private Ass_ReceiveIBLL ass_ReceiveIBLL = new Ass_ReceiveBLL();
  21. private Ass_ReceiveItemIBLL assReceiveItemIbll = new Ass_ReceiveItemBLL();
  22. private DataItemIBLL dataItemIbll = new DataItemBLL();
  23. private Ass_AssetsInfoIBLL assAssetsInfoIbll = new Ass_AssetsInfoBLL();
  24. private UserIBLL userIbll=new UserBLL();
  25. #region 视图功能
  26. /// <summary>
  27. /// 主页面
  28. /// <summary>
  29. /// <returns></returns>
  30. [HttpGet]
  31. public ActionResult Index()
  32. {
  33. return View();
  34. }
  35. /// <summary>
  36. /// 表单页
  37. /// <summary>
  38. /// <returns></returns>
  39. [HttpGet]
  40. public ActionResult Form()
  41. {
  42. return View();
  43. }
  44. [HttpGet]
  45. public ActionResult FormView()
  46. {
  47. return View();
  48. }
  49. [HttpGet]
  50. public ActionResult Inventory()
  51. {
  52. return View();
  53. }
  54. #endregion
  55. #region 获取数据
  56. /// <summary>
  57. /// 获取页面显示列表数据
  58. /// <summary>
  59. /// <param name="queryJson">查询参数</param>
  60. /// <returns></returns>
  61. [HttpGet]
  62. [AjaxOnly]
  63. public ActionResult GetPageList(string pagination, string queryJson)
  64. {
  65. Pagination paginationobj = pagination.ToObject<Pagination>();
  66. var data = ass_ReceiveIBLL.GetPageList(paginationobj, queryJson);
  67. var jsonData = new
  68. {
  69. rows = data,
  70. total = paginationobj.total,
  71. page = paginationobj.page,
  72. records = paginationobj.records
  73. };
  74. return Success(jsonData);
  75. }
  76. /// <summary>
  77. /// 获取表单数据
  78. /// <summary>
  79. /// <returns></returns>
  80. [HttpGet]
  81. [AjaxOnly]
  82. public ActionResult GetFormData(string keyValue)
  83. {
  84. var Ass_ReceiveData = ass_ReceiveIBLL.GetAss_ReceiveEntity(keyValue);
  85. var Ass_ReceiveItem = assReceiveItemIbll.GetList(keyValue);
  86. var jsonData = new
  87. {
  88. Ass_Receive = Ass_ReceiveData,
  89. Ass_ReceiveItem
  90. };
  91. return Success(jsonData);
  92. }
  93. /// <summary>
  94. /// 获取表单数据
  95. /// <summary>
  96. /// <returns></returns>
  97. [HttpGet]
  98. [AjaxOnly]
  99. public ActionResult GetFormDataByProcessId(string processId)
  100. {
  101. var Ass_Receive = ass_ReceiveIBLL.GetEntityByProcessId(processId);
  102. var Ass_ReceiveItem = assReceiveItemIbll.GetList(Ass_Receive.RID);
  103. var jsonData = new
  104. {
  105. Ass_Receive,
  106. Ass_ReceiveItem,
  107. };
  108. return Success(jsonData);
  109. }
  110. #endregion
  111. /// <summary>
  112. /// 获取出库清单数据
  113. /// </summary>
  114. /// <param name="applyId">出库单id</param>
  115. /// <returns></returns>
  116. [HttpGet]
  117. [AjaxOnly]
  118. public ActionResult GetInventoryInfo(string applyId)
  119. {
  120. var outEntity = ass_ReceiveIBLL.GetAss_ReceiveEntity(applyId);
  121. var outItem = assReceiveItemIbll.GetList(applyId).ToList();
  122. var unitList = dataItemIbll.GetDetailList("sldw");
  123. var ItemList = new List<object>();
  124. foreach (var item in outItem)
  125. {
  126. var entity = assAssetsInfoIbll.GetAss_AssetsInfoEntity(item.AID);
  127. ItemList.Add(new
  128. {
  129. aOrder = outItem.IndexOf(item),//序号
  130. aName = entity.AName,//名字
  131. aUnit = unitList.FirstOrDefault(a => a.F_ItemValue == entity.AUnit)?.F_ItemName,//单位
  132. aNum = item.ANum,
  133. aPrice = entity.APrice,//价格
  134. aAllPrice = entity.APrice * int.Parse(item.ANum),//总价格
  135. });
  136. }
  137. var data = new
  138. {
  139. projectName = "",
  140. departmentId=outEntity.PDepartment,
  141. applyData=outEntity.RTime.ToDate().ToString("yyyy年MM月dd日"),
  142. list = ItemList
  143. };
  144. return Success(data);
  145. }
  146. #region 提交数据
  147. /// <summary>
  148. /// 删除实体数据
  149. /// <param name="keyValue">主键</param>
  150. /// <summary>
  151. /// <returns></returns>
  152. [HttpPost]
  153. [AjaxOnly]
  154. public ActionResult DeleteForm(string keyValue)
  155. {
  156. ass_ReceiveIBLL.DeleteEntity(keyValue);
  157. return Success("删除成功!");
  158. }
  159. /// <summary>
  160. /// 保存实体数据(新增、修改)
  161. /// <param name="keyValue">主键</param>
  162. /// <summary>
  163. /// <returns></returns>
  164. [HttpPost]
  165. [ValidateAntiForgeryToken]
  166. [AjaxOnly]
  167. public ActionResult SaveForm(string keyValue, string strEntity, string receItemList)
  168. {
  169. Ass_ReceiveEntity entity = strEntity.ToObject<Ass_ReceiveEntity>();
  170. var list = receItemList.ToObject<List<Ass_ReceiveItemEntity>>();
  171. ass_ReceiveIBLL.SaveEntity(keyValue, entity, list);
  172. return Success("保存成功!");
  173. }
  174. [HttpPost]
  175. [AjaxOnly]
  176. public ActionResult ChangeStatusById(string keyValue, string processId)
  177. {
  178. ass_ReceiveIBLL.ChangeStatusById(keyValue, 1, processId);
  179. return Success("操作成功!");
  180. }
  181. #endregion
  182. }
  183. }