Here is sample VB code that accomplishes that. Basically get the part of the lot, calculate the issue required and on hand then perform the issue. I use the part.netweight which you don’t see in the code, but you can grab the data from JobMtl for that operation for the qty/parent. Ours is intentionally different based on yield. They scan the lot into the textbox after typing in quantity and the issue happens there.
Private Sub ValidateMtlPart
LotNum = epiTextBoxC1.Text
Dim JobMtl As EpiDataView = Ctype(oTrans.EpiDataViews(“JobMtl”),EpiDataView)
Dim QCHold As Boolean = False
Dim partNum As String = JobMtl.dataView(JobMtl.Row)(“PartNum”)
Dim ds As new DataSet
Dim adapterName As String
Dim opts As SearchOptions
Dim whereClauses As new system.collections.hashtable
whereClauses.Add(“PartLot”, “LotNum=’” + LotNum + “’”)
opts = SearchOptions.CreateRuntimeSearch(whereClauses,DataSetMode.RowsDataSet)
adapterName = “LotSelectUpdateAdapter”
ds = ProcessCaller.LaunchSearch(oTrans, adapterName, opts)
If ds.Tables("PartLot").Rows.Count > 0 Then
ScanPart = ds.Tables("PartLot").Rows(0)("PartNum")
QChold = ds.Tables("PartLot").Rows(0)("QCHold_c")
End If
End Sub
Private Sub IssueMtl
Dim RQ As EpiDataView = Ctype(oTrans.EpiDataViews(“RQ”),EpiDataView)
Dim JobNum As String = RQ.dataView(RQ.Row)(“JobNum”)
CalculateIssueQty()
If blnConsumed = False
Dim sMessage As String = “”
Dim strGUID As String = "00000000-0000-0000-0000-000000000000"
Dim guid1 As System.GUID = new System.GUID(strGUID)
Dim imAdapter As IssueReturnAdapter = New IssueReturnAdapter([RQForm])
imAdapter.BOConnect()
imAdapter.GetNewIssueReturn("STK-MTL",guid1,"IssueMaterial")
imAdapter.IssueReturnData.IssueReturn.Rows(0)("ToJobNum") = JobNum
imAdapter.IssueReturnData.IssueReturn.Rows(0)("LotNum") = lotNum
imAdapter.IssueReturnData.IssueReturn.Rows(0)("PartNum") = ScanPart
imAdapter.IssueReturnData.IssueReturn.Rows(0)("TranQty") = Format(IssueMtlQty, "####.##")
imAdapter.IssueReturnData.IssueReturn.Rows(0)("ToAssemblySeq") = 0
imAdapter.IssueReturnData.IssueReturn.Rows(0)("ToJobSeq") = 10
imAdapter.IssueReturnData.IssueReturn.Rows(0)("IssuedComplete") = False '//Add logic to determine if True or False
imAdapter.IssueReturnData.IssueReturn.Rows(0)("UM") = "LBS"
imAdapter.IssueReturnData.IssueReturn.Rows(0)("RequirementUOM") = "LBS"
imAdapter.IssueReturnData.IssueReturn.Rows(0)("FromBinNum") = "1"
imAdapter.IssueReturnData.IssueReturn.Rows(0)("FromWareHouseCode") = "Main"
imAdapter.PerformMaterialMovement(true,smessage,smessage)
End If
CoilGrid
epiTextBoxC1.Text = “Scan Coil”
End Sub
Private Sub CalculateIssueQty
Dim OHQty As Decimal
Dim JobMtl As EpidataView = Ctype(oTrans.EpiDataViews(“JobMtl”),EpiDataView)
Dim lotNum As String = EpiTextBoxC1.Text
partNum = scanPart
Try
Dim PartBinAdapt As PartBinSearchAdapter = New PartBinSearchAdapter([RQForm])
PartBinAdapt.BOConnect()
Dim PartBin As Erp.BO.PartBinSearchDataSet = PartBinAdapt.GetPartBinByLot(partNum, lotNum)
OHQty = PartBin.Tables(“PartBinSearch”).Rows(0)(“QtyOnHand”)
PartBinAdapt.Dispose()
Catch ex As exception
blnConsumed = True
OHQty = 1
msgbox(“This Tag already Consumed”)
End Try
If OHQty < IssueQtyRequired Then
IssueMtlQty = OHQty
End If
If OHQty > IssueQtyRequired Then
IssueMtlQty = IssueQtyRequired
End If
If IssueMtlQty < 1 Then
IssueMtlQty = 1
End If
IssueQtyRequired = IssueQtyRequired - IssueMtlQty
End Sub