Im trying to create Production BOM lines using web services. I can construct the lines fine, but as soon as i update the ProdBOMLine() is set back to 0. I have used this code on other Nav integrations but on this one it doesn't like it. I cant figure out what could be different.
Public Sub CreateBOM(BomNo As String, Description As String, UOM As String,
bomLines As List(Of Object()))
Dim bom As New Integration_Production_BOM()
bom.No = BomNo
bom.Description = Description
bom.Unit_of_Measure_Code = UOM
bomService.Create(bom)
lastReadBOM = bom
AddBomLines(lastReadBOM, bomLines)
lastReadBOM.Status = NAV_Bom.Status.Certified
bomService.Update(lastReadBOM)
End Sub
Private Sub AddBomLines(ByRef bom As Integration_Production_BOM, bomLines As List(Of Object()))
bom.ProdBOMLine = New Integration_Production_BOM_Lines(bomLines.Count - 1) {}
For i As Integer = 0 To bomLines.Count - 1
bom.ProdBOMLine(i) = New Integration_Production_BOM_Lines()
Next
' bomService.Update(bom)
Dim position As Integer = 0
For Each bomLine As Object() In bomLines
If bomLine(0) = True Then
bom.ProdBOMLine(position).Type = NAV_Bom.Type.Production_BOM
Else
bom.ProdBOMLine(position).Type = NAV_Bom.Type.Item
End If
bom.ProdBOMLine(position).No = bomLine(1)
bom.ProdBOMLine(position).Quantity_per = bomLine(2)
bom.ProdBOMLine(position).Description = bomLine(4)
If Not String.IsNullOrEmpty(bomLine(3)) Then
bom.ProdBOMLine(position).Variant_Code = bomLine(3)
End If
position += 1
Next
'''Here bom.ProdBOMLine.Count = 3
bomService.Update(bom)
'''Here bom.ProdBOMLine.Count = 0
End Sub
Comments
Post a Comment