This is not a homework, but new task assign by superior. To create a system for in-house end-users, which auto suggest to different assembly line based on each line's capacity. Users need to maintain each line capacity everymonth, and each line have its own product group running on it with unique prority on each assembly line. When the sales order coming, this system will based on the line planning maintenance below to do auto allocation to each assembly lines based on prority setting.
Eg, Product A which is under product group XYZ will be running at L1 and L2.
Sample Data
Period | Line_Number | Product_Subgp | Line_Capacity | Prority
201009 | L1 | XYZ | 2000 | 1
201009 | L1 | ABC | 2000 | 2
201009 | L2 | XYZ | 2000 | 2
201009 | L2 | ZZZ | 2000 | 1
Table Structure for Line Header : LinHdr
Line_Hdr_ID | Int(AutoIncrement)
Line_Number | VarChar(10)[Primary Key]
Period | VarChar(6) [Primary Key]
Capacity | Numeric(16)
Special_Capacity| Numeric(16)
Line_Description| VarChar(20)
Table Structure for Line Header : LinDtl
Line_Dtl_ID | Int(AutoIncrement)
Line_Hdr_ID | Int [Primary key]
Product_Group | VarChar(10)[Primary Key]
Prority | Numeric(2)
Questions:
Table LinHdr: Line_Number+Period is Primary Key. As these 2 fields will be act as uniqueness and as a seekkey of the data. Am i correct to set both as primary key?
Table LinHdr: Need to include Lin_Hdr_ID as primary key? (LinHID which is autoincrement by SQL, will be invisible to users).
- The purpose of LinHID is to link to LinDtl, so that no need to include redundant data (i.e. Period+Line_Number) into LinDtl, by using Lin_Hdr_ID to link betw 2 tables.
Table LinDtl: Line_Hdr_ID+Product_Group will set as Primary Key, to enforce uniqueness. Is this correct to have this Line_Dtl_ID? Is this field necessary? If Line_Hdr_ID+Product_Group already provide uniqueness, can exclude Line_Dtl_ID?
Or, it is better to combine 2 tables above into 1 tables, which did not create relational database?
Hope can have advice from expertise here.
Thanks in advance.