GraduationStandardController.cs 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.Mvc;
  6. using EMIS.CommonLogic.GraduationManage.GraduationSetting;
  7. using EMIS.ViewModel;
  8. using EMIS.Web.Controls;
  9. using Bowin.Web.Controls.Mvc;
  10. using Bowin.Common.Utility;
  11. using Bowin.Common.Data;
  12. using Bowin.Common.JSON;
  13. using EMIS.ViewModel.GraduationManage.GraduationSetting;
  14. using EMIS.Utility;
  15. using EMIS.CommonLogic.CalendarManage;
  16. using EMIS.CommonLogic.SystemServices;
  17. namespace EMIS.Web.Controllers.GraduationManage.GraduationSetting
  18. {
  19. [Authorization]
  20. public class GraduationStandardController : Controller
  21. {
  22. public IGraduationStandardServices GraduationStandardServices { get; set; }
  23. /// <summary>
  24. /// 毕业标准页面
  25. /// </summary>
  26. /// <returns></returns>
  27. public ActionResult List()
  28. {
  29. return View();
  30. }
  31. /// <summary>
  32. /// 毕业标准列表查询
  33. /// </summary>
  34. /// <param name="pararms"></param>
  35. /// <returns></returns>
  36. [HttpPost]
  37. public ActionResult List(QueryParamsModel pararms)
  38. {
  39. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  40. var gradSchoolyearID = pararms.getExtraGuid("GradSchoolyearDropdown");
  41. var campusID = pararms.getExtraGuid("CampusDropdown");
  42. var collegeID = pararms.getExtraGuid("CollegeDropdown");
  43. var yearID = pararms.getExtraInt("DictionarySchoolyear") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionarySchoolyear");
  44. var standardID = pararms.getExtraInt("DictionaryStandard") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryStandard");
  45. var educationID = pararms.getExtraInt("DictionaryEducation") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryEducation");
  46. var learningformID = pararms.getExtraInt("DictionaryLearningform") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryLearningform");
  47. var learnSystem = pararms.getExtraString("DictionaryLearnSystem");
  48. //在校状态
  49. var inSchoolStatus = pararms.getExtraInt("DictionaryInschoolStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryInschoolStatus");
  50. return base.Json(GraduationStandardServices.GetGraduationStandardViewGrid(configuretView, gradSchoolyearID, campusID, collegeID, yearID,
  51. standardID, educationID, learningformID, learnSystem, inSchoolStatus, (int)pararms.page, (int)pararms.rows));
  52. }
  53. /// <summary>
  54. /// 标准生成
  55. /// </summary>
  56. /// <returns></returns>
  57. [HttpGet]
  58. public ActionResult Generate()
  59. {
  60. return View();
  61. }
  62. /// <summary>
  63. /// 标准生成(只生成年级专业对应的学生人数大于0的信息)
  64. /// </summary>
  65. /// <param name="graduationStandardView"></param>
  66. /// <returns></returns>
  67. [HttpPost]
  68. public ActionResult Generate(GraduationStandardView graduationStandardView)
  69. {
  70. try
  71. {
  72. string result = GraduationStandardServices
  73. .GraduationStandardGenerate(graduationStandardView.GraduatingSemesterID, graduationStandardView.CollegeID);
  74. return Json(new ReturnMessage()
  75. {
  76. IsSuccess = true,
  77. Message = "生成成功" + result + "。"
  78. });
  79. }
  80. catch (Exception ex)
  81. {
  82. return Json(new ReturnMessage()
  83. {
  84. IsSuccess = false,
  85. Message = "生成失败,原因:" + ex.Message
  86. });
  87. }
  88. }
  89. /// <summary>
  90. /// 复制新增
  91. /// </summary>
  92. /// <param name="graduationStandardID"></param>
  93. /// <returns></returns>
  94. public ActionResult CopyAdd(Guid graduationStandardID)
  95. {
  96. GraduationStandardView graduationStandardView = new GraduationStandardView();
  97. graduationStandardView = GraduationStandardServices.GetGraduationStandardView(graduationStandardID);
  98. return View("Edit", graduationStandardView);
  99. }
  100. /// <summary>
  101. /// 复制新增
  102. /// </summary>
  103. /// <param name="graduationStandardView"></param>
  104. /// <returns></returns>
  105. [HttpPost]
  106. public ActionResult CopyAdd(GraduationStandardView graduationStandardView)
  107. {
  108. graduationStandardView.GraduationStandardID = Guid.Empty;
  109. return this.Edit(graduationStandardView);
  110. }
  111. /// <summary>
  112. /// 编辑(新增、修改)
  113. /// </summary>
  114. /// <param name="GraduationStandardID"></param>
  115. /// <returns></returns>
  116. [HttpGet]
  117. public ActionResult Edit(Guid? GraduationStandardID)
  118. {
  119. GraduationStandardView graduationStandardView = new GraduationStandardView();
  120. if (GraduationStandardID.HasValue && GraduationStandardID != Guid.Empty)
  121. {
  122. graduationStandardView = GraduationStandardServices.GetGraduationStandardView(GraduationStandardID);
  123. }
  124. return View(graduationStandardView);
  125. }
  126. /// <summary>
  127. /// 编辑(新增、修改)
  128. /// </summary>
  129. /// <param name="graduationStandardView"></param>
  130. /// <returns></returns>
  131. [HttpPost]
  132. public ActionResult Edit(GraduationStandardView graduationStandardView)
  133. {
  134. try
  135. {
  136. GraduationStandardServices.GraduationStandardEdit(graduationStandardView);
  137. return Json(new ReturnMessage()
  138. {
  139. IsSuccess = true,
  140. Message = "保存成功。"
  141. });
  142. }
  143. catch (Exception ex)
  144. {
  145. return Json(new ReturnMessage()
  146. {
  147. IsSuccess = false,
  148. Message = "保存失败,原因:" + ex.Message
  149. });
  150. }
  151. }
  152. /// <summary>
  153. /// 毕业标准批量新增(业务主键:年级专业ID)
  154. /// </summary>
  155. /// <returns></returns>
  156. [HttpGet]
  157. public ActionResult GraduationStandardBatchAdd()
  158. {
  159. GraduationStandardView graduationStandardView = new GraduationStandardView();
  160. return View(graduationStandardView);
  161. }
  162. /// <summary>
  163. /// 毕业标准批量新增(业务主键:年级专业ID)
  164. /// </summary>
  165. /// <param name="graduationStandardView"></param>
  166. /// <returns></returns>
  167. public ActionResult GraduationStandardBatchAdd(GraduationStandardView graduationStandardView)
  168. {
  169. try
  170. {
  171. var grademajorIDList = Request["grademajorIDList"].JsonToObject<List<Guid?>>();
  172. string result = GraduationStandardServices.GraduationStandardBatchAdd(grademajorIDList, graduationStandardView);
  173. return Json(new ReturnMessage()
  174. {
  175. IsSuccess = true,
  176. Message = "新增成功" + result + "。"
  177. });
  178. }
  179. catch (Exception ex)
  180. {
  181. return Json(new ReturnMessage()
  182. {
  183. IsSuccess = false,
  184. Message = "新增失败,原因:" + ex.Message
  185. });
  186. }
  187. }
  188. /// <summary>
  189. /// 查询未新增的毕业标准对应的年级专业信息
  190. /// </summary>
  191. /// <param name="pararms"></param>
  192. /// <returns></returns>
  193. [HttpPost]
  194. public ActionResult GraduationStandardNoAddList(QueryParamsModel pararms)
  195. {
  196. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  197. var campusID = pararms.getExtraGuid("CampusDropdown");
  198. var collegeID = pararms.getExtraGuid("CollegeDropdown");
  199. var schoolyearID = pararms.getExtraInt("DictionarySchoolyear") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionarySchoolyear");
  200. var standardID = pararms.getExtraInt("DictionaryStandard") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryStandard");
  201. var educationID = pararms.getExtraInt("DictionaryEducation") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryEducation");
  202. var learningformID = pararms.getExtraInt("DictionaryLearningform") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryLearningform");
  203. var learnSystem = pararms.getExtraString("DictionaryLearnSystem");
  204. //在校状态
  205. var inSchoolStatus = pararms.getExtraInt("DictionaryInschoolStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryInschoolStatus");
  206. //毕业学期(年级专业对应的毕业学期)
  207. var gradSchoolyearID = pararms.getExtraGuid("GradSchoolyearDropdown");
  208. return base.Json(GraduationStandardServices.GetGraduationStandardNoAddViewGrid(configuretView, campusID, collegeID,
  209. schoolyearID, standardID, educationID, learningformID, learnSystem, inSchoolStatus, gradSchoolyearID, (int)pararms.page, (int)pararms.rows));
  210. }
  211. /// <summary>
  212. /// 删除
  213. /// </summary>
  214. /// <param name="graduationStandardIDs"></param>
  215. /// <returns></returns>
  216. [HttpPost]
  217. public ActionResult Delete(string graduationStandardIDs)
  218. {
  219. try
  220. {
  221. List<Guid?> list = graduationStandardIDs.Split(',').Where(x => !string.IsNullOrEmpty(x))
  222. .Select(x => (Guid?)new Guid(x)).ToList();
  223. GraduationStandardServices.GraduationStandardDelete(list);
  224. return base.Json("删除成功。");
  225. }
  226. catch (Exception ex)
  227. {
  228. return base.Json("删除失败,原因:" + ex.Message);
  229. }
  230. }
  231. /// <summary>
  232. /// 根据毕业标准查看对应的专业计划信息
  233. /// </summary>
  234. /// <returns></returns>
  235. public ActionResult SpecialtyPlanList()
  236. {
  237. return View();
  238. }
  239. /// <summary>
  240. /// 根据毕业标准查看对应的专业计划信息
  241. /// </summary>
  242. /// <param name="pararms"></param>
  243. /// <returns></returns>
  244. [HttpPost]
  245. public ActionResult SpecialtyPlanList(QueryParamsModel pararms)
  246. {
  247. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  248. var graduationStandardID = Request["graduationStandardID"].ParseStrTo<Guid>();
  249. var schoolyearID = pararms.getExtraGuid("SchoolyearDropdown");
  250. var courseTypeID = pararms.getExtraInt("DictionaryCourseType") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryCourseType");
  251. var starttermID = pararms.getExtraInt("DictionaryStartterm") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryStartterm");
  252. var isMainCourse = pararms.getExtraInt("DictionaryIsMainCourse") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryIsMainCourse");
  253. var handleModeID = pararms.getExtraInt("DictionaryHandleMode") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryHandleMode");
  254. return Json(GraduationStandardServices.GetSpecialtyPlanViewGrid(configuretView, graduationStandardID,
  255. schoolyearID, courseTypeID, starttermID, isMainCourse, handleModeID, (int)pararms.page, (int)pararms.rows));
  256. }
  257. /// <summary>
  258. /// 专业计划明细Excel导出
  259. /// </summary>
  260. /// <returns></returns>
  261. [HttpPost]
  262. public ActionResult SpecialtyPlanListExcel()
  263. {
  264. return null;
  265. }
  266. /// <summary>
  267. /// 根据毕业标准查看对应的执行计划信息
  268. /// </summary>
  269. /// <returns></returns>
  270. public ActionResult ExecutablePlanList()
  271. {
  272. return View();
  273. }
  274. /// <summary>
  275. /// 根据毕业标准查看对应的执行计划信息
  276. /// </summary>
  277. /// <param name="pararms"></param>
  278. /// <returns></returns>
  279. [HttpPost]
  280. public ActionResult ExecutablePlanList(QueryParamsModel pararms)
  281. {
  282. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  283. var graduationStandardID = Request["graduationStandardID"].ParseStrTo<Guid>();
  284. var schoolyearID = pararms.getExtraGuid("SchoolyearDropdown");
  285. var courseTypeID = pararms.getExtraInt("DictionaryCourseType") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryCourseType");
  286. var starttermID = pararms.getExtraInt("DictionaryStartterm") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryStartterm");
  287. var isMainCourse = pararms.getExtraInt("DictionaryIsMainCourse") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryIsMainCourse");
  288. var handleModeID = pararms.getExtraInt("DictionaryHandleMode") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryHandleMode");
  289. //计划状态(执行计划)
  290. var executablePlanStatus = pararms.getExtraInt("DictionaryExecutablePlanStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryExecutablePlanStatus");
  291. return Json(GraduationStandardServices.GetExecutablePlanViewGrid(configuretView, graduationStandardID,
  292. schoolyearID, courseTypeID, starttermID, isMainCourse, handleModeID, executablePlanStatus, (int)pararms.page, (int)pararms.rows));
  293. }
  294. /// <summary>
  295. /// 执行计划明细Excel导出
  296. /// </summary>
  297. /// <returns></returns>
  298. [HttpPost]
  299. public ActionResult ExecutablePlanListExcel()
  300. {
  301. return null;
  302. }
  303. /// <summary>
  304. /// 查询年级专业下各班级学生名单
  305. /// </summary>
  306. /// <returns></returns>
  307. public ActionResult Detail()
  308. {
  309. return View();
  310. }
  311. /// <summary>
  312. /// 查询年级专业下各班级学生名单
  313. /// </summary>
  314. /// <param name="pararms"></param>
  315. /// <returns></returns>
  316. [HttpPost]
  317. public ActionResult Detail(QueryParamsModel pararms)
  318. {
  319. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  320. var grademajorID = Request["grademajorID"].ParseStrTo<Guid>();
  321. int? inschoolStatus = Request["inschoolStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request["inschoolStatus"].ParseStrTo<int>();
  322. return Json(GraduationStandardServices.GetGradeMajorStudentViewGrid(configuretView, grademajorID, inschoolStatus, (int)pararms.page, (int)pararms.rows));
  323. }
  324. /// <summary>
  325. /// 学生信息明细Excel导出
  326. /// </summary>
  327. /// <returns></returns>
  328. [HttpPost]
  329. public ActionResult GrademajorStudentExcel()
  330. {
  331. NpoiExcelHelper neh = new NpoiExcelHelper();
  332. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  333. var grademajorID = Request["grademajorID"].ParseStrTo<Guid>();
  334. int? inSchoolStatus = Request["inschoolStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request["inschoolStatus"].ParseStrTo<int>();
  335. var dt = GraduationStandardServices.GetGradeMajorStudentViewGrid(configuretView, grademajorID, inSchoolStatus)
  336. .Select(x => new
  337. {
  338. x.LoginID,
  339. x.UserName,
  340. x.SexName,
  341. x.ClassmajorName,
  342. x.InSchoolStatusName,
  343. x.StudentStatusName
  344. }).ToTable();
  345. string[] liststring = { "学号", "姓名", "性别", "班级名称 ", "在校状态", "学籍状态" };
  346. var title = "毕业标准学生信息";
  347. if (inSchoolStatus == (int)CF_INOrOutSchoolStatus.No)
  348. {
  349. title = "毕业标准学生信息(非在校)";
  350. }
  351. if (inSchoolStatus == (int)CF_INOrOutSchoolStatus.Yes)
  352. {
  353. title = "毕业标准学生信息(在校)";
  354. }
  355. neh.Export(dt, liststring, title + DateTime.Now.ToString("yyyyMMdd"));
  356. return Json(new ReturnMessage()
  357. {
  358. IsSuccess = true,
  359. Message = "导出成功。"
  360. });
  361. }
  362. /// <summary>
  363. /// Excel导出
  364. /// </summary>
  365. /// <returns></returns>
  366. [HttpPost]
  367. public ActionResult Excel()
  368. {
  369. NpoiExcelHelper neh = new NpoiExcelHelper();
  370. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  371. var gradSchoolyearID = Request.Form["GradSchoolyearDropdown"] == DropdownList.SELECT_ALL.ToString() ? null : Request.Form["GradSchoolyearDropdown"].ParseStrTo<Guid>();
  372. var campusID = Request.Form["CampusDropdown"].ParseStrTo<Guid>();
  373. var collegeID = Request.Form["CollegeDropdown"].ParseStrTo<Guid>();
  374. var yearID = Request.Form["DictionarySchoolyear"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionarySchoolyear"].ParseStrTo<int>();
  375. var standardID = Request.Form["DictionaryStandard"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryStandard"].ParseStrTo<int>();
  376. var educationID = Request.Form["DictionaryEducation"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryEducation"].ParseStrTo<int>();
  377. var learningformID = Request.Form["DictionaryLearningform"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryLearningform"].ParseStrTo<int>();
  378. var learnSystem = Request.Form["DictionaryLearnSystem"].ToString();
  379. //在校状态
  380. var inSchoolStatus = Request.Form["DictionaryInschoolStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryInschoolStatus"].ParseStrTo<int>();
  381. var dt = GraduationStandardServices.GetGraduationStandardViewList(configuretView, gradSchoolyearID, campusID, collegeID, yearID,
  382. standardID, educationID, learningformID, learnSystem, inSchoolStatus)
  383. .Select(x => new
  384. {
  385. x.GraduatingSemesterCode,
  386. x.GrademajorCode,
  387. x.GrademajorName,
  388. x.FacultymajorNo,
  389. x.FacultymajorName,
  390. x.CollegeNo,
  391. x.CollegeName,
  392. x.SchoolyearID,
  393. x.SchoolcodeName,
  394. x.EnteringSchoolYearCode,
  395. x.StandardID,
  396. x.StandardCode,
  397. x.StandardName,
  398. x.EducationName,
  399. x.LearningformName,
  400. x.LearnSystem,
  401. x.PlanCourseCount,
  402. x.SpecialtyCreditTotal,
  403. x.SpecialtyRequireCreditTotal,
  404. x.OptionalCreditTotal,
  405. x.FreeSelectionCreditTotal,
  406. x.ExecCourseCount,
  407. x.ExecutableCreditTotal,
  408. x.RequireCourseCount,
  409. x.GraduationCredit,
  410. x.StudentCount
  411. }).ToTable();
  412. string[] liststring = {
  413. "毕业学期", "年级专业编号", "年级专业名称", "院系专业编号", "院系专业名称",
  414. RSL.Get("CollegeCode"), RSL.Get("CollegeName"), "年级", "学期", "入学学年学期",
  415. "专业ID(Value)", "专业代码", "专业名称", RSL.Get("EducationID"), "学习形式",
  416. "学制", "计划门数", "计划学分", "必修学分", "限选学分", "任选学分",
  417. "执行门数", "执行学分", "毕业门数", "毕业学分", "人数"
  418. };
  419. var title = "毕业标准信息";
  420. if (inSchoolStatus == (int)CF_INOrOutSchoolStatus.No)
  421. {
  422. title = "毕业标准信息(非在校)";
  423. }
  424. if (inSchoolStatus == (int)CF_INOrOutSchoolStatus.Yes)
  425. {
  426. title = "毕业标准信息(在校)";
  427. }
  428. neh.Export(dt, liststring, title + DateTime.Now.ToString("yyyyMMdd"));
  429. return Json(new ReturnMessage()
  430. {
  431. IsSuccess = true,
  432. Message = "导出成功。"
  433. });
  434. }
  435. }
  436. }