Current location: Hot Scripts Forums » Programming Languages » PHP » Part Manufacturing Database


Part Manufacturing Database

Reply
  #1 (permalink)  
Old 03-03-04, 11:54 AM
j0ker21m j0ker21m is offline
New Member
 
Join Date: Mar 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Part Manufacturing Database

Hello guys.

I am needing a database built so I can keep track of which peices are needed for building a part. I cannot figure out how to design the database(s) so that I can have each component listed in its assembly order.

For example, if part 1 takes 6 peices to build, but 3 of them are built in a sub-assembly to make 1 part, how do I get it into databases so that it would read like this:

Part a,b, and c will assemble to make part D. Part D, E, and F will assemble into part 1.

My problem isnt in the coding, its in the design of the database. I cannot figure a logical way to store the information so that I may use queries to sort out the info.

Any help would be appreciated.
Reply With Quote
  #2 (permalink)  
Old 03-04-04, 10:29 AM
jerry's Avatar
jerry jerry is offline
Newbie Coder
 
Join Date: Mar 2004
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Could this be an answer ?

Hello...

What you need is a stree structure:

Suggestion Table:

Gen_ID (bigint auto increment, primary)
ParentID (int)
ID (int)
PartName (text)

so basically, there's an entry:

Assume Part A is the main parent, which is made out of part B,C,D
and Part D is made out of part E,F,G

Assuming:
Part A = 1
Part B = 2
Part C = 3
Part D = 4
Part E = 5
Part F = 6
Part G = 7
So, in the database design above, for the main entry, ie: Part A

ParentID = 0 ( signifies that this is the highest parent, no parts above A )
ID = 1
Partname = 'A'

ParentID = 1 ( Assuming Part B is a subpart of 'A', hence parent of 1 (A's ID))
ID = 2 ( B's ID )
Partname = 'B'

ParentID = 1 ( Assuming Part C is a subpart of 'A', hence parent of 1 (A's ID))
ID = 3 (C's ID)
Partname = 'C'

ParentID=1 ( Assuming Part D is a subpart of 'A', hence parent of 1 (A's ID))
ID = 4 (D's ID)
Partname = 'D'

ParentID=4 ( Assuming Part E is a subpart of 'D', hence parent of 4 (A's ID))
ID = 5 (E's ID)
Partname = 'E'

ParentID=4 ( Assuming Part F is a subpart of 'D', hence parent of 4 (A's ID))
ID = 6 (F's ID)
Partname = 'F'

ParentID=4 ( Assuming Part G is a subpart of 'D', hence parent of 4 (A's ID))
ID = 7 (G's ID)
Partname = 'G'

So as you can see, a select statement:

select * from ^^table^^ where parentid=1 ( check for direct subparts of A)
RESULTS: B,C,D
Then repeat the select process...
select * from ^^table^^ where parentid=4 ( check for direct subparts of D)

as you can see, you've gotten a tree structure. Now, all you need to do is lots of programming to get things together. Please consider General Scripting if you need web development services some day.
__________________
<font face="Verdana"><a href="http://www.generalscripting.com">General Scripting</a> Web Development Services</font>
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP Form to update a MySQL database? Scoobler PHP 9 09-04-08 01:41 AM
Share database over the Internet nitinkedia The Lounge 2 11-20-03 02:07 PM
SQL database registration form help vinhkhuong PHP 3 10-10-03 03:49 AM
Share database over the Internet nitinkedia New Members & Introductions 1 07-10-03 02:50 PM


All times are GMT -5. The time now is 09:12 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.