using System; using Learun.Util; using System.Data; using Learun.Application.TwoDevelopment.PersonnelManagement; using System.Web.Mvc; using System.Collections.Generic; using Learun.Application.Base.SystemModule; namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers { /// /// 版 本 Learun-ADMS-Ultimate V7.0.0 力软敏捷开发框架 /// Copyright (c) 2013-2018 上海力软信息技术有限公司 /// 创 建:超级管理员 /// 日 期:2019-09-24 15:37 /// 描 述:质量目标管理计划 /// public class MP_QualityObjectivesController : MvcControllerBase { private MP_QualityObjectivesIBLL mP_QualityObjectivesIBLL = new MP_QualityObjectivesBLL(); private MP_BrowseRecordIBLL mpBrowseRecordIbll = new MP_BrowseRecordBLL(); #region 视图功能 /// /// 主页面 /// /// [HttpGet] public ActionResult Index() { return View(); } /// /// 管理员页面 /// /// [HttpGet] public ActionResult IndexManagement() { return View(); } /// /// 提交材料页面 /// /// [HttpGet] public ActionResult IndexChildren() { return View(); } /// /// 表单页 /// /// [HttpGet] public ActionResult Form() { return View(); } /// /// 表单页 /// /// [HttpGet] public ActionResult UploadForm() { return View(); } #endregion #region 获取数据 /// /// 获取页面显示列表数据 /// /// 查询参数 /// [HttpGet] [AjaxOnly] public ActionResult GetPageList(string pagination, string queryJson) { Pagination paginationobj = pagination.ToObject(); var data = mP_QualityObjectivesIBLL.GetPageList(paginationobj, queryJson); var jsonData = new { rows = data, total = paginationobj.total, page = paginationobj.page, records = paginationobj.records }; return Success(jsonData); } /// /// 获取表单数据 /// /// [HttpGet] [AjaxOnly] public ActionResult GetFormData(string keyValue) { var MP_ManageMentPlanData = mP_QualityObjectivesIBLL.GetMP_ManageMentPlanEntity(keyValue); var jsonData = new { MP_ManageMentPlan = MP_ManageMentPlanData, }; return Success(jsonData); } #endregion #region 提交数据 /// /// 删除实体数据 /// 主键 /// /// [HttpPost] [AjaxOnly] public ActionResult DeleteForm(string keyValue) { mP_QualityObjectivesIBLL.DeleteEntity(keyValue); return Success("删除成功!"); } /// /// 合格/不合格 /// 主键 /// /// [HttpPost] [AjaxOnly] public ActionResult Qqualified(string keyValue, bool status) { var keyValueArr = keyValue.Split(','); foreach (var item in keyValueArr) { var entity = mP_QualityObjectivesIBLL.GetMP_ManageMentPlanEntity(item); entity.MPConclusion = status ? 1 : 0; mP_QualityObjectivesIBLL.SaveEntity(item, entity); } return Success("操作成功!"); } /// /// 保存实体数据(新增、修改) /// 主键 /// /// [HttpPost] [ValidateAntiForgeryToken] [AjaxOnly] public ActionResult SaveForm(string keyValue, string strEntity) { MP_ManageMentPlanEntity entity = strEntity.ToObject(); entity.MPType = 2; mP_QualityObjectivesIBLL.SaveEntity(keyValue, entity); return Success("保存成功!"); } /// /// 保存实体数据(新增、修改) /// 主键 /// /// [HttpPost] [ValidateAntiForgeryToken] [AjaxOnly] public ActionResult UploadForm(string keyValue, string strEntity) { MP_ManageMentPlanEntity entity = strEntity.ToObject(); if (!string.IsNullOrEmpty(keyValue)) { var entity2 = mP_QualityObjectivesIBLL.GetMP_ManageMentPlanEntity(keyValue); if (!string.IsNullOrEmpty(entity.MPFileTwo)) { entity.MPStatus = 0;//已提交 entity.MPUploadTimes = $"{DateTime.Now.ToString()}, {entity2.MPUploadTimes}"; entity.SUpdateTime = entity2.SUpdateTime + 1; } } else { entity.Create(); if (!string.IsNullOrEmpty(entity.MPFileTwo)) { entity.MPStatus = 0;//已提交 entity.MPUploadTimes = DateTime.Now.ToString(); entity.SUpdateTime = 1; entity.MPType = 2; } } entity.MPUploaderTwo = LoginUserInfo.Get().userId; mP_QualityObjectivesIBLL.SaveEntity(keyValue, entity); return Success("提交成功!"); } /// /// 保存实体数据(新增、修改) /// 主键 /// /// [HttpPost] [AjaxOnly] public ActionResult AddRecord(string fileId) { var loginUser = LoginUserInfo.Get(); var entity = mP_QualityObjectivesIBLL.GetMP_ManageMentPlanEntityByFileTwo(fileId); var record = new MP_BrowseRecordEntity(); record.MPId = entity.MPId; record.BRViewTime = DateTime.Now; record.BRViewers = loginUser.userId; record.BRViewerAddress = loginUser.iPAddress; record.Create(); mpBrowseRecordIbll.SaveEntity("", record); return Success("提交成功!"); } /// /// 保存文件浏览记录 /// 主键 /// /// [HttpPost] [AjaxOnly] public ActionResult AddFileRecord(string fileId) { var loginUser = LoginUserInfo.Get(); var record = new MP_BrowseRecordEntity(); record.FileId = fileId; record.Department = loginUser.departmentId; record.BRViewTime = DateTime.Now; record.BRViewers = loginUser.userId; record.BRViewerAddress = loginUser.iPAddress; record.Create(); mpBrowseRecordIbll.SaveEntity("", record); return Success("提交成功!"); } #endregion } }