diff --git a/SGGL/BLL/HSSE/SitePerson/SitePerson_PersonService.cs b/SGGL/BLL/HSSE/SitePerson/SitePerson_PersonService.cs
index 22fef7aa..34672431 100644
--- a/SGGL/BLL/HSSE/SitePerson/SitePerson_PersonService.cs
+++ b/SGGL/BLL/HSSE/SitePerson/SitePerson_PersonService.cs
@@ -638,7 +638,7 @@ namespace BLL
var getSitePerson = GetSitePersonByProjectIdPersonId(projectId, personId);
if (getSitePerson != null && string.IsNullOrEmpty(getSitePerson.CardNo))
{
- cardNo= SendCarNobySiteperson(getSitePerson);
+ cardNo= SendCarNobySiteperson(getSitePerson.SitePersonId);
}
return cardNo;
@@ -649,36 +649,39 @@ namespace BLL
///
///
///
- public static string SendCarNobySiteperson(Model.SitePerson_Person item)
+ public static string SendCarNobySiteperson(string sitePersonId)
{
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) ////参加过培训的人员
+ var item = db.SitePerson_Person.FirstOrDefault(x => x.SitePersonId == sitePersonId);
+ if (item != 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 isNull = db.EduTrain_TrainRecordDetail.FirstOrDefault(x => x.PersonId == item.PersonId && x.CheckResult == true);
+ if (isNull != null) ////参加过培训的人员
{
- var getMaxCarNo = getCarPerson.Max(x => x.CardNo);
- if (!string.IsNullOrEmpty(getMaxCarNo) && getMaxCarNo.Length > 5)
+ 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 getInt = Funs.GetNewInt(getMaxCarNo.Substring(getMaxCarNo.Length - 5));
- if (getInt.HasValue)
+ var getMaxCarNo = getCarPerson.Max(x => x.CardNo);
+ if (!string.IsNullOrEmpty(getMaxCarNo) && getMaxCarNo.Length > 5)
{
- carNo= item.CardNo = SQLHelper.RunProcNewId("SpGetNewNumber", "SitePerson_Person", "CardNo", item.ProjectId, prefix);
- db.SubmitChanges();
+ 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();
+ else
+ {
+ carNo = item.CardNo = prefix + "00001";
+ db.SubmitChanges();
+ }
}
}
-
return carNo;
}
}
diff --git a/SGGL/BLL/OpenService/GetDataService.cs b/SGGL/BLL/OpenService/GetDataService.cs
index 3cd6f60b..92605ba5 100644
--- a/SGGL/BLL/OpenService/GetDataService.cs
+++ b/SGGL/BLL/OpenService/GetDataService.cs
@@ -522,7 +522,7 @@ namespace BLL
select x;
foreach (var item in getPersons)
{
- if (!string.IsNullOrEmpty(SitePerson_PersonService.SendCarNobySiteperson(item)))
+ if (!string.IsNullOrEmpty(SitePerson_PersonService.SendCarNobySiteperson(item.SitePersonId)))
{
count++;
}
diff --git a/SGGL/FineUIPro.Web/HSSE/SitePerson/ReadWriteCard.aspx.cs b/SGGL/FineUIPro.Web/HSSE/SitePerson/ReadWriteCard.aspx.cs
index 35c3a5e6..ce8c2286 100644
--- a/SGGL/FineUIPro.Web/HSSE/SitePerson/ReadWriteCard.aspx.cs
+++ b/SGGL/FineUIPro.Web/HSSE/SitePerson/ReadWriteCard.aspx.cs
@@ -57,17 +57,8 @@ namespace FineUIPro.Web.HSSE.SitePerson
{
try
{
- var getSitePerson = SitePerson_PersonService.GetSitePersonById(this.StiePersonId);
- if (getSitePerson != null)
- {
- SitePerson_PersonService.SendCarNobySiteperson(getSitePerson);
- PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
- }
- else
- {
- ShowNotify("发卡未成功!", MessageBoxIcon.Warning);
- return;
- }
+ SitePerson_PersonService.SendCarNobySiteperson(this.StiePersonId);
+ PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
catch
{