Bogart size,scl,yy,分sheet,进程

该脚本自动筛选指定客户在特定日期范围内的订单,并通过数据库操作生成详细的订单预测报告,包含RM材料、颜色、尺寸、数量等关键信息。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

    Private T As Thread
1
Private Sub cmdExprot_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdExprot.Click 2 If Not T Is Nothing Then 3 If T.ThreadState = ThreadState.Running Then Exit Sub 4 End If 5 T = New Thread(AddressOf Export) 6 T.Start() 7 End Sub 8 9 Private Function checkParameter() As Boolean 10 If Me.cboCustomer.Text.Trim.Length = 0 Then 11 MsgBox("Customer is required.", MsgBoxStyle.Exclamation, Me.Text) 12 cboCustomer.Focus() 13 Return False 14 End If 15 If Me.cboDateFrom.Text.Trim.Length = 0 Then 16 MsgBox("CP Date From is required.", MsgBoxStyle.Exclamation, Me.Text) 17 cboDateFrom.Focus() 18 Return False 19 End If 20 If Me.cboDateTo.Text.Trim.Length = 0 Then 21 MsgBox("CP Date To is required.", MsgBoxStyle.Exclamation, Me.Text) 22 cboDateTo.Focus() 23 Return False 24 End If 25 Return True 26 End Function 27 28 Private Sub Export() 29 If checkParameter() = False Then Exit Sub 30 Try 31 gSub.setPrompt("Please wait! Loading data...") 32 lblMsg.Text = "Loading data...... " 33 lblMsg.Refresh() 34 Me.Cursor = Cursors.WaitCursor 35 36 'scl# 37 Dim sql As String = "select distinct t1.scl# from orfords t1 left join orforda t2 on t1.cstord=t2.cstord left join orflcch t3 on t1.cstord=t3.cstord and t1.deg=t3.deg and t1.com=t3.com where t2.ekey like '" + CStr(Me.cboCustomer.SelectedValue).Replace("'", "''") + "%' and date(dt#05y||'-'||dt#05m||'-'||dt#05d) between '" + Me.cboDateFrom.Text.Trim.Replace("'", "''") + "' and '" + Me.cboDateTo.Text.Trim.Replace("'", "''") + "' and shq>0 " 38 Dim tbScl As DataTable = gData.GetDataTable(sql, netConn) 39 If tbScl.Rows.Count = 0 Then 40 MessageBox.Show("no data.") 41 Exit Sub 42 End If 43 Dim header As String = "" 44 45 '---------------------進度條------------------------ 46 sql = "select distinct t1.cstord,t1.deg,t1.com,t2.clot,t2.ekey,t1.scl#,t1.scld,(dt#05y||'-'||dt#05m||'-'||dt#05d) as cpdate from orfords t1 left join orforda t2 on t1.cstord=t2.cstord left join orflcch t3 on t1.cstord=t3.cstord and t1.deg=t3.deg and t1.com=t3.com where t2.ekey like '" + CStr(Me.cboCustomer.SelectedValue).Replace("'", "''") + "%' and date(dt#05y||'-'||dt#05m||'-'||dt#05d) between '" + Me.cboDateFrom.Text.Trim.Replace("'", "''") + "' and '" + Me.cboDateTo.Text.Trim.Replace("'", "''") + "' and shq>0" 47 Dim tb As DataTable = gData.GetDataTable(sql, netConn) 48 prbProc.Value = 0 49 prbProc.Minimum = 0 50 prbProc.Maximum = tb.Rows.Count + 1 51 '---------------------進度條------------------------ 52 53 Dim xApp As Excel.Application = New Excel.Application 54 Dim xBook As Excel.Workbook 55 xBook = xApp.Workbooks.Add 56 '按scl#循環 57 Dim xsheetnum As Integer = 0 58 For Each R_scl As DataRow In tbScl.Rows 59 Dim xSheet As New Excel.Worksheet 60 xsheetnum = xsheetnum + 1 61 If xsheetnum >= 4 Then 62 xSheet = xBook.Worksheets.Add(after:=xBook.Worksheets(xBook.Worksheets.Count)) 63 Else 64 xSheet = xBook.Worksheets(xsheetnum) 65 End If 66 xSheet.Name = CStr(R_scl.Item("scl#")).Replace("/", "|") 67 xSheet.Cells.HorizontalAlignment = Excel.XlHAlign.xlHAlignCenter 68 xSheet.Cells.VerticalAlignment = Excel.XlHAlign.xlHAlignCenter 69 70 xSheet.Cells.RowHeight = 14.5 71 xSheet.Cells.EntireColumn.AutoFit() 72 xSheet.Range("A1").Resize(1, 8).RowHeight = 33 73 xApp.WindowState = Excel.XlWindowState.xlMaximized 74 '1頁寬 75 With xSheet.PageSetup 76 .LeftMargin = xApp.Application.InchesToPoints(0.25) 77 .RightMargin = xApp.Application.InchesToPoints(0.25) 78 .TopMargin = xApp.Application.InchesToPoints(0.3) 79 .BottomMargin = xApp.Application.InchesToPoints(0.3) 80 .HeaderMargin = xApp.Application.InchesToPoints(0.3) 81 .FooterMargin = xApp.Application.InchesToPoints(0.3) 82 .PrintComments = xlPrintNoComments 83 .Orientation = Excel.XlPageOrientation.xlPortrait 84 .Draft = False 85 .FirstPageNumber = xlAutomatic 86 .Order = xlDownThenOver 87 .BlackAndWhite = False 88 .Zoom = False 89 .FitToPagesWide = 1 90 .FitToPagesTall = 10000 91 .PrintErrors = xlPrintErrorsDisplayed 92 .PaperSize = 120 93 .PrintGridlines = True 94 .CenterHorizontally = True 95 End With 96 Dim len As Integer = 1 97 98 gData.ExecuteCommand("drop table sumsize_temp", SqlConnect) 99 gData.ExecuteCommand("create table sumsize_temp (sug nvarchar(50),clot char(10),lotno char(10),deg char(10),ekey nvarchar(8),colorcode nvarchar(50),color nvarchar(100),size char(10),quantity numeric)", SqlConnect) '每個scl#裏面RM在對應color和size的用量 100 header = "B&B foam article RM code,Call lot, Customer,Col nb," 101 102 '這個日期里面這個客戶的訂單里面有哪些款 103 'key:t1.cstord,t1.deg,t1.com,t1.scl#,t1.scld 104 sql = "select distinct t1.cstord,t1.deg,t1.com,t2.clot,t2.ekey,t1.scl#,t1.scld,(dt#05y||'-'||dt#05m||'-'||dt#05d) as cpdate from orfords t1 left join orforda t2 on t1.cstord=t2.cstord left join orflcch t3 on t1.cstord=t3.cstord and t1.deg=t3.deg and t1.com=t3.com where t2.ekey like '" + CStr(Me.cboCustomer.SelectedValue).Replace("'", "''") + "%' and date(dt#05y||'-'||dt#05m||'-'||dt#05d) between '" + Me.cboDateFrom.Text.Trim.Replace("'", "''") + "' and '" + Me.cboDateTo.Text.Trim.Replace("'", "''") + "' and t1.scl#='" + CStr(R_scl.Item("scl#")) + "' and shq>0 order by t1.cstord" 105 Dim tbMain As DataTable = gData.GetDataTable(sql, netConn) 106 107 '每個款到so找max(款),max(soissued)的這條so里面的rmcode 108 For Each R_main As DataRow In tbMain.Rows 109 110 lblMsg.Text = "Please wait while creating BNB Order Forecast Report " + CStr(R_main.Item("cstord")) + " of scl " + CStr(R_scl.Item("scl#")) + "...... " 111 lblMsg.Refresh() 112 prbProc.Value = prbProc.Value + 1 113 Application.DoEvents() 114 115 116 Dim styleno As String = gData.SelectValue("select isnull(max(styleno),'') from SOT_SampleHead where styleno like'" + Mid(CStr(R_main.Item("deg")), 1, 6) + "%'", SqlConnect, "") 117 Dim soissued As String = gData.SelectValue("select isnull(max(soissued),'') from SOT_SampleHead where styleno='" + styleno + "'", SqlConnect, "") 118 sql = "select distinct rmcode,itemdim1 from SOT_SampleHead t1 left join SampleOrderDetail t2 on t1.styleno=t2.styleno and t1.style2=t2.style2 and t1.stype=t2.sampletype and t1.sver=t2.sver where t1.styleno='" + styleno + "' and t1.soissued='" + soissued + "' and left(rmcode,2)='84'" 119 Dim tbSO As DataTable = gData.GetDataTable(sql, SqlConnect) 120 If tbSO.Rows.Count = 0 Then GoTo SS 121 Dim sugs As String = "" 122 For i As Integer = 0 To tbSO.Rows.Count - 1 123 If i = tbSO.Rows.Count - 1 Then 124 sugs = sugs + "'" + CStr(tbSO.Rows(i).Item("rmcode")) + "'" 125 Else 126 sugs = sugs + "'" + CStr(tbSO.Rows(i).Item("rmcode")) + "'," 127 End If 128 Next 129 '回到protex尋找這個款的max(deg)這個物料(sug,ovy)的com='FGTBC'且skey='BGFO'的所有bom3 130 '在protex中的max(deg) 131 Dim deg As String = gData.SelectValue("select max(deg) from pcfbomq where deg like '" + Mid(CStr(R_main.Item("deg")), 1, 6) + "%'", netConn, "") 132 sql = "select distinct t1.sug,t2.ovy,t2.bom3 from phfrmt t1 left join pcfcrdb t2 on t1.sug=t2.sug where t2.dcrd='" + deg + "' and t2.com='FGTBC' and t1.skey='BGFO' and t1.sug in(" + sugs + ")" 133 Dim tbRM As DataTable = gData.GetDataTable(sql, netConn) 134 If tbRM.Rows.Count = 0 Then GoTo SS 135 '為提升效率,先找出指定sug的所有ovy的bom3,再把不存在的ovy的bom3刪除 136 'For Each rm As DataRow In tbRM.Rows 137 ' Dim r() As DataRow = tbSO.Select("rmcode='" + rm.Item("sug") + "' and itemdim1='" + rm.Item("ovy") + "'") 138 ' If r.Length = 0 Then 139 ' rm.Delete() 140 ' End If 141 'Next 142 'tbRM.AcceptChanges() 143 'If tbRM.Rows.Count = 0 Then GoTo SS 144 145 Dim sizeqty(2, 10) As Object 146 Dim size(2, 10) As Object 147 Dim YY(2, 10) As Object 148 149 '----------------------------------有細數的size---------------------------------------- 150 For i As Integer = 0 To 1 151 'size quantity 152 sql = "select shq#1,shq#2,shq#3,shq#4,shq#5,shq#6,shq#7,shq#8,shq#9,shq#10 from orfords where cstord='" + CStr(R_main.Item("cstord")) + "' and deg='" + CStr(R_main.Item("deg")) + "' and scl#='" + CStr(R_main.Item("scl#")) + "' and scls='" + CStr(i) + "' and coalesce(scld,'')='" + CStr(R_main.Item("scld")) + "' and com='" + CStr(R_main.Item("com")) + "'" 153 Dim tbSizeqty As DataTable = gData.GetDataTable(sql, netConn) 154 155 'size 156 sql = " select sz01,sz02,sz03,sz04,sz05,sz06,sz07,sz08,sz09,sz10,coalesce(scld,'') as scld from pcfsclc t1 left join pcfscld t2 on t1.scl#=t2.scl# where t1.scl#='" + CStr(R_main.Item("scl#")) + "' and scls='" + CStr(i) + "' and coalesce(scld,'')='" + CStr(R_main.Item("scld")) + "'" 157 Dim tbSize As DataTable = gData.GetDataTable(sql, netConn) 158 159 For j As Integer = 0 To 9 160 sizeqty(i, j) = tbSizeqty.Rows(0).Item("shq#" + CStr(j + 1)) 161 If j = 9 Then 162 size(i, j) = CStr(tbSize.Rows(0).Item("sz10")) + CStr(tbSize.Rows(0).Item("scld")) 163 Else 164 size(i, j) = CStr(tbSize.Rows(0).Item("sz0" + CStr(j + 1))) + CStr(tbSize.Rows(0).Item("scld")) 165 End If 166 Next 167 Next 168 '----------------------------------有細數的size-------------------- 169 170 '----------------------------------RM在對應size的YY------------------------------- 171 Dim cscomd As String = "" 172 'max(bom1) 173 Dim bom1 As String = gData.SelectValue("select max(bom1) from pcfbomq where deg ='" + deg + "'", netConn, "") 174 For i As Integer = 0 To tbRM.Rows.Count - 1 175 For m As Integer = 0 To 1 176 'YY 177 '找max(deg),max(bom1)的這個物料(bom3)的YY 178 sql = "select qbrt01,qbrt02,qbrt03,qbrt04,qbrt05,qbrt06,qbrt07,qbrt08,qbrt09,qbrt10 from pcfbomq t1 where t1.deg='" + deg + "' and bom1='" + bom1 + "' and t1.scl#='" + CStr(R_main.Item("scl#")) + "' and scls='" + CStr(m) + "' and bom3='" + CStr(tbRM.Rows(i).Item("bom3")) + "' and coalesce(scld,'')='" + CStr(R_main.Item("scld")) + "'" 179 Dim tbYY As DataTable = gData.GetDataTable(sql, netConn) 180 If tbYY.Rows.Count = 0 Then GoTo SS 181 For n As Integer = 0 To 9 182 If n = 9 Then 183 YY(m, n) = tbYY.Rows(0).Item("qbrt10") 184 Else 185 YY(m, n) = tbYY.Rows(0).Item("qbrt0" + CStr(n + 1)) 186 End If 187 If Val(sizeqty(m, n)) > 0 Then 188 Dim tbCom As DataTable = gData.GetDataTable("select distinct cscomd from orflcch where cstord='" + R_main.Item("cstord") + "' and deg='" + R_main.Item("deg") + "' and ekey='" + CStr(Me.cboCustomer.SelectedValue).Replace("'", "''") + "' and com='" + CStr(R_main.Item("com")) + "'", netConn) 189 If tbCom.Rows.Count > 0 Then 190 cscomd = tbCom.Rows(0).Item("cscomd") 191 Else 192 cscomd = "" 193 End If 194 gData.ExecuteCommand("insert into sumsize_temp values('" + tbRM.Rows(i).Item("sug") + "','" + R_main.Item("clot") + "','" + R_main.Item("cstord") + "','" + R_main.Item("deg") + "','" + R_main.Item("ekey") + "','" + R_main.Item("com") + "','" + cscomd + "','" + size(m, n) + "'," + CStr(Val(sizeqty(m, n)) * Val(YY(m, n))) + ")", SqlConnect) 195 End If 196 Next 197 Next 198 Next 199 '----------------------------------RM在對應size的YY------------------------------- 200 SS: 201 Next 202 '-------------------------get report data------------------------- 203 sql = "select distinct sug,clot,ekey,colorcode,color from sumsize_temp" 204 Dim tbRow As DataTable = gData.GetDataTable(sql, SqlConnect) 205 If tbRow.Rows.Count = 0 Then GoTo SS2 206 sql = "select distinct size from sumsize_temp" 207 Dim tbColumn As DataTable = gData.GetDataTable(sql, SqlConnect) 208 For Each r As DataRow In tbColumn.Rows 209 header = header + r.Item("size") + "," 210 Next 211 212 header = header + "Requested Date,CP Date,L/D apr Date" 213 Dim head() As String = header.Split(",") 214 If head.Length > len Then len = head.Length 215 Dim data(tbRow.Rows.Count + 1, head.Length) As Object 216 217 sql = "select sug,clot,colorcode,color,size,sum(quantity) as qty from sumsize_temp group by sug,clot,colorcode,color,size" 218 Dim tbData As DataTable = gData.GetDataTable(sql, SqlConnect) 219 220 For i As Integer = 0 To tbRow.Rows.Count 221 If i = 0 Then 222 For j As Integer = 0 To head.Length - 1 223 data(i, j) = head(j) 224 Next 225 Else 226 data(i, 0) = tbRow.Rows(i - 1).Item("sug") 227 data(i, 1) = tbRow.Rows(i - 1).Item("clot") 228 data(i, 2) = tbRow.Rows(i - 1).Item("ekey") 229 data(i, 3) = tbRow.Rows(i - 1).Item("color") 230 For k As Integer = 4 To 4 + tbColumn.Rows.Count - 1 231 Dim r() As DataRow = tbData.Select("sug='" + tbRow.Rows(i - 1).Item("sug") + "' and clot='" + tbRow.Rows(i - 1).Item("clot") + "' and colorcode='" + tbRow.Rows(i - 1).Item("colorcode") + "' and size='" + head(k) + "'") 232 If r.Length = 0 Then 233 data(i, k) = 0 234 Else 235 data(i, k) = r(0).Item("qty") 236 End If 237 Next 238 'Requested Date 239 sql = "select min(cpdate) as cpdate from CPM_Detail where clot='" + CStr(tbRow.Rows(i - 1).Item("clot")) + "' and itmcde=20 and isnull(cpdate,'')<>''" 240 data(i, head.Length - 3) = gData.SelectValue(sql, SqlConnect, "") 241 'CP Date 242 sql = "select min(date(dt#05y||'-'||dt#05m||'-'||dt#05d)) from orfords t1 left join orforda t2 on t1.cstord=t2.cstord left join orflcch t3 on t1.cstord=t3.cstord and t1.deg=t3.deg where t2.ekey like '" + CStr(tbRow.Rows(i - 1).Item("ekey")).Replace("'", "''") + "%' and date(dt#05y||'-'||dt#05m||'-'||dt#05d) between '" + Me.cboDateFrom.Text.Trim.Replace("'", "''") + "' and '" + Me.cboDateTo.Text.Trim.Replace("'", "''") + "' and t2.clot='" + CStr(tbRow.Rows(i - 1).Item("clot")) + "'" 243 data(i, head.Length - 2) = gData.SelectValue(sql, netConn, "") 244 'L/D apr Date 245 sql = "select max(date(left(appdte,4)||'-'||left(right(appdte,4),2)||'-'||right(appdte,2))) as appdte from proda201.orflccb where clot=(select pyord from imfcltb where clot='" + CStr(tbRow.Rows(i - 1).Item("clot")) + "') and sug='" + CStr(tbRow.Rows(i - 1).Item("sug")) + "'" 246 data(i, head.Length - 1) = gData.SelectValue(sql, netConn, "") 247 End If 248 Next 249 '-------------------------get report data------------------------- 250 251 'fill data 252 With xSheet.Range("A2").Resize(tbRow.Rows.Count + 1, head.Length) 253 .Value = data 254 .Font.Name = "Arial" 255 .Font.Size = 10 256 .Borders.LineStyle = 1 257 End With 258 With xSheet.Range("A2").Resize(1, head.Length) 259 .Interior.Color = RGB(192, 192, 192) '底色 260 .RowHeight = 14.25 261 End With 262 263 SS2: 264 gData.ExecuteCommand("drop table sumsize_temp", SqlConnect) 265 266 '-------------------------輸出主標題------------------- 267 With xSheet.Range("A1").Resize(1, len) 268 .Merge() 269 .Value = "B&B Order Forecast Report" 270 .Font.Name = "Arial" 271 .Font.Size = 20 272 .Font.Bold = True 273 .HorizontalAlignment = Excel.Constants.xlCenter 274 .VerticalAlignment = Excel.Constants.xlCenter 275 End With 276 '-------------------------輸出主標題------------------- 277 xSheet.Range("A1").Resize(1, len).EntireColumn.AutoFit() 278 xSheet.Range("A1").Resize(1, len).EntireRow.AutoFit() 279 Next 280 281 lblMsg.Text = "Ready" 282 lblMsg.Refresh() 283 prbProc.Value = prbProc.Value + 1 284 Application.DoEvents() 285 286 287 xApp.Range("A1").Select() 288 289 xApp.ActiveWindow.Zoom = 100 290 xApp.Visible = True 291 xApp.Caption = "Bogart ProTex Report" 292 xApp.ActiveWindow.Caption = "Data Export" 293 294 xBook = Nothing 295 xApp = Nothing 296 GC.Collect() 297 Catch ex As Exception 298 ErrorMsg.Show(ex) 299 Finally 300 gSub.setPrompt("Ready") 301 lblMsg.Text = "Ready" 302 lblMsg.Refresh() 303 prbProc.Value = 0 304 Application.DoEvents() 305 Me.Cursor = Cursors.Default 306 End Try 307 End Sub

 

JFM7VX690T型SRAM型现场可编程门阵列技术手册主要介绍的是上海复旦微电子集团股份有限公司(简称复旦微电子)生产的高性能FPGA产品JFM7VX690T。该产品属于JFM7系列,具有现场可编程特性,集成了功能强大且可以灵活配置组合的可编程资源,适用于实现多种功能,如输入输出接口、通用数字逻辑、存储器、数字信号处理和时钟管理等。JFM7VX690T型FPGA适用于复杂、高速的数字逻辑电路,广泛应用于通讯、信息处理、工业控制、数据中心、仪表测量、医疗仪器、人工智能、自动驾驶等领域。 产品特点包括: 1. 可配置逻辑资源(CLB),使用LUT6结构。 2. 包含CLB模块,可用于实现常规数字逻辑和布式RAM。 3. 含有I/O、BlockRAM、DSP、MMCM、GTH等可编程模块。 4. 提供不同的封装规格和工作温度范围的产品,便于满足不同的使用环境。 JFM7VX690T产品系列中,有多种型号可供选择。例如: - JFM7VX690T80采用FCBGA1927封装,尺寸为45x45mm,使用锡银焊球,工作温度范围为-40°C到+100°C。 - JFM7VX690T80-AS同样采用FCBGA1927封装,但工作温度范围更广,为-55°C到+125°C,同样使用锡银焊球。 - JFM7VX690T80-N采用FCBGA1927封装和铅锡焊球,工作温度范围与JFM7VX690T80-AS相同。 - JFM7VX690T36的封装规格为FCBGA1761,尺寸为42.5x42.5mm,使用锡银焊球,工作温度范围为-40°C到+100°C。 - JFM7VX690T36-AS使用锡银焊球,工作温度范围为-55°C到+125°C。 - JFM7VX690T36-N使用铅锡焊球,工作温度范围与JFM7VX690T36-AS相同。 技术手册中还包含了一系列详细的技术参数,包括极限参数、推荐工作条件、电特性参数、ESD等级、MSL等级、重量等。在产品参数章节中,还特别强调了封装类型,包括外形图和尺寸、引出端定义等。引出端定义是指对FPGA芯片上的各个引脚的功能和接线规则进行说明,这对于FPGA的正确应用和电路设计至关重要。 应用指南章节涉及了FPGA在不同应用场景下的推荐使用方法。其中差异说明部可能涉及产品之间的性能差异;关键性能对比可能包括功耗与速度对比、上电浪涌电流测试情况说明、GTH Channel Loss性能差异说明、GTH电源性能差异说明等。此外,手册可能还提供了其他推荐应用方案,例如不使用的BANK接法推荐、CCLK信号PCB布线推荐、JTAG级联PCB布线推荐、系统工作的复位方案推荐等,这些内容对于提高系统性能和稳定性有着重要作用。 焊接及注意事项章节则针对产品的焊接过程提供了指导,强调焊接过程中的注意事项,以确保产品在组装过程中的稳定性和可靠性。手册还明确指出,未经复旦微电子的许可,不得翻印或者复制全部或部本资料的内容,且不承担采购方选择与使用本文描述的产品和服务的责任。 上海复旦微电子集团股份有限公司拥有相关的商标和知识产权。该公司在中国发布的技术手册,版权为上海复旦微电子集团股份有限公司所有,未经许可不得进行复制或传播。 技术手册提供了上海复旦微电子集团股份有限公司销售及服务网点的信息,方便用户在需要时能够联系到相应的服务机构,获取最新信息和必要的支持。同时,用户可以访问复旦微电子的官方网站(***以获取更多产品信息和公司动态。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值