| | |
| | | public ResponseResult GetAttachments([FromBody] JObject data) |
| | | { |
| | | var itemNo = data["itemNo"]?.ToString(); |
| | | var projName = data["projName"]?.ToString(); |
| | | var fromPage = data["fromPage"]?.ToString(); // 新增参数 |
| | | |
| | | // 调试日志 |
| | | Console.WriteLine($"XJController.GetAttachments 接收参数: itemNo='{itemNo}', projName='{projName}', fromPage='{fromPage}'"); |
| | | |
| | | // 条件过滤逻辑:根据fromPage决定是否过滤 |
| | | string filterProjName = null; |
| | | if (fromPage == "Detail" && !string.IsNullOrEmpty(projName)) |
| | | { |
| | | filterProjName = projName; // Detail页面需要过滤 |
| | | } |
| | | // Add页面不传递filterProjName,显示所有附件 |
| | | |
| | | try |
| | | { |
| | | dynamic resultInfos = new System.Dynamic.ExpandoObject(); |
| | | var tbBillList = new XJService().GetAttachments(itemNo); |
| | | var tbBillList = new XJService().GetAttachments(itemNo, filterProjName); |
| | | if (tbBillList == null || tbBillList.Count == 0) |
| | | { |
| | | return new ResponseResult |
| | |
| | | /// <param name="itemNo">物料编码</param> |
| | | /// <param name="fileName">文件名</param> |
| | | /// <param name="ftpServer">FTP服务器地址</param> |
| | | /// <param name="projName">项目名称(可选)</param> |
| | | /// <returns>文件内容</returns> |
| | | [HttpGet("PreviewFtpFile")] |
| | | public IActionResult PreviewFtpFile([FromQuery] string itemNo, [FromQuery] string fileName, [FromQuery] string ftpServer) |
| | | public IActionResult PreviewFtpFile([FromQuery] string itemNo, [FromQuery] string fileName, [FromQuery] string ftpServer, [FromQuery] string projName = null) |
| | | { |
| | | try |
| | | { |
| | |
| | | Response.Headers.Add("Access-Control-Expose-Headers", "Content-Type, Content-Length"); |
| | | |
| | | var service = new XJService(); |
| | | var fileBytes = service.GetFtpFile(itemNo, fileName, ftpServer); |
| | | var fileBytes = service.GetFtpFile(itemNo, fileName, ftpServer, projName); |
| | | |
| | | if (fileBytes == null || fileBytes.Length == 0) |
| | | { |
| | |
| | | /// <param name="itemNo">物料编码</param> |
| | | /// <param name="fileName">文件名</param> |
| | | /// <param name="ftpServer">FTP服务器地址</param> |
| | | /// <param name="projName">项目名称(可选)</param> |
| | | /// <returns>文件下载</returns> |
| | | [HttpGet("DownloadFtpFile")] |
| | | public IActionResult DownloadFtpFile([FromQuery] string itemNo, [FromQuery] string fileName, [FromQuery] string ftpServer) |
| | | public IActionResult DownloadFtpFile([FromQuery] string itemNo, [FromQuery] string fileName, [FromQuery] string ftpServer, [FromQuery] string projName = null) |
| | | { |
| | | try |
| | | { |
| | |
| | | Response.Headers.Add("Access-Control-Expose-Headers", "Content-Disposition, Content-Length, Content-Type"); |
| | | |
| | | var service = new XJService(); |
| | | var fileBytes = service.GetFtpFile(itemNo, fileName, ftpServer); |
| | | var fileBytes = service.GetFtpFile(itemNo, fileName, ftpServer, projName); |
| | | |
| | | if (fileBytes == null || fileBytes.Length == 0) |
| | | { |