If (qteXML > seuilConf) Then strBody = "" strBody = strBody & "" strBody = strBody & "\" strBody = strBody & \"---- Genzyme Lyon , \" strBody = strBody & \"---- Alerte MES, \" strBody = strBody & \"---- Écart(s) de stock detecte(s), \" strBody = strBody & \"---- " & Now & ", \" strBody = strBody & \"---- Matiere/Lot :, " & codeMatiereXML & "/" & lotXML & "(" & descMatiere & ")" & ", \" strBody = strBody & \"---- Quantite ajustee :, " & qteXML & unitMatiere & " (Seuil d'alerte : " & seuilConf & unitMatiere & "), \" strBody = strBody & \"---- Quantite standard U.Stk :, " & quantiteStd & unitMatiere & ", \" strBody = strBody & \"---- Zone :, " & locationXML & ", \" strBody = strBody & " " strBody = strBody & "" End If strBody = " " & strBody
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionSet oFl = fso.GetFile(Path_ListeXML) If (oFl.Size <> "0") Then Do Until Fichier.AtEndOfStream MsgBox("Parcours des fichiers non déjà scannés") Fichier_Line = Fichier.ReadLine xmlDoc.load(Dossier & Fichier_Line) Set oElement = xmlDoc.documentElement ' Si le fichier n'est pas vide If Not oElement Is Nothing Then Set XmlAttrib = oElement.getElementsByTagName("rmks") 'MsgBox("OK") For Each x In XmlAttrib 'MsgBox("OK 2") '------------------------------------------------------------------------------------------------------------------------------- 'RECHERCHE DE WEIGHT ADJ If x.Text="WEIGHT ADJ" Then MsgBox("Le fichier " & Fichier_Line & " contient WEIGHT ADJ") '------------------------------------------------------------------------------------------------------------------------------- 'RECHERCHE DES VALEURS CLÉS FICHIERS XML For Each inventory In xmlDoc.selectNodes("/soapenv:Envelope/soapenv:Body/receiveInventory/inventoryReceipt") MsgBox("Récupération des valeurs du fichier XML") '** Code de la Matière ** codeMatiereXML = inventory.selectSingleNode("ptPart").Text '** Quantité XML ** quantiteXML = inventory.selectSingleNode("lotserialQty").Text qXML = Replace(quantiteXML,".",",") '** Zone ** locationXML = inventory.selectSingleNode("location").Text 'MsgBox(locationXML) '** Numéro de lot ** lotXML = inventory.selectSingleNode("lotserial").Text '-------------------------------------------------------------------------------------------------------------------------------- 'RECHERCHE VALEURS MATIÈRE A PARTIR DU FICHIER DE CONFIGURATION Set FileConfig = fso.OpenTextFile("P:\Detection Ajustement Stock\FichierConfiguration.txt",ForReading,True) FileConfig_data = FileConfig.ReadAll FileConfig.Close arrLines = Split(FileConfig_data,vbCrLf) '** Recherche Seuil d'alerte ** Set a = New RegExp a.Pattern = "seuil_" & codeMatiereXML a.IgnoreCase = True a.Global = False 'Renvoyer seulement la première occurrence For i = 0 To UBound(arrLines) occurrence = a.Test(arrLines(i)) If (occurrence = True) Then tab = Split(arrLines(i),"=") seuilAjustement = tab(1) sAjust = Replace(seuilAjustement,".",",") seuilConf = Csng(sAjust) qteXML = Csng(qXML) '** Écart de stock ** If (qteXML > seuilConf) Then MsgBox("Écart de stock dans le fichier " & Fichier_Line) '** Récupération de l'intitulé matière ** tab1 = Split(arrLines(i+1),"=") descM = tab1(1) descMatiere = Replace(descM,".",",") '** Récupération de la taille de l'unité de stock ** tab2 = Split(arrLines(i+2),"=") qStd = tab2(1) quantiteStd = Replace(qStd,".",",") '** Récuperation unité de poids ** tab3 = Split(arrLines(i+3),"=") unitMatiere = tab3(1) '** Corps du mail ** strBody = "" strBody = strBody & "" strBody = strBody & "\" strBody = strBody & \"---- Genzyme Lyon , \" strBody = strBody & \"---- Alerte MES, \" strBody = strBody & \"---- Écart(s) de stock detecte(s), \" strBody = strBody & \"---- " & Now & ", \" strBody = strBody & \"---- Matiere/Lot :, " & codeMatiereXML & "/" & lotXML & "(" & descMatiere & ")" & ", \" strBody = strBody & \"---- Quantite ajustee :, " & qteXML & unitMatiere & " (Seuil d'alerte : " & seuilConf & unitMatiere & "), \" strBody = strBody & \"---- Quantite standard U.Stk :, " & quantiteStd & unitMatiere & ", \" strBody = strBody & \"---- Zone :, " & locationXML & ", \" strBody = strBody & " " strBody = strBody & "" '** Appel fonction Mail ** Call SendMail("kevin.moine@genzyme.com", strBody, "Rapport Script") MsgBox("Mail envoyé") '** HISTORISATION => Écriture dans fichier Log.csv ** Set corps = fso.OpenTextFile("P:\Detection Ajustement Stock\Log.csv",ForAppending) Message = Fichier_Line & ";" & codeMatiereXML & ";" & lotXML & ";" & descMatiere & ";" & qteXML & ";" & locationXML corps.WriteLine Message corps.Close Else MsgBox("Aucun nouveau écart de stock détecté. Base à jour") End If Else '** Corps du mail ** strBody = "" strBody = strBody & "" strBody = strBody & "\" strBody = strBody & \"---- Genzyme Lyon , \" strBody = strBody & \"---- Alerte MES, \" strBody = strBody & \"---- Écart(s) de stock detecte(s), \" strBody = strBody & \"---- " & Now & ", \" strBody = strBody & \"---- Problème, Matiere non définie dans les valeurs d'ajustement : " & codeMatiereXML & ", \" strBody = strBody & " " strBody = strBody & "" '** Appel fonction Mail ** Call SendMail("kevin.moine@genzyme.com", strBody, "Rapport Script") MsgBox("Mail envoyé") End If Next Next End If Next End If Loop Else MsgBox("Tous les fichiers ont déjà été traités précedemment") End If 'strBody = " " & strBody