Change Part Plant Vendor ID

Beings I'm not the one to answer the question you're not asking, all I
can do is shrug my shoulders.

Your idea of launching part entry is probably just as good if not
better, I'll play with that this weekend. Thanks for the code snippet.

________________________________

From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf
Of Robert Brown
Sent: Friday, April 18, 2008 1:53 PM
To: vantage@yahoogroups.com
Subject: Re: [Vantage] Change Part Plant Vendor ID



Ken

I won't even ask WHY so many are authorized to create new parts (as it
is a policy that normally comes back and haunts you).

Why try to do so much via backdoor VB code? (Code that YOU will have to
change imbedded business rules in as business rules change over time.)

Just use your code:

' Next 3 lines are to make sure part is not in database already
dim recSelected as boolean = true
Dim whereClause as string = "PartNum = '" & partnum & "'"
Dim dsPartNum as DataSet = Epicor.Mfg.UI. FormFunctions.
SearchFunctions. listLookup( oTrans,"PartAdap ter",recSelected
,False,whereClau se)

if recSelected then
messagebox.show( "Duplicate Part")

...and trap the test to verify if it is a new part number so it just
launches PartEntry if it IS new (also passing it the new part number to
set up):

ELSE

ProcessCaller.LaunchForm(oTrans,"Epicor.Mfg.UI.PartEntry.dll",partnum)

END IF

Why rewrite Part Entry?

Rob Brown

--- On Fri, 4/18/08, Ken Williams <ken@...
<mailto:ken%40intermountainelectronics.com> > wrote:

From: Ken Williams <ken@...
<mailto:ken%40intermountainelectronics.com> >
Subject: [Vantage] Change Part Plant Vendor ID
To: vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com>
Date: Friday, April 18, 2008, 11:37 AM

We seem to have a large user problem of adding parts to the database
when needed. That is to say, they just don't do it, which causes all
sorts of problems down the road.

I've been tasked with coming up with a push button that will do this for
the end user. This push button needs to exist in Quote entry & Job entry
for mfg details.

All was going great until I got to trying to update the part plant
vendor ID with the vendor listed in the appropriate field on the
quote/job mfg detail. I seem to be having problems finding an
appropriate dataset to pass to PartAdapt.ChangePar tPlantVendorID(
vendorid, dsPartNum). Any help would be greatly appreciated.

Dim partAdapt as PartAdapter = New PartAdapter( oTrans)
Dim edv As EpiDataView = CType(oTrans. EpiDataViews( "JobMtl") ,
EpiDataView)
dim partnum as string = edv.dataView( edv.row)( "PartNum" )
dim partdescription as string = edv.dataView( edv.row)( "Description" )
dim vendorid as string = edv.dataView( edv.row)( "VendorNumVendor ID")
dim unitcost as string = edv.dataView( edv.row)( "EstUnitCost" )

' Next 3 lines are to make sure part is not in database already
dim recSelected as boolean = true
Dim whereClause as string = "PartNum = '" & partnum & "'"
Dim dsPartNum as DataSet = Epicor.Mfg.UI. FormFunctions.
SearchFunctions. listLookup( oTrans,"PartAdap ter",recSelected
,False,whereClau se)

if recSelected then
messagebox.show( "Duplicate Part")
else
PartAdapt.BOConnect ()
PartAdapt.GetNewPar t()
PartAdapt.PartData. Tables(0) .Rows(0). BeginEdit( )
PartAdapt.PartData. Tables(0) .Rows(0)( "PartNum" ) = partnum
PartAdapt.PartData. Tables(0) .Rows(0)( "PartDescription ") =
partdescription
PartAdapt.PartData. Tables(0) .Rows(0). EndEdit()
PartAdapt.Update( )

The above code works great, below are some ways I've tried to update the
vendor ID

Dim dsPartNumafter as DataSet = SearchFunctions. ListLookup(
oTrans,"PartPlan tSearchAdapter" ,recSelected, false,whereClaus e) 'this
results in partlistdataset instead of partdataset
PartAdapt.ChangePar tPlantVendorID( vendorid, dsPartNumafter) 'this is
expecting partdataset, not partlistdataset

