📄 capacity.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form Capacity
BorderStyle = 1 'Fixed Single
Caption = "产能评估"
ClientHeight = 7470
ClientLeft = 45
ClientTop = 435
ClientWidth = 10500
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 7470
ScaleWidth = 10500
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command2
Caption = "导入计划"
Height = 325
Left = 7440
TabIndex = 15
Top = 150
Width = 975
End
Begin VB.Frame Frame1
Caption = "统计结论"
Height = 1815
Left = 120
TabIndex = 6
Top = 5520
Width = 10215
Begin VB.CommandButton Command1
Caption = "计算"
Height = 375
Left = 8760
TabIndex = 16
Top = 480
Width = 1215
End
Begin VB.TextBox Text3
Height = 375
Left = 8760
TabIndex = 14
Top = 1080
Width = 1215
End
Begin VB.TextBox Text2
Height = 375
Left = 6000
TabIndex = 12
Top = 1080
Width = 1215
End
Begin VB.TextBox Text1
Height = 375
Left = 6000
TabIndex = 10
Top = 480
Width = 1215
End
Begin MSComctlLib.ListView ListView2
Height = 1335
Left = 195
TabIndex = 8
Top = 285
Width = 4335
_ExtentX = 7646
_ExtentY = 2355
View = 3
LabelEdit = 1
LabelWrap = -1 'True
HideSelection = -1 'True
FullRowSelect = -1 'True
GridLines = -1 'True
_Version = 393217
ForeColor = -2147483640
BackColor = -2147483643
BorderStyle = 1
Appearance = 1
NumItems = 4
BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628}
Text = "表计类型"
Object.Width = 1764
EndProperty
BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 1
Text = "累积总数"
Object.Width = 1764
EndProperty
BeginProperty ColumnHeader(3) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 2
Text = "折合生产"
Object.Width = 1764
EndProperty
BeginProperty ColumnHeader(4) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 3
Text = "所需时间"
Object.Width = 1764
EndProperty
End
Begin VB.Label Label4
Caption = "折合生产表(台)"
Height = 255
Left = 7440
TabIndex = 13
Top = 1200
Width = 1335
End
Begin VB.Label Label3
Caption = "总共生产表(台)"
Height = 255
Left = 4680
TabIndex = 11
Top = 1200
Width = 1335
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "总共耗时(小时)"
Height = 180
Left = 4680
TabIndex = 9
Top = 600
Width = 1260
End
End
Begin MSComCtl2.DTPicker DTPicker1
Height = 300
Left = 5760
TabIndex = 5
Top = 165
Width = 1455
_ExtentX = 2566
_ExtentY = 529
_Version = 393216
Format = 144834561
CurrentDate = 39503
End
Begin VB.ComboBox BZ
Height = 300
Left = 3360
TabIndex = 4
Top = 160
Width = 1335
End
Begin VB.ComboBox BM
Height = 300
Left = 1080
TabIndex = 3
Top = 160
Width = 1335
End
Begin MSComctlLib.ListView ListView1
Height = 4815
Left = 120
TabIndex = 7
Top = 600
Width = 10215
_ExtentX = 18018
_ExtentY = 8493
View = 3
LabelEdit = 1
LabelWrap = -1 'True
HideSelection = 0 'False
FullRowSelect = -1 'True
GridLines = -1 'True
_Version = 393217
ForeColor = -2147483640
BackColor = -2147483643
BorderStyle = 1
Appearance = 1
NumItems = 7
BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628}
Text = "计划单号"
Object.Width = 1764
EndProperty
BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 1
Text = "批次号"
Object.Width = 1764
EndProperty
BeginProperty ColumnHeader(3) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 2
Text = "子批次号"
Object.Width = 1764
EndProperty
BeginProperty ColumnHeader(4) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 3
Text = "表计类型"
Object.Width = 1764
EndProperty
BeginProperty ColumnHeader(5) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 4
Text = "生产数量"
Object.Width = 1764
EndProperty
BeginProperty ColumnHeader(6) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 5
Text = "客户名称"
Object.Width = 4410
EndProperty
BeginProperty ColumnHeader(7) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 6
Text = "表计规格"
Object.Width = 4410
EndProperty
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "选择日期"
Height = 180
Index = 2
Left = 4920
TabIndex = 2
Top = 240
Width = 720
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "选择班组"
Height = 180
Index = 1
Left = 2520
TabIndex = 1
Top = 240
Width = 720
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "选择部门"
Height = 180
Index = 0
Left = 240
TabIndex = 0
Top = 240
Width = 720
End
End
Attribute VB_Name = "Capacity"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub BM_Click()
TeamsToCombo BZ, BM.Text
MeterTypeToLv ListView2, BM.Text
End Sub
Private Sub Command1_Click()
'全部计算
MeterTypeToLv ListView2, BM.Text
CategoriesStatistics ListView1, ListView2
'===========================
GetCategoriesEquivalentSCNum ListView2
GetCategoriesUseTime ListView2
'===========================
Text1.Text = GetUseTime(ListView2)
Text2.Text = GetSCNum(ListView2)
Text3.Text = GetEquivalentSCNum(ListView2)
End Sub
Private Sub Command2_Click()
LoadDayPlan ListView1, BM.Text, BZ.Text, DTPicker1.Value
End Sub
Private Sub Form_Load()
Me.Left = (Screen.Width - Me.Width) / 2
Me.Top = (Screen.Height - Me.Height) / 2
DepartToCombo BM
ConvertFont Me
End Sub
'=============================================================
Private Function GetSCNum(Lv As ListView) As Variant
'获取生产总数量
'On Error Resume Next
GetSCNum = 0
Dim i As Variant
For i = 1 To Lv.ListItems.Count
GetSCNum = GetSCNum + Val(Lv.ListItems(i).SubItems(1))
Next i
End Function
Private Function GetEquivalentSCNum(Lv As ListView) As Variant
'获得折合生产总数量
'On Error Resume Next
GetEquivalentSCNum = 0
Dim i As Variant
For i = 1 To Lv.ListItems.Count
GetEquivalentSCNum = GetEquivalentSCNum + Val(Lv.ListItems(i).SubItems(2))
Next i
End Function
Private Function GetUseTime(Lv As ListView) As Variant
'获得总共需要的生产时间
'On Error Resume Next
GetUseTime = 0
Dim i As Variant
For i = 1 To Lv.ListItems.Count
GetUseTime = GetUseTime + Val(Lv.ListItems(i).SubItems(3))
Next i
End Function
'=============================================================
Private Sub CategoriesStatistics(Lv_Z As ListView, Lv_T As ListView)
'将生产表数量分类统计到listview
Dim i, j
Dim Mtype As String '类型
Dim MNum As Variant '生产数量
For i = 1 To Lv_Z.ListItems.Count '搜索计划表
Mtype = Lv_Z.ListItems(i).SubItems(3)
MNum = Val(Lv_Z.ListItems(i).SubItems(4))
For j = 1 To Lv_T.ListItems.Count
If Lv_T.ListItems(j).Text = Mtype Then
Lv_T.ListItems(j).SubItems(1) = Val(Lv_T.ListItems(j).SubItems(1)) + MNum '生产数量累加
Exit For
End If
Next j
Next i
End Sub
Private Sub GetCategoriesUseTime(Lv As ListView)
'获取分类后的完成时间
'On Error Resume Next
Dim i
For i = 1 To Lv.ListItems.Count '搜索计划表
If Lv.ListItems(i).SubItems(1) <> "" Then
'Debug.Print "GetMeterCapacity:" & GetMeterCapacity(BM.Text, BZ.Text, Lv.ListItems(i).Text) & Lv.ListItems(i).Text 'GetBaseNum(BM.Text, BZ.Text)
Lv.ListItems(i).SubItems(3) = Val(Lv.ListItems(i).SubItems(1)) / GetMeterCapacity(BM.Text, BZ.Text, Lv.ListItems(i).Text)
End If
Next i
End Sub
Private Sub GetCategoriesEquivalentSCNum(Lv As ListView)
'获取分类后折合的表计数量
'On Error Resume Next
Dim i
For i = 1 To Lv.ListItems.Count '搜索计划表
If Lv.ListItems(i).SubItems(1) <> "" Then
'Debug.Print GetMeterCapacity(BM.Text, BZ.Text, Lv.ListItems(i).Text) 'GetBaseNum(BM.Text, BZ.Text)
Lv.ListItems(i).SubItems(2) = (Val(Lv.ListItems(i).SubItems(1)) * GetMeterCapacity(BM.Text, BZ.Text, Lv.ListItems(i).Text)) / GetBaseNum(BM.Text, BZ.Text)
End If
Next i
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -