item_product_list, item_component_list ArrayList에서 배열로 변경
This commit is contained in:
parent
d844d01f89
commit
483056d07d
@ -292,7 +292,13 @@ Public Class frm_Main
|
||||
apiCommand(parsingCode.item) = "Item"
|
||||
apiCommand(parsingCode.state) = "state"
|
||||
|
||||
DBCmd = "SELECT CAST(ProdCode AS CHAR), SalesPackingCntColNm, SalesPackingSerialColNm FROM " & applyPlistDB & " WHERE ProdCode <> 2 GROUP BY ProdCode ORDER BY ProdCode asc;"
|
||||
DBCmd = "SELECT MAX(ProdCode) FROM " & applyPlistDB & ";"
|
||||
If DBQueryReader(DBCmd) Then
|
||||
item_product_max_index = sqlDataQuery(0)
|
||||
ReDim item_product_list(item_product_max_index)
|
||||
End If
|
||||
|
||||
DBCmd = "SELECT CAST(ProdCode AS CHAR), SalesPackingCntColNm, SalesPackingSerialColNm FROM " & applyPlistDB & " WHERE ProdCode <> 1 GROUP BY ProdCode ORDER BY ProdCode asc;"
|
||||
If DBQueryReader(DBCmd) Then
|
||||
Dim RowCount As Int16 = (sqlDataQuery.Length / 3) - 1
|
||||
Dim dataSetCount As Int32 = 0
|
||||
@ -310,10 +316,16 @@ Public Class frm_Main
|
||||
End If
|
||||
dataSetCount += 1
|
||||
Next
|
||||
item_product_list.Add(item_data)
|
||||
item_product_list(item_data.prod_code) = item_data
|
||||
Next
|
||||
End If
|
||||
|
||||
DBCmd = "SELECT MAX(ProdCode) FROM " & applyClistDB & ";"
|
||||
If DBQueryReader(DBCmd) Then
|
||||
item_component_max_index = sqlDataQuery(0)
|
||||
ReDim item_component_list(item_component_max_index)
|
||||
End If
|
||||
|
||||
DBCmd = "SELECT CAST(ProdCode AS CHAR), SalesPackingCntColNm FROM " & applyClistDB & " GROUP BY ProdCode ORDER BY ProdCode asc;"
|
||||
If DBQueryReader(DBCmd) Then
|
||||
Dim RowCount As Int16 = (sqlDataQuery.Length / 2) - 1
|
||||
@ -330,30 +342,34 @@ Public Class frm_Main
|
||||
End If
|
||||
dataSetCount += 1
|
||||
Next
|
||||
item_component_list.Add(item_data)
|
||||
item_component_list(item_data.prod_code) = item_data
|
||||
Next
|
||||
End If
|
||||
|
||||
'제품 정보 조회 쿼리 생성
|
||||
query_product = Nothing
|
||||
For Each item_data As item_info In item_product_list
|
||||
If item_data.item_type = "P" Then
|
||||
If query_product = Nothing Then
|
||||
query_product = "'" & item_data.prod_code & "', IFNULL(" & item_data.sales_packing_serial_col_nm & ",'NULL'), IFNULL(" & item_data.sales_packing_cnt_col_nm & ",'0')"
|
||||
Else
|
||||
query_product = query_product & ",'" & item_data.prod_code & "', IFNULL(" & item_data.sales_packing_serial_col_nm & ",'NULL'), IFNULL(" & item_data.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 Each item_data As item_info In item_component_list
|
||||
If item_data.item_type = "C" Then
|
||||
For i = 0 To item_component_max_index
|
||||
If item_component_list(i).sales_packing_cnt_col_nm <> Nothing Then
|
||||
If query_component = Nothing Then
|
||||
query_component = "'" & item_data.prod_code & "', IFNULL(" & item_data.sales_packing_cnt_col_nm & ",'0')"
|
||||
query_component = "IFNULL(" & item_component_list(i).sales_packing_cnt_col_nm & ",'0')"
|
||||
Else
|
||||
query_component = query_component & ",'" & item_data.prod_code & "', IFNULL(" & item_data.sales_packing_cnt_col_nm & ",'0')"
|
||||
query_component = query_component & ", IFNULL(" & item_component_list(i).sales_packing_cnt_col_nm & ",'0')"
|
||||
End If
|
||||
Else
|
||||
If query_component = Nothing Then
|
||||
query_component = "'0'"
|
||||
Else
|
||||
query_component = query_component & ", '0'"
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
@ -1439,11 +1455,11 @@ Public Class frm_Main
|
||||
Dim itemCode As String = Nothing
|
||||
Dim itemName As String = Nothing
|
||||
|
||||
For Each item_data As item_info In item_component_list
|
||||
For i = 0 To item_component_max_index
|
||||
itemCode = Nothing
|
||||
itemName = Nothing
|
||||
If item_data.cnt <> 0 Then
|
||||
DBCmd = "SELECT ItemCode,ItemName FROM " & applyClistDB & " WHERE ProdCode = '" & item_data.prod_code & "'"
|
||||
If item_component_list(i).cnt <> 0 Then
|
||||
DBCmd = "SELECT ItemCode,ItemName FROM " & applyClistDB & " WHERE ProdCode = '" & i & "'"
|
||||
|
||||
If DBQueryReader(DBCmd) Then
|
||||
For cnt = 0 To sqlDataQuery.Length - 1
|
||||
@ -1471,7 +1487,7 @@ Public Class frm_Main
|
||||
ReDim ChkItemSet(itemInfoList.pk_Type, firstDataNum)
|
||||
ChkItemSet(itemInfoList.code, firstDataNum) = itemCode
|
||||
ChkItemSet(itemInfoList.name, firstDataNum) = itemName
|
||||
ChkItemSet(itemInfoList.count, firstDataNum) = item_data.cnt
|
||||
ChkItemSet(itemInfoList.count, firstDataNum) = item_component_list(i).cnt
|
||||
ChkItemSet(itemInfoList.face, firstDataNum) = 0
|
||||
ChkItemSet(itemInfoList.eye, firstDataNum) = 0
|
||||
ChkItemSet(itemInfoList.pk_Type, firstDataNum) = 1
|
||||
@ -1480,7 +1496,7 @@ Public Class frm_Main
|
||||
ReDim Preserve ChkItemSet(itemInfoList.pk_Type, chkCount)
|
||||
ChkItemSet(itemInfoList.code, chkCount) = itemCode
|
||||
ChkItemSet(itemInfoList.name, chkCount) = itemName
|
||||
ChkItemSet(itemInfoList.count, chkCount) = item_data.cnt
|
||||
ChkItemSet(itemInfoList.count, chkCount) = item_component_list(i).cnt
|
||||
ChkItemSet(itemInfoList.face, chkCount) = 0
|
||||
ChkItemSet(itemInfoList.eye, chkCount) = 0
|
||||
ChkItemSet(itemInfoList.pk_Type, chkCount) = 1
|
||||
@ -1490,7 +1506,7 @@ Public Class frm_Main
|
||||
ReDim packItemSet(itemInfoList.pk_Type, firstDataNum)
|
||||
packItemSet(itemInfoList.code, firstDataNum) = itemCode
|
||||
packItemSet(itemInfoList.name, firstDataNum) = itemName
|
||||
packItemSet(itemInfoList.count, firstDataNum) = item_data.cnt
|
||||
packItemSet(itemInfoList.count, firstDataNum) = item_component_list(i).cnt
|
||||
packItemSet(itemInfoList.face, firstDataNum) = 0
|
||||
packItemSet(itemInfoList.eye, firstDataNum) = 0
|
||||
packItemSet(itemInfoList.pk_Type, firstDataNum) = 1
|
||||
@ -1499,7 +1515,7 @@ Public Class frm_Main
|
||||
ReDim Preserve packItemSet(itemInfoList.pk_Type, chkCount)
|
||||
packItemSet(itemInfoList.code, chkCount) = itemCode
|
||||
packItemSet(itemInfoList.name, chkCount) = itemName
|
||||
packItemSet(itemInfoList.count, chkCount) = item_data.cnt
|
||||
packItemSet(itemInfoList.count, chkCount) = item_component_list(i).cnt
|
||||
packItemSet(itemInfoList.face, chkCount) = 0
|
||||
packItemSet(itemInfoList.eye, chkCount) = 0
|
||||
packItemSet(itemInfoList.pk_Type, chkCount) = 1
|
||||
@ -1526,30 +1542,8 @@ Public Class frm_Main
|
||||
DBCmd = "SELECT " & query_component & " FROM " & applySalesDB & " WHERE PackingCode = '" & codeData & "'"
|
||||
|
||||
If DBQueryReader(DBCmd) Then
|
||||
Dim RowCount As Int16 = (sqlDataQuery.Length / 2) - 1
|
||||
Dim dataSetCount As Int32 = 0
|
||||
Dim prod_code As String
|
||||
Dim cnt As String
|
||||
|
||||
For row = 0 To RowCount
|
||||
For col = 0 To 1
|
||||
If col = 0 Then
|
||||
prod_code = sqlDataQuery(dataSetCount)
|
||||
ElseIf col = 1 Then
|
||||
cnt = sqlDataQuery(dataSetCount)
|
||||
End If
|
||||
dataSetCount += 1
|
||||
Next
|
||||
|
||||
For i = 0 To item_component_list.Count - 1
|
||||
Dim item_data As item_info = item_component_list(i)
|
||||
If item_data.item_type = "C" And item_data.prod_code = prod_code Then
|
||||
item_data.cnt = cnt
|
||||
|
||||
item_component_list(i) = item_data
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
For i = 0 To item_component_max_index 'sqlDataQuery.Length - 1 와 같음
|
||||
item_component_list(i).cnt = sqlDataQuery(i)
|
||||
Next
|
||||
|
||||
Return True
|
||||
@ -1573,10 +1567,9 @@ Public Class frm_Main
|
||||
|
||||
Private Function serialDivision() As Boolean
|
||||
Dim slashNum As Int16
|
||||
|
||||
For Each item_data As item_info In item_product_list
|
||||
If item_data.cnt > 0 Then
|
||||
Dim restData As String = item_data.serial
|
||||
For i = 1 To item_product_max_index
|
||||
If item_product_list(i).cnt > 0 Then
|
||||
Dim restData As String = item_product_list(i).serial
|
||||
slashNum = UBound(Split(restData, "/"))
|
||||
|
||||
For slash = 0 To slashNum
|
||||
@ -1838,33 +1831,18 @@ Public Class frm_Main
|
||||
Private Function serialPacking(codeData As String) As Boolean
|
||||
DBCmd = "SELECT " & query_product & " FROM " & applySalesDB & " WHERE PackingCode = '" & codeData & "'"
|
||||
If DBQueryReader(DBCmd) Then
|
||||
Dim RowCount As Int16 = (sqlDataQuery.Length / 3) - 1
|
||||
Dim RowCount As Int16 = (sqlDataQuery.Length / 2)
|
||||
Dim dataSetCount As Int32 = 0
|
||||
Dim prod_code As String
|
||||
Dim serial As String
|
||||
Dim cnt As String
|
||||
|
||||
For row = 0 To RowCount
|
||||
For col = 0 To 2
|
||||
For row = 2 To RowCount
|
||||
For col = 0 To 1
|
||||
If col = 0 Then
|
||||
prod_code = sqlDataQuery(dataSetCount)
|
||||
item_product_list(row).serial = sqlDataQuery(dataSetCount)
|
||||
ElseIf col = 1 Then
|
||||
serial = sqlDataQuery(dataSetCount)
|
||||
ElseIf col = 2 Then
|
||||
cnt = sqlDataQuery(dataSetCount)
|
||||
item_product_list(row).cnt = sqlDataQuery(dataSetCount)
|
||||
End If
|
||||
dataSetCount += 1
|
||||
Next
|
||||
|
||||
For i = 0 To item_product_list.Count - 1
|
||||
Dim item_data As item_info = item_product_list(i)
|
||||
If item_data.item_type = "P" And item_data.prod_code = prod_code Then
|
||||
item_data.serial = serial
|
||||
item_data.cnt = cnt
|
||||
item_product_list(i) = item_data
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
Next
|
||||
Else
|
||||
MsgBox("패킹 시리얼 번호를 검색하는 도중 오류가 발생하였습니다.")
|
||||
@ -3454,9 +3432,13 @@ Public Class frm_Main
|
||||
ProdSelect(i) = Nothing
|
||||
Next
|
||||
|
||||
For Each item_data As item_info In item_product_list
|
||||
item_data.cnt = 0
|
||||
item_data.serial = Nothing
|
||||
For i = 1 To item_product_max_index
|
||||
item_product_list(i).cnt = 0
|
||||
item_product_list(i).serial = Nothing
|
||||
Next
|
||||
|
||||
For i = 0 To item_component_max_index
|
||||
item_component_list(i).cnt = 0
|
||||
Next
|
||||
|
||||
For i = 0 To chkItem.Length - 1
|
||||
|
||||
@ -40,10 +40,12 @@
|
||||
Dim prod_code As String
|
||||
Dim sales_packing_cnt_col_nm As String
|
||||
Dim sales_packing_serial_col_nm As String
|
||||
Dim cnt As String
|
||||
Dim cnt As Integer
|
||||
Dim serial As String
|
||||
End Structure
|
||||
Public item_product_list As New ArrayList
|
||||
Public item_component_list As New ArrayList
|
||||
Public item_product_list() As item_info
|
||||
Public item_component_list() As item_info
|
||||
Public item_product_max_index As Integer
|
||||
Public item_component_max_index As Integer
|
||||
|
||||
End Module
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user