📄 设备_密封点登记录入.frm
字号:
For jsqte = Max_Text_Index To 0 Step -1
LrText(jsqte).Tag = ""
LrText(jsqte).Text = ""
Next jsqte
'设置操作状态为浏览
Lab_OperStatus = "1"
Call Sub_OperStatus("10")
End If
Rec_Query.Requery
Rec_Query.Find "AirproofFileID=" & Val(Lab_BillId.Caption)
Exit Sub
Swcwcl: '单据删除时出现错误
Cw_DataEnvi.DataConnect.RollbackTrans
Tsxx = "单据删除过程中出现未知错误,程序自动恢复保存前状态!"
Call Xtxxts(Tsxx, 0, 1)
Exit Sub
End Sub
Private Sub Sub_AbandonBill() '放弃对当前单据的操作
Dim jsqte As Long '临时使用计数器
'如果单据有效则重新显示当前单据,置单据为空状态
If Not Rec_Query.EOF Then
Lab_BillId.Caption = Rec_Query.Fields("AirproofFileID")
Call Sub_ShowBill
Else
'单据ID置为0
Lab_BillId.Caption = 0
'清除录入文本框
For jsqte = Max_Text_Index To 0 Step -1
LrText(jsqte).Tag = ""
LrText(jsqte).Text = ""
Next jsqte
End If
'设置操作状态为浏览
Lab_OperStatus = "1"
Call Sub_OperStatus("10")
End Sub
Private Function Sub_SaveBill() As Boolean '保 存 单 据
Dim RecTemp As New ADODB.Recordset '临时使用动态集
Dim Rec_Bill As New ADODB.Recordset '单据表动态集
Dim jsqte As Integer '临时计数器
Sub_SaveBill = False
'一.============先对单据内容进行有效性判断==============='
'先进行字段不能为空或不能为零有效性判断(Fixed)
For jsqte = 0 To Max_Text_Index
If Textint(jsqte, 8) = 1 Then '字段不能为空
If Len(Trim(LrText(jsqte).Text)) = 0 Then
Tsxx = Textstr(jsqte, 7) & "不能为空!"
Call Xtxxts(Tsxx, 0, 1)
LrText(jsqte).SetFocus
Exit Function
End If
Else
If Textint(jsqte, 8) = 2 Then '字段不能为零
If Val(Trim(LrText(jsqte).Text)) = 0 Then
Tsxx = Textstr(jsqte, 7) & "不能为零!"
Call Xtxxts(Tsxx, 0, 1)
LrText(jsqte).SetFocus
Exit Function
End If
End If
End If
Next jsqte
'对需要进行事后判断的文本框录入内容进行有效性判断 (Fixed)
For jsqte = 0 To Max_Text_Index
If Textint(jsqte, 9) = 0 Or Textint(jsqte, 9) = 2 Then
If Not TextYxxpd(jsqte) Then
Exit Function
End If
End If
Next jsqte
'[>>
'可在此区域写入其他对单据表头内容的有效性判断,具体格式参照如下
'<<]
'二.=============如果以上有效性检查均顺利通过,则执行存盘动作============'
'对存盘进行事务处理(Fixed)
On Error GoTo Swcwcl
Cw_DataEnvi.DataConnect.BeginTrans
'判断单据状态以进行不同处理
'1.先对单据主表进行处理
If Trim(Lab_OperStatus) = "2" Then
'新增单据
'1.对于某些单据号自动生成的单据则可在此处自动生成
LrText(0).Text = CreatBillCode(BillCode, True)
'2.开始存盘
'打开单据表动态集
If Rec_Bill.State = 1 Then Rec_Bill.Close
Rec_Bill.Open "Select * From Dev_AirproofFile Where 1=2", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
With Rec_Bill
.AddNew
.Fields("AirproofFileId") = CreatBillID(BillCode) '单据ID
.Fields("AirproofCode") = Trim(LrText(0).Text) '密封单号
.Fields("Devid") = Trim(LrText(1).Text) '设备编号
If Trim(LrText(2).Text) <> "" Then
.Fields("WActAirproof") = Trim(LrText(2).Text) '风动密封点
End If
If Trim(LrText(3).Text) <> "" Then
.Fields("GActAirproof") = Trim(LrText(3).Text) '气动密封点
End If
If Trim(LrText(4).Text) <> "" Then
.Fields("OActAirproof") = Trim(LrText(4).Text) '油动密封点
End If
If Trim(LrText(5).Text) <> "" Then
.Fields("WaActAirproof") = Trim(LrText(5).Text) '水密封点
End If
If Trim(LrText(6).Text) <> "" Then
.Fields("MActAirproof") = Trim(LrText(6).Text) '物料动密封点
End If
If Trim(LrText(7).Text) <> "" Then
.Fields("WWhishtAirproof") = Trim(LrText(7).Text) '风静密封点
End If
If Trim(LrText(8).Text) <> "" Then
.Fields("GWhishtAirproof") = Trim(LrText(8).Text) '气静密封点
End If
If Trim(LrText(9).Text) <> "" Then
.Fields("OWhishtAirproof") = Trim(LrText(9).Text) '油静密封点
End If
If Trim(LrText(10).Text) <> "" Then
.Fields("WaWhishtAirproof") = Trim(LrText(10).Text) '水静密封点
End If
If Trim(LrText(11).Text) <> "" Then
.Fields("MWhishtAirproof") = Trim(LrText(11).Text) '物料静密封点
End If
.Fields("Memo") = Trim(LrText(12).Text) '备注
''' .Fields("Bill") = Xtczy '制单人
''' .Fields("Checker") = "" '审核人置空
.Update
'系统读出单据ID写入Lab_BillID
Lab_BillId.Caption = .Fields("AirproofFileId")
End With
Else
'修改单据
'打开单据表动态集
If Rec_Bill.State = 1 Then Rec_Bill.Close
Rec_Bill.Open "Select * From Dev_AirproofFile Where AirproofFileId=" & Val(Lab_BillId.Caption), Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
With Rec_Bill
.Fields("AirproofCode") = Trim(LrText(0).Text) '密封单号
.Fields("Devid") = Trim(LrText(1).Text) '设备编号
If Trim(LrText(2).Text) <> "" Then
.Fields("WActAirproof") = Trim(LrText(2).Text) '风动密封点
End If
If Trim(LrText(3).Text) <> "" Then
.Fields("GActAirproof") = Trim(LrText(3).Text) '气动密封点
End If
If Trim(LrText(4).Text) <> "" Then
.Fields("OActAirproof") = Trim(LrText(4).Text) '油动密封点
End If
If Trim(LrText(5).Text) <> "" Then
.Fields("WaActAirproof") = Trim(LrText(5).Text) '水密封点
End If
If Trim(LrText(6).Text) <> "" Then
.Fields("MActAirproof") = Trim(LrText(6).Text) '物料动密封点
End If
If Trim(LrText(7).Text) <> "" Then
.Fields("WWhishtAirproof") = Trim(LrText(7).Text) '风静密封点
End If
If Trim(LrText(8).Text) <> "" Then
.Fields("GWhishtAirproof") = Trim(LrText(8).Text) '气静密封点
End If
If Trim(LrText(9).Text) <> "" Then
.Fields("OWhishtAirproof") = Trim(LrText(9).Text) '油静密封点
End If
If Trim(LrText(10).Text) <> "" Then
.Fields("WaWhishtAirproof") = Trim(LrText(10).Text) '水静密封点
End If
If Trim(LrText(11).Text) <> "" Then
.Fields("MWhishtAirproof") = Trim(LrText(11).Text) '物料静密封点
End If
.Fields("Memo") = Trim(LrText(12).Text) '备注
.Update
End With
End If
Cw_DataEnvi.DataConnect.CommitTrans
Sub_SaveBill = True
Tsxx = "单据存盘完毕! 单据号:" & Trim(LrText(0).Text)
Call Xtxxts(Tsxx, 0, 4)
'标识单据发生改动
Bln_BillChange = True
'设置单据改变后的状态
Lab_OperStatus = "1"
Call Sub_OperStatus("10")
Rec_Query.Requery
Rec_Query.Find "AirproofFileId=" & Val(Lab_BillId.Caption)
Exit Function
Swcwcl: '数据存盘时出现错误
Cw_DataEnvi.DataConnect.RollbackTrans
Tsxx = "存盘过程中出现未知错误,程序自动恢复保存前状态!"
Call Xtxxts(Tsxx, 0, 1)
End Function
'选择首张,上张,下张,末张(此4个过程只需用您的单据ID字段名替换"CloseBillID"即可)
Private Sub Sub_First() '首 张
With Rec_Query
If .RecordCount = 0 Then
Exit Sub
End If
.MoveFirst
Lab_BillId.Caption = .Fields("AirproofFileID")
Call Sub_ShowBill
End With
End Sub
Private Sub Sub_Prev() '上 张
With Rec_Query
If .RecordCount = 0 Then
Exit Sub
End If
If Not .BOF Then
.MovePrevious
End If
If Not .BOF Then
Lab_BillId.Caption = .Fields("AirproofFileID")
Else
.MoveNext
End If
Call Sub_ShowBill
End With
End Sub
Private Sub Sub_Next() '下 张
With Rec_Query
If .RecordCount = 0 Then
Exit Sub
End If
If Not .EOF Then
.MoveNext
End If
If Not .EOF Then
Lab_BillId.Caption = .Fields("AirproofFileID")
Else
.MovePrevious
End If
Call Sub_ShowBill
End With
End Sub
Private Sub Sub_Last() '末 张
With Rec_Query
If .RecordCount = 0 Then
Exit Sub
End If
.MoveLast
Lab_BillId.Caption = .Fields("AirproofFileID")
Call Sub_ShowBill
End With
End Sub
'[>>===================以下为根据实际业务需要自定义过程区域=============================<<]
'审核,弃审
Private Sub Sub_CheckBill() '审 核
'[>>
'此处可以写入禁止单据审核的理由
'<<]
'将单据写入审核标识
Cw_DataEnvi.DataConnect.Execute ("Update XS_CloseBill Set Checker='" & Xtczy & "' Where AirproofFileID=" & Val(Lab_BillId.Caption))
'写入系统操作员
LrText(8).Text = Xtczy
'设置审核弃审按钮状态
Call Sub_CheckStatus
'标识单据发生变化
Bln_BillChange = True
End Sub
Private Sub Sub_AbandonCheck() '弃 审
'[>>
'此处可以写入禁止单据弃审的理由
'<<]
'将单据清除审核标识
Cw_DataEnvi.DataConnect.Execute ("Update XS_CloseBill Set Checker='' Where AirproofFileID=" & Val(Lab_BillId.Caption))
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -