From bf780b6c83012b5beb3d7515b8fb61753c5fb736 Mon Sep 17 00:00:00 2001 From: sjz <1240968267@qq.com> Date: 星期四, 26 六月 2025 08:48:37 +0800 Subject: [PATCH] 采购承诺交期改string类型 --- MESApplication/Controllers/QcIssueResult/QcIssueResultController.cs | 35 ++++++++++++++++++++++++++++++++--- 1 files changed, 32 insertions(+), 3 deletions(-) diff --git a/MESApplication/Controllers/QcIssueResult/QcIssueResultController.cs b/MESApplication/Controllers/QcIssueResult/QcIssueResultController.cs index 5e0024f..53c0dd1 100644 --- a/MESApplication/Controllers/QcIssueResult/QcIssueResultController.cs +++ b/MESApplication/Controllers/QcIssueResult/QcIssueResultController.cs @@ -2,6 +2,7 @@ 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 +11,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; @@ -33,14 +38,17 @@ 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(); @@ -58,6 +66,27 @@ } } + // 鏂板瑙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