123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- Imports System.Data.SqlClient
- Imports System
- Imports System.Collections.Generic
- Imports System.ComponentModel
- Imports System.Data
- Imports System.Drawing
- Imports System.Drawing.Design
- Imports System.Text
-
-
- Public Class Frm_Ship_Daily_sum
- Dim cmd As New SqlCommand
- Dim da As New SqlDataAdapter
- Dim dt As New DataTable
- Dim sql As String
- Dim conn As New SqlConnection
- Private dateTimePicker1 As DateTimePicker
- Dim p() As String
- Dim my_cust As String = ""
- Dim colorArray(10) As Color
- Private Sub Frm_Ship_Daily_sum_Load(sender As Object, e As EventArgs) Handles MyBase.Load
-
-
- colorArray(0) = Color.FromName("Aquamarine")
- colorArray(1) = Color.FromName("azure")
- colorArray(2) = Color.FromName("beige")
- colorArray(3) = Color.FromName("gainsboro")
- colorArray(4) = Color.FromName("LightBlue")
- colorArray(5) = Color.FromName("LightSalmon")
-
-
-
- conn.ConnectionString = connstring
- conn.Open()
-
- cmd.Connection = conn
-
-
- sql = "SELECT p.出货日期, p.custname as 客户, p.颜色, p.尺数, p.卡号1, p.品名 AS 系统品名, p.库存尺数 AS 即时库存,
- - p.尺数 + p.库存尺数 AS 结存, p.编码 AS 系统编码, Rt_measure_daily.date AS 打尺日期,
- Rt_measure_daily.sf AS 打尺尺数
- FROM (SELECT TOP (100) PERCENT rt_ship_temp_1.custname, rt_ship_temp_1.card AS 卡号, CAST(SUM(rt_ship_temp_1.qty)
- AS numeric(10, 1)) AS 尺数, CASE WHEN RIGHT(rt_ship_temp_1.card, 1)
- = 'F' THEN 'BRF' + substring(rt_ship_temp_1.card, 0, len(rt_ship_temp_1.card)) ELSE '' END AS 卡号1,
- CASE WHEN rt_finish_stock.name IS NULL THEN N'杂皮 二层' ELSE rt_finish_stock.name END AS 品名,
- CASE WHEN rt_finish_stock.sf IS NULL THEN '' ELSE rt_finish_stock.sf END AS 库存尺数,
- CASE WHEN rt_finish_stock.code IS NULL THEN '' ELSE rt_finish_stock.code END AS 编码,
- rt_ship_temp_1.color1 AS 颜色, rt_ship_temp_1.date AS 出货日期
- FROM rt_ship_temp_1 LEFT OUTER JOIN
- rt_finish_stock ON rt_ship_temp_1.card = rt_finish_stock.lot
- WHERE (rt_ship_temp_1.date BETWEEN '2024/6/1' AND '2024/6/19')
- GROUP BY rt_ship_temp_1.custname, rt_ship_temp_1.card, rt_finish_stock.name, rt_finish_stock.sf, rt_finish_stock.code,
- rt_ship_temp_1.color1, rt_ship_temp_1.date
- ORDER BY rt_finish_stock.code) AS p LEFT OUTER JOIN
- Rt_measure_daily ON p.卡号1 = Rt_measure_daily.card
- ORDER BY p.出货日期, p.custname, p.颜色"
- cmd.CommandText = sql
-
- da.SelectCommand = cmd
- da.Fill(dt)
-
- dgv1.DataSource = dt
-
-
- dgv1.Columns(1).Width = 120
- dgv1.Columns(2).Width = 250
- dgv1.Columns(4).Width = 145
-
- Set_grid_color()
-
-
-
- End Sub
-
- Private Sub dgv1_CellPainting(sender As Object, e As DataGridViewCellPaintingEventArgs) Handles dgv1.CellPainting
-
-
- If e.ColumnIndex <> 0 And e.RowIndex <> -1 Then
-
-
- Dim Brush As SolidBrush
- Dim backcolorBrush As SolidBrush
-
-
-
-
-
-
-
-
-
- End If
-
-
-
- End Sub
-
- Private Sub Set_grid_color()
-
- Dim c As Integer = 1
- Dim p(1000) As Integer
-
- Dim x As Integer
-
- p(1) = 0
-
- For x = 1 To dgv1.Rows.Count - 2
-
- If dgv1.Rows(x).Cells(4).Value.ToString <> dgv1.Rows(x - 1).Cells(4).Value.ToString Then
-
- p(c + 1) = x
- c = c + 1
-
-
- End If
- Next
- p(c + 1) = x
-
- ReDim Preserve p(x)
-
- If c = 1 Then
- For z As Integer = 0 To x - 1
-
- dgv1.Rows(z).DefaultCellStyle.BackColor = colorArray(1)
-
- Next
- Else
-
- For cc As Integer = 1 To c
-
- For z As Integer = p(cc) To p(cc + 1) - 1
- dgv1.Rows(z).DefaultCellStyle.BackColor = colorArray(cc Mod 3)
- Next
- Next
- End If
-
-
-
-
-
-
-
-
-
- End Sub
- End Class
|