添加过帐单

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>
<Compile Include="BaseBill.cs" />
<Compile Include="BaseModel.cs" />
<Compile Include="Request\ApVouch.cs" />
<Compile Include="Request\BinChange.cs" />
<Compile Include="Request\Bom.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

@@ -14,7 +14,7 @@ namespace NX.ERP.U8.AP
public APVouch() : base("应付单", "U8API/APVouch")
{
}
protected override string AddUrl
@@ -56,10 +56,10 @@ namespace NX.ERP.U8.AP
u8EnvContext.U8Login = U8LoginContext.Instance.ClsLogin;
U8ApiAddress apiAddress = new U8ApiAddress(this.LoadUrl);
U8ApiBroker u8ApiBroker = new U8ApiBroker(apiAddress, u8EnvContext);
u8EnvContext.SetApiContext("VouchType",this.VoucherID);
u8EnvContext.SetApiContext("VouchType", this.VoucherID);
u8ApiBroker.AssignNormalValue("linkid", "");
u8ApiBroker.AssignNormalValue("linkid", "0");
if (!u8ApiBroker.Invoke())
{
Exception exception = u8ApiBroker.GetException();
@@ -95,7 +95,7 @@ namespace NX.ERP.U8.AP
para.DomBody = new DOMDocumentClass();
para.DomBody.loadXML(dOMDocument2.xml);
}
para.ReturnValue = Convert.ToBoolean(u8ApiBroker.GetReturnValue());
para.ErrMsg = u8ApiBroker.GetResult("xmlmsg") as string;
u8ApiBroker.Release();
@@ -122,7 +122,7 @@ namespace NX.ERP.U8.AP
u8ApiBroker.AssignNormalValue("ohead", para.DomHead);
u8ApiBroker.AssignNormalValue("obody", para.DomBody);
//给普通参数isadd赋值。此参数的数据类型为System.Boolean,此参数按值传递,表示true新增,false修改
u8ApiBroker.AssignNormalValue("isadd",true);
u8ApiBroker.AssignNormalValue("isadd", true);
if (para.DOMMsg != null)
@@ -133,7 +133,7 @@ namespace NX.ERP.U8.AP
{
u8ApiBroker.AssignNormalValue("xmlmsg", new DOMDocumentClass());
}
// u8ApiBroker.AssignNormalValue("bReMote", para.IsReMote);
if (!u8ApiBroker.Invoke())
@@ -163,11 +163,20 @@ namespace NX.ERP.U8.AP
}
para.ReturnValue = Convert.ToBoolean(u8ApiBroker.GetReturnValue());
para.ErrMsg = u8ApiBroker.GetResult("xmlmsg") as string;
u8ApiBroker.Release();
if (!para.ReturnValue)
{
throw new Exception(para.ErrMsg);
}
return "";
}
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
@@ -197,15 +206,43 @@ namespace NX.ERP.U8.AP
voucherParameter.DomHead.loadXML(HeadTemplate);
voucherParameter.DomBody.loadXML(BodyTemplate);
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;
//for (var n = 0; n < storeIn.details.Count(); n++)
//{
//var detail = storeIn.details[n];
bodyXml = domBody.createElement("z:row");
//var detail = storeIn.details[n];
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);
var str = voucherParameter.DomBody.xml;
@@ -216,7 +253,6 @@ namespace NX.ERP.U8.AP
}
catch (Exception 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>
</PropertyGroup>
<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.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>
@@ -152,6 +157,7 @@
<Compile Include="App_Start\RouteConfig.cs" />
<Compile Include="App_Start\SwaggerConfig.cs" />
<Compile Include="App_Start\WebApiConfig.cs" />
<Compile Include="Controllers\AP\APController.cs" />
<Compile Include="Controllers\MOM\BomController.cs" />
<Compile Include="Controllers\MOM\MomOrderController.cs" />
<Compile Include="Controllers\Pmc\FinanceController.cs" />

View File

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

View File

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