Dim gdsl() As String = str.Split("|")
Dim msm() As String
For Index As Integer = 0 To gdsl.Length - 1
Dim msm() As String
Dim gds() As String = gdsl(Index).Split("_")
msm(Index)= "物料编码 = '" & dr("存货编码") & "' and 库位编码 = '" & dr("仓库编码") & "' And 生产订单号码 = '" & gds(0) & "' and 工单行号 = '" & gds(1) & "'"
Next
Select Case e.DataCol.name
Case "SN"
If Not e.DataRow.IsNull("SN") Then
Dim drr As DataRow = DataTables("库存明细表").SQLFind("SN = '" & e.DataRow("SN") & "' and 物料编码 = '" & dr("存货编码") & "'")
If drr IsNot Nothing Then
If drr("状态") = "配货完成" Then
e.DataRow("状态") = "配货重复扫描"
e.DataRow("物料编码") = dr("存货编码")
e.DataRow("发货单号") = dr("发货单号")
e.DataRow("数量") = 0
e.DataRow.save
Else
Dim nms() As String = {"生产订单号码","工单行号","物料编码","物料名称","类别说明","产品批次","订单号","订单行号","客户","备注","软件版本","MAC","HW","入库单号","库位类别","库位编码","入库完成时间","入库方式","在库生命周期"}
For Each nm As String In nms
e.DataRow(nm) = drr(nm)
Next
e.DataRow("状态") = "配货完成"
e.DataRow("发货单号") = dr("发货单号")
e.DataRow("数量") = 1
e.DataRow.save
drr("状态") = "配货完成"
drr("配货完成时间") = Date.now
drr("U8发货单号") = dr("发货单号")
drr("业务员") = dr("业务员")
drr("货运单号") = dr("货运单号")
drr("发货地址") = dr("发货地址")
drr.Save
Dim mr As DataRow = DataTables("库位数量统计").SQLFind("生产订单号码 = '" & drr("生产订单号码") & "' and 工单行号 = '" & drr("工单行号") & "' and 物料编码 = '" & drr("物料编码") & "' and 库位编码 = '" & drr("库位编码") & "' and 库位类别 = '" & drr("库位类别") & "'")
If mr IsNot Nothing Then
Dim cmd1 As new SQLCommand
cmd1.C
cmd1.CommandText = "Exec kwsltjdec '" & mr("生产订单号码") & "','" & mr("工单行号") & "','" & mr("物料编码") & "','" & mr("库位编码") & "','" & mr("库位类别") & "'"
Dim t As DataTable = cmd1.ExecuteReader
mr.save
End If
Dim tr As String = "物料编码 = '" & e.DataRow("物料编码") & "' and 库位类别 = '" & e.DataRow("库位类别") & "' and 生产订单号码 = '" & e.DataRow("生产订单号码") & "' and 工单行号 = '" & e.DataRow("工单行号") & "'"
Dim mrr As DataRow = DataTables("可用数量表").SQLFind(tr)
If mrr IsNot Nothing Then
Dim match As Boolean = False
For id As Integer = 0 To msm.Length
If (msm(id) = tr) Then
match = True
Exit For
End If
Next
If match = False
Dim cmd1 As new SQLCommand
cmd1.C
cmd1.CommandText = "Exec kwsltjdec '" & mr("生产订单号码") & "','" & mr("工单行号") & "','" & mr("物料编码") & "','" & mr("库位编码") & "','" & mr("库位类别") & "'"
Dim t As DataTable = cmd1.ExecuteReader
mr.save
End If
End If
End If
Else
e.DataRow("状态") = "配货完成"
e.DataRow("物料编码") = dr("存货编码")
e.DataRow("发货单号") = dr("发货单号")
e.DataRow("数量") = 1
e.DataRow.save
Dim rr As DataRow = DataTables("库存明细表").AddNew
rr("SN") = e.DataRow("SN")
rr("物料编码") = e.DataRow("物料编码")
rr("U8发货单号") = dr("发货单号")
rr("状态") = "配货完成"
rr("出库方式") = "type5"
rr("数量") = 1
rr.save
Dim sum2 As Integer
sum2 = DataTables("配货扫描").SQLCompute("Sum(数量)",filter1 & "And 状态 = '配货完成' and SN is not null")
yphsl.text = "发货单号:" & dr("发货单号") & "已完成配货数量" & "=" & sum2
If dr("挪货数量") = sum2 Then
dr("配货状态") = True
dr("配货完成时间") = Date.now
dr.save
tg.Enabled = True
wg.Enabled = True
Else
tg.Enabled = False
wg.Enabled = False
End If
End If
End If
End Select
蓝色的代码是不是也有问题。我想把每次合成的内容作为msm数组的元素。