新增以U8登录人为基础的制单功能(ST)
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
|
||||
</startup>
|
||||
</configuration>
|
||||
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ServerUpdate.Entity
|
||||
{
|
||||
internal class AppFile
|
||||
{
|
||||
}
|
||||
}
|
||||
Generated
+40
@@ -0,0 +1,40 @@
|
||||
namespace ServerUpdate
|
||||
{
|
||||
partial class Form1
|
||||
{
|
||||
/// <summary>
|
||||
/// 必需的设计器变量。
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有正在使用的资源。
|
||||
/// </summary>
|
||||
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows 窗体设计器生成的代码
|
||||
|
||||
/// <summary>
|
||||
/// 设计器支持所需的方法 - 不要修改
|
||||
/// 使用代码编辑器修改此方法的内容。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Text = "Form1";
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace ServerUpdate
|
||||
{
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace ServerUpdate
|
||||
{
|
||||
internal static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// 应用程序的主入口点。
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new Form1());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// 有关程序集的一般信息由以下
|
||||
// 控制。更改这些特性值可修改
|
||||
// 与程序集关联的信息。
|
||||
[assembly: AssemblyTitle("ServerUpdate")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("ServerUpdate")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2025")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// 将 ComVisible 设置为 false 会使此程序集中的类型
|
||||
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
|
||||
//请将此类型的 ComVisible 特性设置为 true。
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
|
||||
[assembly: Guid("d78f0d4e-86ae-4fe8-a212-e7b6ef75c514")]
|
||||
|
||||
// 程序集的版本信息由下列四个值组成:
|
||||
//
|
||||
// 主版本
|
||||
// 次版本
|
||||
// 生成号
|
||||
// 修订号
|
||||
//
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 此代码由工具生成。
|
||||
// 运行时版本: 4.0.30319.42000
|
||||
//
|
||||
// 对此文件的更改可能导致不正确的行为,如果
|
||||
// 重新生成代码,则所做更改将丢失。
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace ServerUpdate.Properties
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 强类型资源类,用于查找本地化字符串等。
|
||||
/// </summary>
|
||||
// 此类是由 StronglyTypedResourceBuilder
|
||||
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
|
||||
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
|
||||
// (以 /str 作为命令选项),或重新生成 VS 项目。
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources
|
||||
{
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 返回此类使用的缓存 ResourceManager 实例。
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((resourceMan == null))
|
||||
{
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ServerUpdate.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写当前线程的 CurrentUICulture 属性,对
|
||||
/// 使用此强类型资源类的所有资源查找执行重写。
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture
|
||||
{
|
||||
get
|
||||
{
|
||||
return resourceCulture;
|
||||
}
|
||||
set
|
||||
{
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace ServerUpdate.Properties
|
||||
{
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
|
||||
{
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default
|
||||
{
|
||||
get
|
||||
{
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
||||
@@ -0,0 +1,82 @@
|
||||
<?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>{D78F0D4E-86AE-4FE8-A212-E7B6EF75C514}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<RootNamespace>ServerUpdate</RootNamespace>
|
||||
<AssemblyName>ServerUpdate</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Entity\AppFile.cs" />
|
||||
<Compile Include="Form1.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Form1.Designer.cs">
|
||||
<DependentUpon>Form1.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Web.UI.WebControls;
|
||||
using ADODB;
|
||||
using log4net;
|
||||
using UFIDA.U8.Framework.Api.ControlObject.Entity;
|
||||
@@ -266,23 +267,128 @@ namespace UFIDA.U8.Framework.Api.ControlObject.U8M
|
||||
}
|
||||
}
|
||||
|
||||
public void Init(string userToken, bool bMon = true, int traceTimes = 0)
|
||||
{
|
||||
if (traceTimes > 5)
|
||||
throw new Exception("U8登录异常");
|
||||
|
||||
try
|
||||
{
|
||||
//if (!string.IsNullOrWhiteSpace(ThreadContext.ServerToken))
|
||||
//{
|
||||
// ThreadContext.ServerToken = null;
|
||||
//}
|
||||
|
||||
//if (!string.IsNullOrWhiteSpace(ThreadContext.U8LoginInfo!=null))
|
||||
//{
|
||||
// ThreadContext.U8LoginInfo = null;
|
||||
//}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(userToken)) throw new ArgumentNullException(nameof(userToken));
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(Cryptography.m_userToken))
|
||||
{
|
||||
Cryptography.m_userToken = "";
|
||||
}
|
||||
|
||||
if (bMon)
|
||||
{
|
||||
|
||||
#if DEBUG
|
||||
_vbLogin = new VBLogin();
|
||||
_vbLogin.ClearError();
|
||||
logInfo.Debug($"VB--开始进行U8登录:{userToken}");
|
||||
if (!_vbLogin.ConstructLogin(userToken))
|
||||
{
|
||||
throw new Exception($"VB--U8登录失败---{_vbLogin.ShareString}");
|
||||
}
|
||||
_netLogin = new NetLogin();
|
||||
_productContext = _netLogin.Login("DP", _vbLogin.userToken);
|
||||
if (_productContext == null)
|
||||
{
|
||||
logInfo.Debug($"Net--U8上下文构建失败---{_netLogin.ErrDescript}");
|
||||
|
||||
logInfo.Debug($"Net--开始进行上下文构建:{userToken}");
|
||||
_productContext = _netLogin.Login("DP", _vbLogin.userToken);
|
||||
//throw new Exception($"Net--U8上下文构建失败---{_netLogin.ErrDescript}");
|
||||
}
|
||||
logInfo.Debug($"Net--开始进行上下文刷新:{_productContext.calledContext.token}");
|
||||
ClientUserContext.Instance.RefreshContext();
|
||||
|
||||
logInfo.Debug("Net--完成生产制造登录进程");
|
||||
|
||||
#else
|
||||
_netLogin = new NetLogin();
|
||||
|
||||
logInfo.Debug($"Net--开始进行U8登录:{paramter.cSrv}--{paramter.pUserId}--{paramter.pAccId}");
|
||||
|
||||
if (!_netLogin.login(paramter.pSubId, paramter.pUserId, paramter.pPassword, paramter.cSrv, paramter.pDate, paramter.pAccId, paramter.cSerial) && string.IsNullOrWhiteSpace(_netLogin.userToken))
|
||||
{
|
||||
throw new Exception($"Net--U8登录失败---{_netLogin.ErrDescript}");
|
||||
}
|
||||
|
||||
logInfo.Debug($"Net--开始进行上下文构建:{_netLogin.userToken}");
|
||||
|
||||
_productContext = _netLogin.SubLogin("DP");
|
||||
|
||||
if (_productContext == null)
|
||||
{
|
||||
throw new Exception($"Net--U8上下文构建失败---{_netLogin.ErrDescript}");
|
||||
}
|
||||
|
||||
|
||||
logInfo.Debug($"Net--开始进行上下文刷新:{_productContext.calledContext.token}");
|
||||
|
||||
ClientUserContext.Instance.RefreshContext();
|
||||
|
||||
logInfo.Debug("Net--完成生产制造登录进程");
|
||||
|
||||
return;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
_vbLogin = new VBLogin();
|
||||
|
||||
_vbLogin.ClearError();
|
||||
logInfo.Debug($"VB--开始进行U8登录:{userToken}");
|
||||
if (!_vbLogin.ConstructLogin(userToken))
|
||||
{
|
||||
throw new Exception($"VB--U8登录失败---{_vbLogin.ShareString}");
|
||||
}
|
||||
logInfo.Debug($"VB--开始创建连接对象:{_vbLogin.userToken}");
|
||||
Connection = new Connection();
|
||||
Connection.Open(_vbLogin.UfDbName);
|
||||
logInfo.Debug("VB--完成登录进程");
|
||||
return;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logInfo.Error($"重试次数:{traceTimes},错误信息:{ex.Message}", ex);
|
||||
|
||||
if (ex.Message == "VB--U8登录失败---登录使用时间超过系统预置时间,请重新登录!")
|
||||
{
|
||||
throw new Exception("登录使用时间超过系统预置时间,请重新登录!");
|
||||
}
|
||||
|
||||
Init(userToken, bMon, traceTimes + 1);
|
||||
}
|
||||
}
|
||||
|
||||
public void ShutDown()
|
||||
{
|
||||
U8LoginInfoPool.Clear();
|
||||
|
||||
ThreadContext.ServerToken = null;
|
||||
|
||||
_vbLogin?.ShutDown();
|
||||
_productContext=null;
|
||||
_netLogin?.SubLogout("DP");
|
||||
_netLogin?.ShutDown();
|
||||
_vbLogin = null;
|
||||
_netLogin = null;
|
||||
{
|
||||
U8LoginInfoPool.Clear();
|
||||
ThreadContext.ServerToken = null;
|
||||
_vbLogin?.ShutDown();
|
||||
_productContext=null;
|
||||
_netLogin?.SubLogout("DP");
|
||||
_netLogin?.ShutDown();
|
||||
_vbLogin = null;
|
||||
_netLogin = null;
|
||||
}
|
||||
public bool CheckAccId(string cAccId)
|
||||
{
|
||||
return _vbLogin.get_cAcc_Id() == cAccId;
|
||||
}
|
||||
}
|
||||
|
||||
public bool CheckAccId(string cAccId)
|
||||
{
|
||||
return _vbLogin.get_cAcc_Id() == cAccId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DocumentationFile>bin\Debug\UFIDA.U8.Framework.Api.ControlObject.xml</DocumentationFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
|
||||
@@ -15,6 +15,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VoucherPlugTest", "VoucherP
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebUpdate", "WebUpdate\WebUpdate.csproj", "{7861F8D1-F5A9-4AE5-9E60-1772D2B4A074}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServerUpdate", "ServerUpdate\ServerUpdate.csproj", "{D78F0D4E-86AE-4FE8-A212-E7B6EF75C514}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -45,6 +47,10 @@ Global
|
||||
{7861F8D1-F5A9-4AE5-9E60-1772D2B4A074}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{7861F8D1-F5A9-4AE5-9E60-1772D2B4A074}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{7861F8D1-F5A9-4AE5-9E60-1772D2B4A074}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{D78F0D4E-86AE-4FE8-A212-E7B6EF75C514}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D78F0D4E-86AE-4FE8-A212-E7B6EF75C514}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D78F0D4E-86AE-4FE8-A212-E7B6EF75C514}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D78F0D4E-86AE-4FE8-A212-E7B6EF75C514}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
Binary file not shown.
@@ -636,11 +636,19 @@
|
||||
日志组件
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:UFIDA.U8.Framework.Api.Controllers.U8.DPController.Login(UFIDA.U8.Framework.Api.ControlObject.Entity.LoginParamter)">
|
||||
<member name="M:UFIDA.U8.Framework.Api.Controllers.U8.DPController.Login(System.String,UFIDA.U8.Framework.Api.Entity.LoginInput)">
|
||||
<summary>
|
||||
U8登录接口
|
||||
</summary>
|
||||
<param name="input"></param>
|
||||
<param name="cAccId">系统号</param>
|
||||
<param name="input">登录参数</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:UFIDA.U8.Framework.Api.Controllers.U8.DPController.Login(UFIDA.U8.Framework.Api.Entity.UserTokenInput)">
|
||||
<summary>
|
||||
U8登录接口
|
||||
</summary>
|
||||
<param name="input">用户令牌</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:UFIDA.U8.Framework.Api.Controllers.U8.DPController.GetPassword(System.String)">
|
||||
@@ -673,21 +681,21 @@
|
||||
</member>
|
||||
<member name="M:UFIDA.U8.Framework.Api.Controllers.U8.DPController.AddAccountConfig(UFIDA.U8.Framework.Api.Models.AddU8AccountConfigInput)">
|
||||
<summary>
|
||||
新增对接账套设置
|
||||
注册对接系统
|
||||
</summary>
|
||||
<param name="input"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:UFIDA.U8.Framework.Api.Controllers.U8.DPController.UpdateAccountConfig(UFIDA.U8.Framework.Api.Models.AddU8AccountConfigInput)">
|
||||
<summary>
|
||||
更新对接账套设置
|
||||
更新对接系统
|
||||
</summary>
|
||||
<param name="input"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:UFIDA.U8.Framework.Api.Controllers.U8.DPController.ListAccountConfig(UFIDA.U8.Framework.Api.Models.ListU8AccountConfigInput)">
|
||||
<summary>
|
||||
获取对接账套设置列表
|
||||
获取对接系统列表
|
||||
</summary>
|
||||
<param name="input"></param>
|
||||
<returns></returns>
|
||||
@@ -1015,6 +1023,19 @@
|
||||
<param name="bReMote">是否远程</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:UFIDA.U8.Framework.Api.Controllers.U8.STController.Insert2(System.String,System.Collections.Generic.Dictionary{System.String,System.Object},System.Boolean,System.Boolean,System.Boolean,System.String,System.Boolean)">
|
||||
<summary>
|
||||
新增单据
|
||||
</summary>
|
||||
<param name="cCardNum">单据类型编码</param>
|
||||
<param name="input">报文</param>
|
||||
<param name="bCheck">是否控制可用量</param>
|
||||
<param name="bBeforCheckStock">是否检查可用量</param>
|
||||
<param name="bIsRedVouch">是否红字单据</param>
|
||||
<param name="sAddedState">传空字符串</param>
|
||||
<param name="bReMote">是否远程</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:UFIDA.U8.Framework.Api.Controllers.U8.STController.Verify(System.String,System.String,System.String,System.Boolean,System.Boolean,System.Boolean)">
|
||||
<summary>
|
||||
审核单据(单号)
|
||||
@@ -1139,6 +1160,51 @@
|
||||
日志组件
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:UFIDA.U8.Framework.Api.Entity.LoginInput">
|
||||
<summary>
|
||||
登录参数
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:UFIDA.U8.Framework.Api.Entity.LoginInput.pUserId">
|
||||
<summary>
|
||||
用户名
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:UFIDA.U8.Framework.Api.Entity.LoginInput.pPassword">
|
||||
<summary>
|
||||
密码
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:UFIDA.U8.Framework.Api.Entity.LoginInput.pDate">
|
||||
<summary>
|
||||
登录日期,影响各接口制单的默认日期
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:UFIDA.U8.Framework.Api.Entity.UserTokenInput">
|
||||
<summary>
|
||||
用户令牌参数
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:UFIDA.U8.Framework.Api.Entity.UserTokenInput.userToken">
|
||||
<summary>
|
||||
用户令牌
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:UFIDA.U8.Framework.Api.Entity.LoginOutput">
|
||||
<summary>
|
||||
登录输出参数
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:UFIDA.U8.Framework.Api.Entity.LoginOutput.cAccId">
|
||||
<summary>
|
||||
系统号
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:UFIDA.U8.Framework.Api.Entity.LoginOutput.userToken">
|
||||
<summary>
|
||||
用户令牌
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:UFIDA.U8.Framework.Api.WebApiApplication.CurrentDomain_AssemblyResolve(System.Object,System.ResolveEventArgs)">
|
||||
<summary>
|
||||
缺少程序集全局处理事件
|
||||
@@ -1224,6 +1290,13 @@
|
||||
<param name="pDate"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:UFIDA.U8.Framework.Api.Unit.CommUnit.GetUserToken(System.String)">
|
||||
<summary>
|
||||
获取用户令牌
|
||||
</summary>
|
||||
<param name="userToken">用户令牌</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:UFIDA.U8.Framework.Api.Unit.RemoteLoader">
|
||||
<summary>
|
||||
跨域加载
|
||||
|
||||
@@ -39,8 +39,8 @@ namespace UFIDA.U8.Framework.Api
|
||||
c.CustomProvider((defaultProvider) => new SwaggerCacheProvider(defaultProvider, $@"{AppDomain.CurrentDomain.BaseDirectory}\App_Data\U8API.xml"));
|
||||
c.SingleApiVersion("v1", "U8API");
|
||||
c.IncludeXmlComments($@"{AppDomain.CurrentDomain.BaseDirectory}\App_Data\U8API.xml");
|
||||
TokenRequiredHeaderParameter.HeaderKey = "account_token";
|
||||
TokenRequiredHeaderParameter.Description = "ÁîÅÆ";
|
||||
TokenRequiredHeaderParameter.HeaderKey = "userToken";
|
||||
TokenRequiredHeaderParameter.Description = "Óû§ÁîÅÆ";
|
||||
c.OperationFilter<TokenRequiredHeaderParameter>();
|
||||
|
||||
// If you want the output Swagger docs to be indented properly, enable the "PrettyPrint" option.
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.Http;
|
||||
using System.Web.Http.Description;
|
||||
using System.Web.UI.WebControls;
|
||||
using log4net;
|
||||
using UFIDA.U8.Framework.Api.ControlObject.Common;
|
||||
using UFIDA.U8.Framework.Api.ControlObject.Entity;
|
||||
using UFIDA.U8.Framework.Api.ControlObject.Json;
|
||||
using UFIDA.U8.Framework.Api.ControlObject.U8M;
|
||||
using UFIDA.U8.Framework.Api.Entity;
|
||||
using UFIDA.U8.Framework.Api.Models;
|
||||
using UFIDA.U8.Framework.Api.Unit;
|
||||
|
||||
@@ -23,26 +27,53 @@ namespace UFIDA.U8.Framework.Api.Controllers.U8
|
||||
/// <summary>
|
||||
/// U8登录接口
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <param name="cAccId">系统号</param>
|
||||
/// <param name="input">登录参数</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Route("api/U8/DP/Login")]
|
||||
public async Task<BaseResult<string>> Login( [FromBody] LoginParamter input)
|
||||
public async Task<BaseResult<string>> Login(string cAccId, [FromBody] LoginInput input)
|
||||
{
|
||||
try
|
||||
{
|
||||
var logn = new BaseLogin();
|
||||
logInfo.Debug($"当前接口:api/U8/DP/Login,参数:{input.ToJson()}");
|
||||
|
||||
logn.Init(input, false);
|
||||
var db = CommUnit.GetDbClient();
|
||||
|
||||
var userToken = logn.userToken;
|
||||
var account = await db.Queryable<SysU8AccountConfig>().FirstAsync(a => a.Status == StatusEnum.Enable && a.cAccountNo == cAccId);
|
||||
|
||||
if (account == null)
|
||||
{
|
||||
throw new Exception($"未能找到[{cAccId}]的配置信息");
|
||||
}
|
||||
|
||||
var param = new LoginParamter()
|
||||
{
|
||||
cSrv = account.cSrv,
|
||||
pAccId = account.cAcc_DataSource,
|
||||
pDate = string.IsNullOrWhiteSpace(input.pDate) ? $"{DateTime.Today:yyyy-MM-dd}" : input.pDate,
|
||||
pPassword = string.IsNullOrWhiteSpace(input.pPassword) ? "" : CommUnit.GetDecrypt(input.pPassword),
|
||||
pYearId = string.IsNullOrWhiteSpace(input.pDate) ? $"{DateTime.Today.Year}" : $"{DateTime.Parse(input.pDate).Year}",
|
||||
pSubId = "DP",
|
||||
pUserId = input.pUserId
|
||||
};
|
||||
|
||||
var login = new BaseLogin();
|
||||
|
||||
login.Init(param, false);
|
||||
|
||||
var userToken = login.userToken;
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(userToken))
|
||||
{
|
||||
return new BaseResult<string>() { bSuccess = true, message = "登录成功", result = userToken };
|
||||
}
|
||||
var output = new LoginOutput
|
||||
{
|
||||
cAccId = cAccId,
|
||||
userToken = CommUnit.GetEncrypt(userToken)
|
||||
};
|
||||
|
||||
await Task.Delay(1);
|
||||
return new BaseResult<string>() { bSuccess = true, message = "登录成功", result = CommUnit.GetEncrypt(output.ToJson()) };
|
||||
}
|
||||
|
||||
throw new Exception("未知错误,请检查系统日志");
|
||||
|
||||
@@ -51,12 +82,55 @@ namespace UFIDA.U8.Framework.Api.Controllers.U8
|
||||
{
|
||||
logInfo.Error(ex.Message, ex);
|
||||
|
||||
await Task.Delay(1);
|
||||
|
||||
return new BaseResult<string> { bSuccess = false, message = "登录失败", result = ex.Message };
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// U8登录接口
|
||||
/// </summary>
|
||||
/// <param name="input">用户令牌</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Route("api/U8/DP/Login/Token")]
|
||||
public async Task<BaseResult<string>> Login([FromBody] UserTokenInput input)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
logInfo.Debug($"当前接口:api/U8/DP/Login/Token,参数:{input.ToJson()}");
|
||||
|
||||
var token = CommUnit.GetUserToken(input.userToken);
|
||||
|
||||
var login = new BaseLogin();
|
||||
|
||||
login.Init(token, false);
|
||||
|
||||
var userToken = login.userToken;
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(userToken))
|
||||
{
|
||||
return new BaseResult<string>() { bSuccess = true, message = "登录成功", result = "登录成功" };
|
||||
}
|
||||
|
||||
throw new Exception("未知错误,请检查系统日志");
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logInfo.Error(ex.Message, ex);
|
||||
|
||||
await Task.Delay(1);
|
||||
|
||||
return new BaseResult<string> { bSuccess = false, message = "登录失败", result = ex.Message };
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取U8密码
|
||||
/// </summary>
|
||||
@@ -138,6 +212,7 @@ namespace UFIDA.U8.Framework.Api.Controllers.U8
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Route("api/U8/DP/GetDecryptString")]
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
public async Task<BaseResult<string>> GetDecryptString(string input)
|
||||
{
|
||||
try
|
||||
@@ -155,7 +230,7 @@ namespace UFIDA.U8.Framework.Api.Controllers.U8
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 新增对接账套设置
|
||||
/// 注册对接系统
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
@@ -202,7 +277,7 @@ namespace UFIDA.U8.Framework.Api.Controllers.U8
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新对接账套设置
|
||||
/// 更新对接系统
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
@@ -248,7 +323,7 @@ namespace UFIDA.U8.Framework.Api.Controllers.U8
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取对接账套设置列表
|
||||
/// 获取对接系统列表
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
|
||||
@@ -4,7 +4,9 @@ using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using System.Web.Http;
|
||||
using UFIDA.U8.Framework.Api.Common.Entity;
|
||||
using UFIDA.U8.Framework.Api.ControlObject.Common;
|
||||
@@ -12,6 +14,7 @@ using UFIDA.U8.Framework.Api.ControlObject.Entity;
|
||||
using UFIDA.U8.Framework.Api.ControlObject.Json;
|
||||
using UFIDA.U8.Framework.Api.ControlObject.ST;
|
||||
using UFIDA.U8.Framework.Api.ControlObject.U8M;
|
||||
using UFIDA.U8.Framework.Api.Entity;
|
||||
using UFIDA.U8.Framework.Api.Models;
|
||||
using UFIDA.U8.Framework.Api.Unit;
|
||||
// ReSharper disable StringLiteralTypo
|
||||
@@ -46,7 +49,7 @@ namespace UFIDA.U8.Framework.Api.Controllers.U8
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Route("api/U8/ST/{cCardNum}/Insert")]
|
||||
public async Task<BaseResult<string>> Insert(string cAccId, string cCardNum,[FromBody] Dictionary<string, object> input, bool bCheck = true,bool bBeforCheckStock=true,bool bIsRedVouch=false,string sAddedState="",bool bReMote=false)
|
||||
public async Task<BaseResult<string>> Insert(string cAccId ,string cCardNum,[FromBody] Dictionary<string, object> input, bool bCheck = true,bool bBeforCheckStock=true,bool bIsRedVouch=false,string sAddedState="",bool bReMote=false)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -254,6 +257,227 @@ namespace UFIDA.U8.Framework.Api.Controllers.U8
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 新增单据
|
||||
/// </summary>
|
||||
/// <param name="cCardNum">单据类型编码</param>
|
||||
/// <param name="input">报文</param>
|
||||
/// <param name="bCheck">是否控制可用量</param>
|
||||
/// <param name="bBeforCheckStock">是否检查可用量</param>
|
||||
/// <param name="bIsRedVouch">是否红字单据</param>
|
||||
/// <param name="sAddedState">传空字符串</param>
|
||||
/// <param name="bReMote">是否远程</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Route("api/U8/ST/{cCardNum}/Insert/Token")]
|
||||
public async Task<BaseResult<string>> Insert2(string cCardNum, [FromBody] Dictionary<string, object> input, bool bCheck = true, bool bBeforCheckStock = true, bool bIsRedVouch = false, string sAddedState = "", bool bReMote = false)
|
||||
{
|
||||
try
|
||||
{
|
||||
var userToken = Request.Headers.GetValues("userToken").First();
|
||||
|
||||
logInfo.Debug($"当前接口:api/U8/ST/{cCardNum}/Insert/{userToken},参数:{input.ToJson()}");
|
||||
|
||||
var output = CommUnit.GetDecrypt(userToken).ToObject<LoginOutput>();
|
||||
|
||||
var token = CommUnit.GetDecrypt(output.userToken);
|
||||
|
||||
var db = CommUnit.GetDbClient();
|
||||
|
||||
var workId = SnowFlakeSingle.Instance.NextId();
|
||||
|
||||
logInfo.Debug($"作业Id:{workId}-----单据:{cCardNum},操作:新增,对接账套:{output.cAccId},数据:{input.ToJson()}");
|
||||
|
||||
//LoginParamter param;
|
||||
|
||||
if (!_cache.TryGetValue($"U8_{userToken}_{output.cAccId}", out BaseLogin baseLogin))
|
||||
{
|
||||
logInfo.Debug($"作业Id:{workId}-----未获取到缓存的登录信息,正在重新构建");
|
||||
|
||||
baseLogin = new BaseLogin();
|
||||
|
||||
baseLogin.Init(token, false, 5);
|
||||
|
||||
_cache.Clear();
|
||||
|
||||
_cache.Set($"U8_{userToken}_{output.cAccId}", baseLogin);
|
||||
}
|
||||
//else
|
||||
//{
|
||||
// param = await CommUnit.GetLoginParamter(cAccId);
|
||||
//}
|
||||
|
||||
logInfo.Debug($"作业Id:{workId}-----登录信息获取完成,缓存设置完成,开始加载单据配置信息");
|
||||
|
||||
var voucherInfo = await db.Queryable<SysU8VoucherDefine>().FirstAsync(s => s.CardNumber == cCardNum);
|
||||
|
||||
var defs = await db.Queryable<SysU8FieldDefine>().Where(s => s.CardNumber == cCardNum && s.cPosition == "H" && s.bEnable == true).ToListAsync(); //查询表头字段配置,供后续设置字段值
|
||||
|
||||
var dateKey = "";
|
||||
var exchKey = "";
|
||||
if (defs.Any(a => a.bDate == true && a.cPosition == "H"))
|
||||
dateKey = defs.Where(a => a.bDate == true && a.cPosition == "H").Select(a => a.FieldName).First();
|
||||
|
||||
if (defs.Any(a => a.bPrice == true && a.cPosition == "H"))
|
||||
exchKey = defs.Where(a => a.bPrice == true && a.cPosition == "H").Select(a => a.FieldName).First();
|
||||
|
||||
var dDate = DateTime.Today;
|
||||
if (!string.IsNullOrWhiteSpace(dateKey))
|
||||
{
|
||||
if (!DateTime.TryParse($"{input[dateKey]}", out dDate))
|
||||
{
|
||||
dDate = DateTime.Today;
|
||||
}
|
||||
}
|
||||
|
||||
Exch exch;
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(exchKey) && input.TryGetValue(exchKey, out var value))
|
||||
{
|
||||
exch = CommonHelper.GetExch(dDate, output.cAccId, $"{value}", baseLogin.Connection);
|
||||
}
|
||||
else
|
||||
{
|
||||
exch = null;
|
||||
}
|
||||
|
||||
|
||||
var newNumber = "";
|
||||
var bGetCode = false;
|
||||
var codeKey = "";
|
||||
|
||||
if (defs.Any(a => a.bDefault == true && a.cPosition == "H" && a.DefaultValue == "单号" && a.bEnable == true))
|
||||
{
|
||||
bGetCode = true;
|
||||
codeKey = defs
|
||||
.Where(a => a.bDefault == true && a.cPosition == "H" && a.DefaultValue == "单号" &&
|
||||
a.bEnable == true).Select(a => a.FieldName).First();
|
||||
|
||||
logInfo.Debug($"作业Id:{workId}-----配置获取单号");
|
||||
}
|
||||
else
|
||||
{
|
||||
logInfo.Debug($"作业Id:{workId}-----没有单号需要自动指定");
|
||||
}
|
||||
|
||||
#region 调整日期,去掉时间部分
|
||||
|
||||
if (input.ContainsKey("ddate"))
|
||||
{
|
||||
logInfo.Debug($"作业Id:{workId}-----调整日期,去掉时间部分");
|
||||
input["ddate"] = $"{Convert.ToDateTime(input["ddate"]):yyyy-MM-dd}";
|
||||
}
|
||||
|
||||
if (input.ContainsKey("dtvdate"))
|
||||
{
|
||||
logInfo.Debug($"作业Id:{workId}-----调整日期,去掉时间部分");
|
||||
input["dtvdate"] = $"{Convert.ToDateTime(input["dtvdate"]):yyyy-MM-dd}";
|
||||
}
|
||||
|
||||
#endregion
|
||||
logInfo.Debug($"作业Id:{workId}-----设置表头数据");
|
||||
input.SetDictionaryData(defs, baseLogin.Connection, newNumber, 1, exch);
|
||||
|
||||
logInfo.Debug($"作业Id:{workId}-----读取表体数据");
|
||||
var bodyData = input[voucherInfo.BodyName].ToJson().ToList<Dictionary<string, object>>(); //读取表体的数据
|
||||
|
||||
if (bodyData == null || bodyData.Count <= 0)
|
||||
throw new Exception("无表体数据!");
|
||||
|
||||
logInfo.Debug($"作业Id:{workId}-----获取表体字段配置");
|
||||
var defsBody = await db.Queryable<SysU8FieldDefine>().Where(s => s.CardNumber == cCardNum && s.cPosition == "B" && s.bEnable == true).ToListAsync(); //获取表体的字段配置
|
||||
|
||||
var rowNo = 1;
|
||||
|
||||
foreach (var body in bodyData)
|
||||
{
|
||||
logInfo.Debug($"作业Id:{workId}-----设置第{rowNo}行单据数据");
|
||||
body.SetDictionaryData(defsBody, baseLogin.Connection, newNumber, rowNo, exch);
|
||||
|
||||
rowNo++;
|
||||
|
||||
// 根据存货档案是否批次管理调整批次号
|
||||
if (body.ContainsKey("binvbatch") && body.ContainsKey("cbatch"))
|
||||
{
|
||||
logInfo.Debug($"作业Id:{workId}-----第{rowNo}行根据存货档案是否批次管理调整批次号");
|
||||
if (body["binvbatch"] == null || body["binvbatch"] == DBNull.Value || !body["binvbatch"].ToBoolean())
|
||||
{
|
||||
body["cbatch"] = "";
|
||||
}
|
||||
}
|
||||
|
||||
// 根据存货档案是否批次管理调整批次号(调拨单)
|
||||
if (body.ContainsKey("binvbatch") && body.ContainsKey("ctvbatch"))
|
||||
{
|
||||
logInfo.Debug($"作业Id:{workId}-----第{rowNo}行根据存货档案是否批次管理调整批次号(调拨单)");
|
||||
if (body["binvbatch"] == null || body["binvbatch"] == DBNull.Value || !body["binvbatch"].ToBoolean())
|
||||
{
|
||||
body["ctvbatch"] = "";
|
||||
}
|
||||
}
|
||||
|
||||
// 根据存货档案是否保质期管理调整生产日期和失效日期
|
||||
if (body.ContainsKey("binvquality") && body.ContainsKey("dmadedate"))
|
||||
{
|
||||
logInfo.Debug($"作业Id:{workId}-----第{rowNo}行根据存货档案是否保质期管理调整生产日期和失效日期");
|
||||
|
||||
if (body["binvquality"] == null || body["binvquality"] == DBNull.Value || !body["binvquality"].ToBoolean())
|
||||
{
|
||||
if (cCardNum == "0304")
|
||||
{
|
||||
body["dmadedate"] = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
body["dmadedate"] = "";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (body.ContainsKey("cmassunit") && body.ContainsKey("imassdate"))
|
||||
{
|
||||
switch ($"{body["cmassunit"]}")
|
||||
{
|
||||
case "1" when cCardNum != "0304":
|
||||
body["dvdate"] = $"{Convert.ToDateTime(body["dmadedate"]).AddYears(Convert.ToInt32(body["imassdate"])):yyyy-MM-dd HH:MM:ss}";
|
||||
break;
|
||||
case "1" when cCardNum == "0304":
|
||||
body["ddisdate"] = $"{Convert.ToDateTime(body["dmadedate"]).AddYears(Convert.ToInt32(body["imassdate"])):yyyy-MM-dd HH:MM:ss}";
|
||||
break;
|
||||
case "2" when cCardNum != "0304":
|
||||
body["dvdate"] = $"{Convert.ToDateTime(body["dmadedate"]).AddMonths(Convert.ToInt32(body["imassdate"])):yyyy-MM-dd HH:MM:ss}";
|
||||
break;
|
||||
case "2" when cCardNum == "0304":
|
||||
body["ddisdate"] = $"{Convert.ToDateTime(body["dmadedate"]).AddMonths(Convert.ToInt32(body["imassdate"])):yyyy-MM-dd HH:MM:ss}";
|
||||
break;
|
||||
case "3" when cCardNum != "0304":
|
||||
body["dvdate"] = $"{Convert.ToDateTime(body["dmadedate"]).AddDays(Convert.ToInt32(body["imassdate"])):yyyy-MM-dd HH:MM:ss}";
|
||||
break;
|
||||
case "3" when cCardNum == "0304":
|
||||
body["ddisdate"] = $"{Convert.ToDateTime(body["dmadedate"]).AddDays(Convert.ToInt32(body["imassdate"])):yyyy-MM-dd HH:MM:ss}";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
input[voucherInfo.BodyName] = bodyData;
|
||||
|
||||
var co = new USERPCO();
|
||||
|
||||
var res = await co.Insert(baseLogin, input, cCardNum, voucherInfo.VoucherType, bGetCode, codeKey, bCheck, bBeforCheckStock, bIsRedVouch, sAddedState, bReMote, voucherInfo.bVerify, voucherInfo.bPrintDom);
|
||||
|
||||
return res;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logInfo.Error(ex.Message, ex);
|
||||
|
||||
return new BaseResult<string> { bSuccess = false, message = ex.Message, result = ex.StackTrace };
|
||||
}
|
||||
}
|
||||
|
||||
///// <summary>
|
||||
///// 修改单据
|
||||
///// </summary>
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace UFIDA.U8.Framework.Api.Entity
|
||||
{
|
||||
/// <summary>
|
||||
/// 登录参数
|
||||
/// </summary>
|
||||
public class LoginInput
|
||||
{
|
||||
/// <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 class UserTokenInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 用户令牌
|
||||
/// </summary>
|
||||
public string userToken { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 登录输出参数
|
||||
/// </summary>
|
||||
public class LoginOutput
|
||||
{
|
||||
/// <summary>
|
||||
/// 系统号
|
||||
/// </summary>
|
||||
public string cAccId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户令牌
|
||||
/// </summary>
|
||||
public string userToken { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -419,12 +419,13 @@
|
||||
<Compile Include="Controllers\U8\SFCController.cs" />
|
||||
<Compile Include="Controllers\U8\STController.cs" />
|
||||
<Compile Include="Controllers\U8\WorkflowController.cs" />
|
||||
<Compile Include="Entity\LoginInput.cs" />
|
||||
<Compile Include="Global.asax.cs">
|
||||
<DependentUpon>Global.asax</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Models\SFCInput.cs" />
|
||||
<Compile Include="Models\STInput.cs" />
|
||||
<Compile Include="Models\U8AccountConfigInput.cs" />
|
||||
<Compile Include="Entity\SFCInput.cs" />
|
||||
<Compile Include="Entity\STInput.cs" />
|
||||
<Compile Include="Entity\U8AccountConfigInput.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Unit\AssemblyDynamicLoader.cs" />
|
||||
<Compile Include="Unit\CommUnit.cs" />
|
||||
|
||||
@@ -5,10 +5,14 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using System.Web.UI.WebControls;
|
||||
using Microsoft.Data.Sqlite;
|
||||
using SqlSugar;
|
||||
using UFIDA.U8.Framework.Api.Common.Unit.GM;
|
||||
using UFIDA.U8.Framework.Api.ControlObject.Entity;
|
||||
using UFIDA.U8.Framework.Api.ControlObject.Json;
|
||||
using UFIDA.U8.Framework.Api.Entity;
|
||||
using UFIDA.U8.Framework.Api.Models;
|
||||
|
||||
namespace UFIDA.U8.Framework.Api.Unit
|
||||
{
|
||||
@@ -126,9 +130,21 @@ namespace UFIDA.U8.Framework.Api.Unit
|
||||
|
||||
return param;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取用户令牌
|
||||
/// </summary>
|
||||
/// <param name="userToken">用户令牌</param>
|
||||
/// <returns></returns>
|
||||
public static string GetUserToken(string userToken)
|
||||
{
|
||||
var output = CommUnit.GetDecrypt(userToken).ToObject<LoginOutput>();
|
||||
|
||||
var token = CommUnit.GetDecrypt(output.userToken);
|
||||
|
||||
return token;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user