1
This commit is contained in:
@@ -88,6 +88,7 @@
|
|||||||
"X-KDApi-AppSec": "df3e8fd75c794f11af72faa6f6df0d48",
|
"X-KDApi-AppSec": "df3e8fd75c794f11af72faa6f6df0d48",
|
||||||
"X-KDApi-LCID": "2052",
|
"X-KDApi-LCID": "2052",
|
||||||
"X-KDApi-ServerUrl": "http://192.168.0.233/k3cloud/",
|
"X-KDApi-ServerUrl": "http://192.168.0.233/k3cloud/",
|
||||||
|
"PRD_PickMtrl_Port": 1500,
|
||||||
"CustomRequestRemoteSql": "",
|
"CustomRequestRemoteSql": "",
|
||||||
"VoucherGroup": "记",
|
"VoucherGroup": "记",
|
||||||
"MesSchema": "TEST",
|
"MesSchema": "TEST",
|
||||||
|
|||||||
@@ -14,13 +14,13 @@ namespace RB_MES_API.Context
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static class LocalStaticRequest
|
public static class LocalStaticRequest
|
||||||
{
|
{
|
||||||
public static K3CloudApi cloudApi { get; set; }=new K3CloudApi();
|
public static K3CloudApi cloudApi { get; set; } = new K3CloudApi();
|
||||||
public static bool Islogin { get; set; } = false;
|
public static bool Islogin { get; set; } = false;
|
||||||
public static string LoginMsg { get; set; }=string.Empty;
|
public static string LoginMsg { get; set; } = string.Empty;
|
||||||
public static bool NeedRefresh { get; set; } = true;
|
public static bool NeedRefresh { get; set; } = true;
|
||||||
public static List<int> HashCode { get; set; }= new List<int>();
|
public static List<int> HashCode { get; set; } = new List<int>();
|
||||||
public static List<SystemProfile> sysprofile = new List<SystemProfile>();
|
public static List<SystemProfile> sysprofile = new List<SystemProfile>();
|
||||||
public static string GetSystemProfile(int categoryid,string key)
|
public static string GetSystemProfile(int categoryid, string key)
|
||||||
{
|
{
|
||||||
if (sysprofile.Any(s => s.FCategoryID == categoryid && s.FKey == key))
|
if (sysprofile.Any(s => s.FCategoryID == categoryid && s.FKey == key))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Kingdee.CDP.WebApi.SDK;
|
using Kingdee.CDP.WebApi.SDK;
|
||||||
|
using Kingdee.CDP.WebApi.SDK.DataEntity;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.Data.SqlClient;
|
using Microsoft.Data.SqlClient;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
@@ -1060,7 +1061,20 @@ namespace RB_MES_API.Controllers
|
|||||||
Stopwatch stopwatch = new Stopwatch();
|
Stopwatch stopwatch = new Stopwatch();
|
||||||
// 开始计时
|
// 开始计时
|
||||||
stopwatch.Start();
|
stopwatch.Start();
|
||||||
string result = LocalStaticRequest.cloudApi.BatchSave(formid, jsonstr);
|
|
||||||
|
string result = "";
|
||||||
|
|
||||||
|
string setPort = ApiSettingsHelper.GetConfig($"{formid}_Port");
|
||||||
|
if (!setPort.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
string serverUrl = ApiSettingsHelper.GetConfig("X-KDApi-ServerUrl");
|
||||||
|
serverUrl = ReplaceOrAddPortAdvanced(serverUrl, setPort);
|
||||||
|
result = new K3CloudApi(serverUrl).BatchSave(formid, jsonstr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = LocalStaticRequest.cloudApi.BatchSave(formid, jsonstr);
|
||||||
|
}
|
||||||
// 停止计时
|
// 停止计时
|
||||||
stopwatch.Stop();
|
stopwatch.Stop();
|
||||||
// 获取执行时间
|
// 获取执行时间
|
||||||
@@ -1092,6 +1106,34 @@ namespace RB_MES_API.Controllers
|
|||||||
}
|
}
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 替换或添加URL中的端口号(支持指定协议)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="input"></param>
|
||||||
|
/// <param name="newPort"></param>
|
||||||
|
/// <param name="protocol"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static string ReplaceOrAddPortAdvanced(string input, string newPort, string protocol = "http")
|
||||||
|
{
|
||||||
|
// 构建协议特定的模式
|
||||||
|
string protocolPattern = string.IsNullOrEmpty(protocol) ? @"(https?|ftp)://" : $"{protocol}://";
|
||||||
|
|
||||||
|
// 匹配已有端口号
|
||||||
|
string patternWithPort = $@"({protocolPattern}[^/]+?):\d+";
|
||||||
|
// 匹配没有端口号
|
||||||
|
string patternWithoutPort = $@"({protocolPattern}[^/:/]+)(?=/|$)";
|
||||||
|
|
||||||
|
// 先尝试替换已有端口号
|
||||||
|
string result = Regex.Replace(input, patternWithPort, $"$1:{newPort}");
|
||||||
|
|
||||||
|
// 如果没有端口号被替换,尝试添加端口号
|
||||||
|
if (result == input)
|
||||||
|
result = Regex.Replace(input, patternWithoutPort, $"$1:{newPort}");
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 批量提交已保存的单据
|
/// 批量提交已保存的单据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user