I am not sure how to explain this so here is the scenario.
1. using csv import - using the event ( CSVSalesOrderWatcher.FileImport) to import a CSV file to EDIT an existing sales order. No matter what I do I get the following error ( in windows logs )
"Failed to import File 'C:\Temp\Watch\TestFile_so0054000.csv' - Error: Index (zero based) must be greater than or equal to zero and less than the size of the argument list."
Worse - the second line ( the last line ) of the order has been changed - The quantity ordered is copied to quantity Back ordered ( see screen shot ). Both lines had the Demand field set equal to ordered field before the operation. ( Note there is plenty of stock on hand )
While my final aim is to update the Quantity Del, the code I am testing with does not do any updates to the order - yet this happens ! see simplified code below. and the sample file attached.
HELP!
- Code: Select all
Dim salesOrder As JiwaSales.SalesOrder.SalesOrder = JiwaApplication.Manager.Instance.BusinessLogicFactory.CreateBusinessLogic(Of JiwaSales.SalesOrder.SalesOrder)(Nothing)
Using csvParser As New FileIO.TextFieldParser(FileName)
csvParser.TextFieldType = FileIO.FieldType.Delimited
csvParser.Delimiters = New String() {","}
csvParser.HasFieldsEnclosedInQuotes = False
Dim csvFields As String()
Dim previousOrderNo As String = Nothing
Dim newKey As String = ""
Dim debtor As JiwaApplication.Entities.Debtor.Debtor = New JiwaApplication.Entities.Debtor.Debtor
Dim inventory As JiwaApplication.Entities.Inventory.Inventory = New JiwaApplication.Entities.Inventory.Inventory
Dim sInvNo As String = "
csvFields = csvParser.ReadFields
sInvNo = "0054000" ' csvFields(0).ToString().Trim() '-- JiwaInvoiceNo
Dim salesOrderLine As JiwaSales.SalesOrder.SalesOrderLine
Dim sLineId As String = "3be372b3446949ffb882" 'csvFields(2).ToString().Trim()
Dim qtyThisDel As Decimal = 0
CSVSalesOrderWatcher.LogToEventLog("Updated sales order InvNo: " + sInvNo + " FileName: " + FileName , System.Diagnostics.EventLogEntryType.SuccessAudit)
End Using


