|
- 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
- {
- /// <summary>
- /// 版 本 Learun-ADMS-Ultimate V7.0.0 力软敏捷开发框架
- /// Copyright (c) 2013-2018 上海力软信息技术有限公司
- /// 创 建:超级管理员
- /// 日 期:2019-09-24 15:37
- /// 描 述:质量目标管理计划
- /// </summary>
- public class MP_QualityObjectivesController : MvcControllerBase
- {
- private MP_QualityObjectivesIBLL mP_QualityObjectivesIBLL = new MP_QualityObjectivesBLL();
- private MP_BrowseRecordIBLL mpBrowseRecordIbll = new MP_BrowseRecordBLL();
-
- #region 视图功能
-
- /// <summary>
- /// 主页面
- /// <summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult Index()
- {
- return View();
- }
- /// <summary>
- /// 管理员页面
- /// <summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult IndexManagement()
- {
- return View();
- }
- /// <summary>
- /// 提交材料页面
- /// <summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult IndexChildren()
- {
- return View();
- }
- /// <summary>
- /// 表单页
- /// <summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult Form()
- {
- return View();
- }
-
- /// <summary>
- /// 表单页
- /// <summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult UploadForm()
- {
- return View();
- }
-
-
-
- #endregion
-
- #region 获取数据
-
- /// <summary>
- /// 获取页面显示列表数据
- /// <summary>
- /// <param name="queryJson">查询参数</param>
- /// <returns></returns>
- [HttpGet]
- [AjaxOnly]
- public ActionResult GetPageList(string pagination, string queryJson)
- {
- Pagination paginationobj = pagination.ToObject<Pagination>();
- var data = mP_QualityObjectivesIBLL.GetPageList(paginationobj, queryJson);
- var jsonData = new
- {
- rows = data,
- total = paginationobj.total,
- page = paginationobj.page,
- records = paginationobj.records
- };
- return Success(jsonData);
- }
- /// <summary>
- /// 获取表单数据
- /// <summary>
- /// <returns></returns>
- [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 提交数据
-
- /// <summary>
- /// 删除实体数据
- /// <param name="keyValue">主键</param>
- /// <summary>
- /// <returns></returns>
- [HttpPost]
- [AjaxOnly]
- public ActionResult DeleteForm(string keyValue)
- {
- mP_QualityObjectivesIBLL.DeleteEntity(keyValue);
- return Success("删除成功!");
- }
-
- /// <summary>
- /// 合格/不合格
- /// <param name="keyValue">主键</param>
- /// <summary>
- /// <returns></returns>
- [HttpPost]
- [AjaxOnly]
- public ActionResult Qqualified(string keyValue, bool status)
- {
- var entity = mP_QualityObjectivesIBLL.GetMP_ManageMentPlanEntity(keyValue);
- entity.MPConclusion = status?1:0;
- mP_QualityObjectivesIBLL.SaveEntity(keyValue, entity);
- return Success("删除成功!");
- }
-
- /// <summary>
- /// 保存实体数据(新增、修改)
- /// <param name="keyValue">主键</param>
- /// <summary>
- /// <returns></returns>
- [HttpPost]
- [ValidateAntiForgeryToken]
- [AjaxOnly]
- public ActionResult SaveForm(string keyValue, string strEntity)
- {
- MP_ManageMentPlanEntity entity = strEntity.ToObject<MP_ManageMentPlanEntity>();
- entity.MPType = 2;
- mP_QualityObjectivesIBLL.SaveEntity(keyValue, entity);
- return Success("保存成功!");
- }
-
-
- /// <summary>
- /// 保存实体数据(新增、修改)
- /// <param name="keyValue">主键</param>
- /// <summary>
- /// <returns></returns>
- [HttpPost]
- [ValidateAntiForgeryToken]
- [AjaxOnly]
- public ActionResult UploadForm(string keyValue, string strEntity)
- {
- MP_ManageMentPlanEntity entity = strEntity.ToObject<MP_ManageMentPlanEntity>();
- 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("提交成功!");
- }
-
- /// <summary>
- /// 保存实体数据(新增、修改)
- /// <param name="keyValue">主键</param>
- /// <summary>
- /// <returns></returns>
- [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("提交成功!");
- }
-
-
- /// <summary>
- /// 保存文件浏览记录
- /// <param name="keyValue">主键</param>
- /// <summary>
- /// <returns></returns>
- [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
-
- }
- }
|