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; }