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

📄 frmzz.frm

📁 经典delphi,Delphi下深入Windows核心编程.原书光盘代码
💻 FRM
📖 第 1 页 / 共 2 页
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "msflxgrd.ocx"
Begin VB.Form frmZZ 
   Caption         =   "组装单信息"
   ClientHeight    =   4620
   ClientLeft      =   1452
   ClientTop       =   1560
   ClientWidth     =   10344
   LinkTopic       =   "Form1"
   MDIChild        =   -1  'True
   ScaleHeight     =   4620
   ScaleWidth      =   10344
   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        =   17378
         _ExtentY        =   4255
         _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
Public txtSQL As String
Dim mrc As ADODB.Recordset
Dim MsgText As String
Dim mblChange As Boolean

Private Sub cmdAdd_Click()
    Dim intCount As Integer
    Dim sMeg As String
    Dim MsgText As String
    Dim j As Integer
    
  
    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
            txtSQL = "select sl from kucun where ckdm = '" & Trim(Combo1(2).ItemData(Combo1(2).ListIndex)) & "' and wzdm = '" & Trim(msgList.TextMatrix(intCount, 4)) & "'"
        
            Set mrc = ExecuteSQL(txtSQL, MsgText)
            If Not mrc.EOF Then
                If mrc.Fields(0) >= (CDbl(txtItem(5)) * CDbl(msgList.TextMatrix(intCount, 7))) Then
                    j = j + 1
                End If
                
                mrc.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
                    txtSQL = "select sl,total_je from kucun where ckdm = '" & Trim(Combo1(2).ItemData(Combo1(2).ListIndex)) & "' and wzdm = '" & Trim(msgList.TextMatrix(intCount, 4)) & "'"
                
                    Set mrc = ExecuteSQL(txtSQL, MsgText)
                    If Not mrc.EOF Then
                        mrc.Fields(0) = mrc.Fields(0) - CDbl(txtItem(5)) * CDbl(msgList.TextMatrix(intCount, 7))
                        mrc.Fields(1) = mrc.Fields(1) * (mrc.Fields(0)) / (mrc.Fields(0) + CDbl(txtItem(5)) * CDbl(msgList.TextMatrix(intCount, 7)))
                        

⌨️ 快捷键说明

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