# Business Logic — JKKKisnUwHmdkAddCC.execKisnHeigo() [653 LOC]

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

## 1. Role

### JKKKisnUwHmdkAddCC.execKisnHeigo()

This method is the central orchestrator for **line merger (heigo: 引越) processing** within the K-Opticom customer base system. It handles the business operation of transferring service contracts from a **merger source (heigo-moto: 引越元)** to a **merger destination (heigo-saki: 引越先)** during a customer's line migration (residential move or service change). It coordinates a multi-step workflow that begins by submitting an approval registration, then systematically terminates existing services on the source line, registers or updates service contracts on the destination line, merges construction plan line information, processes EO (eo Hikari: eo Light) optical phone service updates, and finally performs post-application tasks including order setting adjustments and discount auto-application.

The method implements a **dispatch-and-delegate pattern**: it routes processing by `funcCd` (function code), where `"1"` indicates main registration (executing full lifecycle processing) and `"2"` indicates provisional or inquiry processing (executing only the first half of operations). It also implements a **migration-guard pattern** via the `teishiFlg` flag: if any destination service is detected as being "in transition" (usage start date equals the maximum date `20991231`), the method skips source line termination to prevent conflicts during overlapping moves.

For **both network and phone service mergers**, it additionally handles device provisioning service deinstallation (DSL line teardown for equipment like routers and set-top boxes). It also supports **mansion (apartment building) specific logic**, identifying whether the destination is a standard mansion or mezon-type building, and merges construction plan line data accordingly. When the merger involves both network and telephone services, it queries business parameter settings to determine which device service codes require deinstallation and processes them in a loop.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["execKisnHeigo begin"])
    START --> EXTRACT["Extract heogomtList, heogoskList, funcCode from ccMsg"]
    EXTRACT --> SCINIT["Instantiate ServiceComponentRequestInvoker"]
    SCINIT --> APPREG["EKK0011D020 - Submit Approval Registration"]
    APPREG --> GETOUT["Get mskmNo, mskmDtlNo, updDtm from output"]
    GETOUT --> INITEISI["Set teishiFlg = false"]
    INITEISI --> CHKLOOP["Loop: heogoskList items"]
    CHKLOOP --> SVCQUERY["EKK0241A010 - Destination Service Contract Consent Query"]
    SVCQUERY --> CHECKTRANS{"usuStaymd == 20991231?"}
    CHECKTRANS --> YES_TF["Set teishiFlg = true (service in transition)"]
    CHECKTRANS --> NO_TF["Continue to next item"]
    YES_TF --> BREAKLOOP["Break loop"]
    NO_TF --> SVCSTOP["EKK0251C050 - Service Contract Line Usage Termination"]
    BREAKLOOP --> MOTOLOOP["Loop: heogomtList items"]
    NO_TF --> MOTOLOOP
    MOTOLOOP --> CHKTEISHI{"teishiFlg?"}
    CHKTEISHI --> T_YES["teishiFlg=true - Update service contract instead of terminate"]
    T_YES --> TRANS_UPD["EKK0241A010 + EKK0241C010 - Service Contract Change"]
    T_YES --> NEXT_MOTO["Continue to next item"]
    CHKTEISHI --> T_NO["teishiFlg=false - Normal processing"]
    T_NO --> NORMAL_QRY["EKK0241A010 - Service Contract Consent Query"]
    NORMAL_QRY --> CT_EXISTS{"Service contract exists?"}
    CT_EXISTS --> YES_CT["EKK0241C010 - Service Contract Change"]
    CT_EXISTS --> NO_CT["EKK0241D010 - Service Contract Registration"]
    YES_CT --> SETUDPT["Set updDtmWork"]
    NO_CT --> SETUDPT
    SETUDPT --> NEXT_MOTO
    NEXT_MOTO --> KIKI_CHK["EKK0341B504 - Device Provision Service Consent Query"]
    KIKI_CHK --> KIKI_LOOP["Loop device items"]
    KIKI_LOOP --> KIKI_SKIP{"skip: ONU / canceled / already terminated?"}
    KIKI_SKIP --> SKIP["Continue to next item"]
    KIKI_SKIP --> KIKI_UPD["EKK0341C320 - Device Provision Service Line Change"]
    KIKI_UPD --> PROGREG["EKK1091D010 - Progress Registration"]
    PROGREG --> FUNC1_CHECK{"funcCode == 1?"}
    FUNC1_CHECK --> YES_F1["YES - Main registration"]
    FUNC1_CHECK --> NO_F1["NO"]
    YES_F1 --> MERGE["execUpdSvcKeiKaisenUcwk - Service Contract Line Merge"]
    MERGE --> MANSION_Q["EKK0861B002 - Mansion Information Query"]
    MANSION_Q --> MANSION_TYPE{"Is Mansion or Mezon?"}
    MANSION_TYPE --> YES_M["Set bukkenCd, equipCd"]
    MANSION_TYPE --> NO_M["Null bukkenCd"]
    YES_M --> WORK_PLAN["EKU0081C030 - Construction Plan Line Merge"]
    NO_M --> WORK_PLAN
    WORK_PLAN --> TEL_CHECK{"telSvcKeiNo exists?"}
    TEL_CHECK --> YES_T["YES - eo Optical Phone"]
    TEL_CHECK --> NO_T["NO - Skip"]
    YES_T --> TEL_DET["EKK0191B005 - eo Optical Phone Details"]
    TEL_DET --> TEL_CONS["EKK0191A010 - eo Optical Phone Consent"]
    TEL_CONS --> SVC_CONS["EKK0161A010 - Service Contract Consent"]
    SVC_CONS --> FUNC1_SVC{"funcCode == 1?"}
    FUNC1_SVC --> YES_F1S["YES - EKK0191C060 + execJKKHakkoSODCC"]
    FUNC1_SVC --> NO_F1S["Skip"]
    FUNC1 --> POST_APP["EKK0021C060 - Post Application Request"]
    POST_APP --> SORT_REG["JKKSeiriNoHtbChgCC.seiriNoHtbChg"]
    SORT_REG --> ORDER_QUERY["EKK1041B001 - Order Settings Query"]
    ORDER_QUERY --> ORDER_CHK{"Order settings exist?"}
    ORDER_CHK --> YES_O["EKK1041C010 - Order Settings Change"]
    ORDER_CHK --> NO_O["Skip"]
    SORT_REG --> WRISVC["execWrisvcAutoAply - Discount Auto Application"]
    WRISVC --> END_N(["Return param"])
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `handle` | `SessionHandle` | Database session handle providing the transaction context for all SC calls and database operations. Used across all CBS invocations for connection management. |
| 2 | `param` | `IRequestParameterReadWrite` | Business data I/O object carrying request/reply parameters via its `getData()` and `setData()` methods. Contains the `fixedText` key holding the main `ccMsg` HashMap, and is used to store intermediate results (e.g., sort number registration via `FIXED_KEY_SEIRINO_HTB_CHG_CC`). |
| 3 | `fixedText` | `String` | A string key used to retrieve the primary data HashMap (`ccMsg`) from `param`. It identifies the entry point within the param's internal data store for accessing merger source/destination lists, function codes, and migration metadata. |

**Instance fields / external state read:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `IDO_DIV_00076` | `String` constant = `"00076"` | Disruption classification code for "line merger information merge" — passed to EKK0251C050 to identify the type of service change. |
| `KK_COM_SVC_UP_DTM` | `String` constant = `"KK_COM_SVC_UP_DTM"` | Key for storing the service contract update timestamp in the param object. |
| `KK_OYA_SKBT_KSN_UCWK` | `String` constant = `"KK_OYA_SKBT_KSN_UCWK"` | Business parameter key for device provisioning service contract parent contract identification. |
| `FIXED_KEY_SEIRINO_HTB_CHG_CC` | `String` constant = `"SeiriNoHtbChgCC"` | CC internal key for sort number merger processing data storage. |
| `TEMPLATE_ID_*` constants | `String` | Template IDs for CBS messages (e.g., `EKK0011D020`, `EKK0251C050`, etc.) passed to `callSC` for message template resolution. |

**External constants resolved:**

| Constant | Value | Context |
|----------|-------|---------|
| `JKKStrConst.END_YMD_DEFAULT` | `"20991231"` | Maximum/default end date — used to detect if a service is "in transition" (migrating) |
| `JKKSvcConst.MAX_YMD` | `"20991231"` | Maximum year-month-day date — used as the end date when registering new service contracts |
| `JKKStrConst.MANSION_BUKKEN_CD_MANSION` | `"001"` | Mansion property code — identifies standard apartment building type |
| `JKKStrConst.MANSION_BUKKEN_CD_MEZON` | `"002"` | Mezon property code — identifies mezon-type building |
| `JKKStrConst.CD00056_STAT_DSLZUMI` | `"910"` | Service status code for "DSL teardown completed" — used to skip already-terminated device services |
| `JKKStrConst.CD00056_STAT_CANCELZUMI` | `"920"` | Service status code for "cancellation completed" — used to skip canceled device services |
| `JKKSvcConst.KKTK_SVC_CD_ONU` | `"C012"` | Device provision service code for ONU (Optical Network Unit) — excluded from deinstallation processing |

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| C | `callSC (EKK0011D020)` | EKK0011D020 | KK_T_MSKM (Approval Registration Master) | Submit approval registration — creates a new approval registration record for the merger operation |
| R | `callSC (EKK0241A010)` | EKK0241A010 | KK_T_SVC_KEI (Service Contract) | Query destination service contract consent — reads service contract details including usage start date |
| U | `callSC (EKK0241C010)` | EKK0241C010 | KK_T_SVC_KEI (Service Contract) | Change service contract — updates service contract record with start/end dates and usage period for merger source (when service in transition) and merger destination |
| C | `callSC (EKK0241D010)` | EKK0241D010 | KK_T_SVC_KEI (Service Contract) | Register service contract — creates new service contract when none exists on destination line |
| U | `callSC (EKK0251C050)` | EKK0251C050 | KK_T_SVC_KEI_HANS (Service Contract History) | Terminate service contract line usage — marks service contracts on the source line as ended (skipped if `teishiFlg` is true) |
| U | `callSC (EKK0341C320)` | EKK0341C320 | KK_T_KIKI_SVC_KEI (Device Provision Service Contract) | Change device provision service contract line — updates device service contracts with new merger destination information |
| R | `callSC (EKK0341B504)` | EKK0341B504 | KK_T_KIKI_SVC_KEI (Device Provision Service Contract) | Query device provision service contract consent — reads device service contract details for line change processing |
| R | `callSC (EKK0861B002)` | EKK0861B002 | KK_T_MANSION (Mansion Information) | Query mansion information — retrieves mansion property type and equipment codes |
| C | `callSC (EKU0081C030)` | EKU0081C030 | KK_T_WORK_PLAN (Construction Plan) | Merge construction plan line — merges construction plan information from source to destination line |
| R | `callSC (EKK0191B005)` | EKK0191B005 | KK_T_SVC_KEI (Service Contract) | Query eo optical phone service contract details — retrieves eo Hikari service contract information |
| R | `callSC (EKK0191A010)` | EKK0191A010 | KK_T_SVC_KEI (Service Contract) | Query eo optical phone service contract consent — reads eo service consent details |
| R | `callSC (EKK0161A010)` | EKK0161A010 | KK_T_SVC_KEI (Service Contract) | Query service contract consent — reads service contract consent information for eo optical phone |
| U | `callSC (EKK0191C060)` | EKK0191C060 | KK_T_SVC_KEI (Service Contract) | Change eo optical phone service contract details — updates eo service contract during main registration |
| C | `callSC (EKK1091D010)` | EKK1091D010 | KK_T_PRG_STAT (Progress Status) | Progress registration — registers the progress status of the merger operation for the first source service contract |
| R | `callSC (EKK1041B001)` | EKK1041B001 | KK_T_ORD_SET (Order Settings) | Query order settings — reads existing order settings associated with merger source service contracts |
| U | `callSC (EKK1041C010)` | EKK1041C010 | KK_T_ORD_SET (Order Settings) | Change order settings — updates order setting information with new merger destination line numbers |
| U | `callSC (EKK0021C060)` | EKK0021C060 | KK_T_MSKM_DTL (Approval Registration Details) | Post application request — requests follow-up business processing for the approval registration details |
| - | `execUpdSvcKeiKaisenUcwk()` | EKK0251SC | KK_T_SVC_KEI_HANS (Service Contract History) | Merge service contract line information — updates service contract history during main registration |
| - | `execJKKHakkoSODCC()` | SOD SC | KK_T_SOD (Service Order Data) | Issue service order — creates a service order data record for the eo optical phone change |
| - | `seiriNoHtbChg()` | - | - | Sort number registration — delegates sort number assignment via JKKSeiriNoHtbChgCC |
| - | `execWrisvcAutoAply()` | WRISVC SC | KK_T_WRISVC_DISCOUNT (Wrisvc Discount) | Auto-apply discounts — applies automatic discounts for the merger operation |
| - | `setSvcUpDtm()` | - | - | Sets the update timestamp stamp in the work area |
| - | `callSC (EZM0321A010)` | EZM0321A010 | KK_T_WORK_PARAM (Business Parameter) | Query business parameter management — retrieves device service code settings for network+phone merger |
| - | `execEKK0341A010()` | EKK0341A010 | KK_T_KIKI_SVC_KEI (Device Provision Service Contract) | Query device provision service contract — reads multi-functional router contract status during network merger |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Batch: KKSV0705OPOperation | `KKSV0705OPOperation.target3 (CCRequestBroker)` -> `JKKKisnUwHmdkAddCC.execKisnHeigo` | EKK0011D020 [C] KK_T_MSKM, EKK0251C050 [U] KK_T_SVC_KEI_HANS, EKK0241C010 [U] KK_T_SVC_KEI, EKK0241D010 [C] KK_T_SVC_KEI, EKK0341C320 [U] KK_T_KIKI_SVC_KEI, EKK1091D010 [C] KK_T_PRG_STAT, EKK0021C060 [U] KK_T_MSKM_DTL, EKU0081C030 [C] KK_T_WORK_PLAN, EKK0191C060 [U] KK_T_SVC_KEI |

**Notes:** KKSV0705 is the "Line Transfer Amount Change Registration" BPM operation that invokes this method as its core Common Component. The operation is generated from BPMXML and acts as the entry point for the line merger registration process.

## 6. Per-Branch Detail Blocks

**Block 1** — [SET] `(ccMsg extraction)` (L260)

> Extract business data from the input parameter map.

| # | Type | Code |
|---|------|------|
| 1 | SET | `ccMsg = (HashMap)param.getData(fixedText)` // Main data map from param [-> fixedText is key] |
| 2 | SET | `heogomtList = (ArrayList)ccMsg.get("HEIGOUMOTOList")` // Merger source items list [-> "HEIGOUMOTOList"] |
| 3 | SET | `heogoskList = (ArrayList)ccMsg.get("HEIGOUSAKIList")` // Merger destination items list [-> "HEIGOUSAKIList"] |
| 4 | SET | `funcCd = (String)ccMsg.get("func_code")` // Function code: "1"=main registration, "2"=inquiry [-> "func_code"] |
| 5 | SET | `telSvcKeiNo = (String)ccMsg.get("tel_svc_kei_no")` // Telephone service contract number for eo processing [-> "tel_svc_kei_no"] |
| 6 | SET | `idoDiv = (String)ccMsg.get("ido_div")` // Disruption classification code [-> "ido_div"] |
| 7 | SET | `mansSvcKeiNo = (String)ccMsg.get("heigo_sk_svc_kei_no")` // Destination service contract number for mansion query [-> "heigo_sk_svc_kei_no"] |
| 8 | SET | `updDtmWork = null` // Update timestamp work variable |

**Block 2** — [SET] `(ServiceComponentRequestInvoker instantiation)` (L269)

| # | Type | Code |
|---|------|------|
| 1 | SET | `scCall = new ServiceComponentRequestInvoker()` // Instantiate SC invoker with log class name from parameter |

**Block 3** — [SET] `(EKK0011D020 input preparation)` (L273)

| # | Type | Code |
|---|------|------|
| 1 | SET | `ekk0011d020In` = Object[][] array |
| 2 | SET | `EKK0011D020CBSMsg.TEMPLATEID` = `"EKK0011D020"` [-> TEMPLATE_ID_EKK0011D020] |
| 3 | SET | `EKK0011D020CBSMsg.FUNC_CODE` = `funcCd` |
| 4 | SET | `EKK0011D020CBSMsg.SYSID` = `ccMsg.get("sysid")` |
| 5 | SET | `EKK0011D020CBSMsg.MSKM_SBT_CD` = `ccMsg.get("mskm_sbt_cd")` |
| 6 | SET | `EKK0011D020CBSMsg.MSKM_UK_DTM` = `ccMsg.get("mskm_uk_dtm")` |
| 7 | SET | `EKK0011D020CBSMsg.MSKM_YMD` = `ccMsg.get("mskm_ymd")` |
| 8 | SET | `EKK0011D020CBSMsg.CONSMBSN_MSKM_STAT_SKBT_CD` = `ccMsg.get("consmbsn_mskm_stat_skbt_cd")` |
| 9 | SET | `EKK0011D020CBSMsg.EKK0011D020CBSMSG1LIST` = `null` |

