From cbc94f6d0153e28989f6b83b7a7cc783159b4703 Mon Sep 17 00:00:00 2001
From: zyf <1071160500@qq.com>
Date: 星期一, 25 八月 2025 13:58:33 +0800
Subject: [PATCH] 销售订单号、入库检接口优化
---
MESApplication/Controllers/QcIssueResult/QcIssueResultController.cs | 37 +++++++++++++++++++++++++++++++++----
1 files changed, 33 insertions(+), 4 deletions(-)
diff --git a/MESApplication/Controllers/QcIssueResult/QcIssueResultController.cs b/MESApplication/Controllers/QcIssueResult/QcIssueResultController.cs
index 24cb605..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,11 +11,15 @@
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;
[ApiController]
-[Route("api/QcIssueResult")]
+[Route("api/[controller]")]
public class QcIssueResultController : ControllerBase
{
private readonly MessageCenterManager _manager = new();
@@ -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