做了个产品管理窗口,在开发版的环境中测试是没问题的,但运行发布后的时候就不行了.发布后当先择"铝门锁","窗门锁","胆仔锁","鹅旦锁","内胆锁","有尾门锁","83内胆-锁" 类产品时程序就死了.
实在是想不明白,希望有人能找出原因。
情况是这样的,比如想在产品规格表中双击某一产品时会根据产品的类别打开不同的格式窗口,表的
DoubleClick事件代码如下:
Select Case Tables("obas_part_spec").Current("产品类别")
Case "铝门锁","窗门锁","胆仔锁","鹅旦锁","内胆锁","有尾门锁","83内胆-锁"
Forms("产品规格表2").Open
Case Else
Forms("产品规格表").Open
End Select
当打开产品格表窗口时,窗口有一个选择组合框,可以根据选择不同的产品类别打开不同的窗口,
ValueChanged
代码如下:
Dim s As String
s=e.Sender.Text
try
Dim ids As String
Dim drs As List(Of DataRow)
drs = DataTables("料品资料查询表").Select("type_name = '" & s &"'")
For Each dr As DataRow In drs
ids = ids & ",'" & dr("part_no") & "'"
Next
ids= ids.Trim(",")
DataTables("obas_part_spec").LoadFilter = "part_no In (" & ids & ")"
DataTables("obas_part_spec").Load()
Catch ex As Exception
MessageBox.Show("没找到相关数据1!","提示",MessageBoxButtons.OK)
End Try
Select Case s
Case "铝门锁","窗门锁","胆仔锁","鹅旦锁","内胆锁","有尾门锁","83内胆-锁"
Forms("产品规格表2").Open()
Forms("产品规格表").Close
'Case Else
' Return
Case Else
try
Dim s1 As String = Tables("obas_part_spec").Current("part_no")
Dim s2 As String ="0"
Dim t As WinForm.Table = e.Form.Controls("Table1")
If e.Form.Controls("TextBox1").Text <> "" Then
t.Table.Fill("SELECT parent_part as 内部编码,child_part,Left(unit_qty,4) As 数量,bom_sort As 排序,ov_part.item_no As 物料编码,ov_part.part_name As 名称,ov_part.part_spec As 规格,obas_part1.bom_draw_no As 图号 from obom_stru2 INNER JOIN ov_part on obom_stru2.child_part = ov_part.part_no INNER JOIN obas_part1 on obom_stru2.child_part = obas_part1.part_no where parent_part='" & s1 & "'ORDER BY 排序","erp",True)
t.Table.SetColVisibleWidth("物料编码|77|名称|75|规格|207|数量|19|图号|60")
Else
t.Table.Fill("SELECT parent_part as 内部编码,child_part,Left(unit_qty,4) As 数量,bom_sort As 排序,ov_part.item_no As 物料编码,ov_part.part_name As 名称,ov_part.part_spec As 规格,obas_part1.bom_draw_no As 图号 from obom_stru2 INNER JOIN ov_part on obom_stru2.child_part = ov_part.part_no INNER JOIN obas_part1 on obom_stru2.child_part = obas_part1.part_no where parent_part='" & s2 & "'ORDER BY 排序","erp",True)
t.Table.SetColVisibleWidth("物料编码|77|名称|75|规格|207|数量|19|图号|60")
End If
Catch ex As Exception
Dim s2 As String ="0"
Dim t As WinForm.Table = e.Form.Controls("Table1")
t.Table.Fill("SELECT parent_part as 内部编码,child_part,Left(unit_qty,4) As 数量,bom_sort As 排序,ov_part.item_no As 物料编码,ov_part.part_name As 名称,ov_part.part_spec As 规格,obas_part1.bom_draw_no As 图号 from obom_stru2 INNER JOIN ov_part on obom_stru2.child_part = ov_part.part_no INNER JOIN obas_part1 on obom_stru2.child_part = obas_part1.part_no where parent_part='" & s2 & "'ORDER BY 排序","erp",True)
t.Table.SetColVisibleWidth("物料编码|77|名称|75|规格|207|数量|19|图号|60")
MessageBox.Show("没找到相关数据!","提示",MessageBoxButtons.OK)
End Try
End Select
另窗口中也有个产品编码的文本框控件,
TextChanged
代码如下:
Try
Dim s As String = Tables("obas_part_spec").Current("part_no")
Dim s1 As String ="0"
Dim t As WinForm.Table = e.Form.Controls("Table1")
Select Case Forms("产品规格表").Controls("Label8").text
Case "铝门锁","窗门锁","胆仔锁","鹅旦锁","内胆锁","有尾门锁","83内胆-锁"
Forms("产品规格表2").Open()
Forms("产品规格表").Close
'If Tables("obas_part_spec").Current("产品类别") <> "铝门锁" Then
'Dim s2 As String = "铝门锁,窗门锁,胆仔锁,鹅旦锁,内胆锁,有尾门锁"
'Dim s3 As String = Tables("obas_part_spec").Current("产品类别")
'If s2.indexof(s3) < 0 Then
Case Else
If e.Sender.Text <> "" Then
t.Table.Fill("SELECT parent_part as 内部编码,child_part,Left(unit_qty,4) As 数量,bom_sort As 排序,ov_part.item_no As 物料编码,ov_part.part_name As 名称,ov_part.part_spec As 规格,obas_part1.bom_draw_no As 图号 from obom_stru2 INNER JOIN ov_part on obom_stru2.child_part = ov_part.part_no INNER JOIN obas_part1 on obom_stru2.child_part = obas_part1.part_no where parent_part='" & s & "'ORDER BY 排序","erp",True)
t.Table.SetColVisibleWidth("物料编码|77|名称|75|规格|207|数量|19|图号|60")
Else
t.Table.Fill("SELECT parent_part as 内部编码,child_part,Left(unit_qty,4) As 数量,bom_sort As 排序,ov_part.item_no As 物料编码,ov_part.part_name As 名称,ov_part.part_spec As 规格,obas_part1.bom_draw_no As 图号 from obom_stru2 INNER JOIN ov_part on obom_stru2.child_part = ov_part.part_no INNER JOIN obas_part1 on obom_stru2.child_part = obas_part1.part_no where parent_part='" & s1 & "'ORDER BY 排序","erp",True)
t.Table.SetColVisibleWidth("物料编码|77|名称|75|规格|207|数量|19|图号|60")
End If
End Select
Catch ex As Exception
End Try