'///自动填入产品信息///
If e.DataCol.Name = "商品编号" Then
If e.DataRow.IsNull("仓储编号") Then
If e.NewValue Is Nothing Then
e.DataRow("销售单价") = Nothing
End If
Else
Dim dr As DataRow
dr = DataTables("仓储明细").sqlFind("[商品编号] = '" & e.DataRow("商品编号") & "'and [仓储编号]='" & e.DataRow("仓储编号") & "'")
If dr IsNot Nothing Then
e.DataRow("销售单价") = dr("公开售价")
e.DataRow("产品名称") = dr("商品名称")
e.DataRow("规格型号") = dr("规格型号")
e.DataRow("单位") = dr("单位")
e.DataRow("销售单价") = dr("公开售价")
Else
MessageBox.Show("请检查当前仓库是否存在该产品名称")
'
End If
End If
End If
'///对出库信息进行记录///
Select Case e.DataCol.Name
Case "出库1"
If e.newvalue Is Nothing And e.oldvalue Is Nothing Then
e.DataRow("出库时间1") = Nothing
Else
e.DataRow("出库时间1") = Date.today()
End If
Case "出库2"
If e.newvalue Is Nothing And e.oldvalue Is Nothing Then
e.DataRow("出库时间2") = Nothing
Else
e.DataRow("出库时间2") = Date.today()
End If
Case "出库3"
If e.newvalue Is Nothing And e.oldvalue Is Nothing Then
e.DataRow("出库时间3") = Nothing
Else
e.DataRow("出库时间3") = Date.today()
End If
Case "出库4"
If e.newvalue Is Nothing And e.oldvalue Is Nothing Then
e.DataRow("出库时间4") = Nothing
Else
e.DataRow("出库时间4") = Date.today()
End If
Case "出库5"
If e.newvalue Is Nothing And e.oldvalue Is Nothing Then
e.DataRow("出库时间5") = Nothing
Else
e.DataRow("出库时间5") = Date.today()
End If
End Select
'///从父表提取相关信息///
Select Case e.DataCol.Name
Case "商品编号"
Dim pr As DataRow = e.DataRow.GetParentRow("销售子任务")
If pr IsNot Nothing Then
e.DataRow("客户") = pr("客户")
End If
Dim pr1 As DataRow = e.DataRow.GetParentRow("销售任务")
If pr1 IsNot Nothing Then
e.DataRow("业务年度") = pr1("业务年度")
e.DataRow("销售类型") = pr1("销售类型")
e.DataRow("任务类别") = pr1("任务类别")
End If
End Select
'///动态生成合计金额的表达式///
Select Case e.DataCol.Name
Case "数量", "销售单价"
DataTables("销售任务").DataCols("合计金额").Expression = "IsNull(Sum(Child(销售_子任务).合计金额),0)"
End Select
'///计算库存以及虚拟库存///
Select Case e.DataCol.Name
Case "数量"
If e.NewValue < 0 Then
e.DataRow("性质") = "退货"
Else
e.DataRow("性质") = Nothing
End If
Dim dr As DataRow
dr = DataTables("仓储明细").SQLFind("[商品编号] = '" & e.DataRow("商品编号") & "'and [仓储编号]='" & e.DataRow("仓储编号") & "'")
If dr IsNot Nothing Then
dr("虚拟库存") = dr("虚拟库存") - e.NewValue + e.OldValue
dr.Save()
End If
Case "出库1", "出库2", "出库3", "出库4", "出库5"
Dim dr1 As DataRow
dr1 = DataTables("仓储明细").SQLFind("[商品编号] = '" & e.DataRow("商品编号") & "'and [仓储编号]='" & e.DataRow("仓储编号") & "'")
If dr1 IsNot Nothing Then
dr1("库存") = dr1("库存") - e.NewValue + e.OldValue
dr1.Save()
End If
End Select
e.DataTable.Save()
有一些事件代码以及动态生成一些表达式
但是跟粘贴这个编号触发的好像没有发现什么 值是 null的
[此贴子已经被作者于2025/3/27 18:05:44编辑过]