This commit is contained in:
杨红卫 2021-07-26 11:08:59 +08:00
parent 7700a66999
commit 16bd4f1767
18 changed files with 1180 additions and 216 deletions

View File

@ -0,0 +1,26 @@
ALTER VIEW [dbo].[View_SitePerson_Checking]
AS
/*人员考勤视图*/
SELECT ch.CheckingId
,person.CardNo
,ch.PersonId
,ch.ProjectId
,person.IdentityCard
,ch.WorkAreaId
,ch.IntoOutTime
,ch.IntoOut
,ch.[Address]
,ch.WorkAreaName
,person.PersonName
,person.UnitId
,unit.UnitName
,ch.States
from dbo.SitePerson_Checking ch
left join dbo.SitePerson_Person person on ch.PersonId=person.PersonId
left join dbo.Base_Unit unit on person.UnitId=unit.UnitId
GO

View File

@ -2761,6 +2761,11 @@ namespace BLL
/// 人工时月报模版文件原始的虚拟路径
/// </summary>
public const string MonthReportTemplateUrl = "File\\Excel\\DataIn\\人工时月报模板.xls";
/// <summary>
/// 现场人员考勤导入模版
/// </summary>
public const string PersonInfoTemplateUrl = "File\\Excel\\DataIn\\现场人员考勤导入模版.xls";
/// <summary>
/// 百万工时安全统计月报表模板文件原始虚拟路径
/// </summary>

Binary file not shown.

After

Width:  |  Height:  |  Size: 589 KiB

View File

@ -1013,6 +1013,7 @@
<Content Include="HSSE\SitePerson\PersonIn.aspx" />
<Content Include="HSSE\SitePerson\PersonInfo.aspx" />
<Content Include="HSSE\SitePerson\PersonInfoEdit.aspx" />
<Content Include="HSSE\SitePerson\PersonInfoIn.aspx" />
<Content Include="HSSE\SitePerson\PersonList.aspx" />
<Content Include="HSSE\SitePerson\PersonListEdit.aspx" />
<Content Include="HSSE\SitePerson\PersonOut.aspx" />
@ -11272,6 +11273,13 @@
<Compile Include="HSSE\SitePerson\PersonInfoEdit.aspx.designer.cs">
<DependentUpon>PersonInfoEdit.aspx</DependentUpon>
</Compile>
<Compile Include="HSSE\SitePerson\PersonInfoIn.aspx.cs">
<DependentUpon>PersonInfoIn.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="HSSE\SitePerson\PersonInfoIn.aspx.designer.cs">
<DependentUpon>PersonInfoIn.aspx</DependentUpon>
</Compile>
<Compile Include="HSSE\SitePerson\PersonList.aspx.cs">
<DependentUpon>PersonList.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>

View File

@ -8,111 +8,119 @@
</head>
<body>
<form id="form1" runat="server">
<f:PageManager ID="PageManager1" AutoSizePanelID="Panel1" runat="server" />
<f:Panel ID="Panel1" runat="server" Margin="5px" BodyPadding="5px" ShowBorder="false"
ShowHeader="false" Layout="VBox" BoxConfigAlign="Stretch">
<Items>
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" Title="现场人员考勤管理" EnableCollapse="true"
runat="server" BoxFlex="1" DataKeyNames="CheckingId" DataIDField="CheckingId" AllowSorting="true" SortField="IntoOutTime"
SortDirection="DESC" OnSort="Grid1_Sort" AllowPaging="true" IsDatabasePaging="true" ForceFit="true"
PageSize="10" OnPageIndexChange="Grid1_PageIndexChange" EnableColumnLines="true" EnableTextSelection="True"
OnRowDoubleClick="Grid1_RowDoubleClick" EnableRowDoubleClickEvent="True">
<Toolbars>
<f:Toolbar ID="Toolbar2" Position="Top" runat="server">
<Items>
<f:PageManager ID="PageManager1" AutoSizePanelID="Panel1" runat="server" />
<f:Panel ID="Panel1" runat="server" Margin="5px" BodyPadding="5px" ShowBorder="false"
ShowHeader="false" Layout="VBox" BoxConfigAlign="Stretch">
<Items>
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" Title="现场人员考勤管理" EnableCollapse="true"
runat="server" BoxFlex="1" DataKeyNames="CheckingId" DataIDField="CheckingId" AllowSorting="true" SortField="IntoOutTime"
SortDirection="DESC" OnSort="Grid1_Sort" AllowPaging="true" IsDatabasePaging="true" ForceFit="true"
PageSize="10" OnPageIndexChange="Grid1_PageIndexChange" EnableColumnLines="true" EnableTextSelection="True"
OnRowDoubleClick="Grid1_RowDoubleClick" EnableRowDoubleClickEvent="True">
<Toolbars>
<f:Toolbar ID="Toolbar2" Position="Top" runat="server">
<Items>
<f:DropDownList runat="server" ID="drpUnit" Label="单位"
Width="300px" LabelAlign="Right" LabelWidth="50px"></f:DropDownList>
<f:TextBox runat="server" Label="姓名" ID="txtPersonName" EmptyText="输入查询条件"
Width="200px" LabelWidth="50px" LabelAlign="right">
</f:TextBox>
<f:DatePicker runat="server" Label="时间" ID="txtStartDate" EnableEdit="true" LabelWidth="60px" Width="180px"
LabelAlign="Right">
</f:DatePicker>
<f:DatePicker runat="server" Label="至" ID="txtEndDate" EnableEdit="true" LabelWidth="40px" Width="180px"
LabelAlign="Right">
</f:DatePicker>
<f:ToolbarFill ID="ToolbarFill1" runat="server">
</f:ToolbarFill>
<f:Button ID="btSearch" ToolTip="查询" Icon="SystemSearch" runat="server" OnClick="btSearch_Click"></f:Button>
<f:Button ID="btnNew" ToolTip="增加" Icon="Add" runat="server" Hidden="true">
</f:Button>
<f:Button ID="btnOut" OnClick="btnOut_Click" runat="server" ToolTip="导出" Icon="FolderUp"
EnableAjax="false" DisableControlBeforePostBack="false">
</f:Button>
</Items>
</f:Toolbar>
</Toolbars>
<Columns>
<f:TemplateField ColumnID="tfNumber" HeaderText="序号" Width="90px" HeaderTextAlign="Center" TextAlign="Center">
<ItemTemplate>
<asp:Label ID="labNumber" runat="server" Text=' <%# Grid1.PageIndex * Grid1.PageSize + Container.DataItemIndex + 1%>'></asp:Label>
</ItemTemplate>
</f:TemplateField>
<f:RenderField Width="250px" ColumnID="UnitName" DataField="UnitName" SortField="UnitName"
FieldType="String" HeaderText="单位名称" HeaderTextAlign="Center"
TextAlign="Left">
</f:RenderField>
<f:RenderField Width="100px" ColumnID="PersonName" DataField="PersonName" SortField="PersonName"
FieldType="String" HeaderText="人员姓名" HeaderTextAlign="Center"
TextAlign="Left">
</f:RenderField>
<f:TemplateField ColumnID="tfIntoOut" Width="80px" HeaderText="进出" HeaderTextAlign="Center" TextAlign="Center">
<ItemTemplate>
<asp:Label ID="lblIntoOut" runat="server" Text='<%# ConvertIntoOut(Eval("IntoOut")) %>'
ToolTip='<%#ConvertIntoOut(Eval("IntoOut")) %>'></asp:Label>
</ItemTemplate>
</f:TemplateField>
<f:RenderField Width="160px" ColumnID="IntoOutTime" DataField="IntoOutTime" SortField="IntoOutTime"
HeaderText="出入现场时间" HeaderTextAlign="Center" TextAlign="Center">
</f:RenderField>
<%-- <f:TemplateField ColumnID="tfAddress" Width="130px" HeaderText="进出地点" HeaderTextAlign="Center" TextAlign="Left">
Width="300px" LabelAlign="Right" LabelWidth="50px">
</f:DropDownList>
<f:TextBox runat="server" Label="姓名" ID="txtPersonName" EmptyText="输入查询条件"
Width="200px" LabelWidth="50px" LabelAlign="right">
</f:TextBox>
<f:DatePicker runat="server" Label="时间" ID="txtStartDate" EnableEdit="true" LabelWidth="60px" Width="180px"
LabelAlign="Right">
</f:DatePicker>
<f:DatePicker runat="server" Label="至" ID="txtEndDate" EnableEdit="true" LabelWidth="40px" Width="180px"
LabelAlign="Right">
</f:DatePicker>
<f:ToolbarFill ID="ToolbarFill1" runat="server">
</f:ToolbarFill>
<f:Button ID="btSearch" ToolTip="查询" Icon="SystemSearch" runat="server" OnClick="btSearch_Click"></f:Button>
<f:Button ID="btnNew" ToolTip="增加" Icon="Add" runat="server" Hidden="true">
</f:Button>
<f:Button ID="btnImport" ToolTip="导入" Icon="ApplicationGet" Hidden="true" runat="server"
OnClick="btnImport_Click">
</f:Button>
<f:Button ID="btnOut" OnClick="btnOut_Click" runat="server" ToolTip="导出" Icon="FolderUp"
EnableAjax="false" DisableControlBeforePostBack="false">
</f:Button>
</Items>
</f:Toolbar>
</Toolbars>
<Columns>
<f:TemplateField ColumnID="tfNumber" HeaderText="序号" Width="90px" HeaderTextAlign="Center" TextAlign="Center">
<ItemTemplate>
<asp:Label ID="labNumber" runat="server" Text=' <%# Grid1.PageIndex * Grid1.PageSize + Container.DataItemIndex + 1%>'></asp:Label>
</ItemTemplate>
</f:TemplateField>
<f:RenderField Width="250px" ColumnID="UnitName" DataField="UnitName" SortField="UnitName"
FieldType="String" HeaderText="单位名称" HeaderTextAlign="Center"
TextAlign="Left">
</f:RenderField>
<f:RenderField Width="100px" ColumnID="PersonName" DataField="PersonName" SortField="PersonName"
FieldType="String" HeaderText="人员姓名" HeaderTextAlign="Center"
TextAlign="Left">
</f:RenderField>
<f:TemplateField ColumnID="tfIntoOut" Width="80px" HeaderText="进出" HeaderTextAlign="Center" TextAlign="Center">
<ItemTemplate>
<asp:Label ID="lblIntoOut" runat="server" Text='<%# ConvertIntoOut(Eval("IntoOut")) %>'
ToolTip='<%#ConvertIntoOut(Eval("IntoOut")) %>'></asp:Label>
</ItemTemplate>
</f:TemplateField>
<f:RenderField Width="160px" ColumnID="IntoOutTime" DataField="IntoOutTime" SortField="IntoOutTime"
HeaderText="出入现场时间" HeaderTextAlign="Center" TextAlign="Center">
</f:RenderField>
<%-- <f:TemplateField ColumnID="tfAddress" Width="130px" HeaderText="进出地点" HeaderTextAlign="Center" TextAlign="Left">
<ItemTemplate>
<asp:Label ID="lblAddress" runat="server" Text='<%# Bind("Address") %>' ToolTip='<%#Bind("Address") %>'></asp:Label>
</ItemTemplate>
</f:TemplateField>--%>
<f:TemplateField ColumnID="tfWorkAreaName" Width="120px" HeaderText="单位工程" HeaderTextAlign="Center" TextAlign="Left">
<ItemTemplate>
<asp:Label ID="lblWorkAreaName" runat="server" Text='<%# Bind("WorkAreaName") %>' ToolTip='<%#Bind("WorkAreaName") %>'></asp:Label>
</ItemTemplate>
</f:TemplateField>
<f:RenderField Width="100px" ColumnID="CardNo" DataField="CardNo" SortField="CardNo"
FieldType="String" HeaderText="卡号" HeaderTextAlign="Center"
TextAlign="Center">
</f:RenderField>
<f:TemplateField ColumnID="tfIdentityCard" Width="180px" HeaderText="身份证号" HeaderTextAlign="Center" TextAlign="Right">
<ItemTemplate>
<asp:Label ID="lblIdentityCard" runat="server" Text='<%# Bind("IdentityCard") %>' ToolTip='<%#Bind("IdentityCard") %>'></asp:Label>
</ItemTemplate>
</f:TemplateField>
</Columns>
<Listeners>
<f:Listener Event="dataload" Handler="onGridDataLoad" />
<f:Listener Event="beforerowcontextmenu" Handler="onRowContextMenu" />
</Listeners>
<PageItems>
<f:ToolbarSeparator ID="ToolbarSeparator1" runat="server">
</f:ToolbarSeparator>
<f:ToolbarText ID="ToolbarText1" runat="server" Text="每页记录数:">
</f:ToolbarText>
<f:DropDownList runat="server" ID="ddlPageSize" Width="80px" AutoPostBack="true"
OnSelectedIndexChanged="ddlPageSize_SelectedIndexChanged">
</f:DropDownList>
</PageItems>
</f:Grid>
</Items>
</f:Panel>
<f:Window ID="Window1" Title="编辑考勤" Hidden="true" EnableIFrame="true" EnableMaximize="true"
Target="Parent" EnableResize="false" runat="server" OnClose="Window1_Close" IsModal="true"
Width="950px" Height="450px">
</f:Window>
<f:Menu ID="Menu1" runat="server">
<f:MenuButton ID="btnMenuEdit" OnClick="btnMenuEdit_Click" EnablePostBack="true"
Hidden="true" Icon="Pencil" runat="server" Text="编辑">
</f:MenuButton>
<f:MenuButton ID="btnMenuDelete" OnClick="btnMenuDelete_Click" EnablePostBack="true"
Hidden="true" Icon="Delete" runat="server" Text="删除">
</f:MenuButton>
</f:Menu>
<f:TemplateField ColumnID="tfWorkAreaName" Width="120px" HeaderText="单位工程" HeaderTextAlign="Center" TextAlign="Left">
<ItemTemplate>
<asp:Label ID="lblWorkAreaName" runat="server" Text='<%# Bind("WorkAreaName") %>' ToolTip='<%#Bind("WorkAreaName") %>'></asp:Label>
</ItemTemplate>
</f:TemplateField>
<f:RenderField Width="100px" ColumnID="CardNo" DataField="CardNo" SortField="CardNo"
FieldType="String" HeaderText="卡号" HeaderTextAlign="Center"
TextAlign="Center">
</f:RenderField>
<f:TemplateField ColumnID="tfIdentityCard" Width="180px" HeaderText="身份证号" HeaderTextAlign="Center" TextAlign="Right">
<ItemTemplate>
<asp:Label ID="lblIdentityCard" runat="server" Text='<%# Bind("IdentityCard") %>' ToolTip='<%#Bind("IdentityCard") %>'></asp:Label>
</ItemTemplate>
</f:TemplateField>
</Columns>
<Listeners>
<f:Listener Event="dataload" Handler="onGridDataLoad" />
<f:Listener Event="beforerowcontextmenu" Handler="onRowContextMenu" />
</Listeners>
<PageItems>
<f:ToolbarSeparator ID="ToolbarSeparator1" runat="server">
</f:ToolbarSeparator>
<f:ToolbarText ID="ToolbarText1" runat="server" Text="每页记录数:">
</f:ToolbarText>
<f:DropDownList runat="server" ID="ddlPageSize" Width="80px" AutoPostBack="true"
OnSelectedIndexChanged="ddlPageSize_SelectedIndexChanged">
</f:DropDownList>
</PageItems>
</f:Grid>
</Items>
</f:Panel>
<f:Window ID="Window1" Title="编辑考勤" Hidden="true" EnableIFrame="true" EnableMaximize="true"
Target="Parent" EnableResize="false" runat="server" OnClose="Window1_Close" IsModal="true"
Width="950px" Height="450px">
</f:Window>
<f:Window ID="Window2" Title="导入考勤" Hidden="true" EnableIFrame="true" EnableMaximize="true"
Target="Parent" EnableResize="false" runat="server" OnClose="Window1_Close" IsModal="true"
Width="1200px" Height="600px">
</f:Window>
<f:Menu ID="Menu1" runat="server">
<f:MenuButton ID="btnMenuEdit" OnClick="btnMenuEdit_Click" EnablePostBack="true"
Hidden="true" Icon="Pencil" runat="server" Text="编辑">
</f:MenuButton>
<f:MenuButton ID="btnMenuDelete" OnClick="btnMenuDelete_Click" EnablePostBack="true"
Hidden="true" Icon="Delete" runat="server" Text="删除">
</f:MenuButton>
</f:Menu>
</form>
<script type="text/javascript">
var menuID = '<%= Menu1.ClientID %>';
@ -127,7 +135,7 @@
}
function onGridDataLoad(event) {
this.mergeColumns(['UnitName']);
this.mergeColumns(['UnitName']);
}
</script>
</body>

View File

@ -336,6 +336,7 @@ namespace FineUIPro.Web.HSSE.SitePerson
if (buttonList.Contains(BLL.Const.BtnAdd))
{
this.btnNew.Hidden = false;
this.btnImport.Hidden = false;
}
if (buttonList.Contains(BLL.Const.BtnModify))
{
@ -426,5 +427,15 @@ namespace FineUIPro.Web.HSSE.SitePerson
{
BindGrid();
}
/// <summary>
/// 导入
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnImport_Click(object sender, EventArgs e)
{
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("PersonInfoIn.aspx", "导入 - ")));
}
}
}

View File

@ -120,6 +120,15 @@ namespace FineUIPro.Web.HSSE.SitePerson {
/// </remarks>
protected global::FineUIPro.Button btnNew;
/// <summary>
/// btnImport 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnImport;
/// <summary>
/// btnOut 控件。
/// </summary>
@ -201,6 +210,15 @@ namespace FineUIPro.Web.HSSE.SitePerson {
/// </remarks>
protected global::FineUIPro.Window Window1;
/// <summary>
/// Window2 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Window Window2;
/// <summary>
/// Menu1 控件。
/// </summary>

View File

@ -5,36 +5,36 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>编辑现场考勤人员考勤信息</title>
<link href="~/res/css/common.css" rel="stylesheet" type="text/css" />
<link href="~/res/css/common.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<f:PageManager ID="PageManager1" AutoSizePanelID="SimpleForm1" runat="server" />
<f:Form ID="SimpleForm1" ShowBorder="false" ShowHeader="false" AutoScroll="true"
BodyPadding="10px" runat="server" RedStarPosition="BeforeText" LabelAlign="Right">
<Rows>
<f:FormRow>
<Items>
<f:Label ID="Label1" runat="server">
</f:Label>
<f:RadioButtonList ID="rblCheck" runat="server" AutoPostBack="true" OnSelectedIndexChanged="rblCheck_SelectedIndexChanged">
<f:RadioItem Value="手动" Text="手动" Selected="true" />
<f:RadioItem Value="自动" Text="自动" />
</f:RadioButtonList>
<f:Label ID="Label2" runat="server">
</f:Label>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:DropDownBox runat="server" ID="drpPersonId" Label="人员姓名" EmptyText="请从下拉表格中选择"
<f:PageManager ID="PageManager1" AutoSizePanelID="SimpleForm1" runat="server" />
<f:Form ID="SimpleForm1" ShowBorder="false" ShowHeader="false" AutoScroll="true"
BodyPadding="10px" runat="server" RedStarPosition="BeforeText" LabelAlign="Right">
<Rows>
<f:FormRow>
<Items>
<f:Label ID="Label1" runat="server">
</f:Label>
<f:RadioButtonList ID="rblCheck" runat="server" AutoPostBack="true" OnSelectedIndexChanged="rblCheck_SelectedIndexChanged">
<f:RadioItem Value="手动" Text="手动" Selected="true" />
<f:RadioItem Value="自动" Text="自动" />
</f:RadioButtonList>
<f:Label ID="Label2" runat="server">
</f:Label>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<%--<f:DropDownBox runat="server" ID="drpPersonId" Label="人员姓名" EmptyText="请从下拉表格中选择"
MatchFieldWidth="false" LabelAlign="Right" AutoPostBack="true" OnTextChanged="drpPersonId_TextChanged"
EnableMultiSelect="false" Required="true" ShowRedStar="true" >
<PopPanel>
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" runat="server" DataIDField="PersonId"
DataTextField="PersonName" DataKeyNames="PersonId" AllowSorting="true" SortField="CardNo"
SortDirection="ASC" EnableColumnLines="true" Hidden="true" Width="900px" PageSize="10000"
Height="300px" EnableMultiSelect="false">
Height="300px" EnableMultiSelect="false" EnableCheckBoxSelect="true">
<Toolbars>
<f:Toolbar ID="Toolbar2" Position="Top" runat="server">
<Items>
@ -69,57 +69,100 @@
</Columns>
</f:Grid>
</PopPanel>
</f:DropDownBox>
<f:TextBox ID="txtIdCard" Label="身份证号码" Readonly="true" runat="server" ></f:TextBox>
</Items>
</f:FormRow>
<f:FormRow ColumnWidths="40% 25% 35%">
<Items>
<f:TextBox ID="txtWorkArea" runat="server" Label="单位工程" MaxLength="100" LabelAlign="Right">
</f:TextBox>
<f:DropDownList ID="drpWorkArea" runat="server" AutoPostBack="true" OnSelectedIndexChanged="drpWorkArea_SelectedIndexChanged">
</f:DropDownList>
<f:Label ID="Label4" runat="server" Text="说明:检查区域可从下拉框选择也可手动编辑。" CssClass="lab" MarginLeft="5px">
</f:Label>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:TextBox ID="txtAddress" runat="server" Label="进出地点" MaxLength="50" LabelAlign="Right">
</f:TextBox>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<%--<f:Label ID="Label3" runat="server">
</f:Label>--%>
<f:DropDownList ID="drpType" runat="server" Label="进出时间">
<f:ListItem Value="1" Text="入场时间" />
<f:ListItem Value="0" Text="出场时间" />
</f:DropDownList>
<f:DatePicker ID="txtTime" runat="server" >
</f:DatePicker>
<f:TextBox ID="txtTime2" runat="server">
</f:TextBox>
</Items>
</f:FormRow>
</Rows>
<Toolbars>
<f:Toolbar ID="Toolbar1" Position="Bottom" ToolbarAlign="Right" runat="server">
<Items>
<f:Button ID="btnSave" Icon="SystemSave" runat="server" ToolTip="保存" ValidateForms="SimpleForm1"
OnClick="btnSave_Click">
</f:Button>
<f:Button ID="btnClose" EnablePostBack="false" ToolTip="关闭" runat="server" Icon="SystemClose">
</f:Button>
</Items>
</f:Toolbar>
</Toolbars>
</f:Form>
<f:Window ID="Window1" Title="连接读卡器" Hidden="true" EnableIFrame="true" EnableMaximize="true"
Target="Parent" EnableResize="false" runat="server" IsModal="true" Width="600px"
Height="300px">
</f:Window>
</f:DropDownBox>--%>
<f:DropDownBox runat="server" ID="drpPersonId" Label="人员姓名" EmptyText="请从下拉表格中选择"
EnableMultiSelect="true" MatchFieldWidth="false" Values="105,108" AutoPostBack="true" OnTextChanged="drpPersonId_TextChanged">
<PopPanel>
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" runat="server" Width="900px" Height="300px" Hidden="true"
DataIDField="PersonId" DataTextField="PersonName" EnableMultiSelect="true" KeepCurrentSelection="true"
DataKeyNames="PersonId" EnableCheckBoxSelect="true">
<Toolbars>
<f:Toolbar ID="Toolbar2" Position="Top" runat="server">
<Items>
<f:TextBox runat="server" Label="卡号" ID="txtCardNo" EmptyText="输入查询条件" AutoPostBack="true"
OnTextChanged="TextBox_TextChanged" Width="250px" LabelAlign="Right">
</f:TextBox>
<f:TextBox runat="server" Label="姓名" ID="txtPersonName" EmptyText="输入查询条件" AutoPostBack="true"
OnTextChanged="TextBox_TextChanged" Width="250px" LabelAlign="Right">
</f:TextBox>
<f:TextBox runat="server" Label="身份证号" ID="txtIdentityCard" EmptyText="输入查询条件" AutoPostBack="true"
OnTextChanged="TextBox_TextChanged" Width="300px" LabelAlign="Right">
</f:TextBox>
</Items>
</f:Toolbar>
</Toolbars>
<Columns>
<f:RowNumberField EnablePagingNumber="true" HeaderText="序号" Width="50px" HeaderTextAlign="Center"
TextAlign="Center" />
<f:RenderField Width="100px" ColumnID="CardNo" DataField="CardNo" SortField="CardNo"
FieldType="String" HeaderText="卡号" HeaderTextAlign="Center" TextAlign="Left">
</f:RenderField>
<f:RenderField Width="100px" ColumnID="PersonName" DataField="PersonName" EnableFilter="true"
SortField="PersonName" FieldType="String" HeaderText="姓名" HeaderTextAlign="Center"
TextAlign="Left">
</f:RenderField>
<f:RenderField Width="200px" ColumnID="UnitName" DataField="UnitName" SortField="UnitName"
FieldType="String" HeaderText="所在单位" HeaderTextAlign="Center" TextAlign="Left" ExpandUnusedSpace="true">
</f:RenderField>
<f:RenderField Width="120px" ColumnID="WorkPostName" DataField="WorkPostName" SortField="WorkPostName"
FieldType="String" HeaderText="岗位" HeaderTextAlign="Center" TextAlign="Left">
</f:RenderField>
</Columns>
</f:Grid>
</PopPanel>
</f:DropDownBox>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:TextBox ID="txtIdCard" Label="身份证号码" Readonly="true" runat="server"></f:TextBox>
</Items>
</f:FormRow>
<f:FormRow ColumnWidths="40% 25% 35%">
<Items>
<f:TextBox ID="txtWorkArea" runat="server" Label="单位工程" MaxLength="100" LabelAlign="Right">
</f:TextBox>
<f:DropDownList ID="drpWorkArea" runat="server" AutoPostBack="true" EnableMultiSelect="true" OnSelectedIndexChanged="drpWorkArea_SelectedIndexChanged">
</f:DropDownList>
<f:Label ID="Label4" runat="server" Text="说明:检查区域可从下拉框选择也可手动编辑。" CssClass="lab" MarginLeft="5px">
</f:Label>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:TextBox ID="txtAddress" runat="server" Label="进出地点" MaxLength="50" LabelAlign="Right">
</f:TextBox>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:DropDownList ID="drpType" runat="server" Label="进出时间">
<f:ListItem Value="1" Text="入场时间" />
<f:ListItem Value="0" Text="出场时间" />
</f:DropDownList>
<f:DatePicker ID="txtTime" runat="server">
</f:DatePicker>
<f:TextBox ID="txtTime2" runat="server">
</f:TextBox>
</Items>
</f:FormRow>
</Rows>
<Toolbars>
<f:Toolbar ID="Toolbar1" Position="Bottom" ToolbarAlign="Right" runat="server">
<Items>
<f:Button ID="btnSave" Icon="SystemSave" runat="server" ToolTip="保存" ValidateForms="SimpleForm1"
OnClick="btnSave_Click">
</f:Button>
<f:Button ID="btnClose" EnablePostBack="false" ToolTip="关闭" runat="server" Icon="SystemClose">
</f:Button>
</Items>
</f:Toolbar>
</Toolbars>
</f:Form>
<f:Window ID="Window1" Title="连接读卡器" Hidden="true" EnableIFrame="true" EnableMaximize="true"
Target="Parent" EnableResize="false" runat="server" IsModal="true" Width="600px"
Height="300px">
</f:Window>
</form>
</body>
</html>

View File

@ -70,6 +70,11 @@ namespace FineUIPro.Web.HSSE.SitePerson
BindGrid(personInfo.PersonId);
this.drpPersonId.Value = personInfo.PersonId;
}
this.txtIdCard.Text = personInfo.IdentityCard;
if (!string.IsNullOrEmpty(personInfo.WorkAreaId))
{
this.drpWorkArea.SelectedValueArray = personInfo.WorkAreaId.Split(',');
}
this.txtWorkArea.Text = personInfo.WorkAreaName;
this.txtAddress.Text = personInfo.Address;
if (personInfo.IntoOutTime != null)
@ -99,16 +104,35 @@ namespace FineUIPro.Web.HSSE.SitePerson
{
if (!string.IsNullOrEmpty(this.drpPersonId.Value))
{
var person = BLL.PersonService.GetPersonById(this.drpPersonId.Value);
if (person != null)
string[] personIds = this.drpPersonId.Value.Split(',');
string idCards = string.Empty;
string workAreaIds = string.Empty;
string workAreaNames = string.Empty;
foreach (var item in personIds)
{
this.txtIdCard.Text = person.IdentityCard;
if (!string.IsNullOrEmpty(person.WorkAreaId))
var person = BLL.PersonService.GetPersonById(item.Trim());
if (person != null)
{
this.drpWorkArea.SelectedValue = person.WorkAreaId;
this.txtWorkArea.Text = this.drpWorkArea.SelectedItem.Text;
idCards += person.IdentityCard + ",";
workAreaIds += person.WorkAreaId;
if (!string.IsNullOrEmpty(person.WorkAreaId))
{
workAreaNames += BLL.UnitWorkService.getUnitWorkByUnitWorkId(person.WorkAreaId).UnitWorkName + ",";
}
}
}
if (!string.IsNullOrEmpty(idCards))
{
this.txtIdCard.Text = idCards.Substring(0, idCards.LastIndexOf(','));
}
if (!string.IsNullOrEmpty(workAreaIds))
{
this.drpWorkArea.SelectedValueArray = workAreaIds.Split(',');
}
if (!string.IsNullOrEmpty(workAreaNames))
{
this.txtWorkArea.Text = workAreaNames.Substring(0, workAreaNames.LastIndexOf(','));
}
}
}
#endregion
@ -196,32 +220,67 @@ namespace FineUIPro.Web.HSSE.SitePerson
ShowNotify("请选择人员!", MessageBoxIcon.Warning);
return;
}
Model.SitePerson_Checking personInfo = new Model.SitePerson_Checking
string[] personIds = this.drpPersonId.Value.Split(',');
foreach (var item in personIds)
{
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();
Model.SitePerson_Checking personInfo = new Model.SitePerson_Checking();
personInfo.ProjectId = this.ProjectId;
personInfo.PersonId = item.Trim();
var person = BLL.PersonService.GetPersonById(personInfo.PersonId);
if (person != null)
{
personInfo.IdentityCard = person.IdentityCard;
if (!string.IsNullOrEmpty(person.WorkAreaId))
{
personInfo.WorkAreaId = person.WorkAreaId;
personInfo.WorkAreaName = BLL.UnitWorkService.getUnitWorkByUnitWorkId(person.WorkAreaId).UnitWorkName;
}
}
personInfo.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 = SQLHelper.GetNewID();
BLL.SitePerson_CheckingService.AddPersonInfo(personInfo);
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);
}
//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());
}
#endregion

View File

@ -0,0 +1,94 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PersonInfoIn.aspx.cs" Inherits="FineUIPro.Web.HSSE.SitePerson.PersonInfoIn" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>现场人员考勤管理导入</title>
<link href="~/res/css/common.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<f:PageManager ID="PageManager1" AutoSizePanelID="SimpleForm1" runat="server" OnCustomEvent="PageManager1_CustomEvent" />
<f:Form ID="SimpleForm1" ShowBorder="false" ShowHeader="false" AutoScroll="true"
BodyPadding="10px" runat="server" RedStarPosition="BeforeText" LabelAlign="Right">
<Toolbars>
<f:Toolbar ID="Toolbar2" Position="Top" ToolbarAlign="Right" runat="server">
<Items>
<f:ToolbarFill ID="ToolbarFill1" runat="server"></f:ToolbarFill>
<f:Button ID="btnAudit" Icon="ApplicationEdit" runat="server" ToolTip="审核" ValidateForms="SimpleForm1"
OnClick="btnAudit_Click">
</f:Button>
<f:Button ID="btnImport" Icon="ApplicationGet" runat="server" ToolTip="导入" ValidateForms="SimpleForm1"
OnClick="btnImport_Click">
</f:Button>
<f:Button ID="btnSave" Icon="SystemSave" runat="server" ToolTip="保存" ValidateForms="SimpleForm1"
OnClick="btnSave_Click">
</f:Button>
<f:Button ID="btnDownLoad" runat="server" Icon="ApplicationGo" ToolTip="下载模板" OnClick="btnDownLoad_Click">
</f:Button>
</Items>
</f:Toolbar>
</Toolbars>
<Rows>
<f:FormRow>
<Items>
<f:FileUpload runat="server" ID="fuAttachUrl" EmptyText="选择要导入的文件" Label="选择要导入的文件"
LabelWidth="150px">
</f:FileUpload>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" EnableCollapse="true" runat="server"
EnableColumnLines="true" BoxFlex="1" DataKeyNames="CheckingId" DataIDField="CheckingId"
AllowSorting="true" SortField="CardNo" PageSize="500" Height="400px">
<Columns>
<f:TemplateField Width="55px" HeaderText="序号">
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Container.DataItemIndex + 1 %>'></asp:Label>
</ItemTemplate>
</f:TemplateField>
<f:RenderField Width="220px" ColumnID="UnitName" DataField="UnitName" FieldType="String"
HeaderText="单位" HeaderTextAlign="Center" TextAlign="Center" ExpandUnusedSpace="true">
</f:RenderField>
<f:RenderField Width="150px" ColumnID="PersonName" DataField="PersonName"
SortField="PersonName" FieldType="String" HeaderText="姓名" HeaderTextAlign="Center"
TextAlign="Center">
</f:RenderField>
<f:RenderField Width="220px" ColumnID="IdentityCard" DataField="IdentityCard" SortField="IdentityCard"
FieldType="String" HeaderText="身份证号码" HeaderTextAlign="Center" TextAlign="Center">
</f:RenderField>
<f:TemplateField ColumnID="tfIntoOut" Width="150px" HeaderText="进/出" HeaderTextAlign="Center" TextAlign="Center">
<ItemTemplate>
<asp:Label ID="lblIntoOut" runat="server" Text='<%# ConvertIntoOut(Eval("IntoOut")) %>'
ToolTip='<%#ConvertIntoOut(Eval("IntoOut")) %>'></asp:Label>
</ItemTemplate>
</f:TemplateField>
<f:RenderField Width="240px" ColumnID="IntoOutTime" DataField="IntoOutTime" SortField="IntoOutTime"
FieldType="String" HeaderText="时间" HeaderTextAlign="Center" TextAlign="Center">
</f:RenderField>
</Columns>
</f:Grid>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:HiddenField ID="hdFileName" runat="server">
</f:HiddenField>
<f:HiddenField ID="hdCheckResult" runat="server">
</f:HiddenField>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:Label ID="lblBottom" runat="server" Text="说明1 导入模板中灰色项为必填项。2 身份证号码必须为15或18位所属单位等必须与基础信息中对应类型的名称一致,否则无法导入。3 如需修改已有人员信息请到系统中修改。4 数据导入后,点击“保存”,即可完成信息导入。">
</f:Label>
</Items>
</f:FormRow>
</Rows>
</f:Form>
</form>
</body>
</html>

View File

@ -0,0 +1,494 @@
using BLL;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.OleDb;
using System.IO;
using System.Linq;
namespace FineUIPro.Web.HSSE.SitePerson
{
public partial class PersonInfoIn : PageBase
{
#region
/// <summary>
/// 上传预设的虚拟路径
/// </summary>
private string initPath = Const.ExcelUrl;
/// <summary>
/// 人员考勤集合
/// </summary>
public static List<Model.View_SitePerson_Checking> viewCheckings = new List<Model.View_SitePerson_Checking>();
/// <summary>
/// 错误集合
/// </summary>
public static string errorInfos = string.Empty;
#endregion
#region
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.hdFileName.Text = string.Empty;
this.hdCheckResult.Text = string.Empty;
if (viewCheckings != null)
{
viewCheckings.Clear();
}
errorInfos = string.Empty;
}
}
#endregion
#region
/// <summary>
/// 审核
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnAudit_Click(object sender, EventArgs e)
{
try
{
if (this.fuAttachUrl.HasFile == false)
{
ShowNotify("请您选择Excel文件", MessageBoxIcon.Warning);
return;
}
string IsXls = Path.GetExtension(this.fuAttachUrl.FileName).ToString().Trim().ToLower();
if (IsXls != ".xls")
{
ShowNotify("只可以选择Excel文件", MessageBoxIcon.Warning);
return;
}
if (viewCheckings!=null)
{
viewCheckings.Clear();
}
if (!string.IsNullOrEmpty(errorInfos))
{
errorInfos = string.Empty;
}
string rootPath = Server.MapPath("~/");
string initFullPath = rootPath + initPath;
if (!Directory.Exists(initFullPath))
{
Directory.CreateDirectory(initFullPath);
}
this.hdFileName.Text = BLL.Funs.GetNewFileName() + IsXls;
string filePath = initFullPath + this.hdFileName.Text;
this.fuAttachUrl.PostedFile.SaveAs(filePath);
ImportXlsToData(rootPath + initPath + this.hdFileName.Text);
}
catch (Exception ex)
{
ShowNotify("'" + ex.Message + "'", MessageBoxIcon.Warning);
}
}
#region Excel提取数据
/// <summary>
/// 从Excel提取数据--》Dataset
/// </summary>
/// <param name="filename">Excel文件路径名</param>
private void ImportXlsToData(string fileName)
{
try
{
string oleDBConnString = String.Empty;
oleDBConnString = "Provider=Microsoft.Jet.OLEDB.4.0;";
oleDBConnString += "Data Source=";
oleDBConnString += fileName;
oleDBConnString += ";Extended Properties=Excel 8.0;";
OleDbConnection oleDBConn = null;
OleDbDataAdapter oleAdMaster = null;
DataTable m_tableName = new DataTable();
DataSet ds = new DataSet();
oleDBConn = new OleDbConnection(oleDBConnString);
oleDBConn.Open();
m_tableName = oleDBConn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
if (m_tableName != null && m_tableName.Rows.Count > 0)
{
m_tableName.TableName = m_tableName.Rows[0]["TABLE_NAME"].ToString().Trim();
}
string sqlMaster;
sqlMaster = " SELECT * FROM [" + m_tableName.TableName + "]";
oleAdMaster = new OleDbDataAdapter(sqlMaster, oleDBConn);
oleAdMaster.Fill(ds, "m_tableName");
oleAdMaster.Dispose();
oleDBConn.Close();
oleDBConn.Dispose();
AddDatasetToSQL(ds.Tables[0], 5);
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region Dataset的数据导入数据库
/// <summary>
/// 将Dataset的数据导入数据库
/// </summary>
/// <param name="pds">数据集</param>
/// <param name="Cols">数据集行数</param>
/// <returns></returns>
private bool AddDatasetToSQL(DataTable pds, int Cols)
{
string result = string.Empty;
int ic, ir;
ic = pds.Columns.Count;
if (ic < Cols)
{
Alert.ShowInTop("导入Excel格式错误Excel只有" + ic.ToString().Trim() + "行", MessageBoxIcon.Warning);
}
ir = pds.Rows.Count;
if (pds != null && ir > 0)
{
var units = from x in Funs.DB.Base_Unit select x;
var sitePersons = from x in Funs.DB.SitePerson_Person where x.ProjectId == this.CurrUser.LoginProjectId select x;
for (int i = 0; i < ir; i++)
{
string col0 = pds.Rows[i][0].ToString().Trim();
if (!string.IsNullOrEmpty(col0))
{
var unit = units.FirstOrDefault(e => e.UnitName == col0);
if (unit != null)
{
var projectUnit = Funs.DB.Project_ProjectUnit.FirstOrDefault(x => x.ProjectId == this.CurrUser.LoginProjectId && x.UnitId == unit.UnitId);
if (projectUnit == null)
{
result += "第" + (i + 2).ToString() + "行," + "单位" + "," + "[" + col0 + "]不在本项目中!" + "|";
}
}
else
{
result += "第" + (i + 2).ToString() + "行," + "单位" + "," + "[" + col0 + "]不在单位表中!" + "|";
}
}
string col1 = pds.Rows[i][1].ToString().Trim();
if (!string.IsNullOrEmpty(col1))
{
var person = sitePersons.FirstOrDefault(e => e.PersonName == col1);
if (person == null)
{
result += "第" + (i + 2).ToString() + "行," + "姓名" + "," + "[" + col1 + "]不在人员信息表中!" + "|";
}
}
string col2 = pds.Rows[i][2].ToString().Trim();
if (!string.IsNullOrEmpty(col2))
{
var person = sitePersons.FirstOrDefault(e => e.IdentityCard == col2);
if (person == null)
{
result += "第" + (i + 2).ToString() + "行," + "身份证号码" + "," + "[" + col2 + "]错误!" + "|";
}
}
else
{
result += "第" + (i + 2).ToString() + "行," + "身份证号码" + "," + "此项为必填项!" + "|";
}
string col3 = pds.Rows[i][3].ToString().Trim();
if (!string.IsNullOrEmpty(col3))
{
if (col3 != "进" && col3 != "出")
{
result += "第" + (i + 2).ToString() + "行," + "进/出" + "," + "[" + col3 + "]错误!" + "|";
}
}
string col4 = pds.Rows[i][4].ToString();
if (!string.IsNullOrEmpty(col4))
{
try
{
DateTime inToOutTime = Convert.ToDateTime(col4);
}
catch (Exception)
{
result += "第" + (i + 2).ToString() + "行," + "时间" + "," + "[" + col4 + "]错误!" + "|";
}
}
}
if (!string.IsNullOrEmpty(result))
{
result = result.Substring(0, result.LastIndexOf("|"));
errorInfos = result;
Alert alert = new Alert
{
Message = result,
Target = Target.Self
};
alert.Show();
}
else
{
errorInfos = string.Empty;
ShowNotify("审核完成,请点击导入!", MessageBoxIcon.Success);
}
}
else
{
ShowNotify("导入数据为空!", MessageBoxIcon.Warning);
}
return true;
}
#endregion
#endregion
#region
/// <summary>
/// 导入
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnImport_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(errorInfos))
{
if (!string.IsNullOrEmpty(this.hdFileName.Text))
{
string rootPath = Server.MapPath("~/");
ImportXlsToData2(rootPath + initPath + this.hdFileName.Text);
}
else
{
ShowNotify("请先审核要导入的文件!", MessageBoxIcon.Warning);
}
}
else
{
Alert.ShowInTop("请先将错误数据修正,再重新导入保存!", MessageBoxIcon.Warning);
}
}
#region Excel提取数据
/// <summary>
/// 从Excel提取数据--》Dataset
/// </summary>
/// <param name="filename">Excel文件路径名</param>
private void ImportXlsToData2(string fileName)
{
try
{
string oleDBConnString = String.Empty;
oleDBConnString = "Provider=Microsoft.Jet.OLEDB.4.0;";
oleDBConnString += "Data Source=";
oleDBConnString += fileName;
oleDBConnString += ";Extended Properties=Excel 8.0;";
OleDbConnection oleDBConn = null;
OleDbDataAdapter oleAdMaster = null;
DataTable m_tableName = new DataTable();
DataSet ds = new DataSet();
oleDBConn = new OleDbConnection(oleDBConnString);
oleDBConn.Open();
m_tableName = oleDBConn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
if (m_tableName != null && m_tableName.Rows.Count > 0)
{
m_tableName.TableName = m_tableName.Rows[0]["TABLE_NAME"].ToString().Trim();
}
string sqlMaster;
sqlMaster = " SELECT * FROM [" + m_tableName.TableName + "]";
oleAdMaster = new OleDbDataAdapter(sqlMaster, oleDBConn);
oleAdMaster.Fill(ds, "m_tableName");
oleAdMaster.Dispose();
oleDBConn.Close();
oleDBConn.Dispose();
AddDatasetToSQL2(ds.Tables[0], 5);
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region Dataset的数据导入数据库
/// <summary>
/// 将Dataset的数据导入数据库
/// </summary>
/// <param name="pds">数据集</param>
/// <param name="Cols">数据集列数</param>
/// <returns></returns>
private bool AddDatasetToSQL2(DataTable pds, int Cols)
{
int ic, ir;
viewCheckings.Clear();
ic = pds.Columns.Count;
if (ic < Cols)
{
Alert.ShowInTop("导入Excel格式错误Excel只有" + ic.ToString().Trim() + "列", MessageBoxIcon.Warning);
}
ir = pds.Rows.Count;
if (pds != null && ir > 0)
{
var units = from x in Funs.DB.Base_Unit select x;
var sitePersons = from x in Funs.DB.SitePerson_Person where x.ProjectId == this.CurrUser.LoginProjectId select x;
for (int i = 0; i < ir; i++)
{
string col2 = pds.Rows[i][2].ToString().Trim();
if (!string.IsNullOrEmpty(col2))
{
Model.View_SitePerson_Checking checking = new Model.View_SitePerson_Checking();
string col0 = pds.Rows[i][0].ToString().Trim();
string col1 = pds.Rows[i][1].ToString().Trim();
string col3 = pds.Rows[i][3].ToString().Trim();
string col4 = pds.Rows[i][4].ToString().Trim();
if (!string.IsNullOrEmpty(col2))
{
checking.UnitName = col0;
checking.PersonName = col1;
checking.IdentityCard = col2;
checking.IntoOut = (col3 == "进"? "1": "0");
checking.IntoOutTime = Convert.ToDateTime(col4);
var person = BLL.PersonService.GetPersonByIdentityCard(this.CurrUser.LoginProjectId, checking.IdentityCard);
if (person != null)
{
checking.PersonId = person.PersonId;
}
checking.CheckingId = SQLHelper.GetNewID(typeof(Model.SitePerson_Checking));
viewCheckings.Add(checking);
}
}
}
if (viewCheckings.Count > 0)
{
this.Grid1.Hidden = false;
this.Grid1.DataSource = viewCheckings;
this.Grid1.DataBind();
}
}
else
{
ShowNotify("导入数据为空!", MessageBoxIcon.Warning);
}
return true;
}
#endregion
#endregion
#region
/// <summary>
/// 保存
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSave_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(errorInfos))
{
int a = viewCheckings.Count();
for (int i = 0; i < a; i++)
{
Model.SitePerson_Checking newChecking = new Model.SitePerson_Checking
{
CheckingId = viewCheckings[i].CheckingId,
ProjectId = this.CurrUser.LoginProjectId,
IdentityCard = viewCheckings[i].IdentityCard,
IntoOutTime = viewCheckings[i].IntoOutTime,
IntoOut = viewCheckings[i].IntoOut,
PersonId = viewCheckings[i].PersonId
};
BLL.SitePerson_CheckingService.AddPersonInfo(newChecking);
}
string rootPath = Server.MapPath("~/");
string initFullPath = rootPath + initPath;
string filePath = initFullPath + this.hdFileName.Text;
if (filePath != string.Empty && System.IO.File.Exists(filePath))
{
System.IO.File.Delete(filePath);//删除上传的XLS文件
}
ShowNotify("导入成功!", MessageBoxIcon.Success);
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
else
{
Alert.ShowInTop("请先将错误数据修正,再重新导入保存!", MessageBoxIcon.Warning);
}
}
#endregion
#region
/// <summary>
/// 下载模板按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnDownLoad_Click(object sender, EventArgs e)
{
PageContext.RegisterStartupScript(Confirm.GetShowReference("确定下载导入模板吗?", String.Empty, MessageBoxIcon.Question, PageManager1.GetCustomEventReference(false, "Confirm_OK"), PageManager1.GetCustomEventReference("Confirm_Cancel")));
}
/// <summary>
/// 下载导入模板
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void PageManager1_CustomEvent(object sender, CustomEventArgs e)
{
if (e.EventArgument == "Confirm_OK")
{
string rootPath = Server.MapPath("~/");
string uploadfilepath = rootPath + Const.PersonInfoTemplateUrl;
string filePath = Const.PersonInfoTemplateUrl;
string fileName = Path.GetFileName(filePath);
FileInfo info = new FileInfo(uploadfilepath);
long fileSize = info.Length;
Response.ClearContent();
Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
Response.ContentType = "excel/plain";
Response.ContentEncoding = System.Text.Encoding.UTF8;
Response.AddHeader("Content-Length", fileSize.ToString().Trim());
Response.TransmitFile(uploadfilepath, 0, fileSize);
Response.End();
}
}
#endregion
#region
/// <summary>
/// 把进出转换为字符串类型
/// </summary>
/// <param name="sex"></param>
/// <returns></returns>
protected string ConvertIntoOut(object intoOut)
{
if (intoOut != null)
{
if (Convert.ToBoolean(intoOut) == true)
{
return "进场";
}
else
{
return "出场";
}
}
return "";
}
#endregion
}
}

