# Business Logic - JKKHakkoSODCC.telNoChge() [775 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `com.fujitsu.futurity.bp.custom.common.JKKHakkoSODCC` |
| Layer | Common Component (CC / Shared Business Logic) |
| Module | `common` (Package: `com.fujitsu.futurity.bp.custom.common`) |

## 1. Role

### JKKHakkoSODCC.telNoChge()

This method performs **phone number change processing** (Japanese: 電話番号変更処理) for K-Opticom's fiber-to-the-home (FTTH) service customers. It is the central orchestration method that coordinates the entire lifecycle of a phone number change -- from reading pre-change and post-change service contract data, through generating the appropriate Service Order Data (SOD) documents, to handling dependent services like SIP, ENUM, number portability (number conversion), caller ID notification, and emergency notifications.

The method handles **two service modes**: mode `"0"` (FTTH phone number change / 光電話番号変更) and mode `"1"` (BMP number addition application / 番ポ追加申込). Within each mode, it further branches based on whether the customer uses a multi-function router (多機能ルーター), whether they have number portability (BMP) enabled, and whether their order status allows skipping certain operations (e.g., forced termination cases where SIP disconnect/cancel SOD was already issued).

Design patterns implemented: **routed dispatch** (mode-based branching into distinct operational paths), **builder** (accumulating SOD documents via `addSOD`, `add050AddSod`, `add050DelSod`, `addTakinoSod` calls), and **delegation** (offering validation, lookup, and creation to specialized helper methods). Its role in the larger system is that of a **shared service component** -- called internally by `bmpSwitchOdrCtrl` and `htelNoChgeOdrCtrl` within the same class, which in turn are entry points from screen CBS layer. It does not receive direct calls from UI screens.

When processing device-level data (from `EKK0341B008SC`), the method filters to only VA (home terminal) devices and, if a multi-function router is present, generates SOD for router setup/change (ODR_NAIYO_CD_408 or 409). For non-router cases, it generates standard phone number change SOD (ODR_NAIYO_CD_210).

After device loop processing, it handles SIP lifecycle (disconnect, cancel, re-register), ENUM (setup/cancel if BMP is active), number portability (050 number add/del), option services (non-050 services), and emergency notification registration. The final step registers emergency notification (ODR_NAIYO_CD_250).

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["telNoChge(params)"])

    START --> SETUP["Extract SOD Maps from sodMap"]
    SETUP --> GETPREV["Extract service contract data"]
    GETPREV --> NORMALIZE["shkkaMap: normalize maps"]
    NORMALIZE --> GETPOSTUCWK["Get post-change service contract via callEKK0161A010SC"]
    GETPOSTUCWK --> GETTRNNO["getSame_trn_no: get same processing number"]
    GETTRNNO --> GETDSLNO["getEKK0251B001SC: service circuit details"]
    GETDSLNO --> CALLVA["callEKK0191A010SC: home terminal VA agreement"]
    CALLVA --> CALLKKT1["callEKK0341B008SC: device details list"]
    CALLKKT1 --> CALLKKT2["callEKK0341B008_02SC: EG switch check"]
    CALLKKT2 --> LOOPSTART["for each device in list"]
    LOOPSTART --> REGALCHK{"isRegalVaKiki?"}
    REGALCHK -->|not REGAL| TAKINOCHECK{"checkTakinoRT: multi-func router?"}
    REGALCHK -->|REGAL| LOOPNEXT["continue"]
    TAKINOCHECK -->|not router| MODECHECK{"mode = TEL_CHNG_DIV_HTEL_CHNG?"}
    MODECHECK -->|mode 0: telno change| TELCHNG_SOD["addSOD 210: OLS setup, phone change"]
    MODECHECK -->|mode 1 or BMP add| TAKINOTALK["addTakinoSOD 409: router setup/change"]
    TELCHNG_SOD --> BREAK1["break loop"]
    TAKINOTALK --> BREAK1
    TAKINOCHECK -->|router| TAKINOTALK
    LOOPNEXT --> LOOPEND["end device loop"]

    LOOPEND --> GETBFUCWK["Get pre-change data via callEKK0191A010SC"]
    GETBFUCWK --> CHECKSIP["callEKK1041B001SC: check pending orders"]
    CHECKSIP --> SKIPCHECK{"can_skip_sip_ecs_delsod?"}
    SKIPCHECK -->|false| SIPDEL["addSOD 229: SIP disconnect"]
    SIPDEL --> SIPDEL2["addSOD 230: SIP cancel"]
    SIPDEL2 --> ENUMCHECK["ENUM check block"]
    SKIPCHECK -->|true| ENUMCHECK
    ENUMCHECK --> ENUMREG{"chbfBmpUm = BMP_UM_ARI?"}
    ENUMREG -->|has BMP| BMPCHK{"isBmpOpenZumi?"}
    BMPCHK -->|open| TELNOJUDGE{"isTelnoSODJudge 004?"}
    TELNOJUDGE -->|yes| ENUMDEL_S["addSOD 266: ENUM setup/cancel"]
    ENUMREG -->|no BMP| TELNOJUDGE2{"isTelnoSODJudge 004?"}
    TELNOJUDGE2 -->|yes| ENUMDEL2["addSOD 266: ENUM setup/cancel"]
    ENUMDEL_S --> OPLOOP1["option service loop"]
    ENUMDEL2 --> OPLOOP1
    OPLOOP1 --> CHK050{"OP_SVC_CD = N050?"}
    CHK050 -->|yes| SET050["iHave050no = true"]
    SET050 --> CHKNONE50["telOpUm = legalTelSod"]
    CHK050 -->|no 050| CHKNONE50
    CHKNONE50 --> OPLOOPEND["end loop"]
    OPLOOPEND --> DEL050CHK{"iHave050no?"}
    DEL050CHK -->|yes| DEL050["add050DelSod: number portability cancel"]
    DEL050CHK -->|no| EMERCHK["emergency check"]
    DEL050 --> EMERCHK
    EMERCHK --> EMERADD{"!can_skip?"}
    EMERADD -->|yes| EMERADD_S["addSOD 252: emergency cancel"]
    EMERADD -->|no| SIPREG["SIP registration"]
    EMERADD_S --> SIPREG
    SIPREG --> SIPREG_S["addSOD 218: SIP registration"]
    SIPREG_S --> MODECHK2{"mode = HTEL_CHNG?"}
    MODECHK2 -->|yes| TEMPSTOP["addSOD 223: FTTH SIP temp stop"]
    MODECHK2 -->|no| TELNOJUDGE3{"isTelnoSODJudge 001?"}
    TEMPSTOP --> TELNOJUDGE3
    TELNOJUDGE3 -->|yes| BMPREG["addSOD 225: SIP BMP reg"]
    BMPREG --> ENUMREG_S["addSOD 265: ENUM reg"]
    TELNOJUDGE3 -->|no| OPLOOP2["post-change option loop"]
    ENUMREG_S --> OPLOOP2
    OPLOOP2 --> OP2CHK050{"OP_SVC_CD = N050?"}
    OP2CHK050 -->|yes| OP2SET050["iHave050no = true"]
    OP2CHK050 -->|no 050| OP2CHKTEL{"telOpUm?"}
    OP2SET050 --> OP2CHKTEL
    OP2CHKTEL --> TELCHK2{"telOpUm?"}
    TELCHK2 -->|yes| HASINSHAADD["addSOD 211/212: caller ID"]
    TELCHK2 -->|no| SIPALLREG["addSOD 219: SIP option reg"]
    HASINSHAADD --> SIPALLREG
    SIPALLREG --> ADD050CHK{"iHave050no?"}
    ADD050CHK -->|yes| ADD050["add050AddSod: number portability reg"]
    ADD050CHK -->|no| EMERREG["emergency reg"]
    ADD050 --> EMERREG
    EMERREG --> EMERREG_S["addSOD 250: emergency reg"]
    EMERREG_S --> END_NODE(["Return param"])

    END_NODE --> FINISH(["End"])
```

**CRITICAL - Constant Resolution:**

| Constant | Value | Business Meaning |
|----------|-------|-----------------|
| `TEL_CHNG_DIV_HTEL_CHNG` | `"0"` | FTTH phone number change |
| `TEL_CHNG_DIV_BMP_ADD_MSKM` | `"1"` | Number portability addition application |
| `ODR_NAIYO_CD_208` | `"208"` | OLS setup, phone number addition |
| `ODR_NAIYO_CD_209` | `"209"` | OLS setup, phone number disconnect |
| `ODR_NAIYO_CD_210` | `"210"` | OLS setup, phone number change |
| `ODR_NAIYO_CD_211` | `"211"` | OLS setup, caller ID notification registration |
| `ODR_NAIYO_CD_212` | `"212"` | OLS setup, caller ID notification disconnect |
| `ODR_NAIYO_CD_218` | `"218"` | SIP registration |
| `ODR_NAIYO_CD_219` | `"219"` | SIP option service unified registration |
| `ODR_NAIYO_CD_223` | `"223"` | FTTH SIP temporary suspension |
| `ODR_NAIYO_CD_225` | `"225"` | SIP BMP (number portability) information registration |
| `ODR_NAIYO_CD_229` | `"229"` | SIP disconnect |
| `ODR_NAIYO_CD_230` | `"230"` | SIP cancel |
| `ODR_NAIYO_CD_250` | `"250"` | Emergency notification registration |
| `ODR_NAIYO_CD_252` | `"252"` | Emergency notification cancel |
| `ODR_NAIYO_CD_265` | `"265"` | ENUM setup/registration |
| `ODR_NAIYO_CD_266` | `"266"` | ENUM setup/cancel |
| `ODR_NAIYO_CD_408` | `"408"` | Multi-function router setup/addition |
| `ODR_NAIYO_CD_409` | `"409"` | Multi-function router setup/change (VA + phone) |
| `BMP_UM_ARI` | `"1"` | Has number portability (BMP) |
| `ORDER_SBT_CD_TEL` | `"TEL"` | Order subtype code: Phone |
| `SVC_ORDER_CD_SIP` | `"SIP"` | Service order code: SIP |
| `YOKYU_SBT_CD_DSL` | `"03"` | Release subtype code: Disconnect |
| `YOKYU_SBT_CD_DEL` | `"08"` | Subtype code: Cancel |
| `OP_SVC_CD_N050` | `"N050"` | Option service code: 050-number portability |
| `OP_SVC_CD_DSP_ME` | `"DSP_ME"` | Option service code: Caller ID notification |
| `TELNO_JUDGE_004` | `"004"` | Judge pattern: NTT phone with internal number portability (legal entity to individual) |
| `TELNO_JUDGE_001` | `"001"` | Judge pattern: Non-NTT phone or NTT with internal BMP |
| `FUNC_CODE_1` | `"1"` | Function code: agreement inquiry |
| `FUNC_CODE_2` | `"2"` | Function code: inquiry |
| `FUNC_CODE_4` | `"4"` | Function code: EG switch inquiry |

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `handle` | `SessionHandle` | Session handle carrying session manager context; used for database connections and transaction management throughout the method |
| 2 | `param` | `IRequestParameterReadWrite` | Parameter object containing model group and control maps; acts as the accumulator for SOD documents generated during processing (reassigned via `addSOD` calls) |
| 3 | `fixedText` | `String` | User-defined arbitrary string; passed through but not actively used in current processing path |
| 4 | `sodMap` | `HashMap<String, Object>` | Service Order Data map carrying service contract info (`SVC_KEI_INFO`), service contract details (`SVC_KEI_UCWK_INFO`), and optional operation service info (`OPSVKEI_INFO`); serves as the primary data source for reading pre/post-change state |
| 5 | `mode` | `String` | Service type discriminator: `"0"` triggers FTTH phone number change processing path; `"1"` triggers number portability (BMP) addition application path |

**External state read by the method (instance fields):**

| Field | Description |
|-------|-------------|
| `this.ido_div` | Difference/discrepancy code used in device eligibility checks |
| `this.kktk_svc_kei_no[]` | Device provision service contract number (set during device loop) |
| `this.kktk_svc_kei_gadtm[]` | Device provision service contract version registration timestamp |
| `this.taknkiki_model_cd[]` | Home terminal device model code |
| `this.kiki_seizo_no[]` | Device serial number |
| `this.svc_kei_ucwk_no[]` | Service contract details number (post-change) |
| `this.svc_kei_ucwk_gadtm[]` | Service contract details version registration timestamp |
| `this.svc_kei_kaisen_ucwk_no` | Service circuit details number (from VLAN-ID processing) |
| `this.svc_kei_kaisen_ucwk_gadtm` | Service circuit details version registration timestamp |
| `this.same_trn_no` | Same processing number (used to group related operations) |
| `this.op_svc_kei_no_tikan` | Option service contract number for number portability |
| `this.op_gadtm_tikan` | Version timestamp for number portability option service |
| `this.op_svc_kei_no` | Option service contract number (caller ID) |
| `this.op_gadtm` | Version timestamp for caller ID option service |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `callEKK0161A010SC` | EKK0161A010SC | Service contract details (post-change) | Retrieves post-change service contract details by service contract details number and version timestamp |
| R | `getSame_trn_no` | - | Same processing number | Gets the same processing number for grouping related operations |
| R | `getEKK0251B001SC` | EKK0251B001SC | Service circuit details | Retrieves service circuit details list for the given service contract number (VLAN-ID processing) |
| R | `callEKK0191A010SC` | EKK0191A010SC | Home terminal VA info, device info | Agrees home terminal VA information and device info by service contract details number; called twice (post-change with FUNC_CODE_1, pre-change with FUNC_CODE_2) |
| R | `callEKK0341B008SC` | EKK0341B008SC | Device provision service contract details | Retrieves device provision service contract details list for the service contract number |
| R | `callEKK0341B008_02SC` | EEK0341B008_02SC | Device change number with EG switch info | Additional device details for EG switch consideration (change during device exchange); replaces device list if VA device has change number match with IDO_DIV=00067 |
| R | `callEKK1041B001SC` | EKK1041B001SC | Order settings list | Queries order settings list by order subtype (TEL), service order code (SIP), and service contract number |
| R | `getEKK1041B001result` | - | Order settings result | Retrieves the result list from the EKK1041B001SC call |
| R | `callEKK0351B002SC` | EKK0351B002SC | Option service contract list | Agrees option service contract list; called twice (pre-change and post-change) |
| R | `getEKK0351B002result` | - | Option service result | Retrieves the result from the EKK0351B002SC call |
| C | `addSOD` | - | SOD (Service Order Data) | Creates SOD with the given ODR_NAIYO_CD (order content code); the most frequently called method, creating various service orders |
| C | `add050AddSod` | - | SOD (number portability) | Creates SOD for 050-number portability addition (post-change) |
| C | `add050DelSod` | - | SOD (number portability) | Creates SOD for 050-number portability cancellation (pre-change) |
| C | `addTakinoSOD` | - | SOD (multi-func router) | Creates SOD for multi-function router setup/change (VA + phone) |
| - | `isRegalVaKiki` | - | - | Validates whether the device is a valid REGAL VA device; used to filter device list |
| - | `checkTakinoRT` | - | - | Checks if the customer uses a multi-function router; returns 0 if not a router |
| - | `isBmpOpenZumiDslNoDslNoChg` | - | - | Determines if number portability (BMP) has been opened; returns true if opened |
| - | `isTelnoSODJudge` | - | - | Judges whether SOD should be generated based on phone number type (NTT/internal BMP) and judge pattern |
| - | `legalTelSod` | - | - | Determines if a non-050 option service code is a legal telephone service requiring SOD |
| - | `isAddSodTrgtStat` | - | - | Determines if the option service contract status is a target for SOD addition |
| - | `isNullBlank` (various) | - | - | Null/blank validation utilities called from various helper classes |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | `bmpSwitchOdrCtrl` | `bmpSwitchOdrCtrl` -> `telNoChge` | `addSOD [C] SOD`, `add050DelSod [C] SOD`, `callEKK0351B002SC [R] Option Service`, `callEKK1041B001SC [R] Order Settings` |
| 2 | `htelNoChgeOdrCtrl` | `htelNoChgeOdrCtrl` -> `telNoChge` | `addSOD [C] SOD`, `add050DelSod [C] SOD`, `callEKK0351B002SC [R] Option Service`, `callEKK1041B001SC [R] Order Settings` |

**Terminal operations from this method:**

| Terminal | Type | Description |
|----------|------|-------------|
| `addSOD` | C | Service Order Data creation (multiple ODR_NAIYO_CD values: 210, 229, 230, 218, 252, 250, 266, 225, 265, 211, 219, 212, 223) |
| `add050AddSod` | C | 050-number portability addition SOD creation |
| `add050DelSod` | C | 050-number portability cancellation SOD creation |
| `addTakinoSOD` | C | Multi-function router SOD creation (codes 408, 409) |
| `callEKK1041B001SC` | R | Order settings list query (TEL, SIP) |
| `callEKK0351B002SC` | R | Option service contract list query |
| `legalTelSod` | - | Legal telephone service SOD judgment |
| `isAddSodTrgtStat` | - | SOD addition target status check |
| `isTelnoSODJudge` | - | Phone number SOD judgment |

## 6. Per-Branch Detail Blocks

**Block 1** — [SET] Initialize working variables (L33598)

| # | Type | Code |
|---|------|------|
| 1 | SET | `statusCode = 0` // Service interval phase execution status |
| 2 | SET | `svc_kei_info_Map = shkkaMap(sodMap.get(SVC_KEI_INFO))` // Service contract info |
| 3 | SET | `svc_kei_ucwk_info_Map = shkkaMap(sodMap.get(SVC_KEI_UCWK_INFO))` // Service contract details info |
| 4 | SET | `opsvkei_info_Map = shkkaMap(sodMap.get(OPSVKEI_INFO))` // Option service info (ANK-1855-00-00) |

**Block 2** — [SET] Extract post-change parameters (L33612-L33619)

| # | Type | Code |
|---|------|------|
| 1 | SET | `svc_kei_no = svc_kei_info_MAP.get(INFO_SVC_KEI_NO)` // Service contract number |
| 2 | SET | `svc_kei_ucwk_no = svc_kei_ucwk_info_Map.get(INFO_SVC_KEI_UCWK_NO)` // Post-change service contract details number |
| 3 | SET | `chbf_svc_kei_ucwk_gene_add_dtm = ...get(INFO_CHBF_SVC_KEI_UCWK_GENE_ADD_DTM)` // Pre-change version timestamp |
| 4 | SET | `chaf_svc_kei_ucwk_gene_add_dtm = ...get(INFO_CHAF_SVC_KEI_UCWK_GENE_ADD_DTM)` // Post-change version timestamp |
| 5 | SET | `chbfBmpUm = ""` // Pre-change number portability status (ANK-3876-00-00) |

**Block 3** — [TRY-CATCH] Retrieve post-change service contract details (OT-2013-0000311) (L33627-L33641)

| # | Type | Code |
|---|------|------|
| 1 | SET | `inHashUcwk.put(SVC_KEI_UCWK_NO, svc_kei_ucwk_no)` // Post-change service contract details number |
| 2 | SET | `inHashUcwk.put(GENE_ADD_DTM, chaf_svc_kei_ucwk_gene_add_dtm)` // Post-change version timestamp |
| 3 | CALL | `statusCode = callEKK0161A010SC(param, handle, inHashUcwk, resultHashUcwk, FUNC_CODE_1)` |
| 4 | IF | `0 != statusCode` -> throw `CCException(SCCallException)` |
| 5 | SET | `eKK0161A010Hash = resultHashUcwk.get(TEMPLATE_ID_EKK0161A010)` |
| 6 | SET | `chbfSvcKeiUcwkNo = eKK0161A010Hash.get(KEIZK_MT_SVC_KEI_UCWK_NO)` // Previous service contract details number |

**Block 4** — [SET] Get same processing number and service circuit details (L33646-L33663)

| # | Type | Code |
|---|------|------|
| 1 | SET | `sameTrnNo = new String[1]` |
| 2 | CALL | `getSame_trn_no(param, handle, null, sameTrnNo)` // Get same processing number |
| 3 | SET | `this.same_trn_no = sameTrnNo[0]` |
| 4 | SET | `this.svc_kei_ucwk_no[0] = svc_kei_ucwk_no` |
| 5 | SET | `this.svc_kei_ucwk_gadtm[0] = chaf_svc_kei_ucwk_gene_add_dtm` |
| 6 | CALL | `eKK0251B001Hash = getEKK0251B001SC(param, handle, svc_kei_no, FUNC_CODE_1)` // Service circuit details |
| 7 | SET | `this.svc_kei_kaisen_ucwk_no = eKK0251B001Hash.get(SVC_KEI_KAISEN_UCWK_NO)` |
| 8 | SET | `this.svc_kei_kaisen_ucwk_gadtm = eKK0251B001Hash.get(GENE_ADD_DTM)` |

**Block 5** — [CALL] Get post-change VA device info (L33669-L33690)

| # | Type | Code |
|---|------|------|
| 1 | SET | `inHashUcwk.put(SVC_KEI_UCWK_NO, svc_kei_ucwk_no)` |
| 2 | SET | `inHashUcwk.put(GENE_ADD_DTM, chaf_svc_kei_ucwk_gene_add_dtm)` |
| 3 | CALL | `statusCode = callEKK0191A010SC(param, handle, inHashUcwk, resultHashUcwk, FUNC_CODE_1)` |
| 4 | IF | `0 != statusCode` -> throw `CCException(SCCallException)` |
| 5 | SET | `vaTaknkikiModelCd = eKK0191A010Hash.get(VA_TAKNKIKI_MODEL_CD)` // Home terminal device model code |
| 6 | SET | `vaKikiChgNo = eKK0191A010Hash.get(VA_KIKI_CHG_NO)` // IT1-2013-0000099 |
| 7 | SET | `chafBmpUm = eKK0191A010Hash.get(BMP_UM)` // Post-change number portability status (OT-2013-0000311) |

**Block 6** — [CALL] Get device list (L33695-L33710)

| # | Type | Code |
|---|------|------|
| 1 | SET | `inHashKktk.put(SVC_KEI_NO, svc_kei_no)` |
| 2 | CALL | `statusCode = callEKK0341B008SC(param, handle, inHashKktk, resultHashKktk, FUNC_CODE_1)` |
| 3 | IF | `0 != statusCode` -> throw `CCException(SCCallException)` |
| 4 | SET | `msgEKK0341B008SCList = resultHashKktk.get(TEMPLATE_ID_EKK0341B022)` |

**Block 7** — [CALL] EG switch consideration (IT2-2016-0000035) (L33715-L33742)

| # | Type | Code |
|---|------|------|
| 1 | SET | `inHashKktk.put(SVC_KEI_NO, svc_kei_no)` |
| 2 | CALL | `statusCode = callEKK0341B008_02SC(param, handle, inHashKktk, resultHashKktk, FUNC_CODE_4)` |
| 3 | IF | `0 != statusCode` -> throw `CCException(SCCallException)` |
| 4 | SET | `msgEKK0341B022_02SCList = resultHashKktk.get(TEMPLATE_ID_EKK0341B022)` |
| 5 | IF | `msgEKK0341B022_02SCList != null && length > 0` -> iterate |
| 6 | SET | `kktkSvcCd = eKK0341B022SCHash.get(KKTK_SVC_CD)` |
| 7 | SET | `kikiChgNo = eKK0341B022SCHash.get(KIKI_CHG_NO)` |
| 8 | SET | `idoDiv = eKK0341B022SCHash.get(IDO_DIV)` |
| 9 | IF | `KKTK_SVC_CD_HTEL_VA.equals(kktkSvcCd)` AND `vaKikiChgNo.equals(kikiChgNo)` AND `"00067".equals(idoDiv)` |
| 10 | SET | `msgEKK0341B008SCList = msgEKK0341B022_02SCList` // Replace device list |

**Block 8** — [FOR] Process each device (L33750-L33843)

| # | Type | Code |
|---|------|------|
| 1 | SET | `isHakkoOlsTelnoChg = false` // OM-2014-0001919 |
| 2 | SET | `for i = 0 to msgEKK0341B008SCList.length` |
| 3 | SET | `eKK0341B008SCHash = msgEKK0341B008SCList[i].getMsgData()` |
| 4 | SET | `kktkSvcKeiNo = eKK0341B008SCHash.get(KKTK_SVC_KEI_NO)` // Device provision service contract number |
| 5 | SET | `kktkGeneAddDtm = eKK0341B008SCHash.get(GENE_ADD_DTM)` |
| 6 | SET | `vaTaknkikiModelCd = eKK0341B008SCHash.get(TAKNKIKI_MODEL_CD)` // OM-2015-0003416 |
| 7 | SET | `kktkKikiSeizoNo = eKK0341B008SCHash.get(KIKI_SEIZO_NO)` |

**Block 8.1** — [IF-ELSE] REGAL VA device check (ANK-3238-00-00) (L33831-L33843)

| # | Type | Code |
|---|------|------|
| 1 | SET | `kokanBfKiki = new HashMap<>()` // Repair exchange map |
| 2 | IF | `!isRegalVaKiki(handle, param, eKK0341B008SCHash, vaTaknkikiModelCd, null, this.ido_div, vaKikiChgNo, kokanBfKiki)` |
| 3 | EXEC | `continue` // Skip non-REGAL devices |

**Block 8.1.1** — [IF] Repair exchange device (ANK-3238-00-00) (L33847-L33853)

| # | Type | Code |
|---|------|------|
| 1 | IF | `kokanBfKiki != null && !isEmpty()` |
| 2 | SET | `kktkSvcKeiNo = kokanBfKiki.get(KKTK_SVC_KEI_NO)` // Use repair exchange device info |
| 3 | SET | `kktkGeneAddDtm = kokanBfKiki.get(GENE_ADD_DTM)` |
| 4 | SET | `kktkKikiSeizoNo = kokanBfKiki.get(KIKI_SEIZO_NO)` |
| 5 | SET | `vaTaknkikiModelCd = kokanBfKiki.get(TAKNKIKI_MODEL_CD)` |

**Block 8.2** — [SET] Store device info into instance fields (L33856-L33867)

| # | Type | Code |
|---|------|------|
| 1 | SET | `this.kktk_svc_kei_no[0] = kktkSvcKeiNo` |
| 2 | SET | `this.kktk_svc_kei_gadtm[0] = kktkGeneAddDtm` |
| 3 | SET | `this.taknkiki_model_cd[0] = vaTaknkikiModelCd` |
| 4 | SET | `this.kiki_seizo_no[0] = kktkKikiSeizoNo` |

**Block 8.3** — [IF] Multi-function router check and SOD generation (L33873-L33894)

| # | Type | Code |
|---|------|------|
| 1 | CALL | `takino_flg = checkTakinoRT(handle, param)` // Returns 0 if not a multi-func router |
| 2 | IF | `TEL_CHNG_DIV_HTEL_CHNG.equals(mode)` OR (`TEL_CHNG_DIV_BMP_ADD_MSKM.equals(mode)` AND `!isNull(chbfSvcKeiUcwkNo)`) |
| 3 | IF | `takino_flg == 0` (not a multi-func router) |
| 4 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_210)` // OLS setup, phone number change |
| 5 | SET | `isHakkoOlsTelnoChg = true` // OM-2014-0001919 |
| 6 | IF-ELSE | `takino_flg != 9` |
| 7 | CALL | `param = addTakinoSOD(handle, param, ODR_NAIYO_CD_409)` // Multi-func router setup/change |
| 8 | EXEC | `break` // Exit device loop |

**Block 8.4** — [IF] Non-change mode SOD generation (L33899-L33913)

| # | Type | Code |
|---|------|------|
| 1 | IF | `takino_flg == 0` (not a multi-func router) |
| 2 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_208)` // OLS setup, phone number addition |
| 3 | IF-ELSE | `takino_flg != 9` |
| 4 | CALL | `param = addTakinoSOD(handle, param, ODR_NAIYO_CD_408)` // Multi-func router setup/addition |
| 5 | EXEC | `break` // Exit device loop |

**Block 9** — [TRY-CATCH] Get pre-change service contract details (L33927-L33950)

| # | Type | Code |
|---|------|------|
| 1 | SET | `inHashUcwk.put(SVC_KEI_UCWK_NO, chbfSvcKeiUcwkNo)` // Pre-change service contract details number |
| 2 | CALL | `statusCode = callEKK0191A010SC(param, handle, inHashUcwk, resultHashUcwk, FUNC_CODE_2)` |
| 3 | IF | `0 != statusCode` -> throw `CCException(SCCallException)` |
| 4 | SET | `chbf_svc_kei_ucwk_gene_add_dtm = chbfEKK0191A010Map.get(GENE_ADD_DTM)` |
| 5 | SET | `chbfBmpUm = chbfEKK0191A010Map.get(BMP_UM)` // Pre-change BMP status |
| 6 | SET | `this.svc_kei_ucwk_no[0] = chbfSvcKeiUcwkNo` // Pre-change details number |
| 7 | SET | `this.svc_kei_ucwk_gadtm[0] = chbf_svc_kei_ucwk_gene_add_dtm` |

**Block 10** — [IF] Check for pending disconnect/cancel orders (ANK-4494-00-00) (L33955-L33983)

| # | Type | Code |
|---|------|------|
| 1 | SET | `can_skip_sip_ecs_delsod = false` |
| 2 | CALL | `callEKK1041B001SC(param, handle, ORDER_SBT_CD_TEL, SVC_ORDER_CD_SIP, null, svc_kei_no, null, null)` |
| 3 | SET | `eKK1041B001HashList = getEKK1041B001result(param)` |
| 4 | FOR | `for each eKK1041B001Hash in eKK1041B001HashList` |
| 5 | IF | `chbfSvcKeiUcwkNo.equals(tmpSvcKeiUcwkNo)` |
| 6 | IF | `YOKYU_SBT_CD_DSL.equals(RCNT_YOKYU_SBT_CD)` OR `YOKYU_SBT_CD_DEL.equals(RCNT_YOKYU_SBT_CD)` |
| 7 | SET | `can_skip_sip_ecs_delsod = true` |

**Block 11** — [IF] SIP disconnect/cancel SOD (L33990-L33997)

| # | Type | Code |
|---|------|------|
| 1 | IF | `!can_skip_sip_ecs_delsod` |
| 2 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_229)` // SIP disconnect |
| 3 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_230)` // SIP cancel |

**Block 12** — [IF-ELSE] ENUM setup/cancel SOD (ANK-4494-00-00 STEP2) (L34003-L34029)

| # | Type | Code |
|---|------|------|
| 1 | IF | `BMP_UM_ARI.equals(chbfBmpUm)` (has BMP) |
| 2 | IF | `isBmpOpenZumiDslNoDslNoChg(param, handle, svc_kei_no, this.svc_kei_ucwk_no[0], this.svc_kei_ucwk_gadtm[0])` |
| 3 | IF | `isTelnoSODJudge(handle, param, chbfSvcKeiUcwkNo, chbf_svc_kei_ucwk_gene_add_dtm, null, TELNO_JUDGE_004)` AND `!can_skip_sip_ecs_delsod` |
| 4 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_266)` // ENUM setup/cancel |
| 5 | ELSE | (no BMP) |
| 6 | IF | `isTelnoSODJudge(handle, param, chbfSvcKeiUcwkNo, chbf_svc_kei_ucwk_gene_add_dtm, null, TELNO_JUDGE_004)` AND `!can_skip_sip_ecs_delsod` |
| 7 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_266)` // ENUM setup/cancel |

**Block 13** — [FOR] Process pre-change option services (L34035-L34119)

| # | Type | Code |
|---|------|------|
| 1 | SET | `iHave050no = false` |
| 2 | SET | `telOpUm = false` |
| 3 | SET | `mskmDtlNo = opsvkei_info_Map.get(INFO_MSKM_DTL_NO)` |
| 4 | SET | `inHashOp.put(SVC_KEI_UCWK_NO, chbfSvcKeiUcwkNo)` // Pre-change service contract details number |
| 5 | CALL | `statusCode = callEKK0351B002SC(param, handle, inHashOp, resultHashOp, FUNC_CODE_1)` |
| 6 | SET | `msgList = resultHashOp.get(TEMPLATE_ID_EKK0351B002)` |
| 7 | FOR | `for i = 0 to msgList.length` |
| 8 | SET | `eKK0351B002Hash = msgList[i].getMsgData()` |
| 9 | SET | `op_svc_cd = eKK0351B002Hash.get(OP_SVC_CD)` |
| 10 | SET | `mskmDtlNoOp = eKK0351B002Hash.get(MSKM_DTL_NO)` |
| 11 | IF | `isNullBlank(mskmDtlNoOp)` OR `!mskmDtlNoOp.equals(mskmDtlNo)` |
| 12 | EXEC | `continue` |

**Block 13.1** — [IF] 050-number portability option (L34080-L34089)

| # | Type | Code |
|---|------|------|
| 1 | IF | `OP_SVC_CD_N050.equals(op_svc_cd)` |
| 2 | SET | `iHave050no = true` |
| 3 | SET | `this.op_svc_kei_no_tikan = eKK0351B002Hash.get(OP_SVC_KEI_NO)` |
| 4 | SET | `this.op_gadtm_tikan = eKK0351B002Hash.get(GENE_ADD_DTM)` |

**Block 13.2** — [ELSE] Non-050 option services (ANK-1855-00-00) (L34097-L34098)

| # | Type | Code |
|---|------|------|
| 1 | SET | `telOpUm = (telOpUm ? telOpUm : legalTelSod(op_svc_cd))` |

**Block 14** — [IF] Pre-change number portability cancel SOD (L34103-L34113)

| # | Type | Code |
|---|------|------|
| 1 | IF | `iHave050no` |
| 2 | CALL | `param = add050DelSod(param, handle, svc_kei_no, chbfSvcKeiUcwkNo, chbf_svc_kei_ucwk_gene_add_dtm, this.op_svc_kei_no_tikan, this.op_gadtm_tikan)` // 050-number portability/cancel (pre-change) |

**Block 15** — [IF] Emergency notification cancel SOD (ANK-4494-00-00) (L34116-L34122)

| # | Type | Code |
|---|------|------|
| 1 | IF | `!can_skip_sip_ecs_delsod` |
| 2 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_252)` // Emergency notification, cancel |

**Block 16** — [SET] Reset same_trn_no and SIP registration (L34129-L34135)

| # | Type | Code |
|---|------|------|
| 1 | SET | `this.same_trn_no = ""` // OM-2013-0003443 |
| 2 | SET | `this.svc_kei_ucwk_no[0] = svc_kei_ucwk_no` // Post-change details number |
| 3 | SET | `this.svc_kei_ucwk_gadtm[0] = chaf_svc_kei_ucwk_gene_add_dtm` |
| 4 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_218)` // SIP registration |

**Block 17** — [IF-ELSE] Mode-specific post-change processing (ANK-4494-00-00 STEP2) (L34140-L34159)

| # | Type | Code |
|---|------|------|
| 1 | IF | `TEL_CHNG_DIV_HTEL_CHNG.equals(mode)` AND `CD00001_1.equals(chafBmpUm)` |
| 2 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_223)` // FTTH SIP temporary suspension |
| 3 | ELSE-IF | `isTelnoSODJudge(handle, param, svc_kei_ucwk_no, chaf_svc_kei_ucwk_gene_add_dtm, null, TELNO_JUDGE_001)` |
| 4 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_225)` // SIP BMP info registration |
| 5 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_265)` // ENUM setup/registration |

**Block 18** — [FOR] Process post-change option services (ANK-1855-00-00) (L34164-L34259)

