# Business Logic — JBSbatKKPlaceNoChgRnkiInfCst.execute() [259 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.business.service.JBSbatKKPlaceNoChgRnkiInfCst` |
| Layer | Service (Batch processing — koptBatch module) |
| Module | `service` (Package: `eo.business.service`) |

## 1. Role

### JBSbatKKPlaceNoChgRnkiInfCst.execute()

This method is the **Place Number Change Related Information Extraction** component (`場所番号変更連携情報抽出品`), a batch service responsible for determining which intermediate file records to generate following a residence/address change (`住所変更`, ADCHG) operation in K-Opticom's customer infrastructure system. Its primary business purpose is to identify the correct service contract line and decide whether device provisioning output should be sent to an intermediate file (JBSbatKKIFM270 format) for downstream equipment delivery workflows.

The method implements a **conditional routing/dispatch pattern** across three mutually exclusive business scenarios: (1) **Delayed Start** (`ディレイド起動`, `DELAYED_START = "1"`) — where the delay flag is set to process immediately; (2) **Move-in Reservation Arrived** (`入居予定日の到来`, the move-in reservation date has been reached) — where the service contract line item's reservation date has come due; and (3) **New Construction Work Completed** (`新設工事の完了`) — where the construction work completion record (`KK_T_KJ_FIN_WK`) has been finalized. Only one of these three paths will produce output.

