在表的DataColChanged事件里:代码为:
Select e.DataCol.Name
Case "录入日期","录入人"
If e.DataRow.IsNull("录入日期") OrElse e.DataRow.IsNull("录入人") Then
e.DataRow("派单id") = Nothing
'msgbox(18)
Else
If QQClient.Ready = False Then
PopMessage("QQClient未启动,无法生成编号!","提示",PopIconEnum.Infomation,5)
Else
Dim bh As String = e.DataRow("录入人") & "-" & Format(e.DataRow("录入日期"),"yyyyMMddHHmmss")
Dim rt As String = QQClient.SendWait(":g" & bh & "g:")
Dim id As Integer
If rt > "" Then
If Integer.TryParse(rt,id) Then
e.DataRow("派单id") = bh & "-" & Format(id,"0000")
'msgbox("新增了派工")
Else
PopMessage("服务器返回错误信息:" & rt,"提示",PopIconEnum.Infomation,5)
End If
Else
PopMessage("服务器无响应,无法生成编号!","提示",PopIconEnum.Infomation,5)
End If
End If
End If
End Select
希望:服务器无响应,或QQClient未启动,无法生成编号,就不能增加行。以上代码怎么改呢?
[此贴子已经被作者于2019/3/27 18:44:09编辑过]