# Business Logic — JKKKikiIchiranKkUpdCC.execKikiIchiranKikiUpd() [212 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `com.fujitsu.futurity.bp.custom.common.JKKKikiIchiranKkUpdCC` |
| Layer | CC (Common Component) — reusable business logic shared across screens |
| Module | `common` (Package: `com.fujitsu.futurity.bp.custom.common`) |

## 1. Role

### JKKKikiIchiranKkUpdCC.execKikiIchiranKikiUpd()

This method is the central orchestrator for the **equipment change (機器変更) screen processing** in the K-Opticom broadband customer support system. It retrieves the current service contract and equipment service contract data, performs a series of validation and update checks, and then dispatches to the appropriate update path depending on the service state and device type. The method supports four distinct business branches: (1) **recovery processing** for multi-function router recovery scenarios, where router speed consistency is verified before executing recovery and discount logic; (2) **TV plan update** checks that gate downstream processing; (3) **equipment service code change detection**, which branches into either a no-update path (when code changed) or a full equipment service contract update; and (4) **progress registration and discount application** for non-received service contracts outside of B-CAS/C-CAS channels. It implements a **routing/dispatch pattern** using sequential gate checks and conditional method delegation, acting as the shared common component that multiple screens invoke to perform complete equipment change lifecycle management. The method is called by `JKKKikiIchiranIkkatsuCC.isExecKikiIchiranKkUpd()`, which is the entry point on the bulk-processing screen.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["execKikiIchiranKikiUpd(handle, param, fixedText)"])

    START --> INIT["Initialize ccMsg, messageInfo, temporaryData, workMap"]

    INIT --> CHK_SVC["svc_kei_data exists?"]

    CHK_SVC -->|No| CALL_EKK0081["Call EKK0081A010<br/>(Service Contract Agreement)"]

    CALL_EKK0081 --> STORE_EKK0081["Store EKK0081A010 result"]

    STORE_EKK0081 --> CHK_KKTK["kktk_svc_kei_data exists?"]

    CHK_KKTK -->|No| CALL_EKK0341["Call EKK0341A010<br/>(Equipment Service Contract)"]

    CALL_EKK0341 --> CHK_KKTK_NULL["Result empty?"]

    CHK_KKTK_NULL -->|Yes| SET_ERR["setMessageInfo EKB0320-KW<br/>Return param"]

    CHK_KKTK_NULL -->|No| STORE_EKK0341["Store EKK0341A010 result"]

    CHK_SVC -->|Yes| STORE_EKK0081
    CHK_KKTK -->|Yes| STORE_EKK0341

    STORE_EKK0341 --> SET_INIT["setInitSvcUpdate"]
    SET_INIT --> STORE_TEMP["Store results in temporaryData"]

    STORE_TEMP --> CALL_PCRS["getPcrsData<br/>(Billing course discrimination)"]

    CALL_PCRS --> STORE_PCRS["Store PCRS_MAP"]

    STORE_PCRS --> CHK_RECOVERY["kaifurkuUmu == Recovery?"]

    CHK_RECOVERY -->|Yes| CHK_RTR_RECOVERY["rtrKaifurkuUmu == Recovery?"]

    CHK_RTR_RECOVERY -->|Yes| CHK_SPEED["execCheckRouterSpeed"]

    CHK_SPEED -->|Fail| RETURN_PARAM_1["Return param"]

    CHK_SPEED -->|OK| EXEC_RECOVERY["execKikiKaifukuShori"]

    CHK_RTR_RECOVERY -->|No| EXEC_RECOVERY

    EXEC_RECOVERY --> EXEC_WRIBIKI["execKikiKaifukuWribikiShori<br/>(Recovery discount)"]

    EXEC_WRIBIKI --> RETURN_PARAM_2["Return param"]

    CHK_RECOVERY -->|No| CHK_SVC_STATUS["Get svcKeiStat"]

    CHK_SVC_STATUS --> CHK_MISSING["kktk_svc_cd or taknkiki_model_cd empty?"]

    CHK_MISSING -->|Yes| CALL_EKK0771["Call EKK0771B001 + EKK0771A010<br/>(Get device service info)"]

    CALL_EKK0771 --> CHK_CHECK_SCRN["check_scrn_id != KKW033?"]

    CHK_MISSING -->|No| CHK_CHECK_SCRN

    CHK_CHECK_SCRN -->|Yes| CHK_SERVER["isKikiInfoServerChkCC"]

    CHK_SERVER -->|Fail| RETURN_PARAM_3["Return param"]

    CHK_SERVER -->|OK| CHK_TV_PLAN["isTvPlanUpdate"]

    CHK_TV_PLAN -->|Fail| RETURN_PARAM_4["Return param"]

    CHK_TV_PLAN -->|OK| CHK_SVC_CD["isChangeKktkSvcCd"]

    CHK_SVC_CD -->|Yes| NO_UPDATE["No update (commented out)"]

    CHK_SVC_CD -->|No| EXEC_UPDATE["execUpdateKktkSvckei"]

    EXEC_UPDATE --> SET_RETURN["setReturnDataUpdate"]

    SET_RETURN --> CHK_STAT["svcKeiStat != 010 (Received)?"]

    NO_UPDATE --> CHK_STAT

    CHK_STAT -->|Yes| EXEC_SHINCHOKU["execShinchokuToroku<br/>(Progress registration)"]

    CHK_STAT -->|No| CHK_BCASCCAS["isOtherBcasCcas"]

    EXEC_SHINCHOKU --> CHK_BCASCCAS

    CHK_BCASCCAS -->|Yes| EXEC_WRISVC["execKikiUpdateWrisvc"]

    CHK_BCASCCAS -->|No| SET_SCRN_RETURN["setScrnReturnData"]

    EXEC_WRISVC --> SET_SCRN_RETURN

    SET_SCRN_RETURN --> CLEANUP["Remove KIKI_CREATE_CC_PARAM and KIKI_CREATE_LIST"]

    CLEANUP --> END_RETURN["Return param"]

    SET_ERR --> END_RETURN
    RETURN_PARAM_1 --> END_RETURN
    RETURN_PARAM_2 --> END_RETURN
    RETURN_PARAM_3 --> END_RETURN
    RETURN_PARAM_4 --> END_RETURN

    END_RETURN(["Return param"])
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `handle` | `SessionHandle` | Database session handle used for all CBS (Component Business System) calls within this method. Carries the transactional context and connection state for the session. |
| 2 | `param` | `IRequestParameterReadWrite` | Request/response parameter object that carries screen input data, message information, mapping work area, and temporary data across the processing pipeline. The same object is populated with results and returned to the caller. |
| 3 | `fixedText` | `String` | A data map key (used as `dataMapKey`) that identifies the section of `param` where this method's working data is stored. All `ccMsg` data retrieved from `param.getData(fixedText)` is scoped under this key, allowing the method to operate on a specific data partition within a larger multi-screen request. |

**Instance fields read by the method:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `TEMPLATE_ID_EKK0081A010` | `String` | Template ID `"EKK0081A010"` for the Service Contract Agreement CBS message. |
| `TEMPLATE_ID_EKK0341A010` | `String` | Template ID `"EKK0341A010"` for the Equipment Service Contract Agreement CBS message. |
| `ERR_FLG_ERR` | `String` | Error flag value `"E"` used to mark error conditions in the error flag field. |
| `SVC_KEI_STAT_UKZUMI` | `String` | Service contract status code `"010"` meaning "Received" (受注済). |
| `KIKI_CREATE_CC_PARAM` | `String` | Data map key `"JKKKikiAddCC"` for equipment registration CC data to be cleaned up. |
| `KIKI_CREATE_LIST` | `String` | Data map key `"kikiCreateList"` for equipment registration CC list data to be cleaned up. |
| `PCRS_MAP` | `String` | Data map key `"PCRS_MAP"` for the billing course discrimination result. |
| `SCRN_ID_KKW033` | `String` | Screen ID `"KKW033"` for the equipment list screen — used to skip server check when called from that screen. |
| `KIKI_KAIFUKU_TAISHO_KAIFUKU` | `String` | Recovery operation code `"1"` — indicates recovery processing is the target operation. |
| `FUNC_CODE_1` | `String` | Function code `"1"` (check + register). |
| `FUNC_CODE_2` | `String` | Function code `"2"` (check only). |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `callSC` (EKK0081A010) | EKK0081A010 | Service Contract Agreement table | Calls EKK0081A010 CBS to retrieve service contract agreement data when not already cached. Uses func_code "2" (check only). |
| R | `callSC` (EKK0341A010) | EKK0341A010 | Equipment Service Contract table | Calls EKK0341A010 CBS to retrieve equipment service contract data. If result is empty, sets error EKB0320-KW and returns early. |
| R | `callEKK0771B001` | EKK0771B001 | Equipment service code lookup | Retrieves equipment service code (`kktk_svc_cd`) when it is missing, used for the device service list agreement. |
| R | `callEKK0771A010` | EKK0771A010 | Equipment service name lookup | Retrieves equipment service name (`taknkiki_model_nm`) and alias (`kktk_svc_nm`) using the service code from EKK0771B001. |
| - | `setInitSvcUpdate` | - | - | Stores service contract update timestamp in the work area (v7.00.04 addition). |
| R | `getPcrsData` | - | - | Retrieves billing course discrimination data (billing plan classification) from CBS calls for service type detection. |
| R | `getNullToStr` | - | - | Utility method — safely converts null strings to empty strings. |
| - | `execCheckRouterSpeed` | - | - | Validates router speed consistency when recovery operation involves a multi-function router fallback. Returns false if validation fails. |
| - | `execKikiKaifukuShori` | - | - | Executes recovery processing logic when the router is being recovered (recovery target = "1"). |
| - | `execKikiKaifukuWribikiShori` | - | - | Executes recovery discount processing (applies discount adjustments following recovery). |
| - | `isKikiInfoServerChkCC` | - | - | Server check validation for equipment info. Skipped when check_scrn_id is KKW033 (equipment list screen). Returns false on failure. |
| - | `isTvPlanUpdate` | - | - | TV plan change update check. Returns false if TV plan update fails. |
| - | `isChangeKktkSvcCd` | - | - | Determines whether the equipment service code has changed. |
| - | `execUpdateKktkSvckei` | U | EKK0341C230 | Updates the equipment service contract information (when service code has NOT changed). |
| - | `setReturnDataUpdate` | - | - | Sets the return data after equipment service contract update. |
| - | `execShinchokuToroku` | - | EKK1091D010 | Progress registration (inserts progress record) when service contract status is NOT "010" (Received). |
| - | `isOtherBcasCcas` | - | - | Determines if the service is NOT B-CAS or C-CAS (non-cas broadcasting). |
| - | `execKikiUpdateWrisvc` | U | WrisvcAutoAplyCC | Updates WR service (discount service auto-application) when the service is outside B-CAS/C-CAS. |
| - | `setScrnReturnData` | - | - | Sets screen return data including device names and other display fields. |

## 5. Dependency Trace

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

No screen/batch entry points found within 8 hops. Direct callers found: 1 method.
Terminal operations from this method: `getString` [R], `setScrnReturnData` [-], `execKikiUpdateWrisvc` [U], `isOtherBcasCcas` [-], `execShinchokuToroku` [-], `setReturnDataUpdate` [U], `execUpdateKktkSvckei` [U], `isChangeKktkSvcCd` [-], `isTvPlanUpdate` [U], `isKikiInfoServerChkCC` [-], `getNullToStr` [R], `getString` [R], `getString` [R], `getString` [R], `getString` [R], `getString` [R], `getNullToStr` [R], `getString` [R], `getString` [R], `getString` [R]

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | `JKKKikiIchiranIkkatsuCC.isExecKikiIchiranKkUpd()` | `JKKKikiIchiranIkkatsuCC.isExecKikiIchiranKkUpd` -> `JKKKikiIchiranKkUpdCC.execKikiIchiranKikiUpd` | `EKK0081A010 [R] ServiceContract`, `EKK0341A010 [R] EquipmentServiceContract`, `EKK0771B001 [R] EquipmentServiceCode`, `EKK0771A010 [R] EquipmentServiceName`, `execKikiUpdateWrisvc [U] WRService`, `execShinchokuToroku [C] ProgressRegistration`, `execUpdateKktkSvckei [U] EquipmentServiceContract` |

## 6. Per-Branch Detail Blocks

**Block 1** — SET (L264) Initialization block

> Sets up the working data structures: extracts the ccMsg map from param, initializes error flag to empty string, creates message list and temporary data maps, and ensures the mapping work area exists.

