以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  请教编号问题  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=26340)

--  作者:秦胜雄
--  发布时间:2012/11/30 17:35:00
--  请教编号问题

编号到460以后就不能自动编号了,不知是什么位置出了问题,请指导,谢谢!!!

If e.DataCol.Name = "接单时间" Then
    If e.DataRow.IsNull("接单时间") Then
        e.DataRow("订单号") = Nothing
    Else
        Dim d As Date = e.DataRow("接单时间")
        Dim y As Integer = d.Year
        Dim m As Integer = d.Month
        Dim Days As Integer = Date.DaysInMonth(y,m)
        Dim fd As Date = New Date(y,m,1)
        Dim ld As Date = New Date(y,m,Days)
        Dim bh As String = Format(d,"yyyyMM")
        If e.DataRow("订单号").StartsWith(bh) = False
            Dim max As String
            Dim idx As Integer
            max = e.DataTable.Compute("Max(订单号)","接单时间 >= #" & fd & "# And 接单时间 <= #" & ld & "#")
            If max > "" Then
                idx = CInt(max.Substring(7,4)) + 1
            Else
                idx = 1
            End If
            e.DataRow("订单号") = bh & "-" & Format(idx,"0000")
        End If
    End If
End If

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 m As Integer = d.Month
            Dim Days As Integer = Date.DaysInMonth(y,m)
            Dim fd As Date = New Date(y,m,1)
            Dim ld As Date = New Date(y,m,Days)
            Dim bh As String = e.DataRow("部门") & "-" & Format(d,"yyyyMM") & "-"
            If e.DataRow("管制号").StartsWith(bh) = False
                Dim max As String
                Dim idx As Integer
                Dim flt As String
                flt = "部门 = \'"& e.DataRow("部门") & "\' And 接单时间 >= #" & fd & "# And 接单时间 <= #" & ld & "#"
                max = e.DataTable.Compute("Max(管制号)",flt)
                If max > "" Then
                    idx = CInt(max.Substring(9,4)) + 1
                Else
                    idx = 1
                End If
                e.DataRow("管制号") = bh & Format(idx,"0000")
            End If
        End If
End Select

If e.DataCol.Name = "交货日期" Then
    If e.DataRow.IsNull("交货日期") Then
        e.DataRow("延期") = Nothing
    Else
        e.DataRow("延期") = (Date.Today.Subtract(e.DataRow("交货日期")).Days)
    End If
End If

Select Case e.DataCol.Name
    Case "管制号"
        If e.DataRow.IsNull("管制号") = False Then
            If e.DataRow.GetChildRows("订单明细").Count = 0 Then
                Dim dr As DataRow = DataTables("订单明细").AddNew(1)
                dr("管制号") = e.DataRow("管制号")
                dr("交货日期") = e.DataRow("交货日期")
                dr("客户") = e.DataRow("客户")
            End If
        End If
End Select

Select Case e.DataCol.Name
    Case "客户"
        If e.DataRow.IsNull("客户") = False Then
            If e.DataRow.GetChildRows("客户").Count = 0 Then
                Dim dr As DataRow = DataTables("客户").AddNew()
                dr("客户") = e.DataRow("客户")
            End If
        End If
End Select


图片点击可在新窗口打开查看此主题相关图片如下:截图1354268053.png
图片点击可在新窗口打开查看

--  作者:lin_hailun
--  发布时间:2012/11/30 17:45: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 m As Integer = d.Month
            Dim Days As Integer = Date.DaysInMonth(y,m)
            Dim fd As Date = New Date(y,m,1)
            Dim ld As Date = New Date(y,m,Days)
            Dim bh As String = e.DataRow("部门") & "-" & Format(d,"yyyyMM") & "-"
            If e.DataRow("管制号").StartsWith(bh) = False
                Dim max As String
                Dim idx As Integer
                Dim flt As String
                flt = "部门 = \'"& e.DataRow("部门") & "\' And 接单时间 >= #" & fd & "# And 接单时间 <= #" & ld & "#"
                max = e.DataTable.Compute("Max(管制号)",flt)
                If max > "" Then
                    idx = CInt(max.Substring(9,4)) + 1
                Else
                    idx = 1
                End If
                e.DataRow("管制号") = bh & Format(idx,"0000")
            End If
        End If
End Select

If e.DataCol.Name = "交货日期" Then
    If e.DataRow.IsNull("交货日期") Then
        e.DataRow("延期") = Nothing
    Else
        e.DataRow("延期") = (Date.Today.Subtract(e.DataRow("交货日期")).Days)
    End If
End If

Select Case e.DataCol.Name
    Case "管制号"
        If e.DataRow.IsNull("管制号") = False Then
            If e.DataRow.GetChildRows("订单明细").Count = 0 Then
                Dim dr As DataRow = DataTables("订单明细").AddNew(1)
                dr("管制号") = e.DataRow("管制号")
                dr("交货日期") = e.DataRow("交货日期")
                dr("客户") = e.DataRow("客户")
            End If
        End If
End Select

Select Case e.DataCol.Name
    Case "客户"
        If e.DataRow.IsNull("客户") = False Then
            If e.DataRow.GetChildRows("客户").Count = 0 Then
                Dim dr As DataRow = DataTables("客户").AddNew()
                dr("客户") = e.DataRow("客户")
            End If
        End If
End Select



--  作者:秦胜雄
--  发布时间:2012/11/30 18:19:00
--  

谢谢!!!,下载试过,460号以后不能自动编号,今天是月底30号,不知有关系没有,本来明天准备到公司局域网试用的,看能否帮忙再看有办法没有,谢谢!!!


--  作者:lin_hailun
--  发布时间:2012/12/1 8:58:00
--  
 不清楚具体问题,没有项目,只有代码,不便测试。或者联系客服QQ协助解决吧。
--  作者:狐狸爸爸
--  发布时间:2012/12/1 11:20:00
--  
楼主你最好直接做个例子上来,凭空怎么分析啊?
--  作者:秦胜雄
--  发布时间:2012/12/1 14:41:00
--  

现在又可以正常使用了,开机时有个激活框提示,不知还能试用多长时间,以便公司决定是否购买。


--  作者:lin_hailun
--  发布时间:2012/12/1 14:45:00
--  
以下是引用秦胜雄在2012-12-1 14:41:00的发言:

现在又可以正常使用了,开机时有个激活框提示,不知还能试用多长时间,以便公司决定是否购买。


估计,快了……可能还能使用几天到十来天。