Additionally, the method acts as a **gatekeeper** that filters out ineligible records: it skips processing if the target device identifier number is Hampin-locked (hiring contract), if the contract is in a suspended state (commented-out code), and excludes equipment provider service contracts that have been surrendered (`isSurrenderService`). The method is called as a shared component from `JBSbatKKAdChgCstScreenKidou`, which orchestrates the broader address change and screen relocation batch workflow.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["execute(inMap)"])

    START --> INIT["Initialize: outputItem, outMap"]
    INIT --> READ_IN["Read input fields from inMap"]
    READ_IN --> CHECK_DELAYED["isDelayed flag default to DELAYED_NOT_START"]

    CHECK_DELAYED --> EMPTY_CHECK["Is inChbfSkbtNo or inChafSkbtNo empty?"]
    EMPTY_CHECK -- Yes --> EARLY_NULL["Return null"]
    EMPTY_CHECK -- No --> HMPIN_CHECK["Check Hampin: executeKK_T_KKTK_SVC_KEI_KK_SELECT_092"]
    HMPIN_CHECK --> HMPIN_FOUND{"hmpinInfo != null?"}
    HMPIN_FOUND -- Yes --> HMPIN_RETURN["Return null"]
    HMPIN_FOUND -- No --> SVC_CONTRACT["Service Contract Retrieval Chain"]

    SVC_CONTRACT --> CONTRACT_1["SELECT_094: Parent service contract"]
    CONTRACT_1 --> FOUND_1{"kktkSvcKeiInfo found?"}
    FOUND_1 -- Yes --> CONTRACT_DONE["trgSvcKeiNo set"]
    FOUND_1 -- No --> CONTRACT_2["SELECT_095: Parent service contract line item"]
    CONTRACT_2 --> LOOP_2{"svkeiKaisenUwiInfo rows?"}
    LOOP_2 -- Yes --> FOUND_2["trgSvcKeiNo set, break"]
    LOOP_2 -- No --> CONTRACT_3["SELECT_096: Parent service contract internal"]
    CONTRACT_3 --> FOUND_3{"kktkSvcKeiInfo found?"}
    FOUND_3 -- Yes --> FOUND_4
    FOUND_3 -- No --> CONTRACT_4["SELECT_097: Parent option service contract"]
    CONTRACT_4 --> FOUND_4{"kktkSvcKeiInfo found?"}
    FOUND_4 -- Yes --> CONTRACT_DONE
    FOUND_4 -- No --> SVC_NULL["Return null"]

    CONTRACT_DONE --> TRG_CHECK{"trgSvcKeiNo empty?"}
    TRG_CHECK -- Yes --> TRG_NULL_RETURN["Return null"]
    TRG_CHECK -- No --> DELAYED_BRANCH{"DELAYED_START.equals(isDelayed)?"}

    DELAYED_BRANCH -- Yes --> DELAYED_PATH["Delayed Start Branch"]
    DELAYED_PATH --> DELAYED_SET["Set outMap: modelCd, seizureNo, chgRsnCd, stcPlaceNo, svcKeiNo"]
    DELAYED_SET --> DELAYED_SURRENDER{"isSurrenderService(inChgTgKeiNo)?"}
    DELAYED_SURRENDER -- No --> DELAYED_ADD["outputItem.addOutMapList(outMap)"]
    DELAYED_SURRENDER -- Yes --> DELAYED_SKIP["Skip addOutMapList"]
    DELAYED_ADD --> DELAYED_RETURN["Return outputItem"]
    DELAYED_SKIP --> DELAYED_RETURN

    DELAYED_BRANCH -- No --> NYUKYO_CHECK["Check move-in reservation: executeKK_T_SVKEI_KAISEN_UW_KK_SELECT_026"]
    NYUKYO_CHECK --> NYUKYO_FOUND{"nyukyoRsvTriKisnInfo != null?"}
    NYUKYO_FOUND -- Yes --> NYUKYO_PATH["Move-in Reservation Arrived Branch"]
    NYUKYO_PATH --> NYUKYO_SET["Set outMap: modelCd, seizureNo, chgRsnCd, stcPlaceNo, svcKeiNo"]
    NYUKYO_SET --> NYUKYO_SURRENDER{"isSurrenderService(inChgTgKeiNo)?"}
    NYUKYO_SURRENDER -- No --> NYUKYO_ADD["outputItem.addOutMapList(outMap)"]
    NYUKYO_SURRENDER -- Yes --> NYUKYO_SKIP["Skip addOutMapList"]
    NYUKYO_ADD --> NYUKYO_RETURN["Return outputItem"]
    NYUKYO_SKIP --> NYUKYO_RETURN

    NYUKYO_FOUND -- No --> NEW_KJ_CHECK["New Construction Work Completed: executeKK_T_KJ_FIN_WK_KK_SELECT_020"]
    NEW_KJ_CHECK --> FOR_KJ{"kjFinRnkiInfo rows?"}
    FOR_KJ -- No --> FINAL_NULL["Return null"]
    FOR_KJ -- Yes --> KJ_LOOP["Loop: for each KK_T_KJ_FIN_WK row"]
    KJ_LOOP --> KJ_KOJIAK["Get trgKojiakNo from row"]
    KJ_KOJIAK --> KJ_SELECT["executeKU_T_SVKEI_KOJIAK_KK_SELECT_007"]
    KJ_SELECT --> KJ_FOUND{"KOJIAK row exists?"}
    KJ_FOUND -- No --> CONTINUE["continue loop"]
    KJ_FOUND -- Yes --> KJ_SET["Set outMap: modelCd, seizureNo, chgRsnCd, stcPlaceNo, svcKeiNo"]
    KJ_SET --> KJ_SURRENDER{"isSurrenderService(inChgTgKeiNo)?"}
    KJ_SURRENDER -- No --> KJ_ADD["outputItem.addOutMapList(outMap)"]
    KJ_SURRENDER -- Yes --> KJ_SKIP["Skip addOutMapList"]
    KJ_ADD --> KJ_RETURN["Return outputItem"]
    KJ_SKIP --> KJ_RETURN

    CONTINUE --> KJ_LOOP_NEXT["Next row"]
    KJ_LOOP_NEXT --> KJ_FOUND
    KJ_LOOP_NEXT --> FOR_KJ

    FOR_KJ_NEXT["Loop ends, no match"] --> FINAL_NULL
```

**Constant Resolution Reference:**

| Constant | Value | Business Meaning |
|----------|-------|------------------|
| `DELAYED_START` | `"1"` | Delayed start flag ON — process immediately without waiting for reservation date |
| `DELAYED_NOT_START` | `"0"` | Delayed start flag OFF / not started |
| `ADCHG_DTL_SBT_CD_KOJIAK_NO` | `"06"` | Address change detail subtype code (Work order number) — **currently commented out** |
| `KU_T_KOJIAK_KOJIAK_STAT` | `"900"` | Work order status (Suspended/Canceled) — **currently commented out** |
| `KIKI_CHG_RSN_CD` output | `"1"` | Device change reason code = "1" (changed from "2" per OM-2014-0001147) |

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `inMap` | `JBSbatServiceInterfaceMap` | Input message envelope carrying address change processing data. Contains the residence change number (`ADCHG_NO`), the transfer destination service contract line item number (`ITENS_SVKEI_KISUW_NO`), the change target contract number (`CHG_TG_KEI_NO`), the pre-change device identifier number (`CHBF_SKBT_NO`), and the post-change device identifier number (`CHAF_SKBT_NO`). Also carries the `IS_DELAYED` flag that determines whether to process immediately or wait for the move-in reservation date. |

**Instance Fields read by this method:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `db_KK_T_KKTK_SVC_KEI` | `JBSbatSQLAccess` | SQL access to `KK_T_KKTK_SVC_KEI` (Equipment provider service contract table) |
| `db_KK_T_SVKEI_KAISEN_UW` | `JBSbatSQLAccess` | SQL access to `KK_T_SVKEI_KAISEN_UW` (Service contract line item / move-in reservation table) |
| `db_KK_T_KJ_FIN_WK` | `JBSbatSQLAccess` | SQL access to `KK_T_KJ_FIN_WK` (Work completion work table) |
| `db_KU_T_SVKEI_KOJIAK` | `JBSbatSQLAccess` | SQL access to `KU_T_SVKEI_KOJIAK` (Service contract - Work order table) |
| `db_KK_T_SVC_KEI` | `JBSbatSQLAccess` | SQL access to `KK_T_SVC_KEI` (Service contract table) |
| `opeDate` | `String` (inherited) | Operating date — the business date for processing (used in date-based queries and `adjustDate` calls) |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `executeKK_T_KKTK_SVC_KEI_KK_SELECT_092` | KK_T_KKTK_SVC_KEI_KK_SELECT_092 | `KK_T_KKTK_SVC_KEI` | Check Hampin-locked devices — query equipment provider service contract by target contract number, pre-change identifier, and operating date. Used as a filter to skip Hampin-locked lines. |
| R | `executeKK_T_KKTK_SVC_KEI_KK_SELECT_094` | KK_T_KKTK_SVC_KEI_KK_SELECT_094 | `KK_T_KKTK_SVC_KEI` | Retrieve parent service contract by reference date, target contract number, post-change identifier, parent type code `"20991231"`, and parent-child relation `"01"` (parent is service contract). |
| R | `executeKK_T_KKTK_SVC_KEI_KK_SELECT_095` | KK_T_KKTK_SVC_KEI_KK_SELECT_095 | `KK_T_KKTK_SVC_KEI` | Retrieve parent service contract line item — query with reference dates, target contract number, post-change identifier, and relation type `"02"` (parent is service contract line item). Iterates over multiple rows. |
| R | `executeKK_T_KKTK_SVC_KEI_KK_SELECT_096` | KK_T_KKTK_SVC_KEI_KK_SELECT_096 | `KK_T_KKTK_SVC_KEI` | Retrieve parent service contract internal — query with reference date, target contract number, post-change identifier, and relation type `"03"` (parent is service contract internal). |
| R | `executeKK_T_KKTK_SVC_KEI_KK_SELECT_097` | KK_T_KKTK_SVC_KEI_KK_SELECT_097 | `KK_T_KKTK_SVC_KEI` | Retrieve parent option service contract — query with relation type `"04"` (parent is option service contract). |
| R | `executeKK_T_SVKEI_KAISEN_UW_KK_SELECT_026` | KK_T_SVKEI_KAISEN_UW_KK_SELECT_026 | `KK_T_SVKEI_KAISEN_UW` | Check move-in reservation — query service contract line item / move-in reservation by transfer source contract line item number and operating date +1 day. Determines if the move-in date has arrived. |
| R | `executeKK_T_KJ_FIN_WK_KK_SELECT_020` | KK_T_KJ_FIN_WK_KK_SELECT_020 | `KK_T_KJ_FIN_WK` | Check new construction work completion — query work completion work table by address change number and operating date. Iterates over all matching completion records. |
| R | `executeKU_T_SVKEI_KOJIAK_KK_SELECT_007` | KU_T_SVKEI_KOJIAK_KK_SELECT_007 | `KU_T_SVKEI_KOJIAK` | Verify work order status — query service contract / work order by target service contract number and target work order number. If no row found, the work order has been cancelled or is not active. |
| R | `JBSbatCommonDBInterface.selectNext` | — | Various tables | Generic row fetching from SQL query result sets across all tables above. |
| R | `JBSbatCommonDBInterface.getString` | — | Various tables | Extract string values from result set rows: `SVC_KEI_NO`, `TAKNKIKI_MODEL_CD`, `KIKI_SEIZO_NO`, `KIKI_STC_SAKI_PLACE_NO`, `KOJIAK_NO`. |
| R | `JBSbatFUCaseFileRnkData.getString` | — | — | Reads string from case file rank data structure. |
| R | `JBSbatFUMoveNaviData.getString` | — | — | Reads string from move navigation data structure. |
| R | `JBSbatZMAdDataSet.getString` | — | — | Reads string from admission data set. |
| R | `JESC0101B010TPMA.getString` | — | — | Reads string from transfer parameter data. |
| R | `JESC0101B020TPMA.getString` | — | — | Reads string from transfer parameter data. |
| C | `JBSbatKKGetCTITelno.addOutMapList` | JBSbatKKGetCTITelno | — | Adds output map to the output item's list of records to be written. |
| - | `JBSbatACIcjknTrkmRsltHenshu.setOutFlg` | JBSbatACIcjknTrkmRsltHenshu | — | Sets output flag to true on the interface map. |
| - | `JBSbatACTelnoGuideUseChrgInfoTrkmDataMake.setOutFlg` | JBSbatACTelnoGuideUseChrgInfoTrkmDataMake | — | Sets output flag on data make handler. |
| - | `JBSbatInterface.adjustDate` | JBSbatInterface | — | Date adjustment utility — adds/subtracts days from the operating date. |
| - | `JBSbatInterface.trim` | JBSbatInterface | — | String trim utility. |
| - | `JZMBatCommon.trim` | JZMBatCommon | — | String trim utility. |
| - | `JBSbatKKBmpKaihkPrdChokNoDel.trim` | JBSbatKKBmpKaihkPrdChokNoDel | — | String trim utility. |
| - | `JBSbatKKSodSendReqBase.trim` | JBSbatKKSodSendReqBase | — | String trim utility. |
| - | `JBSbatKKTchishoDelete.trim` | JBSbatKKTchishoDelete | — | String trim utility. |
| - | `JKKShkaFinJiKikiStaAddCC.adjustDate` | JKKShkaFinJiKikiStaAddCC | — | Date adjustment for settlement finalization device status. |
| - | `JKKSyuKeiStabunKikiStaAddCC.adjustDate` | JKKSyuKeiStabunKikiStaAddCC | — | Date adjustment for settlement allocation device status. |
| - | `JEKK0081C310TPMA.setString` | JEKK0081C310TPMA | — | Sets string value in transfer parameter data. |
| - | `JBSbatKKSodSendReqBase.trim` | JBSbatKKSodSendReqBase | — | String trim utility. |
| - | `Mover.setString` | Mover | — | Sets string value via Mover utility. |
| - | `JBSbatKKPlaceNoChgRnkiInfCst.isStringEmpty` | — | — | Internal utility to check if a string is null or empty after trimming. |
| - | `JBSbatKKPlaceNoChgRnkiInfCst.isSurrenderService` | — | — | Internal utility to determine if a service contract has been surrendered (cancelled) by checking the equipment provider service contract status. |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Batch: `JBSbatKKAdChgCstScreenKidou` | `JBSbatKKAdChgCstScreenKidou.execute` → iterate `KK_T_ADCHG` rows → `execObjPlaceNoChg.execute(inMap)` | `executeKK_T_KKTK_SVC_KEI_KK_SELECT_092 [R] KK_T_KKTK_SVC_KEI`, `executeKK_T_KKTK_SVC_KEI_KK_SELECT_094 [R] KK_T_KKTK_SVC_KEI`, `executeKK_T_KKTK_SVC_KEI_KK_SELECT_095 [R] KK_T_KKTK_SVC_KEI`, `executeKK_T_KKTK_SVC_KEI_KK_SELECT_096 [R] KK_T_KKTK_SVC_KEI`, `executeKK_T_KKTK_SVC_KEI_KK_SELECT_097 [R] KK_T_KKTK_SVC_KEI`, `executeKK_T_SVKEI_KAISEN_UW_KK_SELECT_026 [R] KK_T_SVKEI_KAISEN_UW`, `executeKK_T_KJ_FIN_WK_KK_SELECT_020 [R] KK_T_KJ_FIN_WK`, `executeKU_T_SVKEI_KOJIAK_KK_SELECT_007 [R] KU_T_SVKEI_KOJIAK`, `isSurrenderService [R] KK_T_KKTK_SVC_KEI` |

## 6. Per-Branch Detail Blocks

### Block 1 — INITIALIZATION (L198)

> Initialize output containers and read input fields from the input message envelope.

| # | Type | Code |
|---|------|------|
| 1 | SET | `outputItem = new JBSbatOutputItem()` // Create output container |
| 2 | SET | `outMap = new JBSbatServiceInterfaceMap()` // Create intermediate file output map |
| 3 | EXEC | `outMap.setOutFlg(true)` // Set output flag to true |
| 4 | SET | `inAdchgNo = inMap.getString(JBSbatKK_T_ADCHG.ADCHG_NO)` // Residence change number — **commented out (unused)** |
| 5 | SET | `inItensSvkeiKisuwNo = inMap.getString(JBSbatKK_T_ADCHG.ITENS_SVKEI_KISUW_NO)` // Transfer destination service contract line item number |
| 6 | SET | `inChgTgKeiNo = inMap.getString(JBSbatKK_T_ADCHG_DTL.CHG_TG_KEI_NO)` // Change target contract number |
| 7 | SET | `inChbfSkbtNo = inMap.getString(JBSbatKK_T_ADCHG_DTL.CHBF_SKBT_NO)` // Pre-change device identifier number |
| 8 | SET | `inChafSkbtNo = inMap.getString(JBSbatKK_T_ADCHG_DTL.CHAF_SKBT_NO)` // Post-change device identifier number |
| 9 | SET | `isDelayed = inMap.getString("IS_DELAYED")` // Delayed start flag from input |
| 10 | IF | `isDelayed == null || "".equals(isDelayed.trim())` → `isDelayed = DELAYED_NOT_START` (`"0"`) [L220] // Default delayed flag to "not started" |

### Block 2 — DEVICE IDENTIFIER NULL CHECK (L238)

> Early termination: skip processing if either pre-change or post-change device identifier numbers are empty. This is a data integrity guard.

| # | Type | Code |
|---|------|------|
| 1 | IF | `isStringEmpty(inChbfSkbtNo) \|\| isStringEmpty(inChafSkbtNo)` → `return null` [L238] |

### Block 3 — HAMPIN LOCK CHECK (L242)

> Query the equipment provider service contract table to check if the target contract line has a Hampin lock (hiring contract). If Hampin-locked, skip processing. Hampin is a device leasing service.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `executeKK_T_KKTK_SVC_KEI_KK_SELECT_092(new String[]{inChgTgKeiNo, inChbfSkbtNo, opeDate})` // Query for Hampin-locked devices |
| 2 | SET | `hmpinInfo = db_KK_T_KKTK_SVC_KEI.selectNext()` // Fetch result row |
| 3 | IF | `hmpinInfo != null` → `return null` [L245] // Hampin-locked → skip |

### Block 4 — SERVICE CONTRACT RETRIEVAL CHAIN (L254–L298)

> Retrieve the parent service contract number through a cascading series of fallback SQL queries. Each attempt tries a different parent-child relationship type until one succeeds. This determines which service contract the change target is associated with.

#### Block 4.1 — SELECT_094: Parent Service Contract (L256)

> First attempt: look for a direct parent service contract relationship (`"01"`).

| # | Type | Code |
|---|------|------|
| 1 | CALL | `executeKK_T_KKTK_SVC_KEI_KK_SELECT_094(new String[]{"20991231", inChgTgKeiNo, inChafSkbtNo, "01", "20991231"})` // Parent service contract lookup |
| 2 | SET | `kktkSvcKeiInfo = db_KK_T_KKTK_SVC_KEI.selectNext()` |
| 3 | IF | `kktkSvcKeiInfo != null` → `trgSvcKeiNo = kktkSvcKeiInfo.getString(JBSbatKK_T_SVC_KEI.SVC_KEI_NO)` [L260] // Extract service contract number |

#### Block 4.2 — SELECT_095: Parent Service Contract Line Item (L263)

> Second attempt: look for a parent service contract line item relationship (`"02"`). Iterates over all matching rows.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `executeKK_T_KKTK_SVC_KEI_KK_SELECT_095(new String[]{"20991231", "20991231", "20991231", inChgTgKeiNo, inChafSkbtNo, "02", "20991231"})` // Parent line item lookup |
| 2 | FOR | `svkeiKaisenUwiInfo = db_KK_T_KKTK_SVC_KEI.selectNext()` while `!= null` [L265] |
| 3 | SET | `kktkSvcKeiInfo = svkeiKaisenUwiInfo` |
| 4 | IF | `kktkSvcKeiInfo != null` → `trgSvcKeiNo = kktkSvcKeiInfo.getString(JBSbatKK_T_SVC_KEI.SVC_KEI_NO)` → `break` [L268] |

#### Block 4.3 — SELECT_096: Parent Service Contract Internal (L273)

> Third attempt: look for a parent service contract internal relationship (`"03"`).

| # | Type | Code |
|---|------|------|
| 1 | CALL | `executeKK_T_KKTK_SVC_KEI_KK_SELECT_096(new String[]{"20991231", inChgTgKeiNo, inChafSkbtNo, "03", "20991231"})` // Parent internal lookup |
| 2 | SET | `kktkSvcKeiInfo = db_KK_T_KKTK_SVC_KEI.selectNext()` |
| 3 | IF | `kktkSvcKeiInfo != null` → `trgSvcKeiNo = kktkSvcKeiInfo.getString(JBSbatKK_T_SVC_KEI_UCWK.SVC_KEI_NO)` [L277] // Note: reads from SVC_KEI_UCWK field |

#### Block 4.4 — SELECT_097: Parent Option Service Contract (L279)

> Fourth attempt: look for a parent option service contract relationship (`"04"`).

| # | Type | Code |
|---|------|------|
| 1 | CALL | `executeKK_T_KKTK_SVC_KEI_KK_SELECT_097(new String[]{"01", "20991231", inChgTgKeiNo, inChafSkbtNo, "04", "20991231"})` // Parent option contract lookup |
| 2 | SET | `kktkSvcKeiInfo = db_KK_T_KKTK_SVC_KEI.selectNext()` |
| 3 | IF | `kktkSvcKeiInfo != null` → `trgSvcKeiNo = kktkSvcKeiInfo.getString(JBSbatKK_T_OP_SVC_KEI.SVC_KEI_NO)` [L283] // Reads from option service contract table |

#### Block 4.5 — Contract Retrieval Result Check (L288)

| # | Type | Code |
|---|------|------|
| 1 | IF | `kktkSvcKeiInfo == null` → `return null` [L288] // No parent contract found → skip |
| 2 | IF | `isStringEmpty(trgSvcKeiNo)` → `return null` [L291] // Contract number is empty → skip |

### Block 5 — DELAYED START BRANCH (L296–L345)

> Condition: `DELAYED_START.equals(isDelayed)` where `DELAYED_START = "1"` [L296]. This branch executes when the delayed start flag is set to "1", meaning processing should proceed immediately regardless of the move-in reservation date. The method builds intermediate file output with device and contract details.

#### Block 5.1 — Build Intermediate File Output (L298–L321)

> Populate the output map with device model code, device serial number, change reason code, installation destination address, and service contract number extracted from the retrieved contract info.

| # | Type | Code |
|---|------|------|
| 1 | SET | `outMap.setString(JBSbatKKIFM270.TAKNKIKI_MODEL_CD, kktkSvcKeiInfo.getString(JBSbatKK_T_KKTK_SVC_KEI.TAKNKIKI_MODEL_CD))` // Device model code |
| 2 | SET | `outMap.setString(JBSbatKKIFM270.KIKI_SEIZO_NO, kktkSvcKeiInfo.getString(JBSbatKK_T_KKTK_SVC_KEI.KIKI_SEIZO_NO))` // Device serial number |
| 3 | SET | `outMap.setString(JBSbatKKIFM270.KIKI_CHG_RSN_CD, "1")` // Device change reason code = "1" [OM-2014-0001147] |
| 4 | SET | `outMap.setString(JBSbatKKIFM270.KIKI_STC_SAKI_PLACE_NO, kktkSvcKeiInfo.getString(JBSbatKK_T_KKTK_SVC_KEI.KIKI_STC_SAKI_PLACE_NO))` // Device installation destination address number |
| 5 | SET | `outMap.setString(JBSbatKKIFM270.SVC_KEI_NO, kktkSvcKeiInfo.getString(JBSbatKK_T_SVC_KEI.SVC_KEI_NO))` // Service contract number |

#### Block 5.2 — Surrender Check (L325–L330)

> Only add the output map to results if the service contract has NOT been surrendered. Equipment provider service contracts that have been cancelled should not produce device delivery records.

| # | Type | Code |
|---|------|------|
| 1 | IF | `!isSurrenderService(inChgTgKeiNo)` → `outputItem.addOutMapList(outMap)` [L327] // Only output if NOT surrendered |
| 2 | IF (else) | surrendered → skip `addOutMapList` (no output) |
| 3 | RETURN | `return outputItem` [L333] |

### Block 6 — MOVE-IN RESERVATION ARRIVED BRANCH (L338–L394)

> Condition: `isDelayed` is NOT `"1"` and `nyukyoRsvTriKisnInfo != null` [L344]. This branch triggers when the delayed flag is off AND the move-in reservation date has been reached (the service contract line item's reservation date is on or before the operating date + 1 day).

#### Block 6.1 — Check Move-in Reservation (L342–L343)

| # | Type | Code |
|---|------|------|
| 1 | CALL | `executeKK_T_SVKEI_KAISEN_UW_KK_SELECT_026(new String[]{inItensSvkeiKisuwNo, JBSbatDateUtil.adjustDate(opeDate, 1)})` // Query with operating date + 1 day |
| 2 | SET | `nyukyoRsvTriKisnInfo = db_KK_T_SVKEI_KAISEN_UW.selectNext()` |

#### Block 6.2 — Reservation Found → Build Intermediate File Output (L346–L381)

> Same output structure as Block 5.1: model code, serial number, change reason code, address, contract number.

| # | Type | Code |
|---|------|------|
| 1 | SET | `outMap.setString(JBSbatKKIFM270.TAKNKIKI_MODEL_CD, kktkSvcKeiInfo.getString(JBSbatKK_T_KKTK_SVC_KEI.TAKNKIKI_MODEL_CD))` |
| 2 | SET | `outMap.setString(JBSbatKKIFM270.KIKI_SEIZO_NO, kktkSvcKeiInfo.getString(JBSbatKK_T_KKTK_SVC_KEI.KIKI_SEIZO_NO))` |
| 3 | SET | `outMap.setString(JBSbatKKIFM270.KIKI_CHG_RSN_CD, "1")` |
| 4 | SET | `outMap.setString(JBSbatKKIFM270.KIKI_STC_SAKI_PLACE_NO, kktkSvcKeiInfo.getString(JBSbatKK_T_KKTK_SVC_KEI.KIKI_STC_SAKI_PLACE_NO))` |
| 5 | SET | `outMap.setString(JBSbatKKIFM270.SVC_KEI_NO, kktkSvcKeiInfo.getString(JBSbatKK_T_SVC_KEI.SVC_KEI_NO))` |

#### Block 6.3 — Surrender Check (L385–L390)

> Same surrender filter as Block 5.2.

| # | Type | Code |
|---|------|------|
| 1 | IF | `!isSurrenderService(inChgTgKeiNo)` → `outputItem.addOutMapList(outMap)` [L387] |
| 2 | IF (else) | surrendered → skip output |
| 3 | RETURN | `return outputItem` [L392] |

### Block 7 — NEW CONSTRUCTION WORK COMPLETED BRANCH (L397–L443)

> Condition: Neither delayed start nor move-in reservation arrived. This is the final fallback path — the new construction work completion record exists and the associated work order is still active. This represents a traditional completion-based trigger.

#### Block 7.1 — Query Work Completion Records (L399–L400)

| # | Type | Code |
|---|------|------|
| 1 | CALL | `executeKK_T_KJ_FIN_WK_KK_SELECT_020(new String[]{inAdchgNo, opeDate})` // Query by address change number and operating date |

#### Block 7.2 — Loop Over Work Completion Rows (L402–L443)

> Iterate over all work completion records. For each row, verify the work order is still active before generating output.

##### Block 7.2.1 — Get Work Order Number (L404–L406)

| # | Type | Code |
|---|------|------|
| 1 | SET | `trgKojiakNo = newKjFinRnkiInfo.getString(JBSbatKK_T_KJ_FIN_WK.KOJIAK_NO)` // Extract work order number from completion row |

##### Block 7.2.2 — Verify Work Order Active (L408–L409)

| # | Type | Code |
|---|------|------|
| 1 | CALL | `executeKU_T_SVKEI_KOJIAK_KK_SELECT_007(new String[]{trgSvcKeiNo, trgKojiakNo})` // Verify work order |
| 2 | IF | `db_KU_T_SVKEI_KOJIAK.selectNext() == null` → `continue` [L409] // Work order not active → skip this row |

##### Block 7.2.3 — Build Intermediate File Output (L413–L429)

> Same output structure: model code, serial number, change reason code, address, contract number.

| # | Type | Code |
|---|------|------|
| 1 | SET | `outMap.setString(JBSbatKKIFM270.TAKNKIKI_MODEL_CD, kktkSvcKeiInfo.getString(JBSbatKK_T_KKTK_SVC_KEI.TAKNKIKI_MODEL_CD))` |
| 2 | SET | `outMap.setString(JBSbatKKIFM270.KIKI_SEIZO_NO, kktkSvcKeiInfo.getString(JBSbatKK_T_KKTK_SVC_KEI.KIKI_SEIZO_NO))` |
| 3 | SET | `outMap.setString(JBSbatKKIFM270.KIKI_CHG_RSN_CD, "1")` |
| 4 | SET | `outMap.setString(JBSbatKKIFM270.KIKI_STC_SAKI_PLACE_NO, kktkSvcKeiInfo.getString(JBSbatKK_T_KKTK_SVC_KEI.KIKI_STC_SAKI_PLACE_NO))` |
| 5 | SET | `outMap.setString(JBSbatKKIFM270.SVC_KEI_NO, kktkSvcKeiInfo.getString(JBSbatKK_T_SVC_KEI.SVC_KEI_NO))` |

##### Block 7.2.4 — Surrender Check and Return (L433–L441)

| # | Type | Code |
|---|------|------|
| 1 | IF | `!isSurrenderService(inChgTgKeiNo)` → `outputItem.addOutMapList(outMap)` [L435] |
| 2 | IF (else) | surrendered → skip output |
| 3 | RETURN | `return outputItem` [L440] |

### Block 8 — FINAL FALLBACK (L446)

> None of the three conditional paths produced output. Return null to signal no intermediate file records to generate.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return null` // No matching condition → no output [L446] |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `ADCHG_NO` | Field | Residence change number — internal tracking ID for address change transactions in the customer infrastructure system |
| `ITENS_SVKEI_KISUW_NO` | Field | Transfer destination service contract line item number — identifies which line item of the service contract is being transferred after the address change |
| `ITNM_SVKEI_KISUW_NO` | Field | Transfer source service contract line item number — identifies the line item before the address change transfer |
| `CHG_TG_KEI_NO` | Field | Change target contract number — the service contract number that is the subject of the address change |
| `CHBF_SKBT_NO` | Field | Pre-change device identifier number — the device's unique identifier number before the address change |
| `CHAF_SKBT_NO` | Field | Post-change device identifier number — the device's unique identifier number after the address change |
| `IS_DELAYED` | Field | Delayed start flag — input flag that controls whether to process immediately (`"1"`) or wait for the move-in reservation date (`"0"`) |
| `KOJIAK_NO` | Field | Work order number — identifies a construction work order associated with a service contract |
| `SVC_KEI_NO` | Field | Service contract number — unique identifier for a customer's service contract (e.g., FTTH, Mail, ENUM) |
| `TAKNKIKI_MODEL_CD` | Field | Indoor device model code — hardware model identifier for the customer premises equipment (CPE) |
| `KIKI_SEIZO_NO` | Field | Device serial number — unique manufacturing serial number of the customer premises equipment |
| `KIKI_CHG_RSN_CD` | Field | Device change reason code — reason for device change; value `"1"` indicates address change relocation |
| `KIKI_STC_SAKI_PLACE_NO` | Field | Device installation destination address number — the address where the device should be installed after the change |
| ADCHG | Acronym | Address Change (`住所変更`) — the business process of changing a customer's registered address |
| Hampin | Business term | Hampin (`はんぴ`) — a device leasing/rental service brand by KDDI where customers lease equipment rather than purchase it; Hampin-locked contracts cannot be transferred |
| KK_T_KKTK_SVC_KEI | Table | Equipment provider service contract table — stores service contract records for equipment provider relationships |
| KK_T_SVKEI_KAISEN_UW | Table | Service contract line item / move-in reservation table — tracks service contract line items and their move-in reservation dates |
| KK_T_KJ_FIN_WK | Table | Work completion work table — stores records of completed construction work orders |
| KU_T_SVKEI_KOJIAK | Table | Service contract - Work order table — stores the relationship between service contracts and construction work orders; presence of a row indicates the work order is active |
| Delayed Start (`ディレイド起動`) | Business term | A processing mode where device provisioning output is generated immediately without waiting for the scheduled move-in date; used when the address change and move-in occur simultaneously |
| Move-in Reservation (`入居予定日`) | Business term | The scheduled date when a customer is expected to move into the new address; processing waits until this date arrives before generating output |
| New Construction Completion (`新設工事の完了`) | Business term | A trigger condition where the construction work for new installation has been completed; this serves as the fallback path when neither delayed start nor move-in reservation conditions are met |
| Surrender Service | Business term | A surrendered/cancelled service contract where the customer has terminated the service; such contracts should not produce device delivery output |
| Device Identifier Number (`識別番号`) | Field | A unique identifier assigned to customer premises equipment for tracking and management purposes |
| K-Opticom | Business term | K-Opticom Inc. — a Japanese internet service provider specializing in FTTH (Fiber To The Home) services, acquired by KDDI |
| FTTH | Business term | Fiber To The Home — fiber-optic broadband internet service |
| CBS | Acronym | Common Business Service — shared business service component in the system architecture |
| SC | Acronym | Service Component — a service layer component that handles specific business operations |
| Intermediate File (`中間ファイル`) | Business term | A temporary file format (JBSbatKKIFM270) used for batch data exchange between processing stages; contains device and contract information for downstream equipment delivery workflows |
