2021-04-30 10:28:37 +08:00
|
|
|
|
using BLL;
|
|
|
|
|
using System;
|
2021-07-08 20:34:29 +08:00
|
|
|
|
using System.Collections.Generic;
|
2021-04-30 10:28:37 +08:00
|
|
|
|
using System.Configuration;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
|
|
namespace FineUIPro.Web.ZHGL.RealName
|
|
|
|
|
{
|
|
|
|
|
public partial class SynchroSet : PageBase
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 用户编辑页面
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (!IsPostBack)
|
|
|
|
|
{
|
|
|
|
|
///权限
|
|
|
|
|
this.GetButtonPower();
|
|
|
|
|
ProjectService.InitAllProjectShortNameDropDownList(this.drpProject, this.CurrUser.UserId, false);
|
2021-06-18 20:37:07 +08:00
|
|
|
|
if (!string.IsNullOrEmpty(this.CurrUser.LoginProjectId))
|
2021-04-30 10:28:37 +08:00
|
|
|
|
{
|
2021-06-18 20:37:07 +08:00
|
|
|
|
this.drpProject.SelectedValue = this.CurrUser.LoginProjectId;
|
|
|
|
|
this.drpProject.Readonly = true;
|
2021-04-30 10:28:37 +08:00
|
|
|
|
}
|
2021-07-14 19:57:50 +08:00
|
|
|
|
if (this.CurrUser.UserId == Const.hfnbdId)
|
|
|
|
|
{
|
|
|
|
|
this.btnDataProcess.Hidden = false;
|
|
|
|
|
}
|
2021-06-18 20:37:07 +08:00
|
|
|
|
this.SetPage();
|
2021-04-30 10:28:37 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 保存按钮
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void btnSave_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Model.RealName_SynchroSet newSynchroSet = new Model.RealName_SynchroSet
|
|
|
|
|
{
|
|
|
|
|
UnitId = Const.UnitId_CWCEC,
|
|
|
|
|
ApiUrl = Funs.RealNameApiUrl,
|
|
|
|
|
ClientId = this.txtclientId.Text.Trim(),
|
|
|
|
|
UserName = this.txtUserName.Text.Trim(),
|
|
|
|
|
Password = this.txtword.Text.Trim(),
|
|
|
|
|
Intervaltime=Funs.GetNewInt(this.txtintervaltime.Text.Trim()),
|
|
|
|
|
};
|
2021-07-08 20:34:29 +08:00
|
|
|
|
newSynchroSet.ProCode = ProjectService.GetJTProjectCodeByProjectId(this.drpProject.SelectedValue);
|
2021-04-30 10:28:37 +08:00
|
|
|
|
BLL.SynchroSetService.SaveSynchroSet(newSynchroSet);
|
|
|
|
|
ShowNotify("保存成功!", MessageBoxIcon.Success);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 连接测试
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void btnConnect_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Model.RealName_SynchroSet newSynchroSet = new Model.RealName_SynchroSet
|
|
|
|
|
{
|
|
|
|
|
UnitId = Const.UnitId_CWCEC,
|
|
|
|
|
ApiUrl = Funs.RealNameApiUrl,
|
|
|
|
|
ClientId = this.txtclientId.Text.Trim(),
|
|
|
|
|
UserName = this.txtUserName.Text.Trim(),
|
|
|
|
|
Password = this.txtword.Text.Trim(),
|
|
|
|
|
Intervaltime = Funs.GetNewInt(this.txtintervaltime.Text.Trim()),
|
|
|
|
|
};
|
2021-07-08 20:34:29 +08:00
|
|
|
|
newSynchroSet.ProCode = ProjectService.GetJTProjectCodeByProjectId(this.drpProject.SelectedValue);
|
2021-04-30 10:28:37 +08:00
|
|
|
|
if (!string.IsNullOrEmpty(SynchroSetService.SaveToken(newSynchroSet)))
|
|
|
|
|
{
|
|
|
|
|
ShowNotify("连接成功!", MessageBoxIcon.Success);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Alert.ShowInParent("连接失败", MessageBoxIcon.Warning);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 获取按钮权限
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取按钮权限
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="button"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
private void GetButtonPower()
|
|
|
|
|
{
|
2021-12-16 17:09:14 +08:00
|
|
|
|
string menuId = !string.IsNullOrEmpty(this.CurrUser.LoginProjectId) ? Const.ProjectRealNameSynchroSetMenuId : Const.ServerRealNameSynchroSetMenuId;
|
2021-06-18 20:37:07 +08:00
|
|
|
|
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, menuId);
|
2021-04-30 10:28:37 +08:00
|
|
|
|
if (buttonList.Count() > 0)
|
|
|
|
|
{
|
|
|
|
|
if (buttonList.Contains(BLL.Const.BtnSave))
|
|
|
|
|
{
|
|
|
|
|
this.btnSave.Hidden = false;
|
|
|
|
|
this.btnConnect.Hidden = false;
|
|
|
|
|
this.btnCompany.Hidden = false;
|
|
|
|
|
|
|
|
|
|
this.btnCompany.Hidden = false;
|
|
|
|
|
this.btnProCollCompany.Hidden = false;
|
|
|
|
|
this.btnCollTeam.Hidden = false;
|
|
|
|
|
this.btnPersons.Hidden = false;
|
|
|
|
|
this.btnAttendance.Hidden = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
2021-08-29 12:41:15 +08:00
|
|
|
|
#region 推送参建企业
|
2021-04-30 10:28:37 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// 推送参建企业
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void btnCompany_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
ShowNotify(BLL.SynchroSetService.PushCollCompany(), MessageBoxIcon.Information);
|
|
|
|
|
}
|
2021-08-29 12:41:15 +08:00
|
|
|
|
#endregion
|
2021-04-30 10:28:37 +08:00
|
|
|
|
|
2021-08-29 12:41:15 +08:00
|
|
|
|
#region 推送项目参建单位
|
2021-04-30 10:28:37 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// 推送项目参建单位
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void btnProCollCompany_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
string message = string.Empty;
|
2021-07-08 20:34:29 +08:00
|
|
|
|
string proCode =BLL.ProjectService.GetJTProjectCodeByProjectId(this.drpProject.SelectedValue);
|
2021-04-30 10:28:37 +08:00
|
|
|
|
var getRProjects = Funs.DB.RealName_Project.FirstOrDefault(x => x.ProCode == proCode);
|
|
|
|
|
if (getRProjects != null)
|
|
|
|
|
{
|
|
|
|
|
message += ("项目" + getRProjects.ProCode + SynchroSetService.PushProCollCompany(getRProjects.ProCode));
|
|
|
|
|
ShowNotify(message, MessageBoxIcon.Information);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ShowNotify("当前项目还没有与实名制对接!", MessageBoxIcon.Information);
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-08-29 12:41:15 +08:00
|
|
|
|
#endregion
|
2021-04-30 10:28:37 +08:00
|
|
|
|
|
2021-08-29 12:41:15 +08:00
|
|
|
|
#region 推送施工队
|
2021-04-30 10:28:37 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// 推送施工队
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void btnCollTeam_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
string message = string.Empty;
|
2021-07-08 20:34:29 +08:00
|
|
|
|
string proCode = BLL.ProjectService.GetJTProjectCodeByProjectId(this.drpProject.SelectedValue);
|
2021-04-30 10:28:37 +08:00
|
|
|
|
var getRProjects = Funs.DB.RealName_Project.FirstOrDefault(x => x.ProCode == proCode);
|
|
|
|
|
if (getRProjects != null)
|
|
|
|
|
{
|
|
|
|
|
message += ("项目" + getRProjects.ProCode + SynchroSetService.PushCollTeam(getRProjects.ProCode));
|
|
|
|
|
ShowNotify(message, MessageBoxIcon.Information);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ShowNotify("当前项目还没有与实名制对接!", MessageBoxIcon.Information);
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-08-29 12:41:15 +08:00
|
|
|
|
#endregion
|
2021-04-30 10:28:37 +08:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 推送人员信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void btnPersons_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
//string add ="新增"+ BLL.SynchroSetService.PushPersons(Const.BtnAdd,null) ?? "";
|
|
|
|
|
//string update ="更新"+ BLL.SynchroSetService.PushPersons(Const.BtnModify,null) ?? "";
|
|
|
|
|
//ShowNotify(add+"|"+ update, MessageBoxIcon.Information);
|
|
|
|
|
string message = string.Empty;
|
2021-07-08 20:34:29 +08:00
|
|
|
|
string proCode = BLL.ProjectService.GetJTProjectCodeByProjectId(this.drpProject.SelectedValue);
|
2021-04-30 10:28:37 +08:00
|
|
|
|
var getRProjects = Funs.DB.RealName_Project.FirstOrDefault(x => x.ProCode == proCode);
|
|
|
|
|
if (getRProjects != null)
|
|
|
|
|
{
|
|
|
|
|
message += ("项目" + getRProjects.ProCode + "新增" + BLL.SynchroSetService.PushPersons(Const.BtnAdd, getRProjects.ProCode, null) ?? "");
|
|
|
|
|
message += ("|更新" + BLL.SynchroSetService.PushPersons(Const.BtnModify, getRProjects.ProCode, null) ?? "");
|
|
|
|
|
ShowNotify(message, MessageBoxIcon.Information);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ShowNotify("当前项目还没有与实名制对接!", MessageBoxIcon.Information);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 推送考勤
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void btnAttendance_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
string message = string.Empty;
|
2021-07-08 20:34:29 +08:00
|
|
|
|
string proCode = BLL.ProjectService.GetJTProjectCodeByProjectId(this.drpProject.SelectedValue);
|
2021-04-30 10:28:37 +08:00
|
|
|
|
var getRProjects = Funs.DB.RealName_Project.FirstOrDefault(x => x.ProCode == proCode);
|
|
|
|
|
if (getRProjects != null)
|
|
|
|
|
{
|
|
|
|
|
message +=("项目"+ getRProjects.ProCode+ SynchroSetService.PushAttendance(getRProjects.ProCode));
|
|
|
|
|
ShowNotify(message, MessageBoxIcon.Information);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ShowNotify("当前项目还没有与实名制对接!", MessageBoxIcon.Information);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 切换项目
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void drpProject_SelectedIndexChanged(object sender, EventArgs e)
|
2021-06-18 20:37:07 +08:00
|
|
|
|
{
|
|
|
|
|
this.SetPage();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
protected void SetPage()
|
2021-04-30 10:28:37 +08:00
|
|
|
|
{
|
|
|
|
|
this.txtclientId.Text = string.Empty;
|
|
|
|
|
this.txtUserName.Text = string.Empty;
|
|
|
|
|
this.txtword.Text = string.Empty;
|
2021-06-18 20:37:07 +08:00
|
|
|
|
this.txtapiUrl.Text = Funs.RealNameApiUrl;
|
|
|
|
|
this.txtintervaltime.Text = ConfigurationManager.AppSettings["Intervaltime"];
|
2021-04-30 10:28:37 +08:00
|
|
|
|
|
2021-07-08 20:34:29 +08:00
|
|
|
|
var getpro = Funs.DB.Base_Project.FirstOrDefault(x=>x.ProjectId == this.drpProject.SelectedValue);
|
|
|
|
|
if (getpro !=null && !string.IsNullOrEmpty(getpro.JTProjectCode))
|
2021-04-30 10:28:37 +08:00
|
|
|
|
{
|
2021-07-08 20:34:29 +08:00
|
|
|
|
var getSynchroSet = SynchroSetService.GetSynchroSetByUnitId(Const.UnitId_CWCEC, getpro.JTProjectCode);
|
2021-04-30 10:28:37 +08:00
|
|
|
|
if (getSynchroSet != null)
|
|
|
|
|
{
|
|
|
|
|
this.txtapiUrl.Text = Funs.RealNameApiUrl;
|
|
|
|
|
this.txtclientId.Text = getSynchroSet.ClientId;
|
|
|
|
|
this.txtUserName.Text = getSynchroSet.UserName;
|
|
|
|
|
this.txtword.Text = getSynchroSet.Password;
|
|
|
|
|
this.txtintervaltime.Text = getSynchroSet.Intervaltime.ToString();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-15 09:11:58 +08:00
|
|
|
|
#region 按身份证推送或删除考勤
|
2021-04-30 10:28:37 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// 按身份证推送
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void btnPushData_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
string message = string.Empty;
|
2021-07-08 20:34:29 +08:00
|
|
|
|
string idText = this.txtIdentityCard.Text.Trim();
|
|
|
|
|
if (!string.IsNullOrEmpty(idText))
|
2021-04-30 10:28:37 +08:00
|
|
|
|
{
|
2021-07-08 20:34:29 +08:00
|
|
|
|
string proCode = ProjectService.GetJTProjectCodeByProjectId(this.drpProject.SelectedValue);
|
2022-02-20 11:43:11 +08:00
|
|
|
|
var getRProjects = Funs.DB.RealName_Project.FirstOrDefault(x => x.JTproCode == proCode);
|
|
|
|
|
if (getRProjects != null && !string.IsNullOrEmpty(getRProjects.JTproCode))
|
2021-04-30 10:28:37 +08:00
|
|
|
|
{
|
2021-09-15 09:11:58 +08:00
|
|
|
|
var getList = returnCardList();
|
|
|
|
|
if (getList != null && getList.Count > 0)
|
2021-07-08 20:34:29 +08:00
|
|
|
|
{
|
2021-09-15 09:11:58 +08:00
|
|
|
|
foreach (var item in getList)
|
2021-07-08 20:34:29 +08:00
|
|
|
|
{
|
2021-09-15 09:11:58 +08:00
|
|
|
|
message += ("项目" + getRProjects.ProCode + "新增" + BLL.SynchroSetService.PushPersonsByIdentityCard(Const.BtnAdd, getRProjects.ProCode, item) ?? "");
|
|
|
|
|
message += ("|更新" + BLL.SynchroSetService.PushPersonsByIdentityCard(Const.BtnModify, getRProjects.ProCode, item) ?? "");
|
2021-07-08 20:34:29 +08:00
|
|
|
|
}
|
2021-09-15 09:11:58 +08:00
|
|
|
|
ShowNotify(message, MessageBoxIcon.Information);
|
2021-07-08 20:34:29 +08:00
|
|
|
|
}
|
2021-09-15 09:11:58 +08:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ShowNotify("当前项目还没有与实名制对接!", MessageBoxIcon.Information);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void btnDelete_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
var getList = returnCardList();
|
|
|
|
|
if (getList != null && getList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
foreach (var item in getList)
|
|
|
|
|
{
|
|
|
|
|
var realPersonInOutNow = Funs.DB.RealName_PersonInOutNow.Where(x => x.IdcardNumber == item);
|
|
|
|
|
if (realPersonInOutNow.Count() > 0)
|
2021-07-08 20:34:29 +08:00
|
|
|
|
{
|
2021-09-15 09:11:58 +08:00
|
|
|
|
Funs.DB.RealName_PersonInOutNow.DeleteAllOnSubmit(realPersonInOutNow);
|
|
|
|
|
Funs.DB.SubmitChanges();
|
2021-07-08 20:34:29 +08:00
|
|
|
|
}
|
2021-09-15 09:11:58 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-07-08 20:34:29 +08:00
|
|
|
|
|
2021-09-15 09:11:58 +08:00
|
|
|
|
private List<string> returnCardList()
|
|
|
|
|
{
|
|
|
|
|
List<string> getList = new List<string>();
|
|
|
|
|
string idText = this.txtIdentityCard.Text.Trim();
|
|
|
|
|
if (!string.IsNullOrEmpty(idText))
|
|
|
|
|
{
|
|
|
|
|
idText = idText.Replace(",", ",").Replace("(条)", "").Replace(";", ";").Replace("(", "(").Replace(")", ")");
|
|
|
|
|
if (idText.Contains("("))
|
|
|
|
|
{
|
|
|
|
|
var getData = Funs.GetStrListByStr(idText, ';');
|
|
|
|
|
foreach (var itemD in getData)
|
2021-07-06 15:16:17 +08:00
|
|
|
|
{
|
2021-09-15 09:11:58 +08:00
|
|
|
|
if (!string.IsNullOrEmpty(itemD))
|
2021-07-06 15:16:17 +08:00
|
|
|
|
{
|
2021-09-15 09:11:58 +08:00
|
|
|
|
var a = itemD.Split('(');
|
|
|
|
|
if (a.Count() > 1)
|
|
|
|
|
{
|
|
|
|
|
var b = a[1].Split(')');
|
|
|
|
|
if (b.Count() > 1)
|
|
|
|
|
{
|
|
|
|
|
getList.Add(b[0]);
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-07-06 15:16:17 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2021-04-30 10:28:37 +08:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2021-09-15 09:11:58 +08:00
|
|
|
|
getList = Funs.GetStrListByStr(idText, ',');
|
2021-04-30 10:28:37 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2021-09-15 09:11:58 +08:00
|
|
|
|
return getList;
|
2021-04-30 10:28:37 +08:00
|
|
|
|
}
|
2021-09-15 09:11:58 +08:00
|
|
|
|
#endregion
|
2021-07-14 19:57:50 +08:00
|
|
|
|
|
2021-08-29 12:41:15 +08:00
|
|
|
|
#region 考勤记录 去重
|
2021-07-14 19:57:50 +08:00
|
|
|
|
/// <summary>
|
2021-08-29 12:41:15 +08:00
|
|
|
|
/// 考勤记录 去重
|
2021-07-14 19:57:50 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void btnDataProcess_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2021-07-19 10:41:58 +08:00
|
|
|
|
int delCount = 0;
|
|
|
|
|
try
|
2021-07-14 19:57:50 +08:00
|
|
|
|
{
|
2021-07-19 10:41:58 +08:00
|
|
|
|
var result = (from x in Funs.DB.RealName_PersonInOutNow
|
|
|
|
|
select new
|
|
|
|
|
{
|
|
|
|
|
x.ProjectId,
|
|
|
|
|
date = x.ChangeTime.Value.Date,
|
|
|
|
|
x.IdcardNumber,
|
|
|
|
|
x.IsIn
|
|
|
|
|
}).Distinct();
|
|
|
|
|
foreach (var item in result)
|
2021-07-14 19:57:50 +08:00
|
|
|
|
{
|
2021-07-19 10:41:58 +08:00
|
|
|
|
var getDateRecords = from x in Funs.DB.RealName_PersonInOutNow
|
|
|
|
|
where x.ProjectId == item.ProjectId && x.ChangeTime.Value >= item.date.Date && x.ChangeTime.Value < item.date.Date.AddDays(1)
|
|
|
|
|
&& x.IdcardNumber == item.IdcardNumber
|
|
|
|
|
select x;
|
|
|
|
|
|
|
|
|
|
var getInRecords = getDateRecords.Where(x => x.IsIn == true);
|
|
|
|
|
if (getInRecords.Count() > 1)
|
|
|
|
|
{
|
|
|
|
|
DateTime? minChangeTime = getInRecords.Min(x => x.ChangeTime);
|
|
|
|
|
var getDeleteInR = from x in getInRecords
|
|
|
|
|
where x.ChangeTime != minChangeTime
|
|
|
|
|
select x;
|
|
|
|
|
if (getDeleteInR.Count() > 0)
|
|
|
|
|
{
|
|
|
|
|
delCount += getDeleteInR.Count();
|
|
|
|
|
Funs.DB.RealName_PersonInOutNow.DeleteAllOnSubmit(getDeleteInR);
|
|
|
|
|
Funs.DB.SubmitChanges();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
var getOutRecords = getDateRecords.Where(x => x.IsIn == false);
|
|
|
|
|
if (getOutRecords.Count() > 1)
|
|
|
|
|
{
|
|
|
|
|
DateTime? maxChangeTime = getOutRecords.Max(x => x.ChangeTime);
|
|
|
|
|
var getDeleteOutR = from x in getOutRecords
|
|
|
|
|
where x.ChangeTime != maxChangeTime
|
|
|
|
|
select x;
|
|
|
|
|
if (getDeleteOutR.Count() > 0)
|
|
|
|
|
{
|
|
|
|
|
delCount += getDeleteOutR.Count();
|
|
|
|
|
Funs.DB.RealName_PersonInOutNow.DeleteAllOnSubmit(getDeleteOutR);
|
|
|
|
|
Funs.DB.SubmitChanges();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (delCount >= 1000)
|
|
|
|
|
{
|
|
|
|
|
Alert.ShowInTop("已清理" + delCount.ToString(), MessageBoxIcon.Success);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2021-07-14 19:57:50 +08:00
|
|
|
|
}
|
2021-07-19 10:41:58 +08:00
|
|
|
|
Alert.ShowInTop("已清理" + delCount.ToString(), MessageBoxIcon.Success);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
Alert.ShowInTop("已清理" + delCount.ToString(), MessageBoxIcon.Success);
|
|
|
|
|
return;
|
2021-07-14 19:57:50 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2021-08-29 12:41:15 +08:00
|
|
|
|
#endregion
|
2021-08-26 11:26:04 +08:00
|
|
|
|
|
2021-08-29 12:41:15 +08:00
|
|
|
|
#region 人员批量单条推送
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 新增
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
2021-08-26 11:26:04 +08:00
|
|
|
|
protected void btnAllPushData_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
string message = string.Empty;
|
|
|
|
|
int count = 0;
|
|
|
|
|
string projectId = this.drpProject.SelectedValue;
|
|
|
|
|
string proCode = ProjectService.GetJTProjectCodeByProjectId(projectId);
|
2022-02-20 11:43:11 +08:00
|
|
|
|
var getRProjects = Funs.DB.RealName_Project.FirstOrDefault(x => x.JTproCode == proCode);
|
|
|
|
|
if (getRProjects != null && !string.IsNullOrEmpty(getRProjects.JTproCode))
|
2021-08-26 11:26:04 +08:00
|
|
|
|
{
|
|
|
|
|
var getIdentityCards = (from x in Funs.DB.SitePerson_Person
|
|
|
|
|
join v in Funs.DB.ProjectData_TeamGroup on x.TeamGroupId equals v.TeamGroupId
|
2021-09-06 12:27:07 +08:00
|
|
|
|
join p in Funs.DB.Project_ProjectUnit on new { x.UnitId, x.ProjectId } equals new { p.UnitId, p.ProjectId }
|
2021-08-26 11:26:04 +08:00
|
|
|
|
where x.ProjectId == projectId
|
2021-09-09 16:46:34 +08:00
|
|
|
|
&& x.IsCardNoOK==true
|
2021-08-26 11:26:04 +08:00
|
|
|
|
&& v.TeamId.HasValue && x.HeadImage != null && x.HeadImage.Length > 0
|
|
|
|
|
&& !x.RealNameAddTime.HasValue
|
2021-09-06 12:27:07 +08:00
|
|
|
|
&& p.UnitType != Const.ProjectUnitType_3 && p.UnitType != Const.ProjectUnitType_4
|
|
|
|
|
select x.IdentityCard).Take(500);
|
2021-08-26 11:26:04 +08:00
|
|
|
|
foreach (var item in getIdentityCards)
|
|
|
|
|
{
|
|
|
|
|
string mes = BLL.SynchroSetService.PushPersonsByIdentityCard(Const.BtnAdd, getRProjects.ProCode, item) ?? "";
|
2021-09-06 12:27:07 +08:00
|
|
|
|
if (mes.Contains("不合法"))
|
2021-08-26 11:26:04 +08:00
|
|
|
|
{
|
|
|
|
|
message += ("身份证号码" + item + "新增失败" + mes);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
count++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-08-29 12:41:15 +08:00
|
|
|
|
|
2022-02-20 11:43:11 +08:00
|
|
|
|
string meshow = "新增成功!";
|
|
|
|
|
if (message.Contains("失败"))
|
|
|
|
|
{
|
|
|
|
|
meshow = "存在新增失败数据!";
|
|
|
|
|
}
|
|
|
|
|
SynchroSetService.InsertRealNamePushLog(projectId, proCode, "批量单条推送(新增)", "完成", null, meshow, null, null);
|
2021-08-26 11:26:04 +08:00
|
|
|
|
if (string.IsNullOrEmpty(message))
|
|
|
|
|
{
|
|
|
|
|
ShowNotify("同步完成!" + count.ToString() + "条", MessageBoxIcon.Success);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Alert.ShowInParent("同步完成!" + count.ToString() + "条;" + message, MessageBoxIcon.Warning);
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-08-29 12:41:15 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// 更新
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
2021-08-26 11:26:04 +08:00
|
|
|
|
protected void btnUpdate_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
string message = string.Empty;
|
|
|
|
|
int count = 0;
|
|
|
|
|
string projectId = this.drpProject.SelectedValue;
|
|
|
|
|
string proCode = ProjectService.GetJTProjectCodeByProjectId(projectId);
|
2022-02-20 11:43:11 +08:00
|
|
|
|
var getRProjects = Funs.DB.RealName_Project.FirstOrDefault(x => x.JTproCode == proCode);
|
|
|
|
|
if (getRProjects != null && !string.IsNullOrEmpty(getRProjects.JTproCode))
|
2021-08-26 11:26:04 +08:00
|
|
|
|
{
|
|
|
|
|
var getIdentityCards = (from x in Funs.DB.SitePerson_Person
|
|
|
|
|
join v in Funs.DB.ProjectData_TeamGroup on x.TeamGroupId equals v.TeamGroupId
|
2021-09-09 16:46:34 +08:00
|
|
|
|
join p in Funs.DB.Project_ProjectUnit on new { x.UnitId, x.ProjectId } equals new { p.UnitId, p.ProjectId }
|
|
|
|
|
where x.ProjectId == projectId && x.IsCardNoOK == true && v.TeamId.HasValue
|
2022-02-20 11:43:11 +08:00
|
|
|
|
&& !x.RealNameUpdateTime.HasValue
|
2021-09-09 16:46:34 +08:00
|
|
|
|
&& p.UnitType != Const.ProjectUnitType_3 && p.UnitType != Const.ProjectUnitType_4
|
|
|
|
|
select x.IdentityCard).Take(100);
|
2021-08-26 11:26:04 +08:00
|
|
|
|
foreach (var item in getIdentityCards)
|
|
|
|
|
{
|
|
|
|
|
string mes = BLL.SynchroSetService.PushPersonsByIdentityCard(Const.BtnModify, getRProjects.ProCode, item) ?? "";
|
2021-09-06 12:27:07 +08:00
|
|
|
|
if (mes.Contains("不合法"))
|
2021-08-26 11:26:04 +08:00
|
|
|
|
{
|
|
|
|
|
message += ("身份证号码" + item + "更新失败" + mes);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
count++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-02-20 11:43:11 +08:00
|
|
|
|
string meshow = "更新成功!";
|
|
|
|
|
if (message.Contains("失败"))
|
|
|
|
|
{
|
|
|
|
|
meshow = "存在更新失败数据!";
|
|
|
|
|
}
|
|
|
|
|
SynchroSetService.InsertRealNamePushLog(projectId, proCode, "批量单条推送(更新)", "完成", null, meshow, null, null);
|
2021-08-26 11:26:04 +08:00
|
|
|
|
if (string.IsNullOrEmpty(message))
|
|
|
|
|
{
|
|
|
|
|
ShowNotify("同步完成!" + count.ToString() + "条", MessageBoxIcon.Success);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Alert.ShowInParent("同步完成!" + count.ToString() + "条;" + message, MessageBoxIcon.Warning);
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-08-29 12:41:15 +08:00
|
|
|
|
#endregion
|
2022-02-20 11:43:11 +08:00
|
|
|
|
|
|
|
|
|
protected void btnupdatePersonsExitTime_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
string message = string.Empty;
|
|
|
|
|
string projectId = this.drpProject.SelectedValue;
|
|
|
|
|
string proCode = ProjectService.GetJTProjectCodeByProjectId(projectId);
|
|
|
|
|
var getRProjects = Funs.DB.RealName_Project.FirstOrDefault(x => x.JTproCode == proCode);
|
|
|
|
|
if (getRProjects != null && !string.IsNullOrEmpty(getRProjects.JTproCode))
|
|
|
|
|
{
|
|
|
|
|
message= SynchroSetService.updatePersonsExitTime(getRProjects.JTproCode);
|
|
|
|
|
}
|
|
|
|
|
if (string.IsNullOrEmpty(message))
|
|
|
|
|
{
|
|
|
|
|
ShowNotify("同步完成!" + message, MessageBoxIcon.Warning);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Alert.ShowInParent("同步完成!" + message, MessageBoxIcon.Warning);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 一键清理更新状态
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void btnCanelUpdate_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
|
|
|
|
{
|
|
|
|
|
var getPersons = from x in db.SitePerson_Person
|
|
|
|
|
where x.ProjectId == this.drpProject.SelectedValue && x.RealNameUpdateTime != null
|
|
|
|
|
select x;
|
|
|
|
|
int count = getPersons.Count();
|
|
|
|
|
if (count > 0)
|
|
|
|
|
{
|
|
|
|
|
foreach (var item in getPersons)
|
|
|
|
|
{
|
|
|
|
|
item.RealNameUpdateTime = null;
|
|
|
|
|
db.SubmitChanges();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ShowNotify("操作完成!" + count.ToString() + "条", MessageBoxIcon.Success);
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-04-30 10:28:37 +08:00
|
|
|
|
}
|
|
|
|
|
}
|