| # | Type | Code |
|---|------|------|
| 1 | SET | `iHave050no = false` |
| 2 | SET | `inHashOp.put(SVC_KEI_UCWK_NO, svc_kei_ucwk_no)` // Post-change service contract details number |
| 3 | CALL | `statusCode = callEKK0351B002SC(param, handle, inHashOp, resultHashOp, FUNC_CODE_1)` |
| 4 | SET | `msgList2 = resultHashOp.get(TEMPLATE_ID_EKK0351B002)` |
| 5 | FOR | `for i = 0 to msgList2.length` |
| 6 | SET | `eKK0351B002Hash = msgList2[i].getMsgData()` |
| 7 | SET | `op_svc_kei_stat = eKK0351B002Hash.get(OP_SVC_KEI_STAT)` |
| 8 | SET | `op_svc_cd = eKK0351B002Hash.get(OP_SVC_CD)` |

**Block 18.1** — [IF] 050-number portability option (post-change) (L34178-L34188)

| # | Type | Code |
|---|------|------|
| 1 | IF | `OP_SVC_CD_N050.equals(op_svc_cd)` |
| 2 | IF | `isAddSodTrgtStat(op_svc_kei_stat)` |
| 3 | SET | `iHave050no = true` |
| 4 | SET | `this.op_svc_kei_no_tikan = eKK0351B002Hash.get(OP_SVC_KEI_NO)` |
| 5 | SET | `this.op_gadtm_tikan = eKK0351B002Hash.get(GENE_ADD_DTM)` |

**Block 18.2** — [ELSE] Non-050 option services (post-change) (L34192-L34227)

| # | Type | Code |
|---|------|------|
| 1 | SET | `telOpUm = (telOpUm ? telOpUm : legalTelSod(op_svc_cd))` |
| 2 | IF | `OP_SVC_CD_DSP_ME.equals(op_svc_cd)` AND `isHakkoOlsTelnoChg` |
| 3 | IF | `SVC_KEI_STAT_030` OR `SVC_KEI_STAT_100` OR `SVC_KEI_STAT_210` |
| 4 | SET | `existsHasinshaNoTchi = true` // Caller ID notification registration pending |
| 5 | SET | `this.op_svc_kei_no = eKK0351B002Hash.get(OP_SVC_KEI_NO)` |
| 6 | SET | `this.op_gadtm = eKK0351B002Hash.get(GENE_ADD_DTM)` |
| 7 | ELSE-IF | `SVC_KEI_STAT_910` (contract terminated) |
| 8 | SET | `existsHasinshaNoTchiDsl = true` // Caller ID notification disconnect pending |
| 9 | SET | `this.op_svc_kei_no = eKK0351B002Hash.get(OP_SVC_KEI_NO)` |
| 10 | SET | `this.op_gadtm = eKK0351B002Hash.get(GENE_ADD_DTM)` |

**Block 19** — [IF-ELSE] Post-change caller ID / option service SOD (L34232-L34259)

| # | Type | Code |
|---|------|------|
| 1 | IF | `telOpUm` |
| 2 | IF | `existsHasinshaNoTchi` AND `isHakkoOlsTelnoChg` |
| 3 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_211)` // OLS setup, caller ID notification registration |
| 4 | ELSE-IF | `existsHasinshaNoTchiDsl` AND `isHakkoOlsTelnoChg` |
| 5 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_212)` // OLS setup, caller ID notification disconnect |
| 6 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_219)` // SIP option unified registration |

**Block 20** — [IF] Post-change number portability registration SOD (L34263-L34276)

| # | Type | Code |
|---|------|------|
| 1 | IF | `iHave050no` |
| 2 | CALL | `param = add050AddSod(param, handle, svc_kei_no, svc_kei_ucwk_no, chaf_svc_kei_ucwk_gene_add_dtm, this.op_svc_kei_no_tikan, this.op_gadtm_tikan)` // 050-number portability/registration (post-change) |

**Block 21** — [CALL] Emergency notification registration (L34280-L34282)

| # | Type | Code |
|---|------|------|
| 1 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_250)` // Emergency notification, registration |

**Block 22** — [RETURN] (L34285)

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return param` |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|-----------------|
| `svc_kei_no` | Field | Service contract number - unique identifier for a service contract line item |
| `svc_kei_ucwk_no` | Field | Service contract details number - versioned identifier for service contract sub-items |
| `svc_kei_ucwk_gene_add_dtm` | Field | Service contract details version registration timestamp - tracks version history for change detection |
| `chbf_svc_kei_ucwk_gene_add_dtm` | Field | Pre-change service contract details version registration timestamp - used for change detection |
| `chaf_svc_kei_ucwk_gene_add_dtm` | Field | Post-change service contract details version registration timestamp - new version after change |
| `chbfBmpUm` / `chafBmpUm` | Field | Pre/post-change number portability (BMP) status - `"1"` indicates number portability is active |
| `chbfSvcKeiUcwkNo` | Field | Pre-change service contract details number - retrieved for reference during phone number change |
| `ido_div` | Field | Difference/discrepancy code - used to identify device change status during repair exchanges |
| `kktk_svc_kei_no` | Field | Device provision service contract number - identifies a specific device provision contract |
| `taknkiki_model_cd` | Field | Home terminal device model code - identifies the type of home terminal equipment |
| `kiki_seizo_no` | Field | Device serial number - unique hardware identifier for the home terminal |
| `op_svc_kei_no_tikan` | Field | Option service contract number for number portability - identifies the option service involved in number portability |
| `op_gadtm_tikan` | Field | Version timestamp for number portability option service |
| `same_trn_no` | Field | Same processing number - groups related operations for batch processing |
| SOD | Acronym | Service Order Data - internal entity representing service order documents that drive downstream processing |
| FTTH | Business term | Fiber To The Home - fiber-optic broadband internet service provided by K-Opticom |
| BMP | Acronym | Number Portability (BMP / 番号変換) - allows customers to retain their phone number when switching carriers or services |
| ENUM | Business term | E.164 Number Mapping - DNS-based service that maps telephone numbers to IP addresses for VoIP routing |
| OLS | Acronym | Operator Line Service - the base telephone line service providing PSTN connectivity |
| SIP | Business term | Session Initiation Protocol - VoIP signaling protocol used for telephone service over IP networks |
| VA | Acronym | Virtual Appliance / Home Terminal - the customer-facing device (ONT/terminal unit) at the premises |
| TAKINKI | Japanese term | 家庭機器 (home equipment) - refers to customer premise equipment including home terminals |
| ODR_NAIYO_CD | Field | Order content code - classifies the type of SOD to be issued (e.g., phone change, SIP registration, ENUM cancel) |
| TEL_CHNG_DIV | Field | Phone change division - discriminator for the type of phone change operation |
| KKTK_SVC_CD | Field | Device provision service code - classifies the type of device service (e.g., HTVA for home terminal VA) |
| MSKM_DTL_NO | Field | Application details number - internal tracking number for application line items |
| TAKINORT | Acronym | Multi-function router (多機能ルーター) - router with integrated VA (home terminal) functionality |
| 光電話 | Japanese term | Hikari Denwa (FTTH phone) - phone service delivered over fiber-optic network |
| 電話変更 | Japanese term | Telephone number change - the core business operation of changing a customer's phone number |
| 番ポ追加申込 | Japanese term | Number portability addition application - applying for number portability service |
| 緊急通報 | Japanese term | Emergency notification - service that notifies emergency services of caller identity |
| 発信者番号通知 | Japanese term | Caller ID notification service - displays the caller's phone number to the recipient |
| 050ナンバー | Business term | 050-number - an IP telephone number prefix used for VoIP services in Japan |
| EG切替 | Japanese term | EG (Equipment Gate) switch - device change during equipment exchange/repair process |
| 収支状況コード (RCNT_YOKYU_SBT_CD) | Field | Release subtype code - `"03"` = disconnect, `"08"` = cancel |
| サービス提供契約状態 (SVC_KEI_STAT_*) | Field | Service contract status codes: 030 = contracted, 100 = providing service, 210 = paused/interrupted, 910 = terminated |
| 多機能ルーター機能コード (TAKINORT_KINO_CD_*) | Field | Multi-function router function code: A = router only, B = VA only, C = both in use |
| 番号変換 | Japanese term | Number conversion/portability - the process of changing a phone number while maintaining the number identity |
