# Business Logic — JKKHakkoSODCC.stpRlsOdrCtrl() [366 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `com.fujitsu.futurity.bp.custom.common.JKKHakkoSODCC` |
| Layer | Common Component (CC) — Custom business logic coordination class |
| Module | `common` (Package: `com.fujitsu.futurity.bp.custom.common`) |

## 1. Role

### JKKHakkoSODCC.stpRlsOdrCtrl()

The `stpRlsOdrCtrl` method (short for "Cancellation Order Control Processing" / 中断解除オーダ制御処理) is the central dispatch router that determines which Service Order Data (SOD) commands to generate when a telecom service contract is cancelled or released. It sits in the common component layer and is invoked during the order-release flow of the e-customer core system to coordinate cancellation-related SOD generation across diverse service types.

The method operates as a **route-and-dispatch** pattern: it classifies the service into one of three major service categories — (1) FTTH/ADSL net services, (2) mobile services (WiMAX, e-mobile, WiFi Spot), or (3) telephone services — and then executes the appropriate cancellation logic for that category. Within each branch, it may also detect associated option services (such as dial-up connections, fixed IP addresses, or multisection setups) and generate additional SODs as needed.

Key conditional branches include:
- **FTTH/ADSL branch**: Handles FTTH authentication cancel-release, dial-up A/B connection cancel-release, fixed IP address handling, and multisection with fixed IP cancel-release. Skips SOD generation entirely for private mansion-type buildings (FTTH authentication is not available there).
- **Mobile branch**: Handles e-mobile cancel-release (when a previous service contract exists), WiMAX CUI cancel-release, and WiFi Spot change or cancel-release (based on whether the customer has other active WiFi Spot sessions).
- **Telephone branch**: Handles SIP cancel-release for pure cancellation scenarios, or delegates to `bmpDojiMskm` for number-porting-related processing (when the operation is a usage suspension-release rather than a full cancellation).

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["stpRlsOdrCtrl(params)"])
    START --> EXTRACT["Extract SOD basic/service info from sodMap"]
    EXTRACT --> SHKKA["shkkaMap() on each info Map"]
    SHKKA --> SVCJUDGE["Determine svc_kind via jdgSvcKind()"]
    SVCJUDGE --> CHECKNET{"svc_kind = SVC_KIND_NET<br/>or pcrs_cd = PCRS_CD_ADSL_FURETTSU"}
    CHECKNET -->|Yes| NETBRANCH["Net Service Branch"]
    CHECKNET -->|No| CHECKMOB{"svc_kind = SVC_KIND_MOB"}
    CHECKMOB -->|Yes| MOBBRANCH["Mobile Service Branch"]
    CHECKMOB -->|No| CHECKTEL{"svc_kind = SVC_KIND_TEL"}
    CHECKTEL -->|Yes| TELBRANCH["Telephone Service Branch"]
    CHECKTEL -->|No| RETURN["Return param"]

    NETBRANCH --> MANSION{"isMansionPrvate()?"}
    MANSION -->|Yes| NET_RETURN["Return param early<br/>(FTTH auth unavailable<br/>DIY upgrade not allowed)"]
    MANSION -->|No| NET_INIT["Reset dial_flg, fmtcel_flg,<br/>fixipad_flg, mltise_flg = false"]
    NET_INIT --> CALLOPT["callEKK0351B010SC<br/>(Option service list lookup)"]
    CALLOPT --> LOOPOPT["Loop option service items"]

    LOOPOPT --> INMAPICHECK{"svc_kei_ucwk_no<br/>matches option item?"}
    INMAPICHECK -->|No| SKIPITEM["Skip this item"]
    INMAPICHECK -->|Yes| STARTRESVCHK{"isStartRsvOption?"}
    STARTRESVCHK -->|Yes| SKIPITEM
    STARTRESVCHK -->|No| OP_CDCHECK{"op_svc_cd?"}

    OP_CDCHECK --> DUPCHK{"OP_SVC_CD_DUP<br/>(DSL upgrade)?"}
    DUPCHK -->|Yes| DUP_STAT{"op_svc_kei_stat =<br/>SVC_KEI_STAT_100?"}
    DUP_STAT -->|Yes| SETDIAL["Set op_svc_kei_no_dial<br/>dial_flg = true"]
    DUP_STAT -->|No| NEXTITEM["Next iteration"]
    SETDIAL --> NEXTITEM

    DUPCHK -->|No| FIXIPCHK{"OP_SVC_CD_FIXIPAD<br/>(Fixed IP)?"}
    FIXIPCHK -->|Yes| FIXIPCOND{"SVC_KEI_STAT_910 ><br/>op_svc_kei_stat?"}
    FIXIPCOND -->|Yes| SETFIXIP["fixipad_flg = true"]
    FIXIPCOND -->|No| NEXTITEM
    FIXIPCHK -->|No| MLTCHK{"OP_SVC_CD_MLTISE<br/>(Multisection)?"}

    MLTCHK -->|Yes| MLTSTAT{"op_svc_kei_stat =<br/>SVC_KEI_STAT_100<br/>or SVC_KEI_STAT_030?"}
    MLTSTAT -->|Yes| SETMLTISE["Set op_svc_kei_no_mltise<br/>mltise_flg = true"]
    MLTSTAT -->|No| NEXTITEM
    MLTCHK -->|No| NEXTITEM

    NEXTITEM --> LOOP_END{"End of items?"}
    LOOP_END -->|No| INMAPICHECK
    LOOP_END -->|Yes| DIALLGCHK{"dial_flg OR fmtcel_flg<br/>OR (fixipad_flg AND mltise_flg)?"}

    DIALLGCHK -->|Yes| GETSAME1["getSame_trn_no<br/>(Get same processing no.)"]
    GETSAME1 --> SETSAME1["Set same_trn_no"]
    DIALLGCHK -->|No| SETSAME0["Set same_trn_no = empty"]

    SETSAME1 --> SVCUCWKSET["Set svc_kei_ucwk_no,<br/>svc_kei_ucwk_gadtm"]
    SETSAME0 --> SVCUCWKSET
    SVCUCWKSET --> GETOLDVR["getOldVrsbIdgSvcDtlCd"]

    GETOLDVR --> ADDFTTH["addSOD(ODR_NAIYO_CD_107)<br/>(FTTH auth cancel release)"]
    ADDFTTH --> DIALCHK{"dial_flg?"}
    DIALCHK -->|Yes| ADDDIAL["addSOD(ODR_NAIYO_CD_141)<br/>(Dial-up cancel release)"]
    DIALCHK -->|No| FLTCOMBCHK{"fixipad_flg AND mltise_flg?"}
    ADDDIAL --> FLTCOMBCHK
    FLTCOMBCHK -->|Yes| ADDMULTI["addSOD(ODR_NAIYO_CD_171)<br/>(Multisection fixed IP cancel)"]
    FLTCOMBCHK -->|No| NET_END["Net branch complete"]
    ADDMULTI --> NET_END

    NET_END --> RETURN

    MOBBRANCH --> WIFISPCHECK{"pcrs_cd =<br/>PCRS_CD_WIFISPOT?"}
    WIFISPCHECK -->|Yes| MOB_WSP["same_trn_no = empty"]
    WIFISPCHECK -->|No| CHGCHK{"chgSvcKeiJdg(svc_kei_no)?"}
    CHGCHK -->|Yes| MOB_SAME["getSame_trn_no"]
    CHGCHK -->|No| EKK161CHECK{"svc_kei_ucwk_no<br/>exists?"}
    MOB_WSP --> EKK161CHECK
    MOB_SAME --> EKK161CHECK

    EKK161CHECK -->|Yes| CALLEKK161["callEKK0161A010SC<br/>(Agreement meeting)"]
    CALLEKK161 --> GETPCRSCD["Extract ucwkPcrsCd"]
    EKK161CHECK -->|No| GETPCRSCD

    GETPCRSCD --> EMCHK{"isEmobile()?"}
    EMCHK -->|Yes| SAKI_SVC{"saki_svc_kei_no exists?"}
    SAKI_SVC -->|Yes| ADDEMO["addSOD(ODR_NAIYO_CD_315)<br/>(e-mobile cancel release)"]
    SAKI_SVC -->|No| WIMAXCHK
    ADDEMO --> WIMAXCHK

    WIMAXCHK{"ucwkPcrsCd =<br/>PCRS_CD_WIMAX?"}
    WIMAXCHK -->|Yes| WIMAXSET["Set svc_kei_ucwk_no,<br/>svc_kei_ucwk_gadtm"]
    WIMAXSET --> ADDWIMAX["addSOD(ODR_NAIYO_CD_311)<br/>(WiMAX CUI cancel)"]
    WIMAXCHK -->|No| FREEWICHECK{"ucwkPcrsCd = FREE_WIFI<br/>or WIFISPOT?"}
    ADDWIMAX --> FREEWICHECK

    FREEWICHECK -->|Yes| WIFI_CNT["countUpWiFiSpotSessions"]
    WIFI_CNT --> WIFI_JUDGE["judgeOdrHakkoJoken4WiFiSpot"]
    WIFI_JUDGE --> WIFI_GT0{"wifiSpotCnt > 0?"}
    WIFI_GT0 -->|Yes| WIFI_SET1["Set svc_kei_ucwk_no,<br/>svc_kei_ucwk_gadtm"]
    WIFI_SET1 --> ADDWIFICHG["addSOD(ODR_NAIYO_CD_302)<br/>(WiFi Spot change)"]
    WIFI_GT0 -->|No| WIFI_SET0["Set svc_kei_ucwk_no,<br/>svc_kei_ucwk_gadtm"]
    WIFI_SET0 --> ADDWIFICAN["addSOD(ODR_NAIYO_CD_305)<br/>(WiFi Spot cancel)"]
    ADDWIFICHG --> MOB_END
    ADDWIFICAN --> MOB_END

    MOB_END --> BLANKCHK{"isBlank(same_trn_no)?"}
    BLANKCHK -->|No| SETMAES["Set mae_recode_ch_svc_kei_no"]
    BLANKCHK -->|Yes| MOB_END2["Mobile branch complete"]
    SETMAES --> MOB_END2

    TELBRANCH --> TELCOND{"NOT (ido_div =<br/>IDO_DIV_USESTPRLS)<br/>OR syori_div is null?"}
    TELCOND -->|Yes| TELSET["Set svc_kei_ucwk_no,<br/>svc_kei_ucwk_gadtm"]
    TELSET --> ADDSIP["addSOD(ODR_NAIYO_CD_224)<br/>(SIP cancel release)"]
    TELCOND -->|No| BMPDOJI["bmpDojiMskm<br/>(Number porting SODs)"]
    ADDSIP --> TEL_END["Tel branch complete"]
    BMPDOJI --> TEL_END

    TEL_END --> RETURN
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `handle` | `SessionHandle` | Application session context used for all downstream service calls and database transactions. Carries connection, transaction, and authentication state. |
| 2 | `param` | `IRequestParameterReadWrite` | Request/response parameter object wrapping the service order group and control map. Modified in place by `addSOD` calls and returned as the updated context for the next processing stage. |
| 3 | `sodMap` | `HashMap<String, Object>` | A composite map containing sub-maps for SOD basic info, service contract info, and service contract detail info. Serves as the primary data vehicle carrying all order-line data needed for cancellation processing. |

**Instance fields read by this method:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `pcrs_cd` | `String` | Pricing code — determines the specific service plan (e.g., WiFi Spot, e-mobile plans, ADSL Furetsu). Affects which mobile/WiFi branches are taken. |
| `pplan_cd` | `String` | Plan code — used when retrieving the old verification determination service detail code via `getOldVrsbIdgSvcDtlCd`. |
| `ido_div` | `String` | Operation division code — distinguishes cancellation (中断解除) from usage suspension-release (利用停止解除). Controls the telephone branch behavior. |
| `syori_div` | `String` | Processing division — null check determines whether to generate SIP cancellation SOD or delegate to `bmpDojiMskm`. |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `callEKK0351B010SC` | EKK0351B010SC | KK_T_OPSVKEI (Option service contract) | Retrieves the list of option services associated with a given service contract number (option service list lookup). |
| R | `getKK0351Hash` | EKK0351A010CBS | KK_T_OPSVKEI_UCWK (Option service contract detail) | Fetches the service contract detail number for a given option service contract to validate matching. |
| R | `getKK0351GeneAddDtm` | EKK0351B010CBS | KK_T_OPSVKEI (Option service contract) | Retrieves the version registration datetime for an option service contract. |
| R | `callEKK0161A010SC` | EKK0161A010SC | KK_T_SVC_KEI_UCWK (Service contract detail) | Service contract detail agreement meeting — retrieves service contract detail information including pricing code. |
| R | `getSame_trn_no` | - | - | Gets the same processing number for deduplication tracking across related service contracts. |
| R | `getOldVrsbIdgSvcDtlCd` | - | - | Retrieves the old verification determination service detail code for legacy compatibility checks. |
| R | `countUpWiFiSpotSessions` | - | - | Counts the number of active WiFi Spot sessions for the customer. |
| R | `judgeOdrHakkoJoken4WiFiSpot` | - | - | Evaluates order-issuance eligibility conditions for WiFi Spot cancellation. |
| C | `addSOD` | - | KK_T_SOD (Service Order Data) | Generates and registers a service order data record for the specified order content code. Called multiple times with different ODR_NAIYO_CD values. |
| C | `bmpDojiMskm` | - | KK_T_SOD (Service Order Data) | Handles number-porting-related SOD generation (fallback for telephone branch when processing division exists). |
| - | `isStartRsvOption` | - | - | Checks whether an option service has a start reservation (unreflected) — used to filter out options not yet active. |
| - | `chgSvcKeiJdg` | - | - | Judges whether the service contract number differs from the previous processing record. |
| - | `jdgSvcKind` | - | - | Determines the service type (net/mobile/telephone) from pricing code or plan data. |
| - | `shkkaMap` | - | - | Shallow copy utility — creates a copy of the input HashMap to avoid mutating the original. |
| - | `isMansionPrvate` | - | - | Determines whether the customer resides in a private mansion type building. |
| - | `isEmobile` | - | - | Checks whether the pricing code corresponds to an e-mobile plan. |
| - | `isBlank` | - | - | Utility null/empty check on the same processing number. |

## 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 | Method: JKKHakkoSODCC.hakkoSOD() | `hakkoSOD()` -> `stpRlsOdrCtrl(handle, param, sodMap)` | `addSOD [C] KK_T_SOD`, `bmpDojiMskm [-]`, `callEKK0351B010SC [R] KK_T_OPSVKEI`, `callEKK0161A010SC [R] KK_T_SVC_KEI_UCWK` |
| 2 | Method: JKKHakkoSODCC.useStpRlsOdrCtrl() | `useStpRlsOdrCtrl()` -> `stpRlsOdrCtrl(handle, param, sodMap)` | `addSOD [C] KK_T_SOD`, `bmpDojiMskm [-]`, `callEKK0351B010SC [R] KK_T_OPSVKEI`, `callEKK0161A010SC [R] KK_T_SVC_KEI_UCWK` |

**Terminal operations from this method (all CRUD endpoints reached):**

| Terminal | CRUD | Entity/DB |
|----------|------|-----------|
| `addSOD(handle, param, ODR_NAIYO_CD_107)` | C | KK_T_SOD (FTTH auth/cancel release) |
| `addSOD(handle, param, ODR_NAIYO_CD_141)` | C | KK_T_SOD (Dial-up A/B connection cancel release) |
| `addSOD(handle, param, ODR_NAIYO_CD_171)` | C | KK_T_SOD (Multisection fixed IP cancel release) |
| `addSOD(handle, param, ODR_NAIYO_CD_315)` | C | KK_T_SOD (e-mobile cancel release) |
| `addSOD(handle, param, ODR_NAIYO_CD_311)` | C | KK_T_SOD (WiMAX CUI cancel release) |
| `addSOD(handle, param, ODR_NAIYO_CD_302)` | C | KK_T_SOD (WiFi Spot change) |
| `addSOD(handle, param, ODR_NAIYO_CD_305)` | C | KK_T_SOD (WiFi Spot cancel release) |
| `addSOD(handle, param, ODR_NAIYO_CD_224)` | C | KK_T_SOD (SIP cancel release) |
| `bmpDojiMskm(handle, param, sodMap, null)` | C | KK_T_SOD (Number porting related SODs) |
| `callEKK0351B010SC(...)` | R | KK_T_OPSVKEI (Option service contracts) |
| `callEKK0161A010SC(...)` | R | KK_T_SVC_KEI_UCWK (Service contract details) |
| `getKK0351Hash(...)` | R | KK_T_OPSVKEI_UCWK |
| `getKK0351GeneAddDtm(...)` | R | KK_T_OPSVKEI |
| `getSame_trn_no(...)` | R | - |
| `getOldVrsbIdgSvcDtlCd(...)` | R | - |
| `countUpWiFiSpotSessions(...)` | R | - |

## 6. Per-Branch Detail Blocks

**Block 1** — INITIALIZATION `(no condition)` (L6818)

> Initialize service variables, extract and shallow-copy info maps from sodMap, and retrieve key identifiers.

| # | Type | Code |
|---|------|------|
| 1 | SET | `statusCode = 0` // Service interface execution status flag [-> `0`] |
| 2 | SET | `sod_kihon_info_Map = (HashMap)sodMap.get(JKKHakkoSODConstCC.SOD_KIHON_INFO)` // SOD basic info [-> `"SOD_KIHON_INFO"`] |
| 3 | SET | `svc_kei_info_Map = (HashMap)sodMap.get(JKKHakkoSODConstCC.SVC_KEI_INFO)` // Service contract info [-> `"SVC_KEI_INFO"`] |
| 4 | SET | `svc_kei_ucwk_info_Map = (HashMap)sodMap.get(JKKHakkoSODConstCC.SVC_KEI_UCWK_INFO)` // Service contract detail info [-> `"SVC_KEI_UCWK_INFO"`] |
| 5 | EXEC | `sod_kihon_info_Map = shkkaMap(sod_kihon_info_Map)` // Shallow copy basic info map |
| 6 | EXEC | `svc_kei_info_Map = shkkaMap(svc_kei_info_Map)` // Shallow copy contract info map |
| 7 | EXEC | `svc_kei_ucwk_info_Map = shkkaMap(svc_kei_ucwk_info_Map)` // Shallow copy detail info map |
| 8 | SET | `sys_id = (String)sod_kihon_info_Map.get(JKKHakkoSODConstCC.INFO_SYSID)` // SYSID [-> `"INFO_SYSID"`] |
| 9 | SET | `svc_kei_no = (String)svc_kei_info_Map.get(JKKHakkoSODConstCC.INFO_SVC_KEI_NO)` // Service contract number [-> `"INFO_SVC_KEI_NO"`] |
| 10 | SET | `svc_kei_ucwk_no = (String)svc_kei_ucwk_info_Map.get(JKKHakkoSODConstCC.INFO_SVC_KEI_UCWK_NO)` // Service contract detail number [-> `"INFO_SVC_KEI_UCWK_NO"`] |
| 11 | SET | `chaf_svc_kei_ucwk_gene_add_dtm = (String)svc_kei_ucwk_info_Map.get(JKKHakkoSODConstCC.INFO_CHAF_SVC_KEI_UCWK_GENE_ADD_DTM)` // Post-change registration datetime [-> `"INFO_CHAF_SVC_KEI_UCWK_GENE_ADD_DTM"`] |
| 12 | CALL | `svc_kind = jdgSvcKind()` // Determine service type (IT2-2016-0000004) |

**Block 2** — IF `[Net Service Branch]` `(JKKHakkoSODConstCC.SVC_KIND_NET.equals(svc_kind) || JKKHakkoSODConstCC.PCRS_CD_ADSL_FURETTSU.equals(pcrs_cd))` (L6842)

> Handle FTTH/ADSL Furetsu service cancellation. ADSL Furetsu is treated as a net service.

**Block 2.1** — IF `(isMansionPrvate())` (L6846)

> If the customer is in a private mansion building, skip all FTTH SOD generation. FTTH authentication is not available in private mansions, and DIY upgrades are not permitted.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return param` // Early return — no SOD generated |

**Block 2.2** — INITIALIZATION (L6852)

> Reset all option detection flags and prepare for option service lookup.

| # | Type | Code |
|---|------|------|
| 1 | SET | `dial_flg = fmtcel_flg = false` |
| 2 | SET | `fixipad_flg = mltise_flg = false` // 2013-04-11 addition |
| 3 | SET | `inHashMltise = new HashMap<>()` // Input map for option lookup |
| 4 | SET | `resultHashMltise = new HashMap<>()` // Result map for option lookup |
| 5 | SET | `inHashMltise.put(JKKHakkoSODConstCC.SVC_KEI_NO, svc_kei_no)` // Service contract number |

**Block 2.3** — OPTION SERVICE LIST LOOKUP (L6862)

> Call EKK0351B010SC to retrieve the list of option services (changed from EKK0351B002SC per IT1-2013-0000869).

| # | Type | Code |
|---|------|------|
| 1 | CALL | `statusCode = callEKK0351B010SC(param, handle, inHashMltise, resultHashMltise, JKKHakkoSODConstCC.FUNC_CODE_1)` |
| 2 | IF | `statusCode != 0` // Error handling — throw SCCallException |

**Block 2.4** — OPTION SERVICE LOOP (L6872)

> Iterate through each option service item returned by EKK0351B010SC and detect DSL upgrade, fixed IP, and multisection options.

| # | Type | Code |
|---|------|------|
| 1 | SET | `msgList = (CAANMsg[])resultHashMltise.get(JKKHakkoSODConstCC.TEMPLATE_ID_EKK0351B010)` |
| 2 | SET | `op_svc_kei_no = ""`, `op_svc_kei_stat = ""`, `op_svc_cd = ""` |
| 3 | FOR | `i = 0; i < msgList.length; i++` |
| 4 | SET | `retHash = msgList[i].getMsgData()` |
| 5 | SET | `op_svc_kei_no = retHash.get(EKK0351B010CBSMsg1List.OP_SVC_KEI_NO)` // Option service contract number |
| 6 | SET | `op_svc_kei_stat = retHash.get(EKK0351B010CBSMsg1List.OP_SVC_KEI_STAT)` // Option service contract status |
| 7 | SET | `op_svc_cd = retHash.get(EKK0351B010CBSMsg1List.OP_SVC_CD)` // Option service code |

**Block 2.4.1** — IF `(OM-2016-0000007) svc_kei_ucwk_no match check)` (L6885)

> Skip option items that do not match the current service contract detail number.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `kk0351A010Hash = getKK0351Hash(param, handle, op_svc_kei_no)` |
| 2 | SET | `svcKeiUcwkNo = kk0351A010Hash.get(EKK0351A010CBSMsg1List.SVC_KEI_UCWK_NO)` |
| 3 | IF | `isNull(svcKeiUcwkNo) || !svc_kei_ucwk_no.equals(svcKeiUcwkNo)` → `continue` |

**Block 2.4.2** — IF `(isStartRsvOption check)` (L6894)

> Skip option items with a start reservation (unreflected) that have not yet taken effect.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `isStartRsvOption(param, handle, JKKHakkoSODConstCC.FUNC_CODE_1, op_svc_kei_no)` |
| 2 | IF | `true` → `continue` (unreflected start reservation, no order data) |

**Block 2.4.3** — IF/ELSE-IF/ELSE-IF/ELSE-IF `(op_svc_cd classification)` (L6901)

> Classify option service codes to detect specific option types.

**Block 2.4.3.1** — IF `[DSL Upgrade]` `(JKKHakkoSODConstCC.OP_SVC_CD_DUP.equals(op_svc_cd))` (L6901)

> Detect DSL upgrade (dial-up A/B connection) option.

**Block 2.4.3.1.1** — IF `[Status is "Service in Progress"]` `(JKKHakkoSODConstCC.SVC_KEI_STAT_100.equals(op_svc_kei_stat))` (L6904)

| # | Type | Code |
|---|------|------|
| 1 | SET | `this.op_svc_kei_no_dial = op_svc_kei_no` // Option service contract number |
| 2 | CALL | `this.op_gadtm_dial = getKK0351GeneAddDtm(param, handle, op_svc_kei_no)` |
| 3 | SET | `dial_flg = true` |

**Block 2.4.3.2** — ELSE-IF `[Fixed IP Address]` `(JKKHakkoSODConstCC.OP_SVC_CD_FIXIPAD.equals(op_svc_cd))` (L6938)

> Detect fixed IP address option (added 2013-04-11, IT1-2013-0000869).

**Block 2.4.3.2.1** — IF `[Status < SVC_KEI_STAT_910]` `(SVC_KEI_STAT_910.compareTo(op_svc_kei_stat) > 0)` (L6940)

| # | Type | Code |
|---|------|------|
| 1 | SET | `fixipad_flg = true` |

**Block 2.4.3.3** — ELSE-IF `[Multisection]` `(JKKHakkoSODConstCC.OP_SVC_CD_MLTISE.equals(op_svc_cd))` (L6945)

> Detect multisection option. OM-2016-0000007 extended status check to include SVC_KEI_STAT_030.

**Block 2.4.3.3.1** — IF `[Status is 100 or 030]` `(SVC_KEI_STAT_100.equals(op_svc_kei_stat) || SVC_KEI_STAT_030.equals(op_svc_kei_stat))` (L6948)

| # | Type | Code |
|---|------|------|
| 1 | SET | `this.op_svc_kei_no_mltise = op_svc_kei_no` |
| 2 | CALL | `this.op_gadtm_mltise = getKK0351GeneAddDtm(param, handle, op_svc_kei_no)` |
| 3 | SET | `mltise_flg = true` |

**Block 2.5** — SAME PROCESSING NUMBER LOGIC (L6962)

> If dial-up or fmtcel or (fixed IP AND multisection) flags are set, retrieve the same processing number.

| # | Type | Code |
|---|------|------|
| 1 | IF | `dial_flg OR fmtcel_flg OR (fixipad_flg AND mltise_flg)` |
| 2 | SET | `sameTrnNo = new String[1]` |
| 3 | CALL | `getSame_trn_no(param, handle, null, sameTrnNo)` |
| 4 | SET | `this.same_trn_no = sameTrnNo[0]` |
| 5 | ELSE | `this.same_trn_no = ""` |

**Block 2.6** — SERVICE CONTRACT DETAIL SETUP (L6975)

> Set the service contract detail number and generation datetime on instance fields.

| # | 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 | CALL | `this.old_vrsb_jdg_svc_dtl_cd = getOldVrsbIdgSvcDtlCd(handle, param, svc_kei_no, this.svc_kei_ucwk_no[0], this.pplan_cd)` // ANK-2765-00-00 |

**Block 2.7** — ADD SOD: FTTH AUTH/CANCEL RELEASE (L6980)

| # | Type | Code |
|---|------|------|
| 1 | CALL | `param = addSOD(handle, param, JKKHakkoSODConstCC.ODR_NAIYO_CD_107)` // FTTH auth/cancel release |

**Block 2.8** — IF `[Dial-up exists]` `(dial_flg)` (L6983)

> Generate dial-up A/B connection cancel release SOD if dial-up option is active.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `param = addSOD(handle, param, JKKHakkoSODConstCC.ODR_NAIYO_CD_141)` // Dial-up cancel release |

**Block 2.9** — IF `[Fixed IP + Multisection combined]` `(fixipad_flg AND mltise_flg)` (L6998)

> Generate multisection with fixed IP cancel release SOD.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `param = addSOD(handle, param, JKKHakkoSODConstCC.ODR_NAIYO_CD_171)` // Multisection fixed IP cancel |

**Block 3** — ELSE-IF `[Mobile Service Branch]` `(JKKHakkoSODConstCC.SVC_KIND_MOB.equals(svc_kind))` (L7008)

> Handle mobile service (WiMAX, e-mobile, WiFi Spot) cancellation logic.

**Block 3.1** — IF `[WiFi Spot pricing code]` `(JKKHakkoSODConstCC.PCRS_CD_WIFISPOT.equals(pcrs_cd))` (L7012)

> When the customer's current pricing code is WiFi Spot, reset same_trn_no to empty.

| # | Type | Code |
|---|------|------|
| 1 | SET | `this.same_trn_no = ""` |

**Block 3.2** — ELSE-IF `[Service contract number changed]` `(chgSvcKeiJdg(svc_kei_no))` (L7017)

> If the service contract number differs from the previous processing record, retrieve the same processing number.

| # | 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.3** — EKK0161A010 SERVICE CONTRACT DETAIL LOOKUP (L7024)

> Call EKK0161A010SC to retrieve service contract detail information (agreement meeting), needed to extract the pricing code for mobile service type determination.

| # | Type | Code |
|---|------|------|
| 1 | SET | `inEKK0161A010Hash = new HashMap<>()` |
| 2 | SET | `retEKK0161A010Hash = new HashMap<>()` |
| 3 | IF | `svc_kei_ucwk_no != null && svc_kei_ucwk_no.length() > 0` |
| 4 | SET | `inEKK0161A010Hash.put(JKKHakkoSODConstCC.SVC_KEI_UCWK_NO, svc_kei_ucwk_no)` |
| 5 | SET | `inEKK0161A010Hash.put(JKKHakkoSODConstCC.GENE_ADD_DTM, chaf_svc_kei_ucwk_gene_add_dtm)` |
| 6 | CALL | `statusCode = callEKK0161A010SC(param, handle, inEKK0161A010Hash, retEKK0161A010Hash, JKKHakkoSODConstCC.FUNC_CODE_1)` |
| 7 | IF | `statusCode != 0` → throw `CCException` |
| 8 | SET | `eKK0161A010Hash = retEKK0161A010Hash.get(JKKHakkoSODConstCC.TEMPLATE_ID_EKK0161A010)` |
| 9 | IF | `eKK0161A010Hash != null` |
| 10 | SET | `ucwkPcrsCd = eKK0161A010Hash.get(EKK0161A010CBSMsg1List.PCRS_CD)` // Pricing code from service contract detail |

**Block 3.4** — IF `[e-mobile detection]` `(isEmobile())` (L7063)

> Handle e-mobile plan cancellation. When the pricing code matches e-mobile series (PCRS_CD_EMOBILE_7M, PCRS_CD_EMOBILE_21M, etc.), generate e-mobile cancel release SOD only if a previous service contract number exists (from KO termination/cancellation screen).

| # | Type | Code |
|---|------|------|
| 1 | SET | `saki_svc_kei_no = svc_kei_info_Map.get(JKKHakkoSODConstCC.INFO_SAKI_SVC_KEI_NO)` // Previous service contract number |
| 2 | IF | `saki_svc_kei_no != null && saki_svc_kei_no.length() > 0` |
| 3 | CALL | `param = addSOD(handle, param, JKKHakkoSODConstCC.ODR_NAIYO_CD_315)` // e-mobile cancel release |

**Block 3.5** — IF `[WiMAX detection]` `(JKKHakkoSODConstCC.PCRS_CD_WIMAX.equals(ucwkPcrsCd))` (L7078)

> Handle WiMAX plan cancellation. Set service contract detail info and generate WiMAX CUI cancel release SOD.

| # | 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 | CALL | `param = addSOD(handle, param, JKKHakkoSODConstCC.ODR_NAIYO_CD_311)` // WiMAX CUI cancel |

**Block 3.6** — IF `[Free WiFi / WiFi Spot detection]` `(JKKHakkoSODConstCC.PCRS_CD_FREE_WIFI.equals(ucwkPcrsCd) || JKKHakkoSODConstCC.PCRS_CD_WIFISPOT.equals(ucwkPcrsCd))` (L7092)

> Handle WiFi Spot cancellation. Count active sessions: if more than 0, generate a change SOD; if 0, generate a cancel release SOD.

**Block 3.6.1** — SESSION COUNTING (L7101)

| # | Type | Code |
|---|------|------|
| 1 | CALL | `wifiSpotCnt = countUpWiFiSpotSessions(param, handle, sys_id, svc_kei_ucwk_no)` |
| 2 | CALL | `judgeOdrHakkoJoken4WiFiSpot(param, handle, sys_id)` |

**Block 3.6.2** — IF `[wifiSpotCnt > 0]` (L7104)

> Other active WiFi Spot contracts exist — this customer is not the first to be cancelled. Generate a WiFi Spot change SOD.

| # | 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 | CALL | `param = addSOD(handle, param, JKKHakkoSODConstCC.ODR_NAIYO_CD_302)` // WiFi Spot change |

**Block 3.6.3** — ELSE `[wifiSpotCnt == 0]` (L7115)

> No other active WiFi Spot contracts — this is the first customer being cancelled. Generate a WiFi Spot cancel release SOD.

| # | 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 | CALL | `param = addSOD(handle, param, JKKHakkoSODConstCC.ODR_NAIYO_CD_305)` // WiFi Spot cancel release |

**Block 3.7** — IF `[same_trn_no is not blank]` `(isBlank(this.same_trn_no))` (L7125)

> If the same processing number is set, record the current service contract number as the previous contract number.

| # | Type | Code |
|---|------|------|
| 1 | SET | `this.mae_recode_ch_svc_kei_no = new String(svc_kei_no)` |

**Block 4** — ELSE-IF `[Telephone Service Branch]` `(JKKHakkoSODConstCC.SVC_KIND_TEL.equals(svc_kind))` (L7131)

> Handle telephone service cancellation logic, differentiating between full cancellation and usage suspension-release scenarios.

**Block 4.1** — IF `[Full cancellation or missing processing division]` `(NOT IDO_DIV_USESTPRLS.equals(this.ido_div) || this.syori_div is null)` (L7136)

> When the operation is not a usage suspension-release (利用停止解除) or processing division is null — generate SIP cancel release SOD. This branch handles full cancellations and forced disconnections.

| # | Type | Code |
|---|------|------|
| 1 | SET | `this.same_trn_no = ""` |
| 2 | SET | `this.svc_kei_ucwk_no = new String[1]` |
| 3 | SET | `this.svc_kei_ucwk_no[0] = svc_kei_ucwk_no` |
| 4 | SET | `this.svc_kei_ucwk_gadtm = new String[1]` |
| 5 | SET | `this.svc_kei_ucwk_gadtm[0] = chaf_svc_kei_ucwk_gene_add_dtm` |
| 6 | CALL | `param = addSOD(handle, param, JKKHakkoSODConstCC.ODR_NAIYO_CD_224)` // SIP cancel release |

**Block 4.2** — ELSE `[Number porting related]` (L7148)

> When processing division exists and operation is usage suspension-release — delegate to `bmpDojiMskm` for number porting-related SOD generation (includes number porting, transfer destination token registration, and token start SODs).

| # | Type | Code |
|---|------|------|
| 1 | CALL | `bmpDojiMskm(handle, param, sodMap, null)` // 050 option related number swap SODs |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `stpRlsOdrCtrl` | Method | Cancellation Order Control — the primary method that determines which SODs to generate during service cancellation |
| SOD | Acronym | Service Order Data — the system's order record entity; generates work orders for downstream processing systems |
| `ODR_NAIYO_CD` | Field | Order content code — identifies the type of SOD to generate (FTTH auth, dial-up cancel, SIP cancel, etc.) |
| `svc_kei_no` | Field | Service contract number — unique identifier for a customer's service contract |
| `svc_kei_ucwk_no` | Field | Service contract detail number — sub-identifier for a specific service line/item within a contract |
| `svc_kind` | Field | Service type classification — net, mobile, or telephone |
| `pcrs_cd` | Field | Pricing code — identifies the specific rate plan or product (e.g., PCRS_CD_WIFISPOT, PCRS_CD_EMOBILE_7M) |
| `pplan_cd` | Field | Plan code — higher-level product plan identifier |
| `ido_div` | Field | Operation division code — distinguishes cancellation (中断解除) from usage suspension-release (利用停止解除) |
| `syori_div` | Field | Processing division — indicates whether additional processing (e.g., number porting) should be triggered |
| `same_trn_no` | Field | Same processing number — internal tracking ID for deduplication across related service contracts |
| `dial_flg` | Field | Dial-up flag — indicates whether a dial-up A/B connection option is active |
| `fixipad_flg` | Field | Fixed IP address flag — indicates whether a static IP address option is active |
| `mltise_flg` | Field | Multisection flag — indicates whether a multisection (multiple phone line) option is active |
| `fmtcel_flg` | Field | Format cell flag — deprecated; was used for FTTH Cell service (now inactive since OM-2013-0002546) |
| FTTH | Business term | Fiber To The Home — fiber-optic broadband internet service |
| e-mobile | Business term | e-mobile — a mobile carrier service brand; e-SMART mobile service |
| WiMAX | Business term | WiMAX — wireless broadband mobile service (3G/4G standard) |
| WiFi Spot | Business term | WiFi Spot — indoor WiFi access point rental service |
| CUI | Business term | Customer Unit Interface — WiMAX device/service management interface |
| SIP | Business term | Session Initiation Protocol — VoIP telephone service over IP networks |
| `SVC_KEI_STAT_100` | Constant | Service status "Service in Progress" — the service is currently active |
| `SVC_KEI_STAT_030` | Constant | Service status "Preparation" — service is being prepared/activated |
| `SVC_KEI_STAT_910` | Constant | Service status threshold — used for fixed IP condition comparison |
| `OP_SVC_CD_DUP` | Constant | Option service code for DSL upgrade (dial-up A/B connection) |
| `OP_SVC_CD_FIXIPAD` | Constant | Option service code for fixed IP address option |
| `OP_SVC_CD_MLTISE` | Constant | Option service code for multisection (multiple phone line) option |
| `ODR_NAIYO_CD_107` | Constant | Order content: FTTH authentication / cancel release |
| `ODR_NAIYO_CD_141` | Constant | Order content: Dial-up A/B connection cancel release |
| `ODR_NAIYO_CD_171` | Constant | Order content: Multisection (fixed IP) cancel release |
| `ODR_NAIYO_CD_224` | Constant | Order content: SIP cancel release |
| `ODR_NAIYO_CD_302` | Constant | Order content: WiFi Spot change |
| `ODR_NAIYO_CD_305` | Constant | Order content: WiFi Spot cancel release |
| `ODR_NAIYO_CD_311` | Constant | Order content: WiMAX CUI cancel release |
| `ODR_NAIYO_CD_315` | Constant | Order content: e-mobile cancel release |
| `shkkaMap` | Method | Shallow copy — creates a shallow copy of a HashMap to avoid mutating the original |
| `jdgSvcKind` | Method | Service type judgment — determines whether the service is net, mobile, or telephone based on pricing/plan data |
| `isMansionPrvate` | Method | Private mansion check — determines if the customer resides in a private building where FTTH authentication is unavailable |
| `isEmobile` | Method | e-mobile detection — checks if the pricing code corresponds to any e-mobile plan series |
| `chgSvcKeiJdg` | Method | Service contract change judgment — compares current vs. previous service contract number |
| `addSOD` | Method | Add Service Order Data — generates and registers an SOD record |
| `bmpDojiMskm` | Method | Number porting co-processing — handles number porting-related SODs (050 option, transfer token) |
| `callEKK0351B010SC` | Method | Service component call — retrieves the option service contract list for a service contract number |
| `callEKK0161A010SC` | Method | Service component call — retrieves service contract detail agreement meeting information |
| `KK_T_OPSVKEI` | DB Entity | Option service contract table — stores option service contract data |
| `KK_T_SVC_KEI_UCWK` | DB Entity | Service contract detail table — stores service contract detail/agreement data |
| `KK_T_SOD` | DB Entity | Service order data table — stores generated SOD records |
| EKK0351B010SC | SC Code | Service Component for option service contract list lookup |
| EKK0161A010SC | SC Code | Service Component for service contract detail agreement meeting |
| CCException | Class | Custom exception for common component errors |
| SCCallException | Class | Exception for service component call errors |
| `saki_svc_kei_no` | Field | Previous service contract number — set when cancellation originates from the contract termination screen |
| `mae_recode_ch_svc_kei_no` | Field | Previous record change service contract number — stores the original contract number for porting context |
| `FUNC_CODE_1` | Constant | Function code "1" — passed to service component calls to identify the calling function context |
