FinshedStoreInfoController.cs 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. using ShwasherSys.BaseSysInfo.States;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Threading.Tasks;
  6. using System.Web;
  7. using System.Web.Mvc;
  8. using Abp.Domain.Repositories;
  9. using Abp.Web.Mvc.Authorization;
  10. using IwbZero.AppServiceBase;
  11. using IwbZero.Auditing;
  12. using IwbZero.IdentityFramework;
  13. using ShwasherSys.Authorization.Permissions;
  14. using ShwasherSys.BasicInfo;
  15. using ShwasherSys.Common;
  16. using ShwasherSys.EntityFramework;
  17. using ShwasherSys.ProductStoreInfo;
  18. using ShwasherSys.ProductStoreInfo.Dto;
  19. using ShwasherSys.StoreQuery;
  20. using ShwasherSys.StoreQuery.Dto;
  21. namespace ShwasherSys.Controllers
  22. {
  23. [AbpMvcAuthorize,AuditLog("成品仓库维护")]
  24. public class FinshedStoreInfoController : ShwasherControllerBase
  25. {
  26. protected IInventoryCheckAppService InventoryCheckAppService{ get; }
  27. protected IStoreStatisticsApplicationService StoreStatisticsApplicationService { get; }
  28. protected IQueryAppService QueryAppService { get; }
  29. protected IRepository<InventoryCheckInfo,string> InventoryCheckInfoRepository { get; }
  30. protected ISqlExecuter SqlExcuter { get; }
  31. public FinshedStoreInfoController(IStatesAppService statesAppService, IStoreStatisticsApplicationService storeStatisticsApplicationService, IQueryAppService queryAppService, ISqlExecuter sqlExcuter, IRepository<InventoryCheckInfo, string> inventoryCheckInfoRepository, IInventoryCheckAppService inventoryCheckAppService)
  32. {
  33. StoreStatisticsApplicationService = storeStatisticsApplicationService;
  34. QueryAppService = queryAppService;
  35. SqlExcuter = sqlExcuter;
  36. InventoryCheckInfoRepository = inventoryCheckInfoRepository;
  37. InventoryCheckAppService = inventoryCheckAppService;
  38. StatesAppService = statesAppService;
  39. }
  40. // GET: FinshedProductStoreInfo
  41. [AbpMvcAuthorize(PermissionNames.PagesFinshedStoreInfoFinshedEnterStoreApplyMg),AuditLog("成品入库申请页面")]
  42. public ActionResult FinshedEnterStoreApplyMg()
  43. {
  44. string s1 = FinshedEnterStoreApplyStatusEnum.Applying.ToInt() + "",
  45. s2 = FinshedEnterStoreApplyStatusEnum.Audited.ToInt() + "",
  46. s3 = FinshedEnterStoreApplyStatusEnum.Refused.ToInt() + "",
  47. s4 = FinshedEnterStoreApplyStatusEnum.EnterStored.ToInt() + "";
  48. ViewBag.FinshedApplyStatus = StatesAppService.GetSelectLists("FinshedEnterStore", "ApplyStatus", a =>
  49. a.CodeValue == s1 ||
  50. a.CodeValue == s2 ||
  51. a.CodeValue == s3 ||
  52. a.CodeValue == s4);
  53. ViewBag.StoreHouse = QueryAppService.QueryStoreHouseSelect();
  54. ViewBag.CreateSourceType = StatesAppService.GetSelectLists("FinshedEnterStore", "CreateSourceType");
  55. return View();
  56. }
  57. [AbpMvcAuthorize(PermissionNames.PagesFinshedStoreInfoFinshedEnterStoreMg),AuditLog("成品入库信息页面")]
  58. public ActionResult FinshedEnterStoreMg()
  59. {
  60. ViewBag.FinshedApplyStatus = StatesAppService.GetSelectLists("FinshedEnterStore", "ApplyStatus");
  61. return View();
  62. }
  63. [AbpMvcAuthorize(PermissionNames.PagesFinshedStoreInfoFinshedOutStoreApplyMg),AuditLog("成品出库申请页面")]
  64. public ActionResult FinshedOutStoreApplyMg()
  65. {
  66. string s1 = OutStoreApplyStatusEnum.Applying.ToInt() + "",
  67. s2 = OutStoreApplyStatusEnum.Audited.ToInt() + "",
  68. s3 = OutStoreApplyStatusEnum.Refused.ToInt() + "",
  69. s4 = OutStoreApplyStatusEnum.OutStored.ToInt() + "";
  70. ViewBag.FinshedApplyStatus = StatesAppService.GetSelectLists("FinshedOutStore", "ApplyStatus", a =>
  71. a.CodeValue == s1 ||
  72. a.CodeValue == s2 ||
  73. a.CodeValue == s3 ||
  74. a.CodeValue == s4);
  75. return View();
  76. }
  77. [AbpMvcAuthorize(PermissionNames.PagesFinshedStoreInfoFinshedOutStoreMg),AuditLog("成品出库信息页面")]
  78. public ActionResult FinshedOutStoreMg()
  79. {
  80. ViewBag.FinshedApplyStatus = StatesAppService.GetSelectLists("FinshedOutStore", "ApplyStatus");
  81. return View();
  82. }
  83. [AbpMvcAuthorize(PermissionNames.PagesFinshedStoreInfoCurrentFinshedStoreHouseMg),AuditLog("成品仓库实时信息页面")]
  84. public ActionResult CurrentFinshedStoreHouseMg()
  85. {
  86. ViewBag.StoreHouses = QueryAppService.QueryStoreHouseSelect(1);
  87. return View();
  88. }
  89. [AbpMvcAuthorize(PermissionNames.PagesFinshedStoreInfoCurrentStoreHouseQueryMg), AuditLog("库存数量查询页面")]
  90. public ActionResult CurrentStoreHouseQueryMg()
  91. {
  92. return View();
  93. }
  94. [AbpMvcAuthorize(PermissionNames.PagesFinshedStoreInfoCurrentStoreHouseQueryMgPrint), AuditLog("库存清单明细")]
  95. public ActionResult StoreListReport()
  96. {
  97. string lcSql =
  98. @"select vp.*,e.AllEnterQuantity,o.AllOutQuantity from v_ProductStoreInfo vp left join (select ProductNo,SUM(Quantity) as AllEnterQuantity from (select ProductNo,StoreHouseId,Quantity,AuditDate from FinshedEnterStore where ApplyStatus=5 and EnterStoreDate > (CONVERT(varchar(7),GETDATE(),120)+'-01')) gt group by ProductNo
  99. ) as e on vp.ProductNo=e.ProductNo left join (select ProductNo,SUM(ActualQuantity) as AllOutQuantity from (select ProductNo,StoreHouseId,ActualQuantity,AuditDate from ProductOutStore where ApplyStatus=5 and OutStoreDate > (CONVERT(varchar(7),GETDATE(),120)+'-01')) gt group by ProductNo) as o
  100. on vp.ProductNo=o.ProductNo";
  101. var entity = SqlExcuter.SqlQuery<ProductStoreCount>(lcSql).ToList();
  102. ViewBag.QueryRecord = entity;
  103. return View();
  104. }
  105. [AbpMvcAuthorize(PermissionNames.PagesFinshedStoreInfoCurrentStoreHouseQueryMgQueryEnterOut), AuditLog("进出库信息查看")]
  106. public async Task<ActionResult> ProductStoreDetail(string id)
  107. {
  108. id = string.IsNullOrEmpty(id) ? Request["id"] : id;
  109. var enterOutList = await StoreStatisticsApplicationService.QueryProductEnterOutRecord(id);
  110. var productStore = await StoreStatisticsApplicationService.QueryStoreTotalByProduct(id);
  111. if (enterOutList.Any())
  112. {
  113. ViewBag.EnterOutList = enterOutList;
  114. }
  115. ViewBag.ProductStore = productStore;
  116. var storeHouseList = QueryAppService.QueryStoreHouse();
  117. ViewBag.StoreHouseList = storeHouseList;
  118. return View();
  119. }
  120. [AbpMvcAuthorize(PermissionNames.PagesFinshedStoreInfoEnterOutStoreHouseQueryMg), AuditLog("进出库数量查询页面")]
  121. public ActionResult EnterOutStoreHouseQueryMg()
  122. {
  123. var storeHouseList = QueryAppService.QueryStoreHouse();
  124. ViewBag.StoreHouseList = HtmlHelpers.TranSelectItems<StoreHouse>(storeHouseList, "StoreHouseName", "Id");
  125. return View();
  126. }
  127. public ActionResult InventoryCheckCreate()
  128. {
  129. var storeHouseList = QueryAppService.QueryStoreHouse().Where(i=>i.StoreHouseTypeId!=3).ToList();
  130. ViewBag.StoreHouseList = storeHouseList; /*HtmlHelpers.TranSelectItems<StoreHouse>(storeHouseList, "StoreHouseName", "Id");*/
  131. ViewBag.CheckState = StatesAppService.GetSelectLists("InventoryCheck", "CheckState");
  132. return View();
  133. }
  134. public ActionResult InventoryCheck()
  135. {
  136. var storeHouseList = QueryAppService.QueryStoreHouse().Where(i => i.StoreHouseTypeId != 3).ToList();
  137. ViewBag.StoreHouseList = HtmlHelpers.TranSelectItems<StoreHouse>(storeHouseList, "StoreHouseName", "Id");
  138. ViewBag.CheckState = StatesAppService.GetSelectLists("InventoryCheck", "CheckState");
  139. return View();
  140. }
  141. public async Task<ActionResult> InventoryCheckRecord(string id)
  142. {
  143. ViewBag.InventoryCheck = ObjectMapper.Map<InventoryCheckDto>(InventoryCheckInfoRepository.Get(id));
  144. var storeHouseList = QueryAppService.QueryStoreHouse().Where(i => i.StoreHouseTypeId != 3).ToList();
  145. ViewBag.StoreHouseList = HtmlHelpers.TranSelectItems<StoreHouse>(storeHouseList, "StoreHouseName", "Id");
  146. ViewBag.CheckState = StatesAppService.GetSelectLists("InventoryCheck", "CheckState");
  147. return View();
  148. }
  149. public async Task<ActionResult> InventoryCheckRecordSemi(string id)
  150. {
  151. ViewBag.InventoryCheck = ObjectMapper.Map<InventoryCheckDto>(InventoryCheckInfoRepository.Get(id));
  152. var storeHouseList = QueryAppService.QueryStoreHouse().Where(i => i.StoreHouseTypeId != 3).ToList();
  153. ViewBag.StoreHouseList = HtmlHelpers.TranSelectItems<StoreHouse>(storeHouseList, "StoreHouseName", "Id");
  154. ViewBag.CheckState = StatesAppService.GetSelectLists("InventoryCheck", "CheckState");
  155. return View();
  156. }
  157. }
  158. }