From 138fc3a8ac9cb199eb23659efe6f9c2a56596b09 Mon Sep 17 00:00:00 2001 From: sunliang <593170460@qq.com> Date: Mon, 15 Apr 2024 10:08:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=B5=81=E7=A8=8B=E4=B8=AD?= =?UTF-8?q?=E8=A1=A8=E5=8D=95=E6=9D=83=E9=99=90=E9=85=8D=E7=BD=AE=E7=9A=84?= =?UTF-8?q?=E6=89=B9=E9=87=8F=E8=AE=BE=E7=BD=AE=EF=BC=8C=E4=BF=9D=E5=AD=98?= =?UTF-8?q?=E5=90=8E=E4=BF=AE=E6=94=B9=E7=9A=84=E5=86=85=E5=AE=B9=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E5=85=A8=E9=83=A8=E4=BF=9D=E5=AD=98=E9=97=AE=E9=A2=98?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E5=A4=8D=E8=BE=93=E5=85=A5=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E9=87=8C=E6=97=A0=E6=B3=95=E4=BD=93=E7=8E=B0=E4=B8=8A=E4=B8=8B?= =?UTF-8?q?=E6=A0=87=E9=97=AE=E9=A2=98=EF=BC=8C=E4=BF=AE=E5=A4=8D=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E6=89=93=E5=BC=80=E4=B8=8A=E4=BC=A0=E7=9A=84=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E7=89=88=E6=8A=80=E6=9C=AF=E5=8D=8F=E8=AE=AE=E9=99=84?= =?UTF-8?q?=E4=BB=B6=EF=BC=8C=E5=9B=A0=E4=B8=BA=E6=96=87=E4=BB=B6=E5=90=8D?= =?UTF-8?q?=E4=B8=AD=E7=9A=84=E7=A9=BA=E6=A0=BC=E6=A0=BC=E5=BC=8F=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E5=AF=BC=E8=87=B4=E6=96=87=E4=BB=B6=E5=90=8D=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CCFlow/CCFlow/WF/CCForm/Ath.js | 10 ++++ CCFlow/Components/BP.En30/DA/DataType.cs | 8 +-- .../BP.En30/Sys/FrmUI/MapAttrString.cs | 2 +- CCFlow/Components/BP.WF/Glo.cs | 2 +- .../BP.WF/HttpHandler/HttpHandlerGlo.cs | 4 +- .../Components/BP.WF/HttpHandler/WF_CCForm.cs | 52 +++++++++++++++++-- 6 files changed, 66 insertions(+), 12 deletions(-) diff --git a/CCFlow/CCFlow/WF/CCForm/Ath.js b/CCFlow/CCFlow/WF/CCForm/Ath.js index f4b39075..36baef94 100644 --- a/CCFlow/CCFlow/WF/CCForm/Ath.js +++ b/CCFlow/CCFlow/WF/CCForm/Ath.js @@ -579,12 +579,22 @@ function GetFileStream(mypk, FK_FrmAttachment) { * @param MyPK 上传附件数据的信息主键 */ function Down2018(mypk) { + debugger var nodeID = GetQueryString("FK_Node"); var workID = GetQueryString("WorkID"); var url = ""; if (plant == "CCFlow") { + var handler = new HttpHandler("BP.WF.HttpHandler.WF_CCForm"); + handler.AddPara("WorkID", workID); + handler.AddPara("FK_Node", nodeID); + handler.AddPara("MyPK", mypk); + var fileUrl = handler.DoMethodReturnString("AttachmentUpload_Down"); + if (typeof fileUrl === "string" && fileUrl.startsWith("/DataUser/")) { + window.open(window.location.origin + fileUrl); + return; + } SetHref(basePath + "/WF/Comm/ProcessRequest?DoType=HttpHandler&DoMethod=AttachmentUpload_Down&HttpHandlerName=BP.WF.HttpHandler.WF_CCForm&WorkID=" + workID + "&FK_Node=" + nodeID + "&MyPK=" + mypk); return; } diff --git a/CCFlow/Components/BP.En30/DA/DataType.cs b/CCFlow/Components/BP.En30/DA/DataType.cs index ba5b0881..a926f12f 100644 --- a/CCFlow/Components/BP.En30/DA/DataType.cs +++ b/CCFlow/Components/BP.En30/DA/DataType.cs @@ -442,10 +442,12 @@ namespace BP.DA } - string filePath = fileName.Substring(0, fileName.LastIndexOf('/')); - string fName = fileName.Substring(fileName.LastIndexOf('/')); + string filePath = fileName.Substring(0, fileName.LastIndexOf('/')+1); + string fName = fileName.Substring(fileName.LastIndexOf('/')+1); fName = PraseStringToUrlFileNameExt(fName, "%", "%25"); + fName = PraseStringToUrlFileNameExt(fName, " ", "%20"); + fName = PraseStringToUrlFileNameExt(fName, "+", "%2B"); fName = PraseStringToUrlFileNameExt(fName, " ", "%20"); fName = PraseStringToUrlFileNameExt(fName, "/", "%2F"); @@ -453,7 +455,7 @@ namespace BP.DA fName = PraseStringToUrlFileNameExt(fName, "#", "%23"); fName = PraseStringToUrlFileNameExt(fName, "&", "%26"); fName = PraseStringToUrlFileNameExt(fName, "=", "%3D"); - fName = PraseStringToUrlFileNameExt(fName, " ", "%20"); + return filePath + fName; } diff --git a/CCFlow/Components/BP.En30/Sys/FrmUI/MapAttrString.cs b/CCFlow/Components/BP.En30/Sys/FrmUI/MapAttrString.cs index ce66fdc3..7eac79a5 100644 --- a/CCFlow/Components/BP.En30/Sys/FrmUI/MapAttrString.cs +++ b/CCFlow/Components/BP.En30/Sys/FrmUI/MapAttrString.cs @@ -954,7 +954,7 @@ namespace BP.Sys.FrmUI break; case DBType.Oracle: case DBType.DM: - sql = "ALTER table " + md.PTable + " modify " + attr.Field + " VARCHAR2(" + attr.MaxLen + ")"; + sql = "ALTER table " + md.PTable + " modify " + attr.Field + " NVARCHAR2(" + attr.MaxLen + ")"; break; case DBType.KingBaseR3: case DBType.KingBaseR6: diff --git a/CCFlow/Components/BP.WF/Glo.cs b/CCFlow/Components/BP.WF/Glo.cs index eed4b0e0..981bb6c2 100644 --- a/CCFlow/Components/BP.WF/Glo.cs +++ b/CCFlow/Components/BP.WF/Glo.cs @@ -87,7 +87,7 @@ namespace BP.WF break; } sql += " UNION "; - sql += " SELECT KeyOfEn AS No,Name From Sys_MapAttr WHERE UIContralType=14 AND FK_MapData='@FK_Frm'"; + sql += " SELECT KeyOfEn AS No,Name From Sys_MapAttr WHERE UIContralType=14 AND FK_MapData='@FK_Frm' ORDER BY No DESC"; return sql; } } diff --git a/CCFlow/Components/BP.WF/HttpHandler/HttpHandlerGlo.cs b/CCFlow/Components/BP.WF/HttpHandler/HttpHandlerGlo.cs index 76ae4ec1..cf525b01 100644 --- a/CCFlow/Components/BP.WF/HttpHandler/HttpHandlerGlo.cs +++ b/CCFlow/Components/BP.WF/HttpHandler/HttpHandlerGlo.cs @@ -2,7 +2,7 @@ using System.IO; using System.Collections.Generic; using BP.Difference; - +using System; namespace BP.WF.HttpHandler { @@ -13,8 +13,8 @@ namespace BP.WF.HttpHandler { //if (String.Compare("firefox", HttpContextHelper.RequestBrowser, StringComparison.OrdinalIgnoreCase)!=0) // tempName = HttpUtility.UrlEncode(tempName); + HttpContextHelper.ResponseWriteFile(filepath, tempName); - HttpContextHelper.ResponseWriteFile(filepath, tempName); } /// diff --git a/CCFlow/Components/BP.WF/HttpHandler/WF_CCForm.cs b/CCFlow/Components/BP.WF/HttpHandler/WF_CCForm.cs index 336d0dde..d3ddcee9 100644 --- a/CCFlow/Components/BP.WF/HttpHandler/WF_CCForm.cs +++ b/CCFlow/Components/BP.WF/HttpHandler/WF_CCForm.cs @@ -4612,6 +4612,7 @@ namespace BP.WF.HttpHandler HttpPostedFile file = HttpContextHelper.RequestFiles(i); string fileName = System.IO.Path.GetFileName(file.FileName); + fileName = ToDBC(fileName); #region 文件上传的iis服务器上 or db数据库里. if (athDesc.AthSaveWay == AthSaveWay.IISServer) @@ -4668,10 +4669,10 @@ namespace BP.WF.HttpHandler string guid = DBAccess.GenerGUID(); + //string realSaveTo = savePath + "/" + guid + "." + fileName; + string realSaveTo = savePath + "/" + fileName; - string realSaveTo = savePath + "/" + guid + "." + fileName; - realSaveTo = realSaveTo.Replace("~", "-"); realSaveTo = realSaveTo.Replace("'", "-"); realSaveTo = realSaveTo.Replace("*", "-"); @@ -4756,7 +4757,6 @@ namespace BP.WF.HttpHandler dbUpload.FileFullName = dbUpload.MyPK; } #endregion 处理文件路径,如果是保存到数据库,就存储pk. - dbUpload.FileName = fileName; dbUpload.FileSize = (float)info.Length; dbUpload.RDT = DataType.CurrentDateTimess; @@ -4936,6 +4936,33 @@ namespace BP.WF.HttpHandler return "{\"msg\":\"上传成功\"}"; } + + /// + /// 转半角(DBC case) + /// + /// 任意字符串 + /// 半角字符串 + public string ToDBC(string input) + { + char[] c = input.ToCharArray(); + for (int i = 0; i < c.Length; i++) + { + if (c[i] == 12288) + { + c[i] = (char)32; + continue; + } + if (c[i] == 160) + { + c[i] = (char)32; + continue; + } + if (c[i] > 65280 && c[i] < 65375) + c[i] = (char)(c[i] - 65248); + } + string s = new string(c); + return s; + } /// /// 删除附件 /// @@ -5643,7 +5670,7 @@ namespace BP.WF.HttpHandler FrmAttachmentDB downDB = new FrmAttachmentDB(); downDB.MyPK = this.MyPK; - downDB.Retrieve(); + downDB.RetrieveFromDBSources(); FrmAttachment dbAtt = new FrmAttachment(); dbAtt.MyPK = downDB.FK_FrmAttachment; dbAtt.Retrieve(); @@ -5679,6 +5706,12 @@ namespace BP.WF.HttpHandler else { filepath = downDB.FileFullName; + int splitStartIndex = filepath.IndexOf("DataUser/"); + if(splitStartIndex > -1) + { + return "/" + filepath.Substring(splitStartIndex); + } + //return filepath; } #endregion } @@ -5710,7 +5743,16 @@ namespace BP.WF.HttpHandler } BP.WF.HttpHandler.HttpHandlerGlo.DownloadFile(filepath, downDB.FileName); - return DataType.PraseStringToUrlFileName(filepath); + try + { + filepath = DataType.PraseStringToUrlFileName(filepath); + } + catch (Exception ex) + { + + throw new Exception (ex.Message); + } + return filepath; }