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 Bowin.Web.Controls.Mvc;
- using EMIS.CommonLogic.CultureplanManage.PlanManagement;
- using EMIS.ViewModel.BaseWorkflow;
- using Bowin.Common.JSON;
- using EMIS.ViewModel.CultureplanManage.PlanManagement;
- using Bowin.Common.Utility;
- using Bowin.Common.Data;
- using EMIS.Utility;
- using EMIS.Utility.FormValidate;
- namespace EMIS.Web.Controllers.CultureplanManage.PlanManagement
- {
- [Authorization]
- public class PlanApprovalController : Controller
- {
- public IPlanApplicationServices planApplicationServices { get; set; }
- //
- // GET: /PlanApproval/
- public ActionResult List()
- {
- return View();
- }
- /// <summary>
- /// 列表查询
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult List(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- var campusID = pararms.getExtraGuid("CampusDropdown");
- var collegeID = pararms.getExtraGuid("CollegeDropdown");
- var yearID = pararms.getExtraInt("SchoolyearDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("SchoolyearDictionaryDropDown");
- var standardID = pararms.getExtraInt("StandardDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("StandardDictionaryDropDown");
- var educationID = pararms.getExtraInt("DictionaryEducation") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryEducation");
- var learningFormID = pararms.getExtraInt("DictionaryLearningform") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryLearningform");
- var schoolyear = pararms.getExtraGuid("SchoolyearDropdown");
- var grademajorID = pararms.getExtraGuid("GrademajorComboGrid");
- var approvalStatus = pararms.getExtraInt("DictionaryApprovalStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryApprovalStatus");
- var LearnSystem = pararms.getExtraString("DictionaryLearnSystem");
- return this.Json(planApplicationServices.GetPlanApprovalViewGrid(configuretView, campusID, collegeID, yearID, standardID, educationID, learningFormID, schoolyear, approvalStatus,grademajorID,LearnSystem, (int)pararms.page, (int)pararms.rows));
- }
-
- /// <summary>
- /// 编辑
- /// </summary>
- /// <param name="planApplicationID"></param>
- /// <returns></returns>
- [HttpGet]
- public ActionResult Edit(Guid? planApplicationID)
- {
- List<DropdownListItem> list = new List<DropdownListItem>();
- var user = HttpContext.User as EMIS.Utility.FormValidate.CustomPrincipal;
- PlanApplicationView planApplicationView = new PlanApplicationView();
- if (planApplicationID.HasValue)
- planApplicationView = planApplicationServices.GetPlanApplicationView(planApplicationID);
- List<ActionView> listAction = planApplicationServices.GetAuditingActionView((Guid)planApplicationID, user.UserID);
- foreach (var item in listAction)
- {
- DropdownListItem dli = new DropdownListItem { Text = item.ActionName, Value = item.ToJson() };
- list.Add(dli);
- }
- ViewData["listAction"] = list;
- return View(planApplicationView);
- }
-
- /// <summary>
- /// 编辑
- /// </summary>
- /// <param name="specialtyApplyID"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Edit(PlanApplicationView planApplicationView)
- {
- 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(planApplicationView.PlanApplicationID);
- planApplicationServices.ApprovePlanApplicationApply(list, user.UserID, actionView, comment, planApplicationView);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "审核成功!"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "审核失败,原因::" + ex.Message
- });
- }
- }
- /// <summary>
- /// 审批确定(批量)
- /// </summary>
- /// <param name="planApplicationIDs"></param>
- /// <param name="actionID"></param>
- /// <param name="comment"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Approve(string planApplicationIDs, Guid actionID, string comment)
- {
- var planApplicationIDList = planApplicationIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => new Guid(x)).ToList();
- var curUserID = CustomPrincipal.Current.UserID;
- if (planApplicationIDList.Count == 0)
- {
- return Json(new ReturnMessage { IsSuccess = false, Message = "请选择至少一条记录进行审核。" });
- }
- try
- {
- this.planApplicationServices.Approve(planApplicationIDList, curUserID, actionID, comment);
- return Json(new ReturnMessage { IsSuccess = true, Message = "审核成功。" });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage { IsSuccess = false, Message = "审核失败:" + ex.Message });
- }
- }
- /// <summary>
- /// 获取下一步动作
- /// </summary>
- /// <param name="planApplicationIDs"></param>
- /// <returns></returns>
- [HttpGet]
- public ActionResult ApprovalHandle(string planApplicationIDs)
- {
- if (string.IsNullOrEmpty(planApplicationIDs))
- {
- planApplicationIDs = Session["planApplicationIDs"].ToString();
- }
- var user = HttpContext.User as EMIS.Utility.FormValidate.CustomPrincipal;
- if (!string.IsNullOrEmpty(planApplicationIDs))
- {
- List<Guid> listguid = new List<Guid>();
- Guid planApplicationID = new Guid(planApplicationIDs.Split(',')[0]);
- List<ActionView> listAction = planApplicationServices.GetAuditingActionView(planApplicationID, user.UserID);
- List<DropdownListItem> list = new List<DropdownListItem>();
- if (listAction.Count == 0)
- {
- return RedirectToAction("MsgShow", "Common", new
- {
- WindowID = Request["WindowID"],
- msg = "对不起,您无权限进行审核操作。"
- });
- }
- foreach (var item in listAction)
- {
- DropdownListItem dli = new DropdownListItem { Text = item.ActionName, Value = item.ToJson() };
- list.Add(dli);
- }
- ViewData["planApplicationIDs"] = planApplicationIDs;
- ViewData["listAction"] = list;
- }
- else
- {
- return RedirectToAction("MsgShow", "Common", new
- {
- WindowID = Request["WindowID"],
- msg = "请选择需要审核的数据。"
- });
- }
- return View();
- }
- /// <summary>
- ///
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- public ActionResult ApprovalHandle()
- {
- string planApplicationIDs = Request.Form["planApplicationIDs"].ToString();
- Session["planApplicationIDs"] = planApplicationIDs;
- return Json("成功", JsonRequestBehavior.AllowGet);
- }
- /// <summary>
- /// 获取流程步骤详细信息
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult ApproveWorkflowList(Guid? planApplicationID)
- {
- return base.Json(planApplicationServices.GetWorkflowApproveHistoryView(planApplicationID));
- }
-
- /// <summary>
- /// 导出Excel
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Excel()
- {
- NpoiExcelHelper neh = new NpoiExcelHelper();
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
- var campusID = Request.Form["CampusDropdown"].ParseStrTo<Guid>();
- var collegeID = Request.Form["CollegeDropdown"].ParseStrTo<Guid>();
- var yearID = Request.Form["DictionarySchoolyear"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionarySchoolyear"].ParseStrTo<int>();
- var standardID = Request.Form["DictionaryStandard"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryStandard"].ParseStrTo<int>();
- var educationID = Request.Form["DictionaryEducation"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryEducation"].ParseStrTo<int>();
- var learningFormID = Request.Form["DictionaryLearningform"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryLearningform"].ParseStrTo<int>();
- var schoolyear = Request.Form["SchoolyearDropdown"].ParseStrTo<Guid>();
- var grademajorID = Request.Form["GrademajorComboGrid"].ParseStrTo<Guid>();
- var approvalStatus = Request.Form["DictionaryApprovalStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryApprovalStatus"].ParseStrTo<int>();
- var LearnSystem = "";
- //Request.Form["DictionaryLearnSystem"].ToString();
- var dt = planApplicationServices.GetPlanApprovalViewList(configuretView, campusID, collegeID, yearID,
- standardID, educationID, learningFormID, schoolyear, approvalStatus, grademajorID, LearnSystem).Select(x => new
- {
- x.SchoolyearCode,
- x.GrademajorCode,
- x.GrademajorName,
- x.CourseCode,
- x.CourseName,
- x.CourseTypeName,
- x.HandleModeName,
- x.Totalhours,
- x.TheoryCourse,
- x.Practicehours,
- x.Trialhours,
- x.Credit,
- x.SchoolcodeName,
- x.SchoolyearNumName,
- x.StarttermName,
- x.CollegeName,
- x.CreateTime,
- x.ApprovalStatusName
- }).ToTable();
- string[] liststring = { "学年学期","年级专业代码", "年级专业名称","课程代码", "课程名称", "课程类型","处理方式",
- "总学时","理论学时","实践学时", "实验学时","学分","学期","开课学年", "开课学期",
- RSL.Get("College"), "申请时间", "审批状态" };
- neh.Export(dt, liststring, "计划审核信息");
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "导出成功!"
- });
- }
- }
- }
|