在那里改呢?改哪一句?
Public Shared Function ConvertToJsonObject(ByVal dataTable As DataTable) As String
Dim result As New Dictionary(Of String, WarecodeStateJsonModel)
For Each dr As DataRow In dataTable.Rows
Dim wareCode As String
wareCode = dr("库位类别").ToString()
If (result.ContainsKey(wareCode)) Then
Dim model = result(wareCode)
model.rootWorks.Add(GetWareRootWork(dr))
Else
Dim model As New WarecodeStateJsonModel
model.wareCode = wareCode
model.rootWorks.Add(GetWareRootWork(dr))
result.Add(wareCode, model)
End If
Next
Dim models As New List(Of WarecodeStateJsonModel)
For Each warecodeStateJsonModel As WarecodeStateJsonModel In result.Values
models.Add(warecodeStateJsonModel)
Next
Return JsonConvertor.ObjectToJson(models)
End Function
Public Shared Function GetWareRootWork(ByVal dr1 As DataRow) As WareRootWork
Dim rootWork As New WareRootWork(dr1("_Identify").ToString(), dr1("生产订单号码").ToString(), dr1("工单行号").ToString(), dr1("订单号").ToString(), dr1("订单行号").ToString(), dr1("物料编码").ToString(), dr1("软件版本").ToString(), dr1("两化表编号").ToString(), dr1("数量").ToString(), Format(dr1("入库时间"), "yyyy-MM-dd HH:mm:ss"))
Return rootWork
End Function