| # | Type | Code |
|---|------|------|
| 1 | SET | `dataMapKey = fixedText` // Map key from parameter [-> dataMapKey = fixedText] |
| 2 | EXEC | `ccMsg.put("err_flg", "")` // Initialize error flag to clear (エラーフラグ) |
| 3 | SET | `messageInfo = new ArrayList<HashMap>()` // Message code list (メッセージコードリスト) |
| 4 | EXEC | `ccMsg.put("message_list", messageInfo)` // Register message list |
| 5 | SET | `temporaryData = new HashMap()` // Temporary work data area (一時領域名データ) |
| 6 | EXEC | `workMap = param.getMappingWorkArea()` // Get common work area (共通領域を取得) |

**Block 2** — IF (workMap == null) (L279)

> Ensures the mapping work area exists; creates it if missing.

| # | Type | Code |
|---|------|------|
| 1 | SET | `workMap = new HashMap()` // Create new work area if null |
| 2 | EXEC | `param.setMappingWorkArea(workMap)` // Register work area |

**Block 3** — SET (L285) v7.00.04 commented removal

> The old setInitSvcUpdate call was commented out in v7.00.04 removal and re-added later with different parameters.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `// setInitSvcUpdate(param, ccMsg);` // Commented out — v7.00.04 removal (サービス契約更新前タイムスタンプ共通領域格納) |

**Block 4** — SET (L289) ServiceComponentRequestInvoker creation

> Creates the CBS invocation builder that carries the class name for logging.

| # | Type | Code |
|---|------|------|
| 1 | SET | `scCall = new ServiceComponentRequestInvoker()` // CBS invoker instance (SC呼び出し部品のインスタンス生成) |

**Block 5** — IF (svc_kei_data exists) (L293)

> Retrieves cached service contract agreement data (サービス契約同意照会). If not present, calls EKK0081A010 CBS to fetch it.

| # | Type | Code |
|---|------|------|
| 1 | SET | `ekk0081a010cbsMsg = (CAANMsg)ccMsg.get("svc_kei_data")` // Retrieve cached service contract data (サービス契約データが存在しない場合取得) |

**Block 5.1** — IF (ekk0081a010cbsMsg == null) (L296)

> Calls EKK0081A010 (Service Contract Agreement) when data is missing. Input includes template ID, func_code "2" (check only), service contract number, empty generation timestamp, and operation date.

| # | Type | Code |
|---|------|------|
| 1 | SET | `ekk0081a010IN[...] = TEMPLATE_ID_EKK0081A010` // [-> TEMPLATE_ID_EKK0081A010 = "EKK0081A010"] |
| 2 | SET | `ekk0081a010IN[...] = "2"` // Func code: check only (機能コード：チェックのみ) |
| 3 | SET | `ekk0081a010IN[...] = ccMsg.get("svc_kei_no")` // Service contract number (サービス契約番号) |
| 4 | SET | `ekk0081a010IN[...] = ""` // Empty generate add datetime (生成追加日時) |
| 5 | SET | `ekk0081a010IN[...] = ccMsg.get("unyo_ymd")` // Operation date (運用年月日) |
| 6 | CALL | `callSC(handle, scCall, param, dataMapKey, ekk0081a010IN)` |

**Block 5.2** — SET (L305) Store EKK0081 result

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `temporaryData.put(TEMPLATE_ID_EKK0081A010, ekk0081a010cbsMsg)` // Store service contract agreement result |

**Block 6** — IF (kktk_svc_kei_data exists) (L308)

> Retrieves cached equipment service contract data (機器提供サービス契約データ). If missing, calls EKK0341A010 CBS.

| # | Type | Code |
|---|------|------|
| 1 | SET | `ekk0341a010cbsMsg = (CAANMsg)ccMsg.get("kktk_svc_kei_data")` // Retrieve cached equipment service data |

**Block 6.1** — IF (ekk0341a010cbsMsg == null) (L311)

> Calls EKK0341A010 (Equipment Service Contract Agreement) with func_code "2", equipment service contract number, empty generation timestamp, and operation date.

