以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 请教大家了 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=44624) |
||||
-- 作者:happly145 -- 发布时间:2014/1/5 11:41:00 -- 请教大家了 当选择工序1里的人名时,按确认按钮后, 数量乘以产品信息表中的对应产品的工序1值, 后将结果添加到工时统计表相对应的人名中。 谢谢呀!
[此贴子已经被作者于2014-1-5 11:42:03编辑过]
|
||||
-- 作者:y2287958 -- 发布时间:2014/1/5 12:19:00 -- 在“工时核算”表的DataChanged事件中设置以下代码试试: Dim dr As DataRow = e.DataRow If e.DataCol.Name = "工序1" Dim dr1,dr2 As DataRow dr1 = DataTables("产品信息").Find("产品名称=\'" & dr("产品名称") & "\'") dr2 = DataTables("工时统计").Find("产品名称=\'" & dr("产品名称") & "\'") If dr.IsNull("工序1")=False If dr1 IsNot Nothing AndAlso dr2 IsNot Nothing Dim i As Integer = dr("数量") * dr1("工序1") If e.NewValue <> e.OldValue dr2(e.NewValue) = i dr2(e.OldValue) = Nothing End If End If Else dr2(e.OldValue) = Nothing End If End If |
||||
-- 作者:happly145 -- 发布时间:2014/1/5 12:27:00 -- 谢谢,我试试 |
||||
-- 作者:happly145 -- 发布时间:2014/1/5 12:42:00 -- 什么意思呀 ![]() ![]() [此贴子已经被作者于2014-1-5 12:42:27编辑过]
|
||||
-- 作者:y2287958 -- 发布时间:2014/1/5 13:40:00 -- 换这个吧 Dim dr As DataRow = e.DataRow If e.DataCol.Name = "工序1" Dim dr1,dr2 As DataRow dr1 = DataTables("产品信息").Find("产品名称=\'" & dr("产品名称") & "\'") dr2 = DataTables("工时统计").Find("产品名称=\'" & dr("产品名称") & "\'") If dr1 IsNot Nothing AndAlso dr2 IsNot Nothing For Each s As String In DataTables("员工信息").GetValues("员工姓名") If DataTables("工时统计").DataCols.Contains(s) If s = e.NewValue Dim i As Integer = dr("数量") * dr1("工序1") dr2(e.NewValue) = i Else dr2(s) = Nothing End If End If Next End If End If |
||||
-- 作者:lsy -- 发布时间:2014/1/5 14:29:00 -- 工时统计表,大大的缺陷,就是个不定时炸弹,不知啥时候就会破坏整个项目: 以员工名为列名,员工是变动的,列名应该是固定的,两者不匹配。 |
||||
-- 作者:happly145 -- 发布时间:2014/1/5 14:35:00 -- 学习了 |
||||
-- 作者:happly145 -- 发布时间:2014/1/5 14:41:00 -- 还是有问题 |
||||
-- 作者:happly145 -- 发布时间:2014/1/5 15:55:00 -- 如果同一人完成所有工序的话,怎么实现累加功能呀? |
||||
-- 作者:有点甜 -- 发布时间:2014/1/5 21:40:00 -- 改了一下,如下。
|