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/MES.Service/Modes/MesQamftp.cs | 2
StandardInterface/MES.Service/Modes/QsItemOqcItem.cs | 6 +
StandardInterface/MES.Service/Modes/QamftpDto.cs | 1
StandardInterface/MESApplication/Controllers/QC/SJController.cs | 25 +++-
StandardInterface/MES.Service/service/QC/RKJService.cs | 68 +++++++++++--
StandardInterface/MES.Service/service/QC/XJService.cs | 62 ++++++++++-
StandardInterface/MES.Service/Modes/QsQaItemXj01.cs | 6 +
StandardInterface/MESApplication/Controllers/QC/XJController.cs | 26 ++++-
StandardInterface/MESApplication/Controllers/QC/RKJController.cs | 30 ++++--
StandardInterface/MES.Service/service/QC/SJService.cs | 32 +++++-
10 files changed, 210 insertions(+), 48 deletions(-)
diff --git a/StandardInterface/MES.Service/Modes/MesQamftp.cs b/StandardInterface/MES.Service/Modes/MesQamftp.cs
index 29c0519..fbd77dc 100644
--- a/StandardInterface/MES.Service/Modes/MesQamftp.cs
+++ b/StandardInterface/MES.Service/Modes/MesQamftp.cs
@@ -50,5 +50,7 @@
[SugarColumn(ColumnName = "ITEM_ID")]
public decimal? ItemId { get; set; }
+ [SugarColumn(ColumnName = "PID")]
+ public decimal? Pid { get; set; }
}
}
\ No newline at end of file
diff --git a/StandardInterface/MES.Service/Modes/QamftpDto.cs b/StandardInterface/MES.Service/Modes/QamftpDto.cs
index 8bf3c2e..e09a42b 100644
--- a/StandardInterface/MES.Service/Modes/QamftpDto.cs
+++ b/StandardInterface/MES.Service/Modes/QamftpDto.cs
@@ -19,5 +19,6 @@
public string LastupdateBy { get; set; }
public DateTime? LastupdateDate { get; set; }
public decimal? ItemId { get; set; }
+ public decimal? Pid { get; set; }
}
}
\ No newline at end of file
diff --git a/StandardInterface/MES.Service/Modes/QsItemOqcItem.cs b/StandardInterface/MES.Service/Modes/QsItemOqcItem.cs
index 663083a..77043a7 100644
--- a/StandardInterface/MES.Service/Modes/QsItemOqcItem.cs
+++ b/StandardInterface/MES.Service/Modes/QsItemOqcItem.cs
@@ -171,4 +171,10 @@
[SugarColumn(IsIgnore = true)] public string? imageData { get; set; }
[SugarColumn(IsIgnore = true)] public int? Unqualified { get; set; }
+
+ /// <summary>
+ /// 鐗╂枡缂栫爜锛堜粠涓昏〃鑾峰彇锛�
+ /// </summary>
+ [SugarColumn(IsIgnore = true)]
+ public string? ItemNo { get; set; }
}
\ No newline at end of file
diff --git a/StandardInterface/MES.Service/Modes/QsQaItemXj01.cs b/StandardInterface/MES.Service/Modes/QsQaItemXj01.cs
index 95a65e9..8f18b91 100644
--- a/StandardInterface/MES.Service/Modes/QsQaItemXj01.cs
+++ b/StandardInterface/MES.Service/Modes/QsQaItemXj01.cs
@@ -162,4 +162,10 @@
[SugarColumn(IsIgnore = true)] public string? result { get; set; }
[SugarColumn(IsIgnore = true)] public string? imageData { get; set; }
+
+ /// <summary>
+ /// 鐗╂枡缂栫爜锛堜粠涓昏〃鑾峰彇锛�
+ /// </summary>
+ [SugarColumn(IsIgnore = true)]
+ public string? ItemNo { get; set; }
}
\ No newline at end of file
diff --git a/StandardInterface/MES.Service/service/QC/RKJService.cs b/StandardInterface/MES.Service/service/QC/RKJService.cs
index 92353cc..dc5c9a7 100644
--- a/StandardInterface/MES.Service/service/QC/RKJService.cs
+++ b/StandardInterface/MES.Service/service/QC/RKJService.cs
@@ -710,8 +710,36 @@
var rkjDto = new RKJDto();
var db = SqlSugarHelper.GetInstance();
- var qsItemOqcItem =
- db.Queryable<QsItemOqcItem>().Single(s => s.Id == id);
+
+ // 浣跨敤JOIN鏌ヨ鑾峰彇瀛愯〃鏁版嵁鍜屼富琛ㄧ殑ItemNo瀛楁
+ var qsItemOqcItem = db
+ .Queryable<QsItemOqcItem, QsItemOqcReq>((a, b) => new JoinQueryInfos(JoinType.Left, a.Pid == b.Id))
+ .Where((a, b) => a.Id == id)
+ .Select((a, b) => new QsItemOqcItem
+ {
+ Id = a.Id,
+ Pid = a.Pid,
+ ProjName = a.ProjName,
+ ItemMod = a.ItemMod,
+ InspectionMethod = a.InspectionMethod,
+ UsingInstruments = a.UsingInstruments,
+ LevelNum = a.LevelNum,
+ MaxValue = a.MaxValue,
+ StandardValue = a.StandardValue,
+ MinValue = a.MinValue,
+ Notes = a.Notes,
+ FcheckLevel = a.FcheckLevel,
+ FacLevel = a.FacLevel,
+ QsCode = a.QsCode,
+ QsName = a.QsName,
+ Picture = a.Picture,
+ Picturename = a.Picturename,
+ IsPass = a.IsPass,
+ Remarks = a.Remarks,
+ FreQty = a.FreQty,
+ // 娣诲姞涓昏〃鐨処temNo瀛楁
+ ItemNo = b.ItemNo
+ }).Single();
if (qsItemOqcItem.IsPass == 0)
qsItemOqcItem.Result = "涓嶅悎鏍�";
@@ -731,7 +759,6 @@
qsItemOqcItem.Unqualified = count;
rkjDto.ItemXj01 = qsItemOqcItem;
-
rkjDto.ItemXj02s = db.Queryable<QsItemOqcItemDetail>()
.Where(s => s.Pid == id)
@@ -960,14 +987,24 @@
/// 鑾峰彇闄勪欢淇℃伅
/// </summary>
/// <param name="ItemNo">鐗╂枡缂栫爜</param>
+ /// <param name="projName">椤圭洰鍚嶇О锛堢敤浜庤繃婊わ級</param>
/// <returns>闄勪欢鍒楄〃</returns>
- public List<QamftpDto> GetAttachments(string ItemNo)
+ public List<QamftpDto> GetAttachments(string ItemNo, string projName = null)
{
var db = SqlSugarHelper.GetInstance();
try
{
- return db.Queryable<MesQamftp>()
+ var query = db.Queryable<MesQamftp>()
.Where(x => x.ItemNo == ItemNo)
+ .Where(x => x.Ftype == "鍏ュ簱妫�"); // 娣诲姞FTYPE = '鍏ュ簱妫�'鐨勯檺鍒�
+
+ // 濡傛灉浼犲叆浜唒rojName锛屽垯鎸塅version杩囨护
+ if (!string.IsNullOrEmpty(projName))
+ {
+ query = query.Where(x => x.Fversion == projName);
+ }
+
+ return query
.OrderBy(x => x.Fdate, OrderByType.Desc)
.Select(x => new QamftpDto
{
@@ -998,24 +1035,33 @@
/// </summary>
/// <param name="itemNo">鐗╂枡缂栫爜</param>
/// <param name="fileName">鏂囦欢鍚�</param>
- /// <param name="ftpServer">FTP鏈嶅姟鍣ㄥ湴鍧�</param>
+ /// <param name="projName">椤圭洰鍚嶇О</param>
/// <returns>鏂囦欢瀛楄妭鏁扮粍</returns>
- public byte[] GetFtpFile(string itemNo, string fileName, string ftpServer)
+ public byte[] GetFtpFile(string itemNo, string fileName, string projName = null)
{
// 鍙傛暟楠岃瘉
- if (string.IsNullOrEmpty(itemNo) || string.IsNullOrEmpty(fileName) || string.IsNullOrEmpty(ftpServer))
+ if (string.IsNullOrEmpty(itemNo) || string.IsNullOrEmpty(fileName))
{
- throw new ArgumentException("鍙傛暟涓嶈兘涓虹┖: itemNo, fileName, ftpServer");
+ throw new ArgumentException("鍙傛暟涓嶈兘涓虹┖: itemNo, fileName");
}
string ftpUser = "hm_ftp";
string ftpPwd = "dell_123";
+ string ftpServer = "ftp://192.168.1.100"; // 榛樿FTP鏈嶅姟鍣ㄥ湴鍧�
// 鏍囧噯鍖朏TP鏈嶅姟鍣ㄥ湴鍧�
string normalizedServer = NormalizeFtpServer(ftpServer);
- // 鏋勫缓FTP鏂囦欢璺緞 - RKJ浣跨敤FQC鏂囦欢澶�
- string ftpPath = $"{normalizedServer}/FQC/{itemNo}/{fileName}";
+ // 鏋勫缓FTP鏂囦欢璺緞 - RKJ浣跨敤FQC鏂囦欢澶癸紝濡傛灉鏈塸rojName鍒欎娇鐢╬rojName浣滀负璺緞鐨勬渶鍚庝竴娈�
+ string ftpPath;
+ if (!string.IsNullOrEmpty(projName))
+ {
+ ftpPath = $"{normalizedServer}/FQC/{itemNo}/{projName}/{fileName}";
+ }
+ else
+ {
+ ftpPath = $"{normalizedServer}/FQC/{itemNo}/{fileName}";
+ }
try
{
diff --git a/StandardInterface/MES.Service/service/QC/SJService.cs b/StandardInterface/MES.Service/service/QC/SJService.cs
index 9ea4fb8..1d48230 100644
--- a/StandardInterface/MES.Service/service/QC/SJService.cs
+++ b/StandardInterface/MES.Service/service/QC/SJService.cs
@@ -742,14 +742,22 @@
/// </summary>
/// <param name="itemNo">鐗╂枡缂栫爜</param>
/// <returns>闄勪欢鍒楄〃</returns>
- public List<QamftpDto> GetAttachments(string itemNo)
+ public List<QamftpDto> GetAttachments(string itemNo, string projName = null)
{
var db = SqlSugarHelper.GetInstance();
try
{
- return db.Queryable<MesQamftp>()
+ var query = db.Queryable<MesQamftp>()
.Where(x => x.ItemNo == itemNo)
- .OrderBy(x => x.Fdate, OrderByType.Desc)
+ .Where(x => x.Ftype == "棣栨");
+
+ // 濡傛灉浼犲叆浜唒rojName锛屽垯鎸塅version杩囨护
+ if (!string.IsNullOrEmpty(projName))
+ {
+ query = query.Where(x => x.Fversion == projName);
+ }
+
+ return query.OrderBy(x => x.Fdate, OrderByType.Desc)
.Select(x => new QamftpDto
{
Id = x.Id,
@@ -765,7 +773,8 @@
F_type = x.F_type,
LastupdateBy = x.LastupdateBy,
LastupdateDate = x.LastupdateDate,
- ItemId = x.ItemId
+ ItemId = x.ItemId,
+ Pid = x.Pid
}).ToList();
}
catch (Exception ex)
@@ -780,8 +789,9 @@
/// <param name="itemNo">鐗╂枡缂栫爜</param>
/// <param name="fileName">鏂囦欢鍚�</param>
/// <param name="ftpServer">FTP鏈嶅姟鍣ㄥ湴鍧�</param>
+ /// <param name="projName">椤圭洰鍚嶇О</param>
/// <returns>鏂囦欢瀛楄妭鏁扮粍</returns>
- public byte[] GetFtpFile(string itemNo, string fileName, string ftpServer)
+ public byte[] GetFtpFile(string itemNo, string fileName, string ftpServer, string projName = null)
{
// 鍙傛暟楠岃瘉
if (string.IsNullOrEmpty(itemNo) || string.IsNullOrEmpty(fileName) || string.IsNullOrEmpty(ftpServer))
@@ -795,8 +805,16 @@
// 鏍囧噯鍖朏TP鏈嶅姟鍣ㄥ湴鍧�
string normalizedServer = NormalizeFtpServer(ftpServer);
- // 鏋勫缓FTP鏂囦欢璺緞 - 棣栨浣跨敤OPC鐩綍
- string ftpPath = $"{normalizedServer}/OPC/{itemNo}/{fileName}";
+ // 鏋勫缓FTP鏂囦欢璺緞 - 棣栨浣跨敤OPC鐩綍锛屽鏋滀紶鍏ヤ簡projName鍒欎娇鐢ㄦ柊鏍煎紡
+ string ftpPath;
+ if (!string.IsNullOrEmpty(projName))
+ {
+ ftpPath = $"{normalizedServer}/OPC/{itemNo}/{projName}/{fileName}";
+ }
+ else
+ {
+ ftpPath = $"{normalizedServer}/OPC/{itemNo}/{fileName}";
+ }
try
{
diff --git a/StandardInterface/MES.Service/service/QC/XJService.cs b/StandardInterface/MES.Service/service/QC/XJService.cs
index 8d3ddfc..de5a9a7 100644
--- a/StandardInterface/MES.Service/service/QC/XJService.cs
+++ b/StandardInterface/MES.Service/service/QC/XJService.cs
@@ -418,8 +418,35 @@
var xjDto = new XJDto();
var db = SqlSugarHelper.GetInstance();
- var qsQaItemXj01 =
- db.Queryable<QsQaItemXj01>().Single(s => s.Id == id);
+
+ // 浣跨敤JOIN鏌ヨ鑾峰彇瀛愯〃鏁版嵁鍜屼富琛ㄧ殑ItemNo瀛楁
+ var qsQaItemXj01 = db
+ .Queryable<QsQaItemXj01, QsQaItemXj>((a, b) => new JoinQueryInfos(JoinType.Left, a.Pid == b.Id))
+ .Where((a, b) => a.Id == id)
+ .Select((a, b) => new QsQaItemXj01
+ {
+ Id = a.Id,
+ Pid = a.Pid,
+ ProjName = a.ProjName,
+ ItemMod = a.ItemMod,
+ InspectionMethod = a.InspectionMethod,
+ UsingInstruments = a.UsingInstruments,
+ LevelNum = a.LevelNum,
+ MaxValue = a.MaxValue,
+ StandardValue = a.StandardValue,
+ MinValue = a.MinValue,
+ Notes = a.Notes,
+ FcheckLevel = a.FcheckLevel,
+ FacLevel = a.FacLevel,
+ QsCode = a.QsCode,
+ QsName = a.QsName,
+ Picture = a.Picture,
+ Picturename = a.Picturename,
+ IsPass = a.IsPass,
+ Remarks = a.Remarks,
+ // 娣诲姞涓昏〃鐨処temNo瀛楁
+ ItemNo = b.ItemNo
+ }).Single();
if (qsQaItemXj01.IsPass == 0)
qsQaItemXj01.result = "涓嶅悎鏍�";
@@ -433,7 +460,6 @@
Convert.ToBase64String(qsQaItemXj01.Picture);
xjDto.ItemXj01 = qsQaItemXj01;
-
xjDto.ItemXj02s = db.Queryable<QsQaItemXj02>().Where(s => s.Pid == id)
.ToList();
@@ -751,15 +777,24 @@
/// 鑾峰彇闄勪欢淇℃伅
/// </summary>
/// <param name="itemNo">鐗╂枡缂栫爜</param>
+ /// <param name="projName">椤圭洰鍚嶇О锛堝彲閫夛紝鐢ㄤ簬杩囨护锛�</param>
/// <returns>闄勪欢鍒楄〃</returns>
- public List<QamftpDto> GetAttachments(string itemNo)
+ public List<QamftpDto> GetAttachments(string itemNo, string projName = null)
{
var db = SqlSugarHelper.GetInstance();
try
{
- return db.Queryable<MesQamftp>()
+ var query = db.Queryable<MesQamftp>()
.Where(x => x.ItemNo == itemNo)
- .OrderBy(x => x.Fdate, OrderByType.Desc)
+ .Where(x => x.Ftype == "宸℃"); // 娣诲姞FTYPE = '宸℃'鐨勯檺鍒�
+
+ // 濡傛灉浼犲叆浜唒rojName锛屽垯鎸塅version杩囨护
+ if (!string.IsNullOrEmpty(projName))
+ {
+ query = query.Where(x => x.Fversion == projName);
+ }
+
+ return query.OrderBy(x => x.Fdate, OrderByType.Desc)
.Select(x => new QamftpDto
{
Id = x.Id,
@@ -790,8 +825,9 @@
/// <param name="itemNo">鐗╂枡缂栫爜</param>
/// <param name="fileName">鏂囦欢鍚�</param>
/// <param name="ftpServer">FTP鏈嶅姟鍣ㄥ湴鍧�</param>
+ /// <param name="projName">椤圭洰鍚嶇О锛堝彲閫夛紝鐢ㄤ簬璺緞鏋勫缓锛�</param>
/// <returns>鏂囦欢瀛楄妭鏁扮粍</returns>
- public byte[] GetFtpFile(string itemNo, string fileName, string ftpServer)
+ public byte[] GetFtpFile(string itemNo, string fileName, string ftpServer, string projName = null)
{
// 鍙傛暟楠岃瘉
if (string.IsNullOrEmpty(itemNo) || string.IsNullOrEmpty(fileName) || string.IsNullOrEmpty(ftpServer))
@@ -805,8 +841,16 @@
// 鏍囧噯鍖朏TP鏈嶅姟鍣ㄥ湴鍧�
string normalizedServer = NormalizeFtpServer(ftpServer);
- // 鏋勫缓FTP鏂囦欢璺緞 - 宸℃浣跨敤OPC鐩綍
- string ftpPath = $"{normalizedServer}/OPC/{itemNo}/{fileName}";
+ // 鏋勫缓FTP鏂囦欢璺緞 - 宸℃浣跨敤OPC鐩綍锛屽鏋滀紶鍏ヤ簡projName鍒欎娇鐢ㄦ柊鏍煎紡
+ string ftpPath;
+ if (!string.IsNullOrEmpty(projName))
+ {
+ ftpPath = $"{normalizedServer}/OPC/{itemNo}/{projName}/{fileName}";
+ }
+ else
+ {
+ ftpPath = $"{normalizedServer}/OPC/{itemNo}/{fileName}";
+ }
try
{
diff --git a/StandardInterface/MESApplication/Controllers/QC/RKJController.cs b/StandardInterface/MESApplication/Controllers/QC/RKJController.cs
index 2f8057f..9ed886f 100644
--- a/StandardInterface/MESApplication/Controllers/QC/RKJController.cs
+++ b/StandardInterface/MESApplication/Controllers/QC/RKJController.cs
@@ -574,16 +574,26 @@
/// <summary>
/// 鑾峰彇闄勪欢淇℃伅
/// </summary>
- /// <param name="data">鍖呭惈itemNo鐨凧SON瀵硅薄</param>
+ /// <param name="data">鍖呭惈itemNo銆乸rojName銆乫romPage鐨凧SON瀵硅薄</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(); // 鏂板鍙傛暟
+
+ // 鏉′欢杩囨护閫昏緫锛氭牴鎹甪romPage鍐冲畾鏄惁杩囨护
+ 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)
{
diff --git a/StandardInterface/MESApplication/Controllers/QC/SJController.cs b/StandardInterface/MESApplication/Controllers/QC/SJController.cs
index a50af9f..83e6a80 100644
--- a/StandardInterface/MESApplication/Controllers/QC/SJController.cs
+++ b/StandardInterface/MESApplication/Controllers/QC/SJController.cs
@@ -375,16 +375,27 @@
/// <summary>
/// 鑾峰彇闄勪欢淇℃伅
/// </summary>
- /// <param name="data">鍖呭惈itemNo鐨凧SON瀵硅薄</param>
+ /// <param name="data">鍖呭惈itemNo鍜宲rojName鐨凧SON瀵硅薄</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();
+
+ // 鏍规嵁鏉ユ簮椤甸潰鍐冲畾鏄惁杩囨护
+ string filterProjName = null;
+ if (fromPage == "Detail" && !string.IsNullOrEmpty(projName))
+ {
+ filterProjName = projName; // Detail椤甸潰闇�瑕佽繃婊�
+ }
+ // Add椤甸潰涓嶄紶閫抐ilterProjName锛屾樉绀烘墍鏈夐檮浠�
+
try
{
dynamic resultInfos = new System.Dynamic.ExpandoObject();
- var tbBillList = new SJService().GetAttachments(itemNo);
+ var tbBillList = new SJService().GetAttachments(itemNo, filterProjName);
if (tbBillList == null || tbBillList.Count == 0)
{
return new ResponseResult
@@ -414,13 +425,14 @@
/// <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
{
- var fileBytes = new SJService().GetFtpFile(itemNo, fileName, ftpServer);
+ var fileBytes = new SJService().GetFtpFile(itemNo, fileName, ftpServer, projName);
if (fileBytes == null)
{
return NotFound(new ResponseResult
@@ -451,13 +463,14 @@
/// <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
{
- var fileBytes = new SJService().GetFtpFile(itemNo, fileName, ftpServer);
+ var fileBytes = new SJService().GetFtpFile(itemNo, fileName, ftpServer, projName);
if (fileBytes == null)
{
return NotFound(new ResponseResult
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