Dim Book As New XLS.Book(ProjectPath & "Attachments\\trading shipping mark.xlsx")
Dim fl As String = ProjectPath & "trading\\"&Tables("packinglist_t").current("shippingNo")&"\\Box\\"& "ShippingNo_"& Tables("packinglist_t").current("shippingNo") & " BoxNo_" &Tables("packinglist_t").current("boxno") & ".xlsx"
Dim Result As DialogResult
Dim Proc As New Process \'打开工作簿
Dim r1 As Row = Nothing
Dim cn1 As Integer = 0
Dim cn2 As Double = 0
Dim cn3 As Double = 0
For i As Integer = 0 To Tables("packinglist_t").Rows.Count - 1
Dim r As Row = Tables("packinglist_t").Rows(i)
If r("boxno") = r.Table.current("boxno") AndAlso (r1 Is Nothing OrElse r("ShippingNo") & r("BoxNo") <> r1("ShippingNo") & r1("BoxNo"))
cn1 += 1
cn2 += r("Volume_CBM")
cn3 += r("Gross_weight")
r1 = r
End If
Next
vars("总箱数") = cn1
vars("总立方") = cn2
vars("总毛重") = cn3
Dim Sheet As XLS.Sheet = Book.Sheets(0)
If Tables("packinglist_t").current("boxno") = Nothing
sheet(5,14).value = "<BoxNo is null and (customer <> \'CWA\' or customer is null)>" \'客户不是CWA才打印
Else
sheet(5,14).value = "<BoxNo=\'" & Tables("packinglist_t").current("boxno") & "\' and (customer <> \'CWA\' or customer is null)>" \'客户不是CWA才打印
End If
Book.Build() \'生成细节区
sheet = Book.Sheets(0)
If FileSys.FileExists(ProjectPath & "trading\\"&Tables("packinglist_t").current("shippingNo")&"\\Box\\"& "ShippingNo_"& Tables("packinglist_t").current("shippingNo") & " BoxNo_" &Tables("packinglist_t").current("boxno") & ".xlsx") Then
Result = Messagebox.Show(Tables("packinglist_t").current("shippingNo") & " BoxNo_" &Tables("packinglist_t").current("boxno") & ".xlsx"&" 文件已经存在,是否要覆盖?","提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If Result = DialogResult.Yes Then
Book.Save(fl) \'保存工作簿
Proc.File = fl
Proc.Start()
End If
Else
Book.Save(fl) \'保存工作簿
Proc.File = fl
Proc.Start()
End If
Tables("Packinglist_t").current.locked = True