From 349f2f66fdac1a2d64e0c99201b7f09579470714 Mon Sep 17 00:00:00 2001
From: xwt <2740516069@qq.com>
Date: 星期四, 16 十月 2025 14:26:31 +0800
Subject: [PATCH] SJ,XJ,RKJ检验项单独拍照+提交限制
---
StandardInterface/MESApplication/Controllers/QC/RKJController.cs | 119 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 119 insertions(+), 0 deletions(-)
diff --git a/StandardInterface/MESApplication/Controllers/QC/RKJController.cs b/StandardInterface/MESApplication/Controllers/QC/RKJController.cs
index 9ed886f..4e4cf90 100644
--- a/StandardInterface/MESApplication/Controllers/QC/RKJController.cs
+++ b/StandardInterface/MESApplication/Controllers/QC/RKJController.cs
@@ -718,4 +718,123 @@
return Ok();
}
+
+ /// <summary>
+ /// 涓婁紶鍥剧墖鍒版楠岄」鐩殑PICTURE瀛楁
+ /// </summary>
+ /// <param name="file">涓婁紶鐨勫浘鐗囨枃浠�</param>
+ /// <param name="id">妫�楠岄」鐩甀D</param>
+ /// <param name="gid">妫�楠屽崟ID</param>
+ /// <param name="billNo">宸ュ崟鍙�</param>
+ /// <param name="createBy">鍒涘缓浜�</param>
+ /// <returns>涓婁紶缁撴灉</returns>
+ [HttpPost("UploadImageToPicture")]
+ public ResponseResult UploadImageToPicture(IFormFile file, [FromForm] string id, [FromForm] string gid, [FromForm] string billNo, [FromForm] string createBy)
+ {
+ try
+ {
+ // 鍙傛暟楠岃瘉
+ if (file == null || file.Length == 0)
+ {
+ return new ResponseResult
+ {
+ status = 1,
+ message = "璇烽�夋嫨瑕佷笂浼犵殑鍥剧墖鏂囦欢",
+ data = null
+ };
+ }
+
+ if (string.IsNullOrEmpty(id))
+ {
+ return new ResponseResult
+ {
+ status = 1,
+ message = "妫�楠岄」鐩甀D涓嶈兘涓虹┖",
+ data = null
+ };
+ }
+
+ if (string.IsNullOrEmpty(createBy))
+ {
+ return new ResponseResult
+ {
+ status = 1,
+ message = "鍒涘缓浜轰笉鑳戒负绌�",
+ data = null
+ };
+ }
+
+ // 璇诲彇鏂囦欢瀛楄妭鏁扮粍
+ byte[] imageBytes;
+ using (var memoryStream = new MemoryStream())
+ {
+ file.CopyTo(memoryStream);
+ imageBytes = memoryStream.ToArray();
+ }
+
+ // 璋冪敤鏈嶅姟鏂规硶淇濆瓨鍥剧墖
+ var service = new RKJService();
+ var (status, message) = service.UploadImageToPicture(Convert.ToDecimal(id), imageBytes, file.FileName, createBy);
+
+ return new ResponseResult
+ {
+ status = status,
+ message = message,
+ data = null
+ };
+ }
+ catch (Exception ex)
+ {
+ return new ResponseResult
+ {
+ status = 1,
+ message = $"涓婁紶鍥剧墖澶辫触锛歿ex.Message}",
+ data = null
+ };
+ }
+ }
+
+ /// <summary>
+ /// 鍒犻櫎妫�楠岄」鐩殑鍥剧墖
+ /// </summary>
+ /// <param name="data">鍖呭惈妫�楠岄」鐩甀D鐨凧SON瀵硅薄</param>
+ /// <returns>鍒犻櫎缁撴灉</returns>
+ [HttpPost("DeleteImageFromPicture")]
+ public ResponseResult DeleteImageFromPicture([FromBody] JObject data)
+ {
+ try
+ {
+ var id = data["id"]?.ToString();
+
+ if (string.IsNullOrEmpty(id))
+ {
+ return new ResponseResult
+ {
+ status = 1,
+ message = "妫�楠岄」鐩甀D涓嶈兘涓虹┖",
+ data = null
+ };
+ }
+
+ // 璋冪敤鏈嶅姟鏂规硶鍒犻櫎鍥剧墖
+ var service = new RKJService();
+ var (status, message) = service.DeleteImageFromPicture(Convert.ToDecimal(id));
+
+ return new ResponseResult
+ {
+ status = status,
+ message = message,
+ data = null
+ };
+ }
+ catch (Exception ex)
+ {
+ return new ResponseResult
+ {
+ status = 1,
+ message = $"鍒犻櫎鍥剧墖澶辫触锛歿ex.Message}",
+ data = null
+ };
+ }
+ }
}
\ No newline at end of file
--
Gitblit v1.9.3