SGGL_SHJ/SGGL/WebAPI/Controllers/CQMS/CQMSMeetingController.cs

263 lines
8.9 KiB
C#
Raw Normal View History

2023-03-15 10:55:53 +08:00
using BLL;
using Model;
using System;
using System.Collections.Generic;
using System.Web.Http;
namespace WebAPI.Controllers
{
/// <summary>
/// 质量会议
/// </summary>
public class CQMSMeetingController : ApiController
{
2023-03-16 14:35:01 +08:00
/// <summary>
/// 根据项目id获取质量会议列表集合
/// </summary>
/// <param name="projectId"></param>
/// <param name="index"></param>
/// <param name="page"></param>
/// <param name="meetingType"></param>
/// <returns></returns>
[HttpGet]
public ResponseData<List<Meeting_CQMSMeeting>> getMeetingList(string projectId, int index, int page, string meetingType)
{
ResponseData<List<Meeting_CQMSMeeting>> res = new ResponseData<List<Meeting_CQMSMeeting>>();
res.successful = true;
res.resultValue = BLL.CQMS_MeetingService.getListDataForApi(projectId, index, page, meetingType);
return res;
}
2023-03-15 10:55:53 +08:00
2023-03-16 14:35:01 +08:00
/// <summary>
/// 根据id获取质量会议详情
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet]
public ResponseData<Meeting_CQMSMeeting> GetMeetingByMeetingId(string id)
{
ResponseData<Meeting_CQMSMeeting> res = new ResponseData<Meeting_CQMSMeeting>();
Meeting_CQMSMeeting cd = BLL.CQMS_MeetingService.GetMeetingByMeetingIdForApi(id);
res.successful = true;
res.resultValue = BeanUtil.CopyOjbect<Meeting_CQMSMeeting>(cd, true);
return res;
}
/// <summary>
/// 根据id获取审核记录集合
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public ResponseData<List<Meeting_CQMSMeetingApprove>> GetApproveById(string id)
{
ResponseData<List<Meeting_CQMSMeetingApprove>> res = new ResponseData<List<Meeting_CQMSMeetingApprove>>();
res.successful = true;
res.resultValue = BLL.CQMS_MeetingApproveService.GetListDataByIdForApi(id);
return res;
}
/// <summary>
/// 根据id获取当前办理人审批信息
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public ResponseData<Meeting_CQMSMeetingApprove> GetCurrApproveById(string id)
{
ResponseData<Meeting_CQMSMeetingApprove> res = new ResponseData<Meeting_CQMSMeetingApprove>();
res.successful = true;
res.resultValue = BeanUtil.CopyOjbect<Meeting_CQMSMeetingApprove>(BLL.CQMS_MeetingApproveService.getCurrApproveForApi(id), true);
return res;
}
/// <summary>
/// 保存会议主表信息
/// </summary>
/// <param name="meeting"></param>
/// <returns></returns>
[HttpPost]
public ResponseData<string> AddCQMSMeeting([FromBody] Model.Meeting_CQMSMeeting meeting)
{
ResponseData<string> res = new ResponseData<string>();
try
{
if (string.IsNullOrEmpty(meeting.MeetingId))
{
meeting.MeetingId = Guid.NewGuid().ToString();
BLL.CQMS_MeetingService.AddMeetingForApi(meeting);
if (meeting.MeetingType == "M")
{
SaveAttachFile(meeting.MeetingId, BLL.Const.CQMSMonthMeetingMenuId, meeting.AttachUrl);
}
else
{
SaveAttachFile(meeting.MeetingId, BLL.Const.CQMSSpecialMeetingMenuId, meeting.AttachUrl);
}
res.resultValue = meeting.MeetingId;
}
else
{
BLL.CQMS_MeetingService.UpdateMeetingForApi(meeting);
if (meeting.MeetingType == "M")
{
SaveAttachFile(meeting.MeetingId, BLL.Const.CQMSMonthMeetingMenuId, meeting.AttachUrl);
}
else
{
SaveAttachFile(meeting.MeetingId, BLL.Const.CQMSSpecialMeetingMenuId, meeting.AttachUrl);
}
res.resultValue = meeting.MeetingId;
}
res.successful = true;
}
catch (Exception e)
{
res.resultHint = e.StackTrace;
res.successful = false;
}
return res;
}
public static void SaveAttachFile(string dataId, string menuId, string url)
{
Model.ToDoItem toDoItem = new Model.ToDoItem
{
MenuId = menuId,
DataId = dataId,
UrlStr = url,
};
APIUpLoadFileService.SaveAttachUrl(toDoItem);
}
/// <summary>
/// 新增办理信息
/// </summary>
/// <param name="approve"></param>
/// <returns></returns>
[HttpPost]
public ResponseData<string> AddApprove([FromBody] Model.Meeting_CQMSMeetingApprove approve)
{
ResponseData<string> res = new ResponseData<string>();
try
{
Model.Meeting_CQMSMeeting Meeting = new Model.Meeting_CQMSMeeting();
Meeting.MeetingId = approve.MeetingId;
Meeting.State = approve.ApproveType;
BLL.CQMS_MeetingService.UpdateMeetingForApi(Meeting);
res.resultValue = BLL.CQMS_MeetingApproveService.AddMeetingApproveForApi(approve);
res.successful = true;
}
catch (Exception e)
{
res.resultHint = e.StackTrace;
res.successful = false;
}
return res;
}
/// <summary>
/// 更新办理信息
/// </summary>
/// <param name="approve"></param>
/// <returns></returns>
[HttpPost]
public ResponseData<string> UpdateApprove([FromBody] Model.Meeting_CQMSMeetingApprove approve)
{
ResponseData<string> res = new ResponseData<string>();
try
{
approve.ApproveDate = DateTime.Now;
BLL.CQMS_MeetingApproveService.UpdateMeetingApproveForApi(approve);
res.successful = true;
}
catch (Exception e)
{
res.resultHint = e.StackTrace;
res.successful = false;
}
return res;
}
/// <summary>
/// 获取主持人信息
/// </summary>
/// <returns></returns>
public Model.ResponeData getHostMan(string projectId, string unitId)
{
var responeData = new Model.ResponeData();
try
{
responeData.data = APIBaseInfoService.getCQMSMeetingHostMan(projectId, unitId);
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
/// <summary>
/// 获取质量会议参加人员
/// </summary>
/// <returns></returns>
public Model.ResponeData getAttentPerson(string projectId)
{
var responeData = new Model.ResponeData();
try
{
responeData.data = APIBaseInfoService.getAttentPerson(projectId);
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
/// <summary>
/// 根据状态获取办理步骤 0-重新编制1-编制2-总包质量经理审批C-审批完成
/// </summary>
/// <returns></returns>
public Model.ResponeData getHandleListByState(string state)
{
var responeData = new Model.ResponeData();
try
{
responeData.data = CQMS_MeetingService.GetDHandleTypeByStateForApi(state);
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
/// <summary>
/// 根据办理步骤获取办理人
/// </summary>
/// <returns></returns>
public Model.ResponeData getHandleManListByState(string state, string id, string projectId)
{
var responeData = new Model.ResponeData();
try
{
responeData.data = CQMS_MeetingService.GetHandleManListForApi(state, id, projectId);
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
2023-03-15 10:55:53 +08:00
}
}