'*******************************************************************************
'* 作成者   : 株式会社エコー・システム 
'* 作成日   : 2005/08/25
'* 概要     : PICS2004 共通処理
'* 更新履歴 : 
'* ﾊﾞｰｼﾞｮﾝ  : 1.0
'*******************************************************************************
Module modPublicPL050
    '/*
    '|| 関数名：fEditIPAddress
    '|| 概要  ：IPアドレス編集
    '|| 引数　：IPアドレス
    '|| 戻り値：-1(NG)   0(OK)  
    '*/
    Public Function fEditIPAddress(ByRef pstrIPAddress As String) As Integer
        Dim wstrIP As String
        fEditIPAddress = -1
        Try
            If Not IsNumeric(pstrIPAddress) Then Exit Function
            wstrIP = fIntZerosapress(Mid(pstrIPAddress, 1, 3)) & "." & fIntZerosapress(Mid(pstrIPAddress, 4, 3)) & "." _
              & fIntZerosapress(Mid(pstrIPAddress, 7, 3)) & "." & fIntZerosapress(Mid(pstrIPAddress, 10, 3))

            pstrIPAddress = wstrIP

            fEditIPAddress = 0
        Catch ex As Exception
            sErrLog(gAppName, "fEditIPAddress", ex.ToString)
        End Try
    End Function
    '/*
    '|| 関数名：fMakeLabelData
    '|| 概要  ：
    '|| 引数　：1.ItemGr
    '||         2.ファイルパス
    '||         3.支障ﾌﾗｸﾞ  0:通常出庫 1:支障処理
    '|| 戻り値：-1(NG)   0:(OK)
    '*/
    Public Function fMakeLabelData(ByVal pstrFilePath As String, Optional ByVal intSisyoFlg As Integer = 0) As Integer
        Dim intType() As PRINT_TYPE
        Dim strRecDat() As String
        Dim wstrctRec As LABEL_DATA_STR_PL
        Dim rtn As Integer
        Dim buf As String

        fMakeLabelData = -1
        buf = ""

        Try
            fPrintInit(pstrFilePath)

            If intSisyoFlg = 0 Then
                With wstrctRec
                    .strAIC = Mid(gstrctAicCase.AicCaseNo, 1, 13)
                    .strCaseNO = Mid(gstrctAicCase.AicCaseNo, 14, 7)
                    .strKukuri = gstrctAicCase.YYYYMMDD
                End With

                ReDim Preserve strRecDat(0)
                ReDim Preserve intType(0)
                intType(0) = modPrint.PRINT_TYPE.AList
                buf = wstrctRec.strAIC & wstrctRec.strCaseNO & wstrctRec.strKukuri & gstrctAicCase.Line
                strRecDat(0) = buf.PadRight(30) & "PACKAJ"

                ReDim Preserve strRecDat(1)
                ReDim Preserve intType(1)
                intType(1) = modPrint.PRINT_TYPE.CaseLabel
                strRecDat(1) = buf.PadRight(30) & "PACKAJ"
            Else '支障ラベル出力
                With wstrctRec
                    .strAIC = Mid(gstrctAicCase.AicCaseNo, 1, 13)
                    .strCaseNO = Mid(gstrctAicCase.AicCaseNo, 14, 7)
                    .strKukuri = gstrctAicCase.YYYYMMDD
                End With

                ReDim Preserve strRecDat(0)
                ReDim Preserve intType(0)
                intType(0) = modPrint.PRINT_TYPE.NotCaseLabel
                buf = wstrctRec.strAIC & wstrctRec.strCaseNO & wstrctRec.strKukuri & gstrctAicCase.Line
                strRecDat(0) = buf.PadRight(30) & "PACKAP"
            End If

            rtn = fPrintProc2(intType, strRecDat, pstrFilePath)
            If rtn = 0 Then
                fMakeLabelData = 0
            End If

        Catch ex As Exception
            sErrLog(gAppName, "fMakeLabelData", ex.ToString)
        End Try
    End Function

End Module
