20220929 人员离岗导入功能实现
This commit is contained in:
parent
18ed8e8833
commit
b72cf8845f
|
@ -17,8 +17,6 @@ set PUBLISHER_SRC_ROOT=%PROJECT_SRC%\SGGL\FineUIPro.Web
|
||||||
REM 源代码版本日志文件夹
|
REM 源代码版本日志文件夹
|
||||||
set VerLog_SRC_ROOT=%PROJECT_SRC%\database\版本日志
|
set VerLog_SRC_ROOT=%PROJECT_SRC%\database\版本日志
|
||||||
|
|
||||||
REM 源代码附件文件夹
|
|
||||||
set FileUpload=%PROJECT_SRC%\SGGL\FineUIPro.Web\FileUpload
|
|
||||||
|
|
||||||
REM 包文件夹名
|
REM 包文件夹名
|
||||||
SET ReleasePack=PackFile
|
SET ReleasePack=PackFile
|
||||||
|
@ -52,15 +50,8 @@ rd %RELEASE_VerLog_ROOT% /S /Q
|
||||||
)
|
)
|
||||||
mkdir %RELEASE_VerLog_ROOT%
|
mkdir %RELEASE_VerLog_ROOT%
|
||||||
|
|
||||||
|
|
||||||
IF exist %FileUpload%\nul.ext (
|
|
||||||
rd %FileUpload% /S /Q
|
|
||||||
)
|
|
||||||
mkdir %FileUpload%
|
|
||||||
|
|
||||||
IF errorlevel 1 goto delReleasePackError
|
IF errorlevel 1 goto delReleasePackError
|
||||||
|
|
||||||
|
|
||||||
@echo 设置.net控制台环境
|
@echo 设置.net控制台环境
|
||||||
@echo.
|
@echo.
|
||||||
@call "%VS150%"
|
@call "%VS150%"
|
||||||
|
|
|
@ -89,8 +89,6 @@ namespace BLL
|
||||||
CheckWay = "FACE_FANGSHI",
|
CheckWay = "FACE_FANGSHI",
|
||||||
};
|
};
|
||||||
|
|
||||||
if (SynchroSetService.PushAttendanceS(newR) != "True")
|
|
||||||
{
|
|
||||||
db.RealName_PersonInOutNow.InsertOnSubmit(newR);
|
db.RealName_PersonInOutNow.InsertOnSubmit(newR);
|
||||||
db.SubmitChanges();
|
db.SubmitChanges();
|
||||||
}
|
}
|
||||||
|
@ -98,7 +96,6 @@ namespace BLL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 根据人员主键删除一个人员出入场记录
|
/// 根据人员主键删除一个人员出入场记录
|
||||||
|
|
|
@ -16,19 +16,22 @@
|
||||||
<Toolbars>
|
<Toolbars>
|
||||||
<f:Toolbar ID="Toolbar2" Position="Top" ToolbarAlign="Right" runat="server">
|
<f:Toolbar ID="Toolbar2" Position="Top" ToolbarAlign="Right" runat="server">
|
||||||
<Items>
|
<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:Button>
|
||||||
<f:ToolbarFill></f:ToolbarFill>
|
<f:ToolbarFill 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" Text="保存" ValidateForms="SimpleForm1"
|
||||||
OnClick="btnSave_Click">
|
OnClick="btnSave_Click">
|
||||||
</f:Button>
|
</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>
|
||||||
<%--<f:Button ID="btnOut" Icon="Pencil" runat="server" Text="导出" ToolTip="导出错误列表" ValidateForms="SimpleForm1"
|
<%--<f:Button ID="btnOut" Icon="Pencil" runat="server" Text="导出" ToolTip="导出错误列表" ValidateForms="SimpleForm1"
|
||||||
OnClick="btnOut_Click" Hidden="true"></f:Button>--%>
|
OnClick="btnOut_Click" Hidden="true"></f:Button>--%>
|
||||||
|
@ -184,7 +187,7 @@
|
||||||
</f:FormRow>
|
</f:FormRow>
|
||||||
<f:FormRow>
|
<f:FormRow>
|
||||||
<Items>
|
<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>
|
</f:Label>
|
||||||
</Items>
|
</Items>
|
||||||
</f:FormRow>
|
</f:FormRow>
|
||||||
|
|
|
@ -65,9 +65,13 @@ namespace FineUIPro.Web.HSSE.SitePerson
|
||||||
persons.Clear();
|
persons.Clear();
|
||||||
}
|
}
|
||||||
errorInfos = string.Empty;
|
errorInfos = string.Empty;
|
||||||
|
this.ProjectId = this.CurrUser.LoginProjectId;
|
||||||
|
if (!string.IsNullOrEmpty(Request.Params["ProjectId"]))
|
||||||
|
{
|
||||||
this.ProjectId = Request.Params["ProjectId"];
|
this.ProjectId = Request.Params["ProjectId"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 审核
|
#region 审核
|
||||||
|
@ -1134,6 +1138,13 @@ namespace FineUIPro.Web.HSSE.SitePerson
|
||||||
getPerson.IsUsed = persons[i].IsUsedName == "是" ? true : false;
|
getPerson.IsUsed = persons[i].IsUsedName == "是" ? true : false;
|
||||||
getPerson.IsCardUsed = persons[i].IsCardUsedName == "是" ? true : false;
|
getPerson.IsCardUsed = persons[i].IsCardUsedName == "是" ? true : false;
|
||||||
getPerson.IsCardNoOK = IDCardValid.CheckIDCard(persons[i].IdentityCard);
|
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();
|
Funs.DB.SubmitChanges();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1314,5 +1325,134 @@ namespace FineUIPro.Web.HSSE.SitePerson
|
||||||
{
|
{
|
||||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("PersonBaseData.aspx", "查看 - ")));
|
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,10 +7,12 @@
|
||||||
// </自动生成>
|
// </自动生成>
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
namespace FineUIPro.Web.HSSE.SitePerson {
|
namespace FineUIPro.Web.HSSE.SitePerson
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
public partial class PersonIn {
|
public partial class PersonIn
|
||||||
|
{
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// form1 控件。
|
/// form1 控件。
|
||||||
|
@ -84,6 +86,15 @@ namespace FineUIPro.Web.HSSE.SitePerson {
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
protected global::FineUIPro.Button btnSave;
|
protected global::FineUIPro.Button btnSave;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// btnOut 控件。
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// 自动生成的字段。
|
||||||
|
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||||
|
/// </remarks>
|
||||||
|
protected global::FineUIPro.Button btnOut;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// btnDownLoad 控件。
|
/// btnDownLoad 控件。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
Loading…
Reference in New Issue