From 8e5e2fb892df6cc8c61d7c03baa2412522ad11c4 Mon Sep 17 00:00:00 2001
From: xwt <2740516069@qq.com>
Date: 星期四, 25 九月 2025 19:17:11 +0800
Subject: [PATCH] SJ,XJ,RKJ优化
---
StandardInterface/MESApplication/Controllers/QC/SJController.cs | 118 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 117 insertions(+), 1 deletions(-)
diff --git a/StandardInterface/MESApplication/Controllers/QC/SJController.cs b/StandardInterface/MESApplication/Controllers/QC/SJController.cs
index 87a2a52..a50af9f 100644
--- a/StandardInterface/MESApplication/Controllers/QC/SJController.cs
+++ b/StandardInterface/MESApplication/Controllers/QC/SJController.cs
@@ -329,8 +329,10 @@
decimal? id = data["id"]?.ToObject<decimal>();
string? no = data["no"]?.ToString();
string? user = data["user"]?.ToString();
+ decimal? mnum = data["mnum"]?.ToObject<decimal?>();
+ string? dnum = data["dnum"]?.ToString();
- var (result, message) = new SJService().GenUpdate(id, no, user);
+ var (result, message) = new SJService().GenUpdate(id, no, user, mnum, dnum);
dynamic resultInfos = new ExpandoObject();
resultInfos.result = result;
@@ -369,4 +371,118 @@
return ResponseResult.ResponseError(ex);
}
}
+
+ /// <summary>
+ /// 鑾峰彇闄勪欢淇℃伅
+ /// </summary>
+ /// <param name="data">鍖呭惈itemNo鐨凧SON瀵硅薄</param>
+ /// <returns>闄勪欢鍒楄〃</returns>
+ [HttpPost("getAttachments")]
+ public ResponseResult GetAttachments([FromBody] JObject data)
+ {
+ var itemNo = data["itemNo"]?.ToString();
+ try
+ {
+ dynamic resultInfos = new System.Dynamic.ExpandoObject();
+ var tbBillList = new SJService().GetAttachments(itemNo);
+ if (tbBillList == null || tbBillList.Count == 0)
+ {
+ return new ResponseResult
+ {
+ status = 1,
+ message = "璇ユ楠屽崟鏈笂浼犻檮浠朵俊鎭紒",
+ data = null
+ };
+ }
+ resultInfos.tbBillList = tbBillList;
+ return new ResponseResult
+ {
+ status = 0,
+ message = "OK",
+ data = resultInfos
+ };
+ }
+ catch (Exception ex)
+ {
+ return ResponseResult.ResponseError(ex);
+ }
+ }
+
+ /// <summary>
+ /// 棰勮FTP鏂囦欢
+ /// </summary>
+ /// <param name="itemNo">鐗╂枡缂栫爜</param>
+ /// <param name="fileName">鏂囦欢鍚�</param>
+ /// <param name="ftpServer">FTP鏈嶅姟鍣ㄥ湴鍧�</param>
+ /// <returns>鏂囦欢鍐呭</returns>
+ [HttpGet("PreviewFtpFile")]
+ public IActionResult PreviewFtpFile([FromQuery] string itemNo, [FromQuery] string fileName, [FromQuery] string ftpServer)
+ {
+ try
+ {
+ var fileBytes = new SJService().GetFtpFile(itemNo, fileName, ftpServer);
+ if (fileBytes == null)
+ {
+ return NotFound(new ResponseResult
+ {
+ status = 1,
+ message = "鏂囦欢涓嶅瓨鍦ㄦ垨鏃犳硶璁块棶",
+ data = null
+ });
+ }
+
+ var contentType = new SJService().GetContentType(fileName);
+ return File(fileBytes, contentType, fileName);
+ }
+ catch (Exception ex)
+ {
+ return StatusCode(500, new ResponseResult
+ {
+ status = 1,
+ message = ex.Message,
+ data = null
+ });
+ }
+ }
+
+ /// <summary>
+ /// 涓嬭浇FTP鏂囦欢
+ /// </summary>
+ /// <param name="itemNo">鐗╂枡缂栫爜</param>
+ /// <param name="fileName">鏂囦欢鍚�</param>
+ /// <param name="ftpServer">FTP鏈嶅姟鍣ㄥ湴鍧�</param>
+ /// <returns>鏂囦欢涓嬭浇</returns>
+ [HttpGet("DownloadFtpFile")]
+ public IActionResult DownloadFtpFile([FromQuery] string itemNo, [FromQuery] string fileName, [FromQuery] string ftpServer)
+ {
+ try
+ {
+ var fileBytes = new SJService().GetFtpFile(itemNo, fileName, ftpServer);
+ if (fileBytes == null)
+ {
+ return NotFound(new ResponseResult
+ {
+ status = 1,
+ message = "鏂囦欢涓嶅瓨鍦ㄦ垨鏃犳硶璁块棶",
+ data = null
+ });
+ }
+
+ var contentType = new SJService().GetContentType(fileName);
+
+ // 璁剧疆涓嬭浇鍝嶅簲澶�
+ Response.Headers.Add("Content-Disposition", $"attachment; filename=\"{fileName}\"");
+
+ return File(fileBytes, contentType, fileName);
+ }
+ catch (Exception ex)
+ {
+ return StatusCode(500, new ResponseResult
+ {
+ status = 1,
+ message = ex.Message,
+ data = null
+ });
+ }
+ }
}
\ No newline at end of file
--
Gitblit v1.9.3