添加用友插件项目

This commit is contained in:
gongxh
2021-05-26 10:15:12 +08:00
parent 4b8a39b3ae
commit 2dfdd9d16f
6 changed files with 147 additions and 18 deletions

View File

@@ -31,7 +31,7 @@
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>

View File

@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace NX.ERP.U8.Plugin
{
public class ApVochPlugin
{
/// <summary>
///
/// </summary>
/// <param name="head"></param>
/// <param name="body"></param>
/// <param name="ErrMsg"></param>
/// <returns></returns>
public bool AfterSave(ref MSXML2.IXMLDOMDocument2 head,ref MSXML2.IXMLDOMDocument2 body,out string ErrMsg )
{
MessageBox.Show("结束保存");
ErrMsg = "";
return true;
}
}
}

View File

@@ -0,0 +1,51 @@
<?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>{6A041146-D589-465F-9586-FF8ECCDB8B94}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>NX.ERP.U8.Plugin</RootNamespace>
<AssemblyName>NX.ERP.U8.Plugin</AssemblyName>
<TargetFrameworkVersion>v3.5</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>
</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="Interop.MSXML2">
<HintPath>..\NX.ERP.U8\lib\Interop.MSXML2.dll</HintPath>
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="ApVochPlugin.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("NX.ERP.U8.Plugin")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NX.ERP.U8.Plugin")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("6a041146-d589-465f-9586-ff8eccdb8b94")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -112,12 +112,15 @@ namespace NX.ERP.U8.AP
protected override string AddRdVoucher(VoucherParameter para)
{
try
U8EnvContext u8EnvContext = new U8EnvContext
{
U8EnvContext u8EnvContext = new U8EnvContext();
u8EnvContext.U8Login = U8LoginContext.Instance.ClsLogin;
U8Login = U8LoginContext.Instance.ClsLogin
};
U8ApiAddress apiAddress = new U8ApiAddress(this.AddUrl);
U8ApiBroker u8ApiBroker = new U8ApiBroker(apiAddress, u8EnvContext);
try
{
u8EnvContext.SetApiContext("VouchType", this.VoucherID);
u8ApiBroker.AssignNormalValue("ohead", para.DomHead);
u8ApiBroker.AssignNormalValue("obody", para.DomBody);
@@ -134,8 +137,6 @@ namespace NX.ERP.U8.AP
u8ApiBroker.AssignNormalValue("xmlmsg", new DOMDocumentClass());
}
// u8ApiBroker.AssignNormalValue("bReMote", para.IsReMote);
if (!u8ApiBroker.Invoke())
{
Exception exception = u8ApiBroker.GetException();
@@ -159,7 +160,7 @@ namespace NX.ERP.U8.AP
}
para.ReturnValue = false;
u8ApiBroker.Release();
}
para.ReturnValue = Convert.ToBoolean(u8ApiBroker.GetReturnValue());
@@ -169,7 +170,7 @@ namespace NX.ERP.U8.AP
u8ApiBroker.Release();
if (!para.ReturnValue)
{
@@ -186,7 +187,7 @@ namespace NX.ERP.U8.AP
}
finally
{
u8ApiBroker.Release();
}
}
@@ -208,9 +209,9 @@ namespace NX.ERP.U8.AP
IXMLDOMElement headXml = domHead.createElement("z:row");
// headXml.setAttribute("cVenAbbName", "无锡市鑫奥");
headXml.setAttribute("cDwCode", ApVouch.supplierCode);
headXml.setAttribute("dVouchDate",ApVouch.Date);
headXml.setAttribute("dVouchDate", ApVouch.Date);
headXml.setAttribute("iExchRate", 1);
headXml.setAttribute("iAmount_f",ApVouch.Amount);
headXml.setAttribute("iAmount_f", ApVouch.Amount);
headXml.setAttribute("iRAmount", ApVouch.Amount);
headXml.setAttribute("cVouchType", "P0");
headXml.setAttribute("cTypeName", "其他应付单");
@@ -219,11 +220,11 @@ namespace NX.ERP.U8.AP
headXml.setAttribute("VT_ID", 8056);
headXml.setAttribute("bd_c", false);
headXml.setAttribute("bStartFlag", false);
headXml.setAttribute("cVouchID", "664");
headXml.setAttribute("cVouchID", "");
headXml.setAttribute("cFlag", "AP");
headXml.setAttribute("cDeptCode", ApVouch.DeptCode);
headXml.setAttribute("cDigest", ApVouch.Digest);
headXml.setAttribute("cLink", "664");
headXml.setAttribute("cLink", "");
IXMLDOMElement bodyXml;
//for (var n = 0; n < storeIn.details.Count(); n++)
@@ -238,15 +239,14 @@ namespace NX.ERP.U8.AP
bodyXml.setAttribute("iAmount", ApVouch.Amount);
bodyXml.setAttribute("iAmount_f", ApVouch.Amount);
bodyXml.setAttribute("iAmt_s", 0);
bodyXml.setAttribute("cLink", "664");
bodyXml.setAttribute("cLink", "");
headXml.setAttribute("cDwCode", ApVouch.supplierCode);
bodyXml.setAttribute("bd_c", true);
domBody.selectSingleNode("//rs:data").appendChild(bodyXml);
//}
domHead.selectSingleNode("//rs:data").appendChild(headXml);
var str = voucherParameter.DomBody.xml;
Console.WriteLine(str);
try
{
return AddRdVoucher(voucherParameter);

View File

@@ -19,6 +19,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{272C1F7E-6
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "U8Test", "U8Test\U8Test.csproj", "{D5B8553C-BA98-4A52-8BF0-15791F7EF9C0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NX.ERP.U8.Plugin", "NX.ERP.U8.Plugin\NX.ERP.U8.Plugin.csproj", "{6A041146-D589-465F-9586-FF8ECCDB8B94}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -100,6 +102,18 @@ Global
{D5B8553C-BA98-4A52-8BF0-15791F7EF9C0}.Release|x64.Build.0 = Release|Any CPU
{D5B8553C-BA98-4A52-8BF0-15791F7EF9C0}.Release|x86.ActiveCfg = Release|Any CPU
{D5B8553C-BA98-4A52-8BF0-15791F7EF9C0}.Release|x86.Build.0 = Release|Any CPU
{6A041146-D589-465F-9586-FF8ECCDB8B94}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6A041146-D589-465F-9586-FF8ECCDB8B94}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6A041146-D589-465F-9586-FF8ECCDB8B94}.Debug|x64.ActiveCfg = Debug|Any CPU
{6A041146-D589-465F-9586-FF8ECCDB8B94}.Debug|x64.Build.0 = Debug|Any CPU
{6A041146-D589-465F-9586-FF8ECCDB8B94}.Debug|x86.ActiveCfg = Debug|Any CPU
{6A041146-D589-465F-9586-FF8ECCDB8B94}.Debug|x86.Build.0 = Debug|Any CPU
{6A041146-D589-465F-9586-FF8ECCDB8B94}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6A041146-D589-465F-9586-FF8ECCDB8B94}.Release|Any CPU.Build.0 = Release|Any CPU
{6A041146-D589-465F-9586-FF8ECCDB8B94}.Release|x64.ActiveCfg = Release|Any CPU
{6A041146-D589-465F-9586-FF8ECCDB8B94}.Release|x64.Build.0 = Release|Any CPU
{6A041146-D589-465F-9586-FF8ECCDB8B94}.Release|x86.ActiveCfg = Release|Any CPU
{6A041146-D589-465F-9586-FF8ECCDB8B94}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -111,6 +125,7 @@ Global
{8A6603B0-444A-49C7-80C9-195638129068} = {0AB7F5D9-F8E9-4EA7-917F-283EF99CF16D}
{C1FFE393-1879-4FC1-A99E-695F2882553D} = {0AB7F5D9-F8E9-4EA7-917F-283EF99CF16D}
{D5B8553C-BA98-4A52-8BF0-15791F7EF9C0} = {272C1F7E-66F7-4E92-9777-3A7CB2E9D7CC}
{6A041146-D589-465F-9586-FF8ECCDB8B94} = {0AB7F5D9-F8E9-4EA7-917F-283EF99CF16D}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {8C57E044-32E1-444C-B548-E83838110953}