PrepareEdit事件
If e.Row("ruku") = True Then
Select Case e.Col.Name
Case "chanpinid","sdate","shuliang","beizhu"
e.Cancel = True
End Select
End If
StartEdit 事件
If e.Col.Name = "chanpinid" Then
e.Cancel = True
If e.Row("ruku") = False
Forms("其他入库选产品").Open()
End If
End If
DataColChanged 事件
Select Case e.DataCol.Name
Case "ruku" '复制数据到库存流水
Dim dr As DataRow=e.DataRow
If e.DataRow("ruku") = False
Dim nma() As String = {"sdate","chanpinid","shuliang"} 'A表数据来源列
Dim nmb() As String = {"rdate","chanpinid","shuliang"} 'B表数据接收列
Dim drs As DataRow = DataTables("kucun").AddNew
For i As Integer = 0 To nma.Length - 1
drs(nmb(i)) = e.DataRow(nma(i))
Next
drs("beizhu") = "库存盘点"
drs("bianhao")="KC" & dr("_Identify")
DataTables("kucun").save()
Else
Dim Result As DialogResult
Result = MessageBox.Show("您确定要取消该产品入库吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If Result = DialogResult.Yes Then
Dim nma() As String = {"sdate","chanpinid","shuliang"} 'A表数据来源列
Dim nmb() As String = {"rdate","chanpinid","shuliang"} 'B表数据接收列
Dim drs As DataRow = DataTables("kucun").AddNew
For i As Integer = 0 To nma.Length - 1
drs(nmb(i)) = e.DataRow(nma(i))
Next
drs("beizhu") = "库存盘点"
drs("shuliang") = -drs("shuliang")
drs("bianhao")="KC" & dr("_Identify")
DataTables("kucun").save()
Else
e.Cancel = True
End If
End If
End Select