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/MES.Service/Modes/QsItemOqcItem.cs             |   10 
 StandardInterface/MESApplication/Controllers/QC/SJController.cs  |  119 +++++++++
 StandardInterface/MES.Service/service/QC/RKJService.cs           |  130 +++++++++
 StandardInterface/MES.Service/service/QC/XJService.cs            |  123 +++++++++
 StandardInterface/MESApplication/Controllers/QC/XJController.cs  |  119 +++++++++
 StandardInterface/MESApplication/Controllers/QC/RKJController.cs |  119 +++++++++
 StandardInterface/MES.Service/service/QC/SJService.cs            |  123 +++++++++
 StandardInterface/MESApplication/appsettings.json                |    2 
 8 files changed, 740 insertions(+), 5 deletions(-)

diff --git a/StandardInterface/MES.Service/Modes/QsItemOqcItem.cs b/StandardInterface/MES.Service/Modes/QsItemOqcItem.cs
index 5335a54..574410f 100644
--- a/StandardInterface/MES.Service/Modes/QsItemOqcItem.cs
+++ b/StandardInterface/MES.Service/Modes/QsItemOqcItem.cs
@@ -150,13 +150,21 @@
     public byte[]? Picture { get; set; }
 
     /// <summary>
-    ///     鍥剧墖鍚嶇О
+    ///     gongxu
     /// </summary>
     [Column("PICTURENAME")]
     [SugarColumn(ColumnName = "PICTURENAME")] //鐢ㄤ簬SqlSugar
     [StringLength(32, ErrorMessage = "Picturename闀垮害涓嶈兘瓒呭嚭32")]
     public string? Picturename { get; set; }
 
+    /// <summary>
+    ///     鍥剧墖鍚嶇О
+    /// </summary>
+    [Column("PICTURENAME")]
+    [SugarColumn(ColumnName = "TPICTURENAME")] //鐢ㄤ簬SqlSugar
+    [StringLength(32, ErrorMessage = "Picturename闀垮害涓嶈兘瓒呭嚭32")]
+    public string? TPicturename { get; set; }
+
     [Column("Remarks")]
     [SugarColumn(ColumnName = "Remarks")] //鐢ㄤ簬SqlSugar
     [StringLength(200, ErrorMessage = "澶囨敞涓嶈兘瓒呭嚭200")]
diff --git a/StandardInterface/MES.Service/service/QC/RKJService.cs b/StandardInterface/MES.Service/service/QC/RKJService.cs
index f7da3e0..83a7b51 100644
--- a/StandardInterface/MES.Service/service/QC/RKJService.cs
+++ b/StandardInterface/MES.Service/service/QC/RKJService.cs
@@ -608,6 +608,7 @@
         if (StringUtil.IsNotNullOrEmpty(queryObj.createUser))
             lineNo = _baseService.getUserLineNo(queryObj.createUser);
 
+
         return db
             .Queryable<QsItemOqcReq, Womdaa, MesItems>((a, da, b) =>
                 new JoinQueryInfos(
@@ -625,12 +626,12 @@
                 !"鏈畬鎴�".Equals(queryObj.result),
                 (a, da, b) => a.FcheckResu != null && a.FcheckResu != "")
             .WhereIF(id > 0, (a, da, b) => a.Id == id)
-            // 娣诲姞fsubmit瀛楁杩囨护閫昏緫
+            // 娣诲姞fsubmit瀛楁杩囨护閫昏緫 - 鍙湁鍦ㄦ槑纭寚瀹歠submit鍙傛暟鏃舵墠杩囨护锛屼笖娌℃湁浼犻�抜d鏃舵墠杩囨护
             .WhereIF(
-                StringUtil.IsNotNullOrEmpty(queryObj.fsubmit) && queryObj.fsubmit == "1",
+                id <= 0 && StringUtil.IsNotNullOrEmpty(queryObj.fsubmit) && queryObj.fsubmit == "1",
                 (a, da, b) => a.Fsubmit == 1)
             .WhereIF(
-                StringUtil.IsNullOrEmpty(queryObj.fsubmit) || queryObj.fsubmit == "0",
+                id <= 0 && StringUtil.IsNotNullOrEmpty(queryObj.fsubmit) && queryObj.fsubmit == "0",
                 (a, da, b) => a.Fsubmit == 0 || a.Fsubmit == null)
             // 娣诲姞鎼滅储鏉′欢 - 鏍规嵁閫夋嫨鐨勬悳绱㈠瓧娈佃繘琛岀簿纭悳绱�
             .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue) && !string.IsNullOrEmpty(queryObj.searchField) && queryObj.searchField == "billNo",  // 宸ュ崟
@@ -1217,4 +1218,127 @@
                 .ExecuteCommand();
         });
     }
+
+    /// <summary>
+    /// 涓婁紶鍥剧墖鍒版楠岄」鐩殑PICTURE瀛楁
+    /// </summary>
+    /// <param name="id">妫�楠岄」鐩甀D</param>
+    /// <param name="imageBytes">鍥剧墖瀛楄妭鏁扮粍</param>
+    /// <param name="fileName">鍘熷鏂囦欢鍚�</param>
+    /// <param name="createBy">鍒涘缓浜�</param>
+    /// <returns>鎿嶄綔缁撴灉</returns>
+    public (int status, string message) UploadImageToPicture(decimal id, byte[] imageBytes, string fileName, string createBy)
+    {
+        try
+        {
+            if (imageBytes == null || imageBytes.Length == 0)
+            {
+                return (1, "鍥剧墖鏁版嵁涓虹┖");
+            }
+
+            if (string.IsNullOrEmpty(fileName))
+            {
+                return (1, "鏂囦欢鍚嶄负绌�");
+            }
+
+            // 楠岃瘉鍥剧墖鏍煎紡
+            var allowedExtensions = new[] { ".jpg", ".jpeg", ".png", ".gif", ".bmp", ".webp" };
+            var extension = System.IO.Path.GetExtension(fileName).ToLower();
+            if (!allowedExtensions.Contains(extension))
+            {
+                return (1, "涓嶆敮鎸佺殑鍥剧墖鏍煎紡锛屼粎鏀寔锛歫pg, jpeg, png, gif, bmp, webp");
+            }
+
+            // 楠岃瘉鍥剧墖澶у皬锛堥檺鍒朵负5MB锛�
+            if (imageBytes.Length > 5 * 1024 * 1024)
+            {
+                return (1, "鍥剧墖澶у皬涓嶈兘瓒呰繃5MB");
+            }
+
+            // 鐢熸垚鏃堕棿鎴虫枃浠跺悕锛屾牸寮忥細1746945271304.jpg
+            var timestamp = DateTimeOffset.Now.ToUnixTimeMilliseconds();
+            var timestampFileName = $"{timestamp}{extension}";
+
+            var result = SqlSugarHelper.UseTransactionWithOracle(db =>
+            {
+                // 妫�鏌ユ楠岄」鐩槸鍚﹀瓨鍦�
+                var exists = db.Queryable<QsItemOqcItem>()
+                    .Where(s => s.Id == id)
+                    .Any();
+
+                if (!exists)
+                {
+                    throw new Exception("妫�楠岄」鐩笉瀛樺湪");
+                }
+
+                // 鏇存柊PICTURE瀛楁锛圠ONG RAW绫诲瀷锛夊拰TPICTURENAME瀛楁锛堟椂闂存埑鏂囦欢鍚嶏級
+                var updateResult = db.Updateable<QsItemOqcItem>()
+                    .SetColumns(s => s.Picture == imageBytes)
+                    .SetColumns(s => s.TPicturename == timestampFileName)
+                    .Where(s => s.Id == id)
+                    .ExecuteCommand();
+
+                return updateResult;
+            });
+
+            if (result > 0)
+            {
+                return (0, "鍥剧墖淇濆瓨鎴愬姛");
+            }
+            else
+            {
+                return (1, "鍥剧墖淇濆瓨澶辫触锛屾湭鎵惧埌瀵瑰簲鐨勬楠岄」鐩�");
+            }
+        }
+        catch (Exception ex)
+        {
+            return (1, $"鍥剧墖淇濆瓨澶辫触锛歿ex.Message}");
+        }
+    }
+
+    /// <summary>
+    /// 鍒犻櫎妫�楠岄」鐩殑鍥剧墖
+    /// </summary>
+    /// <param name="id">妫�楠岄」鐩甀D</param>
+    /// <returns>鎿嶄綔缁撴灉</returns>
+    public (int status, string message) DeleteImageFromPicture(decimal id)
+    {
+        try
+        {
+            var result = SqlSugarHelper.UseTransactionWithOracle(db =>
+            {
+                // 妫�鏌ユ楠岄」鐩槸鍚﹀瓨鍦�
+                var exists = db.Queryable<QsItemOqcItem>()
+                    .Where(s => s.Id == id)
+                    .Any();
+
+                if (!exists)
+                {
+                    throw new Exception("妫�楠岄」鐩笉瀛樺湪");
+                }
+
+                // 娓呯┖PICTURE瀛楁鍜孴PICTURENAME瀛楁
+                var updateResult = db.Updateable<QsItemOqcItem>()
+                    .SetColumns(s => s.Picture == null)
+                    .SetColumns(s => s.TPicturename == null)
+                    .Where(s => s.Id == id)
+                    .ExecuteCommand();
+
+                return updateResult;
+            });
+
+            if (result > 0)
+            {
+                return (0, "鍥剧墖鍒犻櫎鎴愬姛");
+            }
+            else
+            {
+                return (1, "鍥剧墖鍒犻櫎澶辫触锛屾湭鎵惧埌瀵瑰簲鐨勬楠岄」鐩�");
+            }
+        }
+        catch (Exception ex)
+        {
+            return (1, $"鍥剧墖鍒犻櫎澶辫触锛歿ex.Message}");
+        }
+    }
 }
