Dim dd As WinForm.Label = Forms("合同号款号更改").Controls("担当")
Dim ht As WinForm.Label = Forms("合同号款号更改").Controls("合同")
Dim ght As WinForm.TextBox = e.Form.Controls("TextBox1")
Dim jq As WinForm.Label = Forms("合同号款号更改").Controls("交期")
Dim kf As WinForm.Label = Forms("合同号款号更改").Controls("客户")
Dim kh As WinForm.Label = Forms("合同号款号更改").Controls("款")
Dim mc As WinForm.Label = Forms("合同号款号更改").Controls("名称")
Dim sl As WinForm.Label = Forms("合同号款号更改").Controls("数量")
Dim ddh As WinForm.TextBox = Forms("订单查询修改").Controls("合同号")
Dim shk As WinForm.TextBox = Forms("订单查询修改").Controls("款号")
Dim rt As Row = Tables("订单查询修改_订单主表").Current
If ht.Text = "" Then
MessageBox.Show("没有合同数据请检查订单信息是否完整!", "提示")
Return
Else
If kh.Text = "" Then
MessageBox.Show("没有款号数据请检查订单信息是否完整!", "提示")
Return
Else
If ght.Text = "" Then
MessageBox.Show("未填写新合同号请填写!", "提示")
Return
Else
If MessageBox.Show("款号为" & kh.Text & "的订单已经被修改,是否保存?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = DialogResult.Yes Then
Dim filter As String = "合同号 = '" & ht.Text & "'And 款号 = '" & kh.Text & "'And 数据ID = '" & rt("_Identify") & "'"
Dim filters As String = "合同号 = '" & ht.Text & "'And 款号 = '" & kh.Text & "' And 业务担当 = '" & dd.Text & "' And 合同交期 = '" & jq.Text & "' And 客户名称 = '" & kf.Text & "' And 品名 = '" & mc.Text & "' And 合同数量 = '" & sl.Text & "'And 数据ID = '" & rt("_Identify") & "' "
Dim drZ As List(Of DataRow) = DataTables("订单查询修改_订单主表").Select(filters)
If FileSys.FileExists("d:/订单信息/"+(rt("客户名称")) + "/"+(rt("合同号")) +"- "+(rt("款号")) +" 订单指示.xls") Then '如果指定的文件存在
FileSys.DeleteFile("d:/订单信息/"+(rt("客户名称")) + "/"+(rt("合同号")) +"- "+(rt("款号")) +" 订单指示.xls",2,2) '则彻底删除之
End If
For Each r As DataRow In drZ
r("合同号") = ght.Text
ddh.Value = ght.Text
Next
Dim cmd As New SQLCommand
Dim dds1 As DataTable
Dim ddm1 As DataTable
Dim dmd1 As DataTable
Dim psb1 As DataTable
Dim flb1 As DataTable
Dim cmb As WinForm.ComboBox
cmd.C
cmd.CommandText = "SELECT * Fro m {订单数量明细}"
dds1 = cmd.ExecuteReader(True)
cmd.CommandText = "SELECT * Fro m {订单面料明细}"
ddm1 = cmd.ExecuteReader(True)
cmd.CommandText = "SELECT * Fro m {面料委托表}"
dmd1= cmd.ExecuteReader(True)
cmd.CommandText = "SELECT * Fro m {配色表}"
psb1 = cmd.ExecuteReader(True)
cmd.CommandText = "SELECT * Fro m {订单辅料明细}"
flb1 = cmd.ExecuteReader(True)
Dim drs As List(Of DataRow) = dds1.Select(filter)
For Each r1 As DataRow In drs
r1("合同号") = ght.Text
Next
Dim drp As List(Of DataRow) = psb1.Select(filter)
For Each r2 As DataRow In drp
r2("合同号") = ght.Text
Next
Dim drf As List(Of DataRow) = flb1.Select(filter)
For Each r3 As DataRow In drf
r3("合同号") = ght.Text
Next
Dim drm As List(Of DataRow) = dmd1.Select(filter)
For Each r4 As DataRow In drm
r4("合同号") = ght.Text
Next
Dim drt As List(Of DataRow) = ddm1.Select(filter)
For Each r5 As DataRow In drt
r5("合同号") = ght.Text
Next
If DataTables("订单查询修改_订单主表").HasChanges Or dds1.HasChanges Or flb1.HasChanges Or ddm1.HasChanges Or psb1.HasChanges Then
psb1.Save()
ddm1.Save()
flb1.Save()
dds1.Save()
dmd1.Save()
DataTables("订单查询修改_订单主表").Save()
MessageBox.Show("订单更新完成!")
Forms("合同号款号更改").Close()
End If
End If
End If
End If
End If