# Business Logic — JBSbatKKRsvTokiHak.insertOdr() [292 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.business.service.JBSbatKKRsvTokiHak` |
| Layer | Service (Batch service layer) |
| Module | `service` (Package: `eo.business.service`) |

## 1. Role

### JBSbatKKRsvTokiHak.insertOdr()

The `insertOdr` method is the core order registration engine within the e光 (eo Hikari) telecom batch service system. It processes **SOD (Service Order Data) issuance** — the creation of standardized telecom service orders that are dispatched to external service providers and internal provisioning systems. This method handles two primary SOD issuance scenarios: **Start SOD** (`SOD_HAK_SBT_CD_STA = "1"`) which covers new activation, number port-in, number port-out, and suspension-related order creation; and **End SOD** (`SOD_HAK_SBT_CD_END = "2"`) which covers service termination, cancellation, and decommissioning orders.

The method implements a **routing and dispatch pattern**. Based on the SOD issuance type code and the transfer porting registration code (ITNTOKI_ADD_CD), it populates two parallel lists — `yokyuSbtCdList` (request type codes) and `odrNaiyoCdList` (order content codes) — that define exactly which order lines to issue. For FTTH (Fiber To The Home) services with number porting, it additionally handles ENUM (E.164 Number Mapping) setup or removal and updates the customer type classification (Individual vs. Corporate phone number帯 code).

Its role in the larger system is as a **delegated service handler** called by `JBSbatKKRsvTokiHak.execute()`, which serves as the batch job entry point. This method does not directly interface with screens — it is a backend batch processing method that transforms service contract data into standardized order records. It acts as a **service type router**: it examines the input parameters and branches into one of two major paths (Start SOD or End SOD), then further branches based on the porting transfer registration code, ultimately creating the appropriate order records through delegation to `insertOdrHakkoJoken` and `insertOdrInfSksiWk`.

All branches:
- **Start SOD + Port-In (ITENS="1")**: Creates a SIP port-in order (220) plus ENUM setup and individual customer update if applicable.
- **Start SOD + Port-Out (ITENM="2")**: Creates a SIP port-out order (259) plus ENUM setup and individual customer update if applicable.
- **Start SOD + Suspension (PAUSE="3")**: Creates service cancellation (03), deletion (08), SIP cancellation (229), SIP deletion (230), and SIP port-in suspension registration (262), plus standard porting (14).
- **End SOD + Port-Out End (ITENM="2")**: Creates SIP port-out cancellation (221), SIP port-out deletion (222), plus cancellation (03) and deletion (08).
- **End SOD + Port-In End (ITENS="1")**: Creates SIP port-in cancellation (260), SIP port-in deletion (261), plus cancellation (03) and deletion (08).
- **End SOD + Suspension End (PAUSE="3")**: Creates SIP port-in suspension cancellation (263), SIP port-in suspension deletion (264), new service (02), SIP registration (218), plus optional number port info registration (225), option bulk registration (219), temporary suspension (10), and ENUM deletion (266) with corporate customer type update.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["insertOdr"])

    START --> EXTRACT["Extract: sodHakSbtCd, itntokiAddCd, bmpUm, svcKeiUcwkStat, pauseStpCd, telNo"]

    EXTRACT --> INIT["Initialize: yokyuSbtCdList, odrNaiyoCdList, sameTrnNo=null, monaiBmp=false"]

    INIT --> MONAI_CHECK["telNo != null and not empty?"]
    MONAI_CHECK -->|Yes| MONAI_CAL["Call: isMonaiBmp telNo"]
    MONAI_CHECK -->|No| MONAI_UNSET["monaiBmp = false"]
    MONAI_CAL --> MONAI_SET["monaiBmp = result"]
    MONAI_SET --> MAIN_IF["sodHakSbtCd check"]

    MAIN_IF -->|SOD Start| STA_BRANCH["SOD Start Branch"]
    MAIN_IF -->|SOD End| END_BRANCH["SOD End Branch"]

    STA_BRANCH --> STA_CHECK["itntokiAddCd check"]

    STA_CHECK -->|ITENS 1| STA_ITENM["Add: odrNaiyoCdList -> 220"]

    STA_CHECK -->|ITENM 2| STA_ITENM2["Add: odrNaiyoCdList -> 259"]

    STA_CHECK -->|PAUSE 3| STA_PAUSE["Add: yokyuSbtCdList -> 03, 08; odr -> 229, 230, 262"]

    STA_PAUSE --> STA_TOKI["Add: yokyuSbtCdList -> 14"]

    STA_ITENM --> STA_TOKI
    STA_ITENM2 --> STA_TOKI

    STA_TOKI --> ENUM_ADD_CHECK1["ITENS AND bmpUm=0 AND monaiBmp?"]
    ENUM_ADD_CHECK1 -->|Yes| ENUM_ADD_KOJIN1["Add: 02, 265; Call: UpdateKojinHojinTlnTatCd KOJIN"]

    ENUM_ADD_CHECK1 -->|No| ENUM_ADD_CHECK2["ITENM AND bmpUm=0 AND monaiBmp?"]
    ENUM_ADD_KOJIN1 --> ENUM_ADD_CHECK2
    ENUM_ADD_CHECK2 -->|Yes| ENUM_ADD_KOJIN2["Add: 02, 265; Call: UpdateKojinHojinTlnTatCd KOJIN"]

    ENUM_ADD_CHECK2 -->|No| ENUM_ADD_CHECK3["ITENS AND bmpUm=1 AND monaiBmp?"]
    ENUM_ADD_KOJIN2 --> ENUM_ADD_CHECK3
    ENUM_ADD_CHECK3 -->|Yes| CALL_KOJIN1["Call: UpdateKojinHojinTlnTatCd KOJIN"]

    ENUM_ADD_CHECK3 -->|No| ENUM_ADD_CHECK4["ITENM AND bmpUm=1 AND monaiBmp?"]
    CALL_KOJIN1 --> ENUM_ADD_CHECK4
    ENUM_ADD_CHECK4 -->|Yes| CALL_KOJIN2["Call: UpdateKojinHojinTlnTatCd KOJIN"]

    ENUM_ADD_CHECK4 --> STA_END

    END_BRANCH --> END_CHECK["itntokiAddCd check"]

    END_CHECK -->|ITENM 2 End| END_ITENM["Add: 221, 222; yokyu: 03, 08"]

    END_CHECK -->|ITENS 1 End| END_ITENS["Add: 260, 261; yokyu: 03, 08"]

    END_CHECK -->|PAUSE 3| END_PAUSE["Add: yokyu: 03, 08, 02; odr: 263, 264, 218"]

    END_PAUSE --> BMP_CHECK1["Contains 218 AND bmpUm=1?"]
    END_ITENM --> END_END
    END_ITENS --> END_END

    BMP_CHECK1 -->|Yes| BMP_ADD["Add: yokyu -> 04; odr -> 225"]
    BMP_ADD --> OP_CHECK1["Contains 218 AND checkOpUm?"]
    END_END --> OP_CHECK1

    OP_CHECK1 -->|Yes| OP_ADD["Add: yokyu -> 04; odr -> 219"]
    OP_CHECK1 -->|No| PAUSE_CHECK["svcKeiUcwkStat=210 AND pauseStpCd=01?"]

    OP_ADD --> PAUSE_CHECK2["svcKeiUcwkStat=210 AND pauseStpCd=01?"]
    PAUSE_CHECK -->|Yes| PAUSE_ADD["Add: yokyu -> 10; odr -> 223"]
    PAUSE_ADD --> PAUSE_CHECK3["svcKeiUcwkStat=210 AND pauseStpCd=01?"]
    PAUSE_CHECK2 -->|No| PAUSE_CHECK3
    PAUSE_CHECK3 -->|Yes| PAUSE_ADD2["Add: yokyu -> 10; odr -> 223"]
    PAUSE_CHECK3 -->|No| ENUM_END_CHECK1["ITENS AND bmpUm=0 AND monaiBmp?"]

    ENUM_END_CHECK1 -->|Yes| ENUM_END_KOJIN1["Add: 08, 266"]
    ENUM_END_CHECK1 -->|No| ENUM_END_CHECK2["ITENM AND bmpUm=0 AND monaiBmp?"]
    ENUM_END_KOJIN1 --> ENUM_END_CHECK2
    ENUM_END_CHECK2 -->|Yes| ENUM_END_KOJIN2["Add: 08, 266"]

    ENUM_END_CHECK2 -->|No| ENUM_END_CHECK3["ITENS AND bmpUm=1 AND monaiBmp?"]
    ENUM_END_KOJIN2 --> ENUM_END_CHECK3
    ENUM_END_CHECK3 -->|Yes| CALL_HOJIN1["Call: UpdateKojinHojinTlnTatCd HOJIN"]
    ENUM_END_CHECK3 -->|No| ENUM_END_CHECK4["ITENM AND bmpUm=1 AND monaiBmp?"]
    CALL_HOJIN1 --> ENUM_END_CHECK4
    ENUM_END_CHECK4 -->|Yes| CALL_HOJIN2["Call: UpdateKojinHojinTlnTatCd HOJIN"]

    ENUM_END_CHECK4 --> SAME_CHECK["yokyuSbtCdList.size > 1?"]
    STA_END --> SAME_CHECK

    SAME_CHECK -->|Yes| GET_SEQ["getFormatedNextSeq SEQ_SAME_TRN_NO"]
    SAME_CHECK -->|No| FOR_LOOP["for loop: yokyuSbtCdList"]

    GET_SEQ --> FOR_LOOP

    FOR_LOOP --> GET_ODR_SEQ["Get odrHakkoJokenNo = nextSeq"]

    GET_ODR_SEQ --> INSERT_COND["Call: insertOdrHakkoJoken"]

    INSERT_COND --> INSERT_WORK["Call: insertOdrInfSksiWk"]

    INSERT_WORK --> ENUM_DEL_CHECK["odrNaiyoCd = 266 AND monaiBmp?"]

    ENUM_DEL_CHECK -->|Yes| UPDATE_HOJIN["Call: UpdateKojinHojinTlnTatCd HOJIN"]

    ENUM_DEL_CHECK -->|No| LOOP_END["Loop next iteration"]
    UPDATE_HOJIN --> LOOP_END

    LOOP_END -->|Next| FOR_LOOP
    LOOP_END -->|Done| END_NODE(["Return"])

    PAUSE_CHECK2 --> PAUSE_CHECK3
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `inMap` | `JBSbatServiceInterfaceMap` | Input message map containing the SOD issuance parameters. Carries the SOD issuance type code (`SOD_HAK_SBT_CD`) and transfer porting registration code (`ITNTOKI_ADD_CD`). Also carries optional service contract data used by called methods. |
| 2 | `svkeiuwEohTelMap` | `JBSbatCommonDBInterface` | Service contract detail map for eo光電話 (eo Hikari Phone). Contains the `BMP_UM` (number port flag — whether the customer has a phone number / "番号" (bangou) = "1" if yes, "0" if no) and the telephone number (`TELNO`). Used to determine number porting scenario and ENUM handling. |
| 3 | `svcKeiUcwkMap` | `JBSbatCommonDBInterface` | Service contract detail work map. Contains the service contract status (`SVC_KEI_UCWK_STAT`) and the pause interruption code (`PAUSE_STP_CD`). Used to determine if the service is in suspended state (210) during End SOD processing. |
| 4 | `sysDate` | `String` | System date in YYYYMMDD format. Used as a data attribute when updating the customer type phone number帯 code via `UpdateKojinHojinTlnTatCd` and as a timestamp for order issuance condition registration. |

