error on BinLocationCollection.Read
Hi,
I think even this maybe a bug but still is technical/programming related.
It took me all day to debug this, so I would like to share my pain
.
Details: (Jiwa: 7.0.157)
I get "Object reference not set to an instance of an object." on
error as below:
the problem:
I was using below to create order in a different warehouse.
Code was done pre v7.0.8x, so I dont remember why I didnt set logicalID in .CreateNew()...
so, after the code above, below variables actually hold different value. i.e. one is the current logical warehouse ID, the other become warehouse that order resides in
now you get the error if you do Inventory.Read(InventoryID) on any item. This also happens to other plugins triggered by above code(e.g. line added/updated etc etc).
Fix:
This is an unusual scenario but I think the error on BinLocationCollection.Read() may still be a bug.
I think even this maybe a bug but still is technical/programming related.
It took me all day to debug this, so I would like to share my pain
Details: (Jiwa: 7.0.157)
I get "Object reference not set to an instance of an object." on
- Code: Select all
_Inventory = JiwaFinancials.Jiwa.JiwaApplication.Manager.Instance.BusinessLogicFactory.CreateBusinessLogic(Of JiwaFinancials.Jiwa.JiwaInventory.Inventory)(Nothing)
_Inventory.Read(_InventoryID)
error as below:
- Code: Select all
at JiwaFinancials.Jiwa.JiwaInventory.BinLocationCollection.Read()
at JiwaFinancials.Jiwa.JiwaInventory.Inventory.Read(String RecID)
at Lonicera.Jiwa.Standard.EDI.BL.OrderLine..ctor(Int64 EDIOrderLineID, Int64 EDIOrderID, Int32 OrderLineNo, String OrderItemCode, String OrderItemCodeType, String OrderItemCode2, String OrderItemCodeType2, String OrderItemDescription, Decimal OrderQty, Decimal OrderPackSize, Decimal OrderPrice, Decimal OrderTaxRate, String JiwaPartNo, String JiwaBarCode, Decimal JiwaQtyAvailable, Decimal JiwaQtyAssigned, Decimal JiwaPrice, Decimal JiwaPriceOverwrite, String ManuallySelectedPartNo, Boolean DonotImportThisLine, Boolean LineUpdated, Int32 QuantityDecimalPlaces, String InventoryID, String _JiwaInvoiceID, String _JiwaInvoiceLineID, OrderLines Lines)
at Lonicera.Jiwa.Standard.EDI.BL.OrderLines.Read()
at Lonicera.Jiwa.Standard.EDI.BL.Order.Read(String RecID)
the problem:
- Code: Select all
_SalesOrder = JiwaApplication.Manager.Instance.BusinessLogicFactory.CreateBusinessLogic(Of JiwaSales.SalesOrder.SalesOrder)(Nothing)
RaiseEvent ProcessStart(Me, _SalesOrder, New System.EventArgs())
With _SalesOrder
.CreateNew(JiwaSales.SalesOrder.SalesOrder.NewSalesOrderTypes.e_NewSalesOrder, Debtor.DebtorID, True,,,, WarehouseID)
'.Warehouse.IN_LogicalID = WarehouseID
.OrderNo = Me.CustomerPONo
.Reference = Me.EDIOrderReferenceNo
.ExpectedDeliveryDate = Me.RequestedDeliveryDate
.SalesOrderHistorys(1).Notes = Me.Comments
End With
'JiwaApplication.Manager.Instance.Database.CurrentLogicalWarehouseID
'JiwaApplication.Manager.Instance.CurrentLogicalWarehouse.IN_LogicalID
For Each line As BL.OrderLine In _OrderLines
If Not line.DonotImportThisLine Then
With _SalesOrder.SalesOrderLines
.AddInventoryItem(line.InventoryID, JiwaSales.SalesOrder.SalesOrderLineCollection.SalesOrderLineInventorySeedTypes.e_SalesOrderLineInventoryID, NewKey)
If line.JiwaQtyAssigned = 0 Then
.Item(NewKey).QuantityOrdered = line.OrderQty
Else
.Item(NewKey).QuantityOrdered = line.JiwaQtyAssigned
End If
.Item(NewKey).DiscountedPrice = line.JiwaPriceOverwrite
line.AssignMapping(_SalesOrder.RecID, NewKey)
End With
End If
Next
Me.OrderApproved = True
RaiseEvent ProcessEnding(Me, _SalesOrder, New System.EventArgs())
_SalesOrder.Save()
Me.Save()
RaiseEvent ProcessEnd(Me, _SalesOrder, New System.EventArgs())
I was using below to create order in a different warehouse.
- Code: Select all
.Warehouse.IN_LogicalID = WarehouseID
Code was done pre v7.0.8x, so I dont remember why I didnt set logicalID in .CreateNew()...
so, after the code above, below variables actually hold different value. i.e. one is the current logical warehouse ID, the other become warehouse that order resides in
- Code: Select all
'JiwaApplication.Manager.Instance.Database.CurrentLogicalWarehouseID
'JiwaApplication.Manager.Instance.CurrentLogicalWarehouse.IN_LogicalID
now you get the error if you do Inventory.Read(InventoryID) on any item. This also happens to other plugins triggered by above code(e.g. line added/updated etc etc).
Fix:
- Code: Select all
SalesOrder.CreateNew(JiwaSales.SalesOrder.SalesOrder.NewSalesOrderTypes.e_NewSalesOrder, Debtor.DebtorID, True,,,, WarehouseID)
This is an unusual scenario but I think the error on BinLocationCollection.Read() may still be a bug.