📄 frmproblemman.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form FrmProblemMan
BorderStyle = 1 'Fixed Single
Caption = "问题管理"
ClientHeight = 6765
ClientLeft = 45
ClientTop = 330
ClientWidth = 9795
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 6765
ScaleWidth = 9795
StartUpPosition = 2 '屏幕中心
Begin MSComCtl2.DTPicker DTDate
Height = 300
Left = 1200
TabIndex = 10
Top = 180
Width = 1455
_ExtentX = 2566
_ExtentY = 529
_Version = 393216
Format = 24772609
CurrentDate = 38719
End
Begin VB.ComboBox ComboStatus
Height = 300
Left = 5880
Style = 2 'Dropdown List
TabIndex = 9
Top = 180
Width = 1215
End
Begin VB.CheckBox Check1
Caption = "全部"
Height = 255
Left = 3360
TabIndex = 7
Top = 203
Width = 855
End
Begin VB.CommandButton Cmd_Del
Cancel = -1 'True
Caption = "删 除"
Height = 400
Left = 4320
MouseIcon = "FrmProblemMan.frx":0000
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 6
Top = 6120
Width = 1300
End
Begin VB.CommandButton Cmd_Modi
Caption = "修 改"
Height = 400
Left = 2520
MouseIcon = "FrmProblemMan.frx":030A
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 1
Top = 6120
Width = 1300
End
Begin VB.CommandButton Cmd_Add
Caption = "添 加"
Height = 400
Left = 720
MouseIcon = "FrmProblemMan.frx":0614
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 0
Top = 6120
Width = 1300
End
Begin VB.CommandButton Cmd_Submit
Caption = "提 交"
Height = 400
Left = 6120
MouseIcon = "FrmProblemMan.frx":091E
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 2
Top = 6120
Width = 1300
End
Begin VB.CommandButton Cmd_Back
Caption = "返 回"
Height = 400
Left = 7920
MouseIcon = "FrmProblemMan.frx":0C28
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 3
Top = 6120
Width = 1300
End
Begin MSDataGridLib.DataGrid DataGrid1
Height = 5175
Left = 240
TabIndex = 4
Top = 720
Width = 9375
_ExtentX = 16536
_ExtentY = 9128
_Version = 393216
AllowUpdate = 0 'False
AllowArrows = 0 'False
HeadLines = 1
RowHeight = 15
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ColumnCount = 2
BeginProperty Column00
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
Begin MSAdodcLib.Adodc Adodc1
Height = 375
Left = 240
Top = 6480
Visible = 0 'False
Width = 1335
_ExtentX = 2355
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 2
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "问题状态"
Height = 180
Left = 4800
TabIndex = 8
Top = 240
Width = 720
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "创建日期"
Height = 180
Left = 240
TabIndex = 5
Top = 240
Width = 720
End
End
Attribute VB_Name = "FrmProblemMan"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Refresh_Problem()
Dim StrSearch As String
Dim StrDate As String
'设置查询条件
If Check1.Value <> 1 Then
StrDate = Format(DTDate.Value, "yyyy-mm-dd")
StrSearch = " AND p.CreateDate='" + Trim(StrDate) + "'"
End If
If ComboStatus.ListIndex > 0 Then
StrSearch = StrSearch + " AND p.Status='" + Trim(ComboStatus.Text) + "'"
End If
'设置连接字符串和SELECT语句
Adodc1.ConnectionString = Conn
Adodc1.RecordSource = "SELECT p.ProId As 问题编号, t.BaseName As 客户单位," _
+ "p.Contact As 联系人,p.Title As 问题题目,t1.BaseName As 问题级别," _
+ "t2.BaseName As 问题类型,p.Detail As 问题描述,p.Status AS 状态," _
+ "p.SolveDate As 解决日期,p.Poster As 录入人, p.Createdate As 录入日期 " _
+ " FROM SrvProblem p,BaseInfo t,BaseInfo t1,BaseInfo t2 " _
+ " WHERE p.CustId=t.Id AND p.ProLevel=t1.Id " _
+ " AND p.ProType=t2.Id " + StrSearch _
+ " ORDER BY p.ProId"
Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1
'设置表格控件的列宽
DataGrid1.Columns(0).Width = 0
DataGrid1.Columns(1).Width = 1300
DataGrid1.Columns(2).Width = 1000
DataGrid1.Columns(3).Width = 1400
DataGrid1.Columns(4).Width = 1200
DataGrid1.Columns(5).Width = 1200
DataGrid1.Columns(6).Width = 1600
DataGrid1.Columns(7).Width = 800
DataGrid1.Columns(8).Width = 1200
DataGrid1.Columns(9).Width = 1000
DataGrid1.Columns(10).Width = 1200
ChangeButton
End Sub
Private Sub Check1_Click()
If Check1.Value = 1 Then
DTDate.Enabled = False
Else
DTDate.Value = Format(Now, "yyyy-mm-dd")
DTDate.Enabled = True
End If
Refresh_Problem
End Sub
Private Sub Cmd_Add_Click()
'设置添加记录标记
FrmProblemEdit.Modify = False
'初始化FrmProblemEdit窗体中的控件
FrmProblemEdit.txtStatus = "新建"
FrmProblemEdit.lblFillDate = Format(Now, "yyyy-mm-dd")
FrmProblemEdit.lblFillin = CurUser.UserName
'启动窗体
FrmProblemEdit.Show 1
'刷新显示
Refresh_Problem
End Sub
Private Sub Cmd_Back_Click()
Unload Me
End Sub
Private Sub Cmd_Del_Click()
'没有提交问题前可以删除问题记录
If Adodc1.Recordset.BOF = True Then
MsgBox "请选择记录"
Exit Sub
End If
If MsgBox("是否删除记录?", vbYesNo, "请确认") = vbNo Then
Exit Sub
End If
MyPro.Delete (Adodc1.Recordset.Fields(0))
Refresh_Problem
End Sub
Private Sub Cmd_Modi_Click()
'判断是否选择了要修改的记录
If Adodc1.Recordset.BOF = True Then
MsgBox "请选择记录"
Exit Sub
End If
'保存光标位置
p = Adodc1.Recordset.AbsolutePosition
'读取当前记录的各列数据
'设置修改标记
FrmProblemEdit.Modify = True
'问题编号
FrmProblemEdit.OriProId = Adodc1.Recordset.Fields(0)
'客户名称
FrmProblemEdit.dco_Customer.Text = Trim(Adodc1.Recordset.Fields(1))
'联系人
FrmProblemEdit.txtContact = Trim(Adodc1.Recordset.Fields(2))
'问题题目
FrmProblemEdit.txtTitle = Trim(Adodc1.Recordset.Fields(3))
'问题级别
FrmProblemEdit.dco_Level.Text = Trim(Adodc1.Recordset.Fields(4))
'问题类型
FrmProblemEdit.dco_Type.Text = Trim(Adodc1.Recordset.Fields(5))
'问题描述
FrmProblemEdit.txtDetail = Trim(Adodc1.Recordset.Fields(6))
'状态
FrmProblemEdit.txtStatus = Trim(Adodc1.Recordset.Fields(7))
'解决日期
FrmProblemEdit.txtSDate = Trim(Adodc1.Recordset.Fields(8))
'录入人
FrmProblemEdit.lblFillin = Trim(Adodc1.Recordset.Fields(9))
'录入日期
FrmProblemEdit.lblFillDate = Trim(Adodc1.Recordset.Fields(10))
'启动窗体
FrmProblemEdit.Show 1
'刷新显示
Refresh_Problem
'恢复光标位置
Adodc1.Recordset.Move 0
Adodc1.Recordset.Move p - 1
End Sub
Private Sub Cmd_Submit_Click()
'判断是否选择了要提交的记录
If Adodc1.Recordset.BOF = True Then
MsgBox "请选择记录"
Exit Sub
End If
If MsgBox("是否提交当前问题记录?提交后则不能更改记录", vbYesNo, "请确认") = vbNo Then
Exit Sub
End If
'设置提交窗体的问题编号
FrmProSubmit.OriProId = Adodc1.Recordset.Fields(0)
'启动窗体
FrmProSubmit.Show 1
'刷新显示
Refresh_Problem
End Sub
Private Sub ComboStatus_Click()
Refresh_Problem
End Sub
Private Sub ChangeButton()
If Adodc1.Recordset.BOF = True Then
Exit Sub
End If
'根据问题的状态控制功能按钮是否有效
If Trim(Adodc1.Recordset.Fields(7)) = "新建" Then
Cmd_Modi.Enabled = True
Cmd_Del.Enabled = True
Cmd_Submit.Enabled = True
Else
Cmd_Modi.Enabled = False
Cmd_Del.Enabled = False
Cmd_Submit.Enabled = False
End If
End Sub
Private Sub DataGrid1_RowColChange(LastRow As Variant, ByVal LastCol As Integer)
ChangeButton
End Sub
Private Sub DTDate_Change()
Refresh_Problem
End Sub
Private Sub Form_Load()
ComboStatus.AddItem "全部", 0
ComboStatus.AddItem "新建", 1
ComboStatus.AddItem "提交", 2
ComboStatus.AddItem "分配", 3
ComboStatus.AddItem "解决", 4
ComboStatus.ListIndex = 0
'把创建日期组合框ComboDate赋值为当前日期
DTDate.Value = Now
Check1.Value = 1
DTDate.Enabled = False
'显示当前日期创建的所有未处理问题
Refresh_Problem
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -