📄 设备检修_月度检修计划编辑.frm
字号:
.Buttons("sh").Enabled = True '删行
.Buttons("bc").Enabled = True '保存
.Buttons("fq").Enabled = True '放弃
.Buttons("shsh").Enabled = False '审核
.Buttons("shqs").Enabled = False '弃审
.Buttons("PZ").Enabled = False '批准
.Buttons("first").Enabled = False '首张
.Buttons("prev").Enabled = False '上张
.Buttons("next").Enabled = False '下张
.Buttons("last").Enabled = False '末张
.Buttons("bz").Enabled = True '帮助
.Buttons("fh").Enabled = True '退出
'设置文本框录入状态
Call Sub_LrtextStatus(True)
End Select
End With
End Sub
Private Sub Sub_LrtextStatus(TextEnabled As Boolean) '设置录入文本框状态
'录入文本框状态设置
If TextEnabled Then
For jsqte = Max_Text_Index To 0 Step -1
'判断文本框是否可编辑
If Textboolean(jsqte, 5) Then
LrText(jsqte).Enabled = True
Else
LrText(jsqte).Enabled = False
End If
Next jsqte
Else
For jsqte = Max_Text_Index To 0 Step -1
LrText(jsqte).Enabled = False
Next jsqte
End If
End Sub
Private Sub Sub_CheckStatus() '设置审核弃审按钮状态(亦可设置其他动作按钮状态)
'根据当前单据状态来确定审核弃审按钮状态
If Trim(LrText(4).Text) <> "" Then
If Trim(LrText(5).Text) <> "" Then
Tlb_Action.Buttons("shsh").Enabled = False
Tlb_Action.Buttons("shqs").Enabled = False
Tlb_Action.Buttons("PZ").Enabled = False
Else
Tlb_Action.Buttons("shsh").Enabled = False
Tlb_Action.Buttons("shqs").Enabled = True
Tlb_Action.Buttons("PZ").Enabled = True
End If
Else
Tlb_Action.Buttons("shsh").Enabled = True
Tlb_Action.Buttons("shqs").Enabled = False
Tlb_Action.Buttons("PZ").Enabled = False
End If
End Sub
Private Sub Wbkcl() '文本框录入之前处理(根据实际情况)
Dim xswbrr As String
With WglrGrid
Zdlrqnr = Trim(.Text)
xswbrr = Trim(.Text)
If GridBoolean(.Col, 3) Then '列表框录入
'填充列表框程序
Call FillCombo(YdCombo, GridStr(.Col, 5), xswbrr, 0)
Else
Wbkbhlock = True
'====以下为用户自定义
Ydtext.Text = xswbrr
'====以上为用户自定义
Wbkbhlock = False
Ydtext.SelStart = Len(Ydtext.Text)
End If
End With
End Sub
Private Function sjzdyxxpd(Dqpdwgh As Long, Dqpdwgl As Long) As Boolean '录入数据字段有效性判断,同时进行字段录入事后处理
'函数参数:Dqpdwgh, Dqpdwgl 当前要判断网格单元所处行列值
Dim Str_JudgeText As String '临时有效性判断字段内容
Dim Coljsq As Long '临时列计数器
Dim RecTemp As New ADODB.Recordset '临时使用动态集
Dim Sqlstr As String '临时使用查询字符串
With WglrGrid
'非录入状态或非数据行则其有效性为合法
If Yxxpdlock Or .Row < .FixedRows Then
sjzdyxxpd = True
Exit Function
End If
'取得当前要判断字段内容
Str_JudgeText = Trim(.TextMatrix(Dqpdwgh, Dqpdwgl))
'根据不同字段进行相应的处理(依据其逻辑编号)
Select Case GridStr(Dqpdwgl, 1)
'[>>以下为自定义部分
Case "001" '存货编码
If Not Trim(Str_JudgeText) = "" Then
'1.放置字段有效性判断
Sqlstr = "SELECT DEVID,DName,Model From Dev_Main Where DevID='" & Str_JudgeText & "' Or DName='" & Str_JudgeText & "'"
Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
If RecTemp.EOF Then
Tsxx = "此设备编号不存在!"
GoTo Lrcwcl
End If
'2.放置字段事后处理程序
.TextMatrix(Dqpdwgh, Sydz("001", GridStr(), Szzls)) = Trim(RecTemp.Fields("DevID") & "") '显示存货编码
.TextMatrix(Dqpdwgh, Sydz("002", GridStr(), Szzls)) = Trim(RecTemp.Fields("DName") & "") '显示存货名称
.TextMatrix(Dqpdwgh, Sydz("003", GridStr(), Szzls)) = Trim(RecTemp.Fields("Model") & "") '显示存货规格型号
Else
'3.清空相关字段
.TextMatrix(Dqpdwgh, Sydz("002", GridStr(), Szzls)) = "" '存货名称
.TextMatrix(Dqpdwgh, Sydz("003", GridStr(), Szzls)) = "" '存货规格型号
End If
Case "006"
If .TextMatrix(Dqpdwgh, Sydz("006", GridStr(), Szzls)) <> "" Then
If IsDate(Trim(.TextMatrix(Dqpdwgh, Sydz("006", GridStr(), Szzls)))) = 0 Then
pdzwx = True
Tsxx = "非法公历日期!(格式:" + Format(Date, "yyyy-mm-dd") + ")"
GoTo Lrcwcl
End If
If Format(.TextMatrix(Dqpdwgh, Sydz("006", GridStr(), Szzls)), "yyyy-mm-dd") < "1930-01-01" Then
pdzwx = True
Tsxx = "非法公历日期!(格式:" + Format(Date, "yyyy-mm-dd") + ")"
GoTo Lrcwcl
End If
End If
Case "007"
If .TextMatrix(Dqpdwgh, Sydz("007", GridStr(), Szzls)) <> "" Then
If IsDate(Trim(.TextMatrix(Dqpdwgh, Sydz("007", GridStr(), Szzls)))) = 0 Then
pdzwx = True
Tsxx = "非法公历日期!(格式:" + Format(Date, "yyyy-mm-dd") + ")"
GoTo Lrcwcl
End If
If Format(.TextMatrix(Dqpdwgh, Sydz("007", GridStr(), Szzls)), "yyyy-mm-dd") < "1930-01-01" Then
pdzwx = True
Tsxx = "非法公历日期!(格式:" + Format(Date, "yyyy-mm-dd") + ")"
GoTo Lrcwcl
Else
If Format(.TextMatrix(Dqpdwgh, Sydz("007", GridStr(), Szzls)), "yyyy-mm-dd") < Format(.TextMatrix(Dqpdwgh, Sydz("006", GridStr(), Szzls)), "yyyy-mm-dd") Then
pdzwx = True
Tsxx = "计划完成日期不能小于计划开始日期"
GoTo Lrcwcl
End If
End If
End If
End Select
'字段录入正确后为零字段清空(Fixed)
Call Qkwlzd(Dqpdwgh, Dqpdwgl)
'字段录入正确后进行数据合计(Fixed)
For Coljsq = Qslz To .Cols - 1
Call Sjhj(Coljsq)
Next Coljsq
'字段有效性判断通过,将字段有效性判断加锁直至再次改变(Fixed)
sjzdyxxpd = True
Yxxpdlock = True
Exit Function
End With
Lrcwcl: '录入错误处理
With WglrGrid
'给出错误提示信息
Call Xtxxts(Tsxx, 0, 1)
'返回网格错误位置(ChangeLock避免再次引发RowColChange有效性判断),装入录入载体
Changelock = True
.Select Dqpdwgh, Dqpdwgl
Changelock = False
Call xswbk
'函数返回False
sjzdyxxpd = False
Exit Function
End With
End Function
Private Sub Sub_JoinCount(Lng_CountRow As Long, Lng_CountCol As Long) '当网格列值发生改变时,处理网格列之间的关联计算(可选)
'过程参数:Lng_CountRow,Lng_CountCol 网格改变内容所处行列值
With WglrGrid
Select Case GridStr(Lng_CountCol, 1) '判断网格列对应逻辑编号
'[>>以下为自定义部分
Case "004" '单重改变
'计算公式:单重*数量=总重
If Val(.TextMatrix(Lng_CountRow, Sydz("004", GridStr(), Szzls))) * Val(.TextMatrix(Lng_CountRow, Sydz("006", GridStr(), Szzls))) <> 0 Then
.TextMatrix(Lng_CountRow, Sydz("007", GridStr(), Szzls)) = Format(Val(.TextMatrix(Lng_CountRow, Sydz("004", GridStr(), Szzls))) * Val(.TextMatrix(Lng_CountRow, Sydz("006", GridStr(), Szzls))), "###0." + String(Xtslxsws, "0"))
Else
.TextMatrix(Lng_CountRow, Sydz("007", GridStr(), Szzls)) = ""
End If
Case "005" '单价改变
'计算公式:单价*数量=金额
If Val(.TextMatrix(Lng_CountRow, Sydz("005", GridStr(), Szzls))) * Val(.TextMatrix(Lng_CountRow, Sydz("006", GridStr(), Szzls))) <> 0 Then
.TextMatrix(Lng_CountRow, Sydz("008", GridStr(), Szzls)) = Format(Val(.TextMatrix(Lng_CountRow, Sydz("005", GridStr(), Szzls))) * Val(.TextMatrix(Lng_CountRow, Sydz("006", GridStr(), Szzls))), "##0." + String(Xtjexsws, "0"))
Else
.TextMatrix(Lng_CountRow, Sydz("008", GridStr(), Szzls)) = ""
End If
Case "006" '数量改变
'计算公式:单重*数量=总重
If Val(.TextMatrix(Lng_CountRow, Sydz("004", GridStr(), Szzls))) * Val(.TextMatrix(Lng_CountRow, Sydz("006", GridStr(), Szzls))) <> 0 Then
.TextMatrix(Lng_CountRow, Sydz("007", GridStr(), Szzls)) = Format(Val(.TextMatrix(Lng_CountRow, Sydz("004", GridStr(), Szzls))) * Val(.TextMatrix(Lng_CountRow, Sydz("006", GridStr(), Szzls))), "###0." + String(Xtslxsws, "0"))
Else
.TextMatrix(Lng_CountRow, Sydz("007", GridStr(), Szzls)) = ""
End If
'计算公式:单价*数量=金额
If Val(.TextMatrix(Lng_CountRow, Sydz("005", GridStr(), Szzls))) * Val(.TextMatrix(Lng_CountRow, Sydz("006", GridStr(), Szzls))) <> 0 Then
.TextMatrix(Lng_CountRow, Sydz("008", GridStr(), Szzls)) = Format(Val(.TextMatrix(Lng_CountRow, Sydz("005", GridStr(), Szzls))) * Val(.TextMatrix(Lng_CountRow, Sydz("006", GridStr(), Szzls))), "###0." + String(Xtjexsws, "0"))
Else
.TextMatrix(Lng_CountRow, Sydz("008", GridStr(), Szzls)) = ""
End If
Case "008" '金额改变
'计算公式:金额/数量=单价
If Val(.TextMatrix(Lng_CountRow, Sydz("006", GridStr(), Szzls))) <> 0 Then
If Val(.TextMatrix(Lng_CountRow, Sydz("008", GridStr(), Szzls))) / Val(.TextMatrix(Lng_CountRow, Sydz("006", GridStr(), Szzls))) <> 0 Then
.TextMatrix(Lng_CountRow, Sydz("005", GridStr(), Szzls)) = Format(Val(.TextMatrix(Lng_CountRow, Sydz("008", GridStr(), Szzls))) / Val(.TextMatrix(Lng_CountRow, Sydz("006", GridStr(), Szzls))), "###0." + String(Xtdjxsws, "0"))
End If
End If
'<<以上为自定义部分]
End Select
End With
End Sub
Private Function Sjhzyxxpd(Yxxpdh As Long) As Boolean '录入数据行有效性判断,同时进行行处理
'函数参数:Yxxpdh 要进行有效性判断的网格数据行的行值
Dim Lrywlz As Long '录入有误网格列值
Dim RecTemp As New ADODB.Recordset '临时使用动态集
With WglrGrid
'判断行为空(行中所有可编辑列数据均为空或为零)和无效数据行则清除当前行
If .TextMatrix(Yxxpdh, 0) <> "*" Then
Sjhzyxxpd = True
Exit Function
Else
If pdhwk(Yxxpdh) And Yxxpdh + 1 <= .Rows - 1 Then
'当要判断行处于网格末行时才允许删行,否则要进行有效性判断
If .TextMatrix(Yxxpdh + 1, 0) <> "*" Then
Changelock = True
.RemoveItem Yxxpdh
If .Rows < Pmbcsjhs + .FixedRows + Fzxwghs + 1 Then
.AddItem ""
.RowHeight(.Rows - 1) = Sjhgd
End If
Changelock = False
Sjhzyxxpd = True
Exit Function
End If
End If
End If
'行没有发生变化则不进行有效性判断
If Hyxxpdlock Then
Sjhzyxxpd = True
Exit Function
End If
'[>>以下为自定义部分
'1.放置行有效性判断程序
'1.1首先进行单个不能为空或不能为零判断(Fixed)
For jsqte = Qslz To .Cols - 1
'字段不能为空
If GridInt(jsqte, 5) = 1 Then
If Len(Trim(.TextMatrix(Yxxpdh, jsqte))) = 0 Then
Tsxx = GridStr(jsqte, 2)
Lrywlz = jsqte
GoTo Lrcwcl
Exit For
End If
End If
'字段不能为零
If GridInt(jsq
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -