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.
 
 
 
 
 
 

212 lines
7.0 KiB

  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;
  7. using System.Linq;
  8. using Learun.Application.Base.SystemModule;
  9. using Learun.Application.Organization;
  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:49
  17. /// 描 述:出库申请
  18. /// </summary>
  19. public class Ass_AssetsOutApplyController : MvcControllerBase
  20. {
  21. private Ass_AssetsOutApplyIBLL ass_AssetsOutApplyIBLL = new Ass_AssetsOutApplyBLL();
  22. private DataItemIBLL dataItemIbll=new DataItemBLL();
  23. private UserIBLL userIbll=new UserBLL();
  24. #region 视图功能
  25. /// <summary>
  26. /// 主页面
  27. /// <summary>
  28. /// <returns></returns>
  29. [HttpGet]
  30. public ActionResult Index()
  31. {
  32. return View();
  33. }
  34. /// <summary>
  35. /// 表单查看页
  36. /// <summary>
  37. /// <returns></returns>
  38. [HttpGet]
  39. public ActionResult FormView()
  40. {
  41. return View();
  42. }
  43. /// <summary>
  44. /// 表单页
  45. /// <summary>
  46. /// <returns></returns>
  47. [HttpGet]
  48. public ActionResult Form()
  49. {
  50. ViewBag.AOCode = "CKSQ_" + CommonHelper.CreateNo();
  51. return View();
  52. }
  53. /// <summary>
  54. /// 出库清单
  55. /// <summary>
  56. /// <returns></returns>
  57. [HttpGet]
  58. public ActionResult Inventory()
  59. {
  60. return View();
  61. }
  62. #endregion
  63. #region 获取数据
  64. /// <summary>
  65. /// 获取页面显示列表数据
  66. /// <summary>
  67. /// <param name="queryJson">查询参数</param>
  68. /// <returns></returns>
  69. [HttpGet]
  70. [AjaxOnly]
  71. public ActionResult GetPageList(string pagination, string queryJson)
  72. {
  73. Pagination paginationobj = pagination.ToObject<Pagination>();
  74. var data = ass_AssetsOutApplyIBLL.GetPageList(paginationobj, queryJson);
  75. var jsonData = new
  76. {
  77. rows = data,
  78. total = paginationobj.total,
  79. page = paginationobj.page,
  80. records = paginationobj.records
  81. };
  82. return Success(jsonData);
  83. }
  84. /// <summary>
  85. /// 获取表单数据
  86. /// <summary>
  87. /// <returns></returns>
  88. [HttpGet]
  89. [AjaxOnly]
  90. public ActionResult GetFormData(string keyValue)
  91. {
  92. var Ass_AssetsOutApplyData = ass_AssetsOutApplyIBLL.GetAss_AssetsOutApplyEntity(keyValue);
  93. var Ass_AssetsOutItemApplyData = ass_AssetsOutApplyIBLL.GetAss_AssetsOutItemApplyList(Ass_AssetsOutApplyData.AOId);
  94. var jsonData = new
  95. {
  96. Ass_AssetsOutApply = Ass_AssetsOutApplyData,
  97. Ass_AssetsOutItemApply = Ass_AssetsOutItemApplyData,
  98. };
  99. return Success(jsonData);
  100. }
  101. /// <summary>
  102. /// 获取表单数据
  103. /// <summary>
  104. /// <returns></returns>
  105. [HttpGet]
  106. [AjaxOnly]
  107. public ActionResult GetFormDataByProcessId(string processId)
  108. {
  109. var Ass_AssetsOutApplyData = ass_AssetsOutApplyIBLL.GetEntityByProcessId(processId);
  110. var Ass_AssetsOutItemApplyData = ass_AssetsOutApplyIBLL.GetAss_AssetsOutItemApplyList(Ass_AssetsOutApplyData.AOId);
  111. var jsonData = new
  112. {
  113. Ass_AssetsOutApply = Ass_AssetsOutApplyData,
  114. Ass_AssetsOutItemApply = Ass_AssetsOutItemApplyData,
  115. };
  116. return Success(jsonData);
  117. }
  118. #endregion
  119. /// <summary>
  120. /// 获取出库清单数据
  121. /// </summary>
  122. /// <param name="applyId">出库单id</param>
  123. /// <returns></returns>
  124. [HttpGet]
  125. [AjaxOnly]
  126. public ActionResult GetInventoryInfo(string applyId)
  127. {
  128. var outEntity = ass_AssetsOutApplyIBLL.GetAss_AssetsOutApplyEntity(applyId);
  129. var departmentId = userIbll.GetEntityByUserId(outEntity.AOCreateUserId)?.F_DepartmentId;
  130. var outItem = ass_AssetsOutApplyIBLL.GetAss_AssetsOutItemApplyList(applyId).ToList();
  131. var unitList= dataItemIbll.GetDetailList("sldw");
  132. var ItemList = new List<object>();
  133. foreach (var item in outItem)
  134. {
  135. ItemList.Add(new
  136. {
  137. aOrder = outItem.IndexOf(item),//序号
  138. aName = item.AOIName,//名字
  139. aUnit =unitList.FirstOrDefault(a=>a.F_ItemValue==item.AOIUnit)?.F_ItemName,//单位
  140. aNum = 1,
  141. aPrice = item.AOIPrice,//价格
  142. aAllPrice = item.AOIPrice,//总价格
  143. });
  144. }
  145. var data = new
  146. {
  147. projectName = outEntity.AOProjectName,
  148. departmentId,
  149. applyData =outEntity.AOCreateTime.ToDate().ToString("yyyy年MM月dd日"),
  150. list = ItemList
  151. };
  152. return Success(data);
  153. }
  154. #region 提交数据
  155. /// <summary>
  156. /// 删除实体数据
  157. /// <param name="keyValue">主键</param>
  158. /// <summary>
  159. /// <returns></returns>
  160. [HttpPost]
  161. [AjaxOnly]
  162. public ActionResult DeleteForm(string keyValue)
  163. {
  164. ass_AssetsOutApplyIBLL.DeleteEntity(keyValue);
  165. return Success("删除成功!");
  166. }
  167. /// <summary>
  168. /// 保存实体数据(新增、修改)
  169. /// <param name="keyValue">主键</param>
  170. /// <summary>
  171. /// <returns></returns>
  172. [HttpPost]
  173. [ValidateAntiForgeryToken]
  174. [AjaxOnly]
  175. public ActionResult SaveForm(string keyValue, string strEntity, string strass_AssetsOutItemApplyList)
  176. {
  177. Ass_AssetsOutApplyEntity entity = strEntity.ToObject<Ass_AssetsOutApplyEntity>();
  178. entity.AOStatus = 0;
  179. entity.AOOutStatus = 0;
  180. entity.AOCreateTime = DateTime.Now;
  181. List<Ass_AssetsOutItemApplyEntity> ass_AssetsOutItemApplyList = strass_AssetsOutItemApplyList.ToObject<List<Ass_AssetsOutItemApplyEntity>>();
  182. ass_AssetsOutApplyIBLL.SaveEntity(keyValue, entity, ass_AssetsOutItemApplyList);
  183. return Success("保存成功!");
  184. }
  185. /// <summary>
  186. /// 提交出库申请
  187. /// </summary>
  188. /// <param name="keyValue"></param>
  189. /// <returns></returns>
  190. [HttpPost]
  191. [AjaxOnly]
  192. public ActionResult ChangeStatusById(string keyValue, string processId)
  193. {
  194. ass_AssetsOutApplyIBLL.ChangeStatusById(keyValue, 1, processId);
  195. return Success("操作成功!");
  196. }
  197. #endregion
  198. }
  199. }