加上整个表的代码
表事件
订单表_PrepareEdit
e.Table.Cols("排期").ComboList
= DataTables("订单表").GetComboListString("排期")
订单表_DataColChanged
Dim er As DataRow
= e.DataRow
Dim na As String =
e.DataCol.Name
Dim colstr As
String
Dim nfn As String
Dim ofn As String
Dim pa As String
If e.DataCol.Name
Like "更改*" Then
'MessageBox.Show(en)
Else
Dim str As String = er("更改记录")
If str > "" Then str = str
& chr(10) & chr(13)
Dim mm As String =
format(Date.Today.Month,"00")
Dim dd As String =
format(Date.Today.Day,"00")
Dim
ov As String = cstr(e.OldValue)
Dim nv As String = cstr(e.NewValue)
If ov > "" And nv <>
ov Then
str = er("更改记录")
If str > "" Then str = str
& chr(10) & chr(13)
str = str & user.name &
"|" & mm & "/" & dd & "|" &
e.DataCol.Name & "|" &
ov & "-->" & nv & "|#"
er("更改记录") = str
End If
End If
If e.DataCol.Name
Like "*实际" Then
Dim ntr As String = e.DataCol.Name
Dim sts() As String =
ntr.Split("_")
If er.IsNull(e.DataCol.Name ) Then
er(sts(0) & "_完成") =
False
Else
er(sts(0) & "_完成") = True
End If
End If
If na = "排产单号"
Then
If er.IsNull("排产单号") = False Then
er("排期") = CInt(mid(er("排产单号"),3,4)) + 1
End If
'--------------自动根据单据编号获取单据编号2的缩写
If na = "单据编号"
Then er("单据编号2") = mid(er("单据编号"),8,4)
'---------------------------根据文件名改变,判断是否需要修改文件名
Select Case
e.DataCol.Name
Case "产品代码"
Dim nr As DataRow = DataTables("彩单清单管理").Find("产品代码
='" & er("产品代码") & "'")
If nr Is Nothing Then
Dim nr1 As Row = Tables("彩单清单管理").AddNew
nr1("产品代码") = er("产品代码")
Else
nr("产品代码") = er("产品代码")
End If
Case "排产单号","组装车间","排期","环保要求","计划交期","回复交期","类型"
'MessageBox.Show(e.NewValue)
Dim drs As List(Of DataRow)
drs = e.DataTable.Select("单据编号
='" & e.DataRow("单据编号") & "'")
For Each dr As DataRow In drs
dr(e.DataCol.Name) = e.NewValue
Next
Case "入仓数量"
If er("入仓数量") - er("数量")
>=0 Then
er("完成入仓")= True
Else
er("完成入仓") = False
End If
End Select
订单表_CurrentChanged
Dim fnm As String
= "订单查看"
If
Forms(fnm).Opened Then '如果窗口已经打开
Dim tb As Table = Tables("订单查看_Tab订单")
tb.StopRedraw
Dim dr As DataRow = e.Table.Current.DataRow
Dim wz As Integer = tb.FindRow(dr)
If wz >=0 Then
tb.Position = wz
End If
tb.ResumeRedraw
End If