310 lines
9.4 KiB
Plaintext
310 lines
9.4 KiB
Plaintext
VERSION 5.00
|
|
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
|
|
Begin VB.Form frmAuslieferung
|
|
Caption = "Pruef2000 US Auslieferung"
|
|
ClientHeight = 5610
|
|
ClientLeft = 60
|
|
ClientTop = 345
|
|
ClientWidth = 8730
|
|
LinkTopic = "Form2"
|
|
ScaleHeight = 5610
|
|
ScaleWidth = 8730
|
|
StartUpPosition = 3 'Windows-Standard
|
|
Begin VB.CommandButton cmdClose
|
|
Caption = "Schließen"
|
|
Height = 495
|
|
Left = 4290
|
|
TabIndex = 3
|
|
Top = 5010
|
|
Width = 1605
|
|
End
|
|
Begin VB.Timer Timer1
|
|
Left = 2520
|
|
Top = 4980
|
|
End
|
|
Begin VB.CommandButton cmdDurchfuehren
|
|
Caption = "Auslieferung mehrfach starten"
|
|
Height = 495
|
|
Left = 6150
|
|
TabIndex = 2
|
|
Top = 5010
|
|
Width = 2385
|
|
End
|
|
Begin MSFlexGridLib.MSFlexGrid MSFlexGrid1
|
|
Height = 2925
|
|
Left = 30
|
|
TabIndex = 0
|
|
Top = 1860
|
|
Width = 8655
|
|
_ExtentX = 15266
|
|
_ExtentY = 5159
|
|
_Version = 393216
|
|
Rows = 11
|
|
Cols = 5
|
|
AllowUserResizing= 3
|
|
End
|
|
Begin VB.Label Label1
|
|
Caption = "Label1"
|
|
Height = 1605
|
|
Left = 120
|
|
TabIndex = 4
|
|
Top = 60
|
|
Width = 8445
|
|
End
|
|
Begin VB.Label lblAutosize
|
|
Caption = "lblAutosize"
|
|
Height = 375
|
|
Left = 210
|
|
TabIndex = 1
|
|
Top = 5100
|
|
Visible = 0 'False
|
|
Width = 1395
|
|
End
|
|
End
|
|
Attribute VB_Name = "frmAuslieferung"
|
|
Attribute VB_GlobalNameSpace = False
|
|
Attribute VB_Creatable = False
|
|
Attribute VB_PredeclaredId = True
|
|
Attribute VB_Exposed = False
|
|
Option Explicit
|
|
|
|
Public m_colEinbauplatz As Collection
|
|
Private m_intAnzahlInstanzen As Integer
|
|
|
|
' Einbauplatz 0
|
|
' Abschluss 1
|
|
Const COLCHECK = 1
|
|
' SerienNr 2
|
|
' FabNr 3
|
|
' Status 4
|
|
Const COLSTATUS = 4
|
|
'Schloss
|
|
Const COLLOCK = 5
|
|
' ProzessID 6
|
|
Const COLPROZESSID = 6
|
|
'
|
|
|
|
|
|
|
|
Private Sub cmdClose_Click()
|
|
Unload Me
|
|
End Sub
|
|
|
|
Private Sub cmdDurchfuehren_Click()
|
|
|
|
Dim Pruefzaehler As CPruefzaehler
|
|
Dim Einbauplatz As CEinbauplatz
|
|
Dim strCOM As String
|
|
Dim strKommando As String
|
|
Dim lngProzessId As Long
|
|
|
|
strKommando = g_App.Settings.GetAuslieferung()
|
|
|
|
If strKommando = "" Then
|
|
MsgBox "Der Pfad zum Programm 'Auslieferung' ist nicht in der Ini-Datei definiert."
|
|
Exit Sub
|
|
End If
|
|
|
|
cmdDurchfuehren.Enabled = False
|
|
cmdClose.Enabled = False
|
|
|
|
For Each Einbauplatz In m_colEinbauplatz
|
|
Set Pruefzaehler = Einbauplatz.getPruefzaehler
|
|
If Not Pruefzaehler Is Nothing Then
|
|
Select Case MSFlexGrid1.TextMatrix(Einbauplatz.getNr, 1)
|
|
Case Chr(111)
|
|
' unchecked
|
|
MSFlexGrid1.TextMatrix(Einbauplatz.getNr, COLSTATUS) = "abgewählt"
|
|
Case Chr(254)
|
|
' checked
|
|
' starte Auslieferung für diesen Einbauplatz
|
|
strCOM = g_App.Settings.getUSComPort(Einbauplatz.getNr)
|
|
ExecuteAndWait strKommando, "/COM " & strCOM & " /EBP " & Einbauplatz.getNr & " /END", Me.hwnd, 1, False, lngProzessId
|
|
MSFlexGrid1.TextMatrix(Einbauplatz.getNr, COLPROZESSID) = lngProzessId
|
|
If lngProzessId > 0 Then
|
|
m_intAnzahlInstanzen = m_intAnzahlInstanzen + 1
|
|
MSFlexGrid1.TextMatrix(Einbauplatz.getNr, COLSTATUS) = "läuft"
|
|
Else
|
|
MSFlexGrid1.TextMatrix(Einbauplatz.getNr, COLSTATUS) = "Fehler"
|
|
End If
|
|
End Select
|
|
End If
|
|
MSFlexGrid1.row = Einbauplatz.getNr
|
|
MSFlexGrid1.Col = 0
|
|
Next
|
|
|
|
AutoSpaltenBreite MSFlexGrid1, lblAutosize
|
|
MSFlexGrid1.ColWidth(4) = 1980
|
|
|
|
Timer1.Interval = 500
|
|
Timer1.Enabled = True
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
Private Sub Form_Load()
|
|
Dim Pruefzaehler As CPruefzaehler
|
|
Dim Einbauplatz As CEinbauplatz
|
|
|
|
MSFlexGrid1.Clear
|
|
InitFlexgrid
|
|
|
|
Label1.Caption = "Das Programm 'Auslieferung' wird nun mehrfach (d.h. in mehreren Instanzen) für jeden eingebauten Zähler gestartet."
|
|
Label1.Caption = Label1.Caption & "Alle Instanzen müssen von Ihnen bedient werden." & vbCrLf
|
|
Label1.Caption = Label1.Caption & "Sie können den Status der einzelnen Instanzen in der unteren Tabelle sehen."
|
|
Label1.Caption = Label1.Caption & "Um zwischen den einzelnen Instanzen zu wechseln, können Sie die Tasten ALT + TAB benutzen." & vbCrLf
|
|
Label1.Caption = Label1.Caption & "Nach dem Starten können Sie dieses Formular erst schließen, wenn alle Instanzen von 'Auslieferung' beendet worden sind."
|
|
|
|
|
|
MSFlexGrid1.FormatString = "Einbauplatz|Abschluss|SerienNr|FabNr|Status|Schloss|ProzessID"
|
|
|
|
MSFlexGrid1.FixedRows = 1
|
|
|
|
For Each Einbauplatz In m_colEinbauplatz
|
|
MSFlexGrid1.row = Einbauplatz.getNr
|
|
MSFlexGrid1.Col = 0
|
|
MSFlexGrid1.text = Einbauplatz.getNr
|
|
Set Pruefzaehler = Einbauplatz.getPruefzaehler
|
|
If Pruefzaehler Is Nothing Then
|
|
MSFlexGrid1.Col = 1
|
|
MSFlexGrid1.text = ""
|
|
Else
|
|
MSFlexGrid1.Col = 1
|
|
MSFlexGrid1.text = Chr(254)
|
|
MSFlexGrid1.Col = 2
|
|
MSFlexGrid1.text = Pruefzaehler.getSerienNr
|
|
MSFlexGrid1.Col = 3
|
|
MSFlexGrid1.text = Pruefzaehler.getAuftragPositionSerienNr.getFabNr
|
|
End If
|
|
Next
|
|
|
|
AutoSpaltenBreite MSFlexGrid1, lblAutosize
|
|
MSFlexGrid1.ColWidth(4) = 1980
|
|
End Sub
|
|
|
|
|
|
Private Sub MSFlexGrid1_Click()
|
|
' Beim Klick auf eine CheckBox-Spalte, Status ändern
|
|
With MSFlexGrid1
|
|
If .MouseRow >= .FixedRows And .MouseCol = 1 Then
|
|
Select Case .text
|
|
Case Chr(111)
|
|
.text = Chr(254)
|
|
Case Chr(254)
|
|
.text = Chr(111)
|
|
Case Else
|
|
End Select
|
|
End If
|
|
|
|
If Val(.TextMatrix(.MouseRow, COLPROZESSID)) > 0 Then
|
|
' Prozess in den Vordergrund holen
|
|
End If
|
|
End With
|
|
|
|
End Sub
|
|
|
|
|
|
Private Sub InitFlexgrid()
|
|
With MSFlexGrid1
|
|
' autom. Neuzeichen ausschalten
|
|
.Redraw = False
|
|
|
|
' FlexGrid mit 100 Zeilen und 4 Spalten füllen
|
|
.Rows = 11
|
|
.Cols = 5
|
|
|
|
' autom. Scrollen des Inhalts beim
|
|
' Ziehen des Scrollbalkens aktivieren
|
|
.ScrollTrack = True
|
|
|
|
' aktuelle Zelle (Startzelle)
|
|
.row = .FixedRows
|
|
.Col = .FixedCols
|
|
|
|
' alle Zeilen selektieren
|
|
.RowSel = .Rows - 1
|
|
.ColSel = .Col
|
|
|
|
' nachfolgende Zellen-Zuweisungen autom. für
|
|
' den selektierten Bereich wiederholen
|
|
.FillStyle = flexFillRepeat
|
|
|
|
' Ausrichtung der Zellen: zentriert
|
|
.CellAlignment = 1
|
|
|
|
' Schriftart und -größe zuweisen
|
|
.CellFontName = "Wingdings"
|
|
.CellFontSize = 14
|
|
|
|
' Spaltenbreite festlegen
|
|
.ColWidth(.Col) = 350
|
|
|
|
' Inhalt allen Zellen der 1. Spalte vorbelegen
|
|
' (CheckBox)
|
|
'.text = Chr(254)
|
|
'.text = Chr(111)
|
|
|
|
.FillStyle = flexFillSingle
|
|
.row = .FixedRows
|
|
.Col = .FixedCols
|
|
|
|
' autom. Neuzeichnen aktivieren
|
|
.Redraw = True
|
|
End With
|
|
End Sub
|
|
|
|
Private Sub Timer1_Timer()
|
|
Dim Pruefzaehler As CPruefzaehler
|
|
Dim Einbauplatz As CEinbauplatz
|
|
Dim lngProzessId As Long
|
|
Dim lngReturn As Long
|
|
Dim strCOM As String
|
|
Dim blnOffen As Boolean
|
|
|
|
Dim blnNochZaehlerOffen As Boolean
|
|
blnNochZaehlerOffen = False
|
|
|
|
For Each Einbauplatz In m_colEinbauplatz
|
|
Set Pruefzaehler = Einbauplatz.getPruefzaehler
|
|
If Not Pruefzaehler Is Nothing Then
|
|
lngProzessId = Val(MSFlexGrid1.TextMatrix(Einbauplatz.getNr, COLPROZESSID))
|
|
If lngProzessId > 0 Then
|
|
lngReturn = WaitForSingleObject(lngProzessId, 0)
|
|
If lngReturn = 0 Then
|
|
' Programm beendet
|
|
|
|
MSFlexGrid1.TextMatrix(Einbauplatz.getNr, COLSTATUS) = "beendet"
|
|
MSFlexGrid1.TextMatrix(Einbauplatz.getNr, COLPROZESSID) = ""
|
|
m_intAnzahlInstanzen = m_intAnzahlInstanzen - 1
|
|
|
|
strCOM = g_App.Settings.getUSComPort(Einbauplatz.getNr)
|
|
lngReturn = modUSchall.USGetSchlossOffen(Einbauplatz.getNr, blnOffen)
|
|
If lngReturn = 0 Then
|
|
If blnOffen = True Then
|
|
MSFlexGrid1.TextMatrix(Einbauplatz.getNr, COLLOCK) = "Offen"
|
|
blnNochZaehlerOffen = True
|
|
Else
|
|
MSFlexGrid1.TextMatrix(Einbauplatz.getNr, COLLOCK) = "Geschlossen"
|
|
MSFlexGrid1.TextMatrix(Einbauplatz.getNr, COLCHECK) = Chr(111)
|
|
End If
|
|
Else
|
|
' Fehler:
|
|
MSFlexGrid1.TextMatrix(Einbauplatz.getNr, COLLOCK) = "? Fehler " & lngReturn
|
|
End If
|
|
End If
|
|
End If
|
|
End If
|
|
Next
|
|
AutoSpaltenBreite MSFlexGrid1, lblAutosize
|
|
MSFlexGrid1.ColWidth(4) = 1980
|
|
|
|
If m_intAnzahlInstanzen = 0 Then
|
|
If blnNochZaehlerOffen = False Then
|
|
cmdClose.Enabled = True
|
|
End If
|
|
cmdDurchfuehren.Enabled = True
|
|
End If
|
|
|
|
End Sub
|