**Instance fields / external state:**
- `bmpUm` (extracted from `svkeiuwEohTelMap`) — Number port flag. `"1"` = has a phone number, `"0"` = no phone number. Controls whether ENUM setup/deletion and option handling applies.
- `monaiBmp` (computed) — Within-network number port flag. Indicates whether the telephone number belongs to an internal network operator. Computed via `isMonaiBmp(telNo)` call. Controls ENUM handling in updated logic (ANK-4494-00-00).

## 4. CRUD Operations / Called Services

### Pre-computed evidence from code analysis graph:

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JBSbatInterface.getFormatedNextSeq` | - | - | Gets formatted sequence number for same transaction number |
| R | `JBSbatInterface.trim` | - | - | Trims whitespace from string values |
| R | `JCCBatCommon.getFormatedNextSeq` | - | - | Gets formatted next sequence number |
| - | `JZMBatCommon.trim` | - | - | Trims whitespace from string values |
| R | `JBSbatFUCaseFileRnkData.getString` | - | - | Gets string value from case file ranking data |
| R | `JBSbatFUMoveNaviData.getString` | - | - | Gets string value from move navigation data |
| - | `JBSbatKKBmpKaihkPrdChokNoDel.trim` | - | - | Trims whitespace from number port data |
| - | `JBSbatKKRsvTokiHak.checkOpUm` | - | - | Checks if optional services exist on the contract |
| C | `JBSbatKKRsvTokiHak.insertOdrHakkoJoken` | EKK batch | KK_T_ODR_HAKKO_JOKEN | **Creates** order issuance condition records in the order issuance conditions table. Called per iteration of the yokyuSbtCdList loop with yokyuSbtCd, sameTrnNo, sysDate, and odrNaiyoCd. |
| C | `JBSbatKKRsvTokiHak.insertOdrInfSksiWk` | EKK batch | KK_T_ODR_INFO_SKSI_WK | **Creates** order information creation work records. Called per iteration with odrHakkoJokenNo and odrNaiyoCd. |
| - | `JBSbatKKRsvTokiHak.isMonaiBmp` | - | - | Checks if the phone number is within the network (internal operator) |
| U | `JBSbatKKRsvTokiHak.UpdateKojinHojinTlnTatCd` | EKK batch | KK_T_KOJIN_HOJIN_TLN_TAI_CD | **Updates** the customer type phone number帯 code (Individual="1" or Corporate="2") on the personal/corporate phone classification table. Called when ENUM setup or deletion occurs during porting scenarios. |
| - | `JBSbatKKSodSendReqBase.trim` | - | - | Trims whitespace from SOD send request data |
| - | `JBSbatKKTchishoDelete.trim` | - | - | Trims whitespace from branch delete data |
| R | `JBSbatZMAdDataSet.getString` | - | - | Gets string value from ZM ad data set |
| R | `JCCOracleSeqUtil.getFormatedNextSeq` | - | - | Gets formatted next sequence number from Oracle DB sequence |
| R | `JESC0101B010TPMA.getString` | - | - | Gets string value from ESC telecom data |
| R | `JESC0101B020TPMA.getString` | - | - | Gets string value from ESC telecom data |
| R | `JSCCommonNoGenerator.getFormatedNextSeq` | - | - | Gets formatted next sequence number from common no generator |
| R | `JWCejbCMNOraSeqNm.getFormatedNextSeq` | - | - | Gets formatted next sequence number from Oracle sequence |

**Classification rationale:**
- `insertOdrHakkoJoken` — **Create**: Inserts order issuance condition records (SOD issuance condition header per order line item).
- `insertOdrInfSksiWk` — **Create**: Inserts order information creation work records (work data for order detail processing).
- `UpdateKojinHojinTlnTatCd` — **Update**: Updates the personal/corporate phone number帯 code field.
- Various `getFormatedNextSeq` calls — **Read**: Retrieve sequential numbers from DB sequences.

## 5. Dependency Trace

### Pre-computed evidence from code analysis graph:

No screen/batch entry points found within 8 hops. Direct callers found: 1 methods.

Trace who calls this method and what this method ultimately calls.

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Batch: `JBSbatKKRsvTokiHak` (execute) | `JBSbatKKRsvTokiHak.execute()` -> `insertOdr(inMap, svkeiuwEohTelMap, svcKeiUcwkMap, sysDate)` | `insertOdrHakkoJoken [C] KK_T_ODR_HAKKO_JOKEN`, `insertOdrInfSksiWk [C] KK_T_ODR_INFO_SKSI_WK`, `UpdateKojinHojinTlnTatCd [U] KK_T_KOJIN_HOJIN_TLN_TAI_CD`, `getFormatedNextSeq [R] DB_SEQ` |

**Terminal operations reached from this method:**
- `getString [R]` — Multiple data source reads from input maps and data structures
- `UpdateKojinHojinTlnTatCd [U] KK_T_KOJIN_HOJIN_TLN_TAI_CD` — Customer type phone classification table updates (individual/corporate)
- `insertOdrInfSksiWk [C] KK_T_ODR_INFO_SKSI_WK` — Order information creation work insert
- `insertOdrHakkoJoken [C] KK_T_ODR_HAKKO_JOKEN` — Order issuance condition insert
- `getFormatedNextSeq [R]` — Database sequence number reads (SEQ_SAME_TRN_NO, SEQ_ODR_HAKKO_JOKEN_NO)
- `checkOpUm [-]` — Optional service existence check on contract
- `isMonaiBmp [-]` — Within-network number port check

## 6. Per-Branch Detail Blocks

**Block 1** — VARIABLE EXTRACTION `(L2196)`

> Extracts core input data from the three interface maps and prepares processing context.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `sodHakSbtCd = JBSbatInterface.trim(inMap.getString(JBSbatKKIFM112.SOD_HAK_SBT_CD))` // Get SOD issuance type code [SOD_HAK_SBT_CD="SOD_HAK_SBT_CD"] |
| 2 | CALL | `itntokiAddCd = JBSbatInterface.trim(inMap.getString(JBSbatKKIFM112.ITNTOKI_ADD_CD))` // Get transfer porting registration code [ITNTOKI_ADD_CD="ITNTOKI_ADD_CD"] |
| 3 | CALL | `bmpUm = svkeiuwEohTelMap.getString(JBSbatKK_T_SVKEIUW_EOH_TEL.BMP_UM)` // Get number port flag [BMP_UM="BMP_UM"] |
| 4 | CALL | `svcKeiUcwkStat = svcKeiUcwkMap.getString(JBSbatKK_T_SVC_KEI_UCWK.SVC_KEI_UCWK_STAT)` // Get service contract status [SVC_KEI_UCWK_STAT="SVC_KEI_UCWK_STAT"] |
| 5 | CALL | `pauseStpCd = svcKeiUcwkMap.getString(JBSbatKK_T_SVC_KEI_UCWK.PAUSE_STP_CD)` // Get pause interruption code [PAUSE_STP_CD="PAUSE_STP_CD"] |
| 6 | CALL | `telNo = svkeiuwEohTelMap.getString(JBSbatKK_T_SVKEIUW_EOH_TEL.TELNO)` // Get telephone number [TELNO="TELNO"] |
| 7 | SET | `monaiBmp = false` // Initialize within-network port flag [FLG_OFF="0"] |

**Block 2** — IF `telNo != null && !"".equals(telNo)` (L2212)

> Determines if the telephone number is within the network by calling the `isMonaiBmp` method.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | Check: telNo != null and not empty |
| 2 | CALL | `monaiBmp = isMonaiBmp(telNo)` // Check if telNo is within network |

**Block 3** — BLOCK INITIALIZATION (L2218)

> Initializes the two parallel lists that will hold the request type codes and order content codes.

| # | Type | Code |
|---|------|------|
| 1 | SET | `yokyuSbtCdList = new ArrayList<String>()` // Request type code list [YOKYU_SBT_CD] |
| 2 | SET | `odrNaiyoCdList = new ArrayList<String>()` // Order content code list [ODR_NAIYO_CD] |
| 3 | SET | `sameTrnNo = null` // Same transaction number for multi-line orders |

**Block 4** — IF `SOD_HAK_SBT_CD_STA.equals(sodHakSbtCd)` `[SOD_HAK_SBT_CD_STA = "1" (SOD Start)]` (L2224)

> **SOD Start Branch** — Processes orders that are being initiated (new activations, port-in, port-out, suspension).

**Block 4.1** — IF `JKKBatConst.ITNTOKI_ADD_CD_ITENS.equals(itntokiAddCd)` `[ITNTOKI_ADD_CD_ITENS = "1" (Port-In Registration)]` (L2228)

> When the transfer porting registration code is "1" (port-in by transfer to new provider): adds the SIP port-in order content code "220".

| # | Type | Code |
|---|------|------|
| 1 | SET | `odrNaiyoCdList.add(JKKBatConst.ODR_NAIYO_CD_SIP_TOKI_ADD)` // [ODR_NAIYO_CD_SIP_TOKI_ADD = "220" (SIP Port-In Add Registration)] |

**Block 4.2** — IF-ELSE `JKKBatConst.ITNTOKI_ADD_CD_ITENM.equals(itntokiAddCd)` `[ITNTOKI_ADD_CD_ITENM = "2" (Port-Out Registration)]` (L2234)

> When the transfer porting registration code is "2" (port-out by transfer to new provider): adds the SIP port-out order content code "259".

| # | Type | Code |
|---|------|------|
| 1 | SET | `odrNaiyoCdList.add(JKKBatConst.ODR_NAIYO_CD_SIP_TOKI_ITN_ADD)` // [ODR_NAIYO_CD_SIP_TOKI_ITN_ADD = "259" (SIP Port-Out Add Registration)] |

**Block 4.3** — IF-ELSE `JKKBatConst.ITNTOKI_ADD_CD_PAUSE.equals(itntokiAddCd)` `[ITNTOKI_ADD_CD_PAUSE = "3" (Port Suspension)]` (L2241)

> When the transfer porting registration code is "3" (porting by suspension): adds service cancellation code "03", deletion code "08", SIP cancellation "229", SIP deletion "230", and SIP port-in suspension registration "262".

| # | Type | Code |
|---|------|------|
| 1 | SET | `yokyuSbtCdList.add(JKKBatConst.YOKYU_SBT_CD_DSL)` // [YOKYU_SBT_CD_DSL = "03" (Cancellation)] |
| 2 | SET | `yokyuSbtCdList.add(JKKBatConst.YOKYU_SBT_CD_DEL)` // [YOKYU_SBT_CD_DEL = "08" (Deletion)] |
| 3 | SET | `odrNaiyoCdList.add(JKKBatConst.ODR_NAIYO_CD_SIP_DSL)` // [ODR_NAIYO_CD_SIP_DSL = "229" (SIP Cancellation)] |
| 4 | SET | `odrNaiyoCdList.add(JKKBatConst.ODR_NAIYO_CD_SIP_DEL)` // [ODR_NAIYO_CD_SIP_DEL = "230" (SIP Deletion)] |
| 5 | SET | `odrNaiyoCdList.add(JKKBatConst.ODR_NAIYO_CD_SIP_TOKI_PAUSE_ADD)` // [ODR_NAIYO_CD_SIP_TOKI_PAUSE_ADD = "262" (SIP Port Suspension Add Registration)] |

**Block 4.4** — PROCESSING STEP (L2251)

> Always adds the standard porting code "14" (Porting) to the request type code list.

| # | Type | Code |
|---|------|------|
| 1 | SET | `yokyuSbtCdList.add(JKKBatConst.YOKYU_SBT_CD_TOKI)` // [YOKYU_SBT_CD_TOKI = "14" (Porting)] |

**Block 4.5** — IF `JKKBatConst.ITNTOKI_ADD_CD_ITENS.equals(itntokiAddCd) && FLG_OFF.equals(bmpUm) && monaiBmp` `[ITENS="1" AND bmpUm=0 AND monaiBmp=true]` (L2265)

> When port-in registration AND no phone number (bmpUm=0) AND within-network port exists: adds ENUM setup code "02" (New) and "265" (ENUM setup/registration), and updates the customer type code to Individual.

| # | Type | Code |
|---|------|------|
| 1 | SET | `yokyuSbtCdList.add(JKKBatConst.YOKYU_SBT_CD_NEW)` // [YOKYU_SBT_CD_NEW = "02" (New)] |
| 2 | SET | `odrNaiyoCdList.add(JKKBatConst.ODR_NAIYO_CD_ENUM_ADD)` // [ODR_NAIYO_CD_ENUM_ADD = "265" (ENUM Setup/Registration)] |
| 3 | CALL | `UpdateKojinHojinTlnTatCd(telNo, KOJIN_HOJIN_TLN_TAI_CD_KOJIN, sysDate)` // [KOJIN_HOJIN_TLN_TAI_CD_KOJIN = "1" (Individual)] |

**Block 4.6** — IF `JKKBatConst.ITNTOKI_ADD_CD_ITENM.equals(itntokiAddCd) && FLG_OFF.equals(bmpUm) && monaiBmp` `[ITENM="2" AND bmpUm=0 AND monaiBmp=true]` (L2274)

> When port-out registration AND no phone number (bmpUm=0) AND within-network port exists: adds ENUM setup code "02" and "265", and updates customer type code to Individual.

| # | Type | Code |
|---|------|------|
| 1 | SET | `yokyuSbtCdList.add(JKKBatConst.YOKYU_SBT_CD_NEW)` // [YOKYU_SBT_CD_NEW = "02" (New)] |
| 2 | SET | `odrNaiyoCdList.add(JKKBatConst.ODR_NAIYO_CD_ENUM_ADD)` // [ODR_NAIYO_CD_ENUM_ADD = "265" (ENUM Setup/Registration)] |
| 3 | CALL | `UpdateKojinHojinTlnTatCd(telNo, KOJIN_HOJIN_TLN_TAI_CD_KOJIN, sysDate)` // [KOJIN_HOJIN_TLN_TAI_CD_KOJIN = "1" (Individual)] |

**Block 4.7** — IF `JKKBatConst.ITNTOKI_ADD_CD_ITENS.equals(itntokiAddCd) && FLG_ON.equals(bmpUm) && monaiBmp` `[ITENS="1" AND bmpUm=1 AND monaiBmp=true]` (L2287)

> When port-in registration AND has phone number (bmpUm=1) AND within-network port exists: updates customer type code to Individual (no ENUM add needed since number is retained).

| # | Type | Code |
|---|------|------|
| 1 | CALL | `UpdateKojinHojinTlnTatCd(telNo, KOJIN_HOJIN_TLN_TAI_CD_KOJIN, sysDate)` // [KOJIN_HOJIN_TLN_TAI_CD_KOJIN = "1" (Individual)] |

**Block 4.8** — IF `JKKBatConst.ITNTOKI_ADD_CD_ITENM.equals(itntokiAddCd) && FLG_ON.equals(bmpUm) && monaiBmp` `[ITENM="2" AND bmpUm=1 AND monaiBmp=true]` (L2294)

> When port-out registration AND has phone number (bmpUm=1) AND within-network port exists: updates customer type code to Individual (no ENUM add needed since number is retained).

| # | Type | Code |
|---|------|------|
| 1 | CALL | `UpdateKojinHojinTlnTatCd(telNo, KOJIN_HOJIN_TLN_TAI_CD_KOJIN, sysDate)` // [KOJIN_HOJIN_TLN_TAI_CD_KOJIN = "1" (Individual)] |

**Block 5** — ELSE IF `SOD_HAK_SBT_CD_END.equals(sodHakSbtCd)` `[SOD_HAK_SBT_CD_END = "2" (SOD End)]` (L2309)

> **SOD End Branch** — Processes orders that are being terminated (cancellation, port-out end, port-in end, suspension end).

**Block 5.1** — IF `JKKBatConst.ITNTOKI_ADD_CD_ITENM.equals(itntokiAddCd)` `[ITENM = "2" (Port-Out End)]` (L2313)

> When ending port-out registration: adds SIP port-out cancellation "221", SIP port-out deletion "222", and cancellation "03", deletion "08" to request type list.

| # | Type | Code |
|---|------|------|
| 1 | SET | `odrNaiyoCdList.add(JKKBatConst.ODR_NAIYO_CD_SIP_TOKI_DSL)` // [ODR_NAIYO_CD_SIP_TOKI_DSL = "221" (SIP Port-Out Cancellation)] |
| 2 | SET | `yokyuSbtCdList.add(JKKBatConst.YOKYU_SBT_CD_DSL)` // [YOKYU_SBT_CD_DSL = "03" (Cancellation)] |
| 3 | SET | `odrNaiyoCdList.add(JKKBatConst.ODR_NAIYO_CD_SIP_TOKI_DEL)` // [ODR_NAIYO_CD_SIP_TOKI_DEL = "222" (SIP Port-Out Deletion)] |
| 4 | SET | `yokyuSbtCdList.add(JKKBatConst.YOKYU_SBT_CD_DEL)` // [YOKYU_SBT_CD_DEL = "08" (Deletion)] |

**Block 5.2** — ELSE IF `JKKBatConst.ITNTOKI_ADD_CD_ITENS.equals(itntokiAddCd)` `[ITENS = "1" (Port-In End)]` (L2323)

> When ending port-in registration: adds SIP port-in cancellation "260", SIP port-in deletion "261", and cancellation "03", deletion "08" to request type list.

| # | Type | Code |
|---|------|------|
| 1 | SET | `odrNaiyoCdList.add(JKKBatConst.ODR_NAIYO_CD_SIP_TOKI_ITN_DSL)` // [ODR_NAIYO_CD_SIP_TOKI_ITN_DSL = "260" (SIP Port-In Cancellation)] |
| 2 | SET | `yokyuSbtCdList.add(JKKBatConst.YOKYU_SBT_CD_DSL)` // [YOKYU_SBT_CD_DSL = "03" (Cancellation)] |
| 3 | SET | `odrNaiyoCdList.add(JKKBatConst.ODR_NAIYO_CD_SIP_TOKI_ITN_DEL)` // [ODR_NAIYO_CD_SIP_TOKI_ITN_DEL = "261" (SIP Port-In Deletion)] |
| 4 | SET | `yokyuSbtCdList.add(JKKBatConst.YOKYU_SBT_CD_DEL)` // [YOKYU_SBT_CD_DEL = "08" (Deletion)] |

**Block 5.3** — ELSE IF `JKKBatConst.ITNTOKI_ADD_CD_PAUSE.equals(itntokiAddCd)` `[PAUSE = "3" (Suspension End)]` (L2335)

> When ending suspension registration: adds SIP port-in suspension cancellation "263", SIP port-in suspension deletion "264", new service "02", SIP registration "218", plus optional number port info and option processing.

| # | Type | Code |
|---|------|------|
| 1 | SET | `yokyuSbtCdList.add(JKKBatConst.YOKYU_SBT_CD_DSL)` // [YOKYU_SBT_CD_DSL = "03" (Cancellation)] |
| 2 | SET | `odrNaiyoCdList.add(JKKBatConst.ODR_NAIYO_CD_SIP_TOKI_PAUSE_DSL)` // [ODR_NAIYO_CD_SIP_TOKI_PAUSE_DSL = "263" (SIP Port-In Suspension Cancellation)] |
| 3 | SET | `yokyuSbtCdList.add(JKKBatConst.YOKYU_SBT_CD_DEL)` // [YOKYU_SBT_CD_DEL = "08" (Deletion)] |
| 4 | SET | `odrNaiyoCdList.add(JKKBatConst.ODR_NAIYO_CD_SIP_TOKI_PAUSE_DEL)` // [ODR_NAIYO_CD_SIP_TOKI_PAUSE_DEL = "264" (SIP Port-In Suspension Deletion)] |
| 5 | SET | `yokyuSbtCdList.add(JKKBatConst.YOKYU_SBT_CD_NEW)` // [YOKYU_SBT_CD_NEW = "02" (New)] |
| 6 | SET | `odrNaiyoCdList.add(JKKBatConst.ODR_NAIYO_CD_SIP_ADD)` // [ODR_NAIYO_CD_SIP_ADD = "218" (SIP Registration)] |

**Block 5.4** — IF `odrNaiyoCdList.contains(ODR_NAIYO_CD_SIP_ADD) && FLG_ON.equals(bmpUm)` `[Contains "218" AND bmpUm="1"]` (L2364)

> When SIP registration order is present AND the customer has a phone number: adds number port info registration code "04" (Change) and "225" (SIP number port info registration).

| # | Type | Code |
|---|------|------|
| 1 | SET | `yokyuSbtCdList.add(JKKBatConst.YOKYU_SBT_CD_CHG)` // [YOKYU_SBT_CD_CHG = "04" (Change)] |
| 2 | SET | `odrNaiyoCdList.add(JKKBatConst.ODR_NAIYO_CD_SIP_BMP_ADD)` // [ODR_NAIYO_CD_SIP_BMP_ADD = "225" (SIP Number Port Info Registration)] |

**Block 5.5** — IF `odrNaiyoCdList.contains(ODR_NAIYO_CD_SIP_ADD) && checkOpUm(inMap)` `[Contains "218" AND checkOpUm = true]` (L2374)

> When SIP registration order is present AND optional services (non-050 number plans) exist: adds option bulk registration code "04" (Change) and "219" (SIP option bulk registration).

| # | Type | Code |
|---|------|------|
| 1 | SET | `yokyuSbtCdList.add(JKKBatConst.YOKYU_SBT_CD_CHG)` // [YOKYU_SBT_CD_CHG = "04" (Change)] |
| 2 | SET | `odrNaiyoCdList.add(JKKBatConst.ODR_NAIYO_CD_SIP_OP_ADD)` // [ODR_NAIYO_CD_SIP_OP_ADD = "219" (SIP Option Bulk Registration)] |

**Block 5.6** — IF `svcKeiUcwkStat = SVC_KEI_STAT_PAUSE_STP && pauseStpCd = PAUSE_STP_CD_PAUSECHU_SODHAKZM` `[svcKeiUcwkStat = "210" AND pauseStpCd = "01"]` (L2385)

> When the service contract status is "Suspended/Interruption" (210) AND the pause interruption code is "01" (Suspension in progress, SOD issued): adds temporary suspension code "10" and SIP temporary suspension order code "223".

| # | Type | Code |
|---|------|------|
| 1 | SET | `yokyuSbtCdList.add(JKKBatConst.YOKYU_SBT_CD_STP)` // [YOKYU_SBT_CD_STP = "10" (Temporary Suspension)] |
| 2 | SET | `odrNaiyoCdList.add(JKKBatConst.ODR_NAIYO_CD_SIP_STP)` // [ODR_NAIYO_CD_SIP_STP = "223" (SIP Temporary Suspension)] |

**Block 5.7** — IF `JKKBatConst.ITNTOKI_ADD_CD_ITENS.equals(itntokiAddCd) && FLG_OFF.equals(bmpUm) && monaiBmp` `[ITENS="1" AND bmpUm=0 AND monaiBmp=true]` (L2399)

> When ending port-in registration AND no phone number AND within-network port exists: adds ENUM deletion code "08" (Deletion) and "266" (ENUM setup deletion), and prepares to update customer type code to Corporate.

| # | Type | Code |
|---|------|------|
| 1 | SET | `yokyuSbtCdList.add(JKKBatConst.YOKYU_SBT_CD_DEL)` // [YOKYU_SBT_CD_DEL = "08" (Deletion)] |
| 2 | SET | `odrNaiyoCdList.add(JKKBatConst.ODR_NAIYO_CD_ENUM_DEL)` // [ODR_NAIYO_CD_ENUM_DEL = "266" (ENUM Setup Deletion)] |

**Block 5.8** — IF `JKKBatConst.ITNTOKI_ADD_CD_ITENM.equals(itntokiAddCd) && FLG_OFF.equals(bmpUm) && monaiBmp` `[ITENM="2" AND bmpUm=0 AND monaiBmp=true]` (L2406)

> When ending port-out registration AND no phone number AND within-network port exists: adds ENUM deletion code "08" (Deletion) and "266" (ENUM setup deletion), and prepares to update customer type code to Corporate.

| # | Type | Code |
|---|------|------|
| 1 | SET | `yokyuSbtCdList.add(JKKBatConst.YOKYU_SBT_CD_DEL)` // [YOKYU_SBT_CD_DEL = "08" (Deletion)] |
| 2 | SET | `odrNaiyoCdList.add(JKKBatConst.ODR_NAIYO_CD_ENUM_DEL)` // [ODR_NAIYO_CD_ENUM_DEL = "266" (ENUM Setup Deletion)] |

**Block 5.9** — IF `JKKBatConst.ITNTOKI_ADD_CD_ITENS.equals(itntokiAddCd) && FLG_ON.equals(bmpUm) && monaiBmp` `[ITENS="1" AND bmpUm=1 AND monaiBmp=true]` (L2416)

> When ending port-in registration AND has phone number AND within-network port exists: updates the customer type code to Corporate.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `UpdateKojinHojinTlnTatCd(telNo, KOJIN_HOJIN_TLN_TAI_CD_HOJIN, sysDate)` // [KOJIN_HOJIN_TLN_TAI_CD_HOJIN = "2" (Corporate)] |

**Block 5.10** — IF `JKKBatConst.ITNTOKI_ADD_CD_ITENM.equals(itntokiAddCd) && FLG_ON.equals(bmpUm) && monaiBmp` `[ITENM="2" AND bmpUm=1 AND monaiBmp=true]` (L2424)

> When ending port-out registration AND has phone number AND within-network port exists: updates the customer type code to Corporate.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `UpdateKojinHojinTlnTatCd(telNo, KOJIN_HOJIN_TLN_TAI_CD_HOJIN, sysDate)` // [KOJIN_HOJIN_TLN_TAI_CD_HOJIN = "2" (Corporate)] |

**Block 6** — IF `yokyuSbtCdList.size() > 1` (L2431)

> When there are multiple request type codes (multi-line order), allocate a shared transaction number for batch consistency.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `sameTrnNo = JBSbatInterface.getFormatedNextSeq(JKKBatConst.SEQ_SAME_TRN_NO, EMPTY, 12)` // [SEQ_SAME_TRN_NO = "SEQ_SAME_TRN_NO", EMPTY = ""] |

**Block 7** — FOR LOOP `(L2439)`

> Iterates over all request type codes and order content codes, registering each as an order issuance condition and creating the corresponding order work record. This is the main order creation loop.

**Block 7.1** — LOOP BODY (L2441)

> Gets a unique order issuance condition number and calls the two key registration methods.

| # | Type | Code |
|---|------|------|
| 1 | SET | `yokyuSbtCd = yokyuSbtCdList.get(i)` // Current request type code |
| 2 | SET | `odrNaiyoCd = odrNaiyoCdList.get(i)` // Current order content code |
| 3 | CALL | `odrHakkoJokenNo = JBSbatInterface.getFormatedNextSeq(JKKBatConst.SEQ_ODR_HAKKO_JOKEN_NO, EMPTY, 12)` // [SEQ_ODR_HAKKO_JOKEN_NO = "SEQ_ODR_HAKKO_JOKEN_NO"] |
| 4 | CALL | `insertOdrHakkoJoken(inMap, odrHakkoJokenNo, yokyuSbtCd, sameTrnNo, sysDate, odrNaiyoCd)` // Register order issuance condition |
| 5 | CALL | `insertOdrInfSksiWk(inMap, odrHakkoJokenNo, odrNaiyoCd)` // Register order information creation work |

**Block 7.2** — IF `odrNaiyoCd.equals(ODR_NAIYO_CD_ENUM_DEL) && monaiBmp` `[odrNaiyoCd = "266" AND monaiBmp=true]` (L2454)

> When processing an ENUM deletion order AND the number is within the network: updates the customer type code to Corporate after the ENUM deletion SOD is issued.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `UpdateKojinHojinTlnTatCd(telNo, KOJIN_HOJIN_TLN_TAI_CD_HOJIN, sysDate)` // [KOJIN_HOJIN_TLN_TAI_CD_HOJIN = "2" (Corporate)] |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `sodHakSbtCd` | Field | SOD issuance type code — classifies whether this is a Start SOD ("1", new activation) or End SOD ("2", termination) order |
| `itntokiAddCd` | Field | Transfer porting registration code — identifies the type of number porting operation: "1" (port-in registration), "2" (port-out registration), "3" (port suspension) |
| `bmpUm` | Field | Number port flag (bangou um) — "1" = customer has a phone number, "0" = no phone number |
| `monaiBmp` | Field | Within-network number port flag — indicates if the telephone number belongs to an internal network operator (computed via `isMonaiBmp`) |
| `svcKeiUcwkStat` | Field | Service contract status — current state of the service contract, e.g., "210" (Suspended/Interruption) |
| `pauseStpCd` | Field | Pause interruption code — specific pause state code, e.g., "01" (Suspension in progress, SOD already issued) |
| `yokyuSbtCd` | Field | Request type code — classifies the type of service request: "02" (New), "03" (Cancellation), "04" (Change), "08" (Deletion), "10" (Temporary Suspension), "14" (Porting) |
| `odrNaiyoCd` | Field | Order content code — classifies the specific order content to be issued to external systems: "218" (SIP Registration), "219" (SIP Option Bulk Registration), "220" (SIP Port-In Add), "221" (SIP Port-Out Cancellation), "222" (SIP Port-Out Deletion), "223" (SIP Temporary Suspension), "225" (SIP Number Port Info Registration), "229" (SIP Cancellation), "230" (SIP Deletion), "259" (SIP Port-Out Add), "260" (SIP Port-In Cancellation), "261" (SIP Port-In Deletion), "262" (SIP Port Suspension Add), "263" (SIP Port-In Suspension Cancellation), "264" (SIP Port-In Suspension Deletion), "265" (ENUM Setup/Registration), "266" (ENUM Setup Deletion) |
| `sameTrnNo` | Field | Same transaction number — shared transaction number for multi-line orders, allocated when more than one request type code exists |
| `odrHakkoJokenNo` | Field | Order issuance condition number — unique identifier for each order issuance condition record, generated via database sequence |
| SOD | Acronym | Service Order Data — standardized telecom order fulfillment entity used for inter-system service provisioning |
| FTTH | Business term | Fiber To The Home — fiber-optic broadband internet service (eo光 / eo Hikari) |
| ENUM | Business term | E.164 Number Mapping — maps telephone numbers to IP-based addresses, used in VoIP/SIP call routing |
| SIP | Business term | Session Initiation Protocol — signaling protocol for VoIP call setup and management |
| Port-In (ITENS) | Business term | Number port-in registration — customer transfers their phone number from another provider to eo Hikari (ITENTOKI_ADD_CD_ITENS = "1") |
| Port-Out (ITENM) | Business term | Number port-out registration — customer transfers their phone number from eo Hikari to another provider (ITENTOKI_ADD_CD_ITENM = "2") |
| Port Suspension (PAUSE) | Business term | Porting by suspension — temporary porting suspension request (ITENTOKI_ADD_CD_PAUSE = "3") |
| BMP (bangou) | Business term | Phone number indicator — whether the customer retains a phone number (Bangou = "番号") |
| KOJIN_HOJIN_TLN_TAI_CD_KOJIN | Field | Individual customer phone classification code — "1" = Individual (個人) |
| KOJIN_HOJIN_TLN_TAI_CD_HOJIN | Field | Corporate customer phone classification code — "2" = Corporate (法人) |
| FLG_ON | Constant | Flag ON = "1" |
| FLG_OFF | Constant | Flag OFF = "0" |
| `insertOdrHakkoJoken` | Method | Register order issuance conditions — creates records in KK_T_ODR_HAKKO_JOKEN table |
| `insertOdrInfSksiWk` | Method | Register order information creation work — creates work records in KK_T_ODR_INFO_SKSI_WK table |
| `UpdateKojinHojinTlnTatCd` | Method | Update customer type phone classification code — updates the individual/corporate classification in KK_T_KOJIN_HOJIN_TLN_TAI_CD table |
| `checkOpUm` | Method | Check optional service existence — determines if optional services (non-050 number plans) are present on the contract |
| `isMonaiBmp` | Method | Check within-network number port — determines if the phone number belongs to an internal network operator |
| KK_T_ODR_HAKKO_JOKEN | Table | Order Issuance Conditions table — stores SOD issuance condition header records |
| KK_T_ODR_INFO_SKSI_WK | Table | Order Information Creation Work table — stores order detail work records for processing |
| KK_T_KOJIN_HOJIN_TLN_TAI_CD | Table | Personal/Corporate Phone Classification Code table — stores the customer type classification for phone numbers |
