出货记录表的代码 同步2万行,假死。
chuhuo_StartEdit
If e.Col.Name = "chanpinid" Then
e.Cancel = True
Forms("销售选产品").Open()
End If
chuhuo_DataColChanged
Select Case e.DataCol.Name
Case "shuliang","danjia"
Dim dr As DataRow=e.DataRow
dr("zonger") =dr("shuliang")*dr("danjia")
dr("fuzhu")=dr("shuliang")*guanxi4/guanxi3
Case "fuzhu"
Dim dr As DataRow=e.DataRow
dr("shuliang")=dr("fuzhu")/guanxi4*guanxi3
Case "chanpinid" '发生变化的列
Dim dr As DataRow
Dim Filter As String
Filter = "[chanpinid] = '" & e.DataRow("chanpinid") & "' And [kehuid] = '" & e.DataRow("kehuid") & "' and [danjia]> 0"
dr = DataTables("chuhuo").Find(Filter & "and [_Identify] < " & e.DataRow("_Identify"),"chuhuodate desc") '
If dr IsNot Nothing Then '如果找到
'将找到的内容填入到正在输入的行中.
e.DataRow("danjia") = dr("danjia")
Else
e.DataRow("danjia")=0
End If
Case "hongchong" '复制数据到库存流水
Dim dr As DataRow=e.DataRow
If e.DataRow("hongchong") = True
Dim nma() As String = {"chuhuodate","chanpinid","shuliang","chuhuodan"} 'A表数据来源列
Dim nmb() As String = {"rdate","chanpinid","shuliang","bianhao"} '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") = "销售红冲"
Else If e.DataRow("hongchong")= False And e.DataRow("shuliang")>0
Dim nma() As String = {"chuhuodate","chanpinid","shuliang","chuhuodan"} 'A表数据来源列
Dim nmb() As String = {"rdate","chanpinid","shuliang","bianhao"} '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")
End If
DataTables("kucun").save
End Select
chuhuo_DrawCell
If e.Row("hongchong") = True Then
e.Style = "红冲"
End If
出货单表 1万行 同步该表 大概几秒钟
代码如下
chuhuodan_StartEdit
If e.Col.Name = "chuhuodan" Then
e.Cancel = True
Forms("查看出货单").Open()
End If
If e.col.name="hongchong" AndAlso e.Row("shoukuan")>0 Then
messagebox.show("已收款账单不能红冲!","提示",messageboxbuttons.ok,messageboxicon.Information)
e.cancel=True
End If
If e.Col.Name = "hongchong" AndAlso e.Row("hongchong") = True AndAlso user.name<>"开发者" Then
MessageBox.Show("不能反红冲!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
e.Cancel= True
End If
chuhuodan_DataColChanged
'Select Case e.DataCol.Name
'Case "chuhuodate"
'Dim dr As DataRow = e.DataRow
'Dim s As String = dr("_Identify")
'dr("chuhuodan") = "XS" & s.PadLeft(6,"0")
'End Select
Select Case e.DataCol.Name
Case "hongchong"
DataTables("chuhuodan").save
DataTables("chuhuo").save
End Select
chuhuodan_DrawCell
If e.Row("hongchong") =True Then
e.Style = "红冲"
End If
chuhuodan_PrepareEdit
If User.Group<>"财务部" Then
Select Case e.col.name
Case "chuhuodate","kehuname","kehuid","tel1","dizhi","diqu","beizhu","addtime","adduser","wancheng"
e.cancel=True
End Select
End If
If (e.Row("wancheng") = True Or e.Row("hongchong")=True) AndAlso User.group<> "财务部" Then
Select Case e.Col.Name
Case "wancheng","hongchong"
e.Cancel = True
End Select
End If
chuhuodan_DataColChanging
Select Case e.DataCol.Name
Case "hongchong"
If e.DataRow("hongchong") = False
Dim Result As DialogResult
Result = MessageBox.Show("您确定要红冲吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If Result = DialogResult.no Then
e.Cancel = True
End If
Else
Dim Result As DialogResult
Result = MessageBox.Show("您确定要反红冲吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If Result = DialogResult.no Then
e.Cancel = True
End If
End If
End Select
chuhuodan_DataRowAdding
Dim dr As DataRow = e.DataRow
Dim s As String = dr("_Identify")
dr("chuhuodan") = "XS" & s.PadLeft(6,"0")
dr("chuhuodate")=mydate
出货记录的代码有问题吗?
[此贴子已经被作者于2012-4-23 16:34:12编辑过]