472,344 Members | 1,680 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,344 software developers and data experts.

Simple ERP problem

-----------------------------------------
BACKGROUND

In my company (www.glass.biz) we use ERP software
to compute what has to be done to do products for
our customers. Main algorithm takes data in form
of two tables -- let's call them "Structure" and
"Orders".

"Structure" keeps information on construction
of our product -- what resources we need to
produce a product, and how many pieces of that
product we make at once. For example table that
looks like:

do_product_A resource_X -3
do_product_A resource_Y -5
do_proudct_A product_A +2
do_product_B resource_X -7
do_product_B resource_Z -1
do_product_B product_B +1

tells that to produce 2 pieces of product_A
we need to use 3 pieces of resource_X and
5 pieces of resource_Y. To produce product_B
we use 7 pieces of resource_X and one piece
of resource_Z. Names that occur in table I
would reference as "identifiers".

"Orders" is a table that keeps information
about current orders, and could take form
like this

product_A 4
product_B 2.

Our program computes that we need to
perform task do_product_A two times,
and perform task do_product_B two times
also, so we need

resource_X 20
resource_Y 10
resource_Z 2.

What was shown above is simplified view
of our model, but shows all problems I
would like to discuss.

Our software works fine iff:

1. Identyfiers are strings that
match case insensitive perl regex
described by pattern: /[A-Z](_?[A-Z0-9])*/.
This means that identifier starts with
a letter, ends with a letter or digit,
and can contain uderbars. No two underbars
can be next to each other. Underbars
can't be at the beginning and at the end
of identifier.

2. Identyfier can't occur in both columns of
"Structure" table (even in different rows).

3. Pair consisting of identifier in the first column
and identifier in the second column should be
uniqe in "Structure" table.

4. Identifiers in "Orders" table must be
present in the second column of
"Structure" table.
-----------------------------------------
PROBLEM and my SOLUTION

For realiability and multiuser purposes I
want to move our system to PostgreSQL, but
I found some problems which I describe below.

1. To check identifiers I would use ~* operator.
Will it work with regex shown above?

2. Identifier can't occur in both columns, so
I will make multicolumn Primary Key on first
two columns of "Structure" table.

3. How to I prevent from inserting same identifiers
in first and second coulumn, for example:

do_something XXX -4
XXX resource_Y +3

4. How do I prevent from inserting in table "Orders"
identyfier that is not present in the second
column of "Structure" table? I could use Foreign Key
in "Orders" table, but I don't need first column
of "Structure" table, so this part of Foreign Key
would always be NULL.

Thank you for any useful reply and opinions.
Problem seems to be simple, but I am completely novice,
so can't solve it on my own behalf.

Leszek Dubiel
Jul 19 '05 #1
0 1936

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Patchwork | last post by:
Hi Everyone, Please take a look at the following (simple and fun) program: ...
6
by: francisco lopez | last post by:
ok , first of all sorry if my english is not so good, I do my best. here is my problem: I donīt know much javascript so I wrote a very simple...
0
by: 42 | last post by:
I implemented a simple class inherited from Page to create a page template. It simply wraps some trivial html around the inherited page, and puts...
18
by: Sender | last post by:
Yesterday there was a very long thread on this query. (You can search on this by post by 'sender' with subject 'Simple Problem' post date Oct 7 time...
27
by: one man army | last post by:
Hi All- I am new to PHP. I found FAQTS and the php manual. I am trying this sequence, but getting 'no zip string found:'... PHP Version 4.4.0 ...
2
by: Vitali Gontsharuk | last post by:
Hi! I have a problem programming a simple client-server game, which is called pingpong ;-) The final program will first be started as a server...
8
by: rdrink | last post by:
I am just getting into pysqlite (with a fair amount of Python and MySQL experience behind me) and have coded a simple test case to try to get the...
5
by: Chelong | last post by:
hey,the follow is the text file content ========================================apple====pear== one Lily 7 0 0 7 7 two Lily 20 20 6.6666 20 8...
30
by: galiorenye | last post by:
Hi, Given this code: A** ppA = new A*; A *pA = NULL; for(int i = 0; i < 10; ++i) { pA = ppA; //do something with pA
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.