老师,您好,我有一个DataColchanging的事件出现了问题, 我要实现的工作是,在WO列输入某工单号后,系统自动在当前表内实现筛选, 但却发现执行到下面黄色背景行时却没有执行, 不知道怎么回事, 能帮我看一下是什么原因吗? 谢谢!
Dim dr As DataRow = e.DataRow
Dim cn As String = e.DataCol.Name
If Not DataTables.Contains("WorkOrderStatus") Then
DataTables.Load("WorkOrderStatus")
End If
If Not DataTables.Contains("Production_List") Then
DataTables.Load("Production_List")
End If
Select Case cn
Case "WO"
Dim wo As String = e.NewValue
Dim sn As Integer
If isnumeric(wo) Then
sn = wo
If len(sn) <= 5 Then
wo = "IWO" & Right("00000" & sn, 5) & "/1"
Else
wo = "IWO" & Right("000000" & sn, 6) & "/1"
End If
Else
If Not wo.Contains("/") Then
wo = wo & "/1"
Else
wo = e.NewValue
End If
End If
SystemReady = False
e.NewValue = wo
Dim dr1a As DataRow = DataTables("WorkOrderStatus").SQLFind("WO='" & wo & "'")
If dr1a IsNot Nothing Then
dr("PartNumber") = dr1a("PartNumber") '程序运行到此一切正常
Else
dr("PartNumber") = ""
End If
If dr.IsNull("Date") Then dr("Date") = Date.Now
'到了此处发现没有运行,我用Messagebox.show(1111)就是用于验证确认的
MessageBox.Show(1111)
'筛选写入的工单号对应行信息
MessageBox.Show(wo)
DataTables("IDR").LoadFilter = "WO='" & wo & "'"
DataTables("IDR").Load
'下方工单状态信息刷新
DataTables("WorkOrderStatus").LoadFilter = "WO='" & wo & "'"
DataTables("WorkOrderStatus").Load
DataTables("Production_List").LoadFilter = "WO='" & wo & "'"
DataTables("Production_List").Load
Tables("IDR_Table2").sort = "OP"
Tables("IDR_Table3").sort = "OP"
Dim PN As String = dr("PartNumber")
'工程师信息确认
If Not DataTables.Contains("PartList") Then
DataTables.Load("PartList")
End If
MessageBox.Show(PN)
Dim dr3 As DataRow = DataTables("PartList").SQLFind("PartNumber='" & PN & "'")
If dr3 IsNot Nothing Then
'dr("ME") = dr3("ME")
If dr.IsNull("QE") Then
dr("QE") = dr3("QE")
End If
End If
'打开图片
Dim Pbx As WinForm.PictureBox
If Forms("IDR").Opened Then
pbx = Forms("IDR").Controls("PictureBox1")
ElseIf Forms("ProductionIssue").Opened Then
Pbx = Forms("ProductionIssue").Controls("PictureBox1")
End If
Dim fpf As String
Dim fp As String = "P:\General documents\Setup\Pic\" '\\freenas01chi\Production\General documents\Setup\Pic\
fpf = fp & PN & ".jpg"
If FileSys.FileExists(fpf) = False Then
fp = "T:\ME\ME Documentation\Picture\" '\\domain.pragon\china\ME\ME Documentation\Picture\" & PN & ".jpg"
fpf = fp & PN & ".jpg"
If FileSys.FileExists(fpf) = False Then
fpf = "P:\General documents\Setup\Pic\Error.jpg"
End If
End If
pbx.ImageFile = fpf
pbx.SizeMode = ImageSizeMode.Zoom
Case "OP"
Dim wo As String = dr("WO")
Dim op As Integer = e.NewValue
Dim dr1 As DataRow = DataTables("WorkOrderStatus").sqlFind("WO='" & wo & "' and OP =" & op)
If dr1 IsNot Nothing Then
dr("ResID") = dr1("ResID")
'dr("WOQty") = dr1("ESTQTY_IN")
'dr("ProductDeliveryDate") = dr1("DeliveryDate")
End If
If Not dr.IsNull("ResID") Then
Dim dr2 As DataRow = DataTables("ResourceID").Find("ResID = '" & dr("ResID") & "'")
If dr2("适用于标准化后的班组名称") = "QC" Then
dr("ProblemLocation") = "QC I&I"
Else
dr("ProblemLocation") = dr2("适用于标准化后的班组名称")
End If
End If
Case "ResourceID"
If dr.IsNull("ProblemLocation") Then
Dim Res As String = dr("ResID")
Dim dr1 As DataRow = DataTables("ResourceID").Find("ResourceID='" & Res & "'")
If dr1 IsNot Nothing Then
If dr1("适用于标准化后的班组名称") = "QC" Then
dr("ProblemLocation") = "QC I&I"
Else
dr("DataSource") = dr1("适用于标准化后的班组名称")
End If
End If
End If
Case "Disposition_Machining"
Dim dr2a As DataRow = DataTables("Data").Find("CostProcess = '机加工'")
dr("ReworkCost_Maching") = round2(dr2a("CostProcess_PerHour") * e.NewValue / 60, 1)
dr("ReworkCost") = dr("ReworkCost_Maching") + dr("ReworkCost_SecondaryProcess") + dr("ReworkCost_QC")
dr("SubtotalCost") = dr("RMCost") + dr("LaborCost") + dr("BurdenCost") + dr("OutSourcingCost") + dr("ReworkCost") + dr("OtherCost")
Case "Disposition_SecondaryProcess"
Dim dr2b As DataRow = DataTables("Data").Find("CostProcess = '后处理'")
dr("ReworkCost_SecondaryProcess") = round2(dr2b("CostProcess_PerHour") * e.NewValue / 60, 1)
dr("ReworkCost") = dr("ReworkCost_Maching") + dr("ReworkCost_SecondaryProcess") + dr("ReworkCost_QC")
dr("SubtotalCost") = dr("RMCost") + dr("LaborCost") + dr("BurdenCost") + dr("OutSourcingCost") + dr("ReworkCost") + dr("OtherCost")
Case "Disposition_QC"
Dim dr2c As DataRow = DataTables("Data").Find("CostProcess = 'QC'")
dr("ReworkCost_QC") = round2(dr2c("CostProcess_PerHour") * e.NewValue / 60, 2)
dr("ReworkCost") = dr("ReworkCost_Maching") + dr("ReworkCost_SecondaryProcess") + dr("ReworkCost_QC")
dr("SubtotalCost")=dr("RMCost")+dr("LaborCost")+dr("BurdenCost")+dr("OutSourcingCost")+dr("ReworkCost")+dr("OtherCost")
Case "OtherCost"
dr("SubtotalCost") = dr("RMCost") + dr("LaborCost") + dr("BurdenCost") + dr("OutSourcingCost") + dr("ReworkCost") + e.NewValue
End Select
SystemReady = True
[此贴子已经被作者于2024/1/3 15:54:48编辑过]