/
ivan
/
ModMas
Обзор
Документация
Войти
/
ivan
/
ModMas
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
ModuleMaster/mm/plan_with_key_materials.aspx.vb
193 строки
7 KB
i.krivokon
Initial commit
13 мар 2026, 13:49
13 мар 2026, 13:49
00d9fb6
Код
Авторство
О чём код?
Partial Class MM_plan_with_key_materials Inherits System.Web.UI.Page Private needToUpdateVendors As Boolean = False Private Sub ResetVendors() 'ddlVendor.Items.Clear() 'Dim i As New ListItem("ALL", "%") 'ddlVendor.Items.Add(i) 'needToUpdateVendors = True End Sub Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load If Not IsPostBack Then ResetVendors() reportDate.Text = Date.Today.AddDays(2).ToString("yyyy-MM-dd") End If End Sub Protected Sub ddlPlanDate_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles ddlPlanDate.SelectedIndexChanged ResetVendors() End Sub Protected Sub ddlLine_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles ddlLine.SelectedIndexChanged ResetVendors() End Sub Protected Sub ddlModel_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles ddlModel.SelectedIndexChanged ResetVendors() End Sub Protected Sub ddlLine_DataBinding(sender As Object, e As System.EventArgs) Handles ddlLine.DataBinding ddlLine.Items.Clear() Dim i As New ListItem("ALL", "%") ddlLine.Items.Add(i) End Sub Protected Sub ddlModel_DataBinding(sender As Object, e As System.EventArgs) Handles ddlModel.DataBinding ddlModel.Items.Clear() Dim i As New ListItem("ALL", "%") ddlModel.Items.Add(i) End Sub Protected Sub Page_PreRenderComplete(sender As Object, e As System.EventArgs) Handles Me.PreRenderComplete If needToUpdateVendors Then 'ddlVendor.Items.Clear() 'Dim i As New ListItem("ALL", "%") 'ddlVendor.Items.Add(i) Dim vendors As New Collection For Each r As GridViewRow In GridView1.Rows If Not vendors.Contains(r.Cells(10).Text.Trim) And r.Cells(10).Text.Trim <> " " Then vendors.Add(r.Cells(10).Text.Trim, r.Cells(10).Text.Trim) End If If Not vendors.Contains(r.Cells(12).Text.Trim) And r.Cells(12).Text.Trim <> " " Then vendors.Add(r.Cells(12).Text.Trim, r.Cells(12).Text.Trim) End If If Not vendors.Contains(r.Cells(14).Text.Trim) And r.Cells(14).Text.Trim <> " " Then vendors.Add(r.Cells(14).Text.Trim, r.Cells(14).Text.Trim) End If Next 'For Each it In vendors ' ddlVendor.Items.Add(it) 'Next End If If chkAutoRefresh.Checked Then 'Dim metaKey As New HtmlMeta 'metaKey.HttpEquiv = "refresh" 'metaKey.Content = "30" 'Header.Controls.Add(metaKey) End If End Sub Protected Sub ibPrint_Click(sender As Object, e As System.Web.UI.ImageClickEventArgs) Handles ibPrint.Click Response.Write("<script type='text/javascript'>detailedresults=window.open('plan_with_key_materials_print.aspx?plan_date=" & ddlPlanDate.SelectedValue & "&line=" & ddlLine.SelectedValue & "&model=" & ddlModel.SelectedValue & "&vendor=" & ddlVendor.SelectedValue & "');</script>") End Sub Public Overrides Sub VerifyRenderingInServerForm(ByVal control As Control) End Sub Protected Sub ImageButton1_Click(sender As Object, e As System.Web.UI.ImageClickEventArgs) Handles ImageButton1.Click ExcelDownloadSub(GridView1, "ProductionPlanWithKeyMaterials" & DateTime.Now.ToString("yyyyMMddHHmmss")) End Sub Sub ExcelDownloadSub(ByVal gv As GridView, ByVal filename As String) Response.Clear() Response.Buffer = True Response.AddHeader("content-disposition", "attachment;filename=" & filename & ".xls") Response.ContentType = "application/vnd.xls" Response.ContentEncoding = System.Text.Encoding.GetEncoding("UTF-8") EnableViewState = False Response.Charset = "utf-8" Dim myCItrad As System.Globalization.CultureInfo = New System.Globalization.CultureInfo("EN-US", True) gv.AllowSorting = False gv.AllowPaging = False gv.DataBind() Dim sw As IO.StringWriter = New IO.StringWriter(myCItrad) Dim hw As HtmlTextWriter = New HtmlTextWriter(sw) gv.RenderControl(hw) Response.Write(sw.ToString) Response.End() End Sub Protected Sub ImageButton2_Click(sender As Object, e As System.Web.UI.ImageClickEventArgs) Handles ImageButton2.Click Me.DataBind() End Sub Private PrevLine As String = "" Protected Sub GridView1_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound Dim curLine As String = e.Row.Cells(0).Text Dim curModel As String = e.Row.Cells(1).Text Dim curVersion As String = e.Row.Cells(2).Text e.Row.Cells(6).Attributes.Add("model", curModel) e.Row.Cells(6).Attributes.Add("version", curVersion) e.Row.Cells(6).Attributes.Add("field", "panel") e.Row.Cells(7).Attributes.Add("model", curModel) e.Row.Cells(7).Attributes.Add("version", curVersion) e.Row.Cells(7).Attributes.Add("field", "ip_smps") e.Row.Cells(8).Attributes.Add("model", curModel) e.Row.Cells(8).Attributes.Add("version", curVersion) e.Row.Cells(8).Attributes.Add("field", "speaker") e.Row.Cells(9).Attributes.Add("model", curModel) e.Row.Cells(9).Attributes.Add("version", curVersion) e.Row.Cells(9).Attributes.Add("field", "stand") e.Row.Cells(11).Attributes.Add("model", curModel) e.Row.Cells(11).Attributes.Add("version", curVersion) e.Row.Cells(11).Attributes.Add("field", "front") e.Row.Cells(13).Attributes.Add("model", curModel) e.Row.Cells(13).Attributes.Add("version", curVersion) e.Row.Cells(13).Attributes.Add("field", "rear") If curLine <> PrevLine Then PrevLine = curLine e.Row.Style("border-top") = "2px Solid Black" End If If chkHighlightPassedPo.Checked Then If e.Row.RowType = DataControlRowType.DataRow Then If ddlPlanDate.SelectedValue & " " & e.Row.Cells(3).Text < DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") Then e.Row.BackColor = Drawing.Color.LightGreen End If End If End If End Sub Protected Sub chkHighlightPassedPo_CheckedChanged(sender As Object, e As System.EventArgs) Handles chkHighlightPassedPo.CheckedChanged GridView1.DataBind() End Sub Protected Sub chkAutoRefresh_CheckedChanged(sender As Object, e As System.EventArgs) Handles chkAutoRefresh.CheckedChanged If chkAutoRefresh.Checked Then Timer1.Enabled = True Else Timer1.Enabled = False End If End Sub Protected Sub Timer1_Tick(sender As Object, e As System.EventArgs) Handles Timer1.Tick GridView1.DataBind() End Sub Protected Sub getData_Click(sender As Object, e As EventArgs) Handles getData.Click Dim sqlf As New sharedClasses.dbFunctions.SqlFunctions sqlf.NonQuery("Update UserModules.[user].WA_JOB_LIST Set RUN_IMMEDIATELY='Y', PARAMS='PLAN_DATE:{" & reportDate.Text & "}' WHERE id=1 ") message.Text = "Выгрузка поставлена в очередь. Время ожидания ~5 минут" End Sub End Class