diff --git a/frmMySqlTest.vb b/frmMySqlTest.vb index 92ad761..fe28b6c 100644 --- a/frmMySqlTest.vb +++ b/frmMySqlTest.vb @@ -175,20 +175,20 @@ Public Class frmMySqlTest End If '제품 정보 조회 쿼리 생성 + 'item_product_list 에 index (2)부터 등록되어 있기에 (2)부터 조회 query_product = Nothing - For i = 0 To item_product_max_index - If item_product_list(i).sales_packing_cnt_col_nm <> Nothing Then - If query_product = Nothing Then - query_product = "IFNULL(" & item_product_list(i).sales_packing_serial_col_nm & ",'NULL'), IFNULL(" & item_product_list(i).sales_packing_cnt_col_nm & ",'0')" - Else - query_product = query_product & ", IFNULL(" & item_product_list(i).sales_packing_serial_col_nm & ",'NULL'), IFNULL(" & item_product_list(i).sales_packing_cnt_col_nm & ",'0')" - End If + For i = 2 To item_product_max_index + If query_product = Nothing Then + query_product = "IFNULL(" & item_product_list(i).sales_packing_serial_col_nm & ",'NULL'), IFNULL(" & item_product_list(i).sales_packing_cnt_col_nm & ",'0')" + Else + query_product = query_product & ", IFNULL(" & item_product_list(i).sales_packing_serial_col_nm & ",'NULL'), IFNULL(" & item_product_list(i).sales_packing_cnt_col_nm & ",'0')" End If Next '구성품 정보 조회 쿼리 생성 query_component = Nothing For i = 0 To item_component_max_index + '구성품 중 ProdCode는 있으나 품목이 없는 경우가 있기에 NULL 체크 필요 If item_component_list(i).sales_packing_cnt_col_nm <> Nothing Then If query_component = Nothing Then query_component = "IFNULL(" & item_component_list(i).sales_packing_cnt_col_nm & ",'0')" @@ -246,7 +246,12 @@ Public Class frmMySqlTest If DBQueryReader(dbcmd) Then command_serial = sqlDataQuery(0) command_count = sqlDataQuery(1) - product_serial_type = sqlDataQuery(2) + '제품 ProSet(1),LuxSet(2)는 같은 컬럼을 사용하고 있어 중복되기 때문에 item_product_list는 2부터 등록되어 있기에 ProSet(1)도 "2"에 조회하여야 함 + If sqlDataQuery(2) = "1" Then ' + product_serial_type = "2" + Else + product_serial_type = sqlDataQuery(2) + End If dbcmd = "SELECT PackingCode FROM " & sales_table & " WHERE " & command_serial & " LIKE '%" & serial & "%'" If DBQueryReader(dbcmd) Then @@ -327,22 +332,22 @@ Public Class frmMySqlTest '제품 정보 조회 dbcmd = "SELECT " & query_product & " FROM " & sales_db & " WHERE PackingCode = '" & packing_code & "'" If DBQueryReader(dbcmd) Then - Dim RowCount As Int16 = (sqlDataQuery.Length / 2) Dim dataSetCount As Int32 = 0 - For row = 2 To RowCount '제품 ProdCode는 1부터 시작하며, ProSet(1),LuxSet(2)는 같은 컬럼을 사용하고 있어 중복되기 때문에 ProdCode 2부터 설정 + 'query_product가 ProdCode = 2부터 생성되었기에 (2)부터 조회 + For i = 2 To item_product_max_index For col = 0 To 1 If col = 0 Then - item_product_list(row).serial = sqlDataQuery(dataSetCount) + item_product_list(i).serial = sqlDataQuery(dataSetCount) ElseIf col = 1 Then - item_product_list(row).cnt = sqlDataQuery(dataSetCount) + item_product_list(i).cnt = sqlDataQuery(dataSetCount) End If dataSetCount += 1 Next '모든 제품의 시리얼번호를 검색 - If item_product_list(row).serial <> "NULL" Then - Dim serial_array() As String = item_product_list(row).serial.Split("/") + If item_product_list(i).serial <> "NULL" Then + Dim serial_array() As String = item_product_list(i).serial.Split("/") For j = 0 To serial_array.Length - 1 If Len(serial_array(j)) <> 0 Then all_serial_list.Add(serial_array(j)) @@ -368,12 +373,13 @@ Public Class frmMySqlTest Dim dgv_switch As Boolean Try - For i = 0 To item_product_max_index + 'item_product_list 에 index (2)부터 등록되어 있기에 (2)부터 조회 + For i = 2 To item_product_max_index dgv_switch = False item_name = Nothing If item_product_list(i).cnt > 0 Then - If i = 1 Or i = 2 Then 'Pro_Set, Lux_Set + If i = 2 Then 'Pro_Set, Lux_Set If Mid(item_product_list(i).serial, 1, 2) = "10" Then item_name = "DUALSONIC Pro 1Set (KR)" Else