View File

@ -0,0 +1,159 @@
//------------------------------------------------------------------------------
// <自动生成>
// 此代码由工具生成。
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </自动生成>
//------------------------------------------------------------------------------
namespace FineUIPro.Web.HSSE.SitePerson {
public partial class PersonInfoIn {
/// <summary>
/// form1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
/// <summary>
/// PageManager1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.PageManager PageManager1;
/// <summary>
/// SimpleForm1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Form SimpleForm1;
/// <summary>
/// Toolbar2 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Toolbar Toolbar2;
/// <summary>
/// ToolbarFill1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.ToolbarFill ToolbarFill1;
/// <summary>
/// btnAudit 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnAudit;
/// <summary>
/// btnImport 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnImport;
/// <summary>
/// btnSave 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnSave;
/// <summary>
/// btnDownLoad 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnDownLoad;
/// <summary>
/// fuAttachUrl 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.FileUpload fuAttachUrl;
/// <summary>
/// Grid1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Grid Grid1;
/// <summary>
/// Label2 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.WebControls.Label Label2;
/// <summary>
/// lblIntoOut 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblIntoOut;
/// <summary>
/// hdFileName 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.HiddenField hdFileName;
/// <summary>
/// hdCheckResult 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.HiddenField hdCheckResult;
/// <summary>
/// lblBottom 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Label lblBottom;
}
}

