If dlg.ShowDialog = DialogResult.Ok Then '如果用户单击了确定按钮
Dim app As new msexcel.application
Dim wb As msexcel.workbook = app.workbooks.open(dlg.filename)
Dim ws1 As msexcel.worksheet = wb.worksheets(1)
Dim rg1 As msexcel.range=ws1.usedrange
Dim ary1 =rg1.value
Tables("中外运理货表").stopRedraw()
For n1 As Integer=3 To rg1.Rows.count
Dim ra1 As DataRow =DataTables("中外运理货表").addnew()
ra1("操作_导入批次")= pc
ra1("操作_状态")= "理货前-新增"
ra1("规格")=ary1(n1, 6)
ra1("货号")=ary1(n1,4)
ra1("理货结果_缠绕膜")=ary1(n1,34)
ra1("理货结果_长")=ary1(n1,27)
ra1("理货结果_点货数量")=ary1(n1,21)
ra1("理货结果_高")=ary1(n1,29)
ra1("理货结果_净重")=ary1(n1,30)
ra1("理货结果_库位")= ary1(n1,26)
ra1("理货结果_宽")= ary1(n1,28)
ra1("理货结果_破损表述")= ary1(n1,24)
ra1("理货结果_气泡柱")= ary1(n1,33)
ra1("理货结果_日期")= ary1(n1,22)
ra1("理货结果_实际撕标数量")= ary1(n1,31)
ra1("理货结果_实际贴标数量")= ary1(n1,32)
ra1("理货结果_条形码")= ary1(n1,20)
ra1("理货结果_托盘号")= ary1(n1,25)
ra1("理货结果_性质")= ary1(n1,23)
ra1("理货中_WMS中匹配条码")= ary1(n1,10)
ra1("理货中_缠绕膜")= ary1(n1,19)
ra1("理货中_长")= ary1(n1,12)
ra1("理货中_二维码贴标")= ary1(n1,16)
ra1("理货中_高")= ary1(n1,14)
ra1("理货中_净重")= ary1(n1,15)
ra1("理货中_宽")= ary1(n1,13)
ra1("理货中_气泡柱")= ary1(n1,18)
ra1("理货中_实际点数及日期")= ary1(n1,11)
ra1("理货中_撕标")= ary1(n1,17)
Dim pzm As String = ary1(n1,3)
Dim txm As String = ary1(n1,2)
If pzm > "" Then
ra1("理论PZ码")= pzm.trimstart("p", "z", "n")
Else
ra1("理论PZ码")= ""
End If
If txm > "" Then
ra1("理论条形码")= txm.trimstart("p", "z", "n")
Else
ra1("理论条形码")= ""
End If
ra1("理论净重")= ary1(n1,9)
ra1("理论日期")= ary1(n1,8)
ra1("理论入库数据")= ary1(n1,7)
ra1("日志_导入人")= user.name
ra1("日志_导入时间")= ct
ra1("项号")= ary1(n1,1)
ra1("中文品名")= ary1(n1,5)
ra1.locked=True
ra1.save