\ No newline at end of file
diff --git a/StandardInterface/MES.Service/service/QC/SJService.cs b/StandardInterface/MES.Service/service/QC/SJService.cs
index 1d48230..db8e86a 100644
--- a/StandardInterface/MES.Service/service/QC/SJService.cs
+++ b/StandardInterface/MES.Service/service/QC/SJService.cs
@@ -1028,4 +1028,127 @@
 
         return result;
     }
+
+    /// <summary>
+    /// 涓婁紶鍥剧墖鍒版楠岄」鐩殑PICTURE瀛楁
+    /// </summary>
+    /// <param name="id">妫�楠岄」鐩甀D</param>
+    /// <param name="imageBytes">鍥剧墖瀛楄妭鏁扮粍</param>
+    /// <param name="fileName">鍘熷鏂囦欢鍚�</param>
+    /// <param name="createBy">鍒涘缓浜�</param>
+    /// <returns>鎿嶄綔缁撴灉</returns>
+    public (int status, string message) UploadImageToPicture(decimal id, byte[] imageBytes, string fileName, string createBy)
+    {
+        try
+        {
+            if (imageBytes == null || imageBytes.Length == 0)
+            {
+                return (1, "鍥剧墖鏁版嵁涓虹┖");
+            }
+
+            if (string.IsNullOrEmpty(fileName))
+            {
+                return (1, "鏂囦欢鍚嶄负绌�");
+            }
+
+            // 楠岃瘉鍥剧墖鏍煎紡
+            var allowedExtensions = new[] { ".jpg", ".jpeg", ".png", ".gif", ".bmp", ".webp" };
+            var extension = System.IO.Path.GetExtension(fileName).ToLower();
+            if (!allowedExtensions.Contains(extension))
+            {
+                return (1, "涓嶆敮鎸佺殑鍥剧墖鏍煎紡锛屼粎鏀寔锛歫pg, jpeg, png, gif, bmp, webp");
+            }
+
+            // 楠岃瘉鍥剧墖澶у皬锛堥檺鍒朵负5MB锛�
+            if (imageBytes.Length > 5 * 1024 * 1024)
+            {
+                return (1, "鍥剧墖澶у皬涓嶈兘瓒呰繃5MB");
+            }
+
+            // 鐢熸垚鏃堕棿鎴虫枃浠跺悕锛屾牸寮忥細1746945271304.jpg
+            var timestamp = DateTimeOffset.Now.ToUnixTimeMilliseconds();
+            var timestampFileName = $"{timestamp}{extension}";
+
+            var result = SqlSugarHelper.UseTransactionWithOracle(db =>
+            {
+                // 妫�鏌ユ楠岄」鐩槸鍚﹀瓨鍦�
+                var exists = db.Queryable<QsItemIpiItem>()
+                    .Where(s => s.Id == id)
+                    .Any();
+
+                if (!exists)
+                {
+                    throw new Exception("妫�楠岄」鐩笉瀛樺湪");
+                }
+
+                // 鏇存柊PICTURE瀛楁锛圠ONG RAW绫诲瀷锛夊拰PICTURENAME瀛楁锛堟椂闂存埑鏂囦欢鍚嶏級
+                var updateResult = db.Updateable<QsItemIpiItem>()
+                    .SetColumns(s => s.Picture == imageBytes)
+                    .SetColumns(s => s.Picturename == timestampFileName)
+                    .Where(s => s.Id == id)
+                    .ExecuteCommand();
+
+                return updateResult;
+            });
+
+            if (result > 0)
+            {
+                return (0, "鍥剧墖淇濆瓨鎴愬姛");
+            }
+            else
+            {
+                return (1, "鍥剧墖淇濆瓨澶辫触锛屾湭鎵惧埌瀵瑰簲鐨勬楠岄」鐩�");
+            }
+        }
+        catch (Exception ex)
+        {
+            return (1, $"鍥剧墖淇濆瓨澶辫触锛歿ex.Message}");
+        }
+    }
+
+    /// <summary>
+    /// 鍒犻櫎妫�楠岄」鐩殑鍥剧墖
+    /// </summary>
+    /// <param name="id">妫�楠岄」鐩甀D</param>
+    /// <returns>鎿嶄綔缁撴灉</returns>
+    public (int status, string message) DeleteImageFromPicture(decimal id)
+    {
+        try
+        {
+            var result = SqlSugarHelper.UseTransactionWithOracle(db =>
+            {
+                // 妫�鏌ユ楠岄」鐩槸鍚﹀瓨鍦�
+                var exists = db.Queryable<QsItemIpiItem>()
+                    .Where(s => s.Id == id)
+                    .Any();
+
+                if (!exists)
+                {
+                    throw new Exception("妫�楠岄」鐩笉瀛樺湪");
+                }
+
+                // 娓呯┖PICTURE瀛楁鍜孭ICTURENAME瀛楁
+                var updateResult = db.Updateable<QsItemIpiItem>()
+                    .SetColumns(s => s.Picture == null)
+                    .SetColumns(s => s.Picturename == null)
+                    .Where(s => s.Id == id)
+                    .ExecuteCommand();
+
+                return updateResult;
+            });
+
+            if (result > 0)
+            {
+                return (0, "鍥剧墖鍒犻櫎鎴愬姛");
+            }
+            else
+            {
+                return (1, "鍥剧墖鍒犻櫎澶辫触锛屾湭鎵惧埌瀵瑰簲鐨勬楠岄」鐩�");
+            }
+        }
+        catch (Exception ex)
+        {
+            return (1, $"鍥剧墖鍒犻櫎澶辫触锛歿ex.Message}");
+        }
+    }
 }