View File

@ -123,9 +123,9 @@
<f:RenderField HeaderText="班组" ColumnID="TeamGroupName" DataField="TeamGroupName" SortField="TeamGroupName"
FieldType="String" HeaderTextAlign="Center" TextAlign="Left" Width="150px">
</f:RenderField>
<f:RenderField HeaderText="单位工程" ColumnID="WorkAreaName" DataField="WorkAreaName" SortField="WorkAreaName"
FieldType="String" HeaderTextAlign="Center" TextAlign="Left" Width="110px">
</f:RenderField>
<%-- <f:RenderField HeaderText="单位工程" ColumnID="WorkAreaName" DataField="WorkAreaName" SortField="WorkAreaName"
FieldType="String" HeaderTextAlign="Center" TextAlign="Left" Width="110px" >
</f:RenderField> --%>
<f:RenderField Width="100px" ColumnID="InTime" DataField="InTime" SortField="InTime"
FieldType="Date" Renderer="Date" RendererArgument="yyyy-MM-dd" HeaderText="入场时间"
HeaderTextAlign="Center" TextAlign="Center">

View File

@ -184,10 +184,17 @@ namespace FineUIPro.Web.HSSE.SitePerson
{
new SqlParameter("@ProjectId", this.ProjectId)
};
if (!string.IsNullOrEmpty(unitId) && unitId != "0")
if (!string.IsNullOrEmpty(unitId))
{
strSql += " AND UnitId =@UnitId ";
listStr.Add(new SqlParameter("@UnitId", unitId));
if (unitId == "0")
{
strSql += " AND UnitId IS NULL ";
}
else
{
strSql += " AND UnitId =@UnitId ";
listStr.Add(new SqlParameter("@UnitId", unitId));
}
}
if (!string.IsNullOrEmpty(this.txtPersonName.Text.Trim()))
{

View File

@ -12,6 +12,7 @@
.userphoto img {
width: 100%;
height:auto;
}
.uploadbutton .f-btn {
@ -158,6 +159,7 @@
<f:FileUpload ID="filePhoto" CssClass="uploadbutton" runat="server" ButtonText="上传照片"
ButtonOnly="true" AutoPostBack="true" OnFileSelected="filePhoto_FileSelected" Hidden="true">
</f:FileUpload>
<f:Label runat="server" Text="要求小于300K且清晰大头照"></f:Label>
</Items>
</f:Panel>
</Items>

View File

@ -1,6 +1,7 @@
using BLL;
using Newtonsoft.Json.Linq;
using System;
using System.IO;
using System.Linq;
namespace FineUIPro.Web.HSSE.SitePerson
@ -618,7 +619,18 @@ namespace FineUIPro.Web.HSSE.SitePerson
fileName = fileName.Replace(":", "_").Replace(" ", "_").Replace("\\", "_").Replace("/", "_");
fileName = DateTime.Now.Ticks.ToString() + "_" + fileName;
string url = "~/FileUpload/PersonBaseInfo/" + DateTime.Now.Year + "-" + DateTime.Now.Month + "/";
filePhoto.SaveAs(Server.MapPath(url + fileName));
string fileMapPath = Server.MapPath(url + fileName);
filePhoto.SaveAs(fileMapPath);
if (File.Exists(fileMapPath))
{
FileInfo fileInfo = new FileInfo(fileMapPath);
double size = Math.Ceiling(fileInfo.Length * 1.0 / 1024.0);
if (size > 300)
{
Alert.ShowInTop("照片大小超过300KB请重新上传", MessageBoxIcon.Warning);
return;
}
}
imgPhoto.ImageUrl = url + fileName;
// 清空文件上传组件
filePhoto.Reset();

View File

@ -325791,6 +325791,8 @@ namespace Model
private string _CardNo;
private string _PersonId;
private string _ProjectId;
private string _IdentityCard;
@ -325799,7 +325801,7 @@ namespace Model
private System.Nullable<System.DateTime> _IntoOutTime;
private System.Nullable<bool> _IntoOut;
private string _IntoOut;
private string _Address;
@ -325849,6 +325851,22 @@ namespace Model
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PersonId", DbType="NVarChar(50)")]
public string PersonId
{
get
{
return this._PersonId;
}
set
{
if ((this._PersonId != value))
{
this._PersonId = value;
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ProjectId", DbType="NVarChar(50)")]
public string ProjectId
{
@ -325881,7 +325899,7 @@ namespace Model
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_WorkAreaId", DbType="NVarChar(MAX)", UpdateCheck=UpdateCheck.Never)]
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_WorkAreaId", DbType="NVarChar(50)")]
public string WorkAreaId
{
get
@ -325913,8 +325931,8 @@ namespace Model
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_IntoOut", DbType="Bit")]
public System.Nullable<bool> IntoOut
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_IntoOut", DbType="Char(1)")]
public string IntoOut
{
get
{
@ -325945,7 +325963,7 @@ namespace Model
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_WorkAreaName", DbType="NVarChar(500)")]
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_WorkAreaName", DbType="NVarChar(100)")]
public string WorkAreaName
{
get
@ -326009,7 +326027,7 @@ namespace Model
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_States", DbType="VarChar(1)")]
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_States", DbType="Char(1)")]
public string States
{
get