123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- using Bowin.Common.JSON;
- using EMIS.ViewModel;
- using EMIS.Web.Controls;
- using EMIS.CommonLogic.TeachingMaterial;
- using Bowin.Web.Controls.Mvc;
- using EMIS.ViewModel.TeachingMaterial;
- using Bowin.Common.Utility;
- using Bowin.Common.Data;
- using EMIS.Utility;
- using EMIS.CommonLogic.CalendarManage;
- namespace EMIS.Web.Controllers.TeachingMaterial
- {
- [Authorization]
- public class TeachersConfirmOrderController : Controller
- {
- public ITeachersConfirmOrderServices TeachersConfirmOrderServices { get; set; }
- public ISchoolYearServices schoolYearServices { get; set; }
- /// <summary>
- /// 页面列表查询
- /// </summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult List()
- {
- //默认加载当前校历下学年学期的下一个学期
- var schoolYearView = schoolYearServices.GetSchoolYearIsCurrent(true);
- var schoolyear = schoolYearServices.GetSchoolYearViewListAfterCurrent().OrderBy(x => x.Code).Where(x => x.Value > schoolYearView.Value).FirstOrDefault();
- ViewBag.SchoolYearID = schoolyear.SchoolYearID;
- return View();
- }
- /// <summary>
- /// 列表查询
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult List(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- //避开全选值
- Guid? publishID = pararms.getExtraGuid("PublishDropdown");
- Guid? coursematerialID = pararms.getExtraGuid("CourseDropdown");
- var schoolYearID = pararms.getExtraGuid("SchoolYearDropdown");
- Guid? teachingMaterialID = pararms.getExtraGuid("TeachingMaterialDropdown");
- var approvalStatus = pararms.getExtraInt("StatusDropdown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryApprovalStatus");
- return base.Json(TeachersConfirmOrderServices.GetTeachersOrderViewGrid(configuretView, schoolYearID, teachingMaterialID, coursematerialID, publishID, approvalStatus, (int)pararms.page, (int)pararms.rows));
- }
- #region 2.0 加载清单明细列表
- /// <summary>
- /// 明细页面
- /// </summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult Detail(string teachersOrderID)
- {
- string yearIds = Request.QueryString["schoolYearID"];
- if (yearIds != null)
- {
- ViewData["schoolYearID"] = yearIds;
- ViewData["teachingMaterialPoolID"] = Request.QueryString["teachingMaterialPoolID"];
- }
- return View();
- }
- /// <summary>
- /// 清单征订明细查看
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Detail(QueryParamsModel pararms)
- {
- var user = HttpContext.User as EMIS.Utility.FormValidate.CustomPrincipal;
- //避开全选值
- var schoolYearID = Request.Params["schoolYearID"] == null ? Guid.Empty.ToString() : Request.Params["schoolYearID"].ToString();
- var teachingMaterialID = Request.Params["teachingMaterialPoolID"] == null ? Guid.Empty.ToString() : Request.Params["teachingMaterialPoolID"].ToString();
- Guid? collegeID = user.CollegeID;
- Guid? teachingMaterialPoolIDs = new Guid(teachingMaterialID);
- Guid? schoolYearIDs = new Guid(schoolYearID);
- return base.Json(TeachersConfirmOrderServices.GetTeachersOrderDetailViewGrid(schoolYearIDs, collegeID, teachingMaterialPoolIDs, (int)pararms.page, (int)pararms.rows));
- }
- #endregion
- #region 3.0 获取预加窗口
- /// <summary>
- /// 获取下一步动作
- /// </summary>
- /// <param name="planApplicationIDs"></param>
- /// <returns></returns>
- [HttpGet]
- public ActionResult BatchSetPreAddedValue()
- {
- TeachersConfirmOrderView teachersConfirmOrderView;
- teachersConfirmOrderView = new TeachersConfirmOrderView()
- {
- PreAddedValue = 5
- };
- return View(teachersConfirmOrderView);
- }
- #endregion
- #region 4.0 待定
- #endregion
- #region 5.0 批量设置值
- /// <summary>
- /// 批量设置预加值
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- public ActionResult BatchSetPreAddedValue(string orderJsonStr)
- {
- try
- {
- orderJsonStr = Request.Form["hid_JsonStr"];
- string PreAddedValue = Request.Form["PreAddedValue"];
- if (orderJsonStr != null)
- {
- var user = HttpContext.User as EMIS.Utility.FormValidate.CustomPrincipal;
- var addTeacherList = orderJsonStr.JsonToObject<List<TeachersOrderView>>();
- TeachersConfirmOrderServices.BatchUpdatePreAddedValue(addTeacherList, Convert.ToInt32(PreAddedValue), user.UserID);
- }
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "保存成功!"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "保存失败,原因:" + ex.Message + "!"
- });
- }
- }
- #endregion
- #region 6.0 页面Excel表格导出
- [HttpPost]
- public ActionResult Excel(QueryParamsModel pararms)
- {
- //避开全选值
- bool? isLate = null;
- Guid? publishID = Request.Form["PublishDropdown"].ParseStrTo<Guid>();
- Guid? coursematerialID = Request.Form["CourseDropdown"].ParseStrTo<Guid>();
- var schoolYearID = Request.Form["SchoolYearDropdown"].ParseStrTo<Guid>();
- var teachingMaterialID = Request.Form["TeachingMaterialDropdown"].ParseStrTo<Guid>();
- NpoiExcelHelper neh = new NpoiExcelHelper();
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
- var dt = TeachersConfirmOrderServices.GetTeachersConfirmOrderViewExcel(configuretView, schoolYearID, teachingMaterialID, coursematerialID, publishID).Select(x => new
- {
- x.SchoolyearName,
- x.TeachingMaterialCode,
- x.CoursematerialName,
- x.ISBN,
- x.TeachingMaterialName,
- x.Price,
- x.PublishTime,
- x.PublishName,
- x.Author,
- x.OrderQty,
- x.PreAddedValue,
- x.CountNumber
- }).ToTable();
- string[] liststring = { "学年学期","教材编号","课程名称","ISBN","教材名称","单价"
- ,"版本时间","出版单位","作者","征订数量","增加数量","总数量"};
- neh.Export(dt, liststring, "征订统计信息");
- return RedirectToAction("MsgShow", "Common", new
- {
- msg = "导出成功!",
- url = Url.Content("~/TeachersConfirmOrder/List").AddMenuParameter()
- });
- }
- #endregion
- #region 6.0 明细Excel表格导出
- [HttpPost]
- public ActionResult DetailExcel(QueryParamsModel pararms)
- {
- //避开全选值
- Guid? schoolyearID = Request.Params["schoolyearID"].ParseStrTo<Guid>();
- Guid? teachingMaterialPoolID = Request.Params["teachingMaterialPoolID"].ParseStrTo<Guid>();
- NpoiExcelHelper neh = new NpoiExcelHelper();
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
- var dt = TeachersConfirmOrderServices.GetTeachersConfirmOrderViewDetailExcel(schoolyearID, teachingMaterialPoolID).Select(x => new
- {
- x.SchoolyearName,
- x.CollegeName,
- x.TeachingMaterialCode,
- x.CoursematerialName,
- x.ISBN,
- x.TeachingMaterialName,
- x.PublishTime,
- x.PublishName,
- x.Author,
- x.OrderQty,
- x.OrderUserName,
- x.OrderDate,
- x.OrderDesc,
- x.Desc
- }).ToTable();
- string[] liststring = { "学年学期",RSL.Get("College"),"教材编号","课程名称","ISBN","教材名称"
- ,"版本时间","出版单位","作者","征订数量","征订人","征订日期","征订说明","备注"};
- neh.Export(dt, liststring, "教师征订清单明细信息");
- return RedirectToAction("MsgShow", "Common", new
- {
- msg = "导出成功!",
- url = Url.Content("~/TeachersConfirmOrder/List").AddMenuParameter()
- });
- }
- #endregion
- }
- }
|