添加过帐单

This commit is contained in:
gongxh
2021-05-22 16:37:58 +08:00
parent 4c897a8787
commit 99a222789b
7 changed files with 105 additions and 18 deletions

View File

@@ -66,6 +66,7 @@
<ItemGroup> <ItemGroup>
<Compile Include="BaseBill.cs" /> <Compile Include="BaseBill.cs" />
<Compile Include="BaseModel.cs" /> <Compile Include="BaseModel.cs" />
<Compile Include="Request\ApVouch.cs" />
<Compile Include="Request\BinChange.cs" /> <Compile Include="Request\BinChange.cs" />
<Compile Include="Request\Bom.cs" /> <Compile Include="Request\Bom.cs" />
<Compile Include="Request\Inventorybu.cs" /> <Compile Include="Request\Inventorybu.cs" />

View File

@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace NX.ERP.Model.Request
{
public class ApVouch
{
public string DeptCode { get; set; }
public string DeptName { get; set; }
public string supplierCode { get; set; }
public string Amount { get; set; }
public string Digest { get; set; }
public DateTime Date { get; set; }
}
}

View File

@@ -56,9 +56,9 @@ namespace NX.ERP.U8.AP
u8EnvContext.U8Login = U8LoginContext.Instance.ClsLogin; u8EnvContext.U8Login = U8LoginContext.Instance.ClsLogin;
U8ApiAddress apiAddress = new U8ApiAddress(this.LoadUrl); U8ApiAddress apiAddress = new U8ApiAddress(this.LoadUrl);
U8ApiBroker u8ApiBroker = new U8ApiBroker(apiAddress, u8EnvContext); U8ApiBroker u8ApiBroker = new U8ApiBroker(apiAddress, u8EnvContext);
u8EnvContext.SetApiContext("VouchType",this.VoucherID); u8EnvContext.SetApiContext("VouchType", this.VoucherID);
u8ApiBroker.AssignNormalValue("linkid", "0"); u8ApiBroker.AssignNormalValue("linkid", "");
if (!u8ApiBroker.Invoke()) if (!u8ApiBroker.Invoke())
{ {
@@ -122,7 +122,7 @@ namespace NX.ERP.U8.AP
u8ApiBroker.AssignNormalValue("ohead", para.DomHead); u8ApiBroker.AssignNormalValue("ohead", para.DomHead);
u8ApiBroker.AssignNormalValue("obody", para.DomBody); u8ApiBroker.AssignNormalValue("obody", para.DomBody);
//给普通参数isadd赋值。此参数的数据类型为System.Boolean,此参数按值传递,表示true新增,false修改 //给普通参数isadd赋值。此参数的数据类型为System.Boolean,此参数按值传递,表示true新增,false修改
u8ApiBroker.AssignNormalValue("isadd",true); u8ApiBroker.AssignNormalValue("isadd", true);
if (para.DOMMsg != null) if (para.DOMMsg != null)
@@ -167,7 +167,16 @@ namespace NX.ERP.U8.AP
para.ErrMsg = u8ApiBroker.GetResult("xmlmsg") as string; para.ErrMsg = u8ApiBroker.GetResult("xmlmsg") as string;
u8ApiBroker.Release(); u8ApiBroker.Release();
if (!para.ReturnValue)
{
throw new Exception(para.ErrMsg);
}
return ""; return "";
} }
catch (Exception err) catch (Exception err)
@@ -183,7 +192,7 @@ namespace NX.ERP.U8.AP
public string AddVocher() public string AddVocher(NX.ERP.Model.Request.ApVouch ApVouch)
{ {
VoucherParameter voucherParameter = new VoucherParameter VoucherParameter voucherParameter = new VoucherParameter
@@ -197,15 +206,43 @@ namespace NX.ERP.U8.AP
voucherParameter.DomHead.loadXML(HeadTemplate); voucherParameter.DomHead.loadXML(HeadTemplate);
voucherParameter.DomBody.loadXML(BodyTemplate); voucherParameter.DomBody.loadXML(BodyTemplate);
IXMLDOMElement headXml = domHead.createElement("z:row"); IXMLDOMElement headXml = domHead.createElement("z:row");
// headXml.setAttribute("cVenAbbName", "无锡市鑫奥");
headXml.setAttribute("cDwCode", ApVouch.supplierCode);
headXml.setAttribute("dVouchDate",ApVouch.Date);
headXml.setAttribute("iExchRate", 1);
headXml.setAttribute("iAmount_f",ApVouch.Amount);
headXml.setAttribute("iRAmount", ApVouch.Amount);
headXml.setAttribute("cVouchType", "P0");
headXml.setAttribute("cTypeName", "其他应付单");
headXml.setAttribute("cCode", "220201");
headXml.setAttribute("cexch_name", "人民币");
headXml.setAttribute("VT_ID", 8056);
headXml.setAttribute("bd_c", false);
headXml.setAttribute("bStartFlag", false);
headXml.setAttribute("cVouchID", "");
headXml.setAttribute("cFlag", "AP");
headXml.setAttribute("cDeptCode", ApVouch.DeptCode);
headXml.setAttribute("cDigest", ApVouch.Digest);
headXml.setAttribute("cLink", "");
IXMLDOMElement bodyXml; IXMLDOMElement bodyXml;
//for (var n = 0; n < storeIn.details.Count(); n++) //for (var n = 0; n < storeIn.details.Count(); n++)
//{ //{
//var detail = storeIn.details[n]; //var detail = storeIn.details[n];
bodyXml = domBody.createElement("z:row"); bodyXml = domBody.createElement("z:row");
bodyXml.setAttribute("cDeptCode", ApVouch.DeptCode);
bodyXml.setAttribute("cCode", "");
bodyXml.setAttribute("iExchRate", 1);
bodyXml.setAttribute("cexch_name", "人民币");
bodyXml.setAttribute("iAmount", ApVouch.Amount);
bodyXml.setAttribute("iAmount_f", ApVouch.Amount);
bodyXml.setAttribute("iAmt_s", 0);
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); domHead.selectSingleNode("//rs:data").appendChild(headXml);
var str = voucherParameter.DomBody.xml; var str = voucherParameter.DomBody.xml;
@@ -216,7 +253,6 @@ namespace NX.ERP.U8.AP
} }
catch (Exception err) catch (Exception err)
{ {
throw err; throw err;
} }

View File

@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Http;
namespace NX.ERP.WebAPi.Controllers.AP
{
public class APController : ApiController
{
[Route("api/ap/add")]
[HttpPost]
public string AddVoucher(NX.ERP.Model.Request.ApVouch ApVouch)
{
var dal = new NX.ERP.U8.AP.APVouch();
return dal.AddVocher(ApVouch);
}
}
}

View File

@@ -52,6 +52,11 @@
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="ADODB, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<SpecificVersion>False</SpecificVersion>
<EmbedInteropTypes>True</EmbedInteropTypes>
<HintPath>..\NX.ERP.U8\lib\ADODB.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" /> <Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.Owin, Version=4.1.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> <Reference Include="Microsoft.Owin, Version=4.1.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Owin.4.1.1\lib\net45\Microsoft.Owin.dll</HintPath> <HintPath>..\packages\Microsoft.Owin.4.1.1\lib\net45\Microsoft.Owin.dll</HintPath>
@@ -152,6 +157,7 @@
<Compile Include="App_Start\RouteConfig.cs" /> <Compile Include="App_Start\RouteConfig.cs" />
<Compile Include="App_Start\SwaggerConfig.cs" /> <Compile Include="App_Start\SwaggerConfig.cs" />
<Compile Include="App_Start\WebApiConfig.cs" /> <Compile Include="App_Start\WebApiConfig.cs" />
<Compile Include="Controllers\AP\APController.cs" />
<Compile Include="Controllers\MOM\BomController.cs" /> <Compile Include="Controllers\MOM\BomController.cs" />
<Compile Include="Controllers\MOM\MomOrderController.cs" /> <Compile Include="Controllers\MOM\MomOrderController.cs" />
<Compile Include="Controllers\Pmc\FinanceController.cs" /> <Compile Include="Controllers\Pmc\FinanceController.cs" />

View File

@@ -7,7 +7,7 @@
<appSettings> <appSettings>
<add key="server" value="10.0.0.12" /> <add key="server" value="10.0.0.12" />
<add key="AccId" value="u8-2@001" /> <add key="AccId" value="u8-2@001" />
<add key="UserId" value="wx997" /> <add key="UserId" value="wx996" />
<add key="Password" value="1" /> <add key="Password" value="1" />
<add key="EaiPort" value="80" /> <add key="EaiPort" value="80" />
<add key="EaiPath" value="U8EAI/import.asp" /> <add key="EaiPath" value="U8EAI/import.asp" />

View File

@@ -17,3 +17,4 @@ export const getInventorybu=(info)=>{
export const getInventorypo=(info)=>{ export const getInventorypo=(info)=>{
return axios.post('/api/Pmc/InventoryPocode',info) return axios.post('/api/Pmc/InventoryPocode',info)
} }