# Business Logic - JFUSetVariTsushinKikiMskmCC.setKkOpSvcKeiToroku() [405 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | com.fujitsu.futurity.bp.custom.common.JFUSetVariTsushinKikiMskmCC |
| Layer | CC/Common Component - shared business logic for equipment registration |
| Module | common (Package: com.fujitsu.futurity.bp.custom.common) |

## 1. Role

### JFUSetVariTsushinKikiMskmCC.setKkOpSvcKeiToroku()

This method performs **Equipment Option Service Contract Registration Processing** (equipment option service contract registration) within the K-Opticom customer base system. It registers, queries, and activates equipment option service contracts for routers and VA (Virtual Access) equipment for FTTH, Mail, and ENUM services.

The method implements a **routing/dispatch design pattern**. Based on whether the retained router is a multifunction router (determined by inParamOwnTknRouterKind and inParamRouterkinoNm), it branches into two workflows: (1) **non-multifunc / low-speed multifunc router path** - registers a new equipment option contract, searches for existing multifunc phone contracts, and conditionally activates; (2) **dedicated multifunc router path** - queries existing contracts and performs price plan changes (EKK2811C250/C260 for in-service, EKK2811C240 for processing) before activating.

Called from three locations in JFUSetVariTsushinKikiMskmCC - line 1183 (low-speed multifunc ONU exchange), line 1334 (standard contract loop), and line 1456 (multifunc router application). May register up to three contracts per invocation: router, multifunc phone, and VA.

### Design Patterns
- **Routing/Dispatch**: Dispatches based on router type (wired vs wireless, multifunc vs non-multifunc)
- **Delegation**: Delegates to executeSC, setInMapKkOpSvcKeiToroku, setInMapKkOpSvcKeiShosa, setInMapKkOpSvcKeiListShokai, hakkoSOD, setNewRtPcrs
- **Builder**: Template-based assembly via initData() + setInMap* builder methods

### Role in the Larger System
Sits between screen-level workflow (JFUSetVariTsushinKikiMskmCC) and SC layer. Assembles input data for equipment option service contracts, invokes SC handlers, returns updated timestamps for downstream processing. Invoked during equipment registration lifecycle.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["setKkOpSvcKeiToroku"])
    START --> IN_GET["Get inMap from param.getData(fixedText)"]
    IN_GET --> WORK_GET["Get workLst from inMap, get first element as inParamMap"]
    WORK_GET --> IN_EXTRACT["Extract: inParamSysId, inParamIdoDiv, inParamSvkeiKaisenUwNo, inParamOwnTknRouterKind, inParamhmpinKktkSvcKeiNoVa, inParamRouterkinoNm"]
    IN_EXTRACT --> ROUTER_CHECK{"ROUTER_KINO_YUSEN equals inParamRouterkinoNm?"}
    ROUTER_CHECK -->|"Has wired router"| WIRE_PCRS["Set pcrsCd=G01, pplanCd=PG0101"]
    ROUTER_CHECK -->|"No wired router"| WIRELESS_PCRS["Set pcrsCd=G02, pplanCd=PG0201"]
    WIRE_PCRS --> SET_NEW_RTPCRS["Call setNewRtPcrs(tempData, pcrsCd)"]
    WIRELESS_PCRS --> SET_NEW_RTPCRS
    SET_NEW_RTPCRS --> OWN_TKN_CHECK{"isNull(inParamOwnTknRouterKind) OR OWN_TKN_RT_KIND_0 equals inParamOwnTknRouterKind?"}
    OWN_TKN_CHECK -->|"True: Non-multifunc or low-speed"| NON_MF["Non-multifunc / low-speed multifunc router branch"]
    OWN_TKN_CHECK -->|"False: Dedicated multifunc router"| DED_MF["Dedicated multifunc router branch"]
    NON_MF --> NON_INIT["initData(param, fixedText, IN_COLUMN_LIST_35)"]
    NON_INIT --> NON_SETINMAP["setInMapKkOpSvcKeiToroku - register router equipment"]
    NON_SETINMAP --> NON_EXECSVC["executeSC - Equipment option service contract registration"]
    NON_EXECSVC --> NON_GETVAL["getTemplateValue for lastUpdDtm and kkopSvcKeiNoRT"]
    NON_GETVAL --> NON_SEARCH["initData, setInMapKkOpSvcKeiListShokai, ignoreSearchError, executeSC - search existing contracts"]
    NON_SEARCH --> NON_LOOP["Loop through template list to extract existing multifunc router data"]
    NON_LOOP --> NON_ISNULL_CHECK{"isNull(kkOpSvcKeiNoTEL)?"}
    NON_ISNULL_CHECK -->|"Null: No multifunc phone"| NON_RT_SEARCH["initData, setInMapKkOpSvcKeiShosa, executeSC - router inquiry"]
    NON_RT_SEARCH --> NON_RT_GET["getTemplateValue for lastUpdDtm, kkOpSvcKeiNoRT"]
    NON_ISNULL_CHECK -->|"Not null: Multifunc phone exists"| NON_MULTI_EXISTS["Multifunc phone exists branch"]
    NON_MULTI_EXISTS --> NON_STAT_CHECK{"svcKeiStatNet equals 020 OR kktkSvcKeiStat equals 020?"}
    NON_STAT_CHECK -->|"Status 020: Inquiry done"| NON_STAT020["initData, setInMapKkOpSvcKeiShosa, executeSC, getTemplateValue"]
    NON_STAT_CHECK -->|"Status 30/100: In service, contract ended"| NON_STAT30["initData, setInMapKkOpSvcKeiShosa, executeSC EKK2811C050, getTemplateValue"]
    NON_STAT020 --> NON_CONTRACT_CHECK{"kktkSvcKeiStat equals 100 AND svcKeiStatNet equals 100?"}
    NON_STAT30 --> NON_CONTRACT_CHECK
    NON_CONTRACT_CHECK -->|"Yes: In service"| NON_CONTRACT["initData, setInMapKktkSvcKeiUqSearch, executeSC, getOpeDate comparison, setEKK2811C070, executeSC EKK2811C070"]
    NON_CONTRACT_CHECK -->|"No"| NON_SKIP_CONTRACT["Skip contract operations"]
    NON_RT_GET --> NON_SKIP_CONTRACT
    NON_SKIP_CONTRACT --> NON_SHUKKA_CHECK{"isShukkaZumi(kikiSeizoNo)?"}
    NON_SHUKKA_CHECK -->|"True: Shipped"| NON_SOD_REG["printDebugLog, hakkoSOD with SOD code 402"]
    NON_SHUKKA_CHECK -->|"False"| NON_NO_SOD["Skip SOD registration"]
    NON_SOD_REG --> NON_VA_CHECK{"isNull(inParamhmpinKktkSvcKeiNoVa)?"}
    NON_NO_SOD --> NON_VA_CHECK
    NON_VA_CHECK -->|"Not null: VA equipment retained"| VA_BRANCH["VA equipment branch"]
    NON_VA_CHECK -->|"Null"| END_RETURN["Return lastUpdDtm"]
    VA_BRANCH --> VA_PCRS_CHECK{"pcrsCdTel equals A31?"}
    VA_PCRS_CHECK -->|"Yes"| VA_PCRS_G03["Set pcrsCdVa=G03, pplanCdVa=PG0301"]
    VA_PCRS_CHECK -->|"Check A32"| VA_A32_CHECK{"pcrsCdTel equals A32?"}
    VA_A32_CHECK -->|"Yes"| VA_PCRS_G04["Set pcrsCdVa=G04, pplanCdVa=PG0401"]
    VA_A32_CHECK -->|"No"| VA_DEFAULT["Keep empty values"]
    VA_PCRS_G03 --> VA_REG["initData, setInMapKkOpSvcKeiToroku - register VA, executeSC, getTemplateValue"]
    VA_PCRS_G04 --> VA_REG
    VA_DEFAULT --> VA_REG
    VA_REG --> VA_SEARCH["initData, setInMapKkOpSvcKeiShosa, executeSC - VA inquiry"]
    VA_SEARCH --> VA_SKIP_CANCEL["Skip cancel/termination processing for VA"]
    VA_SKIP_CANCEL --> END_RETURN
    DED_MF --> DED_SEARCH["initData, setInMapKkOpSvcKeiListShokai, ignoreSearchError, executeSC - search existing contracts"]
    DED_SEARCH --> DED_LOOP["Loop through template list to extract multifunc router data"]
    DED_LOOP --> DED_STAT_CHECK{"rtKkopSvcKeiStat equals 100?"}
    DED_STAT_CHECK -->|"In service"| DED_PCRS_HENKO["initData, setInMapKkOpSvcKeiPcrsHenko, executeSC EKK2811C250, initData, setInMapKkOpSvcKeiPcrsHenkoKakutei, executeSC EKK2811C260"]
    DED_STAT_CHECK -->|"Not in service"| DED_HENKO_KATUDU["initData, setEKK2811C240, executeSC - contract processing price plan change"]
    DED_PCRS_HENKO --> DED_CONTRACT_CHECK{"kktkSvcKeiStat equals 100 AND svcKeiStatNet equals 100?"}
    DED_HENKO_KATUDU --> DED_CONTRACT_CHECK
    DED_CONTRACT_CHECK -->|"Yes"| DED_CONTRACT["initData, setInMapKktkSvcKeiUqSearch, executeSC, setEKK2811C070, executeSC EKK2811C070"]
    DED_CONTRACT_CHECK -->|"No"| DED_SKIP_CONTRACT["Skip contract operations"]
    DED_SKIP_CONTRACT --> DED_SHUKKA_CHECK{"isShukkaZumi(kikiSeizoNo)?"}
    DED_SHUKKA_CHECK -->|"True"| DED_SOD_REG["printDebugLog, hakkoSOD with SOD code 418"]
    DED_SHUKKA_CHECK -->|"False"| DED_NO_SOD["Skip SOD registration"]
    DED_SOD_REG --> END_RETURN
    DED_NO_SOD --> END_RETURN
```

**Constant Resolution:**

| Constant | Actual Value | Business Meaning |
|----------|-------------|-----------------|
| ROUTER_KINO_YUSEN | 無線ルーター機能 | Wireless router function |
| OWN_TKN_RT_KIND_0 | 0 | Low-speed multifunc router |
| IN_PARAM_SYSID | kk0341_sysid | IN item: SYSID (customer base system ID) |
| IN_PARAM_IDO_DIV | ido_div | IN item: Displacement type (migration status) |
| KKTK_SVKEI_ADD_LIST | kktk_svkei_add_list | Registered equipment list |
| CD00134_G01 | G01 | Price plan: Wired router function |
| CD00134_G02 | G02 | Price plan: Wireless router function |
| CD00565_PG0101 | PG0101 | Pricing plan: Wired router function |
| CD00565_PG0201 | PG0201 | Pricing plan: Wireless router function |
| CD00134_A31 | A31 | Phone adapter function (No. 1) |
| CD00134_A32 | A32 | Phone adapter function (No. 2) |
| CD00134_G03 | G03 | Price plan: Phone adapter (No. 1) |
| CD00134_G04 | G04 | Price plan: Phone adapter (No. 2) |
| CD00565_PG0301 | PG0301 | Pricing plan: Phone adapter (No. 1) |
| CD00565_PG0401 | PG0401 | Pricing plan: Phone adapter (No. 2) |
| CD00037_020 | 020 | Service contract status: Inquiry completed (net) |
| CD00037_100 | 100 | Service contract status: In service (net) |
| CD00056_020 | 020 | Equipment provision status: Inquiry completed |
| CD00056_030 | 030 | Equipment provision status: Contract ended |
| CD00056_100 | 100 | Equipment provision status: In service |
| CD00002_0 | 0 | Same day |
| CD00002_1 | 1 | Future date |
| KKOP_SVC_KEI_STAT_MUKO | 910, 920 | Invalid equipment option contract status |
| CD01616_910 | 910 | Contract status: Cancel request |
| CD01616_920 | 920 | Contract status: Cancelled |
| CD01105_402 | 402 | SOD code: Multifunc router setup (registration) |
| CD01105_418 | 418 | SOD code: Multifunc router setup (wireless/wired change) |

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | handle | SessionHandle | Database session handle for SC operations. Carries transaction database connection context. |
| 2 | param | IRequestParameterReadWrite | Request parameter object for passing input/output data between screen and SC layer. |
| 3 | fixedText | String | Service message identifier used as lookup key for input parameters in the request map. |
| 4 | kktkSvcKeiNo | String | Equipment provision service contract number (unique identifier). |
| 5 | seikyKeiNoNet | String | Billing contract number for net service (internet service line). |
| 6 | seikyKeiNoTel | String | Billing contract number for phone service (telephone service line). |
| 7 | mskmDtlNo | String | Application detail number (specific line item within a service application). |
| 8 | lastUpdDtm | String | Last update datetime. Updated during processing for optimistic locking. |
| 9 | pcrsCdTel | String | Pricing course code for phone. Determines VA equipment pricing (A31=adapter No.1, A32=adapter No.2). |
| 10 | svcKeiStatNet | String | Service contract status for net (020=inquiry done, 100=in service). |
| 11 | tempData | HashMap | Work data map for inter-function communication. Updated by setNewRtPcrs. |

### External/Instance Fields Read
No instance fields accessed. Uses static template keys (TEMP_TEMPLATE_KEY_35, TEMPLATE_ID_35, IN_COLUMN_LIST_35, etc.).

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | JACBatCommon.isNull | JACBatCommon | - | Null check utility |
| - | JACBatCommon.printDebugLog | JACBatCommon | - | Debug logging |
| - | JACbatDebugLogUtil.printDebugLog | JACbatDebugLog | - | Debug logging |
| - | JACbatRknBusinessUtil.isNull | JACbatRknBusiness | - | Null check utility |
| - | JCHbatSeikyKaknoBusinessUtil.isNull | JCHbatSeikyKaknoBusiness | - | Null check utility |
| - | JCKLcsRenkeiUtil.printDebugLog | JCKLcsRenkei | - | Debug logging |
| - | JKKHttpCommunicator.printDebugLog | JKKHttpCommunicator | - | Debug logging |
| - | JBSbatACInsentetivePrcInfoSaksei.isNull | JBSbatACInsentetivePrcInfoSaksei | - | Null check utility |
| - | JBSbatAKCHSeikyYsoInfMake.isNull | JBSbatAKCHSeikyYsoInfMake | - | Null check utility |
| - | JBSbatKKCashPostAddMail.printDebugLog | JBSbatKKCashPostAddMail | - | Debug logging |
| - | JBSbatKKOpsvkeiDelTrgtChsht.initData | JBSbatKKOpsvkeiDelTrgtChsht | - | Data initialization |
| R | JCCBPCommon.getOpeDate | JCCBPCommon | - | Operational date retrieval |
| - | JFUBaseCC.executeSC | JFUBaseCC | - | Base class SC executor |
| - | JFUBaseCC.ignoreSearchError | JFUBaseCC | - | Suppress search errors |
| - | JFUBaseCC.initData | JFUBaseCC | - | Base class data init |
| - | JFUBaseUtil.executeSC | JFUBaseUtil | - | Utility SC executor |
| - | JFUBaseUtil.ignoreSearchError | JFUBaseUtil | - | Suppress search errors |
| - | JFUBaseUtil.initData | JFUBaseUtil | - | Utility data init |
| - | JFUBPCommon.executeSC | JFUBPCommon | - | BP layer SC executor |
| R | JFUBaseCC.getMaxTempTempleteKey | JFUBaseCC | - | Template key retrieval |
| R | JFUBaseCC.getTemplateList | JFUBaseCC | - | Template list retrieval |
| R | JFUBaseCC.getTemplateListValue | JFUBaseCC | - | Template list value retrieval |
| R | JFUBaseCC.getTemplateValue | JFUBaseCC | - | Template value retrieval |
| R | JFUBaseUtil.getMaxTempTempleteKey | JFUBaseUtil | - | Template key retrieval |
| R | JFUBaseUtil.getTemplateList | JFUBaseUtil | - | Template list retrieval |
| R | JFUBaseUtil.getTemplateListValue | JFUBaseUtil | - | Template list value retrieval |
| R | JFUBaseUtil.getTemplateValue | JFUBaseUtil | - | Template value retrieval |

### SC Code Calls (Inferred from Template IDs)

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| C | executeSC (Template ID 35) | EKK2811D010SC | KK_T_OPSVKEI | Equipment option service contract registration (router) |
| R | executeSC (Template ID KKOP_SVKEI_LIST_SHOKAI) | EKK2811B503SC | KK_T_OPSVKEI | Equipment option service contract list inquiry (front) |
| R | executeSC (Template ID 36) | EKK2811C030SC | KK_T_OPSVKEI | Equipment option service contract inquiry (router) |
| U | executeSC (Template ID EKK2811C050) | EKK2811C050SC | KK_T_OPSVKEI | Equipment option service contract contract completion |
| R | executeSC (Template ID 27) | EKK0341A010SC | KK_T_KKTK_SVC_KEI | Equipment provision service contract unique inquiry |
| C | executeSC (Template ID EKK2811C070) | EKK2811C070SC | KK_T_OPSVKEI | Equipment option service contract start (activation) |
| C | executeSC (VA path, Template ID 35) | EKK2811D010SC | KK_T_OPSVKEI | Equipment option service contract registration (VA) |
| R | executeSC (VA path, Template ID 36) | EKK2811C030SC | KK_T_OPSVKEI | Equipment option service contract inquiry (VA) |
| U | executeSC (Template ID 38) | EKK2811C250SC | KK_T_OPSVKEI | Equipment option service contract price plan change |
| U | executeSC (Template ID 39) | EKK2811C260SC | KK_T_OPSVKEI | Equipment option service contract price plan change confirmation |
| U | executeSC (Template ID EKK2811C240) | EKK2811C240SC | KK_T_OPSVKEI | Equipment option service contract processing-in-progress price plan change |
| C | hakkoSOD (SOD code 402) | - | SOD | Service order data registration (multifunc router setup/registration) |
| C | hakkoSOD (SOD code 418) | - | SOD | Service order data registration (multifunc router wireless/wired change) |

### Template ID to SC Code Mapping

| Template ID | Inferred SC Code | SC Business Meaning |
|-------------|-----------------|---------------------|
| EKK2811D010 | EKK2811D010SC | Equipment option service contract registration |
| EKK2811C030 | EKK2811C030SC | Equipment option service contract inquiry |
| EKK2811C050 | EKK2811C050SC | Equipment option service contract contract completion |
| EKK2811C070 | EKK2811C070SC | Equipment option service contract start |
| EKK2811C240 | EKK2811C240SC | Processing-in-progress price plan change |
| EKK2811C250 | EKK2811C250SC | Price plan change |
| EKK2811C260 | EKK2811C260SC | Price plan change confirmation |
| EKK2811B503 | EKK2811B503SC | Equipment option contract list inquiry |
| EKK0341A010 | EKK0341A010SC | Equipment provision contract unique inquiry |

### Entity/DB Tables
- **KK_T_OPSVKEI**: Equipment Option Service Contract table (via EKK2811* CBS messages)
- **KK_T_KKTK_SVC_KEI**: Equipment Provision Service Contract table (via EKK0341* CBS messages)
- **SOD**: Service Order Data table (via hakkoSOD calls)

## 5. Dependency Trace

### Caller Analysis (3 callers within JFUSetVariTsushinKikiMskmCC)

| # | Caller | Call Chain |
|---|--------|-----------|
| 1 | JFUSetVariTsushinKikiMskmCC (line 1183) | setKkOpSvcKeiToroku called from main processing during low-speed multifunc router ONU exchange work |
| 2 | JFUSetVariTsushinKikiMskmCC (line 1334) | setKkOpSvcKeiToroku called from equipment provision service contract loop iteration |
| 3 | JFUSetVariTsushinKikiMskmCC (line 1456) | setKkOpSvcKeiToroku called from multifunc router application processing |

### Terminal Operations

| # | Terminal Operation | Type | Details |
|---|-------------------|------|---------|
| 1 | executeSC EKK2811D010SC | C | Equipment option service contract registration (router/VA) |
| 2 | executeSC EKK2811B503SC | R | Equipment option contract list inquiry |
| 3 | executeSC EKK2811C030SC | R | Equipment option contract inquiry |
| 4 | executeSC EKK2811C050SC | U | Equipment option contract contract completion |
| 5 | executeSC EKK0341A010SC | R | Equipment provision contract unique inquiry |
| 6 | executeSC EKK2811C070SC | C | Equipment option contract start |
| 7 | executeSC EKK2811C250SC | U | Equipment option price plan change |
| 8 | executeSC EKK2811C260SC | U | Price plan change confirmation |
| 9 | executeSC EKK2811C240SC | U | Processing-in-progress price plan change |
| 10 | hakkoSOD (SOD 402/418) | C | Service order data registration |
| 11 | getTemplateValue | R | Template value retrieval |
| 12 | getMaxTempTempleteKey | R | Template key retrieval |
| 13 | getTemplateList | R | Template list retrieval |
| 14 | setNewRtPcrs | - | Route pricing course code setup |
| 15 | printDebugLog | - | Debug logging |
| 16 | isShukkaZumi | - | Shipped status check |
| 17 | JCCBPCommon.getOpeDate | R | Operational date retrieval |

### Data Flow
Screen/Workflow (JFUSetVariTsushinKikiMskmCC) -> setKkOpSvcKeiToroku -> executeSC (EKK2811*/EKK0341A010) -> Database (KK_T_OPSVKEI, KK_T_KKTK_SVC_KEI) -> SOD registration.

## 6. Per-Branch Detail Blocks

**Block 1** - [INITIALIZATION] (L2412-2430)

> Extract input parameters and determine router pricing course code.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `inMap = param.getData(fixedText)` |
| 2 | SET | `workLst = (ArrayList<Object>)inMap.get(KKTK_SVKEI_ADD_LIST)` |
| 3 | SET | `inParamMap = (HashMap)workLst.get(I_ZERO)` |
| 4 | SET | `inParamSysId = inParamMap.get(IN_PARAM_SYSID)` [-> "kk0341_sysid"] |
| 5 | SET | `inParamIdoDiv = inParamMap.get(IN_PARAM_IDO_DIV)` [-> "ido_div"] |
| 6 | SET | `inParamSvkeiKaisenUwNo = inMap.get("svc_kei_kaisen_ucwk_no")` |
| 7 | SET | `inParamOwnTknRouterKind = inMap.get("own_tkn_router_kind")` |
| 8 | SET | `inParamhmpinKktkSvcKeiNoVa = inMap.get("hmpin_kktk_svc_kei_no_va")` |
| 9 | SET | `inParamRouterkinoNm = inMap.get("router_kino_nm")` |
| 10 | SET | `pcrsCd = ""`, `pplanCd = ""` |

**Block 1.1** - [IF] `ROUTER_KINO_YUSEN.equals(inParamRouterkinoNm)` (L2432-2444)

| # | Type | Code |
|---|------|------|
| 1 | IF | `ROUTER_KINO_YUSEN.equals(inParamRouterkinoNm)` [="無線ルーター機能"] |
| 2 | SET | `pcrsCd = "G01"`, `pplanCd = "PG0101"` // Wired router |
| 3 | ELSE | |
| 4 | SET | `pcrsCd = "G02"`, `pplanCd = "PG0201"` // Wireless router |
| 5 | CALL | `setNewRtPcrs(tempData, pcrsCd)` |

**Block 2** - [IF] `isNull(inParamOwnTknRouterKind) || OWN_TKN_RT_KIND_0.equals(...)` (L2448-2639)

> Non-multifunc / low-speed multifunc router path. Registers new contracts and conditionally activates.

| # | Type | Code |
|---|------|------|
| 1 | IF | `isNull(inParamOwnTknRouterKind) || OWN_TKN_RT_KIND_0.equals(...)` [="0"] |

**Block 2.1** - [NON-MULTIFUNC ROUTER BRANCH] (L2453-2641)

| # | Type | Code |
|---|------|------|
| 1 | CALL | `initData(param, fixedText, IN_COLUMN_LIST_35)` // Reset for router registration |
| 2 | CALL | `setInMapKkOpSvcKeiToroku(param, fixedText, KK2801_KKOP_SVC_CD_G01, pcrsCd, pplanCd, kktkSvcKeiNo, inParamSysId, mskmDtlNo, inParamIdoDiv, seikyKeiNoNet, KK2811_KIKI_RNTAI_KEI_CHGECHU_FLG_0, lastUpdDtm)` |
| 3 | CALL | `executeSC(..., TEMPLATE_ID_35, ...)` // Execute registration SC |
| 4 | SET | `lastUpdDtm = getTemplateValue(...)` // Retrieve update timestamp |
| 5 | SET | `kkopSvcKeiNoRT = getTemplateValue(...)` // Retrieve new contract number |
| 6 | CALL | `initData(param, fixedText, IN_COLUMN_LIST_KKOP_SVKEI_LIST_SHOKAI)` // Reset for multifunc search |
| 7 | CALL | `setInMapKkOpSvcKeiListShokai(param, fixedText, inParamSysId, inParamSvkeiKaisenUwNo)` |
| 8 | CALL | `ignoreSearchError(param, fixedText)` |
| 9 | CALL | `executeSC(..., TEMPLATE_ID_KKOP_SVKEI_LIST_SHOKAI, ...)` // Execute search SC |
| 10 | SET | `kkOpSvcKeiNoTEL = null`, `taknkikiModelCd = null`, `kikiSeizoNo = null`, `kktkSvcKeiStat = null` |

**Block 2.2** - [FOR LOOP] Extract existing multifunc router data (L2490-2515)

| # | Type | Code |
|---|------|------|
| 1 | FOR | `for (HashMap dataMap : getTemplateList(..., TEMP_TEMPLATE_KEY_KKOP_SVKEI_LIST_SHOKAI, TEMPLATE_ID_DETAIL_KKOP_SVKEI_LIST_SHOKAI))` |
| 2 | SET | `kkopSvcKeiStat = dataMap.get(EKK2811B503CBSMsg1List.KKOP_SVC_KEI_STAT)` |
| 3 | IF | `KKOP_SVC_KEI_STAT_MUKO.contains(kkopSvcKeiStat)` [910, 920] -> continue |
| 4 | SET | `kkopSvcCd = dataMap.get(EKK2811B503CBSMsg1List.KKOP_SVC_CD)` |
| 5 | SET | `kktkSvcKeiNoKkop = dataMap.get(EKK2811B503CBSMsg1List.KKTK_SVC_KEI_NO)` |
| 6 | IF | `!kktkSvcKeiNoKkop.equals(kktkSvcKeiNo)` -> `inParamhmpinKktkSvcKeiNoVa = kktkSvcKeiNo`, continue |
| 7 | IF | `KK2801_KKOP_SVC_CD_G02.equals(kkopSvcCd)` -> Extract kkOpSvcKeiNoTEL, taknkikiModelCd, kikiSeizoNo, kktkSvcKeiStat |

**Block 2.3** - [IF] `isNull(kkOpSvcKeiNoTEL)` (L2519-2540)

> No multifunc phone exists - perform router inquiry.

| # | Type | Code |
|---|------|------|
| 1 | IF | `isNull(kkOpSvcKeiNoTEL)` |
| 2 | CALL | `initData(param, fixedText, IN_COLUMN_LIST_36)` |
| 3 | CALL | `setInMapKkOpSvcKeiShosa(param, fixedText, kkopSvcKeiNoRT, inParamIdoDiv, lastUpdDtm)` |
| 4 | CALL | `executeSC(..., TEMPLATE_ID_36, ...)` // Router inquiry SC |
| 5 | SET | `lastUpdDtm = getTemplateValue(...)` |
| 6 | SET | `kkOpSvcKeiNoRT = getTemplateValue(...)` |

**Block 2.4** - [ELSE] Multifunc phone exists - status check (L2541-2617)

| # | Type | Code |
|---|------|------|
| 1 | ELSE | // Multifunc phone exists |
| 2 | SET | `geneAddDtmAft = null` |
| 3 | IF | `CD00037_020.equals(svcKeiStatNet) || CD00056_020.equals(kktkSvcKeiStat)` [020 = Inquiry done] |
| 4 | THEN | Same router inquiry as Block 2.3 + retrieve GENE_ADD_DTM |
| 5 | ELSE_IF | `CD00056_030.equals(kktkSvcKeiStat) || CD00056_100.equals(kktkSvcKeiStat)` [030 = Contract ended, 100 = In service] |
| 6 | THEN | `initData, setInMapKkOpSvcKeiShosa, executeSC(EKK2811C050), getTemplateValue` // Contract completion path |

**Block 2.4.1** - [IF] `CD00056_100.equals(kktkSvcKeiStat) && CD00037_100.equals(svcKeiStatNet)` (L2596-2617)

> Both equipment provision and net service in service (100) - execute contract start.

| # | Type | Code |
|---|------|------|
| 1 | IF | `CD00056_100.equals(kktkSvcKeiStat) && CD00037_100.equals(svcKeiStatNet)` |
| 2 | CALL | `initData(param, fixedText, IN_COLUMN_LIST_27)` // Equipment provision contract inquiry |
| 3 | CALL | `setInMapKktkSvcKeiUqSearch(param, fixedText, kktkSvcKeiNo)` |
| 4 | CALL | `executeSC(..., TEMPLATE_ID_27, ...)` // Execute SC |
| 5 | SET | `svcStaYmd = getTemplateListValue(...)` // Get service start date |
| 6 | SET | `dojiStaUm = "0"` // Same day |
| 7 | IF | `JCCBPCommon.getOpeDate(null).compareTo(svcStaYmd) < 0` |
| 8 | THEN | `dojiStaUm = "1"` // Future date |
| 9 | CALL | `initData(param, fixedText, IN_COLUMN_LIST_EKK2811C070)` |
| 10 | CALL | `setEKK2811C070(param, fixedText, kkOpSvcKeiNoRT, inParamIdoDiv, lastUpdDtm, dojiStaUm)` |
| 11 | CALL | `executeSC(..., TEMPLATE_ID_EKK2811C070, ...)` // Contract start SC |
| 12 | SET | `lastUpdDtm = getTemplateValue(...)` |
| 13 | SET | `geneAddDtmAft = getTemplateValue(...)` |

**Block 2.5** - [IF] `isShukkaZumi(kikiSeizoNo)` (L2618-2624)

> Equipment shipped - register SOD for multifunc router (registration).

| # | Type | Code |
|---|------|------|
| 1 | IF | `isShukkaZumi(kikiSeizoNo)` |
| 2 | CALL | `printDebugLog("...サービスオーダー登録(多機能ルーター設定・変更(ルーター機能・登録))..." + kikiSeizoNo)` |
| 3 | CALL | `hakkoSOD(handle, param, fixedText, kktkSvcKeiNo, taknkikiModelCd, kikiSeizoNo, kkOpSvcKeiNoRT, null, geneAddDtmAft, "402")` |

**Block 2.6** - [IF] `!isNull(inParamhmpinKktkSvcKeiNoVa)` (L2628-2685)

> VA equipment retained - register VA equipment option contract.

| # | Type | Code |
|---|------|------|
| 1 | IF | `!isNull(inParamhmpinKktkSvcKeiNoVa)` |
| 2 | SET | `pcrsCdVa = EMPTY`, `pplanCdVa = EMPTY` |
| 3 | IF | `CD00134_A31.equals(pcrsCdTel)` -> `pcrsCdVa = "G03"`, `pplanCdVa = "PG0301"` |
| 4 | ELSE_IF | `CD00134_A32.equals(pcrsCdTel)` -> `pcrsCdVa = "G04"`, `pplanCdVa = "PG0401"` |
| 5 | CALL | `initData(param, fixedText, IN_COLUMN_LIST_35)` |
| 6 | CALL | `setInMapKkOpSvcKeiToroku(..., KK2801_KKOP_SVC_CD_G02, pcrsCdVa, pplanCdVa, ..., KK2811_KIKI_RNTAI_KEI_CHGECHU_FLG_1, ...)` |
| 7 | CALL | `executeSC(..., TEMPLATE_ID_35, ...)` // VA registration |
| 8 | SET | `lastUpdDtm = getTemplateValue(...)` |
| 9 | SET | `kkopSvcKeiNo = getTemplateValue(...)` |
| 10 | CALL | `initData(param, fixedText, IN_COLUMN_LIST_36)` |
| 11 | CALL | `setInMapKkOpSvcKeiShosa(...)` // VA inquiry |
| 12 | CALL | `executeSC(..., TEMPLATE_ID_36, ...)` |
| 13 | SET | `lastUpdDtm = getTemplateValue(...)` |
| 14 | NOTE | Cancel/termination processing for VA explicitly skipped (VA in inquiry or contract-end state) |

**Block 3** - [ELSE] Dedicated multifunc router branch (L2688-2807)

> Dedicated multifunc router - queries existing contracts and performs price plan changes.

| # | Type | Code |
|---|------|------|
| 1 | ELSE | // Dedicated multifunc router |
| 2 | CALL | `initData(param, fixedText, IN_COLUMN_LIST_KKOP_SVKEI_LIST_SHOKAI)` |
| 3 | CALL | `setInMapKkOpSvcKeiListShokai(param, fixedText, inParamSysId, inParamSvkeiKaisenUwNo)` |
| 4 | CALL | `ignoreSearchError(param, fixedText)` |
| 5 | CALL | `executeSC(..., TEMPLATE_ID_KKOP_SVKEI_LIST_SHOKAI, ...)` |
| 6 | SET | `kkOpSvcKeiNoRT = null`, `geneAddDtmBef = null`, `taknkikiModelCd = null`, `kikiSeizoNo = null`, `kktkSvcKeiStat = null`, `rtKkopSvcKeiStat = EMPTY` |

**Block 3.1** - [FOR LOOP] Extract multifunc data from search results (L2700-2730)

| # | Type | Code |
|---|------|------|
| 1 | FOR | `for (HashMap dataMap : getTemplateList(..., TEMP_TEMPLATE_KEY_KKOP_SVKEI_LIST_SHOKAI, TEMPLATE_ID_DETAIL_KKOP_SVKEI_LIST_SHOKAI))` |
| 2 | SET | `kkopSvcKeiStat = dataMap.get(EKK2811B503CBSMsg1List.KKOP_SVC_KEI_STAT)` |
| 3 | IF | `KKOP_SVC_KEI_STAT_MUKO.contains(kkopSvcKeiStat)` -> continue |
| 4 | SET | `kkopSvcCd = dataMap.get(EKK2811B503CBSMsg1List.KKOP_SVC_CD)` |
| 5 | IF | `KK2801_KKOP_SVC_CD_G01.equals(kkopSvcCd)` -> Extract: kkOpSvcKeiNoRT, geneAddDtmBef, taknkikiModelCd, kikiSeizoNo, kktkSvcKeiStat, rtKkopSvcKeiStat |

**Block 3.2** - [IF] `CD01616_100.equals(rtKkopSvcKeiStat)` (L2733-2762)

> Multifunc router in service (100) - execute price plan change (C250) and confirmation (C260).

| # | Type | Code |
|---|------|------|
| 1 | IF | `CD01616_100.equals(rtKkopSvcKeiStat)` |
| 2 | CALL | `initData(param, fixedText, IN_COLUMN_LIST_38)` |
| 3 | CALL | `setInMapKkOpSvcKeiPcrsHenko(param, fixedText, kkOpSvcKeiNoRT, inParamIdoDiv, mskmDtlNo, pcrsCd, pplanCd, lastUpdDtm)` |
| 4 | CALL | `executeSC(..., TEMPLATE_ID_38, ...)` // Price plan change SC |
| 5 | SET | `lastUpdDtm = getTemplateValue(...)` |
| 6 | CALL | `initData(param, fixedText, IN_COLUMN_LIST_39)` |
| 7 | CALL | `setInMapKkOpSvcKeiPcrsHenkoKakutei(param, fixedText, kkOpSvcKeiNoRT, lastUpdDtm)` |
| 8 | CALL | `executeSC(..., TEMPLATE_ID_39, ...)` // Price plan change confirmation |
| 9 | SET | `lastUpdDtm = getTemplateValue(...)` |
| 10 | SET | `geneAddDtmAft = getTemplateValue(...)` |

**Block 3.3** - [ELSE] Contract being processed - EKK2811C240 (L2764-2786)

> Not in service - execute processing-in-progress price plan change.

| # | Type | Code |
|---|------|------|
| 1 | ELSE | // Received, inquiry done, or contract ended |
| 2 | CALL | `initData(param, fixedText, IN_COLUMN_LIST_EKK2811C240)` |
| 3 | CALL | `setEKK2811C240(param, fixedText, kkOpSvcKeiNoRT, pcrsCd, pplanCd, lastUpdDtm, mskmDtlNo, lastUpdDtm)` |
| 4 | CALL | `executeSC(..., TEMPLATE_ID_EKK2811C240, ...)` |
| 5 | SET | `geneAddDtmAft = getTemplateValue(...)` |
| 6 | SET | `lastUpdDtm = getTemplateValue(...)` |

**Block 3.4** - [IF] `CD00056_100.equals(kktkSvcKeiStat) && CD00037_100.equals(svcKeiStatNet)` (L2789-2807)

> Both in service - execute contract start (same logic as Block 2.4.1).

| # | Type | Code |
|---|------|------|
| 1 | IF | `CD00056_100.equals(kktkSvcKeiStat) && CD00037_100.equals(svcKeiStatNet)` |
| 2 | CALL | `initData(param, fixedText, IN_COLUMN_LIST_27)` |
| 3 | CALL | `setInMapKktkSvcKeiUqSearch(param, fixedText, kktkSvcKeiNo)` |
| 4 | CALL | `executeSC(..., TEMPLATE_ID_27, ...)` |
| 5 | SET | `svcStaYmd = getTemplateListValue(...)` |
| 6 | SET | `dojiStaUm = "0"` (or `"1"` if `getOpeDate < svcStaYmd`) |
| 7 | CALL | `initData(param, fixedText, IN_COLUMN_LIST_EKK2811C070)` |
| 8 | CALL | `setEKK2811C070(param, fixedText, kkOpSvcKeiNoRT, inParamIdoDiv, lastUpdDtm, dojiStaUm)` |
| 9 | CALL | `executeSC(..., TEMPLATE_ID_EKK2811C070, ...)` |
| 10 | SET | `geneAddDtmAft = getTemplateValue(...)` |
| 11 | SET | `lastUpdDtm = getTemplateValue(...)` |

**Block 4** - [IF] `isShukkaZumi(kikiSeizoNo)` (L2810-2817)

> Equipment shipped - register SOD for multifunc router (wireless/wired change).

| # | Type | Code |
|---|------|------|
| 1 | IF | `isShukkaZumi(kikiSeizoNo)` |
| 2 | CALL | `printDebugLog("...サービスオーダー登録(多機能ルーター設定・変更(ルーター機能・無線/有線変更))..." + kikiSeizoNo)` |
| 3 | CALL | `hakkoSOD(handle, param, fixedText, kktkSvcKeiNo, taknkikiModelCd, kikiSeizoNo, kkOpSvcKeiNoRT, geneAddDtmBef, geneAddDtmAft, "418")` |

**Block 5** - [RETURN] (L2819)

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

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `kkop_svc_kei_no` | Field | Equipment option service contract number - unique identifier for equipment option contract |
| `kktk_svc_kei_no` | Field | Equipment provision service contract number - main equipment provision contract ID |
| `seiky_kei_no` | Field | Billing contract number - billing contract for a service |
| `seiky_kei_no_net` | Field | Billing contract number for net service - internet service billing contract |
| `seiky_kei_no_tel` | Field | Billing contract number for phone service - telephone service billing contract |
| `mskm_dtl_no` | Field | Application detail number - specific line item in a service application |
| `last_upd_dtm` | Field | Last update datetime - modification timestamp for optimistic locking |
| `ido_div` | Field | Displacement type (migration status) - indicates service migration |
| `pcrs_cd` | Field | Pricing course code - pricing plan/course code for a service |
| `pcrs_cd_tel` | Field | Pricing course code for phone - determines VA equipment pricing plan |
| `svc_kei_stat_net` | Field | Service contract status for net (020=inquiry done, 100=in service) |
| `own_tkn_router_kind` | Field | Retained multifunc router type (0=low-speed multifunc) |
| `router_kino_nm` | Field | Router function name - literal string identifying router type |
| `kkop_svc_kei_stat` | Field | Equipment option service contract status (910=cancel request, 920=cancelled, 100=in service) |
| `kkop_svc_cd` | Field | Equipment option service code (G01=router, G02=multifunc phone) |
| `kk2801_kkop_svc_cd_g01` | Constant | Equipment option service code G01 - router function |
| `kk2801_kkop_svc_cd_g02` | Constant | Equipment option service code G02 - multifunc phone function |
| `kk2811_kiki_rntai_kei_chgchyu_flg` | Field | Equipment replacement contract change processing flag (0=not processing, 1=processing) |
| `kiki_seizo_no` | Field | Equipment serial number - manufacturing serial number |
| `taknkiki_model_cd` | Field | Home equipment model code - model identifier for installed equipment |
| `gene_add_dtm` | Field | Generation/addition datetime - timestamp for contract generation/modification |
| `doji_sta_um` | Field | Simultaneous start flag (0=same day, 1=future date) |
| `kk0341_sysid` | Field | K-Opticom customer base system ID - internal customer account identifier |
| `svc_kei_kaisen_ucwk_no` | Field | Service contract migration work number - tracking ID for migration |
| `hmpin_kktk_svc_kei_no_va` | Field | Returned equipment provision service contract number (VA) - for retained VA equipment |
| SOD | Acronym | Service Order Data - external order fulfillment system |
| FTTH | Business term | Fiber To The Home - fiber-optic broadband service |
| VA | Acronym | Virtual Access - virtual access service type |
| ENUM | Business term | ENUM telephone numbering mapping service |
| SC | Acronym | Service Component - service layer for database operations |
| CBS | Acronym | CBS Message - Common Business System message classes |
| EKK2811* | Acronym | Equipment option service CBS module |
| EKK0341* | Acronym | Equipment provision service CBS module |
| K-Opticom | Business term | K-Opticom telecom carrier (customer base system) |
