Nav apraksta
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

出貨確認.vb 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. Option Strict Off
  2. Public Class 出貨確認
  3. ReadOnly ds As New DataSet
  4. Private Sub Set_清單()
  5. DataGridView1.DataSource = Nothing : ds.Clear() : DataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  6. DataGridView1.ColumnHeadersHeight = 40 : DataGridView1.AllowUserToAddRows = False
  7. SQL_出貨確認清單()
  8. da.Fill(ds) : DataGridView1.DataSource = ds.Tables(0) : conn.Close()
  9. DataGridView1.Columns(0).Visible = False : DataGridView1.Columns(1).FillWeight = 110 : DataGridView1.Columns(2).Visible = False : DataGridView1.Columns(3).FillWeight = 200
  10. DataGridView1.Columns(4).Visible = False : DataGridView1.Columns(5).Visible = False : DataGridView1.Columns(6).FillWeight = 60 : DataGridView1.Columns(7).FillWeight = 150
  11. DataGridView1.Columns(8).FillWeight = 80 : DataGridView1.Columns(9).FillWeight = 80 : DataGridView1.Columns(10).FillWeight = 40 : DataGridView1.Columns(11).FillWeight = 60
  12. DataGridView1.Columns(12).FillWeight = 40 : DataGridView1.Columns(13).FillWeight = 110 : DataGridView1.Columns(14).FillWeight = 60 : DataGridView1.Columns(15).Visible = False
  13. DataGridView1.Columns(16).FillWeight = 60 : DataGridView1.Columns(17).FillWeight = 40 : DataGridView1.Columns(18).FillWeight = 60 : DataGridView1.Columns(19).FillWeight = 40
  14. DataGridView1.Columns(6).DefaultCellStyle.Format = "#,##0" : DataGridView1.Columns(17).DefaultCellStyle.Format = "#,##0.0" : DataGridView1.Columns(19).DefaultCellStyle.Format = "#,##0.0"
  15. DataGridView1.Columns(1).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView1.Columns(1).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  16. DataGridView1.Columns(2).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView1.Columns(2).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  17. DataGridView1.Columns(6).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView1.Columns(6).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  18. DataGridView1.Columns(8).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView1.Columns(8).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  19. DataGridView1.Columns(9).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView1.Columns(9).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  20. DataGridView1.Columns(10).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView1.Columns(10).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  21. DataGridView1.Columns(11).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView1.Columns(11).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  22. DataGridView1.Columns(12).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView1.Columns(12).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  23. DataGridView1.Columns(13).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView1.Columns(13).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
  24. For I As Integer = 0 To 19 : DataGridView1.Columns(I).ReadOnly = True : Next
  25. For i As Integer = 0 To DataGridView1.Rows.Count - 1
  26. DataGridView1.Rows(i).Cells("選擇").Value = False
  27. If DataGridView1.Rows(i).Cells("業務比例").Value.ToString = "" Then : DataGridView1.Rows(i).Cells("業務比例").Value = 0 : End If
  28. If DataGridView1.Rows(i).Cells("司機比例").Value.ToString = "" Then : DataGridView1.Rows(i).Cells("司機比例").Value = 0 : End If
  29. Next
  30. End Sub
  31. Private Sub ComboBox6下拉表單資料載入()
  32. SQL_員工名稱下拉清單()
  33. ComboBox6.Items.Clear() : ComboBox8.Items.Clear() : While (dr.Read()) : ComboBox6.Items.Add(dr("名稱")) : ComboBox8.Items.Add(dr("名稱")) : End While : conn.Close()
  34. End Sub
  35. Private Sub ComboBox7下拉表單資料載入()
  36. SQL_傭金比例下拉清單()
  37. ComboBox7.Items.Clear() : ComboBox9.Items.Clear()
  38. While (dr.Read()) : ComboBox7.Items.Add(Format(dr("比例"), "#,##0.0")) : ComboBox9.Items.Add(Format(dr("比例"), "#,##0.0")) : End While : conn.Close()
  39. End Sub
  40. Private Sub 出貨確認_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  41. Me.MdiParent = MAOJI_ERP_SYS : Me.WindowState = 2 : Me.AutoScroll = True
  42. ComboBox6下拉表單資料載入() : ComboBox7下拉表單資料載入() : Set_清單()
  43. End Sub
  44. Private Sub DataGridView1_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles DataGridView1.CellClick
  45. If e.RowIndex = -1 Then : Else
  46. ComboBox6下拉表單資料載入() : ComboBox7下拉表單資料載入()
  47. TextBox3.Text = DataGridView1.Rows(e.RowIndex).Cells("單據編號").Value : TextBox1.Text = DataGridView1.Rows(e.RowIndex).Cells("訂單流水號").Value.ToString
  48. ComboBox6.Text = DataGridView1.Rows(e.RowIndex).Cells("業務").Value.ToString : ComboBox7.Text = Format(DataGridView1.Rows(e.RowIndex).Cells("業務比例").Value, "#,##0.0")
  49. ComboBox8.Text = DataGridView1.Rows(e.RowIndex).Cells("司機").Value.ToString : ComboBox9.Text = Format(DataGridView1.Rows(e.RowIndex).Cells("司機比例").Value, "#,##0.0")
  50. If DataGridView1.Rows(e.RowIndex).Cells("選擇").Value = False And DataGridView1.Rows(e.RowIndex).Cells("司機").Value.ToString <> "" Then
  51. DataGridView1.Rows(e.RowIndex).Cells("選擇").Value = True
  52. ElseIf DataGridView1.Rows(e.RowIndex).Cells("司機").Value.ToString = "" Then
  53. MsgBox("請最少指定送貨司機。") : DataGridView1.Rows(e.RowIndex).Cells("選擇").Value = False
  54. End If
  55. End If
  56. End Sub
  57. Private Sub DataGridView1_RowPostPaint(ByVal sender As Object, ByVal e As DataGridViewRowPostPaintEventArgs) Handles DataGridView1.RowPostPaint
  58. Dim linePen As New Pen(Color.Blue, 2)
  59. If e.RowIndex = DataGridView1.Rows.Count - 1 Then : Exit Sub
  60. Else
  61. If DataGridView1(1, e.RowIndex).Value.ToString <> DataGridView1(1, e.RowIndex + 1).Value.ToString Then
  62. Dim startX As Integer = IIf(DataGridView1.RowHeadersVisible, DataGridView1.RowHeadersWidth, 0)
  63. Dim startY As Integer = e.RowBounds.Top + e.RowBounds.Height - 1
  64. Dim endX As Integer = startX + DataGridView1.Columns.GetColumnsWidth(DataGridViewElementStates.Visible) - DataGridView1.HorizontalScrollingOffset
  65. e.Graphics.DrawLine(linePen, startX, startY, endX, startY) : Exit Sub
  66. End If
  67. End If
  68. End Sub
  69. Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  70. For i As Integer = 0 To DataGridView1.Rows.Count - 1
  71. If TextBox3.Text = DataGridView1.Rows(i).Cells("單據編號").Value.ToString Then
  72. If DataGridView1.Rows(i).Cells("司機").Value.ToString = "" Then
  73. For ii As Integer = 0 To DataGridView1.Rows.Count - 1
  74. DataGridView1.Rows(ii).Cells("選擇").Value = False
  75. Next
  76. MsgBox("請最少指定送貨司機。")
  77. Exit For
  78. End If
  79. DataGridView1.Rows(i).Cells("選擇").Value = True
  80. End If
  81. Next i
  82. End Sub
  83. Private Sub Button13_Click(sender As Object, e As EventArgs) Handles Button13.Click
  84. For i As Integer = 0 To DataGridView1.Rows.Count - 1
  85. If DataGridView1.Rows(i).Cells("司機").Value.ToString = "" Then
  86. For ii As Integer = 0 To DataGridView1.Rows.Count - 1
  87. DataGridView1.Rows(ii).Cells("選擇").Value = False
  88. Next
  89. MsgBox("請最少指定送貨司機。")
  90. Exit For
  91. End If
  92. DataGridView1.Rows(i).Cells("選擇").Value = True
  93. Next i
  94. End Sub
  95. Private Sub Button12_Click(sender As Object, e As EventArgs) Handles Button12.Click
  96. For i As Integer = 0 To DataGridView1.Rows.Count - 1 : DataGridView1.Rows(i).Cells("選擇").Value = False : Next i
  97. End Sub
  98. Private Sub Set_日期格式轉換()
  99. DTP = Format(DateTimePicker1.Value, "yyyy/MM/dd")
  100. End Sub
  101. Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
  102. Set_日期格式轉換() : Dim 出貨情況 As String
  103. For i As Integer = 0 To DataGridView1.Rows.Count - 1
  104. 資料數 = DataGridView1.Rows.Count : MyModule1.進度條()
  105. If DataGridView1.Rows(i).Cells("選擇").Value = True Then
  106. PA1 = DataGridView1.Rows(i).Cells("資料流水號").Value : SQL_出貨確認_倉儲明細表_銷售出庫確認() : conn.Close()
  107. If TextBox1.Text = "" Then : Else
  108. If DataGridView1.Rows(i).Cells("出貨備齊").Value = True Then : 出貨情況 = "完全出貨" : Else : 出貨情況 = "分批出貨" : End If
  109. PA1 = 出貨情況 : PA = TextBox1.Text : SQL_出貨確認_訂單控制表_出貨情況() : conn.Close()
  110. If 出貨情況 = "完全出貨" Then
  111. PA = TextBox1.Text : SQL_出貨確認_訂單明細表_出貨情況一() : conn.Close()
  112. ElseIf 出貨情況 = "分批出貨" Then
  113. PA = DataGridView1.Rows(i).Cells("訂單明細流水").Value : SQL_出貨確認_訂單明細表_出貨情況二() : conn.Close()
  114. End If
  115. End If
  116. End If
  117. Next : Set_清單() : MsgBox("出庫完成。") : MAOJI_ERP_SYS.ToolStripProgressBar1.Value = 0 : 最終數 = 0
  118. End Sub
  119. Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
  120. PA1 = ComboBox6.Text : NU1 = ComboBox7.Text : PA2 = ComboBox8.Text : NU2 = ComboBox9.Text : PA = TextBox3.Text
  121. SQL_出貨單業務司機指定() : Set_清單()
  122. End Sub
  123. '-----------------------------滑鼠右鍵------------------------------------------------------------------------------------------------------------------------------------------
  124. Private Sub 重新整理ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 重新整理ToolStripMenuItem.Click
  125. Set_清單() : DateTimePicker1.Value = Today()
  126. End Sub
  127. Private Sub 依據單號全部選擇ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 依據單號全部選擇ToolStripMenuItem.Click
  128. Me.Button1.PerformClick()
  129. End Sub
  130. Private Sub 全部選擇ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 全部選擇ToolStripMenuItem.Click
  131. Me.Button13.PerformClick()
  132. End Sub
  133. Private Sub 全部取消ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 全部取消ToolStripMenuItem.Click
  134. Me.Button12.PerformClick()
  135. End Sub
  136. Private Sub 確認收料入庫ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 確認收料入庫ToolStripMenuItem.Click
  137. Me.Button4.PerformClick()
  138. End Sub
  139. End Class