# Business Logic — JKKKikiIchiranKkOpKyUpdCC.execKikiOptKeiCreUpd() [225 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `com.fujitsu.futurity.bp.custom.common.JKKKikiIchiranKkOpKyUpdCC` |
| Layer | CC / Common Component (Cross-cutting common component in the custom business layer) |
| Module | `common` (Package: `com.fujitsu.futurity.bp.custom.common`) |

## 1. Role

### JKKKikiIchiranKkOpKyUpdCC.execKikiOptKeiCreUpd()

This method is the central orchestrator for updating equipment option service contracts within the K-Opticom e-Frontier customer backbone system. It processes the lifecycle of equipment (router, telephone adapter, and terminal compensation) optional service subscriptions by coordinating data acquisition, service contract agreement confirmation, and downstream SOD (Service Order Data) generation.

Specifically, the method performs the following business operations. First, it retrieves the master service contract agreement (EKK0081A010) and the equipment provision service contract agreement (EKK0341A010), populating temporary working data with both. If the contract status indicates a pending change (CD00056_STAT_KEI_CHG_CHU = "110"), it additionally fetches the reserved equipment provision data via EKK0341A010PK. Second, it evaluates three sequential service-type filters — router equipment optimization (`isRtOptSvcKei`), telephone adapter equipment optimization (`isVaOptSvcKei`), and terminal compensation equipment optimization (`isTnmtOptSvcKei`). If none of the three service types apply, the method returns immediately without further processing. Third, based on the discrepancy classification (`ido_div`), it branches into two major paths: for unreturned equipment cancellation (IDO_DIV_00030 = "00030"), it registers advance records for router and VA equipment options; for all other scenarios (normal equipment option add/change), if the function code indicates a register operation and the processing classification is "Change Option Update" (`KIKI_OPT_SVC_KEI_SHORI_KBN_UPD` = "3"), it either issues an SOD immediately (if a send date is set) or registers the advance (if no send date is set). Finally, for screen-driven terminal compensation operations, it conditionally registers terminal advance processing when the equipment option selection state and equipment editing classification meet specific criteria.

The method implements a **routing/dispatch design pattern**, acting as a shared utility component called by 9+ screen controllers across multiple business flows including equipment creation, cancellation, bulk update, and plan addition. It serves as the single entry point that normalizes equipment option service contract update processing across all K-Opticom screens that deal with optional equipment services.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["execKikiOptKeiCreUpd"])

    START --> S1["S1: dataMapKey = fixedText"]
    S1 --> S2["S2: ccMsg = param.getData"]
    S2 --> S3["S3: func_code = ccMsg.get func_code"]
    S3 --> S4["S4: Error flag init"]
    S4 --> S5["S5: messageInfo = new ArrayList"]
    S5 --> S6["S6: ccMsg.put message_list"]
    S6 --> S7["S7: temporaryData = new HashMap"]
    S7 --> S8["S8: workMap = param.getMappingWorkArea"]
    S8 --> S9{workMap == null?}
    S9 -- Yes --> S10["S10: workMap = new HashMap"]
    S9 -- No --> S11["S11: workMap exists"]
    S10 --> S12["S12: scCall = new ServiceComponentRequestInvoker"]
    S11 --> S12
    S12 --> S13["S13: callSC EKK0081A010
Service Contract Agreement"]
    S13 --> S14["S14: temporaryData.put EKK0081A010"]
    S14 --> S15["S15: setTempSvcKeiData
Router/Phone service status"]
    S15 --> S16["S16: kktk_svc_kei_data from ccMsg"]
    S16 --> S17{Equipment service data null?}
    S17 -- Yes --> S18["S18: kktkSvcKeiNo from ccMsg"]
    S18 --> S19{kktkSvcKeiNo not empty?}
    S19 -- Yes --> S20["S20: execEKK0341A010 with kktkSvcKeiNo"]
    S19 -- No --> S21["S21: key from scrnItemMap kktk_svc_kei_no_bf"]
    S21 --> S22["S22: execEKK0341A010 with key"]
    S20 --> S23["S23: temporaryData.put EKK0341A010"]
    S22 --> S23
    S17 -- No --> S23
    S23 --> S24["S24: kktkSvcKeiStatRsv from ccMsg"]
    S24 --> S25{Contract change status 110?}
    S25 -- Yes --> S26["S26: execEKK0341A010PK
Reserved data"]
    S26 --> S27["S27: temporaryData.put reserved"]
    S27 --> S28
    S25 -- No --> S28["S28: isRtOptSvcKei check"]
    S28 -- Not router --> END_RETURN["Return param"]
    S28 -- Router needed --> S29["S29: isVaOptSvcKei check"]
    S29 -- Not phone --> END_RETURN
    S29 -- Phone needed --> S30["S30: isTnmtOptSvcKei check"]
    S30 -- Not terminal --> END_RETURN
    S30 -- Terminal needed --> S31{IDO_DIV 00030 unreturned equip?}
    S31 -- No --> S32{func_code equals 1?}
    S31 -- Yes --> S33["S33: getUpdAfKikiOptionInfo Rutar AF"]
    S33 --> S34{msg_af not null?}
    S34 -- Yes --> S35["S35: execShinchokuToroku
SOD_SHORI_KBN_DSL"]
    S35 --> S36["S36: getUpdAfKikiOptionInfo VA AF"]
    S36 --> S37{msg_af not null?}
    S37 -- Yes --> S38["S38: execShinchokuToroku
SOD_SHORI_KBN_DSL"]
    S37 -- No --> S39
    S34 -- No --> S39
    S38 --> S39
    S39["S39: scrnItemMap null check"]
    S39 -- Null --> S40["S40: setRetItem"]
    S39 -- Not null --> S41{hosho_mskm_select in 1/2
and kiki_edit_kbn equals 16?}
    S41 -- Yes --> S42["S42: execShinchokuTorokuTnmt"]
    S41 -- No --> S40
    S42 --> S40
    S32 -- No --> S40
    S32 -- Yes --> S43["S43: kikiOptSvcKeiShoriKbn from ccMsg"]
    S43 --> S44{ShoriKbn equals 3 Update?}
    S44 -- No --> S40
    S44 -- Yes --> S45["S45: add_sod_send_ymd from ccMsg"]
    S45 --> S46{add_sod_send_ymd not empty?}
    S46 -- Yes --> S47["S47: execSodHakko"]
    S46 -- No --> S48["S48: getUpdAfKikiOptionInfo Rutar AF"]
    S48 --> S49{msg_af not null?}
    S49 -- Yes --> S50["S50: execShinchokuToroku
SOD_SHORI_KBN_INI"]
    S49 -- No --> S40
    S47 --> S40
    S50 --> S40
    S40 --> S_FINAL(["Return param"])
```

**Constant Resolution Notes:**
- `CD00056_STAT_KEI_CHG_CHU = "110"` (Contract Change in Progress) — from `JKKStrConst`
- `KIKI_OPT_SVC_KEI_SHORI_KBN_UPD = "3"` (Change Option Update) — local constant
- `IDO_DIV_00030 = "00030"` (Discrepancy: Unreturned Equipment Cancellation) — local constant
- `FUNC_CODE_1 = "1"` (Function Code: Check & Register) — local constant
- `SOD_SHORI_KBN_INI = "0"` (SOD Processing: Initial Value) — local constant
- `SOD_SHORI_KBN_DSL = "3"` (SOD Processing: Cancellation) — local constant

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `handle` | `SessionHandle` | Database session handle for executing CBS (Business Rule Component) and SC (Service Component) calls. Carries the transactional context (DB connection, user session) for all downstream service invocations. |
| 2 | `param` | `IRequestParameterReadWrite` | The request parameter object that carries screen input data, working areas, and message lists. It provides access to the data map (via `getData(fixedText)`), the mapping work area (shared state across components), and the return data container. The `func_code` field within determines whether the operation is check-and-register ("1") or check-only ("2"). |
| 3 | `fixedText` | `String` | A string key used to identify the data map entry within `param`. It acts as the namespace/namespace qualifier for accessing the equipment option service contract data blob. In practice, this is the same as `dataMapKey` after assignment (`String dataMapKey = fixedText`). |
| 4 | `scrnItemMap` | `HashMap<String, Object>` | Screen-specific item data carrying UI-related state. Key fields include: `kktk_svc_kei_no_bf` (previous equipment provision service contract number, used as fallback when the primary number is unavailable), `hosho_mskm_select` (equipment option selection state: "1" or "2" for terminal compensation selection), `kiki_edit_kbn` (equipment editing classification: "16" for terminal compensation advance registration mode), and `tnmt_snck_flg` (terminal compensation advance registration flag, currently commented out). This map may be null when the method is called from non-screen batch paths. |

**Instance fields / external state read by the method:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `KIKI_OPT_SVC_KEI_RUTAR_AF` | `String` | Map key for post-update router equipment option contract data (`"KIKI_OPT_SVC_KEI_RUTAR_AF"`) |
| `KIKI_OPT_SVC_KEI_VA_AF` | `String` | Map key for post-update VA equipment option contract data (`"KIKI_OPT_SVC_KEI_VA_AF"`) |
| `KKTK_SVC_KEI_DATA_RSV` | `String` | Map key for reserved equipment provision service contract data (`"kktk_svc_kei_data_rsv"`) |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `callSC` (EKK0081A010CBSMsg) | EKK0081A010SC | Service Contract Agreement data | Calls `callSC` with EKK0081A010 template to retrieve the master service contract agreement (svc_kei_no, gene_add_dtm, rsv_aply_ymd). FUNC_CODE="2" indicates a retrieval query. |
| R | `setTempSvcKeiData` (internal) | EKK0081B009/EKK0161B004/EKK0191A010SC | Service contract detail / line data | Retrieves same-location service contract information for network and telephone service status from the same service contract. Used to determine if router or telephone option data should be processed. |
| R | `execEKK0341A010` | EKK0341A010SC | Equipment Provision Service Contract Agreement | Retrieves equipment provision service contract agreement data (kktk_svc_kei_no, svc_kei_stat_rsv, etc.). Called with either the primary kktkSvcKeiNo or a fallback key from scrnItemMap. |
| R | `execEKK0341A010PK` | EKK0341A010SC | Equipment Provision Service Contract Agreement (PK lookup) | Retrieves the reserved/pending equipment provision service contract data when the contract status is "Contract Change in Progress" (CD00056_STAT_KEI_CHG_CHU = "110"). |
| R | `getUpdAfKikiOptionInfo` (internal) | - | temporaryData (in-memory map) | Reads post-update equipment option contract data from the `temporaryData` HashMap using the KIKI_OPT_SVC_KEI_RUTAR_AF or KIKI_OPT_SVC_KEI_VA_AF keys. Pure in-memory operation. |
| R | `getNullToStr` (internal) | - | - | Utility method to safely cast objects to String, returning empty string for null values. Used extensively for null-safe parameter extraction. |
| R | `isRtOptSvcKei` (internal) | - | temporaryData (in-memory map) | Evaluates whether the equipment option contract involves router services. Reads service type, status, and processing classification from temporaryData. Returns true if router equipment processing is required. |
| R | `isVaOptSvcKei` (internal) | - | temporaryData (in-memory map) | Evaluates whether the equipment option contract involves telephone adapter (VA) services. Similar logic to isRtOptSvcKei but for telephone service codes. |
| R | `isTnmtOptSvcKei` (internal) | - | temporaryData, scrnItemMap | Evaluates whether the equipment option contract involves terminal compensation services (KIKI_OPT_SVC_CD_TNMT = "G03"). Reads from both temporaryData and scrnItemMap. |
| C | `execSodHakko` | EKK1081D010SC / EKK1081C011SC | Order Conditions Registration / Order Info Work | Issues SOD (Service Order Data) for unreturned equipment. Creates an order condition record and work info record. Parameters include ORDER_SBT_CD_2 (eo light), SVC_ORDER_CD_26 (multi-function router), YOKYU_SBT_CD_04 (Change). |
| C | `execShinchokuToroku` | EKK1091D010SC | Advance Registration (Progress Registration) | Registers advance processing records for equipment option services. Called with SOD_SHORI_KBN_DSL ("3" for cancellation) for unreturned equipment path, and SOD_SHORI_KBN_INI ("0" for initial value) for normal add/change path. |
| C | `execShinchokuTorokuTnmt` | EKK1091D010SC | Advance Registration - Terminal Compensation | Registers advance processing for terminal compensation equipment option. Called from screen-driven flows when hosho_mskm_select is "1" or "2" and kiki_edit_kbn is "16". |
| - | `setRetItem` (internal) | - | param (response data) | Populates the return parameter with processed data including error flags, message lists, temporary data, and post-update service contract data. Writes response data to param for the calling screen. |

**Processing Classification (KIKI_OPT_SVC_KEI_SHORI_KBN):**

| Value | Constant | Business Meaning |
|-------|----------|-----------------|
| "1" | KIKI_OPT_SVC_KEI_SHORI_KBN_ADD | Equipment Option Add |
| "2" | KIKI_OPT_SVC_KEI_SHORI_KBN_DSL | Equipment Option Cancel + Option Update |
| "3" | KIKI_OPT_SVC_KEI_SHORI_KBN_UPD | Change Option Update |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Controller: JFUUpdSpMskmOtherOpCC | `JFUUpdSpMskmOtherOpCC.updOtherOp()` → `JKKKikiIchiranKkOpKyUpdCC.execKikiOptKeiCreUpd()` | `execShinchokuToroku[C] KK_T_IDO_TOROKU`, `execSodHakko[C] KK_T_ODR_HAKKO_JOKEN` |
| 2 | Controller: JKKKikiIchiranCancelCC | `JKKKikiIchiranCancelCC.execKikiOptSvcKeiDsl()` → `JKKKikiIchiranKkOpKyUpdCC.execKikiOptKeiCreUpd()` | `execShinchokuToroku[C] KK_T_IDO_TOROKU` |
| 3 | Controller: JKKKikiIchiranIkkatsuCC | `JKKKikiIchiranIkkatsuCC.execKikiOptSvcKeiUpd()` → `JKKKikiIchiranKkOpKyUpdCC.execKikiOptKeiCreUpd()` | `execShinchokuToroku[C] KK_T_IDO_TOROKU`, `execSodHakko[C] KK_T_ODR_HAKKO_JOKEN` |
| 4 | Controller: JKKKikiIchiranIkkatsuCC | `JKKKikiIchiranIkkatsuCC.execTnmtHoshoKaiCanSyori()` → `JKKKikiIchiranKkOpKyUpdCC.execKikiOptKeiCreUpd()` | `execShinchokuToroku[C] KK_T_IDO_TOROKU` |
| 5 | Controller: JKKKikiIchiranIkkatsuCC | `JKKKikiIchiranIkkatsuCC.execTnmtHoshoSyori()` → `JKKKikiIchiranKkOpKyUpdCC.execKikiOptKeiCreUpd()` | `execShinchokuToroku[C] KK_T_IDO_TOROKU` |
| 6 | Controller: JKKKikiIchiranKkCreateCC | `JKKKikiIchiranKkCreateCC.execKikiOptSvcKeiUpdCC()` → `JKKKikiIchiranKkOpKyUpdCC.execKikiOptKeiCreUpd()` | `execShinchokuToroku[C] KK_T_IDO_TOROKU`, `execSodHakko[C] KK_T_ODR_HAKKO_JOKEN` |
| 7 | Controller: JKKKikiIchiranKkCreateCC | `JKKKikiIchiranKkCreateCC.execKikiOptSvcKeiUpdCC_tamnt_conp()` → `JKKKikiIchiranKkOpKyUpdCC.execKikiOptKeiCreUpd()` | `execShinchokuToroku[C] KK_T_IDO_TOROKU` |
| 8 | Controller: JKKOnuPlanKknKjIktAddCC | `JKKOnuPlanKknKjIktAddCC.execKikiIchiranKkOpKyUpdCC()` → `JKKKikiIchiranKkOpKyUpdCC.execKikiOptKeiCreUpd()` | `execShinchokuToroku[C] KK_T_IDO_TOROKU`, `execSodHakko[C] KK_T_ODR_HAKKO_JOKEN` |
| 9 | Controller: JKKUpdSpMskmOtherOpBaseCC | `JKKUpdSpMskmOtherOpBaseCC.updOtherOpBase()` → `JKKKikiIchiranKkOpKyUpdCC.execKikiOptKeiCreUpd()` | `execShinchokuToroku[C] KK_T_IDO_TOROKU`, `execSodHakko[C] KK_T_ODR_HAKKO_JOKEN` |

**Terminal operations from this method (all paths):**

| Terminal Operation | Type | Entity / DB |
|-------------------|------|-------------|
| `setRetItem` | Write (W) | param response data (in-memory) |
| `execShinchokuToroku` | Create (C) | KK_T_IDO_TOROKU (Advance Registration Table) |
| `execShinchokuTorokuTnmt` | Create (C) | KK_T_IDO_TOROKU (Terminal Compensation Advance Registration) |
| `execSodHakko` | Create (C) | KK_T_ODR_HAKKO_JOKEN (Order Conditions Table), KK_T_ODR_INFO (Order Info Table) |
| `getUpdAfKikiOptionInfo` | Read (R) | temporaryData (in-memory HashMap) |
| `getNullToStr` | Read (R) | in-memory cast (null-safe String conversion) |
| `callSC` (EKK0081A010) | Read (R) | KK_T_SVC_KEI (Service Contract Table) |
| `execEKK0341A010` | Read (R) | KK_T_KKTK_SVC_KEI (Equipment Provision Service Contract Table) |
| `execEKK0341A010PK` | Read (R) | KK_T_KKTK_SVC_KEI (Equipment Provision Service Contract Table, PK lookup) |

## 6. Per-Branch Detail Blocks

### Block 1 — INIT [Initialization] (L471)

> Initializes all working structures, error flags, message containers, and service component request invoker. Prepares the data map key and extracts the function code.

| # | Type | Code |
|---|------|------|
| 1 | SET | `dataMapKey = fixedText` // Alias: the fixedText parameter becomes the data map key |
| 2 | EXEC | `ccMsg = param.getData(dataMapKey)` // Extract equipment option service contract data map from param |
| 3 | SET | `func_code = (String)ccMsg.get("func_code")` // Read function code (1=Check+Register, 2=Check-only) |
| 4 | SET | `ccMsg.put("err_flg", "")` // Initialize error flag to empty (no error) // エラフラグ |
| 5 | SET | `messageInfo = new ArrayList<HashMap<String, Object>>()` // Create message info list // メッセージ情報 |
| 6 | EXEC | `ccMsg.put("message_list", messageInfo)` // Register message list // メッセージコードリスト |
| 7 | SET | `temporaryData = new HashMap<String, Object>()` // Create temporary working area // 一時領域名データ |
| 8 | SET | `workMap = param.getMappingWorkArea()` // Get common working area // 共通領域名を取得 |
| 9 | IF | `workMap == null` (L487) |

### Block 1.9 — [Nested] workMap null check (L488)

> If no common work area exists, create and register a new one.

| # | Type | Code |
|---|------|------|
| 1 | SET | `workMap = new HashMap()` // Create new work map // 共通領域名を取得 |
| 2 | EXEC | `param.setMappingWorkArea(workMap)` // Register the new work map |

### Block 2 — SC INVOKER SETUP [Service Component Setup] (L496)

> Creates the service component request invoker instance and calls EKK0081A010 (Service Contract Agreement) to retrieve the master service contract data.

| # | Type | Code |
|---|------|------|
| 1 | SET | `scCall = new ServiceComponentRequestInvoker()` // SC call invoker // SC呼び出し部品 — pass class name as parameter |
| 2 | SET | `ekk0081a010cbsMsg = (CAANMsg)ccMsg.get("svc_kei_data")` // Attempt to read existing service contract data // サービス契約データが存在しない場合取得します |
| 3 | SET | `ekk0081a010IN[...]` // Prepare input: TEMPLATE_ID_EKK0081A010, FUNC_CODE="2", svc_kei_no, gene_add_dtm="", rsv_aply_ymd=(String)ccMsg.get("unyo_ymd") // ***** EKK0081A010（サービス契約照会）***** |
| 4 | CALL | `ekk0081a010cbsMsg = callSC(handle, scCall, param, dataMapKey, ekk0081a010IN)` // Invoke SC to retrieve service contract agreement data |
| 5 | EXEC | `ekk0081a010cbsMsg.getCAANMsgList(...)[0]` // Extract first message from SC response |
| 6 | EXEC | `temporaryData.put(TEMPLATE_ID_EKK0081A010, ekk0081a010cbsMsg)` // Store result in temporaryData // 検索結果を格納（サービス契約照会） |

### Block 3 — TEMPORARY SERVICE CONTRACT DATA [setTempSvcKeiData] (L515)

> Sets temporary service contract data including router and telephone service status. Used to determine if router or telephone equipment options need processing.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `setTempSvcKeiData(handle, scCall, param, dataMapKey, temporaryData)` // Set service contract data from same line's network/phone service status |

### Block 4 — EQUIPMENT PROVISION SERVICE CONTRACT ACQUISITION (L520)

> Acquires the equipment provision service contract agreement (EKK0341A010). If data is not already present, it queries via EKK0341A010 using either the primary equipment number or a fallback from the screen item map.

| # | Type | Code |
|---|------|------|
| 1 | SET | `ekk0341a010cbsMsg = (CAANMsg)ccMsg.get("kktk_svc_kei_data")` // Equipment provision service contract data // 機器提供サービス契約情報を取得 |
| 2 | IF | `ekk0341a010cbsMsg == null` (L523) // 機器提供サービス契約情報が存在しない場合取得します |

### Block 4.2 — [Nested] EKK0341A010 acquisition — primary path (L526)

> When equipment provision service contract data is missing and a primary service contract number exists, call EKK0341A010 with the primary number.

| # | Type | Code |
|---|------|------|
| 1 | SET | `kktkSvcKeiNo = getNullToStr((String)ccMsg.get("kktk_svc_kei_no"))` // Sanitized equipment provision service contract number |
| 2 | IF | `!"$empty$".equals(kktkSvcKeiNo)` (L526) // kktkSvcKeiNo is not empty |

### Block 4.2.2 — [Nested] EKK0341A010 with primary number (L530)

| # | Type | Code |
|---|------|------|
| 1 | CALL | `ekk0341a010cbsMsg = execEKK0341A010(handle, scCall, param, dataMapKey, kktkSvcKeiNo)` // ***** 機器提供サービス契約照会の実行 ***** (Execute equipment provision service contract agreement inquiry) |

### Block 4.3 — [Nested] EKK0341A010 acquisition — fallback path (L533-L537)

> When the primary number is empty, use the previous service contract number from the screen item map as fallback.

| # | Type | Code |
|---|------|------|
| 1 | SET | `key = (String)scrnItemMap.get("kktk_svc_kei_no_bf")` // Previous equipment service contract number // 機器提供サービス契約番号(前) |
| 2 | CALL | `ekk0341a010cbsMsg = execEKK0341A010(handle, scCall, param, dataMapKey, key)` // ***** 機器提供サービス契約照会の実行 (fallback) ***** |

### Block 4.5 — [Sibling] Store EKK0341A010 result (L542)

> After EKK0341A010 acquisition (whether from existing data or via query), store the result.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `temporaryData.put(TEMPLATE_ID_EKK0341A010, ekk0341a010cbsMsg)` // 検索結果を格納（機器提供サービス契約照会） |

### Block 5 — RESERVED DATA CHECK [ANK-4287-00-00] (L545-L556)

> Checks if the equipment provision service contract status is "Contract Change in Progress" (CD00056_STAT_KEI_CHG_CHU = "110"). If so, fetches the reserved equipment provision data.

| # | Type | Code |
|---|------|------|
| 1 | SET | `kktkSvcKeiStatRsv = getNullToStr((String)ccMsg.get("kktk_svc_kei_stat_rsv"))` // 機器提供サービス契約ステータス(予約) |
| 2 | IF | `JKKStrConst.CD00056_STAT_KEI_CHG_CHU.equals(kktkSvcKeiStatRsv)` — `[CD00056_STAT_KEI_CHG_CHU = "110"]` // 契約変更中の場合 (L548) |

### Block 5.2 — [Nested] Fetch reserved data (L550-L555)

> When the status indicates contract change in progress, retrieve the reserved equipment provision service contract data.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `ekk0341a010cbsMsgRsv = execEKK0341A010PK(handle, scCall, param, dataMapKey)` // 契約変更中の機器提供サービス契約情報を取得 |
| 2 | EXEC | `temporaryData.put(KKTK_SVC_KEI_DATA_RSV, ekk0341a010cbsMsgRsv)` // 検索結果を格納（機器提供サービス契約照会(予約)） |

### Block 6 — ROUTER EQUIPMENT OPTIMIZATION CHECK (L559-L562)

> Evaluates whether this operation involves router equipment optimization. If NOT, returns early — no further processing needed.

| # | Type | Code |
|---|------|------|
| 1 | IF | `!isRtOptSvcKei(handle, scCall, param, dataMapKey, temporaryData)` (L559) // ルーター機器オプションサービス契約処理 |

### Block 7 — TELEPHONE ADAPTER EQUIPMENT OPTIMIZATION CHECK (L565-L568)

> Evaluates whether this operation involves telephone adapter (VA) equipment optimization. If NOT, returns early.

| # | Type | Code |
|---|------|------|
| 1 | IF | `!isVaOptSvcKei(handle, scCall, param, dataMapKey, temporaryData)` (L565) // 電話機器オプションサービス契約処理 |

### Block 8 — TERMINAL COMPENSATION EQUIPMENT OPTIMIZATION CHECK (L572-L575)

> [v9.00.00 Added] Evaluates whether this operation involves terminal compensation equipment optimization. If NOT, returns early.

| # | Type | Code |
|---|------|------|
| 1 | IF | `!isTnmtOptSvcKei(handle, scCall, param, dataMapKey, temporaryData, scrnItemMap)` (L574) // 端末補償オプションサービス契約処理 |

### Block 9 — UNRETURNED EQUIPMENT CANCELLATION / NORMAL PROCESSING SPLIT (L579)

> Splits processing based on `ido_div`. If `ido_div` equals "00030" (unreturned equipment cancellation), the advance registration is performed in the cancellation CC (Contract Change Controller), so this method does not execute SOD issuance here. For all other cases (normal add/change), it proceeds to SOD-related processing.

| # | Type | Code |
|---|------|------|
| 1 | IF | `!IDO_DIV_00030.equals(ccMsg.get("ido_div"))` (L579) // 未返却機器解除の場合 — SOD issuance is deferred to the cancellation CC // 解除CCでSOD発行と進展登録を行うためここでは実行しない |

### Block 9.2 — [Nested] Function code check (L582-L583)

> Within the normal (non-unreturned) processing path, check if the function code indicates register operation ("1").

| # | Type | Code |
|---|------|------|
| 1 | IF | `FUNC_CODE_1.equals((String)ccMsg.get("func_code"))` — `[FUNC_CODE_1 = "1"]` // 機能コード（チェック＆登録）(L582) |

### Block 9.2.2 — [Nested] Processing classification check (L585-L611)

> Within register operation, determine if the processing classification is "Change Option Update" (KIKI_OPT_SVC_KEI_SHORI_KBN_UPD = "3"). Per the v13.00.00 change (ANK-2394-00-00), only "Change Option Update" triggers SOD issuance at this stage — "Add" is handled during return processing.

| # | Type | Code |
|---|------|------|
| 1 | SET | `kikiOptSvcKeiShoriKbn = (String)ccMsg.get(KIKI_OPT_SVC_KEI_SHORI_KBN)` // 機器オプションサービス契約処理区分 |
| 2 | IF | `KIKI_OPT_SVC_KEI_SHORI_KBN_UPD.equals(kikiOptSvcKeiShoriKbn)` — `[KIKI_OPT_SVC_KEI_SHORI_KBN_UPD = "3"]` (L594) // 機器オプション追加と機器オプション更新の時のみSOD発行と判断します |

### Block 9.2.2.2 — [Nested] SOD send date check (L596-L627)

> For "Change Option Update" operations, check if `add_sod_send_ymd` (SOD send date) is set. If set, issue SOD immediately. If not set (v13.00.00 ANK-2394-00-00 improvement), register advance instead.

| # | Type | Code |
|---|------|------|
| 1 | SET | `add_sod_send_ymd = getNullToStr((String)ccMsg.get("add_sod_send_ymd"))` // 未返却機器解除の場合、解除CCでSOD発行と進展登録を行うためここでは実行しない — here it is the SOD send date |
| 2 | IF | `!"".equals(add_sod_send_ymd)` (L600) // SOD send date is not empty |

### Block 9.2.2.2.2 — [Nested] Immediate SOD issuance (L602)

> When SOD send date is set, issue SOD immediately. SOD issuance is triggered after the equipment becomes service-providing, and the router or VA has already been issued, so the SOD send date condition is used.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `execSodHakko(handle, scCall, param, dataMapKey, temporaryData)` // SOD発行処理 |

### Block 9.2.2.2.3 — [Nested] Advance registration fallback (L605-L627)

> [v13.00.00 ANK-2394-00-00] When SOD send date is NOT set, retrieve post-update router equipment option data and register advance if available.

| # | Type | Code |
|---|------|------|
| 1 | SET | `ekk2811a010Msg_af = getUpdAfKikiOptionInfo(temporaryData, KIKI_OPT_SVC_KEI_RUTAR_AF)` // 更新後ルーター機器オプション契約データ |
| 2 | IF | `ekk2811a010Msg_af != null` (L608) |

### Block 9.2.2.2.3.2 — [Nested] Advance registration (L611)

> Register advance processing for router equipment option with SOD_SHORI_KBN_INI ("0" — initial value).

| # | Type | Code |
|---|------|------|
| 1 | CALL | `execShinchokuToroku(handle, scCall, param, dataMapKey, temporaryData, ekk2811a010Msg_af, SOD_SHORI_KBN_INI)` // 进展登録（機器オプション(ルーター機器機能)の进展登録）`[SOD_SHORI_KBN_INI = "0"]` |

### Block 10 — UNRETURNED EQUIPMENT CANCELLATION PATH (L628-L650)

> When `ido_div` = "00030" (unreturned equipment cancellation), register advances for both router and VA equipment options without SOD issuance. The SOD issuance is deferred to the cancellation CC.

| # | Type | Code |
|---|------|------|
| 1 | SET | `ekk2811a010Msg_af = getUpdAfKikiOptionInfo(temporaryData, KIKI_OPT_SVC_KEI_RUTAR_AF)` // 更新後ルーター機器オプション契約データ |
| 2 | IF | `ekk2811a010Msg_af != null` (L631) |

### Block 10.2 — [Nested] Router advance registration (L634)

> Register advance for router equipment option during unreturned equipment cancellation.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `execShinchokuToroku(handle, scCall, param, dataMapKey, temporaryData, ekk2811a010Msg_af, SOD_SHORI_KBN_DSL)` // 进展登録（機器オプション(ルーター機器機能)の进展登録）`[SOD_SHORI_KBN_DSL = "3"]` |

### Block 10.3 — [Sibling] VA advance registration (L638-L644)

> Register advance for VA (telephone adapter) equipment option during unreturned equipment cancellation.

| # | Type | Code |
|---|------|------|
| 1 | SET | `ekk2811a010Msg_af = getUpdAfKikiOptionInfo(temporaryData, KIKI_OPT_SVC_KEI_VA_AF)` // 更新後VA機器オプション契約データ |
| 2 | IF | `ekk2811a010Msg_af != null` (L641) |

### Block 10.3.2 — [Nested] VA advance registration (L644)

> Register advance for VA equipment option with SOD_SHORI_KBN_DSL ("3").

| # | Type | Code |
|---|------|------|
| 1 | CALL | `execShinchokuToroku(handle, scCall, param, dataMapKey, temporaryData, ekk2811a010Msg_af, SOD_SHORI_KBN_DSL)` // 进展登録（機器オプション（電話アダプター機能)の进展登録）`[SOD_SHORI_KBN_DSL = "3"]` |

### Block 11 — TERMINAL COMPENSATION SCREEN HANDLING [v9.00.00] (L650-L673)

> [v9.00.02 corrected] When the screen item map is not null, check if the equipment option selection state and equipment editing classification indicate terminal compensation advance registration mode.

| # | Type | Code |
|---|------|------|
| 1 | IF | `scrnItemMap != null` (L654) // 画面の全パラメータが存在する場合 |

### Block 11.2 — [Nested] Parameter extraction (L657-L659)

| # | Type | Code |
|---|------|------|
| 1 | SET | `hosho_mskm_select = getNullToStr((String)scrnItemMap.get("hosho_mskm_select"))` // 機器オプション（補償）選択状態 |
| 2 | SET | `kiki_edit_kbn = getNullToStr((String)scrnItemMap.get("kiki_edit_kbn"))` // 機器編集区分 |

### Block 11.3 — [Nested] Terminal compensation advance registration condition (L663)

> Process when `hosho_mskm_select` is "1" or "2" (equipment option selected) AND `kiki_edit_kbn` is "16" (terminal compensation advance registration mode).

| # | Type | Code |
|---|------|------|
| 1 | IF | `("1".equals(hosho_mskm_select) || "2".equals(hosho_mskm_select)) && "16".equals(kiki_edit_kbn)` (L663) |

### Block 11.3.2 — [Nested] Terminal compensation advance registration (L666)

> Register advance processing for terminal compensation equipment option.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `execShinchokuTorokuTnmt(handle, scCall, param, dataMapKey, temporaryData, scrnItemMap, SOD_SHORI_KBN_DSL)` // 进展登録（機器オプション（端末補償）の进展登録）`[SOD_SHORI_KBN_DSL = "3"]` |

### Block 12 — RESPONSE POPULATION [setRetItem] (L677)

> Populate the response parameter with all processed data including error flags, message lists, temporary data, and post-update service contract information.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `setRetItem(handle, scCall, param, dataMapKey, temporaryData)` // 処理後データを格納します |
| 2 | RETURN | `return param;` // Return the populated request parameter to the caller |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `svc_kei_no` | Field | Service contract number — internal tracking ID for service contract lines |
| `svc_kei_data` | Field | Service contract agreement data — returned by EKK0081A010 CBS |
| `kktk_svc_kei_no` | Field | Equipment provision service contract number — identifies the equipment-specific service contract line |
| `kktk_svc_kei_no_bf` | Field | Previous equipment provision service contract number — fallback value from screen state, used when primary number is unavailable |
| `kktk_svc_kei_stat_rsv` | Field | Equipment provision service contract reservation status — indicates if contract change is pending (e.g., "110" = contract change in progress) |
| `kktk_svc_kei_data` | Field | Equipment provision service contract agreement data — returned by EKK0341A010 CBS |
| `kktk_svc_kei_data_rsv` | Field | Reserved equipment provision service contract data — stored during contract change in progress |
| `func_code` | Field | Function code — determines operation type: "1" = check & register, "2" = check-only |
| `ido_div` | Field | Discrepancy classification — distinguishes unreturned equipment cancellation ("00030") from normal service changes |
| `kiki_opt_svc_kei_shori_kbn` | Field | Equipment option service contract processing classification — "1"=Add, "2"=Cancel+Update, "3"=Change Option Update |
| `add_sod_send_ymd` | Field | SOD send date (year/month/day) — when set, SOD is issued immediately; when empty, advance registration is performed |
| `hosho_mskm_select` | Field | Equipment option (compensation) selection state — "1" or "2" indicates terminal compensation option is selected |
| `kiki_edit_kbn` | Field | Equipment editing classification — "16" indicates terminal compensation advance registration mode |
| `err_flg` | Field | Error flag — empty means no error, "E" indicates error state |
| `message_list` | Field | Message code list — ArrayList of message info HashMaps for UI error/warning display |
| `workMap` | Field | Common work area — shared data map across components within the same request flow |
| `temporaryData` | Field | Temporary working data HashMap — holds CBS results (EKK0081A010, EKK0341A010), reserved data, and post-update option data |
| SOD | Acronym | Service Order Data — telecom order fulfillment entity that triggers downstream billing and provisioning workflows |
| EKK0081A010 | CBS Code | Service Contract Agreement Inquiry — retrieves master service contract data (service contract number, gene add datetime, reservation apply date) |
| EKK0341A010 | CBS Code | Equipment Provision Service Contract Agreement Inquiry — retrieves equipment-specific service contract data |
| EKK0341A010PK | CBS Code | Equipment Provision Service Contract Agreement Inquiry (PK lookup) — retrieves reserved/pending equipment contract data |
| SC | Acronym | Service Component — Fujitsu Futurity framework component for business rule execution and data access |
| CBS | Acronym | Business Rule Component — Component-based service for business rule execution |
| CC | Acronym | Common Component — Cross-cutting component providing shared business logic across screens |
| Router (ルーター) | Business term | Multi-function router equipment — internet service access equipment (service code "G01") |
| VA (電話アダプター) | Business term | Voice Adapter / Telephone adapter equipment — VoIP telephone adapter equipment (service code "G02") |
| Terminal Compensation (端末補償) | Business term | Terminal compensation equipment option — equipment protection/compensation service (service code "G03") |
| CD00056_STAT_KEI_CHG_CHU | Constant | Contract Change in Progress status code ("110") — indicates the equipment provision service contract is undergoing a change |
| IDO_DIV_00030 | Constant | Discrepancy: Unreturned Equipment Cancellation — special flow where SOD issuance is deferred to the cancellation controller |
| KIKI_OPT_SVC_CD_RUTAR | Constant | Router equipment option service code ("G01") |
| KIKI_OPT_SVC_CD_VA | Constant | VA equipment option service code ("G02") |
| KIKI_OPT_SVC_CD_TNMT | Constant | Terminal compensation equipment option service code ("G03") |
| SVC_CD_NET | Constant | Internet service code ("01") — eo Hikari internet service |
| SVC_CD_TEL | Constant | Telephone service code ("02") — eo Hikari telephone service |
| SOD_SHORI_KBN_INI | Constant | SOD processing classification: Initial value ("0") — used for advance registration in normal add/change flow |
| SOD_SHORI_KBN_DSL | Constant | SOD processing classification: Cancellation ("3") — used for advance registration in unreturned equipment cancellation flow |
| KIKI_OPT_SVC_KEI_RUTAR_AF | Constant | Map key for post-update router equipment option contract data ("KIKI_OPT_SVC_KEI_RUTAR_AF") |
| KIKI_OPT_SVC_KEI_VA_AF | Constant | Map key for post-update VA equipment option contract data ("KIKI_OPT_SVC_KEI_VA_AF") |
| KIKI_OPT_SVC_KEI_RUTAR_BF | Constant | Map key for pre-update router equipment option contract data ("KIKI_OPT_SVC_KEI_RUTAR_BF") |
| KIKI_OPT_SVC_KEI_VA_BF | Constant | Map key for pre-update VA equipment option contract data ("KIKI_OPT_SVC_KEI_VA_BF") |
| KK_COM_SVC_UP_DTM | Constant | Service contract update timestamp storage key |
| KK_COM_IDO_UP_DTM | Constant | Discrepancy registration update timestamp storage key |
| NET_SVC_KEI_NO_HOJI_KEY | Constant | Network service contract data preservation key |
| TEL_SVC_KEI_NO_HOJI_KEY | Constant | Telephone service contract data preservation key |
| KKW03301_PRG_WORK | Constant | Progress information output judgment data preservation key |
| ANK-4287-00-00 | Issue ID | Contract reservation function support for equipment options — added EKK0341A010PK reserved data retrieval |
| ANK-2394-00-00 | Issue ID | Improvement plan case support — added advance registration fallback when SOD send date is empty (v13.00.00) |
| ANK-2054-00-00 | Issue ID | Case support — added terminal compensation equipment option processing (v9.00.00) |
