20231227
This commit is contained in:
		
							parent
							
								
									88b4e488a8
								
							
						
					
					
						commit
						22b9ee9a7d
					
				| 
						 | 
				
			
			@ -635,6 +635,59 @@ namespace BLL
 | 
			
		|||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        public static void UpdateDoorPerson(Model.SitePerson_Person person)
 | 
			
		||||
        {
 | 
			
		||||
            using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
 | 
			
		||||
            {
 | 
			
		||||
                Model.SitePerson_Person newPerson = db.SitePerson_Person.FirstOrDefault(e => e.PersonId == person.PersonId);
 | 
			
		||||
                if (newPerson != null)
 | 
			
		||||
                {
 | 
			
		||||
                    
 | 
			
		||||
                    newPerson.PersonName = person.PersonName;
 | 
			
		||||
                    newPerson.Sex = person.Sex;
 | 
			
		||||
                    if (newPerson.IdentityCard != person.IdentityCard)
 | 
			
		||||
                    {
 | 
			
		||||
                        PersonInOutService.UpdateRealNameInOut(newPerson.PersonId, newPerson.IdentityCard, person.IdentityCard);
 | 
			
		||||
                        newPerson.IdentityCard = person.IdentityCard;
 | 
			
		||||
                    }
 | 
			
		||||
                    newPerson.Address = person.Address;                
 | 
			
		||||
                    newPerson.UnitId = person.UnitId;
 | 
			
		||||
                    newPerson.TeamGroupId = person.TeamGroupId;
 | 
			
		||||
                    newPerson.WorkAreaId = person.WorkAreaId;
 | 
			
		||||
                    newPerson.WorkPostId = person.WorkPostId;
 | 
			
		||||
                    newPerson.InTime = person.InTime;
 | 
			
		||||
                    newPerson.OutTime = person.OutTime;
 | 
			
		||||
                    newPerson.OutResult = person.OutResult;
 | 
			
		||||
                    newPerson.Telephone = person.Telephone;
 | 
			
		||||
                    newPerson.PhotoUrl = person.PhotoUrl;
 | 
			
		||||
                    newPerson.HeadImage = person.HeadImage;
 | 
			
		||||
                    newPerson.IsUsed = person.IsUsed;
 | 
			
		||||
 | 
			
		||||
                    if (!newPerson.OutTime.HasValue)
 | 
			
		||||
                    {
 | 
			
		||||
                        newPerson.OutTime = null;
 | 
			
		||||
                        newPerson.ExchangeTime = null;
 | 
			
		||||
                    }
 | 
			
		||||
                    if (!string.IsNullOrEmpty(person.AuditorId))
 | 
			
		||||
                    {
 | 
			
		||||
                        newPerson.AuditorId = person.AuditorId;
 | 
			
		||||
                    }
 | 
			
		||||
                    if (person.AuditorDate.HasValue)
 | 
			
		||||
                    {
 | 
			
		||||
                        newPerson.AuditorDate = person.AuditorDate;
 | 
			
		||||
                    }
 | 
			
		||||
                    newPerson.Birthday = person.Birthday;
 | 
			
		||||
                    newPerson.IdcardType = person.IdcardType;
 | 
			
		||||
                    newPerson.IdcardStartDate = person.IdcardStartDate;
 | 
			
		||||
                    newPerson.IdcardEndDate = person.IdcardEndDate;
 | 
			
		||||
                    newPerson.IdcardForever = person.IdcardForever;
 | 
			
		||||
                    newPerson.IdcardAddress = person.IdcardAddress;
 | 
			
		||||
                    newPerson.IsCardNoOK = IDCardValid.CheckIDCard(person.IdentityCard);
 | 
			
		||||
                    db.SubmitChanges();
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 修改密码
 | 
			
		||||
        /// </summary>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -157,9 +157,6 @@ namespace WebAPI.Controllers
 | 
			
		|||
                        {
 | 
			
		||||
                            var getUnit = UnitService.getUnitByCollCropCodeUnitName(person.CollCropCode, person.UnitName);
 | 
			
		||||
                            if (getUnit != null)
 | 
			
		||||
                            {
 | 
			
		||||
                                var getPerson = PersonService.GetPersonByIdentityCard(getProject.ProjectId, person.IdentityCard);
 | 
			
		||||
                                if (getPerson == null)
 | 
			
		||||
                            {                              
 | 
			
		||||
                                    Model.SitePerson_Person newPerson = new Model.SitePerson_Person
 | 
			
		||||
                                    {
 | 
			
		||||
| 
						 | 
				
			
			@ -261,42 +258,16 @@ namespace WebAPI.Controllers
 | 
			
		|||
                                        //AttachFileService.Base64ToImage(person.headImage, path, person.PersonName);
 | 
			
		||||
                                    }
 | 
			
		||||
 | 
			
		||||
                                var getPerson = PersonService.GetPersonByIdentityCard(getProject.ProjectId, person.IdentityCard);
 | 
			
		||||
                                if (getPerson == null)
 | 
			
		||||
                                {
 | 
			
		||||
                                    PersonService.AddPerson(newPerson);
 | 
			
		||||
                                    responeData.message = "新增人员成功!";
 | 
			
		||||
                                }
 | 
			
		||||
                                else
 | 
			
		||||
                                {
 | 
			
		||||
                                    if (person.headImage.Length > 0)
 | 
			
		||||
                                    {
 | 
			
		||||
                                        var image = Convert.FromBase64String(person.headImage);
 | 
			
		||||
                                        getPerson.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))
 | 
			
		||||
                                        {
 | 
			
		||||
                                            Directory.CreateDirectory(fileUrl);
 | 
			
		||||
                                        }
 | 
			
		||||
                                        getPerson.PhotoUrl = path + flieName;
 | 
			
		||||
                                        System.IO.File.WriteAllBytes((fileUrl + flieName), image);
 | 
			
		||||
                                        //AttachFileService.Base64ToImage(person.headImage, path, person.PersonName);
 | 
			
		||||
                                        PersonService.UpdatePhotoUrl(getPerson.PersonId, getPerson.PhotoUrl,getPerson.HeadImage);
 | 
			
		||||
                                        responeData.message = "更新照片!";
 | 
			
		||||
                                    }
 | 
			
		||||
                                    else
 | 
			
		||||
                                    {
 | 
			
		||||
                                        if (!string.IsNullOrEmpty(person.OutTime))
 | 
			
		||||
                                        {
 | 
			
		||||
                                            var outTime = Funs.GetNewDateTimeOrNow(person.OutTime);
 | 
			
		||||
                                            PersonService.PersonOut(getPerson.PersonId, outTime);
 | 
			
		||||
                                            responeData.message = "更新出场时间";
 | 
			
		||||
                                        }
 | 
			
		||||
                                        else
 | 
			
		||||
                                        {
 | 
			
		||||
                                            responeData.message = "该身份证号码人员已存在!";
 | 
			
		||||
                                        }
 | 
			
		||||
                                    }
 | 
			
		||||
                                    PersonService.UpdateDoorPerson(newPerson);
 | 
			
		||||
                                    responeData.message = "更新人员成功!";
 | 
			
		||||
                                }
 | 
			
		||||
                            }
 | 
			
		||||
                            else
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue