123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287 |
- Imports System.Data.SqlClient
- Public Class Frm_WB_Container
- Dim cmd As New SqlCommand
- Dim da As New SqlDataAdapter
- Dim dt As New DataTable
- Dim sql As String
- Private Const CP_UTF8 = 65001
-
-
- Private Sub Label3_Click(sender As Object, e As EventArgs) Handles Label3.Click
-
- End Sub
-
- Private Sub Label7_Click(sender As Object, e As EventArgs) Handles Label7.Click
-
- End Sub
-
- Private Sub FrmWB_Pur_Load(sender As Object, e As EventArgs) Handles MyBase.Load
-
-
- Dim conn As New SqlConnection
-
- ' connstring = "Data Source=127.0.0.1;Persist Security Info=True;User ID=sa;Password=Lafayette11;Initial Catalog=maindb_hy2014"
- conn.ConnectionString = connstring
- conn.Open()
-
-
- Dim conn1 As New SqlConnection
- conn1.ConnectionString = connstring
- conn1.Open()
-
-
- Dim cmd1 As New SqlCommand
-
- cmd1.Connection = conn1
-
-
- cmd.Connection = conn
-
-
- sql = "SELECT supplier as 供应商,contract as 合约号,source as 皮源,c_qty as 柜数,price as 单价,weight as 装船重,c_no as 货柜号 FROM RT_wetblue_arrival"
- cmd.CommandText = Sql
-
- da.SelectCommand = cmd
- da.Fill(dt)
-
-
-
-
- Dim p() As String
-
- For x As Integer = 0 To dt.Rows.Count - 1
-
-
- p = Split(dt.Rows(x).Item("货柜号"), " ")
-
-
- Dim my_ctn As String = ""
-
-
- For y As Integer = 0 To UBound(p)
-
-
-
-
- Dim my_ctn1 As String = ""
- Dim q() As String
- Dim my_string As String
-
- q = Split(p(y), "/")
-
- If UBound(q) > 0 Then
-
- For z As Integer = 0 To UBound(q) - 1
-
-
-
-
-
-
-
- Next
-
-
- End If
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- If y = UBound(p) Then
- my_ctn = my_ctn & p(y)
-
- Else
- my_ctn = my_ctn & p(y) & ","
-
- End If
-
-
-
- Next
-
-
-
-
-
- sql = "update rt_wetblue_arrival set c_no_new='" & my_ctn & "' where c_no='" & dt.Rows(x).Item("货柜号") & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
-
-
-
-
- Next
-
-
-
-
-
-
-
-
-
-
-
-
-
- 'Dim p() As String
-
- 'For x As Integer = 0 To dt.Rows.Count - 1
-
-
- ' p = Split(dt.Rows(x).Item("pre"), " ")
-
-
- ' dt.Rows(x).Item("pre") = p(0)
-
-
-
-
-
-
- 'Next
-
-
-
-
-
-
-
-
-
-
-
-
- dgv1.DataSource = dt
-
-
-
-
-
-
-
-
-
-
-
- 'For x As Integer = 0 To dgv1.Rows.Count - 1
-
-
- ' If IsNumeric(dgv1.Rows(x).Cells("emp").Value) Then
-
-
- ' dgv1.Rows(x).DefaultCellStyle.BackColor = Color.LavenderBlush
- ' End If
-
-
- 'Next x
-
-
-
-
-
-
- dgv1.Columns(0).Width = 80
- dgv1.Columns(1).Width = 120
- dgv1.Columns(2).Width = 210
- 'dgv1.Columns(3).Width = 60
- 'dgv1.Columns(4).Width = 60
- 'dgv1.Columns(5).Width = 130
- 'dgv1.Columns(6).Width = 130
- 'dgv1.Columns(7).Width = 80
- 'dgv1.Columns(9).Width = 200
-
-
-
-
- ' dgv1.Columns(7).Visible = False
-
- sql = "delete from rt_wb_source"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- dt = New DataTable
- sql = "SELECT supplier as 供应商,contract as 合约号,source as 皮源,price as 单价,weight as 装船重,c1 as 货柜号 FROM RT_wetblue_arrival"
- cmd.CommandText = sql
-
- da.SelectCommand = cmd
- da.Fill(dt)
-
-
-
-
-
- For x As Integer = 0 To dt.Rows.Count - 1
-
- Dim my_c_no() As String
-
- my_c_no = Split(dt.Rows(x).Item("货柜号").ToString, ",")
-
- Dim my_name As String
-
-
- If dt.Rows(x).Item("皮源") Like "*美国身*" Then
-
-
- my_name = dt.Rows(x).Item("货柜号")
-
- End If
-
-
-
- For y As Integer = 0 To UBound(my_c_no)
- sql = "insert into rt_wb_source (supplier,contract,source,price,weight,c_no) values
- (N'" & dt.Rows(x).Item("供应商") & "',N'" & dt.Rows(x).Item("合约号") & "',N'" & dt.Rows(x).Item("皮源") & "','" & dt.Rows(x).Item("单价") & "','" & dt.Rows(x).Item("装船重") & "',N'" & my_c_no(y) & "')"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- Next
-
-
-
-
-
-
-
- Next
- MsgBox("")
-
-
- End Sub
-
-
-
-
- Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
-
- Dim dt As New DataTable
- sql = "SELECT DISTINCT company, contract_no, source, qty, price, ship_date, arrive_date, weight, ctn_no FROM RT_WB_purchase where ctn_no like '%" & TextBox3.Text & "%'"
- cmd.CommandText = sql
-
- da.SelectCommand = cmd
- da.Fill(dt)
- dgv1.DataSource = dt
-
-
-
- End Sub
-
- Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click
-
-
- End Sub
- End Class
|