473,388 Members | 1,215 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 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 1990

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: //////////////////////////////////////////////////////////////////////////// ///////////// // Monster Munch, example...
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 one to validate a form I have on my webpage. ...
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 the inherited page into a form. The problem I...
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 1:43p) And in the end the following code was...
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 $doc = new DomDocument; $res =...
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 (nr. 2) and then as a client. The client then...
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 hang of things... yet have run into a 'stock...
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 one Lily 0 10 2.85 4 0 two Lily 22 22 7.33326 2 5 ...
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.