SVN r693
SVN-Revision: r693
This commit is contained in:
@@ -2984,9 +2984,10 @@ namespace Lskj.Control.Model
|
||||
if (!string.IsNullOrEmpty(token))
|
||||
{
|
||||
string speciesno = "010106";
|
||||
GetFileCodeInfo(Path.GetFileNameWithoutExtension(filePath), out string sourceCode, out string sourceName, out string sourceBB, out int sourceBC);
|
||||
byte[] fileBytes = UploadFileUtil.ConvertFileToBytes(filePath);
|
||||
string fileStream = Convert.ToBase64String(fileBytes);
|
||||
string selectSql = $"select * from P_fm_FileTab where parentid in (select dirid from P_fm_DirectoryTab where pid = '{idValue}' and dllcoid = '{Model.ModuleCode}') and speciesno = '{speciesno}' and sname = '{Path.GetFileName(filePath).Replace(" ", "")}'";
|
||||
string selectSql = $"select * from P_fm_FileTab where parentid in (select dirid from P_fm_DirectoryTab where pid = '{idValue}' and dllcoid = '{Model.ModuleCode}') and speciesno = '{speciesno}' and sname like '{sourceCode}%'";
|
||||
DataTable deleteTable = BaseImpl.GetDataTableResult(selectSql);
|
||||
if (deleteTable != null && deleteTable.Rows.Count > 0)
|
||||
{
|
||||
@@ -3003,7 +3004,7 @@ namespace Lskj.Control.Model
|
||||
HttpHelper.Post(deleteUrl, fileStream, null, deleteHeaderDic, out string deleteResult);
|
||||
}
|
||||
}
|
||||
string postUrl = "{0}Api/FileUploadApi.ashx?moduleId={1}&idValue={2}&speciesno={8}&folder={3}&totsize={4}&position={5}&filename={6}&method={7}";
|
||||
string postUrl = "{0}Api/FileUploadApi.ashx?moduleId={1}&idValue={2}&speciesno={8}&folder={3}&totsize={4}&position={5}&filename={6}&method={7}&confirm=1";
|
||||
postUrl = string.Format(postUrl, SystemInfo.Instance.OAUrl, Model.ModuleCode, HttpUtility.UrlEncode(idValue), "file", fileBytes.Length, 0, HttpUtility.UrlEncode(Path.GetFileName(filePath)), "DoWebUpload", speciesno);
|
||||
bool isUpload = UploadFileUtil.UploadFile(token, postUrl, fileStream, out string fileId, out string rtnMsg);
|
||||
if (!isUpload)
|
||||
@@ -3164,8 +3165,45 @@ namespace Lskj.Control.Model
|
||||
return result == 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 解析code信息
|
||||
/// </summary>
|
||||
/// <param name="sourceCode"></param>
|
||||
/// <param name="code"></param>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="bb"></param>
|
||||
/// <param name="bc"></param>
|
||||
private void GetFileCodeInfo(string sourceCode, out string code, out string name, out string bb, out int bc)
|
||||
{
|
||||
string namepattern = @"^(.*-S[A-Z]\d*)(.*)$";
|
||||
string pattern = @"^(.*?)(\d+)?$";
|
||||
string childcode = "";
|
||||
string childname = "";
|
||||
string childsourceCode = "";
|
||||
string childsourceBB = "";
|
||||
int childsourceBC = 0;
|
||||
Match namematch = Regex.Match(Path.GetFileNameWithoutExtension(sourceCode).Trim(), namepattern);
|
||||
if (namematch.Success)
|
||||
{
|
||||
childcode = namematch.Groups[1].Value.Trim();
|
||||
childname = namematch.Groups[2].Value.Trim();
|
||||
}
|
||||
Match match = Regex.Match(childcode, pattern);
|
||||
if (match.Success)
|
||||
{
|
||||
childsourceCode = match.Groups[1].Value;
|
||||
int.TryParse(match.Groups[2].Value, out childsourceBC);//版次
|
||||
Match bbMatch = Regex.Match(childsourceCode, @"^.*?([A-Za-z]+)(\d*)$");
|
||||
if (bbMatch.Success)
|
||||
{
|
||||
childsourceBB = bbMatch.Groups[1].Value.Trim();
|
||||
}
|
||||
}
|
||||
code = childsourceCode;
|
||||
name = childname;
|
||||
bb = childsourceBB;
|
||||
bc = childsourceBC;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>说明:执行最后一次查询</para>
|
||||
|
||||
Reference in New Issue
Block a user