以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助]郁闷了,2个小时过去也不知道问题在哪,求帮助 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=85892) |
-- 作者:huhu -- 发布时间:2016/6/4 20:56:00 -- [求助]郁闷了,2个小时过去也不知道问题在哪,求帮助 Dim gdhhh As WinForm.TextBox = Forms("生产入库").Controls("TextBox3") Dim scsmy As WinForm.TextBox = Forms("生产入库").Controls("TextBox2") Dim lb As WinForm.ComboBox = e.Form.Controls("ComboBox2") If e.DataCol.name = "SN" Then Dim nms() As String = {"生产订单号码","工单行号","物料编码","物料名称","类别说明","产品批次","订单号","订单行号","客户","备注","软件版本","状态","产品态"} If e.NewValue Is Nothing Then For Each nm As String In nms e.DataRow(nm) = Nothing Next Else Select Case lb.text Case "2" e.DataRow.Save Dim rr1 As DataRow = DataTables("assemblyMiddle").SQLFind("item_ID = \'" & e.DataRow("SN") & "\'") If rr1 IsNot Nothing Then Dim fdr As DataRow = DataTables("扫描配货明细").Find("SN = \'" & e.DataRow("SN") & "\' And _Identify <> " & e.DataRow("_Identify")) If fdr IsNot Nothing Then If fdr("状态") = "生产结束重复扫描" Or fdr("状态") = "生产结束扫描完成" Then e.DataRow("数量") = 0 e.DataRow("状态") = "生产结束重复扫描" e.DataRow.save e.DataRow.locked = True Dim drr1 As DataRow = DataTables("生产扫描异常").Find("SN = \'" & e.DataRow("SN") & "\'") If drr1 Is Nothing Then Dim drrr1 As DataRow = DataTables("生产扫描异常").AddNew drrr1("数量") = 0 drrr1("SN") = e.DataRow("SN") drrr1("状态") = "生产结束重复扫描" drrr1.Locked = True End If End If Else Dim rr2s As List(of DataRow) = DataTables("assemblyMiddle").SQLSelect("id_Flag = \'" & rr1("id_Flag") & "\'") SystemReady = False For Each rr2 As DataRow In rr2s Dim ndr As DataRow = DataTables("扫描配货明细").AddNew Dim dr1 As DataRow = DataTables("assemblyProduct").SQLFind("deviceCode = \'" & rr2("item_ID") & "\' or productno = \'" & rr2("item_ID") & "\'") If dr1 IsNot Nothing Then ndr("SN") = rr2("item_ID") Dim dr2 As DataRow = DataTables("assemblySubWorkOrder").SQLFind("SID = \'" & dr1("subWorkOrder") & "\'") If dr2 IsNot Nothing Then ndr("工单行号") = dr2("LineFlag") Dim dr3 As DataRow = DataTables("assemblyWorkOrder").SQLFind("Id = \'" & dr2("workOrder") & "\'") ndr("生产订单号码") = dr3("WorkOrderNo") ndr("生产订单号码工单行号")= ndr("生产订单号码") & "-" & ndr("工单行号") ndr.Save Dim dr5 As DataRow = DataTables("assemblyScriptParamter").SQLFind("workOrderNo = \'" & ndr("生产订单号码") & "\' and lineFlag = \'" & ndr("工单行号") & "\'") If dr5 IsNot Nothing Then msgbox(0)-------只最后弹出一次,不应该每次循环都弹出么。 If dr5.IsNull("scriptval8") Then-----------scriptval8为空 Dim kwlb As WinForm.ComboBox = Forms("生产入库").Controls("ComboBox1") Dim rklb As WinForm.ComboBox = Forms("生产入库").Controls("ComboBox2") ndr("库位类别") = kwlb.text ndr("入库类别") = rklb.text ndr("绑外SN") = e.DataRow("SN") ndr("数量") = 1 ndr("状态") = "生产结束扫描完成" ndr("入库方式") = "扫描入库" ndr("生产结束扫描完成时间") = Date.now ndr("生产扫描员") = scsmy.text ndr.Save Else If dr1("status") = "-1" Then Dim kwlb As WinForm.ComboBox = Forms("生产入库").Controls("ComboBox1") Dim rklb As WinForm.ComboBox = Forms("生产入库").Controls("ComboBox2") ndr("库位类别") = kwlb.text ndr("入库类别") = rklb.text ndr("数量") = 1 ndr("状态") = "生产结束扫描完成" ndr("入库方式") = "扫描入库" ndr("生产结束扫描完成时间") = Date.now ndr("生产扫描员") = scsmy.text ndr.locked = True ndr.Save Else ndr("数量") = 0 ndr("状态") = "不符合入库条件" ndr.save Dim drr12 As DataRow = DataTables("生产扫描异常").Find("SN = \'" & ndr("SN") & "\' and 生产订单号码工单行号 = \'" & e.DataRow("生产订单号码工单行号") & "\'") If drr12 Is Nothing Then Dim drrr12 As DataRow = DataTables("生产扫描异常").AddNew drrr12("数量") = 0 drrr12("SN") = ndr("SN") drrr12.Locked = True End If End If End If End If End If End If Next Dim ndr1 As DataRow = DataTables("扫描配货明细").find("SN = \'" & e.DataRow("SN") & "\' And 状态 = \'生产结束扫描完成\'") For Each nm As String In nms e.DataRow(nm) = ndr1(nm) Next e.DataRow("绑外SN") = e.DataRow("SN") e.DataRow("数量") = 1 e.DataRow("入库方式") = ndr1("入库方式") e.DataRow("库位类别") = ndr1("库位类别") e.DataRow("生产结束扫描完成时间") = ndr1("生产结束扫描完成时间") e.DataRow("状态") = "生产结束扫描完成" e.DataRow.save ndr1.Delete For Each mdr As DataRow In DataTables("扫描配货明细").Select("绑外SN = \'" & e.DataRow("SN") & "\'") mdr.Locked = True mdr.save Next SystemReady = True End If End If End Select End If End If 加上红色的代码会报错:未将对象引用设置到对象实例。同时表的行号没了,如附件。 注掉红色的代码,感觉结果是对的。请帮忙看一下红色的代码,郁闷了2个小时了,找不出问题。 另外能帮忙把代码改简洁点不。意图就是把集合中的行加上的表中,删除掉重复的那一行。
|
-- 作者:大红袍 -- 发布时间:2016/6/5 11:36:00 -- 每个判断,都加入msgbox弹出是否进入执行了代码。
不会做,上传实例,说明什么问题。 |