Page 1 of 1

Programming Warehouse Transfer Out

PostPosted: Mon Dec 15, 2014 12:56 pm
by changsen.wu
Hi Mike/Scott

I am having trouble adding warehouse transfer out lines for an existing warehouse transfer out object through code.

Based on the object model, I add a warehouse transfer lines by calling WarehouseTransferObject.AddTransferLine method. I then populate the linedetails collection by calling WarehouseTransferObject.TransferLines.Item(WarehouseTransferObject..TransferLines.Count).LineDetails.Add method. Specifically, I populate the following fields within the Add method:

TransferLineDetailsID =(Left(Replace( WarehouseTransferObject.Database.Database.NewGUID, "-", ""), 20)
Quantity = actual quantity to transfer (QuantityLeft from IN_SOH table)
OriginalQuantity = 0
Cost = lcostin from IN_SOH
SerialNo = SerialNo from IN_SOH
Dest_IN_SOHID = ""
Source_IN_SOHID = LinkID from IN_SOH
Source_BinLocation = BinLocation from IN_SOH
Source_DateIn = DateIn from IN_SOH
Source_ExpiryDate = ExpiryDate from IN_SOH
Source_SpecialPrice = SpecialPrice from IN_SOH
InTransit_IN_SOHID = ""
CostReceived = 0
CostReceived = 0
SerialNoIn = ""
BinLocationIn = ""
ExpiryDateIn = Now
AddedCost = 0

I then call WarehouseTransferObject.TransferLines.Item(.TransferLines.Count).AdjustQtyTrans as I assume this has the same functionality as SalesOrderLine.ReAdjustDelivery method.

However, upon save, I get the following error:

Error : Insert / Update of WH_TransferLineDetails yielded a result of 0 rows.

Module : clsWarehouseTransfer.SaveRecord

Please advise the correct way of adding linedetail object (presumably that's the cause of the issue).

In addition, I am also curious as to when WH_TransferLineDetails.IN_SOHID is used versus WH_TransferLineDetails.InTransit_IN_SOHID for warehouse transfers. I originally believe that if one uses in-transit warehouse, the latter field would be populated and if not, then the former. However, InTransit_IN_SOHID gets populated regardless whether In Transit warehouse is used in a transfer, and IN_SOHID doesn't seem to be populated at all. Could you please confirm.

Thanks

Changsen