This commit is contained in:
杨红卫 2022-09-05 17:20:50 +08:00
parent 74d3922232
commit c26e450d67
7 changed files with 190 additions and 7 deletions

View File

@ -41,7 +41,7 @@ namespace BLL
/// <param name="welder"></param>
public static void UpdateChecker(Model.SitePerson_Person checker)
{
Model.SitePerson_Person newChecker = Funs.DB.SitePerson_Person.FirstOrDefault(e => e.PersonId == checker.PersonId);
Model.SitePerson_Person newChecker = Funs.DB.SitePerson_Person.FirstOrDefault(e => e.PersonId == checker.PersonId && e.ProjectId == checker.ProjectId);
if (newChecker != null)
{
newChecker.PersonId = checker.PersonId;

View File

@ -15,7 +15,7 @@ namespace BLL
/// <param name="welder"></param>
public static void UpdateWelder(Model.SitePerson_Person welder)
{
Model.SitePerson_Person newWelder = Funs.DB.SitePerson_Person.FirstOrDefault(e => e.PersonId == welder.PersonId);
Model.SitePerson_Person newWelder = Funs.DB.SitePerson_Person.FirstOrDefault(e => e.PersonId == welder.PersonId && e.ProjectId == welder.ProjectId);
if (newWelder != null)
{
newWelder.WelderCode = welder.WelderCode;

View File

@ -28,7 +28,7 @@ namespace BLL
/// 定义变量
/// </summary>
private static IQueryable<Model.View_SitePerson_Person> getDataLists = from x in db.View_SitePerson_Person
select x;
select x;
/// <summary>
/// 数据列表
@ -41,7 +41,7 @@ namespace BLL
/// <param name="states"></param>
/// <param name="Grid1"></param>
/// <returns></returns>
public static IEnumerable getListData(string projetcId, string unitId, string workPostId, string name, string idCard, string states,string personType, Grid Grid1)
public static IEnumerable getListData(string projetcId, string unitId, string workPostId, string name, string idCard, string states, string personType, Grid Grid1)
{
IQueryable<Model.View_SitePerson_Person> getDataList = getDataLists.OrderBy(x => x.ProjectId).ThenBy(x => x.UnitId);
if (!string.IsNullOrEmpty(projetcId) && projetcId != Const._Null)
@ -1034,5 +1034,102 @@ namespace BLL
}
}
#endregion
#region
public static List<Model.SitePerson_Person> GetWelderListDataForApi(string unitId, string projectId, int index, int page)
{
using (var db = new Model.SGGLDB(Funs.ConnString))
{
IQueryable<Model.SitePerson_Person> q = db.SitePerson_Person;
List<string> ids = new List<string>();
if (!string.IsNullOrEmpty(unitId))
{
q = q.Where(e => e.UnitId == unitId);
}
if (!string.IsNullOrEmpty(projectId))
{
q = q.Where(e => e.ProjectId == projectId);
}
var qq1 = from x in q
where x.WorkPostId == Const.WorkPost_Welder && x.States == Const.ProjectPersonStates_1
orderby x.PersonName
select new
{
x.PersonId,
x.PersonName,
x.UnitId,
};
var list = qq1.Skip(index * page).Take(page).ToList();
List<Model.SitePerson_Person> listRes = new List<Model.SitePerson_Person>();
for (int i = 0; i < list.Count; i++)
{
Model.SitePerson_Person x = new Model.SitePerson_Person();
x.PersonId = list[i].PersonId;
x.PersonName = list[i].PersonName;
x.UnitId = list[i].UnitId + "$" + UnitService.GetUnitNameByUnitId(list[i].UnitId);
listRes.Add(x);
}
return listRes;
}
}
#endregion
#region
public static Model.Person_Persons GetWelder(string projectId, string personId)
{
using (var db = new Model.SGGLDB(Funs.ConnString))
{
Model.SitePerson_Person x = db.SitePerson_Person.FirstOrDefault(e => e.ProjectId == projectId && e.PersonId == personId);
Model.Person_Persons getPerson = db.Person_Persons.FirstOrDefault(e => e.PersonId == personId);
getPerson.Sex = getPerson.Sex == "1" ? "男" : "女";
getPerson.Birthday = getPerson.Birthday;
getPerson.PhotoUrl = getPerson.PhotoUrl;
getPerson.QRCodeAttachUrl = getPerson.QRCodeAttachUrl;
getPerson.IdentityCard = x.IdentityCard;
getPerson.CertificateId = x.CertificateCode; //证书编号
getPerson.EduLevel = x.WelderLevel; //焊工等级
getPerson.RelativeTel = x.Remark; //备注
getPerson.RoleIds = AttachFileService.getFileUrl(x.SitePersonId); //焊工证路径
getPerson.DepartId = x.SitePersonId; //焊工SitePersonId
if (!string.IsNullOrEmpty(x.WelderCode))
{
getPerson.JobNum = x.WelderCode;
}
else
{
var u = BLL.UnitService.GetUnitByUnitId(x.UnitId);
string prefix = BLL.ProjectService.GetProjectCodeByProjectId(projectId) + "-" + u.UnitCode + "-H";
getPerson.JobNum = BLL.SQLHelper.RunProcNewId("SpGetThreeNumber", "SitePerson_Person", "WelderCode", projectId, prefix);
}
getPerson.PersonName = x.PersonName;
var unit = UnitService.GetUnitByUnitId(x.UnitId);
getPerson.UnitId = x.UnitId + "$" + unit.UnitName;
return getPerson;
}
}
#endregion
public static void UpdateWelderForApi(Model.SitePerson_Person Welder)
{
using (var db = new Model.SGGLDB(Funs.ConnString))
{
Model.SitePerson_Person newWelder = db.SitePerson_Person.First(e => e.SitePersonId == Welder.SitePersonId);
if (!string.IsNullOrEmpty(Welder.WelderCode))
newWelder.WelderCode = Welder.WelderCode;
if (!string.IsNullOrEmpty(Welder.CertificateCode))
newWelder.CertificateCode = Welder.CertificateCode;
if (!string.IsNullOrEmpty(Welder.UnitId))
newWelder.UnitId = Welder.UnitId;
if (!string.IsNullOrEmpty(Welder.WelderLevel))
newWelder.WelderLevel = Welder.WelderLevel;
if (!string.IsNullOrEmpty(Welder.Remark))
newWelder.Remark = Welder.Remark;
newWelder.Isprint = "0";
db.SubmitChanges();
}
}
}
}

View File

@ -120,7 +120,8 @@ namespace FineUIPro.Web.CQMS.PersonManage
{
edit = "1";
}
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/WelderManage&menuId={1}&edit={2}&strParam=4", PersonId, BLL.Const.WelderManageMenuId, edit)));
Model.SitePerson_Person Checker = BLL.CheckerService.GetCheckerById(PersonId);
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/WelderManage&menuId={1}&edit={2}&strParam=4", Checker.SitePersonId, BLL.Const.WelderManageMenuId, edit)));
}
#endregion
}

