Nessuna descrizione
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

模具開發控制表.vb 28KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382
  1. Option Strict Off
  2. Imports System.IO
  3. Imports System.Net
  4. Imports Microsoft.Office.Interop.Excel.XlUnderlineStyle
  5. Imports Microsoft.Office.Interop.Excel.Constants
  6. Imports Microsoft.Office.Interop.Excel.XlBordersIndex
  7. Imports Microsoft.Office.Interop.Excel.XlLineStyle
  8. Imports Microsoft.Office.Interop.Excel.XlBorderWeight
  9. Imports Microsoft.Office.Interop.Excel.XlThemeFont
  10. Imports Microsoft.Office.Interop.Excel.XlThemeColor
  11. Imports Microsoft.Office.Interop.Excel.XlWindowState
  12. Imports Microsoft.Office.Interop.Excel
  13. Imports System.Net.WebRequestMethods
  14. Public Class 模具開發控制表
  15. Public Property Credentials As ICredentials
  16. Private ReadOnly ds, ds1, ds2, ds3 As New DataSet
  17. Dim xlApp As Application : Dim xlBook As Workbook : Dim xlSheet As Worksheet
  18. Private Sub Set_楦頭規格表清單()
  19. 清單_dgv.DataSource = Nothing : ds.Clear()
  20. 清單_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  21. 清單_dgv.ColumnHeadersHeight = 25
  22. 清單_dgv.AllowUserToAddRows = False
  23. SQL_模具開發控制表清單()
  24. da.Fill(ds) : 清單_dgv.DataSource = ds.Tables(0) : conn.Close()
  25. 清單_dgv.Columns(0).Width = 142 : 清單_dgv.Columns(1).Visible = False : 清單_dgv.Columns(2).Visible = False : 清單_dgv.Columns(3).Visible = False
  26. 清單_dgv.Columns(4).Width = 142 : 清單_dgv.Columns(5).Visible = False : 清單_dgv.Columns(6).Visible = False : 清單_dgv.Columns(7).Visible = False
  27. 清單_dgv.Columns(8).Visible = False : 清單_dgv.Columns(9).Visible = False : 清單_dgv.Columns(10).Visible = False : 清單_dgv.Columns(11).Visible = False
  28. 清單_dgv.Columns(12).Visible = False : 清單_dgv.Columns(13).Visible = False : 清單_dgv.Columns(14).Visible = False
  29. End Sub
  30. Private Sub ComboBox1下拉表單資料載入()
  31. SQL_下拉清單1()
  32. 模具廠_cb.Items.Clear() : While (dr.Read()) : 模具廠_cb.Items.Add(dr("廠商")) : End While : conn.Close()
  33. End Sub
  34. Private Sub ComboBox2下拉表單資料載入()
  35. SQL_下拉清單2()
  36. 結構_cb.Items.Clear() : While (dr.Read()) : 結構_cb.Items.Add(dr("結構")) : End While : conn.Close()
  37. End Sub
  38. Private Sub ComboBox3下拉表單資料載入()
  39. SQL_下拉清單3()
  40. 材質_cb.Items.Clear() : While (dr.Read()) : 材質_cb.Items.Add(dr("材質")) : End While : conn.Close()
  41. End Sub
  42. Private Sub ComboBox4下拉表單資料載入()
  43. SQL_下拉清單4()
  44. 楦頭編號_cb.Items.Clear() : While (dr.Read()) : 楦頭編號_cb.Items.Add(dr("楦頭編號")) : End While : conn.Close()
  45. End Sub
  46. Private Sub ComboBox5下拉表單資料載入()
  47. SQL_下拉清單5()
  48. 品牌_cb.Items.Clear() : While (dr.Read()) : 品牌_cb.Items.Add(dr("CUST")) : End While : conn.Close()
  49. End Sub
  50. Private Sub ComboBox6下拉表單資料載入()
  51. SQL_下拉清單6()
  52. 大底廠_cb.Items.Clear() : While (dr.Read()) : 大底廠_cb.Items.Add(dr("廠商")) : End While : conn.Close()
  53. End Sub
  54. Private Sub ComboBox7下拉表單資料載入()
  55. SQL_下拉清單7()
  56. 季節_cb.Items.Clear() : While (dr.Read()) : 季節_cb.Items.Add(dr("SEASON")) : End While : conn.Close()
  57. End Sub
  58. Private Sub 模具開發控制表_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  59. Me.MdiParent = WINPROFIT_ERP_SYS : Me.WindowState = 2 : Me.AutoScroll = True
  60. ComboBox1下拉表單資料載入() : ComboBox2下拉表單資料載入() : ComboBox3下拉表單資料載入() : ComboBox4下拉表單資料載入() : ComboBox5下拉表單資料載入() : ComboBox6下拉表單資料載入()
  61. ComboBox7下拉表單資料載入() : Set_楦頭規格表清單()
  62. 模具開發單編碼_tb.Enabled = False : TextBox7.Visible = False : TextBox8.Visible = False : TextBox9.Visible = False
  63. 模具廠_cb.Enabled = False : 結構_cb.Enabled = False : 材質_cb.Enabled = False : 楦頭編號_cb.Enabled = False : 品牌_cb.Enabled = False : 大底廠_cb.Enabled = False : 季節_cb.Enabled = False
  64. 模具編號_tb.Enabled = False : 參考漾鞋編號_tb.Enabled = False : 尺寸_tb.Enabled = False : 備註_tb.Enabled = False : 儲存新增_bt.Enabled = False : 儲存修改_bt.Enabled = False
  65. 新增_bt.Enabled = True : 修改_bt.Enabled = True
  66. WINPROFIT_ERP_SYS.WindowState = 2
  67. If FolderBrowserDialog1.ShowDialog = DialogResult.OK Then
  68. WebBrowser2.Navigate(FolderBrowserDialog1.SelectedPath)
  69. End If
  70. End Sub
  71. Private Sub 圖片導入()
  72. SQL_圖片導入()
  73. PictureBox1.Image = Nothing
  74. While dr.Read() = True
  75. Dim unused As Byte() = New Byte(-1) {}
  76. Dim bytes As Byte() = DirectCast(dr.Item("圖片"), Byte())
  77. Dim oStream As New MemoryStream(bytes)
  78. PictureBox1.Image = Bitmap.FromStream(oStream)
  79. End While
  80. conn.Close()
  81. PictureBox1.SizeMode = 4
  82. End Sub
  83. Private Sub DataGridView1_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles 清單_dgv.CellClick
  84. If 新增_bt.Enabled = True Or 修改_bt.Enabled = True Then
  85. If e.RowIndex = -1 Then : Else
  86. 模具開發單編碼_tb.Text = 清單_dgv.Rows(e.RowIndex).Cells("模具開發單號").Value : 模具廠_cb.Text = 清單_dgv.Rows(e.RowIndex).Cells("模具廠").Value
  87. 結構_cb.Text = 清單_dgv.Rows(e.RowIndex).Cells("結構").Value : 材質_cb.Text = 清單_dgv.Rows(e.RowIndex).Cells("材質").Value
  88. 楦頭編號_cb.Text = 清單_dgv.Rows(e.RowIndex).Cells("楦頭編號").Value : 模具編號_tb.Text = 清單_dgv.Rows(e.RowIndex).Cells("模具編號").Value
  89. 參考漾鞋編號_tb.Text = 清單_dgv.Rows(e.RowIndex).Cells("參考原樣鞋編號").Value : 品牌_cb.Text = 清單_dgv.Rows(e.RowIndex).Cells("品牌").Value
  90. 大底廠_cb.Text = 清單_dgv.Rows(e.RowIndex).Cells("大底廠").Value : 尺寸_tb.Text = 清單_dgv.Rows(e.RowIndex).Cells("尺寸").Value
  91. 季節_cb.Text = 清單_dgv.Rows(e.RowIndex).Cells("季節").Value : 備註_tb.Text = 清單_dgv.Rows(e.RowIndex).Cells("備註").Value
  92. TextBox8.Text = 清單_dgv.Rows(e.RowIndex).Cells("制表").Value : TextBox9.Text = 清單_dgv.Rows(e.RowIndex).Cells("制表日期").Value
  93. CN_tb.Text = 清單_dgv.Rows(e.RowIndex).Cells("CN").Value
  94. 圖片導入()
  95. End If
  96. End If
  97. End Sub
  98. Private Sub Button7_Click(sender As Object, e As EventArgs) Handles 查詢_bt.Click
  99. PA = InputBox("請輸入要查詢的關鍵字") : Set_楦頭規格表清單() : PA = ""
  100. End Sub
  101. Private Sub Button2_Click(sender As Object, e As EventArgs) Handles 新增_bt.Click
  102. 模具廠_cb.Enabled = True : 結構_cb.Enabled = True : 材質_cb.Enabled = True : 楦頭編號_cb.Enabled = True : 品牌_cb.Enabled = True : 大底廠_cb.Enabled = True : 季節_cb.Enabled = True
  103. 模具編號_tb.Enabled = True : 參考漾鞋編號_tb.Enabled = True : 尺寸_tb.Enabled = True : 備註_tb.Enabled = True : 儲存新增_bt.Enabled = True : 儲存修改_bt.Enabled = False
  104. 新增_bt.Enabled = False : 修改_bt.Enabled = False
  105. ComboBox1下拉表單資料載入() : ComboBox2下拉表單資料載入() : ComboBox3下拉表單資料載入() : ComboBox4下拉表單資料載入() : ComboBox5下拉表單資料載入() : ComboBox6下拉表單資料載入()
  106. ComboBox7下拉表單資料載入()
  107. 模具編號_tb.Text = "" : 模具編號_tb.Text = "" : 參考漾鞋編號_tb.Text = "" : 尺寸_tb.Text = "" : 備註_tb.Text = "" : PictureBox1.Image = Nothing
  108. SQL_最後一筆模具開發單號()
  109. If dr.Read() Then : 模具開發單編碼_tb.Text = dr("模具開發單號").ToString : Else : 模具開發單編碼_tb.Text = "MD00000000" : End If
  110. conn.Close()
  111. Dim NUM1 As Integer
  112. NUM1 = Double.Parse(Strings.Right(模具開發單編碼_tb.Text, 8)) + 1
  113. If NUM1 < 10 Then : 模具開發單編碼_tb.Text = "MD" & "0000000" & NUM1
  114. ElseIf NUM1 > 9 And NUM1 < 100 Then : 模具開發單編碼_tb.Text = "MD" & "000000" & NUM1
  115. ElseIf NUM1 > 99 And NUM1 < 1000 Then : 模具開發單編碼_tb.Text = "MD" & "00000" & NUM1
  116. ElseIf NUM1 > 999 And NUM1 < 10000 Then : 模具開發單編碼_tb.Text = "MD" & "0000" & NUM1
  117. ElseIf NUM1 > 9999 And NUM1 < 100000 Then : 模具開發單編碼_tb.Text = "MD" & "000" & NUM1
  118. ElseIf NUM1 > 99999 And NUM1 < 100000 Then : 模具開發單編碼_tb.Text = "MD" & "00" & NUM1
  119. ElseIf NUM1 > 999999 And NUM1 < 1000000 Then : 模具開發單編碼_tb.Text = "MD" & "0" & NUM1
  120. ElseIf NUM1 > 9999999 Then : 模具開發單編碼_tb.Text = "MD" & NUM1
  121. End If
  122. End Sub
  123. Private Sub Set_日期格式轉換()
  124. DTP = Strings.Format(Today(), "yyyy/MM/dd")
  125. End Sub
  126. Private Sub Button3_Click(sender As Object, e As EventArgs) Handles 儲存新增_bt.Click
  127. If 模具廠_cb.Text = "" Or 結構_cb.Text = "" Or 材質_cb.Text = "" Or 楦頭編號_cb.Text = "" Or 品牌_cb.Text = "" Or 大底廠_cb.Text = "" Or 季節_cb.Text = "" Or 模具開發單編碼_tb.Text = "" Or
  128. 模具編號_tb.Text = "" Or 參考漾鞋編號_tb.Text = "" Or 尺寸_tb.Text = "" Or 檔案名稱_tb.Text = "" Then
  129. MsgBox("資料不齊全,除了備註欄位其他位置不可空白,並請注意圖片是否有準備好。")
  130. Else
  131. SQL_模具開發控制表()
  132. If dr.Read() Then
  133. conn.Close() : MsgBox("資料重複,不予許新建")
  134. Else
  135. Dim 驗證 As String = "" : Dim 取變數 As String
  136. 取變數 = Strings.StrReverse(檔案名稱_tb.Text)
  137. For i As Integer = 1 To 10
  138. If i = 1 Then
  139. 驗證 = Strings.Left(取變數, i)
  140. Else
  141. If Strings.Mid(取變數, i, 1) = "." Then
  142. 驗證 = Strings.StrReverse(驗證) : Exit For
  143. Else
  144. 驗證 &= Strings.Mid(取變數, i, 1)
  145. End If
  146. End If
  147. Next
  148. If 驗證 = "PNG" Or 驗證 = "png" Or 驗證 = "GIF" Or 驗證 = "gif" Or 驗證 = "BMP" Or 驗證 = "bmp" Or 驗證 = "JPG" Or 驗證 = "jpg" Or 驗證 = "JPEG" Or 驗證 = "jpeg" Then
  149. Set_日期格式轉換()
  150. SQL_查詢最後一筆模具開發單號()
  151. If dr.Read() Then
  152. conn.Close()
  153. SQL_最後一筆模具開發單號()
  154. If dr.Read() Then : 模具開發單編碼_tb.Text = dr("模具開發單號").ToString : Else : 模具開發單編碼_tb.Text = "MD00000000" : End If
  155. conn.Close()
  156. Dim NUM1 As Integer
  157. NUM1 = Double.Parse(Strings.Right(模具開發單編碼_tb.Text, 8)) + 1
  158. If NUM1 < 10 Then : 模具開發單編碼_tb.Text = "MD" & "0000000" & NUM1
  159. ElseIf NUM1 > 9 And NUM1 < 100 Then : 模具開發單編碼_tb.Text = "MD" & "000000" & NUM1
  160. ElseIf NUM1 > 99 And NUM1 < 1000 Then : 模具開發單編碼_tb.Text = "MD" & "00000" & NUM1
  161. ElseIf NUM1 > 999 And NUM1 < 10000 Then : 模具開發單編碼_tb.Text = "MD" & "0000" & NUM1
  162. ElseIf NUM1 > 9999 And NUM1 < 100000 Then : 模具開發單編碼_tb.Text = "MD" & "000" & NUM1
  163. ElseIf NUM1 > 99999 And NUM1 < 100000 Then : 模具開發單編碼_tb.Text = "MD" & "00" & NUM1
  164. ElseIf NUM1 > 999999 And NUM1 < 1000000 Then : 模具開發單編碼_tb.Text = "MD" & "0" & NUM1
  165. ElseIf NUM1 > 9999999 Then : 模具開發單編碼_tb.Text = "MD" & NUM1
  166. End If
  167. PA49 = TextBox7.Text : SQL_新增模具開發控制表()
  168. Else
  169. PA49 = TextBox7.Text : SQL_新增模具開發控制表()
  170. End If
  171. conn.Close()
  172. 圖片導入() : Set_楦頭規格表清單() : MsgBox("新增完成")
  173. 模具廠_cb.Enabled = False : 結構_cb.Enabled = False : 材質_cb.Enabled = False : 楦頭編號_cb.Enabled = False : 品牌_cb.Enabled = False : 大底廠_cb.Enabled = False
  174. 季節_cb.Enabled = False : 模具編號_tb.Enabled = False : 參考漾鞋編號_tb.Enabled = False : 尺寸_tb.Enabled = False : 備註_tb.Enabled = False : 儲存新增_bt.Enabled = False
  175. 儲存修改_bt.Enabled = False : 新增_bt.Enabled = True : 修改_bt.Enabled = True : 檔案名稱_tb.Text = ""
  176. MsgBox("修改完成") : 檔案名稱_tb.Text = ""
  177. Else
  178. 檔案名稱_tb.Text = ""
  179. MsgBox("上傳文件並非常用圖片格式,文件已自動刪除,請專換成常用圖片檔案再行操作。")
  180. End If
  181. End If
  182. End If
  183. End Sub
  184. Private Sub Button5_Click(sender As Object, e As EventArgs) Handles 修改_bt.Click
  185. 模具廠_cb.Enabled = True : 結構_cb.Enabled = True : 材質_cb.Enabled = True : 楦頭編號_cb.Enabled = True : 品牌_cb.Enabled = True : 大底廠_cb.Enabled = True : 季節_cb.Enabled = True
  186. 模具編號_tb.Enabled = True : 參考漾鞋編號_tb.Enabled = True : 尺寸_tb.Enabled = True : 備註_tb.Enabled = True : 儲存新增_bt.Enabled = False : 儲存修改_bt.Enabled = True
  187. 新增_bt.Enabled = False : 修改_bt.Enabled = False
  188. End Sub
  189. Private Sub Button6_Click(sender As Object, e As EventArgs) Handles 儲存修改_bt.Click
  190. Set_日期格式轉換()
  191. SQL_修改模具開發控制表()
  192. conn.Close()
  193. Set_楦頭規格表清單()
  194. MsgBox("修改完成")
  195. 模具廠_cb.Enabled = False : 結構_cb.Enabled = False : 材質_cb.Enabled = False : 楦頭編號_cb.Enabled = False : 品牌_cb.Enabled = False : 大底廠_cb.Enabled = False : 季節_cb.Enabled = False
  196. 模具編號_tb.Enabled = False : 參考漾鞋編號_tb.Enabled = False : 尺寸_tb.Enabled = False : 備註_tb.Enabled = False : 儲存新增_bt.Enabled = False : 儲存修改_bt.Enabled = False
  197. 新增_bt.Enabled = True : 修改_bt.Enabled = True
  198. End Sub
  199. Private Sub TextBox5_DragEnter(sender As Object, e As DragEventArgs) Handles 檔案名稱_tb.DragEnter
  200. If e.Data.GetDataPresent(DataFormats.FileDrop) Then
  201. Dim files As String()
  202. Try
  203. files = CType(e.Data.GetData(DataFormats.FileDrop), String())
  204. 檔案名稱_tb.Text = files(files.Length - 1)
  205. Catch ex As Exception
  206. MessageBox.Show(ex.Message)
  207. Return
  208. End Try
  209. End If
  210. Dim STR2 As Integer = 0
  211. TextBox7.Text = 檔案名稱_tb.Text
  212. If 檔案名稱_tb.Text = "" Then
  213. Else
  214. For i As Integer = 0 To 9999
  215. Dim STR1 As Integer = Strings.Len(TextBox7.Text)
  216. If Strings.Right((TextBox7.Text), 1) <> "\" Then
  217. STR1 -= 1 : STR2 += 1
  218. If STR1 = 0 Then
  219. TextBox7.Text = ""
  220. 檔案名稱_tb.Text = ""
  221. i = 9999
  222. Else
  223. TextBox7.Text = Strings.Left((TextBox7.Text), STR1)
  224. End If
  225. Else
  226. TextBox7.Text = Strings.Right((檔案名稱_tb.Text), STR2)
  227. 檔案名稱_tb.Text = TextBox7.Text
  228. i = 9999
  229. End If
  230. Next
  231. Dim files As String() : files = CType(e.Data.GetData(DataFormats.FileDrop), String())
  232. TextBox7.Text = files(files.Length - 1)
  233. End If
  234. End Sub
  235. Private Sub TextBox5_DragDrop(ByVal sender As Object, ByVal e As DragEventArgs) Handles 檔案名稱_tb.DragDrop
  236. Dim files As Array = e.Data.GetData(DataFormats.FileDrop)
  237. For Each file As String In files
  238. 檔案名稱_tb.AppendText(file + Environment.NewLine)
  239. Next
  240. End Sub
  241. Private Sub Button4_Click(sender As Object, e As EventArgs) Handles 讀取料夾路徑_bt.Click
  242. If FolderBrowserDialog1.ShowDialog = DialogResult.OK Then
  243. WebBrowser2.Navigate(FolderBrowserDialog1.SelectedPath)
  244. End If
  245. End Sub
  246. Private Sub Button24_Click(sender As Object, e As EventArgs) Handles 圖片修改存檔_bt.Click
  247. If 模具開發單編碼_tb.Text = "" Or 檔案名稱_tb.Text = "" Then : MsgBox("請確定需要修改圖片的模具資料已選擇與圖片資料已準備完畢。") : Else
  248. Dim 驗證 As String = "" : Dim 取變數 As String : Dim frq As FtpWebRequest, frp As FtpWebResponse, fcr As NetworkCredential : 取變數 = Strings.StrReverse(檔案名稱_tb.Text)
  249. For i As Integer = 1 To 10
  250. If i = 1 Then : 驗證 = Strings.Left(取變數, i) : Else
  251. If Strings.Mid(取變數, i, 1) = "." Then : 驗證 = Strings.StrReverse(驗證) : Exit For : Else : 驗證 &= Strings.Mid(取變數, i, 1) : End If
  252. End If
  253. Next
  254. If 驗證 = "PNG" Or 驗證 = "png" Or 驗證 = "GIF" Or 驗證 = "gif" Or 驗證 = "BMP" Or 驗證 = "bmp" Or 驗證 = "JPG" Or 驗證 = "jpg" Or 驗證 = "JPEG" Or 驗證 = "jpeg" Then
  255. Set_日期格式轉換()
  256. PA49 = TextBox7.Text : SQL_修改模具開發控制表1()
  257. conn.Close() : dr.Close()
  258. 檔案名稱_tb.Text = "" : 圖片導入() : MsgBox("修改完成")
  259. Else : MsgBox("上傳文件並非常用圖片格式,文件已自動刪除,請專換成常用圖片檔案再行操作。") : End If
  260. End If
  261. End Sub
  262. Private Sub Button8_Click(sender As Object, e As EventArgs) Handles 列印_bt.Click
  263. xlApp = CType(CreateObject("Excel.Application"), Microsoft.Office.Interop.Excel.Application)
  264. xlBook = xlApp.Workbooks.Add
  265. xlApp.DisplayAlerts = True
  266. xlBook.Activate()
  267. xlSheet = NewMethod(xlBook)
  268. xlSheet.Activate()
  269. xlApp.Visible = True
  270. xlApp.Application.WindowState = xlMaximized
  271. xlSheet.Cells(1, 1) = "巨益模具開發計畫表" : xlSheet.Cells(2, 1) = "模具廠 : " : xlSheet.Cells(3, 1) = "結構 : " : xlSheet.Cells(4, 1) = "材質 : " : xlSheet.Cells(5, 1) = "楦頭編號 : "
  272. xlSheet.Cells(6, 1) = "模具編號 : " : xlSheet.Cells(2, 2) = 模具廠_cb.Text : xlSheet.Cells(3, 2) = 結構_cb.Text : xlSheet.Cells(4, 2) = 材質_cb.Text : xlSheet.Cells(5, 2) = 楦頭編號_cb.Text
  273. xlSheet.Cells(6, 2) = 模具編號_tb.Text : xlSheet.Cells(2, 3) = "參考漾鞋編號 : " : xlSheet.Cells(3, 3) = "品牌 : " : xlSheet.Cells(4, 3) = "大底廠 : " : xlSheet.Cells(5, 3) = "尺寸 : "
  274. xlSheet.Cells(6, 3) = "季節 : " : xlSheet.Cells(2, 4) = 模具編號_tb.Text : xlSheet.Cells(3, 4) = 品牌_cb.Text : xlSheet.Cells(4, 4) = 大底廠_cb.Text : xlSheet.Cells(5, 4) = 尺寸_tb.Text
  275. xlSheet.Cells(6, 4) = 季節_cb.Text : xlSheet.Cells(7, 4) = "備註 : " : xlSheet.Cells(8, 4) = 備註_tb.Text : xlSheet.Cells(52, 1) = "製表人 : " : xlSheet.Cells(52, 2) = TextBox8.Text
  276. xlSheet.Cells(52, 3) = "製表人 : " : xlSheet.Cells(52, 4) = TextBox9.Text
  277. CC(xlApp, xlSheet) : BB(xlApp, xlSheet)
  278. xlSheet.PageSetup.PrintArea = ""
  279. xlApp.Cells.Select()
  280. xlSheet.Range("B1").Select()
  281. xlApp.Application.WindowState = xlMinimized
  282. MsgBox("列印完成")
  283. End Sub
  284. Private Shared Function NewMethod(xlBook As Microsoft.Office.Interop.Excel.Workbook) As Microsoft.Office.Interop.Excel.Worksheet
  285. Return CType(xlBook.Worksheets.Add, Microsoft.Office.Interop.Excel.Worksheet)
  286. End Function
  287. Private Sub CC(ByVal myExcel As Application, ByVal xlSheet As Worksheet)
  288. xlSheet.Cells.Select()
  289. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 12 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False
  290. .Shadow = False : .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  291. xlSheet.Columns("A:A").Select : myExcel.Selection.ColumnWidth = 15 : xlSheet.Columns("B:B").Select : myExcel.Selection.ColumnWidth = 50
  292. xlSheet.Columns("C:C").Select : myExcel.Selection.ColumnWidth = 15 : xlSheet.Columns("D:D").Select : myExcel.Selection.ColumnWidth = 40
  293. xlSheet.Rows("2:6").Select : myExcel.Selection.RowHeight = 30 : xlSheet.Rows("1:1").Select : myExcel.Selection.RowHeight = 35
  294. xlSheet.Range("D8:D51").Select() : myExcel.Selection.Merge
  295. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlTop : .WrapText = True : .Orientation = 0 : .AddIndent = False
  296. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  297. xlSheet.Range("A2:D6").Select()
  298. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  299. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  300. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  301. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  302. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  303. With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  304. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  305. xlSheet.Range("A7:C51").Select()
  306. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  307. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  308. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  309. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  310. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  311. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  312. xlSheet.Range("D7:D51").Select()
  313. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  314. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  315. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  316. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  317. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  318. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  319. xlSheet.Rows("8:8").Select : myExcel.Selection.RowHeight = 15.75
  320. xlSheet.Range("A1:D1").Select() : myExcel.Selection.Merge
  321. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 26 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False
  322. .Shadow = False : .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  323. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  324. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  325. myExcel.ActiveWindow.DisplayGridlines = False
  326. myExcel.Application.PrintCommunication = False
  327. With myExcel.ActiveSheet.PageSetup : .PrintTitleRows = "" : .PrintTitleColumns = "" : End With
  328. myExcel.Application.PrintCommunication = True : myExcel.ActiveSheet.PageSetup.PrintArea = "" : myExcel.Application.PrintCommunication = False
  329. With myExcel.ActiveSheet.PageSetup : .LeftHeader = "" : .CenterHeader = "" : .RightHeader = "" : .LeftFooter = "" : .CenterFooter = "" : .RightFooter = ""
  330. .LeftMargin = myExcel.Application.InchesToPoints(0.236220472440945) : .RightMargin = myExcel.Application.InchesToPoints(0.236220472440945)
  331. .TopMargin = myExcel.Application.InchesToPoints(0.748031496062992) : .BottomMargin = myExcel.Application.InchesToPoints(0.748031496062992)
  332. .HeaderMargin = myExcel.Application.InchesToPoints(0.31496062992126) : .FooterMargin = myExcel.Application.InchesToPoints(0.31496062992126)
  333. .PrintHeadings = False : .PrintGridlines = False : .PrintQuality = 600 : .CenterHorizontally = True : .CenterVertically = True : .Draft = False : .FirstPageNumber = xlAutomatic
  334. .BlackAndWhite = False : .Zoom = False : .FitToPagesWide = 1 : .FitToPagesTall = 1 : .OddAndEvenPagesHeaderFooter = False : .DifferentFirstPageHeaderFooter = False
  335. .ScaleWithDocHeaderFooter = True : .AlignMarginsHeaderFooter = True : .EvenPage.LeftHeader.Text = "" : .EvenPage.CenterHeader.Text = "" : .EvenPage.RightHeader.Text = ""
  336. .EvenPage.LeftFooter.Text = "" : .EvenPage.CenterFooter.Text = "" : .EvenPage.RightFooter.Text = "" : .FirstPage.LeftHeader.Text = "" : .FirstPage.CenterHeader.Text = ""
  337. .FirstPage.RightHeader.Text = "" : .FirstPage.LeftFooter.Text = "" : .FirstPage.CenterFooter.Text = "" : .FirstPage.RightFooter.Text = ""
  338. End With
  339. myExcel.Application.PrintCommunication = False
  340. End Sub
  341. Private Sub BB(ByVal myExcel As Application, ByVal xlSheet As Worksheet)
  342. Clipboard.SetDataObject(PictureBox1.Image)
  343. xlSheet.Range("A7").Select()
  344. myExcel.ActiveSheet.Pictures.Paste.Select
  345. myExcel.Selection.ShapeRange.Width = 485
  346. myExcel.Selection.ShapeRange.IncrementLeft(3)
  347. myExcel.Selection.ShapeRange.IncrementTop(3)
  348. End Sub
  349. Private Sub Button11_Click(sender As Object, e As EventArgs) Handles 新增模具廠_bt.Click
  350. PA = "" : 供應商管理_製鞋樣品.Show() : 供應商管理_製鞋樣品.BringToFront()
  351. End Sub
  352. Private Sub Button13_Click(sender As Object, e As EventArgs) Handles 新增大底廠_bt.Click
  353. PA = "" : 供應商管理_製鞋樣品.Show() : 供應商管理_製鞋樣品.BringToFront()
  354. End Sub
  355. Private Sub Button12_Click(sender As Object, e As EventArgs) Handles 新增楦頭編號_bt.Click
  356. PA = "" : 楦頭規格表.Show() : 楦頭規格表.BringToFront()
  357. End Sub
  358. Private Sub Button10_Click(sender As Object, e As EventArgs) Handles 新增季節清單_bt.Click
  359. 清單修改.Close() : 季節清單修改 = True : 清單修改.ShowDialog() : ComboBox7下拉表單資料載入() : 季節清單修改 = False
  360. End Sub
  361. Private Sub Button18_Click(sender As Object, e As EventArgs) Handles 新增結構清單_bt.Click
  362. 清單修改.Close() : 模具用結構 = True : 清單修改.ShowDialog() : ComboBox2下拉表單資料載入() : 模具用結構 = False
  363. End Sub
  364. Private Sub Button9_Click(sender As Object, e As EventArgs) Handles 新增材質清單_bt.Click
  365. 清單修改.Close() : 模具用材質 = True : 清單修改.ShowDialog() : ComboBox3下拉表單資料載入() : 模具用材質 = False
  366. End Sub
  367. End Class