diff --git a/PackingInvoiceMapper/frm_Main.vb b/PackingInvoiceMapper/frm_Main.vb index bae46ad..6499ae3 100644 --- a/PackingInvoiceMapper/frm_Main.vb +++ b/PackingInvoiceMapper/frm_Main.vb @@ -5,7 +5,7 @@ Imports Newtonsoft.Json.Linq Public Class frm_Main Public programName As String = "PackingInvoiceMapper Ver. " - Private programVer As String = "2.0.0" + Private programVer As String = "3.0.0" Private apiItemOutURL As String = "item-outflows/page" @@ -113,9 +113,6 @@ Public Class frm_Main prodEye prodBody End Enum - Private Const typePosition As Int16 = 2 - - Private Const colorPosition As Int16 = 11 Private Enum txbList Name @@ -196,6 +193,9 @@ Public Class frm_Main cj = 6 End Enum + Private query_product As String + Private query_component As String + Private Sub frm_Main_Load(sender As Object, e As EventArgs) Handles MyBase.Load DataSetting() formSetting() @@ -292,6 +292,72 @@ 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;" + If DBQueryReader(DBCmd) Then + Dim RowCount As Int16 = (sqlDataQuery.Length / 3) - 1 + Dim dataSetCount As Int32 = 0 + Dim item_data As item_info + + For row = 0 To RowCount + item_data.item_type = "P" + For col = 0 To 2 + If col = 0 Then + item_data.prod_code = sqlDataQuery(dataSetCount) + ElseIf col = 1 Then + item_data.sales_packing_cnt_col_nm = sqlDataQuery(dataSetCount) + ElseIf col = 2 Then + item_data.sales_packing_serial_col_nm = sqlDataQuery(dataSetCount) + End If + dataSetCount += 1 + Next + item_product_list.Add(item_data) + Next + 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 + Dim dataSetCount As Int32 = 0 + Dim item_data As item_info + + For row = 0 To RowCount + item_data.item_type = "C" + For col = 0 To 1 + If col = 0 Then + item_data.prod_code = sqlDataQuery(dataSetCount) + ElseIf col = 1 Then + item_data.sales_packing_cnt_col_nm = sqlDataQuery(dataSetCount) + End If + dataSetCount += 1 + Next + item_component_list.Add(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 + End If + Next + + '구성품 정보 조회 쿼리 생성 + query_component = Nothing + For Each item_data As item_info In item_component_list + If item_data.item_type = "C" Then + If query_component = Nothing Then + query_component = "'" & item_data.prod_code & "', IFNULL(" & item_data.sales_packing_cnt_col_nm & ",'0')" + Else + query_component = query_component & ",'" & item_data.prod_code & "', IFNULL(" & item_data.sales_packing_cnt_col_nm & ",'0')" + End If + End If + Next + End Sub Private Sub txbNameValue(valueType As Int16) '' order 데이터 - true / packing 데이터 - false @@ -1387,11 +1453,11 @@ Public Class frm_Main Dim itemCode As String = Nothing Dim itemName As String = Nothing - For i = 0 To cCountList_max_index + For Each item_data As item_info In item_component_list itemCode = Nothing itemName = Nothing - If cCountData(i) <> 0 Then - DBCmd = "SELECT ItemCode,ItemName FROM " & applyClistDB & " WHERE ProdCode = '" & i & "'" + If item_data.cnt <> 0 Then + DBCmd = "SELECT ItemCode,ItemName FROM " & applyClistDB & " WHERE ProdCode = '" & item_data.prod_code & "'" If DBQueryReader(DBCmd) Then For cnt = 0 To sqlDataQuery.Length - 1 @@ -1419,7 +1485,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) = cCountData(i) + ChkItemSet(itemInfoList.count, firstDataNum) = item_data.cnt ChkItemSet(itemInfoList.face, firstDataNum) = 0 ChkItemSet(itemInfoList.eye, firstDataNum) = 0 ChkItemSet(itemInfoList.pk_Type, firstDataNum) = 1 @@ -1428,7 +1494,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) = cCountData(i) + ChkItemSet(itemInfoList.count, chkCount) = item_data.cnt ChkItemSet(itemInfoList.face, chkCount) = 0 ChkItemSet(itemInfoList.eye, chkCount) = 0 ChkItemSet(itemInfoList.pk_Type, chkCount) = 1 @@ -1438,7 +1504,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) = cCountData(i) + packItemSet(itemInfoList.count, firstDataNum) = item_data.cnt packItemSet(itemInfoList.face, firstDataNum) = 0 packItemSet(itemInfoList.eye, firstDataNum) = 0 packItemSet(itemInfoList.pk_Type, firstDataNum) = 1 @@ -1447,7 +1513,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) = cCountData(i) + packItemSet(itemInfoList.count, chkCount) = item_data.cnt packItemSet(itemInfoList.face, chkCount) = 0 packItemSet(itemInfoList.eye, chkCount) = 0 packItemSet(itemInfoList.pk_Type, chkCount) = 1 @@ -1471,114 +1537,35 @@ Public Class frm_Main End Function Private Function comSearchCount(codeData As String) As Boolean - DBCmd = "SELECT Mask5Cnt - ,Mask10Cnt - ,HairBandCnt - ,GelCnt - ,MiniGelCnt - ,AmpleCnt - ,CreamCnt - ,UmbrellaCnt - ,FenCnt - ,ChargerCnt - ,CableCnt - ,TonerCnt - ,Case_PRO_Black - ,Case_PRO_Beige - ,Case_PRO_Red - ,Case_PRO_Pink - ,Case_MAX_Black - ,Case_MAX_Apr - ,Case_MAX_Mint - ,Case_MAX_Beige - ,SoothingGelCnt - ,Carton0_Cnt - ,Carton1_Cnt - ,Carton2_Cnt - ,Carton3_Cnt - ,Carton4_Cnt - ,Carton5_Cnt - ,Carton6_Cnt - ,Shopbag_Cnt - ,CosShopbag_Cnt - ,DustBagCnt - ,Case_MAX_Purple - ,Case_PRO_SnakeBlakc - ,KollagenCnt - ,KollagenSetCnt - ,Kollagen_PCnt - ,KollagenSet_PCnt - ,CleansingWaterCnt - ,TonerPadCnt - ,Case_MAX_SafBK_Cnt - ,Hologram_1Cnt - ,Hologram_3Cnt - ,Hologram_5Cnt - ,Case_MAX_SafPp_Cnt - ,Case_MAX_Yellow - ,Kollagen_Pe1Cnt - ,Kollagen_Pe3Cnt - ,Kollagen_Pe5Cnt - ,ATCircleCaseCnt - ,APSquareCaseCnt - ,Case_MAX_Peach - ,MasSoothingCnt - ,Case_MAX_SMintCnt - ,MeshPouchCnt - ,FirmingAmpCnt - ,HyaluronicAmpCnt - ,nightshotcnt - ,morningshotcnt - ,casemaxwoodicnt - ,Elicolltonercnt - ,Elicollampcnt - ,Elicollcreamcnt - ,Elihyaltonercnt - ,Elihyalampcnt - ,Elihyalcreamcnt - ,Dayshotcnt - ,Beautyshopbagcnt - ,Gummycnt - ,Stickjellycnt - ,Newyearbagcnt - ,Emsbeltcnt - ,Beltbagcnt - ,Dayshot2cnt - ,Elixircnt - ,Elixirpremiumcnt - ,Emsbeltcontrollsetcnt - ,FabricBagcnt - ,Goldshopbagcnt - ,MorNigshotsetcnt - ,CTBoxcnt - ,ElesqLiftingTonercnt - ,ElesqLiftingCeamcnt - ,ElesqLiftingECreamcnt - ,ElesqLiftingAmpcnt - ,ElesqAquaTonercnt - ,ElesqAquaCeamcnt - ,ElesqAquaECreamcnt - ,ElesqAquaAmpcnt - ,Carton8_Cnt - ,KeyringCnt - ,DoenaLiftingTonercnt - ,DoenaLiftingAmpcnt - ,DoenaLiftingCreamcnt - ,FirmingCollagenGelcnt - ,KeyringSallyCnt - ,BeautykitHairbandCnt - ,BeautykitMirrorSCnt - ,BeautykitMirrorLCnt - ,BloomingMoistureGel150Cnt - ,FirmingCollagenGel150Cnt - ,TweedCaseCnt - ,BloomingMoistureGel250Cnt - FROM " & applySalesDB & " WHERE PackingCode = '" & codeData & "'" '신규구성품추가 : 포장 구성품 수량 조회 추가 + DBCmd = "SELECT " & query_component & " FROM " & applySalesDB & " WHERE PackingCode = '" & codeData & "'" If DBQueryReader(DBCmd) Then - For i = 0 To cCountList_max_index - cCountData(i) = Val(sqlDataQuery(i)) + 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 Next + Return True Else MsgBox("소모품 관련 데이터를 확인할 수 없습니다.", vbExclamation) @@ -1601,9 +1588,9 @@ Public Class frm_Main Private Function serialDivision() As Boolean Dim slashNum As Int16 - For i = 0 To pSerialList_max_index - Dim restData As String = pSerialData(i) - If restData <> "0" Then + For Each item_data As item_info In item_product_list + If item_data.cnt > 0 Then + Dim restData As String = item_data.serial slashNum = UBound(Split(restData, "/")) For slash = 0 To slashNum @@ -1863,27 +1850,35 @@ Public Class frm_Main End Function Private Function serialPacking(codeData As String) As Boolean - DBCmd = "SELECT Main_Product_SN - ,Pro_Face_Serial - ,Pro_Eye_Serial - ,Pro_Body_Serial - ,Lux_Face_Serial - ,Lux_Eye_Serial - ,Lux_Body_Serial - ,MAXIMUM_SN - ,Alpha_Set_Serial - ,Alpha_Face_Serial - ,Alpha_Eye_Serial - ,Alpha_Body_Serial - ,Alto_Serial - ,Effect_serial - ,EffectV3_Serial - ,MAXIMUM_ALPHA_SN - ,Optimum_Serial - FROM " & applySalesDB & " WHERE PackingCode = '" & codeData & "'" '신규제품추가 : 추가하는 품목의 시리얼번호 조회 컬럼 추가 + DBCmd = "SELECT " & query_product & " FROM " & applySalesDB & " WHERE PackingCode = '" & codeData & "'" If DBQueryReader(DBCmd) Then - For i = 0 To pSerialList_max_index - pSerialData(i) = sqlDataQuery(i) + Dim RowCount As Int16 = (sqlDataQuery.Length / 3) - 1 + 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 + If col = 0 Then + prod_code = sqlDataQuery(dataSetCount) + ElseIf col = 1 Then + serial = sqlDataQuery(dataSetCount) + ElseIf col = 2 Then + 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("패킹 시리얼 번호를 검색하는 도중 오류가 발생하였습니다.") @@ -3473,8 +3468,9 @@ Public Class frm_Main ProdSelect(i) = Nothing Next - For i = 0 To pSerialList_max_index - pSerialData(i) = Nothing + For Each item_data As item_info In item_product_list + item_data.cnt = 0 + item_data.serial = Nothing Next For i = 0 To chkItem.Length - 1 diff --git a/PackingInvoiceMapper/mysqlAddress.vb b/PackingInvoiceMapper/mysqlAddress.vb index f35111d..115352b 100644 --- a/PackingInvoiceMapper/mysqlAddress.vb +++ b/PackingInvoiceMapper/mysqlAddress.vb @@ -35,138 +35,15 @@ Public applyNonTDDB As String = MainNonTDDB Public ApplyModelInfoDB As String = mainModelInfoDB - Public Enum pSerialList - DivSet - ProFace - ProEye - ProBody - LuxFace - LuxEye - LuxBody - MAXIMUM - AlphaSet - AlphaFace - AlphaEye - AlphaBody - Alto - Effect - EffectV3 - MaximumAlpha - Optimum - '신규제품추가 : 추가하는 품목의 변수 추가 - End Enum - Public pSerialList_max_index As Integer = [Enum].GetNames(GetType(pSerialList)).Length - 1 - Public pSerialData(pSerialList_max_index) As String + Structure item_info + Dim item_type As String 'P:Product / C:Component + 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 serial As String + End Structure + Public item_product_list As New ArrayList + Public item_component_list As New ArrayList - Public Enum cCountList - Mask5Cnt - Mask10Cnt - HairBandCnt - GelCnt - MiniGelCnt - AmpleCnt - CreamCnt - UmbrellaCnt - FenCnt - ChargerCnt - CableCnt - TonerCnt - Case_PRO_Black - Case_PRO_Beige - Case_PRO_Red - Case_PRO_Pink - Case_MAX_Black - Case_MAX_Apr - Case_MAX_Mint - Case_MAX_Beige - SoothingGelCnt - Carton0_Cnt - Carton1_Cnt - Carton2_Cnt - Carton3_Cnt - Carton4_Cnt - Carton5_Cnt - Carton6_Cnt - Shopbag_Cnt - CosShopbag_Cnt - DustBagCnt - maxPurple - proSnakeBlack - kollagen - kollagenSet - kollagen_P - kollagenSet_P - cleansingWater - tonerPad - MaxSaffianoBK - hologram1 - hologram3 - hologram5 - MaxSaffianoPp - Case_MAX_Yellow - Kollagen_Pe1 - Kollagen_Pe3 - Kollagen_Pe5 - - ATCircleCase - APSquareCase - - MaxPeach - MassageSoothing - Case_Max_SMint - MeshPouch - - FirmingAmp - HyaluronicAmp - - nightshotcnt - morningshotcnt - casemaxwoodicnt - Elicolltonercnt - Elicollampcnt - Elicollcreamcnt - Elihyaltonercnt - Elihyalampcnt - Elihyalcreamcnt - dayshotcnt - Beautyshotbagcnt - Gummycnt - Stickjellycnt - Newyearbagcnt - Emsbeltcnt - beltbagcnt - Dayshot2cnt - Elixircnt - Elixirpremium - Emsbeltcontrollset - FabricBag - Goldshopbag - MorNigshotset - CTBox - ElesqLiftingToner - ElesqLiftingCeam - ElesqLiftingECream - ElesqLiftingAmp - ElesqAquaToner - ElesqAquaCeam - ElesqAquaECream - ElesqAquaAmp - car8 - keyring - DoenaLiftingToner - DoenaLiftingAmp - DoenaLiftingCream - FirmingCollagenGel - keyringSally - beautykitHairband - beautykitMirrorS - beautykitMirrorL - bloomingMoistureGel150 - firmingCollagenGel150 - tweedCase - bloomingMoistureGel250 - '신규구성품추가 : 추가하는 품목의 변수 추가 - End Enum - Public cCountList_max_index As Integer = [Enum].GetNames(GetType(cCountList)).Length - 1 - Public cCountData(cCountList_max_index) As Integer End Module