From 4c2d9a4dbef1e5dae234b78ec980e521bf89fb0d Mon Sep 17 00:00:00 2001
From: zyf <1071160500@qq.com>
Date: 星期六, 08 十一月 2025 19:24:58 +0800
Subject: [PATCH] Merge branch 'master' of http://43.142.96.171:8080/r/~sjz/YC

---
 MESApplication/Controllers/QcIssueResult/QcIssueResultController.cs |   64 +++++++++++++++++++++++++++++--
 1 files changed, 59 insertions(+), 5 deletions(-)

diff --git a/MESApplication/Controllers/QcIssueResult/QcIssueResultController.cs b/MESApplication/Controllers/QcIssueResult/QcIssueResultController.cs
index 5e0024f..2895da9 100644
--- a/MESApplication/Controllers/QcIssueResult/QcIssueResultController.cs
+++ b/MESApplication/Controllers/QcIssueResult/QcIssueResultController.cs
@@ -1,7 +1,9 @@
-锘縰sing MES.Service.Dto.webApi;
+锘縰sing AngleSharp.Dom;
+using MES.Service.Dto.webApi;
 using MES.Service.Dto.webApi.QcIssueResult;
 using MES.Service.Modes;
 using MES.Service.Modes.QcIssueResult;
+using MES.Service.Modes.SentLaboratory;
 using MES.Service.service;
 using MES.Service.service.QcIssueResult;
 using MES.Service.util;
@@ -10,6 +12,10 @@
 using Newtonsoft.Json.Linq;
 using System.Diagnostics;
 using System.Dynamic;
+using System.Net;
+using System.Text;
+using System.Text.Json.Nodes;
+using System.Web;
 
 namespace MESApplication.Controllers.QcIssueResult;
 
@@ -30,17 +36,28 @@
     [HttpPost("GetProcessNo")]
     public IActionResult StartDingtalkProcess([FromBody] GetQcIssueResultDetail getQcIssueResultDetail)
     {
-   
+
+        var entity = new MessageCenter();
+        entity.TableName = TableName;
+        entity.Url = URL + "Save";
+        entity.Method = METHOD;
+        entity.Data = JsonConvert.SerializeObject(getQcIssueResultDetail);
+        entity.Status = 1;
+        entity.CreateBy = "PL017";
+
         try
         {
+            // 鏂板URL瑙g爜澶勭悊閫昏緫
+            DecodeUrlEncodedProperties(getQcIssueResultDetail);
 
             // 璋冪敤 QcIssueResultManager 涓殑 GetProcessNo 鏂规硶鏉ュ惎鍔ㄩ拤閽夊伐浣滄祦瀹炰緥
             string result = m.GetProcessNo(getQcIssueResultDetail);
 
-            string jsonPart = result.Substring(result.IndexOf("{"));
-            Debug.WriteLine(jsonPart);
-            JObject jsonObject = JObject.Parse(jsonPart);
+            string getLaboratoryDetailsJson = JsonConvert.SerializeObject(getQcIssueResultDetail, Formatting.Indented);
+            Debug.WriteLine("getQcIssueResultDetail: " + getLaboratoryDetailsJson);
 
+            string jsonPart = result.Substring(result.IndexOf("{"));
+            JObject jsonObject = JObject.Parse(jsonPart);
             // 鎻愬彇instanceId鐨勫��
             string instanceId = jsonObject["InstanceId"].ToString();
 
@@ -49,15 +66,52 @@
             var save = m.SaveProcessNo(getQcIssueResultDetail.ReleaseNo, instanceId);
             resultInfos.tbBillList = save;
 
+            if (save) entity.Result = 1;
+            entity.DealWith = 1;
+
+            _manager.save(entity);
+
             return Ok(result);
         }
         catch (Exception ex)
         {
             // 鎹曡幏寮傚父骞惰繑鍥為敊璇俊鎭�
+
+            entity.Result = 0;
+
+            entity.DealWith = 0;
+
+            entity.ResultData = ex.Message;
+
+            _manager.save(entity);
+
+            //return ResponseResult.ResponseError(ex);
+
             return StatusCode(500, $"鍚姩閽夐拤宸ヤ綔娴佸疄渚嬪け璐�: {ex.Message}");
         }
     }
 
+    // 鏂板瑙g爜鏂规硶
+    private void DecodeUrlEncodedProperties(object obj)
+    {
+        if (obj == null) return;
+
+        var properties = obj.GetType().GetProperties();
+        foreach (var prop in properties)
+        {
+            // 鍙鐞嗗瓧绗︿覆绫诲瀷鐨勫睘鎬�
+            if (prop.PropertyType == typeof(string) && prop.CanWrite)
+            {
+                var value = prop.GetValue(obj) as string;
+                if (!string.IsNullOrEmpty(value))
+                {
+                    // 浣跨敤UTF8缂栫爜杩涜瑙g爜
+                    var decodedValue = HttpUtility.UrlDecode(value, Encoding.UTF8);
+                    prop.SetValue(obj, decodedValue);
+                }
+            }
+        }
+    }
 
     [HttpPost("Save")]
     public ResponseResult Save(ErpQcIssueResult erpQcIssueResult)

--
Gitblit v1.9.3