Attempt #2, create a new partadapter called vendadapt - this comes very
close to working
vendadapt.BOconnect ()
vendAdapt.getbyid( partnum)
Dim dsPartNumafter as DataSet = vendAdapt.PartData 'this appears to
return partdataset
vendAdapt.ChangePar tPlantVendorID( vendorid, dsPartNumafter) 'get
"Cannot find record for this change"
vendadapt.update( )

I've done a dozen other little things but attempt #2 seems to be very
very close. Using message boxes I've verified it has the partnum &
vendor ID right going into the changepartplant call. Anyway, I know I'm
missing something, hopefully small. Any help would be, as always,
greatly appreciated.

Ken

[Non-text portions of this message have been removed]

__________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now.
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
<http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ>





[Non-text portions of this message have been removed]
We seem to have a large user problem of adding parts to the database when needed. That is to say, they just don't do it, which causes all sorts of problems down the road.

I've been tasked with coming up with a push button that will do this for the end user. This push button needs to exist in Quote entry & Job entry for mfg details.

All was going great until I got to trying to update the part plant vendor ID with the vendor listed in the appropriate field on the quote/job mfg detail. I seem to be having problems finding an appropriate dataset to pass to PartAdapt.ChangePartPlantVendorID(vendorid, dsPartNum). Any help would be greatly appreciated.

Dim partAdapt as PartAdapter = New PartAdapter(oTrans)
Dim edv As EpiDataView = CType(oTrans.EpiDataViews("JobMtl"), EpiDataView)
dim partnum as string = edv.dataView(edv.row)("PartNum")
dim partdescription as string = edv.dataView(edv.row)("Description")
dim vendorid as string = edv.dataView(edv.row)("VendorNumVendorID")
dim unitcost as string = edv.dataView(edv.row)("EstUnitCost")

' Next 3 lines are to make sure part is not in database already
dim recSelected as boolean = true
Dim whereClause as string = "PartNum = '" & partnum & "'"
Dim dsPartNum as DataSet = Epicor.Mfg.UI.FormFunctions.SearchFunctions.listLookup(oTrans,"PartAdapter",recSelected,False,whereClause)

if recSelected then
messagebox.show("Duplicate Part")
else
PartAdapt.BOConnect()
PartAdapt.GetNewPart()
PartAdapt.PartData.Tables(0).Rows(0).BeginEdit()
PartAdapt.PartData.Tables(0).Rows(0)("PartNum") = partnum
PartAdapt.PartData.Tables(0).Rows(0)("PartDescription") = partdescription
PartAdapt.PartData.Tables(0).Rows(0).EndEdit()
PartAdapt.Update()

The above code works great, below are some ways I've tried to update the vendor ID

Dim dsPartNumafter as DataSet = SearchFunctions.ListLookup(oTrans,"PartPlantSearchAdapter",recSelected,false,whereClause) 'this results in partlistdataset instead of partdataset
PartAdapt.ChangePartPlantVendorID(vendorid, dsPartNumafter) 'this is expecting partdataset, not partlistdataset

Attempt #2, create a new partadapter called vendadapt - this comes very close to working
vendadapt.BOconnect()
vendAdapt.getbyid(partnum)
Dim dsPartNumafter as DataSet = vendAdapt.PartData 'this appears to return partdataset
vendAdapt.ChangePartPlantVendorID(vendorid, dsPartNumafter) 'get "Cannot find record for this change"
vendadapt.update()

I've done a dozen other little things but attempt #2 seems to be very very close. Using message boxes I've verified it has the partnum & vendor ID right going into the changepartplant call. Anyway, I know I'm missing something, hopefully small. Any help would be, as always, greatly appreciated.

Ken


[Non-text portions of this message have been removed]
Ken

I won't even ask WHY so many are authorized to create new parts (as it is a policy that normally comes back and haunts you).

Why try to do so much via backdoor VB code? (Code that YOU will have to change imbedded business rules in as business rules change over time.)

