Foxtable(狐表)用户栏目专家坐堂 → [求助].NET Framework 版本:2.0.50727.5472


  共有2635人关注过本帖树形打印复制链接

主题:[求助].NET Framework 版本:2.0.50727.5472

帅哥哟,离线,有人找我吗?
大红袍
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/7/16 21:49:00 [显示全部帖子]

If e.DataCol.Name = "发货日期" Then
    If e.DataRow.IsNull("发货日期") Then
        e.DataRow("单号") = Nothing
    Else
        Dim bh As String = "xs" & Format(e.DataRow("发货日期"),"yyyyMMdd") '取得编号的8位前缀
        If e.DataRow("单号").StartsWith(bh) = False '如果编号的前8位不符
            Dim max As String
            Dim idx As Integer
            max = e.DataTable.Compute("Max(单号)","发货日期 = #" & e.DataRow("发货日期") & "# And [_Identify] <> " & e.DataRow("_Identify")) '取得该天的最大编号
            If max > "" Then '如果存在最大编号
                idx = CInt(max.Substring(bh.Length)) + 1 '获得最大编号的后三位顺序号,并加1
            Else
                idx = 1 '否则顺序号等于1
            End If
            e.DataRow("单号") = bh  & Format(idx,"000")
        End If
    End If
End If

 回到顶部