Foxtable(狐表)用户栏目专家坐堂 → 求助,如何实现物品调取,从原来库点调取后,原来库存减少,同时在新库点增加对应数量!


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

主题:求助,如何实现物品调取,从原来库点调取后,原来库存减少,同时在新库点增加对应数量!

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/9/18 20:45:00 [显示全部帖子]

用代码,做一个出库和一个入库操作。


 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/9/18 21:29:00 [显示全部帖子]

dr = DataTables("设备库存").Find("[出库地点] = '" & e.DataRow("原库地点") & "' and [设备名称] = '" & e.DataRow("设备名称") & "'")

 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/9/18 22:25:00 [显示全部帖子]

Select Case e.DataCol.Name
    Case "设备名称","入库数量","出库数量","入库地点"
        If e.DataCol.Name = "设备名称" Then
            If e.NewValue Is Nothing Then
                e.DataRow("设备品牌") = Nothing
                e.DataRow("设备版本") = Nothing
                e.DataRow("设备型号") = Nothing
                e.DataRow("设备颜色") = Nothing
                e.DataRow("设备内存") = Nothing
            Else
                Dim dr1 As DataRow
                dr1 = DataTables("设备信息").Find("[设备名称] = '" & e.NewValue & "'")
                If dr1 IsNot Nothing
                    e.DataRow("设备品牌") = dr1("设备品牌")
                    e.DataRow("设备版本") = dr1("设备版本")
                    e.DataRow("设备型号") = dr1("设备型号")
                    e.DataRow("设备颜色") = dr1("设备颜色")
                    e.DataRow("设备内存") = dr1("设备内存")
                   
                End If
            End If
        End If
       

        Dim dr As DataRow
        Dim mr As DataRow = e.DataRow
        Dim drs As List(of DataRow)
        dr = e.DataTable.Find("[_SortKey] < " & mr("_SortKey") & " And [设备名称] = '" & mr("设备名称") & "' and 入库地点 = '" & e.DataRow("入库地点") & "'", "[_SortKey] Desc")
        If dr Is Nothing Then
            mr("当前库存") = mr("入库数量") - mr("出库数量")
            dr = mr
        End If
        drs = e.DataTable.Select("[_SortKey] >= " & dr("_SortKey") & " And [设备名称] = '" & dr("设备名称") & "' and 入库地点 = '" & e.DataRow("入库地点") & "'", "[_SortKey]")
        For i As Integer = 1 To drs.Count - 1
            drs(i)("当前库存") = drs(i-1)("当前库存") + drs(i)("入库数量") - drs(i)("出库数量")
        Next
        If e.DataCol.Name = "设备名称" AndAlso e.OldValue IsNot Nothing AndAlso e.OldValue <> e.NewValue Then
            dr = e.DataTable.Find("[_SortKey] < " & mr("_SortKey") & " And [设备名称] = '" & e.OldValue & "' and 入库地点 = '" & e.DataRow("入库地点") & "'", "[_SortKey] Desc")
            If dr Is Nothing Then
                dr = e.DataTable.Find("[设备名称] = '" & e.OldValue & "'", "[_SortKey]")
                If dr IsNot Nothing Then
                    dr("当前库存") = dr("入库数量") - dr("出库数量")
                End If
            End If
            If dr IsNot Nothing Then
                drs = e.DataTable.Select("[_SortKey] >= " & dr("_SortKey") & " And [设备名称] = '" & dr("设备名称") & "' and 入库地点 = '" & e.DataRow("入库地点") & "'", "[_SortKey]")
                For i As Integer = 1 To drs.Count - 1
                    drs(i)("当前库存") = drs(i-1)("当前库存") + drs(i)("入库数量") - drs(i)("出库数量")
                Next
            End If
        End If
        If e.DataCol.Name = "入库地点" AndAlso e.OldValue IsNot Nothing AndAlso e.OldValue <> e.NewValue Then
            dr = e.DataTable.Find("[_SortKey] < " & mr("_SortKey") & " And [设备名称] = '" & e.DataRow("设备名称") & "' and 入库地点 = '" & e.OldValue & "'", "[_SortKey] Desc")
            If dr Is Nothing Then
                dr = e.DataTable.Find("[入库地点] = '" & e.OldValue & "'", "[_SortKey]")
                If dr IsNot Nothing Then
                    dr("当前库存") = dr("入库数量") - dr("出库数量")
                End If
            End If
            If dr IsNot Nothing Then
                drs = e.DataTable.Select("[_SortKey] >= " & dr("_SortKey") & " And [设备名称] = '" & dr("设备名称") & "' and 入库地点 = '" & e.DataRow("入库地点") & "'", "[_SortKey]")
                For i As Integer = 1 To drs.Count - 1
                    drs(i)("当前库存") = drs(i-1)("当前库存") + drs(i)("入库数量") - drs(i)("出库数量")
                Next
            End If
        End If
End Select


 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/9/19 9:48:00 [显示全部帖子]

 汗。。。

 

Select Case e.DataCol.Name
    Case "设备名称","入库数量","出库数量","入库地点"
        If e.DataCol.Name = "设备名称" Then
            If e.NewValue Is Nothing Then
                e.DataRow("设备品牌") = Nothing
                e.DataRow("设备版本") = Nothing
                e.DataRow("设备型号") = Nothing
                e.DataRow("设备颜色") = Nothing
                e.DataRow("设备内存") = Nothing
            Else
                Dim dr1 As DataRow
                dr1 = DataTables("设备信息").Find("[设备名称] = '" & e.NewValue & "'")
                If dr1 IsNot Nothing
                    e.DataRow("设备品牌") = dr1("设备品牌")
                    e.DataRow("设备版本") = dr1("设备版本")
                    e.DataRow("设备型号") = dr1("设备型号")
                    e.DataRow("设备颜色") = dr1("设备颜色")
                    e.DataRow("设备内存") = dr1("设备内存")
                   
                End If
            End If
        End If
       
       
        Dim dr As DataRow
        Dim mr As DataRow = e.DataRow
        Dim drs As List(of DataRow)
        Dim didian As String = iif(e.DataRow.IsNull("入库地点"), e.DataRow("出库地点"), e.DataRow("入库地点"))
        dr = e.DataTable.Find("[_SortKey] < " & mr("_SortKey") & " And [设备名称] = '" & mr("设备名称") & "' and (入库地点 = '" & didian & "' or 出库地点 = '" & didian & "')", "[_SortKey] Desc")
        If dr Is Nothing Then
            mr("当前库存") = mr("入库数量") - mr("出库数量")
            dr = mr
        End If
        drs = e.DataTable.Select("[_SortKey] >= " & dr("_SortKey") & " And [设备名称] = '" & dr("设备名称") & "' and (入库地点 = '" & didian & "' or 出库地点 = '" & didian & "')", "[_SortKey]")
        For i As Integer = 1 To drs.Count - 1
            drs(i)("当前库存") = drs(i-1)("当前库存") + drs(i)("入库数量") - drs(i)("出库数量")
        Next
        If e.DataCol.Name = "设备名称" AndAlso e.OldValue IsNot Nothing AndAlso e.OldValue <> e.NewValue Then
            dr = e.DataTable.Find("[_SortKey] < " & mr("_SortKey") & " And [设备名称] = '" & e.OldValue & "' and (入库地点 = '" & didian & "' or 出库地点 = '" & e.OldValue & "')", "[_SortKey] Desc")
            If dr Is Nothing Then
                dr = e.DataTable.Find("[设备名称] = '" & e.OldValue & "' or 出库地点 = '" &  e.OldValue & "'", "[_SortKey]")
                If dr IsNot Nothing Then
                    dr("当前库存") = dr("入库数量") - dr("出库数量")
                End If
            End If
            If dr IsNot Nothing Then
                drs = e.DataTable.Select("[_SortKey] >= " & dr("_SortKey") & " And [设备名称] = '" & dr("设备名称") & "' and (入库地点 = '" & e.OldValue & "' or 出库地点 = '" & e.OldValue & "')", "[_SortKey]")
                For i As Integer = 1 To drs.Count - 1
                    drs(i)("当前库存") = drs(i-1)("当前库存") + drs(i)("入库数量") - drs(i)("出库数量")
                Next
            End If
        End If
        If e.DataCol.Name = "入库地点" AndAlso e.OldValue IsNot Nothing AndAlso e.OldValue <> e.NewValue Then
            dr = e.DataTable.Find("[_SortKey] < " & mr("_SortKey") & " And [设备名称] = '" & e.DataRow("设备名称") & "' and (入库地点 = '" & e.OldValue & "' or 出库地点 = '" & e.OldValue & "')", "[_SortKey] Desc")
            If dr Is Nothing Then
                dr = e.DataTable.Find("[入库地点] = '" & e.OldValue & "' or 出库地点 = '" & e.OldValue & "'", "[_SortKey]")
                If dr IsNot Nothing Then
                    dr("当前库存") = dr("入库数量") - dr("出库数量")
                End If
            End If
            If dr IsNot Nothing Then
                drs = e.DataTable.Select("[_SortKey] >= " & dr("_SortKey") & " And [设备名称] = '" & dr("设备名称") & "' and (入库地点 = '" & e.OldValue & "' or 出库地点 = '" & e.OldValue & "')", "[_SortKey]")
                For i As Integer = 1 To drs.Count - 1
                    drs(i)("当前库存") = drs(i-1)("当前库存") + drs(i)("入库数量") - drs(i)("出库数量")
                Next
            End If
        End If
End Select


 回到顶部