我负责对3层仓库进行建模,其中将存储文件箱。等式中有行,列和架子。
另外:
某些楼层/行/列/架子组合存储2个盒子,大约3个。
某些行没有正常的列数。
他们希望我的应用程序能够自动增加打印标签(一次20个),告诉用户扫描时盒子的位置。 因此,扫描框1将打印f1r1c1s1b1 框2将打印f1r1c1s1b2 ... f3r26c26b3
我正在考虑构建一个MSSql数据库,用所有可能的组合填充它并减去异常数据。 (使用vb.net2005 for循环来填充) 然后根据表上的smalldatetime或者timestamp列,只需抓住下一个没有spotFilled列设置的列。
这会有用吗?有更好的方法吗?
(下一步是一次阻挡20个,这样两个用户就可以扫描盒子而不会在同一个楼层/行/列上互相撞击,大多数楼层/行/列/架子组合存储21个盒子,1个凹凸可能会好的。他们也希望这些盒子大致按照相同的顺序收到)
MSSQL服务器和VS2005已经存在于我的工作环境中,因此这些是我最熟悉的工具。
答案 0 :(得分:1)
我假设没有简单的架构,所以你可以将整个位置向量映射到一个简单的整数索引?例如,如果它始终是允许3个框的第一列,您仍然可以将f3r26c26s1b3向量映射为整数。
否则,最好的解决方案可能不是存储每个组合。相反,假设每个货架实际上存储了3个盒子,并将第三个盒子的“spotFilled”设置为虚拟值(-1左右;除了NULL =未填充之外的任何东西)。您将此视为普通矩形阵列。它只能起作用,因为你的阵列几乎是常规的,但是嘿 - 现实世界的IT就是要识别异常的例外
答案 1 :(得分:1)
为什么不将普通表视为非锯齿状(列:Floor,Row,Column,Shelf,Box);对数据进行适当的限制,以最大限度地减少db需要的大小,然后将假盒子存放在假点中。
答案 2 :(得分:0)
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
然后我用以下内容将其转储到数据库中:
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