This commit is contained in:
parent
eee2211349
commit
1133cfd7d5
|
|
@ -3170,6 +3170,10 @@ namespace BLL
|
|||
/// </summary>
|
||||
public const string CheckSpecialTemplateUrl = "File\\Excel\\DataIn\\专项检查导入模板.xls";
|
||||
/// <summary>
|
||||
/// 专项检查明细导入模板
|
||||
/// </summary>
|
||||
public const string CheckSpecialDetailTemplateUrl = "File\\Excel\\DataIn\\专项检查明细导入模板.xls";
|
||||
/// <summary>
|
||||
/// 综合检查导入模板
|
||||
/// </summary>
|
||||
public const string CheckColligationTemplateUrl = "File\\Excel\\DataIn\\综合检查导入模板.xls";
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -145,6 +145,9 @@
|
|||
<Reference Include="System.ServiceModel" />
|
||||
<Reference Include="System.ServiceProcess" />
|
||||
<Reference Include="System.Transactions" />
|
||||
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\net461\System.ValueTuple.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.DataVisualization" />
|
||||
<Reference Include="System.Web.DynamicData" />
|
||||
<Reference Include="System.Web.Entity" />
|
||||
|
|
@ -982,6 +985,7 @@
|
|||
<Content Include="HSSE\Check\CheckHolidayEdit.aspx" />
|
||||
<Content Include="HSSE\Check\CheckHolidayPrint.aspx" />
|
||||
<Content Include="HSSE\Check\CheckHolidayView.aspx" />
|
||||
<Content Include="HSSE\Check\CheckSpecialDetailIn.aspx" />
|
||||
<Content Include="HSSE\Check\CheckSpecialProEdit.aspx" />
|
||||
<Content Include="HSSE\Check\CheckSpecialPro.aspx" />
|
||||
<Content Include="HSSE\Check\CheckSpecial.aspx" />
|
||||
|
|
@ -11373,6 +11377,13 @@
|
|||
<Compile Include="HSSE\Check\CheckHolidayView.aspx.designer.cs">
|
||||
<DependentUpon>CheckHolidayView.aspx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="HSSE\Check\CheckSpecialDetailIn.aspx.cs">
|
||||
<DependentUpon>CheckSpecialDetailIn.aspx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="HSSE\Check\CheckSpecialDetailIn.aspx.designer.cs">
|
||||
<DependentUpon>CheckSpecialDetailIn.aspx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="HSSE\Check\CheckSpecialProEdit.aspx.cs">
|
||||
<DependentUpon>CheckSpecialProEdit.aspx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,80 @@
|
|||
<%@ Page Language="C#" CodeBehind="CheckSpecialDetailIn.aspx.cs" Inherits="FineUIPro.Web.HSSE.Check.CheckSpecialProDetailIn" %>
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head runat="server">
|
||||
<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" Text="审核"
|
||||
OnClick="btnAudit_Click">
|
||||
</f:Button>
|
||||
<f:Button ID="btnImport" Icon="ApplicationGet" runat="server" ToolTip="导入" ValidateForms="SimpleForm1" Text="导入"
|
||||
OnClick="btnImport_Click">
|
||||
</f:Button>
|
||||
<f:Button ID="btnDownLoad" runat="server" Icon="ApplicationGo" ToolTip="下载模板" Text="下载模板" 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="gvErrorInfo" ShowBorder="true" EnableAjax="false" ShowHeader="false" Title="导入质量隐患" EnableCollapse="true"
|
||||
runat="server" BoxFlex="1" AllowCellEditing="true" ClicksToEdit="2" AllowSorting="true"
|
||||
SortDirection="DESC" EnableColumnLines="true" ForceFit="true" AllowPaging="true" IsDatabasePaging="true" PageSize="10"
|
||||
EnableRowDoubleClickEvent="true" AllowFilters="true" EnableTextSelection="True">
|
||||
<Columns>
|
||||
<f:TemplateField ColumnID="tfPageIndex" Width="40px" HeaderText="序号" HeaderTextAlign="Center" TextAlign="Center"
|
||||
EnableLock="true" Locked="False">
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="lblPageIndex" runat="server" Text='<%# gvErrorInfo.PageIndex * gvErrorInfo.PageSize + Container.DataItemIndex + 1 %>'></asp:Label>
|
||||
</ItemTemplate>
|
||||
</f:TemplateField>
|
||||
<f:BoundField DataField="Row" HeaderText="错误行号" Width="50px">
|
||||
</f:BoundField>
|
||||
<f:BoundField DataField="Column" HeaderText="错误列" Width="100px">
|
||||
</f:BoundField>
|
||||
<f:BoundField DataField="Reason" HeaderText="错误类型" MinWidth="220px">
|
||||
</f:BoundField>
|
||||
</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 导入模板为.xls后缀的EXCEL文件,有背景色列为必填项。2 数据导入完成,成功后自动返回,如果有不成功数据页面弹出提示框,列表显示导入成功数据。">
|
||||
</f:Label>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
</Rows>
|
||||
</f:Form>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,570 @@
|
|||
using BLL;
|
||||
using BLL.Common;
|
||||
using FineUIPro.Web.BaseInfo;
|
||||
using FineUIPro.Web.DataShow;
|
||||
using Model;
|
||||
using NPOI.SS.UserModel;
|
||||
using NPOI.XSSF.UserModel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Web.Services.Description;
|
||||
|
||||
namespace FineUIPro.Web.HSSE.Check
|
||||
{
|
||||
public partial class CheckSpecialProDetailIn : PageBase
|
||||
{
|
||||
#region 定义变量
|
||||
|
||||
/// <summary>
|
||||
/// 上传预设的虚拟路径
|
||||
/// </summary>
|
||||
private string initPath = Const.ExcelUrl;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 错误集合
|
||||
/// </summary>
|
||||
public static List<Model.ErrorInfo> errorInfos = new List<Model.ErrorInfo>();
|
||||
|
||||
/// <summary>
|
||||
/// 项目id
|
||||
/// </summary>
|
||||
public string ProjectId
|
||||
{
|
||||
get
|
||||
{
|
||||
return (string)ViewState["ProjectId"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["ProjectId"] = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 检查id
|
||||
/// </summary>
|
||||
public string CheckSpecialId
|
||||
{
|
||||
get
|
||||
{
|
||||
return (string)ViewState["CheckSpecialId"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["CheckSpecialId"] = value;
|
||||
}
|
||||
}
|
||||
public static int Cols = 11;//列数
|
||||
|
||||
public static Dictionary<string, string> imgDic = new Dictionary<string, string>();
|
||||
//public static List<string> unitWorks = new List<string>();
|
||||
public static List<WBS_UnitWork> unitWorks = new List<WBS_UnitWork>();
|
||||
public static List<Base_Unit> units = new List<Base_Unit>();
|
||||
public static List<Sys_User> hseManagers = new List<Sys_User>();
|
||||
public static List<HSSE_Hazard_HazardRegisterTypes> types = new List<HSSE_Hazard_HazardRegisterTypes>();
|
||||
|
||||
public static List<string> validLevelStrings = new List<string> { "低风险", "一般风险", "较大风险", "重大风险" };
|
||||
public static List<string> validStateStrings = new List<string> { "待整改", "已整改" };
|
||||
public static List<string> validTypeStrings = new List<string> { "当场纠正", "口头警告" };
|
||||
|
||||
#endregion
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
this.ProjectId = Request.Params["ProjectId"];
|
||||
this.CheckSpecialId = Request.Params["CheckSpecialId"];
|
||||
|
||||
///单位工程
|
||||
var unitWorkList = (from x in Funs.DB.WBS_UnitWork
|
||||
where x.ProjectId == this.ProjectId && x.SuperUnitWork == null
|
||||
orderby x.UnitWorkCode
|
||||
select x).ToList();
|
||||
//var unitWorkList = (from x in Funs.DB.WBS_UnitWork
|
||||
// where x.ProjectId == this.ProjectId && x.SuperUnitWork == null
|
||||
// orderby x.UnitWorkCode
|
||||
// select new
|
||||
// {
|
||||
// x.UnitWorkId,
|
||||
// UnitWorkName = UnitWorkService.GetUnitWorkALLName(x.UnitWorkId)
|
||||
// }).ToList();
|
||||
if (unitWorkList.Any())
|
||||
{
|
||||
unitWorks.AddRange(unitWorkList);
|
||||
//unitWorks.AddRange(unitWorkList.Select(x => x.UnitWorkName));
|
||||
}
|
||||
//受检单位
|
||||
units = (from x in Funs.DB.Base_Unit
|
||||
join y in Funs.DB.Project_ProjectUnit on x.UnitId equals y.UnitId
|
||||
where y.ProjectId == this.ProjectId
|
||||
orderby x.UnitCode
|
||||
select x).ToList();
|
||||
//HSE经理
|
||||
hseManagers = BLL.ProjectUserService.GetProjectUserByUnitidAndProjectId(this.ProjectId, Const.HSSEManager);
|
||||
//安全巡检类型
|
||||
types = BLL.HSSE_Hazard_HazardRegisterTypesService.GetHazardRegisterTypesList("1");
|
||||
|
||||
|
||||
this.hdFileName.Text = string.Empty;
|
||||
if (errorInfos != null)
|
||||
{
|
||||
errorInfos.Clear();
|
||||
}
|
||||
|
||||
//if (this.CurrUser.UserId == Const.AdminId)
|
||||
//{
|
||||
// this.btnFastImport.Hidden = false;
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
#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.CheckSpecialDetailTemplateUrl;
|
||||
string filePath = Const.CheckSpecialDetailTemplateUrl;
|
||||
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="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" && IsXls != ".xlsx")
|
||||
{
|
||||
ShowNotify("只可以选择Excel文件!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
if (errorInfos != null)
|
||||
{
|
||||
errorInfos.Clear();
|
||||
}
|
||||
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);
|
||||
AuditExcelAndShowResult(filePath);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ShowNotify("'" + ex.Message + "'", MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 审核Excel并展示校验结果
|
||||
/// </summary>
|
||||
private void AuditExcelAndShowResult(string fileName)
|
||||
{
|
||||
try
|
||||
{
|
||||
string msg = string.Empty;
|
||||
var dt =NPOIHelper.ExcelToDataSet(fileName, out msg, true);
|
||||
if (dt != null)
|
||||
{
|
||||
//string rootPath = Server.MapPath("~/");
|
||||
//var localPath = ConfigurationManager.AppSettings["localRoot"];
|
||||
//imgDic = NPOIHelper.ExtractDispimgImagesFromXml(rootPath + initPath + this.hdFileName.Text, localPath + "FileUpload/CheckSpecial");
|
||||
ValidateExcelData(dt.Tables[0], false);
|
||||
hdCheckResult.Text = "1";
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
BLL.ErrLogInfo.WriteLog("", exc);
|
||||
Response.Write(exc);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 校验Excel数据(仅校验)
|
||||
/// </summary>
|
||||
/// <param name="pds"></param>
|
||||
/// <param name="import">true:导入;false:审核</param>
|
||||
/// <returns></returns>
|
||||
private bool ValidateExcelData(DataTable pds, bool import)
|
||||
{
|
||||
int ic = pds.Columns.Count;
|
||||
if (ic < Cols)
|
||||
{
|
||||
ShowNotify($"导入Excel格式错误!Excel只有{ic}列", MessageBoxIcon.Warning);
|
||||
return false;
|
||||
}
|
||||
int ir = pds.Rows.Count;
|
||||
if (pds == null || ir <= 0)
|
||||
{
|
||||
ShowNotify("导入数据为空!", MessageBoxIcon.Warning);
|
||||
return false;
|
||||
}
|
||||
var errors = new List<ErrorInfo>();
|
||||
for (int i = 0; i < ir; i++)
|
||||
{
|
||||
var (error, _) = ValidateRowAndBuildEntity(pds.Rows[i], (i + 2).ToString(), import);
|
||||
if (error.Any()) { errors.AddRange(error); }
|
||||
}
|
||||
errorInfos.Clear();
|
||||
errorInfos.AddRange(errors);
|
||||
this.gvErrorInfo.DataSource = errorInfos;
|
||||
this.gvErrorInfo.DataBind();
|
||||
if (errors.Count > 0)
|
||||
{
|
||||
ShowNotify("存在校验错误,请查看错误列表并修正后再次导入。", MessageBoxIcon.Warning);
|
||||
return false;
|
||||
}
|
||||
ShowNotify("审核完成,请点击导入!", MessageBoxIcon.Success);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 校验单行并生成实体(字段顺序与新模板一致)
|
||||
/// </summary>
|
||||
private (List<ErrorInfo> lstError, Model.Check_CheckSpecialProDetail entity) ValidateRowAndBuildEntity(DataRow row, string displayRow, bool import)
|
||||
{
|
||||
List<ErrorInfo> lstError = new List<ErrorInfo>();
|
||||
// 新模板字段顺序
|
||||
string checkAreaName = row[0]?.ToString().Trim(); // 单位工程
|
||||
string checkUnitName = row[1]?.ToString().Trim(); // 受检单位
|
||||
string hseManageName = row[2]?.ToString().Trim(); // HSE经理
|
||||
string description = row[3]?.ToString().Trim(); // 问题描述
|
||||
string urls = row[4]?.ToString().Trim(); // 问题图片地址
|
||||
string checkItemName = row[5]?.ToString().Trim(); // 问题类型
|
||||
string levelName = row[6]?.ToString().Trim(); // 风险级别
|
||||
string completeStatusName = row[7]?.ToString().Trim(); // 现场处理结果
|
||||
string handMethod = row[8]?.ToString().Trim(); // 处理方式
|
||||
string limitedDateStr = row[9]?.ToString().Trim(); // 限时日期
|
||||
string suggestions = row[10]?.ToString().Trim(); // 整改要求
|
||||
|
||||
string CheckArea = string.Empty;
|
||||
string UnitId = string.Empty;
|
||||
string HSEManageId = string.Empty;
|
||||
string CheckContent = string.Empty;
|
||||
string CheckItem = string.Empty;
|
||||
string RiskLevel = string.Empty;
|
||||
bool CompleteStatus = false;
|
||||
DateTime? CompletedDate = null;
|
||||
string RectifyOpinion = string.Empty;
|
||||
DateTime? LimitedDate = null;
|
||||
string Suggestions = string.Empty;
|
||||
|
||||
// 校验并转换
|
||||
if (!string.IsNullOrEmpty(checkAreaName))
|
||||
{
|
||||
if (unitWorks.Any(x => x.UnitWorkName == checkAreaName))
|
||||
{
|
||||
//CheckArea = checkAreaName;
|
||||
CheckArea = unitWorks.Where(x => x.UnitWorkName == checkAreaName).FirstOrDefault().UnitWorkId;
|
||||
}
|
||||
else
|
||||
{
|
||||
lstError.Add(new ErrorInfo { Row = displayRow, Column = "单位工程", Reason = $"单位工程名称[{checkAreaName}]不存在" });
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
lstError.Add(new ErrorInfo { Row = displayRow, Column = "单位工程", Reason = "不能为空" });
|
||||
}
|
||||
if (!string.IsNullOrEmpty(checkUnitName))
|
||||
{
|
||||
if (units.Any(x => x.UnitName == checkUnitName))
|
||||
{
|
||||
UnitId = units.Where(x => x.UnitName == checkUnitName).FirstOrDefault().UnitId;
|
||||
}
|
||||
else
|
||||
{
|
||||
lstError.Add(new ErrorInfo { Row = displayRow, Column = "受检单位", Reason = $"受检单位名称[{checkUnitName}]不存在" });
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
lstError.Add(new ErrorInfo { Row = displayRow, Column = "受检单位", Reason = "不能为空" });
|
||||
}
|
||||
if (!string.IsNullOrEmpty(hseManageName))
|
||||
{
|
||||
if (hseManagers.Any(x => x.UserName == hseManageName))
|
||||
{
|
||||
HSEManageId = hseManagers.Where(x => x.UserName == hseManageName).FirstOrDefault().UserId;
|
||||
}
|
||||
else
|
||||
{
|
||||
lstError.Add(new ErrorInfo { Row = displayRow, Column = "HSE经理", Reason = $"项目不存在用户[{hseManageName}]" });
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(checkItemName))
|
||||
{
|
||||
if (types.Any(x => x.RegisterTypesName == checkItemName))
|
||||
{
|
||||
CheckContent = checkItemName;
|
||||
CheckItem = types.Where(x => x.RegisterTypesName == checkItemName).FirstOrDefault().RegisterTypesId;
|
||||
}
|
||||
else
|
||||
{
|
||||
lstError.Add(new ErrorInfo { Row = displayRow, Column = "问题类型", Reason = $"问题类型[{checkItemName}]不存在" });
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(levelName))
|
||||
{
|
||||
if (validLevelStrings.Any(x => x == levelName))
|
||||
{
|
||||
switch (levelName)
|
||||
{
|
||||
case "低": RiskLevel = "0"; break;
|
||||
case "一般": RiskLevel = "1"; break;
|
||||
case "较高": RiskLevel = "2"; break;
|
||||
case "高": RiskLevel = "3"; break;
|
||||
default: RiskLevel = "0"; break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
lstError.Add(new ErrorInfo { Row = displayRow, Column = "风险级别", Reason = $"风险级别[{levelName}]不存在" });
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(completeStatusName))
|
||||
{
|
||||
if (validStateStrings.Any(x => x == completeStatusName))
|
||||
{
|
||||
if (completeStatusName == "已整改")
|
||||
{
|
||||
CompleteStatus = true;
|
||||
CompletedDate = DateTime.Now;
|
||||
}
|
||||
else
|
||||
{
|
||||
CompleteStatus = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
lstError.Add(new ErrorInfo { Row = displayRow, Column = "现场处理结果", Reason = $"现场处理结果[{completeStatusName}]不存在" });
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(handMethod))
|
||||
{
|
||||
if (validTypeStrings.Any(x => x == handMethod))
|
||||
{
|
||||
RectifyOpinion = handMethod;
|
||||
}
|
||||
else
|
||||
{
|
||||
lstError.Add(new ErrorInfo { Row = displayRow, Column = "处理方式", Reason = $"处理方式[{handMethod}]不存在" });
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(limitedDateStr))
|
||||
{
|
||||
if (!DateTime.TryParse(limitedDateStr, out DateTime ct))
|
||||
lstError.Add(new ErrorInfo { Row = displayRow, Column = "限时日期", Reason = "日期格式错误" });
|
||||
LimitedDate = ct;
|
||||
}
|
||||
else
|
||||
{
|
||||
lstError.Add(new ErrorInfo { Row = displayRow, Column = "限时日期", Reason = "不能为空" });
|
||||
}
|
||||
if (!string.IsNullOrEmpty(suggestions))
|
||||
{
|
||||
Suggestions = suggestions;
|
||||
}
|
||||
//if (import)
|
||||
//{图片待处理
|
||||
// try
|
||||
// {
|
||||
// urls = urls.Substring(urls.IndexOf('"') + 1, urls.LastIndexOf('"') - urls.IndexOf('"') - 1);
|
||||
// var sss = imgDic.ContainsKey(urls) ? imgDic[urls].Replace(Funs.RootPath, "") : "";
|
||||
// }
|
||||
// catch (Exception e) { }
|
||||
//}
|
||||
|
||||
if (lstError.Any())
|
||||
{
|
||||
return (lstError, null);
|
||||
}
|
||||
|
||||
// 其余字段可根据实际业务映射到实体
|
||||
var entity = new Model.Check_CheckSpecialProDetail
|
||||
{
|
||||
CheckSpecialDetailId = SQLHelper.GetNewID(),
|
||||
CheckSpecialId = this.CheckSpecialId,
|
||||
CheckArea = CheckArea,
|
||||
UnitId = UnitId,
|
||||
HSEManage = HSEManageId,
|
||||
Unqualified = description,
|
||||
CheckContent = CheckContent,
|
||||
CheckItem = CheckItem,
|
||||
RiskLevel = RiskLevel,
|
||||
CompleteStatus = CompleteStatus,
|
||||
CompletedDate = CompletedDate,
|
||||
RectifyOpinion = RectifyOpinion,
|
||||
LimitedDate = LimitedDate,
|
||||
Suggestions = Suggestions
|
||||
};
|
||||
return (lstError, entity);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 导入
|
||||
|
||||
/// <summary>
|
||||
/// 导入
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnImport_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (hdCheckResult.Text == "1")
|
||||
{
|
||||
if (errorInfos.Count <= 0)
|
||||
{
|
||||
string rootPath = Server.MapPath("~/");
|
||||
var localPath = ConfigurationManager.AppSettings["localRoot"];
|
||||
//imgDic = NPOIHelper.ExtractDispimgImagesFromXml(rootPath + initPath + this.hdFileName.Text, localPath + "FileUpload/CheckSpecial");
|
||||
ImportExcelToDatabase(rootPath + initPath + this.hdFileName.Text, true);
|
||||
|
||||
hdCheckResult.Text = string.Empty;
|
||||
ShowNotify("导入成功!", MessageBoxIcon.Success);
|
||||
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowNotify("请先将错误数据修正,再重新导入提交!", MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowNotify("请先审核要导入的文件!", MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 导入Excel到数据库
|
||||
/// </summary>
|
||||
private void ImportExcelToDatabase(string fileName, bool import)
|
||||
{
|
||||
try
|
||||
{
|
||||
string msg = string.Empty;
|
||||
var dt = NPOIHelper.ExcelToDataSet(fileName, out msg, true);
|
||||
BLL.ErrLogInfo.WriteLog(msg);
|
||||
SaveExcelDataToDatabase(fileName, dt.Tables[0], import);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ErrLogInfo.WriteLog("", ex);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 校验并保存数据到数据库
|
||||
/// </summary>
|
||||
private bool SaveExcelDataToDatabase(string fileName, DataTable pds, bool import)
|
||||
{
|
||||
int ic = pds.Columns.Count;
|
||||
if (ic < Cols)
|
||||
{
|
||||
ShowNotify($"导入Excel格式错误!Excel只有{ic}列", MessageBoxIcon.Warning);
|
||||
return false;
|
||||
}
|
||||
int ir = pds.Rows.Count;
|
||||
if (pds == null || ir <= 0)
|
||||
{
|
||||
ShowNotify("导入数据为空!", MessageBoxIcon.Warning);
|
||||
return false;
|
||||
}
|
||||
var errors = new List<ErrorInfo>();
|
||||
var toInsert = new List<Model.Check_CheckSpecialProDetail>();
|
||||
|
||||
for (int i = 0; i < ir; i++)
|
||||
{
|
||||
var (error, entity) = ValidateRowAndBuildEntity(pds.Rows[i], (i + 2).ToString(), import);
|
||||
if (error.Any())
|
||||
errors.AddRange(error);
|
||||
else
|
||||
toInsert.Add(entity);
|
||||
}
|
||||
if (errors.Count > 0)
|
||||
{
|
||||
errorInfos.Clear();
|
||||
errorInfos.AddRange(errors);
|
||||
this.gvErrorInfo.DataSource = errorInfos;
|
||||
this.gvErrorInfo.DataBind();
|
||||
ShowNotify("存在校验错误,请先审核并修正后再导入。", MessageBoxIcon.Warning);
|
||||
return false;
|
||||
}
|
||||
try
|
||||
{
|
||||
if (toInsert.Any())
|
||||
{
|
||||
Funs.DB.Check_CheckSpecialProDetail.InsertAllOnSubmit(toInsert);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
ShowNotify($"成功导入 {toInsert.Count} 条记录。", MessageBoxIcon.Success);
|
||||
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ErrLogInfo.WriteLog("导入 Check_CheckSpecialProDetail 失败", ex);
|
||||
ShowNotify("导入失败:" + ex.Message, MessageBoxIcon.Error);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion // 导入
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,143 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <自动生成>
|
||||
// 此代码由工具生成。
|
||||
//
|
||||
// 对此文件的更改可能导致不正确的行为,如果
|
||||
// 重新生成代码,则所做更改将丢失。
|
||||
// </自动生成>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace FineUIPro.Web.HSSE.Check
|
||||
{
|
||||
|
||||
|
||||
public partial class CheckSpecialProDetailIn
|
||||
{
|
||||
|
||||
/// <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>
|
||||
/// btnDownLoad 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnDownLoad;
|
||||
|
||||
/// <summary>
|
||||
/// fuAttachUrl 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.FileUpload fuAttachUrl;
|
||||
|
||||
/// <summary>
|
||||
/// gvErrorInfo 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Grid gvErrorInfo;
|
||||
|
||||
/// <summary>
|
||||
/// lblPageIndex 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label lblPageIndex;
|
||||
|
||||
/// <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;
|
||||
}
|
||||
}
|
||||
|
|
@ -56,7 +56,7 @@
|
|||
</f:Button>
|
||||
<%-- <f:Button ID="btnDelete" Text="删除" Icon="Delete" EnablePostBack="false" runat="server">
|
||||
</f:Button>--%>
|
||||
<f:Button ID="btnImport" ToolTip="导入" Text="导入" Icon="ApplicationGet" Hidden="true" runat="server"
|
||||
<f:Button ID="btnImport" ToolTip="导入" Text="导入" Icon="ApplicationGet" runat="server"
|
||||
OnClick="btnImport_Click">
|
||||
</f:Button>
|
||||
</Items>
|
||||
|
|
|
|||
|
|
@ -759,7 +759,7 @@ namespace FineUIPro.Web.HSSE.Check
|
|||
{
|
||||
SaveNew();
|
||||
}
|
||||
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("CheckSpecialDetailIn.aspx?ProjectId={0}&CheckSpecialId={1}", this.ProjectId, this.CheckSpecialId, "导入 - ")));
|
||||
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("CheckSpecialProDetailIn.aspx?ProjectId={0}&CheckSpecialId={1}", this.ProjectId, this.CheckSpecialId, "导入 - ")));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -13,4 +13,5 @@
|
|||
<package id="System.Security.AccessControl" version="6.0.0" targetFramework="net461" />
|
||||
<package id="System.Security.Permissions" version="6.0.0" targetFramework="net461" />
|
||||
<package id="System.Security.Principal.Windows" version="5.0.0" targetFramework="net461" />
|
||||
<package id="System.ValueTuple" version="4.5.0" targetFramework="net461" />
|
||||
</packages>
|
||||
|
|
@ -1,4 +1,7 @@
|
|||
using System;
|
||||
using BLL;
|
||||
using Microsoft.Ajax.Utilities;
|
||||
using Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.IO;
|
||||
|
|
@ -6,8 +9,6 @@ using System.Linq;
|
|||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Web.Http;
|
||||
using BLL;
|
||||
using Model;
|
||||
using WebAPI.Filter;
|
||||
|
||||
namespace WebAPI.Controllers
|
||||
|
|
@ -42,7 +43,7 @@ namespace WebAPI.Controllers
|
|||
if (getProject != null)
|
||||
{
|
||||
projectId = getProject.ProjectId;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(projectId))
|
||||
{
|
||||
|
|
@ -103,7 +104,7 @@ namespace WebAPI.Controllers
|
|||
isIn = 1;
|
||||
}
|
||||
APIPersonService.getPersonInOut(getPerson, isIn, facerecord.DateTimeRecord.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
responeData.message = "插入成功!";
|
||||
}
|
||||
|
|
@ -157,116 +158,116 @@ namespace WebAPI.Controllers
|
|||
{
|
||||
var getUnit = UnitService.getUnitByCollCropCodeUnitName(person.CollCropCode, person.UnitName);
|
||||
if (getUnit != null)
|
||||
{
|
||||
Model.SitePerson_Person newPerson = new Model.SitePerson_Person
|
||||
{
|
||||
PersonId = SQLHelper.GetNewID(),
|
||||
ProjectId = getProject.ProjectId,
|
||||
UnitId = getUnit.UnitId,
|
||||
PersonName = person.PersonName,
|
||||
IdentityCard = person.IdentityCard,
|
||||
IdcardType = "SHENFEN_ZHENGJIAN",
|
||||
IdcardAddress = person.IdcardAddress,
|
||||
IdcardForever = "N",
|
||||
IdcardStartDate = Funs.GetNewDateTime(person.IdcardStartDate),
|
||||
IdcardEndDate = Funs.GetNewDateTime(person.IdcardEndDate),
|
||||
Sex = (person.Sex == "女" || person.Sex == "2") ? "2" : "1",
|
||||
Address = person.Address,
|
||||
OutResult = person.OutResult,
|
||||
Birthday = person.Birthday,
|
||||
Telephone = person.Telephone,
|
||||
IsUsed = person.IsUsed == false ? false : true,
|
||||
InTime = Funs.GetNewDateTimeOrNow(person.InTime),
|
||||
Password = BLL.PersonService.GetPersonPassWord(person.IdentityCard),
|
||||
Isprint = "0",
|
||||
//PositionId = person.PositionId,
|
||||
//PostTitleId = person.PostTitleId,
|
||||
//IsForeign = person.IsForeign,
|
||||
//IsOutside = person.IsOutside,
|
||||
//EduLevel = person.EduLevel,
|
||||
//MaritalStatus = person.MaritalStatus,
|
||||
//PoliticsStatus = person.PoliticsStatus,
|
||||
//Nation = person.Nation,
|
||||
//CountryCode = person.CountryCode,
|
||||
//ProvinceCode = person.ProvinceCode,
|
||||
};
|
||||
{
|
||||
Model.SitePerson_Person newPerson = new Model.SitePerson_Person
|
||||
{
|
||||
PersonId = SQLHelper.GetNewID(),
|
||||
ProjectId = getProject.ProjectId,
|
||||
UnitId = getUnit.UnitId,
|
||||
PersonName = person.PersonName,
|
||||
IdentityCard = person.IdentityCard,
|
||||
IdcardType = "SHENFEN_ZHENGJIAN",
|
||||
IdcardAddress = person.IdcardAddress,
|
||||
IdcardForever = "N",
|
||||
IdcardStartDate = Funs.GetNewDateTime(person.IdcardStartDate),
|
||||
IdcardEndDate = Funs.GetNewDateTime(person.IdcardEndDate),
|
||||
Sex = (person.Sex == "女" || person.Sex == "2") ? "2" : "1",
|
||||
Address = person.Address,
|
||||
OutResult = person.OutResult,
|
||||
Birthday = person.Birthday,
|
||||
Telephone = person.Telephone,
|
||||
IsUsed = person.IsUsed == false ? false : true,
|
||||
InTime = Funs.GetNewDateTimeOrNow(person.InTime),
|
||||
Password = BLL.PersonService.GetPersonPassWord(person.IdentityCard),
|
||||
Isprint = "0",
|
||||
//PositionId = person.PositionId,
|
||||
//PostTitleId = person.PostTitleId,
|
||||
//IsForeign = person.IsForeign,
|
||||
//IsOutside = person.IsOutside,
|
||||
//EduLevel = person.EduLevel,
|
||||
//MaritalStatus = person.MaritalStatus,
|
||||
//PoliticsStatus = person.PoliticsStatus,
|
||||
//Nation = person.Nation,
|
||||
//CountryCode = person.CountryCode,
|
||||
//ProvinceCode = person.ProvinceCode,
|
||||
};
|
||||
|
||||
if (!string.IsNullOrEmpty(person.TeamGroupName) && !string.IsNullOrEmpty(newPerson.UnitId))
|
||||
if (!string.IsNullOrEmpty(person.TeamGroupName) && !string.IsNullOrEmpty(newPerson.UnitId))
|
||||
{
|
||||
var getTeamGroup = TeamGroupService.getTeamGroupByTeamGroupName(getProject.ProjectId, newPerson.UnitId, person.TeamGroupName);
|
||||
if (getTeamGroup != null)
|
||||
{
|
||||
var getTeamGroup = TeamGroupService.getTeamGroupByTeamGroupName(getProject.ProjectId, newPerson.UnitId, person.TeamGroupName);
|
||||
if (getTeamGroup != null)
|
||||
newPerson.TeamGroupId = getTeamGroup.TeamGroupId;
|
||||
}
|
||||
else
|
||||
{
|
||||
Model.ProjectData_TeamGroup newTeamGroup = new Model.ProjectData_TeamGroup
|
||||
{
|
||||
newPerson.TeamGroupId = getTeamGroup.TeamGroupId;
|
||||
}
|
||||
else
|
||||
{
|
||||
Model.ProjectData_TeamGroup newTeamGroup = new Model.ProjectData_TeamGroup
|
||||
{
|
||||
TeamGroupId = SQLHelper.GetNewID(),
|
||||
ProjectId = getProject.ProjectId,
|
||||
UnitId = newPerson.UnitId,
|
||||
TeamGroupName = person.TeamGroupName,
|
||||
Remark = "来源:门禁对接数据",
|
||||
TeamTypeId = "CANJIAN_TEAM",
|
||||
EntryTime = System.DateTime.Now,
|
||||
RealNamePushTime = null,
|
||||
};
|
||||
db.ProjectData_TeamGroup.InsertOnSubmit(newTeamGroup);
|
||||
db.SubmitChanges();
|
||||
newPerson.TeamGroupId = newTeamGroup.TeamGroupId;
|
||||
}
|
||||
TeamGroupId = SQLHelper.GetNewID(),
|
||||
ProjectId = getProject.ProjectId,
|
||||
UnitId = newPerson.UnitId,
|
||||
TeamGroupName = person.TeamGroupName,
|
||||
Remark = "来源:门禁对接数据",
|
||||
TeamTypeId = "CANJIAN_TEAM",
|
||||
EntryTime = System.DateTime.Now,
|
||||
RealNamePushTime = null,
|
||||
};
|
||||
db.ProjectData_TeamGroup.InsertOnSubmit(newTeamGroup);
|
||||
db.SubmitChanges();
|
||||
newPerson.TeamGroupId = newTeamGroup.TeamGroupId;
|
||||
}
|
||||
var getWorkArea = UnitWorkService.GetUnitWorkByUnitWorkName(getProject.ProjectId, person.WorkAreaName);
|
||||
if (getWorkArea != null)
|
||||
}
|
||||
var getWorkArea = UnitWorkService.GetUnitWorkByUnitWorkName(getProject.ProjectId, person.WorkAreaName);
|
||||
if (getWorkArea != null)
|
||||
{
|
||||
newPerson.WorkAreaId = getWorkArea.UnitWorkId;
|
||||
}
|
||||
var getWorkPost = WorkPostService.GetWorkPostByName(person.WorkPostName);
|
||||
if (getWorkPost != null)
|
||||
{
|
||||
newPerson.WorkPostId = getWorkPost.WorkPostId;
|
||||
}
|
||||
var getHsseMan = ProjectService.getHSSEManager(getProject.ProjectId);
|
||||
if (getHsseMan != null)
|
||||
{
|
||||
newPerson.AuditorId = getHsseMan.UserId;
|
||||
newPerson.AuditorDate = DateTime.Now;
|
||||
}
|
||||
newPerson.OutTime = Funs.GetNewDateTime(person.OutTime);
|
||||
if (person.headImage.Length == 0 && !string.IsNullOrEmpty(person.PhotoUrl))
|
||||
{
|
||||
var getS = AttachFileService.SetImageToByteArray(person.PhotoUrl);
|
||||
if (getS != null)
|
||||
{
|
||||
newPerson.WorkAreaId = getWorkArea.UnitWorkId;
|
||||
person.headImage = getS.ToString();
|
||||
}
|
||||
var getWorkPost = WorkPostService.GetWorkPostByName(person.WorkPostName);
|
||||
if (getWorkPost != null)
|
||||
}
|
||||
if (person.headImage.Length > 0)
|
||||
{
|
||||
var image = Convert.FromBase64String(person.headImage);
|
||||
newPerson.HeadImage = image;
|
||||
string rootPath = ConfigurationManager.AppSettings["localRoot"];
|
||||
string path = "FileUpLoad/PersonBaseInfo/" + DateTime.Now.ToString("yyyy-MM") + "/";
|
||||
string fileUrl = (rootPath + path).Replace('/', '\\');
|
||||
string flieName = Funs.GetNewFileName() + "~" + person.PersonName + ".jpg";
|
||||
if (!Directory.Exists(fileUrl))
|
||||
{
|
||||
newPerson.WorkPostId = getWorkPost.WorkPostId;
|
||||
}
|
||||
var getHsseMan = ProjectService.getHSSEManager(getProject.ProjectId);
|
||||
if (getHsseMan != null)
|
||||
{
|
||||
newPerson.AuditorId = getHsseMan.UserId;
|
||||
newPerson.AuditorDate = DateTime.Now;
|
||||
}
|
||||
newPerson.OutTime = Funs.GetNewDateTime(person.OutTime);
|
||||
if (person.headImage.Length == 0 && !string.IsNullOrEmpty(person.PhotoUrl))
|
||||
{
|
||||
var getS = AttachFileService.SetImageToByteArray(person.PhotoUrl);
|
||||
if (getS != null)
|
||||
{
|
||||
person.headImage = getS.ToString();
|
||||
}
|
||||
}
|
||||
if (person.headImage.Length > 0)
|
||||
{
|
||||
var image = Convert.FromBase64String(person.headImage);
|
||||
newPerson.HeadImage = image;
|
||||
string rootPath = ConfigurationManager.AppSettings["localRoot"];
|
||||
string path = "FileUpLoad/PersonBaseInfo/" + DateTime.Now.ToString("yyyy-MM") + "/";
|
||||
string fileUrl = (rootPath + path).Replace('/', '\\');
|
||||
string flieName = Funs.GetNewFileName() + "~" + person.PersonName + ".jpg";
|
||||
if (!Directory.Exists(fileUrl))
|
||||
{
|
||||
Directory.CreateDirectory(fileUrl);
|
||||
}
|
||||
newPerson.PhotoUrl = path + flieName;
|
||||
System.IO.File.WriteAllBytes((fileUrl + flieName), image);
|
||||
//AttachFileService.Base64ToImage(person.headImage, path, person.PersonName);
|
||||
Directory.CreateDirectory(fileUrl);
|
||||
}
|
||||
newPerson.PhotoUrl = path + flieName;
|
||||
System.IO.File.WriteAllBytes((fileUrl + flieName), image);
|
||||
//AttachFileService.Base64ToImage(person.headImage, path, person.PersonName);
|
||||
}
|
||||
|
||||
var getPerson = PersonService.GetPersonByIdentityCard(getProject.ProjectId, person.IdentityCard);
|
||||
if (getPerson == null)
|
||||
if (getPerson == null && !string.IsNullOrWhiteSpace(newPerson.PersonName))
|
||||
{
|
||||
PersonService.AddPerson(newPerson);
|
||||
responeData.message = "新增人员成功!";
|
||||
}
|
||||
else
|
||||
{
|
||||
newPerson.PersonId =getPerson.PersonId;
|
||||
newPerson.PersonId = getPerson.PersonId;
|
||||
PersonService.UpdateDoorPerson(newPerson);
|
||||
responeData.message = "更新人员成功!";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<_PublishTargetUrl>G:\发布\五环WebApi</_PublishTargetUrl>
|
||||
<History>True|2026-02-28T09:34:46.4778856Z||;True|2026-02-28T15:29:45.4981175+08:00||;True|2026-02-28T15:22:44.8350431+08:00||;True|2026-02-28T15:16:49.0265188+08:00||;True|2026-02-28T15:01:52.0489798+08:00||;True|2026-02-28T14:40:09.1723344+08:00||;True|2026-02-28T09:47:26.7601751+08:00||;True|2026-01-24T15:12:59.9025754+08:00||;True|2026-01-19T14:30:45.4370000+08:00||;True|2025-12-24T19:02:35.3684081+08:00||;True|2025-12-18T09:29:13.2909255+08:00||;True|2025-11-25T10:18:00.9729814+08:00||;True|2025-11-25T10:14:14.6947178+08:00||;True|2025-11-25T10:06:29.1167142+08:00||;True|2025-11-25T09:25:18.3566779+08:00||;True|2025-11-24T16:07:37.5433070+08:00||;True|2025-11-19T19:50:54.0090859+08:00||;True|2025-11-19T19:29:28.5861506+08:00||;True|2025-11-19T19:14:02.6887533+08:00||;True|2025-11-19T19:08:28.7856694+08:00||;True|2025-11-17T14:41:29.0529618+08:00||;True|2025-11-17T12:28:22.9224307+08:00||;True|2025-11-17T11:17:50.1481769+08:00||;True|2025-11-07T14:46:56.1446809+08:00||;True|2025-11-05T09:32:06.4998794+08:00||;True|2025-11-04T16:39:28.2175670+08:00||;True|2025-11-04T16:39:02.3610432+08:00||;True|2025-11-04T15:44:06.1295264+08:00||;True|2025-10-31T16:41:11.6570385+08:00||;True|2025-10-30T15:58:05.2014433+08:00||;True|2025-10-29T16:22:27.7866967+08:00||;True|2025-10-29T11:19:32.1187038+08:00||;True|2025-10-24T15:59:19.4176668+08:00||;True|2025-10-23T10:17:32.2384443+08:00||;True|2025-10-23T10:09:35.0601937+08:00||;True|2025-10-23T09:59:27.2018799+08:00||;True|2025-09-29T15:39:36.8617347+08:00||;True|2025-09-29T11:28:10.9193152+08:00||;True|2025-09-29T10:59:58.2893583+08:00||;True|2025-09-23T16:56:39.6344263+08:00||;True|2025-09-23T16:44:57.4175593+08:00||;True|2025-09-23T16:44:35.0478492+08:00||;True|2025-09-23T16:06:50.5843534+08:00||;True|2025-09-22T20:54:35.9805610+08:00||;True|2025-09-22T20:45:58.7044128+08:00||;True|2025-09-22T20:40:46.7449595+08:00||;True|2025-09-22T15:14:22.9602725+08:00||;True|2025-09-22T15:08:27.5989706+08:00||;True|2025-09-22T14:54:19.5237685+08:00||;True|2025-09-18T09:53:17.9300539+08:00||;True|2025-09-16T19:11:12.4383069+08:00||;True|2025-09-02T11:14:00.9580707+08:00||;True|2025-09-02T10:52:20.0445598+08:00||;True|2025-08-29T17:56:01.6245615+08:00||;True|2025-08-29T17:55:41.2802685+08:00||;True|2025-08-09T21:27:40.2103961+08:00||;True|2025-08-06T15:31:52.1166645+08:00||;True|2025-08-04T18:56:13.9675910+08:00||;True|2025-07-23T11:12:18.0134770+08:00||;True|2025-07-23T10:36:09.9990536+08:00||;True|2025-07-23T10:35:51.8814789+08:00||;True|2025-07-21T17:46:45.4620710+08:00||;True|2025-07-21T17:40:43.9871097+08:00||;True|2025-07-21T17:29:11.9275869+08:00||;True|2025-07-21T17:05:21.7763763+08:00||;True|2025-07-18T17:55:59.4892329+08:00||;True|2025-07-18T11:08:56.2628896+08:00||;True|2025-07-18T10:53:44.2534260+08:00||;True|2025-07-18T10:27:52.6751668+08:00||;True|2025-07-18T10:03:09.1785776+08:00||;True|2025-07-18T10:02:38.1252107+08:00||;True|2025-07-17T18:19:07.5837609+08:00||;True|2025-07-17T15:40:11.9126705+08:00||;True|2025-07-11T17:54:03.0298703+08:00||;True|2025-07-11T16:19:50.3283029+08:00||;True|2025-07-11T15:49:22.5920473+08:00||;True|2025-07-02T14:39:27.0436873+08:00||;True|2025-07-02T11:18:29.1208369+08:00||;True|2025-07-01T15:52:16.6767496+08:00||;True|2025-07-01T10:14:59.0471052+08:00||;True|2025-06-28T11:40:36.0544739+08:00||;True|2025-06-27T15:10:24.4628086+08:00||;True|2025-06-27T10:31:14.8332810+08:00||;True|2025-06-27T10:13:13.3022394+08:00||;True|2025-06-26T23:51:04.1304509+08:00||;True|2025-06-26T23:34:06.4223762+08:00||;True|2025-06-26T22:42:08.9018138+08:00||;True|2025-06-26T22:16:01.8954571+08:00||;True|2025-06-26T21:19:42.2638204+08:00||;True|2025-06-25T23:22:39.7267591+08:00||;True|2025-06-25T23:19:33.2378458+08:00||;True|2025-06-25T22:18:16.2863303+08:00||;True|2025-06-25T22:10:29.2540175+08:00||;True|2025-06-25T22:00:58.5212166+08:00||;True|2025-06-25T22:00:31.2531214+08:00||;True|2025-06-25T18:33:01.5770030+08:00||;True|2025-06-25T17:47:33.7779622+08:00||;True|2025-06-25T17:40:26.9905954+08:00||;True|2025-06-20T11:24:58.4099232+08:00||;True|2025-06-19T16:42:45.2358810+08:00||;</History>
|
||||
<History>True|2026-03-01T06:50:18.5222913Z||;True|2026-02-28T17:34:46.4778856+08:00||;True|2026-02-28T15:29:45.4981175+08:00||;True|2026-02-28T15:22:44.8350431+08:00||;True|2026-02-28T15:16:49.0265188+08:00||;True|2026-02-28T15:01:52.0489798+08:00||;True|2026-02-28T14:40:09.1723344+08:00||;True|2026-02-28T09:47:26.7601751+08:00||;True|2026-01-24T15:12:59.9025754+08:00||;True|2026-01-19T14:30:45.4370000+08:00||;True|2025-12-24T19:02:35.3684081+08:00||;True|2025-12-18T09:29:13.2909255+08:00||;True|2025-11-25T10:18:00.9729814+08:00||;True|2025-11-25T10:14:14.6947178+08:00||;True|2025-11-25T10:06:29.1167142+08:00||;True|2025-11-25T09:25:18.3566779+08:00||;True|2025-11-24T16:07:37.5433070+08:00||;True|2025-11-19T19:50:54.0090859+08:00||;True|2025-11-19T19:29:28.5861506+08:00||;True|2025-11-19T19:14:02.6887533+08:00||;True|2025-11-19T19:08:28.7856694+08:00||;True|2025-11-17T14:41:29.0529618+08:00||;True|2025-11-17T12:28:22.9224307+08:00||;True|2025-11-17T11:17:50.1481769+08:00||;True|2025-11-07T14:46:56.1446809+08:00||;True|2025-11-05T09:32:06.4998794+08:00||;True|2025-11-04T16:39:28.2175670+08:00||;True|2025-11-04T16:39:02.3610432+08:00||;True|2025-11-04T15:44:06.1295264+08:00||;True|2025-10-31T16:41:11.6570385+08:00||;True|2025-10-30T15:58:05.2014433+08:00||;True|2025-10-29T16:22:27.7866967+08:00||;True|2025-10-29T11:19:32.1187038+08:00||;True|2025-10-24T15:59:19.4176668+08:00||;True|2025-10-23T10:17:32.2384443+08:00||;True|2025-10-23T10:09:35.0601937+08:00||;True|2025-10-23T09:59:27.2018799+08:00||;True|2025-09-29T15:39:36.8617347+08:00||;True|2025-09-29T11:28:10.9193152+08:00||;True|2025-09-29T10:59:58.2893583+08:00||;True|2025-09-23T16:56:39.6344263+08:00||;True|2025-09-23T16:44:57.4175593+08:00||;True|2025-09-23T16:44:35.0478492+08:00||;True|2025-09-23T16:06:50.5843534+08:00||;True|2025-09-22T20:54:35.9805610+08:00||;True|2025-09-22T20:45:58.7044128+08:00||;True|2025-09-22T20:40:46.7449595+08:00||;True|2025-09-22T15:14:22.9602725+08:00||;True|2025-09-22T15:08:27.5989706+08:00||;True|2025-09-22T14:54:19.5237685+08:00||;True|2025-09-18T09:53:17.9300539+08:00||;True|2025-09-16T19:11:12.4383069+08:00||;True|2025-09-02T11:14:00.9580707+08:00||;True|2025-09-02T10:52:20.0445598+08:00||;True|2025-08-29T17:56:01.6245615+08:00||;True|2025-08-29T17:55:41.2802685+08:00||;True|2025-08-09T21:27:40.2103961+08:00||;True|2025-08-06T15:31:52.1166645+08:00||;True|2025-08-04T18:56:13.9675910+08:00||;True|2025-07-23T11:12:18.0134770+08:00||;True|2025-07-23T10:36:09.9990536+08:00||;True|2025-07-23T10:35:51.8814789+08:00||;True|2025-07-21T17:46:45.4620710+08:00||;True|2025-07-21T17:40:43.9871097+08:00||;True|2025-07-21T17:29:11.9275869+08:00||;True|2025-07-21T17:05:21.7763763+08:00||;True|2025-07-18T17:55:59.4892329+08:00||;True|2025-07-18T11:08:56.2628896+08:00||;True|2025-07-18T10:53:44.2534260+08:00||;True|2025-07-18T10:27:52.6751668+08:00||;True|2025-07-18T10:03:09.1785776+08:00||;True|2025-07-18T10:02:38.1252107+08:00||;True|2025-07-17T18:19:07.5837609+08:00||;True|2025-07-17T15:40:11.9126705+08:00||;True|2025-07-11T17:54:03.0298703+08:00||;True|2025-07-11T16:19:50.3283029+08:00||;True|2025-07-11T15:49:22.5920473+08:00||;True|2025-07-02T14:39:27.0436873+08:00||;True|2025-07-02T11:18:29.1208369+08:00||;True|2025-07-01T15:52:16.6767496+08:00||;True|2025-07-01T10:14:59.0471052+08:00||;True|2025-06-28T11:40:36.0544739+08:00||;True|2025-06-27T15:10:24.4628086+08:00||;True|2025-06-27T10:31:14.8332810+08:00||;True|2025-06-27T10:13:13.3022394+08:00||;True|2025-06-26T23:51:04.1304509+08:00||;True|2025-06-26T23:34:06.4223762+08:00||;True|2025-06-26T22:42:08.9018138+08:00||;True|2025-06-26T22:16:01.8954571+08:00||;True|2025-06-26T21:19:42.2638204+08:00||;True|2025-06-25T23:22:39.7267591+08:00||;True|2025-06-25T23:19:33.2378458+08:00||;True|2025-06-25T22:18:16.2863303+08:00||;True|2025-06-25T22:10:29.2540175+08:00||;True|2025-06-25T22:00:58.5212166+08:00||;True|2025-06-25T22:00:31.2531214+08:00||;True|2025-06-25T18:33:01.5770030+08:00||;True|2025-06-25T17:47:33.7779622+08:00||;True|2025-06-25T17:40:26.9905954+08:00||;True|2025-06-20T11:24:58.4099232+08:00||;</History>
|
||||
<LastFailureDetails />
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
|
|
@ -86,22 +86,22 @@
|
|||
<publishTime>10/28/2024 14:02:50</publishTime>
|
||||
</File>
|
||||
<File Include="bin/App_global.asax.compiled">
|
||||
<publishTime>02/28/2026 17:34:45</publishTime>
|
||||
<publishTime>03/01/2026 14:50:16</publishTime>
|
||||
</File>
|
||||
<File Include="bin/App_global.asax.dll">
|
||||
<publishTime>02/28/2026 17:34:45</publishTime>
|
||||
<publishTime>03/01/2026 14:50:16</publishTime>
|
||||
</File>
|
||||
<File Include="bin/Aspose.Words.dll">
|
||||
<publishTime>12/06/2024 20:13:58</publishTime>
|
||||
</File>
|
||||
<File Include="bin/BLL.dll">
|
||||
<publishTime>02/28/2026 17:34:34</publishTime>
|
||||
<publishTime>03/01/2026 14:49:54</publishTime>
|
||||
</File>
|
||||
<File Include="bin/BLL.dll.config">
|
||||
<publishTime>12/26/2024 09:46:52</publishTime>
|
||||
</File>
|
||||
<File Include="bin/BLL.pdb">
|
||||
<publishTime>02/28/2026 17:34:34</publishTime>
|
||||
<publishTime>03/01/2026 14:49:54</publishTime>
|
||||
</File>
|
||||
<File Include="bin/BouncyCastle.Crypto.dll">
|
||||
<publishTime>12/18/2020 05:32:28</publishTime>
|
||||
|
|
@ -389,13 +389,13 @@
|
|||
<publishTime>02/09/2013 00:42:28</publishTime>
|
||||
</File>
|
||||
<File Include="bin/WebAPI.dll">
|
||||
<publishTime>02/28/2026 17:34:35</publishTime>
|
||||
<publishTime>03/01/2026 14:49:55</publishTime>
|
||||
</File>
|
||||
<File Include="bin/WebAPI.pdb">
|
||||
<publishTime>02/28/2026 17:34:35</publishTime>
|
||||
<publishTime>03/01/2026 14:49:55</publishTime>
|
||||
</File>
|
||||
<File Include="bin/WebAPI.xml">
|
||||
<publishTime>02/28/2026 17:34:35</publishTime>
|
||||
<publishTime>03/01/2026 14:49:55</publishTime>
|
||||
</File>
|
||||
<File Include="bin/WebGrease.dll">
|
||||
<publishTime>01/23/2014 21:57:34</publishTime>
|
||||
|
|
@ -479,7 +479,7 @@
|
|||
<publishTime>10/28/2024 14:02:50</publishTime>
|
||||
</File>
|
||||
<File Include="PrecompiledApp.config">
|
||||
<publishTime>02/28/2026 17:34:36</publishTime>
|
||||
<publishTime>03/01/2026 14:49:56</publishTime>
|
||||
</File>
|
||||
<File Include="Scripts/bootstrap.js">
|
||||
<publishTime>10/28/2024 14:02:50</publishTime>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
|
||||
<LastActiveSolutionConfig>Release|Any CPU</LastActiveSolutionConfig>
|
||||
<UseIISExpress>true</UseIISExpress>
|
||||
<Use64BitIISExpress />
|
||||
<IISExpressSSLPort />
|
||||
|
|
|
|||
Loading…
Reference in New Issue