webERP Forum
BILL OF MATERIALS - Printable Version

+- webERP Forum (http://www.weberp.org/forum)
+-- Forum: webERP Discussion (http://www.weberp.org/forum/forumdisplay.php?fid=1)
+--- Forum: Development Discussion & Specification (http://www.weberp.org/forum/forumdisplay.php?fid=10)
+--- Thread: BILL OF MATERIALS (/showthread.php?tid=2684)



BILL OF MATERIALS - petero@laballieds - 01-20-2016

Hi guys, have been looking for best ERP to manage the company's business, i wanted web based php good lack found weberp promising to others because of the easy of understanding its code base. Guddos guys

My question is how do i import a CSV BOM guys, is there any script doing so.
so far have imported all stock items.
PeterWink


RE: BILL OF MATERIALS - TimSchofield - 01-20-2016

I don't think there is a script to do it, but mysql does have it's own command for importing csv files. So assuming you have a csv file with the data like this:

+-----------------+-------------+------+-----+------------+-------+
| Field | Type | Null | Key | Default | Extra |
+-----------------+-------------+------+-----+------------+-------+
| parent | varchar(20) | NO | | | |
| sequence | int(11) | YES | | 0 | |
| component | varchar(20) | YES | | | |
| workcentreadded | char(5) | YES | | | |
| loccode | char(5) | YES | | | |
| effectiveafter | date | YES | | 0000-00-00 | |
| effectiveto | date | YES | | 0000-00-00 | |
| quantity | double | YES | | NULL | |
| autoissue | tinyint(4) | YES | | 0 | |
+-----------------+-------------+------+-----+------------+-------+

All you need is to issue the following command to mysql:

LOAD DATA INFILE "/path/to/your/file/boms.csv"
INTO TABLE bom
COLUMNS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '"'
ESCAPED BY '"'
LINES TERMINATED BY '\n'
IGNORE 1 LINES;

You will need to adjust the line terminator if your file has windows line terminators instead of unix and the last part says to ignore the first line of the file assuming they are headers. Obviously change for your file.

Thanks
Tim


RE: BILL OF MATERIALS - petero@laballieds - 01-20-2016

Thanks Falkona , i will try your approach for now and see the outcome.
#1062 - Duplicate entry 'A008-INT002-W001-1' for key 'PRIMARY', yet i have no duplicate vlue for A008, Any help with this thread


RE: BILL OF MATERIALS - TimSchofield - 01-20-2016

The primary key is

`parent` - A008, `component` - INT002, `workcentreadded` - W001, `location` - 1

Are you saying that you only have one record with these fields/values? If so are you sure you have your line endings correct windows/unix?

Thanks
Tim


RE: BILL OF MATERIALS - petero@laballieds - 01-20-2016

Kindly find attached a part of my bom parent sequence continuos until z001

I added few columns to bom table



RE: BILL OF MATERIALS - agaluski - 01-21-2016

This is a duplicate. Same Parent, Component, Workcenter and location
A008 0 INT002 W001 1 1/6/2016 1/7/2036 0.4 1 TAB 1000 1000 INACT
A008 0 INT002 W001 1 1/6/2016 1/7/2036 1.6 1 TAB 1000 1000 INACT



RE: BILL OF MATERIALS - petero@laballieds - 01-21-2016

Thanks so much Agaluski, it worked, that was the problem. The only problem i have is that in some of the bom setup(that i imported from csv) there is an added empty component when the bom(finished) product is expanded. This list of expanded Bom also displays error :the date format invalid ' when i try to delete the empty component nothing happens, when i try to search bom tablle for empty components nothing any suggestions, otherwise i thank you so much i am a mile ahead now.


RE: BILL OF MATERIALS - TimSchofield - 01-21-2016

One thing I notice in that csv file is that the dates are in the form dd/mm/YYYY. For mysql they should be in the form YYYY-mm-dd - sorry I should have mentioned that when I posted the original query.

Not sure if this is what is causing the issue though,

Tim




RE: BILL OF MATERIALS - petero@laballieds - 01-22-2016

Thanks it worked , i also noticed i had imported some items in the stockmaster with empty stockid.
I have done everything is fine now am guddos alot for ua help i love the easy of use of weberp, Finally am changing the table that displays bom to group by mbflag ie i should see a group of raw materials, finished products, i have appended 'group by stockmaster.mbflag' to the BOM query (i have also described a condition to display full descriptive name- if mbflag eg if mbflag='M' $constant="Finished Product" and display $constant insted of mbflag its working well apart from the grouping issue.
Wink