📄 form_incomeadd.frm
字号:
AllowUserResizing= 3
End
Begin MSDBGrid.DBGrid gridCustomer
Bindings = "form_incomeAdd.frx":802E
Height = 1500
Left = 855
OleObjectBlob = "form_incomeAdd.frx":8042
TabIndex = 4
Top = 1680
Visible = 0 'False
Width = 3840
End
Begin MSDBGrid.DBGrid grid1
Bindings = "form_incomeAdd.frx":8D7A
Height = 2985
Left = 3915
OleObjectBlob = "form_incomeAdd.frx":8D8E
TabIndex = 15
Top = 1980
Visible = 0 'False
Width = 6285
End
Begin MSFlexGridLib.MSFlexGrid mf1
Height = 4575
Left = 120
TabIndex = 16
Top = 1680
Width = 11130
_ExtentX = 19632
_ExtentY = 8070
_Version = 393216
BackColorFixed = -2147483636
BackColorBkg = -2147483644
AllowUserResizing= 3
End
Begin VB.Label lblTtlQtyCaption
BackColor = &H00C0FFFF&
Caption = "总件数:"
ForeColor = &H00FF0000&
Height = 255
Left = 1200
TabIndex = 22
Top = 8160
Width = 735
End
Begin VB.Label lblTtlQty
BackColor = &H00C0FFFF&
Caption = "0"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 255
Left = 2040
TabIndex = 21
Top = 8160
Width = 735
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "入 库 单"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 285
Left = 5115
TabIndex = 18
Top = 0
Width = 1395
End
Begin VB.Label Label6
BackColor = &H80000018&
Caption = "累计净重毛重"
BeginProperty Font
Name = "宋体"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 1200
Left = 615
TabIndex = 17
Top = 6480
Width = 255
End
End
Attribute VB_Name = "form_incomeAdd"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim s, y, i '定义变量
Dim mydb As Database '定义数据库
Dim rs1 As Recordset '定义字段
Dim rs2 As Recordset
Dim rsMaster As Recordset
Dim lsph As Integer '定义一个整型变量
Dim isAdd As Boolean '是否新增
Dim grid1IsVisible As Boolean
Dim m_billType As Integer
' 续单的最大箱号
Dim m_prevBillNo As Integer
Private Sub cmdCHeck_Click()
Dim strMsg As String
strMsg = checkbarcodesRepeated(mf1)
If strMsg <> "" Then
MsgBox "红色显示部分条码重复!", vbCritical, "警告"
End If
End Sub
Private Sub cmdDeleteLine_Click()
For i = mf1.FixedCols To mf1.cols - mf1.FixedCols
mf1.TextMatrix(mf1.row, i) = ""
Next i
text1.Text = ""
Call fillTotalDataFromDtlData
If mf1.row > 1 Then
mf1.row = mf1.row - 1
End If
Exit Sub
End Sub
Private Sub cmdImport_Click()
Dim filePath As String
filePath = ""
filePath = "C:\盘点机目录\rk.txt"
If Dir(filePath) = "" Then
MsgBox "对不起,找不到文件【" + filePath + "】", vbInformation, "提示"
Exit Sub
End If
If MsgBox("真的要导入文件" + vbCrLf + "【" + filePath + "】的数据嘛?", vbYesNo + vbQuestion + vbDefaultButton1, "提示") = vbNo Then
Exit Sub
End If
' 将文本文件中的数据导入到数据库中
If importDataFromFile(filePath, "RK") = True Then
MsgBox "导入成功,请修改供应商等信息!", vbInformation, "提示"
Unload Me
Load form_incomeBill
form_incomeBill.Show
frm_main.Enabled = False
Else
MsgBox "对不起,导入失败!", vbInformation, "提示"
End If
End Sub
Private Sub cmdPrevNo_Click()
Load dlg_incomeBill
dlg_incomeBill.Show vbModal, Me
m_prevBillNo = getPrevBillMaxBoxNo(Me.txtPrevBillNo.Text, True)
setGridSequence Me.mf1, m_prevBillNo + 1, 0
End Sub
Private Sub Form_Load()
' Me.cmdImport.Visible = False
' 隐藏没有用的孔件
Me.Label5.Visible = False
Me.txtPrevBillNo.Visible = False
Me.cmdPrevNo.Visible = False
Me.chkAutoOut.Visible = False
m_prevBillNo = 0
grid1IsVisible = False
isAdd = True
enableControls (False)
'自动识别数据库路径
Data1.DatabaseName = g_dbPath
Data2.DatabaseName = g_dbPath
m_billType = 0
mf1.rows = 2: mf1.cols = 14 '定义mf1表的总行数、总列数
'定义mf1表的列宽和表头信息
s = Array("500", "1300", "1200", "1300", "1100", "450", "1000", "0", "0", "1000", "500", "1000", "1300", 0)
y = Array("序号", "条 码 号", "物料名称", "型号||规格", " 标 准", "单位", "净重", "价格", "金额", "总皮重", "件/箱", "毛重", "工号", "productId")
For i = 0 To mf1.cols - 1
mf1.ColWidth(i) = s(i): mf1.TextMatrix(0, i) = y(i)
Next i
mf1.FixedRows = 1: mf1.FixedCols = 1 '定义mf1表的固定行数、固定列数
'定义mf1表的列序号
For i = mf1.FixedRows To mf1.rows - mf1.FixedRows
mf1.TextMatrix(i, 0) = i
Next i
mf1.AllowUserResizing = flexResizeColumns
'定义msfgTtl表的列宽和表头信息
msfgTtl.rows = 2: msfgTtl.cols = 11 '定义msfgTtl表的总行数、总列数
msfgTtl.FixedRows = 1: msfgTtl.FixedCols = 1 '定义mf1表的固定行数、固定列数
s = Array("500", "900", "1400", "1300", "1100", "700", "1000", "0", "600", "1000", 0)
y = Array("序号", "物料编号", "物料名称", "型号||规格", " 标 准", "单位", "总净重", "金额", "总件数", "总毛重", "productId")
For i = 0 To msfgTtl.cols - 1
msfgTtl.ColWidth(i) = s(i): msfgTtl.TextMatrix(0, i) = y(i)
Next i
msfgTtl.rows = 101
For i = msfgTtl.FixedRows To msfgTtl.rows - msfgTtl.FixedRows
msfgTtl.TextMatrix(i, 0) = i
Next i
billDate.Text = CStr(Now) '设置出库日期
Data1.RecordSource = "select * from hpos_products"
Data2.RecordSource = "select fullName,orgId,orgCode,shortenedform from hpos_organization where orgType=1 order by fullName"
End Sub
Private Sub Form_Unload(Cancel As Integer)
frm_main.Enabled = True
End Sub
Private Sub gridCustomer_DblClick()
selectCustomer
End Sub
Private Sub gridCustomer_GotFocus()
text1.Visible = False
End Sub
Private Sub gridCustomer_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then '当按回车键时
selectCustomer
End If
If KeyCode = vbKeyEscape Then '按ESC键
gridCustomer.Visible = False 'gridCustomer不可见
End If
End Sub
Private Sub selectCustomer()
With Data2.Recordset
If Data2.Recordset.RecordCount > 0 Then
If Data2.Recordset.Fields("orgId") <> "" Then
'赋值给mf1表格
If .Fields("OrgId") <> "" Then txtSupplier.Text = .Fields("OrgId")
If .Fields("fullName") <> "" Then supplierName.Text = .Fields("fullName")
gridCustomer.Visible = False
Else
MsgBox "没有数据可选择!", vbCritical, "提示"
gridCustomer.Visible = False 'gridCustomer不可见
End If
End If
End With
' supplierName.SetFocus: supplierName.SelStart = 0: supplierName.SelLength = Len(supplierName.Text)
mf1GetFocus
End Sub
Private Sub grid1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then '当按回车键时
With Data1.Recordset
If Data1.Recordset.RecordCount > 0 Then
If Data1.Recordset.Fields("barcode") <> "" Then
text1.Text = mf1.Text '赋值给text1
text1.SetFocus
If (mf1.row = mf1.rows - mf1.FixedRows) Then
mf1.rows = mf1.rows + 1
mf1.TextMatrix(mf1.rows - mf1.FixedRows, 0) = mf1.rows - mf1.FixedRows + m_prevBillNo
End If
mf1.row = mf1.row + 1: mf1.col = 1 '到达第5列
grid1.Visible = False
Else
MsgBox "没有数据供选择!", vbCritical, "提示"
grid1.Visible = False 'grid1不可见
text1.SetFocus
End If
End If
End With
text1.SetFocus 'text1获得焦点
End If
If KeyCode = vbKeyEscape Then '按ESC键
grid1.Visible = False 'grid1不可见
text1.SetFocus 'text1获得焦点
End If
End Sub
Private Sub gridCustomer_LostFocus()
gridCustomer.Visible = False
End Sub
Private Sub mf1_GotFocus()
If mf1.row >= mf1.FixedRows And (mf1.col = 1) Then
On Error Resume Next
text1.Width = mf1.CellWidth
text1.Height = mf1.CellHeight
text1.Left = mf1.CellLeft + mf1.Left
text1.Top = mf1.CellTop + mf1.Top
text1.Text = mf1.Text
text1.Visible = True 'text1可见
text1.SetFocus
text1.Locked = False
End If
End Sub
Private Sub supplierName_Change()
'查询供应商信息
Data2.RecordSource = "select fullName,orgId,orgCode,shortenedform from hpos_organization where orgType=1 and ((hpos_organization.fullName like " + Chr(34) + supplierName.Text + "*" + Chr(34) + ")or (hpos_organization.shortenedform like " + Chr(34) + supplierName.Text + "*" + Chr(34) + "))order by fullName"
Data2.Refresh
Dim rsMaster As Recordset
Set rsMaster = Data2.Recordset
If rsMaster.EOF Or supplierName.Text = "" Or IsNull(rsMaster) Then
gridCustomer.Visible = False
Else
gridCustomer.Visible = True
End If
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -