This commit is contained in:
杨红卫 2023-06-27 23:06:59 +08:00
parent 225bc98fcd
commit da7bf97960
3 changed files with 25 additions and 31 deletions

View File

@ -638,7 +638,7 @@ 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))
{ {
cardNo= SendCarNobySiteperson(getSitePerson); cardNo= SendCarNobySiteperson(getSitePerson.SitePersonId);
} }
return cardNo; return cardNo;
@ -649,11 +649,14 @@ namespace BLL
/// </summary> /// </summary>
/// <param name="item"></param> /// <param name="item"></param>
/// <returns></returns> /// <returns></returns>
public static string SendCarNobySiteperson(Model.SitePerson_Person item) public static string SendCarNobySiteperson(string sitePersonId)
{ {
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{ {
string carNo = string.Empty; string carNo = string.Empty;
var item = db.SitePerson_Person.FirstOrDefault(x => x.SitePersonId == sitePersonId);
if (item != null)
{
var isNull = db.EduTrain_TrainRecordDetail.FirstOrDefault(x => x.PersonId == item.PersonId && x.CheckResult == true); var isNull = db.EduTrain_TrainRecordDetail.FirstOrDefault(x => x.PersonId == item.PersonId && x.CheckResult == true);
if (isNull != null) ////参加过培训的人员 if (isNull != null) ////参加过培训的人员
{ {
@ -667,7 +670,7 @@ namespace BLL
var getInt = Funs.GetNewInt(getMaxCarNo.Substring(getMaxCarNo.Length - 5)); var getInt = Funs.GetNewInt(getMaxCarNo.Substring(getMaxCarNo.Length - 5));
if (getInt.HasValue) if (getInt.HasValue)
{ {
carNo= item.CardNo = SQLHelper.RunProcNewId("SpGetNewNumber", "SitePerson_Person", "CardNo", item.ProjectId, prefix); carNo = item.CardNo = SQLHelper.RunProcNewId("SpGetNewNumber", "SitePerson_Person", "CardNo", item.ProjectId, prefix);
db.SubmitChanges(); db.SubmitChanges();
} }
} }
@ -678,7 +681,7 @@ namespace BLL
db.SubmitChanges(); db.SubmitChanges();
} }
} }
}
return carNo; return carNo;
} }
} }

View File

@ -522,7 +522,7 @@ namespace BLL
select x; select x;
foreach (var item in getPersons) foreach (var item in getPersons)
{ {
if (!string.IsNullOrEmpty(SitePerson_PersonService.SendCarNobySiteperson(item))) if (!string.IsNullOrEmpty(SitePerson_PersonService.SendCarNobySiteperson(item.SitePersonId)))
{ {
count++; count++;
} }

View File

@ -57,18 +57,9 @@ namespace FineUIPro.Web.HSSE.SitePerson
{ {
try try
{ {
var getSitePerson = SitePerson_PersonService.GetSitePersonById(this.StiePersonId); SitePerson_PersonService.SendCarNobySiteperson(this.StiePersonId);
if (getSitePerson != null)
{
SitePerson_PersonService.SendCarNobySiteperson(getSitePerson);
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
} }
else
{
ShowNotify("发卡未成功!", MessageBoxIcon.Warning);
return;
}
}
catch catch
{ {
ShowNotify("发卡未成功!", MessageBoxIcon.Warning); ShowNotify("发卡未成功!", MessageBoxIcon.Warning);