frmbom.frm

来自「ERP工程管理子系统,用于ERP编程者参考.」· FRM 代码 · 共 831 行 · 第 1/2 页

FRM
831
字号
         Height          =   255
         Left            =   6840
         TabIndex        =   14
         Top             =   480
         Width           =   735
      End
      Begin VB.Label Label10 
         Caption         =   "单位:"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   10200
         TabIndex        =   13
         Top             =   480
         Width           =   855
      End
      Begin VB.Label Label9 
         Caption         =   "颜色:"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   8760
         TabIndex        =   12
         Top             =   480
         Width           =   855
      End
      Begin VB.Label Label7 
         Caption         =   "规格:"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   6120
         TabIndex        =   11
         Top             =   480
         Width           =   855
      End
      Begin VB.Label Label5 
         Caption         =   "名称:"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   3240
         TabIndex        =   10
         Top             =   480
         Width           =   735
      End
      Begin VB.Label Label3 
         Caption         =   "货号"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   120
         TabIndex        =   9
         Top             =   480
         Width           =   615
      End
   End
   Begin VB.Frame Frame2 
      Caption         =   "子项"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   3975
      Left            =   120
      TabIndex        =   17
      Top             =   2400
      Width           =   11655
   End
   Begin VB.Label LblAdd 
      BackStyle       =   0  'Transparent
      Caption         =   "添加"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   3720
      MouseIcon       =   "FrmBOM.frx":14C6
      MousePointer    =   99  'Custom
      TabIndex        =   7
      Top             =   6600
      Width           =   615
   End
   Begin VB.Image Image5 
      Height          =   300
      Left            =   3120
      Picture         =   "FrmBOM.frx":17D0
      Top             =   6600
      Width           =   300
   End
   Begin VB.Label LblModify 
      BackStyle       =   0  'Transparent
      Caption         =   "修改"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   5280
      MouseIcon       =   "FrmBOM.frx":1BEC
      MousePointer    =   99  'Custom
      TabIndex        =   6
      Top             =   6600
      Width           =   615
   End
   Begin VB.Image Image2 
      Height          =   300
      Left            =   4680
      Picture         =   "FrmBOM.frx":1EF6
      Top             =   6600
      Width           =   300
   End
   Begin VB.Label LblDelete 
      BackStyle       =   0  'Transparent
      Caption         =   "删除"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   6720
      MouseIcon       =   "FrmBOM.frx":2312
      MousePointer    =   99  'Custom
      TabIndex        =   5
      Top             =   6600
      Width           =   615
   End
   Begin VB.Image Image3 
      Height          =   300
      Left            =   6120
      Picture         =   "FrmBOM.frx":261C
      Top             =   6600
      Width           =   300
   End
   Begin VB.Label LblBack 
      BackStyle       =   0  'Transparent
      Caption         =   "返回"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   8160
      MouseIcon       =   "FrmBOM.frx":2A38
      MousePointer    =   99  'Custom
      TabIndex        =   4
      Top             =   6600
      Width           =   615
   End
   Begin VB.Image Image4 
      Height          =   300
      Left            =   7560
      Picture         =   "FrmBOM.frx":2D42
      Top             =   6600
      Width           =   300
   End
   Begin VB.Label LblFind 
      BackStyle       =   0  'Transparent
      Caption         =   "查询子项"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   5400
      MouseIcon       =   "FrmBOM.frx":315E
      MousePointer    =   99  'Custom
      TabIndex        =   2
      Top             =   2040
      Width           =   1095
   End
   Begin VB.Image Image1 
      Height          =   300
      Left            =   4800
      Picture         =   "FrmBOM.frx":3468
      Top             =   2040
      Width           =   300
   End
   Begin VB.Label Label1 
      BackStyle       =   0  'Transparent
      Caption         =   "BOM"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   18
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   5400
      TabIndex        =   0
      Top             =   240
      Width           =   615
   End
End
Attribute VB_Name = "FrmBOM"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Public Sub Refresh_BOM()
FrmBOM.TxtFather.Text = ""
FrmBOM.LblName.Caption = ""
FrmBOM.LblColor.Caption = ""
FrmBOM.LblSize.Caption = ""
FrmBOM.LblUnit.Caption = ""
FrmBOM.Adodc1.Refresh
FrmBOM.Adodc2.Refresh
End Sub

Private Sub Form_Load()
LblModify.Enabled = False
LblDelete.Enabled = False
End Sub

Private Sub ImgItem_Click()
FrmItemPQury.OK = 1
FrmItemPQury.Show 1
End Sub

Private Sub LblAdd_Click()
'显示添加项目选择窗口
FrmBOMInsertLogIn.Show
End Sub

Private Sub LblBack_Click()
Unload Me
End Sub

Private Sub LblDelete_Click()
If TxtFather <> "" Then
    '查询父项信息

        If Adodc1.Recordset.RecordCount = 0 Then
           MsgBox "没有该父项可进行删除"
        Exit Sub
        Else
        FrmBOMDeleteLogIn.LblDeleteP.Caption = "删除父项“" + Adodc1.Recordset.Fields(4) + "”"
        FrmBOMDeleteLogIn.OriParentItem = Adodc1.Recordset.Fields(0)
        End If
     '查询对应子项信息

        If Adodc2.Recordset.RecordCount = 0 Then
           FrmBOMDeleteLogIn.LbDeletelC.Visible = False
           FrmBOMDeleteLogIn.Image1.Visible = False
        Else
        FrmBOMDeleteLogIn.LbDeletelC.Caption = "删除父项“" + Adodc1.Recordset.Fields(4) + "”中的子项“" + Adodc2.Recordset.Fields(11) + "”"
        FrmBOMDeleteLogIn.OriChildItem = Adodc2.Recordset.Fields(2)
        End If
    
  FrmBOMDeleteLogIn.Show
Else
  MsgBox "请选择父项后指定要删除的子项纪录"
  TxtFather.Text = ""
  LblName.Caption = ""
  Exit Sub
End If
End Sub

Private Sub LblFind_Click()
If LblFind.Caption = "查询子项" Then

If TxtFather.Text = "" Then
MsgBox "请输入要查询的父项货号"
TxtFather.SetFocus
Exit Sub
End If

'查询父项信息
Adodc1.ConnectionString = "driver={SQL Server};server=" + Trim(Server) + ";uid=" + Trim(User) + ";pwd=" + Trim(Password) + ";database=ERP"
Adodc1.RecordSource = "select * from Parent,Item where Item.Item=Parent.ParentItem and Parent.ParentItem='" + Trim(TxtFather.Text) + "' "
Adodc1.Refresh
 If Adodc1.Recordset.RecordCount = 0 Then
 LblDelete.Enabled = False
 MsgBox "该项目不是父项,请重新输入"
TxtFather.SetFocus
TxtFather.SelStart = 0
TxtFather.SelLength = Len(TxtFather)
 Else
   '填充父项信息
    Set TxtFather.DataSource = Adodc1
    TxtFather.DataField = "Item"
    Set LblName.DataSource = Adodc1
    LblName.DataField = "Name"
    Set LblSize.DataSource = Adodc1
    LblSize.DataField = "Specification"
    Set LblColor.DataSource = Adodc1
    LblColor.DataField = "Color"
    Set LblUnit.DataSource = Adodc1
    LblUnit.DataField = "Unit"
    
    LblDelete.Enabled = True
    
    '使得货号,名称不可更改
    TxtFather.Enabled = False
    ImgItem.Enabled = False
    LblFind.Caption = "重新查找"
 End If

'查询对应子项信息
Adodc2.ConnectionString = "driver={SQL Server};server=" + Trim(Server) + ";uid=" + Trim(User) + ";pwd=" + Trim(Password) + ";database=ERP"

Adodc2.RecordSource = "select * from Child,Item where Item.Item=Child.ChildItem and Child.ParentItem='" + Trim(TxtFather.Text) + "' "
Adodc2.Refresh
'填充子项信息
Set DataGrid1.DataSource = Adodc2
 If Adodc2.Recordset.RecordCount <> 0 Then
    LblModify.Enabled = True
 Else
    LblModify.Enabled = False
 End If

Else
Unload Me
Me.Show

End If
End Sub

Private Sub LblModify_Click()
FrmCEdit.Modify = True
FrmCEdit.OriParentItem = Adodc1.Recordset.Fields(0)
FrmCEdit.OriChildItem = Adodc2.Recordset.Fields(2)
'父项信息
FrmCEdit.LblPName.Caption = Adodc1.Recordset.Fields(4)
FrmCEdit.LblPItem.Caption = Adodc1.Recordset.Fields(0)
FrmCEdit.LblPSpecification.Caption = Adodc1.Recordset.Fields(5)
FrmCEdit.LblPColor.Caption = Adodc1.Recordset.Fields(6)
FrmCEdit.LblPUnit.Caption = Adodc1.Recordset.Fields(7)
'子项信息
FrmCEdit.LblCName.Caption = Adodc2.Recordset.Fields(11)
FrmCEdit.LblCItem.Caption = Adodc2.Recordset.Fields(2)
FrmCEdit.LblCSpecification.Caption = Adodc2.Recordset.Fields(12)
FrmCEdit.LblCColor.Caption = Adodc2.Recordset.Fields(13)
FrmCEdit.LblCUnit.Caption = Adodc2.Recordset.Fields(14)
FrmCEdit.LblCDrawing.Caption = Adodc2.Recordset.Fields(10)
FrmCEdit.TxtQty.Text = Adodc2.Recordset.Fields(3)
FrmCEdit.CmbQT.Text = Adodc2.Recordset.Fields(4)
FrmCEdit.CmbCT.Text = Adodc2.Recordset.Fields(1)
FrmCEdit.TxtScrap.Text = Adodc2.Recordset.Fields(5)
FrmCEdit.TxtOffset.Text = Adodc2.Recordset.Fields(6)
FrmCEdit.TxtRemark.Text = Adodc2.Recordset.Fields(7)
FrmCEdit.Show
Adodc2.Refresh
End Sub

⌨️ 快捷键说明

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