📄 frmzz.frm
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "Msflxgrd.ocx"
Begin VB.Form frmZZ
Caption = "组装单信息"
ClientHeight = 4620
ClientLeft = 1455
ClientTop = 1560
ClientWidth = 10335
LinkTopic = "Form1"
MDIChild = -1 'True
ScaleHeight = 4620
ScaleWidth = 10335
WindowState = 2 'Maximized
Begin VB.Frame Frame1
Caption = "组装单基本信息:"
Height = 1560
Index = 0
Left = 120
TabIndex = 2
Top = 10
Width = 10092
Begin VB.CommandButton cmdAdd
Caption = "组装成品"
Height = 372
Left = 7560
TabIndex = 26
Top = 1080
Width = 2292
End
Begin VB.ComboBox Combo1
Height = 288
Index = 3
Left = 5760
Style = 2 'Dropdown List
TabIndex = 25
Top = 1080
Width = 1572
End
Begin VB.ComboBox Combo1
Height = 288
Index = 2
Left = 3360
Style = 2 'Dropdown List
TabIndex = 24
Top = 1080
Width = 1572
End
Begin VB.TextBox txtItem
Height = 270
Index = 6
Left = 960
MaxLength = 20
TabIndex = 18
Top = 1080
Width = 1572
End
Begin VB.TextBox txtItem
Height = 270
Index = 5
Left = 8280
MaxLength = 20
TabIndex = 17
Top = 720
Width = 1572
End
Begin VB.TextBox txtItem
Height = 270
Index = 4
Left = 5760
MaxLength = 20
TabIndex = 16
Top = 720
Width = 1572
End
Begin VB.ComboBox Combo1
Height = 288
Index = 1
Left = 960
Style = 2 'Dropdown List
TabIndex = 15
Top = 720
Width = 1572
End
Begin VB.TextBox txtItem
Height = 270
Index = 3
Left = 3360
MaxLength = 20
TabIndex = 12
Top = 720
Width = 1572
End
Begin VB.TextBox txtItem
Height = 270
Index = 2
Left = 8280
MaxLength = 20
TabIndex = 8
Top = 360
Width = 1572
End
Begin VB.TextBox txtItem
Height = 270
Index = 0
Left = 960
MaxLength = 20
TabIndex = 5
Top = 360
Width = 1572
End
Begin VB.ComboBox Combo1
Height = 288
Index = 0
Left = 3360
Style = 2 'Dropdown List
TabIndex = 4
Top = 360
Width = 1572
End
Begin VB.TextBox txtItem
Enabled = 0 'False
Height = 270
Index = 1
Left = 5760
MaxLength = 20
TabIndex = 3
Top = 360
Width = 1572
End
Begin VB.Label Label2
Caption = "成品仓库:"
Height = 252
Index = 10
Left = 5040
TabIndex = 23
Top = 1080
Width = 1092
End
Begin VB.Label Label2
Caption = "原料仓库:"
Height = 252
Index = 9
Left = 2640
TabIndex = 22
Top = 1080
Width = 1092
End
Begin VB.Label Label2
Caption = "总 金 额:"
Height = 252
Index = 8
Left = 120
TabIndex = 21
Top = 1080
Width = 1092
End
Begin VB.Label Label2
Caption = "数 量:"
Height = 252
Index = 7
Left = 7440
TabIndex = 20
Top = 720
Width = 1092
End
Begin VB.Label Label2
Caption = "价 格:"
Height = 252
Index = 6
Left = 5040
TabIndex = 19
Top = 720
Width = 1092
End
Begin VB.Label Label2
Caption = "成品名称:"
Height = 252
Index = 1
Left = 120
TabIndex = 14
Top = 720
Width = 1092
End
Begin VB.Label Label2
Caption = "计量单位:"
Height = 252
Index = 4
Left = 2640
TabIndex = 13
Top = 720
Width = 1092
End
Begin VB.Label Label2
Caption = "业 务 员:"
Height = 252
Index = 3
Left = 2640
TabIndex = 10
Top = 360
Width = 1092
End
Begin VB.Label Label2
Caption = "成品编号:"
Height = 252
Index = 2
Left = 7440
TabIndex = 9
Top = 360
Width = 1092
End
Begin VB.Label Label2
Caption = "组装单编号:"
Height = 252
Index = 0
Left = 5040
TabIndex = 7
Top = 360
Width = 1092
End
Begin VB.Label Label2
Caption = "日 期:"
Height = 252
Index = 5
Left = 120
TabIndex = 6
Top = 360
Width = 1092
End
End
Begin VB.Frame Frame1
Caption = "原材料信息"
Height = 2772
Index = 1
Left = 120
TabIndex = 0
Top = 1680
Width = 10092
Begin MSFlexGridLib.MSFlexGrid msgList
Height = 2412
Left = 120
TabIndex = 1
Top = 240
Width = 9852
_ExtentX = 17383
_ExtentY = 4260
_Version = 393216
Cols = 5
FixedCols = 4
AllowUserResizing= 1
End
End
Begin VB.Label lblTitle
Caption = "生 产 配 料 单 设 置 信 息 列 表"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H8000000D&
Height = 252
Left = 480
TabIndex = 11
Top = 240
Visible = 0 'False
Width = 5532
End
End
Attribute VB_Name = "frmZZ"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim mblChange As Boolean
Public txtSQL As String
Dim mrc As adodb.Recordset
'用户的读写权限标识
Dim mintRW As Integer
'状态条中显示的时间信息
Public msBarText As String
Public reportSQL As String
Public Sub RecordRefresh()
'显示数据
msBarText = "当前数据时间范围:" & Format(DateAdd("m", -1, Now), "yyyy-mm-dd") & "至" & Format(Now, "yyyy-mm-dd")
ShowData
End Sub
Private Sub cmdAdd_Click()
Dim intCount As Integer
Dim sMeg As String
Dim MsgText As String
Dim j As Integer
Dim sSQL As String
Dim recTemp As adodb.Recordset
For intCount = 0 To 6
If Trim(txtItem(intCount) & " ") = "" Then
Select Case intCount
Case 0
sMeg = "日期"
Case 1
sMeg = "组装单编号"
Case 2
sMeg = "成品编号"
Case 3
sMeg = "计量单位"
Case 4
sMeg = "价格"
Case 5
sMeg = "数量"
Case 6
sMeg = "总金额"
End Select
sMeg = sMeg & "不能为空!"
MsgBox sMeg, vbOKOnly + vbExclamation, "警告"
txtItem(intCount).SetFocus
Exit Sub
End If
Next intCount
For intCount = 0 To 3
If Trim(Combo1(intCount) & " ") = "" Then
Select Case intCount
Case 0
sMeg = "业务员"
Case 1
sMeg = "成品名称"
Case 2
sMeg = "原材料仓库"
Case 3
sMeg = "成品仓库"
End Select
sMeg = sMeg & "不能为空!"
MsgBox sMeg, vbOKOnly + vbExclamation, "警告"
Combo1(intCount).SetFocus
Exit Sub
End If
Next intCount
If msgList.Rows > 1 Then
j = 0
For intCount = 1 To msgList.Rows - 1
sSQL = "select sl from kucun where ckdm = '" & Trim(Combo1(2).ItemData(Combo1(2).ListIndex)) & "' and wzdm = '" & Trim(msgList.TextMatrix(intCount, 4)) & "'"
Set recTemp = ExecuteSQL(sSQL, MsgText)
If Not recTemp.EOF Then
If recTemp.Fields(0) >= (CDbl(txtItem(5)) * CDbl(msgList.TextMatrix(intCount, 7))) Then
j = j + 1
End If
recTemp.Close
End If
Next intCount
If j <> msgList.Rows - 1 Then
MsgBox "指定的原材料仓库中数量不够,请先进货或者转仓!", vbOKOnly, "警告"
Else
If MsgBox("是否组装成品" & Trim(Combo1(1)) & Trim(txtItem(5)) & Trim(txtItem(3)) & ",并保存在仓库" & Trim(Combo1(3)) & "?", vbOKCancel, "组装产品") = vbOK Then
'更新库存
'减少原材料
For intCount = 1 To msgList.Rows - 1
sSQL = "select sl,total_je from kucun where ckdm = '" & Trim(Combo1(2).ItemData(Combo1(2).ListIndex)) & "' and wzdm = '" & Trim(msgList.TextMatrix(intCount, 4)) & "'"
Set recTemp = ExecuteSQL(sSQL, MsgText)
If Not recTemp.EOF Then
recTemp.Fields(0) = recTemp.Fields(0) - CDbl(txtItem(5)) * CDbl(msgList.TextMatrix(intCount, 7))
recTemp.Fields(1) = recTemp.Fields(1) * (recTemp.Fields(0)) / (recTemp.Fields(0) + CDbl(txtItem(5)) * CDbl(msgList.TextMatrix(intCount, 7)))
recTemp.Update
recTemp.Close
End If
Next intCount
'增加成品
sSQL = "select sl,total_je from kucun where ckdm = '" & Trim(Combo1(3).ItemData(Combo1(3).ListIndex)) & "' and wzdm = '" & Trim(txtItem(2)) & "'"
Set recTemp = ExecuteSQL(sSQL, MsgText)
If Not recTemp.EOF Then
recTemp.Fields(0) = recTemp.Fields(0) + CDbl(txtItem(5))
recTemp.Fields(1) = recTemp.Fields(1) + CDbl(txtItem(6))
recTemp.Update
recTemp.Close
Else
sSQL = "insert kucun (update_date,kucun_no,ckdm,wzdm,sl,total_je) values ('"
sSQL = sSQL & Trim(txtItem(0)) & "','"
sSQL = sSQL & Trim(txtItem(1)) & "','"
sSQL = sSQL & Trim(Combo1(3).ItemData(Combo1(3).ListIndex)) & "','"
sSQL = sSQL & Trim(txtItem(2)) & "','"
sSQL = sSQL & Trim(txtItem(5)) & "','"
sSQL = sSQL & Trim(txtItem(6)) & "')"
Set recTemp = ExecuteSQL(sSQL, MsgText)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -