yes - however....i'm pretty sure the problem happens before i reach any of this...
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not (IsPostBack) Then
OracleDataAdapter1.Fill(DataSet11)
'lstOpenOrders.DataBind()
'lstOpenOrders.Items.Insert(0, "Select Order")
'lblRecordCount.Text = "(There are " & lstOpenOrders.Items.Count - 1 & " Orders Currently Open)"
Else
If txtTote.Text <> "" Then
'when an order is selected, a postback occurs
'using the selected orders info, pull in the details
'reset the dataadpaters select statement
Dim aryOrderInfo() As String
Dim intRoutingRevision As Integer
Dim strOrderID As String
Dim strRelease As String
Dim strPartNumber As String
strOrderID = txtSOREL.Text
strOrderID = Mid(strOrderID, 1, Len(Trim(strOrderID)) - 3)
strRelease = txtSOREL.Text
strRelease = CStr(CInt(Right(strRelease, 3)))
aryOrderInfo = Split(lstOpenOrders.SelectedValue, " ")
DataSet31.Reset()
OracleDataAdapter2.SelectCommand.CommandText = "SELECT pct.DESCRIPTION,cot.CUSTOMER_PO_NO,cit.NAME,dtt.NOTE_TEXT, sot.REVISED_QTY_DUE, sot.REVISED_DUE_DATE, sot.REVISED_START_DATE, sot.ROUTING_REVISION, sot.PART_NO FROM PART_CATALOG_TAB pct, CUSTOMER_ORDER_TAB cot, CUSTOMER_INFO_TAB cit, DOCUMENT_TEXT_TAB dtt, SHOP_ORD_TAB sot WHERE sot.ORDER_NO = '" & strOrderID & "' AND sot.RELEASE_NO = '" & strRelease & "' And dtt.NOTE_ID = sot.NOTE_ID AND dtt.OUTPUT_TYPE = 'SO INFO' AND pct.PART_NO = sot.PART_NO AND cit.CUSTOMER_ID = cot.CUSTOMER_NO AND cot.ORDER_NO IN(SELECT substr(DOCUMENT_TEXT_TAB.NOTE_TEXT,5,(instr(DOCUMENT_TEXT_TAB.NOTE_TEXT,'LINE')-7)) FROM DOCUMENT_TEXT_TAB, SHOP_ORD_TAB WHERE DOCUMENT_TEXT_TAB.NOTE_ID = SHOP_ORD_TAB.NOTE_ID AND UPPER(SHOP_ORD_TAB.ROWSTATE) = 'STARTED' AND SHOP_ORD_TAB.ORDER_NO = '" & strOrderID & "' AND SHOP_ORD_TAB.RELEASE_NO = '" & strRelease & "')"
OracleDataAdapter2.Fill(DataSet31)
'was data found for the order?
If DataSet31.Tables(0).Rows.Count > 0 Then
intRoutingRevision = CInt(DataSet31.Tables(0).Rows(0).Item(7))
strPartNumber = DataSet31.Tables(0).Rows(0).Item(8)
OracleDataAdapter3.SelectCommand.CommandText = "SELECT PS.LINE_SEQUENCE, PS.COMPONENT_PART, PC.DESCRIPTION, PS.QTY_PER_ASSEMBLY, PS.PRINT_UNIT FROM PROD_STRUCTURE PS, PART_CATALOG_TAB PC WHERE PS.COMPONENT_PART = PC.PART_NO AND PS.BOM_TYPE = 'Manufacturing' AND PS.ALTERNATIVE_NO = '*' AND PS.PART_NO = '" & strPartNumber & "' AND PS.ENG_CHG_LEVEL IN (SELECT MAX(eng_chg_level) FROM prod_structure WHERE prod_structure.part_no = '" & strPartNumber & "')"
OracleDataAdapter3.Fill(DataSet41)
OracleDataAdapter4.SelectCommand.CommandText = "SELECT RO.OPERATION_NO, RO.OPERATION_DESCRIPTION, RO.WORK_CENTER_NO, WCT.DESCRIPTION,RO.STD_OPERATION_NAME FROM ROUTING_OPERATION RO, WORK_CENTER_TAB WCT WHERE RO.PART_NO = '" & strPartNumber & "' AND RO.ROUTING_REVISION = " & intRoutingRevision & " AND RO.BOM_TYPE = 'Manufacturing' AND RO.ALTERNATIVE_NO='*' AND RO.WORK_CENTER_NO = WCT.WORK_CENTER_NO ORDER BY OPERATION_NO"
OracleDataAdapter4.Fill(DataSet51)
dgMaterialsUsed.DataBind()
dlOperations.DataSource = DataSet51
dlOperations.DataBind()
'make the display labels visible
lblCustomerLabel.Visible = True
lblCustomerPOLabel.Visible = True
lblCustomerOrderLabel.Visible = True
lblDescriptionLabel.Visible = True
lblPartNumberLabel.Visible = True
lblQuantityLabel.Visible = True
lblRevisedDueDateLabel.Visible = True
lblRevisedStartDateLabel.Visible = True
lblOrderInfoLabel.Text = "Order Info"
lblOrderInfoLabel.Visible = True
lblDataCollectionLabel.Visible = True
'set the display values
lblCustomer.Text = DataSet31.Tables(0).Rows(0).Item(2)
lblCustomerPO.Text = DataSet31.Tables(0).Rows(0).Item(1)
lblCustomerOrder.Text = DataSet31.Tables(0).Rows(0).Item(3)
lblDescription.Text = DataSet31.Tables(0).Rows(0).Item(0)
lblPartNumber.Text = DataSet31.Tables(0).Rows(0).Item(8)
lblQuantity.Text = DataSet31.Tables(0).Rows(0).Item(4)
lblRevisedDueDate.Text = DataSet31.Tables(0).Rows(0).Item(5)
lblRevisedStartDate.Text = DataSet31.Tables(0).Rows(0).Item(6)
'make display values visible
lblCustomer.Visible = True
lblCustomerPO.Visible = True
lblCustomerOrder.Visible = True
lblDescription.Visible = True
lblPartNumber.Visible = True
lblQuantity.Visible = True
lblRevisedDueDate.Visible = True
lblRevisedStartDate.Visible = True
lblMaterialsUsedLabel.Visible = True
'show grids
dgMaterialsUsed.Visible = True
dlOperations.Visible = True
'the quantity field in the materials used grid
'needs to be multiplied by the quantity for this
'order so....
Dim intStepThrough As Integer
For intStepThrough = 0 To dgMaterialsUsed.Items.Count - 1
dgMaterialsUsed.Items(intStepThrough).Cells(3).Text = CStr(CInt(dgMaterialsUsed.Items(intStepThrough).Cells(3).Text) * CInt(lblQuantity.Text))
Next
Else
'a problem has occurred - no data was found for the order
lblOrderInfoLabel.Text = "No Information was found for the Order"
lblOrderInfoLabel.Visible = True
'make labels invisible
lblCustomerLabel.Visible = False
lblCustomerPOLabel.Visible = False
lblCustomerOrderLabel.Visible = False
lblDescriptionLabel.Visible = False
lblPartNumberLabel.Visible = False
lblQuantityLabel.Visible = False
lblRevisedDueDateLabel.Visible = False
lblRevisedStartDateLabel.Visible = False
lblMaterialsUsedLabel.Visible = False
lblDataCollectionLabel.Visible = False
'make display values visible
lblCustomer.Visible = False
lblCustomerPO.Visible = False
lblCustomerOrder.Visible = False
lblDescription.Visible = False
lblPartNumber.Visible = False
lblQuantity.Visible = False
lblRevisedDueDate.Visible = False
lblRevisedStartDate.Visible = False
'reset datasets
DataSet31.Reset()
DataSet41.Reset()
DataSet51.Reset()
DataSet61.Reset()
DataSet71.Reset()
DataSet81.Reset()
'hide grids
dgMaterialsUsed.Visible = False
dlOperations.Visible = False
End If
'Response.Write(OracleDataAdapter2.SelectCommand.CommandText)
'Response.Write(DataSet31.Tables(0).Rows(0).Item(0))
Else
If txtSOREL.Text <> "" Then
If txtTote.Visible = False Then
lblToteLabel.Visible = True
txtTote.Visible = True
End If
End If
End If
End If
End Sub
Sub DoItemSelect(ByVal sender As Object, ByVal e As DataListCommandEventArgs)
' see if it was the Select button that was clicked
If e.CommandName = "Select" Then
' set the SelectedIndex property of the list to this item's index
dlOperations.SelectedIndex = e.Item.ItemIndex
dlOperations.DataSource = DataSet51
dlOperations.DataBind()
End If
' see if it was the Un-Select button that was clicked
If e.CommandName = "unSelect" Then
' set the SelectedIndex property of the list to -1
dlOperations.SelectedIndex = -1
dlOperations.DataSource = DataSet51
dlOperations.DataBind()
End If
End Sub
Sub DoItemEdit(ByVal sender As Object, ByVal e As DataGridCommandEventArgs) Handles dgNormTypes.EditCommand
' get a reference to the DataGrid control in this row
Dim oRow As DataListItem = dlOperations.Items(dlOperations.SelectedIndex)
Dim oGrid As DataGrid = CType(oRow.FindControl("dgNormTypes"), DataGrid)
' set the EditItemIndex of the grid to this item's index
oGrid.EditItemIndex = e.Item.ItemIndex
' bind grid to display row in new mode
' get CustomerID from the DataKeys collection of the DataList
oGrid.DataSource = DataSet61
oGrid.DataBind()
lblRecordCount.Visible = True
lblRecordCount.Text = CStr(CInt(lblRecordCount.Text) + 1)
Response.Write(e.CommandName)
End Sub
Sub DoItemUpdate(ByVal sender As Object, ByVal e As DataGridCommandEventArgs) Handles dgNormTypes.UpdateCommand
'first, determine if the original data came from IFS or
'from the sql stakqmanscanned table. this will determine
'whether this is an update to IFS, an update to sql,
'or an insertion to sql
'dataset91 has the data from stakqmanscanned
'dataset 121 has the data from IFS
'first, see if there is an entry in stakqmanscanned
'if there is, update it and get out
'otherwise, see if there is an entry in IFS
'if there is, update it and get out
'otherwise, do an insert into stakqmanscanned
Dim intExecuteResult As Integer = 0
' get a reference to the DataGrid control in this row
Dim oRow As DataListItem = dlOperations.Items(dlOperations.SelectedIndex)
Dim oGrid As DataGrid = CType(oRow.FindControl("dgNormTypes"), DataGrid)
If DataSet91.Tables(0).Rows.Count > 0 Then
'we have data in the stakqmanscanned so,
'update it now
' set the EditItemIndex of the grid to this item's index
oGrid.EditItemIndex = e.Item.ItemIndex
' get a reference to the text boxes
Dim oResults As TextBox = CType(e.Item.FindControl("txtResults"), TextBox)
Response.Write(oResults.Text)
ElseIf DataSet121.Tables(0).Rows.Count > 0 Then
'we have data in the IFS so,
'update it now
' set the EditItemIndex of the grid to this item's index
oGrid.EditItemIndex = e.Item.ItemIndex
' get a reference to the text boxes
Dim oResults As TextBox = CType(e.Item.FindControl("txtResults"), TextBox)
Response.Write(oResults.Text)
OracleUpdateAnalysisNormTab.CommandText = ""
OracleUpdateAnalysisNormTab.CommandText = "update analysis_norm_tab set non_conforms = " & oResults.Text & " where analysis_no = " & DataSet121.Tables(0).Rows(0).Item(2)
intExecuteResult = OracleUpdateAnalysisNormTab.ExecuteNonQuery()
Response.Write(intExecuteResult)
Else
'do insert
End If
If intExecuteResult = 1 Then
Else
End If
' set EditItemIndex of grid to -1 to switch out of Edit mode
oGrid.EditItemIndex = -1
oGrid.DataSource = DataSet121
oGrid.DataBind()
Response.Write("<br>" & DataSet121.Tables(0).Rows(0).Item(3))
End Sub
Sub DoItemCancel(ByVal sender As Object, ByVal e As DataGridCommandEventArgs)
Response.Write("cancel")
End Sub
Sub DoAttributeEdit(ByVal sender As Object, ByVal e As DataGridCommandEventArgs)
' get a reference to the DataGrid control in this row
Dim oRow As DataListItem = dlOperations.Items(dlOperations.SelectedIndex)
Dim oGrid As DataGrid = CType(oRow.FindControl("dgAttributes"), DataGrid)
' set the EditItemIndex of the grid to this item's index
oGrid.EditItemIndex = e.Item.ItemIndex
' bind grid to display row in new mode
' get CustomerID from the DataKeys collection of the DataList
oGrid.DataSource = DataSet81
oGrid.DataBind()
Response.Write("attributeedit")
End Sub
Sub DoAttributeUpdate(ByVal sender As Object, ByVal e As DataGridCommandEventArgs)
End Sub
Sub DoAttributeCancel(ByVal sender As Object, ByVal e As DataGridCommandEventArgs)
' get a reference to the DataGrid control in this row
'Dim oGrid As DataGrid = GetDataGridRef()
' set EditItemIndex of grid to -1 to switch out of Edit mode
'oGrid.EditItemIndex = -1
' bind grid to display row in new mode
' get CustomerID from the DataKeys collection of the DataList
'oGrid.DataSource = GetOrders(dtl1.DataKeys(dtl1.SelectedIndex))
'oGrid.DataBind()
Response.Write("attributeupdate")
End Sub
Sub BindNormTypesGrid(ByVal sender As Object, ByVal e As DataListItemEventArgs)
' see what type of row (header, footer, item, etc.) caused the event
Dim oType As ListItemType = CType(e.Item.ItemType, ListItemType)
' only process it if it's the Selected row
If oType = ListItemType.SelectedItem And dlOperations.SelectedIndex <> -1 Then
' get value of operation id for this row from DataKeys collection
Dim strOrderID As String
Dim strRelease As String
Dim strPartNumber As String
strPartNumber = lblPartNumber.Text
strOrderID = txtSOREL.Text
strOrderID = Mid(strOrderID, 1, Len(Trim(strOrderID)) - 3)
strRelease = txtSOREL.Text
strRelease = CStr(CInt(Right(strRelease, 3)))
Dim sKey As String = dlOperations.DataKeys(e.Item.ItemIndex)
'sKey will hold the operation id
' get a reference to the DataGrid control in this row
Dim oGrid As DataGrid = CType(e.Item.FindControl("dgNormTypes"), DataGrid)
'x and y are used as indexes to step through datasets
Dim x As Integer
Dim y As Integer
'set the dataadapter select statement
'(for some reason, the select statement was sometimes
'duplicating itself and producing two identical
'sets of data - that is the reason for the following
'2 lines)
DataSet61.Reset()
OracleDataAdapter5.SelectCommand.CommandText = ""
OracleDataAdapter5.SelectCommand.CommandText = "SELECT QCPLT.NORM_TYPE,QCPLT.CONTROL_PLAN_NO,QCPLT.CTRL_PLAN_REVISION_NO,QCPLT.DATA_POINT,NTT.DESCRIPTION,'0' AS TempResults FROM QMAN_CONTROL_PLAN_LINE_TAB QCPLT, NORM_TYPE_TAB NTT WHERE QCPLT.NORM_TYPE = NTT.NORM_TYPE AND UPPER(SUBSTR(NTT.DESCRIPTION,1,14)) <> 'RESERVED BY QE' AND (QCPLT.CONTROL_PLAN_NO IN (SELECT control_plan_no FROM qman_ctrl_plan_shop_order WHERE order_no = '" & strOrderID & "' AND release_no = " & strRelease & ")) AND (QCPLT.ROUTING_OPERATION_NO = '" & sKey & "') AND (QCPLT.CTRL_PLAN_REVISION_NO IN (SELECT ctrl_plan_revision_no FROM qman_ctrl_plan_shop_order WHERE order_no = '" & strOrderID & "' AND release_no = " & strRelease & "))"
'Response.Write(OracleDataAdapter5.SelectCommand.CommandText)
OracleDataAdapter5.Fill(DataSet61)
'okay...here begins a critical piece of logic.
'we dont want the user to see zeros for
'each norm type everytime they enter this screen.
'otherwise, the user could make some data collection
'entries, close the norm type, reopen it again and
'it would be back to zero. so....we need to query the
'stakqmanscanned table AND the stakqmanscannedlog table
'and if any recent entires exist for these norm types,
'we need to incorporate them here (determine which one
'is most recent)
'first check IFS
DataSet121.Reset()
OracleDataAdapter7.SelectCommand.CommandText = ""
OracleDataAdapter7.SelectCommand.CommandText = "SELECT AN.NORM_TYPE, AN.DATA_POINT,AN.ANALYSIS_NO, AN.NON_CONFORMS FROM ANALYSIS_NORM_TAB AN, ANALYSIS_OPERATION_TAB AO WHERE AN.ANALYSIS_NO = AO.ANALYSIS_NO AND TO_CHAR(AN.DATA_POINT * 10) = AO.TEST_OPERATION_NO AND (AN.DATA_POINT = " & DataSet61.Tables(0).Rows(0).Item(3) & ") AND (AN.NORM_TYPE = " & DataSet61.Tables(0).Rows(0).Item(0) & ") AND (AN.ANALYSIS_NO IN (SELECT analysis_no FROM analysis_tab WHERE part_no = '" & Trim(lblPartNumber.Text) & "' AND order_no = '" & Mid(Trim(txtSOREL.Text), 1, 5) & "' AND release_no = '" & strRelease & "' AND operation_no = " & sKey & " AND control_plan_no = " & DataSet61.Tables(0).Rows(0).Item(1) & " AND ctrl_plan_revision_no = " & DataSet61.Tables(0).Rows(0).Item(2) & " AND work_center_no = " & DataSet51.Tables(0).Rows(dlOperations.SelectedIndex).Item(2) & ")) AND (AN.NOTE_TEXT LIKE '%" & txtTote.Text & "%')"
'Response.Write(OracleDataAdapter7.SelectCommand.CommandText)
OracleDataAdapter7.Fill(DataSet121)
'now check stakqmanscanned
DataSet91.Reset()
SqlDataAdapter3.SelectCommand.CommandText = ""
SqlDataAdapter3.SelectCommand.CommandText = "SELECT * FROM stakQmanScanned WHERE (shop_order = '10228') AND (release_no = 12) AND Attributes like '%TOTE E%'"
SqlDataAdapter3.Fill(DataSet91)
'since stakqmanscanned has more recent data than
'IFS, do IFS first
If DataSet121.Tables(0).Rows.Count > 0 And DataSet61.Tables(0).Rows.Count > 0 Then
'have to iterate through the rows of this dataset
'and compare any entries with the normtypes in
'the normtypes dataset and if there is a match,
'replace the normtypes amount with the number in
'this dataset
For x = 0 To DataSet61.Tables(0).Rows.Count - 1
For y = 0 To DataSet121.Tables(0).Rows.Count - 1
If DataSet61.Tables(0).Rows(x).Item(0) = DataSet121.Tables(0).Rows

.Item(0) And DataSet61.Tables(0).Rows(x).Item(3) = DataSet121.Tables(0).Rows

.Item(1) Then
DataSet61.Tables(0).Rows(x).Item(5) = DataSet121.Tables(0).Rows

.Item(3)
End If
Next y
Next x
End If
'now check stakqmanscannedlog
If DataSet91.Tables(0).Rows.Count > 0 And DataSet61.Tables(0).Rows.Count > 0 Then
'have to iterate through the rows of this dataset
'and compare any entries with the normtypes in
'the normtypes dataset and if there is a match,
'replace the normtypes amount with the number in
'this dataset
For x = 0 To DataSet61.Tables(0).Rows.Count - 1
For y = 0 To DataSet91.Tables(0).Rows.Count - 1
If DataSet61.Tables(0).Rows(x).Item(0) = DataSet91.Tables(0).Rows

.Item(6) And DataSet61.Tables(0).Rows(x).Item(3) = DataSet91.Tables(0).Rows

.Item(5) Then
DataSet61.Tables(0).Rows(x).Item(5) = DataSet91.Tables(0).Rows

.Item(7)
End If
Next y
Next x
End If
' bind nested "norm types" DataGrid to DataReader
'Response.Write(OracleDataAdapter5.SelectCommand.CommandText)
oGrid.DataSource = DataSet61
oGrid.DataBind()
If DataSet61.Tables(0).Rows.Count > 0 Then
oGrid.Visible = True
Else
oGrid.Visible = False
End If
'control plan number:
'Response.Write(DataSet61.Tables(0).Rows(0).Item(2))
'control plan revision:
'Response.Write(DataSet61.Tables(0).Rows(0).Item(3))
Dim oGrid2 As DataGrid = CType(e.Item.FindControl("dgAttributes"), DataGrid)
'grab the standard text data
'SqlDataAdapter2.SelectCommand.CommandText = "SELECT RequiredText, OpPriority FROM dbo.StandardOperationText WHERE (StdOpName = " & DataSet51.Tables(0).Rows(e.Item.ItemIndex).Item(4) & ") AND (UPPER(DisplayLanguage) = 'E') ORDER BY OpPriority"
DataSet81.Reset()
SqlDataAdapter2.SelectCommand.CommandText = "SELECT RequiredText, OpPriority,'' as AttributeValue FROM dbo.StandardOperationText WHERE (StdOpName = " & DataSet51.Tables(0).Rows(e.Item.ItemIndex).Item(4) & ") AND (UPPER(DisplayLanguage) = 'E') ORDER BY OpPriority"
'Response.Write(SqlDataAdapter2.SelectCommand.CommandText)
SqlDataAdapter2.Fill(DataSet81)
'if the required text is Tote, then set it here
If DataSet81.Tables(0).Rows.Count > 0 Then
oGrid2.Visible = True
For x = 0 To DataSet81.Tables(0).Rows.Count - 1
If DataSet81.Tables(0).Rows(x).Item(0) = "Tote" Then
DataSet81.Tables(0).Rows(x).Item(2) = txtTote.Text
End If
Next
Else
oGrid2.Visible = False
End If
oGrid2.DataSource = DataSet81
oGrid2.DataBind()
End If
End Sub
Private Sub lstOpenOrders_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lstOpenOrders.SelectedIndexChanged
End Sub
Private Sub txtEmployeeID_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtEmployeeID.TextChanged
'trim the employeeid to only the essential portion
If Len(txtEmployeeID.Text) >= 10 Then
txtEmployeeID.Text = Mid(txtEmployeeID.Text, 6, 5)
txtEmployeeID.Text = txtEmployeeID.Text
End If
If Len(txtEmployeeID.Text) = 7 Then
txtEmployeeID.Text = Mid(txtEmployeeID.Text, 2, 5)
End If
'get the employee's name, status and language
SqlDataAdapter1.SelectCommand.CommandText = "SELECT UserName, Status, DefaultLanguage FROM Employee WHERE (UserId = " & txtEmployeeID.Text & ")"
SqlDataAdapter1.Fill(DataSet71)
'see if the employee was found
lblEmployeeName.Visible = True
If DataSet71.Tables(0).Rows.Count > 0 Then
If UCase(DataSet71.Tables(0).Rows(0).Item(1)) = "ACTIVE" Then
lblEmployeeName.Text = UCase(DataSet71.Tables(0).Rows(0).Item(0))
'make the tote scan area visible
lblScanTote.Visible = True
txtSOREL.Visible = True
'set the focus to the tote textbox:
'Me.SetFocus(Me.txtTote)
Else
lblEmployeeName.Text = UCase(DataSet71.Tables(0).Rows(0).Item(0)) & " is not an Active Employee"
txtEmployeeID.Text = ""
End If
Else
'employee was not found
lblEmployeeName.Text = "Employee " & txtEmployeeID.Text & " was not found"
txtEmployeeID.Text = ""
End If
End Sub
Private Sub txtSOREL_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtSOREL.TextChanged
dlOperations.SelectedIndex = -1
DataSet31.Reset()
DataSet41.Reset()
DataSet51.Reset()
DataSet61.Reset()
DataSet71.Reset()
DataSet81.Reset()
End Sub
End Class