11/02/2024 - 22h
parent
0ed0493ea8
commit
62696c7302
|
@ -1,11 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="09/02/24 - 22h">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="09/02/24 - 22hqsdsq">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Log/log_file.log" beforeDir="false" afterPath="$PROJECT_DIR$/Log/log_file.log" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Session_Formation.py" beforeDir="false" afterPath="$PROJECT_DIR$/Session_Formation.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/site_formation.py" beforeDir="false" afterPath="$PROJECT_DIR$/site_formation.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ressources_materiels.py" beforeDir="false" afterPath="$PROJECT_DIR$/ressources_materiels.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
@ -75,13 +75,6 @@
|
|||
<option name="presentableId" value="Default" />
|
||||
<updated>1680804787304</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00169" summary="13/12/2023 - 23h30">
|
||||
<created>1702506480594</created>
|
||||
<option name="number" value="00169" />
|
||||
<option name="presentableId" value="LOCAL-00169" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1702506480595</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00170" summary="14/12/2023 - 08h30">
|
||||
<created>1702540046306</created>
|
||||
<option name="number" value="00170" />
|
||||
|
@ -418,7 +411,14 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1707512374460</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="218" />
|
||||
<task id="LOCAL-00218" summary="09/02/24 - 22hqsdsq">
|
||||
<created>1707599836404</created>
|
||||
<option name="number" value="00218" />
|
||||
<option name="presentableId" value="LOCAL-00218" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1707599836405</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="219" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
|
@ -433,7 +433,6 @@
|
|||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="09/01/24 - 19h30" />
|
||||
<MESSAGE value="11/01/24 - 21h30" />
|
||||
<MESSAGE value="12/01/24 - 16h30" />
|
||||
<MESSAGE value="15/01/2024 - 17h00" />
|
||||
|
@ -458,6 +457,7 @@
|
|||
<MESSAGE value="06/02/2024 -20h" />
|
||||
<MESSAGE value="08/02/2024 -20h" />
|
||||
<MESSAGE value="09/02/24 - 22h" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="09/02/24 - 22h" />
|
||||
<MESSAGE value="09/02/24 - 22hqsdsq" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="09/02/24 - 22hqsdsq" />
|
||||
</component>
|
||||
</project>
|
1325
Log/log_file.log
1325
Log/log_file.log
File diff suppressed because it is too large
Load Diff
14
main.py
14
main.py
|
@ -5289,6 +5289,20 @@ def Get_List_Ressource_Materielle_Rattachement():
|
|||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
"""
|
||||
API pour recuperer les differents types de ressources materielles
|
||||
"""
|
||||
@app.route('/myclass/api/Get_Type_Ressource_Materielle/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def Get_Type_Ressource_Materielle():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### Get_Type_Ressource_Materielle payload = ",payload)
|
||||
status, retval = ressources_materiels.Get_Type_Ressource_Materielle(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
"""
|
||||
API de creation d'une commande client d'un partner
|
||||
"""
|
||||
|
|
|
@ -47,8 +47,8 @@ def Add_Ressource_Materielle(diction):
|
|||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', "ref_interne", "nom", "description", "detail", "famille",'marque', 'type',
|
||||
'prix_achat', 'fournisseur', 'qty_stock',]
|
||||
field_list = ['token', "ref_interne", "nom", "description", "detail", "famille",'marque',
|
||||
'prix_achat', 'fournisseur', 'qty_stock', 'type', 'site_formation_id']
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
|
@ -114,7 +114,7 @@ def Add_Ressource_Materielle(diction):
|
|||
3]) + " - Le champ 'ref_interne' fait plus de 255 caractères")
|
||||
|
||||
return False, " - Le champ 'ref_interne' fait plus de 255 caractères"
|
||||
data['ref_interne'] = diction['ref_interne']
|
||||
data['ref_interne'] = ref_interne
|
||||
|
||||
|
||||
nom = ""
|
||||
|
@ -127,7 +127,7 @@ def Add_Ressource_Materielle(diction):
|
|||
3]) + " - Le champ 'nom' fait plus de 255 caractères")
|
||||
|
||||
return False, " - Le champ 'nom' fait plus de 255 caractères"
|
||||
data['nom'] = diction['nom']
|
||||
data['nom'] = nom
|
||||
|
||||
|
||||
description = ""
|
||||
|
@ -140,7 +140,7 @@ def Add_Ressource_Materielle(diction):
|
|||
3]) + " - Le champ 'description' fait plus de 500 caractères")
|
||||
|
||||
return False, " - Le champ 'Detail' fait plus de 500 caractères"
|
||||
data['description'] = diction['description']
|
||||
data['description'] = description
|
||||
|
||||
|
||||
detail = ""
|
||||
|
@ -154,7 +154,7 @@ def Add_Ressource_Materielle(diction):
|
|||
|
||||
return False, " - Le champ 'Detail' fait plus de 255 caractères"
|
||||
|
||||
data['detail'] = diction['detail']
|
||||
data['detail'] = detail
|
||||
|
||||
|
||||
|
||||
|
@ -162,21 +162,14 @@ def Add_Ressource_Materielle(diction):
|
|||
if ("famille" in diction.keys()):
|
||||
if diction['famille']:
|
||||
famille = diction['famille']
|
||||
data['famille'] = diction['famille']
|
||||
data['famille'] = famille
|
||||
|
||||
|
||||
marque = ""
|
||||
if ("marque" in diction.keys()):
|
||||
if diction['marque']:
|
||||
marque = diction['marque']
|
||||
data['marque'] = diction['marque']
|
||||
|
||||
type = ""
|
||||
if ("type" in diction.keys()):
|
||||
if diction['type']:
|
||||
type = diction['type']
|
||||
data['type'] = diction['type']
|
||||
|
||||
data['marque'] = marque
|
||||
|
||||
|
||||
prix_achat = ""
|
||||
|
@ -191,14 +184,45 @@ def Add_Ressource_Materielle(diction):
|
|||
|
||||
return False, " - Le prix d'achat est invalide "
|
||||
|
||||
data['prix_achat'] = diction['prix_achat']
|
||||
data['prix_achat'] = prix_achat
|
||||
|
||||
|
||||
fournisseur = ""
|
||||
if ("fournisseur" in diction.keys()):
|
||||
if diction['fournisseur']:
|
||||
fournisseur = diction['fournisseur']
|
||||
data['fournisseur'] = diction['fournisseur']
|
||||
data['fournisseur'] = fournisseur
|
||||
|
||||
type = ""
|
||||
if ("type" in diction.keys()):
|
||||
if diction['type']:
|
||||
type = diction['type']
|
||||
is_valide_type_materiel = MYSY_GV.dbname['ressource_materielle_type'].count_documents({'code':type,
|
||||
'partner_owner_recid':'default',
|
||||
'valide':'1',
|
||||
'locked':'0'})
|
||||
|
||||
if( is_valide_type_materiel != 1):
|
||||
mycommon.myprint(" Le type de materiel est invalide ")
|
||||
return False, " Le type de materiel est invalide "
|
||||
|
||||
data['type'] = type
|
||||
|
||||
site_formation_id = ""
|
||||
if ("site_formation_id" in diction.keys()):
|
||||
if diction['site_formation_id']:
|
||||
site_formation_id = diction['site_formation_id']
|
||||
# verifier que le site de formation existe et est valide
|
||||
is_site_formation_valide = MYSY_GV.dbname['site_formation'].count_documents({'_id':ObjectId(str(site_formation_id)),
|
||||
'partner_owner_recid':str(my_partner['recid']),
|
||||
'valide':'1',
|
||||
'locked':'0'})
|
||||
|
||||
if( is_site_formation_valide != 1):
|
||||
mycommon.myprint(" L'identifiant du site de formation est invalide ")
|
||||
return False, " L'identifiant du site de formation est invalide "
|
||||
|
||||
data['site_formation_id'] = site_formation_id
|
||||
|
||||
|
||||
qty_stock = ""
|
||||
|
@ -213,7 +237,7 @@ def Add_Ressource_Materielle(diction):
|
|||
|
||||
return False, " - La quantité en stock est invalide "
|
||||
|
||||
data['qty_stock'] = diction['qty_stock']
|
||||
data['qty_stock'] = qty_stock
|
||||
|
||||
|
||||
|
||||
|
@ -221,6 +245,7 @@ def Add_Ressource_Materielle(diction):
|
|||
data['valide'] = '1'
|
||||
data['locked'] = '0'
|
||||
data['date_update'] = str(datetime.now())
|
||||
data['update_by'] = str(my_partner['_id'])
|
||||
|
||||
# Creation du RecId
|
||||
data['recid'] = mycommon.create_user_recid()
|
||||
|
@ -230,8 +255,8 @@ def Add_Ressource_Materielle(diction):
|
|||
inserted_id = MYSY_GV.dbname['ressource_materielle'].insert_one(data).inserted_id
|
||||
if (not inserted_id):
|
||||
mycommon.myprint(
|
||||
" Impossible de créer le materiel ")
|
||||
return False, " Impossible de créer le materiel "
|
||||
" Impossible de créer le materiel (2) ")
|
||||
return False, " Impossible de créer le materiel (2) "
|
||||
|
||||
|
||||
return True, " Le matereiel a été correctement créé"
|
||||
|
@ -254,7 +279,7 @@ def Update_Ressource_Materielle(diction):
|
|||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', "ref_interne", "nom", "description", "detail", "famille",'marque', 'type',
|
||||
'prix_achat', 'fournisseur', 'qty_stock', '_id']
|
||||
'prix_achat', 'fournisseur', 'qty_stock', '_id', 'site_formation_id']
|
||||
|
||||
|
||||
|
||||
|
@ -389,8 +414,36 @@ def Update_Ressource_Materielle(diction):
|
|||
|
||||
type = ""
|
||||
if ("type" in diction.keys()):
|
||||
type = diction['type']
|
||||
data_update['type'] = diction['type']
|
||||
if diction['type']:
|
||||
type = diction['type']
|
||||
is_valide_type_materiel = MYSY_GV.dbname['ressource_materielle_type'].count_documents({'code': type,
|
||||
'partner_owner_recid': 'default',
|
||||
'valide': '1',
|
||||
'locked': '0'})
|
||||
|
||||
if (is_valide_type_materiel != 1):
|
||||
mycommon.myprint(" Le type de materiel est invalide ")
|
||||
return False, " Le type de materiel est invalide "
|
||||
|
||||
data_update['type'] = type
|
||||
|
||||
site_formation_id = ""
|
||||
if ("site_formation_id" in diction.keys()):
|
||||
if diction['site_formation_id']:
|
||||
site_formation_id = diction['site_formation_id']
|
||||
# verifier que le site de formation existe et est valide
|
||||
is_site_formation_valide = MYSY_GV.dbname['site_formation'].count_documents(
|
||||
{'_id': ObjectId(str(site_formation_id)),
|
||||
'partner_owner_recid': str(my_partner['recid']),
|
||||
'valide': '1',
|
||||
'locked': '0'})
|
||||
|
||||
if (is_site_formation_valide != 1):
|
||||
mycommon.myprint(" L'identifiant du site de formation est invalide ")
|
||||
return False, " L'identifiant du site de formation est invalide "
|
||||
|
||||
print(" ##### GGRR site_formation_id = ", site_formation_id)
|
||||
data_update['site_formation_id'] = site_formation_id
|
||||
|
||||
prix_achat = ""
|
||||
if ("prix_achat" in diction.keys()):
|
||||
|
@ -2115,3 +2168,79 @@ def Get_List_Ressource_Materielle_Rattachement(diction):
|
|||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de récupérer la liste des affectations de l'employé "
|
||||
|
||||
|
||||
"""
|
||||
Recuperation des types de ressources materielles (consommable, stockable ou autre)
|
||||
"""
|
||||
def Get_Type_Ressource_Materielle(diction):
|
||||
try:
|
||||
diction = mycommon.strip_dictionary(diction)
|
||||
|
||||
"""
|
||||
Verification des input acceptés
|
||||
"""
|
||||
field_list = ['token', ]
|
||||
|
||||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
if val not in field_list and val.startswith('my_') is False:
|
||||
mycommon.myprint(str(
|
||||
inspect.stack()[0][3]) + " Le champ '" + val + "' n'existe pas")
|
||||
return False, " Les informations fournies sont incorrectes",
|
||||
|
||||
"""
|
||||
Verification des champs obligatoires
|
||||
"""
|
||||
field_list_obligatoire = ['token', ]
|
||||
for val in field_list_obligatoire:
|
||||
if val not in diction:
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - La valeur '" + val + "' n'est pas presente dans liste ")
|
||||
return False, " Les informations fournies sont incorrectes",
|
||||
|
||||
"""
|
||||
Verification de l'identité et autorisation de l'entité qui
|
||||
appelle cette API
|
||||
"""
|
||||
token = ""
|
||||
if ("token" in diction.keys()):
|
||||
if diction['token']:
|
||||
token = diction['token']
|
||||
|
||||
# Verifier la validité du token
|
||||
retval = mycommon.check_partner_token_validity("", token)
|
||||
|
||||
if retval is False:
|
||||
return "Err_Connexion", " La session de connexion n'est pas valide"
|
||||
|
||||
# Recuperation des données du partenaire
|
||||
local_status, my_partner = mycommon.get_partner_data_from_token(token)
|
||||
if (local_status is False):
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - impossible de récupérer les données de l'utilisateur ")
|
||||
return False, str(inspect.stack()[0][3]) + " - impossible de récupérer les données de l'utilisateur. "
|
||||
|
||||
"""
|
||||
Clés de mise à jour
|
||||
"""
|
||||
data_cle = {}
|
||||
data_cle['partner_owner_recid'] = "default"
|
||||
data_cle['locked'] = "0"
|
||||
data_cle['valide'] = "1"
|
||||
|
||||
RetObject = []
|
||||
val_tmp = 1
|
||||
|
||||
for retval in MYSY_GV.dbname['ressource_materielle_type'].find(data_cle):
|
||||
user = retval
|
||||
user['id'] = str(val_tmp)
|
||||
val_tmp = val_tmp + 1
|
||||
RetObject.append(mycommon.JSONEncoder().encode(user))
|
||||
|
||||
return True, RetObject
|
||||
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de récupérer les type de ressource materielle "
|
||||
|
|
Loading…
Reference in New Issue