20220929 人员离岗导入功能实现
This commit is contained in:
parent
18ed8e8833
commit
b72cf8845f
|
@ -17,8 +17,6 @@ set PUBLISHER_SRC_ROOT=%PROJECT_SRC%\SGGL\FineUIPro.Web
|
|||
REM 源代码版本日志文件夹
|
||||
set VerLog_SRC_ROOT=%PROJECT_SRC%\database\版本日志
|
||||
|
||||
REM 源代码附件文件夹
|
||||
set FileUpload=%PROJECT_SRC%\SGGL\FineUIPro.Web\FileUpload
|
||||
|
||||
REM 包文件夹名
|
||||
SET ReleasePack=PackFile
|
||||
|
@ -52,15 +50,8 @@ rd %RELEASE_VerLog_ROOT% /S /Q
|
|||
)
|
||||
mkdir %RELEASE_VerLog_ROOT%
|
||||
|
||||
|
||||
IF exist %FileUpload%\nul.ext (
|
||||
rd %FileUpload% /S /Q
|
||||
)
|
||||
mkdir %FileUpload%
|
||||
|
||||
IF errorlevel 1 goto delReleasePackError
|
||||
|
||||
|
||||
@echo 设置.net控制台环境
|
||||
@echo.
|
||||
@call "%VS150%"
|
||||
|
|
|
@ -89,11 +89,8 @@ namespace BLL
|
|||
CheckWay = "FACE_FANGSHI",
|
||||
};
|
||||
|
||||
if (SynchroSetService.PushAttendanceS(newR) != "True")
|
||||
{
|
||||
db.RealName_PersonInOutNow.InsertOnSubmit(newR);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
db.RealName_PersonInOutNow.InsertOnSubmit(newR);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,19 +16,22 @@
|
|||
<Toolbars>
|
||||
<f:Toolbar ID="Toolbar2" Position="Top" ToolbarAlign="Right" runat="server">
|
||||
<Items>
|
||||
<f:Button ID="btnSee" Icon="Find" runat="server" ToolTip="查看基础数据" OnClick="btnSee_Click">
|
||||
<f:Button ID="btnSee" Icon="Find" runat="server" Text="查看基础数据" OnClick="btnSee_Click">
|
||||
</f:Button>
|
||||
<f:ToolbarFill></f:ToolbarFill>
|
||||
<f:Button ID="btnAudit" Icon="ApplicationEdit" runat="server" ToolTip="审核" ValidateForms="SimpleForm1"
|
||||
<f:ToolbarFill runat="server"></f:ToolbarFill>
|
||||
<f:Button ID="btnAudit" Icon="ApplicationEdit" runat="server" Text="审核" ValidateForms="SimpleForm1"
|
||||
OnClick="btnAudit_Click">
|
||||
</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">
|
||||
</f:Button>
|
||||
<f:Button ID="btnSave" Icon="SystemSave" runat="server" ToolTip="保存" ValidateForms="SimpleForm1"
|
||||
<f:Button ID="btnSave" Icon="SystemSave" runat="server" Text="保存" ValidateForms="SimpleForm1"
|
||||
OnClick="btnSave_Click">
|
||||
</f:Button>
|
||||
<f:Button ID="btnDownLoad" runat="server" Icon="ApplicationGo" ToolTip="下载模板" OnClick="btnDownLoad_Click">
|
||||
<f:Button ID="btnOut" Icon="ApplicationGet" runat="server" Text="离岗" ToolTip="离岗导入"
|
||||
OnClick="btnOut_Click1">
|
||||
</f:Button>
|
||||
<f:Button ID="btnDownLoad" runat="server" Icon="ApplicationGo" Text="下载模板" OnClick="btnDownLoad_Click">
|
||||
</f:Button>
|
||||
<%--<f:Button ID="btnOut" Icon="Pencil" runat="server" Text="导出" ToolTip="导出错误列表" ValidateForms="SimpleForm1"
|
||||
OnClick="btnOut_Click" Hidden="true"></f:Button>--%>
|
||||
|
@ -184,7 +187,7 @@
|
|||
</f:FormRow>
|
||||
<f:FormRow>
|
||||
<Items>
|
||||
<f:Label ID="lblBottom" runat="server" Text="说明:1 人员信息导入模板中,灰色项为必填项。2 身份证号码必须为15或18位,所属单位、所在班组、单位工程、岗位、特岗证书等必须与基础信息中对应类型的名称一致,否则无法导入。3 如需修改已有人员信息,请到系统中修改。4 数据导入后,点击“保存”,即可完成人员信息导入。">
|
||||
<f:Label ID="lblBottom" runat="server" Text="说明:1 人员信息导入模板中,灰色项为必填项。2 身份证号码必须为15或18位,所属单位、所在班组、单位工程、岗位、特岗证书等必须与基础信息中对应类型的名称一致,否则无法导入。3 如需修改已有人员信息,请到系统中修改。4 数据导入后,点击“保存”,即可完成人员信息导入。5 离岗导入不需要审核,模板列不要动,填写身份证号码和离岗时间。">
|
||||
</f:Label>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
|
|
|
@ -65,7 +65,11 @@ namespace FineUIPro.Web.HSSE.SitePerson
|
|||
persons.Clear();
|
||||
}
|
||||
errorInfos = string.Empty;
|
||||
this.ProjectId = Request.Params["ProjectId"];
|
||||
this.ProjectId = this.CurrUser.LoginProjectId;
|
||||
if (!string.IsNullOrEmpty(Request.Params["ProjectId"]))
|
||||
{
|
||||
this.ProjectId = Request.Params["ProjectId"];
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
@ -1134,6 +1138,13 @@ namespace FineUIPro.Web.HSSE.SitePerson
|
|||
getPerson.IsUsed = persons[i].IsUsedName == "是" ? true : false;
|
||||
getPerson.IsCardUsed = persons[i].IsCardUsedName == "是" ? true : false;
|
||||
getPerson.IsCardNoOK = IDCardValid.CheckIDCard(persons[i].IdentityCard);
|
||||
if (getPerson.OutTime.HasValue)
|
||||
{
|
||||
getPerson.IsUsed = true;
|
||||
getPerson.ExchangeTime = null;
|
||||
getPerson.ExchangeTime2 = null;
|
||||
getPerson.RealNameUpdateTime = null;
|
||||
}
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
@ -1314,5 +1325,134 @@ namespace FineUIPro.Web.HSSE.SitePerson
|
|||
{
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("PersonBaseData.aspx", "查看 - ")));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 离岗导入
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnOut_Click1(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;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
string fileName = rootPath + initPath + this.hdFileName.Text;
|
||||
|
||||
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();
|
||||
|
||||
AddDatasetToSQLout(ds.Tables[0]);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
#region 将Dataset的数据导入数据库
|
||||
/// <summary>
|
||||
/// 将Dataset的数据导入数据库
|
||||
/// </summary>
|
||||
/// <param name="pds">数据集</param>
|
||||
/// <param name="Cols">数据集列数</param>
|
||||
/// <returns></returns>
|
||||
private bool AddDatasetToSQLout(DataTable pds)
|
||||
{
|
||||
int ic, ir;
|
||||
persons.Clear();
|
||||
ic = pds.Columns.Count;
|
||||
ir = pds.Rows.Count;
|
||||
string info = string.Empty;
|
||||
if (pds != null && ir > 0)
|
||||
{
|
||||
for (int i = 0; i < ir; i++)
|
||||
{
|
||||
string col4 = pds.Rows[i][4].ToString().Trim();
|
||||
string col30 = pds.Rows[i][30].ToString().Trim();
|
||||
string col31 = pds.Rows[i][31].ToString().Trim();
|
||||
DateTime? outTime = Funs.GetNewDateTime(col30);
|
||||
if (!string.IsNullOrEmpty(col4) && outTime.HasValue)
|
||||
{
|
||||
var getPerson = Funs.DB.SitePerson_Person.FirstOrDefault(x => x.IdentityCard == col4 && x.ProjectId == this.ProjectId);
|
||||
if (getPerson != null)
|
||||
{
|
||||
getPerson.OutTime = outTime;
|
||||
getPerson.OutResult = col31;
|
||||
getPerson.IsUsed = true;
|
||||
getPerson.ExchangeTime = null;
|
||||
getPerson.ExchangeTime2 = null;
|
||||
getPerson.RealNameUpdateTime = null;
|
||||
Funs.DB.SubmitChanges();
|
||||
info += "第" + (i + 1).ToString() + "行," + getPerson.PersonName + "离岗成功。";
|
||||
}
|
||||
else
|
||||
{
|
||||
info += "第" + (i + 1).ToString() + "行,人员不在当前项目。";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
info += "第" + (i + 1).ToString() + "行,身份证号码、离场时间为空。";
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(info))
|
||||
{
|
||||
ShowNotify(info, MessageBoxIcon.Information);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowNotify("导入数据为空!", MessageBoxIcon.Warning);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -7,11 +7,13 @@
|
|||
// </自动生成>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace FineUIPro.Web.HSSE.SitePerson {
|
||||
|
||||
|
||||
public partial class PersonIn {
|
||||
|
||||
namespace FineUIPro.Web.HSSE.SitePerson
|
||||
{
|
||||
|
||||
|
||||
public partial class PersonIn
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// form1 控件。
|
||||
/// </summary>
|
||||
|
@ -20,7 +22,7 @@ namespace FineUIPro.Web.HSSE.SitePerson {
|
|||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// PageManager1 控件。
|
||||
/// </summary>
|
||||
|
@ -29,7 +31,7 @@ namespace FineUIPro.Web.HSSE.SitePerson {
|
|||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.PageManager PageManager1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// SimpleForm1 控件。
|
||||
/// </summary>
|
||||
|
@ -38,7 +40,7 @@ namespace FineUIPro.Web.HSSE.SitePerson {
|
|||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Form SimpleForm1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Toolbar2 控件。
|
||||
/// </summary>
|
||||
|
@ -47,7 +49,7 @@ namespace FineUIPro.Web.HSSE.SitePerson {
|
|||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Toolbar Toolbar2;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// btnSee 控件。
|
||||
/// </summary>
|
||||
|
@ -56,7 +58,7 @@ namespace FineUIPro.Web.HSSE.SitePerson {
|
|||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnSee;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// btnAudit 控件。
|
||||
/// </summary>
|
||||
|
@ -65,7 +67,7 @@ namespace FineUIPro.Web.HSSE.SitePerson {
|
|||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnAudit;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// btnImport 控件。
|
||||
/// </summary>
|
||||
|
@ -74,7 +76,7 @@ namespace FineUIPro.Web.HSSE.SitePerson {
|
|||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnImport;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// btnSave 控件。
|
||||
/// </summary>
|
||||
|
@ -83,7 +85,16 @@ namespace FineUIPro.Web.HSSE.SitePerson {
|
|||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnSave;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// btnOut 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnOut;
|
||||
|
||||
/// <summary>
|
||||
/// btnDownLoad 控件。
|
||||
/// </summary>
|
||||
|
@ -92,7 +103,7 @@ namespace FineUIPro.Web.HSSE.SitePerson {
|
|||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnDownLoad;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// fuAttachUrl 控件。
|
||||
/// </summary>
|
||||
|
@ -101,7 +112,7 @@ namespace FineUIPro.Web.HSSE.SitePerson {
|
|||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.FileUpload fuAttachUrl;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Grid1 控件。
|
||||
/// </summary>
|
||||
|
@ -110,7 +121,7 @@ namespace FineUIPro.Web.HSSE.SitePerson {
|
|||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Grid Grid1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Label2 控件。
|
||||
/// </summary>
|
||||
|
@ -119,7 +130,7 @@ namespace FineUIPro.Web.HSSE.SitePerson {
|
|||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label Label2;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// hdFileName 控件。
|
||||
/// </summary>
|
||||
|
@ -128,7 +139,7 @@ namespace FineUIPro.Web.HSSE.SitePerson {
|
|||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.HiddenField hdFileName;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// hdCheckResult 控件。
|
||||
/// </summary>
|
||||
|
@ -137,7 +148,7 @@ namespace FineUIPro.Web.HSSE.SitePerson {
|
|||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.HiddenField hdCheckResult;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// lblBottom 控件。
|
||||
/// </summary>
|
||||
|
@ -146,7 +157,7 @@ namespace FineUIPro.Web.HSSE.SitePerson {
|
|||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Label lblBottom;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Window1 控件。
|
||||
/// </summary>
|
||||
|
@ -155,7 +166,7 @@ namespace FineUIPro.Web.HSSE.SitePerson {
|
|||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Window Window1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Window2 控件。
|
||||
/// </summary>
|
||||
|
|
Loading…
Reference in New Issue