Aller directement au contenu principal

Personnalisation de la grille d'étalonnage et des paramètres de réussite/échec personnalisés

Imaginons que vous souhaitiez effectuer quelques opérations sur une grille de points de test d'étalonnage. Par exemple, si vous souhaitez définir vos propres critères pour la notation « Réussite/Échec ». Pour ce faire, il suffit d'ajouter d'abord un déclencheur d'événement personnalisé pour « Ajouter un équipement (après) ». Dans ce même code, vous pouvez également personnaliser l'affichage de la résolution et de la troncature pour chaque colonne, au-delà des paramètres habituels de configuration de la résolution. En définissant PassFailOverride sur True, vous permettez à votre code « Override » de s'exécuter en cas de réussite ou d'échec. ResOverride indique à votre programme de lier des champs afin que leur valeur soit dérivée d'autres champs. Vous pouvez également définir un « décalage » pour la résolution. Pour qu'un champ « tronque » les données en fonction de sa résolution, définissez la valeur TruncFIELDNAME sur True.

Vous pouvez utiliser le code suivant :

sCompany = LookupEquipmentCompany

sID = LookupEquipmentID

Si sID <> "" alors

CurrentTolDir = ReturnFromSQL("SELECT TOL_DIRECTION FROM GAGES WHERE COMPANY='" & sCompany & "' AND GAGE_SN='" & sID & "'")

Si CurrentTolDir = "SPECIAL TOL." alors

PassFailOverride = True <-- Ceci

ResOverride = True

TruncTol = True

SetResTol = True

ResFieldTol = "AV_RES"

TruncStandard = True

SetResStandard = True

ResFieldStandard = "NUM_RESOLUTION"

ResStandardOffset = 1

TruncExtra4 = True

SetResExtra4 = True

ResFieldExtra4 = "NUM_RESOLUTION"

ResExtra4Offset = 1

TruncExtra3 = True

SetResExtra3 = True

ResFieldExtra3 = "AV_RES"

TruncExtra5 = True

SetResExtra5 = True

ResFieldExtra5 = "AV_RES"

SetResAVResult = True

ResFieldAVResult = "AV_RES"

SetResExtra2 = True

ResFieldExtra2 = "AV_RES"

SetResUsedWarnTol = True

ResFieldUsedWarnTol = "AV_RES"

ResUsedWarnTolOffset = 2

else

PassFailOverride = False

ResOverride = False

end if

end if

Remarque : cela ne modifierait la grille que pour les nouveaux événements après l'ajout de matériel. Répétez cette même logique dans un « Lancement (Fin) de l'événement » afin de prendre également en compte les événements en cours de modification.

Pour remplacer le résultat « Réussite/Échec », vous pouvez utiliser le code ci-dessous dans une action de déclencheur « Point de test avant publication » :

Si PassFailOverride = True alors

dStandard = tpFieldByNameAsFloat("LINE_STANDARD")

dTolPlus = tpFieldByNameAsFloat("TOLERANCE1")

dTolMinus = tpFieldByNameAsFloat("TOLERANCE2")

dAsFound = tpFieldByNameAsFloat("RESULT1")

dAsLeft = tpFieldByNameAsFloat("RESULT2")

sFailed = tpFieldByNameAsString("OUT_OF_TOL")

sAdjusted = tpFieldByNameAsString("ADJUSTED")

sROV = tpFieldByNameAsString("ROV")

sLimited = tpFieldByNameAsString("LIMITED")

iAV_RES = tpFieldBynameAsInteger("AV_RES")

dCalTol = tpFieldByNameAsFloat("TEST_ACCURACY")

If (DualTolerance = True) then

dTolMinus2 = tpFieldByNameAsFloat("EXTRA_NUM3")

dStandard2 = tpFieldByNameAsFloat("EXTRA_NUM4")

dTolPlus2 = tpFieldByNameAsFloat("EXTRA_NUM5")

else

dTolMinus2 = dTolMinus

dStandard2 = dStandard

dTolPlus2 = dTolPlus2

end if

Si ((tpFieldIsNull("RESULT1") <> "1") et (tpFieldIsNull("LINE_STANDARD") <> "1")) then

dCalcDev = (dAsFound - dStandard)

tpSetFieldByNameAsFloat("UTOLERANCE2_WARN", dCalcDev)

