We do item costing at the warehouse level because we have Vendor Consignment Warehouses. We have recently started using RMA Receipts to receive in RMA items in CSI so we know that they have arrived. To avoid making them part of our inventory, though, we have decided to move these to a separate Quality "QA" Warehouse. The problem is, there has to be an Item Warehouse record for the "QA" warehouse and that item before they can be received in. I have written a form script to do this, but I still have an issues:
1. When I add the Item Warehouse record, I cannot get it to add a value for the Unit Cost. I just want to make the QA Warehouse cost for this item the unit cost in our MAIN Warehouse.
2. Because F1 is our default location, everytime I create a new QA Warehouse record, it adds a record for QA > F1 with the "Permanent" flag checked. We are receiving these into QA > INS so I do not want the QA > F1 record!
Here is my current script! I appreciate any help!
Sub GetQAWarehouseInfo()
Dim QtyAvailRequestData2 As LoadCollectionRequestData = New LoadCollectionRequestData()
Dim itemNum2 As String = ThisForm.Components("ItemEdit").Value
QtyAvailRequestData2.IDOName = "SLItemWhses"
QtyAvailRequestData2.PropertyList.SetProperties("Item, Whse, UnitCost")
QtyAvailRequestData2.Filter = "Item = '" + itemNum2 + "' AND Whse='QA'"
QtyAvailRequestData2.RecordCap = -1
QtyAvailRequestData2.OrderBy = "Item"
Dim QtyAvailResponseData2 As LoadCollectionResponseData = New LoadCollectionResponseData()
QtyAvailResponseData2 = Me.IDOClient.LoadCollection(QtyAvailRequestData2)
Dim sItemType2 As String = String.Empty
Dim sQAUnitCost2 As String = ThisForm.Components("ue_DerWhseCurUnitCostEdit").Value
If (QtyAvailResponseData2.Items.Count <> 0) Then
'Get QA Warehouse Info
Application.ShowMessage(Application.GetStringValue("A Record Exists"))
ThisForm.Components("QAWarehouseItemEdit").Value = "1"
ThisForm.Components("QAWarehouseCostEdit").Value = sQAUnitCost2
Else
sItemType2 = "-1"
ThisForm.Components("QAWarehouseCostEdit").Value = sQAUnitCost2
Application.ShowMessage(Application.GetStringValue("A Record DOES NOT Exist"))
Try
Dim request As New UpdateCollectionRequestData
Dim response As New UpdateCollectionResponseData
Dim newRequest As New IDOUpdateItem
request.IDOName = "SLItemWhses"
request.RefreshAfterUpdate = True
newRequest.Action = UpdateAction.Insert
Dim dd As DateTime = DateTime.UtcNow.AddHours(-6)
Dim iWhse As String = "QA"
Dim iItem As String = ThisForm.Components("ItemEdit").Value
Dim iUnitCost As String = "999.00" 'I just put a value in here to try to get SOMETHING to write
newRequest.Properties.Add("Item", iItem)
newRequest.Properties.Add("Whse", iWhse)
newRequest.Properties.Add("UnitCost", iUnitCost)
request.Items.Add(newRequest)
response = IDOClient.UpdateCollection(request)
ThisForm.Components("QAWarehouseItemEdit").Value = "1"
Catch ex As Exception
MsgBox("Error" & vbCrLf & ex.Message)
End Try
End If
End Sub