📄 frmproductionprogressitemdate2.frm
字号:
VERSION 5.00
Object = "{4932CEF1-2CAA-11D2-A165-0060081C43D9}#2.0#0"; "Actbar2.OCX"
Object = "{0ECD9B60-23AA-11D0-B351-00A0C9055D8E}#6.0#0"; "MSHFLXGD.OCX"
Begin VB.Form frmProductionProgressItemDate2
Caption = "絲光"
ClientHeight = 6285
ClientLeft = 60
ClientTop = 345
ClientWidth = 7380
LinkTopic = "Form1"
ScaleHeight = 6285
ScaleWidth = 7380
StartUpPosition = 3 'Windows Default
Begin ActiveBar2LibraryCtl.ActiveBar2 ActiveBar21
Height = 6285
Left = 0
TabIndex = 0
Top = 0
Width = 7380
_LayoutVersion = 1
_ExtentX = 13018
_ExtentY = 11086
_DataPath = ""
Bands = "frmProductionProgressItemDate2.frx":0000
Begin VB.Frame Frame1
Height = 5715
Left = 0
TabIndex = 1
Top = 480
Width = 7275
Begin VB.TextBox txtOrderNo
Height = 285
Left = 7200
TabIndex = 2
Top = 4860
Visible = 0 'False
Width = 375
End
Begin MSHierarchicalFlexGridLib.MSHFlexGrid MSHF1
Height = 5355
Left = 120
TabIndex = 3
Top = 240
Width = 7035
_ExtentX = 12409
_ExtentY = 9446
_Version = 393216
AllowUserResizing= 1
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_NumberOfBands = 1
_Band(0).Cols = 2
End
End
End
End
Attribute VB_Name = "frmProductionProgressItemDate2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim lngrow As Integer
Dim newItem As Boolean
Private Sub ActiveBar21_ToolClick(ByVal Tool As ActiveBar2LibraryCtl.Tool)
Select Case Tool.Name
Case "cmdAdd":
NewOperatorInf
Case "cmdEdit":
EditOperatorInf
Case "cmdDel":
DelOperatorInf
Case "cmdCancel":
Unload Me
End Select
End Sub
Private Sub Form_Load()
Me.Move (Screen.Width - Me.Width) \ 2, (Screen.Height - Me.Height) \ 2
' ReadCustomerPurveyInf
ActiveBar21.Bands("toolbar").Tools.item("cmdDel").Enabled = False
ActiveBar21.Bands("toolbar").Tools.item("cmdEdit").Enabled = False
Me.Caption = "絲光"
HookWheel Me.hwnd
End Sub
Public Sub FillMshf1(ByVal strId As String)
Dim rs As ADODB.Recordset
Dim strCap As String
strCap = Me.Caption
Me.Caption = "正在读取资料..."
Screen.MousePointer = vbHourglass
On Error GoTo errLabel
Set rs = New ADODB.Recordset
With rs
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.LockType = adLockOptimistic
Set .ActiveConnection = Cn
End With
rs.Open "SELECT * from tProductionProcess where orderno='" & strId & "' and ItemDate2<>''"
With MSHF1
.Redraw = False
.Rows = 2
.Cols = 4
.Clear
'初始化
.WordWrap = False
.TextMatrix(0, 0) = "序号"
.ColWidth(0) = 600
.TextMatrix(0, 1) = "加工單號"
.ColWidth(1) = 1500
.TextMatrix(0, 2) = "絲光"
.ColWidth(2) = 2000
.TextMatrix(0, 3) = ""
.ColWidth(3) = 0
'.....................................................
.Rows = rs.RecordCount + 2
'On Error Resume Next
Dim i As Integer
For lngrow = 2 To rs.RecordCount + 1
.TextMatrix(lngrow, 0) = lngrow - 1
.TextMatrix(lngrow, 1) = NullValue(rs.Fields!OrderNo)
.TextMatrix(lngrow, 2) = NullValue(rs.Fields!ItemDate2)
.TextMatrix(lngrow, 3) = NullValue(rs.Fields!ID)
rs.MoveNext
Next
lngrow = 0
.TextMatrix(1, 0) = "总计"
.TextMatrix(1, 1) = .Rows - 2
SetItemBackColor MSHF1
.Redraw = True
End With
rs.Close
Set rs = Nothing
Me.Caption = strCap
Screen.MousePointer = vbDefault
remClear:
Set rs = Nothing
Me.Caption = strCap
Screen.MousePointer = vbDefault
Exit Sub
errLabel:
On Error Resume Next
MSHF1.Redraw = True
GoTo remClear
End Sub
Private Sub Form_Unload(Cancel As Integer)
UnHookWheel Me.hwnd
End Sub
Private Sub MSHF1_Click()
lngrow = Val(MSHF1.row)
If lngrow = 1 Then
MSHF1.Sort = 1
Else
MSHF1.row = lngrow
MSHF1.col = 0
MSHF1.ColSel = MSHF1.Cols - 1
ActiveBar21.Bands("toolbar").Tools.item("cmdDel").Enabled = True
ActiveBar21.Bands("toolbar").Tools.item("cmdEdit").Enabled = True
End If
End Sub
Private Sub MSHF1_DblClick()
EditOperatorInf
End Sub
Private Sub NewOperatorInf()
With frmProductionProgressItemDate2Info
.newItem = True
.txtOrderNo = txtOrderNo
.Show vbModal
End With
ActiveBar21.Bands("toolbar").Tools.item("cmdDel").Enabled = False
ActiveBar21.Bands("toolbar").Tools.item("cmdEdit").Enabled = False
End Sub
Private Sub EditOperatorInf()
With frmProductionProgressItemDate2Info
.newItem = False
If lngrow = 1 Then Exit Sub
.txtOrderNo = MSHF1.TextMatrix(lngrow, 1)
.DTPprogress = MSHF1.TextMatrix(lngrow, 2)
.txtId = MSHF1.TextMatrix(lngrow, 3)
.Show vbModal
End With
ActiveBar21.Bands("toolbar").Tools.item("cmdDel").Enabled = False
ActiveBar21.Bands("toolbar").Tools.item("cmdEdit").Enabled = False
End Sub
Private Sub DelOperatorInf()
Dim strSql, mOrderNo As String
If lngrow > MSHF1.Rows - 1 Then Exit Sub
If lngrow <= 1 Then
MsgBox "请选中一条要删除的记录!", vbExclamation, "提示"
Exit Sub
End If
On Error GoTo errHandle
mOrderNo = MSHF1.TextMatrix(lngrow, 1)
If MsgBox("确定要刪除?", vbQuestion + vbYesNo, "询问") = vbNo Then
Exit Sub
Else
strSql = "delete from tProductionProcess where id=" & MSHF1.TextMatrix(lngrow, 3)
Cn.Execute strSql
MsgBox "刪除成功!", vbInformation, "提示"
FillMshf1 mOrderNo
End If
ActiveBar21.Bands("toolbar").Tools.item("cmdDel").Enabled = False
ActiveBar21.Bands("toolbar").Tools.item("cmdEdit").Enabled = False
Exit Sub
errHandle:
objDatabase.DatabaseError
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -