APBill 网络服务问题
APBill web service issue
我正在使用 Web 服务来创建 AP 账单和调整记录,在我尝试设置 DocType ("Type") 之前一切正常。如果我让它默认为 'Bill',我没有问题。如果我尝试将下拉列表显式设置为 'Bill'(或 'Debit Adj.',或 'Credit Adj.'),我会收到一条错误消息,告诉我保存已被禁用(保存时发生错误)。我查看了系统,但找不到 'Bill' 存在的任何地方 - 数据库中只有 'INV'。查看源代码,我可以在类型下拉列表中看到一个名为 [ARInvoiceType.List()] 的属性,但我找不到它的内容。如果您查看 APDocType 枚举,它也不会在任何地方显示 'Bill' 。我已经尝试将类型设置为 'INV' 和 'Invoice' - 但这也不起作用。我需要知道在 Web 服务中将 'Type' 设置为什么,以便它代表下拉列表显示的内容。
这里是相关的代码示例:
foreach (PXResult<xvwInterCompanyProcess> rec in res)
{
xvwInterCompanyProcess icp = (xvwInterCompanyProcess)rec;
//Set the Doc Type...
apDocType = "Bill";
//Save if the RefNbr has changed - unless it's the first record...
if (icp.OrigRefNbr != LastRefNbr)
{
if (Counter > 0) context.Submit(new Command[] { AP301000.Actions.Save });
//Insert...
context.Submit(new Command[] { AP301000.Actions.Insert });
//add the Header records...
context.Submit(
new Command[]
{
//First, the header records...
new Value { Value = apDocType, LinkedCommand = AP301000.DocumentSummary.Type },
new Value { Value = Convert.ToString(icp.DocDate), LinkedCommand = AP301000.DocumentSummary.Date },
new Value { Value = icp.VendorRef, LinkedCommand = AP301000.DocumentSummary.VendorRef },
new Value { Value = icp.Description, LinkedCommand = AP301000.DocumentSummary.Description },
new Value { Value = "ZINTERREC", LinkedCommand = AP301000.DocumentSummary.Vendor },
}
);
}
//add the detail records...
context.Submit(
new Command[]
{
AP301000.DocumentDetails.ServiceCommands.NewRow,
new Value { Value = icp.InventoryID, LinkedCommand = AP301000.DocumentDetails.InventoryID },
new Value { Value = icp.TranDesc, LinkedCommand = AP301000.DocumentDetails.TransactionDescr },
new Value { Value = Convert.ToString(icp.Qty), LinkedCommand = AP301000.DocumentDetails.Quantity },
new Value { Value = icp.Uom, LinkedCommand = AP301000.DocumentDetails.UOM },
new Value { Value = Convert.ToString(icp.Units), LinkedCommand = AP301000.DocumentDetails.UnitCost },
new Value { Value = Convert.ToString(icp.TranAmt), LinkedCommand = AP301000.DocumentDetails.ExtCost },
new Value { Value = icp.Account, LinkedCommand = AP301000.DocumentDetails.Account },
new Value { Value = icp.APProject, LinkedCommand = AP301000.DocumentDetails.Project },
new Value { Value = icp.Aptask, LinkedCommand = AP301000.DocumentDetails.ProjectTask },
new Value { Value = "NONTAXABLE", LinkedCommand = AP301000.DocumentDetails.TaxCategory },
new Value { Value = "2", LinkedCommand = AP301000.DocumentDetails.SourceCompany },
new Value { Value = "Acumatica", LinkedCommand = AP301000.DocumentDetails.SourceApplication },
new Value { Value = "AR", LinkedCommand = AP301000.DocumentDetails.SourceModule },
new Value { Value = icp.OrigRefNbr + "|" + icp.LineNbr, LinkedCommand = AP301000.DocumentDetails.SourceID },
//new Value { Value = "US000000000", LinkedCommand = AP301000.DocumentDetails.Subaccount },
}
);
LastRefNbr = icp.OrigRefNbr;
Counter++;
}
if (res.Count > 0)
context.Submit(new Command[] { AP301000.Actions.Save });
}
我会尝试在插入命令之前设置 'Type'...
您需要在提交插入命令之前设置 'Type'。
我正在使用 Web 服务来创建 AP 账单和调整记录,在我尝试设置 DocType ("Type") 之前一切正常。如果我让它默认为 'Bill',我没有问题。如果我尝试将下拉列表显式设置为 'Bill'(或 'Debit Adj.',或 'Credit Adj.'),我会收到一条错误消息,告诉我保存已被禁用(保存时发生错误)。我查看了系统,但找不到 'Bill' 存在的任何地方 - 数据库中只有 'INV'。查看源代码,我可以在类型下拉列表中看到一个名为 [ARInvoiceType.List()] 的属性,但我找不到它的内容。如果您查看 APDocType 枚举,它也不会在任何地方显示 'Bill' 。我已经尝试将类型设置为 'INV' 和 'Invoice' - 但这也不起作用。我需要知道在 Web 服务中将 'Type' 设置为什么,以便它代表下拉列表显示的内容。
这里是相关的代码示例:
foreach (PXResult<xvwInterCompanyProcess> rec in res)
{
xvwInterCompanyProcess icp = (xvwInterCompanyProcess)rec;
//Set the Doc Type...
apDocType = "Bill";
//Save if the RefNbr has changed - unless it's the first record...
if (icp.OrigRefNbr != LastRefNbr)
{
if (Counter > 0) context.Submit(new Command[] { AP301000.Actions.Save });
//Insert...
context.Submit(new Command[] { AP301000.Actions.Insert });
//add the Header records...
context.Submit(
new Command[]
{
//First, the header records...
new Value { Value = apDocType, LinkedCommand = AP301000.DocumentSummary.Type },
new Value { Value = Convert.ToString(icp.DocDate), LinkedCommand = AP301000.DocumentSummary.Date },
new Value { Value = icp.VendorRef, LinkedCommand = AP301000.DocumentSummary.VendorRef },
new Value { Value = icp.Description, LinkedCommand = AP301000.DocumentSummary.Description },
new Value { Value = "ZINTERREC", LinkedCommand = AP301000.DocumentSummary.Vendor },
}
);
}
//add the detail records...
context.Submit(
new Command[]
{
AP301000.DocumentDetails.ServiceCommands.NewRow,
new Value { Value = icp.InventoryID, LinkedCommand = AP301000.DocumentDetails.InventoryID },
new Value { Value = icp.TranDesc, LinkedCommand = AP301000.DocumentDetails.TransactionDescr },
new Value { Value = Convert.ToString(icp.Qty), LinkedCommand = AP301000.DocumentDetails.Quantity },
new Value { Value = icp.Uom, LinkedCommand = AP301000.DocumentDetails.UOM },
new Value { Value = Convert.ToString(icp.Units), LinkedCommand = AP301000.DocumentDetails.UnitCost },
new Value { Value = Convert.ToString(icp.TranAmt), LinkedCommand = AP301000.DocumentDetails.ExtCost },
new Value { Value = icp.Account, LinkedCommand = AP301000.DocumentDetails.Account },
new Value { Value = icp.APProject, LinkedCommand = AP301000.DocumentDetails.Project },
new Value { Value = icp.Aptask, LinkedCommand = AP301000.DocumentDetails.ProjectTask },
new Value { Value = "NONTAXABLE", LinkedCommand = AP301000.DocumentDetails.TaxCategory },
new Value { Value = "2", LinkedCommand = AP301000.DocumentDetails.SourceCompany },
new Value { Value = "Acumatica", LinkedCommand = AP301000.DocumentDetails.SourceApplication },
new Value { Value = "AR", LinkedCommand = AP301000.DocumentDetails.SourceModule },
new Value { Value = icp.OrigRefNbr + "|" + icp.LineNbr, LinkedCommand = AP301000.DocumentDetails.SourceID },
//new Value { Value = "US000000000", LinkedCommand = AP301000.DocumentDetails.Subaccount },
}
);
LastRefNbr = icp.OrigRefNbr;
Counter++;
}
if (res.Count > 0)
context.Submit(new Command[] { AP301000.Actions.Save });
}
我会尝试在插入命令之前设置 'Type'...
您需要在提交插入命令之前设置 'Type'。