Foxtable(狐表)用户栏目专家坐堂 → 代码垄余,相同的代码。怎么封装


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

主题:代码垄余,相同的代码。怎么封装

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


加好友 发短信
等级:童狐 帖子:204 积分:1738 威望:0 精华:0 注册:2018/8/23 14:16:00
代码垄余,相同的代码。怎么封装  发帖心情 Post By:2020/9/12 14:10:00 [只看该作者]

If zdc.Checked Then
                                zd=DataTables("转仓单明细").Find("款号='" & drs("款号") & "' And 花色='" & drs("花色") & "' and 尺码 = '" & drs("尺码") & "' and 仓库='" & ck & "'and 调入仓库='总部仓库'","日期")
                                If zd Is Nothing Then
                                    If drts.Text.Length>0 Then
                                        dr=DataTables("转仓单明细").Find("款号='" & drs("款号") & "' And 花色='" & drs("花色") & "' and 尺码 = '" & drs("尺码") & "' and 仓库='" & ck & "'","日期")
                                        dc=DataTables("转仓单明细").Find("款号='" & drs("款号") & "' And 花色='" & drs("花色") & "' and 尺码 = '" & drs("尺码") & "' and 调出仓库='" & ck & "'","日期")
                                        If dc IsNot Nothing And dr IsNot Nothing Then
                                            Dim t1 As TimeSpan =  dc("日期") - dr("日期")
                                            If t1.TotalDays<drts.Text
                                                If cnt > 0 Then
                                                    drs(ck) = 1
                                                    cnt = cnt - 1
                                                Else
                                                    drs(ck) = Nothing
                                                End If
                                            End If
                                        End If
                                    Else
                                        If cnt > 0 Then
                                            drs(ck) = 1
                                            cnt = cnt - 1
                                        Else
                                            drs(ck) = Nothing
                                        End If
                                    End If
                                End If
                            End If
                        Else
                            If drts.Text.Length>0 Then
                                dr=DataTables("转仓单明细").Find("款号='" & drs("款号") & "' And 花色='" & drs("花色") & "' and 尺码 = '" & drs("尺码") & "' and 仓库='" & ck & "'","日期")
                                dc=DataTables("转仓单明细").Find("款号='" & drs("款号") & "' And 花色='" & drs("花色") & "' and 尺码 = '" & drs("尺码") & "' and 调出仓库='" & ck & "'","日期")
                                If dc IsNot Nothing And dr IsNot Nothing Then
                                    Dim t1 As TimeSpan =  dc("日期") - dr("日期")
                                    If t1.TotalDays<drts.Text
                                        If cnt > 0 Then
                                            drs(ck) = 1
                                            cnt = cnt - 1
                                        Else
                                            drs(ck) = Nothing
                                        End If
                                    End If
                                End If
                            Else
                                If cnt > 0 Then
                                    drs(ck) = 1
                                    cnt = cnt - 1
                                Else
                                    drs(ck) = Nothing
                                End If
                            End If
                        End If


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


加好友 发短信
等级:超级版主 帖子:106680 积分:542589 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2020/9/12 14:34:00 [只看该作者]

dim cando as boolean = true
If zdc.Checked Then
      zd=DataTables("转仓单明细").Find("款号='" & drs("款号") & "' And 花色='" & drs("花色") & "' and 尺码 = '" & drs("尺码") & "' and 仓库='" & ck & "'and 调入仓库='总部仓库'","日期")
       If zd Isnot Nothing Then cando =false
end if

if cando  then
重复的代码放这里
endif

 回到顶部