123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- using EMIS.ViewModel;
- using EMIS.Web.Controls;
- using EMIS.CommonLogic.TeachingMaterial;
- using Bowin.Web.Controls.Mvc;
- using EMIS.ViewModel.WorkflowManage;
- using Bowin.Common.Utility;
- using Bowin.Common.JSON;
- using Bowin.Common.Data;
- using EMIS.ViewModel.TeachingMaterial;
- using EMIS.Utility;
- using EMIS.CommonLogic.CalendarManage;
- using EMIS.Utility.FormValidate;
- namespace EMIS.Web.Controllers.TeachingMaterial
- {
- [Authorization]
- public class TeachersOrderExamineController : Controller
- {
- public ITeachersOrderExamineServices TeachersOrderExamineServices { 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 = null;
- Guid? coursematerialID = null;
- publishID = pararms.getExtraGuid("PublishDropdown");
- coursematerialID = pararms.getExtraGuid("CourseDropdown");
- var schoolYearID = pararms.getExtraGuid("SchoolYearDropdown");
- var collegeID = pararms.getExtraGuid("CollegeDropdown");
- var approvalStatus = pararms.getExtraInt("StatusDropdown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("StatusDropdown");
- return base.Json(TeachersOrderExamineServices.GetTeachersOrderViewGrid(configuretView, schoolYearID, collegeID, coursematerialID, publishID, approvalStatus, (int)pararms.page, (int)pararms.rows));
- }
- #region 3.0 获取下一步环节
- /// <summary>
- /// 获取下一步动作
- /// </summary>
- /// <param name="planApplicationIDs"></param>
- /// <returns></returns>
- [HttpGet]
- public ActionResult ApprovalHandle(string teachersOrderIDs)
- {
- try
- {
- if (string.IsNullOrEmpty(teachersOrderIDs))
- {
- teachersOrderIDs = Session["teachersOrderIDs"].ToString();
- }
- var user = HttpContext.User as EMIS.Utility.FormValidate.CustomPrincipal;
- if (!string.IsNullOrEmpty(teachersOrderIDs))
- {
- Guid teachersOrderID = new Guid(teachersOrderIDs.Split(',')[0]);
- List<ActionView> listAction = TeachersOrderExamineServices.GetAuditingActionView(teachersOrderID, user.UserID).OrderBy(x => x.ActionID).ToList();
- List<DropdownListItem> list = new List<DropdownListItem>();
- foreach (var item in listAction)
- {
- DropdownListItem dli = new DropdownListItem { Text = item.ActionName, Value = item.ToJson() };
- list.Add(dli);
- }
- ViewData["teachersOrderIDs"] = teachersOrderIDs;
- ViewData["listAction"] = list;
- }
- }
- catch (Exception ex)
- {
- return RedirectToAction("MsgShow", "Common", new
- {
- WindowID = Request["WindowID"],
- msg = "操作失败原因:" + ex.Message,
- url = Url.Action("List").AddMenuParameter()
- });
- }
- return View();
- }
- [HttpPost]
- public ActionResult ApprovalHandle()
- {
- string teachersOrderIDs = Request.Form["teachersOrderIDs"].ToString();
- Session["teachersOrderIDs"] = teachersOrderIDs;
- return Json("成功", JsonRequestBehavior.AllowGet);
- }
- #endregion
- #region 4.0 提交审核
- [HttpPost]
- public ActionResult Approve(string teachersOrderIDs, Guid actionID, string comment)
- {
- var teachersOrderIDList = teachersOrderIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => new Guid(x)).ToList();
- var curUserID = CustomPrincipal.Current.UserID;
- if (teachersOrderIDList.Count == 0)
- {
- return Json(new ReturnMessage { IsSuccess = false, Message = "请选择至少一条记录进行审核。" });
- }
- try
- {
- this.TeachersOrderExamineServices.Approve(teachersOrderIDList, curUserID, actionID, string.IsNullOrEmpty(comment) ? "同意" : comment);
- return Json(new ReturnMessage { IsSuccess = true, Message = "审核成功。" });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage { IsSuccess = false, Message = "审核失败:" + ex.Message });
- }
- }
- #endregion
- #region 5.0 获取流程流转步骤
- /// <summary>
- /// 获取流程步骤详细信息
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult ApproveWorkflowList(Guid? teachersOrderID)
- {
- return base.Json(TeachersOrderExamineServices.GetWorkflowApproveHistoryView(teachersOrderID));
- }
- #endregion
- #region 6.0 导出Excel
- /// <summary>
- /// 导出Excel
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Excel()
- {
- //避开全选值
- Guid? publishID = null;
- Guid? coursematerialID = null;
- bool? isLate = null;
- publishID = Request.Form["PublishDropdown"].ParseStrTo<Guid>();
- coursematerialID = Request.Form["CourseDropdown"].ParseStrTo<Guid>();
- var schoolYearID = Request.Form["SchoolYearDropdown"].ParseStrTo<Guid>();
- var collegeID = Request.Form["CollegeDropdown"].ParseStrTo<Guid>();
- var approvalStatus = Request.Form["StatusDropdown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["StatusDropdown"].ParseStrTo<int>();
- NpoiExcelHelper neh = new NpoiExcelHelper();
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
- var dt = TeachersOrderExamineServices.GetTeachersOrderExamineViewExcel(configuretView, schoolYearID, collegeID, coursematerialID, publishID, approvalStatus).Select(x => new
- {
- x.SchoolyearName,
- x.TeachingMaterialCode,
- x.CoursematerialCode,
- x.CoursematerialName,
- x.CoursematerialLevelName,
- x.CoursematerialTypeName,
- x.ISBN,
- x.TeachingMaterialName,
- x.PublishTime,
- x.PublishName,
- x.Author,
- x.OrderQty,
- x.OrderUserName,
- x.CollegeName,
- x.OrderDate,
- x.OrderDesc,
- x.ApproveStatusName
- }).ToTable();
- string[] liststring = { "学年学期","教材编号","课程代码","课程名称","课程级别","课程科类","ISBN","教材名称"
- ,"版本时间","出版单位","作者","征订数量","征订人",RSL.Get("College"),"征订日期","征订说明","审核状态 "};
- neh.Export(dt, liststring, "征订审核信息");
- return RedirectToAction("MsgShow", "Common", new
- {
- msg = "导出成功!",
- url = Url.Content("~/TeachersOrder/List").AddMenuParameter()
- });
- }
- #endregion
- /// <summary>
- /// 编辑
- /// </summary>
- /// <param name="teachersOrderID"></param>
- /// <returns></returns>
- [HttpGet]
- public ActionResult Edit(Guid? teachersOrderID)
- {
- List<DropdownListItem> list = new List<DropdownListItem>();
- var user = HttpContext.User as EMIS.Utility.FormValidate.CustomPrincipal;
- TeachersOrderView teachersOrderView = new TeachersOrderView();
- if (teachersOrderID.HasValue)
- teachersOrderView = TeachersOrderExamineServices.GetTeachersOrderExamineView(teachersOrderID);
- List<ActionView> listAction = TeachersOrderExamineServices.GetAuditingActionView((Guid)teachersOrderID, user.UserID);
- foreach (var item in listAction)
- {
- DropdownListItem dli = new DropdownListItem { Text = item.ActionName, Value = item.ToJson() };
- list.Add(dli);
- }
- ViewData["listAction"] = list;
- ViewData["endStatus"] = TeachersOrderExamineServices.GetCorrectEndStatus();
- return View(teachersOrderView);
- }
- /// <summary>
- /// 编辑
- /// </summary>
- /// <param name="specialtyApplyID"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Edit(TeachersOrderView teachersOrderView)
- {
- try
- {
- List<Guid> list = new List<Guid>();
- string action = Request.Form["ddlAction"];
- var user = HttpContext.User as EMIS.Utility.FormValidate.CustomPrincipal;
- ActionView actionView = action.JsonToObject<ActionView>();
- string comment = Request.Form["txtOpinioncomment"];
- list.Add(teachersOrderView.TeachersOrderID);
- TeachersOrderExamineServices.ApproveTeachersOrderExamine(list, user.UserID, actionView, comment);
- return RedirectToAction("MsgShow", "Common", new
- {
- msg = "审核成功!",
- url = Url.Content("~/TeachersOrderExamine/List").AddMenuParameter()
- });
- }
- catch (Exception ex)
- {
- return RedirectToAction("MsgShow", "Common", new
- {
- msg = "审核失败,原因:" + ex.Message,
- url = Url.Content("~/TeachersOrderExamine/List").AddMenuParameter()
- });
- }
- }
- }
- }
|