partial void HRupdate_Execute()
        {
            // Write your code here.
            foreach (Infoes item in _itemsControl.SelectedItems)
            {
                var dup = (from x in this.DataWorkspace.ApplicationData.InfoesSet
                           where x.PID == item.PID select x).Execute().Count();

                if (dup != 0)
                {
                    this.ShowMessageBox("         工号重复!", caption: "输入错误", button: MessageBoxOption.Ok);
                    //item.Delete();
                    return;
                }

                //var tmp = item.PID.ToString();
                var tmp         = item.PID;
                var synUserInfo = new SyncUserInfo(tmp);
                synUserInfo.Process();

                this.DataWorkspace.ApplicationData.SaveChanges();

                /*
                 * item.WorkExp =  synUserInfo.UserInfo.name + "\n" + synUserInfo.UserInfo.GH + "\n" + synUserInfo.UserInfo.sex + "\n" +
                 *              synUserInfo.UserInfo.nation + "\n" + synUserInfo.UserInfo.birthday + "\n" + synUserInfo.UserInfo.JXRQ + "\n" +
                 *              synUserInfo.UserInfo.CJGZRQ + "\n" + synUserInfo.UserInfo.poli + "\n" + synUserInfo.UserInfo.polidata + "\n" +
                 *              synUserInfo.UserInfo.staffgroup + "\n" + synUserInfo.UserInfo.staffsubgroup + "\n" + synUserInfo.UserInfo.department + "\n" +
                 *              synUserInfo.UserInfo.department2 + "\n" + synUserInfo.UserInfo.education + "\n" + synUserInfo.UserInfo.college + "\n" +
                 *              synUserInfo.UserInfo.xw + "\n" + synUserInfo.UserInfo.zc + "\n" + synUserInfo.UserInfo.zw + "\n" + synUserInfo.UserInfo.zj + "\n" +
                 *              synUserInfo.UserInfo.xk;
                 */

                try
                {
                    item.Name = synUserInfo.UserInfo.name;
                }
                catch (Exception e)
                {
                    this.ShowMessageBox("     输入工号不存在!", caption: "输入错误", button: MessageBoxOption.Ok);
                    item.Delete();
                    return;
                }

                item.Sex       = synUserInfo.UserInfo.sex;
                item.Nation    = synUserInfo.UserInfo.nation;
                item.Politics  = synUserInfo.UserInfo.poli;
                item.FullEdu   = synUserInfo.UserInfo.education;
                item.FUniMajor = synUserInfo.UserInfo.college;
                //item.PartEdu = synUserInfo.UserInfo;
                //item.PUniMajor = synUserInfo.UserInfo;
                item.Duty     = synUserInfo.UserInfo.zw;
                item.Rank     = synUserInfo.UserInfo.zj;
                item.JobTitle = synUserInfo.UserInfo.zc;
                item.Major    = synUserInfo.UserInfo.xk;

                item.Photo = synUserInfo.Photo;
                if (item.Photo == null)
                {
                    this.ShowMessageBox("没有照片,请自行上传!", caption: "照片格式", button: MessageBoxOption.Ok);
                }


                try
                {
                    var tmp_bth  = synUserInfo.UserInfo.birthday.Insert(4, "-");
                    var tmp_bth2 = tmp_bth.Insert(7, "-");
                    item.BirthDate = Convert.ToDateTime(tmp_bth2);
                }
                catch (Exception e)
                {
                    this.ShowMessageBox("出生日期格式不正确,请手动输入!", caption: "格式错误", button: MessageBoxOption.Ok);
                    //item.BirthDate = Convert.ToDateTime("1900-1-2");
                    //this.ShowMessageBox(synUserInfo.UserInfo.birthday);
                    return;
                }

                try
                {
                    var tmp_wrk  = synUserInfo.UserInfo.CJGZRQ.Insert(4, "-");
                    var tmp_wrk2 = tmp_wrk.Insert(7, "-");
                    item.WorkDate = Convert.ToDateTime(tmp_wrk2);
                }
                catch (Exception e)
                {
                    this.ShowMessageBox("参加工作日期格式不正确,请手动输入!", caption: "格式错误", button: MessageBoxOption.Ok);
                    //item.WorkDate = Convert.ToDateTime("1900-1-2");
                    //this.ShowMessageBox(synUserInfo.UserInfo.CJGZRQ);
                    return;
                }

                try
                {
                    var tmp_pty  = synUserInfo.UserInfo.polidata.Insert(4, "-");
                    var tmp_pty2 = tmp_pty.Insert(7, "-");
                    item.PartyDate = Convert.ToDateTime(tmp_pty2);
                }
                catch (Exception e)
                {
                    this.ShowMessageBox("入党日期格式不正确,请手动输入!", caption: "格式错误", button: MessageBoxOption.Ok);
                    //this.ShowMessageBox(synUserInfo.UserInfo.polidata);
                    return;
                }

                this.DataWorkspace.ApplicationData.SaveChanges();
            }
        }
        //[AdminSessionFilter(Order = 1)]
        //[PermissionFilter(Order = 2, Permission = "00000000-0000-0000-5000-000000000001")]
        public JsonResult SyncQyUser()
        {
            LogHelper.Info("SyncQyUser Start!");
            string        account = System.Configuration.ConfigurationManager.AppSettings["SFTPAccount"];
            string        pass    = System.Configuration.ConfigurationManager.AppSettings["SFTPPass"];
            SFTPOperation sftp    = new SFTPOperation("esft-cn.gsk.com", "22", account, pass);
            //读取人员数据
            var                 employeeFile = sftp.ReadFile("shared/UserList/EXP_EMPLOYEE_USER_LIST_WX_DD.CSV");
            String              csvSplitBy = "(?<=^|,)(\"(?:[^\"]|\"\")*\"|[^,]*)";
            StreamReader        sr = new StreamReader(employeeFile, System.Text.UTF8Encoding.UTF8);
            List <SyncUserInfo> syncUserInfo = new List <SyncUserInfo>();
            DataTable           dt = new DataTable();
            int                 i = 0, m = 0;

            sr.Peek();
            while (sr.Peek() > 0)
            {
                m = m + 1;
                string strd = sr.ReadLine();
                if (m >= 0 + 1)
                {
                    if (m == 0 + 1) //如果是字段行,则自动加入字段。
                    {
                        MatchCollection mcs = Regex.Matches(strd, csvSplitBy);
                        foreach (Match mc in mcs)
                        {
                            dt.Columns.Add(mc.Value); //增加列标题
                        }
                    }
                    else
                    {
                        MatchCollection mcs = Regex.Matches(strd, "(?<=^|,)(\"(?:[^\"]|\"\")*\"|[^,]*)");
                        i = 0;
                        System.Data.DataRow dr = dt.NewRow();
                        foreach (Match mc in mcs)
                        {
                            dr[i] = mc.Value;
                            i++;
                        }
                        dt.Rows.Add(dr);  //DataTable 增加一行
                    }
                }
            }
            foreach (DataRow item in dt.Rows)
            {
                SyncUserInfo syncUser = new SyncUserInfo();
                syncUser.ID          = Guid.NewGuid();
                syncUser.UserId      = item[0].ToString().Replace("\"", "").Trim();
                syncUser.UserName    = item[1].ToString().Replace("\"", "");
                syncUser.UserNo      = item[3].ToString().Replace("\"", "");
                syncUser.Email       = item[4].ToString().Replace("\"", "");
                syncUser.LineManager = item[8].ToString().Replace("\"", "");
                syncUser.IsCurrent   = item[9].ToString().Replace("\"", "") == "YES" ? 1 : 0;
                syncUser.Department  = item[5].ToString().Replace("\"", "");
                syncUser.Title       = item[11].ToString().Replace("\"", "").Replace("?", "").Replace("?", "").Replace("�", "").Replace("㡰", "");
                syncUserInfo.Add(syncUser);
            }
            //List<SyncUserInfo> syncUserInfo = new List<SyncUserInfo>();
            //SyncUserInfo syncUser = new SyncUserInfo();
            //syncUser.ID = Guid.NewGuid();
            //syncUser.UserId = "yw960402";
            //syncUser.UserName = "******";
            //syncUser.UserNo = "";
            //syncUser.Email = "";
            //syncUser.LineManager = "jjz63156";
            //syncUser.IsCurrent = 1;
            //syncUser.Department = "";
            //syncUser.Title = "";
            //syncUserInfo.Add(syncUser);


            //SyncUserInfo syncUser1 = new SyncUserInfo();
            //syncUser1.ID = Guid.NewGuid();
            //syncUser1.UserId = "jjz63156";
            //syncUser1.UserName = "******";
            //syncUser1.UserNo = "";
            //syncUser1.Email = "";
            //syncUser1.LineManager = "jfh21155";
            //syncUser1.IsCurrent = 1;
            //syncUser1.Department = "";
            //syncUser1.Title = "";
            //syncUserInfo.Add(syncUser1);
            List <WP_QYUSER> qyUserList      = new List <WP_QYUSER>();
            List <WP_QYUSER> qyUserListLine2 = new List <WP_QYUSER>();
            Guid             weChatId        = Guid.NewGuid();

            foreach (var item in syncUserInfo.ToList())
            {
                WP_QYUSER qyUser = new WP_QYUSER();
                qyUser.ID         = item.ID;
                qyUser.WechatID   = weChatId;
                qyUser.Name       = item.UserName;
                qyUser.UserId     = item.UserId;
                qyUser.Email      = item.Email;
                qyUser.CreateDate = DateTime.Now;
                qyUser.Creator    = Guid.Empty;
                qyUser.ModifyDate = qyUser.CreateDate;
                qyUser.Modifier   = qyUser.Creator;
                var lineManager = syncUserInfo.FirstOrDefault(p => p.UserId == item.LineManager);
                if (lineManager != null)
                {
                    qyUser.LineManager   = lineManager.UserId + "," + lineManager.UserName;
                    qyUser.LineManagerID = lineManager.ID;
                }
                qyUser.State     = item.IsCurrent == 1 ? 1 : 4;
                qyUser.DeptNames = item.Department;
                qyUser.Position  = item.Title;
                qyUser.Gender    = 0;
                qyUserList.Add(qyUser);
            }

            var LineManagerList = userInfoService.FindUserManagerInfo();

            foreach (var item in syncUserInfo.ToList())
            {
                WP_QYUSER qyUser = new WP_QYUSER();
                qyUser.ID         = item.ID;
                qyUser.WechatID   = weChatId;
                qyUser.Name       = item.UserName;
                qyUser.UserId     = item.UserId;
                qyUser.Email      = item.Email;
                qyUser.CreateDate = DateTime.Now;
                qyUser.Creator    = Guid.Empty;
                qyUser.ModifyDate = qyUser.CreateDate;
                qyUser.Modifier   = qyUser.Creator;
                var LineManager1 = LineManagerList.Where(x => x.UserId == item.UserId).FirstOrDefault();
                if (LineManager1 != null && LineManager1.LineManagerId != null)
                {
                    qyUser.LineManager = LineManager1.LineManagerId;
                }
                else
                {
                    qyUser.LineManager = "";
                }
                qyUser.State     = item.IsCurrent == 1 ? 1 : 4;
                qyUser.DeptNames = item.Department;
                qyUser.Position  = item.Title;
                qyUser.Gender    = 0;
                qyUserListLine2.Add(qyUser);
            }

            if (qyUserList.Count > 0)
            {
                Task.Factory.StartNew(() =>
                {
                    try
                    {
                        userInfoService.SyncWorkDayUserInfo(qyUserList);
                    }
                    catch (Exception ex)
                    {
                        LogHelper.Error("SysUserError:Start");
                        LogHelper.Error(ex.Message);
                        LogHelper.Error("SysUserError:End");
                        throw ex;
                    }
                });

                Task.Factory.StartNew(() =>
                {
                    try
                    {
                        LogHelper.Info("SyncQyUser Start!");
                        SyncPreChange(qyUserList, qyUserListLine2);
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                });
                //对结果进行遍历
                foreach (var item in qyUserList)
                {
                    //查询用户是否有未完成的上传文件审批
                    var uploadOrderList = uploadOrderService.GetUploadOrderByUserId(item.UserId);
                    foreach (var uploadOrder in uploadOrderList)
                    {
                        if (item.State != 4)
                        {
                            //判断未完成的订单是否审批人发生了变化
                            LogHelper.Info("SyncQyUser:UserID" + item.UserId);
                            if (item.LineManager == null || item.LineManager == "")
                            {
                                continue;
                            }
                            var uploadInfoDMDelegate = userInfoService.isAgent(item.LineManager.Split(',')[0]);
                            if (uploadInfoDMDelegate != null && uploadOrder.BUHeadMUDID.Equals(uploadInfoDMDelegate) && uploadOrder.IsReAssign == false)
                            {
                                continue;
                            }
                            if ((!uploadOrder.BUHeadMUDID.Equals(item.LineManager.Split(',')[0]) && uploadOrder.IsReAssign == false) || (uploadOrder.IsReAssign == true && !uploadOrder.ReAssignBUHeadMUDID.Equals(item.LineManager.Split(',')[0])))
                            {
                                LogHelper.Info("SyncQyUser:LineManager" + item.LineManager);
                                //将待审批上传文件转交给新的审批人
                                PreApprovalService.UpdatePuoReAssign(uploadOrder.ID.ToString(), "系统自动", "系统自动", item.LineManager.Split(',')[0], item.LineManager.Split(',')[1]);
                                //发消息
                                var messageBase = "该订单已上传会议支持文件";
                                switch (uploadOrder.FileType)
                                {
                                case 1:
                                    messageBase = "该订单已提交退单原因";
                                    break;

                                case 2:
                                    messageBase = "该订单已提交会议支持文件丢失原因";
                                    break;

                                case 3:
                                    messageBase = "该订单已提交未送达,会议未正常召开原因";
                                    break;
                                }
                                LogHelper.Info("SyncQyUser:HTCode" + uploadOrder.HTCode);
                                var approverMsg = $"{uploadOrder.HTCode},{messageBase},请<a href='{ConfigurationManager.AppSettings["MealH5SiteUrl"]}/P/Upload/Approval?id={uploadOrder.ID}&from=0'>点击这里</a>进行审批。";
                                var rtnVal      = WxMessageClientChannelFactory.GetChannel().SendText(item.LineManager.Split(',')[0], approverMsg);
                            }
                        }
                    }
                }
            }
            LogHelper.Info("SyncQyUser Success!");
            //new TaskPlanController().AutoTransfer();
            return(Json(new { state = 1 }));
        }