If _usergroup = "原料坯布仓库" OrElse _userroles.Contains("计划配缸") = True OrElse _userroles.Contains("系统维护") = True Then
If Tables("计划配缸通知单").Rows.Count > 0 Then
For Each r1 As Row In Tables("计划配缸通知单").Rows
r1("下一工序") = Nothing
Next
Dim dt1 As DataTable = Tables("计划配缸通知单").DataTable
Dim dt2 As DataTable = DataTables("染色生产表") '已染色
Dim dt3 As DataTable = DataTables("烘剪产量表") '已烘剪
Dim dt4 As DataTable = DataTables("定型产量表") '已打包称重
Dim dt5 As DataTable = DataTables("成品入库表") '已入库
Dim dt6 As DataTable = DataTables("成品库存表") '已库存
Dim dt7 As DataTable = DataTables("成品出库表") '已出库
For Each dr1 As DataRow In dt1.Select("配缸 = true and 缸号 is not null")
dr1("下一工序") = dr1("下一工序") & vbcrlf & "订单总重量:" & dr1("订单重量") & "计划总重量:" & dr1("计划重量")
Dim dr2s As List(Of DataRow) = dt2.SQLSelect("缸号 = '" & dr1("缸号") & "' and 流转日期 is not null")
If dr2s.Count > 0 Then
For Each dr2 As DataRow In dr2s
If dr1.isnull("下一工序") = True Then
dr1("下一工序") = "已染色:" & "染色编号" & "-" & dr2("染色编号") & "|" & "流转日期" & "-" & dr2("流转日期")
Else
dr1("下一工序") = dr1("下一工序") & vbcrlf & "已染色:" & "染色编号" & "-" & dr2("染色编号") & "|" & "流转日期" & "-" & dr2("流转日期")
End If
Next
End If
Dim dr3s As List(Of DataRow) = dt3.SQLSelect("缸号 = '" & dr1("缸号") & "' And 流转日期 Is not null")
If dr3s.Count > 0 Then
For Each dr3 As DataRow In dr3s
If dr1.isnull("下一工序") = True Then
dr1("下一工序") = "已烘剪:" & "烘剪编号" & "-" & dr3("烘剪编号") & "|" & "流转日期" & "-" & dr3("流转日期")
Else
dr1("下一工序") = dr1("下一工序") & vbcrlf & "已烘剪:" & "烘剪编号" & "-" & dr3("烘剪编号") & "|" & "流转日期" & "-" & dr3("流转日期")
End If
Next
End If
Dim dr4s As List(Of DataRow) = dt4.SQLSelect("缸号 = '" & dr1("缸号") & "' and 加工类型 = '打包称重' and 下一工序 = '成品仓库' and 流转日期 is not null")
If dr4s.count > 0 Then
For Each dr4 As DataRow In dr4s
If dr1.isnull("下一工序") = True Then
dr1("下一工序") = "已打包称重:" & "定型编号" & "-" & dr4("定型编号") & "|" & "定型重量" & "-" & dr4("定型重量") & "|" & "定型匹数" & "-" & dr4("定型匹数")
Else
dr1("下一工序") = dr1("下一工序") & vbcrlf & "已打包称重:" & "定型编号" & "-" & dr4("定型编号") & "|" & "定型重量" & "-" & dr4("定型重量") & "|" & "定型匹数" & "-" & dr4("定型匹数")
End If
Next
End If
Dim dr5s As List(of DataRow) = dt5.SQLSelect("缸号 like '%" & dr1("缸号") & "%'")
Dim zl5 As Double = 0
If dr5s.count > 0 Then
For Each dr5 As DataRow In dr5s
zl5 = zl5 + dr5("重量")
If dr1.isnull("下一工序") = True Then
dr1("下一工序") = "已入库:" & "入库编号" & "-" & dr5("入库编号") & "|" & "重量" & "-" & dr5("重量") & "|" & "匹数" & "-" & dr5("匹数")
Else
dr1("下一工序") = dr1("下一工序") & vbcrlf & "已入库:" & "入库编号" & "-" & dr5("入库编号") & "|" & "重量" & "-" & dr5("重量") & "|" & "匹数" & "-" & dr5("匹数")
End If
Next
End If
Dim dr6s As List(of DataRow) = dt6.SQLSelect("缸号 like '%" & dr1("缸号") & "%'")
If dr6s.count > 0 Then
For Each dr6 As DataRow In dr6s
If dr1.isnull("下一工序") = True Then
dr1("下一工序") = "已库存:" & "入库编号" & "-" & dr6("入库编号") & "|" & "重量" & "-" & dr6("重量") & "|" & "匹数" & "-" & dr6("匹数")
Else
dr1("下一工序") = dr1("下一工序") & vbcrlf & "已库存:" & "入库编号" & "-" & dr6("入库编号") & "|" & "重量" & "-" & dr6("重量") & "|" & "匹数" & "-" & dr6("匹数")
End If
Next
End If
Dim dr7s As List(of DataRow) = dt7.SQLSelect("缸号 like '%" & dr1("缸号") & "%'")
If dr7s.count > 0 Then
Dim zl7 As Double = 0
For Each dr7 As DataRow In dr7s
zl7 = zl7 + dr7("重量")
If dr1.isnull("下一工序") = True Then
dr1("下一工序") = "已出库:" & "出库编号" & "-" & dr7("出库编号") & "|" & "重量" & "-" & dr7("重量") & "|" & "匹数" & "-" & dr7("匹数")
Else
dr1("下一工序") = dr1("下一工序") & vbcrlf & "已出库:" & "出库编号" & "-" & dr7("出库编号") & "|" & "重量" & "-" & dr7("重量") & "|" & "匹数" & "-" & dr7("匹数")
End If
Next
If zl7 > 0 AndAlso zl5 > 0 AndAlso zl7 < zl5 Then
dr1("下一工序") = dr1("下一工序") & vbcrlf & "已部分完成"
ElseIf zl7 > 0 AndAlso zl5 > 0 AndAlso zl7 = zl5 Then
dr1("下一工序") = dr1("下一工序") & vbcrlf & "已完成"
End If
End If
Next
dt1.save
End If
Else
MessageBox.Show("您没有操作权限!","提示")
End If