📄 gpinzp.frm
字号:
Height = 255
Index = 4
Left = 5580
TabIndex = 20
Top = 1380
Width = 735
End
Begin VB.Label Label1
Caption = "产品编号"
Height = 195
Index = 3
Left = 3000
TabIndex = 19
Top = 1380
Width = 795
End
Begin VB.Label Label1
Caption = "工票编号"
Height = 195
Index = 2
Left = 8460
TabIndex = 18
Top = 360
Width = 795
End
Begin VB.Label Label1
Caption = "绍兴金氏机械设备有限公司 工票"
BeginProperty Font
Name = "MS Sans Serif"
Size = 13.5
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 315
Index = 0
Left = 3060
TabIndex = 3
Top = 180
Width = 4815
End
Begin VB.Label Label1
Caption = "工票类别:"
Height = 255
Index = 1
Left = 60
TabIndex = 2
Top = 660
Width = 915
End
Begin VB.Label Label1
Caption = "增拨工票"
ForeColor = &H000000C0&
Height = 195
Index = 16
Left = 1080
TabIndex = 1
Top = 660
Width = 795
End
End
Attribute VB_Name = "gpinzp"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'工票编号 =填制日期+code,在保存时反映
Option Explicit
Dim instrI As Integer, instrJ As Integer
Private Sub Form_Load()
Me.Width = 11100
Me.Height = 6800
Grid1.AutoRedraw = False
Grid1.DisplayFocusRect = False
Grid1.Cols = 15
Grid1.Rows = 7
Grid1.FixedRows = 1
Grid1.FixedCols = 2
Grid1.Column(0).Width = 1
Grid1.Column(1).Width = 1
Grid1.Column(2).Width = 1
Grid1.Column(3).Width = 380
Grid1.Column(4).Width = 2
Grid1.Column(5).Width = 100
Grid1.Column(6).Width = 100
Grid1.Column(7).Width = 40
Grid1.Column(8).Width = 2
Grid1.Column(9).Width = 70
Grid1.Column(10).Width = 60
Grid1.Column(11).Width = 100
Grid1.Column(12).Width = 100
Grid1.Column(13).Width = 100
Grid1.Column(14).Width = 2
dogridfill
Grid1.AutoRedraw = True
Grid1.Refresh
'填列产品
Set rsTempA = oDb.Execute("select * from acp where cpyn='Y'") '只显示需统计的产品Y
Do Until rsTempA.EOF
cmbcp.AddItem rsTempA!cpbh & "," & rsTempA!cpmc & "." & rsTempA!cpxh
rsTempA.MoveNext
Loop
cmbcp.ListIndex = 0
'填列车间
Set rsTempA = oDb.Execute("select * from acj ")
Do Until rsTempA.EOF
cmbcj.AddItem rsTempA!cjbh & "," & rsTempA!cjmc
rsTempA.MoveNext
Loop
cmbcj.ListIndex = 0
i = InStr(cmbcj.Text, ",")
txtcjbh.Text = Left(cmbcj.Text, i - 1)
txtcjmc.Text = Mid(cmbcj.Text, i + 1)
Set rsTempB = oDb.Execute("select * from abz where bzyn='Y' and cjbh='" & Left(cmbcj.Text, i - 1) & "'")
Do Until rsTempB.EOF
cmbbz.AddItem rsTempB!bzbh & "," & rsTempB!bzmc
rsTempB.MoveNext
Loop
'工序编号下拉填列
Set rsTempC = oDb.Execute("select * from agx where gxtj='Y' and gxcjbh=" & txtcjbh.Text & " order by gxbh")
Do Until rsTempC.EOF
Grid1.ComboBox(9).AddItem rsTempC!gxmc
rsTempC.MoveNext
Loop
Grid1.ComboBox(9).Locked = True
cmbgslb.AddItem "设计更改"
cmbgslb.AddItem "工艺更改"
cmbgslb.AddItem "计划更改"
cmbgslb.AddItem "质量损失"
cmbgslb.AddItem "设备返修"
cmbgslb.ListIndex = 0
mskdate.Text = NOWDate
MonthView1.Visible = False
MonthView1.Value = NOWDate
'工票编号
Set rsTempA = oDb.Execute("select max(code) as maxcode from gpzph where gprq='" & mskdate.Text & "'")
If IsNull(rsTempA!maxcode) Then
txtcode.Text = 1
Else
txtcode.Text = rsTempA!maxcode + 1
End If
lblgpbh.Caption = Left(mskdate.Text, 4) & Mid(mskdate.Text, 6, 2) & Mid(mskdate.Text, 9) & Format$(txtcode.Text, "0000")
txtcode.Visible = False
txtcjbh.Visible = False
txtcjmc.Visible = False
txtbzbh.Visible = False
txtbzmc.Visible = False
txtkp.AddItem "周建军"
txtkp.AddItem "罗长有"
txtkp.AddItem "戚福金"
End Sub
Private Sub cmdsave_Click()
If cmbbz.Text = "" Then
MsgBox "请选择班组/个人", vbOKOnly, "信息不完整"
Exit Sub
End If
'gpzpb按表格中零件名称、工序名称的选择,填入相关的编号,图号
For i = 1 To Grid1.Rows - 1
griditem = Trim(Grid1.Cell(i, 3).Text)
If griditem <> "" Then
instrI = InStr(griditem, ",")
instrJ = InStr(griditem, ".")
Grid1.Cell(i, 14).Text = Left(griditem, instrI - 1)
Grid1.Cell(i, 2).Text = Mid(griditem, instrJ + 1)
Grid1.Cell(i, 4).Text = Mid(griditem, instrI + 1, instrJ - instrI - 1)
End If
griditem = Trim(Grid1.Cell(i, 9).Text)
If griditem <> "" Then
Set rsTempA = oDb.Execute("select * from agx where gxmc='" & griditem & "'")
Grid1.Cell(i, 8).Text = rsTempA!gxbh
End If
'表体内容
If (Val(Grid1.Cell(i, 10).Text) <> 0) And (Grid1.Cell(i, 2).Text <> "") And (Grid1.Cell(i, 8).Text <> "") Then '有工时数据,保存
'工票编号+产品编号+部件编号+闻件名称+图号
'+数量+工序编号+工序名称+工时+备注+备注+备注
griditem = "'" & lblgpbh.Caption & "','" & lblcp(0).Caption & "','" & Grid1.Cell(i, 2).Text & "','" & Grid1.Cell(i, 12).Text & " ','" & Grid1.Cell(i, 4).Text & "'"
If Grid1.Cell(i, 5).Text <> "" Then '零件名称
griditem = griditem & Chr(9) & Grid1.Cell(i, 5).Text
Else
griditem = griditem & Chr(9) & ""
End If
If Grid1.Cell(i, 6).Text <> "" Then '零件 图号
griditem = griditem & Chr(9) & Grid1.Cell(i, 6).Text
Else
griditem = griditem & Chr(9) & ""
End If
If Grid1.Cell(i, 7).Text <> "" Then
griditem = griditem & "," & Grid1.Cell(i, 7).Text & ",'" & Grid1.Cell(i, 8).Text & "','" & Grid1.Cell(i, 9).Text & "'," & Grid1.Cell(i, 10).Text & ",'" & Grid1.Cell(i, 11).Text & "','" & Grid1.Cell(i, 12).Text & "','" & Grid1.Cell(i, 13).Text & "'"
Else
griditem = griditem & ",0,'" & Grid1.Cell(i, 8).Text & "','" & Grid1.Cell(i, 9).Text & "'," & Grid1.Cell(i, 10).Text & ",'" & Grid1.Cell(i, 11).Text & "','" & Grid1.Cell(i, 12).Text & "','" & Grid1.Cell(i, 13).Text & "'"
End If
szSql = "insert gpzpb (gpbh,gpcpbh,gpbjbh,gpbjmc,gpbjth,gpsl,gpgxbh,gpgxmc,gpgs,gpbz,gpbz1,gpbz2) values ( " & griditem & ")"
oDb.Execute szSql
End If
Next i
'gpzph
'工票编号+code+票日期+产品编号
griditem = "'" & lblgpbh.Caption & "'," & txtcode.Text & ",'" & mskdate.Text & "','" & lblcp(0).Caption & "','" & cmbgslb.Text & "',"
griditem = griditem & txtcjbh.Text & ",'" & txtcjmc & "'," & txtbzbh.Text & ",'" & txtbzmc.Text & "','" & txtgphm.Text & "','" & txtsh.Text & "','" & txtkp.Text & "'"
szSql = "insert gpzph (gpbh,code,gprq,gpcpbh,gpgslb,gpcjbh,gpcjmc,gpbzbh,gpbzmc,gphm,gpsh,gpkp) values ( " & griditem & ")"
oDb.Execute szSql
MsgBox "工票数据已保存完毕!", vbOKOnly, "数据保存"
'编号更新
txtcode.Text = Val(txtcode.Text) + 1
lblgpbh.Caption = Left(mskdate.Text, 4) & Mid(mskdate.Text, 6, 2) & Mid(mskdate.Text, 9) & Format$(txtcode.Text, "0000")
End Sub
Private Sub cmdexit_Click()
Unload Me
End Sub
Private Sub cmbcp_LostFocus()
'选取产品后,相应部件填入cmbbj下拉框
i = InStr(cmbcp.Text, ",")
j = InStr(cmbcp.Text, ".")
lblcp(0).Caption = Left(cmbcp.Text, i - 1)
lblcp(1).Caption = Mid(cmbcp.Text, i + 1, j - i - 1)
lblcp(2).Caption = Mid(cmbcp.Text, j + 1)
'单位编号、名称
Set rsTempB = oDb.Execute("select * from acp where cpbh='" & Left(cmbcp.Text, i - 1) & "'")
lbldh(0).Caption = rsTempB!dhbh
lbldh(1).Caption = rsTempB!dhmc
If i < 1 Then Exit Sub
Grid1.Rows = 1 '清空原有数据
Grid1.Rows = 7
'选定产品后填入部件下拉内容
Set rsTempC = oDb.Execute("select * from abj where cpbh='" & Left(cmbcp.Text, i - 1) & "' order by cpbh")
Do Until rsTempC.EOF
Grid1.ComboBox(3).AddItem rsTempC!bjmc & "," & rsTempC!bjth & "." & rsTempC!bjbh '名称+图号+编号
rsTempC.MoveNext
Loop
Grid1.ComboBox(3).Locked = True
End Sub
Private Sub cmbcj_LostFocus()
'取得车间编号并填列班组/个人名称
i = InStr(cmbcj.Text, ",")
If i < 1 Then
MsgBox "请选择车间", vbOKOnly, "车间"
Exit Sub
End If
txtcjbh.Text = Left(cmbcj.Text, i - 1)
txtcjmc.Text = Mid(cmbcj.Text, i + 1)
cmbbz.Clear
Set rsTempB = oDb.Execute("select * from abz where bzyn='Y' and cjbh='" & Left(cmbcj.Text, i - 1) & "'")
Do Until rsTempB.EOF
cmbbz.AddItem rsTempB!bzbh & "," & rsTempB!bzmc
rsTempB.MoveNext
Loop
'工序编号下拉填列
Grid1.ComboBox(9).Clear
Set rsTempC = oDb.Execute("select * from agx where gxtj='Y' and gxcjbh=" & txtcjbh.Text & " order by gxbh")
Do Until rsTempC.EOF
Grid1.ComboBox(9).AddItem rsTempC!gxmc
rsTempC.MoveNext
Loop
Grid1.ComboBox(9).Locked = True
End Sub
Private Sub cmbbz_LostFocus()
'取得 班组/个人编号
i = InStr(cmbbz.Text, ",")
If i < 1 Then Exit Sub
txtbzbh.Text = Left(cmbbz.Text, i - 1)
txtbzmc.Text = Mid(cmbbz.Text, i + 1)
End Sub
Private Sub cmddate_Click()
MonthView1.Visible = True
End Sub
Private Sub MonthView1_DateClick(ByVal DateClicked As Date)
MonthView1.Visible = False
'mskdate.Text = MonthView1.Value
mskdate.Text = Format(MonthView1.Value, "YYYY-MM-DD")
'工票编号
Set rsTempA = oDb.Execute("select max(code) as maxcode from gpzph where gprq='" & mskdate.Text & "'")
If IsNull(rsTempA!maxcode) Then
txtcode.Text = 1
Else
txtcode.Text = rsTempA!maxcode + 1
End If
lblgpbh.Caption = Left(mskdate.Text, 4) & Mid(mskdate.Text, 6, 2) & Mid(mskdate.Text, 9) & Format$(txtcode.Text, "0000")
End Sub
Private Sub dogridfill()
Grid1.Cell(0, 1).Text = "序号"
Grid1.Cell(0, 2).Text = "部件编号"
Grid1.Cell(0, 3).Text = "部件名称+图号+部件编号"
Grid1.Cell(0, 4).Text = "图号"
Grid1.Cell(0, 5).Text = "零件名称"
Grid1.Cell(0, 6).Text = "零件图号"
Grid1.Cell(0, 7).Text = "数量"
Grid1.Cell(0, 8).Text = "工序编号"
Grid1.Cell(0, 9).Text = "工序名称"
Grid1.Cell(0, 10).Text = "工时(分)"
Grid1.Cell(0, 11).Text = " 备 注"
Grid1.Cell(0, 12).Text = " 备 注"
Grid1.Cell(0, 13).Text = " 备 注"
Grid1.Cell(0, 14).Text = "部件名称" '临时需用
Grid1.Column(3).CellType = cellComboBox
Grid1.Column(9).CellType = cellComboBox
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -