From 1133cfd7d5ff819d853b53ae8fb6fbaa17c0343e Mon Sep 17 00:00:00 2001 From: xiaju <1784803958@qq.com> Date: Sun, 1 Mar 2026 14:56:58 +0800 Subject: [PATCH] 1 --- SGGL/BLL/Common/Const.cs | 4 + .../Excel/DataIn/专项检查明细导入模板.xls | Bin 0 -> 19456 bytes SGGL/FineUIPro.Web/FineUIPro.Web.csproj | 11 + .../HSSE/Check/CheckSpecialDetailIn.aspx | 80 +++ .../HSSE/Check/CheckSpecialDetailIn.aspx.cs | 570 ++++++++++++++++++ .../CheckSpecialDetailIn.aspx.designer.cs | 143 +++++ .../HSSE/Check/CheckSpecialProEdit.aspx | 2 +- .../HSSE/Check/CheckSpecialProEdit.aspx.cs | 2 +- SGGL/FineUIPro.Web/packages.config | 1 + .../DoorProject/uploadController.cs | 199 +++--- .../PublishProfiles/FolderProfile.pubxml.user | 18 +- SGGL/WebAPI/WebAPI.csproj.user | 2 +- 12 files changed, 921 insertions(+), 111 deletions(-) create mode 100644 SGGL/FineUIPro.Web/File/Excel/DataIn/专项检查明细导入模板.xls create mode 100644 SGGL/FineUIPro.Web/HSSE/Check/CheckSpecialDetailIn.aspx create mode 100644 SGGL/FineUIPro.Web/HSSE/Check/CheckSpecialDetailIn.aspx.cs create mode 100644 SGGL/FineUIPro.Web/HSSE/Check/CheckSpecialDetailIn.aspx.designer.cs diff --git a/SGGL/BLL/Common/Const.cs b/SGGL/BLL/Common/Const.cs index f6beabb4..bb3beb27 100644 --- a/SGGL/BLL/Common/Const.cs +++ b/SGGL/BLL/Common/Const.cs @@ -3170,6 +3170,10 @@ namespace BLL /// public const string CheckSpecialTemplateUrl = "File\\Excel\\DataIn\\专项检查导入模板.xls"; /// + /// 专项检查明细导入模板 + /// + public const string CheckSpecialDetailTemplateUrl = "File\\Excel\\DataIn\\专项检查明细导入模板.xls"; + /// /// 综合检查导入模板 /// public const string CheckColligationTemplateUrl = "File\\Excel\\DataIn\\综合检查导入模板.xls"; diff --git a/SGGL/FineUIPro.Web/File/Excel/DataIn/专项检查明细导入模板.xls b/SGGL/FineUIPro.Web/File/Excel/DataIn/专项检查明细导入模板.xls new file mode 100644 index 0000000000000000000000000000000000000000..8e108894b158256337f144b9b9b133811a76ff5a GIT binary patch literal 19456 zcmeHP30M@zwyqvV7*J&21Z0&>WM5nXK_e=QqM$?+Q3g>_6p2BFhzoH;1r3UXaMdX8 zdt8b8f+#8?%5?`7_b3_#H4)x9-P1F}%=BE$_ul(%?ssdx>Z&?*&R?faE!|bsJr!4U zYS!)PP)lT-A5kGq&FVx|icUcsJ?*p!v4jYwo0^-OX&PK0`d{}qvcPB1)dt#41w0>o z8}QiXYTyOn)xm3kZwtO1cunx_!E1qsEw?zI7 zIrxs?Ex=>HL2nIlTdDNl$b5f$RU=3;{8C{o_a&1dOd&I%C0g$cp~tXB;DMN>0I!6c zps(aBCSa~pem;I6uHX)31<6e8XyArH=_zC)8AIzaks*G;RhRH6wtNg*BZ?Zvb!RyH zlA%!ZG^lwW5(n3~)&NNH=tKE92jci?ZTToZfiV+UZwUE@OoCq=ZTtSv3JJ7LkdjKq zLwqs{a5x81{c-HJwtO7VFGYCj0vN@rZAgjcCAE{86j6o2UrTsoH~%DD33&iMhD?Du zfl4AmP$ij62XFa*?E+~X;waSN1Q@s%#3-0eFb!=ES3UZ=i{|*1zV@PLB0^jyeQ@mx z9C&vc&I_RVmeN;i`r00@6gf!C+@dM&Fn84hfAj1dY)tY!Sar#WA>l~B^S?-MM-ZQq z!`J7aYtZzT`XmB^ANdtcAcMn$Syx_vXAXWo2OaCH7$52K_{i_CP#;3PIq2#fbZ-uP z0SCVh2fsE4U5|sV&OsN*&^z)w!-&-*lr^b?+m;P+25&>$NDsnLVn`P$YDc~|3>;%c z>?24745xT9l0(oJ?!YGUf-X=NS7}UMM}BX(ad+evRbDa+GM+dQ4?@KfOOb+35R=pw z={-ox+?I7$#9U$ktF+=$nOvsqzEHBIGI3=ZNCTOW-SB)$&49-i{JFx7)D?zR z4-!CX=m%0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)am;w!ASFln$3>(dFwscu(%X$-dSL6QfrxogpJ9olBvV2eMuyr~Qw zGsr)draRH}&h&LIP00iv)^)r&9Q7gtp0)~KO&{iVENv}7g z`E(lbiM}KarxqkYQ<7GJV^Cr!N%KK2(h#l1$hUzbn@9~wT9v3015HU<4PGs}t|v(g zK#vo;TENA~<5-N;4HV;PKr808WB3UVU%F=dAa*wa4<|5uJo-S}1N-o2y4?v0qH~xO z1u1N4CdDIt0G~~%Kpxadl*flWv=hVG22%Lm2a{5T6iygSN)1xbaYQKrq|o$Co;vh( zm=#4S4ft3S`(ian?}QM)5!`@1tiBN9(7WnU5;anXqP2)h{d|aP5q`Y`gcMP)XKD!v zDaRukv>d97IwF4vge%%Hbi~49Jz6kiawChH$>KZYl2Z_5>s&i4Cmx&iH1@YqK& zKNvi?%t3I$xobFh%!>z)<)?zj`6?4U&QaOmai01GJkEK$K?u`)5W@DPs{$d$5wC3+ z39B1INC3pi8Z(b0FG?snu9HXqj|KAK92g2KrLpku4asC0_yi~y|4kzeXhK+PF>@;f z3LRJdQ9s`GOV@(=tuqU(^{a_3<>|@w`8^D9h+zuD)OE|9R=LpEe@#6*|rZErG{b3Cg1tHRK z+zo`j77lw4ICA2l*NuhV7YN~a7&Y<0DTEw!D2shJ2=+0O=)Rf+G4{VvB0vK7HWZI( zTcGy_)Iiv!_=jfZi8;SNQpeD7}Hp2R`g~2MK0g gz + + ..\packages\System.ValueTuple.4.5.0\lib\net461\System.ValueTuple.dll + @@ -982,6 +985,7 @@ + @@ -11373,6 +11377,13 @@ CheckHolidayView.aspx + + CheckSpecialDetailIn.aspx + ASPXCodeBehind + + + CheckSpecialDetailIn.aspx + CheckSpecialProEdit.aspx ASPXCodeBehind diff --git a/SGGL/FineUIPro.Web/HSSE/Check/CheckSpecialDetailIn.aspx b/SGGL/FineUIPro.Web/HSSE/Check/CheckSpecialDetailIn.aspx new file mode 100644 index 00000000..c51a374b --- /dev/null +++ b/SGGL/FineUIPro.Web/HSSE/Check/CheckSpecialDetailIn.aspx @@ -0,0 +1,80 @@ +<%@ Page Language="C#" CodeBehind="CheckSpecialDetailIn.aspx.cs" Inherits="FineUIPro.Web.HSSE.Check.CheckSpecialProDetailIn" %> + + + + + + + 导入明细 + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/HSSE/Check/CheckSpecialDetailIn.aspx.cs b/SGGL/FineUIPro.Web/HSSE/Check/CheckSpecialDetailIn.aspx.cs new file mode 100644 index 00000000..836ada71 --- /dev/null +++ b/SGGL/FineUIPro.Web/HSSE/Check/CheckSpecialDetailIn.aspx.cs @@ -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 定义变量 + + /// + /// 上传预设的虚拟路径 + /// + private string initPath = Const.ExcelUrl; + + + /// + /// 错误集合 + /// + public static List errorInfos = new List(); + + /// + /// 项目id + /// + public string ProjectId + { + get + { + return (string)ViewState["ProjectId"]; + } + set + { + ViewState["ProjectId"] = value; + } + } + /// + /// 检查id + /// + public string CheckSpecialId + { + get + { + return (string)ViewState["CheckSpecialId"]; + } + set + { + ViewState["CheckSpecialId"] = value; + } + } + public static int Cols = 11;//列数 + + public static Dictionary imgDic = new Dictionary(); + //public static List unitWorks = new List(); + public static List unitWorks = new List(); + public static List units = new List(); + public static List hseManagers = new List(); + public static List types = new List(); + + public static List validLevelStrings = new List { "低风险", "一般风险", "较大风险", "重大风险" }; + public static List validStateStrings = new List { "待整改", "已整改" }; + public static List validTypeStrings = new List { "当场纠正", "口头警告" }; + + #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 下载模板 + + /// + /// 下载模板按钮 + /// + /// + /// + 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"))); + } + + /// + /// 下载导入模板 + /// + /// + /// + 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 审核 + /// + /// 审核 + /// + /// + /// + 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); + } + } + + /// + /// 审核Excel并展示校验结果 + /// + 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); + } + } + + /// + /// 校验Excel数据(仅校验) + /// + /// + /// true:导入;false:审核 + /// + 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(); + 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; + } + + + /// + /// 校验单行并生成实体(字段顺序与新模板一致) + /// + private (List lstError, Model.Check_CheckSpecialProDetail entity) ValidateRowAndBuildEntity(DataRow row, string displayRow, bool import) + { + List lstError = new List(); + // 新模板字段顺序 + 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 导入 + + /// + /// 导入 + /// + /// + /// + 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); + } + } + /// + /// 导入Excel到数据库 + /// + 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); + } + } + + /// + /// 校验并保存数据到数据库 + /// + 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(); + var toInsert = new List(); + + 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 // 导入 + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/HSSE/Check/CheckSpecialDetailIn.aspx.designer.cs b/SGGL/FineUIPro.Web/HSSE/Check/CheckSpecialDetailIn.aspx.designer.cs new file mode 100644 index 00000000..c601808d --- /dev/null +++ b/SGGL/FineUIPro.Web/HSSE/Check/CheckSpecialDetailIn.aspx.designer.cs @@ -0,0 +1,143 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.HSSE.Check +{ + + + public partial class CheckSpecialProDetailIn + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// SimpleForm1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Form SimpleForm1; + + /// + /// Toolbar2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar2; + + /// + /// ToolbarFill1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarFill ToolbarFill1; + + /// + /// btnAudit 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnAudit; + + /// + /// btnImport 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnImport; + + /// + /// btnDownLoad 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnDownLoad; + + /// + /// fuAttachUrl 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.FileUpload fuAttachUrl; + + /// + /// gvErrorInfo 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Grid gvErrorInfo; + + /// + /// lblPageIndex 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label lblPageIndex; + + /// + /// hdFileName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.HiddenField hdFileName; + + /// + /// hdCheckResult 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.HiddenField hdCheckResult; + + /// + /// lblBottom 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Label lblBottom; + } +} diff --git a/SGGL/FineUIPro.Web/HSSE/Check/CheckSpecialProEdit.aspx b/SGGL/FineUIPro.Web/HSSE/Check/CheckSpecialProEdit.aspx index ec955b06..277d1567 100644 --- a/SGGL/FineUIPro.Web/HSSE/Check/CheckSpecialProEdit.aspx +++ b/SGGL/FineUIPro.Web/HSSE/Check/CheckSpecialProEdit.aspx @@ -56,7 +56,7 @@ <%-- --%> - diff --git a/SGGL/FineUIPro.Web/HSSE/Check/CheckSpecialProEdit.aspx.cs b/SGGL/FineUIPro.Web/HSSE/Check/CheckSpecialProEdit.aspx.cs index 5e561173..17851848 100644 --- a/SGGL/FineUIPro.Web/HSSE/Check/CheckSpecialProEdit.aspx.cs +++ b/SGGL/FineUIPro.Web/HSSE/Check/CheckSpecialProEdit.aspx.cs @@ -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, "导入 - "))); } /// diff --git a/SGGL/FineUIPro.Web/packages.config b/SGGL/FineUIPro.Web/packages.config index e17e423b..c72b1fe6 100644 --- a/SGGL/FineUIPro.Web/packages.config +++ b/SGGL/FineUIPro.Web/packages.config @@ -13,4 +13,5 @@ + \ No newline at end of file diff --git a/SGGL/WebAPI/Controllers/DoorProject/uploadController.cs b/SGGL/WebAPI/Controllers/DoorProject/uploadController.cs index 0c59402c..585b8662 100644 --- a/SGGL/WebAPI/Controllers/DoorProject/uploadController.cs +++ b/SGGL/WebAPI/Controllers/DoorProject/uploadController.cs @@ -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 = "更新人员成功!"; } diff --git a/SGGL/WebAPI/Properties/PublishProfiles/FolderProfile.pubxml.user b/SGGL/WebAPI/Properties/PublishProfiles/FolderProfile.pubxml.user index 7183a11f..b9446aa9 100644 --- a/SGGL/WebAPI/Properties/PublishProfiles/FolderProfile.pubxml.user +++ b/SGGL/WebAPI/Properties/PublishProfiles/FolderProfile.pubxml.user @@ -6,7 +6,7 @@ <_PublishTargetUrl>G:\发布\五环WebApi - 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||; + 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||; @@ -86,22 +86,22 @@ 10/28/2024 14:02:50 - 02/28/2026 17:34:45 + 03/01/2026 14:50:16 - 02/28/2026 17:34:45 + 03/01/2026 14:50:16 12/06/2024 20:13:58 - 02/28/2026 17:34:34 + 03/01/2026 14:49:54 12/26/2024 09:46:52 - 02/28/2026 17:34:34 + 03/01/2026 14:49:54 12/18/2020 05:32:28 @@ -389,13 +389,13 @@ 02/09/2013 00:42:28 - 02/28/2026 17:34:35 + 03/01/2026 14:49:55 - 02/28/2026 17:34:35 + 03/01/2026 14:49:55 - 02/28/2026 17:34:35 + 03/01/2026 14:49:55 01/23/2014 21:57:34 @@ -479,7 +479,7 @@ 10/28/2024 14:02:50 - 02/28/2026 17:34:36 + 03/01/2026 14:49:56 10/28/2024 14:02:50 diff --git a/SGGL/WebAPI/WebAPI.csproj.user b/SGGL/WebAPI/WebAPI.csproj.user index 377acc13..252faead 100644 --- a/SGGL/WebAPI/WebAPI.csproj.user +++ b/SGGL/WebAPI/WebAPI.csproj.user @@ -1,7 +1,7 @@ - Debug|Any CPU + Release|Any CPU true