# Business Logic — JBSbatKKNrkeFinKikiHktgi.executeDK_T_HAISO_TG_BPIN_PKUPDATE() [17 LOC]

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

## 1. Role

### JBSbatKKNrkeFinKikiHktgi.executeDK_T_HAISO_TG_BPIN_PKUPDATE()

This method performs a **primary-key-based update** on the Delivery Target Item (`DK_T_HAISO_TG_BPIN`) table within the batch processing framework. Specifically, it updates the **Equipment Provisioning Service Contract Number** (`KKTK_SVC_KEI_NO`) and the **Equipment Change Number** (`KIKI_CHG_NO`) for a given delivery target item identified by its **Delivery Target Item Number** (`HAISO_TAIBPIN_NO`).

The method acts as a **dedicated persistence helper** within a larger batch processing pipeline (K-Opticom's customer backbone batch system). It implements the **delegation pattern** — constructing parameter maps for both the SET clause and WHERE clause, then delegating the actual SQL execution to the `JBSbatSQLAccess.updateByPrimaryKeys()` infrastructure method. It is a private utility method called exclusively by `JBSbatKKNrkeFinKikiHktgi.execute()`, serving as a low-level data update operation in the equipment provisioning / service contract lifecycle.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["executeDK_T_HAISO_TG_BPIN_PKUPDATE(params)"])
    START --> STEP1["S1: Create setMap (JBSbatCommonDBInterface)"]
    STEP1 --> STEP2["S2: Set KKTK_SVC_KEI_NO from setParam[0]"]
    STEP2 --> STEP3["S3: Set KIKI_CHG_NO from setParam[1]"]
    STEP3 --> STEP4["S4: Create whereMap (JBSbatCommonDBInterface)"]
    STEP4 --> STEP5["S5: Set HAISO_TAIBPIN_NO from whereParam[0]"]
    STEP5 --> STEP6["S6: Call db_DK_T_HAISO_TG_BPIN.updateByPrimaryKeys(whereMap, setMap)"]
    STEP6 --> END_NODE(["Return / Next"])
```

**Processing Summary:**

1. **S1** — Initialize the SET parameter map (`JBSbatCommonDBInterface`) to hold columns to be updated.
2. **S2** — Assign the **Equipment Provisioning Service Contract Number** from `setParam[0]` into the SET map under the column `KKTK_SVC_KEI_NO`.
3. **S3** — Assign the **Equipment Change Number** from `setParam[1]` into the SET map under the column `KIKI_CHG_NO`.
4. **S4** — Initialize the WHERE parameter map (`JBSbatCommonDBInterface`) to hold the primary-key lookup criteria.
5. **S5** — Assign the **Delivery Target Item Number** from `whereParam[0]` into the WHERE map under the column `HAISO_TAIBPIN_NO`.
6. **S6** — Delegate the SQL `UPDATE` to the `JBSbatSQLAccess` framework via `updateByPrimaryKeys()`, which builds and executes an UPDATE targeting the `DK_T_HAISO_TG_BPIN` table using the WHERE map as the primary-key filter and the SET map as the values to modify.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `setParam` | `Object[]` | An array carrying the values to be updated in the `DK_T_HAISO_TG_BPIN` table. Index `[0]` is the **Equipment Provisioning Service Contract Number** (`KKTK_SVC_KEI_NO`) — the internal contract identifier linking a delivery item to its service contract. Index `[1]` is the **Equipment Change Number** (`KIKI_CHG_NO`) — a sequence number or reference ID used to track equipment replacement events. |
| 2 | `whereParam` | `Object[]` | An array carrying the primary-key lookup criteria. Index `[0]` is the **Delivery Target Item Number** (`HAISO_TAIBPIN_NO`) — the unique identifier of the delivery target item row to locate and update. |

**External State / Instance Fields Read:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `db_DK_T_HAISO_TG_BPIN` | `JBSbatSQLAccess` | SQL Access layer instance configured for the `DK_T_HAISO_TG_BPIN` table; provides the `updateByPrimaryKeys()` method used at line 1978. |

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| U | `db_DK_T_HAISO_TG_BPIN.updateByPrimaryKeys(Object whereMap, Object setMap)` | - | `DK_T_HAISO_TG_BPIN` | Updates the `DK_T_HAISO_TG_BPIN` table by primary key, setting `KKTK_SVC_KEI_NO` and `KIKI_CHG_NO` for the row identified by `HAISO_TAIBPIN_NO`. |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Batch: JBSbatKKNrkeFinKikiHktgi | `JBSbatKKNrkeFinKikiHktgi.execute()` -> `executeDK_T_HAISO_TG_BPIN_PKUPDATE` | `updateByPrimaryKeys [U] DK_T_HAISO_TG_BPIN` |

**Notes:**
- This method has **1 direct caller**: `JBSbatKKNrkeFinKikiHktgi.execute()`, which is the main batch processing entry point.
- No screen (KKSV*) or batch entry points are found within 8 hops beyond the direct caller.
- The terminal operation reachable from this method is a single database update to `DK_T_HAISO_TG_BPIN`.

## 6. Per-Branch Detail Blocks

This method has no conditional branches (no if/else, switch, or loops). It is a linear sequence of operations.

**Block 1** — [LINEAR PROCESSING] (L1966)

> Create the SET parameter map and populate it with the values to be updated.

| # | Type | Code |
|---|------|------|
| 1 | SET | `JBSbatCommonDBInterface setMap = new JBSbatCommonDBInterface();` // Create map for SET clause values |
| 2 | EXEC | `setMap.setValue(JBSbatDK_T_HAISO_TG_BPIN.KKTK_SVC_KEI_NO, setParam[0]);` // Set Equipment Provisioning Service Contract Number [`KKTK_SVC_KEI_NO = "KKTK_SVC_KEI_NO"`] — business: equipment provisioning service contract number |
| 3 | EXEC | `setMap.setValue(JBSbatDK_T_HAISO_TG_BPIN.KIKI_CHG_NO, setParam[1]);` // Set Equipment Change Number [`KIKI_CHG_NO = "KIKI_CHG_NO"`] — business: equipment change number |

**Block 2** — [LINEAR PROCESSING] (L1971)

> Create the WHERE parameter map and populate it with the primary-key lookup criteria.

| # | Type | Code |
|---|------|------|
| 1 | SET | `JBSbatCommonDBInterface whereMap = new JBSbatCommonDBInterface();` // Create map for WHERE clause criteria |
| 2 | EXEC | `whereMap.setValue(JBSbatDK_T_HAISO_TG_BPIN.HAISO_TAIBPIN_NO, whereParam[0]);` // Set Delivery Target Item Number [`HAISO_TAIBPIN_NO = "HAISO_TAIBPIN_NO"`] — business: delivery target item number (primary key) |

**Block 3** — [LINEAR PROCESSING] (L1978)

> Execute the database update by primary keys.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `db_DK_T_HAISO_TG_BPIN.updateByPrimaryKeys(whereMap, setMap);` // Delegate to SQL Access layer — performs UPDATE on `DK_T_HAISO_TG_BPIN` table where `HAISO_TAIBPIN_NO` matches and sets `KKTK_SVC_KEI_NO`, `KIKI_CHG_NO` |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `KKTK_SVC_KEI_NO` | Field | Equipment Provisioning Service Contract Number — the internal contract identifier that links a delivery item to its corresponding service provisioning contract. |
| `KIKI_CHG_NO` | Field | Equipment Change Number — a reference ID tracking equipment replacement or change events in the service lifecycle. |
| `HAISO_TAIBPIN_NO` | Field | Delivery Target Item Number — the unique identifier for a delivery target item, used as the primary key to locate the row to update. |
| `HAISO_NO` | Field | Delivery Number — identifier for a delivery batch/event. |
| `TAKNKIKI_SBT_CD` | Field | Home Equipment Type Code — categorizes the type of customer premises equipment. |
| `KIKI_SEIZO_NO` | Field | Equipment Serial Number — manufacturing serial number for tracking individual equipment units. |
| `HMPIN_KIKI` | Field | Returned Equipment — equipment that has been sent back by the customer. |
| `SHUKKA_LOT_NO` | Field | Shipment Lot Number — groups equipment items into shipment lots for logistics tracking. |
| `JP_T_HAISO_TG_BPIN` / `DK_T_HAISO_TG_BPIN` | Table | Delivery Target Item table — stores information about equipment items that are targets for delivery/shipment, including their linkage to service contracts and equipment change tracking. |
| `JBSbatSQLAccess` | Class | SQL Access framework class — provides database operations (SELECT, INSERT, UPDATE, DELETE) through parameterized map-based interfaces. |
| `JBSbatCommonDBInterface` | Class | Common database interface for building SET and WHERE parameter maps used by the SQL Access layer. |
| `updateByPrimaryKeys` | Method | SQL Access method that performs an UPDATE using the WHERE map as primary-key filter and the SET map as column values to update. |
