20230627优化选择用户接口 角色不空 账号不空,优化生成卡号方法。
This commit is contained in:
parent
ca2e5715b8
commit
225bc98fcd
|
|
@ -1,4 +1,6 @@
|
|||
--ADD BY YangHongwei 2023-06-27
|
||||
1、修改本部检查通知页面。
|
||||
2、修改赛鼎现场人员更换单位,新项目入场单位下拉框处理。
|
||||
3、优化选择用户接口 角色不空 账号不空。
|
||||
4、优化生成卡号方法。
|
||||
--END
|
||||
|
|
@ -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)
|
||||
&& 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)
|
||||
{
|
||||
Model.UserItem newItem = new Model.UserItem();
|
||||
|
|
@ -107,7 +107,8 @@ namespace BLL
|
|||
{
|
||||
var getUser = (from x in db.Person_Persons
|
||||
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
|
||||
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
|
||||
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
|
||||
{
|
||||
PersonId = x.PersonId,
|
||||
|
|
@ -173,7 +174,7 @@ namespace BLL
|
|||
else
|
||||
{
|
||||
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
|
||||
{
|
||||
PersonId = x.PersonId,
|
||||
|
|
@ -235,7 +236,7 @@ namespace BLL
|
|||
join y in db.SitePerson_Person on x.PersonId equals y.PersonId
|
||||
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
|
||||
&& (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
|
||||
{
|
||||
PersonId = x.PersonId,
|
||||
|
|
@ -267,7 +268,7 @@ namespace BLL
|
|||
join y in db.SitePerson_Person on x.PersonId equals y.PersonId
|
||||
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
|
||||
&& (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
|
||||
{
|
||||
PersonId = x.PersonId,
|
||||
|
|
@ -313,7 +314,7 @@ namespace BLL
|
|||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
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;
|
||||
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
|
||||
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
|
||||
{
|
||||
PersonId = x.PersonId,
|
||||
|
|
|
|||
|
|
@ -325,7 +325,7 @@ namespace BLL
|
|||
public static List<Model.SitePerson_Person> GetSitePersonsByProjectIds(List<string> ProjectIds)
|
||||
{
|
||||
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();
|
||||
}
|
||||
#endregion
|
||||
|
|
@ -342,7 +342,7 @@ namespace BLL
|
|||
List<Model.SitePerson_Person> returnLists = new List<Model.SitePerson_Person>();
|
||||
var getSitePerson = db.SitePerson_Person.Where(x => x.ProjectId == projectId
|
||||
&& x.States == Const.ProjectPersonStates_1
|
||||
&& x.RoleIds != null);
|
||||
&& x.RoleIds.Length > 1);
|
||||
var uList = Funs.GetStrListByStr(unitTypes, ',');
|
||||
if (!string.IsNullOrEmpty(unitTypes))
|
||||
{
|
||||
|
|
@ -385,7 +385,7 @@ namespace BLL
|
|||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
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))
|
||||
{
|
||||
var getUnitIdsList = Funs.GetStrListByStr(unitIds, ',');
|
||||
|
|
@ -638,35 +638,49 @@ namespace BLL
|
|||
var getSitePerson = GetSitePersonByProjectIdPersonId(projectId, personId);
|
||||
if (getSitePerson != null && string.IsNullOrEmpty(getSitePerson.CardNo))
|
||||
{
|
||||
string prefix = UnitService.GetUnitCodeByUnitId(getSitePerson.UnitId) + "-";
|
||||
var getMaxCarNo = Funs.DB.SitePerson_Person.Where(x => x.ProjectId == projectId && x.CardNo.Contains(prefix)).Max(x => x.CardNo);
|
||||
cardNo= SendCarNobySiteperson(getSitePerson);
|
||||
}
|
||||
|
||||
return cardNo;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 发卡
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
/// <returns></returns>
|
||||
public static string SendCarNobySiteperson(Model.SitePerson_Person item)
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
string carNo = string.Empty;
|
||||
var isNull = db.EduTrain_TrainRecordDetail.FirstOrDefault(x => x.PersonId == item.PersonId && x.CheckResult == true);
|
||||
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)
|
||||
{
|
||||
cardNo = SQLHelper.RunProcNewId("SpGetNewNumber", "SitePerson_Person", "CardNo", getSitePerson.ProjectId, prefix);
|
||||
getSitePerson.CardNo = cardNo;
|
||||
Funs.DB.SubmitChanges();
|
||||
carNo= item.CardNo = SQLHelper.RunProcNewId("SpGetNewNumber", "SitePerson_Person", "CardNo", item.ProjectId, prefix);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return cardNo;
|
||||
}
|
||||
|
||||
public static string SendCardNo(string sitepersinId)
|
||||
else
|
||||
{
|
||||
string cardNo = string.Empty;
|
||||
var getSitePerson = GetSitePersonById(sitepersinId);
|
||||
if (getSitePerson != null && string.IsNullOrEmpty(getSitePerson.CardNo))
|
||||
{
|
||||
cardNo = SQLHelper.RunProcNewId("SpGetNewNumber", "SitePerson_Person", "CardNo", getSitePerson.ProjectId, UnitService.GetUnitCodeByUnitId(getSitePerson.UnitId) +"-");
|
||||
getSitePerson.CardNo = cardNo;
|
||||
Funs.DB.SubmitChanges();
|
||||
carNo = item.CardNo = prefix + "00001";
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
return cardNo;
|
||||
return carNo;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
using System;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Linq;
|
||||
using WIA;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
|
|
@ -520,23 +522,11 @@ namespace BLL
|
|||
select x;
|
||||
foreach (var item in getPersons)
|
||||
{
|
||||
var isNull = db.EduTrain_TrainRecordDetail.FirstOrDefault(x => x.PersonId == item.PersonId && x.CheckResult ==true);
|
||||
if (isNull != null) ////参加过培训的人员
|
||||
if (!string.IsNullOrEmpty(SitePerson_PersonService.SendCarNobySiteperson(item)))
|
||||
{
|
||||
string prefix = UnitService.GetUnitCodeByUnitId(item.UnitId) + "-";
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,9 +57,18 @@ namespace FineUIPro.Web.HSSE.SitePerson
|
|||
{
|
||||
try
|
||||
{
|
||||
SitePerson_PersonService.SendCardNo(this.StiePersonId);
|
||||
var getSitePerson = SitePerson_PersonService.GetSitePersonById(this.StiePersonId);
|
||||
if (getSitePerson != null)
|
||||
{
|
||||
SitePerson_PersonService.SendCarNobySiteperson(getSitePerson);
|
||||
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowNotify("发卡未成功!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
ShowNotify("发卡未成功!", MessageBoxIcon.Warning);
|
||||
|
|
|
|||
|
|
@ -319,21 +319,7 @@ namespace FineUIPro.Web.Person
|
|||
|
||||
if (projectId != Const._Null)
|
||||
{
|
||||
int count = 0;
|
||||
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++;
|
||||
}
|
||||
}
|
||||
int count = GetDataService.SendCarNo(projectId);
|
||||
Alert.ShowInParent("操作完成!共补卡号" + count.ToString() + "个。", MessageBoxIcon.Information);
|
||||
BindGrid();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -343,9 +343,13 @@ namespace WebAPI.Controllers
|
|||
}
|
||||
else
|
||||
{
|
||||
SitePerson_PersonService.SendCardNo(getTestRecord.ProjectId, getTestRecord.TestManId);
|
||||
APITestRecordService.updateAll(getTestRecord.TestPlanId);
|
||||
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 };
|
||||
|
|
|
|||
|
|
@ -697,7 +697,7 @@ namespace WebAPI.Controllers
|
|||
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
|
||||
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
|
||||
{
|
||||
x.PersonId,
|
||||
|
|
|
|||
|
|
@ -361,7 +361,7 @@
|
|||
<AutoAssignPort>True</AutoAssignPort>
|
||||
<DevelopmentServerPort>0</DevelopmentServerPort>
|
||||
<DevelopmentServerVPath>/</DevelopmentServerVPath>
|
||||
<IISUrl>http://localhost:3528/</IISUrl>
|
||||
<IISUrl>http://localhost:9192/</IISUrl>
|
||||
<NTLMAuthentication>False</NTLMAuthentication>
|
||||
<UseCustomServer>False</UseCustomServer>
|
||||
<CustomServerUrl>
|
||||
|
|
|
|||
Loading…
Reference in New Issue