Без опису
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

量產訂單輸入.vb 45KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524
  1. Option Strict Off
  2. Imports System.Data.SqlClient
  3. Public Class 量產訂單輸入
  4. ReadOnly conn As New SqlConnection
  5. ReadOnly da As New SqlDataAdapter
  6. ReadOnly cmd As New SqlCommand
  7. ReadOnly ds As New DataSet : ReadOnly ds1 As New DataSet : ReadOnly ds2 As New DataSet : ReadOnly ds3 As New DataSet : ReadOnly ds4 As New DataSet
  8. Dim dr As SqlDataReader
  9. Dim DTP As String : Dim DTP1 As String : Dim DDFF As String
  10. Private Sub Set_清單2()
  11. DataGridView4.DataSource = Nothing : ds2.Clear()
  12. DataGridView4.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  13. DataGridView4.ColumnHeadersHeight = 25
  14. DataGridView4.AllowUserToAddRows = False
  15. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  16. If PA = "" Then : DDFF = "" : Else
  17. DDFF = " WHERE 訂單流水號 LIKE N'%" & PA & "%' OR 客戶訂單號 LIKE N'%" & PA & "%' OR ConstructionName LIKE N'%" & PA & "%' OR ModeOfDelivery LIKE N'%" & PA & "%' OR
  18. DeliveryTerms LIKE N'%" & PA & "%' OR OrgShipDate LIKE N'%" & PA & "%' OR FromPort LIKE N'%" & PA & "%' OR ToPort LIKE N'%" & PA & "%' OR
  19. ShippingCarrier LIKE N'%" & PA & "%' OR VendorReference LIKE N'%" & PA & "%' OR ModifiedDate LIKE N'%" & PA & "%' OR CustomerName LIKE N'%" & PA & "%' OR
  20. ShipDate LIKE N'%" & PA & "%' OR SalesOrder LIKE N'%" & PA & "%' OR DeliveryAddress LIKE N'%" & PA & "%' OR 下單日 LIKE N'%" & PA & "%' OR 交期 LIKE N'%" & PA & "%' OR
  21. ETADate LIKE N'%" & PA & "%' OR CreatedDate LIKE N'%" & PA & "%' OR Brand LIKE N'%" & PA & "%' OR CustomerRequisition LIKE N'%" & PA & "%' OR 工廠 LIKE N'%" & PA & "%' "
  22. End If
  23. SQL1 = "SELECT 訂單流水號, 客戶訂單號, ConstructionName, ModeOfDelivery, DeliveryTerms, OrgShipDate, FromPort, ToPort,
  24. ShippingCarrier, VendorReference, ModifiedDate, CustomerName, ShipDate, SalesOrder, DeliveryAddress, 下單日,
  25. 交期, ETADate, CreatedDate, Brand, CustomerRequisition, 工廠
  26. FROM 訂單明細表抬頭 " & DDFF & " ORDER BY 訂單流水號 DESC"
  27. cmd.Connection = conn : cmd.CommandText = SQL1 : da.SelectCommand = cmd : da.Fill(ds2) : DataGridView4.DataSource = ds2.Tables(0) : conn.Close()
  28. DataGridView4.Columns(0).FillWeight = 120 : DataGridView4.Columns(1).FillWeight = 150 : DataGridView4.Columns(2).Visible = False : DataGridView4.Columns(3).Visible = False
  29. DataGridView4.Columns(4).Visible = False : DataGridView4.Columns(5).Visible = False : DataGridView4.Columns(6).Visible = False : DataGridView4.Columns(7).Visible = False
  30. DataGridView4.Columns(8).Visible = False : DataGridView4.Columns(9).Visible = False : DataGridView4.Columns(10).Visible = False : DataGridView4.Columns(11).Visible = False
  31. DataGridView4.Columns(12).Visible = False : DataGridView4.Columns(13).Visible = False : DataGridView4.Columns(14).Visible = False : DataGridView4.Columns(15).FillWeight = 90
  32. DataGridView4.Columns(16).FillWeight = 90 : DataGridView4.Columns(17).Visible = False : DataGridView4.Columns(18).Visible = False : DataGridView4.Columns(19).Visible = False
  33. DataGridView4.Columns(20).Visible = False : DataGridView4.Columns(21).Visible = False
  34. End Sub
  35. Private Sub Set_清單1()
  36. DataGridView2.DataSource = Nothing : ds1.Clear()
  37. DataGridView2.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  38. DataGridView2.ColumnHeadersHeight = 25
  39. DataGridView2.AllowUserToAddRows = False
  40. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  41. SQL1 = "SELECT 訂單顏色清單.顏色, METOO選擇按鈕.選擇 FROM 訂單顏色清單 LEFT OUTER JOIN METOO選擇按鈕 ON 訂單顏色清單.顏色 = METOO選擇按鈕.對應
  42. WHERE 訂單顏色清單.顏色 LIKE N'%" & TextBox1.Text & "%'
  43. ORDER BY 訂單顏色清單.顏色"
  44. cmd.Connection = conn : cmd.CommandText = SQL1 : da.SelectCommand = cmd : da.Fill(ds1) : DataGridView2.DataSource = ds1.Tables(0) : conn.Close()
  45. DataGridView2.Columns(0).FillWeight = 110 : DataGridView2.Columns(1).FillWeight = 40
  46. For i As Integer = 0 To DataGridView2.Rows.Count - 1
  47. DataGridView2.Rows(i).Cells("選擇").Value = False
  48. Next i
  49. End Sub
  50. Private Sub Set_清單3()
  51. DataGridView3.DataSource = Nothing : ds3.Clear()
  52. DataGridView3.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  53. DataGridView3.ColumnHeadersHeight = 40
  54. DataGridView3.AllowUserToAddRows = False
  55. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  56. SQL1 = "SELECT 資料流水號, 年份季度, 客戶訂單號, 型體號碼, GOODBOX AS 型體名稱, APMA確認 AS 顏色, TVW AS 楦型, 訂單數量, 工廠回復交期 AS 工廠交期, 客戶交期 AS 交期開始, 客戶交期1 AS 交期結束,
  57. 單價, 總金額, 備註, 生產工廠, 訂單種類, BUYER, CFMSPEC AS 訂單屬性, CFMSAMPLE, TRIAL1, TRIAL2, TRIAL3, TRIAL4, 包裝確認時間, 貼標時間, 裁斷時間, 針車時間, 成型時間, 驗貨時間,
  58. 實際離廠日, 訂單流水號, 明細建檔, LEATHER, LEA_Note, CXL, CXLTime, 出貨數量, PO_S_Date, Requested_XF, Confirm_XF, Revised_XF, Special_Packaging, Remarks, 出貨地,
  59. 楦頭號, 材質, 長期試穿, 面料, 副料, 中底, 鞋墊, 大底, 跟, 工廠進度表備註1, 七號模具, 工廠進度表備註2, 國標測試, 客戶包裝確認, 東莞業務備註, 驗貨報告圖片
  60. FROM 訂單控制表 WHERE 訂單流水號 LIKE N'" & TextBox12.Text & "' ORDER BY GOODBOX, APMA確認, TVW"
  61. cmd.Connection = conn : cmd.CommandText = SQL1 : da.SelectCommand = cmd : da.Fill(ds3) : DataGridView3.DataSource = ds3.Tables(0) : conn.Close()
  62. DataGridView3.Columns(0).FillWeight = 85 : DataGridView3.Columns(1).FillWeight = 70 : DataGridView3.Columns(2).FillWeight = 130 : DataGridView3.Columns(3).FillWeight = 120
  63. DataGridView3.Columns(4).FillWeight = 130 : DataGridView3.Columns(5).FillWeight = 80 : DataGridView3.Columns(6).FillWeight = 50 : DataGridView3.Columns(7).FillWeight = 80
  64. DataGridView3.Columns(8).FillWeight = 90 : DataGridView3.Columns(9).FillWeight = 90 : DataGridView3.Columns(10).FillWeight = 90
  65. DataGridView3.Columns(11).Visible = False : DataGridView3.Columns(12).Visible = False
  66. DataGridView3.Columns(13).FillWeight = 130 : DataGridView3.Columns(14).FillWeight = 80 : DataGridView3.Columns(15).FillWeight = 120 : DataGridView3.Columns(16).FillWeight = 130
  67. DataGridView3.Columns(17).Visible = False : DataGridView3.Columns(18).Visible = False : DataGridView3.Columns(19).Visible = False : DataGridView3.Columns(20).Visible = False
  68. DataGridView3.Columns(21).Visible = False : DataGridView3.Columns(22).Visible = False : DataGridView3.Columns(23).Visible = False : DataGridView3.Columns(24).Visible = False
  69. DataGridView3.Columns(25).Visible = False : DataGridView3.Columns(26).Visible = False : DataGridView3.Columns(27).Visible = False : DataGridView3.Columns(28).Visible = False
  70. DataGridView3.Columns(29).Visible = False : DataGridView3.Columns(30).Visible = False : DataGridView3.Columns(31).Visible = False : DataGridView3.Columns(32).Visible = False
  71. DataGridView3.Columns(33).Visible = False : DataGridView3.Columns(34).Visible = False : DataGridView3.Columns(35).Visible = False : DataGridView3.Columns(36).Visible = False
  72. DataGridView3.Columns(37).Visible = False : DataGridView3.Columns(38).Visible = False : DataGridView3.Columns(39).Visible = False : DataGridView3.Columns(40).Visible = False
  73. DataGridView3.Columns(41).Visible = False : DataGridView3.Columns(42).Visible = False : DataGridView3.Columns(43).Visible = False : DataGridView3.Columns(44).Visible = False
  74. DataGridView3.Columns(45).Visible = False : DataGridView3.Columns(46).Visible = False : DataGridView3.Columns(47).Visible = False : DataGridView3.Columns(48).Visible = False
  75. DataGridView3.Columns(49).Visible = False : DataGridView3.Columns(50).Visible = False : DataGridView3.Columns(51).Visible = False : DataGridView3.Columns(52).Visible = False
  76. DataGridView3.Columns(53).Visible = False : DataGridView3.Columns(54).Visible = False : DataGridView3.Columns(55).Visible = False : DataGridView3.Columns(56).Visible = False
  77. DataGridView3.Columns(57).Visible = False : DataGridView3.Columns(58).Visible = False : DataGridView3.Columns(59).Visible = False
  78. DataGridView3.Columns(7).DefaultCellStyle.Format = "#,##0"
  79. DataGridView3.Columns(7).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight
  80. DataGridView3.Columns(7).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight
  81. DataGridView3.EditMode = DataGridViewEditMode.EditOnEnter
  82. End Sub
  83. Private Sub Set_清單4()
  84. DataGridView5.DataSource = Nothing : ds4.Clear()
  85. DataGridView5.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  86. DataGridView5.ColumnHeadersHeight = 25
  87. DataGridView5.AllowUserToAddRows = False
  88. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  89. SQL1 = "SELECT 資料流水號, 客戶訂單號, ItemNumber, ProductName, Color, DM, [4], [4.5], [5], [5.5], [6], [6.5], [7], [7.5], [8], [8.5], [9], [9.5], [10], [10.5], [11], [11.5], [12], [12.5],
  90. [13], [14], 訂單流水號
  91. FROM 訂單明細表 WHERE 訂單流水號 LIKE N'" & TextBox12.Text & "' ORDER BY ProductName, Color, DM"
  92. cmd.Connection = conn : cmd.CommandText = SQL1 : da.SelectCommand = cmd : da.Fill(ds4) : DataGridView5.DataSource = ds4.Tables(0) : conn.Close()
  93. DataGridView5.Columns(0).FillWeight = 85 : DataGridView5.Columns(1).FillWeight = 150 : DataGridView5.Columns(2).FillWeight = 120 : DataGridView5.Columns(3).FillWeight = 150
  94. DataGridView5.Columns(4).FillWeight = 80 : DataGridView5.Columns(5).FillWeight = 50 : DataGridView5.Columns(6).FillWeight = 38 : DataGridView5.Columns(7).FillWeight = 37
  95. DataGridView5.Columns(8).FillWeight = 38 : DataGridView5.Columns(9).FillWeight = 37 : DataGridView5.Columns(10).FillWeight = 38 : DataGridView5.Columns(11).FillWeight = 37
  96. DataGridView5.Columns(12).FillWeight = 38 : DataGridView5.Columns(13).FillWeight = 37 : DataGridView5.Columns(14).FillWeight = 38 : DataGridView5.Columns(15).FillWeight = 37
  97. DataGridView5.Columns(16).FillWeight = 38 : DataGridView5.Columns(17).FillWeight = 37 : DataGridView5.Columns(18).FillWeight = 38 : DataGridView5.Columns(19).FillWeight = 37
  98. DataGridView5.Columns(20).FillWeight = 38 : DataGridView5.Columns(21).FillWeight = 37 : DataGridView5.Columns(22).FillWeight = 38 : DataGridView5.Columns(23).FillWeight = 37
  99. DataGridView5.Columns(24).FillWeight = 38 : DataGridView5.Columns(25).FillWeight = 37 : DataGridView5.Columns(26).Visible = False
  100. DataGridView5.EditMode = DataGridViewEditMode.EditOnEnter
  101. End Sub
  102. Private Sub ComboBox1下拉表單資料載入()
  103. conn.Close()
  104. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  105. SQL1 = "SELECT 楦型 FROM 訂單控制表楦型清單 ORDER BY 楦型"
  106. cmd.CommandText = SQL1 : cmd.Connection = conn : dr = cmd.ExecuteReader : ComboBox1.Items.Clear()
  107. While (dr.Read()) : ComboBox1.Items.Add(dr("楦型")) : End While : conn.Close()
  108. End Sub
  109. Private Sub ComboBox2下拉表單資料載入()
  110. conn.Close()
  111. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  112. SQL1 = "SELECT 客戶簡稱 FROM 客戶控制表 ORDER BY 客戶簡稱"
  113. cmd.CommandText = SQL1 : cmd.Connection = conn : dr = cmd.ExecuteReader
  114. ComboBox2.Items.Clear() : While (dr.Read()) : ComboBox2.Items.Add(dr("客戶簡稱")) : End While : conn.Close()
  115. End Sub
  116. Private Sub ComboBox3下拉表單資料載入()
  117. conn.Close()
  118. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  119. SQL1 = "SELECT SEASON FROM 季節清單 ORDER BY SEASON"
  120. cmd.CommandText = SQL1 : cmd.Connection = conn : dr = cmd.ExecuteReader
  121. ComboBox3.Items.Clear() : While (dr.Read()) : ComboBox3.Items.Add(dr("SEASON")) : End While : conn.Close()
  122. End Sub
  123. Private Sub ComboBox4下拉表單資料載入()
  124. conn.Close()
  125. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  126. SQL1 = "SELECT MODEOFDELIVERY FROM MODEOFDELIVERY"
  127. cmd.CommandText = SQL1 : cmd.Connection = conn : dr = cmd.ExecuteReader : ComboBox4.Items.Clear()
  128. While (dr.Read()) : ComboBox4.Items.Add(dr("MODEOFDELIVERY")) : End While : conn.Close()
  129. End Sub
  130. Private Sub ComboBox5下拉表單資料載入()
  131. conn.Close()
  132. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  133. SQL1 = "SELECT DELIVERYTERMS FROM DELIVERYTERMS"
  134. cmd.CommandText = SQL1 : cmd.Connection = conn : dr = cmd.ExecuteReader : ComboBox5.Items.Clear()
  135. While (dr.Read()) : ComboBox5.Items.Add(dr("DELIVERYTERMS")) : End While : conn.Close()
  136. End Sub
  137. Private Sub ComboBox6下拉表單資料載入()
  138. conn.Close()
  139. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  140. SQL1 = "SELECT FOB FROM 港口清單"
  141. cmd.CommandText = SQL1 : cmd.Connection = conn : dr = cmd.ExecuteReader : ComboBox6.Items.Clear()
  142. While (dr.Read()) : ComboBox6.Items.Add(dr("FOB")) : End While : conn.Close()
  143. End Sub
  144. Private Sub ComboBox7下拉表單資料載入()
  145. conn.Close()
  146. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  147. SQL1 = "SELECT TOPORT FROM TOPORT ORDER BY TOPORT"
  148. cmd.CommandText = SQL1 : cmd.Connection = conn : dr = cmd.ExecuteReader : ComboBox7.Items.Clear()
  149. While (dr.Read()) : ComboBox7.Items.Add(dr("TOPORT")) : End While : conn.Close()
  150. End Sub
  151. Private Sub ComboBox8下拉表單資料載入()
  152. conn.Close()
  153. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  154. SQL1 = "SELECT REMARK FROM DELIVERYADDRESS ORDER BY REMARK"
  155. cmd.CommandText = SQL1 : cmd.Connection = conn : dr = cmd.ExecuteReader : ComboBox8.Items.Clear()
  156. While (dr.Read()) : ComboBox8.Items.Add(dr("REMARK")) : End While : conn.Close()
  157. End Sub
  158. Private Sub ComboBox9下拉表單資料載入()
  159. conn.Close()
  160. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  161. SQL1 = "SELECT 工廠 FROM 工廠控制表 GROUP BY 工廠 ORDER BY 工廠"
  162. cmd.CommandText = SQL1 : cmd.Connection = conn : dr = cmd.ExecuteReader : ComboBox9.Items.Clear()
  163. While (dr.Read()) : ComboBox9.Items.Add(dr("工廠")) : End While : conn.Close()
  164. End Sub
  165. Private Sub ComboBox11下拉表單資料載入()
  166. conn.Close()
  167. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  168. SQL1 = "SELECT 型體號碼 FROM 型體控制表 WHERE 客戶簡稱 LIKE N'" & ComboBox2.Text & "' GROUP BY 型體號碼 ORDER BY 型體號碼"
  169. cmd.CommandText = SQL1 : cmd.Connection = conn : dr = cmd.ExecuteReader
  170. ComboBox11.Items.Clear() : While (dr.Read()) : ComboBox11.Items.Add(dr("型體號碼")) : End While : conn.Close()
  171. End Sub
  172. Private Sub ComboBox12下拉表單資料載入()
  173. conn.Close()
  174. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  175. SQL1 = "SELECT 型體名稱 FROM 型體控制表 WHERE 型體號碼 LIKE N'" & ComboBox11.Text & "' GROUP BY 型體名稱 ORDER BY 型體名稱"
  176. cmd.CommandText = SQL1 : cmd.Connection = conn : dr = cmd.ExecuteReader
  177. ComboBox12.Items.Clear() : While (dr.Read()) : ComboBox12.Items.Add(dr("型體名稱")) : End While : conn.Close()
  178. End Sub
  179. Private Sub ComboBox13下拉表單資料載入()
  180. conn.Close()
  181. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  182. SQL1 = "SELECT CN FROM 模具開發控制表 WHERE (CN NOT LIKE '') GROUP BY CN ORDER BY CN"
  183. cmd.CommandText = SQL1 : cmd.Connection = conn : dr = cmd.ExecuteReader
  184. ComboBox13.Items.Clear() : While (dr.Read()) : ComboBox13.Items.Add(dr("CN")) : End While : conn.Close()
  185. End Sub
  186. Private Sub ComboBox14下拉表單資料載入()
  187. conn.Close()
  188. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  189. SQL1 = "SELECT CUST FROM MTTOOCUST清單 ORDER BY CUST"
  190. cmd.CommandText = SQL1 : cmd.Connection = conn : dr = cmd.ExecuteReader
  191. ComboBox14.Items.Clear() : While (dr.Read()) : ComboBox14.Items.Add(dr("CUST")) : End While : conn.Close()
  192. End Sub
  193. Private Sub 量產訂單輸入_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  194. Me.MdiParent = WINPROFIT_ERP_SYS : Me.WindowState = 2 : Me.AutoScroll = True
  195. TextBox12.Enabled = False : TextBox14.Enabled = False : TextBox15.Enabled = False
  196. Button4.Enabled = False : Button3.Enabled = False : Button17.Enabled = False : Button12.Enabled = False : DateTimePicker1.Visible = False
  197. ComboBox4下拉表單資料載入() : ComboBox5下拉表單資料載入() : ComboBox6下拉表單資料載入() : ComboBox7下拉表單資料載入() : ComboBox8下拉表單資料載入() : ComboBox9下拉表單資料載入()
  198. ComboBox1下拉表單資料載入() : ComboBox2下拉表單資料載入() : ComboBox3下拉表單資料載入() : ComboBox13下拉表單資料載入() : ComboBox14下拉表單資料載入()
  199. Set_清單2() : Set_清單1()
  200. End Sub
  201. Private Sub DataGridView4_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles DataGridView4.CellClick
  202. If e.RowIndex = -1 Then : Else
  203. ComboBox4下拉表單資料載入() : ComboBox5下拉表單資料載入() : ComboBox6下拉表單資料載入() : ComboBox7下拉表單資料載入() : ComboBox8下拉表單資料載入() : ComboBox9下拉表單資料載入()
  204. ComboBox1下拉表單資料載入() : ComboBox2下拉表單資料載入() : ComboBox3下拉表單資料載入() : ComboBox13下拉表單資料載入() : ComboBox14下拉表單資料載入()
  205. ComboBox7.Text = DataGridView4.Rows(e.RowIndex).Cells("ToPort").Value : ComboBox4.Text = DataGridView4.Rows(e.RowIndex).Cells("ModeOfDelivery").Value
  206. ComboBox5.Text = DataGridView4.Rows(e.RowIndex).Cells("DeliveryTerms").Value : ComboBox6.Text = DataGridView4.Rows(e.RowIndex).Cells("FromPort").Value
  207. TextBox13.Text = DataGridView4.Rows(e.RowIndex).Cells("客戶訂單號").Value : TextBox16.Text = DataGridView4.Rows(e.RowIndex).Cells("DeliveryAddress").Value
  208. ComboBox9.Text = DataGridView4.Rows(e.RowIndex).Cells("工廠").Value : ComboBox6.Text = DataGridView4.Rows(e.RowIndex).Cells("FromPort").Value
  209. ComboBox13.Text = DataGridView4.Rows(e.RowIndex).Cells("ConstructionName").Value : TextBox12.Text = DataGridView4.Rows(e.RowIndex).Cells("訂單流水號").Value
  210. ComboBox2.Text = DataGridView4.Rows(e.RowIndex).Cells("Brand").Value
  211. ComboBox14.Text = DataGridView4.Rows(e.RowIndex).Cells("CustomerName").Value.ToString()
  212. If DataGridView4.Rows(e.RowIndex).Cells("交期").Value.ToString = "" Then : Else : DateTimePicker5.Value = DataGridView4.Rows(e.RowIndex).Cells("交期").Value : End If
  213. If DataGridView4.Rows(e.RowIndex).Cells("下單日").Value.ToString = "" Then : Else : DateTimePicker6.Value = DataGridView4.Rows(e.RowIndex).Cells("下單日").Value : End If
  214. conn.Close()
  215. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  216. SQL1 = "SELECT REMARK FROM DELIVERYADDRESS WHERE DELIVERYADDRESS LIKE '" & TextBox16.Text & "'"
  217. cmd.Connection = conn : cmd.CommandText = SQL1 : dr = cmd.ExecuteReader
  218. If dr.Read() Then : ComboBox8.Text = dr("REMARK").ToString : End If : conn.Close()
  219. Set_清單3() : Set_清單4()
  220. TextBox14.Text = "0.00"
  221. For i As Integer = 0 To DataGridView5.Rows.Count - 1
  222. DataGridView3.Rows(i).Cells("訂單數量").Value = DataGridView5.Rows(i).Cells("4").Value + DataGridView5.Rows(i).Cells("4.5").Value + DataGridView5.Rows(i).Cells("5").Value +
  223. DataGridView5.Rows(i).Cells("5.5").Value + DataGridView5.Rows(i).Cells("6").Value + DataGridView5.Rows(i).Cells("6.5").Value + DataGridView5.Rows(i).Cells("7").Value +
  224. DataGridView5.Rows(i).Cells("7.5").Value + DataGridView5.Rows(i).Cells("8").Value + DataGridView5.Rows(i).Cells("8.5").Value + DataGridView5.Rows(i).Cells("9").Value +
  225. DataGridView5.Rows(i).Cells("9.5").Value + DataGridView5.Rows(i).Cells("10").Value + DataGridView5.Rows(i).Cells("10.5").Value + DataGridView5.Rows(i).Cells("11").Value +
  226. DataGridView5.Rows(i).Cells("11.5").Value + DataGridView5.Rows(i).Cells("12").Value + DataGridView5.Rows(i).Cells("12.5").Value + DataGridView5.Rows(i).Cells("13").Value +
  227. DataGridView5.Rows(i).Cells("14").Value
  228. Next i
  229. For i As Integer = 0 To DataGridView3.Rows.Count - 1
  230. TextBox14.Text = Val(TextBox14.Text) + DataGridView3.Rows(i).Cells("訂單數量").Value
  231. Next i
  232. TextBox14.Text = Format(Val(TextBox14.Text), "#,##0.00")
  233. ComboBox3.Text = DataGridView3.Rows(0).Cells("年份季度").Value : ComboBox10.Text = DataGridView3.Rows(0).Cells("訂單屬性").Value
  234. End If
  235. End Sub
  236. Private Sub DataGridView3_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles DataGridView3.CellClick
  237. If e.RowIndex = -1 Then : Else
  238. TextBox15.Text = DataGridView3.Rows(e.RowIndex).Cells("資料流水號").Value : ComboBox10.Text = DataGridView3.Rows(e.RowIndex).Cells("訂單屬性").Value
  239. ComboBox11.Text = DataGridView3.Rows(e.RowIndex).Cells("型體號碼").Value : ComboBox12.Text = DataGridView3.Rows(e.RowIndex).Cells("型體名稱").Value
  240. ComboBox1.Text = DataGridView3.Rows(e.RowIndex).Cells("楦型").Value
  241. End If
  242. End Sub
  243. Private Sub DataGridView5_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles DataGridView5.CellClick
  244. If e.RowIndex = -1 Then : Else
  245. TextBox15.Text = DataGridView5.Rows(e.RowIndex).Cells("資料流水號").Value : ComboBox11.Text = DataGridView5.Rows(e.RowIndex).Cells("ItemNumber").Value
  246. ComboBox12.Text = DataGridView5.Rows(e.RowIndex).Cells("ProductName").Value : ComboBox1.Text = DataGridView5.Rows(e.RowIndex).Cells("DM").Value
  247. End If
  248. End Sub
  249. Private Sub DataGridView3_CellEndEdit(ByVal sender As Object, ByVal e As DataGridViewCellEventArgs) Handles DataGridView3.CellEndEdit
  250. Dim EU(2) As String
  251. EU(0) = DataGridView3("交期開始", e.RowIndex).Value.ToString
  252. If EU(0) = "" Then
  253. Else
  254. DateTimePicker1.Text = EU(0)
  255. DataGridView3.Rows(e.RowIndex).Cells("交期開始").Value = Format(DateTimePicker1.Value, "yyyy/MM/dd")
  256. End If
  257. EU(1) = DataGridView3("交期結束", e.RowIndex).Value.ToString
  258. If EU(1) = "" Then
  259. Else
  260. DateTimePicker1.Text = EU(1)
  261. DataGridView3.Rows(e.RowIndex).Cells("交期結束").Value = Format(DateTimePicker1.Value, "yyyy/MM/dd")
  262. End If
  263. EU(2) = DataGridView3("工廠交期", e.RowIndex).Value.ToString
  264. If EU(2) = "" Then
  265. Else
  266. DateTimePicker1.Text = EU(2)
  267. DataGridView3.Rows(e.RowIndex).Cells("工廠交期").Value = Format(DateTimePicker1.Value, "yyyy/MM/dd")
  268. End If
  269. End Sub
  270. Private Sub DataGridView5_CellContentClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles DataGridView5.CellEndEdit
  271. TextBox14.Text = "0"
  272. For i As Integer = 0 To DataGridView5.Rows.Count - 1
  273. DataGridView3.Rows(i).Cells("訂單數量").Value = DataGridView5.Rows(i).Cells("4").Value + DataGridView5.Rows(i).Cells("4.5").Value + DataGridView5.Rows(i).Cells("5").Value +
  274. DataGridView5.Rows(i).Cells("5.5").Value + DataGridView5.Rows(i).Cells("6").Value + DataGridView5.Rows(i).Cells("6.5").Value + DataGridView5.Rows(i).Cells("7").Value +
  275. DataGridView5.Rows(i).Cells("7.5").Value + DataGridView5.Rows(i).Cells("8").Value + DataGridView5.Rows(i).Cells("8.5").Value + DataGridView5.Rows(i).Cells("9").Value +
  276. DataGridView5.Rows(i).Cells("9.5").Value + DataGridView5.Rows(i).Cells("10").Value + DataGridView5.Rows(i).Cells("10.5").Value + DataGridView5.Rows(i).Cells("11").Value +
  277. DataGridView5.Rows(i).Cells("11.5").Value + DataGridView5.Rows(i).Cells("12").Value + DataGridView5.Rows(i).Cells("12.5").Value + DataGridView5.Rows(i).Cells("13").Value +
  278. DataGridView5.Rows(i).Cells("14").Value
  279. Next i
  280. For i As Integer = 0 To DataGridView3.Rows.Count - 1
  281. TextBox14.Text = Val(TextBox14.Text) + DataGridView3.Rows(i).Cells("訂單數量").Value
  282. Next i
  283. TextBox14.Text = Format(Val(TextBox14.Text), "#,##0")
  284. End Sub
  285. Private Sub ComboBox2_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox2.TextChanged
  286. ComboBox11下拉表單資料載入()
  287. End Sub
  288. Private Sub ComboBox11_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox11.TextChanged
  289. ComboBox12下拉表單資料載入()
  290. End Sub
  291. Private Sub ComboBox8_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox8.TextChanged
  292. conn.Close()
  293. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  294. SQL1 = "SELECT DELIVERYADDRESS FROM DELIVERYADDRESS WHERE REMARK LIKE '" & ComboBox8.Text & "'"
  295. cmd.Connection = conn : cmd.CommandText = SQL1 : dr = cmd.ExecuteReader
  296. If dr.Read() Then : TextBox16.Text = dr("DELIVERYADDRESS").ToString : End If : conn.Close()
  297. End Sub
  298. Private Sub ComboBox9_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox9.TextChanged
  299. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  300. SQL1 = "SELECT 工廠, 供應商資料, 供應商地址 FROM 工廠控制表 WHERE 工廠 LIKE '" & ComboBox9.Text & "'"
  301. cmd.Connection = conn : cmd.CommandText = SQL1 : dr = cmd.ExecuteReader
  302. If dr.Read() Then : TextBox18.Text = dr("供應商資料").ToString : TextBox17.Text = dr("供應商地址").ToString : End If : conn.Close()
  303. End Sub
  304. Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged
  305. Set_清單1()
  306. End Sub
  307. Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
  308. PA = InputBox("請輸入要查詢的關鍵字") : Set_清單2() : PA = ""
  309. End Sub
  310. Private Sub Button16_Click(sender As Object, e As EventArgs) Handles Button16.Click
  311. FACTORY_資料管理.ShowDialog() :: ComboBox9下拉表單資料載入()
  312. End Sub
  313. Private Sub Button10_Click(sender As Object, e As EventArgs) Handles Button10.Click
  314. DELIVERY_ADDRESS__資料管理.ShowDialog() : ComboBox8下拉表單資料載入()
  315. End Sub
  316. Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
  317. 清單修改.Close() : 交貨條件修改 = True : 清單修改.ShowDialog() : ComboBox5下拉表單資料載入() : 交貨條件修改 = False
  318. End Sub
  319. Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
  320. 清單修改.Close() : 港口清單修改 = True : 清單修改.ShowDialog() : ComboBox6下拉表單資料載入() : 港口清單修改 = False
  321. End Sub
  322. Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click
  323. 清單修改.Close() : 到港清單修改 = True : 清單修改.ShowDialog() : ComboBox7下拉表單資料載入() : 到港清單修改 = False
  324. End Sub
  325. Private Sub Button8_Click(sender As Object, e As EventArgs) Handles Button8.Click
  326. 清單修改.Close() : 交貨管道修改 = True : 清單修改.ShowDialog() : ComboBox4下拉表單資料載入() : 交貨管道修改 = False
  327. End Sub
  328. Private Sub Button13_Click(sender As Object, e As EventArgs) Handles Button13.Click
  329. For i As Integer = 0 To DataGridView2.Rows.Count - 1
  330. DataGridView2.Rows(i).Cells("選擇").Value = False
  331. Next i
  332. End Sub
  333. Private Sub Button14_Click(sender As Object, e As EventArgs) Handles Button14.Click
  334. For i As Integer = 0 To DataGridView2.Rows.Count - 1
  335. DataGridView2.Rows(i).Cells("選擇").Value = True
  336. Next i
  337. End Sub
  338. Private Sub Button15_Click(sender As Object, e As EventArgs) Handles Button15.Click
  339. If TextBox15.Text = "" Then
  340. MsgBox("未選擇需要刪除的資料")
  341. Else
  342. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  343. SQL1 = "DELETE FROM 訂單控制表 WHERE (資料流水號 LIKE N'" & TextBox15.Text & "')"
  344. cmd.CommandText = SQL1 : cmd.Connection = conn : cmd.ExecuteNonQuery() : conn.Close()
  345. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  346. SQL1 = "DELETE FROM 訂單明細表 WHERE (資料流水號 LIKE N'" & TextBox15.Text & "')"
  347. cmd.CommandText = SQL1 : cmd.Connection = conn : cmd.ExecuteNonQuery() : conn.Close()
  348. Set_清單3() : Set_清單4()
  349. End If
  350. End Sub
  351. Private Sub Set_日期格式轉換()
  352. DTP = Format(Today(), "yyyy/MM/dd") : DTP1 = Format(Today(), "yyyyMMdd")
  353. End Sub
  354. Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  355. Dim aa1 As MsgBoxResult
  356. aa1 = MsgBox("確定要生成--新的--量產訂單號碼?", MsgBoxStyle.OkCancel)
  357. If aa1 = MsgBoxResult.Ok Then
  358. Button1.Enabled = False : Button11.Enabled = False : Button4.Enabled = True : Button3.Enabled = False : Button17.Enabled = False
  359. Dim NUM0 As Integer
  360. Set_日期格式轉換()
  361. For i As Integer = 1 To 999
  362. NUM0 = 0 + i
  363. If NUM0 < 10 Then : TextBox12.Text = "WP-" & DTP1 & "-00" & NUM0
  364. ElseIf NUM0 > 9 And NUM0 < 100 Then : TextBox12.Text = "WP-" & DTP1 & "-0" & NUM0
  365. ElseIf NUM0 > 99 Then : TextBox12.Text = "WP-" & DTP1 & "-" & NUM0
  366. End If
  367. conn.Close()
  368. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  369. SQL1 = "SELECT TOP (1) 訂單流水號 FROM 訂單控制表 WHERE ( 訂單流水號 LIKE '" & TextBox12.Text & "')"
  370. cmd.Connection = conn : cmd.CommandText = SQL1 : dr = cmd.ExecuteReader
  371. If dr.Read() Then : Else : i = 999 : conn.Close() : End If : conn.Close()
  372. Next
  373. End If
  374. End Sub
  375. Private Sub Button11_Click(sender As Object, e As EventArgs) Handles Button11.Click
  376. If TextBox12.Text = "" Then
  377. MsgBox("請先選擇量產訂單號")
  378. Else
  379. Button1.Enabled = False : Button11.Enabled = False : Button12.Enabled = True : Button3.Enabled = True : Button17.Enabled = True
  380. End If
  381. End Sub
  382. Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
  383. If ComboBox2.Text = "" Or TextBox13.Text = "" Or ComboBox4.Text = "" Or ComboBox5.Text = "" Or ComboBox6.Text = "" Or
  384. ComboBox7.Text = "" Or ComboBox8.Text = "" Or ComboBox9.Text = "" Or ComboBox14.Text = "" Or ComboBox3.Text = "" Then
  385. MsgBox("生成量產訂單抬頭之前,請注意紅色字體部分資料不可有誤。")
  386. Else
  387. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  388. SQL1 = "INSERT INTO 訂單明細表抬頭 (客戶訂單號, 訂單流水號, ConstructionName, ModeOfDelivery, DeliveryTerms, OrgShipDate, FromPort, ToPort,
  389. ShippingCarrier, VendorReference, ModifiedDate, CustomerName, ShipDate, SalesOrder, DeliveryAddress, 下單日,
  390. 交期, ETADate, CreatedDate, Brand, CustomerRequisition, 工廠)
  391. VALUES (N'" & TextBox13.Text & "', N'" & TextBox12.Text & "', N'" & ComboBox13.Text & "', N'" & ComboBox4.Text & "', N'" & ComboBox5.Text &
  392. "', N'" & Format(DateTimePicker5.Value, "yyyy/MM/dd") &
  393. "', N'" & ComboBox6.Text & "', N'" & ComboBox7.Text & "', N'', N'', N'" & Format(DateTimePicker6.Value, "yyyy/MM/dd") & "', N'" & ComboBox14.Text &
  394. "', N'" & Format(DateTimePicker5.Value, "yyyy/MM/dd") & "', N'', N'" & TextBox16.Text &
  395. "', N'" & Format(DateTimePicker6.Value, "yyyy/MM/dd") & "', N'" & Format(DateTimePicker5.Value, "yyyy/MM/dd") & "', N'', N'" & Format(DateTimePicker6.Value, "yyyy/MM/dd") &
  396. "', N'" & ComboBox2.Text & "', N'', N'" & ComboBox9.Text & "')"
  397. cmd.Connection = conn : cmd.CommandText = SQL1 : cmd.ExecuteNonQuery() : conn.Close()
  398. Button1.Enabled = False : Button11.Enabled = False : Button4.Enabled = False : Button12.Enabled = True
  399. End If
  400. End Sub
  401. Private Sub Button12_Click(sender As Object, e As EventArgs) Handles Button12.Click
  402. If ComboBox1.Text = "" Then
  403. MsgBox("沒有選擇楦型。")
  404. Else
  405. For i As Integer = 0 To DataGridView2.Rows.Count - 1
  406. 資料數 = DataGridView2.Rows.Count : MyModule1.進度條()
  407. If DataGridView2.Rows(i).Cells("選擇").Value = True Then
  408. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  409. SQL1 = "SELECT TOP (1) 資料流水號 FROM 訂單控制表 GROUP BY 資料流水號 ORDER BY 資料流水號 DESC"
  410. cmd.Connection = conn : cmd.CommandText = SQL1 : dr = cmd.ExecuteReader
  411. If dr.Read() Then : TextBox15.Text = dr("資料流水號").ToString : Else : TextBox15.Text = "PO00000000" : End If
  412. conn.Close()
  413. Dim NUM1 As Integer
  414. NUM1 = Double.Parse(Strings.Right(TextBox15.Text, 8)) + 1
  415. If NUM1 < 10 Then : TextBox15.Text = "PO" & "0000000" & NUM1
  416. ElseIf NUM1 > 9 And NUM1 < 100 Then : TextBox15.Text = "PO" & "000000" & NUM1
  417. ElseIf NUM1 > 99 And NUM1 < 1000 Then : TextBox15.Text = "PO" & "00000" & NUM1
  418. ElseIf NUM1 > 999 And NUM1 < 10000 Then : TextBox15.Text = "PO" & "0000" & NUM1
  419. ElseIf NUM1 > 9999 And NUM1 < 100000 Then : TextBox15.Text = "PO" & "000" & NUM1
  420. ElseIf NUM1 > 99999 And NUM1 < 100000 Then : TextBox15.Text = "PO" & "00" & NUM1
  421. ElseIf NUM1 > 999999 And NUM1 < 1000000 Then : TextBox15.Text = "PO" & "0" & NUM1
  422. ElseIf NUM1 > 9999999 Then : TextBox15.Text = "PO" & NUM1 + 1
  423. End If
  424. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  425. SQL1 = "INSERT INTO 訂單控制表 (訂單流水號, 年份季度, 客戶訂單號, 型體號碼, GOODBOX, 訂單數量, 客戶交期, 客戶交期1, 單價, 總金額, 備註, 生產工廠, 訂單種類, BUYER, CFMSPEC,
  426. CFMSAMPLE, TRIAL1, TRIAL2, TRIAL3, TRIAL4, 包裝確認時間, 貼標時間, 裁斷時間, 針車時間, 成型時間, 驗貨時間, 實際離廠日, 資料流水號, 明細建檔,
  427. LEATHER, LEA_Note, CXL, CXLTime, 出貨數量, PO_S_Date, Requested_XF, Confirm_XF, Revised_XF, Special_Packaging, Remarks, 出貨地, TVW, 楦頭號,
  428. 材質, 長期試穿, 面料, 副料, 中底, 鞋墊, 大底, 跟, 工廠進度表備註1, 七號模具, 工廠進度表備註2, 國標測試, 客戶包裝確認, 東莞業務備註, APMA確認,
  429. 驗貨報告圖片, 工廠回復交期)
  430. VALUES (N'" & TextBox12.Text & "', N'" & ComboBox3.Text & "', N'" & TextBox13.Text & "', N'" & ComboBox11.Text & "', N'" & ComboBox12.Text &
  431. "', N'0', N'" & Format(DateTimePicker3.Value, "yyyy/MM/dd") & "', N'" & Format(DateTimePicker4.Value, "yyyy/MM/dd") &
  432. "', N'0', N'0', N'', N'" & ComboBox9.Text & "', N'', N'" & ComboBox2.Text & "', N'" & ComboBox10.Text &
  433. "', N'', N'', N'', N'', N'', N'', N'', N'', N'', N'', N'', N'', N'" & TextBox15.Text & "', N'1', N'', N'', N'0', N'', N'0', N'', N'', N'', N'', N'', N'', N'" &
  434. "', N'" & ComboBox1.Text & "', N'', N'', N'', N'', N'', N'', N'', N'', N'', N'', N'', N'', N'0', N'', N'', N'" & DataGridView2.Rows(i).Cells("顏色").Value &
  435. "', N'', N'" & Format(DateTimePicker2.Value, "yyyy/MM/dd") & "')"
  436. cmd.Connection = conn : cmd.CommandText = SQL1 : cmd.ExecuteNonQuery() : conn.Close()
  437. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  438. SQL1 = "INSERT INTO 訂單明細表 (訂單流水號, 客戶訂單號, ItemNumber, ProductName, Color, DM, [4], [4.5], [5], [5.5], [6], [6.5], [7], [7.5], [8], [8.5], [9],
  439. [9.5], [10], [10.5], [11], [11.5], [12], [12.5], [13], [14], 資料流水號)
  440. VALUES (N'" & TextBox12.Text & "', N'" & TextBox13.Text & "', N'" & ComboBox11.Text & "', N'" & ComboBox12.Text & "', N'" & DataGridView2.Rows(i).Cells("顏色").Value &
  441. "', N'" & ComboBox1.Text & "', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0', N'0" &
  442. "', N'" & TextBox15.Text & "')"
  443. cmd.Connection = conn : cmd.CommandText = SQL1 : cmd.ExecuteNonQuery() : conn.Close()
  444. End If
  445. Next i : WINPROFIT_ERP_SYS.ToolStripProgressBar1.Value = 0 : 最終數 = 0
  446. Set_清單3() : Set_清單4() : ComboBox1下拉表單資料載入()
  447. Button3.Enabled = True : Button17.Enabled = True
  448. End If
  449. End Sub
  450. Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
  451. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  452. SQL1 = "UPDATE 訂單明細表抬頭 SET ModeOfDelivery = N'" & ComboBox4.Text & "', DeliveryTerms = N'" & ComboBox5.Text & "', FromPort = N'" & ComboBox6.Text & "',
  453. ToPort = N'" & ComboBox7.Text & "', 工廠 = N'" & ComboBox9.Text & "', DeliveryAddress = N'" & TextBox16.Text & "',
  454. 交期 = N'" & Format(DateTimePicker5.Value, "yyyy/MM/dd") & "', ShipDate = N'" & Format(DateTimePicker5.Value, "yyyy/MM/dd") & "',
  455. OrgShipDate = N'" & Format(DateTimePicker5.Value, "yyyy/MM/dd") & "', Brand = N'" & ComboBox2.Text & "'
  456. WHERE (訂單流水號 LIKE N'" & TextBox12.Text & "')"
  457. cmd.CommandText = SQL1 : cmd.ExecuteNonQuery() : conn.Close()
  458. For i As Integer = 0 To DataGridView3.Rows.Count - 1
  459. 資料數 = DataGridView3.Rows.Count : MyModule1.進度條()
  460. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  461. SQL1 = "UPDATE 訂單控制表 SET 訂單數量 = N'" & DataGridView3.Rows(i).Cells("訂單數量").Value & "', 客戶交期 = N'" & DataGridView3.Rows(i).Cells("交期開始").Value &
  462. "', 客戶交期1 = N'" & DataGridView3.Rows(i).Cells("交期結束").Value & "', 備註 = N'" & DataGridView3.Rows(i).Cells("備註").Value &
  463. "', 工廠回復交期 = N'" & DataGridView3.Rows(i).Cells("工廠交期").Value & "', BUYER = N'" & DataGridView3.Rows(i).Cells("BUYER").Value &
  464. "', CFMSPEC = N'" & ComboBox10.Text & "', APMA確認 = N'" & DataGridView3.Rows(i).Cells("顏色").Value & "'
  465. WHERE (資料流水號 LIKE N'" & DataGridView3.Rows(i).Cells("資料流水號").Value & "')"
  466. cmd.CommandText = SQL1 : cmd.ExecuteNonQuery() : conn.Close()
  467. Next i : WINPROFIT_ERP_SYS.ToolStripProgressBar1.Value = 0 : 最終數 = 0
  468. For i As Integer = 0 To DataGridView5.Rows.Count - 1
  469. 資料數 = DataGridView5.Rows.Count : MyModule1.進度條()
  470. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  471. SQL1 = "UPDATE 訂單明細表 SET [4] = N'" & DataGridView5.Rows(i).Cells("4").Value & "', [4.5] = N'" & DataGridView5.Rows(i).Cells("4.5").Value &
  472. "', [5] = N'" & DataGridView5.Rows(i).Cells("5").Value & "', [5.5] = N'" & DataGridView5.Rows(i).Cells("5.5").Value &
  473. "', [6] = N'" & DataGridView5.Rows(i).Cells("6").Value & "', [6.5] = N'" & DataGridView5.Rows(i).Cells("6.5").Value &
  474. "', [7] = N'" & DataGridView5.Rows(i).Cells("7").Value & "', [7.5] = N'" & DataGridView5.Rows(i).Cells("7.5").Value &
  475. "', [8] = N'" & DataGridView5.Rows(i).Cells("8").Value & "', [8.5] = N'" & DataGridView5.Rows(i).Cells("8.5").Value &
  476. "', [9] = N'" & DataGridView5.Rows(i).Cells("9").Value & "', [9.5] = N'" & DataGridView5.Rows(i).Cells("9.5").Value &
  477. "', [10] = N'" & DataGridView5.Rows(i).Cells("10").Value & "', [10.5] = N'" & DataGridView5.Rows(i).Cells("10.5").Value &
  478. "', [11] = N'" & DataGridView5.Rows(i).Cells("11").Value & "', [11.5] = N'" & DataGridView5.Rows(i).Cells("11.5").Value &
  479. "', [12] = N'" & DataGridView5.Rows(i).Cells("12").Value & "', [12.5] = N'" & DataGridView5.Rows(i).Cells("12.5").Value &
  480. "', [13] = N'" & DataGridView5.Rows(i).Cells("13").Value & "', [14] = N'" & DataGridView5.Rows(i).Cells("14").Value &
  481. "', Color = N'" & DataGridView5.Rows(i).Cells("Color").Value & "'
  482. WHERE (資料流水號 LIKE N'" & DataGridView5.Rows(i).Cells("資料流水號").Value & "')"
  483. cmd.CommandText = SQL1 : cmd.ExecuteNonQuery() : conn.Close()
  484. Next i : WINPROFIT_ERP_SYS.ToolStripProgressBar1.Value = 0 : 最終數 = 0
  485. MsgBox("存檔完成。") : Set_清單2() : Set_清單2()
  486. Button1.Enabled = True : Button11.Enabled = True : Button4.Enabled = False : Button12.Enabled = False : Button3.Enabled = False : Button17.Enabled = False
  487. End Sub
  488. Private Sub Button17_Click(sender As Object, e As EventArgs) Handles Button17.Click
  489. For i As Integer = 0 To DataGridView3.Rows.Count - 1
  490. DataGridView3.Rows(i).Cells("BUYER").Value = ComboBox2.Text
  491. Next
  492. MsgBox("注意還未存檔喔")
  493. End Sub
  494. Private Sub Button9_Click(sender As Object, e As EventArgs) Handles Button9.Click
  495. 清單修改.Close() : 訂單顏色修改 = True : 清單修改.ShowDialog() : Set_清單1() : 訂單顏色修改 = False
  496. End Sub
  497. Private Sub Button18_Click(sender As Object, e As EventArgs) Handles Button18.Click
  498. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  499. SQL1 = "UPDATE 訂單控制表 SET 型體號碼 = N'" & ComboBox11.Text & "', GOODBOX = N'" & ComboBox12.Text & "' WHERE 資料流水號 LIKE '" & TextBox15.Text & "'"
  500. cmd.Connection = conn : cmd.CommandText = SQL1 : cmd.ExecuteNonQuery() : conn.Close()
  501. If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
  502. SQL1 = "UPDATE 訂單明細表 SET ItemNumber = N'" & ComboBox11.Text & "', ProductName = N'" & ComboBox12.Text & "' WHERE 資料流水號 LIKE '" & TextBox15.Text & "'"
  503. cmd.Connection = conn : cmd.CommandText = SQL1 : cmd.ExecuteNonQuery() : conn.Close()
  504. Set_清單3() : Set_清單4()
  505. End Sub
  506. Private Sub ComboBox2_SelectedIndexChanged_1(sender As Object, e As EventArgs) Handles ComboBox2.SelectedIndexChanged
  507. For i As Integer = 0 To DataGridView3.Rows.Count - 1
  508. DataGridView3.Rows(i).Cells("BUYER").Value = ComboBox2.Text
  509. Next
  510. End Sub
  511. End Class