dCalcDev = RoundToDecimal(dCalcDev,iAV_RES)

tpSetFieldByNameAsFloat("AV_AS_FOUND", dCalcDev)

else

tpSetFieldByNameNull("UTOLERANCE2_WARN")

tpSetFieldByNameNull("AV_AS_FOUND")

end if

Si (DualTolerance = True), alors

Si ((tpFieldIsNull("RESULT2") <> "1") et (tpFieldIsNull("EXTRA_NUM4") <> "1")) alors

dCalcDev2 = (dAsLeft - dStandard2)

tpSetFieldByNameAsFloat("UTOLERANCE1_WARN", dCalcDev2)

dCalcDev2 = RoundToDecimal(dCalcDev2,iAV_RES)

tpSetFieldByNameAsFloat("EXTRA_NUM2", dCalcDev2)

else

tpSetFieldByNameNull("UTOLERANCE1_WARN")

tpSetFieldByNameNull("EXTRA_NUM2")

end if

else

If ((tpFieldIsNull("RESULT2") <> "1") and (tpFieldIsNull("LINE_STANDARD") <> "1")) then

dCalcDev2 = (dAsLeft - dStandard2)

tpSetFieldByNameAsFloat("UTOLERANCE1_WARN", dCalcDev2)

dCalcDev2 = RoundToDecimal(dCalcDev2,iAV_RES)

tpSetFieldByNameAsFloat("EXTRA_NUM2", dCalcDev2)

else

tpSetFieldByNameNull("UTOLERANCE1_WARN")

tpSetFieldByNameNull("EXTRA_NUM2")

end if

end if

sVerdict = tpFieldByNameAsString("VERDICT")

Si sVerdict = "" alors

iFromType = 1

sinonSi sVerdict = "F" alors

iFromType = 2

sinonSi sVerdict = "A" alors

iFromType = 3

sinonSi sVerdict = "L" alors

iFromType = 4

sinonSi sVerdict = "R" alors

iFromType = 5

fin si

Si iFromType = 2, alors

CalFailed = (CalFailed - 1)

sinon si iFromType = 3, alors

CalFailed = (CalFailed - 1)

CalAdjusted = (CalAdjusted - 1)

sinon si iFromType = 4, alors

CalFailed = (CalFailed - 1)

CalLimited = (CalLimited - 1)

elseIf iFromType = 5 then

CalROV = (CalROV - 1)

end if

Si (tpFieldIsNull("AV_AS_FOUND") <> "1") alors

Si (CDbl(Abs(tpFieldByNameAsFloat("AV_AS_FOUND"))) <= CDbl(dCalTol)) alors

sNewVerdict = ""

sinon

sNewVerdict = "F"

fin si

sinon

sNewVerdict = ""

fin si

Si sFailed = "1" alors

sNewVerdict = "F"

fin si

Si sNewVerdict = "F" alors

Si (tpFieldIsNull("EXTRA_NUM2") <> "1") then

If (CDbl(Abs(tpFieldByNameAsFloat("EXTRA_NUM2"))) <= CDbl(dCalTol)) then

sNewVerdict = "A"

end if

end if

If sAdjusted = "1" then

sNewVerdict = "A"

end if

end if

If sNewVerdict = « F », alors

Si sLimited = « 1 », alors

sNewVerdict = « L »

fin si

fin si

Si sROV = « 1 », alors

sNewVerdict = « R »

fin si

sVerdict = sNewVerdict

; Si sVerdict = "" alors

; iToType = 1

; sinon si sVerdict = "F" alors

; iToType = 2

; sinon si sVerdict = "A" alors

; iToType = 3

; sinon si sVerdict = "L" alors

; iToType = 4

; sinon si sVerdict = "R" alors

; iToType = 5

; fin si

tpSetFieldByNameAsString("VERDICT", sVERDICT)

Si iToType = 2 alors

CalFailed = (CalFailed + 1)

sinonSi iToType = 3 alors

CalFailed = (CalFailed + 1)

CalAdjusted = (CalAdjusted + 1)

sinonSi iToType = 4 alors

CalFailed = (CalFailed + 1)

CalLimited = (CalLimited + 1)

elseIf iToType = 5 then

CalROV = (CalROV + 1)

end if

end if |