How can I simulate Jagged data?

I'm in charge of modeling a 3-story warehouse where the boxes of documents will be stored. The equation has rows, columns, and shelves.

additionally:

some floor / row / column / shelf combinations store 2 boxes, some 3.

some rows do not have a normal number of columns.

They want my application to automatically increment the number of labels to print labels (20 at a time) indicating where the windows go when the user views them. So in window 1 print f1r1c1s1b1 is scanned box 2 will print f1r1c1s1b2 ... f3r26c26b3

I was thinking about creating an MSSql database, populating it with all possible combos and subtracting the exception data. (using vb.net2005 to create loops to fill) then based on smalldatetime, or maybe a timestamp column on the table, just take the next one that doesn't have a set of columns set.

will this work? is there a better way?

(next step blocks 20 at a time, so 2 users can scan boxes without bumping into each other on the same floor / row / column, most floor / row / column / shelf combo stores 21 boxes, 1 hit will probably be in order, also they would like the boxes to be received roughly in the same order)

MSSQL Server and VS2005 are already present in my production environment, so those are the tools I am most familiar with.

+1


a source to share


3 answers


I assume there is no trivial scheme for you to map the entire location vector to a simple integer index? For example, if there is always the first column that allows 3 fields, you can map the vector f3r26c26s1b3 to an integer.



Otherwise, the best solution is probably not to save every combination. Instead, suppose each shelf actually holds 3 boxes and sets the "spotFilled" of the third window to a dummy value (-1 or so, nothing but NULL = unfilled). You will consider this as a normal rectangular array. This only works because your array is almost regular, but hey - the real IT hub is all about exceptions from exceptions

+1


a source


Why not just have a regular table as if it were not jagged (columns: floor, row, column, shelf, box); put appropriate scores on the data that minimizes how big the db thing is, and then just store the fake boxes in fake locations.



+1


a source


Public Function SecondFloor() As List(Of List(Of bDatafield))
    Dim result As New List(Of List(Of bDatafield))
    For Aisle As Short = 1 To MaxAisle
        For Column As Short = 1 To MaxColumn
            If Not SecondFloorExceptions(Aisle, Column) Then
                For shelf As Short = 1 To MaxShelf
                    For Position As Short = 1 To MaxPositions
                        Dim Location As New List(Of bDatafield)
                        Location.Add(MakeNewField("Floor", Floor2))
                        Location.Add(MakeNewField("Aisle", Aisle.ToString))
                        Location.Add(MakeNewField("Column", Column.ToString))
                        Location.Add(MakeNewField("Shelf", shelf.ToString))
                        Location.Add(MakeNewField("Position", Position.ToString))
                        result.Add(Location)
                    Next
                Next

            End If
        Next
    Next
    Return result
End Function

Public Function MakeNewField(ByVal column As String, ByVal value As String) As bDatafield
    MakeNewField = New bDatafield(column, New Nullable(Of Integer))
    MakeNewField.SqlColumnTransformer = New TransformField(AddressOf MapSqlColumn)
    MakeNewField.Value = value
End Function

Public Function SecondFloorExceptions(ByVal Aisle As Short, ByVal column As Short) As Boolean
    If column > MinAisleLength Then
    ElseIf column > MaxColumn Then
        SecondFloorExceptions = True
    Else
        Select Case Aisle
            Case 2 ''//Items with 39
                If column > 39 Then SecondFloorExceptions = True
            Case 3 To 10, 26 To 30, 32 To 38 ''//Items with 41
                If column > 41 Then SecondFloorExceptions = True
            Case 11 ''//Items with 32
                If column > 32 Then SecondFloorExceptions = True
            Case 12, 13 ''//Items with 38
                If column > 38 Then SecondFloorExceptions = True
            Case 14 To 24 ''//Items with 36
                If column > 36 Then SecondFloorExceptions = True
            Case 25, 31 ''//Item with 35
                If column > 35 Then SecondFloorExceptions = True

        End Select
    End If
End Function

      

Then I dumped it to the database with:

Public Sub InsertLocationRow(ByVal cn As bInheritance.bCnNativeMs _
        , ByVal data As List(Of bDatafield))
    Dim leftSide As String = "insert into " + My.Settings.ProjectSchema + "." + My.Settings.tblLocations + "("
    Dim rightSide As String = " values ("
    Dim first As Boolean = True
    For index As Integer = 0 To data.Count - 1
        If data(index).isValid Then
            If Not first Then
                leftSide += ","
                rightSide += ","
            End If
            leftSide += data(index).SqlColumn()
            rightSide += BLib.AddQSafe(data(index).Value, True)
            first = False
        End If

    Next
    leftSide += ")"
    rightSide += ")"

    cn.ExeNonQuery(leftSide + rightSide)
End Sub

      

0


a source







All Articles