📄 frm_jhgl_wlxq.frm
字号:
Caption = "物料编号"
Height = 195
Left = 5100
TabIndex = 8
Top = 915
Width = 735
End
Begin VB.Label Label4
Caption = "产品单位"
Height = 195
Left = 75
TabIndex = 7
Top = 915
Width = 765
End
Begin VB.Label Label3
Caption = "产品规格"
Height = 180
Left = 5205
TabIndex = 6
Top = 585
Width = 795
End
Begin VB.Label Label2
Caption = "产品计划单"
Height = 210
Left = 3735
TabIndex = 5
Top = 225
Width = 960
End
Begin VB.Label Label1
Caption = "物料需求编号"
Height = 195
Left = 75
TabIndex = 3
Top = 240
Width = 1125
End
End
End
Begin MSComctlLib.Toolbar Toolbar1
Align = 1 'Align Top
Height = 705
Left = 0
TabIndex = 0
Top = 0
Width = 7980
_ExtentX = 14076
_ExtentY = 1244
ButtonWidth = 1138
ButtonHeight = 1191
Appearance = 1
Style = 1
ImageList = "ImageList1"
_Version = 393216
BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
NumButtons = 13
BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = " 增加 "
Key = "add"
ImageIndex = 1
EndProperty
BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "修改"
Key = "modify"
ImageIndex = 2
EndProperty
BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "删除"
Key = "delete"
ImageIndex = 3
EndProperty
BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "保存"
Key = "save"
ImageIndex = 4
EndProperty
BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "取消"
Key = "cancel"
ImageIndex = 5
EndProperty
BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "查找"
Key = "find"
ImageIndex = 6
EndProperty
BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "第一条"
Key = "first"
ImageIndex = 7
EndProperty
BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "上一条"
Key = "previous"
ImageIndex = 8
EndProperty
BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "下一条"
Key = "next"
ImageIndex = 9
EndProperty
BeginProperty Button11 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "末一条"
Key = "last"
ImageIndex = 10
EndProperty
BeginProperty Button12 {66833FEA-8583-11D1-B16A-00C0F0283628}
Enabled = 0 'False
Style = 3
EndProperty
BeginProperty Button13 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "关闭"
Key = "close"
ImageIndex = 11
EndProperty
EndProperty
BorderStyle = 1
End
Begin MSComctlLib.ImageList ImageList1
Left = -240
Top = 675
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 26
ImageHeight = 26
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 11
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_Jhgl_Wlxq.frx":003D
Key = ""
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_Jhgl_Wlxq.frx":1697
Key = ""
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_Jhgl_Wlxq.frx":2CF1
Key = ""
EndProperty
BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_Jhgl_Wlxq.frx":434B
Key = ""
EndProperty
BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_Jhgl_Wlxq.frx":59A5
Key = ""
EndProperty
BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_Jhgl_Wlxq.frx":6FFF
Key = ""
EndProperty
BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_Jhgl_Wlxq.frx":8659
Key = ""
EndProperty
BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_Jhgl_Wlxq.frx":9CB3
Key = ""
EndProperty
BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_Jhgl_Wlxq.frx":B30D
Key = ""
EndProperty
BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_Jhgl_Wlxq.frx":C967
Key = ""
EndProperty
BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_Jhgl_Wlxq.frx":DFC1
Key = ""
EndProperty
EndProperty
End
End
Attribute VB_Name = "Frm_Jhgl_Wlxq"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim i As Integer, Myval As Integer '定义整型变量
Public blnadd1 As Boolean
Dim Mystr As String '定义字符变量存储编号信息
Dim rs3 As New ADODB.Recordset
Dim rs4 As New ADODB.Recordset
Dim rs5 As New ADODB.Recordset
Dim rs6 As New ADODB.Recordset
Dim rs7 As New ADODB.Recordset
Dim Myrs As New ADODB.Recordset
Dim SL As Integer '存储产品数量信息
Dim SL1 As Integer '存储产品数量信息
Dim Str1 As String '存储生产计划开始日期
Dim Str2 As String '存储物料计划截止日期
Sub view_data() '定义显示数据的过程
If Adodc1.Recordset.RecordCount > 0 Then
With Dgr_Wlxq
If .Columns(0) <> "" Then Text1(0).Text = .Columns(0) Else Text1(0).Text = ""
If .Columns(1) <> "" Then Cbx_Scjhd.Text = .Columns(1) Else Cbx_Scjhd.Text = ""
If .Columns(2) <> "" Then Text1(1).Text = .Columns(2) Else Text1(1).Text = ""
If .Columns(3) <> "" Then Text1(2).Text = .Columns(3) Else Text1(2).Text = ""
If .Columns(4) <> "" Then Text1(3).Text = .Columns(4) Else Text1(3).Text = ""
If .Columns(5) <> "" Then Text1(4).Text = .Columns(5) Else Text1(4).Text = ""
If .Columns(6) <> "" Then Text1(5).Text = .Columns(6) Else Text1(5).Text = ""
If .Columns(7) <> "" Then Cbx_wlbh.Text = .Columns(7) Else Dtp_Wgrq.Value = ""
If .Columns(8) <> "" Then Text1(6).Text = .Columns(8) Else Text1(6).Text = ""
If .Columns(9) <> "" Then Text1(7).Text = .Columns(9) Else Text1(7).Text = ""
If .Columns(10) <> "" Then Text1(8).Text = .Columns(10) Else Text1(8).Text = ""
If .Columns(11) <> "" Then Text1(9).Text = .Columns(11) Else Text1(9).Text = ""
If .Columns(12) <> "" Then Text1(10).Text = .Columns(12) Else Text1(10).Text = ""
If .Columns(13) <> "" Then Dtp_Jzrq.Value = .Columns(13) Else Dtp_Jzrq = Date
If .Columns(14) <> "" Then Text1(11).Text = .Columns(14) Else Text1(11).Text = ""
End With
End If
End Sub
Private Sub Cbx_Scjhd_Click()
rs7.Open "select * from tb_SCGL_cpxx where cpxx_id ='" + Cbx_Scjhd.Text + "'", cnn, adOpenKeyset
If rs7.RecordCount > 0 Then
For i = 1 To 3
If rs7.Fields(i) <> "" Then
Text1(i).Text = rs7.Fields(i)
Else
Text1(i).Text = ""
End If
Next i
End If
rs7.Close
rs3.Open "select * from tb_SCGL_scjhd where scjhd_id='" + Cbx_Scjhd.Text + "'", cnn, adOpenKeyset
If rs3.RecordCount > 0 Then
Text1(1).Text = rs3.Fields("scjhd_cpbh")
Text1(2).Text = rs3.Fields("scjhd_cpmc")
Text1(3).Text = rs3.Fields("scjhd_cpgg")
Text1(4).Text = rs3.Fields("scjhd_jldw")
SL = rs3.Fields("scjhd_jhsl")
Str1 = Val(Left(rs3.Fields("scjhd_tcrq"), 4) + Right(Left(rs3.Fields("scjhd_tcrq"), 7), 2) + Right(rs3.Fields("scjhd_tcrq"), 2)) '将生产计划开始日期赋给变量
Dtp_Jzrq.Value = rs3.Fields("scjhd_tcrq") '将生产计划开始日期赋给物料截止日期
rs4.Open "select * from tb_SCGL_wlxx where wlxx_cpbh='" + rs3.Fields("scjhd_cpbh") + "'", cnn, adOpenKeyset
If rs4.RecordCount > 0 Then
Cbx_wlbh.Clear
For i = 0 To rs4.RecordCount - 1
Cbx_wlbh.AddItem Trim(rs4.Fields("wlxx_id"))
rs4.MoveNext
Next i
Cbx_wlbh.ListIndex = 0
Else
Cbx_wlbh.Text = ""
MsgBox "该产品没有相应的物料信息!", , "信息提示"
rs4.Close
rs3.Close
Exit Sub
End If
rs4.Close
rs5.Open "select * from tb_SCGL_cprk where cprk_ddbh='" + Cbx_Scjhd.Text + "'", cnn, adOpenKeyset
If rs5.RecordCount > 0 Then
rs6.Open "select sum(cprk_rksl) from tb_SCGL_cprk where cprk_ddbh='" + Cbx_Scjhd.Text + "'", cnn, adOpenKeyset
SL1 = SL + rs6.Fields(0)
Text1(5).Text = SL1
rs6.Close
End If
rs5.Close
End If
rs3.Close
End Sub
Private Sub Cbx_Scjhd_GotFocus()
Cbx_Scjhd.BackColor = &HFFFF80
End Sub
Private Sub Cbx_Scjhd_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then Text1(1).SetFocus
End Sub
Private Sub Cbx_Scjhd_LostFocus()
Cbx_Scjhd.BackColor = &HFFFFFF
rs3.Open "select * from tb_SCGL_scjhd where scjhd_id='" + Cbx_Scjhd.Text + "'", cnn, adOpenKeyset
If rs3.RecordCount > 0 Then
Text1(1).Text = rs3.Fields("scjhd_cpbh")
Text1(2).Text = rs3.Fields("scjhd_cpmc")
Text1(3).Text = rs3.Fields("scjhd_cpgg")
Text1(4).Text = rs3.Fields("scjhd_jldw")
SL = rs3.Fields("scjhd_jhsl")
Str1 = Val(Left(rs3.Fields("scjhd_tcrq"), 4) + Right(Left(rs3.Fields("scjhd_tcrq"), 7), 2) + Right(rs3.Fields("scjhd_tcrq"), 2)) '将生产计划开始日期赋给变量
Dtp_Jzrq.Value = rs3.Fields("scjhd_tcrq") '将生产计划开始日期赋给物料截止日期
rs4.Open "select * from tb_SCGL_wlxx where wlxx_cpbh='" + rs3.Fields("scjhd_cpbh") + "'", cnn, adOpenKeyset
If rs4.RecordCount > 0 Then
Cbx_wlbh.Clear
For i = 0 To rs4.RecordCount - 1
Cbx_wlbh.AddItem Trim(rs4.Fields("wlxx_id"))
rs4.MoveNext
Next i
Cbx_wlbh.ListIndex = 0
Else
Cbx_wlbh.Text = "请选择物料编号"
End If
rs4.Close
rs5.Open "select * from tb_SCGL_cprk where cprk_ddbh='" + Cbx_Scjhd.Text + "'", cnn, adOpenKeyset
If rs5.RecordCount > 0 Then
rs6.Open "select sum(cprk_rksl) from tb_SCGL_cprk where cprk_ddbh='" + Cbx_Scjhd.Text + "'", cnn, adOpenKeyset
SL1 = SL + rs6.Fields(0)
Text1(5).Text = SL1
rs6.Close
Else
SL1 = SL
Text1(5).Text = SL1
End If
rs5.Close
End If
rs3.Close
Myrs.Open "select * from tb_SCGL_scjhd where scjhd_id='" + Cbx_Scjhd.Text + "'", cnn, adOpenKeyset
If Myrs.RecordCount <= 0 Then
MsgBox "请在下拉列表中选择正确的生产计划单!", , "信息提示"
Cbx_Scjhd.ListIndex = 0
Cbx_Scjhd.SetFocus
Myrs.Close
Exit Sub
End If
Myrs.Close
End Sub
Private Sub Cbx_wcf_GotFocus()
Cbx_wcf.BackColor = &HFFFF80
End Sub
Private Sub Cbx_wcf_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then Text1(5).SetFocus
End Sub
Private Sub Cbx_wcf_LostFocus()
Cbx_wcf.BackColor = &HFFFFFF
End Sub
Private Sub Dtp_Tcrq_GotFocus()
Dtp_Tcrq.CalendarBackColor = &HFFFF80
End Sub
Private Sub Dtp_Tcrq_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then Dtp_Wgrq.SetFocus
End Sub
Private Sub Dtp_Tcrq_LostFocus()
Dtp_Tcrq.CalendarBackColor = &HFFFFFF
End Sub
Private Sub Dtp_Wgrq_GotFocus()
Dtp_Wgrq.CalendarBackColor = &HFFFF80
End Sub
Private Sub Dtp_Wgrq_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then Cbx_wcf.SetFocus
End Sub
Private Sub Cbx_wlbh_Click()
rs6.Open "select * from tb_SCGL_wlxx where wlxx_id='" + Cbx_wlbh.Text + "'", cnn, adOpenKeyset
If rs6.RecordCount > 0 Then
Text1(6).Text = rs6.Fields("wlxx_wlmc")
Text1(7).Text = rs6.Fields("wlxx_wlgg")
Text1(8).Text = rs6.Fields("wlxx_wldw")
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -