20220601 修改Global调用定时器、修改考勤导入列表及导入方法

This commit is contained in:
杨红卫 2022-06-01 14:27:42 +08:00
parent d33b007348
commit 31a7840cda
15 changed files with 365 additions and 210 deletions

View File

@ -0,0 +1,31 @@
ALTER TABLE SitePerson_Checking ADD UnitId NVARCHAR(50) null
go
ALTER TABLE SitePerson_Checking ADD UnitName NVARCHAR(500) null
go
ALTER TABLE SitePerson_Checking ADD PersonName NVARCHAR(50) null
go
/****** Object: Index [NonClusteredIndex-20220601-105641] Script Date: 2022/6/1 11:00:51 ******/
CREATE NONCLUSTERED INDEX [NonClusteredIndex-20220601-105641] ON [dbo].[SitePerson_Checking]
(
[ProjectId] ASC,
[IntoOutTime] ASC,
[UnitId] ASC,
[PersonName] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object: Index [NonClusteredIndex-20220601-122818] Script Date: 2022/6/1 12:38:37 ******/
CREATE NONCLUSTERED INDEX [NonClusteredIndex-20220601-122818] ON [dbo].[SitePerson_Checking]
(
[ProjectId] ASC,
[IntoOutTime] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
UPDATE A SET A.UnitId= b.UnitId
,A.PersonName=B.PersonName
,A.UnitName=C.UnitName
FROM SitePerson_Checking A,SitePerson_Person B,Base_Unit C
WHERE A.PersonId=B.PersonId AND B.UnitId=C.UnitId
go

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Collections; using System.Collections;
using FineUIPro;
namespace BLL namespace BLL
{ {
@ -10,6 +11,72 @@ namespace BLL
{ {
public static Model.SGGLDB db = Funs.DB; public static Model.SGGLDB db = Funs.DB;
#region
/// <summary>
/// 记录数
/// </summary>
public static int count
{
get;
set;
}
/// <summary>
/// 定义变量
/// </summary>
private static IQueryable<Model.SitePerson_Checking> getDataLists = from x in db.SitePerson_Checking
select x;
/// <summary>
/// 数据列表
/// </summary>
/// <param name="unitId"></param>
/// <param name="Grid1"></param>
/// <returns></returns>
public static IEnumerable getListData(string projectId, string unitId, string personName, string startDate, string endDate, Grid Grid1)
{
IQueryable<Model.SitePerson_Checking> getDataList = getDataLists.Where(x => x.ProjectId == projectId);
if (!string.IsNullOrEmpty(unitId) && unitId != Const._Null)
{
getDataList = getDataList.Where(x => x.UnitId == unitId);
}
if (!string.IsNullOrEmpty(personName))
{
getDataList = getDataList.Where(x => x.PersonName.Contains(personName));
}
if (!string.IsNullOrEmpty(startDate))
{
DateTime? startDateD = Funs.GetNewDateTime(startDate);
if (startDateD.HasValue)
{
getDataList = getDataList.Where(x => x.IntoOutTime >= startDateD.Value);
}
}
if (!string.IsNullOrEmpty(endDate))
{
DateTime? endDateD = Funs.GetNewDateTime(endDate);
if (endDateD.HasValue)
{
getDataList = getDataList.Where(x => x.IntoOutTime < endDateD.Value);
}
}
count = getDataList.Count();
if (count == 0)
{
return null;
}
getDataList = SortConditionHelper.SortingAndPaging(getDataList, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize);
return from x in getDataList
select new
{
x.CheckingId, x.ProjectId, x.UnitId, x.UnitName, x.PersonId,
x.PersonName, x.CardNo, x.IdentityCard, x.WorkAreaId, x.WorkAreaName,
x.IntoOut, x.IntoOutTime, x.Address,
};
}
#endregion
/// <summary> /// <summary>
/// 根据人员考勤主键获取人员考勤管理信息 /// 根据人员考勤主键获取人员考勤管理信息
/// </summary> /// </summary>
@ -30,12 +97,15 @@ namespace BLL
Model.SitePerson_Checking newPersonInfo = new Model.SitePerson_Checking Model.SitePerson_Checking newPersonInfo = new Model.SitePerson_Checking
{ {
CheckingId = personInfo.CheckingId, CheckingId = personInfo.CheckingId,
PersonId = personInfo.PersonId,
CardNo = personInfo.CardNo,
ProjectId = personInfo.ProjectId, ProjectId = personInfo.ProjectId,
WorkAreaId = personInfo.WorkAreaId, UnitId = personInfo.UnitId,
WorkAreaName = personInfo.WorkAreaName, UnitName = personInfo.UnitName,
PersonId = personInfo.PersonId,
PersonName = personInfo.PersonName,
IdentityCard = personInfo.IdentityCard, IdentityCard = personInfo.IdentityCard,
CardNo = personInfo.CardNo,
WorkAreaId = personInfo.WorkAreaId,
WorkAreaName = personInfo.WorkAreaName,
IntoOutTime = personInfo.IntoOutTime, IntoOutTime = personInfo.IntoOutTime,
IntoOut = personInfo.IntoOut, IntoOut = personInfo.IntoOut,
Address = personInfo.Address, Address = personInfo.Address,
@ -62,12 +132,14 @@ namespace BLL
Model.SitePerson_Checking newPersonInfo = db.SitePerson_Checking.FirstOrDefault(e => e.CheckingId == personInfo.CheckingId); Model.SitePerson_Checking newPersonInfo = db.SitePerson_Checking.FirstOrDefault(e => e.CheckingId == personInfo.CheckingId);
if (newPersonInfo != null) if (newPersonInfo != null)
{ {
newPersonInfo.CardNo = personInfo.CardNo; newPersonInfo.UnitId = personInfo.UnitId;
newPersonInfo.UnitName = personInfo.UnitName;
newPersonInfo.PersonId = personInfo.PersonId; newPersonInfo.PersonId = personInfo.PersonId;
newPersonInfo.ProjectId = personInfo.ProjectId; newPersonInfo.PersonName = personInfo.PersonName;
newPersonInfo.WorkAreaId = personInfo.WorkAreaId; newPersonInfo.CardNo = personInfo.CardNo;
newPersonInfo.WorkAreaName = personInfo.WorkAreaName;
newPersonInfo.IdentityCard = personInfo.IdentityCard; newPersonInfo.IdentityCard = personInfo.IdentityCard;
newPersonInfo.WorkAreaId = personInfo.WorkAreaId;
newPersonInfo.WorkAreaName = personInfo.WorkAreaName;
newPersonInfo.IntoOutTime = personInfo.IntoOutTime; newPersonInfo.IntoOutTime = personInfo.IntoOutTime;
newPersonInfo.IntoOut = personInfo.IntoOut; newPersonInfo.IntoOut = personInfo.IntoOut;
newPersonInfo.Address = personInfo.Address; newPersonInfo.Address = personInfo.Address;

View File

@ -22,18 +22,26 @@ namespace BLL
/// <returns>是否登录成功</returns> /// <returns>是否登录成功</returns>
public static bool UserLogOn(string account, string password, bool rememberMe, System.Web.UI.Page page) public static bool UserLogOn(string account, string password, bool rememberMe, System.Web.UI.Page page)
{ {
List<Sys_User> x = (from y in Funs.DB.Sys_User try
where y.Account == account && y.IsPost == true && y.Password == Funs.EncryptionPassword(password)
select y).ToList();
if (x.Any())
{ {
string accValue = HttpUtility.UrlEncode(account); List<Sys_User> x = (from y in Funs.DB.Sys_User
FormsAuthentication.SetAuthCookie(accValue, false); where y.Account == account && y.IsPost == true && y.Password == Funs.EncryptionPassword(password)
page.Session[SessionName.CurrUser] = x.First(); select y).ToList();
return true; if (x.Any())
{
string accValue = HttpUtility.UrlEncode(account);
FormsAuthentication.SetAuthCookie(accValue, false);
page.Session[SessionName.CurrUser] = x.First();
return true;
}
else
{
return false;
}
} }
else catch (Exception ex)
{ {
ErrLogInfo.WriteLog("Óû§µÇ½´íÎó£º" + ex.Message);
return false; return false;
} }
} }

View File

@ -7,19 +7,23 @@ namespace BLL
{ {
public class RealNameMonitorService public class RealNameMonitorService
{ {
#region 5 #region 5
/// <summary> /// <summary>
/// 监视组件 /// 监视组件
/// </summary> /// </summary>
// private static Timer messageTimer; private static Timer messageTimer;
/// <summary> /// <summary>
/// 启动监视器,不一定能成功,根据系统设置决定对监视器执行的操作 系统启动5分钟 /// 启动监视器,不一定能成功,根据系统设置决定对监视器执行的操作 系统启动5分钟
/// </summary> /// </summary>
public static void StartMonitor(string jtProCode) public static void StartMonitor()
{ {
int adTimeJ = Funs.GetNewInt(ConfigurationManager.AppSettings["Intervaltime"]) ?? 30; int adTimeJ = Funs.GetNewInt(ConfigurationManager.AppSettings["Intervaltime"]) ?? 30;
Timer messageTimer = new Timer(); //var getSynchroSet = Funs.DB.RealName_SynchroSet.FirstOrDefault();
//if (getSynchroSet != null && getSynchroSet.Intervaltime.HasValue)
//{
// adTimeJ = getSynchroSet.Intervaltime.Value;
//}
if (messageTimer != null) if (messageTimer != null)
{ {
messageTimer.Stop(); messageTimer.Stop();
@ -32,8 +36,7 @@ namespace BLL
{ {
AutoReset = true AutoReset = true
}; };
messageTimer.Elapsed += (sender, args) => AdUserInProcess(sender, jtProCode); messageTimer.Elapsed += new ElapsedEventHandler(AdUserInProcess);
//messageTimer.Elapsed += new ElapsedEventHandler(AdUserInProcess);
messageTimer.Interval = 1000 * 60 * adTimeJ;// 60分钟 60000 * adTimeJ; messageTimer.Interval = 1000 * 60 * adTimeJ;// 60分钟 60000 * adTimeJ;
messageTimer.Start(); messageTimer.Start();
} }
@ -44,25 +47,34 @@ namespace BLL
/// </summary> /// </summary>
/// <param name="sender">Timer组件</param> /// <param name="sender">Timer组件</param>
/// <param name="e">事件参数</param> /// <param name="e">事件参数</param>
public static void AdUserInProcess(object sender, string jtProCode) private static void AdUserInProcess(object sender, ElapsedEventArgs e)
{ {
try try
{ {
SynchroSetService.PushCollCompany(); SynchroSetService.PushCollCompany();
if (!string.IsNullOrEmpty(jtProCode)) var getRProjects = from x in Funs.DB.RealName_Project
select x;
if (getRProjects.Count() > 0)
{ {
SynchroSetService.PushProCollCompany(jtProCode); foreach (var item in getRProjects)
SynchroSetService.PushCollTeam(jtProCode); {
SynchroSetService.getCollTeam(jtProCode); var getSynchroSet = Funs.DB.RealName_SynchroSet.FirstOrDefault(x => x.ProCode == item.JTproCode);
SynchroSetService.PushPersons(Const.BtnAdd, jtProCode, null); if (getSynchroSet != null && !string.IsNullOrEmpty(item.JTproCode))
SynchroSetService.PushPersons(Const.BtnModify, jtProCode, null); {
SynchroSetService.PushAttendance(jtProCode); SynchroSetService.PushProCollCompany(item.JTproCode);
SynchroSetService.updatePersonsExitTime(jtProCode); //SynchroSetService.PushCollTeam(item.ProCode);
//SynchroSetService.getCollTeam(item.ProCode);
//SynchroSetService.PushPersons(Const.BtnAdd, item.JTproCode, null);
//SynchroSetService.PushPersons(Const.BtnModify, item.JTproCode, null);
SynchroSetService.PushAttendance(item.JTproCode);
SynchroSetService.updatePersonsExitTime(item.JTproCode);
}
}
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
StartMonitor(jtProCode); StartMonitor();
ErrLogInfo.WriteLog(ex, "数据接口定时器", "RealNameMonitorService.AdUserInProcess"); ErrLogInfo.WriteLog(ex, "数据接口定时器", "RealNameMonitorService.AdUserInProcess");
} }
} }
@ -176,7 +188,7 @@ namespace BLL
/// </summary> /// </summary>
public static void StartMonitorDeletePushLog() public static void StartMonitorDeletePushLog()
{ {
int adTimeJ = 60 * 12; int adTimeJ = 60 * 4;
if (messageTimer1 != null) if (messageTimer1 != null)
{ {
messageTimer1.Stop(); messageTimer1.Stop();
@ -205,21 +217,21 @@ namespace BLL
try try
{ {
/// 3天推送实名制日志 /// 3天推送实名制日志
var getPushLogs = Funs.DB.RealName_PushLog.Where(x => x.PushTime.Value.AddDays(3) < DateTime.Now); var getPushLogs = Funs.DB.RealName_PushLog.Where(x => x.PushTime.Value.AddHours(6) < DateTime.Now);
if (getPushLogs.Count() > 0) if (getPushLogs.Count() > 0)
{ {
Funs.DB.RealName_PushLog.DeleteAllOnSubmit(getPushLogs); Funs.DB.RealName_PushLog.DeleteAllOnSubmit(getPushLogs);
Funs.DB.SubmitChanges(); Funs.DB.SubmitChanges();
} }
/// 3个月操作日志 /// 3个月操作日志
var getSys_Logs = Funs.DB.Sys_Log.Where(x => x.OperationTime.Value.AddMonths(3) < DateTime.Now); var getSys_Logs = Funs.DB.Sys_Log.Where(x => x.OperationTime.Value.AddDays(15) < DateTime.Now);
if (getSys_Logs.Count() > 0) if (getSys_Logs.Count() > 0)
{ {
Funs.DB.Sys_Log.DeleteAllOnSubmit(getSys_Logs); Funs.DB.Sys_Log.DeleteAllOnSubmit(getSys_Logs);
Funs.DB.SubmitChanges(); Funs.DB.SubmitChanges();
} }
/// 1个月推送消息日志 /// 1个月推送消息日志
var getSys_HttpLogs = Funs.DB.Sys_HttpLog.Where(x => x.LogTime.Value.AddMonths(1) < DateTime.Now); var getSys_HttpLogs = Funs.DB.Sys_HttpLog.Where(x => x.LogTime.Value.AddDays(15) < DateTime.Now);
if (getSys_HttpLogs.Count() > 0) if (getSys_HttpLogs.Count() > 0)
{ {
Funs.DB.Sys_HttpLog.DeleteAllOnSubmit(getSys_HttpLogs); Funs.DB.Sys_HttpLog.DeleteAllOnSubmit(getSys_HttpLogs);

View File

@ -213,7 +213,7 @@ namespace BLL
{ {
access_token = obj["data"].ToString(); access_token = obj["data"].ToString();
SynchroSet.Token = access_token; SynchroSet.Token = access_token;
SynchroSet.Tokenendtime = DateTime.Now.AddHours(23); SynchroSet.Tokenendtime = DateTime.Now.AddHours(12);
SynchroSet.Timestamp = Funs.GetNewDateTime(timestamp); SynchroSet.Timestamp = Funs.GetNewDateTime(timestamp);
SaveSynchroSet(SynchroSet); SaveSynchroSet(SynchroSet);
InsertRealNamePushLog(null, SynchroSet.ProCode, "获取凭证", obj["success"].ToString(), obj["code"].ToString(), obj["message"].ToString(),access_token, pushContent); InsertRealNamePushLog(null, SynchroSet.ProCode, "获取凭证", obj["success"].ToString(), obj["code"].ToString(), obj["message"].ToString(),access_token, pushContent);
@ -809,7 +809,8 @@ namespace BLL
} }
} }
} }
InsertRealNamePushLog(null, proCode, "推送项目参建企业数据", sucess, code, mess, data, pushContent);
InsertRealNamePushLog(null, proCode, "推送项目参建企业数据", sucess, code, mess, data, pushContent);
} }
else else
{ {
@ -1087,10 +1088,14 @@ namespace BLL
} }
/// <summary> /// <summary>
/// 推送人员数据 /// 推送人员数据
/// </summary> /// </summary>
/// <param name="type"></param>
/// <param name="proCode"></param>
/// <param name="identityCard"></param>
/// <param name="isLog">是否写日志</param>
/// <returns></returns> /// <returns></returns>
public static string PushPersonsByIdentityCard(string type, string proCode, string identityCard) public static string PushPersonsByIdentityCard(string type, string proCode, string identityCard,bool isLog)
{ {
try try
{ {
@ -1220,17 +1225,23 @@ namespace BLL
} }
else if (data.Contains("人员不存在")) else if (data.Contains("人员不存在"))
{ {
SynchroSetService.PushPersonsByIdentityCard(Const.BtnAdd, proCode, identityCard); SynchroSetService.PushPersonsByIdentityCard(Const.BtnAdd, proCode, identityCard, isLog);
} }
else else
{ {
InsertRealNamePushLog(null, proCode, "推送人员数据", sucess, code, mess, data, pushContent); if (isLog)
{
InsertRealNamePushLog(null, proCode, "推送人员数据", sucess, code, mess, data, pushContent);
}
} }
} }
} }
else else
{ {
InsertRealNamePushLog(null, proCode, "推送人员数据", sucess, code, mess, data, pushContent); if (isLog)
{
InsertRealNamePushLog(null, proCode, "推送人员数据", sucess, code, mess, data, pushContent);
}
} }
if (data.Contains("已存在") || mess.Contains("已存在")) if (data.Contains("已存在") || mess.Contains("已存在"))
@ -1435,8 +1446,8 @@ namespace BLL
var getPersonS = getData.Select(x => x.idcardNumber).Distinct().ToList(); var getPersonS = getData.Select(x => x.idcardNumber).Distinct().ToList();
foreach (var pitem in getPersonS) foreach (var pitem in getPersonS)
{ {
PushPersonsByIdentityCard(Const.BtnAdd, proCode, pitem); PushPersonsByIdentityCard(Const.BtnAdd, proCode, pitem, false);
PushPersonsByIdentityCard(Const.BtnModify, proCode, pitem); PushPersonsByIdentityCard(Const.BtnModify, proCode, pitem, false);
} }
pushContent = JsonConvert.SerializeObject(listObject); pushContent = JsonConvert.SerializeObject(listObject);

View File

@ -32,6 +32,7 @@
} }
catch (Exception ex) catch (Exception ex)
{ {
ErrLogInfo.WriteLog("数据库连接:" + Funs.ConnString);
ErrLogInfo.WriteLog(string.Empty, ex); ErrLogInfo.WriteLog(string.Empty, ex);
//AppDomain.Unload(AppDomain.CurrentDomain); //AppDomain.Unload(AppDomain.CurrentDomain);
} }
@ -49,11 +50,7 @@
{ {
if (ConfigurationManager.AppSettings["EnableRealName"] == "True") if (ConfigurationManager.AppSettings["EnableRealName"] == "True")
{ {
var getProjects = SynchroSetService.GetRealNameProject(); BLL.RealNameMonitorService.StartMonitor();
foreach (var item in getProjects)
{
BLL.RealNameMonitorService.StartMonitor(item.JTproCode);
}
} }
} }
catch (Exception ex) catch (Exception ex)

View File

@ -69,12 +69,7 @@
<f:RenderField Width="150px" ColumnID="IntoOutTime" DataField="IntoOutTime" SortField="IntoOutTime" <f:RenderField Width="150px" ColumnID="IntoOutTime" DataField="IntoOutTime" SortField="IntoOutTime"
HeaderText="出入现场时间" HeaderTextAlign="Center" TextAlign="Center"> HeaderText="出入现场时间" HeaderTextAlign="Center" TextAlign="Center">
</f:RenderField> </f:RenderField>
<%-- <f:TemplateField ColumnID="tfAddress" Width="130px" HeaderText="进出地点" HeaderTextAlign="Center" TextAlign="Left"> <f:TemplateField ColumnID="tfWorkAreaName" Width="170px" HeaderText="单位工程" HeaderTextAlign="Center" TextAlign="Left" Hidden="true">
<ItemTemplate>
<asp:Label ID="lblAddress" runat="server" Text='<%# Bind("Address") %>' ToolTip='<%#Bind("Address") %>'></asp:Label>
</ItemTemplate>
</f:TemplateField>--%>
<f:TemplateField ColumnID="tfWorkAreaName" Width="170px" HeaderText="单位工程" HeaderTextAlign="Center" TextAlign="Left">
<ItemTemplate> <ItemTemplate>
<asp:Label ID="lblWorkAreaName" runat="server" Text='<%# Bind("WorkAreaName") %>' ToolTip='<%#Bind("WorkAreaName") %>'></asp:Label> <asp:Label ID="lblWorkAreaName" runat="server" Text='<%# Bind("WorkAreaName") %>' ToolTip='<%#Bind("WorkAreaName") %>'></asp:Label>
</ItemTemplate> </ItemTemplate>

View File

@ -1,8 +1,5 @@
using BLL; using BLL;
using System; using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using AspNet = System.Web.UI.WebControls; using AspNet = System.Web.UI.WebControls;
@ -26,16 +23,15 @@ namespace FineUIPro.Web.HSSE.SitePerson
ViewState["CheckingId"] = value; ViewState["CheckingId"] = value;
} }
} }
public string ProjectId
public int RowCount
{ {
get get
{ {
return (int)ViewState["RowCount"]; return (string)ViewState["ProjectId"];
} }
set set
{ {
ViewState["RowCount"] = value; ViewState["ProjectId"] = value;
} }
} }
#endregion #endregion
@ -51,14 +47,15 @@ namespace FineUIPro.Web.HSSE.SitePerson
if (!IsPostBack) if (!IsPostBack)
{ {
Funs.DropDownPageSize(this.ddlPageSize); Funs.DropDownPageSize(this.ddlPageSize);
this.ProjectId = this.CurrUser.LoginProjectId;
////权限按钮方法 ////权限按钮方法
this.GetButtonPower(); this.GetButtonPower();
btnNew.OnClientClick = Window1.GetShowReference("PersonInfoEdit.aspx") + "return false;"; btnNew.OnClientClick = Window1.GetShowReference("PersonInfoEdit.aspx") + "return false;";
this.btnMenuDelete.OnClientClick = Grid1.GetNoSelectionAlertReference("请至少选择一项!"); this.btnMenuDelete.OnClientClick = Grid1.GetNoSelectionAlertReference("请至少选择一项!");
this.btnMenuDelete.ConfirmText = String.Format("你确定要删除选中的&nbsp;<b><script>{0}</script></b>&nbsp;行数据吗?", Grid1.GetSelectedCountReference()); this.btnMenuDelete.ConfirmText = String.Format("你确定要删除选中的&nbsp;<b><script>{0}</script></b>&nbsp;行数据吗?", Grid1.GetSelectedCountReference());
ddlPageSize.SelectedValue = Grid1.PageSize.ToString(); ddlPageSize.SelectedValue = Grid1.PageSize.ToString();
UnitService.InitUnitDropDownList(this.drpUnit, this.CurrUser.LoginProjectId, true); UnitService.InitUnitDropDownList(this.drpUnit, this.ProjectId , true);
if (ProjectUnitService.GetProjectUnitTypeByProjectIdUnitId(this.CurrUser.LoginProjectId, this.CurrUser.UnitId)) if (ProjectUnitService.GetProjectUnitTypeByProjectIdUnitId(this.ProjectId , this.CurrUser.UnitId))
{ {
this.drpUnit.SelectedValue = this.CurrUser.UnitId; this.drpUnit.SelectedValue = this.CurrUser.UnitId;
this.drpUnit.Enabled = false; this.drpUnit.Enabled = false;
@ -75,48 +72,10 @@ namespace FineUIPro.Web.HSSE.SitePerson
/// </summary> /// </summary>
private void BindGrid() private void BindGrid()
{ {
string strSql = @"SELECT CheckingId,CardNo,ProjectId,IdentityCard,WorkAreaId,IntoOutTime,IntoOut,Address,WorkAreaName,PersonName,UnitId,UnitName,States var getData = SitePerson_CheckingService.getListData(this.ProjectId , this.drpUnit.SelectedValue, this.txtPersonName.Text.Trim(),
FROM dbo.View_SitePerson_Checking where 1=1 "; this.txtStartDate.Text, this.txtEndDate.Text, Grid1);
List<SqlParameter> listStr = new List<SqlParameter>(); Grid1.RecordCount = SitePerson_CheckingService.count;
strSql += " AND ProjectId = @ProjectId"; Grid1.DataSource = getData;
if (!string.IsNullOrEmpty(Request.Params["projectId"])) ///是否文件柜查看页面传项目值
{
listStr.Add(new SqlParameter("@ProjectId", Request.Params["projectId"]));
strSql += " AND States = @States"; ///状态为已完成
listStr.Add(new SqlParameter("@States", BLL.Const.State_2));
}
else
{
listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
}
if (this.drpUnit.SelectedValue != Const._Null)
{
strSql += " AND UnitId = @UnitId";
listStr.Add(new SqlParameter("@UnitId", this.drpUnit.SelectedValue));
}
if (!string.IsNullOrEmpty(this.txtPersonName.Text))
{
strSql += " AND PersonName LIKE @PersonName";
listStr.Add(new SqlParameter("@PersonName", "%" + this.txtPersonName.Text.Trim() + "%"));
}
if (!string.IsNullOrEmpty(this.txtStartDate.Text))
{
strSql += " AND IntoOutTime >= @StartDate";
listStr.Add(new SqlParameter("@StartDate", this.txtStartDate.Text.Trim()));
}
if (!string.IsNullOrEmpty(this.txtEndDate.Text))
{
strSql += " AND IntoOutTime < @EndDate";
listStr.Add(new SqlParameter("@EndDate", this.txtEndDate.Text.Trim()));
}
strSql += " order by PersonName";
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
Grid1.RecordCount = tb.Rows.Count;
this.RowCount = tb.Rows.Count;
var table = this.GetPagedDataTable(Grid1, tb);
Grid1.DataSource = table;
Grid1.DataBind(); Grid1.DataBind();
} }
#endregion #endregion
@ -330,7 +289,7 @@ namespace FineUIPro.Web.HSSE.SitePerson
{ {
return; return;
} }
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.PersonInfoMenuId); var buttonList = BLL.CommonService.GetAllButtonList(this.ProjectId , this.CurrUser.UserId, BLL.Const.PersonInfoMenuId);
if (buttonList.Count() > 0) if (buttonList.Count() > 0)
{ {
if (buttonList.Contains(BLL.Const.BtnAdd)) if (buttonList.Contains(BLL.Const.BtnAdd))
@ -362,7 +321,7 @@ namespace FineUIPro.Web.HSSE.SitePerson
Response.AddHeader("content-disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode("现场人员考勤管理" + filename, System.Text.Encoding.UTF8) + ".xls"); Response.AddHeader("content-disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode("现场人员考勤管理" + filename, System.Text.Encoding.UTF8) + ".xls");
Response.ContentType = "application/excel"; Response.ContentType = "application/excel";
Response.ContentEncoding = System.Text.Encoding.UTF8; Response.ContentEncoding = System.Text.Encoding.UTF8;
this.Grid1.PageSize = this.RowCount; this.Grid1.PageSize = this.Grid1.RecordCount;
BindGrid(); BindGrid();
Response.Write(GetGridTableHtml1(Grid1)); Response.Write(GetGridTableHtml1(Grid1));
Response.End(); Response.End();

View File

@ -248,6 +248,13 @@ namespace FineUIPro.Web.HSSE.SitePerson
if (person != null) if (person != null)
{ {
personInfo.IdentityCard = person.IdentityCard; personInfo.IdentityCard = person.IdentityCard;
personInfo.CardNo = person.CardNo;
personInfo.PersonName = person.PersonName;
personInfo.UnitId = person.UnitId;
if (!string.IsNullOrEmpty(personInfo.UnitId))
{
personInfo.UnitName = UnitService.GetUnitNameByUnitId(person.UnitId);
}
if (!string.IsNullOrEmpty(person.WorkAreaId)) if (!string.IsNullOrEmpty(person.WorkAreaId))
{ {
personInfo.WorkAreaId = person.WorkAreaId; personInfo.WorkAreaId = person.WorkAreaId;
@ -259,6 +266,7 @@ namespace FineUIPro.Web.HSSE.SitePerson
string time = string.IsNullOrEmpty(this.txtTime2.Text) ? string.Format("{0:HH:mm:ss}", DateTime.Now) : this.txtTime2.Text.Trim(); string time = string.IsNullOrEmpty(this.txtTime2.Text) ? string.Format("{0:HH:mm:ss}", DateTime.Now) : this.txtTime2.Text.Trim();
personInfo.IntoOutTime = Funs.GetNewDateTimeOrNow(date + " " + time); personInfo.IntoOutTime = Funs.GetNewDateTimeOrNow(date + " " + time);
personInfo.IntoOut = this.drpType.SelectedValue.Trim(); personInfo.IntoOut = this.drpType.SelectedValue.Trim();
if (!string.IsNullOrEmpty(CheckingId)) if (!string.IsNullOrEmpty(CheckingId))
{ {
personInfo.CheckingId = CheckingId; personInfo.CheckingId = CheckingId;
@ -273,32 +281,6 @@ namespace FineUIPro.Web.HSSE.SitePerson
BLL.LogService.AddSys_Log(this.CurrUser, personInfo.CardNo, personInfo.CheckingId, BLL.Const.PersonalInfoMenuId, BLL.Const.BtnDelete); BLL.LogService.AddSys_Log(this.CurrUser, personInfo.CardNo, personInfo.CheckingId, BLL.Const.PersonalInfoMenuId, BLL.Const.BtnDelete);
} }
} }
//Model.SitePerson_Checking personInfo = new Model.SitePerson_Checking
//{
// PersonId = this.drpPersonId.Value,
// IdentityCard = this.txtIdCard.Text,
// ProjectId = this.ProjectId,
// WorkAreaName = this.txtWorkArea.Text.Trim(),
// Address = this.txtAddress.Text.Trim()
//};
//string date = string.IsNullOrEmpty(this.txtTime.Text) ? string.Format("{0:yyyy-MM-dd}", DateTime.Now) : this.txtTime.Text.Trim();
//string time = string.IsNullOrEmpty(this.txtTime2.Text) ? string.Format("{0:HH:mm:ss}", DateTime.Now) : this.txtTime2.Text.Trim();
//personInfo.IntoOutTime = Funs.GetNewDateTimeOrNow(date + " " + time);
//personInfo.IntoOut = this.drpType.SelectedValue.Trim();
//if (!string.IsNullOrEmpty(CheckingId))
//{
// personInfo.CheckingId = CheckingId;
// BLL.SitePerson_CheckingService.UpdatePersonInfo(personInfo);
// BLL.LogService.AddSys_Log(this.CurrUser, personInfo.CardNo, personInfo.CheckingId, BLL.Const.PersonalInfoMenuId, BLL.Const.BtnModify);
//}
//else
//{
// this.CheckingId = SQLHelper.GetNewID();
// personInfo.CheckingId = this.CheckingId;
// BLL.SitePerson_CheckingService.AddPersonInfo(personInfo);
// BLL.LogService.AddSys_Log(this.CurrUser, personInfo.CardNo, personInfo.CheckingId, BLL.Const.PersonalInfoMenuId, BLL.Const.BtnDelete);
//}
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
} }
#endregion #endregion

View File

@ -17,16 +17,16 @@
<f:Toolbar ID="Toolbar2" Position="Top" ToolbarAlign="Right" runat="server"> <f:Toolbar ID="Toolbar2" Position="Top" ToolbarAlign="Right" runat="server">
<Items> <Items>
<f:ToolbarFill ID="ToolbarFill1" runat="server"></f:ToolbarFill> <f:ToolbarFill ID="ToolbarFill1" runat="server"></f:ToolbarFill>
<f:Button ID="btnAudit" Icon="ApplicationEdit" runat="server" ToolTip="审核" ValidateForms="SimpleForm1" <f:Button ID="btnAudit" Icon="ApplicationEdit" runat="server" Text="审核" ValidateForms="SimpleForm1"
OnClick="btnAudit_Click"> OnClick="btnAudit_Click">
</f:Button> </f:Button>
<f:Button ID="btnImport" Icon="ApplicationGet" runat="server" ToolTip="导入" ValidateForms="SimpleForm1" <f:Button ID="btnImport" Icon="ApplicationGet" runat="server" Text="导入并保存" ValidateForms="SimpleForm1"
OnClick="btnImport_Click"> OnClick="btnImport_Click">
</f:Button> </f:Button>
<f:Button ID="btnSave" Icon="SystemSave" runat="server" ToolTip="保存" ValidateForms="SimpleForm1" <f:Button ID="btnSave" Icon="SystemSave" runat="server" ToolTip="保存" ValidateForms="SimpleForm1"
OnClick="btnSave_Click"> OnClick="btnSave_Click" Hidden="true">
</f:Button> </f:Button>
<f:Button ID="btnDownLoad" runat="server" Icon="ApplicationGo" ToolTip="下载模板" OnClick="btnDownLoad_Click"> <f:Button ID="btnDownLoad" runat="server" Icon="ApplicationGo" Text="下载模板" OnClick="btnDownLoad_Click">
</f:Button> </f:Button>
</Items> </Items>
</f:Toolbar> </f:Toolbar>

View File

@ -324,8 +324,11 @@ namespace FineUIPro.Web.HSSE.SitePerson
oleAdMaster.Dispose(); oleAdMaster.Dispose();
oleDBConn.Close(); oleDBConn.Close();
oleDBConn.Dispose(); oleDBConn.Dispose();
var isok = AddDatasetToSQL2(ds.Tables[0]);
AddDatasetToSQL2(ds.Tables[0]); if (isok)
{
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -333,10 +336,10 @@ namespace FineUIPro.Web.HSSE.SitePerson
} }
} }
#endregion #endregion
/// <summary> ///// <summary>
/// 人员考勤集合 ///// 人员考勤集合
/// </summary> ///// </summary>
public static List<Model.View_SitePerson_Checking> viewCheckings = new List<Model.View_SitePerson_Checking>(); //public static List<Model.View_SitePerson_Checking> viewCheckings = new List<Model.View_SitePerson_Checking>();
#region Dataset的数据导入数据库 #region Dataset的数据导入数据库
/// <summary> /// <summary>
@ -347,7 +350,7 @@ namespace FineUIPro.Web.HSSE.SitePerson
/// <returns></returns> /// <returns></returns>
private bool AddDatasetToSQL2(DataTable pds) private bool AddDatasetToSQL2(DataTable pds)
{ {
viewCheckings.Clear(); List<Model.SitePerson_Checking> newCheckings = new List<Model.SitePerson_Checking>();
int ir = pds.Rows.Count; int ir = pds.Rows.Count;
if (pds != null && ir > 0) if (pds != null && ir > 0)
{ {
@ -363,7 +366,7 @@ namespace FineUIPro.Web.HSSE.SitePerson
string col4 = pds.Rows[i][4].ToString().Trim(); string col4 = pds.Rows[i][4].ToString().Trim();
if (!string.IsNullOrEmpty(col2) && !string.IsNullOrEmpty(col3) && !string.IsNullOrEmpty(col4)) if (!string.IsNullOrEmpty(col2) && !string.IsNullOrEmpty(col3) && !string.IsNullOrEmpty(col4))
{ {
Model.View_SitePerson_Checking checking = new Model.View_SitePerson_Checking Model.SitePerson_Checking newChecking = new Model.SitePerson_Checking
{ {
UnitName = col0, UnitName = col0,
PersonName = col1, PersonName = col1,
@ -371,27 +374,47 @@ namespace FineUIPro.Web.HSSE.SitePerson
IntoOut = col3 == "进" ? "1" : "0", IntoOut = col3 == "进" ? "1" : "0",
IntoOutTime = Convert.ToDateTime(col4) IntoOutTime = Convert.ToDateTime(col4)
}; };
var person = sitePersons.FirstOrDefault(x => x.IdentityCard == checking.IdentityCard);
var person = sitePersons.FirstOrDefault(x => x.IdentityCard == newChecking.IdentityCard);
if (person != null) if (person != null)
{ {
checking.PersonId = person.PersonId; newChecking.ProjectId = person.ProjectId;
checking.ProjectId = person.ProjectId; newChecking.UnitId = person.UnitId;
checking.CheckingId = SQLHelper.GetNewID(); newChecking.PersonId = person.PersonId;
viewCheckings.Add(checking); newChecking.CardNo = person.CardNo;
newChecking.PersonName = person.PersonName;
newChecking.WorkAreaId = person.WorkAreaId;
if (!string.IsNullOrEmpty(person.WorkAreaId))
{
newChecking.WorkAreaName = UnitWorkService.GetUnitWorkName(person.WorkAreaId);
}
newChecking.CheckingId = SQLHelper.GetNewID();
newCheckings.Add(newChecking);
BLL.SitePerson_CheckingService.AddPersonInfo(newChecking);
} }
} }
} }
if (viewCheckings.Count > 0) if (newCheckings.Count > 0)
{ {
this.Grid1.Hidden = false; this.Grid1.Hidden = false;
this.Grid1.DataSource = viewCheckings; this.Grid1.DataSource = newCheckings;
this.Grid1.DataBind(); this.Grid1.DataBind();
ShowNotify("导入成功!", MessageBoxIcon.Success);
} }
} }
else else
{ {
ShowNotify("导入数据为空!", MessageBoxIcon.Warning); ShowNotify("导入数据为空!", MessageBoxIcon.Warning);
} }
string rootPath = Server.MapPath("~/");
string initFullPath = rootPath + initPath;
string filePath = initFullPath + this.hdFileName.Text;
if (filePath != string.Empty && System.IO.File.Exists(filePath))
{
File.Delete(filePath);//删除上传的XLS文件
}
return true; return true;
} }
#endregion #endregion
@ -405,53 +428,39 @@ namespace FineUIPro.Web.HSSE.SitePerson
/// <param name="e"></param> /// <param name="e"></param>
protected void btnSave_Click(object sender, EventArgs e) protected void btnSave_Click(object sender, EventArgs e)
{ {
if (string.IsNullOrEmpty(errorInfos)) //if (string.IsNullOrEmpty(errorInfos))
{ //{
foreach (var item in viewCheckings) // foreach (var item in viewCheckings)
{ // {
var getCheck = Funs.DB.SitePerson_Checking.FirstOrDefault(x => x.CheckingId == item.CheckingId); // var getCheck = Funs.DB.SitePerson_Checking.FirstOrDefault(x => x.CheckingId == item.CheckingId);
if (getCheck == null) // if (getCheck == null)
{ // {
Model.SitePerson_Checking newChecking = new Model.SitePerson_Checking // Model.SitePerson_Checking newChecking = new Model.SitePerson_Checking
{ // {
CheckingId = item.CheckingId, // CheckingId = item.CheckingId,
ProjectId = item.ProjectId, // ProjectId = item.ProjectId,
IdentityCard = item.IdentityCard, // IdentityCard = item.IdentityCard,
IntoOutTime = item.IntoOutTime, // IntoOutTime = item.IntoOutTime,
IntoOut = item.IntoOut, // IntoOut = item.IntoOut,
PersonId = item.PersonId // PersonId = item.PersonId
}; // };
BLL.SitePerson_CheckingService.AddPersonInfo(newChecking); // BLL.SitePerson_CheckingService.AddPersonInfo(newChecking);
} // }
} // }
//int a = viewCheckings.Count(); // string rootPath = Server.MapPath("~/");
//for (int i = 0; i < a; i++) // string initFullPath = rootPath + initPath;
//{ // string filePath = initFullPath + this.hdFileName.Text;
// Model.SitePerson_Checking newChecking = new Model.SitePerson_Checking // if (filePath != string.Empty && System.IO.File.Exists(filePath))
// { // {
// CheckingId = viewCheckings[i].CheckingId, // File.Delete(filePath);//删除上传的XLS文件
// ProjectId = viewCheckings[i].ProjectId, // }
// IdentityCard = viewCheckings[i].IdentityCard, // ShowNotify("导入成功!", MessageBoxIcon.Success);
// IntoOutTime = viewCheckings[i].IntoOutTime, // PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
// IntoOut = viewCheckings[i].IntoOut, //}
// PersonId = viewCheckings[i].PersonId //else
// }; //{
// BLL.SitePerson_CheckingService.AddPersonInfo(newChecking); // Alert.ShowInTop("请先将错误数据修正,再重新导入保存!", MessageBoxIcon.Warning);
//} //}
string rootPath = Server.MapPath("~/");
string initFullPath = rootPath + initPath;
string filePath = initFullPath + this.hdFileName.Text;
if (filePath != string.Empty && System.IO.File.Exists(filePath))
{
File.Delete(filePath);//删除上传的XLS文件
}
ShowNotify("导入成功!", MessageBoxIcon.Success);
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
else
{
Alert.ShowInTop("请先将错误数据修正,再重新导入保存!", MessageBoxIcon.Warning);
}
} }
#endregion #endregion

View File

@ -118,9 +118,16 @@
private string btnLogin_Click(string user, string pwd) private string btnLogin_Click(string user, string pwd)
{ {
string url = ""; string url = "";
if (LoginService.UserLogOn(user, pwd, true, this.Page)) try
{ {
url = getUrl(); if (LoginService.UserLogOn(user, pwd, true, this.Page))
{
url = getUrl();
}
}
catch (Exception ex)
{
ErrLogInfo.WriteLog("登陆错误:" + ex.Message);
} }
return url; return url;

View File

@ -270,8 +270,8 @@ namespace FineUIPro.Web.ZHGL.RealName
{ {
foreach (var item in getList) foreach (var item in getList)
{ {
message += ("项目" + getRProjects.ProCode + "新增" + BLL.SynchroSetService.PushPersonsByIdentityCard(Const.BtnAdd, getRProjects.ProCode, item) ?? ""); message += ("项目" + getRProjects.ProCode + "新增" + BLL.SynchroSetService.PushPersonsByIdentityCard(Const.BtnAdd, getRProjects.ProCode, item, true) ?? "");
message += ("|更新" + BLL.SynchroSetService.PushPersonsByIdentityCard(Const.BtnModify, getRProjects.ProCode, item) ?? ""); message += ("|更新" + BLL.SynchroSetService.PushPersonsByIdentityCard(Const.BtnModify, getRProjects.ProCode, item, true) ?? "");
} }
ShowNotify(message, MessageBoxIcon.Information); ShowNotify(message, MessageBoxIcon.Information);
} }
@ -432,7 +432,7 @@ namespace FineUIPro.Web.ZHGL.RealName
select x.IdentityCard).Take(500); select x.IdentityCard).Take(500);
foreach (var item in getIdentityCards) foreach (var item in getIdentityCards)
{ {
string mes = BLL.SynchroSetService.PushPersonsByIdentityCard(Const.BtnAdd, getRProjects.ProCode, item) ?? ""; string mes = BLL.SynchroSetService.PushPersonsByIdentityCard(Const.BtnAdd, getRProjects.ProCode, item, true) ?? "";
if (mes.Contains("不合法")) if (mes.Contains("不合法"))
{ {
message += ("身份证号码" + item + "新增失败" + mes); message += ("身份证号码" + item + "新增失败" + mes);
@ -482,7 +482,7 @@ namespace FineUIPro.Web.ZHGL.RealName
select x.IdentityCard).Take(100); select x.IdentityCard).Take(100);
foreach (var item in getIdentityCards) foreach (var item in getIdentityCards)
{ {
string mes = BLL.SynchroSetService.PushPersonsByIdentityCard(Const.BtnModify, getRProjects.ProCode, item) ?? ""; string mes = BLL.SynchroSetService.PushPersonsByIdentityCard(Const.BtnModify, getRProjects.ProCode, item, true) ?? "";
if (mes.Contains("不合法")) if (mes.Contains("不合法"))
{ {
message += ("身份证号码" + item + "更新失败" + mes); message += ("身份证号码" + item + "更新失败" + mes);

View File

@ -252938,6 +252938,12 @@ namespace Model
private string _WorkAreaName; private string _WorkAreaName;
private string _UnitId;
private string _UnitName;
private string _PersonName;
private EntityRef<Base_Project> _Base_Project; private EntityRef<Base_Project> _Base_Project;
private EntityRef<SitePerson_Person> _SitePerson_Person; private EntityRef<SitePerson_Person> _SitePerson_Person;
@ -252968,6 +252974,12 @@ namespace Model
partial void OnPersonIdChanged(); partial void OnPersonIdChanged();
partial void OnWorkAreaNameChanging(string value); partial void OnWorkAreaNameChanging(string value);
partial void OnWorkAreaNameChanged(); partial void OnWorkAreaNameChanged();
partial void OnUnitIdChanging(string value);
partial void OnUnitIdChanged();
partial void OnUnitNameChanging(string value);
partial void OnUnitNameChanged();
partial void OnPersonNameChanging(string value);
partial void OnPersonNameChanged();
#endregion #endregion
public SitePerson_Checking() public SitePerson_Checking()
@ -253205,6 +253217,66 @@ namespace Model
} }
} }
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UnitId", DbType="NVarChar(50)")]
public string UnitId
{
get
{
return this._UnitId;
}
set
{
if ((this._UnitId != value))
{
this.OnUnitIdChanging(value);
this.SendPropertyChanging();
this._UnitId = value;
this.SendPropertyChanged("UnitId");
this.OnUnitIdChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UnitName", DbType="NVarChar(500)")]
public string UnitName
{
get
{
return this._UnitName;
}
set
{
if ((this._UnitName != value))
{
this.OnUnitNameChanging(value);
this.SendPropertyChanging();
this._UnitName = value;
this.SendPropertyChanged("UnitName");
this.OnUnitNameChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PersonName", DbType="NVarChar(50)")]
public string PersonName
{
get
{
return this._PersonName;
}
set
{
if ((this._PersonName != value))
{
this.OnPersonNameChanging(value);
this.SendPropertyChanging();
this._PersonName = value;
this.SendPropertyChanged("PersonName");
this.OnPersonNameChanged();
}
}
}
[global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_SitePerson_Checking_Base_Project", Storage="_Base_Project", ThisKey="ProjectId", OtherKey="ProjectId", IsForeignKey=true)] [global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_SitePerson_Checking_Base_Project", Storage="_Base_Project", ThisKey="ProjectId", OtherKey="ProjectId", IsForeignKey=true)]
public Base_Project Base_Project public Base_Project Base_Project
{ {