gsproduction a symfony2 intranet application

This is a project I did at the end of 2013. An old client of mine had to replace a legacy application (build with CA-Clipper in 1995) that replaced my legacy application in 2002 with a new one to suite his current needs in a more human way than the Cobol dos terminal program they were using. The business is a fabric dye facility. The problem is to issue dye orders for each fabric batch they have to process and then input defects of each batch of fabric after the next steps of their production. The true problem is the numerous colors and color dye recipes used to dye the fabrics. Each fabric type, each end customer drives them to use different dye procedure. It is a mission critical application for them, in application failure production line will stop, lost man hours and if they will not meet schedules and delivery times and clients will claim penalties.

Also everything had to be formulated and fixed in selectable lists, yarns, chemicals, vendors, machinery, clients, colors and alternative color codes per client. The idea is that you have to dye a batch of fabric to a given color in a given machine. The program has to choose the right recipe and calculate all chemicals and prompt for a dye procedure. That should be able to be modified by the user for the given batch. Modify procedure, quantities what ever needed.

Hence I was familiar with the case I decided to accept the challenge to have the product ready in 2 months. Without asking them I told them that it would be a web application. I rent for them a small 2 core VPS and started the job. Next decision was if I would code it in symfony 1.4 that I was familiar with, or move (at last) to Symfony 2. I wanted to work with symfony2, so I took the risk. A lot of new things to cope with. Symfony2 it self. Twig, doctrine (I was a propel fan) and bootstrap. The unexpected issue was the development environment. Since that time I was using apache, php and mysql installed on my windows machine without any worries. But after two days I started getting pages rendered in 20 to 40 seconds!! Soon I found my way in virtualBox. Then I had a descent working environment.

I purchased a responsive admin theme from themeforest and started to porting it to twig. Most of the first month was straggling with twig and bootstrap. Symfony didn’t at the time had bootstrap support in forms. Embedded forms was next difficulty, but thanks to all bloggers out there it was solved fast. After solving twig and bootstrap issues the project moved fast. Lots of happy coding days followed. Just for the story I used knp-labs menu and paginator, apy/breadcrumbtrail-bundle and php-excel bundles.

Doctrine after some confusion on relations, it was a charm! In the following image you can see the schema. 45 entities.

gsprod-er

 

Lengthy DQL queries with few extra left joins like the following are running smoothly and fast.

SELECT DISTINCT
fpc.cut_date AS cut_date, fpc.id AS fpcId, fpc.rolls AS rolls,
fpc.weight AS weight, fpc.quantity_total AS q_total, fpc.quantity_good AS q_good,
fpc.quantity_total - fpc.quantity_good AS q_bad,
fpc.item_deflection AS i_deflection,
fpc.item_weight AS i_weight, fpc.sb_item_weight AS sb_i_weight, fpc.item_weight_deflection AS iw_deflection,
fpc.bad_cat_1 AS bad_1,fpc.bad_cat_2 AS bad_2,fpc.bad_cat_3 AS bad_3,
fp.id AS fpId,
c.code AS color,
f.id AS fId, f.title AS fabric,
y1.title AS yarn1,
y2.title AS yarn2,
y3.title AS yarn3,
dm.code AS dmachine,
km.code AS kmachine,
cl.title AS client
FROM SlxGsprodBundle:FabricPortionCut fpc
JOIN fpc.fabric_portion fp
LEFT JOIN fp.fabric f
LEFT JOIN fp.color AS c
LEFT JOIN fp.yarn1 y1
LEFT JOIN fp.yarn2 y2
LEFT JOIN fp.yarn3 y3
LEFT JOIN fp.yarnOrigin1 yo1
LEFT JOIN fp.yarnOrigin2 yo2
LEFT JOIN fp.yarnOrigin3 yo3
LEFT JOIN fp.dmachine dm
LEFT JOIN fp.kmachine km
LEFT JOIN fp.orderer cl
LEFT JOIN fpc.fabric_patron pt
LEFT JOIN fpc.fabricPortionCutDefects AS fpcd
WHERE %where%

 

Beside bootstrap and the goodies delivered from the theme, jquery-ui input mask, multiselect, uniform and the exceptional select2 javascripts were used. So nice complex forms like the following were created and worked perfectly!

GsProduction - Μεταβολή 2015-04-26 20-24-36Also nice modal popups included

GsProduction - Εντολή 2015-04-26 20-26-55The bottom line is that after the first month of 12 hours per day work, reading and searching the project moved fast and smooth. When I delivered the first full working version of project in time, my clients were surprised that the delivery time was the one I estimated when I got the job. Their worries about the response of the application (because it was web app and not desktop) were vanished after the first contact. At the time of writing the application is still in production and my happy customers got used to have web application that they use their tablets from home to get the job done!