汗
If e.Selected Then '如果选择了值
Dim tbl As Table = Tables("rkdrop_Table1")
If tbl.Current Is Nothing Then Return
Dim bh As String = tbl.Current("hh") '将要做订单的商品的货号
Dim sdr As DataRow = DataTables("sp").Find("hh = '" & bh & "'") '该商品在sp表中的对应记录
If sdr Is Nothing Then Return
Dim fws As String = sdr("jyfwsx") 'sp对应记录的jyfwsx
If DataTables("bqyzz").DataRows.Count = 0 Then Return
Dim fwq As String = DataTables("bqyzz").DataRows(0)("jyfwlb") '本企业的经营范围
If Tables("cgdmxb").Current Is Nothing Then Return
Dim gdr As DataRow = Tables("cgdmxb").Current.DataRow. GetParentRow("cgddb") '采购订单明细表的对应父行
Dim ghm As String = gdr("ghs") 'cgddb中的对应行的ghs列
Dim hdr As DataRow = DataTables("ghszz").Find("ghsmc = '" & ghm & "'")
If hdr Is Nothing Then Return
Dim fwg As String = hdr("jyfwlb")
If Tables("cgddb.cgdmxb").Current IsNot Nothing Then
If tbl.Current("kz") = True Then
MessageBox.Show("该商品批准证明文件资质已过期,暂停采购计划!","提示", MessageBoxButtons.Ok, MessageBoxIcon.warning)
e.Form.DropDownBox.Value = ""
Tables("cgddb.cgdmxb").Current("hh") = ""
Tables("cgddb.cgdmxb").Current("pm") = ""
Tables("cgddb.cgdmxb").Current("sccj") = ""
Tables("cgddb.cgdmxb").Current("gg") = ""
Tables("cgddb.cgdmxb").Current("dw") = ""
ElseIf fwq.contains( fws ) = False OrElse fwg.contains(fws) = False Then
MessageBox.show("购销双方或单方不具备经营该商品的范围条件!")
e.Form.DropDownBox.Value = ""
Tables("cgddb.cgdmxb").Current("hh") = ""
Tables("cgddb.cgdmxb").Current("pm") = ""
Tables("cgddb.cgdmxb").Current("sccj") = ""
Tables("cgddb.cgdmxb").Current("gg") = ""
Tables("cgddb.cgdmxb").Current("dw") = ""
Else
e.Form.DropDownBox.Value = tbl.Current("pmzjm")
Tables("cgddb.cgdmxb").Current("hh") = tbl.Current("hh")
Tables("cgddb.cgdmxb").Current("pm") = tbl.Current("pm")
Tables("cgddb.cgdmxb").Current("sccj") = tbl.Current("sccj")
Tables("cgddb.cgdmxb").Current("gg") = tbl.Current("gg")
Tables("cgddb.cgdmxb").Current("dw") = tbl.Current("dw")
End If
e.Form.DropDownBox.CloseDropDown()
End If
End If