# Business Logic — JKKTelnoInfoAddCC.checkHtelTelnoAdd() [266 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `com.fujitsu.futurity.bp.custom.common.JKKTelnoInfoAddCC` |
| Layer | CC / Common Component (shared business logic component within the K-Opticom e-Customer Backbone System) |
| Module | `common` (Package: `com.fujitsu.futurity.bp.custom.common`) |

## 1. Role

### JKKTelnoInfoAddCC.checkHtelTelnoAdd()

This method performs comprehensive input validation for the "Light Phone / Number Addition" business operation in the K-Opticom telecommunications customer backbone system. "Light Phone" (光電話, Hikari Denwa) refers to K-Opticom's fiber-optic landline telephony service bundled with broadband internet. The method serves as the centralized guardrail before any light phone or telephone number addition proceeds, preventing data integrity violations and business rule breaches.

The method implements a **conditional validation dispatcher** pattern: it branches based on the movement division code (`idoDiv`), the new VA flag (`newVAFlg`), and the function code (`funcCode`). Each branch performs distinct validation scopes:

- **Non-address-change validation** (when `idoDiv` is NOT "00019" or "00020"): Verifies the residence target number area master data (EZM0091A010) to ensure the number being added belongs to a valid area.
- **New VA validation** (when `newVAFlg` is true): Queries service contract construction project information to detect conflicts where equipment (e.g., a multi-function router) is already assigned to an active construction project, blocking number addition that would cause delivery conflicts.
- **Check mode processing** (when `funcCode == "2"`): Validates same-contract service information and provider service contracts to ensure the number addition does not require a router contract termination that would conflict with existing broadband service agreements.
- **Duplication guard** (always, when not address-change): Checks whether the telephone number being added already exists within the same contract to prevent duplicate assignments.

As a **shared utility** called by the `executeHtelTelnoAdd()` method within `JKKTelnoInfoAddCC`, this validation layer is reused across multiple entry points for the light phone/number addition screen and any batch processing that modifies telephone number data. It is critical to data integrity for the fiber-optic service activation workflow.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["checkHtelTelnoAdd"])
    STEP1["SET: kariTourokuFlg, dobanitenReqCtrlCd from trgtData"]
    STEP2["SET: dobanitenReqCtrlCdBf from outMapEKK0191A010"]
    STEP3["SET: dobanitenStat from outMapETU0021A010"]
    STEP4["SET: idoDiv from trgtData"]
    COND1{idoDiv != 00019 and 00020?}
    STEP5A["SET: searchErrFlg from outMapEZM0091A010"]
    COND2{searchErrFlg == 1?}
    ERR1["addErrInfo: EKB0300-KW"]
    COND3{newVAFlg == true?}
    STEP6A["editInMsgEKU0081B010, callSvcInter"]
    STEP6B["Loop: extract kojiakNo, dates"]
    COND4{dates valid?}
    COND5{kojiakNo != null?}
    STEP6C["editInMsgEKU0011A010, callSvcInter"]
    STEP6D["Extract: kojiakStat, kojiakSbtCd, equipRyuyoUm"]
    COND6{equipRyuyoUm != null?}
    COND7{Stat in 140-190 and SbtCd=001 and equip=1,2,3?}
    ERR2["addErrInfo: EKBE720-KW"]
    COND8{funcCode == 2?}
    COND9{newVAFlg == true?}
    STEP8A["editInMsgEKK0081B009, callSvcInter"]
    STEP8B["Loop: extract prcGrpCd"]
    COND10{prcGrpCd in 02,03,04?}
    STEP8C["editInMsgEKK0341B002, callSvcInter"]
    STEP8D["Loop: extract kktkSvcCd, kktkSvcKeiStat"]
    COND11{kktkSvcCd=C014 and Stat<910?}
    ERR3["addErrInfo: EKBE096--Q"]
    COND12{idoDiv != 00019 and 00020?}
    STEP10["isSameKeiNaiTelnoDbleCheck"]
    ERR4["isErr = true"]
    RETURN["return isErr"]

    START --> STEP1 --> STEP2 --> STEP3 --> STEP4 --> COND1
    COND1 --> STEP5A --> COND2
    COND2 --> ERR1
    ERR1 --> COND3
    COND3 --> STEP6A --> STEP6B --> COND4
    COND4 --> COND5
    COND5 --> STEP6C --> STEP6D --> COND6
    COND6 --> COND7
    COND7 --> ERR2
    ERR2 --> COND3
    COND5 --> COND3
    COND4 --> COND3
    COND3 --> COND8
    COND8 --> COND9
    COND9 --> STEP8A --> STEP8B --> COND10
    COND10 --> STEP8C --> STEP8D --> COND11
    COND11 --> ERR3
    ERR3 --> COND12
    COND10 --> COND12
    COND9 --> COND12
    COND8 --> COND12
    COND12 --> STEP10 --> ERR4
    ERR4 --> RETURN
    COND12 --> RETURN