\ No newline at end of file
diff --git a/StandardInterface/MES.Service/service/QC/XJService.cs b/StandardInterface/MES.Service/service/QC/XJService.cs
index de5a9a7..df2f739 100644
--- a/StandardInterface/MES.Service/service/QC/XJService.cs
+++ b/StandardInterface/MES.Service/service/QC/XJService.cs
@@ -1001,5 +1001,128 @@
         };
     }
 
+    /// <summary>
+    /// 涓婁紶鍥剧墖鍒版楠岄」鐩殑PICTURE瀛楁
+    /// </summary>
+    /// <param name="id">妫�楠岄」鐩甀D</param>
+    /// <param name="imageBytes">鍥剧墖瀛楄妭鏁扮粍</param>
+    /// <param name="fileName">鍘熷鏂囦欢鍚�</param>
+    /// <param name="createBy">鍒涘缓浜�</param>
+    /// <returns>鎿嶄綔缁撴灉</returns>
+    public (int status, string message) UploadImageToPicture(decimal id, byte[] imageBytes, string fileName, string createBy)
+    {
+        try
+        {
+            if (imageBytes == null || imageBytes.Length == 0)
+            {
+                return (1, "鍥剧墖鏁版嵁涓虹┖");
+            }
+
+            if (string.IsNullOrEmpty(fileName))
+            {
+                return (1, "鏂囦欢鍚嶄负绌�");
+            }
+
+            // 楠岃瘉鍥剧墖鏍煎紡
+            var allowedExtensions = new[] { ".jpg", ".jpeg", ".png", ".gif", ".bmp", ".webp" };
+            var extension = System.IO.Path.GetExtension(fileName).ToLower();
+            if (!allowedExtensions.Contains(extension))
+            {
+                return (1, "涓嶆敮鎸佺殑鍥剧墖鏍煎紡锛屼粎鏀寔锛歫pg, jpeg, png, gif, bmp, webp");
+            }
+
+            // 楠岃瘉鍥剧墖澶у皬锛堥檺鍒朵负5MB锛�
+            if (imageBytes.Length > 5 * 1024 * 1024)
+            {
+                return (1, "鍥剧墖澶у皬涓嶈兘瓒呰繃5MB");
+            }
+
+            // 鐢熸垚鏃堕棿鎴虫枃浠跺悕锛屾牸寮忥細1746945271304.jpg
+            var timestamp = DateTimeOffset.Now.ToUnixTimeMilliseconds();
+            var timestampFileName = $"{timestamp}{extension}";
+
+            var result = SqlSugarHelper.UseTransactionWithOracle(db =>
+            {
+                // 妫�鏌ユ楠岄」鐩槸鍚﹀瓨鍦�
+                var exists = db.Queryable<QsQaItemXj01>()
+                    .Where(s => s.Id == id)
+                    .Any();
+
+                if (!exists)
+                {
+                    throw new Exception("妫�楠岄」鐩笉瀛樺湪");
+                }
+
+                // 鏇存柊PICTURE瀛楁锛圠ONG RAW绫诲瀷锛夊拰PICTURENAME瀛楁锛堟椂闂存埑鏂囦欢鍚嶏級
+                var updateResult = db.Updateable<QsQaItemXj01>()
+                    .SetColumns(s => s.Picture == imageBytes)
+                    .SetColumns(s => s.Picturename == timestampFileName)
+                    .Where(s => s.Id == id)
+                    .ExecuteCommand();
+
+                return updateResult;
+            });
+
+            if (result > 0)
+            {
+                return (0, "鍥剧墖淇濆瓨鎴愬姛");
+            }
+            else
+            {
+                return (1, "鍥剧墖淇濆瓨澶辫触锛屾湭鎵惧埌瀵瑰簲鐨勬楠岄」鐩�");
+            }
+        }
+        catch (Exception ex)
+        {
+            return (1, $"鍥剧墖淇濆瓨澶辫触锛歿ex.Message}");
+        }
+    }
+
+    /// <summary>
+    /// 鍒犻櫎妫�楠岄」鐩殑鍥剧墖
+    /// </summary>
+    /// <param name="id">妫�楠岄」鐩甀D</param>
+    /// <returns>鎿嶄綔缁撴灉</returns>
+    public (int status, string message) DeleteImageFromPicture(decimal id)
+    {
+        try
+        {
+            var result = SqlSugarHelper.UseTransactionWithOracle(db =>
+            {
+                // 妫�鏌ユ楠岄」鐩槸鍚﹀瓨鍦�
+                var exists = db.Queryable<QsQaItemXj01>()
+                    .Where(s => s.Id == id)
+                    .Any();
+
+                if (!exists)
+                {
+                    throw new Exception("妫�楠岄」鐩笉瀛樺湪");
+                }
+
+                // 娓呯┖PICTURE瀛楁鍜孭ICTURENAME瀛楁
+                var updateResult = db.Updateable<QsQaItemXj01>()
+                    .SetColumns(s => s.Picture == null)
+                    .SetColumns(s => s.Picturename == null)
+                    .Where(s => s.Id == id)
+                    .ExecuteCommand();
+
+                return updateResult;
+            });
+
+            if (result > 0)
+            {
+                return (0, "鍥剧墖鍒犻櫎鎴愬姛");
+            }
+            else
+            {
+                return (1, "鍥剧墖鍒犻櫎澶辫触锛屾湭鎵惧埌瀵瑰簲鐨勬楠岄」鐩�");
+            }
+        }
+        catch (Exception ex)
+        {
+            return (1, $"鍥剧墖鍒犻櫎澶辫触锛歿ex.Message}");
+        }
+    }
+
     
 }
