จุดประสงค์คือ ผมต้องการให้แสดงออกมาแบบนี้ครับ แล้ว ผมจะทำการ gen barcode วันที่ออกมาครับ
รบกวนด้วยครับ
query Code (VB.NET)
Public Shared Function Datecodelabel1(ByVal SLM_PRD_NAME As String, ByVal SLP_DATE_CODE As String, ByVal BCM_STATUS As String, ByVal SLP_BOX_NO_T As String, ByVal SLP_BOX_NO_F As String) As DataTable
Dim dt As New DataTable
strSql = New StringBuilder
strSql.AppendLine("select distinct t.slp_prd_name ,t.slp_box_no,substr(t.slp_tray_no,-16,4)as date_code")
strSql.AppendLine("from fpcs_lot_serial_packing t ")
strSql.AppendLine("where (slp_prd_name = '" & SLM_PRD_NAME & "' )")
strSql.AppendLine("and slp_box_no in ( ")
strSql.AppendLine("select")
strSql.AppendLine("t.BCM_box_no as box_no")
strSql.AppendLine("from fpc_box_cap_mstr t ")
strSql.AppendLine("left join fpc_box_cap_det A on t.bcm_prd_item_code = A.Bcd_Prd_Item_Code and t.bcm_box_no = A.Bcd_Box_No")
strSql.AppendLine("left join fpc_box_cap_post B on t.bcm_prd_item_code = B.BCP_PRD_ITEM_CODE and t.bcm_box_no = B.BCP_BOX_NO")
strSql.AppendLine("left join fpc_factory C on t.bcm_support_by = C.FACTORY_CODE")
strSql.AppendLine("where (bcm_prd_item_code = REPLACE('9G'||'" & SLM_PRD_NAME & "','-','') )")
strSql.AppendLine("and (A.BCD_PACK_DATE is not null)")
strSql.AppendLine("and (bcm_status = upper('" & BCM_STATUS & "')) ")
strSql.AppendLine("and (A.BCD_SEQ_NO = '1')")
strSql.AppendLine(" ) ")
strSql.AppendLine("AND (t.slp_box_no >= '" & SLP_BOX_NO_F & "' OR '" & SLP_BOX_NO_F & "' IS NULL)")
strSql.AppendLine("AND (t.slp_box_no <= '" & SLP_BOX_NO_T & "' || 'Z' OR '" & SLP_BOX_NO_T & "' IS NULL)")
strSql.AppendLine("order by slp_prd_name ,slp_box_no,substr(t.slp_tray_no,-16,4)")
Dim StrQuery As String = ""
StrQuery = strSql.ToString
dt = GetDataOracle(strSql.ToString, "SLM_PRD_NAME", constrolacle).Tables(0)
Return dt
End Function
Code (VB.NET)
Protected Sub btnsearch_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnsearch.Click
lblmessage.Text = ""
Try
If txtProduct.Text.Length > 12 Then
datecode(txtProduct.Text, "", DDstatus.SelectedValue, txtboxfrom.Text, txtboxto.Text)
End If
Catch ex As Exception
lblmessage.Text = ex.Message()
End Try
End Sub
Code (VB.NET)
Sub datecode(ByVal SLM_PRD_NAME As String, ByVal SLP_DATE_CODE As String, ByVal BCM_STATUS As String, ByVal SLP_BOX_NO_T As String, ByVal SLP_BOX_NO_F As String)
lblmessage.Text = ""
Try
Me.Flag = True
Dim dt As New System.Data.DataTable
dt.TableName = "barcode1DPackingRoom"
dt.Columns.Add(New DataColumn("SLP_PRD_NAME", GetType(String)))
dt.Columns.Add(New DataColumn("SLP_BOX_NO", GetType(String)))
dt.Columns.Add(New DataColumn("DATE_CODE", GetType(String)))
'dt.Columns.Add(New DataColumn("BCM_STATUS", GetType(String)))
'dt.Columns.Add(New DataColumn("SLP_BOX_NO_T", GetType(String)))
'dt.Columns.Add(New DataColumn("SLP_BOX_NO_F", GetType(String)))
Dim DatePackingRoom As DataTable = Datecodelabel1(SLM_PRD_NAME, "", "", "", "")
If DatePackingRoom.Rows.Count > 0 Then
For i As Integer = 0 To DatePackingRoom.Rows.Count - 1
Dim dr As System.Data.DataRow
dr = dt.NewRow
dr("SLP_PRD_NAME") = DatePackingRoom.Rows(i).Item("SLP_PRD_NAME")
dr("SLP_BOX_NO") = DatePackingRoom.Rows(i).Item("SLP_BOX_NO")
dr("DATE_CODE") = DatePackingRoom.Rows(i).Item("DATE_CODE")
'dr("BCM_STATUS") = DatePackingRoom.Rows(i).Item("BCM_STATUS")
'dr("SLP_BOX_NO_T") = DatePackingRoom.Rows(i).Item("SLP_BOX_NO_T")
'dr("SLP_BOX_NO_F") = DatePackingRoom.Rows(i).Item("SLP_BOX_NO_F")
Next
End If
If DatePackingRoom.Rows.Count > 0 Then
Dim b As String = dt.Rows.Count()
ViewDataSet = dt
BindReport(RDSendingReport)
'Else
Me.ViewDataSet = Nothing
End If
Catch ex As Exception
lblmessage.Text = ex.Message()
End Try
End Sub
If DatePackingRoom.Rows.Count > 0 Then
For i As Integer = 0 To DatePackingRoom.Rows.Count - 1
Dim dr As System.Data.DataRow
dr = dt.NewRow
dr("SLP_PRD_NAME") = DatePackingRoom.Rows(i).Item("SLP_PRD_NAME")
dr("SLP_BOX_NO") = DatePackingRoom.Rows(i).Item("SLP_BOX_NO")
dr("DATE_CODE") = DatePackingRoom.Rows(i).Item("DATE_CODE")
'dr("BCM_STATUS") = DatePackingRoom.Rows(i).Item("BCM_STATUS")
'dr("SLP_BOX_NO_T") = DatePackingRoom.Rows(i).Item("SLP_BOX_NO_T")
'dr("SLP_BOX_NO_F") = DatePackingRoom.Rows(i).Item("SLP_BOX_NO_F")
'ลองเพิ่มอันนี้ดูครับ
dt.Rows.Add(dr)
Next
End If