Merge branch 'dev'
This commit is contained in:
commit
586f759d77
|
@ -7,3 +7,4 @@
|
||||||
/vendor/
|
/vendor/
|
||||||
/phpunit/coverage
|
/phpunit/coverage
|
||||||
.vscode
|
.vscode
|
||||||
|
TODO
|
|
@ -426,7 +426,7 @@
|
||||||
|
|
||||||
/* RETOURNE LA LISTE DES MODULE D'UN GROUPE DE MACHINES
|
/* RETOURNE LA LISTE DES MODULE D'UN GROUPE DE MACHINES
|
||||||
*
|
*
|
||||||
* @id_cluster<int> UID du groupe de machine
|
* @id_machine_cluster<int> UID du groupe de machine
|
||||||
*
|
*
|
||||||
* @return modules<Array> Liste des modules autorisés pour le groupe de machines
|
* @return modules<Array> Liste des modules autorisés pour le groupe de machines
|
||||||
*
|
*
|
||||||
|
@ -438,9 +438,9 @@
|
||||||
/* [1] On récupère les modules
|
/* [1] On récupère les modules
|
||||||
=========================================================*/
|
=========================================================*/
|
||||||
/* (1) Récupération */
|
/* (1) Récupération */
|
||||||
$mod_req = new Repo('module/getByMachineCluster', [
|
$mod_req = new Repo('module/getForMachineCluster', [
|
||||||
$_SESSION['WAREHOUSE']['id'],
|
$_SESSION['WAREHOUSE']['id'],
|
||||||
$id_cluster
|
$id_machine_cluster
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$answer = $mod_req->answer();
|
$answer = $mod_req->answer();
|
||||||
|
@ -457,6 +457,44 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* RETOURNE LES E-TREES D'UN GROUPE DE MACHINES
|
||||||
|
*
|
||||||
|
* @id_machine_cluster<int> UID du groupe de machine
|
||||||
|
*
|
||||||
|
* @return etrees<Array> E-trees du groupe de machines
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static function getEtrees($params){
|
||||||
|
extract($params);
|
||||||
|
|
||||||
|
|
||||||
|
/* [1] On récupère les modules
|
||||||
|
=========================================================*/
|
||||||
|
/* (1) Récupération */
|
||||||
|
$mod_req = new Repo('etree/getForMachineCluster', [
|
||||||
|
$_SESSION['WAREHOUSE']['id'],
|
||||||
|
$id_machine_cluster
|
||||||
|
]);
|
||||||
|
|
||||||
|
$answer = $mod_req->answer();
|
||||||
|
|
||||||
|
/* (2) Gestion erreur */
|
||||||
|
if( $answer === false )
|
||||||
|
return ['error' => new Error(Err::NoMatchFound)]; // no error
|
||||||
|
|
||||||
|
|
||||||
|
/* [3] On retourne la liste
|
||||||
|
=========================================================*/
|
||||||
|
return [ 'etrees' => $answer ];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -481,7 +481,7 @@
|
||||||
$sorted_actions[$action['timeout']][] = [
|
$sorted_actions[$action['timeout']][] = [
|
||||||
'id_action' => intval($action['id_action']),
|
'id_action' => intval($action['id_action']),
|
||||||
'name' => strtolower($action['name']),
|
'name' => strtolower($action['name']),
|
||||||
'previous' => $action['previous'],
|
'required' => $action['required'],
|
||||||
'action' => $action['action']
|
'action' => $action['action']
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -495,20 +495,17 @@
|
||||||
|
|
||||||
/* [4] On récupère la liste des MODULES (puces)
|
/* [4] On récupère la liste des MODULES (puces)
|
||||||
=========================================================*/
|
=========================================================*/
|
||||||
$chipsReq = new Repo('chip/getAll', [$_SESSION['WAREHOUSE']['id']]);
|
$chipsReq = new Repo('chip/getForMachine', [$_SESSION['WAREHOUSE']['id'], $id_machine]);
|
||||||
$chips = ($chipsReq->error->get()==Err::Success) ? $chipsReq->answer() : [];
|
$chips = ($chipsReq->error->get()==Err::Success) ? $chipsReq->answer() : [];
|
||||||
|
|
||||||
|
|
||||||
foreach($chips as $c=>$chip){
|
foreach($chips as $c=>$chip){
|
||||||
/* [5] On récupére la liste des PINS de chaque PUCE
|
/* [5] On récupére la liste des PINS de chaque PUCE
|
||||||
=========================================================*/
|
=========================================================*/
|
||||||
$pinsReq = new Repo('pin_merge/getByIdChip', [$chip['id_chip']]);
|
$chips[$c]['pins'] = explode(',', $chip['pins']);
|
||||||
$pins = ($pinsReq->error->get()==Err::Success) ? $pinsReq->answer() : [];
|
|
||||||
|
|
||||||
$chips[$c]['pins'] = [];
|
|
||||||
foreach($pins as $p=>$pin)
|
|
||||||
$chips[$c]['pins'][$p] = intval($pin['pin']);
|
|
||||||
|
|
||||||
|
if( !is_array($chip['pins']) )
|
||||||
|
$chips[$c]['pins'] = [];
|
||||||
|
|
||||||
/* [6] On récupère valeurs pour chaque état de chaque PUCE
|
/* [6] On récupère valeurs pour chaque état de chaque PUCE
|
||||||
=========================================================*/
|
=========================================================*/
|
||||||
|
@ -520,7 +517,7 @@
|
||||||
// On met en forme les données : "val1,val2,val3" -> [val1, val2, val3]
|
// On met en forme les données : "val1,val2,val3" -> [val1, val2, val3]
|
||||||
foreach($states as $s=>$state){
|
foreach($states as $s=>$state){
|
||||||
|
|
||||||
$chips[$c]['states'][$state['state']] = explode(',', $state['pin_values']);
|
$chips[$c]['states'][$state['state']] = explode(',', $state['values']);
|
||||||
foreach($chips[$c]['states'][$state['state']] as $s2=>$state2)
|
foreach($chips[$c]['states'][$state['state']] as $s2=>$state2)
|
||||||
$chips[$c]['states'][$state['state']][$s2] = intval($state2);
|
$chips[$c]['states'][$state['state']][$s2] = intval($state2);
|
||||||
}
|
}
|
||||||
|
@ -543,6 +540,7 @@
|
||||||
foreach($permissions as $p=>$permission){
|
foreach($permissions as $p=>$permission){
|
||||||
$actionList = explode(',', $permission['id_action']);
|
$actionList = explode(',', $permission['id_action']);
|
||||||
|
|
||||||
|
|
||||||
foreach($actionList as $a=>$action)
|
foreach($actionList as $a=>$action)
|
||||||
$actionList[$a] = intval($action);
|
$actionList[$a] = intval($action);
|
||||||
|
|
||||||
|
@ -555,6 +553,49 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* [6] On envoie les e-tree de la machine
|
||||||
|
=========================================================*/
|
||||||
|
$etrees = [];
|
||||||
|
|
||||||
|
/* (1) On essaie de récupérer les etree de la machine*/
|
||||||
|
$mc_req = new Request('machineDefault/getClusters', ['id_machine' => $id_machine]);
|
||||||
|
|
||||||
|
$mc_res = $mc_req->dispatch();
|
||||||
|
|
||||||
|
/* (2) Si on arrive à récupérer les clusters */
|
||||||
|
if( $mc_res->error->get() == Err::Success ){
|
||||||
|
|
||||||
|
/* (3) Pour chaque cluster, on récupère les e-trees */
|
||||||
|
foreach($mc_res->get('clusters') as $cluster){
|
||||||
|
|
||||||
|
/* (4) On les e-trees du cluster */
|
||||||
|
$etree_req = new Request('clusterDefault/getEtrees', [
|
||||||
|
'id_machine_cluster' => $cluster['id_machine_cluster']
|
||||||
|
]);
|
||||||
|
|
||||||
|
$etree_res = $etree_req->dispatch();
|
||||||
|
|
||||||
|
/* (5) Si erreur, on passe */
|
||||||
|
if( $etree_res->error->get() != Err::Success )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
/* (6) Sinon -> On entregistre les e-trees */
|
||||||
|
foreach($etree_res->get('etrees') as $etree){
|
||||||
|
$etree_value = $etree['name'].'-'.$etree['daemon'];
|
||||||
|
|
||||||
|
/* (7) Si pas déja entregistré -> on l'ajoute */
|
||||||
|
if( !in_array($etrees, $etree_name) )
|
||||||
|
$etrees[] = $etree_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* [N] Retourne les données
|
/* [N] Retourne les données
|
||||||
|
@ -563,7 +604,8 @@
|
||||||
'actions' => $sorted_actions,
|
'actions' => $sorted_actions,
|
||||||
'states' => $globalStates,
|
'states' => $globalStates,
|
||||||
'chips' => $chips,
|
'chips' => $chips,
|
||||||
'permissions' => $indexed_permissions
|
'permissions' => $indexed_permissions,
|
||||||
|
'etrees' => $etrees
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,16 +11,59 @@
|
||||||
protected static function table_name(){ static $table_name = 'chip'; return $table_name; }
|
protected static function table_name(){ static $table_name = 'chip'; return $table_name; }
|
||||||
|
|
||||||
|
|
||||||
/* RENVOIE LA LISTE DES CARTES/PUCES DISPONIBLES EN FONCTION DES MODULES DE L'ENTREPOT
|
/* RENVOIE LA LISTE DES CARTES/PUCES DISPONIBLES EN FONCTION DES MODULES DU GROUPE DE MACHINE
|
||||||
|
*
|
||||||
|
* @id_warehouse<int> UID de l'entrepot
|
||||||
|
* @id_machine<int> UID de la machine
|
||||||
*
|
*
|
||||||
* @return chips<Array> Liste des puces/cartes disponibles
|
* @return chips<Array> Liste des puces/cartes disponibles
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static function getAll($id_warehouse){
|
public static function getForMachine($id_warehouse, $id_machine){
|
||||||
/* [1] On récupère les modules de l'entrepot courant
|
|
||||||
=========================================================*/
|
/* (1) On récupère les groupes de la machine
|
||||||
$module_merge = Table::get('module_merge')
|
---------------------------------------------------------*/
|
||||||
->whereIdWarehouse(7);
|
$get_clus = new Repo('machine/getClusters', [$id_warehouse, $id_machine]);
|
||||||
|
|
||||||
|
$clusters = $get_clus->answer();
|
||||||
|
|
||||||
|
if( $clusters === false )
|
||||||
|
return [];
|
||||||
|
|
||||||
|
|
||||||
|
/* (2) On récupère les modules associés aux clusters
|
||||||
|
---------------------------------------------------------*/
|
||||||
|
$module_ids = [];
|
||||||
|
|
||||||
|
foreach($clusters as $cluster){
|
||||||
|
|
||||||
|
$get_mods = new Repo('module/getForMachineCluster', [$id_warehouse, $cluster['id_machine_cluster']]);
|
||||||
|
|
||||||
|
$mods = $get_mods->answer();
|
||||||
|
|
||||||
|
// si pas déja -> on ajoute l'id module à la liste
|
||||||
|
if( is_array($mods) && !in_array($mods['id_module'], $module_ids) )
|
||||||
|
$module_ids[] = $mods['id_module'];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* (3) On récupère la liste des CHIPS
|
||||||
|
---------------------------------------------------------*/
|
||||||
|
$chips = [];
|
||||||
|
foreach($module_ids as $module_id){
|
||||||
|
|
||||||
|
$chip_req = Table::get('chip')
|
||||||
|
->select('*')
|
||||||
|
->whereIdModule($module_id);
|
||||||
|
|
||||||
|
$fetched = $chip_req->fetch();
|
||||||
|
|
||||||
|
// only one by ids
|
||||||
|
$chips[$fetched['id_chip']] = $fetched;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$chip = Table::get('chip')
|
$chip = Table::get('chip')
|
||||||
|
|
|
@ -0,0 +1,202 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace database\repo;
|
||||||
|
use \database\core\DatabaseDriver;
|
||||||
|
use \error\core\Err;
|
||||||
|
use \database\core\Repo;
|
||||||
|
use \orm\core\Table;
|
||||||
|
use \orm\core\Rows;
|
||||||
|
|
||||||
|
class etree extends parentRepo{
|
||||||
|
|
||||||
|
protected static function table_name(){ static $table_name = 'etree'; return $table_name; }
|
||||||
|
|
||||||
|
/* [1] Fetch all etrees for the given machine_cluster
|
||||||
|
*
|
||||||
|
* @id_warehouse<int> UID of the given warehouse
|
||||||
|
* @id_machine_cluster<int> UID of the given machine_cluster
|
||||||
|
*
|
||||||
|
* @return etrees<Array> The list of etrees
|
||||||
|
* FALSE on error
|
||||||
|
*
|
||||||
|
=========================================================*/
|
||||||
|
public static function getForMachineCluster($id_warehouse, $id_machine_cluster){
|
||||||
|
|
||||||
|
/* (1) On récupère le ETREE de la machine
|
||||||
|
---------------------------------------------------------*/
|
||||||
|
$module = Table::get('module')
|
||||||
|
->select('id_module')
|
||||||
|
->select('name');
|
||||||
|
|
||||||
|
$etree = Table::get('etree')
|
||||||
|
->select('id_etree')
|
||||||
|
->select('daemon')
|
||||||
|
->join('id_module', $module);
|
||||||
|
|
||||||
|
$merge = Table::get('module_merge')
|
||||||
|
->join('id_etree', $etree)
|
||||||
|
->whereIdWarehouse($id_warehouse)
|
||||||
|
->whereIdMachineCluster($id_machine_cluster);
|
||||||
|
|
||||||
|
return $merge->fetch();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* [4] Adds a module to machine cluster of a warehouse
|
||||||
|
*
|
||||||
|
* @id_warehouse<int> UID of the given warehouse
|
||||||
|
* @id_machine_cluster<int> UID of the given machine_cluster
|
||||||
|
* @id_module UID of the given module
|
||||||
|
*
|
||||||
|
* @return status<bool> TRUE on success
|
||||||
|
*
|
||||||
|
=========================================================*/
|
||||||
|
public static function link($id_warehouse, $id_machine_cluster, $id_module){
|
||||||
|
|
||||||
|
/* (1) Check module
|
||||||
|
---------------------------------------------------------*/
|
||||||
|
/* (1) Check if module exists (by its id) */
|
||||||
|
$module = Table::get('module')
|
||||||
|
->select('*')
|
||||||
|
->unique()
|
||||||
|
->whereId($id_module);
|
||||||
|
|
||||||
|
if( !$module->fetch() )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
/* (2) Check if the module is allowed in the warehouse */
|
||||||
|
$module_m = Table::get('module_availability')
|
||||||
|
->select('*')
|
||||||
|
->unique()
|
||||||
|
->whereIdWarehouse($id_warehouse)
|
||||||
|
->whereIdModule($id_module);
|
||||||
|
|
||||||
|
// if not allowed in the warehouse -> error
|
||||||
|
if( !$module->fetch() )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
|
||||||
|
/* (2) Check machine_cluster
|
||||||
|
---------------------------------------------------------*/
|
||||||
|
/* (1) Check if machine_cluster exists (by its id) */
|
||||||
|
$machine_cluster = Table::get('machine_cluster')
|
||||||
|
->select('*')
|
||||||
|
->unique()
|
||||||
|
->whereIdWarehouse($id_warehouse)
|
||||||
|
->whereId($id_machine_cluster);
|
||||||
|
|
||||||
|
if( !$machine_cluster->fetch() )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
/* (2) Check link does not already exists */
|
||||||
|
$exists = Table::get('module_merge')
|
||||||
|
->select('*')
|
||||||
|
->unique()
|
||||||
|
->whereIdWarehouse($id_warehouse)
|
||||||
|
->whereIdMachineCluster($id_machine_cluster)
|
||||||
|
->whereIdModule($id_module);
|
||||||
|
|
||||||
|
if( !!$exists->fetch() )
|
||||||
|
return true; // returns all right (even if nothing done)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* (3) Create link
|
||||||
|
---------------------------------------------------------*/
|
||||||
|
$inserted = Table::get('module_merge')->insert([
|
||||||
|
'id_warehouse' => $id_warehouse,
|
||||||
|
'id_module' => $id_module,
|
||||||
|
'id_machine_cluster' => $id_machine_cluster
|
||||||
|
]);
|
||||||
|
|
||||||
|
// return TRUE only if PDO insert successful
|
||||||
|
return $inserted;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* [5] Removes a module from machine cluster of a warehouse
|
||||||
|
*
|
||||||
|
* @id_warehouse<int> UID of the given warehouse
|
||||||
|
* @id_machine_cluster<int> UID of the given machine_cluster
|
||||||
|
* @id_module UID of the given module
|
||||||
|
*
|
||||||
|
* @return status<bool> TRUE on success
|
||||||
|
*
|
||||||
|
=========================================================*/
|
||||||
|
public static function unlink($id_warehouse, $id_machine_cluster, $id_module){
|
||||||
|
|
||||||
|
/* (1) Check module
|
||||||
|
---------------------------------------------------------*/
|
||||||
|
/* (1) Check if module exists (by its id) */
|
||||||
|
$module = Table::get('module')
|
||||||
|
->select('*')
|
||||||
|
->unique()
|
||||||
|
->whereId($id_module);
|
||||||
|
|
||||||
|
if( !$module->fetch() )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* (2) Check machine_cluster
|
||||||
|
---------------------------------------------------------*/
|
||||||
|
/* (1) Check if machine_cluster exists (by its id) */
|
||||||
|
$machine_cluster = Table::get('machine_cluster')
|
||||||
|
->select('*')
|
||||||
|
->unique()
|
||||||
|
->whereIdWarehouse($id_warehouse)
|
||||||
|
->whereId($id_machine_cluster);
|
||||||
|
|
||||||
|
if( !$machine_cluster->fetch() )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
/* (2) Check if link already exists */
|
||||||
|
$exists = Table::get('module_merge')
|
||||||
|
->select('*')
|
||||||
|
->unique()
|
||||||
|
->whereIdWarehouse($id_warehouse)
|
||||||
|
->whereIdMachineCluster($id_machine_cluster)
|
||||||
|
->whereIdModule($id_module);
|
||||||
|
|
||||||
|
if( !$exists->fetch() )
|
||||||
|
return false; // returns all right (even if nothing done)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* (3) Remove link
|
||||||
|
---------------------------------------------------------*/
|
||||||
|
$deleted = Table::get('module_merge')
|
||||||
|
->whereIdWarehouse($id_warehouse)
|
||||||
|
->whereIdModule($id_module)
|
||||||
|
->whereIdMachineCluster($id_machine_cluster)
|
||||||
|
->delete();
|
||||||
|
|
||||||
|
// return TRUE only if PDO delete successful
|
||||||
|
return $deleted;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
|
@ -37,7 +37,7 @@
|
||||||
* FALSE on error
|
* FALSE on error
|
||||||
*
|
*
|
||||||
=========================================================*/
|
=========================================================*/
|
||||||
public static function getByWarehouse($id_warehouse){
|
public static function getForWarehouse($id_warehouse){
|
||||||
|
|
||||||
/* (1) Build request */
|
/* (1) Build request */
|
||||||
$modules = Table::get('module')->select('*');
|
$modules = Table::get('module')->select('*');
|
||||||
|
@ -63,14 +63,21 @@
|
||||||
* FALSE on error
|
* FALSE on error
|
||||||
*
|
*
|
||||||
=========================================================*/
|
=========================================================*/
|
||||||
public static function getByMachineCluster($id_warehouse, $id_machine_cluster){
|
public static function getForMachineCluster($id_warehouse, $id_machine_cluster){
|
||||||
|
|
||||||
/* (1) Build request */
|
/* (1) On récupère le ETREE de la machine
|
||||||
$modules = Table::get('module')->select('*');
|
---------------------------------------------------------*/
|
||||||
$merge = Table::get('module_merge')
|
$module = Table::get('module')
|
||||||
|
->select('id_module')
|
||||||
|
->select('name');
|
||||||
|
|
||||||
|
$etree = Table::get('etree')
|
||||||
|
->join('id_module', $module);
|
||||||
|
|
||||||
|
$merge = Table::get('module_merge')
|
||||||
|
->join('id_etree', $etree)
|
||||||
->whereIdWarehouse($id_warehouse)
|
->whereIdWarehouse($id_warehouse)
|
||||||
->whereIdMachineCluster($id_machine_cluster);
|
->whereIdMachineCluster($id_machine_cluster);
|
||||||
$merge->join('id_module', $modules);
|
|
||||||
|
|
||||||
return $merge->fetch();
|
return $merge->fetch();
|
||||||
|
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace database\repo;
|
|
||||||
use \database\core\DatabaseDriver;
|
|
||||||
use \database\core\Repo;
|
|
||||||
use \manager\repo\cluster as clusterRepo;
|
|
||||||
|
|
||||||
class pin_merge extends parentRepo{
|
|
||||||
|
|
||||||
protected static function table_name(){ static $table_name = 'pin_merge'; return $table_name; }
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
?>
|
|
|
@ -14,22 +14,21 @@
|
||||||
*
|
*
|
||||||
* @id_chip<int> UID de la puce
|
* @id_chip<int> UID de la puce
|
||||||
*
|
*
|
||||||
* @return states<Array> Retourne les données sous forme de tableau de la forme (state, chip, pin, value)
|
* @return states<Array> Retourne les données sous forme de tableau de la forme (state, chip, pin, value)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static function getForChip($id_chip){
|
public static function getForChip($id_chip){
|
||||||
|
|
||||||
$req = DatabaseDriver::getPDO()->prepare("SELECT s.state, pm.id_chip, GROUP_CONCAT(s.value ORDER BY pm.pin ASC) as pin_values
|
$chip = Table::get('chip')
|
||||||
FROM state as s, pin_merge as pm
|
->select('id_chip')
|
||||||
WHERE s.id_pin_merge = pm.id_pin_merge
|
->whereId($id_chip);
|
||||||
AND pm.id_chip = :id_chip
|
|
||||||
GROUP BY s.state, pm.id_chip");
|
|
||||||
$req->execute([
|
|
||||||
':id_chip' => $id_chip
|
|
||||||
]);
|
|
||||||
|
|
||||||
|
$req = Table::get('state')
|
||||||
|
->select('state')
|
||||||
|
->select('value')
|
||||||
|
->join('id_chip', $chip);
|
||||||
|
|
||||||
return $req->fetchAll();
|
return $req->fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,7 +99,7 @@
|
||||||
/* [1] On récupère les modules
|
/* [1] On récupère les modules
|
||||||
=========================================================*/
|
=========================================================*/
|
||||||
/* (1) Récupération */
|
/* (1) Récupération */
|
||||||
$mod_req = new Repo('module/getByWarehouse', [$id_warehouse]);
|
$mod_req = new Repo('module/getForWarehouse', [$id_warehouse]);
|
||||||
|
|
||||||
$answer = $mod_req->answer();
|
$answer = $mod_req->answer();
|
||||||
|
|
||||||
|
|
|
@ -61,16 +61,17 @@
|
||||||
}));
|
}));
|
||||||
|
|
||||||
$twig->addFunction(new \Twig_Function('f_options', function($id_cluster){
|
$twig->addFunction(new \Twig_Function('f_options', function($id_cluster){
|
||||||
$modReq = new Request('clusterDefault/getModules', [
|
$modReq = new Request('clusterDefault/getEtrees', [
|
||||||
'id_cluster' => (int) $id_cluster
|
'id_machine_cluster' => (int) $id_cluster
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$modRes = $modReq->dispatch();
|
$modRes = $modReq->dispatch();
|
||||||
|
|
||||||
// si erreur, on affiche rien par défaut
|
// si erreur, on affiche rien par défaut
|
||||||
if( $modRes->error->get() != Err::Success )
|
if( $modRes->error->get() != Err::Success )
|
||||||
return [];
|
return [];
|
||||||
|
|
||||||
return $modRes->get('modules');
|
return $modRes->get('etrees');
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -62,9 +62,9 @@
|
||||||
|
|
||||||
<span class='option'>
|
<span class='option'>
|
||||||
{{ p_icon.option | raw }}
|
{{ p_icon.option | raw }}
|
||||||
{% for option in f_options(id_machine_cluster) %}
|
{% for option in f_options(machine_cluster.id_machine_cluster) %}
|
||||||
<span class='ignore'>
|
<span class='ignore'>
|
||||||
<span>{{ option.name }}</span>
|
<span>{{ option.name }}:{{ option.daemon }}</span>
|
||||||
</span>
|
</span>
|
||||||
{% else %}
|
{% else %}
|
||||||
<span class='ignore'>Aucune option</span>
|
<span class='ignore'>Aucune option</span>
|
||||||
|
|
|
@ -62,16 +62,17 @@
|
||||||
}));
|
}));
|
||||||
|
|
||||||
$twig->addFunction(new \Twig_Function('f_options', function($id_cluster){
|
$twig->addFunction(new \Twig_Function('f_options', function($id_cluster){
|
||||||
$modReq = new Request('clusterDefault/getModules', [
|
$modReq = new Request('clusterDefault/getEtrees', [
|
||||||
'id_cluster' => (int) $id_cluster
|
'id_machine_cluster' => (int) $id_cluster
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$modRes = $modReq->dispatch();
|
$modRes = $modReq->dispatch();
|
||||||
|
|
||||||
// si erreur, on affiche rien par défaut
|
// si erreur, on affiche rien par défaut
|
||||||
if( $modRes->error->get() != Err::Success )
|
if( $modRes->error->get() != Err::Success )
|
||||||
return [];
|
return [];
|
||||||
|
|
||||||
return $modRes->get('modules');
|
return $modRes->get('etrees');
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
{{ p_icon.option | raw }}
|
{{ p_icon.option | raw }}
|
||||||
{% for option in f_options(cluster.id_machine_cluster) %}
|
{% for option in f_options(cluster.id_machine_cluster) %}
|
||||||
<span class='ignore'>
|
<span class='ignore'>
|
||||||
<span>{{ option.name }}</span>
|
<span>{{ option.name }}:{{ option.daemon }}</span>
|
||||||
</span>
|
</span>
|
||||||
{% else %}
|
{% else %}
|
||||||
<span class='ignore'>Aucune option</span>
|
<span class='ignore'>Aucune option</span>
|
||||||
|
|
|
@ -1,18 +1,6 @@
|
||||||
{
|
{
|
||||||
|
|
||||||
"module": {
|
"module": {
|
||||||
"POST::method": {
|
|
||||||
"description": "Test de l'API",
|
|
||||||
"permissions": [["warehouse"]],
|
|
||||||
"parameters": {}
|
|
||||||
},
|
|
||||||
|
|
||||||
"POST::markdown": {
|
|
||||||
"description": "Retourne une description en markdown des différents modules de l'API",
|
|
||||||
"permissions": [["admin"]],
|
|
||||||
"options": { "download": true },
|
|
||||||
"parameters": {}
|
|
||||||
},
|
|
||||||
|
|
||||||
"POST::apiBlueprint": {
|
"POST::apiBlueprint": {
|
||||||
"description": "Retourne une documentation de l'API au format API Blueprint.",
|
"description": "Retourne une documentation de l'API au format API Blueprint.",
|
||||||
|
@ -20,40 +8,7 @@
|
||||||
"options": { "download": true },
|
"options": { "download": true },
|
||||||
"parameters": {}
|
"parameters": {}
|
||||||
}
|
}
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
"upload": {
|
|
||||||
|
|
||||||
"POST::call_log": {
|
|
||||||
"description": "Upload d'un journal d'appel au format .xml. Retour des données de call_log/unserialize",
|
|
||||||
"permissions": [["admin"]],
|
|
||||||
"parameters": {
|
|
||||||
"file": { "description": "Fichier du journal d'appel.", "type": "FILE" }
|
|
||||||
},
|
|
||||||
"output": {
|
|
||||||
"tmp_id": { "description": "Identifiant temporaire du journal d'appel", "type": "varchar(40,40)" },
|
|
||||||
"directory": { "description": "Annuaire des contacts trouvés", "type": "array<array<mixed>>" },
|
|
||||||
"call": { "description": "Liste des identifiants des contacts triés par nombre d'appels", "type": "array<id>" },
|
|
||||||
"sms": { "description": "Liste des identifiants des contacts triés par nombre de sms", "type": "array<id>" }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
"download": {
|
|
||||||
|
|
||||||
"POST::multiple": {
|
|
||||||
"description": "Download des données relatives aux sujets donnés.",
|
|
||||||
"permissions": [["admin"]],
|
|
||||||
"options": { "download": true },
|
|
||||||
"parameters": {
|
|
||||||
"subjects": { "description": "Identifiants des sujets d'enquêtes à intégrer.", "type": "array<id>", "optional": true },
|
|
||||||
"phone": { "description": "Si vaut TRUE, renvoie les sujets cellulaires.", "type": "boolean", "optional": true },
|
|
||||||
"facebook": { "description": "Si vaut TRUE, renvoie les sujet facebook.", "type": "boolean", "optional": true },
|
|
||||||
"survey": { "description": "Si vaut TRUE, renvoie les sujets ResTIC.", "type": "boolean", "optional": true },
|
|
||||||
"all": { "description": "Si vaut TRUE, renvoie tous les sujets enregistrés.", "type": "boolean", "optional": true }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
@ -509,11 +464,22 @@
|
||||||
"description": "Retourne les modules d'un groupe de machines",
|
"description": "Retourne les modules d'un groupe de machines",
|
||||||
"permissions": [["admin"]],
|
"permissions": [["admin"]],
|
||||||
"parameters": {
|
"parameters": {
|
||||||
"id_cluster": { "description": "UID du groupe de machines", "type": "id" }
|
"id_machine_cluster": { "description": "UID du groupe de machines", "type": "id" }
|
||||||
},
|
},
|
||||||
"output": {
|
"output": {
|
||||||
"modules": { "description": "Modules du groupe", "type": "array<mixed>" }
|
"modules": { "description": "Modules du groupe", "type": "array<mixed>" }
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
"POST::getEtrees": {
|
||||||
|
"description": "Retourne les e-trees d'un groupe de machines",
|
||||||
|
"permissions": [["admin"]],
|
||||||
|
"parameters": {
|
||||||
|
"id_machine_cluster": { "description": "UID du groupe de machines", "type": "id" }
|
||||||
|
},
|
||||||
|
"output": {
|
||||||
|
"etrees": { "description": "E-trees du groupe", "type": "array<mixed>" }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
|
@ -2,12 +2,16 @@
|
||||||
|
|
||||||
"module": [
|
"module": [
|
||||||
"getAll",
|
"getAll",
|
||||||
"getByWarehouse",
|
"getForWarehouse",
|
||||||
"getByMachineCluster",
|
"getForMachineCluster",
|
||||||
"link",
|
"link",
|
||||||
"unlink"
|
"unlink"
|
||||||
],
|
],
|
||||||
|
|
||||||
|
"etree": [
|
||||||
|
"getForMachineCluster"
|
||||||
|
],
|
||||||
|
|
||||||
"history": [
|
"history": [
|
||||||
"create",
|
"create",
|
||||||
"delete",
|
"delete",
|
||||||
|
@ -131,8 +135,7 @@
|
||||||
|
|
||||||
"action": [ "getAll", "getById" ],
|
"action": [ "getAll", "getById" ],
|
||||||
"global_state": [ "getAll" ],
|
"global_state": [ "getAll" ],
|
||||||
"chip": [ "getAll" ],
|
"chip": [ "getForMachine" ],
|
||||||
"pin_merge": [ "getAll", "getByIdChip" ],
|
|
||||||
"state": [ "getForChip" ],
|
"state": [ "getForChip" ],
|
||||||
|
|
||||||
"warehouse": [
|
"warehouse": [
|
||||||
|
|
188
logauth.sql
188
logauth.sql
|
@ -3,7 +3,7 @@
|
||||||
-- http://www.phpmyadmin.net
|
-- http://www.phpmyadmin.net
|
||||||
--
|
--
|
||||||
-- Host: localhost
|
-- Host: localhost
|
||||||
-- Generation Time: Sep 23, 2017 at 07:46 PM
|
-- Generation Time: Sep 25, 2017 at 04:37 PM
|
||||||
-- Server version: 5.7.19-0ubuntu0.16.04.1
|
-- Server version: 5.7.19-0ubuntu0.16.04.1
|
||||||
-- PHP Version: 7.0.22-0ubuntu0.16.04.1
|
-- PHP Version: 7.0.22-0ubuntu0.16.04.1
|
||||||
|
|
||||||
|
@ -28,11 +28,12 @@ USE `logauth`;
|
||||||
-- Table structure for table `action`
|
-- Table structure for table `action`
|
||||||
--
|
--
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `action`;
|
||||||
CREATE TABLE `action` (
|
CREATE TABLE `action` (
|
||||||
`id_action` int(11) NOT NULL,
|
`id_action` int(11) NOT NULL,
|
||||||
`name` varchar(30) COLLATE utf8_unicode_ci NOT NULL,
|
`name` varchar(30) COLLATE utf8_unicode_ci NOT NULL,
|
||||||
`timeout` int(11) NOT NULL,
|
`timeout` int(11) NOT NULL,
|
||||||
`previous` varchar(20) COLLATE utf8_unicode_ci NOT NULL COMMENT 'started | signaled | locked',
|
`required` varchar(20) COLLATE utf8_unicode_ci NOT NULL COMMENT 'started | signaled | locked',
|
||||||
`action` varchar(20) COLLATE utf8_unicode_ci NOT NULL COMMENT 'start | signal | lock'
|
`action` varchar(20) COLLATE utf8_unicode_ci NOT NULL COMMENT 'start | signal | lock'
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||||
|
|
||||||
|
@ -40,10 +41,10 @@ CREATE TABLE `action` (
|
||||||
-- Dumping data for table `action`
|
-- Dumping data for table `action`
|
||||||
--
|
--
|
||||||
|
|
||||||
INSERT INTO `action` (`id_action`, `name`, `timeout`, `previous`, `action`) VALUES
|
INSERT INTO `action` (`id_action`, `name`, `timeout`, `required`, `action`) VALUES
|
||||||
(1, 'Start', 0, '0X0', '1XX'),
|
(1, 'Start', 0, '0X0', '1XX'),
|
||||||
(2, 'Signal', 1, 'XX0', '11X'),
|
(2, 'Signal', 3, 'XX0', '11X'),
|
||||||
(3, 'Lock', 2, 'XX0', '001'),
|
(3, 'Lock', 5, 'XX0', '001'),
|
||||||
(4, 'Unlock', 0, 'XX1', '000'),
|
(4, 'Unlock', 0, 'XX1', '000'),
|
||||||
(5, 'Stop', 0, '1X0', '0XX'),
|
(5, 'Stop', 0, '1X0', '0XX'),
|
||||||
(6, 'Unsignal', 0, 'X10', 'X00');
|
(6, 'Unsignal', 0, 'X10', 'X00');
|
||||||
|
@ -54,6 +55,7 @@ INSERT INTO `action` (`id_action`, `name`, `timeout`, `previous`, `action`) VALU
|
||||||
-- Table structure for table `action_merge`
|
-- Table structure for table `action_merge`
|
||||||
--
|
--
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `action_merge`;
|
||||||
CREATE TABLE `action_merge` (
|
CREATE TABLE `action_merge` (
|
||||||
`id_action_merge` int(11) NOT NULL,
|
`id_action_merge` int(11) NOT NULL,
|
||||||
`id_target` int(11) NOT NULL,
|
`id_target` int(11) NOT NULL,
|
||||||
|
@ -97,6 +99,7 @@ INSERT INTO `action_merge` (`id_action_merge`, `id_target`, `id_source`, `id_act
|
||||||
-- Table structure for table `admin`
|
-- Table structure for table `admin`
|
||||||
--
|
--
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `admin`;
|
||||||
CREATE TABLE `admin` (
|
CREATE TABLE `admin` (
|
||||||
`id_admin` int(11) NOT NULL,
|
`id_admin` int(11) NOT NULL,
|
||||||
`id_warehouse` int(11) NOT NULL,
|
`id_warehouse` int(11) NOT NULL,
|
||||||
|
@ -120,21 +123,45 @@ INSERT INTO `admin` (`id_admin`, `id_warehouse`, `username`, `mail`, `password`,
|
||||||
-- Table structure for table `chip`
|
-- Table structure for table `chip`
|
||||||
--
|
--
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `chip`;
|
||||||
CREATE TABLE `chip` (
|
CREATE TABLE `chip` (
|
||||||
`id_chip` int(11) NOT NULL,
|
`id_chip` int(11) NOT NULL,
|
||||||
`id_module` int(11) DEFAULT NULL,
|
`id_module` int(11) DEFAULT NULL COMMENT 'in global_state',
|
||||||
`name` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
|
`name` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
|
||||||
`position` int(11) NOT NULL,
|
`position` int(11) NOT NULL,
|
||||||
`type` varchar(10) COLLATE utf8_unicode_ci NOT NULL
|
`type` varchar(10) COLLATE utf8_unicode_ci NOT NULL,
|
||||||
|
`pins` text COLLATE utf8_unicode_ci NOT NULL
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Dumping data for table `chip`
|
-- Dumping data for table `chip`
|
||||||
--
|
--
|
||||||
|
|
||||||
INSERT INTO `chip` (`id_chip`, `id_module`, `name`, `position`, `type`) VALUES
|
INSERT INTO `chip` (`id_chip`, `id_module`, `name`, `position`, `type`, `pins`) VALUES
|
||||||
(1, 1, 'led1', 0, 'SERIAL'),
|
(1, 1, 'led1', 0, 'digital', '4,17,27'),
|
||||||
(2, 1, 'relay1', 1, 'SERIAL');
|
(2, 1, 'relay1', 1, 'digital', '21');
|
||||||
|
|
||||||
|
-- --------------------------------------------------------
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Table structure for table `etree`
|
||||||
|
--
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `etree`;
|
||||||
|
CREATE TABLE `etree` (
|
||||||
|
`id_etree` int(11) NOT NULL,
|
||||||
|
`id_module` int(11) NOT NULL,
|
||||||
|
`daemon` varchar(30) COLLATE latin1_bin NOT NULL
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_bin;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Dumping data for table `etree`
|
||||||
|
--
|
||||||
|
|
||||||
|
INSERT INTO `etree` (`id_etree`, `id_module`, `daemon`) VALUES
|
||||||
|
(1, 1, 'read'),
|
||||||
|
(2, 3, 'emitter'),
|
||||||
|
(3, 3, 'receiver');
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
-- --------------------------------------------------------
|
||||||
|
|
||||||
|
@ -142,6 +169,7 @@ INSERT INTO `chip` (`id_chip`, `id_module`, `name`, `position`, `type`) VALUES
|
||||||
-- Table structure for table `global_state`
|
-- Table structure for table `global_state`
|
||||||
--
|
--
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `global_state`;
|
||||||
CREATE TABLE `global_state` (
|
CREATE TABLE `global_state` (
|
||||||
`id_global_state` int(11) NOT NULL,
|
`id_global_state` int(11) NOT NULL,
|
||||||
`global_state` varchar(20) COLLATE utf8_unicode_ci NOT NULL COMMENT 'started | signaled | locked',
|
`global_state` varchar(20) COLLATE utf8_unicode_ci NOT NULL COMMENT 'started | signaled | locked',
|
||||||
|
@ -164,6 +192,7 @@ INSERT INTO `global_state` (`id_global_state`, `global_state`, `chips`) VALUES
|
||||||
-- Table structure for table `history`
|
-- Table structure for table `history`
|
||||||
--
|
--
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `history`;
|
||||||
CREATE TABLE `history` (
|
CREATE TABLE `history` (
|
||||||
`id_history` int(11) NOT NULL,
|
`id_history` int(11) NOT NULL,
|
||||||
`timestamp` int(11) NOT NULL,
|
`timestamp` int(11) NOT NULL,
|
||||||
|
@ -202,6 +231,7 @@ INSERT INTO `history` (`id_history`, `timestamp`, `id_user`, `id_machine`, `id_a
|
||||||
-- Table structure for table `log`
|
-- Table structure for table `log`
|
||||||
--
|
--
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `log`;
|
||||||
CREATE TABLE `log` (
|
CREATE TABLE `log` (
|
||||||
`id_log` int(11) NOT NULL,
|
`id_log` int(11) NOT NULL,
|
||||||
`id_feature` int(11) NOT NULL,
|
`id_feature` int(11) NOT NULL,
|
||||||
|
@ -216,6 +246,7 @@ CREATE TABLE `log` (
|
||||||
-- Table structure for table `machine`
|
-- Table structure for table `machine`
|
||||||
--
|
--
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `machine`;
|
||||||
CREATE TABLE `machine` (
|
CREATE TABLE `machine` (
|
||||||
`id_machine` int(11) NOT NULL,
|
`id_machine` int(11) NOT NULL,
|
||||||
`id_warehouse` int(11) NOT NULL,
|
`id_warehouse` int(11) NOT NULL,
|
||||||
|
@ -355,6 +386,7 @@ INSERT INTO `machine` (`id_machine`, `id_warehouse`, `name`, `token`, `unlock_co
|
||||||
-- Table structure for table `machine_cluster`
|
-- Table structure for table `machine_cluster`
|
||||||
--
|
--
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `machine_cluster`;
|
||||||
CREATE TABLE `machine_cluster` (
|
CREATE TABLE `machine_cluster` (
|
||||||
`id_machine_cluster` int(11) NOT NULL,
|
`id_machine_cluster` int(11) NOT NULL,
|
||||||
`id_warehouse` int(11) NOT NULL,
|
`id_warehouse` int(11) NOT NULL,
|
||||||
|
@ -378,6 +410,7 @@ INSERT INTO `machine_cluster` (`id_machine_cluster`, `id_warehouse`, `name`) VAL
|
||||||
-- Table structure for table `machine_cluster_merge`
|
-- Table structure for table `machine_cluster_merge`
|
||||||
--
|
--
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `machine_cluster_merge`;
|
||||||
CREATE TABLE `machine_cluster_merge` (
|
CREATE TABLE `machine_cluster_merge` (
|
||||||
`id_machine_cluster_merge` int(11) NOT NULL,
|
`id_machine_cluster_merge` int(11) NOT NULL,
|
||||||
`id_machine_cluster` int(11) NOT NULL,
|
`id_machine_cluster` int(11) NOT NULL,
|
||||||
|
@ -392,7 +425,15 @@ INSERT INTO `machine_cluster_merge` (`id_machine_cluster_merge`, `id_machine_clu
|
||||||
(3, 1, 58),
|
(3, 1, 58),
|
||||||
(4, 2, 75),
|
(4, 2, 75),
|
||||||
(5, 3, 6),
|
(5, 3, 6),
|
||||||
(6, 2, 58);
|
(6, 2, 58),
|
||||||
|
(9, 4, 122),
|
||||||
|
(10, 4, 123),
|
||||||
|
(11, 4, 124),
|
||||||
|
(12, 4, 125),
|
||||||
|
(13, 5, 126),
|
||||||
|
(14, 5, 127),
|
||||||
|
(15, 5, 128),
|
||||||
|
(16, 5, 129);
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
-- --------------------------------------------------------
|
||||||
|
|
||||||
|
@ -400,6 +441,7 @@ INSERT INTO `machine_cluster_merge` (`id_machine_cluster_merge`, `id_machine_clu
|
||||||
-- Table structure for table `module`
|
-- Table structure for table `module`
|
||||||
--
|
--
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `module`;
|
||||||
CREATE TABLE `module` (
|
CREATE TABLE `module` (
|
||||||
`id_module` int(11) NOT NULL,
|
`id_module` int(11) NOT NULL,
|
||||||
`name` varchar(50) COLLATE utf8_unicode_ci NOT NULL
|
`name` varchar(50) COLLATE utf8_unicode_ci NOT NULL
|
||||||
|
@ -410,9 +452,10 @@ CREATE TABLE `module` (
|
||||||
--
|
--
|
||||||
|
|
||||||
INSERT INTO `module` (`id_module`, `name`) VALUES
|
INSERT INTO `module` (`id_module`, `name`) VALUES
|
||||||
(1, 'motheure'),
|
(1, 'rfid'),
|
||||||
(2, 'portail'),
|
(2, 'motheure'),
|
||||||
(3, 'upload');
|
(3, 'portail'),
|
||||||
|
(4, 'autostop');
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
-- --------------------------------------------------------
|
||||||
|
|
||||||
|
@ -420,6 +463,7 @@ INSERT INTO `module` (`id_module`, `name`) VALUES
|
||||||
-- Table structure for table `module_availability`
|
-- Table structure for table `module_availability`
|
||||||
--
|
--
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `module_availability`;
|
||||||
CREATE TABLE `module_availability` (
|
CREATE TABLE `module_availability` (
|
||||||
`id_warehouse` int(11) NOT NULL,
|
`id_warehouse` int(11) NOT NULL,
|
||||||
`id_module` int(11) NOT NULL
|
`id_module` int(11) NOT NULL
|
||||||
|
@ -433,7 +477,8 @@ INSERT INTO `module_availability` (`id_warehouse`, `id_module`) VALUES
|
||||||
(7, 1),
|
(7, 1),
|
||||||
(8, 1),
|
(8, 1),
|
||||||
(7, 2),
|
(7, 2),
|
||||||
(8, 2);
|
(8, 2),
|
||||||
|
(8, 3);
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
-- --------------------------------------------------------
|
||||||
|
|
||||||
|
@ -441,35 +486,23 @@ INSERT INTO `module_availability` (`id_warehouse`, `id_module`) VALUES
|
||||||
-- Table structure for table `module_merge`
|
-- Table structure for table `module_merge`
|
||||||
--
|
--
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `module_merge`;
|
||||||
CREATE TABLE `module_merge` (
|
CREATE TABLE `module_merge` (
|
||||||
`id_module_merge` int(11) NOT NULL,
|
`id_module_merge` int(11) NOT NULL,
|
||||||
`id_machine_cluster` int(11) NOT NULL,
|
`id_machine_cluster` int(11) NOT NULL,
|
||||||
`id_module` int(11) NOT NULL,
|
`id_etree` int(11) NOT NULL,
|
||||||
`id_warehouse` int(11) NOT NULL
|
`id_warehouse` int(11) NOT NULL
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Table structure for table `pin_merge`
|
-- Dumping data for table `module_merge`
|
||||||
--
|
--
|
||||||
|
|
||||||
CREATE TABLE `pin_merge` (
|
INSERT INTO `module_merge` (`id_module_merge`, `id_machine_cluster`, `id_etree`, `id_warehouse`) VALUES
|
||||||
`id_pin_merge` int(11) NOT NULL,
|
(1, 4, 1, 8),
|
||||||
`id_chip` int(11) NOT NULL,
|
(2, 5, 1, 8),
|
||||||
`pin` int(11) NOT NULL,
|
(3, 4, 2, 8),
|
||||||
`type` varchar(20) COLLATE utf8_unicode_ci NOT NULL
|
(4, 5, 2, 8);
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Dumping data for table `pin_merge`
|
|
||||||
--
|
|
||||||
|
|
||||||
INSERT INTO `pin_merge` (`id_pin_merge`, `id_chip`, `pin`, `type`) VALUES
|
|
||||||
(1, 1, 4, 'SERIAL'),
|
|
||||||
(2, 1, 17, 'SERIAL'),
|
|
||||||
(3, 1, 27, 'SERIAL'),
|
|
||||||
(4, 2, 21, 'SERIAL');
|
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
-- --------------------------------------------------------
|
||||||
|
|
||||||
|
@ -477,32 +510,25 @@ INSERT INTO `pin_merge` (`id_pin_merge`, `id_chip`, `pin`, `type`) VALUES
|
||||||
-- Table structure for table `state`
|
-- Table structure for table `state`
|
||||||
--
|
--
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `state`;
|
||||||
CREATE TABLE `state` (
|
CREATE TABLE `state` (
|
||||||
`id_state` int(11) NOT NULL,
|
`id_state` int(11) NOT NULL,
|
||||||
`id_pin_merge` int(11) NOT NULL,
|
`id_chip` int(11) NOT NULL,
|
||||||
`state` varchar(1) COLLATE utf8_unicode_ci NOT NULL,
|
`state` varchar(1) COLLATE utf8_unicode_ci NOT NULL,
|
||||||
`value` smallint(4) NOT NULL
|
`value` text COLLATE utf8_unicode_ci NOT NULL
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Dumping data for table `state`
|
-- Dumping data for table `state`
|
||||||
--
|
--
|
||||||
|
|
||||||
INSERT INTO `state` (`id_state`, `id_pin_merge`, `state`, `value`) VALUES
|
INSERT INTO `state` (`id_state`, `id_chip`, `state`, `value`) VALUES
|
||||||
(1, 1, '0', 1),
|
(15, 1, '0', '1,1,1'),
|
||||||
(2, 2, '0', 1),
|
(16, 1, 'R', '0,1,1'),
|
||||||
(3, 3, '0', 1),
|
(17, 1, 'G', '1,0,1'),
|
||||||
(4, 1, 'G', 1),
|
(18, 1, 'B', '1,1,0'),
|
||||||
(5, 2, 'G', 0),
|
(19, 2, '0', '0'),
|
||||||
(6, 3, 'G', 1),
|
(20, 2, '1', '1');
|
||||||
(7, 1, 'B', 1),
|
|
||||||
(8, 2, 'B', 1),
|
|
||||||
(9, 3, 'B', 0),
|
|
||||||
(10, 1, 'R', 0),
|
|
||||||
(11, 2, 'R', 1),
|
|
||||||
(12, 3, 'R', 1),
|
|
||||||
(13, 4, '0', 0),
|
|
||||||
(14, 4, '1', 1);
|
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
-- --------------------------------------------------------
|
||||||
|
|
||||||
|
@ -510,6 +536,7 @@ INSERT INTO `state` (`id_state`, `id_pin_merge`, `state`, `value`) VALUES
|
||||||
-- Table structure for table `user`
|
-- Table structure for table `user`
|
||||||
--
|
--
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `user`;
|
||||||
CREATE TABLE `user` (
|
CREATE TABLE `user` (
|
||||||
`id_user` int(11) NOT NULL,
|
`id_user` int(11) NOT NULL,
|
||||||
`id_warehouse` int(11) NOT NULL,
|
`id_warehouse` int(11) NOT NULL,
|
||||||
|
@ -623,6 +650,7 @@ INSERT INTO `user` (`id_user`, `id_warehouse`, `code`, `username`, `firstname`,
|
||||||
-- Table structure for table `user_cluster`
|
-- Table structure for table `user_cluster`
|
||||||
--
|
--
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `user_cluster`;
|
||||||
CREATE TABLE `user_cluster` (
|
CREATE TABLE `user_cluster` (
|
||||||
`id_user_cluster` int(11) NOT NULL,
|
`id_user_cluster` int(11) NOT NULL,
|
||||||
`id_warehouse` int(11) NOT NULL,
|
`id_warehouse` int(11) NOT NULL,
|
||||||
|
@ -646,6 +674,7 @@ INSERT INTO `user_cluster` (`id_user_cluster`, `id_warehouse`, `name`) VALUES
|
||||||
-- Table structure for table `user_cluster_merge`
|
-- Table structure for table `user_cluster_merge`
|
||||||
--
|
--
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `user_cluster_merge`;
|
||||||
CREATE TABLE `user_cluster_merge` (
|
CREATE TABLE `user_cluster_merge` (
|
||||||
`id_user_cluster_merge` int(11) NOT NULL,
|
`id_user_cluster_merge` int(11) NOT NULL,
|
||||||
`id_user_cluster` int(11) NOT NULL,
|
`id_user_cluster` int(11) NOT NULL,
|
||||||
|
@ -677,6 +706,7 @@ INSERT INTO `user_cluster_merge` (`id_user_cluster_merge`, `id_user_cluster`, `i
|
||||||
-- Table structure for table `warehouse`
|
-- Table structure for table `warehouse`
|
||||||
--
|
--
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `warehouse`;
|
||||||
CREATE TABLE `warehouse` (
|
CREATE TABLE `warehouse` (
|
||||||
`id_warehouse` int(11) NOT NULL,
|
`id_warehouse` int(11) NOT NULL,
|
||||||
`name` varchar(30) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL,
|
`name` varchar(30) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL,
|
||||||
|
@ -726,6 +756,13 @@ ALTER TABLE `chip`
|
||||||
ADD PRIMARY KEY (`id_chip`),
|
ADD PRIMARY KEY (`id_chip`),
|
||||||
ADD KEY `id_module` (`id_module`);
|
ADD KEY `id_module` (`id_module`);
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Indexes for table `etree`
|
||||||
|
--
|
||||||
|
ALTER TABLE `etree`
|
||||||
|
ADD PRIMARY KEY (`id_etree`),
|
||||||
|
ADD KEY `id_module` (`id_module`);
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Indexes for table `global_state`
|
-- Indexes for table `global_state`
|
||||||
--
|
--
|
||||||
|
@ -791,22 +828,15 @@ ALTER TABLE `module_availability`
|
||||||
ALTER TABLE `module_merge`
|
ALTER TABLE `module_merge`
|
||||||
ADD PRIMARY KEY (`id_module_merge`),
|
ADD PRIMARY KEY (`id_module_merge`),
|
||||||
ADD KEY `id_machine_cluster` (`id_machine_cluster`),
|
ADD KEY `id_machine_cluster` (`id_machine_cluster`),
|
||||||
ADD KEY `id_machine` (`id_module`),
|
ADD KEY `id_machine` (`id_etree`),
|
||||||
ADD KEY `id_warehouse` (`id_warehouse`);
|
ADD KEY `id_warehouse` (`id_warehouse`);
|
||||||
|
|
||||||
--
|
|
||||||
-- Indexes for table `pin_merge`
|
|
||||||
--
|
|
||||||
ALTER TABLE `pin_merge`
|
|
||||||
ADD PRIMARY KEY (`id_pin_merge`),
|
|
||||||
ADD KEY `id_chip` (`id_chip`);
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Indexes for table `state`
|
-- Indexes for table `state`
|
||||||
--
|
--
|
||||||
ALTER TABLE `state`
|
ALTER TABLE `state`
|
||||||
ADD PRIMARY KEY (`id_state`),
|
ADD PRIMARY KEY (`id_state`),
|
||||||
ADD KEY `id_pin_merge` (`id_pin_merge`);
|
ADD KEY `id_pin_merge` (`id_chip`);
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Indexes for table `user`
|
-- Indexes for table `user`
|
||||||
|
@ -861,6 +891,11 @@ ALTER TABLE `admin`
|
||||||
ALTER TABLE `chip`
|
ALTER TABLE `chip`
|
||||||
MODIFY `id_chip` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
|
MODIFY `id_chip` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
|
||||||
--
|
--
|
||||||
|
-- AUTO_INCREMENT for table `etree`
|
||||||
|
--
|
||||||
|
ALTER TABLE `etree`
|
||||||
|
MODIFY `id_etree` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
|
||||||
|
--
|
||||||
-- AUTO_INCREMENT for table `global_state`
|
-- AUTO_INCREMENT for table `global_state`
|
||||||
--
|
--
|
||||||
ALTER TABLE `global_state`
|
ALTER TABLE `global_state`
|
||||||
|
@ -889,27 +924,22 @@ ALTER TABLE `machine_cluster`
|
||||||
-- AUTO_INCREMENT for table `machine_cluster_merge`
|
-- AUTO_INCREMENT for table `machine_cluster_merge`
|
||||||
--
|
--
|
||||||
ALTER TABLE `machine_cluster_merge`
|
ALTER TABLE `machine_cluster_merge`
|
||||||
MODIFY `id_machine_cluster_merge` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
|
MODIFY `id_machine_cluster_merge` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17;
|
||||||
--
|
--
|
||||||
-- AUTO_INCREMENT for table `module`
|
-- AUTO_INCREMENT for table `module`
|
||||||
--
|
--
|
||||||
ALTER TABLE `module`
|
ALTER TABLE `module`
|
||||||
MODIFY `id_module` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
|
MODIFY `id_module` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
|
||||||
--
|
--
|
||||||
-- AUTO_INCREMENT for table `module_merge`
|
-- AUTO_INCREMENT for table `module_merge`
|
||||||
--
|
--
|
||||||
ALTER TABLE `module_merge`
|
ALTER TABLE `module_merge`
|
||||||
MODIFY `id_module_merge` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=59;
|
MODIFY `id_module_merge` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
|
||||||
--
|
|
||||||
-- AUTO_INCREMENT for table `pin_merge`
|
|
||||||
--
|
|
||||||
ALTER TABLE `pin_merge`
|
|
||||||
MODIFY `id_pin_merge` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
|
|
||||||
--
|
--
|
||||||
-- AUTO_INCREMENT for table `state`
|
-- AUTO_INCREMENT for table `state`
|
||||||
--
|
--
|
||||||
ALTER TABLE `state`
|
ALTER TABLE `state`
|
||||||
MODIFY `id_state` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15;
|
MODIFY `id_state` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=21;
|
||||||
--
|
--
|
||||||
-- AUTO_INCREMENT for table `user`
|
-- AUTO_INCREMENT for table `user`
|
||||||
--
|
--
|
||||||
|
@ -924,7 +954,7 @@ ALTER TABLE `user_cluster`
|
||||||
-- AUTO_INCREMENT for table `user_cluster_merge`
|
-- AUTO_INCREMENT for table `user_cluster_merge`
|
||||||
--
|
--
|
||||||
ALTER TABLE `user_cluster_merge`
|
ALTER TABLE `user_cluster_merge`
|
||||||
MODIFY `id_user_cluster_merge` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=89;
|
MODIFY `id_user_cluster_merge` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=88;
|
||||||
--
|
--
|
||||||
-- AUTO_INCREMENT for table `warehouse`
|
-- AUTO_INCREMENT for table `warehouse`
|
||||||
--
|
--
|
||||||
|
@ -954,6 +984,12 @@ ALTER TABLE `admin`
|
||||||
ALTER TABLE `chip`
|
ALTER TABLE `chip`
|
||||||
ADD CONSTRAINT `chip_id_module` FOREIGN KEY (`id_module`) REFERENCES `module` (`id_module`) ON DELETE CASCADE ON UPDATE CASCADE;
|
ADD CONSTRAINT `chip_id_module` FOREIGN KEY (`id_module`) REFERENCES `module` (`id_module`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Constraints for table `etree`
|
||||||
|
--
|
||||||
|
ALTER TABLE `etree`
|
||||||
|
ADD CONSTRAINT `fk_etree_id_module` FOREIGN KEY (`id_module`) REFERENCES `module` (`id_module`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Constraints for table `history`
|
-- Constraints for table `history`
|
||||||
--
|
--
|
||||||
|
@ -999,21 +1035,15 @@ ALTER TABLE `module_availability`
|
||||||
-- Constraints for table `module_merge`
|
-- Constraints for table `module_merge`
|
||||||
--
|
--
|
||||||
ALTER TABLE `module_merge`
|
ALTER TABLE `module_merge`
|
||||||
|
ADD CONSTRAINT `fk_module_merge_id_etree` FOREIGN KEY (`id_etree`) REFERENCES `etree` (`id_etree`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||||
ADD CONSTRAINT `fk_module_merge_id_machine_cluster` FOREIGN KEY (`id_machine_cluster`) REFERENCES `machine_cluster` (`id_machine_cluster`) ON DELETE CASCADE ON UPDATE CASCADE,
|
ADD CONSTRAINT `fk_module_merge_id_machine_cluster` FOREIGN KEY (`id_machine_cluster`) REFERENCES `machine_cluster` (`id_machine_cluster`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||||
ADD CONSTRAINT `fk_module_merge_id_module` FOREIGN KEY (`id_module`) REFERENCES `module` (`id_module`) ON DELETE CASCADE ON UPDATE CASCADE,
|
|
||||||
ADD CONSTRAINT `fk_module_merge_id_warehouse` FOREIGN KEY (`id_warehouse`) REFERENCES `warehouse` (`id_warehouse`) ON DELETE CASCADE ON UPDATE CASCADE;
|
ADD CONSTRAINT `fk_module_merge_id_warehouse` FOREIGN KEY (`id_warehouse`) REFERENCES `warehouse` (`id_warehouse`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||||
|
|
||||||
--
|
|
||||||
-- Constraints for table `pin_merge`
|
|
||||||
--
|
|
||||||
ALTER TABLE `pin_merge`
|
|
||||||
ADD CONSTRAINT `pin_id_chip` FOREIGN KEY (`id_chip`) REFERENCES `chip` (`id_chip`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Constraints for table `state`
|
-- Constraints for table `state`
|
||||||
--
|
--
|
||||||
ALTER TABLE `state`
|
ALTER TABLE `state`
|
||||||
ADD CONSTRAINT `state_id_pin_merge` FOREIGN KEY (`id_pin_merge`) REFERENCES `pin_merge` (`id_pin_merge`);
|
ADD CONSTRAINT `fk_state_id_chip` FOREIGN KEY (`id_chip`) REFERENCES `chip` (`id_chip`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Constraints for table `user`
|
-- Constraints for table `user`
|
||||||
|
|
|
@ -337,6 +337,7 @@
|
||||||
|
|
||||||
.option > span.ignore > span{
|
.option > span.ignore > span{
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
|
margin-right: .4em;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (5) Lien vers la modification */
|
/* (5) Lien vers la modification */
|
||||||
|
|
|
@ -539,6 +539,7 @@
|
||||||
#WRAPPER > #CONTAINER > section > .inline-box .option > span.ignore > span,
|
#WRAPPER > #CONTAINER > section > .inline-box .option > span.ignore > span,
|
||||||
#WRAPPER > #CONTAINER > section > .inline-row .option > span.ignore > span {
|
#WRAPPER > #CONTAINER > section > .inline-row .option > span.ignore > span {
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
|
margin-right: .4em;
|
||||||
}
|
}
|
||||||
|
|
||||||
#WRAPPER > #CONTAINER > section > .inline-box .link_edit,
|
#WRAPPER > #CONTAINER > section > .inline-box .link_edit,
|
||||||
|
|
Loading…
Reference in New Issue