# Business Logic — JBSbatKKPlaceNoChgRnkiInfCst.executeKK_T_KKTK_SVC_KEI_KK_SELECT_095() [15 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.business.service.JBSbatKKPlaceNoChgRnkiInfCst` |
| Layer | Service (Batch-side service component) |
| Module | `service` (Package: `eo.business.service`) |

## 1. Role

### JBSbatKKPlaceNoChgRnkiInfCst.executeKK_T_KKTK_SVC_KEI_KK_SELECT_095()

This method performs a targeted database query to retrieve **equipment provider service contract line detail records** (機器提供サービス契約回線内訳 — *kiki teikyō sābisu keiyaku kaisen naiwaku*) from the `KK_T_KKTK_SVC_KEI` table. It is one of three fallback select operations (alongside `KK_SELECT_094` for parent service contracts and `KK_SELECT_096` for parent service contract line details) used during the equipment change target service resolution flow. Specifically, this method resolves a service contract record where the **parent service contract is classified as a service contract line detail** (親契約がサービス契約回線内訳 — identified by the reservation application date parameter value `"02"` in the caller context).

The method follows a **data binding and delegation pattern**: it constructs a `JBSbatCommonDBInterface` parameter list by converting the 7 input bind variable values from the `Object[]` array, then delegates to the `db_KK_T_KKTK_SVC_KEI` data access layer via `selectBySqlDefine()`. It does not contain any conditional branching of its own — its entire responsibility is to package the input bind variables and forward them to the SQL execution engine. The calling method (`executeKK_T_KKTK_SVC_KEI_KK_SELECT_094`, `.095`, `.096` trio in `execute()`) determines which contract classification path to follow and calls this method when the "parent is service contract line detail" fallback is needed.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["executeKK_T_KKTK_SVC_KEI_KK_SELECT_095(param)"])
    START --> CREATE_PARAM["Create JBSbatCommonDBInterface paramList"]
    CREATE_PARAM --> BIND_DATE_START["paramList.setValue(param[0])
回線内訳使用開始年月日
(Line detail service start date)
Line: 690"]
    BIND_DATE_START --> BIND_DATE_END["paramList.setValue(param[1])
回線内訳使用終了年月日
(Line detail service end date)
Line: 691"]
    BIND_DATE_END --> BIND_RESERVATION_DATE["paramList.setValue(param[2])
予約適用年月日
(Reservation application date)
Line: 692"]
    BIND_RESERVATION_DATE --> BIND_CONTRACT_NO["paramList.setValue(param[3])
機器提供サービス契約番号
(Equipment provider service contract number)
Line: 693"]
    BIND_CONTRACT_NO --> BIND_CHANGE_NO["paramList.setValue(param[4])
機器変更番号
(Equipment change number)
Line: 694"]
    BIND_CHANGE_NO --> BIND_PARENT_CONTRACT["paramList.setValue(param[5])
親契約識別コード
(Parent contract identification code)
Line: 695"]
    BIND_PARENT_CONTRACT --> BIND_RESERVATION_DATE_2["paramList.setValue(param[6])
予約適用年月日
(Reservation application date)
Line: 696"]
    BIND_RESERVATION_DATE_2 --> EXEC_SELECT["db_KK_T_KKTK_SVC_KEI.selectBySqlDefine(paramList, KK_SELECT_095)
Execute SQL KEY KK_SELECT_095
Query equipment provider service contract
by service usage period
Line: 700"]
    EXEC_SELECT --> END_NODE(["Return / Next
Line: 701"])
```

**Processing Summary:**
The method performs a linear, unbranching sequence of operations:
1. **Bind Variable Setup** — Creates a `JBSbatCommonDBInterface` object to hold the SQL bind variables. Each of the 7 input `param` array elements is converted to a String and bound via `setValue()`.
2. **SQL Execution** — Invokes `selectBySqlDefine()` on the `db_KK_T_KKTK_SVC_KEI` data access object, passing the prepared parameter list and the SQL key `KK_SELECT_095`. This queries the `KK_T_KKTK_SVC_KEI` table (with joins to `KK_T_SVKEI_KAISEN_UW`, `KK_T_KAISEN_TG_SVKEI`, and `KK_T_SVC_KEI`) to retrieve equipment provider service contract line detail records matching the given service usage period, contract number, change number, and parent contract identification code.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `param` | `Object[]` | Array of 7 bind variable values for the KK_SELECT_095 SQL query. The array index maps to the following business fields: |
|    |               |      | `param[0]` — Line detail service start date (回線内訳使用開始年月日), format `YYYYMMDD` (e.g., `"20991231"` as a far-future placeholder) |
|    |               |      | `param[1]` — Line detail service end date (回線内訳使用終了年月日), format `YYYYMMDD` |
|    |               |      | `param[2]` — Reservation application date (予約適用年月日), format `YYYYMMDD` — used as a join filter on `KK_T_KAISEN_TG_SVKEI.KAISEN_UCWK_USE_STAYMD` |
|    |               |      | `param[3]` — Equipment provider service contract number (機器提供サービス契約番号), the primary business key for identifying the equipment service contract |
|    |               |      | `param[4]` — Equipment change number (機器変更番号), identifies the specific equipment change instance |
|    |               |      | `param[5]` — Parent contract identification code (親契約識別コード), classifies the type of parent contract (e.g., `"02"` indicates "parent is service contract line detail") |
|    |               |      | `param[6]` — Reservation application date (予約適用年月日), format `YYYYMMDD` — used as a join filter on `KK_T_KAISEN_TG_SVKEI.KAISEN_UCWK_USE_ENDYMD` |

No instance fields are directly read within this method (the `db_KK_T_KKTK_SVC_KEI` instance field used for DB access is inherited from the class context, but this method does not reference it as a local variable).

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `JBSbatCommonDBInterface.setValue` | JBSbatCommonDBInterface | - | Calls `setValue` to bind 7 SQL input parameters (L690–L696) |

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `db_KK_T_KKTK_SVC_KEI.selectBySqlDefine` | - | `KK_T_KKTK_SVC_KEI` | Executes SQL KEY `KK_SELECT_095` to read equipment provider service contract line detail records. The query joins `KK_T_KKTK_SVC_KEI` with `KK_T_SVKEI_KAISEN_UW`, `KK_T_KAISEN_TG_SVKEI`, and `KK_T_SVC_KEI` to resolve service contract line detail information based on service usage period, contract number, change number, and parent contract classification code. |

**SQL Query Details (KK_SELECT_095):**
- **Primary Table:** `KK_T_KKTK_SVC_KEI` (KK0341 alias) — equipment provider service contract table
- **Join Tables:**
  - `KK_T_SVKEI_KAISEN_UW` (KK0251) — service detail revision usage table (joined on SVC_KEI_KAISEN_UCWK_NO with MAX GENE_ADD_DTM filter for MK_FLG='0')
  - `KK_T_KAISEN_TG_SVKEI` (KK0241) — service detail change target service detail table (joined on SVC_KEI_KAISEN_UCWK_NO with KAISEN_UCWK_USE_STAYMD <= param and KAISEN_UCWK_USE_ENDYMD >= param, MK_FLG='0')
  - `KK_T_SVC_KEI` (KK0081) — service detail master table (joined on SVC_KEI_NO)
- **Returned Columns:** `TAKNKIKI_MODEL_CD`, `KIKI_SEIZO_NO`, `KIKI_CHG_RSN_CD`, `KIKI_STC_SAKI_PLACE_NO`, `SVC_KEI_KAISEN_UCWK_NO`, `SVC_KEI_NO`, `SVC_CD`
- **Bind Variable Usage:** Two `?` placeholders are consumed from the paramList (the start date and end date parameters at indices 0 and 1, used in `KAISEN_UCWK_USE_STAYMD <= ?` and `KAISEN_UCWK_USE_ENDYMD >= ?` comparisons)

## 5. Dependency Trace

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

No screen/batch entry points found within 8 hops. Direct callers found: 1 methods.
Terminal operations from this method: `selectBySqlDefine` [R] `KK_T_KKTK_SVC_KEI`

Trace who calls this method and what this method ultimately calls.

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Batch: JBSbatKKPlaceNoChgRnkiInfCst.execute() | `execute()` -> `executeKK_T_KKTK_SVC_KEI_KK_SELECT_095()` | `selectBySqlDefine` [R] `KK_T_KKTK_SVC_KEI` |

**Call Chain Detail:**
The method is called from the same class's `execute()` method at line 282. In the caller context:
- This is one of three fallback resolution paths (alongside `KK_SELECT_094` for parent service contracts and `KK_SELECT_096` for parent service contract line details).
- It is invoked when `kktkSvcKeiInfo == null` after the `.094` attempt failed, specifically when the parent contract is a "service contract line detail" (親がサービス契約回線内訳).
- Hardcoded bind parameters: start/end dates set to `"20991231"` (far future placeholder), reservation application date `"20991231"`, equipment provider service contract number from `inChgTgKeiNo`, equipment change number from `inChafSkbtNo`, parent contract identification code `"02"`, and reservation application date `"20991231"`.

## 6. Per-Branch Detail Blocks

This method contains no conditional branches, loops, or exception handlers. The entire flow is linear.

**Block 1** — [LINEAR] `(no condition)` (L686-L701)

> Creates a parameter list and binds 7 SQL bind variables from the input array, then executes the SQL query via the data access layer.

| # | Type | Code |
|---|------|------|
| 1 | SET | `JBSbatCommonDBInterface paramList = new JBSbatCommonDBInterface()` // Create bind variable list<br>// バイント変数のリストを生成します<br>(L689) |
| 2 | EXEC | `paramList.setValue(param[0].toString())` // Bind: 回線内訳使用開始年月日 (Line detail service start date)<br>// param[0] = "20991231" from caller (L690) |
| 3 | EXEC | `paramList.setValue(param[1].toString())` // Bind: 回線内訳使用終了年月日 (Line detail service end date)<br>// param[1] = "20991231" from caller (L691) |
| 4 | EXEC | `paramList.setValue(param[2].toString())` // Bind: 予約適用年月日 (Reservation application date — start date filter)<br>// param[2] = "20991231" from caller, used in KAISEN_UCWK_USE_STAYMD <= ? (L692) |
| 5 | EXEC | `paramList.setValue(param[3].toString())` // Bind: 機器提供サービス契約番号 (Equipment provider service contract number)<br>// param[3] = inChgTgKeiNo from caller (L693) |
| 6 | EXEC | `paramList.setValue(param[4].toString())` // Bind: 機器変更番号 (Equipment change number)<br>// param[4] = inChafSkbtNo from caller (L694) |
| 7 | EXEC | `paramList.setValue(param[5].toString())` // Bind: 親契約識別コード (Parent contract identification code)<br>// param[5] = "02" from caller, indicates parent is service contract line detail (L695) |
| 8 | EXEC | `paramList.setValue(param[6].toString())` // Bind: 予約適用年月日 (Reservation application date — end date filter)<br>// param[6] = "20991231" from caller, used in KAISEN_UCWK_USE_ENDYMD >= ? (L696) |
| 9 | CALL | `db_KK_T_KKTK_SVC_KEI.selectBySqlDefine(paramList, KK_T_KKTK_SVC_KEI_KK_SELECT_095)` // Execute SQL KEY KK_SELECT_095<br>// DBアクセスを実行します<br>(L700) |
| 10 | RETURN | `return;` // Method completes. Query results are available via db_KK_T_KKTK_SVC_KEI.selectNext() in the caller.<br>// (L701) |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| 回線内訳使用開始年月日 | Field | Line detail service start date — the date when the service contract line detail becomes effective (YYYYMMDD format) |
| 回線内訳使用終了年月日 | Field | Line detail service end date — the date when the service contract line detail expires (YYYYMMDD format) |
| 予約適用年月日 | Field | Reservation application date — the date used to determine the validity period for reservation-based service changes |
| 機器提供サービス契約番号 | Field | Equipment provider service contract number — the primary business key identifying an equipment provision service contract |
| 機器変更番号 | Field | Equipment change number — identifies a specific equipment change instance within the service lifecycle |
| 親契約識別コード | Field | Parent contract identification code — a classification code that determines the type/role of the parent contract (e.g., "01"=service contract, "02"=service contract line detail, "03"=service contract line) |
| KK_T_KKTK_SVC_KEI | Entity | Equipment provider service contract table (機器提供サービス契約) — stores equipment provision service contract records including model codes, manufacturing numbers, change reasons, and storage destination |
| KK_T_SVKEI_KAISEN_UW | Entity | Service detail revision usage table — stores revision/usage history of service details with genealogy tracking (GENE_ADD_DTM, MK_FLG) |
| KK_T_KAISEN_TG_SVKEI | Entity | Service detail change target service detail table — stores the mapping of service detail changes with valid usage period (KAISEN_UCWK_USE_STAYMD, KAISEN_UCWK_USE_ENDYMD) |
| KK_T_SVC_KEI | Entity | Service detail master table — master reference table for service detail definitions (SVC_CD, SVC_KEI_NO) |
| KK_SELECT_095 | SQL Key | SQL query key that selects equipment provider service contract line detail records by joining KK_T_KKTK_SVC_KEI with revision, change target, and service detail master tables |
| JBSbatCommonDBInterface | Component | Data binding interface for passing SQL query parameters (bind variables) to the database access layer |
| setValue | Method | Binds a single value to the next parameter position in the JBSbatCommonDBInterface parameter list |
| selectBySqlDefine | Method | Executes a SQL query identified by a key string against the database, using the provided parameter list as bind variables |
| "20991231" | Constant Value | Far-future date placeholder used as a wildcard/bind value when no specific date constraint is needed (effectively matches all dates in the past) |
| "01" / "02" / "03" | Constant Value | Parent contract identification codes: "01"=service contract (サービス契約), "02"=service contract line detail (サービス契約回線内訳), "03"=service contract line (サービス契約内訳) |
| SVC_KEI_NO | Field | Service detail number — unique identifier for a service detail record in KK_T_SVC_KEI |
| SVC_CD | Field | Service code — the service type code associated with a service detail |
| TAKNKIKI_MODEL_CD | Field | Equipment model code — identifies the model of equipment in the provision contract |
| KIKI_SEIZO_NO | Field | Equipment manufacturing number — unique serial number for equipment in the provision contract |
| KIKI_CHG_RSN_CD | Field | Equipment change reason code — classifies the reason for an equipment change |
| KIKI_STC_SAKI_PLACE_NO | Field | Equipment storage destination place number — identifies where the equipment is stored/delivered |
| SVC_KEI_KAISEN_UCWK_NO | Field | Service detail revision work number — internal tracking ID for service detail revision/change work items |
