Jeff,
What I do when I have to create part records for a bunch of new parts is change the company default warehouse to the one I need at the moment. [I have to use a bunch of different logical warehouses, sometimes in the same physical space. Why that is gets complicated and connects to us being a gov't contractor; not important for this discussion.] For parts that already exist in my Part master file, I have to add the new warehouse, but that would be true whatever setting I used for the default warehouse.
I agree that it's a pain to have to change the primary and then delete the default. You could settle for just changing the primary warehouse and make very plain that the default is a dummy. It's not quite as clean or elegant, but it should work.
Thinking on it a bit more, if you wrote the customization I suggested in my first note, you could probably automate the deletion of the default warehouse record in the same routine. The PrimWhse value is stored in the PartPlant dataview - here's the provided code:
Dim [edvVarName] As EpiDataView = CType(oTrans.EpiDataViews("PartPlant"), EpiDataView)
Dim [VarName] As String = [edvVarName].dataView([edvVarName].Row)("PrimWhse")
Then the next step would be:
[edvVarName].dataview([edvVarName].Row)("PrimWhse") =strWarehouseDuJour
Come to think, it would probably be a bit faster to declare the variables Private up at the top, and then capture the warehouse you need, maybe with a pop-up box, in the string variable strWarehouseDuJour.
I had to do something conceptually similar and just got it sorted out this week. Here's the relevant code that I finally got to with the help of our vendor:
'Get Charge Number data from Requisition Detail Table
'First get Req Line info from PORel view
Dim intReqNum As Int32 = edvPORel.dataView(edvPORel.Row)("ReqNum")
Dim intReqLine As Int32 = edvPORel.dataView(edvPORel.Row)("ReqLine")
Dim blnYes As Boolean
Dim strWhereClause As String
'Gets the entire requisition record
Dim blnRequisition As Boolean = ReqAdapter.GetByID(intReqNum)
'Item (1) is the ReqDetail table
For Each drReqLine As DataRow in ReqAdapter.ReqData.Tables.Item(1).Rows
If drReqLine.Item("ReqLine") = intReqLine Then
edvPORel.dataView(edvPORel.Row)("ShortChar01") = drReqLine.Item("ShortChar01")
edvPORel.dataView(edvPORel.Row)("ShortChar02") = drReqLine.Item("ShortChar02")
edvPORel.dataView(edvPORel.Row)("ShortChar03") = drReqLine.Item("ShortChar03")
Exit For
End If
Next drReqLine
It's far from elegant, but the method provided to get a particular record using the Company, Requisition Number, and Requisition Line, doesn't work. You could do essentially the same thing, changing the particulars to meet your situation. The tricky part will be getting the right Item number to access the PartWhse table, but you could probably persuade it to spit out the entire collection if you asked nicely. Or beat it with a club, which is too often what I wish I could do. Oh, and I declared edvPORel as a Data View, and ReqAdapter as a Requisition Adapter, up in the global variables.
[ In the Adapters section I found a method for your situation that corresponds to the FindByCompanyReqNumReqLine that I tried first:
Dim [varAdapterName] As PartAdapterPartData = New PartAdapterPartData([UIForm])
[varAdapterName].BOConnect()
Dim [varName] As Epicor.Mfg.BO.PartDataSet+PartWhseRow = [varAdapterName].PartData.PartWhse.FindByCompanyPartNumPlantWarehouseCode(Company, PartNum, Plant, WarehouseCode)
I wouldn't bet that this works, and it only finds the record for you and returns the dataset, when what you want is to delete it. Oh, and the PartDataSet+PartWhseRow won't compile. Change the plus sign to a period if you try this.]
Good luck!
Lynn Thomas
Senior Engineer
SAIC
317-357-4041 X255
[Non-text portions of this message have been removed]
What I do when I have to create part records for a bunch of new parts is change the company default warehouse to the one I need at the moment. [I have to use a bunch of different logical warehouses, sometimes in the same physical space. Why that is gets complicated and connects to us being a gov't contractor; not important for this discussion.] For parts that already exist in my Part master file, I have to add the new warehouse, but that would be true whatever setting I used for the default warehouse.
I agree that it's a pain to have to change the primary and then delete the default. You could settle for just changing the primary warehouse and make very plain that the default is a dummy. It's not quite as clean or elegant, but it should work.
Thinking on it a bit more, if you wrote the customization I suggested in my first note, you could probably automate the deletion of the default warehouse record in the same routine. The PrimWhse value is stored in the PartPlant dataview - here's the provided code:
Dim [edvVarName] As EpiDataView = CType(oTrans.EpiDataViews("PartPlant"), EpiDataView)
Dim [VarName] As String = [edvVarName].dataView([edvVarName].Row)("PrimWhse")
Then the next step would be:
[edvVarName].dataview([edvVarName].Row)("PrimWhse") =strWarehouseDuJour
Come to think, it would probably be a bit faster to declare the variables Private up at the top, and then capture the warehouse you need, maybe with a pop-up box, in the string variable strWarehouseDuJour.
I had to do something conceptually similar and just got it sorted out this week. Here's the relevant code that I finally got to with the help of our vendor:
'Get Charge Number data from Requisition Detail Table
'First get Req Line info from PORel view
Dim intReqNum As Int32 = edvPORel.dataView(edvPORel.Row)("ReqNum")
Dim intReqLine As Int32 = edvPORel.dataView(edvPORel.Row)("ReqLine")
Dim blnYes As Boolean
Dim strWhereClause As String
'Gets the entire requisition record
Dim blnRequisition As Boolean = ReqAdapter.GetByID(intReqNum)
'Item (1) is the ReqDetail table
For Each drReqLine As DataRow in ReqAdapter.ReqData.Tables.Item(1).Rows
If drReqLine.Item("ReqLine") = intReqLine Then
edvPORel.dataView(edvPORel.Row)("ShortChar01") = drReqLine.Item("ShortChar01")
edvPORel.dataView(edvPORel.Row)("ShortChar02") = drReqLine.Item("ShortChar02")
edvPORel.dataView(edvPORel.Row)("ShortChar03") = drReqLine.Item("ShortChar03")
Exit For
End If
Next drReqLine
It's far from elegant, but the method provided to get a particular record using the Company, Requisition Number, and Requisition Line, doesn't work. You could do essentially the same thing, changing the particulars to meet your situation. The tricky part will be getting the right Item number to access the PartWhse table, but you could probably persuade it to spit out the entire collection if you asked nicely. Or beat it with a club, which is too often what I wish I could do. Oh, and I declared edvPORel as a Data View, and ReqAdapter as a Requisition Adapter, up in the global variables.
[ In the Adapters section I found a method for your situation that corresponds to the FindByCompanyReqNumReqLine that I tried first:
Dim [varAdapterName] As PartAdapterPartData = New PartAdapterPartData([UIForm])
[varAdapterName].BOConnect()
Dim [varName] As Epicor.Mfg.BO.PartDataSet+PartWhseRow = [varAdapterName].PartData.PartWhse.FindByCompanyPartNumPlantWarehouseCode(Company, PartNum, Plant, WarehouseCode)
I wouldn't bet that this works, and it only finds the record for you and returns the dataset, when what you want is to delete it. Oh, and the PartDataSet+PartWhseRow won't compile. Change the plus sign to a period if you try this.]
Good luck!
Lynn Thomas
Senior Engineer
SAIC
317-357-4041 X255
[Non-text portions of this message have been removed]