Just use your code:

' Next 3 lines are to make sure part is not in database already
dim recSelected as boolean = true
Dim whereClause as string = "PartNum = '" & partnum & "'"
Dim dsPartNum as DataSet = Epicor.Mfg.UI. FormFunctions. SearchFunctions. listLookup( oTrans,"PartAdap ter",recSelected ,False,whereClau se)

if recSelected then
messagebox.show( "Duplicate Part")

...and trap the test to verify if it is a new part number so it just launches PartEntry if it IS new (also passing it the new part number to set up):

ELSE

ProcessCaller.LaunchForm(oTrans,"Epicor.Mfg.UI.PartEntry.dll",partnum)

END IF

Why rewrite Part Entry?

Rob Brown

--- On Fri, 4/18/08, Ken Williams <ken@...> wrote:

From: Ken Williams <ken@...>
Subject: [Vantage] Change Part Plant Vendor ID
To: vantage@yahoogroups.com
Date: Friday, April 18, 2008, 11:37 AM






We seem to have a large user problem of adding parts to the database when needed. That is to say, they just don't do it, which causes all sorts of problems down the road.

I've been tasked with coming up with a push button that will do this for the end user. This push button needs to exist in Quote entry & Job entry for mfg details.

All was going great until I got to trying to update the part plant vendor ID with the vendor listed in the appropriate field on the quote/job mfg detail. I seem to be having problems finding an appropriate dataset to pass to PartAdapt.ChangePar tPlantVendorID( vendorid, dsPartNum). Any help would be greatly appreciated.

Dim partAdapt as PartAdapter = New PartAdapter( oTrans)
Dim edv As EpiDataView = CType(oTrans. EpiDataViews( "JobMtl") , EpiDataView)
dim partnum as string = edv.dataView( edv.row)( "PartNum" )
dim partdescription as string = edv.dataView( edv.row)( "Description" )
dim vendorid as string = edv.dataView( edv.row)( "VendorNumVendor ID")
dim unitcost as string = edv.dataView( edv.row)( "EstUnitCost" )

' Next 3 lines are to make sure part is not in database already
dim recSelected as boolean = true
Dim whereClause as string = "PartNum = '" & partnum & "'"
Dim dsPartNum as DataSet = Epicor.Mfg.UI. FormFunctions. SearchFunctions. listLookup( oTrans,"PartAdap ter",recSelected ,False,whereClau se)

if recSelected then
messagebox.show( "Duplicate Part")
else
PartAdapt.BOConnect ()
PartAdapt.GetNewPar t()
PartAdapt.PartData. Tables(0) .Rows(0). BeginEdit( )
PartAdapt.PartData. Tables(0) .Rows(0)( "PartNum" ) = partnum
PartAdapt.PartData. Tables(0) .Rows(0)( "PartDescription ") = partdescription
PartAdapt.PartData. Tables(0) .Rows(0). EndEdit()
PartAdapt.Update( )

The above code works great, below are some ways I've tried to update the vendor ID

Dim dsPartNumafter as DataSet = SearchFunctions. ListLookup( oTrans,"PartPlan tSearchAdapter" ,recSelected, false,whereClaus e) 'this results in partlistdataset instead of partdataset
PartAdapt.ChangePar tPlantVendorID( vendorid, dsPartNumafter) 'this is expecting partdataset, not partlistdataset

Attempt #2, create a new partadapter called vendadapt - this comes very close to working
vendadapt.BOconnect ()
vendAdapt.getbyid( partnum)
Dim dsPartNumafter as DataSet = vendAdapt.PartData 'this appears to return partdataset
vendAdapt.ChangePar tPlantVendorID( vendorid, dsPartNumafter) 'get "Cannot find record for this change"
vendadapt.update( )

I've done a dozen other little things but attempt #2 seems to be very very close. Using message boxes I've verified it has the partnum & vendor ID right going into the changepartplant call. Anyway, I know I'm missing something, hopefully small. Any help would be, as always, greatly appreciated.

Ken

[Non-text portions of this message have been removed]
















____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