添加过帐单

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

@@ -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;
}