| # | Type | Code |
|---|------|------|
| 1 | SET | `ekk0341a010IN[...] = TEMPLATE_ID_EKK0341A010` // [-> TEMPLATE_ID_EKK0341A010 = "EKK0341A010"] |
| 2 | SET | `ekk0341a010IN[...] = "2"` // Func code: check only |
| 3 | SET | `ekk0341a010IN[...] = ccMsg.get("kktk_svc_kei_no")` // Equipment service contract number (機器提供サービス契約番号) |
| 4 | SET | `ekk0341a010IN[...] = ""` // Empty generate add datetime |
| 5 | SET | `ekk0341a010IN[...] = ccMsg.get("unyo_ymd")` // Operation date |
| 6 | CALL | `callSC(handle, scCall, param, dataMapKey, ekk0341a010IN)` |

**Block 6.2** — IF (ekk0341a010cbsMsgList empty) (L322)

> If the equipment service contract query returns no results, sets error EKB0320-KW (other error) and returns early.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `setMessageInfo(ccMsg, "EKB0320-KW", "", "", ERR_FLG_ERR)` // Set error message EKB0320-KW (他のエラーを表示 EKB0320-KW) |
| 2 | RETURN | `return param` // Early return with error |

**Block 6.3** — SET (L330)

| # | Type | Code |
|---|------|------|
| 1 | SET | `ekk0341a010cbsMsg = ekk0341a010cbsMsgList[0]` // Take first result |

**Block 7** — SET (L334) v7.00.04 addition

> Stores service contract update timestamp in the work area (now with the EKK0341 message as the third parameter).

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `setInitSvcUpdate(param, ccMsg, ekk0341a010cbsMsg)` // Store update timestamp (サービス契約更新前タイムスタンプを共通領域に格納) |

**Block 8** — SET (L338) Store EKK0341 result

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `temporaryData.put(TEMPLATE_ID_EKK0341A010, ekk0341a010cbsMsg)` // Store equipment service contract agreement result |

**Block 9** — SET (L341) Get billing course discrimination

| # | Type | Code |
|---|------|------|
| 1 | CALL | `pcrsData = getPcrsData(handle, param, ccMsg)` // Get billing course discrimination data (料金コース判別取得部品呼び出し) |
| 2 | EXEC | `temporaryData.put(PCRS_MAP, pcrsData)` // Store PCRS map |

**Block 10** — SET (L345) v7.00.00 change start

> Retrieves recovery operation mode from the `khk_um` field. ANK-2979-00-00 added `rtr_khk_um` field for multi-function router fallback recovery.

| # | Type | Code |
|---|------|------|
| 1 | SET | `kaifurkuUmu = getNullToStr((String)ccMsg.get("khk_um"))` // Recovery operation mode (回復ユーマ) |
| 2 | SET | `rtrKaifurkuUmu = getNullToStr((String)ccMsg.get("rtr_khk_um"))` // Router recovery mode (ルーター回復ユーマ) [ANK-2979-00-00 ADD] |

**Block 11** — IF (kaifurkuUmu == "1" OR rtrKaifurkuUmu == "1") (L367) [KIKI_KAIFUKU_TAISHO_KAIFUKU = "1"]

> Recovery processing branch. If either the original or router-specific recovery flag equals "1" (Recovery target = Recovery), execute recovery processing including router speed check, recovery logic, and recovery discount.

| # | Type | Code |
|---|------|------|
| 1 | SET | `kaifurkuUmu = getNullToStr((String)ccMsg.get("khk_um"))` |
| 2 | SET | `rtrKaifurkuUmu = getNullToStr((String)ccMsg.get("rtr_khk_um"))` |

**Block 11.1** — IF (rtrKaifurkuUmu == "1") (L371)

> When the router-specific recovery flag is set, perform router speed consistency check first.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `if(!execCheckRouterSpeed(handle, scCall, param, dataMapKey, temporaryData))` // Router and billing plan consistency check (料金プランとルータ機器の整合性チェック) |
| 2 | RETURN | `return param` if check fails |

**Block 11.2** — EXEC (L378) Recovery processing related

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `execKikiKaifukuShori(handle, scCall, param, dataMapKey, temporaryData)` // Recovery processing related (回復処理関連) |
| 2 | EXEC | `execKikiKaifukuWribikiShori(handle, scCall, param, dataMapKey, temporaryData)` // Recovery discount processing (回復割引処理実行) |
| 3 | RETURN | `return param` // Early return after recovery |

**Block 12** — SET (L386) Get service contract status

