frmproductenregister.frm

来自「需要控件:Active Report 2.0(专业报表控件破解版)2.0下的ar」· FRM 代码 · 共 969 行 · 第 1/3 页

FRM
969
字号
      Begin VB.TextBox Text1 
         Height          =   300
         Left            =   1020
         Locked          =   -1  'True
         MaxLength       =   12
         TabIndex        =   1
         Top             =   210
         Width           =   1710
      End
      Begin ServicingMS.ucListView ListView1 
         Height          =   2685
         Left            =   105
         TabIndex        =   4
         Top             =   1920
         Width           =   7470
         _ExtentX        =   13176
         _ExtentY        =   4736
      End
      Begin ServicingMS.lvButtons_H CmdPartsAdd 
         Height          =   390
         Left            =   5700
         TabIndex        =   30
         Top             =   5805
         Width           =   1845
         _ExtentX        =   3254
         _ExtentY        =   688
         Caption         =   "维修零件增加"
         CapAlign        =   2
         BackStyle       =   2
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         cGradient       =   0
         Mode            =   0
         Value           =   0   'False
         Image           =   "FrmProductEnregister.frx":1940
         cBack           =   -2147483633
      End
      Begin VB.Label Label6 
         Caption         =   "维修零件:"
         Height          =   195
         Left            =   4380
         TabIndex        =   32
         Top             =   4875
         Width           =   975
      End
      Begin VB.Label Label12 
         Caption         =   "数量:"
         Height          =   225
         Left            =   4440
         TabIndex        =   31
         Top             =   5400
         Width           =   690
      End
      Begin VB.Label Label11 
         Caption         =   "处理方式:"
         Height          =   270
         Left            =   4710
         TabIndex        =   22
         Top             =   1605
         Width           =   930
      End
      Begin VB.Label Label10 
         Caption         =   "损坏原因:"
         Height          =   285
         Left            =   150
         TabIndex        =   21
         Top             =   1620
         Width           =   885
      End
      Begin VB.Label Label9 
         Caption         =   "维修结果:"
         Height          =   240
         Left            =   5580
         TabIndex        =   19
         Top             =   1170
         Width           =   1005
      End
      Begin VB.Label Label8 
         Caption         =   "修好时间:"
         Height          =   225
         Left            =   3015
         TabIndex        =   18
         Top             =   1185
         Width           =   945
      End
      Begin VB.Label Label7 
         Caption         =   "维修时间:"
         Height          =   270
         Left            =   165
         TabIndex        =   17
         Top             =   1200
         Width           =   960
      End
      Begin VB.Label Label5 
         Caption         =   "使用单位:"
         Height          =   270
         Left            =   3000
         TabIndex        =   9
         Top             =   735
         Width           =   870
      End
      Begin VB.Label Label4 
         Caption         =   "生产时间:"
         Height          =   195
         Left            =   180
         TabIndex        =   8
         Top             =   720
         Width           =   840
      End
      Begin VB.Label Label2 
         Caption         =   "规格:"
         Height          =   225
         Left            =   5550
         TabIndex        =   5
         Top             =   285
         Width           =   570
      End
      Begin VB.Label Label1 
         BackStyle       =   0  'Transparent
         Caption         =   "产品编号:"
         Height          =   240
         Left            =   195
         TabIndex        =   3
         Top             =   285
         Width           =   855
      End
      Begin VB.Label Label3 
         BackStyle       =   0  'Transparent
         Caption         =   "型号:"
         Height          =   210
         Left            =   3030
         TabIndex        =   2
         Top             =   285
         Width           =   480
      End
   End
End
Attribute VB_Name = "FrmProductEnregister"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private m_ColumnSortOrder(2) As eSortOrderConstants
Private m_CurrentColumn      As Integer
Dim SeleItem As Integer
Dim OperStat As Integer   '0,修改 1,增加

Private Sub CmdAdd_Click()
    OperStat = 1
    CmdSave.Enabled = True
    cmdCancel.Enabled = True
    CmdAdd.Enabled = False
    CmdEdit.Enabled = False
    CmdDele.Enabled = False
    StatEF (False)
    Text1.SelLength = Len(Text1)
    Text1.SetFocus
End Sub

Sub StatEF(IsDiab As Boolean)
    Text1.Locked = IsDiab
    Text2.Locked = IsDiab
    Combo1.Locked = IsDiab
    Combo2.Locked = IsDiab
    Combo3.Locked = IsDiab
    Combo4.Locked = IsDiab
    Combo5.Locked = IsDiab
'    DTPicker1.Enabled = IsDiab
'    DTPicker2.Enabled = IsDiab
'    DTPicker3.Enabled = IsDiab
End Sub


Private Sub cmdCancel_Click()
    CmdSave.Enabled = False
    cmdCancel.Enabled = False
    CmdAdd.Enabled = True
    CmdEdit.Enabled = True
    CmdDele.Enabled = True
    Text1.Locked = True
    StatEF (True)
    Text1.SetFocus
    'Text2.Locked = True
End Sub

Private Sub CmdDele_Click()
   If ListView1.SelectedCount <> 0 Then
      If Len(Text1) = 0 Then
         MsgBox "请选择要删除的内容.", vbCritical, "错误"
         Exit Sub
      End If
      If MsgBox("确定删除" & Text1 & "资料(包括零件资料)吗?", vbQuestion + vbOKCancel, "提示") = vbOK Then
       '数据库操作
         ListView1.ItemRemove (SeleItem)
       With rs
           .CursorType = adOpenKeyset
           .LockType = adLockOptimistic
           .Source = "select * from Product where ProductID='" & Text1 & "'"
           .ActiveConnection = Cn
           .Open
           .Delete
           .Close
       End With
       '删除PartsList库中数据
       With rs
           .CursorType = adOpenKeyset
           .LockType = adLockOptimistic
           .Source = "DELETE * From PartsList WHERE ProductID='" & Text1 & "'"
           '.Source = "select * from PartsList where ProductID='" & Text1 & "'"
           .ActiveConnection = Cn
           .Open
           '.Delete
           '.Close
       End With
       
       
      End If
   Else
       MsgBox "请选择要删除的内容.", vbCritical, "错误"
   End If
End Sub

Private Sub CmdEdit_Click()
    If ListView1.SelectedCount <> 0 Then
       StatEF (False)
       Call CmdAdd_Click
       OperStat = 0
       Text1.Locked = True
     '  Text2.Locked = False
     '  Text2.SetFocus
    Else
       If Len(Text1) = 0 Then
          MsgBox "请选择要修改的内容.", vbCritical, "错误"
          Exit Sub
       End If
    End If
End Sub

Private Sub CmdExit_Click()
   Unload Me
End Sub

'维修部件添加
Private Sub CmdPartsAdd_Click()
    If Len(Text1) = 0 Then
       MsgBox "请选择要增加维修零件的记录.", vbCritical, "提示"
       Exit Sub
    End If
    
    If Len(Combo6.Text) = 0 Then
       MsgBox "请选择要增加维修零件名称.", vbCritical, "提示"
       Exit Sub
    End If
    
    With rs
        .CursorType = adOpenKeyset
        .LockType = adLockOptimistic
        .Source = "select * from PartsList where ProductID='" & Text1 & "' and PartsName='" & Combo6 & "'"
        .ActiveConnection = Cn
        .Open
    End With
    If rs.RecordCount <> 0 Then
       '提示,修复修改
       'If MsgBox("新增的部件已存在", vbExclamation, "提示") = vbYes Then
       rs.Fields(2) = Val(Text3)
       rs.Update
    Else
      '新增
       rs.AddNew
       rs.Fields(0) = Text1
       rs.Fields(1) = Combo6
       rs.Fields(2) = Val(Text3)
       rs.Update
       List1.AddItem PadSpaces(Combo6, 12, 1) & Space(4) & PadSpaces(Text3, 2, 2)
    End If
    rs.Close
End Sub

Private Sub CmdSave_Click()
    Dim i As Integer
    If OperStat = 1 Then '增加
       If Len(Text1) = 0 Then
          MsgBox "产品编码必须输入!", vbCritical, "错误"
          Text1.SetFocus
          Exit Sub
       End If
       
       If Len(Combo1.Text) = 0 Then
          MsgBox "产品型号必须输入!", vbCritical, "错误"
          Combo1.SetFocus
       End If
       
       If Len(Combo2.Text) = 0 Then
          MsgBox "产品规格必须输入!", vbCritical, "错误"
          Combo2.SetFocus
       End If
       
       If Len(Combo3.Text) = 0 Then
          MsgBox "使用单位必须输入!", vbCritical, "错误"
          Combo3.SetFocus
       End If
       
       If Len(Combo4.Text) = 0 Then
          MsgBox "维修结果必须输入!", vbCritical, "错误"
          Combo4.SetFocus
       End If
       
       If Len(Combo5.Text) = 0 Then
          MsgBox "处理方式必须输入!", vbCritical, "错误"
          Combo5.SetFocus
       End If
       
       If Len(Text2) = 0 Then
          If MsgBox("产品损坏原因未输,是否自动登记输入[原因不详]?", vbCritical, "错误") = vbYes Then

⌨️ 快捷键说明

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