2024-10-18 17:15:56 +02:00
|
|
|
{{* -*- brindille -*-
|
|
|
|
|
2023-12-06 09:59:11 +01:00
|
|
|
Vérifier la cohérence des E/S d'un matériel
|
|
|
|
- paramètres :
|
|
|
|
- movements : liste de mouvements
|
|
|
|
- eqpmt_key : clé du matériel à vérifier
|
2023-11-29 13:34:25 +01:00
|
|
|
*}}
|
|
|
|
|
2023-11-30 18:14:46 +01:00
|
|
|
{{* récupérer la config des entrées/sorties *}}
|
2023-12-05 10:07:01 +01:00
|
|
|
{{:include file="../_get_config.html" keep="config"}}
|
2023-11-30 18:14:46 +01:00
|
|
|
|
2024-10-18 17:15:56 +02:00
|
|
|
{{:assign erreur=false}}
|
2023-11-29 13:34:25 +01:00
|
|
|
{{:assign stock=0}}
|
|
|
|
{{:assign exterieur=0}}
|
|
|
|
{{:assign nonprop=0}}
|
2023-12-07 17:33:49 +01:00
|
|
|
{{#foreach from=$movements item="mvt"}}
|
|
|
|
{{* déterminer le type de mouvement *}}
|
|
|
|
{{:assign var="mvt_nature" from="mvt.%s_nature"|args:$mvt.direction}}
|
|
|
|
{{:assign var="type_mvt" from="config.%s_nature.%s"|args:$mvt.direction:$mvt_nature}}
|
|
|
|
|
|
|
|
{{if $mvt.equipment == $eqpmt_key}}
|
|
|
|
{{if $mvt.direction == 'input'}}
|
|
|
|
{{if $type_mvt == 'définitif'}}
|
|
|
|
{{:assign stock="%d+%d"|math:$stock:$mvt.amount}}
|
|
|
|
{{elseif $type_mvt == 'retour'}}
|
|
|
|
{{:assign exterieur="%d-%d"|math:$exterieur:$mvt.amount}}
|
|
|
|
{{elseif $type_mvt == 'temporaire'}}
|
|
|
|
{{:assign nonprop="%d+%d"|math:$nonprop:$mvt.amount}}
|
|
|
|
{{/if}}
|
|
|
|
{{elseif $mvt.direction == 'output'}}
|
|
|
|
{{if $type_mvt == 'définitif'}}
|
|
|
|
{{:assign stock="%d-%d"|math:$stock:$mvt.amount}}
|
|
|
|
{{elseif $type_mvt == 'temporaire'}}
|
|
|
|
{{:assign exterieur="%d+%d"|math:$exterieur:$mvt.amount}}
|
|
|
|
{{elseif $type_mvt == 'retour'}}
|
|
|
|
{{:assign nonprop="%d-%d"|math:$nonprop:$mvt.amount}}
|
|
|
|
{{/if}}
|
2023-12-06 09:59:11 +01:00
|
|
|
{{/if}}
|
2024-10-18 17:15:56 +02:00
|
|
|
{{:assign dispo="%d-%d"|math:$stock:$exterieur}}
|
2023-12-06 09:59:11 +01:00
|
|
|
{{if $dispo < 0 || $stock < 0 || $exterieur < 0 || $nonprop < 0}}
|
|
|
|
{{:assign erreur=true}}
|
|
|
|
{{:break}}
|
|
|
|
{{/if}}
|
|
|
|
{{/if}}
|
2023-11-29 13:34:25 +01:00
|
|
|
{{/foreach}}
|