确认入库按钮(add1),click事件:Dim tb1 As Table = Tables("StockInN_Table1")
Dim tb2 As Table = Tables("StockInN_Table2")
DataTables("StockInN_Table2").save()
If DataTables("StockInN_Table2").HasChanges = True Then
Return
Else
DataTables("StockInN_Table1").save()
If DataTables("StockInN_Table1").HasChanges = True Then
Return
End If
End If '先保存,如果不能保存就不继续
Dim sql As new SQLCommand
Dim lsb As DataTable
sql.C
sql.CommandText = "se/ect * fr om {产品库存信息} where 1 = 0"
lsb = sql.ExecuteReader(True) '生成临时表,设成True,库存信息可以保存
Dim ck As String = tb2.Rows(0)("仓库编号")
Dim gys As String = tb2.Rows(0)("供应商编号")
Dim bh As String = tb2.Rows(0)("对应编号")
Dim hs As Integer = tb1.Rows.Count
For i As Integer = 0 To hs -1
Dim hh As String = tb1.Rows(i)("基础货号")
Dim gj As String = tb1.Rows(i)("产地国家码")
Dim kcm As String = hh & gj & gys & ck '生成产品库存码,基础货号+国家码+供应商码+仓库码
Dim h As DataRow
h = lsb.SQLFind("产品库存码 = '" & kcm & "'")
If h IsNot Nothing Then
h("当前库存数量") = h("当前库存数量") + tb1.Rows(i)("数量")
h.save()
Else
Dim xh As DataRow
xh = lsb.AddNew()
xh("产品库存码") = kcm
xh("基础货号") = hh
xh("产品基本名称") = tb1.Rows(i)("产品基本名称")
xh("原产地国") = tb1.Rows(i)("原产地国")
xh("产地国家码") = gj
xh("供应商名称") = tb2.Rows(0)("供应商名称")
xh("供应商编号") = gys
xh("仓库名称") = tb2.Rows(0)("入库仓库")
xh("仓库编号") = ck
xh("当前库存数量") = tb1.Rows(i)("数量")
End If
Next
lsb.save()
If ancs = "cgrk" Then ‘这是全局变量,判断入库类型,会有不同的设置,也很奇怪,只有这个类型会出现我说的错误,其他类型就不出现。但是注释掉这整段还是一样会出现弹窗。
Dim sql3 As new SQLCommand
sql3.C
sql3.CommandText = "up d ate {采购下单表} se t 采购单状态 = '已入库' w here 采购编号 = '" & bh & "'"
sql3.ExecuteNonQuery '添加之后便到采购下单表标注一下单子已成功
End If
e.Form.Controls("ad").Enabled = False
e.Form.Controls("del").Enabled = False
e.Form.Controls("beiz").Enabled = False
e.Form.Controls("dybh").Enabled = False
e.Form.Controls("rkck").Enabled = False
e.Form.Controls("gys").Enabled = False
e.Form.Controls("add1").Enabled = False ‘只要把这条注释掉就没弹窗了
e.Form.Controls("add").Enabled = True
e.Form.Controls("bq").Enabled = True
For Each l As Col In tb1.Cols
MessageBox.show(tb1.Current(l.Name))
Next