Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
cli:franke:shared_data [2018/08/27 12:15] f.zoppini [Entity] |
cli:franke:shared_data [2018/08/27 14:01] (current) f.zoppini [Sample queries] |
||
|---|---|---|---|
| Line 2: | Line 2: | ||
| ==== Database access: technical information ==== | ==== Database access: technical information ==== | ||
| ^DB Server | 10.100.145.20 (fkt20g.fa.franke.world) | | ^DB Server | 10.100.145.20 (fkt20g.fa.franke.world) | | ||
| - | ^SB Server Port |5432| | + | ^DB Server Port |5432| |
| ^DBMS | Postgresql| | ^DBMS | Postgresql| | ||
| ^ODBC Driver | [[https:// | ^ODBC Driver | [[https:// | ||
| ^Database name|andon_FWK| | ^Database name|andon_FWK| | ||
| - | ^Username|(readonly)| | + | ^Database schema|shareddata| |
| - | ^Password|| | + | ^Username| |
| + | ^Password| | ||
| ==== E-R diagram ==== | ==== E-R diagram ==== | ||
| Line 13: | Line 14: | ||
| ==== Data dictionary ==== | ==== Data dictionary ==== | ||
| - | === Entity | + | === Entities |
| ^ Entity | ^ Entity | ||
| ^ Name ^ Description | ^ Name ^ Description | ||
| Line 34: | Line 35: | ||
| | | |oracr|Time of the tracked production unit (HH: | | | |oracr|Time of the tracked production unit (HH: | ||
| ^ ^ ^ ^ ^ ^ ^ | ^ ^ ^ ^ ^ ^ ^ | ||
| - | | **causanc** |**Non compliant causes list**|__codice__|Cause unique identifier|varchar| | + | | **qcausanc** |**Non compliant causes list**|__codice__|Cause unique identifier|varchar| |
| | | |descrizio|Cause description|varchar| | | | | |descrizio|Cause description|varchar| | | ||
| ^ ^ ^ ^ ^ ^ ^ | ^ ^ ^ ^ ^ ^ ^ | ||
| - | | **causafm** |**Downtime causes list**|__codice__|Downtime unique identifier|varchar| | + | | **qcausafm** |**Downtime causes list**|__codice__|Downtime unique identifier|varchar| |
| | | |descrizio|Downtime description of the monitored resource|varchar| | | | | |descrizio|Downtime description of the monitored resource|varchar| | | ||
| | | |tipofm|Downtime type: F = unplanned downtime, M = microstop, P = planned downtime|varchar| | | | | |tipofm|Downtime type: F = unplanned downtime, M = microstop, P = planned downtime|varchar| | | ||
| | | |setup|Downtime for setup reason (flag): 1 = setup kind, 0 = general downtime|integer| | | | | |setup|Downtime for setup reason (flag): 1 = setup kind, 0 = general downtime|integer| | | ||
| + | === Relationships === | ||
| + | ^ Relationship | ||
| + | ^ Name ^ Description | ||
| + | ^ ^ ^ ^ Name ^ Description | ||
| + | | **regprod** |**Each row refers to a production event**| | ||
| + | | | | |ora|Event time (HH: | ||
| + | | | | |tm|Event Time Epoch|long| | ||
| + | | | | |qta|Number of produced items|double| | ||
| + | ^ ^ ^ ^ ^ ^ ^ | ||
| + | | **regnc** |**Each row refers to a non compliant production event**| | ||
| + | | | | |ora|Event time (HH: | ||
| + | | | | |tm|Event Time Epoch|long| | ||
| + | | | | |qta|Number of non compliant produced items|double| | ||
| + | ^ ^ ^ ^ ^ ^ ^ | ||
| + | | **regfm** |**Each row refers to a begin or an end of a downtime**| | ||
| + | | | | |ora|Event time (HH: | ||
| + | | | | |tm|Event Time Epoch|long| | ||
| + | | | | |tmdiff|Time difference from end and begin of the downtime events|long| | ||
| + | | | | |tipoevento|Downtime event type: INFM=downtime start, FIFM=donwtime end|long| | ||
| + | |||
| + | ==== Logical scheme ==== | ||
| + | ^Table^Foreign keys^ | ||
| + | |**prodline**(__codice__, | ||
| + | |**unitprod**(__codice__, | ||
| + | |**causanc**(__codice__, | ||
| + | |**causafm**(__codice__, | ||
| + | |**regprod**(__codice__, | ||
| + | |**regnc**(__codice__, | ||
| + | |**regfm**(__codice__, | ||
| + | ==== Sample queries ==== | ||
| + | Produced items on June 18th 2018 with date, time, unique identifier, production resource description, | ||
| + | <code sql> | ||
| + | SELECT DATA, ora, codlot, prodline.descrizio AS linea, prodline.descrep, | ||
| + | INNER JOIN shareddata.prodline ON prodline.codice=shareddata.regprod.codubi | ||
| + | INNER JOIN shareddata.unitprod ON unitprod.codice=shareddata.regprod.codlot | ||
| + | WHERE DATA=' | ||
| + | ORDER BY tm | ||
| + | </ | ||
| + | Count produced items after June 18th 2018 (included) grouped by day, article code and work order on production resource 821102A (DMG LB) | ||
| + | <code sql> | ||
| + | select data, unitprod.dart, | ||
| + | inner join shareddata.unitprod on shareddata.unitprod.codice=shareddata.regprod.codlot | ||
| + | where regprod.codubi=' | ||
| + | group by data, dart, procord | ||
| + | </ | ||
| + | Get the DMG LB (821102A) downtime events list from 06:00 to 14:00 of June 18th 2018 with date, time, duration in minutes, event type, downtime cause description, | ||
| + | <code sql> | ||
| + | select data, ora, tmdiff/60 as dtm, tipoevento, qcausafm.descrizio as dfermo, qcausafm.tipofm, | ||
| + | inner join shareddata.qcausafm on shareddata.qcausafm.codice=regfm.caufm | ||
| + | where codubi=' | ||
| + | order by tm | ||
| + | </ | ||