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
@@ -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();
}
}
}
}