\ No newline at end of file
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
diff --git a/StandardInterface/MESApplication/Controllers/QC/SJController.cs b/StandardInterface/MESApplication/Controllers/QC/SJController.cs
index 83e6a80..7591679 100644
--- a/StandardInterface/MESApplication/Controllers/QC/SJController.cs
+++ b/StandardInterface/MESApplication/Controllers/QC/SJController.cs
@@ -498,4 +498,123 @@
             });
         }
     }
+
+    /// <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 SJService();
+            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
+        {
+            if (data["id"] == null)
+            {
+                return new ResponseResult
+                {
+                    status = 1,
+                    message = "妫�楠岄」鐩甀D涓嶈兘涓虹┖",
+                    data = null
+                };
+            }
+
+            var id = Convert.ToDecimal(data["id"].ToString());
+
+            // 璋冪敤鏈嶅姟鏂规硶鍒犻櫎鍥剧墖
+            var service = new SJService();
+            var (status, message) = service.DeleteImageFromPicture(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
diff --git a/StandardInterface/MESApplication/Controllers/QC/XJController.cs b/StandardInterface/MESApplication/Controllers/QC/XJController.cs
index 2dccb34..18c4299 100644
--- a/StandardInterface/MESApplication/Controllers/QC/XJController.cs
+++ b/StandardInterface/MESApplication/Controllers/QC/XJController.cs
@@ -748,5 +748,124 @@
         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 XJService();
+            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 XJService();
+            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
diff --git a/StandardInterface/MESApplication/appsettings.json b/StandardInterface/MESApplication/appsettings.json
index 28cfc2a..59a3601 100644
--- a/StandardInterface/MESApplication/appsettings.json
+++ b/StandardInterface/MESApplication/appsettings.json
@@ -10,6 +10,6 @@
   "AppSettings": {
     "TestErpUrl": "http://192.168.11.120:8098/WebService1.asmx/mesToErpinfo",
     "ProductionErpUrl": "http://192.168.11.120:8098/WebService1.asmx/mesToErpinfoFormal",
-    "DataBaseConn": "Data Source = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.22)(PORT = 1521))(CONNECT_DATA = (SERVICE_NAME = ORCL))); Persist Security Info=True;User ID = hm_prd; Password=hmprd"
+    "DataBaseConn": "Data Source = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.22)(PORT = 1521))(CONNECT_DATA = (SERVICE_NAME = ORCL))); Persist Security Info=True;User ID = test_dev; Password=hmprd"
   }
 }

--
Gitblit v1.9.3