| # | Type | Code |
|---|------|------|
| 1 | SET | `svcKeiStat = getNullToStr(ekk0081a010cbsMsg.getString(EKK0081A010CBSMsg1List.SVC_KEI_STAT))` // Service contract status (サービス契約ステータス) |

**Block 13** — IF (kktk_svc_cd or taknkiki_model_cd empty) (L391)

> When equipment service code or device model code is missing, populate them by calling EKK0771B001 (equipment service list agreement) and EKK0771A010 (equipment service info retrieval).

| # | Type | Code |
|---|------|------|
| 1 | CALL | `callEKK0771B001(handle, scCall, param, dataMapKey, tk_sbt_cd, unyo_ymd)` // Equipment service list agreement (機器提供サービス一覧照会) |
| 2 | EXEC | `ccMsg.put("kktk_svc_cd", ekk0771b001cbsMsg1list[0].getString(KKTK_SVC_CD))` // Set equipment service code |
| 3 | CALL | `callEKK0771A010(handle, scCall, param, dataMapKey, kktk_svc_cd)` // Device service info retrieval (機器提供サービス情報取得) |
| 4 | EXEC | `ccMsg.put("taknkiki_model_nm", getNullToStr(ekk0771a010cbsMsg.getString(KKTK_SVC_NM)))` // Set device model name |
| 5 | EXEC | `ccMsg.put("kktk_svc_nm", getNullToStr(ekk0771a010cbsMsg.getString(KKTK_SVC_ALI)))` // Set equipment service name (equipped service alias) |

**Block 14** — IF (check_scrn_id != "KKW033") (L401) [SCRN_ID_KKW033 = "KKW033"]

> Server check for equipment info. This check is SKIPPED when called from the equipment list screen (KKW033) — only executed when called from other screens.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `isKikiInfoServerChkCC(handle, scCall, param, dataMapKey, temporaryData)` // Server check part (サーバーチェック部品呼び出し) — returns false on error, skips subsequent processing |
| 2 | RETURN | `return param` if server check fails |

**Block 15** — IF (!isTvPlanUpdate) (L409)

> TV plan change processing (TV course change processing). Returns early if TV plan update fails. The TV course cancel check (isTvCancelUpdate) is commented out because STB-to-non-STB changes are not possible.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `isTvPlanUpdate(handle, scCall, param, dataMapKey, temporaryData)` // Billing plan change — TV course change processing (料金プラン変更：テレビコース変更処理) |
| 2 | RETURN | `return param` if TV plan update fails |

**Block 16** — IF (isChangeKktkSvcCd) (L424)

> Equipment service code changed branch. When the equipment service code (機器提供サービスコード) has changed, the old code for code-unchanged equipment contract creation is commented out (comment: type has not changed, comment). The else branch handles the actual update path.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `isChangeKktkSvcCd(temporaryData)` // Check if equipment service code changed (機器提供サービスコードが変更された場合) |

**Block 16.1** — IF (isChangeKktkSvcCd == true) (L427)

> Code changed — commented out: device service contract creation and return data setup. The comment states "type has not changed" and "perform direct correction of equipment service contract information."

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `// execCreateKktkSvckei(handle, ...)` // Commented out: create equipment service contract (機器提供サービス契約情報の作り直し) |
| 2 | EXEC | `// setReturnDataCreate(param, dataMapKey)` // Commented out: set return data (戻り値を設定：更新確認時に棟コードと名称が必要) |

**Block 16.2** — ELSE (isChangeKktkSvcCd == false) (L436)

> Code unchanged — update the equipment service contract and set return data.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `execUpdateKktkSvckei(handle, scCall, param, dataMapKey, temporaryData)` // Update equipment service contract information (機器提供サービス契約情報の更新) |
| 2 | EXEC | `setReturnDataUpdate(param, dataMapKey, temporaryData)` // Set return data after update (戻り値を設定) |

**Block 17** — IF (svcKeiStat != "010") (L443) [SVC_KEI_STAT_UKZUMI = "010"]

> Progress registration for non-received service contracts. The status "010" means "Received" (受注済). If the status is NOT received, register progress.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `execShinchokuToroku(handle, scCall, param, dataMapKey, temporaryData)` // Progress registration (進捗登録) |

**Block 18** — IF (isOtherBcasCcas) (L448)

