2025-5-14 附件重复上传提醒

This commit is contained in:
毕文静 2025-05-14 23:08:03 +08:00
parent 1cda2d1914
commit 647d00f201
5 changed files with 43 additions and 21 deletions

View File

@ -7,6 +7,9 @@ using System.Web;
using System.Web.UI; using System.Web.UI;
using System.Web.UI.WebControls; using System.Web.UI.WebControls;
using BLL; using BLL;
using NPOI.SS.Formula.Functions;
using Microsoft.JScript;
using System.Security.Policy;
namespace FineUIPro.Web.AttachFile namespace FineUIPro.Web.AttachFile
{ {
@ -277,21 +280,18 @@ namespace FineUIPro.Web.AttachFile
//合同管理附件名重复提醒 //合同管理附件名重复提醒
if (MenuId == BLL.Const.SESRelatedDateMenuId) if (MenuId == BLL.Const.SESRelatedDateMenuId)
{
if (!string.IsNullOrEmpty(attachUrl))
{ {
string newName = attachUrl.Substring(attachUrl.LastIndexOf("\\")); string newName = attachUrl.Substring(attachUrl.LastIndexOf("\\"));
string n = newName.Substring(newName.IndexOf("_") + 1); string n = newName.Substring(newName.IndexOf("_") + 1);
foreach (var item in sour)
{
if (item.AttachUrl.Contains(n))
{
Alert.ShowInTop(n + "已存在!", MessageBoxIcon.Warning);
return;
}
}
string fc_id = Request.QueryString["fcid"]; string fc_id = Request.QueryString["fcid"];
string fileTypeId = Request.QueryString["fileTypeId"]; string fileTypeId = Request.QueryString["fileTypeId"];
var conLists = from x in Funs.DB.FC_ContractManagement where x.FC_ID.ToString() == fc_id && x.FileTypeId == fileTypeId select x; var conLists = from x in Funs.DB.FC_ContractManagement where x.FC_ID.ToString() == fc_id && x.FileTypeId == fileTypeId select x;
foreach (var item in conLists) foreach (var item in conLists)
{
if (item.FileId != ToKeyId)
{ {
if (item.AttachUrl.Contains(n)) if (item.AttachUrl.Contains(n))
{ {
@ -299,6 +299,28 @@ namespace FineUIPro.Web.AttachFile
return; return;
} }
} }
else
{
List<string> newNames = new List<string>();
var list = attachUrl.Split(',').ToList();
foreach (var l in list)
{
string oldname = l.Substring(l.LastIndexOf("\\"));
string oldn = oldname.Substring(oldname.IndexOf("_") + 1);
newNames.Add(oldn);
}
var query = newNames.GroupBy(x => x).Where(g => g.Count() > 1).ToDictionary(x => x.Key, y => y.Count());
foreach (var i in query)
{
if (i.Value > 1)
{
Alert.ShowInTop(i.Key + "已存在!", MessageBoxIcon.Warning);
return;
}
}
}
}
}
} }
if (sour.Count() == 0) if (sour.Count() == 0)
{ {

View File

@ -2,7 +2,7 @@
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<ProjectView>ShowAllFiles</ProjectView> <ProjectView>ShowAllFiles</ProjectView>
<LastActiveSolutionConfig>Release|Any CPU</LastActiveSolutionConfig> <LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
<UseIISExpress>true</UseIISExpress> <UseIISExpress>true</UseIISExpress>
<Use64BitIISExpress> <Use64BitIISExpress>
</Use64BitIISExpress> </Use64BitIISExpress>

View File

@ -55,7 +55,7 @@
<add path="ChartImg.axd" verb="GET,POST,HEAD" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/> <add path="ChartImg.axd" verb="GET,POST,HEAD" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
<add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=15.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91" validate="false"/> <add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=15.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91" validate="false"/>
</httpHandlers> </httpHandlers>
<compilation debug="false" targetFramework="4.6.1"> <compilation debug="true" targetFramework="4.6.1">
<buildProviders> <buildProviders>
<add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.WebForms, Version=15.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91"/> <add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.WebForms, Version=15.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91"/>
</buildProviders> </buildProviders>

View File

@ -8,7 +8,7 @@
<IISExpressWindowsAuthentication /> <IISExpressWindowsAuthentication />
<IISExpressUseClassicPipelineMode /> <IISExpressUseClassicPipelineMode />
<UseGlobalApplicationHostFile /> <UseGlobalApplicationHostFile />
<LastActiveSolutionConfig>Release|Any CPU</LastActiveSolutionConfig> <LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
</PropertyGroup> </PropertyGroup>
<ProjectExtensions> <ProjectExtensions>
<VisualStudio> <VisualStudio>