View File

@ -109,7 +109,7 @@ namespace FineUIPro.Web.CQMS.PersonManage
// this.txtCertificateLimitTime.Text = string.Format("{0:yyyy-MM-dd}", welder.CertificateLimitTime);
//}
this.txtWelderLevel.Text = welder.WelderLevel;
if (welder.States == Const.State_1)
if (welder.States == Const.ProjectPersonStates_1)
{
cbIsUsed.Checked = true;
}
@ -244,7 +244,8 @@ namespace FineUIPro.Web.CQMS.PersonManage
{
edit = "1";
}
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/WelderManage&menuId={1}&edit={2}&strParam=4", PersonId, BLL.Const.WelderManageMenuId, edit)));
var welder = BLL.SitePerson_PersonService.GetSitePersonByProjectIdPersonId(this.CurrUser.LoginProjectId, PersonId);
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/WelderManage&menuId={1}&edit={2}&strParam=4", welder.SitePersonId, BLL.Const.WelderManageMenuId, edit)));
}
#endregion

View File

@ -0,0 +1,82 @@
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);
}
}
}

View File

@ -167,6 +167,7 @@
<Compile Include="Areas\HelpPage\XmlDocumentationProvider.cs" />
<Compile Include="Controllers\BaseInfoController.cs" />
<Compile Include="Controllers\CommonController.cs" />
<Compile Include="Controllers\CQMS\CQMSPersonManageController.cs" />
<Compile Include="Controllers\CQMS\WBSController.cs" />
<Compile Include="Controllers\HTGL\HTGLPersonController.cs" />
<Compile Include="Controllers\Person\PersonCheckController.cs" />
@ -290,6 +291,7 @@
<Folder Include="App_Data\" />
<Folder Include="Images\" />
<Folder Include="Models\" />
<Folder Include="Views\CQMSPersonManage\" />
<Folder Include="Views\Login\" />
</ItemGroup>
<ItemGroup>