diff --git a/SGGL/BLL/HSSE/SitePerson/PersonInOutService.cs b/SGGL/BLL/HSSE/SitePerson/PersonInOutService.cs
index a19268e8..8098537f 100644
--- a/SGGL/BLL/HSSE/SitePerson/PersonInOutService.cs
+++ b/SGGL/BLL/HSSE/SitePerson/PersonInOutService.cs
@@ -88,8 +88,12 @@ namespace BLL
CheckType = "ZHENGCHANG_KAOQINLEIBIE",
CheckWay = "FACE_FANGSHI",
};
- db.RealName_PersonInOutNow.InsertOnSubmit(newR);
- db.SubmitChanges();
+
+ if (SynchroSetService.PushAttendanceS(newR) != "True")
+ {
+ db.RealName_PersonInOutNow.InsertOnSubmit(newR);
+ db.SubmitChanges();
+ }
}
}
}
diff --git a/SGGL/BLL/ZHGL/RealName/SynchroSetService.cs b/SGGL/BLL/ZHGL/RealName/SynchroSetService.cs
index 61e76b35..1b2d4513 100644
--- a/SGGL/BLL/ZHGL/RealName/SynchroSetService.cs
+++ b/SGGL/BLL/ZHGL/RealName/SynchroSetService.cs
@@ -1132,12 +1132,10 @@ namespace BLL
join y in db.Base_Project on x.ProjectId equals y.ProjectId
join z in db.RealName_Project on y.JTProjectCode equals z.ProCode
join v in db.ProjectData_TeamGroup on x.TeamGroupId equals v.TeamGroupId
- join w in db.Base_WorkPost on x.WorkPostId equals w.WorkPostId
- join p in db.Project_ProjectUnit on new { x.UnitId, x.ProjectId } equals new { p.UnitId, p.ProjectId }
+ join w in db.Base_WorkPost on x.WorkPostId equals w.WorkPostId
where x.IdentityCard == identityCard && y.JTProjectCode == proCode
&& v.TeamId.HasValue && z.JTproCode != null
&& ((type == Const.BtnAdd && x.HeadImage != null && x.HeadImage.Length > 0) || type == Const.BtnModify)
- && p.IsSynchro == true
select new
{
name = x.PersonName,
@@ -1694,5 +1692,107 @@ namespace BLL
}
}
#endregion
+
+ #region 推送考勤数据
+ ///
+ /// 推送考勤数据
+ ///
+ ///
+ public static string PushAttendanceS(Model.RealName_PersonInOutNow inOut)
+ {
+ using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
+ {
+ try
+ {
+ string mess = string.Empty;
+ string sucess = string.Empty;
+ string code = string.Empty;
+ string data = string.Empty;
+ string pushContent = string.Empty;
+ //string contenttype = "application/json;charset=unicode";
+ string url = Funs.RealNameApiUrl + "/foreignApi/accept/attendance";
+ var getData = (from x in db.RealName_PersonInOutNow
+ join p in db.SitePerson_Person on x.PersonId equals p.PersonId
+ join v in db.ProjectData_TeamGroup on p.TeamGroupId equals v.TeamGroupId
+ join z in db.RealName_Project on x.ProCode equals z.ProCode
+ where x.IdcardNumber != null && x.IdcardType != null && x.ChangeTime.HasValue &&
+ x.ProCode == inOut.ProCode && p.HeadImage != null && p.HeadImage.Length > 0
+ && v.TeamId.HasValue && p.HeadImage != null
+ && p.IsCardNoOK == true && z.JTproCode != null
+ && (!p.OutTime.HasValue || p.OutTime > x.ChangeTime)
+ select new
+ {
+ p.PersonId,
+ proCode = z.JTproCode,
+ name = x.Name,
+ idcardType = x.IdcardType,
+ idcardNumber = x.IdcardNumber,
+ checkType = x.CheckType,
+ checkTime = string.Format("{0:yyyy-MM-dd HH:mm:ss}", x.ChangeTime),
+ dierction = x.IsIn == true ? "JINCHANG_JINCHU" : "TUICHANG_JINCHU",
+ checkWay = x.CheckWay,
+ checkLocation = x.CheckLocation,
+ longitude = x.Longitude,
+ latitude = x.Latitude,
+ x.RealNamePushTime,
+ x.PersonInOutId,
+ v.TeamGroupId,
+ }).ToList();
+ if (getData.Count() > 0)
+ {
+ var listObject = new
+ {
+ list = getData.Select(x => new { x.proCode, x.name, x.idcardType, x.idcardNumber, x.checkType, x.checkTime, x.dierction, x.checkWay, x.checkLocation, x.longitude, x.latitude })
+ };
+ Hashtable newToken = new Hashtable
+ {
+ { "token", getaccess_token(inOut.ProCode) }
+ };
+
+ addTeam(getData.Select(x => x.TeamGroupId).ToList(), newToken);
+ getTeam(inOut.ProCode, newToken);
+
+ var getPersonS = getData.Select(x => x.idcardNumber).ToList();
+ foreach (var pitem in getPersonS)
+ {
+ PushPersonsByIdentityCard(Const.BtnAdd, inOut.ProCode, pitem, false);
+ PushPersonsByIdentityCard(Const.BtnModify, inOut.ProCode, pitem, false);
+ }
+
+ pushContent = JsonConvert.SerializeObject(listObject);
+ var returndata = BLL.APIGetHttpService.OutsideHttp(url, "POST", null, newToken, pushContent);
+ if (!string.IsNullOrEmpty(returndata))
+ {
+ JObject obj = JObject.Parse(returndata);
+ mess = obj["message"].ToString();
+ code = obj["code"].ToString();
+ sucess = obj["success"].ToString();
+ data = obj["data"].ToString();
+ if (obj["success"] != null && Convert.ToBoolean(obj["success"].ToString()))
+ {
+ foreach (var item in getData)
+ {
+ var getPersonInOutNow = db.RealName_PersonInOutNow.FirstOrDefault(x => x.PersonInOutId == item.PersonInOutId);
+ if (getPersonInOutNow != null)
+ {
+ //getPersonInOutNow.RealNamePushTime = DateTime.Now;
+ db.RealName_PersonInOutNow.DeleteOnSubmit(getPersonInOutNow);
+ db.SubmitChanges();
+ }
+ }
+ }
+ }
+ }
+
+ return sucess;
+ }
+ catch (Exception ex)
+ {
+ ErrLogInfo.WriteLog(ex, "单条推送考勤数据", "SynchroSetService.PushAttendance");
+ return "";
+ }
+ }
+ }
+ #endregion
}
}