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.
 
 
 
 
 
 

250 lines
7.9 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. namespace Learun.Application.Web.Areas.AssetManagementSystem.Controllers
  10. {
  11. /// <summary>
  12. /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
  13. /// Copyright (c) 2013-2018 北京泉江科技有限公司
  14. /// 创 建:超级管理员
  15. /// 日 期:2019-03-25 12:00
  16. /// 描 述:入库申请
  17. /// </summary>
  18. public class Ass_AssetsInfoApplyController : MvcControllerBase
  19. {
  20. private Ass_AssetsInfoApplyIBLL ass_AssetsInfoApplyIBLL = new Ass_AssetsInfoApplyBLL();
  21. private DataItemIBLL dataItemIbll = new DataItemBLL();
  22. #region 视图功能
  23. /// <summary>
  24. /// 主页面
  25. /// <summary>
  26. /// <returns></returns>
  27. [HttpGet]
  28. public ActionResult Index()
  29. {
  30. return View();
  31. }
  32. [HttpGet]
  33. public ActionResult IndexJY()
  34. {
  35. return View();
  36. }
  37. [HttpGet]
  38. public ActionResult IndexJYHC()
  39. {
  40. return View();
  41. }
  42. /// <summary>
  43. /// 表单查看页
  44. /// <summary>
  45. /// <returns></returns>
  46. [HttpGet]
  47. public ActionResult FormView()
  48. {
  49. return View();
  50. }
  51. /// <summary>
  52. /// 打印清单
  53. /// <summary>
  54. /// <returns></returns>
  55. [HttpGet]
  56. public ActionResult Inventory()
  57. {
  58. return View();
  59. }
  60. [HttpGet]
  61. public ActionResult FormViewJY()
  62. {
  63. return View();
  64. }
  65. /// <summary>
  66. /// 表单页
  67. /// <summary>
  68. /// <returns></returns>
  69. [HttpGet]
  70. public ActionResult Form()
  71. {
  72. ViewBag.AACode = "RKSQ_" + CommonHelper.CreateNo();
  73. return View();
  74. }
  75. [HttpGet]
  76. public ActionResult FormJY()
  77. {
  78. ViewBag.AACode = "RKSQ_" + CommonHelper.CreateNo();
  79. return View();
  80. }
  81. [HttpGet]
  82. public ActionResult FormJYHC()
  83. {
  84. ViewBag.AACode = "RKSQ_" + CommonHelper.CreateNo();
  85. return View();
  86. }
  87. /// <summary>
  88. /// 采购入库表单页
  89. /// </summary>
  90. /// <returns></returns>
  91. [HttpGet]
  92. public ActionResult FormPurchase()
  93. {
  94. ViewBag.AACode = "RKSQ_" + CommonHelper.CreateNo();
  95. return View();
  96. }
  97. [HttpGet]
  98. public ActionResult FormPurchaseJY()
  99. {
  100. ViewBag.AACode = "RKSQ_" + CommonHelper.CreateNo();
  101. return View();
  102. }
  103. #endregion
  104. #region 获取数据
  105. /// <summary>
  106. /// 获取页面显示列表数据
  107. /// <summary>
  108. /// <param name="queryJson">查询参数</param>
  109. /// <returns></returns>
  110. [HttpGet]
  111. [AjaxOnly]
  112. public ActionResult GetPageList(string pagination, string queryJson)
  113. {
  114. Pagination paginationobj = pagination.ToObject<Pagination>();
  115. var data = ass_AssetsInfoApplyIBLL.GetPageList(paginationobj, queryJson);
  116. var jsonData = new
  117. {
  118. rows = data,
  119. total = paginationobj.total,
  120. page = paginationobj.page,
  121. records = paginationobj.records
  122. };
  123. return Success(jsonData);
  124. }
  125. /// <summary>
  126. /// 获取表单数据
  127. /// <summary>
  128. /// <returns></returns>
  129. [HttpGet]
  130. [AjaxOnly]
  131. public ActionResult GetFormData(string keyValue)
  132. {
  133. var Ass_AssetsInfoApplyData = ass_AssetsInfoApplyIBLL.GetAss_AssetsInfoApplyEntity(keyValue);
  134. var Ass_AssetsInfoItemApplyData = ass_AssetsInfoApplyIBLL.GetAss_AssetsInfoItemApplyList(Ass_AssetsInfoApplyData.AAId);
  135. var jsonData = new
  136. {
  137. Ass_AssetsInfoApply = Ass_AssetsInfoApplyData,
  138. Ass_AssetsInfoItemApply = Ass_AssetsInfoItemApplyData,
  139. };
  140. return Success(jsonData);
  141. }
  142. /// <summary>
  143. /// 获取表单数据
  144. /// <summary>
  145. /// <returns></returns>
  146. [HttpGet]
  147. [AjaxOnly]
  148. public ActionResult GetFormDataByProcessId(string processId)
  149. {
  150. var Ass_AssetsInfoApplyData = ass_AssetsInfoApplyIBLL.GetEntityByProcessId(processId);
  151. var Ass_AssetsInfoItemApplyData = ass_AssetsInfoApplyIBLL.GetAss_AssetsInfoItemApplyList(Ass_AssetsInfoApplyData.AAId);
  152. var jsonData = new
  153. {
  154. Ass_AssetsInfoApply = Ass_AssetsInfoApplyData,
  155. Ass_AssetsInfoItemApply = Ass_AssetsInfoItemApplyData,
  156. };
  157. return Success(jsonData);
  158. }
  159. /// <summary>
  160. /// 获取入库清单数据
  161. /// </summary>
  162. /// <param name="applyId">入库清单id</param>
  163. /// <returns></returns>
  164. [HttpGet]
  165. [AjaxOnly]
  166. public ActionResult GetInventoryInfo(string applyId)
  167. {
  168. var applyEntity = ass_AssetsInfoApplyIBLL.GetAss_AssetsInfoApplyEntity(applyId);
  169. var applyItemList = ass_AssetsInfoApplyIBLL.GetAss_AssetsInfoItemApplyList(applyId).ToList();
  170. var unitList = dataItemIbll.GetDetailList("sldw");
  171. var ItemList = new List<object>();
  172. foreach (var item in applyItemList)
  173. {
  174. ItemList.Add(new
  175. {
  176. aOrder = applyItemList.IndexOf(item),//序号
  177. aName = item.AAIName,//名字
  178. aUnit = unitList.FirstOrDefault(a => a.F_ItemValue == item.AAIUnit)?.F_ItemName,//单位
  179. aNum = item.AAIStock,
  180. aPrice = item.AAIPrice,//价格
  181. aAllPrice = item.AAIPrice * item.AAIStock,//总价格
  182. });
  183. }
  184. var data = new
  185. {
  186. projectName = "",
  187. applyData=applyEntity.AACreateTime.ToDate().ToString("yyyy年MM月dd日"),
  188. list = ItemList
  189. };
  190. return Success(data);
  191. }
  192. #endregion
  193. #region 提交数据
  194. /// <summary>
  195. /// 删除实体数据
  196. /// <param name="keyValue">主键</param>
  197. /// <summary>
  198. /// <returns></returns>
  199. [HttpPost]
  200. [AjaxOnly]
  201. public ActionResult DeleteForm(string keyValue)
  202. {
  203. ass_AssetsInfoApplyIBLL.DeleteEntity(keyValue);
  204. return Success("删除成功!");
  205. }
  206. /// <summary>
  207. /// 保存实体数据(新增、修改)
  208. /// <param name="keyValue">主键</param>
  209. /// <summary>
  210. /// <returns></returns>
  211. [HttpPost]
  212. [ValidateAntiForgeryToken]
  213. [AjaxOnly]
  214. public ActionResult SaveForm(string keyValue, string strEntity, string strass_AssetsInfoItemApplyList)
  215. {
  216. Ass_AssetsInfoApplyEntity entity = strEntity.ToObject<Ass_AssetsInfoApplyEntity>();
  217. entity.AAStatus = 0;
  218. entity.AACreateTime = DateTime.Now;
  219. List<Ass_AssetsInfoItemApplyEntity> ass_AssetsInfoItemApplyList = strass_AssetsInfoItemApplyList.ToObject<List<Ass_AssetsInfoItemApplyEntity>>();
  220. ass_AssetsInfoApplyIBLL.SaveEntity(keyValue, entity, ass_AssetsInfoItemApplyList);
  221. return Success("保存成功!");
  222. }
  223. /// <summary>
  224. /// 提交入库申请
  225. /// </summary>
  226. /// <param name="keyValue"></param>
  227. /// <returns></returns>
  228. [HttpPost]
  229. [AjaxOnly]
  230. public ActionResult ChangeStatusById(string keyValue, string processId)
  231. {
  232. ass_AssetsInfoApplyIBLL.ChangeStatusById(keyValue, 1, processId);
  233. return Success("操作成功!");
  234. }
  235. #endregion
  236. }
  237. }