12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238 |
- Imports System.Data.SqlClient
- Imports System.Net
- Imports Microsoft.Office.Interop
- Public Class Frm_BG_main
- Dim cmd As New SqlCommand
- Dim da As New SqlDataAdapter
- Dim my_year111 As Integer
- Dim my_month111 As Integer
- 'Dim my_year As Integer
-
- Dim sql As String
- Dim conn As New SqlConnection
- Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click
- Frm_wb_out.Show()
- End Sub
-
- Private Sub Button13_Click(sender As Object, e As EventArgs) Handles Button13.Click
- Frm_Stock_Month.Show()
-
- End Sub
-
- Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
- Frm_BG_PROCESS.Show()
-
- End Sub
-
- Private Sub Button9_Click(sender As Object, e As EventArgs) Handles Button9.Click
- Frm_BG_Record.Show()
- End Sub
-
- Private Sub Button19_Click(sender As Object, e As EventArgs) Handles Button19.Click
- Frm_Ship_detail.Show()
-
- End Sub
-
- Private Sub Button20_Click(sender As Object, e As EventArgs) Handles Button20.Click
- Frm_BG_IN_SUM.Show()
-
- End Sub
-
- Private Sub Button21_Click(sender As Object, e As EventArgs) Handles Button21.Click
- Frm_BG_OUT_SUM.Show()
- End Sub
-
- Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
- Frm_bg_chem_out_daily.Show()
-
- End Sub
-
- Private Sub Button22_Click(sender As Object, e As EventArgs) Handles Button22.Click '---每日发货
-
- Dim xlApp As Microsoft.Office.Interop.Excel.Application
- Dim xlBook As Microsoft.Office.Interop.Excel.Workbook
- Dim xlSheet As Microsoft.Office.Interop.Excel.Worksheet
-
- Dim name(1000) As String
- Dim no(1000) As String
- Dim SERIAL(1000) As String
- Dim YEAR1(1000) As String
- Dim MONTH1(1000) As String
- Dim DATE1(1000) As String
- Dim COMMENT(1000) As String
- Dim qty(1000) As Double
- Dim QTY1(1000) As Double
- Dim po_no(1000) As String
- Dim sku_no(1000) As String
- Dim nw(1000) As Double
- Dim gw(1000) As Double
- Dim price(1000) As Double
-
-
- Dim dt As New DataTable
- Dim file_name As String = ""
- Dim file_name1 As String = ""
-
-
- ListBox1.Items.Clear()
-
-
-
- Dim a As Integer = 0
- Dim my_count As Integer = 0
- 'OpenFileDialog1.Multiselect = True
- If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
-
- file_name = OpenFileDialog1.FileName
- file_name1 = OpenFileDialog1.SafeFileName
-
- End If
-
-
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
-
- 'sql = "delete from rt_bg_io"
- 'cmd.CommandText = sql
- 'cmd.ExecuteNonQuery()
-
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
-
-
-
-
- Dim yy As Integer = 0
-
-
-
-
-
-
-
-
- ListBox1.Items.Add(file_name)
-
-
- Dim my_customer As String = ""
-
- If OpenFileDialog1.SafeFileName Like "越南上杰发货*" Then
-
- ElseIf OpenFileDialog1.SafeFileName Like "上杰*" Then '-----------上杰
-
-
- sql = "delete from rt_ship_daily_sj"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- xlSheet = xlApp.Workbooks(1).Worksheets(1)
-
- Dim y As Integer = 0
- For y = 14 To xlApp.Workbooks(1).Worksheets(1).UsedRange.Rows.Count
-
- If Len(xlSheet.Cells(y, 2).value) < 1 Then
- Exit For
- End If
-
- Next y
-
-
- xlApp.Range("A14:N" & y - 1).Select()
- ' If xlApp.Selection.mergecells = True Then
- xlApp.Selection.UnMerge
- xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- xlApp.CutCopyMode = False
- xlApp.Selection.FormulaR1C1 = "=R[-1]C"
-
- ' End If
-
-
- For y = 14 To y - 1
-
- sql = "insert into rt_ship_daily_sj (no,name,qty_sf,nw,gw,po_no,qty_sf1,unit_price) values('" & xlSheet.Cells(y, 1).value & "',N'" & xlSheet.Cells(y, 2).value & "'," & xlSheet.Cells(y, 3).value & "," & xlSheet.Cells(y, 5).value & "," & xlSheet.Cells(y, 6).value & ",'" & xlSheet.Cells(y, 7).value & "'," & xlSheet.Cells(y, 9).value & "," & xlSheet.Cells(y, 10).value & ")"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
-
-
- Next
-
-
- sql = "select 品名,cast(sum(淨重) as numeric(10,1)) as 淨重 from (select case when 品名 like '%PU%' or 品名 like '%action%' or 品名 like N'%榔%' then 'pu' else '反毛' end as 品名,淨重 from (select name as 品名,sum(weight) as 淨重 from (SELECT no, name, qty_sf1, nw,qty_sf1/SUM(qty_sf1) OVER (PARTITION BY no) AS Ratio, cast(qty_sf1/SUM(qty_sf1) OVER (PARTITION BY no) *nw as numeric(10,3)) as weight FROM rt_ship_daily_sj) as p group by name) as q ) as qq group by 品名"
-
- cmd.CommandText = sql
- dt = New DataTable
- da.SelectCommand = cmd
- da.Fill(dt)
-
-
- dt.Columns.Add("尺数")
- dt.Columns.Add("货值")
-
-
-
- For rr As Integer = 0 To dt.Rows.Count - 1
-
- sql = "SELECT CAST(SUM(qty_sf1) AS numeric(10, 1)) AS 呎數 FROM (SELECT DISTINCT no, name, CASE WHEN name LIKE '%PU%' OR name LIKE '%action%' OR name LIKE N'%榔%' THEN 'pu' ELSE '反毛' END AS 品名, qty_sf, unit, nw, gw, po_no, po_serial, qty_sf1, sku_no, order_month, supplier, type, unit_price, cbm FROM rt_ship_daily_sj) AS p
- GROUP BY 品名 having 品名=N'" & dt.Rows(rr).Item("品名") & "'"
- cmd.CommandText = sql
-
- dt.Rows(rr).Item("尺数") = cmd.ExecuteScalar
-
-
- Next
-
-
-
- For rr As Integer = 0 To dt.Rows.Count - 1
-
- sql = "SELECT CAST(SUM(qty_sf1 * unit_price) AS numeric(10, 3)) AS 金額 FROM (SELECT DISTINCT no, name, CASE WHEN name LIKE '%PU%' OR name LIKE '%action%' OR name LIKE N'%榔%' THEN 'pu' ELSE '反毛' END AS 品名, qty_sf, unit, nw, gw, po_no, po_serial, qty_sf1, sku_no, order_month, supplier, type, unit_price, cbm FROM rt_ship_daily_sj) AS p
- GROUP BY 品名 having 品名=N'" & dt.Rows(rr).Item("品名") & "'"
- cmd.CommandText = sql
-
- dt.Rows(rr).Item("货值") = cmd.ExecuteScalar
-
-
- Next
- dgv1.DataSource = dt
-
-
-
-
-
-
-
-
-
-
-
- ElseIf OpenFileDialog1.SafeFileName Like "永正货柜*" Then '-----------永正
-
-
- sql = "delete from rt_ship_uz_HG"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- xlSheet = xlApp.Workbooks(1).Worksheets(1)
-
- Dim y As Integer = 0
- For y = 14 To xlApp.Workbooks(1).Worksheets(1).UsedRange.Rows.Count
-
- If Len(xlSheet.Cells(y, 2).value) < 1 Then
- Exit For
- End If
-
- Next y
-
-
- xlApp.Range("A14:N" & y - 1).Select()
- If xlApp.Selection.mergecells = True Then
-
-
- xlApp.Selection.UnMerge
- xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- xlApp.CutCopyMode = False
- xlApp.Selection.FormulaR1C1 = "=R[-1]C"
- End If
-
-
- For y = 14 To y - 1
-
- sql = "insert into rt_ship_uz_HG (no,name,qty_sf,nw,gw,po_no,qty_sf1,unit_price) values('" & xlSheet.Cells(y, 1).value & "',N'" & xlSheet.Cells(y, 2).value & "'," & xlSheet.Cells(y, 3).value & "," & xlSheet.Cells(y, 3).value * 0.1 & ",0,'" & xlSheet.Cells(y, 6).value & "'," & xlSheet.Cells(y, 8).value & ",0)"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
-
-
- Next
-
-
- sql = "select 品名,cast(sum(淨重) as numeric(10,1)) as 淨重 from (select case when 品名 like '%PU%' or 品名 like '%action%' or 品名 like N'%榔%' then 'pu' else '反毛' end as 品名,淨重 from (select name as 品名,sum(weight) as 淨重 from (SELECT no, name, qty_sf1, nw,qty_sf1/SUM(qty_sf1) OVER (PARTITION BY no) AS Ratio, cast(qty_sf1/SUM(qty_sf1) OVER (PARTITION BY no) *nw as numeric(10,3)) as weight FROM RT_Ship_UZ_HG) as p group by name) as q ) as qq group by 品名"
-
- cmd.CommandText = sql
- dt = New DataTable
- da.SelectCommand = cmd
- da.Fill(dt)
-
-
- dt.Columns.Add("尺数")
- dt.Columns.Add("货值")
-
-
-
- For rr As Integer = 0 To dt.Rows.Count - 1
-
- sql = "SELECT CAST(SUM(qty_sf1) AS numeric(10, 1)) AS 呎數 FROM (SELECT DISTINCT no, name, CASE WHEN name LIKE '%PU%' OR name LIKE '%action%' OR name LIKE N'%榔%' THEN 'pu' ELSE '反毛' END AS 品名, qty_sf, unit, nw, gw, po_no, po_serial, qty_sf1, sku_no, order_month, supplier, type, unit_price, cbm FROM RT_Ship_UZ_HG) AS p
- GROUP BY 品名 having 品名=N'" & dt.Rows(rr).Item("品名") & "'"
- cmd.CommandText = sql
-
- dt.Rows(rr).Item("尺数") = cmd.ExecuteScalar
-
-
- Next
-
-
-
- For rr As Integer = 0 To dt.Rows.Count - 1
-
- sql = "SELECT CAST(SUM(qty_sf1 * unit_price) AS numeric(10, 3)) AS 金額 FROM (SELECT DISTINCT no, name, CASE WHEN name LIKE '%PU%' OR name LIKE '%action%' OR name LIKE N'%榔%' THEN 'pu' ELSE '反毛' END AS 品名, qty_sf, unit, nw, gw, po_no, po_serial, qty_sf1, sku_no, order_month, supplier, type, unit_price, cbm FROM RT_Ship_UZ_HG) AS p
- GROUP BY 品名 having 品名=N'" & dt.Rows(rr).Item("品名") & "'"
- cmd.CommandText = sql
-
- dt.Rows(rr).Item("货值") = cmd.ExecuteScalar
-
-
- Next
- dgv1.DataSource = dt
-
-
-
-
-
-
- ElseIf OpenFileDialog1.SafeFileName Like "永正发货*" Then '-----------永正1
-
- sql = "delete from rt_ship_uz_1"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
- xlSheet = xlApp.Workbooks(1).Worksheets(1)
-
- Dim y As Integer = 0
- For y = 14 To xlApp.Workbooks(1).Worksheets(1).UsedRange.Rows.Count
-
- If Len(xlSheet.Cells(y, 2).value) < 1 Then
- Exit For
- End If
-
- Next y
-
- yy = y - 1
- xlApp.Range("A14:O" & yy).Select()
-
- If xlApp.Selection.mergecells = True Then
-
- xlApp.Selection.UnMerge
- xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- xlApp.CutCopyMode = False
- xlApp.Selection.FormulaR1C1 = "=R[-1]C"
- End If
-
- For y = 14 To y - 1
-
- sql = "insert into rt_ship_uz_1 (no,name,qty_sf,nw,gw,po_no,qty_sf1,unit_price) values('" & xlSheet.Cells(y, 1).value & "',N'" & xlSheet.Cells(y, 2).value & "'," & xlSheet.Cells(y, 3).value & "," & xlSheet.Cells(y, 5).value & "," & xlSheet.Cells(y, 6).value & ",'" & xlSheet.Cells(y, 7).value & "'," & xlSheet.Cells(y, 9).value & "," & xlSheet.Cells(y, 14).value & ")"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
-
-
- Next
-
-
- sql = "select 品名,cast(sum(淨重) as numeric(10,1)) as 淨重 from (select case when 品名 like '%PU%' or 品名 like '%action%' or 品名 like N'%榔%' then 'pu' else '反毛' end as 品名,淨重 from (select name as 品名,sum(weight) as 淨重 from (SELECT no, name, qty_sf1, nw,qty_sf1/SUM(qty_sf1) OVER (PARTITION BY no) AS Ratio, cast(qty_sf1/SUM(qty_sf1) OVER (PARTITION BY no) *nw as numeric(10,3)) as weight FROM RT_Ship_UZ_1) as p group by name) as q ) as qq group by 品名"
-
- cmd.CommandText = sql
- dt = New DataTable
- da.SelectCommand = cmd
- da.Fill(dt)
-
-
- dt.Columns.Add("尺数")
- dt.Columns.Add("货值")
-
-
-
- For rr As Integer = 0 To dt.Rows.Count - 1
-
- sql = "SELECT CAST(SUM(qty_sf1) AS numeric(10, 1)) AS 呎數 FROM (SELECT DISTINCT no, name, CASE WHEN name LIKE '%PU%' OR name LIKE '%action%' OR name LIKE N'%榔%' THEN 'pu' ELSE '反毛' END AS 品名, qty_sf, unit, nw, gw, po_no, po_serial, qty_sf1, sku_no, order_month, supplier, type, unit_price, cbm FROM RT_Ship_UZ_1) AS p
- GROUP BY 品名 having 品名=N'" & dt.Rows(rr).Item("品名") & "'"
- cmd.CommandText = sql
-
- dt.Rows(rr).Item("尺数") = cmd.ExecuteScalar
-
-
- Next
-
-
-
- For rr As Integer = 0 To dt.Rows.Count - 1
-
- sql = "SELECT CAST(SUM(qty_sf1 * unit_price) AS numeric(10, 3)) AS 金額 FROM (SELECT DISTINCT no, name, CASE WHEN name LIKE '%PU%' OR name LIKE '%action%' OR name LIKE N'%榔%' THEN 'pu' ELSE '反毛' END AS 品名, qty_sf, unit, nw, gw, po_no, po_serial, qty_sf1, sku_no, order_month, supplier, type, unit_price, cbm FROM RT_Ship_UZ_1) AS p
- GROUP BY 品名 having 品名=N'" & dt.Rows(rr).Item("品名") & "'"
- cmd.CommandText = sql
-
- dt.Rows(rr).Item("货值") = cmd.ExecuteScalar
-
-
- Next
- dgv1.DataSource = dt
-
- ElseIf OpenFileDialog1.SafeFileName Like "永川*" Then
- ElseIf OpenFileDialog1.SafeFileName Like "亿博*" Then
-
-
- sql = "delete from rt_ship_daily_yb"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- For i = 1 To xlApp.Worksheets.Count
-
-
- If xlApp.Workbooks(1).Worksheets(i).name = "1" Then
- xlSheet = xlApp.Workbooks(1).Worksheets(i)
- xlSheet.Activate()
- Exit For
- End If
-
-
-
- Next
-
-
-
-
-
-
- Dim y As Integer = 0
- For y = 2 To xlApp.ActiveSheet.UsedRange.Rows.Count
-
- If Len(xlSheet.Cells(y, 9).value) < 1 Then
- Exit For
- End If
-
- Next y
-
-
- xlApp.Range("A2:i" & y - 1).Select()
- If xlApp.Selection.mergecells = True Then
-
- xlApp.Selection.UnMerge
-
-
- xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- xlApp.CutCopyMode = False
- xlApp.Selection.FormulaR1C1 = "=R[-1]C"
-
- End If
-
- For y = 2 To y - 1
-
- sql = "insert into rt_ship_daily_yb (no,name,qty,nw,gw,po_no) values('" & xlSheet.Cells(y, 1).value & "',N'" & xlSheet.Cells(y, 2).value & "'," & xlSheet.Cells(y, 3).value & "," & xlSheet.Cells(y, 5).value & "," & xlSheet.Cells(y, 6).value & ",N'" & xlSheet.Cells(y, 7).value & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
-
-
- Next
-
-
- sql = "select 订单号,cast(sum(数量) as numeric(10,1)) as 尺数,sum(重量) as 净重,厚度 from (SELECT po_no as 订单号,name as 品名, qty as 数量,cast(qty/SUM(qty) OVER (PARTITION BY no) *nw as numeric(10,1)) as 重量,case when left(ltrim(name),3)='1.2' then left(ltrim(name),3) +'4' else '1.46' end as 厚度
- FROM RT_SHIP_DAILY_YB ) as p group by 订单号,厚度"
-
- cmd.CommandText = sql
- dt = New DataTable
- da.SelectCommand = cmd
- da.Fill(dt)
-
- dgv1.DataSource = dt
-
-
-
-
- sql = "select 订单号,类别,cast(sum(数量) as numeric(10,1)) as 尺数,sum(重量) as 净重,厚度 from (SELECT po_no as 订单号,name as 品名,case when name like '%PU%' or name like '%action%' or name like N'%榔%' or name like N'%virgin%' then 'PU' else '反毛' end as 类别, qty as 数量,cast(qty/SUM(qty) OVER (PARTITION BY no) *nw as numeric(10,1)) as 重量,case when left(ltrim(name),3)='1.2' then left(ltrim(name),3) +'4' else '1.46' end as 厚度
- FROM RT_SHIP_DAILY_YB) as p group by 订单号,类别,厚度"
-
- cmd.CommandText = sql
- dt = New DataTable
- da.SelectCommand = cmd
- da.Fill(dt)
-
-
- dgv2.DataSource = dt
-
-
- sql = "select 类别,sum(尺数),sum(净重) from (select 订单号,类别,cast(sum(数量) as numeric(10,1)) as 尺数,sum(重量) as 净重,厚度 from (SELECT po_no as 订单号,name as 品名,case when name like '%PU%' or name like '%action%' or name like N'%榔%' or name like N'%virgin%' then 'PU' else '反毛' end as 类别, qty as 数量,cast(qty/SUM(qty) OVER (PARTITION BY no) *nw as numeric(10,1)) as 重量,case when left(ltrim(name),3)='1.2' then left(ltrim(name),3) +'4' else '1.46' end as 厚度
- FROM RT_SHIP_DAILY_YB) as p group by 订单号,类别,厚度) as q group by 类别"
-
- cmd.CommandText = sql
- dt = New DataTable
- da.SelectCommand = cmd
- da.Fill(dt)
-
-
- dgv3.DataSource = dt
-
-
-
-
- ' sql = "select name as 品名,cast(sum(qty_sf) as numeric(10,1)) as 尺数,cast(sum(qty_sf*unit_price) as numeric(10,1)) as 总价,sum(weight) as 淨重 from (SELECT no, name, color, qty_sf, gw1, po_no, unit_price, cast(qty_sf/SUM(qty_sf) OVER (PARTITION BY no) *gw1 as numeric(10,1)) as weight
- 'FROM RT_SHIP_DAILY_PUMA) as p group by name"
-
- ' cmd.CommandText = sql
- ' dt = New DataTable
- ' da.SelectCommand = cmd
- ' da.Fill(dt)
-
-
-
-
-
-
-
-
-
-
- 'sql = ""
-
-
- 'cmd.CommandText = sql
- 'dt = New DataTable
- 'da.SelectCommand = cmd
- 'da.Fill(dt)
-
-
- 'dgv2.DataSource = dt
-
-
-
-
-
-
-
-
-
- ElseIf OpenFileDialog1.SafeFileName Like "加和*" Then
-
-
-
- sql = "delete from rt_ship_daily_jh"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- For i = 1 To xlApp.Worksheets.Count
-
-
- If xlApp.Workbooks(1).Worksheets(i).name = "加和" Then
- xlSheet = xlApp.Workbooks(1).Worksheets(i)
- xlSheet.Activate()
- Exit For
- End If
-
-
-
- Next
-
-
-
-
- Dim y As Integer = 0
- For y = 4 To xlApp.ActiveSheet.UsedRange.Rows.Count
-
- If Len(xlSheet.Cells(y, 5).value) < 1 Then
- Exit For
- End If
-
- Next y
-
-
- xlApp.Range("A4:L" & y - 1).Select()
-
- If xlApp.Selection.mergecells = True Then
- xlApp.Selection.UnMerge
- xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- xlApp.CutCopyMode = False
- xlApp.Selection.FormulaR1C1 = "=R[-1]C"
- End If
-
-
- For y = 4 To y - 1
-
- sql = "insert into rt_ship_daily_jh (no,po_no,m_no,name,thick,color,qty_sf,nw,gw) values('" & xlSheet.Cells(y, 1).value & "',N'" & xlSheet.Cells(y, 2).value & "','" & xlSheet.Cells(y, 4).value & "',N'" & xlSheet.Cells(y, 5).value & "','" & xlSheet.Cells(y, 6).value & "',N'" & xlSheet.Cells(y, 7).value & "'," & xlSheet.Cells(y, 8).value & "," & xlSheet.Cells(y, 11).value & "," & xlSheet.Cells(y, 12).value& & ")"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
-
-
- Next
-
-
- sql = "select po_no as 订单号,m_no as 料号,name as 品名, color as 颜色,thick as 厚度,cast(sum(qty_sf) as numeric(10,1)) as 尺数,cast(sum(weight) as numeric(10,1)) as 净重 from (SELECT no, po_no, no1, m_no, name, ltrim(thick) as thick, color, qty_sf, no2, p, nw, gw,cast(qty_sf/SUM(qty_sf) OVER (PARTITION BY no) *nw as numeric(10,1)) as weight
- FROM RT_SHIP_DAILY_JH) as p group by po_no,m_no,name,color,thick"
-
- cmd.CommandText = sql
- dt = New DataTable
- da.SelectCommand = cmd
- da.Fill(dt)
-
- dgv1.DataSource = dt
-
-
-
-
- sql = "select po_no as 订单号,thick as 厚度,cast(sum(qty_sf) as numeric(10,1)) as 尺数,cast(sum(weight) as numeric(10,1)) as 净重 from (SELECT no, po_no, no1, m_no, name, ltrim(thick) as thick, color, qty_sf, no2, p, nw, gw,cast(qty_sf/SUM(qty_sf) OVER (PARTITION BY no) *nw as numeric(10,1)) as weight
- FROM RT_SHIP_DAILY_JH) as p group by po_no,thick"
-
- cmd.CommandText = sql
- dt = New DataTable
- da.SelectCommand = cmd
- da.Fill(dt)
-
- dgv2.DataSource = dt
-
-
-
-
- sql = "select 品名,thick as 厚度, cast(sum(qty_sf) as numeric(10,1)) as 尺数,sum(weight) as 净重 from (SELECT no, po_no, no1, m_no, name, ltrim(thick) as thick, color, qty_sf, no2, p, nw, gw,cast(qty_sf/SUM(qty_sf) OVER (PARTITION BY no) *nw as numeric(10,1)) as weight,case when name like '%PU%' or name like N'%纹%' or name like '%action%' or name like N'%榔%' then 'pu' else '反毛' end as 品名
- FROM RT_SHIP_DAILY_JH) as p group by 品名,thick"
-
- cmd.CommandText = sql
- dt = New DataTable
- da.SelectCommand = cmd
- da.Fill(dt)
-
-
- dgv3.DataSource = dt
-
-
-
-
-
-
-
-
-
-
- ElseIf OpenFileDialog1.SafeFileName Like "吉兴*" Then
- ElseIf OpenFileDialog1.SafeFileName Like "宏美*" Then
- ElseIf OpenFileDialog1.SafeFileName Like "宏福*" Then
- ElseIf OpenFileDialog1.SafeFileName Like "东治*" Then
- ElseIf OpenFileDialog1.SafeFileName Like "东家*" Then
-
-
- sql = "delete from rt_ship_daily_dj"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- For i = 1 To xlApp.Worksheets.Count
-
-
- If xlApp.Workbooks(1).Worksheets(i).name = "0" Then
- xlSheet = xlApp.Workbooks(1).Worksheets(i)
- xlSheet.Activate()
- Exit For
- End If
-
-
-
- Next
-
-
-
-
-
-
- Dim y As Integer = 0
- For y = 2 To xlApp.ActiveSheet.UsedRange.Rows.Count
-
- If Len(xlSheet.Cells(y, 7).value) < 1 Then
- Exit For
- End If
-
- Next y
-
-
- xlApp.Range("A2:K" & y - 1).Select()
-
-
- xlApp.Selection.UnMerge
-
-
- xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- xlApp.CutCopyMode = False
- xlApp.Selection.FormulaR1C1 = "=R[-1]C"
-
-
-
- For y = 2 To y - 1
-
- sql = "insert into rt_ship_daily_dj (no,name,qty,nw,gw,po_no,unit_price) values('" & xlSheet.Cells(y, 1).value & "',N'" & xlSheet.Cells(y, 2).value & "'," & xlSheet.Cells(y, 3).value & "," & xlSheet.Cells(y, 5).value & "," & xlSheet.Cells(y, 6).value & ",N'" & xlSheet.Cells(y, 7).value & "'," & xlSheet.Cells(y, 10).value & ")"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
-
-
- Next
-
-
- sql = "select 订单号,类别,cast(sum(数量) as numeric(10,1)) as 尺数,cast(sum(数量*单价) as numeric(10,3)) as 货值,sum(重量) as 净重,厚度 from
- (SELECT po_no as 订单号,name as 品名,case when name like '%PU%' or name like '%action%' or name like N'%榔%' or name like N'%virgin%' then 'PU' else '反毛' end as 类别, qty as 数量,
- cast(qty/SUM(qty) OVER (PARTITION BY no) *nw as numeric(10,1)) as 重量,case when left(ltrim(name),3)='1.2' then left(ltrim(name),3) +'4' else '1.46' end as 厚度,unit_price as 单价
- FROM RT_SHIP_DAILY_dj) as p group by 订单号,类别,厚度"
-
- cmd.CommandText = sql
- dt = New DataTable
- da.SelectCommand = cmd
- da.Fill(dt)
-
- dgv1.DataSource = dt
-
-
-
-
- sql = "select 类别,sum(尺数),sum(净重),sum(货值) from(select 订单号,类别,cast(sum(数量) as numeric(10,1)) as 尺数,cast(sum(数量*单价) as numeric(10,3)) as 货值,sum(重量) as 净重,厚度 from (SELECT po_no as 订单号,name as 品名,case when name like '%PU%' or name like '%action%' or name like N'%榔%' or name like N'%virgin%' then 'PU' else '反毛' end as 类别, qty as 数量,cast(qty/SUM(qty) OVER (PARTITION BY no) *nw as numeric(10,1)) as 重量,case when left(ltrim(name),3)='1.2' then left(ltrim(name),3) +'4' else '1.46' end as 厚度,unit_price as 单价 FROM RT_SHIP_DAILY_dj) as p group by 订单号,类别,厚度) as q group by 类别"
-
- cmd.CommandText = sql
- dt = New DataTable
- da.SelectCommand = cmd
- da.Fill(dt)
-
-
- dgv2.DataSource = dt
-
-
-
-
-
-
-
- ' sql = "select name as 品名,cast(sum(qty_sf) as numeric(10,1)) as 尺数,cast(sum(qty_sf*unit_price) as numeric(10,1)) as 总价,sum(weight) as 淨重 from (SELECT no, name, color, qty_sf, gw1, po_no, unit_price, cast(qty_sf/SUM(qty_sf) OVER (PARTITION BY no) *gw1 as numeric(10,1)) as weight
- 'FROM RT_SHIP_DAILY_PUMA) as p group by name"
-
- ' cmd.CommandText = sql
- ' dt = New DataTable
- ' da.SelectCommand = cmd
- ' da.Fill(dt)
-
-
-
-
-
-
-
-
-
-
- 'sql = ""
-
-
- 'cmd.CommandText = sql
- 'dt = New DataTable
- 'da.SelectCommand = cmd
- 'da.Fill(dt)
-
-
- 'dgv2.DataSource = dt
-
-
-
-
-
-
-
- ElseIf OpenFileDialog1.SafeFileName Like "贝孚*" Then
- ElseIf OpenFileDialog1.SafeFileName Like "Samil*" Then
- ElseIf OpenFileDialog1.SafeFileName Like "PUMA*" Then '-----------------PUMA
-
-
-
- Dim conn1 As New SqlConnection
- conn1.ConnectionString = connstring
- conn1.Open()
- Dim cmd1 As New SqlCommand
- cmd1.Connection = conn1
- Dim dr As SqlDataReader
-
-
-
- sql = "delete from rt_ship_daily_puma"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- For i = 1 To xlApp.Worksheets.Count
-
-
- If xlApp.Workbooks(1).Worksheets(i).name = "1" Then
- xlSheet = xlApp.Workbooks(1).Worksheets(i)
- xlSheet.Activate()
- Exit For
- End If
-
-
-
- Next
-
-
-
-
-
-
- Dim y As Integer = 0
- For y = 4 To xlApp.ActiveSheet.UsedRange.Rows.Count
-
- If Len(xlSheet.Cells(y, 2).value) < 1 Then
- Exit For
- End If
-
- Next y
-
-
- xlApp.Range("A4:v" & y - 1).Select()
- If xlApp.Selection.mergecells = True Then
-
- xlApp.Selection.UnMerge
- xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- xlApp.CutCopyMode = False
- xlApp.Selection.FormulaR1C1 = "=R[-1]C"
-
- End If
-
- For y = 4 To y - 1
-
- sql = "insert into rt_ship_daily_puma (no,name,color,qty_sf,gw1,po_no,unit_price) values('" & xlSheet.Cells(y, 1).value & "',N'" & xlSheet.Cells(y, 2).value & "',N'" & xlSheet.Cells(y, 4).value & "'," & xlSheet.Cells(y, 5).value & "," & xlSheet.Cells(y, 12).value & ",N'" & xlSheet.Cells(y, 14).value & "'," & xlSheet.Cells(y, 19).value & ")"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
-
-
- Next
-
-
- sql = "select name as 品名,cast(sum(qty_sf) as numeric(10,1)) as 尺数,cast(sum(qty_sf*unit_price) as numeric(10,2)) as 货值,po_no as 订单号,sum(重量) as 毛重, sum(袋重) as 袋重,sum(重量)-sum(袋重) as 净重 from
- (select no,name,qty_sf,unit_price,po_no,gw1,cast(qty_sf/SUM(qty_sf) OVER (PARTITION BY no) *gw1 as numeric(10,2)) as 重量,cast(pa/SUM(pa) OVER (PARTITION BY no)*0.1 as numeric(10,2)) as 袋重 from
- (select no,name,color,qty_sf,unit_price,po_no,gw1,cast(count as numeric(10,1)) as pa from
- (SELECT no, name,case when name<>'' then 1 end as count, color, qty_sf, gw1, po_no, unit_price, cast(qty_sf/SUM(qty_sf) OVER (PARTITION BY no) *gw1 as numeric(10,1)) as weight
- FROM RT_SHIP_DAILY_PUMA) as r) as s) as t group by name,po_no order by 品名,po_no"
-
- cmd.CommandText = sql
- dt = New DataTable
- da.SelectCommand = cmd
- da.Fill(dt)
-
- dgv1.DataSource = dt
-
-
-
-
- sql = "select 品名,sum(尺数) as 尺数,cast(sum(净重) as numeric(10,1)) as 淨重 from(select case when 品名 like '%PU%' or 品名 like '%action%' or 品名 like N'%榔%' then 'pu' else '反毛' end as 品名,尺数,净重 from
- (select name as 品名,cast(sum(qty_sf) as numeric(10,1)) as 尺数,cast(sum(qty_sf*unit_price) as numeric(10,2)) as 货值,po_no as 订单号,sum(重量) as 毛重, sum(袋重) as 袋重,sum(重量)-sum(袋重) as 净重 from
- (select no,name,qty_sf,unit_price,po_no,gw1,cast(qty_sf/SUM(qty_sf) OVER (PARTITION BY no) *gw1 as numeric(10,2)) as 重量,cast(pa/SUM(pa) OVER (PARTITION BY no)*0.1 as numeric(10,3)) as 袋重 from
- (select no,name,color,qty_sf,unit_price,po_no,gw1,cast(count as numeric(10,2)) as pa from
- (SELECT no, name,case when name<>'' then 1 end as count, color, qty_sf, gw1, po_no, unit_price, cast(qty_sf/SUM(qty_sf) OVER (PARTITION BY no) *gw1 as numeric(10,2)) as weight
- FROM RT_SHIP_DAILY_PUMA) as r) as s) as t group by name,po_no) as u) as v group by 品名"
-
- cmd.CommandText = sql
- dt = New DataTable
- da.SelectCommand = cmd
- da.Fill(dt)
-
-
- dgv2.DataSource = dt
-
-
-
-
-
-
- ' sql = "select name as 品名,cast(sum(qty_sf) as numeric(10,1)) as 尺数,cast(sum(qty_sf*unit_price) as numeric(10,1)) as 总价,sum(weight) as 淨重 from (SELECT no, name, color, qty_sf, gw1, po_no, unit_price, cast(qty_sf/SUM(qty_sf) OVER (PARTITION BY no) *gw1 as numeric(10,1)) as weight
- 'FROM RT_SHIP_DAILY_PUMA) as p group by name"
-
- ' cmd.CommandText = sql
- ' dt = New DataTable
- ' da.SelectCommand = cmd
- ' da.Fill(dt)
-
-
-
-
-
-
-
-
-
-
- 'sql = ""
-
-
- 'cmd.CommandText = sql
- 'dt = New DataTable
- 'da.SelectCommand = cmd
- 'da.Fill(dt)
-
-
- 'dgv2.DataSource = dt
-
-
-
-
-
- ElseIf OpenFileDialog1.SafeFileName Like "HATAY*" Then
- ElseIf OpenFileDialog1.SafeFileName Like "DCLASE*" Then
- ElseIf OpenFileDialog1.SafeFileName Like "078*" Then
- ElseIf OpenFileDialog1.SafeFileName Like "076发货*" Then '------------------------金威利/威弘
-
- sql = "delete from rt_ship_076_1"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
-
-
-
- For i = 1 To xlApp.Worksheets.Count
-
-
- xlSheet = xlApp.Worksheets(i)
- xlSheet.Activate()
-
-
-
- Dim y As Integer
- For y = xlApp.Workbooks(1).Worksheets(i).UsedRange.Rows.Count To 3 Step -1
-
- If xlSheet.Cells(y, 1).value = Nothing Then
- GoTo OK
- End If
-
- If xlSheet.Cells(y, 1).value.ToString = "数量合计" Then
- Exit For
- End If
- OK:
-
- Next y
-
- Dim yyy As Integer
-
- For yyy = 3 To xlApp.Workbooks(1).Worksheets(i).UsedRange.Rows.Count
-
- If xlSheet.Cells(yyy, 11).value = "制 表" Then
- Exit For
- End If
-
-
- Next yyy
-
-
-
-
-
-
-
- xlSheet.Range("A3:A" & y - 1).Select()
-
- xlApp.Selection.UnMerge
- 'xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- 'xlApp.CutCopyMode = False
- 'xlApp.Selection.FormulaR1C1 = "=R[-1]C"
-
- xlSheet.Range("c3:f" & y - 1).Select()
-
- xlApp.Selection.UnMerge
- 'xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- 'xlApp.CutCopyMode = False
- 'xlApp.Selection.FormulaR1C1 = "=R[-1]C"
-
-
- xlSheet.Range("i3:i" & yyy - 1).Select()
-
- xlApp.Selection.UnMerge
- 'xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- 'xlApp.CutCopyMode = False
- 'xlApp.Selection.FormulaR1C1 = "=R[-1]C"
-
-
- If xlSheet.Range("k3:n" & yyy - 1).MergeCells.ToString <> "False" Then
-
- xlSheet.Range("k3:n" & yyy - 1).Select()
-
- xlApp.Selection.UnMerge
- 'xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- 'xlApp.CutCopyMode = False
- 'xlApp.Selection.FormulaR1C1 = "=R[-1]C"
-
-
-
- End If
-
-
- Dim my_no As String
- Dim my_po As String
- Dim my_work As String
- Dim my_color As String
- Dim my_thick As String
- Dim my_no1 As String
- Dim my_po1 As String
- Dim my_work1 As String
- Dim my_color1 As String
- Dim my_thick1 As String
-
-
- For y = 3 To y - 1
-
-
- 'If IsNumeric(xlSheet.Cells(y, 1).value) And Not (xlSheet.Cells(y, 2).value = Nothing) Then
-
- If y = 3 Then
- my_no = xlSheet.Cells(y, 1).value
- my_po = xlSheet.Cells(y, 3).value
- my_work = xlSheet.Cells(y, 4).value
- my_color = xlSheet.Cells(y, 5).value
- my_thick = xlSheet.Cells(y, 6).value
- my_no1 = xlSheet.Cells(y, 9).value
- my_po1 = xlSheet.Cells(y, 10).value
- my_work1 = xlSheet.Cells(y, 11).value
- my_color1 = xlSheet.Cells(y, 12).value
- my_thick1 = xlSheet.Cells(y, 13).value
- End If
-
-
- If xlSheet.Cells(y, 2).value = Nothing And xlSheet.Cells(y, 3).value = Nothing And xlSheet.Cells(y, 4).value = Nothing And xlSheet.Cells(y, 5).value = Nothing And xlSheet.Cells(y, 6).value = Nothing Then
-
- ' Exit For
-
- Else
-
-
- If xlSheet.Cells(y, 3).value Is Nothing Then
-
- 'my_no = xlSheet.Cells(y, 1).value
- 'my_po = xlSheet.Cells(y, 3).value
- ' my_work = xlSheet.Cells(y, 4).value
- ' my_color = xlSheet.Cells(y, 5).value
- ' my_thick = xlSheet.Cells(y, 6).value
-
- Else
- my_no = xlSheet.Cells(y, 1).value
- my_po = xlSheet.Cells(y, 3).value
- my_work = xlSheet.Cells(y, 4).value
- my_color = xlSheet.Cells(y, 5).value
- my_thick = xlSheet.Cells(y, 6).value
-
- End If
-
-
- sql = "insert into rt_ship_076_1 (no,sf,order_no,i_no,color,thick) values('" & my_no & "'," & xlSheet.Cells(y, 2).value & ",N'" & my_po & "',N'" & my_work & "',N'" & my_color & "','" & my_thick & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- End If
-
-
-
- my_no1 = xlSheet.Cells(y, 9).value
- my_po1 = xlSheet.Cells(y, 11).value
- my_work1 = xlSheet.Cells(y, 12).value
- my_color1 = xlSheet.Cells(y, 13).value
- my_thick1 = xlSheet.Cells(y, 14).value
-
-
- If xlSheet.Cells(y, 10).value = Nothing And xlSheet.Cells(y, 11).value = Nothing And xlSheet.Cells(y, 12).value = Nothing And xlSheet.Cells(y, 13).value = Nothing And xlSheet.Cells(y, 14).value = Nothing Then
-
- ' Exit For
- Else
-
- If xlSheet.Cells(y, 10).value Is Nothing Then
- Else
-
- my_no1 = xlSheet.Cells(y, 9).value
- my_po1 = xlSheet.Cells(y, 11).value
- my_work1 = xlSheet.Cells(y, 12).value
- my_color1 = xlSheet.Cells(y, 13).value
- my_thick1 = xlSheet.Cells(y, 14).value
-
-
-
-
- End If
-
-
- sql = "insert into rt_ship_076_1 (no,sf,order_no,i_no,color,thick) values('" & my_no & "'," & xlSheet.Cells(y, 10).value & ",N'" & my_po & "',N'" & my_work & "',N'" & my_color & "','" & my_thick & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
-
- End If
-
-
-
-
-
-
-
-
-
-
- ' sql = "insert into rt_ship_076_1 (no,sf,order_no,i_no,color,thick) values('" & my_no & "'," & xlSheet.Cells(y, 5).valu & ",N'" & my_po & "',N'" & my_work & "',N'" & my_color & "','" & my_thick & "')"
- 'cmd.CommandText = sql
- ' cmd.ExecuteScalar()
- ''End If
-
- ''If IsNumeric(xlSheet.Cells(y, 1 + 8).value) And Not (xlSheet.Cells(y, 1 + 9).value = Nothing) Then
-
- 'sql = "insert into rt_ship_076_1 (no,sf,order_no,i_no,color,thick) values('" & xlSheet.Cells(y, 1 + 8).value & "'," & xlSheet.Cells(y, 2 + 8).value & ",N'" & xlSheet.Cells(y, 3 + 8).value & "',N'" & xlSheet.Cells(y, 4 + 8).value & "',N'" & xlSheet.Cells(y, 5 + 8).value & "','" & xlSheet.Cells(y, 6 + 8).value & "')"
- ' cmd.CommandText = sql
- ' cmd.ExecuteScalar()
- ''End If
-
-
- Next
-
-
-
-
-
-
-
- Next
-
-
-
-
- sql = "SELECT order_no AS 订单号, i_no AS 指令号, color AS 颜色, thick AS 厚度, cast(SUM(sf) as numeric(10,1)) AS 尺数 FROM RT_ship_076_1 GROUP BY order_no, i_no, color, thick ORDER BY 订单号, 指令号, 颜色"
- cmd.CommandText = sql
- dt = New DataTable
- da.SelectCommand = cmd
- da.Fill(dt)
- dgv1.DataSource = dt
-
- 'dt.Columns.Add("尺数")
- 'dt.Columns.Add("货值")
-
- sql = "SELECT 订单类别, 厚度, SUM(尺数) AS 尺数, 类别
- FROM (SELECT CASE WHEN LEFT(order_no, 2)
- = 'RT' THEN N'人民币' WHEN order_no LIKE 'SX%' THEN '美元' ELSE order_no END AS 订单类别,
- i_no AS 指令号, color AS 颜色, thick AS 厚度, CAST(SUM(sf) AS numeric(10, 1)) AS 尺数,
- CASE WHEN color LIKE '%pu%' OR
- color LIKE '%action%' OR
- color LIKE N'%纹%' THEN 'PU' ELSE '反毛' END AS 类别
- FROM RT_ship_076_1
- GROUP BY order_no, i_no, color, thick) AS p
- GROUP BY 订单类别, 厚度, 类别
- ORDER BY 订单类别"
- cmd.CommandText = sql
- dt = New DataTable
- da.SelectCommand = cmd
- da.Fill(dt)
- dgv2.DataSource = dt
-
-
- sql = "SELECT 订单类别, SUM(尺数) AS 尺数, 类别
- FROM (SELECT CASE WHEN LEFT(order_no, 2)
- = 'RT' THEN N'人民币' WHEN order_no LIKE 'SX%' THEN '美元' ELSE order_no END AS 订单类别,
- i_no AS 指令号, color AS 颜色, thick AS 厚度, CAST(SUM(sf) AS numeric(10, 1)) AS 尺数,
- CASE WHEN color LIKE '%pu%' OR
- color LIKE '%action%' OR
- color LIKE N'%纹%' THEN 'PU' ELSE '反毛' END AS 类别
- FROM RT_ship_076_1
- GROUP BY order_no, i_no, color, thick) AS p
- GROUP BY 订单类别, 类别 ORDER BY 订单类别"
- cmd.CommandText = sql
- dt = New DataTable
- da.SelectCommand = cmd
- da.Fill(dt)
- dgv3.DataSource = dt
-
-
-
-
-
- For rr As Integer = 0 To dt.Rows.Count - 1
- 'sql = ""
- 'cmd.CommandText = sql
- 'dt.Rows(rr).Item("尺数") = cmd.ExecuteScalar
- Next
-
-
-
- For rr As Integer = 0 To dt.Rows.Count - 1
- 'sql = ""
- 'cmd.CommandText = sql
- 'dt.Rows(rr).Item("货值") = cmd.ExecuteScalar
- Next
- 'DataGridView1.DataSource = dt
-
-
-
- End If
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 'xlSheet = Nothing '釋放sheet物件
-
-
- 'xlApp.Quit() '關閉Excel
-
- 'xlApp = Nothing
-
- MsgBox("完成")
-
-
- End Sub
-
- Private Sub Frm_BG_main_Load(sender As Object, e As EventArgs) Handles MyBase.Load
-
-
-
- conn.ConnectionString = connstring
- conn.Open()
- cmd.Connection = conn
-
- End Sub
-
- Private Sub DataGridView2_MouseUp(sender As Object, e As MouseEventArgs) Handles dgv2.MouseUp
-
-
- Dim x As Double = 0
- Dim y As Double = 0
- For i As Integer = 0 To dgv2.SelectedRows.Count - 1
-
- x = x + Math.Round(dgv2.Rows(dgv2.SelectedRows.Item(i).Index).Cells("尺数").Value, 1)
-
-
-
-
-
-
- Next i
-
- TextBox3.Text = dgv2.SelectedRows.Count
-
- TextBox2.Text = x
-
-
-
-
-
- End Sub
- End Class
|