> Non B-CAS / non C-CAS branch. When the service is NOT B-CAS or C-CAS type (B-CAS、C-CAS以外の場合), call the discount CC to apply auto-discount service (割引CC呼び出し).

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `isOtherBcasCcas(param, dataMapKey, temporaryData)` // Judgment: not B-CAS and not C-CAS |
| 2 | EXEC | `execKikiUpdateWrisvc(handle, scCall, param, dataMapKey, temporaryData)` // Update WR service (割引CC実行：割引サービス自動適用) |

**Block 19** — SET (L453) Set screen return data and cleanup

> Retrieves device names and other display data for the screen, then removes temporary data left by equipment registration CC to avoid data contamination since the discount CC uses the same data fields.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `setScrnReturnData(handle, scCall, param, dataMapKey, temporaryData)` // Set screen return data — returns device name etc. (名称データ等取得し返却) |
| 2 | EXEC | `param.removeData(KIKI_CREATE_CC_PARAM)` // Remove equipment registration CC data (機器登録CCのMapを削除) — the discount CC uses data left by equipment registration CC |
| 3 | EXEC | `param.removeData(KIKI_CREATE_LIST)` // Remove work collaboration data (工事連携データ削除) |

**Block 20** — RETURN (L459)

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return param` // Return the populated parameter object |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `svc_kei_no` | Field | Service contract number — unique identifier for a service contract agreement. |
| `svc_kei_data` | Field | Cached service contract agreement data (Service Contract Agreement CBS result). |
| `svc_kei_stat` | Field | Service contract status — e.g., "010" = Received (受注済). |
| `kktk_svc_kei_no` | Field | Equipment service contract number — identifier for equipment-specific service contract. |
| `kktk_svc_kei_data` | Field | Cached equipment service contract data. |
| `kktk_svc_cd` | Field | Equipment service code (機器提供サービスコード) — classifies the type of equipment service. |
| `kktk_svc_nm` | Field | Equipment service name / device model name (機器提供サービス名称). |
| `kktk_svc_nm` | Field | Equipment service alias (機器提供サービス略称). |
| `taknkiki_model_cd` | Field | Device model code (多能機器モデルコード). |
| `taknkiki_model_nm` | Field | Device model name (多能機器名称). |
| `kkh_um` | Field | Recovery operation mode flag (回復ユーマ) — indicates recovery processing target. |
| `rtr_khk_um` | Field | Router recovery mode flag (ルーター回復ユーマ) — ANK-2979-00-00 addition for multi-function router fallback recovery. |
| `kaifurkuUmu` | Field | Recovery operation mode (回復ユーマ) — local variable reading `khk_um`. |
| `rtrKaifurkuUmu` | Field | Router recovery mode (ルーター回復ユーマ) — local variable reading `rtr_khk_um`. |
| `KIKI_KAIFUKU_TAISHO_KAIFUKU` | Constant | Recovery target = Recovery code value `"1"` — indicates the operation is a recovery (回復処理対象：回復). |
| `SVC_KEI_STAT_UKZUMI` | Constant | Service contract status "010" = Received (受注済). |
| `ERR_FLG_ERR` | Constant | Error flag value `"E"` (エラーフラグ：エラー). |
| `SCRN_ID_KKW033` | Constant | Screen ID `"KKW033"` for the equipment list screen (機器一覧画面ID). |
| `func_code` | Field | CBS function code — "1" = check + register (チェック＆登録), "2" = check only (チェックのみ). |
| `unyo_ymd` | Field | Operation date (運用年月日) — used as the reference date for CBS queries. |
| `TEMPLATE_ID_EKK0081A010` | Constant | Template ID `"EKK0081A010"` for the Service Contract Agreement CBS (サービス契約同意照会). |
| `TEMPLATE_ID_EKK0341A010` | Constant | Template ID `"EKK0341A010"` for the Equipment Service Contract Agreement CBS (機器提供サービス契約同意照会). |
| `TEMPLATE_ID_EKK1091D010` | Constant | Template ID `"EKK1091D010"` for Progress Registration (進捗登録). |
| `PCRS_MAP` | Constant | Data map key `"PCRS_MAP"` for billing course discrimination result (料金コース判別取得部品). |
| `KIKI_CREATE_CC_PARAM` | Constant | Data map key `"JKKKikiAddCC"` for equipment registration CC parameter. |
| `KIKI_CREATE_LIST` | Constant | Data map key `"kikiCreateList"` for equipment registration CC list. |
| `EKK0081A010` | SC Code | Service Contract Agreement CBS — retrieves service contract consent/agreement data. |
| `EKK0341A010` | SC Code | Equipment Service Contract Agreement CBS — retrieves equipment-specific service contract consent data. |
| `EKK0771A010` | SC Code | Equipment Service Info Retrieval — retrieves equipment service name and alias. |
| `EKK0771B001` | SC Code | Equipment Service List Agreement — retrieves equipment service code list. |
| `EKK1091D010` | SC Code | Progress Registration CBS — inserts progress records for service contracts not yet received. |
| `EKK0341C230` | Template ID | Equipment Service Contract Information Change — used to update equipment service contracts. |
| `KIKI` | Abbreviation | Equipment (機器) — refers to customer-premises equipment (CPE). |
| `KIKI KAIFUKU` | Abbreviation | Equipment Recovery (機器回復) — recovery processing for equipment (e.g., router recovery). |
| `Wrisvc` | Abbreviation | WR Service (割引サービス) — discount service auto-application component. |
| `B-CAS` | Business term | B-CAS Card — conditional access system used for Japanese digital broadcasting. |
| `C-CAS` | Business term | C-CAS — alternative conditional access system for digital broadcasting. |
| `PCRS` | Abbreviation | Billing Course discrimination (料金コース判別) — determines the billing plan/course type. |
| `SC` | Abbreviation | Service Component — Fujitsu's business middleware layer for CBS calls. |
| `CBS` | Abbreviation | Component Business System — the business logic layer accessed via SC calls. |
| `CAANMsg` | Abbreviation | CBS Answer message — response object from CBS operations. |
| `ServiceComponentRequestInvoker` | Abbreviation | SC call builder — constructs and logs Service Component requests with class name for audit. |
| `kkh_um` | Field | Recovery operation mode — indicates if recovery processing is targeted (回復ユーマ). |
| `rtr_khk_um` | Field | Router recovery mode — ANK-2979-00-00 addition for multi-function router recovery fallback (ルーター回復ユーマ). |
| `execCheckRouterSpeed` | Method | Router speed consistency check — validates consistency between billing plan and router device (料金プランとルータ機器の整合性チェック). |
| `execKikiKaifukuShori` | Method | Recovery processing — main recovery logic when router is being recovered (回復処理関連). |
| `execKikiKaifukuWribikiShori` | Method | Recovery discount processing — applies discount adjustments following recovery (回復割引処理実行). |
| `isTvPlanUpdate` | Method | TV plan change update check — gates downstream processing (料金プラン変更：テレビコース変更処理). |
| `execShinchokuToroku` | Method | Progress registration — registers progress when service contract is not yet received (進捗登録). |
| `isOtherBcasCcas` | Method | Non B-CAS / non C-CAS judgment — determines if the service type is outside broadcasting CAS types (B-CAS、C-CAS以外). |
| `execKikiUpdateWrisvc` | Method | Equipment WR service update — applies discount service auto-application (割引CC実行). |
| `setScrnReturnData` | Method | Set screen return data — populates device name and other display fields (名称データ等取得し返却). |
| `isKikiInfoServerChkCC` | Method | Equipment info server check — validates equipment info from server (サーバーチェック). |
| `setInitSvcUpdate` | Method | Set initial service update timestamp — stores service contract update timestamp in work area (サービス契約更新前タイムスタンプを共通領域に格納). |
| `getPcrsData` | Method | Get billing course discrimination data — retrieves billing plan classification (料金コース判別取得部品). |
| `EKB0320-KW` | Error code | Error message code — displays generic error "other error" when equipment service contract data is empty (他のエラーを表示 EKB0320-KW). |
| `workMap` | Field | Mapping work area (共通領域) — shared data area for cross-component communication. |
| `ccMsg` | Field | Common component message map — working data map holding CBS results, error flags, and message lists. |
| `temporaryData` | Field | Temporary data area (一時領域名データ) — transient storage for CBS results within this method. |
| `dataMapKey` | Field | Data map key — identifies the partition within param where working data is stored. |
