123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751 |
- Imports System.Data.SqlClient
-
- Public Class Frm_PU_WORK
- Dim cmd As New SqlCommand
- Dim da As New SqlDataAdapter
- Dim dt As New DataTable
- Dim sql As String
- Private Sub Frm_PU_WORK_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()
- cmd.Connection = conn
-
-
-
-
- End Sub
-
- Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click
-
- sql = "SELECT date AS 日期, cust AS 客户, thick AS 厚度, pattern AS 纹路, qty AS 上机数量, spec AS 大小, qly AS 粗细, color AS 颜色,
- color1 AS 颜色1, code AS 代码, comment AS 中检卡号, spec4 AS 规格, price AS 单价, amount AS 金额
- FROM RT_PU_WORK WHERE date BETWEEN '" & String.Format("{0:d}", dtp_begin.Value) & "' and '" & String.Format("{0:d}", dtp_end.Value) & "' ORDER BY 日期"
- cmd.CommandText = sql
- da.SelectCommand = cmd
- da.Fill(dt)
-
- dgv1.DataSource = dt
-
-
-
- sql = "select sum(qty) from RT_PU_WORK WHERE date BETWEEN '" & String.Format("{0:d}", dtp_begin.Value) & "' and '" & String.Format("{0:d}", dtp_end.Value) & "'"
- cmd.CommandText = sql
-
- Label5.Text = cmd.ExecuteScalar
-
-
-
-
- End Sub
-
- Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
-
-
-
-
- Dim aa As String
- Dim bb As String
- Dim my_card As String = ""
- Dim my_date As Date
-
- aa = TextBox8.Text
- bb = aa
-
-
- If aa = "" Then
- MsgBox("请输入起始单号")
- Exit Sub
- End If
-
-
-
- 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 xlSheet2 As Microsoft.Office.Interop.Excel.Worksheet
-
-
-
-
- Dim file_name As String = ""
- Dim file_name1 As String = ""
- Dim my_weight As Double = 0
- Dim a As Integer = 0
- Dim my_count As Integer = 0
- Dim my_x As Integer = 0
-
-
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open("D:\K3\k3表格模板\PU主机入库.xls",, True)
-
- xlBook.Activate()
-
- Dim dt2 As New DataTable
-
-
- For i = 1 To xlApp.Worksheets.Count
-
- If xlApp.Workbooks(1).Worksheets(i).name = "Page1" Then
- xlSheet = xlApp.Workbooks(1).Worksheets(i)
- xlSheet.Activate()
- Exit For
- End If
-
-
- Next
-
-
- Dim my_no As String = "CPRK0"
- Dim yy As Integer = 1
- Dim x As Integer = 0
-
-
- 'sql = "" ''----下鼓
-
-
- 'Dim dt_out As DataTable
-
- 'cmd.CommandText = sql
-
- 'dt_out = New DataTable
- 'da.SelectCommand = cmd
- 'da.Fill(dt_out)
-
- Dim my_total_no As Integer = 0
-
- Dim dt_retan As New DataTable
-
- sql = "SELECT date FROM RT_pu_work
- WHERE date BETWEEN '" & String.Format("{0:d}", dtp_begin.Value) & "' and '" & String.Format("{0:d}", dtp_end.Value) & "' group by date"
- cmd.CommandText = sql
- da.SelectCommand = cmd
- da.Fill(dt_retan)
-
-
-
-
- For x = 0 To dt_retan.Rows.Count - 1 '-----------loop
-
-
-
-
-
- xlSheet.Cells(x + 2, 1) = String.Format("{0:d}", dt_retan.Rows(x).Item("date"))
- xlSheet.Cells(x + 2, 2) = String.Format("{0:d}", dt_retan.Rows(x).Item("date"))
- xlSheet.Cells(x + 2, 3) = "'戴燕卿"
- xlSheet.Cells(x + 2, 4) = "'" & my_no & bb
- xlSheet.Cells(x + 2, 5) = "'zhang"
- xlSheet.Cells(x + 2, 6) = "'1"
- xlSheet.Cells(x + 2, 7) = "'2"
- xlSheet.Cells(x + 2, 8) = "'165701"
-
- xlSheet.Cells(x + 2, 9) = "'651P-R"
- xlSheet.Cells(x + 2, 10) = "'中检、量尺-R"
-
-
- xlSheet.Cells(x + 2, 11) = "'124"
- xlSheet.Cells(x + 2, 12) = "'戴燕卿"
- xlSheet.Cells(x + 2, 13) = "'124"
- xlSheet.Cells(x + 2, 14) = "'戴燕卿"
- xlSheet.Cells(x + 2, 15) = "'85"
-
-
-
-
- For i = 1 To xlApp.Worksheets.Count
-
- If xlApp.Workbooks(1).Worksheets(i).name = "Page2" Then
- xlSheet2 = xlApp.Workbooks(1).Worksheets(i)
- xlSheet2.Activate()
- Exit For
- End If
-
- Next
-
-
-
-
-
- sql = "SELECT date AS 日期, cust AS 客户, thick AS 厚度, pattern AS 纹路, qty AS 上机数量, spec AS 大小, qly AS 粗细, color AS 颜色,
- color1 AS 颜色1, code AS 代码, comment AS 中检卡号, spec4 AS 规格, price AS 单价, amount AS 金额
- FROM RT_PU_WORK WHERE date = '" & dt_retan.Rows(x).Item("date") & "' ORDER BY 日期,客户,纹路,颜色,上机数量"
-
-
-
- sql = "SELECT RT_PU_WORK.date AS 日期, RT_PU_WORK.cust AS 客户, RT_PU_WORK.thick AS 厚度, RT_PU_WORK.pattern AS 纹路,
- RT_PU_WORK.qty AS 上机数量, RT_PU_WORK.spec AS 大小, RT_PU_WORK.qly AS 粗细, RT_PU_WORK.color AS 颜色,
- RT_PU_WORK.color1 AS 颜色1, RT_PU_WORK.code AS 代码, RT_PU_WORK.comment AS 中检卡号,
- RT_PU_WORK.spec4 AS 规格, RT_PU_WORK.price AS 单价, RT_PU_WORK.amount AS 金额, rt_pu_code.thick as thick
- FROM RT_PU_WORK LEFT OUTER JOIN
- rt_pu_code ON RT_PU_WORK.code = rt_pu_code.code WHERE date = '" & dt_retan.Rows(x).Item("date") & "' ORDER BY 日期,客户,纹路,颜色,上机数量 "
-
-
-
-
-
-
-
-
- dt2 = New DataTable
- cmd.CommandText = sql
- da.SelectCommand = cmd
- da.Fill(dt2)
-
-
- Dim serial As Integer = 1
-
-
-
-
-
- For y = 0 To dt2.Rows.Count - 1
-
- xlSheet2.Cells(yy + 1 + y, 2) = "'" & serial '行号
- xlSheet2.Cells(yy + 1 + y, 3) = "'" & my_no & bb
-
- xlSheet2.Cells(yy + 1 + y, 5) = dt2.Rows(y).Item("代码")
- xlSheet2.Cells(yy + 1 + y, 6) = dt2.Rows(y).Item("thick")
-
- xlSheet2.Cells(yy + 1 + y, 15) = dt2.Rows(y).Item("单价")
-
- xlSheet2.Cells(yy + 1 + y, 14) = dt2.Rows(y).Item("上机数量")
- xlSheet2.Cells(yy + 1 + y, 16) = dt2.Rows(y).Item("上机数量") * dt2.Rows(y).Item("单价")
-
- ' xlSheet2.Cells(yy + 1 + y, 17) = "112 " & dt2.Rows(y).Item("皮源1") '批号
- xlSheet2.Cells(yy + 1 + y, 18) = dt2.Rows(y).Item("规格") '备注
- xlSheet2.Cells(yy + 1 + y, 22) = dt2.Rows(y).Item("日期")
-
- xlSheet2.Cells(yy + 1 + y, 25) = "'215B-R"
- xlSheet2.Cells(yy + 1 + y, 26) = "'主机、燥干/赤湖"
-
- 'xlSheet.Cells(x + 2, 9) = "'607-R"
- ' xlSheet.Cells(x + 2, 10) = "'挑选等级-R"
-
-
- xlSheet2.Cells(yy + 1 + y, 38) = dt2.Rows(y).Item("客户")
- 'xlSheet2.Cells(yy + 1 + y, 39) = "'" & dt2.Rows(y).Item("客户")
- ' xlSheet2.Cells(yy + 1 + y, 40) = dt2.Rows(y).Item("技术员")
- ' xlSheet2.Cells(yy + 1 + y, 41) = dt2.Rows(y).Item("中检卡号")
- xlSheet2.Cells(yy + 1 + y, 42) = dt2.Rows(y).Item("颜色")
- xlSheet2.Cells(yy + 1 + y, 43) = dt2.Rows(y).Item("厚度")
- xlSheet2.Cells(yy + 1 + y, 44) = dt2.Rows(y).Item("中检卡号")
- xlSheet2.Cells(yy + 1 + y, 45) = dt2.Rows(y).Item("粗细")
- ' xlSheet2.Cells(yy + 1 + y, 46) = dt2.Rows(y).Item("化工成本")
-
- xlSheet2.Cells(yy + 1 + y, 47) = dt2.Rows(y).Item("颜色1")
- xlSheet2.Cells(yy + 1 + y, 49) = dt2.Rows(y).Item("纹路")
- xlSheet2.Cells(yy + 1 + y, 49) = dt2.Rows(y).Item("大小")
-
-
- my_total_no = yy + 1 + y
-
-
- serial = serial + 1
-
- Next
-
- yy = yy + dt2.Rows.Count
-
-
- aa = aa + 1
- my_x = my_x + 1
- bb = bb + 1
- Next
-
-
- xlSheet2.Range("A2:A" & xlSheet2.UsedRange.Rows.Count).FillDown()
- 'xlSheet2.Range("B2:B" & x + 1).FillDown()
- xlSheet2.Range("D2:D" & xlSheet2.UsedRange.Rows.Count).FillDown()
- xlSheet2.Range("I2:I" & xlSheet2.UsedRange.Rows.Count).FillDown()
- xlSheet2.Range("J2:J" & xlSheet2.UsedRange.Rows.Count).FillDown()
- xlSheet2.Range("L2:L" & xlSheet2.UsedRange.Rows.Count).FillDown()
- xlSheet2.Range("M2:M" & xlSheet2.UsedRange.Rows.Count).FillDown()
- 'xlSheet2.Range("O2:O" & x + 1).FillDown()
- 'xlSheet2.Range("P2:P" & x + 1).FillDown()
-
-
-
-
-
- MsgBox("")
-
- End Sub
-
- Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
-
-
-
-
-
- Dim aa As String
- Dim bb As String
- Dim my_card As String = ""
- Dim my_date As Date
-
- aa = TextBox1.Text
- bb = aa
-
-
- If aa = "" Then
- MsgBox("请输入起始单号")
- Exit Sub
- End If
-
-
-
- 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 xlSheet2 As Microsoft.Office.Interop.Excel.Worksheet
-
-
-
-
- Dim file_name As String = ""
- Dim file_name1 As String = ""
- Dim my_weight As Double = 0
- Dim a As Integer = 0
- Dim my_count As Integer = 0
- Dim my_x As Integer = 0
-
-
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open("D:\K3\k3表格模板\PU主机出库.xls",, True)
-
- xlBook.Activate()
-
- Dim dt2 As New DataTable
-
-
- For i = 1 To xlApp.Worksheets.Count
-
- If xlApp.Workbooks(1).Worksheets(i).name = "Page1" Then
- xlSheet = xlApp.Workbooks(1).Worksheets(i)
- xlSheet.Activate()
- Exit For
- End If
-
-
- Next
-
-
- Dim my_no As String = "SCLL0"
- Dim yy As Integer = 1
- Dim x As Integer = 0
-
-
- 'sql = "" ''----下鼓
-
-
- 'Dim dt_out As DataTable
-
- 'cmd.CommandText = sql
-
- 'dt_out = New DataTable
- 'da.SelectCommand = cmd
- 'da.Fill(dt_out)
-
- Dim my_total_no As Integer = 0
-
- Dim dt_retan As New DataTable
-
- sql = "SELECT date FROM RT_pu_work
- WHERE date BETWEEN '" & String.Format("{0:d}", dtp_begin.Value) & "' and '" & String.Format("{0:d}", dtp_end.Value) & "' group by date"
- cmd.CommandText = sql
- da.SelectCommand = cmd
- da.Fill(dt_retan)
-
-
-
-
- For x = 0 To dt_retan.Rows.Count - 1 '-----------loop
-
-
-
-
-
- xlSheet.Cells(x + 2, 1) = String.Format("{0:d}", dt_retan.Rows(x).Item("date"))
- xlSheet.Cells(x + 2, 2) = String.Format("{0:d}", dt_retan.Rows(x).Item("date"))
- xlSheet.Cells(x + 2, 3) = "'戴燕卿"
- xlSheet.Cells(x + 2, 4) = "'" & my_no & bb
- xlSheet.Cells(x + 2, 5) = "'zhang"
- xlSheet.Cells(x + 2, 6) = "'1"
- xlSheet.Cells(x + 2, 7) = "'2"
- xlSheet.Cells(x + 2, 8) = "'165701"
-
- xlSheet.Cells(x + 2, 9) = "'655P-R"
- xlSheet.Cells(x + 2, 10) = "'修剪、成检、量尺、包装-R"
-
-
- xlSheet.Cells(x + 2, 12) = "'124"
- xlSheet.Cells(x + 2, 13) = "'戴燕卿"
- xlSheet.Cells(x + 2, 14) = "'124"
- xlSheet.Cells(x + 2, 15) = "'戴燕卿"
- ' xlSheet.Cells(x + 2, 16) = "'85"
-
- xlSheet.Cells(x + 2, 18) = "'YBLL"
- xlSheet.Cells(x + 2, 19) = "'一般领料"
- xlSheet.Cells(x + 2, 20) = "'471"
- xlSheet.Cells(x + 2, 21) = "'85"
-
-
- For i = 1 To xlApp.Worksheets.Count
-
- If xlApp.Workbooks(1).Worksheets(i).name = "Page2" Then
- xlSheet2 = xlApp.Workbooks(1).Worksheets(i)
- xlSheet2.Activate()
- Exit For
- End If
-
- Next
-
-
-
-
- sql = "SELECT RT_PU_WORK.date AS 日期, RT_PU_WORK.cust AS 客户, RT_PU_WORK.thick AS 厚度, RT_PU_WORK.pattern AS 纹路,
- RT_PU_WORK.qty AS 上机数量, RT_PU_WORK.spec AS 大小, RT_PU_WORK.qly AS 粗细, RT_PU_WORK.color AS 颜色,
- RT_PU_WORK.color1 AS 颜色1, RT_PU_WORK.code AS 代码, RT_PU_WORK.comment AS 中检卡号,
- RT_PU_WORK.spec4 AS 规格, RT_PU_WORK.price AS 单价, RT_PU_WORK.amount AS 金额, rt_pu_code.thick as thick
- FROM RT_PU_WORK LEFT OUTER JOIN
- rt_pu_code ON RT_PU_WORK.code = rt_pu_code.code WHERE date = '" & dt_retan.Rows(x).Item("date") & "' ORDER BY 日期,客户,纹路,颜色,上机数量 "
-
-
-
-
-
-
-
-
- dt2 = New DataTable
- cmd.CommandText = sql
- da.SelectCommand = cmd
- da.Fill(dt2)
-
-
- Dim serial As Integer = 1
-
-
-
-
-
- For y = 0 To dt2.Rows.Count - 1
-
- xlSheet2.Cells(yy + 1 + y, 2) = "'" & serial '行号
- xlSheet2.Cells(yy + 1 + y, 3) = "'" & my_no & bb
-
- xlSheet2.Cells(yy + 1 + y, 6) = dt2.Rows(y).Item("代码")
- xlSheet2.Cells(yy + 1 + y, 7) = dt2.Rows(y).Item("thick")
-
- ' xlSheet2.Cells(yy + 1 + y, 15) = dt2.Rows(y).Item("单价")
-
- xlSheet2.Cells(yy + 1 + y, 24) = dt2.Rows(y).Item("上机数量")
- ' xlSheet2.Cells(yy + 1 + y, 16) = dt2.Rows(y).Item("上机数量") * dt2.Rows(y).Item("单价")
-
- ' xlSheet2.Cells(yy + 1 + y, 17) = "112 " & dt2.Rows(y).Item("皮源1") '批号
- xlSheet2.Cells(yy + 1 + y, 54) = dt2.Rows(y).Item("规格") '备注
- xlSheet2.Cells(yy + 1 + y, 32) = dt2.Rows(y).Item("日期")
-
- xlSheet2.Cells(yy + 1 + y, 35) = "'215B-R"
- xlSheet2.Cells(yy + 1 + y, 36) = "'主机、燥干/赤湖"
-
- 'xlSheet.Cells(x + 2, 9) = "'607-R"
- ' xlSheet.Cells(x + 2, 10) = "'挑选等级-R"
-
-
- xlSheet2.Cells(yy + 1 + y, 52) = dt2.Rows(y).Item("客户")
- 'xlSheet2.Cells(yy + 1 + y, 39) = "'" & dt2.Rows(y).Item("客户")
- ' xlSheet2.Cells(yy + 1 + y, 40) = dt2.Rows(y).Item("技术员")
- ' xlSheet2.Cells(yy + 1 + y, 41) = dt2.Rows(y).Item("中检卡号")
- xlSheet2.Cells(yy + 1 + y, 56) = dt2.Rows(y).Item("颜色")
- xlSheet2.Cells(yy + 1 + y, 57) = dt2.Rows(y).Item("厚度")
- xlSheet2.Cells(yy + 1 + y, 54) = dt2.Rows(y).Item("中检卡号")
- xlSheet2.Cells(yy + 1 + y, 61) = dt2.Rows(y).Item("粗细")
- ' xlSheet2.Cells(yy + 1 + y, 46) = dt2.Rows(y).Item("化工成本")
-
- xlSheet2.Cells(yy + 1 + y, 53) = dt2.Rows(y).Item("颜色1")
- xlSheet2.Cells(yy + 1 + y, 63) = dt2.Rows(y).Item("纹路")
- xlSheet2.Cells(yy + 1 + y, 64) = dt2.Rows(y).Item("大小")
-
-
- my_total_no = yy + 1 + y
-
-
- serial = serial + 1
-
- Next
-
- yy = yy + dt2.Rows.Count
-
-
- aa = aa + 1
- my_x = my_x + 1
- bb = bb + 1
- Next
-
-
- xlSheet2.Range("A2:A" & yy).FillDown()
-
- xlSheet2.Range("D2:D" & yy).FillDown()
-
- xlSheet2.Range("k2:v" & yy).FillDown()
-
-
-
-
-
- MsgBox("")
-
- End Sub
-
- Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
-
-
-
-
- Dim aa As String
- Dim bb As String
- Dim my_card As String = ""
- Dim my_date As Date
-
- aa = TextBox2.Text
- bb = aa
-
-
- If aa = "" Then
- MsgBox("请输入起始单号")
- Exit Sub
- End If
-
-
-
- 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 xlSheet2 As Microsoft.Office.Interop.Excel.Worksheet
-
-
-
-
- Dim file_name As String = ""
- Dim file_name1 As String = ""
- Dim my_weight As Double = 0
- Dim a As Integer = 0
- Dim my_count As Integer = 0
- Dim my_x As Integer = 0
-
-
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open("D:\K3\k3表格模板\PU主机入库.xls",, True)
-
- xlBook.Activate()
-
- Dim dt2 As New DataTable
-
-
- For i = 1 To xlApp.Worksheets.Count
-
- If xlApp.Workbooks(1).Worksheets(i).name = "Page1" Then
- xlSheet = xlApp.Workbooks(1).Worksheets(i)
- xlSheet.Activate()
- Exit For
- End If
-
-
- Next
-
-
- Dim my_no As String = "CPRK0"
- Dim yy As Integer = 1
- Dim x As Integer = 0
-
-
- 'sql = "" ''----下鼓
-
-
- 'Dim dt_out As DataTable
-
- 'cmd.CommandText = sql
-
- 'dt_out = New DataTable
- 'da.SelectCommand = cmd
- 'da.Fill(dt_out)
-
- Dim my_total_no As Integer = 0
-
- Dim dt_retan As New DataTable
-
- sql = "SELECT date FROM RT_pu_work
- WHERE date BETWEEN '" & String.Format("{0:d}", dtp_begin.Value) & "' and '" & String.Format("{0:d}", dtp_end.Value) & "' group by date"
- cmd.CommandText = sql
- da.SelectCommand = cmd
- da.Fill(dt_retan)
-
-
-
-
- For x = 0 To dt_retan.Rows.Count - 1 '-----------loop
-
-
-
-
-
- xlSheet.Cells(x + 2, 1) = String.Format("{0:d}", dt_retan.Rows(x).Item("date"))
- xlSheet.Cells(x + 2, 2) = String.Format("{0:d}", dt_retan.Rows(x).Item("date"))
- xlSheet.Cells(x + 2, 3) = "'戴燕卿"
- xlSheet.Cells(x + 2, 4) = "'" & my_no & bb
- xlSheet.Cells(x + 2, 5) = "'zhang"
- xlSheet.Cells(x + 2, 6) = "'1"
- xlSheet.Cells(x + 2, 7) = "'2"
- xlSheet.Cells(x + 2, 8) = "'165701"
-
- xlSheet.Cells(x + 2, 9) = "'653P-R"
- xlSheet.Cells(x + 2, 10) = "'燥干-R"
-
-
- xlSheet.Cells(x + 2, 11) = "'124"
- xlSheet.Cells(x + 2, 12) = "'戴燕卿"
- xlSheet.Cells(x + 2, 13) = "'124"
- xlSheet.Cells(x + 2, 14) = "'戴燕卿"
- xlSheet.Cells(x + 2, 15) = "'85"
-
-
-
-
- For i = 1 To xlApp.Worksheets.Count
-
- If xlApp.Workbooks(1).Worksheets(i).name = "Page2" Then
- xlSheet2 = xlApp.Workbooks(1).Worksheets(i)
- xlSheet2.Activate()
- Exit For
- End If
-
- Next
-
-
-
-
-
-
-
-
-
- sql = "SELECT RT_PU_WORK.date AS 日期, RT_PU_WORK.cust AS 客户, RT_PU_WORK.thick AS 厚度, RT_PU_WORK.pattern AS 纹路,
- RT_PU_WORK.qty AS 上机数量, RT_PU_WORK.spec AS 大小, RT_PU_WORK.qly AS 粗细, RT_PU_WORK.color AS 颜色,
- RT_PU_WORK.color1 AS 颜色1, RT_PU_WORK.code AS 代码, RT_PU_WORK.comment AS 中检卡号,
- RT_PU_WORK.spec4 AS 规格, RT_PU_WORK.price AS 单价, RT_PU_WORK.amount AS 金额, rt_pu_code.thick as thick
- FROM RT_PU_WORK LEFT OUTER JOIN
- rt_pu_code ON RT_PU_WORK.code = rt_pu_code.code WHERE date = '" & dt_retan.Rows(x).Item("date") & "' ORDER BY 日期,客户,纹路,颜色,上机数量 "
-
-
-
-
-
-
-
-
- dt2 = New DataTable
- cmd.CommandText = sql
- da.SelectCommand = cmd
- da.Fill(dt2)
-
-
- Dim serial As Integer = 1
-
-
-
-
-
- For y = 0 To dt2.Rows.Count - 1
-
- xlSheet2.Cells(yy + 1 + y, 2) = "'" & serial '行号
- xlSheet2.Cells(yy + 1 + y, 3) = "'" & my_no & bb
-
- xlSheet2.Cells(yy + 1 + y, 5) = dt2.Rows(y).Item("代码")
- xlSheet2.Cells(yy + 1 + y, 6) = dt2.Rows(y).Item("thick")
-
- ' xlSheet2.Cells(yy + 1 + y, 15) = dt2.Rows(y).Item("单价")
-
- xlSheet2.Cells(yy + 1 + y, 14) = dt2.Rows(y).Item("上机数量")
- ' xlSheet2.Cells(yy + 1 + y, 16) = dt2.Rows(y).Item("上机数量") * dt2.Rows(y).Item("单价")
-
- ' xlSheet2.Cells(yy + 1 + y, 17) = "112 " & dt2.Rows(y).Item("皮源1") '批号
- xlSheet2.Cells(yy + 1 + y, 18) = dt2.Rows(y).Item("规格") '备注
- xlSheet2.Cells(yy + 1 + y, 22) = dt2.Rows(y).Item("日期")
-
- xlSheet2.Cells(yy + 1 + y, 25) = "'517B"
- xlSheet2.Cells(yy + 1 + y, 26) = "'PU成品仓"
-
- 'xlSheet.Cells(x + 2, 9) = "'607-R"
- ' xlSheet.Cells(x + 2, 10) = "'挑选等级-R"
-
-
- xlSheet2.Cells(yy + 1 + y, 38) = dt2.Rows(y).Item("客户")
- 'xlSheet2.Cells(yy + 1 + y, 39) = "'" & dt2.Rows(y).Item("客户")
- ' xlSheet2.Cells(yy + 1 + y, 40) = dt2.Rows(y).Item("技术员")
- ' xlSheet2.Cells(yy + 1 + y, 41) = dt2.Rows(y).Item("中检卡号")
- xlSheet2.Cells(yy + 1 + y, 42) = dt2.Rows(y).Item("颜色")
- xlSheet2.Cells(yy + 1 + y, 43) = dt2.Rows(y).Item("厚度")
- xlSheet2.Cells(yy + 1 + y, 44) = dt2.Rows(y).Item("中检卡号")
- xlSheet2.Cells(yy + 1 + y, 45) = dt2.Rows(y).Item("粗细")
- ' xlSheet2.Cells(yy + 1 + y, 46) = dt2.Rows(y).Item("化工成本")
-
- xlSheet2.Cells(yy + 1 + y, 47) = dt2.Rows(y).Item("颜色1")
- xlSheet2.Cells(yy + 1 + y, 49) = dt2.Rows(y).Item("纹路")
- xlSheet2.Cells(yy + 1 + y, 49) = dt2.Rows(y).Item("大小")
-
-
- my_total_no = yy + 1 + y
-
-
- serial = serial + 1
-
- Next
-
- yy = yy + dt2.Rows.Count
-
-
- aa = aa + 1
- my_x = my_x + 1
- bb = bb + 1
- Next
-
-
- xlSheet2.Range("A2:A" & xlSheet2.UsedRange.Rows.Count).FillDown()
- 'xlSheet2.Range("B2:B" & x + 1).FillDown()
- xlSheet2.Range("D2:D" & xlSheet2.UsedRange.Rows.Count).FillDown()
- xlSheet2.Range("I2:I" & xlSheet2.UsedRange.Rows.Count).FillDown()
- xlSheet2.Range("J2:J" & xlSheet2.UsedRange.Rows.Count).FillDown()
- xlSheet2.Range("L2:L" & xlSheet2.UsedRange.Rows.Count).FillDown()
- xlSheet2.Range("M2:M" & xlSheet2.UsedRange.Rows.Count).FillDown()
- 'xlSheet2.Range("O2:O" & x + 1).FillDown()
- 'xlSheet2.Range("P2:P" & x + 1).FillDown()
-
-
-
-
-
- MsgBox("")
-
- End Sub
- End Class
|