xwt
2025-10-10 0c7322109660b80e359118de04c0b9cc16a030e3
StandardInterface/MESApplication/Controllers/QC/RKJController.cs
@@ -574,16 +574,26 @@
    /// <summary>
    /// 获取附件信息
    /// </summary>
    /// <param name="data">包含itemNo的JSON对象</param>
    /// <param name="data">包含itemNo、projName、fromPage的JSON对象</param>
    /// <returns>附件列表</returns>
    [HttpPost("getAttachments")]
    public ResponseResult GetAttachments([FromBody] JObject data)
    {
        var itemNo = data["itemNo"]?.ToString();
        var projName = data["projName"]?.ToString();
        var fromPage = data["fromPage"]?.ToString(); // 新增参数
        // 条件过滤逻辑:根据fromPage决定是否过滤
        string filterProjName = null;
        if (fromPage == "Detail" && !string.IsNullOrEmpty(projName))
        {
            filterProjName = projName;  // Detail页面需要过滤
        }
        try
        {
            dynamic resultInfos = new System.Dynamic.ExpandoObject();
            var tbBillList = new RKJService().GetAttachments(itemNo);
            var tbBillList = new RKJService().GetAttachments(itemNo, filterProjName);
            if (tbBillList == null || tbBillList.Count == 0)
            {
                return new ResponseResult
@@ -612,10 +622,10 @@
    /// </summary>
    /// <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)
    [HttpGet("previewFtpFile")]
    public IActionResult PreviewFtpFile([FromQuery] string itemNo, [FromQuery] string fileName, [FromQuery] string projName = null)
    {
        try
        {
@@ -626,7 +636,7 @@
            Response.Headers.Add("Access-Control-Expose-Headers", "Content-Type, Content-Length");
            
            var service = new RKJService();
            var fileBytes = service.GetFtpFile(itemNo, fileName, ftpServer);
            var fileBytes = service.GetFtpFile(itemNo, fileName, projName);
            
            if (fileBytes == null || fileBytes.Length == 0)
            {
@@ -649,10 +659,10 @@
    /// </summary>
    /// <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)
    [HttpGet("downloadFtpFile")]
    public IActionResult DownloadFtpFile([FromQuery] string itemNo, [FromQuery] string fileName, [FromQuery] string projName = null)
    {
        try
        {
@@ -663,7 +673,7 @@
            Response.Headers.Add("Access-Control-Expose-Headers", "Content-Disposition, Content-Length, Content-Type");
            
            var service = new RKJService();
            var fileBytes = service.GetFtpFile(itemNo, fileName, ftpServer);
            var fileBytes = service.GetFtpFile(itemNo, fileName, projName);
            
            if (fileBytes == null || fileBytes.Length == 0)
            {