?? 設備檔案_設備故障顯示.frm
字號:
EndProperty
EndProperty
End
End
Begin VB.Label Lab_OperStatus
BackColor = &H000080FF&
Caption = "1"
Height = 345
Left = 10980
TabIndex = 5
Top = 1590
Visible = 0 'False
Width = 345
End
End
Attribute VB_Name = "Dev_ListMalfunctionForm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'**************************************************************************************************
'* 模 塊 名 稱 :設備故障顯示
'* 功 能 描 述 :
'* 程序員姓名 :王哲
'* 最后修改人 :王哲
'* 最后修改時間:2001/10/16
'* 備 注:程序中所有依實際情況自定義部分均用[>> <<]括起,注意此種錄入需要修改"Sub Scdqfl"
'*
'* 1.每次調入外部功能窗體,均要加鎖ChangeLock=True,窗體關閉后解鎖ChangeLock=false
'*
'* 3.Lab_OperStatus 用此標簽來標識單據錄入狀態(默認值為1) 1-瀏覽 2-修改
'**************************************************************************************************
'以下為自定義變量
'其它固定使用變量
Dim Tsxx As String '系統信息提示(Fixed)
Dim ReportTitle As String '報表主標題(Fixed)
'以下為固定使用變量(網格)
Dim Cxnrrec As New ADODB.Recordset '顯示查詢內容動態集
Dim Dyymctbl As New DY_Dyymsz '打印頁面窗體變量
Dim GridCode As String '顯示網格網格代碼
Dim GridInf() As Variant '整個網格設置信息
Dim Pmbcsjhs As Long '屏幕網格保持數據行數(大于等于1)
Dim Fzxwghs As Integer '輔助項網格行數(包括合計行)
Dim Sfxshjwg As Boolean '是否顯示合計網格
Dim Qslz As Long '網格隱藏(非操作顯示)列數
Dim Sjhgd As Double '網格數據行高度
Dim GridBoolean() As Boolean '網格列信息(布爾型)
Dim GridStr() As String '網格列信息(字符型)
Dim GridInt() As Integer '網格列信息(整型)
Dim Sfblbzkd As Boolean '是否保留幫助寬度(字段提供幫助時,是否為按鈕保留空間)
Dim Dqlrwgh As Long '當前錄入數據網格行
Dim Dqlrwgl As Long '當前錄入數據網格列
Dim Dqlkwgh As Long '剛剛離開網格行(不一定為錄入行)
Dim Dqlkwgl As Long '剛剛離開網格列
Dim Dqtoprow As Long '當前錄入狀態時最上端可視行
Dim Dqleftcol As Long '當前錄入狀態時最左端可視列
Dim Zdlrqnr As String '字段錄入修改前內容(用來判斷內容是否修改)
Dim Wbkbhlock As Boolean '文本框改變值鎖
Dim Changelock As Boolean '網格行列改變控制鎖(用來區別用戶改變.程序改變)
Dim Gdtlock As Boolean '滾動條滾動控制(用來區別用戶改變.程序改變)
Dim Yxxpdlock As Boolean '字段有效性判斷鎖(內容不修改不需進行字段有效性判斷)
Dim Hyxxpdlock As Boolean '行有效性判斷鎖(字段內容不修改不需進行行有效性判斷)
Dim Valilock As Boolean '文本框失去焦點是否進行有效性控制(TRUE 為鎖定*限用網格錄入)
Dim Shsfts As Boolean '刪除記錄行是否提示
Dim Szzls As Integer '網格信息數組最大下標值(網格列數-1)
Private Sub Form_KeyPress(KeyAscii As Integer) '控制焦點轉移和限制錄入字符"'"
Select Case KeyAscii
Case 39 '屏蔽字符"'"
KeyAscii = 0
End Select
End Sub
Private Sub Form_Load() '窗 體 裝 入
'初始化各種鎖值(Fixed)
Changelock = False '網格行列改變控制鎖
Gdtlock = False '滾動條滾動控制
Yxxpdlock = True '字段有效性判斷鎖
Hyxxpdlock = True '行有效性判斷鎖
Wbkbhlock = False '文本框內容改變鎖
'報表主標題及報表編碼(Fixed)
ReportTitle = "設備故障顯示"
XtReportCode = "Dev_Malfunc"
Load Dyymctbl
'調 入 網 格(Fixed)
GridCode = "Dev_Malfunc" '網格屬性編碼
Call BzWgcsh(WglrGrid, GridCode, GridInf(), GridBoolean(), GridInt(), GridStr())
Qslz = GridInf(1)
Sjhgd = GridInf(2)
Pmbcsjhs = GridInf(3)
Fzxwghs = GridInf(4)
Sfblbzkd = GridInf(5)
Shsfts = GridInf(6)
Sfxshjwg = GridInf(7)
Szzls = WglrGrid.Cols - 1
'設置標題欄寬度、網格寬度高度(Fixed)
Pic_Title.Move 50, Pic_Title.Top, Me.Width - 150, Pic_Title.Height
WglrGrid.Move 50, Pic_Title.Top + Pic_Title.Height, Me.Width - 150
WglrGrid.Height = Me.Height - WglrGrid.Top - 380
'生成查詢結果
Call Sub_Query
'設置狀態為修改狀態
Lab_OperStatus = "2"
End Sub
Private Sub Form_Unload(Cancel As Integer) '窗體卸載
'調入其它窗體或功能產生的有效性判斷(包括數據回寫)
If Not Fun_Drfrmyxxpd Then
Cancel = True
Exit Sub
End If
'卸載打印頁面窗體
Unload Dyymctbl
End Sub
Private Sub Sub_Query() '生成查詢結果
Dim Sqlstr As String '臨時使用字符串
Dim RecTemp As New ADODB.Recordset '臨時使用動態集
Dim jsqte As Long '臨時計數器
Dim RecMain As New ADODB.Recordset
'禁止網格刷新動作,為加快網格顯示速度(Fixed)
WglrGrid.Redraw = False
'查詢字符串
Sqlstr = "SELECT Dev_V_Malfunction.* FROM Dev_V_Malfunction where DEVID='" & StrTemp & "'"
Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
With RecTemp
WglrGrid.Rows = WglrGrid.FixedRows
jsqte = WglrGrid.FixedRows
Do While Not .EOF
WglrGrid.AddItem ""
WglrGrid.TextMatrix(jsqte, 0) = .Fields("MalfunctionID") '故障ID
WglrGrid.TextMatrix(jsqte, Sydz("001", GridStr(), Szzls)) = Trim(.Fields("MalfunCode")) '故障編號
WglrGrid.TextMatrix(jsqte, Sydz("002", GridStr(), Szzls)) = Trim(.Fields("DEVID") & "") '設備編號
WglrGrid.TextMatrix(jsqte, Sydz("003", GridStr(), Szzls)) = Trim(.Fields("Dname") & "") '設備名稱
WglrGrid.TextMatrix(jsqte, Sydz("004", GridStr(), Szzls)) = Trim(.Fields("Model") & "") '規格型號
WglrGrid.TextMatrix(jsqte, Sydz("005", GridStr(), Szzls)) = Trim(.Fields("DeptName") & "") '所屬部門
WglrGrid.TextMatrix(jsqte, Sydz("006", GridStr(), Szzls)) = Trim(.Fields("ConkPheno") & "") '故障現象
WglrGrid.TextMatrix(jsqte, Sydz("007", GridStr(), Szzls)) = Trim(.Fields("RepairName") & "") '維修人員
WglrGrid.TextMatrix(jsqte, Sydz("008", GridStr(), Szzls)) = Trim(.Fields("RprPosition") & "") '維修部位
WglrGrid.TextMatrix(jsqte, Sydz("009", GridStr(), Szzls)) = Trim(.Fields("RepairUnit") & "") '維修單位
WglrGrid.TextMatrix(jsqte, Sydz("010", GridStr(), Szzls)) = Val(.Fields("WorkHour")) '工時
WglrGrid.TextMatrix(jsqte, Sydz("011", GridStr(), Szzls)) = Trim(.Fields("ConkOutCause") & "") '故障原因
WglrGrid.TextMatrix(jsqte, Sydz("012", GridStr(), Szzls)) = Trim(.Fields("DealResult") & "") '處理結果
WglrGrid.TextMatrix(jsqte, Sydz("013", GridStr(), Szzls)) = Format(.Fields("ArisesDate"), "yyyy-mm-dd") '發生日期
WglrGrid.TextMatrix(jsqte, Sydz("014", GridStr(), Szzls)) = Val(.Fields("StopTime") & "") '停機臺時
WglrGrid.TextMatrix(jsqte, Sydz("015", GridStr(), Szzls)) = Trim(.Fields("ListName") & "") '故障類型
WglrGrid.TextMatrix(jsqte, Sydz("016", GridStr(), Szzls)) = Trim(.Fields("PersonName") & "") '操作人員
WglrGrid.TextMatrix(jsqte, Sydz("017", GridStr(), Szzls)) = Trim(.Fields("Remark") & "") '備注
WglrGrid.TextMatrix(jsqte, Sydz("018", GridStr(), Szzls)) = Trim(.Fields("Maker") & "") '制表人
WglrGrid.TextMatrix(jsqte, Sydz("019", GridStr(), Szzls)) = Trim(.Fields("MakerDate") & "") '制表日期
WglrGrid.TextMatrix(jsqte, Sydz("020", GridStr(), Szzls)) = Trim(.Fields("Checker") & "") '審核人
WglrGrid.RowHeight(jsqte) = Sjhgd
.MoveNext
jsqte = jsqte + 1
Loop
End With
'將網格刷新解禁(Fixed)
WglrGrid.Redraw = True
'調整網格(Fixed)
End Sub
Private Sub Tlb_Action_ButtonClick(ByVal Button As MSComctlLib.Button) '用戶點擊工具條
'屏蔽文本框,下拉組合框有效性判斷
Valilock = True
'屏蔽網格失去焦點產生的有效性判斷
Changelock = True
Select Case Button.Key
Case "ymsz" '頁面設置
Dyymctbl.Show 1
Case "yl" '預 覽
If Fun_Drfrmyxxpd Then
Call bbyl(True)
End If
Case "dy" '打 印
If Fun_Drfrmyxxpd Then
Call bbyl(False)
End If
Case "bz" '幫 助
Call F1bz
Case "fh" '退 出
Unload Me
End Select
'解 鎖
Valilock = False
Changelock = False
End Sub
Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer) '支持熱鍵操作
If Shift = 2 Then
Select Case UCase(Chr(KeyCode))
Case "P" 'Ctrl+P 打印
If Tlb_Action.Buttons("dy").Enabled Then
Call bbyl(False)
End If
End Select
End If
End Sub
Private Sub Wbkcl() '文本框錄入之前處理(根據實際情況)
Dim xswbrr As String
With WglrGrid
Zdlrqnr = Trim(.Text)
xswbrr = Trim(.Text)
If GridBoolean(.Col, 3) Then '列表框錄入
'填充列表框程序
Call FillCombo(YdCombo, GridStr(.Col, 5), xswbrr, 0)
Else
Wbkbhlock = True
'====以下為用戶自定義
Ydtext.Text = xswbrr
'====以上為用戶自定義
Wbkbhlock = False
Ydtext.SelStart = Len(Ydtext.Text)
End If
End With
End Sub
'===================以 下 程 序 為 通 用 部 分 ,一 般 不 需 更 改(程序動作部分)======================='
Private Sub Lrzdbz() '錄入字段幫助
If Not Ydcommand.Visible Then
Exit Sub
End If
With WglrGrid
Valilock = True
'處理通用部分
Changelock = True '調入另外窗體必須加鎖
Call Drbmhelp(GridInt(.Col, 6), GridStr(.Col, 3), Trim(Ydtext.Text))
Changelock = False
If Len(Xtfhcs) <> 0 Then
If GridInt(.Col, 7) = 0 Then
Ydtext.Text = Xtfhcs
Else
Ydtext.Text = Xtfhcsfz
End If
End If
Valilock = False
If Ydtext.Visible Then
Ydtext.SetFocus
End If
End With
End Sub
Private Sub Form_Resize() '窗體大小發生變化時,重新顯示文本框
Call Cxxswbk
End Sub
Private Function Fun_Drfrmyxxpd() As Boolean '調入其它窗體或功能產生的有效性判斷(包括數據回寫)
Fun_Drfrmyxxpd = True
With WglrGrid
'如果當前網格處于編輯狀態,則先進行數據回寫再進行有效性判斷
'進行行有效性判斷
End With
End Function
Private Sub WglrGrid_EnterCell() '顯示當前數據行相關信息
With WglrGrid
If .Row >= .FixedRows Then
'[>>
'此處可以填寫顯示與此網格行相關信息
'<<]
End If
End With
End Sub
Private Sub WglrGrid_GotFocus() '網格得到焦點
'網格得到焦點,如果當前選擇行為非數據行
'則調整當前焦點至有效數據行
With WglrGrid
If .Row < .FixedRows And .Rows > .FixedRows Then
Changelock = True
.Select .FixedRows, .Col
Changelock = False
End If
If .Col < Qslz Then
Changelock = True
.Select .Row, Qslz
Changelock = False
End If
End With
End Sub
Private Sub WglrGrid_LostFocus() '錄入網格失去焦點
'用以屏蔽調用其它窗體時發生網格失去焦點事件
If Changelock Then
Exit Sub
End If
'引發網格RowcolChange事件
With WglrGrid
If Not (Ydtext.Visible Or YdCombo.Visible) Then
.Select 0, 0
End If
End With
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -