# Business Logic — JKKHakkoSODCC.htelNoDslOdrCtrl() [605 LOC]

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

## 1. Role

### JKKHakkoSODCC.htelNoDslOdrCtrl()

This method implements the **Optical Phone Number Disconnection Order Control Process** (光電話番号解約オーダ制御処理), which orchestrates the creation and coordination of Service Order Data (SOD) records for a business customer disconnecting their fiber-optic phone service (light phone / 光電話). It serves as the central dispatch hub that gathers all the context needed to produce the correct set of SOD records, then writes them in the proper order.

The method covers several business scenarios:

- **Standard fiber phone disconnection** — generates SIP cancellation and SIP discard SOD records.
- **Transfer phone (転送電話) cleanup** — checks if a transfer phone SOD exists, and if so, issues a cancellation and discard SOD.
- **ENUM settings management** — for customers without a ported number (番포なし), generates ENUM settings and discard SOD when the phone number was originally assigned by the service provider with internal porting enabled.
- **Multi-function router (多機能ルーター) disconnection** — detects whether the customer uses a multi-function router (Takino router) and generates the appropriate router setup-cancellation SOD (ODR_NAIYO_CD_421) and router setup-discard SOD (ODR_NAIYO_CD_422).
- **OLS (Optical Line Termination Setup) management** — generates OLS setup-cancellation SOD for standard cases, or OLS setup + phone disconnection SOD for two-port VA (Virtual Apartment) configurations.
- **EG (Emergency Gateway) switchover handling** — detects if a VA device is in the process of an EG switchover (IDO_DIV = 00067) and substitutes the equipment list accordingly.
- **Operation Setup Order Control** — when there are existing operation settings orders (e.g., 050 number plan operation, sender number notification), it delegates to `opSetOdrCtrl` via `edit4OpSetOdrCtrl` mapping to ensure the operation orders are properly processed.
- **Number porting during disconnection** — generates transfer hold registration and cancel SOD when the customer is in the process of number porting (移転トック).
- **Emergency notice** — generates an emergency notice SOD (ODR_NAIYO_CD_252) to terminate emergency alert services.

The method implements a **routing/dispatch pattern** — it queries service contracts, VA equipment info, transfer phone status, and multi-function router status to branch between several distinct SOD generation paths. It acts as a shared utility called by `hakkoSOD()` for any phone number disconnection order that involves fiber-optic services.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["htelNoDslOdrCtrl"])
    EXTRACT["Extract SOD/Service Maps and Basic Info"]
    GET_SAME_TRN["Get Same Transaction Number"]
    SEARCH_UCWK["Search Service Contract Details"]
    CALL_EKK0191["Call EKK0191A010SC - Get VA Info"]
    GET_EKK1041["Call EKK1041B001SC - Check SIP Orders"]
    CAN_SKIP_CHECK{"Check Z1 Order / Transfer Order"}
    Z1_PENDING{"Z1 Order Pending?"}
    NO_BMP{"No BMP Phone?"}
    GET_TRANSFER["Get Transfer Service Contracts"]
    CHECK_XFER_STATUS{"Transfer Contract Cancelled/Cancelled-Completed?"}
    SIP_DISCARD["SOD: SIP Cancellation (229) + SIP Discard (230)"]
    ENUM_DISCARD["SOD: ENUM Settings + Discard (266)"]
    EARLY_RETURN(["Return Param Early"])
    CALL_EKK0341["Call EKK0341B008SC - Equipment Provisioning"]
    CALL_EKK0341_02["Call EKK0341B008_02SC - EG Switchover Check"]
    EG_SWITCH{EG Switchover (00067)?"}
    FIND_VA_LOOP["Loop: Find VA Device in Equipment"]
    STORE_INST["Store Instance Fields"]
    GET_LINE["Call EKK0251B001SC - Service Line Info"]
    NO_VA_PORT{VA Port Missing?"}
    TAKINO_CHK{Multi-Function Router?"}
    OLS_STANDARD["SOD: OLS Setup Cancel (215) + OLS Cancel (216)"]
    OLS_ROUTER_OFF["SOD: Router Setup Cancel (417)"]
    OLS_ROUTER_ON["SOD: Router Setup Cancel (421) + Router Discard (422)"]
    OLS_PORT["SOD: OLS Setup + Phone Disconnect (209)"]
    SIP_DISCARD_MAIN["SOD: SIP Cancellation (229) + SIP Discard (230)"]
    ENUM_DISCARD_MAIN["SOD: ENUM Settings + Discard (266)"]
    TOKI_SOD["SOD: Transfer Hold Registration"]
    EMERGENCY["SOD: Emergency Notice (252)"]
    FINAL_RETURN(["Return Param"])

    START --> EXTRACT --> GET_SAME_TRN --> SEARCH_UCWK --> CALL_EKK0191 --> GET_EKK1041 --> CAN_SKIP_CHECK --> Z1_PENDING
    Z1_PENDING -->|No| NO_BMP
    NO_BMP -->|Yes| GET_TRANSFER
    GET_TRANSFER --> CHECK_XFER_STATUS
    CHECK_XFER_STATUS -->|Yes| SIP_DISCARD
    SIP_DISCARD --> ENUM_DISCARD --> Z1_PENDING
    Z1_PENDING -->|Yes| EARLY_RETURN
    CALL_EKK0191 --> CALL_EKK0341
    CALL_EKK0341 --> CALL_EKK0341_02
    CALL_EKK0341_02 --> EG_SWITCH
    EG_SWITCH --> FIND_VA_LOOP
    FIND_VA_LOOP --> STORE_INST --> GET_LINE
    GET_LINE --> NO_VA_PORT
    NO_VA_PORT -->|Yes| TAKINO_CHK
    TAKINO_CHK -->|No (0)| OLS_STANDARD
    TAKINO_CHK -->|Yes (4)| OLS_ROUTER_OFF
    TAKINO_CHK -->|Yes (3)| OLS_ROUTER_ON
    OLS_STANDARD --> SIP_DISCARD_MAIN
    OLS_ROUTER_OFF --> SIP_DISCARD_MAIN
    OLS_ROUTER_ON --> SIP_DISCARD_MAIN
    SIP_DISCARD_MAIN --> ENUM_DISCARD_MAIN
    ENUM_DISCARD_MAIN --> NO_VA_PORT
    NO_VA_PORT -->|No| OLS_PORT
    OLS_PORT --> TOKI_SOD
    SIP_DISCARD_MAIN --> TOKI_SOD
    TOKI_SOD --> EMERGENCY --> FINAL_RETURN
```

**Processing Flow Summary:**

1. **Map Extraction**: Extracts `sod_kihon_info_Map` (SOD basic info), `svc_kei_info_Map` (service contract info), and `svc_kei_ucwk_info_Map` (service contract detail info) from `sodMap`. Sanitizes with `shkkaMap()`.
2. **Basic Info Retrieval**: Pulls `sys_id`, `ido_div` (migration division), `svc_kei_no` (service contract number), `svc_kei_ucwk_no`, and `chaf_svc_kei_ucwk_gene_add_dtm` from the maps.
3. **Transaction Number**: Gets a same-transaction number for coordination with parallel orders.
4. **Service Contract Details**: Queries the service contract detail agreement via `searchSvcKeiUcwk`.
5. **VA Info Query**: Calls `callEKK0191A010SC` to retrieve VA port number, VA home device model code, and VA device change number.
6. **Existing SIP Order Check**: Calls `callEKK1041B001SC` to check existing SIP orders, then iterates to determine if a disconnect/discard SOD can be skipped (Z1 order handling).
7. **Z1 Order Status Check**: Calls `findZ1OrderHasBeenSentSvcKeiUcwk` — if Z1 (Z1 order) has NOT been sent yet, additional transfer phone SOD handling is required.
8. **Transfer Phone SOD**: If no BMP phone and Z1 not processed, checks for transfer phone contracts and issues SIP cancellation (229) and SIP discard (230) SOD.
9. **Equipment Provisioning**: Calls `callEKK0341B008SC` to get equipment provisioning service contracts.
10. **EG Switchover**: If VA device is in EG switchover status (IDO_DIV = 00067), substitutes the equipment list with the 02SC result.
11. **VA Device Lookup**: Iterates equipment contracts to find the VA device (KKTK_SVC_CD_HTEL_VA = C004) matching the service contract detail number.
12. **Instance Storage**: Stores all resolved fields into instance variables for downstream use.
13. **Service Line Info**: Calls `getEKK0251B001SC` to get the service line detail number and generation-add datetime.
14. **VA Port Check**: If VA port number is missing, generates OLS/router cancellation SOD based on multi-function router flag.
15. **VA Port Present**: If VA port number is set, generates OLS + phone disconnection SOD.
16. **SIP Cancellation**: Generates SIP cancellation (229) and SIP discard (230) SOD (skipped for number porting mid-transit).
17. **ENUM Management**: For non-ported numbers, generates ENUM settings discard SOD (266) if the phone number was from the service provider with internal porting.
18. **Operation Setup**: Iterates operation service contracts and delegates operation setup order control to `opSetOdrCtrl`.
19. **Transfer Hold**: Generates transfer hold registration SOD.
20. **Emergency Notice**: Generates emergency notice SOD (252) and returns the param.

## 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 across service component calls |
| 2 | `param` | `IRequestParameterReadWrite` | Request parameter object carrying model groups and control maps; accumulates generated SOD records through `addSOD()`/`addTakinoSOD()`/`addTokiSOD()` method calls; modified in place and returned |
| 3 | `fixedText` | `String` | User-assignable string passed through to `opSetOdrCtrl` for operation setup order control mapping — allows business users to provide custom text annotations for the order |
| 4 | `sodMap` | `HashMap<String, Object>` | Service Order Data map containing nested sub-maps: `SOD_KIHON_INFO` (SOD basic info with `INFO_SYSID`, `INFO_IDO_DIV`), `SVC_KEI_INFO` (service contract info with `INFO_SVC_KEI_NO`), and `SVC_KEI_UCWK_INFO` (service contract detail info with `INFO_SVC_KEI_UCWK_NO`, `INFO_CHAF_SVC_KEI_UCWK_GENE_ADD_DTM`) |

**Instance Fields Read:**
- `this.mskm_dtl_no` — Service contract application detail number (used to match operation service contracts)
- `this.ido_div` — Migration division code (used for transfer hold SOD)

**Instance Fields Written:**
- `this.same_trn_no` — Same transaction number
- `this.svc_kei_ucwk_no` — Service contract detail number array
- `this.svc_kei_ucwk_gadtm` — Post-change service contract detail generation-add datetime array
- `this.kktk_svc_kei_no` — Equipment-provisioned service contract number array
- `this.kktk_svc_kei_gadtm` — Equipment-provisioned service contract generation-add datetime array
- `this.taknkiki_model_cd` — Home device model code array
- `this.kiki_seizo_no` — VA device serial number array
- `this.svc_kei_kaisen_ucwk_no` — Service line detail number
- `this.svc_kei_kaisen_ucwk_gadtm` — Service line detail generation-add datetime

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JKKHakkoSODCC.getSame_trn_no` | - | - | Get same transaction number for parallel order coordination |
| R | `JKKHakkoSODCC.searchSvcKeiUcwk` | EKK0161A010SC | KK_T_SVC_KEI_UCWK (Service Contract Detail) | Search service contract detail agreement by service contract detail number and generation-add datetime |
| R | `JKKHakkoSODCC.callEKK0191A010SC` | EKK0191A010SC | KK_T_VA_KIKU (VA Device Table) | Get VA (Virtual Apartment) device info including port number, model code, device change number, BMP UM, and phone number |
| R | `JKKHakkoSODCC.callEKK1041B001SC` | EKK1041B001SC | KK_T_RCNT_YOKYU (Remaining Requirements) | Check existing SIP orders for the service contract number to determine Z1 order status and transfer order eligibility |
| R | `JKKHakkoSODCC.getEKK1041B001result` | EKK1041B001SC | (in-memory) | Retrieve result list from EKK1041B001SC call containing remaining requirement sub-order codes |
| R | `JKKHakkoSODCC.findZ1OrderHasBeenSentSvcKeiUcwk` | - | KK_T_ODR_HAKKO_SOD | Check if Z1 (Z1-order) has been sent for the service contract |
| R | `JKKHakkoSODCC.getOpSvcKei4Eohtel` | EKK0351A010SC | KK_T_OP_SVC_KEI (Operation Service Contract) | Get transfer phone operation service contracts for the given service contract detail number |
| C | `JKKHakkoSODCC.addSOD` | - | KK_T_ODR_HAKKO_SOD | Create SOD records for various order content codes (SIP cancellation, SIP discard, ENUM discard, OLS cancellation, emergency notice, etc.) |
| R | `JKKHakkoSODCC.callEKK0341B008SC` | EKK0341B008SC | KK_T_KKTK_SVC_KEI (Equipment Provisioning Service Contract) | Get equipment provisioning service contracts linked to the service contract number |
| R | `JKKHakkoSODCC.callEKK0341B008_02SC` | EKK0341B008_02SC | KK_T_KKTK_SVC_KEI | Get equipment provisioning service contracts for EG switchover check with updated VA device change number |
| R | `JKKHakkoSODCC.getEKK0251B001SC` | EKK0251B001SC | KK_T_SVC_KEI_KAISEN (Service Line) | Get service line detail info including service line detail number and generation-add datetime |
| C | `JKKHakkoSODCC.addTakinoSOD` | - | KK_T_ODR_HAKKO_SOD | Create SOD records for multi-function router (Takino router) setup/cancellation/discard operations |
| C | `JKKHakkoSODCC.addTokiSOD` | - | KK_T_ODR_HAKKO_SOD | Create SOD records for transfer hold (number porting during disconnection) registration |
| U | `JKKHakkoSODCC.edit4OpSetOdrCtrl` | - | - | Edit and map operation setup order control data for the matching operation contract |
| U | `JKKHakkoSODCC.opSetOdrCtrl` | - | KK_T_ODR_HAKKO_SOD | Execute operation setup order control processing (delegates SOD creation for operation-related orders) |

## 5. Dependency Trace

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

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | `JKKHakkoSODCC.hakkoSOD` | `hakkoSOD` -> `htelNoDslOdrCtrl` | `addSOD [C] KK_T_ODR_HAKKO_SOD`, `addTakinoSOD [C] KK_T_ODR_HAKKO_SOD`, `addTokiSOD [C] KK_T_ODR_HAKKO_SOD`, `opSetOdrCtrl [U] KK_T_ODR_HAKKO_SOD`, `edit4OpSetOdrCtrl [U] -`, `getOpSvcKei4Eohtel [R] KK_T_OP_SVC_KEI`, `callEKK0191A010SC [R] KK_T_VA_KIKU`, `callEKK1041B001SC [R] KK_T_RCNT_YOKYU`, `callEKK0341B008SC [R] KK_T_KKTK_SVC_KEI`, `callEKK0341B008_02SC [R] KK_T_KKTK_SVC_KEI`, `getEKK0251B001SC [R] KK_T_SVC_KEI_KAISEN`, `searchSvcKeiUcwk [R] KK_T_SVC_KEI_UCWK`, `findZ1OrderHasBeenSentSvcKeiUcwk [R] KK_T_ODR_HAKKO_SOD` |

**Call Chain Details:**
- `htelNoDslOdrCtrl` is called from `JKKHakkoSODCC.hakkoSOD()`, which is the main order issuance entry point for generating SOD records.
- The method ultimately triggers multiple SOD creations (`addSOD`, `addTakinoSOD`, `addTokiSOD`) that insert into `KK_T_ODR_HAKKO_SOD`.
- It also updates SOD via `opSetOdrCtrl`.

## 6. Per-Branch Detail Blocks

**Block 1** — [SET] Map Extraction and Info Retrieval (L14720)

> Extracts and sanitizes the three sub-maps from the SOD map, then reads key identity fields.

| # | Type | Code |
|---|------|------|
| 1 | SET | `sod_kihon_info_Map = (HashMap)sodMap.get(SOD_KIHON_INFO)` // SOD basic info [-> `SOD_KIHON_INFO = "sod_kihon_info"`] |
| 2 | SET | `svc_kei_info_Map = (HashMap)sodMap.get(SVC_KEI_INFO)` // Service contract info [-> `SVC_KEI_INFO = "svc_kei_info"`] |
| 3 | SET | `svc_kei_ucwk_info_Map = (HashMap)sodMap.get(SVC_KEI_UCWK_INFO)` // Service contract detail info [-> `SVC_KEI_UCWK_INFO = "svc_kei_ucwk_info"`] |
| 4 | EXEC | `sod_kihon_info_Map = shkkaMap(...)` // Sanitize map keys |
| 5 | EXEC | `svc_kei_info_Map = shkkaMap(...)` // Sanitize map keys |
| 6 | EXEC | `svc_kei_ucwk_info_Map = shkkaMap(...)` // Sanitize map keys |
| 7 | SET | `sys_id = (String)sod_kihon_info_Map.get(INFO_SYSID)` // SYSID [-> `INFO_SYSID = "sysid"`] |
| 8 | SET | `ido_div = (String)sod_kihon_info_Map.get(INFO_IDO_DIV)` // Migration division [-> `INFO_IDO_DIV = "ido_div"`] |
| 9 | SET | `svc_kei_no = (String)svc_kei_info_Map.get(INFO_SVC_KEI_NO)` // Service contract number [-> `INFO_SVC_KEI_NO = "svc_kei_no"`] |
| 10 | SET | `svc_kei_ucwk_no = (String)svc_kei_ucwk_info_Map.get(INFO_SVC_KEI_UCWK_NO)` // Post-change service contract detail number [-> `INFO_SVC_KEI_UCWK_NO = "svc_kei_ucwk_no"`] |
| 11 | SET | `chaf_svc_kei_ucwk_gene_add_dtm = (String)svc_kei_ucwk_info_Map.get(INFO_CHAF_SVC_KEI_UCWK_GENE_ADD_DTM)` // Post-change service contract detail generation-add datetime [-> `INFO_CHAF_SVC_KEI_UCWK_GENE_ADD_DTM = "chaf_svc_kei_ucwk_gene_add_dtm"`] |

**Block 2** — [CALL] Transaction Number Acquisition (L14745)

> Gets a same-transaction number for coordinating parallel orders.

| # | Type | Code |
|---|------|------|
| 1 | SET | `sameTrnNo = new String[1]` |
| 2 | CALL | `getSame_trn_no(param, handle, null, sameTrnNo)` |
| 3 | SET | `this.same_trn_no = sameTrnNo[0]` |

**Block 3** — [CALL] Service Contract Detail Query (L14747)

> Queries the service contract detail agreement for verification.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `eKK0161A010Hash = searchSvcKeiUcwk(handle, param, svc_kei_ucwk_no, chaf_svc_kei_ucwk_gene_add_dtm)` |
| 2 | SET | `svcKeiUcwkMskmDtlNo = (String)eKK0161A010Hash.get(MSKM_DTL_NO)` // Service contract detail application number |

**Block 4** — [CALL] VA Information Retrieval (L14756-L14772)

> Calls the VA device info service component to get VA port number, model code, and device change number.

| # | Type | Code |
|---|------|------|
| 1 | SET | `inHashUcwk = new HashMap<>()` |
| 2 | SET | `resultHashUcwk = new HashMap<>()` |
| 3 | EXEC | `inHashUcwk.put(SVC_KEI_UCWK_NO, svc_kei_ucwk_no)` |
| 4 | EXEC | `inHashUcwk.put(GENE_ADD_DTM, chaf_svc_kei_ucwk_gene_add_dtm)` |
| 5 | CALL | `statusCode = callEKK0191A010SC(param, handle, inHashUcwk, resultHashUcwk, FUNC_CODE_1)` [-> `FUNC_CODE_1 = "1"`] |
| 6 | IF | `statusCode != 0` → throw `CCException` |
| 7 | SET | `eKK0191A010Hash = (HashMap)resultHashUcwk.get(TEMPLATE_ID_EKK0191A010)` |
| 8 | SET | `vaPortNo = (String)eKK0191A010Hash.get(VA_PORT_NO)` // VA port number |
| 9 | SET | `vaTaknkikiModelCd = (String)eKK0191A010Hash.get(VA_TAKNKIKI_MODEL_CD)` // VA home device model code |
| 10 | SET | `vaKikiChgNo = (String)eKK0191A010Hash.get(VA_KIKI_CHG_NO)` // VA device change number |

**Block 5** — [CALL] Existing SIP Order Check (L14778-L14797)

> Checks existing SIP orders to determine if disconnect SOD can be skipped for forced termination cases.

| # | Type | Code |
|---|------|------|
| 1 | SET | `can_skip_delsod = false` |
| 2 | CALL | `callEKK1041B001SC(param, handle, ORDER_SBT_CD_TEL, SVC_ORDER_CD_SIP, null, svc_kei_no, null, null)` [-> `ORDER_SBT_CD_TEL = "Tel"` order sub-order code, `SVC_ORDER_CD_SIP = "SIP"` service order code] |
| 3 | SET | `eKK1041B001HashList = getEKK1041B001result(param)` |
| 4 | FOR | Iterate `eKK1041B001HashList` — find matching `svc_kei_ucwk_no` |
| 5 | IF | Within loop: `svc_kei_ucwk_no.equals(tmpSvcKeiUcwkNo)` |
| 6 | IF | RCNT_YOKYU_SBT_CD = YOKYU_SBT_CD_DSL ("03": Disconnect) OR RCNT_YOKYU_SBT_CD = YOKYU_SBT_CD_DEL ("08": Discard) |
| 7 | SET | `can_skip_delsod = true` [-> `YOKYU_SBT_CD_DSL = "03"`, `YOKYU_SBT_CD_DEL = "08"`] |
| 8 | EXEC | `break` |

**Block 6** — [IF] Z1 Order Pending Branch (L14802)

> If Z1 order has NOT been sent, additional transfer phone SOD processing is required before returning early.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `isZ1Ordered = findZ1OrderHasBeenSentSvcKeiUcwk(param, handle, svc_kei_no, svc_kei_ucwk_no)` |
| 2 | IF | `!isZ1Ordered` (Z1 order not pending) |

**Block 6.1** — [IF] No BMP Phone Branch (L14806)

> If there's no BMP phone (番포なし), only issue transfer phone SOD cancellation when a pre-start transfer phone SOD exists.

| # | Type | Code |
|---|------|------|
| 1 | SET | `bmpUm = (String)eKK0191A010Hash.get(BMP_UM)` |
| 2 | IF | `!BMP_UM_ARI.equals(bmpUm)` [-> `BMP_UM_ARI = "あり"` (BMP phone exists)] |
| 3 | CALL | `kk0351MapList = getOpSvcKei4Eohtel(param, handle, svc_kei_ucwk_no, OP_SVC_CD_TENSO)` [-> `OP_SVC_CD_TENSO = "B024"` (Transfer Phone)] |
| 4 | FOR | Iterate transfer phone operation service contracts |
| 5 | IF | `opSvcKeiStat = SVC_KEI_STAT_910 ("110": Cancelled) OR opSvcKeiStat = SVC_KEI_STAT_920 ("920": Cancelled-Completed)` |
| 6 | IF | `opSvcKeiMskmDtlNo` is not null/blank AND `opSvcKeiMskmDtlNo.equals(svcKeiUcwkMskmDtlNo)` |
| 7 | SET | `this.svc_kei_ucwk_no = new String[1]` |
| 8 | SET | `this.svc_kei_ucwk_no[0] = svc_kei_ucwk_no` |
| 9 | SET | `this.svc_kei_ucwk_gadtm = new String[1]` |
| 10 | SET | `this.svc_kei_ucwk_gadtm[0] = chaf_svc_kei_ucwk_gene_add_dtm` |
| 11 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_229)` // SIP Cancellation [-> `ODR_NAIYO_CD_229 = "229"` (SIP・解約)] |
| 12 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_230)` // SIP Discard [-> `ODR_NAIYO_CD_230 = "230"` (SIP・消去)] |
| 13 | IF | `!isTajgsTelNo(...) && isMonaiBmp(...)` [-> Phone number from service provider with internal porting enabled] |
| 14 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_266)` // ENUM Settings + Discard [-> `ODR_NAIYO_CD_266 = "266"` (ENUM設定・消去)] |
| 15 | EXEC | `break` |

**Block 6.2** — [RETURN] Early Return (L14853)

> Z1 order is already processed; skip equipment provisioning and other downstream processing.

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

**Block 7** — [CALL] Equipment Provisioning Service Contracts (L14858-L14871)

> Gets equipment provisioning service contracts for VA/BBR/etc. device lookup.

| # | Type | Code |
|---|------|------|
| 1 | SET | `inHashKktk = new HashMap<>()` |
| 2 | SET | `resultHashKktk = new HashMap<>()` |
| 3 | EXEC | `inHashKktk.put(SVC_KEI_NO, svc_kei_no)` |
| 4 | CALL | `statusCode = callEKK0341B008SC(param, handle, inHashKktk, resultHashKktk, FUNC_CODE_1)` |
| 5 | IF | `statusCode != 0` → throw `CCException` |
| 6 | SET | `msgEKK0341B022SCList = (CAANMsg[])resultHashKktk.get(TEMPLATE_ID_EKK0341B022)` |

**Block 8** — [CALL] EG Switchover Check (L14874-L14913)

> IT2-2016-0000035: When VA device acquisition needs EG switchover handling, fetches the pre-change device change number and matches against equipment list to substitute the list when IDO_DIV = "00067" (EG Switchover).

| # | Type | Code |
|---|------|------|
| 1 | SET | `chaf_InHashUcwk = new HashMap<>()` |
| 2 | SET | `chaf_resultHashUcwk = new HashMap<>()` |
| 3 | EXEC | `chaf_InHashUcwk.put(SVC_KEI_UCWK_NO, svc_kei_ucwk_no)` |
| 4 | EXEC | `chaf_InHashUcwk.put(GENE_ADD_DTM, chaf_svc_kei_ucwk_gene_add_dtm)` |
| 5 | CALL | `statusCode = callEKK0191A010SC(...)` — Get pre-change VA info |
| 6 | IF | `statusCode != 0` → throw `CCException` |
| 7 | SET | `chaf_vaKikiChgNo = shkkaChr(...)` // Pre-change VA device change number |
| 8 | CALL | `statusCode = callEKK0341B008_02SC(param, handle, inHashKktk, resultHashKktk, FUNC_CODE_4)` |
| 9 | IF | `statusCode != 0` → throw `CCException` |
| 10 | SET | `msgEKK0341B022_02SCList = (CAANMsg[])resultHashKktk.get(TEMPLATE_ID_EKK0341B022)` |
| 11 | IF | `msgEKK0341B022_02SCList != null && length > 0` |
| 12 | FOR | Iterate equipment list items |
| 13 | SET | `kktkSvcCd = (String)eKK0341B022SCHash.get(KKTK_SVC_CD)` |
| 14 | SET | `kikiChgNo = (String)eKK0341B022SCHash.get(KIKI_CHG_NO)` |
| 15 | SET | `idoDiv = (String)eKK0341B022SCHash.get(IDO_DIV)` |
| 16 | IF | `KKTK_SVC_CD_HTEL_VA.equals(kktkSvcCd)` [-> `KKTK_SVC_CD_HTEL_VA = "C004"` (光電話VA)] |
| 17 | IF | `chaf_vaKikiChgNo.equals(kikiChgNo) && "00067".equals(idoDiv)` |
| 18 | SET | `msgEKK0341B022SCList = msgEKK0341B022_02SCList` // Substitute equipment list |

**Block 9** — [FOR] VA Device Lookup (L14919-L15021)

> Multi-function router (Takino) check branching, then iterate equipment contracts to find the VA device.

| # | Type | Code |
|---|------|------|
| 1 | SET | `takino_flg = checkTakinoRT(handle, param)` |
| 2 | IF | `takino_flg == 0` (Not a multi-function router) |
| 3 | FOR | Iterate `msgEKK0341B022SCList` |
| 4 | SET | `vaTaknkikiModelCd = (String)eKK0341B022SCHash.get(TAKNKIKI_MODEL_CD)` |
| 5 | CALL | `kokanBfKiki = new HashMap<>()` |
| 6 | CALL | `isRegalVaKiki(handle, param, eKK0341B022SCHash, vaTaknkikiModelCd, null, ido_div, vaKikiChgNo, kokanBfKiki)` |
| 7 | IF | `isRegalVaKiki` returns true (VA device recognized) |
| 8 | IF | `kktkSvcKeiStat = SVC_KEI_STAT_910 ("110") OR SVC_KEI_STAT_920 ("920")` — skip cancelled equipment |
| 9 | SET | `kktkSvcKeiNo = (String)eKK0341B022SCHash.get(KKTK_SVC_KEI_NO)` |
| 10 | SET | `kktkGeneAddDtm = (String)eKK0341B022SCHash.get(GENE_ADD_DTM)` |
| 11 | SET | `vaKikiSeizoNo = (String)eKK0341B022SCHash.get(KIKI_SEIZO_NO)` |
| 12 | IF | `kokanBfKiki != null && !isEmpty` (Repair exchange case) |
| 13 | SET | `kktkSvcKeiNo = (String)kokanBfKiki.get(KKTK_SVC_KEI_NO)` // Use pre-repair values |
| 14 | SET | `kktkGeneAddDtm = (String)kokanBfKiki.get(GENE_ADD_DTM)` |
| 15 | SET | `vaKikiSeizoNo = (String)kokanBfKiki.get(KIKI_SEIZO_NO)` |
| 16 | SET | `vaTaknkikiModelCd = (String)kokanBfKiki.get(TAKNKIKI_MODEL_CD)` |
| 17 | IF | `!isBlank(vaKikiSeizoNo)` → `break` |

**Block 10** — [SET] Instance Field Storage (L15023-L15041)

> Stores all resolved fields into instance variables for downstream methods.

| # | Type | Code |
|---|------|------|
| 1 | SET | `this.svc_kei_ucwk_no = new String[1]` |
| 2 | SET | `this.svc_kei_ucwk_no[0] = svc_kei_ucwk_no` |
| 3 | SET | `this.svc_kei_ucwk_gadtm = new String[1]` |
| 4 | SET | `this.svc_kei_ucwk_gadtm[0] = chaf_svc_kei_ucwk_gene_add_dtm` |
| 5 | SET | `this.kktk_svc_kei_no = new String[1]` |
| 6 | SET | `this.kktk_svc_kei_no[0] = kktkSvcKeiNo` |
| 7 | SET | `this.kktk_svc_kei_gadtm = new String[1]` |
| 8 | SET | `this.kktk_svc_kei_gadtm[0] = kktkGeneAddDtm` |
| 9 | SET | `this.taknkiki_model_cd = new String[1]` |
| 10 | SET | `this.taknkiki_model_cd[0] = vaTaknkikiModelCd` |
| 11 | SET | `this.kiki_seizo_no = new String[1]` |
| 12 | SET | `this.kiki_seizo_no[0] = vaKikiSeizoNo` |

**Block 11** — [CALL] Service Line Info Retrieval (L15045-L15054)

> Gets service line detail number and generation-add datetime.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `eKK0251B001Hash = getEKK0251B001SC(param, handle, svc_kei_no, FUNC_CODE_1)` |
| 2 | SET | `this.svc_kei_kaisen_ucwk_no = (String)eKK0251B001Hash.get(SVC_KEI_KAISEN_UCWK_NO)` |
| 3 | SET | `this.svc_kei_kaisen_ucwk_gadtm = (String)eKK0251B001Hash.get(GENE_ADD_DTM)` |

**Block 12** — [IF] VA Port Number Missing Branch (L15057)

> If VA port number is not set, generates OLS/router cancellation SOD based on multi-function router flag.

| # | Type | Code |
|---|------|------|
| 1 | IF | `isBlank(vaPortNo)` — VA port number not set |
| 2 | IF | `takino_flg == 0` (Standard router, not multi-function) |
| 3 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_215)` // OLS Setup + Cancel [-> `ODR_NAIYO_CD_215 = "215"` (OLS設定・解約)] |
| 4 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_216)` // OLS Setup + Discard [-> `ODR_NAIYO_CD_216 = "216"` (OLS設定・消去)] |
| 5 | ELSE-IF | `takino_flg == 4` (Multi-function router, VA function cancel) |
| 6 | CALL | `param = addTakinoSOD(handle, param, ODR_NAIYO_CD_417)` // Router Setup + Cancel (VA function cancel) [-> `ODR_NAIYO_CD_417 = "417"`] |
| 7 | ELSE-IF | `takino_flg == 3` (Multi-function router, VA function disconnect) |
| 8 | CALL | `param = addTakinoSOD(handle, param, ODR_NAIYO_CD_421)` // Router Setup + Cancel (VA function disconnect) [-> `ODR_NAIYO_CD_421 = "421"`] |
| 9 | CALL | `param = addTakinoSOD(handle, param, ODR_NAIYO_CD_422)` // Router Setup + Discard (VA function disconnect) [-> `ODR_NAIYO_CD_422 = "422"`] |

**Block 13** — [ELSE] VA Port Number Present Branch (L15062)

> If VA port number IS set, generate OLS + phone disconnection SOD based on router type.

| # | Type | Code |
|---|------|------|
| 1 | IF | `takino_flg == 0` |
| 2 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_209)` // OLS Setup + Phone Disconnection [-> `ODR_NAIYO_CD_209 = "209"` (OLS設定・電話番号解約)] |
| 3 | ELSE-IF | `takino_flg != 9` (Not type-9 multi-function router) |
| 4 | CALL | `param = addTakinoSOD(handle, param, ODR_NAIYO_CD_410)` // Router Setup + Change (VA function + Phone Disconnection) [-> `ODR_NAIYO_CD_410 = "410"`] |

**Block 14** — [IF] Number Porting During Disconnection Check (L15092)

> Skips SIP cancellation/discard SOD if the customer is in number porting transit (移転トック中).

| # | Type | Code |
|---|------|------|
| 1 | IF | `!isItenNoGuideTokiChu(param, handle, eKK0161A010Hash, eKK0191A010Hash)` — Not in number porting transit |
| 2 | IF | `!can_skip_delsod` (Skip SOD cancellation/discard for forced termination) |
| 3 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_229)` // SIP Cancellation |
| 4 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_230)` // SIP Discard |
| 5 | IF | `eKK0191A010Hash != null` |
| 6 | SET | `bmpUm = (String)eKK0191A010Hash.get(BMP_UM)` |
| 7 | IF | `!BMP_UM_ARI.equals(bmpUm)` — No BMP phone |
| 8 | IF | `!isTajgsTelNo(...) && isMonaiBmp(...) && !can_skip_delsod` |
| 9 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_266)` // ENUM Settings + Discard |

**Block 15** — [CALL] 050 Number Plan Operation Processing (L15120-L15154)

> Iterates operation service contracts for 050 number plan and sender number notification operations, delegating to `opSetOdrCtrl`.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `kk0351MapList = getOpSvcKei4Eohtel(param, handle, svc_kei_ucwk_no, null)` // Get operation service contracts (no filter) |
| 2 | FOR | Iterate `kk0351MapList` |
| 3 | SET | `op_svc_cd = (String)eKK0351A010SCHash.get(OP_SVC_CD)` |
| 4 | IF | `op_svc_cd = OP_SVC_CD_DSP_ME` OR `op_svc_cd = OP_SVC_CD_N050` |
| 5 | SET | `kk0351No = (String)eKK0351A010SCHash.get(OP_SVC_KEI_NO)` |
| 6 | SET | `op_gene_add_dtm = (String)eKK0351A010SCHash.get(GENE_ADD_DTM)` |
| 7 | SET | `op_mskm_dtl_no = (String)eKK0351A010SCHash.get(MSKM_DTL_NO)` |
| 8 | IF | `op_mskm_dtl_no` is not null/blank AND `op_mskm_dtl_no.equals(this.mskm_dtl_no)` |
| 9 | CALL | `opSodMap = edit4OpSetOdrCtrl(ido_div, sys_id, svc_kei_no, svc_kei_ucwk_no, chaf_svc_kei_ucwk_gene_add_dtm, kk0351No, op_gene_add_dtm)` |
| 10 | CALL | `opSetOdrCtrl(handle, param, fixedText, opSodMap)` |

**Block 16** — [CALL] Transfer Hold SOD (L15161)

> Registers transfer hold (number porting during disconnection) SOD.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `param = addTokiSOD(handle, param, this.ido_div, null)` |

**Block 17** — [CALL] Emergency Notice SOD (L15169)

> Issues emergency notice cancellation SOD when deletion SOD is not skipped.

| # | Type | Code |
|---|------|------|
| 1 | IF | `!can_skip_delsod` |
| 2 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_252)` // Emergency Notice + Discard [-> `ODR_NAIYO_CD_252 = "252"` (緊急通報・消去)] |

**Block 18** — [RETURN] Final Return (L15177)

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

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `htelNoDslOdrCtrl` | Method | Light Phone Number Disconnection Order Control — orchestrates SOD generation for fiber-optic phone disconnection |
| SOD | Acronym | Service Order Data — order fulfillment records created during service contract changes |
| OLS | Acronym | Optical Line System — optical termination equipment managed by NTT West |
| VA | Acronym | Virtual Apartment — fiber-optic phone device installed in multi-unit housing |
| KKTK | Acronym | 機器提供 (Equipment Provisioning) — service contracts for equipment-provided devices like routers, BBR, ONU |
| SVC_KEI | Acronym | サービス契約 (Service Contract) — telecom service contract line items |
| SVC_KEI_UCWK | Acronym | サービス契約内容情報 (Service Contract Detail Info) — detailed information about service contract line items |
| `ido_div` | Field | 異動区分 (Migration Division Code) — classifies the type of service contract change (e.g., transfer, porting) |
| `svc_kei_no` | Field | サービス契約番号 (Service Contract Number) — unique identifier for a telecom service contract |
| `svc_kei_ucwk_no` | Field | サービス契約内装番号 (Service Contract Detail Number) — internal number for service contract detail line |
| `chaf_svc_kei_ucwk_gene_add_dtm` | Field | 変更後サービス契約内装登録年月日时分秒 (Post-Change Service Contract Detail Generation-Add DateTime) |
| `mskm_dtl_no` | Field | 申込明細番号 (Application Detail Number) — application detail number for matching service contracts to operation contracts |
| `taknkiki_model_cd` | Field | 宅内機器型式コード (Home Device Model Code) — model code for in-premises VA/router device |
| `kiki_seizo_no` | Field | 機器製造番号 (Device Serial Number) — serial number of the VA device |
| `vaPortNo` | Field | VAポート番号 (VA Port Number) — port number assigned to the VA device |
| `kktkSvcKeiNo` | Field | 機器提供サービス契約番号 (Equipment Provisioning Service Contract Number) |
| `can_skip_delsod` | Field | Flag indicating whether SIP cancellation/discard SOD can be skipped (forced termination case) |
| `isZ1Ordered` | Field | Flag indicating whether Z1 (Z1-order) has already been sent |
| `kokanBfKiki` | Field | 修繕前機器 (Pre-Repair Device) — device info before repair exchange |
| ODR_NAIYO_CD | Field | オーダ内容コード (Order Content Code) — code classifying the type of SOD order being created |
| 209 | Constant | OLS Setup + Phone Disconnection SOD |
| 215 | Constant | OLS Setup + Cancel SOD |
| 216 | Constant | OLS Setup + Discard SOD |
| 229 | Constant | SIP Cancellation SOD |
| 230 | Constant | SIP Discard SOD |
| 252 | Constant | Emergency Notice SOD |
| 266 | Constant | ENUM Settings + Discard SOD |
| 410 | Constant | Multi-function Router Setup + Change (VA function + Phone Disconnection) |
| 417 | Constant | Multi-function Router Setup + Cancel (VA function cancellation) |
| 421 | Constant | Multi-function Router Setup + Cancel (VA function disconnect) |
| 422 | Constant | Multi-function Router Setup + Discard (VA function disconnect) |
| YOKYU_SBT_CD_DSL | Constant | "03" — Disconnect remaining requirement type |
| YOKYU_SBT_CD_DEL | Constant | "08" — Discard remaining requirement type |
| SVC_KEI_STAT_910 | Constant | "110" — Cancelled status |
| SVC_KEI_STAT_920 | Constant | "920" — Cancelled-Completed status |
| KKTK_SVC_CD_HTEL_VA | Constant | "C004" — Light Phone VA device type code |
| OP_SVC_CD_TENSO | Constant | "B024" — Transfer Phone operation service code |
| OP_SVC_CD_DSP_ME | Constant | Sender Number Notification operation service code |
| OP_SVC_CD_N050 | Constant | 050 Number Plan operation service code |
| BMP_UM | Field | 番포有無 (BMP Phone Existence Flag) — whether the customer has a ported (BMP) phone number |
| BMP_UM_ARI | Constant | "あり" — BMP phone exists |
| ENUM | Business term | ENUM (Electronic Numbering in the MUNICH system) — DNS-based telephone number mapping service |
| Z1 Order | Business term | Z1 (Z1-order) — a special order type related to fiber service provisioning |
| 転送電話 | Japanese term | Transfer Phone — phone call forwarding service; when disconnected, requires SIP cancellation |
| 多機能ルーター | Japanese term | Multi-function Router (Takino Router) — advanced router with VPN, WiFi, and other features |
| EG切替 | Japanese term | Emergency Gateway Switchover (IDO_DIV = 00067) — VA device migration during switchover between gateways |
| 移転トック中 | Japanese term | In number porting transit — customer is currently undergoing number porting during disconnection |
| 緊急通報 | Japanese term | Emergency Notice — emergency alert service that must be cancelled on disconnection |
| 番ポ | Japanese term | Porting (BMP) — number porting between carriers |
| 内ポ | Japanese term | Internal Port — phone number assignment within the same carrier's internal network |
| 取得事業者 | Japanese term | Acquiring Service Provider — the carrier currently providing the service |
| RCNT_YOKYU_SBT_CD | Field | 残余要求種別コード (Remaining Requirement Type Code) — classifies the remaining requirement type |
| FUNC_CODE | Field | 機能コード (Function Code) — distinguishes processing mode for service component calls |
| KK_T_ODR_HAKKO_SOD | DB Table | Order Issuance SOD Table — stores generated SOD records |
| KK_T_VA_KIKU | DB Table | VA Device Table — stores VA device information |
| KK_T_KKTK_SVC_KEI | DB Table | Equipment Provisioning Service Contract Table — stores equipment-provided service contracts |
| KK_T_SVC_KEI_UCWK | DB Table | Service Contract Detail Table — stores service contract detail information |
| KK_T_SVC_KEI_KAISEN | DB Table | Service Line Table — stores service line detail information |
| KK_T_OP_SVC_KEI | DB Table | Operation Service Contract Table — stores operation service contracts (e.g., sender number notification) |
| KK_T_RCNT_YOKYU | DB Table | Remaining Requirement Table — stores remaining requirement records for orders |