**Block 4** — [CALL] `(EKK0011D020 Submit Approval Registration)` (L282)

| # | Type | Code |
|---|------|------|
| 1 | CALL | `ekk0011d020Out = callSC(handle, scCall, param, fixedText, ekk0011d020In)` |
| 2 | SET | `ekk0011d020OutList = ekk0011d020Out.getCAANMsgList(EKK0011D020CBSMsg.EKK0011D020CBSMSG1LIST)` |
| 3 | SET | `mskmNo = ekk0011d020Out.getString(EKK0011D020CBSMsg.MSKM_NO)` // Application number |
| 4 | SET | `ekk0011_updDtm = ekk0011d020Out.getString(EKK0011D020CBSMsg.UPD_DTM)` // Update timestamp |
| 5 | SET | `mskmDtlNo = null` // Will be set from output list if present |

**Block 5** — [IF] `(ekk0011d020OutList != null && length > 0)` (L287)

> Extract the application detail number from the output list if it exists.

| # | Type | Code |
|---|------|------|
| 1 | SET | `mskmDtlNo = ekk0011d020OutList[0].getString(EKK0011D020CBSMsg1List.MSKM_DTL_NO)` |

**Block 6** — [SET] `(Migration guard initialization — v8.00.01)` (L304)

> Before v8.00.01, this block did not exist. Added to handle overlapping residential moves.

| # | Type | Code |
|---|------|------|
| 1 | SET | `teishiFlg = false` // Migration stop flag — if true, service in transition; skip source termination |

**Block 7** — [FOR] `(heogoskList iteration for migration check)` (L308)

> Loop through destination services to detect if any are "in transition" (usage start date = MAX date).

| # | Type | Code |
|---|------|------|
| 1 | SET | `svc_kei_no = (String)heogoskList.get(m).get("svc_kei_no")` |
| 2 | SET | `ekk0241a010In` = Object[][] [-> FUNC_CODE = `"1"`, KEY_SVC_KEI_NO = svc_kei_no] |
| 3 | CALL | `ekk0241a010Out = callSC(handle, scCall, param, fixedText, ekk0241a010In).getCAANMsgList(EKK0241A010CBSMsg.EKK0241A010CBSMSG1LIST)` |

**Block 7.1** — [IF] `(ekk0241a010Out != null && length != 0)` (L315)

| # | Type | Code |
|---|------|------|
| 1 | SET | `usuStaymd = ekk0241a010Out[0].getString(EKK0241A010CBSMsg1List.KAISEN_UCWK_USE_STAYMD)` // Line details usage start date |

**Block 7.2** — [IF] `usuStaymd != null && END_YMD_DEFAULT == "20991231"` (L318)

> If the usage start date equals the maximum date, the service is considered "in transition" (residential move pending).

| # | Type | Code |
|---|------|------|
| 1 | SET | `teishiFlg = true` // Mark as in-transition |
| 2 | EXEC | `break` // Exit loop early |

**Block 8** — [IF] `!teishiFlg` (L339)

> Skip source line termination if any destination service is in transition (overlapping move).

| # | Type | Code |
|---|------|------|
| 1 | SET | `ekk0251c050In` = Object[][] [-> FUNC_CODE = funcCd, SVC_KEI_KAISEN_UCWK_NO = heigo_mt_svc_kei_kaisen_ucwk_no, USE_ENDYMD = use_endymd, IDO_DIV = `"00076"` [-> IDO_DIV_00076], KK0251_UPD_DTM_BF = kk0251_upd_dtm_bf, EKK0251C050CBSMSG1LIST = heogomtList] |
| 2 | CALL | `msg = callSC(handle, scCall, param, fixedText, ekk0251c050In)` // Terminate source line services |

**Block 9** — [FOR] `(heogomtList iteration — process merger source items)` (L349)

> For each source item, handle service contract change/registration on the destination line.

| # | Type | Code |
|---|------|------|
| 1 | SET | `childMap = heogomtList.get(i)` |

**Block 9.1** — [IF] `teishiFlg` (L357)

> When service is in transition: update existing source service contracts instead of terminating them.

| # | Type | Code |
|---|------|------|
| 1 | SET | `ekk0241a010InDel` = Object[][] [-> FUNC_CODE = `"1"`, KEY_SVC_KEI_NO = childMap.svc_kei_no, KEY_SVC_KEI_KAISEN_UCWK_NO = heigo_mt_svc_kei_kaisen_ucwk_no] |
| 2 | CALL | `ekk0241a010OutDel = callSC(handle, scCall, param, fixedText, ekk0241a010InDel).getCAANMsgList(...)` |
| 3 | IF | `ekk0241a010OutDel != null && length != 0` |
| 4 | SET | `ekk0241c010InDel` = Object[][] [-> FUNC_CODE = funcCd, SVC_KEI_NO = childMap.svc_kei_no, KAISEN_UCWK_USE_STAYMD = from output, KAISEN_UCWK_USE_ENDYMD = use_endymd, UPD_DTM_BF = from output] |
| 5 | CALL | `callSC(handle, scCall, param, fixedText, ekk0241c010InDel)` // Update service contract |

**Block 9.2** — [SET] `(Normal processing: destination service contract query)` (L385)

| # | Type | Code |
|---|------|------|
| 1 | SET | `ekk0241a010In` = Object[][] [-> FUNC_CODE = `"1"`, KEY_SVC_KEI_NO = childMap.svc_kei_no, KEY_SVC_KEI_KAISEN_UCWK_NO = heigo_sk_svc_kei_kaisen_ucwk_no] |
| 2 | CALL | `ekk0241a010Out = callSC(...).getCAANMsgList(EKK0241A010CBSMsg.EKK0241A010CBSMSG1LIST)` |

**Block 9.3** — [IF] `(ekk0241a010Out != null && length != 0)` (L394)

> Destination service contract exists — update it.

| # | Type | Code |
|---|------|------|
| 1 | SET | `ekk0241c010In` = Object[][] [-> FUNC_CODE = funcCd, SVC_KEI_NO = childMap.svc_kei_no, KAISEN_UCWK_USE_STAYMD = mskm_ymd, KAISEN_UCWK_USE_ENDYMD = MAX_YMD `"20991231"` [-> JKKSvcConst.MAX_YMD], UPD_DTM_BF = from output] |
| 2 | CALL | `ekk0241c010Out = callSC(handle, scCall, param, fixedText, ekk0241c010In)` |
| 3 | SET | `updDtmWork = ekk0241c010Out.getString(EKK0241C010CBSMsg.UPD_DTM)` |

**Block 9.4** — [ELSE] (L416)

> Destination service contract does not exist — register new one.

| # | Type | Code |
|---|------|------|
| 1 | SET | `ekk0241d010In` = Object[][] [-> FUNC_CODE = funcCd, SVC_KEI_NO = childMap.svc_kei_no, SVC_KEI_KAISEN_UCWK_NO = heigo_sk_svc_kei_kaisen_ucwk_no] |
| 2 | CALL | `ekk0241d010Out = callSC(handle, scCall, param, fixedText, ekk0241d010In)` |
| 3 | SET | `updDtmWork = ekk0241d010Out.getString(EKK0241D010CBSMsg.UPD_DTM)` |

**Block 10** — [IF] `funcCd == "1"` (L430)

> During main registration: execute service contract line merge processing.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `execUpdSvcKeiKaisenUcwk(handle, scCall, param, fixedText, ccMsg, mskmDtlNo)` |

**Block 11** — [IF] `mansSvcKeiNo == null || length == 0` (L438)

> Fallback: use the merger source service contract number for the mansion query.

| # | Type | Code |
|---|------|------|
| 1 | SET | `mansSvcKeiNo = (String)ccMsg.get("heigo_mt_svc_kei_no")` |

**Block 12** — [SET] `(EKK0861B002 Mansion Information Query)` (L443)

| # | Type | Code |
|---|------|------|
| 1 | SET | `ekk0861b002In` = Object[][] [-> FUNC_CODE = `"2"`, KEY_SVC_KEI_NO = mansSvcKeiNo, KEY_RSV_APLY_YMD = mskm_ymd] |
| 2 | CALL | `ekk0861b002Out = callSC(...).getCAANMsgList(EKK0861B002CBSMsg.EKK0861B002CBSMSG1LIST)` |

**Block 13** — [IF] `(ekk0861b002Out != null && length > 0)` (L452)

> Extract mansion property type and equipment code from query result.

| # | Type | Code |
|---|------|------|
| 1 | SET | `mansionBukkenCd = ekk0861b002Out[0].getString(EKK0861B002CBSMsg1List.MANSION_BUKKEN_CD)` |
| 2 | SET | `tushinEquipCd = ekk0861b002Out[0].getString(EKK0861B002CBSMsg1List.MANS_TUSHIN_EQUIP_CD)` |

**Block 13.1** — [IF] `mansionBukkenCd == MANSION `"001"` OR Mezon `"002"` (L456)

> Check if property type is a mansion or mezon building.

| # | Type | Code |
|---|------|------|
| 1 | SET | `bukkenCd = mansionBukkenCd` |
| 2 | IF | `tushinEquipCd != null && length > 0` |
| 3 | SET | `equipCd = tushinEquipCd` |

**Block 14** — [SET] `(EKU0081C030 Construction Plan Line Merge)` (L468)

| # | Type | Code |
|---|------|------|
| 1 | SET | `eku0081c030In` = Object[][] [-> FUNC_CODE = funcCd, HEIGO_MT_SVC_KEI_KAISEN_UCWK_NO, HEIGO_SK_SVC_KEI_KAISEN_UCWK_NO, MANSION_BUKKEN_CD = bukkenCd, MANS_TUSHIN_EQUIP_CD = equipCd] |
| 2 | CALL | `msg = callSC(handle, scCall, param, fixedText, eku0081c030In)` |

**Block 15** — [IF] `telSvcKeiNo != null && trim().length() > 0` (L477)

> Process eo optical phone service if a telephone service contract number exists.

| # | Type | Code |
|---|------|------|
| 1 | SET | `ekk0191b050In` = Object[][] [-> FUNC_CODE = `"2"`, KEY_SVC_KEI_NO = telSvcKeiNo] |
| 2 | CALL | `ekk0191bOut = callSC(...).getCAANMsgList(EKK0191B005CBSMsg.EKK0191B005CBSMSG1LIST)` |
| 3 | SET | `svcKeiUcwkNo = ekk0191bOut[0].getString(EKK0191B005CBSMsg1List.SVC_KEI_UCWK_NO)` |
| 4 | SET | `ekk0191a010In` = Object[][] [-> FUNC_CODE = `"1"`, KEY_SVC_KEI_UCWK_NO = svcKeiUcwkNo, KEY_GENE_ADD_DTM = ekk0191bOut GENE_ADD_DTM] |
| 5 | CALL | `ekk0191aOut = callSC(...).getCAANMsgList(EKK0191A010CBSMsg.EKK0191A010CBSMSG1LIST)` |
| 6 | SET | `ekk0161a010In` = Object[][] [-> FUNC_CODE = `"2"`, KEY_SVC_KEI_UCWK_NO = svcKeiUcwkNo, KEY_RSV_APLY_YMD = mskm_ymd] |
| 7 | CALL | `ekk0161aOut = callSC(...).getCAANMsgList(EKK0161A010CBSMsg.EKK0161A010CBSMSG1LIST)` |

**Block 15.1** — [IF] `funcCd == "1"` (L496)

> During main registration: update eo optical phone details and issue service order.

| # | Type | Code |
|---|------|------|
| 1 | SET | `ekk0191c060In = setEKK0191C060(funcCd, mskmDtlNo, idoDiv, updDtmWork, ekk0161aOut[0], ekk0191aOut[0])` |
| 2 | CALL | `ekk0191c060Out = callSC(handle, scCall, param, fixedText, ekk0191c060In)` |
| 3 | SET | `updDtmWork = ekk0191c060Out.getString(EKK0191C060CBSMsg.UPD_DTM)` |
| 4 | SET | `ccMsg.put("svc_kei_no", telSvcKeiNo)` |
| 5 | CALL | `execJKKHakkoSODCC(handle, param, ccMsg, ekk0161aOut[0], ekk0191c060Out.getString(EKK0191C060CBSMsg.KK0161_GENE_ADD_DTM))` |

**Block 16** — [SET] `(Service flag initialization)` (L525)

| # | Type | Code |
|---|------|------|
| 1 | SET | `moto_svc_cd = false` // Source service flag |
| 2 | SET | `saki_svc_cd = false` // Destination service flag |
| 3 | SET | `mtSvc = (String)ccMsg.get("mt_svc")` // Merger source service type |
| 4 | SET | `skSvc = (String)ccMsg.get("sk_svc")` // Merger destination service type |

**Block 17** — [FOR] `(heogomtList iteration — service code check)` (L533)

> Loop through source items to determine if any are device provision services.

| # | Type | Code |
|---|------|------|
| 1 | SET | `childMap = heogomtList.get(i)` |
| 2 | IF | `isSvcCd(childMap)` |
| 3 | SET | `moto_svc_cd = true` |

**Block 18** — [FOR] `(heogoskList iteration — service code check)` (L575)

> Loop through destination items to determine if any are device provision services.

| # | Type | Code |
|---|------|------|
| 1 | SET | `saki_svc_cd = true` (when `isSvcCd(heogoskList.get(j))`) |

**Block 19** — [SET] `(Update timestamp setup — v7.00.00)` (L586)

| # | Type | Code |
|---|------|------|
| 1 | CALL | `setSvcUpDtm(param, updDtmWork)` // Set update timestamp stamp in work area [-> KK_COM_SVC_UP_DTM] |

**Block 20** — [IF] `!"".equals(mtSvc) && !"".equals(skSvc)` (L589)

> When merging both network and telephone services: process device deinstallation.

| # | Type | Code |
|---|------|------|
| 1 | SET | `ezm0321a010In` = Object[][] [-> FUNC_CODE = `"1"`, KEY_WORK_PARAM_ID = `KK_OYA_SKBT_KSN_UCWK` [-> `"KK_OYA_SKBT_KSN_UCWK"`]] |
| 2 | CALL | `ezm0321a010Out = callSC(...).getCAANMsgList(EZM0321A010CBSMsg.EZM0321A010CBSMSG1LIST)` |
| 3 | SET | `ekk0341b504InMoto` = Object[][] [-> FUNC_CODE = `"1"`, KEY_SVC_KEI_KAISEN_UCWK_NO = heigo_mt_svc_kei_kaisen_ucwk_no] |
| 4 | CALL | `ekk0341b504OutMoto = callSC(...).getCAANMsgList(EKK0341B504CBSMsg.EKK0341B504CBSMSG1LIST)` |
| 5 | SET | `ekk0341b504InSaki` = Object[][] [-> FUNC_CODE = `"1"`, KEY_SVC_KEI_KAISEN_UCWK_NO = heigo_sk_svc_kei_kaisen_ucwk_no] |
| 6 | CALL | `ekk0341b504OutSaki = callSC(...).getCAANMsgList(EKK0341B504CBSMsg.EKK0341B504CBSMSG1LIST)` |

**Block 20.1** — [SET] `(Multi-functional router check — ANK-2220-00-00)` (L606)

| # | Type | Code |
|---|------|------|
| 1 | SET | `ccMsg.put("isBothTakino", "0")` // Default: not both multi-functional routers |
| 2 | CALL | `kktkSvcKeiNoMoto = getTakinoKktkSvcKeiNo(ekk0341b504OutMoto)` |
| 3 | CALL | `kktkSvcKeiNoSaki = getTakinoKktkSvcKeiNo(ekk0341b504OutSaki)` |

**Block 20.2** — [IF] `kktkSvcKeiNoMoto != null && kktkSvcKeiNoSaki != null` (L616)

> If both source and destination have multi-functional routers: check contract status.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `ekk0341A010OutMoto = execEKK0341A010(handle, scCall, param, fixedText, kktkSvcKeiNoMoto, ccMsg)` |
| 2 | CALL | `ekk0341A010OutSaki = execEKK0341A010(handle, scCall, param, fixedText, kktkSvcKeiNoSaki, ccMsg)` |
| 3 | IF | `kktkSvcStatCheck(ekk0341A010OutMoto) && kktkSvcStatCheck(ekk0341A010OutSaki)` |
| 4 | SET | `ccMsg.put("isBothTakino", "1")` // Both routers under contract |

**Block 20.3** — [IF] `ezm0321a010Out != null && length > 0` (L631)

| # | Type | Code |
|---|------|------|
| 1 | SET | `pKikiCd = ezm0321a010Out[0].getString(EZM0321A010CBSMsg1List.WORK_PARAM_SETTE_VALUE)` |
| 2 | SET | `paramValue = pKikiCd.split(",")` |

**Block 20.4** — [FOR] `(paramValue loop)` (L637)

> Loop through device service codes for deinstallation.

| # | Type | Code |
|---|------|------|
| 1 | IF | `funcCd == "2"` |
| 2 | EXEC | `break` // Skip during inquiry mode |
| 3 | IF | `JKKSvcConst.KKTK_SVC_CD_ONU == "C012"` (paramValue[i]) |
| 4 | EXEC | `continue` // Skip ONU from deinstallation [v8.00.03] |
| 5 | IF | `ekk0341b504OutMoto != null && ekk0341b504OutSaki != null` |
| 6 | SET | `ccMsg.put("mskmDtlNo", mskmDtlNo)` |
| 7 | CALL | `execKikiDsl(handle, scCall, param, fixedText, ekk0341b504OutMoto, ekk0341b504OutSaki, paramValue[i])` |

**Block 21** — [SET] `(EKK0341B504 Device Provision Service Consent Query — post-loop)` (L655)

| # | Type | Code |
|---|------|------|
| 1 | SET | `ekk0341b504In` = Object[][] [-> FUNC_CODE = `"1"`, KEY_SVC_KEI_KAISEN_UCWK_NO = childMap.svc_kei_kaisen_ucwk_no] |
| 2 | CALL | `ekk0341b504Out = callSC(...).getCAANMsgList(EKK0341B504CBSMsg.EKK0341B504CBSMSG1LIST)` |

**Block 22** — [IF] `(ekk0341b504Out != null && length > 0)` (L663)

> Loop through device service items and update each one.

| # | Type | Code |
|---|------|------|
| 1 | FOR | Loop: k = 0 to ekk0341b504Out.length |
| 2 | IF | `funcCd == "2"` |
| 3 | EXEC | `break` |
| 4 | SET | `kktkSvcCD = ekk0341b504Out[k].getString(EKK0341B504CBSMsg1List.KKTK_SVC_CD)` |
| 5 | IF | `moto_svc_cd && saki_svc_cd && kktkSvcCD == "C012"` [JKKSvcConst.KKTK_SVC_CD_ONU] |
| 6 | EXEC | `continue` // Skip ONU when both source and destination are device provision services |
| 7 | SET | `kktkSvcStat = ekk0341b504Out[k].getString(EKK0341B504CBSMsg1List.KKTK_SVC_KEI_STAT)` |
| 8 | IF | `kktkSvcStat == "910"` [CD00056_STAT_DSLZUMI] OR `kktkSvcStat == "920"` [CD00056_STAT_CANCELZUMI] |
| 9 | EXEC | `continue` // Skip already terminated or canceled services [OM-2013-0004076] |
| 10 | SET | `ekk0341c320In` = Object[][] [-> FUNC_CODE = funcCd, MSKM_DTL_NO = mskmDtlNo [v8.00.03], KKTK_SVC_KEI_NO, SVC_KEI_KAISEN_UCWK_NO, RSV_APLY_YMD, IDO_DIV, UPD_DTM_BF] |
| 11 | CALL | `ekk0341c320Out = callSC(handle, scCall, param, fixedText, ekk0341c320In)` |
| 12 | SET | `updDtmWork = ekk0341c320Out.getString(EKK0191C060CBSMsg.UPD_DTM)` |

**Block 23** — [SET] `(Progress Registration preparation)` (L725)

| # | Type | Code |
|---|------|------|
| 1 | SET | `prgMap = heogomtList.get(0)` // First source item |
| 2 | SET | `meisaiMap = new HashMap()` |
| 3 | SET | `prgList = new ArrayList()` |
| 4 | SET | `meisaiMap.put("ido_rsn_cd", ccMsg.get("ido_rsn_cd"))` |
| 5 | SET | `prgList.add(meisaiMap)` |

**Block 24** — [SET] `(EKK1091D010 Progress Registration)` (L732)

| # | Type | Code |
|---|------|------|
| 1 | SET | `ekk1091d010In` = Object[][] [-> FUNC_CODE = funcCd, MSKM_DTL_NO = mskmDtlNo, SVC_KEI_NO = prgMap.svc_kei_no, SVC_KEI_KAISEN_UCWK_NO = prgMap.svc_kei_kaisen_ucwk_no, IDO_DIV = idoDiv, IDO_DTM = JPCBPCommon.getSysDateTimeStamp(), PRG_STAT = ccMsg.prg_stat, EKK1091D010CBSMSG1LIST = prgList] |
| 2 | CALL | `msg = callSC(handle, scCall, param, fixedText, ekk1091d010In)` |

**Block 25** — [IF] `funcCd == "1"` (L745)

> Post-application request during main registration.

| # | Type | Code |
|---|------|------|
| 1 | SET | `ekk0021c060In` = Object[][] [-> FUNC_CODE = funcCd, MSKM_DTL_NO = mskmDtlNo, UPD_DTM_BF = ekk0011_updDtm, KZKWRK_REQYMD = mskm_ymd, IDO_DIV = idoDiv] |
| 2 | CALL | `msg = callSC(handle, scCall, param, fixedText, ekk0021c060In)` |

**Block 26** — [IF] `funcCd == "1"` (L760, v6.00.00)

> Sort number registration during main registration.

| # | Type | Code |
|---|------|------|
| 1 | FOR | Loop: j = 0 to heogomtList.size |
| 2 | SET | `mtChildMap = heogomtList.get(j)` |
| 3 | SET | `param.setData(FIXED_KEY_SEIRINO_HTB_CHG_CC, new HashMap<String, Object>())` |
| 4 | SET | `outMap = (HashMap)param.getData(FIXED_KEY_SEIRINO_HTB_CHG_CC)` |
| 5 | SET | `outMap.put("sysid", ccMsg.get("sysid"))` |
| 6 | SET | `outMap.put("svc_kei_no", mtChildMap.get("svc_kei_no"))` |
| 7 | SET | `outMap.put("seiri_no", ccMsg.get("seiri_no"))` |
| 8 | SET | `seiriNoHtbChgCC = new JKKSeiriNoHtbChgCC()` |
| 9 | CALL | `seiriNoHtbChgCC.seiriNoHtbChg(handle, param, FIXED_KEY_SEIRINO_HTB_CHG_CC)` |

**Block 27** — [IF] `funcCd == "1"` (L780, OM-2014-0002110)

> Order settings adjustment during main registration.

| # | Type | Code |
|---|------|------|
| 1 | FOR | Loop: j = 0 to heogomtList.size |
| 2 | SET | `mtChildMap = heogomtList.get(j)` |
| 3 | CALL | `ekk1041b001Out = execEKK1041B001(handle, scCall, param, fixedText, mtChildMap.svc_kei_no)` |
| 4 | IF | `ekk1041b001Out != null && length > 0` |
| 5 | FOR | Loop: i = 0 to ekk1041b001Out.length |
| 6 | SET | `kaisenUcwkNo = ekk1041b001Out[i].getString(EKK1041B001CBSMsg1List.SVC_KEI_KAISEN_UCWK_NO)` |
| 7 | IF | `kaisenUcwkNo != null && !"".equals(kaisenUcwkNo)` |
| 8 | SET | `ekk1041c010In = setEKK1041C010(funcCd, heigo_sk_svc_kei_kaisen_ucwk_no, ekk1041b001Out[i])` |
| 9 | CALL | `ekk1041c010Out = callSC(handle, scCall, param, fixedText, ekk1041c010In)` |
| 10 | SET | `updDtmWork = ekk1041c010Out.getString(EKK0241C010CBSMsg.UPD_DTM)` |

**Block 28** — [CALL] `(execWrisvcAutoAply)` (L815)

| # | Type | Code |
|---|------|------|
| 1 | CALL | `execWrisvcAutoAply(handle, param, ccMsg, mskmNo)` |

**Block 29** — [RETURN] (L817)

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

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `heigo-moto` (引越元) | Field | Merger source — the original service contract line from which services are transferred (the "before move" line) |
| `heigo-saki` (引越先) | Field | Merger destination — the target service contract line to which services are transferred (the "after move" line) |
| `mskm_no` (申請番号) | Field | Application number — unique identifier for the approval registration record created during the merger process |
| `mskm_dtl_no` (申請詳細番号) | Field | Application detail number — sub-identifier within an approval registration for specific detail records |
| `func_code` | Field | Function code that determines processing mode: `"1"` = main registration (full lifecycle), `"2"` = provisional/inquiry (partial processing) |
| `svc_kei_no` (サービス契約番号) | Field | Service contract number — unique identifier for a service contract record (used for both source and destination services) |
| `svc_kei_kaisen_ucwk_no` (サービス契約回線内装番号) | Field | Service contract line interior number — internal numbering for the line interior portion of a service contract |
| `ido_div` (異動区分) | Field | Disruption/movement classification code — categorizes the type of service change (e.g., `"00076"` for line merger information merge) |
| `tel_svc_kei_no` | Field | Telephone service contract number — the service contract number specifically for eo optical phone service |
| `teishiFlg` (停止フラグ) | Field | Stop flag — when `true`, indicates that at least one destination service is "in transition" (residential move pending), causing the method to skip source line termination |
| `mskm_ymd` (申請年月日) | Field | Application date (year-month-day) — the effective date for the approval registration |
| `use_endymd` | Field | Usage end date — the date when the source service usage ends |
| `upd_dtm` (更新年月日時分秒) | Field | Update timestamp — system timestamp of the last update to a record |
| `bkken_cd` (物件コード) | Field | Property code — identifies the type of building (mansion, mezon, etc.) |
| `teishi_flg` (停止フラグ) | Field | Stop flag — set to true when a destination service is detected as being "in transition" (residential move data present) |
| SOD | Acronym | Service Order Data — telecom order fulfillment entity used to trigger service provisioning workflows |
| FTTH | Business term | Fiber To The Home — fiber-optic internet service offered by K-Opticom |
| eo Hikari | Business term | eo Optical Phone — K-Opticom's fiber-optic telecommunications service brand |
| KKTK | Acronym | K-Opticom Telecommunications Kit — device provision services (routers, set-top boxes, ONU equipment) |
| ONU | Business term | Optical Network Unit — terminal equipment for fiber-optic broadband service; excluded from deinstallation processing |
| DSL | Acronym | Digital Subscriber Line — legacy telephone line technology; deinstallation processing removes DSL line agreements |
| Takino (多機能ルーター) | Business term | Multi-functional router — broadband router equipment provided with device provision services |
| Mansion (マンション) | Field | Apartment building type — property code `"001"` |
| Mezon (メゾン) | Field | Mezon building type — property code `"002"`, a mid-sized apartment style |
| KK_COM_SVC_UP_DTM | Field | Service contract update timestamp key — internal key for storing update timestamps in the param work area |
| KK_OYA_SKBT_KSN_UCWK | Field | Business parameter key for device provisioning parent contract identification — used to query business parameter settings |
| SeiriNoHtbChgCC (整理番号引当変更CC) | CC | Sort number assignment CC — a separate Common Component that handles sort number registration for service contracts |
| execWrisvcAutoAply | Method | Discount auto-application CC — applies automatic discounts to the service contract during the merger operation |
