82 lines
2.7 KiB
C#
82 lines
2.7 KiB
C#
|
|
using BLL;
|
|||
|
|
using Model;
|
|||
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Web.Http;
|
|||
|
|
|
|||
|
|
namespace Mvc.Controllers
|
|||
|
|
{
|
|||
|
|
public class CQMSPersonManageController : ApiController
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// 焊工列表
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="projectId"></param>
|
|||
|
|
/// <param name="index"></param>
|
|||
|
|
/// <param name="page"></param>
|
|||
|
|
/// <param name="unitId"></param>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
[HttpGet]
|
|||
|
|
public ResponseData<List<SitePerson_Person>> WelderIndex(string projectId, int index, int page, string unitId)
|
|||
|
|
{
|
|||
|
|
ResponseData<List<SitePerson_Person>> res = new ResponseData<List<SitePerson_Person>>();
|
|||
|
|
|
|||
|
|
res.successful = true;
|
|||
|
|
res.resultValue = BLL.SitePerson_PersonService.GetWelderListDataForApi(unitId, projectId, index, page);
|
|||
|
|
return res;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 根据personId获取焊工详情
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="projectId"></param>
|
|||
|
|
/// <param name="personId"></param>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
[HttpGet]
|
|||
|
|
public ResponseData<Person_Persons> GetWelder(string projectId, string personId)
|
|||
|
|
{
|
|||
|
|
ResponseData<Person_Persons> res = new ResponseData<Person_Persons>();
|
|||
|
|
Person_Persons welder = BLL.SitePerson_PersonService.GetWelder(projectId, personId);
|
|||
|
|
res.successful = true;
|
|||
|
|
res.resultValue = BeanUtil.CopyOjbect<Person_Persons>(welder, true);
|
|||
|
|
return res;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 保存焊工
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="Welder"></param>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
[HttpPost]
|
|||
|
|
public ResponseData<string> SaveWelder([FromBody] Model.SitePerson_Person Welder)
|
|||
|
|
{
|
|||
|
|
ResponseData<string> res = new ResponseData<string>();
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
BLL.SitePerson_PersonService.UpdateWelderForApi(Welder);
|
|||
|
|
SaveAttachFile(Welder.SitePersonId, BLL.Const.WelderManageMenuId, Welder.RoleIds);
|
|||
|
|
res.resultValue = Welder.PersonId;
|
|||
|
|
|
|||
|
|
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);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|