From 0c7322109660b80e359118de04c0b9cc16a030e3 Mon Sep 17 00:00:00 2001
From: xwt <2740516069@qq.com>
Date: 星期五, 10 十月 2025 15:45:31 +0800
Subject: [PATCH] SJ,XJ,RKJ调用FTP附件
---
StandardInterface/MESApplication/Controllers/QC/XJController.cs | 26 +++++++++++++++++++++-----
1 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/StandardInterface/MESApplication/Controllers/QC/XJController.cs b/StandardInterface/MESApplication/Controllers/QC/XJController.cs
index f1e703c..2dccb34 100644
--- a/StandardInterface/MESApplication/Controllers/QC/XJController.cs
+++ b/StandardInterface/MESApplication/Controllers/QC/XJController.cs
@@ -610,10 +610,24 @@
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}'");
+
+ // 鏉′欢杩囨护閫昏緫锛氭牴鎹甪romPage鍐冲畾鏄惁杩囨护
+ string filterProjName = null;
+ if (fromPage == "Detail" && !string.IsNullOrEmpty(projName))
+ {
+ filterProjName = projName; // Detail椤甸潰闇�瑕佽繃婊�
+ }
+ // Add椤甸潰涓嶄紶閫抐ilterProjName锛屾樉绀烘墍鏈夐檮浠�
+
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
@@ -643,9 +657,10 @@
/// <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
{
@@ -656,7 +671,7 @@
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)
{
@@ -680,9 +695,10 @@
/// <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
{
@@ -693,7 +709,7 @@
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)
{
--
Gitblit v1.9.3