```

**Business logic flow:**

1. **Initialization (lines 6889–6904):** Extracts provisional registration flag, number transfer request control code, and number transfer status from input maps. Prepares old control code for comparison.
2. **Movement Division Check (lines 6930–6945, 7048–7060):** When the movement division is NOT "Address Change/Registration" (00019) or "Address Change/Fixation" (00020), validates the residence target number area master. If search error flag is "1" or the map is null, raises error EKB0300-KW.
3. **New VA Check (lines 6961–7017):** When `newVAFlg` is true, queries service contract construction project list by `svcKeiNo`. For each project within the applicable date range, queries the construction project unique inquiry to check if a construction with an active status (140–190), type "New Installation" (001), and equipment usage present (1,2,3) exists. If so, blocks the addition with error EKBE720-KW (multi-function router delivery conflict).
4. **Check Mode — Same Contract Info (lines 7068–7110):** When `funcCode == "2"` (check mode) and `newVAFlg` is true, queries same-contract service information. For Net-HM/MZ/MT service group codes, queries provider service contract list and checks if broadband service (C014) has a status code less than 910 (indicating active). If so, raises error EKBE096--Q (router termination conflict with light phone addition).
5. **Phone Number Duplication Check (lines 7117–7129):** When not address-change, calls `isSameKeiNaiTelnoDbleCheck()` to verify the telephone number does not already exist within the same contract.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `trgtData` | `HashMap<String, Object>` | Target data map carrying the business context for the phone number addition operation. Contains fields like `ido_div` (movement division code), `kari_touroku_flg` (provisional registration flag), `dobaniten_req_ctrl_cd` (same-number transfer request control code), `telno` (telephone number), `svc_kei_no` (service contract number), and `svc_kei_ucwk_no` (service contract detail number). |
| 2 | `outMapEKK0191A010` | `CAANMsg` | Service contract detail inquiry response (eo light phone). Contains the previous same-number transfer request control code (`dobaniten_req_ctrl_cd`) from the existing service contract record. Used to compare against the new value to detect changes. |
| 3 | `outMapETU0021A010` | `CAANMsg` | Same-number transfer unique inquiry response. Contains the same-number transfer status (`dobaniten_stat`) from the NTT number portability inquiry, indicating the current state of the number transfer request (e.g., "021" = waiting for NTT transmission). |
| 4 | `outMapEZM0091A010` | `CAANMsg` | Residence target number area master inquiry response. Contains `search_err_flg` to indicate whether the residence area lookup succeeded or returned an error. Used to validate that the telephone number belongs to a valid number area. |
| 5 | `funcCode` | `String` | Function code that determines the processing mode. Value `"2"` indicates check mode, which triggers additional same-contract service information validation. This is used by the front-end screen to pre-validate before committing. |
| 6 | `newVAFlg` | `boolean` | New Virtual Appliance flag. When `true`, indicates that a new VA (Virtual Appliance, i.e., the eo gateway device) is being provisioned as part of this operation. Triggers construction project conflict checks to prevent equipment delivery conflicts. |
| 7 | `handle` | `SessionHandle` | Database session handle used for service inter-component calls (`callSvcInter`). Provides the transaction context and database connection for CBS (Component-Based Service) invocations. |
| 8 | `param` | `IRequestParameterReadWrite` | Request parameter object used to build input message maps for service calls. Passed to `editInMsg*` mapper methods and `callSvcInter`. |
| 9 | `svcKeiNo` | `String` | Service contract number — used as the key to query service contract construction project information (`KU0081B010`). Represents the specific service agreement under which the phone number addition is being performed. |

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

| Field | Source Class | Business Description |
|-------|-------------|---------------------|
| `telInfoMapper` | `JKKTelnoInfoAddCC` (inherited) | Data mapper for building input message maps and retrieving target data for CBS service calls |
| `KKOKU_FLG_ERR` | `JKKTelnoInfoAddBase` | Error flag constant `"0"` — used as the error management flag when adding error info |
| `KKOKU_FLG_KKOKU` | `JKKTelnoInfoAddBase` | National management flag constant `"1"` — used for error management in national-managed operations |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `telInfoMapper.editInMsgEKU0081B010` / `callSvcInter` | EKU0081B010 | Service Contract Construction Project (KU0081) | Queries the service contract construction project list using `svcKeiNo` as the key. Retrieves construction project number, applicable start date, and applicable end date. |
| R | `telInfoMapper.editInMsgEKU0011A010` / `callSvcInter` | EKU0011A010 | Construction Project Unique (KU0011) | Queries construction project unique information using `kojiakNo` as the key. Retrieves construction project status, construction project type code, and equipment usage flag. |
| R | `telInfoMapper.editInMsgEKK0081B009` / `callSvcInter` | EKK0081B009 | Same Service Contract (EKK0081) | Queries same-contract service information for the target service contract. Retrieves processing group code to identify the service type (Net-HM, Net-MZ, Net-MT). |
| R | `telInfoMapper.editInMsgEKK0341B002` / `callSvcInter` | EKK0341B002 | Provider Service Contract (EKK0341) | Queries provider service contract list for the service contract number (func_cd=8). Retrieves provider service code and provider service contract status to check for router termination conflicts. |
| R | `getRsltMsgListValue` | EKK0191A010 | Service Contract Detail (EKK0191) | Reads the previous same-number transfer request control code from the existing service contract detail inquiry result. |
| R | `getRsltMsgListValue` | ETU0021A010 | Same-Number Transfer (ETU0021) | Reads the same-number transfer status from the same-number transfer unique inquiry result. |
| R | `CAANMsg.getString` | EZM0091A010 | Residence Target Number Area Master (EZM0091) | Reads the search error flag from the residence target number area master inquiry result. |
| C | `addErrInfo` | - | Error Info | Writes error information to the `trgtData` map with error message key (e.g., EKBE720-KW) and error management flag. |
| - | `callSvcInter` | - | - | Generic service inter-component call — dispatches the prepared input message map to the appropriate CBS (Component-Based Service) and returns the result map. |
| - | `JPCDateChecker.isPastDate` | - | - | Date validation utility — checks if a date is on or after the current operation date. |
| - | `JPCDateChecker.isFutureDate` | - | - | Date validation utility — checks if a date is on or before the current operation date. |
| - | `isSameKeiNaiTelnoDbleCheck` | - | - | Duplicate phone number check — verifies that the telephone number does not already exist within the same service contract. |
| - | `isNull` | - | - | Null-check utility — determines whether a value is null or empty. |

### Business-level CRUD Summary:

- **Read (R):** The method performs primarily read-oriented validation. It queries construction project information, same-contract service information, provider service contracts, number transfer status, and residence area master data to validate business rules. No data is modified by this method.
- **Create (C):** The only create operation is `addErrInfo()`, which writes error records to the in-memory error tracking map (`trgtData`). No database writes occur.
- **Update (U):** None.
- **Delete (D):** None.

## 5. Dependency Trace

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

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | CBS: JKKTelnoInfoAddCC.executeHtelTelnoAdd() | `JKKTelnoInfoAddCC.executeHtelTelnoAdd` -> `JKKTelnoInfoAddCC.checkHtelTelnoAdd` | `callSvcInter [R] EKU0081B010`, `callSvcInter [R] EKU0011A010`, `callSvcInter [R] EKK0081B009`, `callSvcInter [R] EKK0341B002`, `addErrInfo [C] ErrorInfo` |

### Terminal operations from this method (deepest reach):

| Terminal Method | CRUD | Target Entity / SC |
|-----------------|------|-------------------|
| `isSameKeiNaiTelnoDbleCheck` | R | Same-contract phone number check (internal validation) |
| `addErrInfo` | C | Error info map (trgtData) |
| `getString` | R | CAANMsg list values from CBS responses |
| `callSvcInter` | R | CBS: EKU0081B010, EKU0011A010, EKK0081B009, EKK0341B002 |

## 6. Per-Branch Detail Blocks

### Block 1 — SET (Initialization) (L6889–6897)

Extracts initialization data from `trgtData` and input maps.

| # | Type | Code | Business Meaning |
|---|------|------|-----------------|
| 1 | SET | `kariTourokuFlg = (String)trgtData.get(JKKTelnoInfoAddConstCC.KARI_TOUROKU_FLG)` | Provisional registration flag [-> `kari_touroku_flg`] |
| 2 | SET | `dobanitenReqCtrlCd = (String)trgtData.get(JKKTelnoInfoAddConstCC.DOBANITEN_REQ_CTRL_CD)` | Same-number transfer request control code [-> `dobaniten_req_ctrl_cd`] |
| 3 | SET | `dobanitenReqCtrlCdBf = null` | Previous same-number transfer control code (initialized) |
| 4 | EXEC | `getRsltMsgListValue(outMapEKK0191A010, ..., DOBANITEN_REQ_CTRL_CD)` | Retrieves previous transfer control code from service contract detail inquiry result [-> EKK0191A010CBS] |
| 5 | SET | `dobanitenStat = null` | Same-number transfer status (initialized) |
| 6 | EXEC | `getRsltMsgListValue(outMapETU0021A010, ..., DOBANITEN_STAT)` | Retrieves transfer status from same-number transfer inquiry result [-> ETU0021A010CBS] |

### Block 2 — IF (Non-Address-Change: Residence Area Master Check) (L6930–7060)

> If the movement division is NOT "Address Change/Registration" (00019) or "Address Change/Fixation" (00020), validates the residence target number area master. This check ensures that the number area lookup succeeded and the telephone number is valid for the target area.

**Block 2.1 — IF (non-address-change guard)** `(idoDiv != "00019" && idoDiv != "00020")` (L6930)

| # | Type | Code | Business Meaning |
|---|------|------|-----------------|
| 1 | EXEC | `outMapEZM0091A010.getString(EZM0091A010CBSMsg.SEARCH_ERR_FLG)` | Retrieves search error flag from residence area master inquiry |

**Block 2.1.1 — IF (search error detected)** `("1".equals(searchErrFlg))` (L6937)

> If the search returned error flag "1", the residence area master lookup failed — the number cannot be validated.

| # | Type | Code | Business Meaning |
|---|------|------|-----------------|
| 1 | CALL | `addErrInfo(trgtData, "EKB0300-KW", "住所対象番号区域化マスタ,住所コード", null, KKOKU_FLG_ERR)` | Error: "Residence target number area master, residence code" — indicates the number area lookup failed |
| 2 | SET | `isErr = true` | Marks error state |

**Block 2.1.2 — ELSE (null map)** (L6945)

> If the residence area master response map itself is null, the inquiry was not made or failed silently.

| # | Type | Code | Business Meaning |
|---|------|------|-----------------|
| 1 | CALL | `addErrInfo(trgtData, "EKB0300-KW", "住所対象番号区域化マスタ,住所コード", null, KKOKU_FLG_ERR)` | Error: "Residence target number area master, residence code" — indicates no inquiry was performed |
| 2 | SET | `isErr = true` | Marks error state |

### Block 3 — IF (New VA Check: Construction Project Conflict) (L6961–7017)

> If `newVAFlg` is true, this block checks for existing active construction projects that already have equipment (multi-function router) assigned. Adding a phone number to the same contract would create a delivery conflict.

**Block 3.1 — IF (`newVAFlg`)** (L6961)

| # | Type | Code | Business Meaning |
|---|------|------|-----------------|
| 1 | SET | `tmpOutMapEKU0081B010 = null` | Initializes temporary output map |
| 2 | SET | `inMapEKU0081B010 = telInfoMapper.editInMsgEKU0081B010(param, svcKeiNo)` | Builds input map for service contract construction project list inquiry |
| 3 | SET | `tmpOutMapEKU0081B010 = callSvcInter(handle, param, inMapEKU0081B010)` | Calls CBS to query construction project list by service contract number |

**Block 3.2 — FOR (Iterate construction projects)** (L6969–7017)

| # | Type | Code | Business Meaning |
|---|------|------|-----------------|
| 1 | SET | `eku0081b010_mapList = tmpOutMapEKU0081B010.getCAANMsgList(EKU0081B010CBSMSG1LIST)` | Extracts construction project list from CBS response |
| 2 | SET | `kojiakNo = eku0081b010_map.getString(EKU0081B010CBSMsg1List.KOJIAK_NO)` | Retrieves construction project number |
| 3 | SET | `svkeiKojiakTstaymd = eku0081b010_map.getString(EKU0081B010CBSMsg1List.SVKEI_KOJIAK_TSTAYMD)` | Retrieves applicable start date (YYYYMMDD) |
| 4 | SET | `svkeiKojiakTendymd = eku0081b010_map.getString(EKU0081B010CBSMsg1List.SVKEI_KOJIAK_TENDYMD)` | Retrieves applicable end date (YYYYMMDD) |

**Block 3.2.1 — IF (dates within applicable range)** `(isPastDate(start) && isFutureDate(end))` (L6981)

> The construction project is within its valid period: operation date is on or after the start date AND on or before the end date.

| # | Type | Code | Business Meaning |
|---|------|------|-----------------|
| 1 | CALL | `JPCDateChecker.isPastDate(svkeiKojiakTstaymd, getOpeDate(null), "1")` | Checks: operation date >= applicable start date |
| 2 | CALL | `JPCDateChecker.isFutureDate(svkeiKojiakTendymd, getOpeDate(null), "1")` | Checks: operation date <= applicable end date |

**Block 3.2.2 — IF (`kojiakNo` not null)** (L6985)

> A construction project number was retrieved for this project.

| # | Type | Code | Business Meaning |
|---|------|------|-----------------|
| 1 | SET | `inMapEKU0011A010 = telInfoMapper.editInMsgEKU0011A010(param, kojiakNo)` | Builds input for construction project unique inquiry |
| 2 | SET | `outMapEKU0011A010 = callSvcInter(handle, param, inMapEKU0011A010)` | Calls CBS to query construction project detail |
| 3 | SET | `eku0011a010_map = eku0011a010_mapList[0]` | Retrieves first result from unique inquiry |
| 4 | SET | `kojiakStat = eku0011a010_map.getString(EKU0011A010CBSMsg1List.KOJIAK_STAT)` | Retrieves construction project status code |
| 5 | SET | `kojiakSbtCd = eku0011a010_map.getString(EKU0011A010CBSMsg1List.KOJIAK_SBT_CD)` | Retrieves construction project type code |
| 6 | SET | `equipRyuyoUm = eku0011a010_map.getString(EKU0011A010CBSMsg1List.EQUIP_RYUYO_UM)` | Retrieves equipment usage flag |

**Block 3.2.3 — IF (equipment usage flag present)** `(!isNull(equipRyuyoUm))` (L6994)

> Equipment usage has been specified. Must check if the construction status indicates active work.

**Block 3.2.3.1 — IF (active status + new installation + equipment present)** (L6999–7006)

> Construction status is in an active phase (140–190): Ordered, Investigation Complete, Inspection Determined, Investigation Reserved, Key Release Ordered, or On-site Work Complete. AND the construction type is "New Installation" (001). AND equipment is available (1, 2, or 3). This combination means a multi-function router is already being delivered under this construction, and adding a new phone number to the same contract would cause a delivery conflict.

| # | Type | Code | Business Meaning |
|---|------|------|-----------------|
| 1 | SET | `kojiakStat IN ["140","150","160","170","180","190"]` [-> CD00474_IRI_ZM through CD00474_GEMBA_SAGYO_FIN_ZM] | Construction status is in active work phases |
| 2 | SET | `kojiakSbtCd == "001"` [-> CD00577_NEWESTA] | Construction type is New Installation |
| 3 | SET | `equipRyuyoUm IN ["1","2","3"]` [-> EQUIP_RYUYO_UM_ARI_LIST] | Equipment usage: present (multiple sub-values) |
| 4 | CALL | `addErrInfo(trgtData, "EKBE720-KW", "多機能ルーターの送付を伴う電話番号追加は", null, KKOKU_FLG_ERR)` | Error: "Phone number addition accompanying multi-function router delivery" — blocks the addition |
| 5 | SET | `isErr = true` | Marks error state |

### Block 4 — IF (Check Mode — Same Contract Info) (L7068–7110)

> When `funcCode == "2"` (check/pre-validation mode) and `newVAFlg` is true, validates same-contract service information and provider service contracts to prevent router contract termination conflicts.

**Block 4.1 — IF (`funcCode == "2"`, check mode)** (L7068)

| # | Type | Code | Business Meaning |
|---|------|------|-----------------|
| 1 | SET | `"2".equals(funcCode)` | Check mode flag |

**Block 4.2 — IF (check mode + new VA)** (L7072)

| # | Type | Code | Business Meaning |
|---|------|------|-----------------|
| 1 | SET | `inMapEKK0081B009 = telInfoMapper.editInMsgEKK0081B009(param, trgtData, tmpOutMapEKK0081B009, svcKeiNo)` | Builds input for same-contract service information inquiry |
| 2 | SET | `tmpOutMapEKK0081B009 = callSvcInter(handle, param, inMapEKK0081B009)` | Calls CBS to query same-contract service information |

**Block 4.3 — FOR (Iterate same-contract results)** (L7078–7110)

| # | Type | Code | Business Meaning |
|---|------|------|-----------------|
| 1 | SET | `rsltMsgEKK0081B009 = rsltMsgEKK0081B009List[i]` | Retrieves current row from same-contract inquiry result |
| 2 | SET | `prcGrpCd = rsltMsgEKK0081B009.getString(EKK0081B009CBSMsg1List.PRC_GRP_CD)` | Retrieves processing group code |

**Block 4.3.1 — IF (Net-HM/MZ/MT service group)** `(prcGrpCd IN ["02", "03", "04"])` (L7085–7087)

> The service is a fiber-optic broadband service group: Net-HM (02), Net-MZ (03), or Net-MT (04). These are K-Opticom's main fiber plans that include router provision.

| # | Type | Code | Business Meaning |
|---|------|------|-----------------|
| 1 | SET | `prcGrpCd IN ["02", "03", "04"]` [-> PRC_GRP_CD_NET_HM, PRC_GRP_CD_NET_MZ, PRC_GRP_CD_NET_MT] | Service is in Net-HM/MZ/MT group (fiber broadband) |

**Block 4.3.1.1 — Query provider service contract list** (L7092–7094)

| # | Type | Code | Business Meaning |
|---|------|------|-----------------|
| 1 | SET | `inMapEKK0341B002 = telInfoMapper.editInMsgEKK0341B002(param, svcKeiNo, FUNC_CD_8)` | Builds input for provider service contract inquiry (func_cd=8 = provider service) |
| 2 | SET | `outMapEKK0341B002 = callSvcInter(handle, param, inMapEKK0341B002)` | Calls CBS to query provider service contract list |

**Block 4.3.1.2 — FOR (Iterate provider contracts)** (L7100–7110)

| # | Type | Code | Business Meaning |
|---|------|------|-----------------|
| 1 | SET | `rsltMsgEKK0341B002 = rsltMsgEKK0341B002List[k]` | Retrieves current row from provider contract result |
| 2 | SET | `kktkSvcCd = rsltMsgEKK0341B002.getString(EKK0341B002CBSMsg1List.KKTK_SVC_CD)` | Retrieves provider service code |
| 3 | SET | `kktkSvcKeiStat = rsltMsgEKK0341B002.getString(EKK0341B002CBSMsg1List.KKTK_SVC_KEI_STAT)` | Retrieves provider service contract status code |

**Block 4.3.1.2.1 — IF (broadband service with status < 910)** (L7104–7107)

> The provider service is broadband (C014) with a status code less than 910, meaning the router contract is still active. Adding a light phone number that would require router reassignment/termination would conflict with the existing active broadband service.

| # | Type | Code | Business Meaning |
|---|------|------|-----------------|
| 1 | SET | `kktkSvcCd == "C014"` [-> KKTK_SVC_CD_BBR] | Provider service is Broadband |
| 2 | SET | `kktkSvcKeiStat.compareTo("910") > 0` — condition is `> 0` meaning stat < 910 | Status is below 910 (active router contract) |
| 3 | CALL | `addErrInfo(trgtData, "EKBE096--Q", "光電話・番号追加,多機能ルーターへの交換となる,ルーターの解約", null, KKOKU_FLG_KKOKU)` | Error: "Light phone/number addition, requires exchange to multi-function router, router termination" — blocks the addition |
| 4 | RETURN | `break` | Exits the inner loop |

### Block 5 — IF (Phone Number Duplication Check) (L7117–7129)

> Regardless of mode (except address-change), this final guard checks whether the telephone number being added already exists within the same service contract to prevent duplicate assignments.

**Block 5.1 — IF (not address-change)** `(idoDiv != "00019" && idoDiv != "00020")` (L7117)

| # | Type | Code | Business Meaning |
|---|------|------|-----------------|
| 1 | SET | `isSameKeiNaiTelnoDbleCheck(handle, param, trgtData, telno, svcKeiNo, svcKeiUcwkNo)` | Calls duplicate phone number check for the same contract |
| 2 | CALL | `(String)trgtData.get(JKKTelnoInfoAddConstCC.TELNO)` | Retrieves telephone number from target data |
| 3 | CALL | `(String)trgtData.get(JKKTelnoInfoAddConstCC.SVC_KEI_NO)` | Retrieves service contract number from target data |
| 4 | CALL | `(String)trgtData.get(JKKTelnoInfoAddConstCC.SVC_KEI_UCWK_NO)` | Retrieves service contract detail number from target data |

**Block 5.1.1 — IF (duplicate found)** (!`isSameKeiNaiTelnoDbleCheck(...)`) (L7123)

> The duplicate check method internally sets the error info when a duplicate is found.

| # | Type | Code | Business Meaning |
|---|------|------|-----------------|
| 1 | SET | `isErr = true` | Marks error state (error info already set internally) |

### Block 6 — RETURN (L7135)

| # | Type | Code | Business Meaning |
|---|------|------|-----------------|
| 1 | RETURN | `return isErr` | Returns `true` if any error was found during validation, `false` if all checks passed |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `ido_div` | Field | Movement Division Code — classifies the type of account change triggering this operation. Values: "00019" (Address Change/Registration), "00020" (Address Change/Fixation), "00041" (Light Phone/Number Addition). When not an address-change type, additional validation applies. |
| `kari_touroku_flg` | Field | Provisional Registration Flag — indicates whether the record is temporarily registered. |
| `dobaniten_req_ctrl_cd` | Field | Same-Number Transfer Request Control Code — controls the request state for number portability (e.g., "1" = transfer request, "0" = pending). |
| `dobaniten_stat` | Field | Same-Number Transfer Status — NTT number portability inquiry result status (e.g., "021" = waiting for NTT transmission). |
| `telno` | Field | Telephone Number — the phone number being added to the service contract. |
| `svc_kei_no` | Field | Service Contract Number — the key identifier for the service agreement under which the phone number is being added. |
| `svc_kei_ucwk_no` | Field | Service Contract Detail Number — internal tracking ID for a specific line item within a service contract. |
| `kojiak_no` | Field | Construction Project Number — unique identifier for a physical installation/maintenance project. |
| `kojiak_stat` | Field | Construction Project Status — indicates the current phase of a construction project (e.g., "140" = ordered, "150" = investigation complete, "190" = on-site work complete). |
| `kojiak_sbt_cd` | Field | Construction Project Type Code — classifies the type of construction (e.g., "001" = new installation). |
| `equip_ryuyo_um` | Field | Equipment Usage Flag — indicates whether equipment (router, gateway) is assigned to the construction project. Values "1", "2", "3" mean equipment is present. |
| `prc_grp_cd` | Field | Processing Group Code — classifies the service type within the same-contract query. "02" = Net-HM (Hi-Klassik), "03" = Net-MZ (Next), "04" = Net-MT (Type T). |
| `kktk_svc_cd` | Field | Provider Service Code — identifies the type of provider service (e.g., "C014" = broadband). |
| `kktk_svc_kei_stat` | Field | Provider Service Contract Status — numeric status of the provider service contract (e.g., "910" = reference threshold for active/inactive). |
| `search_err_flg` | Field | Search Error Flag — indicates whether the residence target number area master lookup succeeded ("1" = error). |
| Htel (光電話) | Business term | Light Phone — K-Opticom's fiber-optic landline telephone service, bundled with broadband internet. |
| Telno (電話番号) | Business term | Telephone Number — the phone number to be added. |
| VA (Virtual Appliance) | Business term | Gateway device — the eo-branded router/set-top box provided to customers for connecting to the fiber-optic network. |
| DOBANITEN (同番移転) | Acronym | Same-Number Transfer — number portability process where a customer keeps their existing phone number while switching providers. |
| KKTK (機器提供) | Acronym | Equipment Provision — service related to providing customer premises equipment (routers, modems). |
| EKK* / EKU* / ETU* / EZM* | Acronym | Service Component message codes — EKK = contract-related, EKU = construction/project-related, ETU = transfer-related, EZM = master data-related. |
| KOJIAK (工事案件) | Acronym | Construction Project — a physical installation or maintenance work order assigned to a service contract. |
| KARI_TOUROKU (仮登録) | Acronym | Provisional Registration — temporary record creation before full validation. |
| FUNC_CD_8 | Constant | Function Code 8 — indicates provider service inquiry context. |
| KKOKU_FLG_ERR | Constant | "0" — national management error flag, used to categorize error severity. |
| KKOKU_FLG_KKOKU | Constant | "1" — national management flag, used for errors in nationally-managed operations. |

---

*Document generated for K-Opticom e-Customer Backbone System (eo顧客基幹システム). Method: `JKKTelnoInfoAddCC.checkHtelTelnoAdd()`. Lines 6874–7139, 266 LOC.*