diff --git a/Reportapi/Lib/Kingdee.CDP.WebApi.SDK.dll b/Reportapi/Lib/Kingdee.CDP.WebApi.SDK.dll new file mode 100644 index 0000000..3e2915f Binary files /dev/null and b/Reportapi/Lib/Kingdee.CDP.WebApi.SDK.dll differ diff --git a/Reportapi/MyCode.Project.Domain/Config/K3CloudConfig.cs b/Reportapi/MyCode.Project.Domain/Config/K3CloudConfig.cs new file mode 100644 index 0000000..cb58546 --- /dev/null +++ b/Reportapi/MyCode.Project.Domain/Config/K3CloudConfig.cs @@ -0,0 +1,23 @@ +using MyCode.Project.Infrastructure.Common; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MyCode.Project.Domain.Config +{ + /// + /// 金蝶云星空配置类 + /// + public static class K3CloudConfig + { + public static string AcctID = WebConfigUtils.GetConnectionStringsInfo("AcctID"); + public static string AppID = WebConfigUtils.GetConnectionStringsInfo("AppID"); + public static string AppSec = WebConfigUtils.GetConnectionStringsInfo("AppSec"); + public static string UserName = WebConfigUtils.GetConnectionStringsInfo("UserName"); + public static string LCID = WebConfigUtils.GetConnectionStringsInfo("LCID"); + public static string ServerUrl = WebConfigUtils.GetConnectionStringsInfo("ServerUrl"); + public static string OrgNumber = WebConfigUtils.GetConnectionStringsInfo("OrgNumber"); + } +} diff --git a/Reportapi/MyCode.Project.Domain/MyCode.Project.Domain.csproj b/Reportapi/MyCode.Project.Domain/MyCode.Project.Domain.csproj index 69968f2..fdd8310 100644 --- a/Reportapi/MyCode.Project.Domain/MyCode.Project.Domain.csproj +++ b/Reportapi/MyCode.Project.Domain/MyCode.Project.Domain.csproj @@ -54,6 +54,7 @@ + diff --git a/Reportapi/MyCode.Project.Services/K3CloudHelp.cs b/Reportapi/MyCode.Project.Services/K3CloudHelp.cs new file mode 100644 index 0000000..aed9181 --- /dev/null +++ b/Reportapi/MyCode.Project.Services/K3CloudHelp.cs @@ -0,0 +1,83 @@ +using Kingdee.CDP.WebApi.SDK; +using MyCode.Project.Domain.Config; +using MyCode.Project.Domain.Message.Response.User; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MyCode.Project.Services +{ + public static class K3CloudHelp + { + private static K3CloudApi k3CloudApi; + + public static K3CloudApi GetK3CloudApiInstance() + { + K3CloudOption k3CloudOption = new K3CloudOption() + { + AcctID = K3CloudConfig.AcctID, + AppID = K3CloudConfig.AppID, + AppSec = K3CloudConfig.AppSec, + LCID = Convert.ToInt32(K3CloudConfig.LCID), + ServerUrl = K3CloudConfig.ServerUrl, + UserName = K3CloudConfig.UserName, + OrgNumber = K3CloudConfig.OrgNumber + }; + if (k3CloudApi == null) + { + k3CloudApi = new K3CloudApi(k3CloudOption.ServerUrl, 30); + } + k3CloudApi.InitClient( + k3CloudOption.AcctID, + k3CloudOption.AppID, + k3CloudOption.AppSec, + k3CloudOption.UserName, + k3CloudOption.LCID, + k3CloudOption.OrgNumber, + k3CloudOption.ServerUrl + ); + + return k3CloudApi; + } + + public static K3CloudApi CreateDefaultK3CloudApi() + { + + return k3CloudApi; + } + + private class K3CloudOption + { + /// + /// DBID + /// + public string AcctID { get; set; } + /// + /// 应用ID + /// + public string AppID { get; set; } + /// + /// 应用密钥 + /// + public string AppSec { get; set; } + /// + /// 服务器地址 + /// + public string ServerUrl { get; set; } + /// + /// 默认语言ID + /// + public int LCID { get; set; } + /// + /// 默认用户名称 + /// + public string UserName { get; set; } + /// + /// 默认组织ID + /// + public string OrgNumber { get; set; } + } + } +} diff --git a/Reportapi/MyCode.Project.Services/MyCode.Project.Services.csproj b/Reportapi/MyCode.Project.Services/MyCode.Project.Services.csproj index 8a0b90f..617740d 100644 --- a/Reportapi/MyCode.Project.Services/MyCode.Project.Services.csproj +++ b/Reportapi/MyCode.Project.Services/MyCode.Project.Services.csproj @@ -38,6 +38,9 @@ ..\packages\AutoMapper.6.1.1\lib\net45\AutoMapper.dll True + + ..\Lib\Kingdee.CDP.WebApi.SDK.dll + ..\packages\log4net.2.0.8\lib\net45-full\log4net.dll True @@ -115,28 +118,22 @@ - - - - - - - + diff --git a/Reportapi/MyCode.Project.WebApi/Web.config b/Reportapi/MyCode.Project.WebApi/Web.config index 8b44b6a..eff6a91 100644 --- a/Reportapi/MyCode.Project.WebApi/Web.config +++ b/Reportapi/MyCode.Project.WebApi/Web.config @@ -4,11 +4,11 @@ https://go.microsoft.com/fwlink/?LinkId=301879 --> - +
- + @@ -26,12 +26,12 @@ - - - - + + + + - + @@ -54,7 +54,7 @@ - + @@ -62,10 +62,19 @@ + - - - + + + + + + + + + + + - - + + @@ -203,7 +212,7 @@ - + @@ -212,7 +221,7 @@ - + @@ -229,7 +238,7 @@ - + diff --git a/Reportapi/MyCode.Project.sln b/Reportapi/MyCode.Project.sln index 384e3f3..0375e4c 100644 --- a/Reportapi/MyCode.Project.sln +++ b/Reportapi/MyCode.Project.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.33027.164 +# Visual Studio Version 17 +VisualStudioVersion = 17.14.36414.22 d17.14 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Designs", "Designs", "{7DA7AF38-10EF-4157-B270-511E3A58DF6E}" ProjectSection(SolutionItems) = preProject @@ -33,6 +33,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Lib", "Lib", "{EC2A682C-494 Lib\C5.dll = Lib\C5.dll Lib\Common.Logging.dll = Lib\Common.Logging.dll Lib\HtmlAgilityPack.dll = Lib\HtmlAgilityPack.dll + C:\Users\13243\Downloads\Compressed\SDK_.Net4_V9.2.0\.net4.0_sdk_v9.2.0\Kingdee.CDP.WebApi.SDK.Net4.0.V9.2.0\Kingdee.CDP.WebApi.SDK.dll = C:\Users\13243\Downloads\Compressed\SDK_.Net4_V9.2.0\.net4.0_sdk_v9.2.0\Kingdee.CDP.WebApi.SDK.Net4.0.V9.2.0\Kingdee.CDP.WebApi.SDK.dll Lib\log4net.dll = Lib\log4net.dll Lib\log4net.xml = Lib\log4net.xml MyCode.Project.WebApi\bin\Microsoft.Owin.dll = MyCode.Project.WebApi\bin\Microsoft.Owin.dll @@ -278,8 +279,8 @@ Global {B0B592F9-E0B5-41B7-8908-036021468D87} = {8D2B010E-7C91-4375-B93D-511ADE541A2B} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution - EnterpriseLibraryConfigurationToolBinariesPath = packages\Unity.2.1.505.0\lib\NET35;packages\Unity.Interception.2.1.505.0\lib\NET35;packages\EnterpriseLibrary.Common.5.0.505.0\lib\NET35;packages\EnterpriseLibrary.Caching.5.0.505.0\lib\NET35 - EnterpriseLibraryConfigurationToolBinariesPathV6 = packages\EnterpriseLibrary.Common.6.0.1304.0\lib\NET45 SolutionGuid = {22616349-AE54-419A-A4A5-7503567F2279} + EnterpriseLibraryConfigurationToolBinariesPathV6 = packages\EnterpriseLibrary.Common.6.0.1304.0\lib\NET45 + EnterpriseLibraryConfigurationToolBinariesPath = packages\Unity.2.1.505.0\lib\NET35;packages\Unity.Interception.2.1.505.0\lib\NET35;packages\EnterpriseLibrary.Common.5.0.505.0\lib\NET35;packages\EnterpriseLibrary.Caching.5.0.505.0\lib\NET35 EndGlobalSection EndGlobal