Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
OO Design Question and recursion question?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Divers
Thread ID:
00266441
Message ID:
00266905
Vues:
29
>That depends on what you mean by "handle". Are you printing a BOM or displaying it onscreen, or both?
>
Primarily displaying and editing it on screen.
I had used dbi Technologies ctTree to display and edit the BOM in VFP5.
I had used recursion to calculate the cost since a parent item's cost is based upon the subassemblies underneath it. Reading in and saving a BOM did not require recursion since the ctTree had a way to go thru all the nodes in the tree as they appear on the screen. I was able to assign a seq# this way.
I think that conceptually the only difference between what I had done and what you are suggesting is that a bom object be created that is a wrapper around the functionality that you are suggesting.
I was thinking more along the lines of having nested part, labor, Raw Material, subcontract, and subassembly objects within the BOM object. This may or may not be the way to go though.

>Here's a BOM function that will produce a cursor with the finished good as the frist record and each item after it with a link filed to an items immediate parent item;
>
>
>* Calling stub
>CREATE CURSOR BOM (ItemID I, ;
>                   ParentItemID I )
>LOCAL lnRecno()
>PRIVATE lnRecurseLevel
>lnRecurseLevel = 0
>USE Inventory
>* Find the fisnished good you want
>SELECT 0
>USE BOM ORDER ItemID
>IF NOT ProduceBOM( ItemID )
>   * Recursion failed because BOM is too complex
>ENDIF
>GOTO lnRecno()
>
>* Produce BOM cursor
>PROCEDURE ProduceBOM
>LPARAMETERS liItem
>LOCAL liNextItem, lcAlias, llRet
>lnRecurseLevel = lnRecurseLevel + 1
>IF lnRecurseLevel > 100
>   RETURN .F.
>ENDIF
>lcAlias = ALIAS()
>SELECT BOM
>SEEK litemID
>SCAN WHILE iItemID = liItemID
>   INSERT INTO BOM ( ItemID, ParentItemID ) VALUES ( iItemID, liItemID )
>   llRet = ProduceBOM( ChildItemID )
>ENDSCAN
>RETURN llRet
>
>
>This is just off the top of my head so it is not tested or debugged but it should show you that exploding a BOm is not a difficult process. The procedur could easily bet a mathod in an object and the object could have a property for hilding the top level item to be exploded.
>
>The key conecpt here its to not think of the object as the BOM but rather as a thing that can produce a BOM.
Derek Agar
Acctware Business Systems
derekagar@acctware.com
ICQ: 42332100

***********************
When in trouble call 911

He that dwelleth in the secret place
of the most High shall abide under
the shadow of the Almighty.
Psalm 91:1
***********************
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform