48 lines
2.0 KiB
HTML
48 lines
2.0 KiB
HTML
{{*
|
|
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
|
|
*}}
|
|
|
|
{{:assign erreur = false}}
|
|
{{:assign stock=0}}
|
|
{{:assign exterieur=0}}
|
|
{{:assign nonprop=0}}
|
|
{{#foreach from=$movements item="movement"}}
|
|
{{if $movement.equipment == $eqpmt_key}}
|
|
{{if $movement.direction == 'entrée'}}
|
|
{{* chercher le type d'entrée parmi les types de la config *}}
|
|
{{#foreach from=$module.config.inputNature item="elem"}}
|
|
{{if $movement.inputNature == $elem.label}}
|
|
{{if $elem.type == 'définitif'}}
|
|
{{:assign stock="%d+%d"|math:$stock:$movement.amount}}
|
|
{{elseif $elem.type == 'retour'}}
|
|
{{:assign exterieur="%d-%d"|math:$exterieur:$movement.amount}}
|
|
{{elseif $elem.type == 'temporaire'}}
|
|
{{:assign nonprop="%d+%d"|math:$nonprop:$movement.amount}}
|
|
{{/if}}
|
|
{{/if}}
|
|
{{/foreach}}
|
|
{{elseif $movement.direction == 'sortie'}}
|
|
{{* chercher le type de sortie parmi les types de la config *}}
|
|
{{#foreach from=$module.config.outputNature item="elem"}}
|
|
{{if $movement.outputNature == $elem.label}}
|
|
{{if $elem.type == 'définitif'}}
|
|
{{:assign stock="%d-%d"|math:$stock:$movement.amount}}
|
|
{{elseif $elem.type == 'temporaire'}}
|
|
{{:assign exterieur="%d+%d"|math:$exterieur:$movement.amount}}
|
|
{{elseif $elem.type == 'retour'}}
|
|
{{:assign nonprop="%d-%d"|math:$nonprop:$movement.amount}}
|
|
{{/if}}
|
|
{{/if}}
|
|
{{/foreach}}
|
|
{{/if}}
|
|
{{:assign dispo="%d-%d"|math:$stock:$exterieur}}
|
|
{{if $dispo < 0 || $stock < 0 || $exterieur < 0 || $nonprop < 0}}
|
|
{{:assign erreur=true}}
|
|
{{:break}}
|
|
{{/if}}
|
|
{{/if}}
|
|
{{/foreach}}
|