20230627优化选择用户接口 角色不空 账号不空,优化生成卡号方法。

This commit is contained in:
2023-06-27 22:30:19 +08:00
parent ca2e5715b8
commit 225bc98fcd
9 changed files with 76 additions and 70 deletions
@@ -1,4 +1,6 @@
--ADD BY YangHongwei 2023-06-27 --ADD BY YangHongwei 2023-06-27
1、修改本部检查通知页面。 1、修改本部检查通知页面。
2、修改赛鼎现场人员更换单位,新项目入场单位下拉框处理。 2、修改赛鼎现场人员更换单位,新项目入场单位下拉框处理。
3、优化选择用户接口 角色不空 账号不空。
4、优化生成卡号方法。
--END --END
+10 -9
View File
@@ -18,7 +18,7 @@ namespace BLL
{ {
var getUser = db.Person_Persons.FirstOrDefault(x =>( x.Account == userInfo.Account || x.Telephone == userInfo.Telephone || x.PersonName == userInfo.Account) var getUser = db.Person_Persons.FirstOrDefault(x =>( x.Account == userInfo.Account || x.Telephone == userInfo.Telephone || x.PersonName == userInfo.Account)
&& x.Password == Funs.EncryptionPassword(userInfo.Password) && (!x.IsPost.HasValue || x.IsPost == true) && x.Password == Funs.EncryptionPassword(userInfo.Password) && (!x.IsPost.HasValue || x.IsPost == true)
&& (x.Account != null || x.PersonId == Const.hfnbdId || x.PersonId == Const.sysglyId)); && (x.Account.Length > 1 || x.PersonId == Const.hfnbdId || x.PersonId == Const.sysglyId));
if (getUser != null) if (getUser != null)
{ {
Model.UserItem newItem = new Model.UserItem(); Model.UserItem newItem = new Model.UserItem();
@@ -107,7 +107,8 @@ namespace BLL
{ {
var getUser = (from x in db.Person_Persons var getUser = (from x in db.Person_Persons
join y in db.Sys_Role on x.RoleIds equals y.RoleId join y in db.Sys_Role on x.RoleIds equals y.RoleId
where x.UnitId == unitId && x.IsPost == true && (strParam == null || x.PersonName.Contains(strParam)) && x.RoleIds != null where x.UnitId == unitId && x.IsPost == true && (strParam == null || x.PersonName.Contains(strParam))
&& x.RoleIds .Length > 1 && x.Account.Length > 1
orderby x.PersonName orderby x.PersonName
select new Model.BaseInfoItem { BaseInfoId = x.PersonId, BaseInfoName = x.PersonName, BaseInfoCode = x.Telephone }).ToList(); select new Model.BaseInfoItem { BaseInfoId = x.PersonId, BaseInfoName = x.PersonName, BaseInfoCode = x.Telephone }).ToList();
@@ -132,7 +133,7 @@ namespace BLL
{ {
var getDatas = from x in db.Person_Persons var getDatas = from x in db.Person_Persons
join y in db.SitePerson_Person on x.PersonId equals y.PersonId join y in db.SitePerson_Person on x.PersonId equals y.PersonId
where y.ProjectId == projectId && y.States == Const.State_1 && y.RoleIds != null where y.ProjectId == projectId && y.States == Const.State_1 && y.RoleIds.Length>1 && x.Account.Length > 1
select new Model.UserItem select new Model.UserItem
{ {
PersonId = x.PersonId, PersonId = x.PersonId,
@@ -173,8 +174,8 @@ namespace BLL
else else
{ {
var getPersons =from x in db.Person_Persons var getPersons =from x in db.Person_Persons
where x.IsPost == true && x.RoleIds != null where x.IsPost == true && x.RoleIds.Length>1 && x.Account.Length > 1
select new Model.UserItem select new Model.UserItem
{ {
PersonId = x.PersonId, PersonId = x.PersonId,
Account = x.Account, Account = x.Account,
@@ -235,7 +236,7 @@ namespace BLL
join y in db.SitePerson_Person on x.PersonId equals y.PersonId join y in db.SitePerson_Person on x.PersonId equals y.PersonId
join z in db.Project_ProjectUnit on x.UnitId equals z.UnitId join z in db.Project_ProjectUnit on x.UnitId equals z.UnitId
where y.ProjectId == projectId && z.ProjectId == projectId && z.UnitType == unitType && y.States == Const.State_1 where y.ProjectId == projectId && z.ProjectId == projectId && z.UnitType == unitType && y.States == Const.State_1
&& (strParam == null || x.PersonName.Contains(strParam)) && y.RoleIds != null && (strParam == null || x.PersonName.Contains(strParam)) && y.RoleIds.Length>1 && x.Account.Length > 1
select new Model.UserItem select new Model.UserItem
{ {
PersonId = x.PersonId, PersonId = x.PersonId,
@@ -267,7 +268,7 @@ namespace BLL
join y in db.SitePerson_Person on x.PersonId equals y.PersonId join y in db.SitePerson_Person on x.PersonId equals y.PersonId
join z in db.Project_ProjectUnit on x.UnitId equals z.UnitId join z in db.Project_ProjectUnit on x.UnitId equals z.UnitId
where y.ProjectId == projectId && z.ProjectId == projectId && z.UnitType == unitType && y.States == Const.State_1 where y.ProjectId == projectId && z.ProjectId == projectId && z.UnitType == unitType && y.States == Const.State_1
&& (strParam == null || x.PersonName.Contains(strParam)) && y.RoleIds.Contains(item) && y.RoleIds != null && (strParam == null || x.PersonName.Contains(strParam)) && y.RoleIds.Contains(item) && y.RoleIds.Length>1 && x.Account.Length > 1
select new Model.UserItem select new Model.UserItem
{ {
PersonId = x.PersonId, PersonId = x.PersonId,
@@ -313,7 +314,7 @@ namespace BLL
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{ {
var user = from x in db.Person_Persons var user = from x in db.Person_Persons
where x.IsPost == true && x.RoleIds != null where x.IsPost == true && x.RoleIds.Length > 1 && x.Account.Length > 1
select x; select x;
return ObjectMapperManager.DefaultInstance.GetMapper<List<Model.Person_Persons>, List<Model.UserItem>>().Map(user.ToList()); return ObjectMapperManager.DefaultInstance.GetMapper<List<Model.Person_Persons>, List<Model.UserItem>>().Map(user.ToList());
} }
@@ -444,7 +445,7 @@ namespace BLL
{ {
var getDatas = (from x in db.Person_Persons var getDatas = (from x in db.Person_Persons
join y in db.SitePerson_Person on x.PersonId equals y.PersonId join y in db.SitePerson_Person on x.PersonId equals y.PersonId
where y.ProjectId == projectId && y.States == Const.State_1 && y.RoleIds != null where y.ProjectId == projectId && y.States == Const.State_1 && y.RoleIds.Length>1 && x.Account.Length > 1
select new Model.UserItem select new Model.UserItem
{ {
PersonId = x.PersonId, PersonId = x.PersonId,
@@ -325,7 +325,7 @@ namespace BLL
public static List<Model.SitePerson_Person> GetSitePersonsByProjectIds(List<string> ProjectIds) public static List<Model.SitePerson_Person> GetSitePersonsByProjectIds(List<string> ProjectIds)
{ {
return (from x in Funs.DB.SitePerson_Person return (from x in Funs.DB.SitePerson_Person
where ProjectIds.Contains(x.ProjectId) && x.RoleIds != null where ProjectIds.Contains(x.ProjectId) && x.RoleIds.Length > 1
select x).ToList(); select x).ToList();
} }
#endregion #endregion
@@ -342,7 +342,7 @@ namespace BLL
List<Model.SitePerson_Person> returnLists = new List<Model.SitePerson_Person>(); List<Model.SitePerson_Person> returnLists = new List<Model.SitePerson_Person>();
var getSitePerson = db.SitePerson_Person.Where(x => x.ProjectId == projectId var getSitePerson = db.SitePerson_Person.Where(x => x.ProjectId == projectId
&& x.States == Const.ProjectPersonStates_1 && x.States == Const.ProjectPersonStates_1
&& x.RoleIds != null); && x.RoleIds.Length > 1);
var uList = Funs.GetStrListByStr(unitTypes, ','); var uList = Funs.GetStrListByStr(unitTypes, ',');
if (!string.IsNullOrEmpty(unitTypes)) if (!string.IsNullOrEmpty(unitTypes))
{ {
@@ -385,7 +385,7 @@ namespace BLL
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{ {
List<Model.SitePerson_Person> returnLists = new List<Model.SitePerson_Person>(); List<Model.SitePerson_Person> returnLists = new List<Model.SitePerson_Person>();
var getgetSitePerson = db.SitePerson_Person.Where(x => x.ProjectId == projectId && x.States == Const.ProjectPersonStates_1 && x.RoleIds != null); var getgetSitePerson = db.SitePerson_Person.Where(x => x.ProjectId == projectId && x.States == Const.ProjectPersonStates_1 && x.RoleIds.Length > 1);
if (!string.IsNullOrEmpty(unitIds)) if (!string.IsNullOrEmpty(unitIds))
{ {
var getUnitIdsList = Funs.GetStrListByStr(unitIds, ','); var getUnitIdsList = Funs.GetStrListByStr(unitIds, ',');
@@ -638,35 +638,49 @@ namespace BLL
var getSitePerson = GetSitePersonByProjectIdPersonId(projectId, personId); var getSitePerson = GetSitePersonByProjectIdPersonId(projectId, personId);
if (getSitePerson != null && string.IsNullOrEmpty(getSitePerson.CardNo)) if (getSitePerson != null && string.IsNullOrEmpty(getSitePerson.CardNo))
{ {
string prefix = UnitService.GetUnitCodeByUnitId(getSitePerson.UnitId) + "-"; cardNo= SendCarNobySiteperson(getSitePerson);
var getMaxCarNo = Funs.DB.SitePerson_Person.Where(x => x.ProjectId == projectId && x.CardNo.Contains(prefix)).Max(x => x.CardNo);
if (!string.IsNullOrEmpty(getMaxCarNo) && getMaxCarNo.Length > 5)
{
var getInt = Funs.GetNewInt(getMaxCarNo.Substring(getMaxCarNo.Length-5));
if (getInt.HasValue)
{
cardNo = SQLHelper.RunProcNewId("SpGetNewNumber", "SitePerson_Person", "CardNo", getSitePerson.ProjectId, prefix);
getSitePerson.CardNo = cardNo;
Funs.DB.SubmitChanges();
}
}
} }
return cardNo; return cardNo;
} }
public static string SendCardNo(string sitepersinId) /// <summary>
/// 发卡
/// </summary>
/// <param name="item"></param>
/// <returns></returns>
public static string SendCarNobySiteperson(Model.SitePerson_Person item)
{ {
string cardNo = string.Empty; using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
var getSitePerson = GetSitePersonById(sitepersinId);
if (getSitePerson != null && string.IsNullOrEmpty(getSitePerson.CardNo))
{ {
cardNo = SQLHelper.RunProcNewId("SpGetNewNumber", "SitePerson_Person", "CardNo", getSitePerson.ProjectId, UnitService.GetUnitCodeByUnitId(getSitePerson.UnitId) +"-"); string carNo = string.Empty;
getSitePerson.CardNo = cardNo; var isNull = db.EduTrain_TrainRecordDetail.FirstOrDefault(x => x.PersonId == item.PersonId && x.CheckResult == true);
Funs.DB.SubmitChanges(); if (isNull != null) ////参加过培训的人员
} {
string prefix = UnitService.GetUnitCodeByUnitId(item.UnitId) + "-";
var getCarPerson = db.SitePerson_Person.Where(x => x.ProjectId == item.ProjectId && x.CardNo.Contains(prefix) && x.CardNo.Length > 5);
if (getCarPerson.Count() > 0)
{
var getMaxCarNo = getCarPerson.Max(x => x.CardNo);
if (!string.IsNullOrEmpty(getMaxCarNo) && getMaxCarNo.Length > 5)
{
var getInt = Funs.GetNewInt(getMaxCarNo.Substring(getMaxCarNo.Length - 5));
if (getInt.HasValue)
{
carNo= item.CardNo = SQLHelper.RunProcNewId("SpGetNewNumber", "SitePerson_Person", "CardNo", item.ProjectId, prefix);
db.SubmitChanges();
}
}
}
else
{
carNo = item.CardNo = prefix + "00001";
db.SubmitChanges();
}
}
return cardNo; return carNo;
}
} }
#endregion #endregion
+5 -15
View File
@@ -1,7 +1,9 @@
using System; using NPOI.SS.Formula.Functions;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Configuration; using System.Configuration;
using System.Linq; using System.Linq;
using WIA;
namespace BLL namespace BLL
{ {
@@ -520,21 +522,9 @@ namespace BLL
select x; select x;
foreach (var item in getPersons) foreach (var item in getPersons)
{ {
var isNull = db.EduTrain_TrainRecordDetail.FirstOrDefault(x => x.PersonId == item.PersonId && x.CheckResult ==true); if (!string.IsNullOrEmpty(SitePerson_PersonService.SendCarNobySiteperson(item)))
if (isNull != null) ////参加过培训的人员
{ {
string prefix = UnitService.GetUnitCodeByUnitId(item.UnitId) + "-"; count++;
var getMaxCarNo = db.SitePerson_Person.Where(x => x.ProjectId == item.ProjectId && x.CardNo.Contains(prefix)).Max(x => x.CardNo);
if (!string.IsNullOrEmpty(getMaxCarNo) && getMaxCarNo.Length > 5)
{
var getInt = Funs.GetNewInt(getMaxCarNo.Substring(getMaxCarNo.Length - 5));
if (getInt.HasValue)
{
item.CardNo = SQLHelper.RunProcNewId("SpGetNewNumber", "SitePerson_Person", "CardNo", item.ProjectId, prefix);
db.SubmitChanges();
count++;
}
}
} }
} }
return count; return count;
@@ -57,8 +57,17 @@ namespace FineUIPro.Web.HSSE.SitePerson
{ {
try try
{ {
SitePerson_PersonService.SendCardNo(this.StiePersonId); var getSitePerson = SitePerson_PersonService.GetSitePersonById(this.StiePersonId);
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); if (getSitePerson != null)
{
SitePerson_PersonService.SendCarNobySiteperson(getSitePerson);
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
else
{
ShowNotify("发卡未成功!", MessageBoxIcon.Warning);
return;
}
} }
catch catch
{ {
@@ -319,21 +319,7 @@ namespace FineUIPro.Web.Person
if (projectId != Const._Null) if (projectId != Const._Null)
{ {
int count = 0; int count = GetDataService.SendCarNo(projectId);
var getSitePersons = from x in Funs.DB.SitePerson_Person
join y in Funs.DB.EduTrain_TrainRecordDetail on x.PersonId equals y.PersonId
join z in Funs.DB.EduTrain_TrainRecord on y.TrainingId equals z.TrainingId
where x.ProjectId == projectId && z.ProjectId == projectId && (x.CardNo == null || x.CardNo == "")
&& y.CheckResult == true
select x;
if (getSitePersons.Count() > 0)
{
foreach (var person in getSitePersons)
{
SitePerson_PersonService.SendCardNo(person.SitePersonId);
count++;
}
}
Alert.ShowInParent("操作完成!共补卡号" + count.ToString() + "个。", MessageBoxIcon.Information); Alert.ShowInParent("操作完成!共补卡号" + count.ToString() + "个。", MessageBoxIcon.Information);
BindGrid(); BindGrid();
} }
@@ -342,10 +342,14 @@ namespace WebAPI.Controllers
} }
} }
else else
{ {
SitePerson_PersonService.SendCardNo(getTestRecord.ProjectId, getTestRecord.TestManId); APITestRecordService.updateAll(getTestRecord.TestPlanId);
APITestRecordService.updateAll(getTestRecord.TestPlanId);
responeData.message = "恭喜考试通过!您的成绩为:【" + getTestScores.ToString() + "】。"; responeData.message = "恭喜考试通过!您的成绩为:【" + getTestScores.ToString() + "】。";
var getSitePerson = SitePerson_PersonService. GetSitePersonByProjectIdPersonId(getTestRecord.ProjectId, getTestRecord.TestManId);
if (getSitePerson != null && string.IsNullOrEmpty(getSitePerson.CardNo))
{
string CarNo = SitePerson_PersonService.SendCardNo(getTestRecord.ProjectId, getTestRecord.TestManId);
}
} }
responeData.data = new { getTestScores, getPassScores, returnTestRecordId }; responeData.data = new { getTestScores, getPassScores, returnTestRecordId };
+1 -1
View File
@@ -697,7 +697,7 @@ namespace WebAPI.Controllers
join y in Funs.DB.Base_Unit on x.UnitId equals y.UnitId join y in Funs.DB.Base_Unit on x.UnitId equals y.UnitId
join persons in Funs.DB.Person_Persons on x.IdentityCard equals persons.IdentityCard join persons in Funs.DB.Person_Persons on x.IdentityCard equals persons.IdentityCard
where x.ProjectId == projectId && !x.ExchangeTime.HasValue where x.ProjectId == projectId && !x.ExchangeTime.HasValue
&& x.States == Const.ProjectPersonStates_1 && x.CardNo != null && persons.PhotoUrl != null && x.States == Const.ProjectPersonStates_1 && x.CardNo.Length> 5 && persons.PhotoUrl != null
select new select new
{ {
x.PersonId, x.PersonId,
+1 -1
View File
@@ -361,7 +361,7 @@
<AutoAssignPort>True</AutoAssignPort> <AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>0</DevelopmentServerPort> <DevelopmentServerPort>0</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath> <DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>http://localhost:3528/</IISUrl> <IISUrl>http://localhost:9192/</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication> <NTLMAuthentication>False</NTLMAuthentication>
<UseCustomServer>False</UseCustomServer> <UseCustomServer>False</UseCustomServer>
<CustomServerUrl> <CustomServerUrl>