using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using Bowin.Common.Utility; using Bowin.Web.Controls.Mvc; using EMIS.CommonLogic.TeachingMaterial; using EMIS.ViewModel; using EMIS.ViewModel.TeachingMaterial; using EMIS.Web.Controls; using Bowin.Common.Data; namespace EMIS.Web.Controllers.TeachingMaterial { public class StockInDetailController : Controller { #region --0.0 定义-- public IStockInDetailServices StockInDetailServices { get; set; } #endregion #region 1.0 加载列表数据 [HttpGet] public ActionResult List() { return View(); } [HttpPost] public ActionResult List(QueryParamsModel pararms) { ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms); Guid? supplierID = pararms.getExtraGuid("PublishDropdown"); Guid? schoolyearID = pararms.getExtraGuid("SchoolYearDropdown"); Guid? teachingMaterialID = pararms.getExtraGuid("TeachingMaterialDropdown"); return base.Json(StockInDetailServices.GetStockInDetailViewGrid(configuretView, schoolyearID, supplierID, teachingMaterialID, (int)pararms.page, (int)pararms.rows)); } #endregion #region 2.0 编辑数据信息 [HttpGet] public ActionResult Edit() { return View(); } #endregion #region 3.0 页面数据Excel导出 /// /// Excel 导出 /// /// [HttpPost] public ActionResult Excel() { NpoiExcelHelper neh = new NpoiExcelHelper(); ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null); Guid? supplierID = Request.Form["CampusDropdown"].ParseStrTo(); Guid? schoolyearID = Request.Form["CollegeDropdown"].ParseStrTo(); DateTime? stockInDJTime = DateTime.Now; var dt = StockInDetailServices.GetStockInDetailViewList(configuretView, schoolyearID, supplierID, stockInDJTime, stockInDJTime).Select(x => new { x.SchoolyearName, x.StockInDocumentNo, x.StockInType, x.TeachingMaterialCode, x.TeachingMaterialName, x.PublishName, x.SupplierName, x.PublishTime, x.Author, x.Quantity, x.Price, x.DiscountStr, x.DiscountPriceStr, x.TotalPriceStr, x.TotalDollarStr, x.HandlerUserName, x.StockInUserName, x.StockInTime }).ToTable(); string[] liststring = { "学年学期", "入库单据号", "入库编号", "教材编号", "教材名称", "供应商", "出版单位", "版本时间", "作者", "数量", "单价", "折扣率", "折合价", "码洋", "总价", "经手人", "入库人", "入库日期" }; neh.Export(dt, liststring, "入库明细信息"); return RedirectToAction("MsgShow", "Common", new { msg = "导出成功!", url = Url.Content("~/StockInDetail/List").AddMenuParameter() }); } #endregion #region 4.0 页面数据删除 [HttpPost] public ActionResult Delete(string stockInDetailIDs) { try { var stockInDetailIDList = stockInDetailIDs.Split(',').Select(x => (Guid)new Guid(x)).ToList(); StockInDetailServices.Delete(stockInDetailIDList); return base.Json("删除成功"); } catch (Exception ex) { string mge = ex.Message; return base.Json("删除失败,原因:" + mge + "!"); } } #endregion } }