📄 frm转地调逐项操作票.frm
字号:
Text5.Text = ""
End If
If RS.State Then
RS.Close
End If
Call Close_link
End Sub
Private Sub command1_Click()
On Error Resume Next
Call Open_link
If Trim(Text3.Text) = "" Or Trim(Combo1.Text) = "" Or Trim(Text7.Text) = "" Then
A = MsgBox("请填写操作任务和拟票依据!", vbOKOnly)
Exit Sub
Else
If RS.State Then
RS.Close
End If
sql2 = "select max(id) from xdgl_zzxczpzb "
Set RS = ZHCX.Execute(sql2, 0)
If Not IsNull(RS(0)) Then
ID = RS(0) + 1
Else
DWID = 1
End If
If RS.State Then
RS.Close
End If
sql3 = "insert xdgl_zzxczpzb(id,npyj,jkbh,zxsj,zxlph,czrw,bz,scsj) values (" & ID & ",'" & Trim(Combo1.Text) & "','" & Trim(Text1.Text) & "','" & Format(DTPicker2.Value, "yyyy-mm-dd") & "','" & Trim(Text7.Text) & "','" & Trim(Text3.Text) & "','" & Trim(Text2.Text) & "','" & Trim(Text6.Text) & "')"
Debug.Print sql3
Set RS = ZHCX.Execute(sql3, 0)
If RS.State Then
RS.Close
End If
Command1.Enabled = False
End If
Call Close_link
End Sub
Private Sub Command2_Click()
On Error Resume Next
If Trim(Text7.Text) = "" Then
msg = MsgBox("请填写逐项操作票号!", vbOKOnly)
Exit Sub
End If
sql1 = "select max(dwid) from xdgl_zzxczpfb where zxlph='" & Trim(Text7.Text) & "' and czdw='" & Trim(Combo2.Text) & "'"
sql2 = "select max(id) from xdgl_zzxczpfb where zxlph='" & Trim(Text7.Text) & "' "
Call Open_link
Set RS = ZHCX.Execute(sql1, 0)
If Not IsNull(RS(0)) Then
DWID = RS(0) + 1
Else
DWID = 1
End If
If RS.State Then
RS.Close
End If
Set RS = ZHCX.Execute(sql2, 0)
If Not IsNull(RS(0)) Then
ID = RS(0) + 1
Else
ID = 1
End If
If RS.State Then
RS.Close
End If
Adodc1.Recordset.AddNew
DataGrid1.Columns(0).Value = Trim(Combo3.Text)
DataGrid1.Columns(1).Value = Trim(Combo2.Text)
DataGrid1.Columns(3).Value = Trim(Text4.Text)
DataGrid1.Columns(2).Value = DWID
DataGrid1.Columns(4).Value = Trim(Text5.Text)
DataGrid1.Columns(5).Value = Trim(Text7.Text)
DataGrid1.Columns(12).Value = ID
Adodc1.Recordset.Update
Adodc1.Refresh
DataGrid1.Refresh
Adodc1.Recordset.AddNew
'DataGrid1.Columns(0).Value = ""
'DataGrid1.Columns(1).Value = ""
'DataGrid1.Columns(2).Value = ""
'DataGrid1.Columns(3).Value = ""
DataGrid1.Columns(5).Value = Trim(Text7.Text)
DataGrid1.Columns(12).Value = ID + 1
Adodc1.Recordset.Update
Adodc1.Refresh
DataGrid1.Refresh
sql2 = "update xdgl_zzxczpzb set czrw='" & Trim(Text3.Text) & "',czdw='" & Trim(Combo2.Text) & "' where zxlph = '" & Trim(Text7.Text) & "'"
If Trim(Combo2.Text) = "" Then
Else
Set RS = ZHCX.Execute(sql2, 0)
End If
If RS.State Then
RS.Close
End If
Adodc1.RecordSource = "select * from xdgl_zzxczpfb where zxlph='" & Trim(Text7.Text) & "'order by id"
Adodc1.Refresh
DataGrid1.Refresh
If Not Adodc1.Recordset.EOF Then
Adodc1.Recordset.MoveLast
End If
Call sx
Call Close_link
Call qk
End Sub
Private Sub Command3_Click()
On Error Resume Next
If Adodc1.Recordset.EOF Then
A = MsgBox("不能删除空记录", vbDefaultButton2)
Exit Sub
End If
A = MsgBox("是否确认删除该记录", vbYesNo)
If A = 6 Then
Adodc1.Recordset.Delete
Else
Exit Sub
End If
Adodc1.Recordset.Update
Adodc1.Refresh
DataGrid1.Refresh
If Not Adodc1.Recordset.EOF Then
Adodc1.Recordset.MoveLast
End If
Call sx
Combo1.Clear
End Sub
Private Sub Command4_Click()
On Error Resume Next
Dim temp As Integer
Call Open_link
Sql = "select count(zxlph) from XDGL_ZZXCZPFB where zxlph='" & Trim(Text7.Text) & "'"
Set RS = ZHCX.Execute(Sql, 1)
If Not RS.EOF Then
temp = RS(0) Mod 8
If temp = 0 Then
Else
For i = 1 To 8 - temp
sql2 = "select max(id) from xdgl_zzxczpfb where zxlph='" & Trim(Text7.Text) & "' "
Set RS = ZHCX.Execute(sql2, 0)
If Not IsNull(RS(0)) Then
ID = RS(0) + 1
Else
ID = 1
End If
If RS.State Then
RS.Close
End If
Sql = "insert xdgl_zzxczpfb (zxlph,ID) values ('" & Trim(Text7.Text) & "'," & ID & ")"
If RS.State Then
RS.Close
End If
Set RS = ZHCX.Execute(Sql, 1)
Next i
End If
End If
If RS.State Then
RS.Close
End If
Call Close_link
Unload ActiveReport6
ActiveReport6.Show
ActiveReport6.DataControl1.Source = "select * from XDGL_ZZXCZPFB where zxlph='" & Trim(Text7.Text) & "' order by id"
ActiveReport6.DataControl1.Refresh
Call Open_link
Sql = "select * from XDGL_ZZXCZPZB where zxlph='" & Trim(Text7.Text) & "'order by id"
Set RS = ZHCX.Execute(Sql, 0)
If RS.EOF Then
ActiveReport6.Label12 = Format(DTPicker2.Value, "yyyy年mm月dd日")
ActiveReport6.Label4 = ""
ActiveReport6.Label5 = ""
ActiveReport6.Label9 = ""
ActiveReport6.Label17 = ""
ActiveReport6.Label86 = ""
ActiveReport6.Field4.Text = ""
Else
ActiveReport6.Label12 = Format(RS("zxsj"), "yyyy年mm月dd日")
ActiveReport6.Label4 = Trim(RS("npyj"))
ActiveReport6.Label5 = Trim(RS("jkbh"))
ActiveReport6.Label9 = Trim(Text7.Text)
ActiveReport6.Label17 = Trim(RS("czrw"))
ActiveReport6.Label86 = Format(RS("scsj"), "yyyy-mm-dd ")
ActiveReport6.Field4.Text = Trim(RS("bz"))
End If
If RS.State Then
RS.Close
End If
Call Close_link
ActiveReport6.PageSetup
End Sub
Private Sub Command5_Click()
On Error Resume Next
If Text7.Text = "" Then
Exit Sub
End If
sql1 = "update xdgl_zzxczpzb set czrw='" & Trim(Text3.Text) & "',npyj='" & Trim(Combo1.Text) & "',jkbh='" & Trim(Text1.Text) & "',cznr='" & Trim(Text5.Text) & "' where zxlph='" & Trim(Text7.Text) & "'"
Call Open_link
Set RS = ZHCX.Execute(sql1, 0)
Call Close_link
A = MsgBox("操作票修改成功", vbOKOnly)
End Sub
Private Sub DataGrid1_LostFocus()
If Adodc1.Recordset.EOF Then
Else
Adodc1.Recordset.Update
Call sx
End If
End Sub
Private Sub Form_Load()
On Error Resume Next
Text6.Text = Format(Now, "yyyy-mm-dd hh:mm")
DTPicker2.Value = Format(Now, "yyyy-mm-dd")
Adodc1.ConnectionString = "PROVIDER=MSDASQL;dsn=ddmis;uid=mis;pwd=mis005;database=zhcx"
Adodc1.RecordSource = "select * from xdgl_zzxczpfb where zxlph='" & Trim(Text7.Text) & "'"
Combo1.AddItem "计划检修"
Combo1.AddItem "临时检修"
Combo1.Text = ""
sql1 = "select sbmc from xdgl_sblx where sblx='厂站'"
Call Open_link
Combo2.Clear
Set RS = ZHCX.Execute(sql1, 0)
Do While Not RS.EOF
If Not IsNull(RS(0)) Then
Combo2.AddItem Trim(RS(0))
End If
RS.MoveNext
Loop
If RS.State Then
RS.Close
End If
sql2 = "select sbmc from xdgl_sb_sbcsb where sbdl='" & Trim(Combo2.Text) & "' and sbxl='断路器'"
Combo4.Clear
Set RS = ZHCX.Execute(sql2, 0)
Do While Not RS.EOF
If Not IsNull(RS(0)) Then
Combo4.AddItem Trim(RS(0))
End If
RS.MoveNext
Loop
If RS.State Then
RS.Close
End If
Call Close_link
Combo2.Text = ""
Combo3.AddItem "一"
Combo3.AddItem "二"
Combo3.AddItem "三"
Combo3.AddItem "四"
Combo3.AddItem "五"
Combo3.AddItem "六"
Combo3.AddItem "七"
Combo3.AddItem "八"
Combo3.AddItem "九"
Combo3.AddItem "十"
Combo3.Text = ""
Combo4.Text = ""
Combo5.AddItem "运行状态"
Combo5.AddItem "热备用状态"
Combo5.AddItem "冷备用状态"
Combo5.AddItem "检修状态"
Combo5.Text = ""
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Enabled = False
Adodc1.Refresh
DataGrid1.Refresh
If Not Adodc1.Recordset.EOF Then
Adodc1.Recordset.MoveLast
End If
Call sx
End Sub
Sub sx()
DataGrid1.Columns(0).Caption = "系统顺序"
DataGrid1.Columns(0).Width = 1100
DataGrid1.Columns(1).Caption = " 单 位"
DataGrid1.Columns(1).Width = 1200
DataGrid1.Columns(2).Caption = "单位顺序"
DataGrid1.Columns(2).Width = 1100
DataGrid1.Columns(3).Caption = "预计时间"
DataGrid1.Columns(3).Width = 1200
DataGrid1.Columns(4).Caption = " 内 容"
DataGrid1.Columns(4).Width = 6000
DataGrid1.Columns(5).Visible = False
DataGrid1.Columns(6).Visible = False
DataGrid1.Columns(7).Visible = False
DataGrid1.Columns(8).Visible = False
DataGrid1.Columns(9).Visible = False
DataGrid1.Columns(10).Visible = False
DataGrid1.Columns(11).Visible = False
DataGrid1.Columns(12).Visible = False
DataGrid1.Refresh
End Sub
Sub qk()
Combo2.Text = ""
Combo3.Text = ""
Combo4.Text = ""
Combo5.Text = ""
Text4.Text = ""
Text5.Text = ""
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -