2014-01-21 7 views
1

인보이스 번호 세트로 QuickBook을 쿼리 한 다음 각 인보이스 번호에 대해 프로그램을 개발 중입니다. 인보이스가 발행됩니다. 인보이스 번호는 주로 파일에서 가져옵니다. 빠른 책에 일치하는 레코드가없는 문제가있는 번호는 다른 파일에 저장됩니다. 지금은 열심히 다음 예에서 두 숫자를 코딩 한대로 나는 RefNumberList의 모든 송장 번호를 추가하는 것이인보이스 QuickBooks에 대한 RefNumberList를 통한 쿼리 QBFC

IInvoiceQuery Invoices = msgset.AppendInvoiceQueryRq(); 
Invoices.ORInvoiceQuery.RefNumberList.Add("144"); 
Invoices.ORInvoiceQuery.RefNumberList.Add("9999"); 

msgset.Attributes.OnError = ENRqOnError.roeContinue; 

if (sessionMgr.doRequests(ref msgset)) 
{ 
    MessageBox.Show("An error was detected while processing the request. Please check the log files"); 
    return; 
} 

가장 큰 문제는 경우에도 송장 번호 중 하나가이 실패한다는 것입니다 빠른 책에 기록하면 전체 쿼리가 실패합니다.

답변

1

각 인보이스를 별도로 요청하는 것이 좋습니다. 그렇게하면 다른 쿼리가 여전히 값을 반환합니다.

 
msgset.Attributes.OnError = ENRqOnError.roeContinue; 
string[] InvoiceList = { "144", "9999" }; 
foreach (string invNum in InvoiceList) 
{ 
    IInvoiceQuery invQuery = msgset.AppendInvoiceQueryRq(); 
    invQuery.ORInvoiceQuery.RefNumberList.Add(invNum); 
}

// Process the requests and get the response IMsgSetResponse MsgResponse = SessionManager.DoRequests(msgset);

// Check each response for (int index = 0; index < MsgResponse.ResponseList.Count; index++) { IResponse response = MsgResponse.ResponseList.GetAt(index); if (response.StatusCode != 0) { // Save the invoice number in the "not found" file // and display the error MessageBox.Show("Error finding invoice " + InvoiceList[index] + ". Error: " + response.StatusMessage); } }

관련 문제