📄 processesconfig.frm
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form ProcessesConfig
BorderStyle = 1 'Fixed Single
Caption = "生产工序配置"
ClientHeight = 6150
ClientLeft = 45
ClientTop = 435
ClientWidth = 8565
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 6150
ScaleWidth = 8565
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox txt
Appearance = 0 'Flat
BorderStyle = 0 'None
Height = 255
Left = 3480
TabIndex = 11
Top = 2160
Visible = 0 'False
Width = 975
End
Begin VB.ComboBox Combo1
Height = 300
Left = 1680
TabIndex = 10
Top = 2160
Visible = 0 'False
Width = 1335
End
Begin VB.CommandButton Command5
Height = 300
Left = 600
Picture = "ProcessesConfig.frx":0000
Style = 1 'Graphical
TabIndex = 9
Top = 840
Width = 300
End
Begin VB.CommandButton Command3
Height = 300
Left = 240
Picture = "ProcessesConfig.frx":058A
Style = 1 'Graphical
TabIndex = 8
Top = 840
Width = 300
End
Begin VB.CommandButton Command2
Caption = "保存设置"
Height = 375
Left = 6720
TabIndex = 6
Top = 200
Width = 975
End
Begin VB.CommandButton Command4
Height = 300
Left = 2445
Picture = "ProcessesConfig.frx":0B14
Style = 1 'Graphical
TabIndex = 3
Top = 240
Width = 300
End
Begin VB.ComboBox BM
Height = 300
Left = 1080
TabIndex = 2
Top = 240
Width = 1335
End
Begin VB.CommandButton Command1
Height = 300
Left = 5085
Picture = "ProcessesConfig.frx":109E
Style = 1 'Graphical
TabIndex = 1
Top = 240
Width = 300
End
Begin VB.ComboBox BX
Height = 300
Left = 3720
TabIndex = 0
Top = 240
Width = 1335
End
Begin MSFlexGridLib.MSFlexGrid Grid
Height = 4695
Left = 240
TabIndex = 7
Top = 1200
Width = 8055
_ExtentX = 14208
_ExtentY = 8281
_Version = 393216
FixedCols = 0
BackColor = 16777215
BackColorBkg = -2147483633
GridColor = 14737632
GridColorFixed = -2147483632
GridLinesFixed = 1
AllowUserResizing= 1
FormatString = "> 工序名称|>顺序配置(从1向后输入,如:装配【输入1】)"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Times New Roman"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin VB.Line Line1
BorderColor = &H80000010&
X1 = 240
X2 = 8280
Y1 = 720
Y2 = 720
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "部门选择"
Height = 180
Left = 240
TabIndex = 5
Top = 330
Width = 720
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "表型选择"
Height = 180
Left = 2880
TabIndex = 4
Top = 330
Width = 720
End
End
Attribute VB_Name = "ProcessesConfig"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub BM_Click()
MeterTypeToCombo BX, BM.Text
TeamsToCombo Combo1, BM.Text
End Sub
Private Sub BX_Click()
LoadConfig Grid, BM.Text, BX.Text
End Sub
Private Sub Combo1_Click()
Grid.TextMatrix(Grid.Row, Grid.Col) = Combo1.Text
End Sub
Private Sub Command1_Click()
MeterType.Show vbModal
MeterTypeToCombo BX, BM.Text
End Sub
Private Sub Command2_Click()
If MsgBox("是否确定保存当前配置", vbInformation Or vbYesNo, "提示") = vbYes Then
SaveGXConfig Grid, Trim(BM.Text), Trim(BX.Text)
End If
End Sub
Private Sub Command3_Click()
Grid.Rows = Grid.Rows + 1
End Sub
Private Sub Command4_Click()
DepartmentInfo.Show vbModal
DepartToCombo BM
End Sub
Private Sub Command5_Click()
DelConfig BM.Text, Grid.TextMatrix(Grid.Row, 0), BX.Text
Grid.RemoveItem Grid.Row
End Sub
Private Sub Form_Load()
Me.Left = (Screen.Width - Me.Width) / 2
Me.Top = (Screen.Height - Me.Height) / 2
DepartToCombo BM
Grid.ColAlignment(0) = flexAlignCenterCenter
Grid.ColAlignment(1) = flexAlignCenterCenter
ConvertFont Me
End Sub
Private Sub LoadConfig(Flex As MSFlexGrid, Bumen As String, MetType As String)
Dim i As Integer
Dim Mtype As String
Mtype = Flex.TextMatrix(i, 0)
SQL = "Select * from 工序配置 where 部门名称='" & Bumen & "' and 表计类型='" & MetType & "'"
If rs.State = 1 Then rs.Close
rs.Open SQL, DBConn, adOpenKeyset, adLockOptimistic, adCmdText
If Not rs.EOF Then
Flex.Rows = rs.RecordCount + 1
For i = 1 To Flex.Rows - 1
Flex.TextMatrix(i, 0) = rs.Fields("工序名称").Value
Flex.TextMatrix(i, 1) = rs.Fields("顺序编号").Value
rs.MoveNext
Next i
Else
Flex.Rows = 1
End If
End Sub
Private Sub Grid_EnterCell()
Combo1.Visible = False
txt.Visible = False
Select Case Grid.Col
Case 1
txt.Text = Grid.TextMatrix(Grid.Row, Grid.Col)
txt.Left = Grid.CellLeft + Grid.Left
txt.Top = Grid.CellTop + Grid.Top
txt.Width = Grid.CellWidth
txt.Height = Grid.CellHeight
txt.Visible = True
Case 0
Combo1.Text = Grid.TextMatrix(Grid.Row, Grid.Col)
Combo1.Left = Grid.CellLeft + Grid.Left
Combo1.Top = Grid.CellTop + Grid.Top
Combo1.Width = Grid.CellWidth
' Combo1.Height = Grid.CellHeight
Combo1.Visible = True
End Select
End Sub
Private Sub txt_Change()
Grid.TextMatrix(Grid.Row, Grid.Col) = txt.Text
End Sub
Private Sub DelConfig(Bumen As String, BanZu As String, Mtype As String)
SQL = "delete from 工序配置 where 部门名称='" & Bumen & "' and 工序名称='" & BanZu & "' and 表计类型='" & Mtype & "'"
If rs.State = 1 Then rs.Close
rs.Open SQL, DBConn, adOpenKeyset, adLockOptimistic, adCmdText
' MsgBox "删除完成", vbInformation, "提示"
End Sub
Private Sub SaveGXConfig(Flex As MSFlexGrid, Bumen As String, Mtype As String)
Dim i As Integer
For i = 1 To Flex.Rows - 1
Dim BanZu As String
BanZu = Flex.TextMatrix(i, 0)
SQL = "Select * from 工序配置 where 部门名称='" & Bumen & "' and 工序名称='" & BanZu & "' and 表计类型='" & Mtype & "'"
If rs.State = 1 Then rs.Close
rs.Open SQL, DBConn, adOpenKeyset, adLockOptimistic, adCmdText
If rs.EOF Then
rs.AddNew
rs.Fields("部门名称").Value = Bumen
rs.Fields("工序名称").Value = BanZu
rs.Fields("表计类型").Value = Mtype
End If
rs.Fields("顺序编号").Value = Val(Flex.TextMatrix(i, 1))
rs.Update
Next i
MsgBox "修改完成", vbInformation, "提示"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -