123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293 |
- 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;
- using EMIS.CommonLogic.SystemServices;
- using EMIS.CommonLogic.CalendarManage;
- namespace EMIS.Web.Controllers.TeachingMaterial
- {
- [Authorization]
- public class InventoryManagementController : Controller
- {
- public IStockOutServices StockOutServices { get; set; }
- public IStockInDetailServices StockInDetailServices { get; set; }
- public IStockInServices StockInServices { get; set; }
- public IInventoryServices InventoryServices { get; set; }
- public ISchoolYearServices SchoolYearServices { get; set; }
- /// <summary>
- /// 库存汇总页面
- /// </summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult List()
- {
- var schoolYear = SchoolYearServices.GetSchoolYearIsCurrent(true);
- ViewBag.SchoolYearID = schoolYear == null ? "-1" : schoolYear.SchoolyearID.ToString();//默认当前学年
- return View();
- }
- /// <summary>
- /// 库存汇总查询
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult List(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- var schoolYear = SchoolYearServices.GetSchoolYearIsCurrent(true);
- //避开全选值
- Guid? publishID = null;
- Guid? schoolyearID = null;
- Guid? teachingMaterialID = null;
- publishID = pararms.getExtraGuid("PublishDropdown");
- schoolyearID = pararms.getExtraGuid("SchoolYearDropdown");
- var teachingMaterialType = pararms.getExtraInt("TeachingMaterialTypeDropdown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("TeachingMaterialTypeDropdown");
- teachingMaterialID = pararms.getExtraGuid("TeachingMaterialDropdown");
- if (schoolyearID == null)
- {
- schoolyearID = (Guid)schoolYear.SchoolyearID;
- }
- return base.Json(InventoryServices.GetInventoryManagementViewGrid(configuretView, schoolyearID, teachingMaterialID, teachingMaterialType, publishID, (int)pararms.page, (int)pararms.rows));
- }
- /// <summary>
- /// Excel导出
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Excel()
- {
- NpoiExcelHelper neh = new NpoiExcelHelper();
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
- Guid? publishID = null;
- Guid? schoolyearID = null;
- Guid? teachingMaterialID = null;
- publishID = Request.Form["PublishDropdown"].ParseStrTo<Guid>();
- schoolyearID = Request.Form["SchoolYearDropdown"].ParseStrTo<Guid>();
- var teachingMaterialType = Request.Form["TeachingMaterialTypeDropdown"].ParseStrTo<int>();
- if (Request.Form["TeachingMaterialTypeDropdown"].ParseStrTo<int>() != DropdownList.SELECT_ALL && Request.Form["TeachingMaterialTypeDropdown"].ParseStrTo<int>() != null)
- {
- teachingMaterialType = Request.Form["TeachingMaterialTypeDropdown"].ParseStrTo<int>();
- }
- teachingMaterialID = Request.Form["TeachingMaterialDropdown"].ParseStrTo<Guid>();
- var dt = InventoryServices.GetInventoryManagementViewList(configuretView, schoolyearID, teachingMaterialID, teachingMaterialType, publishID).Select(x => new
- {
- x.SchoolYearName,
- x.TeachingMaterialCode,
- x.TeachingMaterialName,
- x.ISBN,
- x.MinInventory,
- x.InventoryCollectQtyStr,
- x.StockInQty,
- x.StockOutQty,
- x.PresentInventory,
- x.Price,
- }).ToTable();
- string[] liststring = { "学年学期", "教材编号", "教材名称", "ISBN", "最小库存量", "原库存量", "入库数量", "出库数量", "当前库存量", "单价" };
- neh.Export(dt, liststring, "库存统计信息");
- return RedirectToAction("MsgShow", "Common", new
- {
- msg = "导出成功!",
- url = Url.Content("~/InventoryManagement/List").AddMenuParameter()
- });
- }
- /// <summary>
- /// 库存明细Excel导出
- /// </summary>
- /// <param name="teachingMaterialPoolID"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult InventoryExcel(Guid? teachingMaterialPoolID)
- {
- NpoiExcelHelper neh = new NpoiExcelHelper();
- var dt = InventoryServices.GetTeachingMateriaInventoryViewList(teachingMaterialPoolID).Select(x => new
- {
- x.PublishName,
- x.TeachingMaterialCode,
- x.TeachingMaterialName,
- x.CoursematerialCode,
- x.CoursematerialName,
- x.ISBN,
- x.PublishTime,
- x.Author,
- x.IsLateName,
- x.Price,
- x.MinInventory,
- x.PresentInventory,
- x.Total,
- x.ModifyTime,
- x.Desc
- }).ToTable();
- string[] liststring = { "书库名称", "教材编号", "教材名称", "课程代码", "课程名称", "ISBN", "版本时间", "出版单位", "作者", "是否过期", "单价", "最小库存量", "当前库存量", "码洋", "最近响应时间", "备注" };
- neh.Export(dt, liststring, "教材库存信息");
- return RedirectToAction("MsgShow", "Common", new
- {
- msg = "导出成功!",
- url = Url.Content("~/InventoryManagement/List").AddMenuParameter()
- });
- }
- /// <summary>
- /// 出库明细Excel导出
- /// </summary>
- /// <param name="teachingMaterialPoolID"></param>
- /// <param name="schoolyearID"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult StockInExcel(Guid? teachingMaterialPoolID, Guid? schoolyearID)
- {
- NpoiExcelHelper neh = new NpoiExcelHelper();
- var dt = InventoryServices.GetStockInDetailByValueViewList(teachingMaterialPoolID, schoolyearID).Select(x => new
- {
- x.SchoolyearName,
- x.StockInDocumentNo,
- x.TeachingMaterialCode,
- x.TeachingMaterialName,
- x.Quantity,
- x.Price,
- x.DiscountStr,
- x.DiscountPriceStr,
- x.TotalPriceStr,
- x.TotalDollarStr,
- x.HandlerUserName,
- x.StockInTime
- }).ToTable();
- string[] liststring = { "学年学期", "入库单据号", "教材编号", "教材名称", "数量", "单价", "折扣率", "折合价", "码洋", "总价", "经手人", "入库日期" };
- neh.Export(dt, liststring, "入库明细信息");
- return RedirectToAction("MsgShow", "Common", new
- {
- msg = "导出成功!",
- url = Url.Content("~/InventoryManagement/List").AddMenuParameter()
- });
- }
- /// <summary>
- /// 入库明细Excel导出
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- public ActionResult StockOutExcel()
- {
- Guid? teachingMaterialPoolID = Request.Params["teachingMaterialPoolID"].ParseStrTo<Guid>();
- Guid? schoolyearID = Request.Params["schoolyearID"].ParseStrTo<Guid>();
- var SchoolYearEntity = SchoolYearServices.GetSchoolYear(schoolyearID);
- NpoiExcelHelper neh = new NpoiExcelHelper();
- var dt = InventoryServices.GetStockOutDetailByValueViewList(teachingMaterialPoolID, SchoolYearEntity.Value, schoolyearID).Select(x => new
- {
- x.SchoolyearName,
- x.StockOutNo,
- x.GetBookNo,
- x.TeachingMaterialCode,
- x.TeachingMaterialName,
- x.StockOutTypeNameStr,
- x.Quantity,
- x.Price,
- x.DiscountStr,
- x.DiscountPriceStr,
- x.TotalPriceStr,
- x.TotalDollarStr,
- x.RecipientUserName,
- x.StockOutTime,
- x.Desc
- }).ToTable();
- string[] liststring = { "学年学期","出库单据号", "领书人", "教材编号", "教材名称","出库类型",
- "数量", "单价", "折扣率", "折合价", "码洋", "总价", "签收人", "出库日期","出库说明" };
- neh.Export(dt, liststring, "出库明细信息");
- return RedirectToAction("MsgShow", "Common", new
- {
- msg = "导出成功!",
- url = Url.Content("~/InventoryManagement/List").AddMenuParameter()
- });
- }
- /// <summary>
- /// 库存明细
- /// </summary>
- /// <param name="teachingMaterialPoolID"></param>
- /// <returns></returns>
- [HttpGet]
- public ActionResult InventoryDetail(string teachingMaterialPoolID)
- {
- if (!string.IsNullOrEmpty(teachingMaterialPoolID))
- ViewData["teachingMaterialPoolID"] = teachingMaterialPoolID;
- return View();
- }
- [HttpPost]
- public ActionResult InventoryDetail(Guid? teachingMaterialPoolID)
- {
- return base.Json(InventoryServices.GetTeachingMateriaInventoryViewGrid(teachingMaterialPoolID));
- }
- /// <summary>
- /// 入库明细
- /// </summary>
- /// <param name="teachingMaterialPoolID"></param>
- /// <param name="schoolyearID"></param>
- /// <returns></returns>
- [HttpGet]
- public ActionResult StockInDetail(string teachingMaterialPoolID, string schoolyearID, string discountPrice)
- {
- if (!string.IsNullOrEmpty(teachingMaterialPoolID))
- ViewBag.teachingMaterialPoolID = teachingMaterialPoolID;
- if (!string.IsNullOrEmpty(schoolyearID))
- ViewBag.schoolyearID = schoolyearID;
- if (!string.IsNullOrEmpty(discountPrice))
- ViewBag.discountPrice = discountPrice;
- return View();
- }
- [HttpPost]
- public ActionResult StockInDetail(QueryParamsModel pararms)
- {
- Guid? teachingMaterialPoolID = Request.Params["teachingMaterialPoolID"].ParseStrTo<Guid>();
- Guid? schoolyearID = Request.Params["schoolyearID"].ParseStrTo<Guid>();
- decimal? discountPrice = Request.Params["discountPrice"].ParseStrTo<decimal>();
- var SchoolYearEntity = SchoolYearServices.GetSchoolYear(schoolyearID);
- return base.Json(InventoryServices.GetStockInDetailByValueViewGrid(teachingMaterialPoolID, schoolyearID, discountPrice, (int)pararms.page, (int)pararms.rows));
- }
- /// <summary>
- /// 出库明细
- /// </summary>
- /// <param name="teachingMaterialPoolID"></param>
- /// <param name="schoolyearID"></param>
- /// <returns></returns>
- [HttpGet]
- public ActionResult StockOutDetail(string teachingMaterialPoolID, string schoolyearID, string discountPrice)
- {
- if (!string.IsNullOrEmpty(teachingMaterialPoolID))
- ViewBag.teachingMaterialPoolID = teachingMaterialPoolID;
- if (!string.IsNullOrEmpty(schoolyearID))
- ViewBag.schoolyearID = schoolyearID;
- if (!string.IsNullOrEmpty(discountPrice))
- ViewBag.discountPrice = discountPrice;
- return View();
- }
- [HttpPost]
- public ActionResult StockOutDetail(QueryParamsModel pararms)
- {
- Guid? teachingMaterialPoolID = Request.Params["teachingMaterialPoolID"].ParseStrTo<Guid>();
- Guid? schoolyearID = Request.Params["schoolyearID"].ParseStrTo<Guid>();
- decimal? discountPrice = Request.Params["discountPrice"].ParseStrTo<decimal>();
- var SchoolYearEntity = SchoolYearServices.GetSchoolYear(schoolyearID);
- return base.Json(InventoryServices.GetStockOutDetailByValueViewGrid(teachingMaterialPoolID, SchoolYearEntity.Value, schoolyearID, discountPrice, (int)pararms.page, (int)pararms.rows));
- }
- }
- }
|