物流运输管理系统 第8页
Set Item = lsvClient.ListItems.Add(, , "")
Item.Tag = sys.StrToText(arrclient(0, iq))
Item.Text = sys.StrToText(iq + 1)
Item.SubItems(1) = sys.StrToText(arrclient(1, iq))
Item.SubItems(2) = sys.StrToText(arrclient(2, iq))
Item.SubItems(3) = sys.StrToText(arrclient(3, iq))
Item.SubItems(4) = sys.StrToText(arrclient(4, iq))
Item.SubItems(5) = sys.StrToText(arrclient(5, iq))
Item.SubItems(5) = sys.StrToText(arrclient(6, iq))
Next
Label2.Caption = "共 " & total & " 条记录"
End Sub
4.8 车站管理表单
新建FRMSTATION表单,用来管理物流系统,所有经过的车站信息,在这个表单中,输入物货信息管理系统中所有经过的车站,即可以接受物品货运到达的地方。
车站管理窗体的控件及属性取值如下:
控件 属性 属性取值
label Name lblTitle
Caption 车站管理
Text Name txtItem
Text Name txtItem
commandbutton Name cmdadd
Caption 新增
commandbutton Name cmdmodify
Caption 修改
commandbutton Name cmddelete
Caption 删除
代码如下:
Private Sub Form_Load()
Me.Top = 0
Me.Left = 0
Me.Width = MainForm.Width * 0.4
Me.Height = MainForm.Height * 0.6
'初始化车站
Dim inum As Integer
Dim strsql As String
Dim DB As New clsDataBase
Dim rs As New ADODB.Recordset
ReDim arrstation(0) As String
strsql = "SELECT * FROM STATION"
Set rs = sys.DB.OpenRecordSet(strsql)
If Not (rs.BOF) Or (rs.EOF) Then
inum = 0
Do While Not rs.EOF
ReDim Preserve arrstation(inum)
arrstation(inum) = rs("NAME")
LisStation.AddItem (rs("NAME"))
LisStation.ItemData(inum) = rs("ID")
rs.MoveNext
inum = inum + 1
Loop
End If
End Sub
Private Sub LisStation_Click()
If LisStation.ListIndex <> -1 Then
txtId.Text = LisStation.ItemData(LisStation.ListIndex)
txtStation.Text = LisStation.Text
End If
End Sub
4.9 品名管理表单
新建FRMPRODUCT表单,用来管理系统的品名设置,通过这个表单,可以对物流管理系统中,所有接待的物品品名进行提前设置,可以方便用户在添加运单管理时对货运信息的输入。
代码如下:
Private Sub Command1_Click()
'检查是否为空
If Trim(txtProduct.Text) <> "" Then
'检查是否重复
Dim i As Integer
Dim isfind As Boolean
isfind = False
For i = 0 To UBound(arrProduct)
If txtProduct.Text = arrProduct(i) Then
isfind = True
End If
Next
If isfind = False Then
'取得最大ID
Dim inum As Integer
Dim strsql As String
Dim DB As New clsDataBase
Dim rs As New ADODB.Recordset
strsql = "SELECT MAX(ID) AS MAXID FROM Product"
Set rs = sys.DB.OpenRecordSet(strsql)
If Not IsNull(rs(0)) Then
ID = rs(0) + 1
Else
ID = 0
End If
txtId.Text = ID
MyVar = MsgBox("确认增加?", vbOKCancel, "信息提示")
If MyVar = vbOK Then
'插入数据
strsql = "INSERT INTO Product (ID,NAME) VALUES (" & sys.TextTolong(txtId) & "," & sys.StrToInsert(txtProduct) & ")"
sys.DB.ExecuteSQL (strsql)
MsgBox "操作成功!"
Unload Me
End If
Else
MsgBox "已经存在该品名!"
End If
Else
MsgBox "品名不能为空!"
End If
End Sub
Private Sub Command2_Click()
'检查是否为空
If Trim(txtProduct.Text) <> "" Then
'检查是否重复
上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] 下一页