添加项目文件。
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace UFIDA.U8.Framework.Api.ControlObject.Models
|
||||
{
|
||||
public class BaseResult<T>
|
||||
{
|
||||
public bool bSuccess { get; set; }
|
||||
public string message { get; set; }
|
||||
public T result { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace UFIDA.U8.Framework.Api.ControlObject.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// U8登录参数
|
||||
/// </summary>
|
||||
public class LoginParamter
|
||||
{
|
||||
/// <summary>
|
||||
/// 登录子系统ID,具体可以查看系统启用
|
||||
/// </summary>
|
||||
public string pSubId { get; set; } = "AS";
|
||||
|
||||
/// <summary>
|
||||
/// 账套ID,一般为数据源@账套号
|
||||
/// </summary>
|
||||
public string pAccId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 年份,一般在账套的有效会计区间内的年份都可以
|
||||
/// </summary>
|
||||
public string pYearId { get; set; } = $"{DateTime.Today.Year}";
|
||||
|
||||
/// <summary>
|
||||
/// 用户名
|
||||
/// </summary>
|
||||
public string pUserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 密码
|
||||
/// </summary>
|
||||
public string pPassword { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// 登录日期,影响各接口制单的默认日期
|
||||
/// </summary>
|
||||
public string pDate { get; set; } = $"{DateTime.Today:yyyy-MM-dd}";
|
||||
|
||||
/// <summary>
|
||||
/// 应用服务器地址
|
||||
/// </summary>
|
||||
public string cSrv { get; set; } = "127.0.0.1";
|
||||
|
||||
/// <summary>
|
||||
/// 序列号,一般不填
|
||||
/// </summary>
|
||||
public string cSerial { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// 账套信息标识
|
||||
/// </summary>
|
||||
public string cToken { get; set; } = "";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// 有关程序集的一般信息由以下
|
||||
// 控制。更改这些特性值可修改
|
||||
// 与程序集关联的信息。
|
||||
[assembly: AssemblyTitle("UFIDA.U8.Framework.Api.ControlObject")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("UFIDA.U8.Framework.Api.ControlObject")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2024")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: log4net.Config.XmlConfigurator(ConfigFile = "log4net.config", ConfigFileExtension = "config", Watch = true)]
|
||||
|
||||
// 将 ComVisible 设置为 false 会使此程序集中的类型
|
||||
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
|
||||
//请将此类型的 ComVisible 特性设置为 true。
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
|
||||
[assembly: Guid("22c84be9-1613-4e32-9e98-237e96fd3540")]
|
||||
|
||||
// 程序集的版本信息由下列四个值组成:
|
||||
//
|
||||
// 主版本
|
||||
// 次版本
|
||||
// 生成号
|
||||
// 修订号
|
||||
//
|
||||
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
|
||||
//通过使用 "*",如下所示:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@@ -0,0 +1,157 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ADODB;
|
||||
using UFIDA.U8.Framework.Api.ControlObject.Models;
|
||||
using UFSoft.U8.Framework.ContextSrv;
|
||||
using UFSoft.U8.Framework.Login.UI;
|
||||
using UFSoft.U8.Framework.LoginContext;
|
||||
using NetLogin = UFSoft.U8.Framework.Login.UI.clsLogin;
|
||||
using VBLogin = U8Login.clsLogin;
|
||||
|
||||
namespace UFIDA.U8.Framework.Api.ControlObject.U8M
|
||||
{
|
||||
public class BaseLogin
|
||||
{
|
||||
private NetLogin _netLogin { get; set; }
|
||||
private VBLogin _vbLogin { get; set; }
|
||||
|
||||
private ProductContext _productContext { get; set; }
|
||||
|
||||
public Connection Connection { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 初始化生产制造上下文
|
||||
/// </summary>
|
||||
/// <param name="paramter">登录参数</param>
|
||||
/// <exception cref="ArgumentNullException"></exception>
|
||||
/// <exception cref="Exception"></exception>
|
||||
public void Init(LoginParamter paramter)
|
||||
{
|
||||
|
||||
//if (!string.IsNullOrWhiteSpace(ThreadContext.ServerToken))
|
||||
//{
|
||||
// ThreadContext.ServerToken = null;
|
||||
//}
|
||||
|
||||
//if (!string.IsNullOrWhiteSpace(ThreadContext.U8LoginInfo!=null))
|
||||
//{
|
||||
// ThreadContext.U8LoginInfo = null;
|
||||
//}
|
||||
|
||||
|
||||
if (paramter == null) throw new ArgumentNullException(nameof(paramter));
|
||||
|
||||
_vbLogin = new VBLogin();
|
||||
|
||||
_netLogin = new NetLogin();
|
||||
|
||||
_vbLogin.ClearError();
|
||||
|
||||
if (!_vbLogin.Login(paramter.pSubId, paramter.pAccId, paramter.pYearId, paramter.pUserId, paramter.pPassword, paramter.pDate, paramter.cSrv, paramter.cSerial) && string.IsNullOrWhiteSpace(_vbLogin.userToken))
|
||||
{
|
||||
//_vbLogin.ShutDown();
|
||||
throw new Exception(_vbLogin.ShareString);
|
||||
}
|
||||
Trace.WriteLine($"U8版本:{_vbLogin.GetVersionInfo()}");
|
||||
Trace.WriteLine($"1--登录令牌:{_netLogin.userToken}");
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(Cryptography.m_userToken))
|
||||
{
|
||||
Cryptography.m_userToken = "";
|
||||
}
|
||||
|
||||
if (_netLogin.login(paramter.pSubId, paramter.pUserId, paramter.pPassword, paramter.cSrv, paramter.pDate, paramter.pAccId, paramter.cSerial))
|
||||
{
|
||||
_productContext = _netLogin.SubLogin("AS");
|
||||
|
||||
if (_productContext == null)
|
||||
throw new Exception($"1--初始化U8登录上下文失败------{_netLogin.ErrDescript}");
|
||||
|
||||
Trace.WriteLine($"2--登录令牌:{_netLogin.userToken}");
|
||||
//Trace.WriteLine($"2--上下文令牌:{_productContext.calledContext.token}");
|
||||
|
||||
|
||||
_vbLogin.ClearError();
|
||||
_vbLogin.ConstructLogin(_netLogin.userToken);
|
||||
var taskId = DateTime.Now.Ticks.ToString();
|
||||
_vbLogin.set_TaskId(taskId);
|
||||
|
||||
|
||||
Trace.WriteLine($"3--登录令牌:{_vbLogin.userToken}");
|
||||
|
||||
|
||||
|
||||
//Trace.WriteLine($"4--正在创建应用池:{_netLogin.userToken}");
|
||||
|
||||
//var info = U8LoginInfo.CreateInstance(_netLogin.userToken);
|
||||
|
||||
//U8LoginInfoPool.Add(_netLogin.userToken, info);
|
||||
|
||||
//Trace.WriteLine($"4--创建应用池:{info.U8LoginToken}");
|
||||
|
||||
//Trace.WriteLine($"4--正在设置线程登录信息:{_netLogin.userToken}");
|
||||
//ThreadContext.SetLoginInfo(_netLogin.userToken);
|
||||
//Trace.WriteLine($"4--设置线程登录信息:{_netLogin.userToken}");
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
//if (_vbLogin ==null)
|
||||
//{
|
||||
// _vbLogin = new VBLogin();
|
||||
|
||||
// _vbLogin.ClearError();
|
||||
|
||||
// if (!_vbLogin.Login(paramter.pSubId, paramter.pAccId, paramter.pYearId, paramter.pUserId, paramter.pPassword, paramter.pDate, paramter.cSrv, paramter.cSerial) && string.IsNullOrWhiteSpace(_vbLogin.userToken))
|
||||
// {
|
||||
// //_vbLogin.ShutDown();
|
||||
// throw new Exception(_vbLogin.ShareString);
|
||||
// }
|
||||
// Trace.WriteLine($"U8版本:{_vbLogin.GetVersionInfo()}");
|
||||
// Trace.WriteLine($"1--登录令牌:{_netLogin.userToken}");
|
||||
|
||||
// if (!string.IsNullOrWhiteSpace(Cryptography.m_userToken))
|
||||
// {
|
||||
// Cryptography.m_userToken = "";
|
||||
// }
|
||||
//}
|
||||
|
||||
//if (!string.IsNullOrWhiteSpace(Cryptography.m_userToken))
|
||||
//{
|
||||
// Cryptography.m_userToken = "";
|
||||
//}
|
||||
|
||||
_productContext = _netLogin.Login("AS", _vbLogin.userToken);
|
||||
|
||||
Trace.WriteLine($"3--上下文令牌:{_productContext.calledContext.token}");
|
||||
|
||||
if (_productContext == null)
|
||||
throw new Exception($"2--初始化U8登录上下文失败------{_netLogin.ErrDescript}");
|
||||
|
||||
Connection = new Connection();
|
||||
Connection.Open(_vbLogin.UfDbName);
|
||||
}
|
||||
|
||||
public void ShutDown()
|
||||
{
|
||||
|
||||
U8LoginInfoPool.Remove(_netLogin.userToken);
|
||||
|
||||
_vbLogin.ShutDown();
|
||||
|
||||
_netLogin.ShutDown();
|
||||
_netLogin.Dispose();
|
||||
_vbLogin = null;
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(Cryptography.m_userToken))
|
||||
{
|
||||
Cryptography.m_userToken = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{22C84BE9-1613-4E32-9E98-237E96FD3540}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>UFIDA.U8.Framework.Api.ControlObject</RootNamespace>
|
||||
<AssemblyName>UFIDA.U8.Framework.Api.ControlObject</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="ADODB, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
<HintPath>D:\U8SOFT\Interop\ADODB.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Interop.GetComObj">
|
||||
<HintPath>D:\U8SOFT\Interop\Interop.GetComObj.dll</HintPath>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</Reference>
|
||||
<Reference Include="Interop.MSXML2">
|
||||
<HintPath>D:\U8SOFT\Interop\Interop.MSXML2.dll</HintPath>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</Reference>
|
||||
<Reference Include="Interop.U8Login, Version=1.14.0.0, Culture=neutral, PublicKeyToken=79a4e7ad54eeabca, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
<HintPath>D:\U8SOFT\Interop\Interop.U8Login.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Interop.UFBillComponent">
|
||||
<HintPath>D:\U8SOFT\Interop\Interop.UFBillComponent.dll</HintPath>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</Reference>
|
||||
<Reference Include="log4net, Version=2.0.17.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\log4net.2.0.17\lib\net45\log4net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="UFSoft.U8.Framework.BF.Dispatcher">
|
||||
<HintPath>D:\U8SOFT\U8M\UFSoft.U8.Framework.BF.Dispatcher.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="UFSoft.U8.Framework.Common">
|
||||
<HintPath>D:\U8SOFT\U8M\UFSoft.U8.Framework.Common.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="UFSoft.U8.Framework.ContextSrv">
|
||||
<HintPath>D:\U8SOFT\U8M\UFSoft.U8.Framework.ContextSrv.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="UFSoft.U8.Framework.Login.BO">
|
||||
<HintPath>D:\U8SOFT\Framework\UFSoft.U8.Framework.Login.BO.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="UFSoft.U8.Framework.Login.UI">
|
||||
<HintPath>D:\U8SOFT\Framework\UFSoft.U8.Framework.Login.UI.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="UFSoft.U8.Framework.LoginContext, Version=1.0.0.0, Culture=neutral, PublicKeyToken=90e57cffdf9d854d, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>D:\U8SOFT\Framework\UFSoft.U8.Framework.LoginContext.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Models\BaseResult.cs" />
|
||||
<Compile Include="Models\LoginParamter.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="U8M\BaseLogin.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="AA\" />
|
||||
<Folder Include="ST\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="log4net" version="2.0.17" targetFramework="net48" />
|
||||
</packages>
|
||||
Reference in New Issue
Block a user