|
|
@ -82,6 +82,83 @@ namespace VOL.WMS.Controllers
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//最终保存
|
|
|
|
|
|
|
|
INFO_FILESRepository.Instance.SaveChanges();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return webResponseContent.OK("文件上传成功");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return webResponseContent.Error("文件上传失败");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class JGWLFileInfo
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
public string FILENAME { get; set; }
|
|
|
|
|
|
|
|
public string FILETYPE { get; set; }
|
|
|
|
|
|
|
|
public string PWORKTYPE { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 上传文件-金港物流
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="files"></param>
|
|
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
|
|
[HttpPost, Route("UploadJGWL"), AllowAnonymous]
|
|
|
|
|
|
|
|
public WebResponseContent UploadJGWL(JGWLFileInfo JsonParam,Microsoft.AspNetCore.Http.IFormFile files)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
WebResponseContent webResponseContent = WebResponseContent.Instance;
|
|
|
|
|
|
|
|
if (files == null ) return webResponseContent.Error("请上传文件");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//跟前端的控件名称保持一致
|
|
|
|
|
|
|
|
var WMSDOID = Request.Form["WMSDOID"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//var limitFiles = files.Where(x => x.Length > LimitUpFileSizee * 1024 * 1024).Select(s => s.FileName);
|
|
|
|
|
|
|
|
//if (limitFiles.Count() > 0)
|
|
|
|
|
|
|
|
//{
|
|
|
|
|
|
|
|
// return webResponseContent.Error($"文件大小不能超过:{LimitUpFileSizee}M,{string.Join(",", limitFiles)}");
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
string filePath = $"Upload/Tables/INFO_FILES/{DateTime.Now.ToString("yyyMMddHHmmsss") + new Random().Next(1000, 9999)}/";
|
|
|
|
|
|
|
|
string fullPath = filePath.MapPath(true);
|
|
|
|
|
|
|
|
int i = 0;
|
|
|
|
|
|
|
|
// List<string> fileNames = new List<string>();
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!Directory.Exists(fullPath)) Directory.CreateDirectory(fullPath);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string fileName = files.FileName;
|
|
|
|
|
|
|
|
//if (fileNames.Contains(fileName))
|
|
|
|
|
|
|
|
//{
|
|
|
|
|
|
|
|
// fileName += $"({i}){fileName}";
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
//fileNames.Add(fileName);
|
|
|
|
|
|
|
|
using (var stream = new FileStream(fullPath + fileName, FileMode.Create))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
files.CopyTo(stream);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var infoFile = new INFO_FILES()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
GID = Guid.NewGuid(),
|
|
|
|
|
|
|
|
CNTRNO = "",
|
|
|
|
|
|
|
|
PID = Guid.Parse(WMSDOID),
|
|
|
|
|
|
|
|
FILENAME = JsonParam.FILENAME,
|
|
|
|
|
|
|
|
IMGPATH = filePath + fileName,
|
|
|
|
|
|
|
|
FILETYPE = JsonParam.FILETYPE,
|
|
|
|
|
|
|
|
PWORKTYPE = JsonParam.PWORKTYPE,
|
|
|
|
|
|
|
|
CORPID = "",
|
|
|
|
|
|
|
|
ModifyDate = DateTime.Now,
|
|
|
|
|
|
|
|
CreateDate = DateTime.Now,
|
|
|
|
|
|
|
|
UPLOADEMPLY = "PDA",
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
INFO_FILESRepository.Instance.Add(infoFile);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//最终保存
|
|
|
|
//最终保存
|
|
|
|
INFO_FILESRepository.Instance.SaveChanges();
|
|
|
|
INFO_FILESRepository.Instance.SaveChanges();
|
|
|
|
|
|
|
|
|
|
|
|