| 
									
										
										
										
											2021-06-30 16:00:32 +08:00
										 |  |  |  | using System; | 
					
						
							|  |  |  |  | using System.Collections.Generic; | 
					
						
							| 
									
										
										
										
											2021-08-13 10:48:08 +08:00
										 |  |  |  | using System.Configuration; | 
					
						
							|  |  |  |  | using System.IO; | 
					
						
							| 
									
										
										
										
											2021-06-30 16:00:32 +08:00
										 |  |  |  | using System.Linq; | 
					
						
							|  |  |  |  | using System.Net; | 
					
						
							|  |  |  |  | using System.Net.Http; | 
					
						
							|  |  |  |  | using System.Web.Http; | 
					
						
							|  |  |  |  | using BLL; | 
					
						
							| 
									
										
										
										
											2023-12-21 14:28:47 +08:00
										 |  |  |  | using Model; | 
					
						
							| 
									
										
										
										
											2021-06-30 16:00:32 +08:00
										 |  |  |  | using WebAPI.Filter; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | namespace WebAPI.Controllers | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     /// <summary> | 
					
						
							|  |  |  |  |     ///  | 
					
						
							|  |  |  |  |     /// </summary> | 
					
						
							|  |  |  |  |     public class uploadController : ApiController | 
					
						
							|  |  |  |  |     { | 
					
						
							| 
									
										
										
										
											2021-08-13 10:48:08 +08:00
										 |  |  |  |         #region 项目出入记录接口 | 
					
						
							| 
									
										
										
										
											2021-06-30 16:00:32 +08:00
										 |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 保存出入记录信息 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="records">出入记录信息</param> | 
					
						
							|  |  |  |  |         /// <returns></returns> | 
					
						
							|  |  |  |  |         [HttpPost] | 
					
						
							|  |  |  |  |         public Model.ResponeData attendance([FromBody] Model.attendanceItems records) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             var responeData = new Model.ResponeData(); | 
					
						
							|  |  |  |  |             try | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 if (records != null && records.records.Count() > 0) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     List<Model.attendanceItem> attendanceItems = records.records; | 
					
						
							| 
									
										
										
										
											2021-08-13 10:48:08 +08:00
										 |  |  |  |                     var getprojectCode = attendanceItems.FirstOrDefault(x => x.ProjectCode != null || x.ProjectId != null); | 
					
						
							|  |  |  |  |                     if (getprojectCode != null) | 
					
						
							| 
									
										
										
										
											2021-06-30 16:00:32 +08:00
										 |  |  |  |                     { | 
					
						
							| 
									
										
										
										
											2021-08-13 10:48:08 +08:00
										 |  |  |  |                         string projectId = getprojectCode.ProjectId; | 
					
						
							|  |  |  |  |                         if (string.IsNullOrEmpty(projectId)) | 
					
						
							| 
									
										
										
										
											2021-06-30 16:00:32 +08:00
										 |  |  |  |                         { | 
					
						
							| 
									
										
										
										
											2021-08-13 10:48:08 +08:00
										 |  |  |  |                             var getProject = ProjectService.GetProjectByProjectCode(getprojectCode.ProjectCode); | 
					
						
							|  |  |  |  |                             if (getProject != null) | 
					
						
							|  |  |  |  |                             { | 
					
						
							|  |  |  |  |                                 projectId = getProject.ProjectId; | 
					
						
							|  |  |  |  |                             }                            | 
					
						
							| 
									
										
										
										
											2021-06-30 16:00:32 +08:00
										 |  |  |  |                         } | 
					
						
							| 
									
										
										
										
											2021-08-13 10:48:08 +08:00
										 |  |  |  |                         if (!string.IsNullOrEmpty(projectId)) | 
					
						
							| 
									
										
										
										
											2021-06-30 16:00:32 +08:00
										 |  |  |  |                         { | 
					
						
							| 
									
										
										
										
											2021-08-13 10:48:08 +08:00
										 |  |  |  |                             using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) | 
					
						
							| 
									
										
										
										
											2021-06-30 16:00:32 +08:00
										 |  |  |  |                             { | 
					
						
							| 
									
										
										
										
											2021-08-13 10:48:08 +08:00
										 |  |  |  |                                 int maxId = 0; | 
					
						
							|  |  |  |  |                                 var getmax = db.T_d_facerecord.Where(x => x.ProjectId == projectId && x.RoleID == "白名单").Select(x => x.ID); | 
					
						
							|  |  |  |  |                                 if (getmax.Count() > 0) | 
					
						
							|  |  |  |  |                                 { | 
					
						
							| 
									
										
										
										
											2021-08-13 14:49:45 +08:00
										 |  |  |  |                                     maxId = getmax.Max(); | 
					
						
							| 
									
										
										
										
											2021-08-13 10:48:08 +08:00
										 |  |  |  |                                 } | 
					
						
							|  |  |  |  |                                 foreach (var item in attendanceItems) | 
					
						
							|  |  |  |  |                                 { | 
					
						
							| 
									
										
										
										
											2021-08-13 14:49:45 +08:00
										 |  |  |  |                                     maxId = maxId + 1; | 
					
						
							| 
									
										
										
										
											2021-08-13 10:48:08 +08:00
										 |  |  |  |                                     string name = string.Empty; | 
					
						
							|  |  |  |  |                                     string cardNo = string.Empty; | 
					
						
							|  |  |  |  |                                     var getPerson = db.SitePerson_Person.FirstOrDefault(x => x.IdentityCard == item.idCardNumber); | 
					
						
							|  |  |  |  |                                     if (getPerson != null) | 
					
						
							|  |  |  |  |                                     { | 
					
						
							|  |  |  |  |                                         name = getPerson.PersonName; | 
					
						
							|  |  |  |  |                                         cardNo = getPerson.CardNo; | 
					
						
							|  |  |  |  |                                     } | 
					
						
							| 
									
										
										
										
											2021-06-30 16:00:32 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-13 10:48:08 +08:00
										 |  |  |  |                                     Model.T_d_facerecord newFacerecord = new Model.T_d_facerecord() | 
					
						
							|  |  |  |  |                                     { | 
					
						
							|  |  |  |  |                                         NewID = SQLHelper.GetNewID(), | 
					
						
							|  |  |  |  |                                         ProjectId = projectId, | 
					
						
							| 
									
										
										
										
											2021-08-13 14:49:45 +08:00
										 |  |  |  |                                         ID = maxId, | 
					
						
							| 
									
										
										
										
											2021-08-13 10:48:08 +08:00
										 |  |  |  |                                         EmployName = name, | 
					
						
							|  |  |  |  |                                         EmployNO = item.idCardNumber, | 
					
						
							|  |  |  |  |                                         RoleID = "白名单", | 
					
						
							|  |  |  |  |                                         DateTimeRecord = Funs.GetNewDateTime(item.attendanceTime), | 
					
						
							|  |  |  |  |                                         RecordDes = "白名单:允许通行", | 
					
						
							|  |  |  |  |                                         InOrOut = (item.attendanceType == 1 ? "进门" : "出门"), | 
					
						
							|  |  |  |  |                                     }; | 
					
						
							| 
									
										
										
										
											2021-06-30 16:00:32 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-13 10:48:08 +08:00
										 |  |  |  |                                     db.T_d_facerecord.InsertOnSubmit(newFacerecord); | 
					
						
							|  |  |  |  |                                     db.SubmitChanges(); | 
					
						
							|  |  |  |  |                                     ///// 根据出入记录 写入考勤记录 | 
					
						
							|  |  |  |  |                                     Model.t_d_facerecordItem facerecord = new Model.t_d_facerecordItem | 
					
						
							|  |  |  |  |                                     { | 
					
						
							| 
									
										
										
										
											2021-08-13 14:49:45 +08:00
										 |  |  |  |                                         ID = maxId, | 
					
						
							| 
									
										
										
										
											2021-08-13 10:48:08 +08:00
										 |  |  |  |                                         EmployName = name, | 
					
						
							|  |  |  |  |                                         IDCardNo = item.idCardNumber, | 
					
						
							|  |  |  |  |                                         EmployNO = item.idCardNumber, | 
					
						
							|  |  |  |  |                                         ProjectId = projectId, | 
					
						
							|  |  |  |  |                                         RoleID = "白名单", | 
					
						
							|  |  |  |  |                                         DateTimeRecord = Funs.GetNewDateTime(item.attendanceTime), | 
					
						
							|  |  |  |  |                                         RecordDes = "白名单:允许通行", | 
					
						
							|  |  |  |  |                                         InOrOut = (item.attendanceType == 1 ? "进门" : "出门"), | 
					
						
							|  |  |  |  |                                     }; | 
					
						
							| 
									
										
										
										
											2022-06-16 17:34:24 +08:00
										 |  |  |  |                                     DoorServerService.InsertEmployInOutRecord(facerecord, getPerson); | 
					
						
							| 
									
										
										
										
											2021-08-13 10:48:08 +08:00
										 |  |  |  |                                     if (facerecord.DateTimeRecord.HasValue) | 
					
						
							|  |  |  |  |                                     { | 
					
						
							|  |  |  |  |                                         int isIn = 0; | 
					
						
							|  |  |  |  |                                         if (facerecord.InOrOut == "进门") | 
					
						
							|  |  |  |  |                                         { | 
					
						
							|  |  |  |  |                                             isIn = 1; | 
					
						
							|  |  |  |  |                                         } | 
					
						
							| 
									
										
										
										
											2022-06-16 17:34:24 +08:00
										 |  |  |  |                                         APIPersonService.getPersonInOut(getPerson, isIn, facerecord.DateTimeRecord.Value); | 
					
						
							| 
									
										
										
										
											2021-08-13 14:49:45 +08:00
										 |  |  |  |                                     }                                    | 
					
						
							| 
									
										
										
										
											2021-06-30 16:00:32 +08:00
										 |  |  |  |                                 } | 
					
						
							| 
									
										
										
										
											2021-08-13 14:49:45 +08:00
										 |  |  |  |                                 responeData.message = "插入成功!"; | 
					
						
							| 
									
										
										
										
											2021-06-30 16:00:32 +08:00
										 |  |  |  |                             } | 
					
						
							|  |  |  |  |                         } | 
					
						
							| 
									
										
										
										
											2021-08-13 10:48:08 +08:00
										 |  |  |  |                         else | 
					
						
							|  |  |  |  |                         { | 
					
						
							|  |  |  |  |                             responeData.code = 0; | 
					
						
							|  |  |  |  |                             responeData.message = "项目号异常!"; | 
					
						
							|  |  |  |  |                         } | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  |                     else | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         responeData.code = 0; | 
					
						
							|  |  |  |  |                         responeData.message = "项目号为空!"; | 
					
						
							| 
									
										
										
										
											2021-06-30 16:00:32 +08:00
										 |  |  |  |                     } | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 else | 
					
						
							|  |  |  |  |                 { | 
					
						
							| 
									
										
										
										
											2021-08-13 10:48:08 +08:00
										 |  |  |  |                     responeData.code = 0; | 
					
						
							| 
									
										
										
										
											2021-07-06 15:16:17 +08:00
										 |  |  |  |                     responeData.message = "数据为空!"; | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             catch (Exception ex) | 
					
						
							|  |  |  |  |             { | 
					
						
							| 
									
										
										
										
											2021-08-12 10:45:31 +08:00
										 |  |  |  |                 responeData.code = 0; | 
					
						
							| 
									
										
										
										
											2021-07-06 15:16:17 +08:00
										 |  |  |  |                 responeData.message = ex.Message; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             return responeData; | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         #endregion | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-13 10:48:08 +08:00
										 |  |  |  |         #region 项目出入人员信息 | 
					
						
							| 
									
										
										
										
											2021-07-06 15:16:17 +08:00
										 |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 保存人员信息 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="person">人员信息</param> | 
					
						
							|  |  |  |  |         /// <returns></returns> | 
					
						
							|  |  |  |  |         [HttpPost] | 
					
						
							| 
									
										
										
										
											2021-08-13 10:48:08 +08:00
										 |  |  |  |         public Model.ResponeData person([FromBody] Model.PersonItem person) | 
					
						
							| 
									
										
										
										
											2021-07-06 15:16:17 +08:00
										 |  |  |  |         { | 
					
						
							|  |  |  |  |             var responeData = new Model.ResponeData(); | 
					
						
							|  |  |  |  |             try | 
					
						
							|  |  |  |  |             { | 
					
						
							| 
									
										
										
										
											2021-08-13 10:48:08 +08:00
										 |  |  |  |                 if (person != null) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         var getProject = ProjectService.GetProjectByProjectCode(person.ProjectCode); | 
					
						
							|  |  |  |  |                         if (getProject != null) | 
					
						
							|  |  |  |  |                         { | 
					
						
							| 
									
										
										
										
											2021-09-06 16:46:05 +08:00
										 |  |  |  |                             var getUnit = UnitService.getUnitByCollCropCodeUnitName(person.CollCropCode, person.UnitName); | 
					
						
							|  |  |  |  |                             if (getUnit != null) | 
					
						
							| 
									
										
										
										
											2023-12-27 14:27:32 +08:00
										 |  |  |  |                             {                               | 
					
						
							| 
									
										
										
										
											2021-09-06 16:46:05 +08:00
										 |  |  |  |                                     Model.SitePerson_Person newPerson = new Model.SitePerson_Person | 
					
						
							|  |  |  |  |                                     { | 
					
						
							|  |  |  |  |                                         PersonId = SQLHelper.GetNewID(), | 
					
						
							|  |  |  |  |                                         ProjectId = getProject.ProjectId, | 
					
						
							|  |  |  |  |                                         UnitId = getUnit.UnitId, | 
					
						
							|  |  |  |  |                                         PersonName = person.PersonName, | 
					
						
							|  |  |  |  |                                         IdentityCard = person.IdentityCard, | 
					
						
							|  |  |  |  |                                         IdcardType = "SHENFEN_ZHENGJIAN", | 
					
						
							|  |  |  |  |                                         IdcardAddress = person.IdcardAddress, | 
					
						
							|  |  |  |  |                                         IdcardForever = "N", | 
					
						
							|  |  |  |  |                                         IdcardStartDate = Funs.GetNewDateTime(person.IdcardStartDate), | 
					
						
							|  |  |  |  |                                         IdcardEndDate = Funs.GetNewDateTime(person.IdcardEndDate), | 
					
						
							|  |  |  |  |                                         Sex = (person.Sex == "女" || person.Sex == "2") ? "2" : "1", | 
					
						
							|  |  |  |  |                                         Address = person.Address, | 
					
						
							|  |  |  |  |                                         OutResult = person.OutResult, | 
					
						
							|  |  |  |  |                                         Birthday = person.Birthday, | 
					
						
							|  |  |  |  |                                         Telephone = person.Telephone, | 
					
						
							|  |  |  |  |                                         IsUsed = person.IsUsed == false ? false : true, | 
					
						
							|  |  |  |  |                                         InTime = Funs.GetNewDateTimeOrNow(person.InTime), | 
					
						
							|  |  |  |  |                                         Password = BLL.PersonService.GetPersonPassWord(person.IdentityCard), | 
					
						
							|  |  |  |  |                                         Isprint = "0", | 
					
						
							|  |  |  |  |                                         //PositionId = person.PositionId, | 
					
						
							|  |  |  |  |                                         //PostTitleId = person.PostTitleId,                               | 
					
						
							|  |  |  |  |                                         //IsForeign = person.IsForeign, | 
					
						
							|  |  |  |  |                                         //IsOutside = person.IsOutside, | 
					
						
							|  |  |  |  |                                         //EduLevel = person.EduLevel, | 
					
						
							|  |  |  |  |                                         //MaritalStatus = person.MaritalStatus, | 
					
						
							|  |  |  |  |                                         //PoliticsStatus = person.PoliticsStatus, | 
					
						
							|  |  |  |  |                                         //Nation = person.Nation, | 
					
						
							|  |  |  |  |                                         //CountryCode = person.CountryCode, | 
					
						
							|  |  |  |  |                                         //ProvinceCode = person.ProvinceCode, | 
					
						
							|  |  |  |  |                                     }; | 
					
						
							| 
									
										
										
										
											2021-08-13 10:48:08 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-06 16:46:05 +08:00
										 |  |  |  |                                     if (!string.IsNullOrEmpty(person.TeamGroupName) && !string.IsNullOrEmpty(newPerson.UnitId)) | 
					
						
							| 
									
										
										
										
											2021-08-13 10:48:08 +08:00
										 |  |  |  |                                     { | 
					
						
							| 
									
										
										
										
											2021-09-06 16:46:05 +08:00
										 |  |  |  |                                         var getTeamGroup = TeamGroupService.getTeamGroupByTeamGroupName(getProject.ProjectId, newPerson.UnitId, person.TeamGroupName); | 
					
						
							|  |  |  |  |                                         if (getTeamGroup != null) | 
					
						
							|  |  |  |  |                                         { | 
					
						
							|  |  |  |  |                                             newPerson.TeamGroupId = getTeamGroup.TeamGroupId; | 
					
						
							|  |  |  |  |                                         } | 
					
						
							|  |  |  |  |                                         else | 
					
						
							|  |  |  |  |                                         { | 
					
						
							|  |  |  |  |                                             Model.ProjectData_TeamGroup newTeamGroup = new Model.ProjectData_TeamGroup | 
					
						
							|  |  |  |  |                                             { | 
					
						
							|  |  |  |  |                                                 TeamGroupId = SQLHelper.GetNewID(), | 
					
						
							|  |  |  |  |                                                 ProjectId = getProject.ProjectId, | 
					
						
							|  |  |  |  |                                                 UnitId = newPerson.UnitId, | 
					
						
							|  |  |  |  |                                                 TeamGroupName = person.TeamGroupName, | 
					
						
							|  |  |  |  |                                                 Remark = "来源:门禁对接数据", | 
					
						
							|  |  |  |  |                                                 TeamTypeId = "CANJIAN_TEAM", | 
					
						
							|  |  |  |  |                                                 EntryTime = System.DateTime.Now, | 
					
						
							|  |  |  |  |                                                 RealNamePushTime = null, | 
					
						
							|  |  |  |  |                                             }; | 
					
						
							|  |  |  |  |                                             db.ProjectData_TeamGroup.InsertOnSubmit(newTeamGroup); | 
					
						
							|  |  |  |  |                                             db.SubmitChanges(); | 
					
						
							|  |  |  |  |                                             newPerson.TeamGroupId = newTeamGroup.TeamGroupId; | 
					
						
							|  |  |  |  |                                         } | 
					
						
							| 
									
										
										
										
											2021-08-13 10:48:08 +08:00
										 |  |  |  |                                     } | 
					
						
							| 
									
										
										
										
											2021-09-06 16:46:05 +08:00
										 |  |  |  |                                     var getWorkArea = UnitWorkService.GetUnitWorkByUnitWorkName(getProject.ProjectId, person.WorkAreaName); | 
					
						
							|  |  |  |  |                                     if (getWorkArea != null) | 
					
						
							|  |  |  |  |                                     { | 
					
						
							|  |  |  |  |                                         newPerson.WorkAreaId = getWorkArea.UnitWorkId; | 
					
						
							|  |  |  |  |                                     } | 
					
						
							|  |  |  |  |                                     var getWorkPost = WorkPostService.GetWorkPostByName(person.WorkPostName); | 
					
						
							|  |  |  |  |                                     if (getWorkPost != null) | 
					
						
							|  |  |  |  |                                     { | 
					
						
							|  |  |  |  |                                         newPerson.WorkPostId = getWorkPost.WorkPostId; | 
					
						
							|  |  |  |  |                                     } | 
					
						
							|  |  |  |  |                                     var getHsseMan = ProjectService.getHSSEManager(getProject.ProjectId); | 
					
						
							|  |  |  |  |                                     if (getHsseMan != null) | 
					
						
							|  |  |  |  |                                     { | 
					
						
							|  |  |  |  |                                         newPerson.AuditorId = getHsseMan.UserId; | 
					
						
							|  |  |  |  |                                         newPerson.AuditorDate = DateTime.Now; | 
					
						
							|  |  |  |  |                                     } | 
					
						
							|  |  |  |  |                                     newPerson.OutTime = Funs.GetNewDateTime(person.OutTime); | 
					
						
							| 
									
										
										
										
											2023-12-21 14:28:47 +08:00
										 |  |  |  |                                     if (person.headImage.Length == 0 && !string.IsNullOrEmpty(person.PhotoUrl)) | 
					
						
							|  |  |  |  |                                     { | 
					
						
							|  |  |  |  |                                         var getS = AttachFileService.SetImageToByteArray(person.PhotoUrl); | 
					
						
							|  |  |  |  |                                         if (getS != null) | 
					
						
							|  |  |  |  |                                         { | 
					
						
							|  |  |  |  |                                             person.headImage = getS.ToString(); | 
					
						
							|  |  |  |  |                                         }                                      | 
					
						
							|  |  |  |  |                                     } | 
					
						
							|  |  |  |  |                                     if (person.headImage.Length > 0) | 
					
						
							| 
									
										
										
										
											2021-08-13 10:48:08 +08:00
										 |  |  |  |                                     { | 
					
						
							| 
									
										
										
										
											2021-09-06 16:46:05 +08:00
										 |  |  |  |                                         var image = Convert.FromBase64String(person.headImage); | 
					
						
							|  |  |  |  |                                         newPerson.HeadImage = image; | 
					
						
							|  |  |  |  |                                         string rootPath = ConfigurationManager.AppSettings["localRoot"]; | 
					
						
							|  |  |  |  |                                         string path = "FileUpLoad/PersonBaseInfo/" + DateTime.Now.ToString("yyyy-MM") + "/"; | 
					
						
							|  |  |  |  |                                         string fileUrl = (rootPath + path).Replace('/', '\\'); | 
					
						
							|  |  |  |  |                                         string flieName = Funs.GetNewFileName() + "~" + person.PersonName + ".jpg"; | 
					
						
							|  |  |  |  |                                         if (!Directory.Exists(fileUrl)) | 
					
						
							| 
									
										
										
										
											2021-08-13 10:48:08 +08:00
										 |  |  |  |                                         { | 
					
						
							| 
									
										
										
										
											2021-09-06 16:46:05 +08:00
										 |  |  |  |                                             Directory.CreateDirectory(fileUrl); | 
					
						
							|  |  |  |  |                                         } | 
					
						
							|  |  |  |  |                                         newPerson.PhotoUrl = path + flieName; | 
					
						
							|  |  |  |  |                                         System.IO.File.WriteAllBytes((fileUrl + flieName), image); | 
					
						
							|  |  |  |  |                                         //AttachFileService.Base64ToImage(person.headImage, path, person.PersonName); | 
					
						
							| 
									
										
										
										
											2021-08-13 10:48:08 +08:00
										 |  |  |  |                                     } | 
					
						
							| 
									
										
										
										
											2021-09-06 16:46:05 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-12-27 14:27:32 +08:00
										 |  |  |  |                                 var getPerson = PersonService.GetPersonByIdentityCard(getProject.ProjectId, person.IdentityCard); | 
					
						
							|  |  |  |  |                                 if (getPerson == null) | 
					
						
							|  |  |  |  |                                 { | 
					
						
							| 
									
										
										
										
											2021-09-06 16:46:05 +08:00
										 |  |  |  |                                     PersonService.AddPerson(newPerson); | 
					
						
							|  |  |  |  |                                     responeData.message = "新增人员成功!"; | 
					
						
							| 
									
										
										
										
											2021-08-13 10:48:08 +08:00
										 |  |  |  |                                 } | 
					
						
							| 
									
										
										
										
											2021-09-06 16:46:05 +08:00
										 |  |  |  |                                 else | 
					
						
							| 
									
										
										
										
											2021-08-13 10:48:08 +08:00
										 |  |  |  |                                 { | 
					
						
							| 
									
										
										
										
											2023-12-28 10:10:06 +08:00
										 |  |  |  |                                     newPerson.PersonId =getPerson.PersonId;  | 
					
						
							| 
									
										
										
										
											2023-12-27 14:27:32 +08:00
										 |  |  |  |                                     PersonService.UpdateDoorPerson(newPerson); | 
					
						
							|  |  |  |  |                                     responeData.message = "更新人员成功!"; | 
					
						
							| 
									
										
										
										
											2021-08-13 10:48:08 +08:00
										 |  |  |  |                                 } | 
					
						
							|  |  |  |  |                             } | 
					
						
							|  |  |  |  |                             else | 
					
						
							|  |  |  |  |                             { | 
					
						
							| 
									
										
										
										
											2021-09-06 16:46:05 +08:00
										 |  |  |  |                                 responeData.code = 0; | 
					
						
							|  |  |  |  |                                 responeData.message = "单位:" + person.UnitName + "施工平台不存在!"; | 
					
						
							| 
									
										
										
										
											2021-08-13 10:48:08 +08:00
										 |  |  |  |                             } | 
					
						
							|  |  |  |  |                         } | 
					
						
							|  |  |  |  |                         else | 
					
						
							|  |  |  |  |                         { | 
					
						
							|  |  |  |  |                             responeData.code = 0; | 
					
						
							| 
									
										
										
										
											2021-09-06 16:46:05 +08:00
										 |  |  |  |                             responeData.message = "项目号:" + person.ProjectCode + "施工平台不存在!"; | 
					
						
							| 
									
										
										
										
											2021-08-13 10:48:08 +08:00
										 |  |  |  |                         } | 
					
						
							|  |  |  |  |                     } | 
					
						
							| 
									
										
										
										
											2021-07-06 15:16:17 +08:00
										 |  |  |  |                 } | 
					
						
							|  |  |  |  |                 else | 
					
						
							|  |  |  |  |                 { | 
					
						
							| 
									
										
										
										
											2021-08-13 10:48:08 +08:00
										 |  |  |  |                     responeData.code = 0; | 
					
						
							| 
									
										
										
										
											2021-07-06 15:16:17 +08:00
										 |  |  |  |                     responeData.message = "数据为空!"; | 
					
						
							| 
									
										
										
										
											2021-06-30 16:00:32 +08:00
										 |  |  |  |                 } | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             catch (Exception ex) | 
					
						
							|  |  |  |  |             { | 
					
						
							| 
									
										
										
										
											2021-08-12 10:45:31 +08:00
										 |  |  |  |                 responeData.code = 0; | 
					
						
							| 
									
										
										
										
											2021-06-30 16:00:32 +08:00
										 |  |  |  |                 responeData.message = ex.Message; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             return responeData; | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         #endregion | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  | } |