📄 fricjbz.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{4F29B06F-16D9-4A0C-9C8A-2F0C02F625FE}#1.0#0"; "FlexCell.ocx"
Begin VB.Form fircjbz
Caption = "班组、个人"
ClientHeight = 6810
ClientLeft = 60
ClientTop = 450
ClientWidth = 7845
LinkTopic = "Form1"
MDIChild = -1 'True
ScaleHeight = 6810
ScaleWidth = 7845
Begin FlexCell.Grid Grid1
Height = 4755
Left = 2580
TabIndex = 11
Top = 1350
Width = 5205
_ExtentX = 9181
_ExtentY = 8387
Cols = 5
Rows = 30
End
Begin VB.TextBox txtbjbh
BackColor = &H00E0E0E0&
Enabled = 0 'False
Height = 285
Left = 3540
TabIndex = 7
Top = 900
Width = 975
End
Begin VB.TextBox txtbjmc
BackColor = &H00E0E0E0&
Enabled = 0 'False
Height = 315
Left = 5580
TabIndex = 6
Top = 885
Width = 1695
End
Begin VB.Frame Frame1
Height = 555
Left = 3900
TabIndex = 2
Top = 6180
Width = 3795
Begin VB.CommandButton Cmdexit
Caption = "返回"
Height = 315
Left = 2760
TabIndex = 5
Top = 180
Width = 855
End
Begin VB.CommandButton cmdsave
Caption = "保存"
Height = 315
Left = 1500
TabIndex = 4
Top = 180
Width = 915
End
Begin VB.CommandButton cmdadd
Caption = "增加"
Height = 315
Left = 180
TabIndex = 3
Top = 180
Width = 915
End
End
Begin VB.TextBox txtcode
Height = 285
Left = 7080
TabIndex = 1
Top = 480
Width = 615
End
Begin MSComctlLib.TreeView TvwDB
Height = 5235
Left = 180
TabIndex = 8
Top = 960
Width = 2235
_ExtentX = 3942
_ExtentY = 9234
_Version = 393217
LineStyle = 1
Style = 7
Appearance = 1
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin VB.Label Label1
Caption = "车间编号"
Height = 195
Index = 0
Left = 2640
TabIndex = 0
Top = 945
Width = 735
End
Begin VB.Label Label1
Caption = "车间名称"
Height = 195
Index = 1
Left = 4800
TabIndex = 10
Top = 945
Width = 735
End
Begin VB.Label Label1
Caption = "班组个人信息录入"
BeginProperty Font
Name = "MS Sans Serif"
Size = 18
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 435
Index = 3
Left = 2280
TabIndex = 9
Top = 120
Width = 3315
End
End
Attribute VB_Name = "fircjbz"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private TempNode As Node
Dim txtkey As String, intIndex As Integer
Dim txtnode As String
Private Sub Form_Load()
Me.Width = 8000: Me.Height = 7300
Set rsTempA = oDb.Execute("select * from acj order by cjbh")
Do Until rsTempA.EOF
Set TempNode = TvwDB.Nodes.Add()
TempNode.Text = rsTempA!cjbh & "," & rsTempA!cjmc
'TempNode.Key = "'" & rsTempA!cjbh & "'"
'intIndex = TempNode.Index
'txtkey = TempNode.Key
rsTempA.MoveNext
Loop
TvwDB.Nodes(1).Expanded = True
Grid1.AutoRedraw = False
Grid1.DisplayFocusRect = False
Grid1.Cols = 5
Grid1.Rows = 1
Grid1.FixedRows = 1
Grid1.Column(0).Width = 5
Grid1.Column(1).Width = 40
Grid1.Column(2).Width = 80
Grid1.Column(3).Width = 80
Grid1.Column(4).Width = 120
Grid1.AutoRedraw = True
Grid1.Refresh
Grid1.Column(1).Locked = True
dogridfill
txtcode.Visible = False
End Sub
Private Sub tvwdb_NodeClick(ByVal Node As Node)
txtnode = Node.Text
i = InStr(Node.Text, ",")
txtbjbh.Text = Left(txtnode, i - 1)
txtbjmc.Text = Mid(txtnode, i + 1)
dogridfill
Set rsTempB = oDb.Execute("select * from abz where cjbh='" & txtbjbh.Text & "'")
Do Until rsTempB.EOF
griditem = rsTempB!bzbh & Chr(9) & rsTempB!bzmc & Chr(9) & rsTempB!bzyn & Chr(9) & rsTempB!bzbz
Grid1.AddItem griditem
rsTempB.MoveNext
Loop
'txtcode
Set rsTempC = oDb.Execute("select max(bzbh) as maxbzbh from abz where cjbh='" & txtbjbh.Text & "'")
If IsNull(rsTempC!maxbzbh) Then
txtcode.Text = 1000
Else
txtcode.Text = rsTempC!maxbzbh + 1
End If
End Sub
Private Sub cmdadd_Click()
If txtbjbh.Text = "" Then
MsgBox "请先点击选择车间", vbOKOnly, "点击车间"
Exit Sub
End If
Grid1.Rows = Grid1.Rows + 1
Grid1.Cell(Grid1.Rows - 1, 1).Text = txtcode.Text
Grid1.Cell(Grid1.Rows - 1, 3).Text = "Y"
txtcode.Text = txtcode.Text + 1
End Sub
Private Sub cmdsave_Click()
'名称是否齐全,再保存
For i = 1 To Grid1.Rows - 1
If (Grid1.Cell(i, 2).Text = "") Or (Grid1.Cell(i, 3).Text = "") Then
MsgBox "请检查名称及统计Y/N", vbOKOnly, "名称"
Exit Sub
End If
Next i
For i = 1 To Grid1.Rows - 1
griditem = Grid1.Cell(i, 1).Text
Set rsTempA = oDb.Execute("select * from abz where cjbh='" & txtbjbh.Text & "'and bzbh='" & griditem & "'")
If rsTempA.RecordCount < 1 Then '增加保存
griditem = "'" & txtbjbh.Text & "','" & txtbjmc.Text & "','" & Grid1.Cell(i, 1).Text & "','" & Grid1.Cell(i, 2).Text & "','" & Grid1.Cell(i, 3).Text & "'"
If Grid1.Cell(i, 4).Text <> "" Then griditem = griditem & ",'" & Grid1.Cell(i, 4).Text & "'" Else griditem = griditem & ",'N'"
szSql = "insert abz (cjbh,cjmc,bzbh,bzmc,bzyn,bzbz) values (" & griditem & ")"
oDb.Execute szSql
Else
szSql = "UPDATE abz SET bzmc='" & Grid1.Cell(i, 2).Text & "',bzyn='" & Grid1.Cell(i, 3).Text & "',bzbz='" & Grid1.Cell(i, 4).Text & "' where cjbh='" & txtbjbh.Text & "' and bzbh='" & Grid1.Cell(i, 1).Text & "'"
oDb.Execute szSql
End If
Next i
MsgBox "班组/个人信息成功保存", vbOKOnly, "保存"
'txtcode.Text = txtcode.Text + 1
End Sub
Private Sub cmdexit_Click()
Unload Me
End Sub
Private Sub dogridfill()
Grid1.Cell(0, 1).Text = "编号"
Grid1.Cell(0, 2).Text = "班组/个人"
Grid1.Cell(0, 3).Text = "是否统计Y/N"
Grid1.Cell(0, 4).Text = "备注"
Grid1.Rows = 1
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -