/
ivan
/
ModMas
Обзор
Документация
Войти
/
ivan
/
ModMas
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
ModuleMaster/sj_vend/picklist.aspx.vb
171 строка
9 KB
i.krivokon
Initial commit
13 мар 2026, 13:49
13 мар 2026, 13:49
00d9fb6
Код
Авторство
О чём код?
Imports sharedClasses Imports System.Data Imports System.Data.SqlClient Partial Class sj_picklist Inherits System.Web.UI.Page Private Sub sj_picklist_Load(sender As Object, e As EventArgs) Handles Me.Load Dim sqlf As New dbFunctions.SqlFunctions Dim dn As String = Request.QueryString("dn") Dim sjProdDAte As String = Request.QueryString("prodDate") Dim accessory As String = Request.QueryString("accessory") Dim qty As String = Request.QueryString("qty") Dim model As String = Request.QueryString("model") Dim source As String = "BOM" Dim dono As String = "" Dim dataSource As String = Request.QueryString("ds") Dim line As String = "" If Not IsNothing(dn) Then If IsNumeric(dn) Then If IsNothing(dataSource) Then dataSource = "summary" Dim drr As DataRow = sqlf.GetRow("SELECT ISNULL(MAIN_PROD_DATE,'') as MAIN_PROD_DATE, " & "ISNULL(PICK_LIST_ASSY, '') as PICK_LIST_ASSY, " & "ISNULL(PLAN_QTY, '') as PLAN_QTY, " & "ISNULL(MAIN_MODEL, '') as MAIN_MODEL, " & "ISNULL(LINE, '') as LINE, " & "ISNULL(SJ_PO, '') as SJ_PO, " & "ISNULL(DO,'') as DO FROM UserModules.[user].MAIN_PLAN_VS_DO WHERE id = " & dn) If Not IsNothing(drr) Then Dim mainLineProdDate As String = drr("MAIN_PROD_DATE") accessory = drr("PICK_LIST_ASSY") qty = drr("PLAN_QTY") model = drr("MAIN_MODEL") line = drr("LINE") dono = drr("DO") Dim sjPO As String = drr("SJ_PO") sqlf.NonQuery("UPDATE UserModules.[user].MAIN_PLAN_VS_DO SET Printed = convert(varchar, getdate(), 120) WHERE id = " & dn) If accessory <> "" _ And model <> "" _ And IsNumeric(qty) Then Dim sql As New StringBuilder If dono <> "" Then ' Pick component list by SERK DO data source = "DO" sql.AppendLine("select ") sql.AppendLine("accessory ") sql.AppendLine(",po ") sql.AppendLine(",[desc] ") sql.AppendLine(",peggetreqt ") sql.AppendLine(",material ") sql.AppendLine(",material_description ") sql.AppendLine(", per_qty ") sql.AppendLine(", sum(cast(ttl_qty as numeric)) as ttl_qty ") sql.AppendLine(", uom ") sql.AppendLine("from ") sql.AppendLine("( ") sql.AppendLine("select ") sql.AppendLine("do.material as accessory ") sql.AppendLine(", do.do as po ") sql.AppendLine(", comp.[desc] ") sql.AppendLine(", '' as peggetreqt ") sql.AppendLine(", comp.component as material ") sql.AppendLine(", comp.component_desc as material_description ") sql.AppendLine(", cast(cast(comp.req_qty as numeric) / cast(comp.qty as numeric) as integer) as per_qty ") sql.AppendLine(", comp.req_qty as ttl_qty ") sql.AppendLine(", comp.UNIT_2 as uom ") sql.AppendLine(" from usermodules.[user].jit do ") sql.AppendLine("left join usermodules.[user].SUB_CONTRACT_COMPONENT comp ") sql.AppendLine("on do.do = comp.do_no ") sql.AppendLine("and do.material = comp.material ") sql.AppendLine("left join gmesdata.dbo.tbm_pm_po_plan pl ") sql.AppendLine("on do.prod_order = pl.po_no collate Cyrillic_General_CI_AI ") sql.AppendLine("where do = '" & dono & "' ") sql.AppendLine(") as temp ") sql.AppendLine(" ") sql.AppendLine("group by accessory ") sql.AppendLine(",po ") sql.AppendLine(",[desc] ") sql.AppendLine(",peggetreqt ") sql.AppendLine(",material ") sql.AppendLine(",material_description ") sql.AppendLine(", per_qty ") sql.AppendLine(", uom ") Else ' PIck component list by BOM source = "BOM" sql.AppendLine("select ") sql.AppendLine("child_item as material ") sql.AppendLine(", cast (quantity as decimal(18,2)) as per_qty ") sql.AppendLine(", cast(quantity as decimal) * " & qty & " as ttl_qty ") sql.AppendLine(", description as material_description ") sql.AppendLine("from usermodules.[user].assy_bom where assy = '" & accessory & "' ") sql.AppendLine("and use_y_n = 'y' ") sql.AppendLine("order by description ") End If For Each tr As HtmlTableRow In report.Rows For Each c As HtmlTableCell In tr.Cells c.InnerText = c.InnerText.Replace("@Model", model). Replace("@Date", mainLineProdDate). Replace("@LotQty", qty). Replace("@Assy", accessory). Replace("@SJPRODDATE", sjProdDAte). Replace("@Line", line). Replace("@SOURCE", "(" + source + ")"). Replace("@PO", sjPO) Next Next 'lblMessage.Text = sql.ToString 'Dim com As New System.Data.SqlClient.SqlCommand 'com.CommandText = sql.ToString 'Dim dt As DataTable = sqlf.GetData(com) Dim dt As DataTable = sqlf.GetData(sql.ToString) If Not IsNothing(dt) Then If dt.Rows.Count > 0 Then Dim cnt As Integer = 1 For Each dr As DataRow In dt.Rows Dim tr As New HtmlTableRow For Each c As HtmlTableCell In itemRow.Cells If IsDBNull(dr("material")) Then Dim cc As New HtmlTableCell With {.InnerText = "NO COMP LIST FOR DO: " & dono} tr.Cells.Add(cc) Else Dim cc As New HtmlTableCell With {.InnerText = c.InnerText. Replace("@Partno", dr("material")). Replace("@Description", dr("material_description")). Replace("@Per", dr("per_qty").ToString.Replace(",00", "")). Replace("@Qty", dr("ttl_qty").ToString.Replace(",00", "")). Replace("@No", cnt)} cc.Attributes("style") = c.Attributes("style") cc.Attributes("class") = c.Attributes("class") cc.Attributes("colspan") = c.Attributes("colspan") tr.Cells.Add(cc) End If Next report.Rows.Add(tr) cnt += 1 Next itemRow.Visible = False Else ' -------- No plan lblMessage.Text = "NO PLAN FOR " & sjProdDAte & " - " & accessory End If End If End If End If End If End If End Sub End Class