以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 自动编号 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=120973) |
||||
-- 作者:13775189031 -- 发布时间:2018/6/27 11:48:00 -- 自动编号 请教 Select e.DataCol.Name Case "制单日期" If e.DataRow.IsNull("制单日期") Then e.DataRow("送检单编号") = Nothing Else Dim d As Date = e.DataRow("制单日期") Dim y As Integer = d.Year Dim bh As String = Format(d,"yyyy") If e.DataRow("送检单编号").StartsWith(bh) = False Dim max As String Dim idx As Integer max = e.DataTable.Compute("Max(送检单编号)","制单日期 = #" & bh & "# And [_Identify] <> " & e.DataRow("_Identify")) If max > "" Then idx = CInt(max.Substring(8,4)) + 1 Else idx = 1 End If e.DataRow("内部合同编号") = bh & "-F-" & Format(idx,"000") e.DataRow.Save End If End If End Select 显示 .NET Framework 版本:2.0.50727.8762 Foxtable 版本:2018.3.9.1 错误所在事件:表,理化试验送检单,DataColChanged 详细错误信息: 调用的目标发生了异常。 该字符串未被识别为有效的 DateTime。 哪里有问题?
|
||||
-- 作者:有点甜 -- 发布时间:2018/6/27 11:53:00 -- Select e.DataCol.Name [此贴子已经被作者于2018/6/27 11:54:16编辑过]
|
||||
-- 作者:13775189031 -- 发布时间:2018/6/27 16:16:00 -- ![]() ![]() |
||||
-- 作者:13775189031 -- 发布时间:2018/10/16 15:21:00 -- 教程上按类别编码 “类别”列是不是不能是表达式列? 我现在按教程编码,只是类别列是表达式,没反应! Select e.DataCol.Name |
||||
-- 作者:有点甜 -- 发布时间:2018/10/16 15:34:00 -- 表达式列修改,不会触发datacolchanged事件,看看
http://www.foxtable.com/webhelp/scr/2381.htm
|
||||
-- 作者:13775189031 -- 发布时间:2018/10/17 9:00:00 -- 谢谢!改用跨表引用解决了! |
||||
-- 作者:13775189031 -- 发布时间:2018/10/17 9:12:00 -- 另外采购管理台账中“编码”自动编号代码如下,想增加另外的功能,即如果“采购计划编号”相同,则“编码”也相同,该怎么改? Select e.DataCol.Name
|
||||
-- 作者:有点甜 -- 发布时间:2018/10/17 9:21:00 -- Select e.DataCol.Name Case "采购计划管理_预算输入部门代号", "采购计划管理_采购计划编号" Dim fdr As DataRow = e.DataTable.find("采购计划管理_采购计划编号 = \'" & e.DataRow("采购计划管理_采购计划编号") & "\' and 编码 is not null", "编码") If fdr IsNot Nothing Then e.DataRow("编码") = fdr("编码") Else If e.DataRow.IsNull("采购计划管理_预算输入部门代号") Then e.DataRow("编码") = Nothing Else Dim lb As String = e.DataRow("采购计划管理_预算输入部门代号") If e.DataRow("编码").StartsWith(lb) = False \'如果单据编号前缀不符 Dim max As String Dim idx As Integer max = e.DataTable.sqlCompute("Max(编码)","采购计划管理_预算输入部门代号 = \'" & lb & "\' And [_Identify] <> " & e.DataRow("_Identify")) \'取得该类别的最大编号 If max > "" Then \'如果存在最大编号 idx = CInt(max.Substring(3,4)) + 1 \'获得最大编号的后三位顺序号,并加1 Else idx = 1 \'否则顺序号等于1 End If e.DataRow("编码") = lb & Format(idx,"0000") End If End If End If End Select |