📄 cooperateredo.frm
字号:
VERSION 5.00
Begin VB.Form CooperateRedo
BorderStyle = 1 'Fixed Single
Caption = "返工单"
ClientHeight = 3090
ClientLeft = 45
ClientTop = 330
ClientWidth = 5430
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3090
ScaleWidth = 5430
StartUpPosition = 3 '窗口缺省
Begin VB.Frame Frame2
Height = 675
Left = 0
TabIndex = 17
Top = 2400
Width = 5415
Begin VB.CommandButton Command4
Caption = "打印"
Height = 350
Left = 600
TabIndex = 21
Top = 210
Width = 855
End
Begin VB.CommandButton Command1
Caption = "新增"
Height = 350
Left = 2520
TabIndex = 20
Top = 210
Width = 855
End
Begin VB.CommandButton Command2
Caption = "保存"
Default = -1 'True
Height = 350
Left = 3480
TabIndex = 19
Top = 210
Width = 855
End
Begin VB.CommandButton Command3
Caption = "退出"
Height = 350
Left = 4440
TabIndex = 18
Top = 210
Width = 855
End
End
Begin VB.Frame Frame1
Height = 2415
Left = 0
TabIndex = 0
Top = 0
Width = 5415
Begin VB.TextBox Text3
Enabled = 0 'False
Height = 300
Left = 960
TabIndex = 8
Text = "2"
Top = 600
Width = 1695
End
Begin VB.TextBox Text10
Enabled = 0 'False
Height = 300
Left = 3600
TabIndex = 7
Text = "0"
Top = 240
Width = 1575
End
Begin VB.TextBox Text11
Alignment = 1 'Right Justify
Enabled = 0 'False
Height = 300
Left = 3600
TabIndex = 6
Text = "2"
Top = 600
Width = 1575
End
Begin VB.TextBox Text1
Enabled = 0 'False
Height = 300
Left = 960
TabIndex = 5
Top = 240
Width = 1695
End
Begin VB.TextBox Text2
Enabled = 0 'False
Height = 300
Left = 3870
TabIndex = 4
Text = "2"
Top = 2565
Width = 1455
End
Begin VB.TextBox Text4
Alignment = 1 'Right Justify
Height = 300
Left = 960
TabIndex = 3
Text = "4"
Top = 1005
Width = 1695
End
Begin VB.TextBox Text7
Enabled = 0 'False
Height = 300
Left = 3600
TabIndex = 2
Top = 960
Width = 1575
End
Begin VB.TextBox Text8
Height = 735
Left = 960
TabIndex = 1
Text = "8"
Top = 1440
Width = 4215
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "生产物料:"
ForeColor = &H80000007&
Height = 180
Left = 120
TabIndex = 16
Top = 675
Width = 810
End
Begin VB.Label Label10
AutoSize = -1 'True
Caption = "外 协 商:"
ForeColor = &H80000008&
Height = 180
Left = 2760
TabIndex = 15
Top = 285
Width = 810
End
Begin VB.Label Label11
AutoSize = -1 'True
Caption = "未完工量:"
ForeColor = &H80000007&
Height = 180
Left = 2760
TabIndex = 14
Top = 675
Width = 810
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "外协单号:"
ForeColor = &H00000000&
Height = 180
Left = 120
TabIndex = 13
Top = 300
Width = 810
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "加工号:"
ForeColor = &H80000007&
Height = 180
Left = 3180
TabIndex = 12
Top = 2640
Width = 720
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "返工件数:"
ForeColor = &H80000008&
Height = 180
Left = 120
TabIndex = 11
Top = 1080
Width = 810
End
Begin VB.Label Label7
AutoSize = -1 'True
Caption = "返工时间:"
ForeColor = &H80000008&
Height = 180
Left = 2760
TabIndex = 10
Top = 1020
Width = 810
End
Begin VB.Label Label8
AutoSize = -1 'True
Caption = "备 注:"
ForeColor = &H80000008&
Height = 180
Left = 120
TabIndex = 9
Top = 1440
Width = 720
End
End
End
Attribute VB_Name = "CooperateRedo"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'*******************************************************
'* 模 块 名 称 :保存外协返工单维护与管理
'* 功 能 描 述 :保存外协返工单的基本信息
'* 程序员姓名 :黄朝和
'* 最后修改人 :
'* 最后修改时间:2005/09/12
'* 备 注:
'*******************************************************
Option Explicit
Private m_recordset As ADODB.Recordset
Private m_cooperateredoDAO As CooperateRedoDAO
Private m_cooperateDAO As CooperateDAO
Public m_cooperateRedoID As String ' 从生产计划单传过来的返工单编号
Public m_finishid As String ' 生产外协单编号
Public m_cooperateType As Integer
Public m_cooperateRedoNum As Double ' 要返工的物料的数量
Private quantity As String '生产数量
Private Sub Command1_Click()
Call clear
End Sub
Private Sub Command2_Click()
If Not Check Then ' 判断输入文本的内容
Exit Sub
End If
Call xzjl
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
Private Sub Command4_Click()
' Dim Report As CooperateRedoprint
' Set Report = New CooperateRedoprint
' Report.PrintDataId Trim(Text1.Tag), Trim(Text11.text)
' Report.show 1
PrintCrystalReport "外协返工单", "'" & m_cooperateRedoID & "'"
Unload Me
End Sub
Private Sub Form_Load()
Set m_recordset = New ADODB.Recordset
Set m_cooperateredoDAO = New CooperateRedoDAO
Set m_cooperateDAO = New CooperateDAO
Dim ret As Boolean
Dim Counterclaimnum As Double
Dim lossNum As Double
SetToCenter Me
Command1.Visible = False
Command2.Visible = False
If m_finishid <> "" Then
ret = m_cooperateredoDAO.cooperateredo_showone(m_recordset, m_finishid)
If ret Then
With m_recordset
If Trim(.Fields("Counterclaimnum") & " ") = "" Then
Counterclaimnum = 0
End If
If Trim(.Fields("lossnum") & " ") = "" Then
lossNum = 0
End If
Text1.text = Trim(.Fields(2))
Text10.text = Trim(.Fields(1))
Text3.text = Trim(.Fields(3))
Text11.text = CDbl(.Fields(7)) - CDbl(.Fields(8)) - CDbl(lossNum) - CDbl(Counterclaimnum)
Text4.text = Trim(.Fields(4))
Text7.text = Trim(.Fields(5))
Text8.text = Trim(.Fields(6))
End With
End If
Text4.Enabled = False
Text8.Enabled = False
m_recordset.Close
End If
If CooperateRedolist.m_cooperateredoType = 2 Then '判断该页是否是从stockorderlistsupplier传过来的 0--表示是,1--表示否
Call cooperateredo_show
Command2.Enabled = False
Command1.Enabled = False
Text4.Enabled = False
Text8.Enabled = False
' ElseIf CooperateRedolist.m_cooperateredoType = 1 Then
' Text7.text = Trim(Format(Date, "yyyy-mm-dd"))
End If
End Sub
Private Sub clear()
Text1.text = ""
Text2.text = ""
Text4.text = ""
Text7.text = ""
Text8.text = ""
End Sub
Private Sub xzjl()
Dim ret As Boolean
ret = m_cooperateredoDAO.newcooperateredo(m_recordset, Trim(Text1.Tag), Trim(Text2.text), _
CDbl(Trim(Text4.text)), CDate(Trim(Text7.text)), _
Trim(Text8.text))
m_recordset.Close
Unload Me
End Sub
'**************************************
'* 功 能 描 述 :判断输入文本框数据的合法性
'* 输 入 参 数 :无
'* 输 出 能 数 :无
'**************************************
Private Function Check() As Boolean
Check = True
If Len(Trim(Text1.text)) = 0 Then ' 判断完成数量是否为空
MainForm.g_msgText = "生产编号不能为空!请双击生产编号!!"
Call HMsgBox(MainForm.g_msgText, 0, 1)
'Text5.SetFocus
Check = False
Exit Function
End If
If Len(Trim(Text4.text)) = 0 Then ' 判断完成数量是否为空
MainForm.g_msgText = "返工数量不能为空!"
Call HMsgBox(MainForm.g_msgText, 0, 1)
Text4.SetFocus
Check = False
Exit Function
End If
If Len(Trim(Text7.text)) = 0 Then ' 判断完成数量是否为空
MainForm.g_msgText = "返工时间不能为空!"
Call HMsgBox(MainForm.g_msgText, 0, 1)
'Text5.SetFocus
Check = False
Exit Function
End If
If Not IsNumeric(Text4.text) Then
MainForm.g_msgText = "返工数量,你输入的数字格式有错误!"
Call HMsgBox(MainForm.g_msgText, 0, 1)
Text4.SetFocus
Check = False
Exit Function
End If
If CDbl(Trim(Text4.text)) > CDbl(Trim(quantity)) Then
MainForm.g_msgText = "您的输入返工不能大于要生产的数量!" + "总的生产数量是" + Trim(quantity)
Call HMsgBox(MainForm.g_msgText, 0, 1)
'Text6.SetFocus
Check = False
Exit Function
End If
End Function
Private Sub cooperateredo_show()
Dim ret As Boolean
Dim lossNum As Double
Dim Counterclaimnum As Double
ret = m_cooperateredoDAO.cooperateredo_showone(m_recordset, m_cooperateRedoID)
If ret Then
With m_recordset
If Trim(.Fields(10) & " ") = "" Then
lossNum = 0
Else
lossNum = Trim(.Fields(10))
End If
If Trim(.Fields("Counterclaimnum") & " ") = "" Then
Counterclaimnum = 0
Else
Counterclaimnum = Trim(.Fields("Counterclaimnum"))
End If
Text1.Tag = Trim(.Fields(0))
Text1.text = Trim(.Fields(2))
Text10.text = Trim(.Fields(1))
Text3.text = Trim(.Fields(3))
Text11.text = CDbl(.Fields(7)) - CDbl(.Fields(8)) - CDbl(Counterclaimnum) - CDbl(lossNum)
Text4.text = Trim(.Fields(4))
Text7.text = Trim(.Fields(5))
Text8.text = Trim(.Fields(6))
End With
End If
m_recordset.Close
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -