⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fk_cailiao_shouhuoxiangdan.vb

📁 本软件设计为在"采购部""工程部""财务部""总经理"等部门之间的采购审核流转等事宜
💻 VB
📖 第 1 页 / 共 2 页
字号:
        Me.Button2.Text = "删 除"
        '
        'Button3
        '
        Me.Button3.Location = New System.Drawing.Point(368, 344)
        Me.Button3.Name = "Button3"
        Me.Button3.Size = New System.Drawing.Size(88, 24)
        Me.Button3.TabIndex = 20
        Me.Button3.Text = "更 新"
        '
        'GroupBox2
        '
        Me.GroupBox2.Location = New System.Drawing.Point(16, 320)
        Me.GroupBox2.Name = "GroupBox2"
        Me.GroupBox2.Size = New System.Drawing.Size(536, 64)
        Me.GroupBox2.TabIndex = 21
        Me.GroupBox2.TabStop = False
        Me.GroupBox2.Text = "操 作 区"
        '
        'fk_cailiao_shouhuoxiangdan
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
        Me.ClientSize = New System.Drawing.Size(568, 398)
        Me.Controls.Add(Me.Button3)
        Me.Controls.Add(Me.Button2)
        Me.Controls.Add(Me.Button1)
        Me.Controls.Add(Me.DataGrid1)
        Me.Controls.Add(Me.TextBox8)
        Me.Controls.Add(Me.Label8)
        Me.Controls.Add(Me.TextBox7)
        Me.Controls.Add(Me.Label7)
        Me.Controls.Add(Me.TextBox6)
        Me.Controls.Add(Me.Label6)
        Me.Controls.Add(Me.TextBox5)
        Me.Controls.Add(Me.Label5)
        Me.Controls.Add(Me.TextBox4)
        Me.Controls.Add(Me.Label4)
        Me.Controls.Add(Me.TextBox3)
        Me.Controls.Add(Me.Label3)
        Me.Controls.Add(Me.TextBox2)
        Me.Controls.Add(Me.Label2)
        Me.Controls.Add(Me.TextBox1)
        Me.Controls.Add(Me.Label1)
        Me.Controls.Add(Me.GroupBox1)
        Me.Controls.Add(Me.GroupBox2)
        Me.MaximizeBox = False
        Me.Name = "fk_cailiao_shouhuoxiangdan"
        Me.Text = "收货单详细信息录入"
        CType(Me.DataGrid1, System.ComponentModel.ISupportInitialize).EndInit()
        Me.ResumeLayout(False)

    End Sub

#End Region
    Dim x As Integer
    Dim m As Integer
    
    '保存信息
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If Me.TextBox1.Text.Trim = "" Then
            MsgBox("请输入货物序号!", MsgBoxStyle.Information, "提示!")
            TextBox1.Focus()
            Exit Sub
        End If
        Dim str As String
        str = "select * from fk_cailiao_shouhuo_xiangdan where 序号 = " + Chr(39) + TextBox1.Text.Trim + Chr(39) + "and 收货单编号 =" + Chr(39) + fk_pub_str + Chr(39)
        If panduan(str) = True Then
            MsgBox("您输入的序号已经存在,请重新输入!", MsgBoxStyle.Information, "提示!")
            TextBox1.Focus()
            Exit Sub
        End If

        Dim sqlstr As String
        sqlstr = "INSERT INTO fk_cailiao_shouhuo_xiangdan " & _
        "(序号,物料名称,描述,单位,数量,单价,总价,收货单编号) " & _
        "VALUES ('" & Me.TextBox1.Text.Trim & "','" & Me.TextBox2.Text.Trim & "','" & Me.TextBox3.Text.Trim & "','" & Me.TextBox4.Text.Trim & "','" & Me.TextBox5.Text.Trim & "','" & Me.TextBox6.Text.Trim & "','" & Me.TextBox7.Text.Trim & "','" & Me.TextBox8.Text.Trim & "')"

        If UpdateData(sqlstr) = False Then
            MsgBox("没有成功添加了该货物信息!", MsgBoxStyle.OKOnly + _
                    MsgBoxStyle.Exclamation, "添加成功")
            Exit Sub
        Else
            MsgBox("已经成功添加了该货物信息!", MsgBoxStyle.OKOnly + _
                    MsgBoxStyle.Exclamation, "添加成功")

            xianshi_datagride1() '显示所有收货单已经有的货物信息到datagrid1中
        End If


    End Sub


    '显示所有收货单已经有的货物信息到datagrid1中
    Private Sub xianshi_datagride1()
        Dim mystr As String
        Dim mydataset As New DataSet
        mystr = "select 序号,物料名称,描述 ,单位,数量,总价 from fk_cailiao_shouhuo_xiangdan   where 收货单编号 =" + Chr(39) + fk_pub_str + Chr(39)
        mydataset = GetDataFromDB(mystr)
        DataGrid1.DataSource = mydataset
    End Sub


    '更新
    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click

        Dim sqlstr As String
        sqlstr = "UPDATE fk_cailiao_shouhuo_xiangdan SET   物料名称 =" + Chr(39) + Trim(TextBox2.Text) + Chr(39) + ",描述 =" + Chr(39) + TextBox3.Text.Trim + Chr(39) + ",单位 =" + Chr(39) + Trim(TextBox4.Text) + Chr(39) + ",数量 =" + Chr(39) + Trim(TextBox5.Text) + Chr(39) + ",单价 =" + Chr(39) + Trim(TextBox6.Text) + Chr(39) + ",总价 =" + Chr(39) + Trim(TextBox7.Text) + Chr(39) + "  where 收货单编号 =" + Chr(39) + fk_pub_str + Chr(39) + "and 序号 =" + Chr(39) + TextBox1.Text.Trim + Chr(39)
        If UpdateData(sqlstr) = True Then
            MsgBox("已经成功更新该信息", MsgBoxStyle.OKOnly + _
            MsgBoxStyle.Exclamation, "更新")


        Else
            MsgBox("没有成功更新该信息", MsgBoxStyle.OKOnly + _
                        MsgBoxStyle.Exclamation, "更新")
            Exit Sub
        End If
    End Sub


    '删  除
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

        Dim sqlstr As String
        sqlstr = "delete fk_cailiao_shouhuo_xiangdan  where 收货单编号 = " + Chr(39) + fk_pub_str + Chr(39) + "and 序号 = " + Chr(39) + TextBox1.Text.Trim + Chr(39)
        If MsgBox("确定要删除吗?", MsgBoxStyle.YesNo, "删除") = MsgBoxResult.No Then
            Exit Sub
        End If
        If UpdateData(sqlstr) = True Then
            MsgBox("已经成功删除该信息", MsgBoxStyle.OKOnly + _
            MsgBoxStyle.Exclamation, "删除")


        Else
            MsgBox("没有成功删除该信息,请与管理员联系!", MsgBoxStyle.OKOnly + _
                        MsgBoxStyle.Exclamation, "删除")
            Exit Sub
        End If
    End Sub


    '窗体的load事件
    Private Sub fk_cailiao_shouhuoxiangdan_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        TextBox8.Text = fk_pub_str
        xianshi_datagride1() '显示所有收货单已经有的货物信息到datagrid1中

        TextBox1.Text = ""
        TextBox2.Text = ""
        TextBox3.Text = ""
        TextBox4.Text = ""
        TextBox5.Text = ""


    End Sub


    Private Sub TextBox6_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox6.TextChanged


        x = x + 1
        If x = 1 Then
            Exit Sub
        End If

        If TextBox6.Text.Trim = "" Then
            TextBox7.Text = ""
            Exit Sub
        End If

        If TextBox5.Text.Trim = "" Then
            MsgBox("请先输入数量!", MsgBoxStyle.Information, "提示")
            TextBox5.Focus()
            Exit Sub
        End If
        Dim str1 As String = TextBox6.Text.Trim

        Dim y As Integer = str1.Length
        Dim sstr As String
        Dim i As Integer
        Dim yy As Integer = 0
        For i = 1 To y
            sstr = Microsoft.VisualBasic.Mid(str1, i, 1)
            If sstr = "0" Or sstr = "1" Or sstr = "2" Or sstr = "3" Or sstr = "4" Or sstr = "5" Or sstr = "6" Or sstr = "7" Or sstr = "8" Or sstr = "9" Or sstr = "." Then
                If sstr = "." Then
                    yy = yy + 1
                    If yy = 2 Then
                        MsgBox("已经有了--.--,不能再输入了!", MsgBoxStyle.Information, "提示")
                        TextBox6.Focus()
                        Exit Sub
                    End If
                End If
            Else
                MsgBox("请输入正确的数字,特别要分清----。----和---.----", MsgBoxStyle.Information, "提示")
                TextBox1.Focus()
                Exit Sub
            End If
        Next

        Dim str2 As String = TextBox5.Text.Trim
        Dim int1 As Decimal
        Dim int2 As Decimal


        Dim int As Decimal
        int1 = Convert.ToDecimal(str2)
        int2 = Convert.ToDecimal(str1)


        int = int1 * int2
        TextBox7.Text = int.ToString
    End Sub


    Private Sub TextBox5_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox5.TextChanged

        m = m + 1
        If x = 1 Then
            Exit Sub
        End If

        Dim str1 As String = TextBox5.Text.Trim

        Dim y As Integer = str1.Length
        Dim sstr As String
        Dim i As Integer
        Dim yy As Integer = 0
        For i = 1 To y
            sstr = Microsoft.VisualBasic.Mid(str1, i, 1)
            If sstr = "0" Or sstr = "1" Or sstr = "2" Or sstr = "3" Or sstr = "4" Or sstr = "5" Or sstr = "6" Or sstr = "7" Or sstr = "8" Or sstr = "9" Or sstr = "." Then
                If sstr = "." Then
                    yy = yy + 1
                    If yy = 2 Then
                        MsgBox("已经有了--.--,不能再输入了!", MsgBoxStyle.Information, "提示")
                        TextBox5.Focus()
                        Exit Sub
                    End If
                End If
            Else
                MsgBox("请输入正确的数字,特别要分清----。----和---.----", MsgBoxStyle.Information, "提示")
                TextBox1.Focus()
                Exit Sub
            End If
        Next

    End Sub
End Class

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -