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/service/QC/SJService.cs | 32 +++++++++++++++++++++++++-------
1 files changed, 25 insertions(+), 7 deletions(-)
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
{
--
Gitblit v1.9.3