# Business Logic — JBSbatKKSyuKeiStabunKikiStaAdd.executeKK_T_PRG_PKINSERT() [41 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.business.service.JBSbatKKSyuKeiStabunKikiStaAdd` |
| Layer | Service (Batch Business Service — extends `JBSbatBusinessService`) |
| Module | `service` (Package: `eo.business.service`) |

## 1. Role

### JBSbatKKSyuKeiStabunKikiStaAdd.executeKK_T_PRG_PKINSERT()

This method is a **primary-key-based create operation** for the progress tracking table (`KK_T_PRG`) within the K-Opticom customer core system's main contract start function. Its business purpose is to **register a new progress record** that tracks the state of a service contract initiation — essentially recording "where we are" in the contract activation workflow. The method accepts a flat `Object[]` array of 33 field values, maps each element to a named field using key-value pairs, and then delegates the actual database insert to the `db_KK_T_PRG.insertByPrimaryKeys()` data access method. It implements a **pass-through data-mapping pattern**: no conditional logic, no branching, no transformation — simply bind and persist. In the larger system, this method serves as the **data-persistence layer entry point** for progress record creation, called directly from `insertPrg()` which orchestrates the broader contract-start business flow. The Japanese Javadoc describes it as "PK(全項目登録)でDBアクセスを行います" (Perform DB access with primary-key registration of all fields), indicating this is the canonical way to create a fully-populated progress record.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["executeKK_T_PRG_PKINSERT setParam"])
    CREATE_MAP["Create JBSbatCommonDBInterface setMap"]
    POPULATE["Populate setMap with 33 fields from setParam array"]
    INSERT["db_KK_T_PRG.insertByPrimaryKeys setMap"]
    END_NODE(["Return"])

    START --> CREATE_MAP
    CREATE_MAP --> POPULATE
    POPULATE --> INSERT
    INSERT --> END_NODE
```

**Processing summary:**

This method has **no conditional branches**. It performs a linear, sequential operation:

1. **Create mapping container** — Instantiate a `JBSbatCommonDBInterface` object to serve as the parameter map for the database insert.
2. **Populate 33 field mappings** — For each array index `0..32` of `setParam`, call `setMap.setValue(key, value)` to bind the corresponding business field name to its value. This covers progress identification, service contract references, change tracking metadata, and audit trail fields.
3. **Execute primary-key insert** — Call `db_KK_T_PRG.insertByPrimaryKeys(setMap)` to write the fully populated record into the `KK_T_PRG` table. The database handles primary key validation (the method name implies insert fails if the primary key already exists).

**Constant resolution:** No constant fields are referenced in this method. Field names like `PRG_NO`, `MSKM_DTL_NO`, etc. are literal string keys passed directly to `setValue()`.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `setParam` | `Object[]` | An ordered array of 33 field values used to create a progress (status) record in the main contract start workflow. Each array element corresponds to a specific business field by index position. The caller (`insertPrg()`) is responsible for ensuring each index contains the correct value type for its corresponding field. |

**Array index-to-field mapping (33 entries):**

| Index | Field Key | Business Meaning |
|-------|-----------|------------------|
| 0 | `PRG_NO` | Progress number — sequential identifier for this progress record |
| 1 | `MSKM_DTL_NO` | Order detail number — links this progress to a specific order line item |
| 2 | `SEIKY_KEI_NO` | Billing contract number — identifies the billing contract being activated |
| 3 | `SEIKY_WAY_NO_KOZA` | Billing method number (bank account) — payment method for billing |
| 4 | `SEIKY_WAY_NO_CRECARD` | Billing method number (credit card) — credit card payment method |
| 5 | `SVC_KEI_NO` | Service contract number — the primary service contract identifier |
| 6 | `SVC_KEI_UCWK_NO` | Service contract detail number — sub-division within a service contract |
| 7 | `SVC_KEI_KAISEN_UCWK_NO` | Service contract line detail number — further line-level subdivision |
| 8 | `KKTK_SVC_KEI_NO` | Equipment provision service contract number — for equipment-related service contracts |
| 9 | `OP_SVC_KEI_NO` | Option service contract number — optional add-on service contracts |
| 10 | `SEIOPSVC_KEI_NO` | Billing option service contract number — option services included in billing |
| 11 | `SBOP_SVC_KEI_NO` | Sub-option service contract number — sub-options within option services |
| 12 | `WRIB_SVC_KEI_NO` | Discount service contract number — service contracts involving discounts |
| 13 | `IDO_DIV` | Change classification — indicates the type of status change (e.g., new, update, cancel) |
| 14 | `IDO_DTM` | Change date/time — timestamp of the status change |
| 15 | `PRG_STAT` | Progress status — current status code of the progress record |
| 16 | `PRG_DTM` | Progress date/time — timestamp when this progress was recorded |
| 17 | `PRG_MEMO` | Progress memo — free-text memo for the progress record |
| 18 | `PRG_TKJK_1` | Progress special item 1 — additional note field 1 |
| 19 | `PRG_TKJK_2` | Progress special item 2 — additional note field 2 |
| 20 | `ADD_DTM` | Registration date/time — timestamp when the record was created |
| 21 | `ADD_OPEACNT` | Registration operator account — operator who created the record |
| 22 | `UPD_DTM` | Update date/time — timestamp of last update |
| 23 | `UPD_OPEACNT` | Update operator account — operator who last updated the record |
| 24 | `DEL_DTM` | Deletion date/time — timestamp when the record was logically deleted |
| 25 | `DEL_OPEACNT` | Deletion operator account — operator who deleted the record |
| 26 | `MK_FLG` | Invalidation flag — flag indicating whether the record is active or inactive |
| 27 | `ADD_UNYO_YMD` | Registration business date — business date of record creation |
| 28 | `ADD_TRN_ID` | Registration process ID — system process ID for audit tracing |
| 29 | `UPD_UNYO_YMD` | Update business date — business date of last update |
| 30 | `UPD_TRN_ID` | Update process ID — system process ID for update audit tracing |
| 31 | `DEL_UNYO_YMD` | Deletion business date — business date of logical deletion |
| 32 | `DEL_TRN_ID` | Deletion process ID — system process ID for deletion audit tracing |

**Instance fields read by this method:**

None. This method does not access any instance fields — it only reads the parameter and writes to local variables.

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| C | `db_KK_T_PRG.insertByPrimaryKeys` | — | `KK_T_PRG` | Inserts a new progress record into the `KK_T_PRG` table using primary-key-based insert. The `setMap` parameter contains all 33 fields populated from `setParam`. |
| U | `JBSbatCommonDBInterface.setValue` | — | — | Sets key-value pairs on the data mapping interface. Called 33 times to bind each field name to its corresponding value from `setParam`. |

**Analysis notes:**
- **CRUD classification: Create (C).** The terminal operation is `insertByPrimaryKeys`, which performs an SQL `INSERT` on the `KK_T_PRG` table. The primary key constraint ensures no duplicate records can be inserted.
- **`KK_T_PRG`** is the progress tracking table (進捗) that stores state information for the main contract start workflow. Each record represents one step in the contract activation process.
- The 33 `setValue` calls are **data binding** operations — they populate a `JBSbatCommonDBInterface` map that serves as the parameter set for the SQL insert.

## 5. Dependency Trace

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

Direct callers found: 1 method.

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Service: `JBSbatKKSyuKeiStabunKikiStaAdd.insertPrg()` | `insertPrg()` -> `executeKK_T_PRG_PKINSERT(setParam)` | `insertByPrimaryKeys [C] KK_T_PRG` |

**Analysis:**
- This method is called **exclusively** from `insertPrg()` within the same class (`JBSbatKKSyuKeiStabunKikiStaAdd`).
- `insertPrg()` is the higher-level business method that orchestrates the full progress record insertion flow (likely performing pre-validation, generating primary keys, preparing the `setParam` array, and then delegating to `executeKK_T_PRG_PKINSERT` for persistence).
- No screen or batch entry points are found within 8 hops. This method is an internal utility within the batch service class, not exposed as a public API.
- The terminal operation chains to `insertByPrimaryKeys [C] KK_T_PRG`, which performs the actual database insert.

## 6. Per-Branch Detail Blocks

This method contains **no conditional branches** (no if/else, no switch/case, no loops, no try/catch). It is a single sequential flow.

**Block 1** — [SEQUENTIAL PROCESSING] (L1030)

> Create the mapping container and populate all 33 field mappings, then execute the database insert.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET | `JBSbatCommonDBInterface setMap = new JBSbatCommonDBInterface();` | Create a new data mapping interface to hold key-value pairs for DB parameters. Javadoc: "設定値のマップを作ります" (Create a map of setting values). |
| 2 | EXEC | `setMap.setValue("PRG_NO", setParam[0]);` | Bind progress number from array index 0. Javadoc: 進捗番号 |
| 3 | EXEC | `setMap.setValue("MSKM_DTL_NO", setParam[1]);` | Bind order detail number from array index 1. Javadoc: 申込明細番号 |
| 4 | EXEC | `setMap.setValue("SEIKY_KEI_NO", setParam[2]);` | Bind billing contract number from array index 2. Javadoc: 請求契約番号 |
| 5 | EXEC | `setMap.setValue("SEIKY_WAY_NO_KOZA", setParam[3]);` | Bind billing method (bank account) from array index 3. Javadoc: 請求方法番号（口座） |
| 6 | EXEC | `setMap.setValue("SEIKY_WAY_NO_CRECARD", setParam[4]);` | Bind billing method (credit card) from array index 4. Javadoc: 請求方法番号（クレジットカード） |
| 7 | EXEC | `setMap.setValue("SVC_KEI_NO", setParam[5]);` | Bind service contract number from array index 5. Javadoc: サービス契約番号 |
| 8 | EXEC | `setMap.setValue("SVC_KEI_UCWK_NO", setParam[6]);` | Bind service contract detail number from array index 6. Javadoc: サービス契約内訳番号 |
| 9 | EXEC | `setMap.setValue("SVC_KEI_KAISEN_UCWK_NO", setParam[7]);` | Bind service contract line detail number from array index 7. Javadoc: サービス契約回線内訳番号 |
| 10 | EXEC | `setMap.setValue("KKTK_SVC_KEI_NO", setParam[8]);` | Bind equipment provision service contract number from array index 8. Javadoc: 機器提供サービス契約番号 |
| 11 | EXEC | `setMap.setValue("OP_SVC_KEI_NO", setParam[9]);` | Bind option service contract number from array index 9. Javadoc: オプションサービス契約番号 |
| 12 | EXEC | `setMap.setValue("SEIOPSVC_KEI_NO", setParam[10]);` | Bind billing option service contract number from array index 10. Javadoc: 請求オプションサービス契約番号 |
| 13 | EXEC | `setMap.setValue("SBOP_SVC_KEI_NO", setParam[11]);` | Bind sub-option service contract number from array index 11. Javadoc: サブオプションサービス契約番号 |
| 14 | EXEC | `setMap.setValue("WRIB_SVC_KEI_NO", setParam[12]);` | Bind discount service contract number from array index 12. Javadoc: 割引サービス契約番号 |
| 15 | EXEC | `setMap.setValue("IDO_DIV", setParam[13]);` | Bind change classification from array index 13. Javadoc: 異動区分 |
| 16 | EXEC | `setMap.setValue("IDO_DTM", setParam[14]);` | Bind change date/time from array index 14. Javadoc: 異動年月日時分秒 |
| 17 | EXEC | `setMap.setValue("PRG_STAT", setParam[15]);` | Bind progress status from array index 15. Javadoc: 進捗ステータス |
| 18 | EXEC | `setMap.setValue("PRG_DTM", setParam[16]);` | Bind progress date/time from array index 16. Javadoc: 進捗年月日時分秒 |
| 19 | EXEC | `setMap.setValue("PRG_MEMO", setParam[17]);` | Bind progress memo from array index 17. Javadoc: 進捗メモ |
| 20 | EXEC | `setMap.setValue("PRG_TKJK_1", setParam[18]);` | Bind progress special item 1 from array index 18. Javadoc: 進捗特記事項１ |
| 21 | EXEC | `setMap.setValue("PRG_TKJK_2", setParam[19]);` | Bind progress special item 2 from array index 19. Javadoc: 進捗特記事項２ |
| 22 | EXEC | `setMap.setValue("ADD_DTM", setParam[20]);` | Bind registration date/time from array index 20. Javadoc: 登録年月日時分秒 |
| 23 | EXEC | `setMap.setValue("ADD_OPEACNT", setParam[21]);` | Bind registration operator account from array index 21. Javadoc: 登録オペレータアカウント |
| 24 | EXEC | `setMap.setValue("UPD_DTM", setParam[22]);` | Bind update date/time from array index 22. Javadoc: 更新年月日時分秒 |
| 25 | EXEC | `setMap.setValue("UPD_OPEACNT", setParam[23]);` | Bind update operator account from array index 23. Javadoc: 更新オペレータアカウント |
| 26 | EXEC | `setMap.setValue("DEL_DTM", setParam[24]);` | Bind deletion date/time from array index 24. Javadoc: 削除年月日時分秒 |
| 27 | EXEC | `setMap.setValue("DEL_OPEACNT", setParam[25]);` | Bind deletion operator account from array index 25. Javadoc: 削除オペレータアカウント |
| 28 | EXEC | `setMap.setValue("MK_FLG", setParam[26]);` | Bind invalidation flag from array index 26. Javadoc: 無効フラグ |
| 29 | EXEC | `setMap.setValue("ADD_UNYO_YMD", setParam[27]);` | Bind registration business date from array index 27. Javadoc: 登録運用年月日 |
| 30 | EXEC | `setMap.setValue("ADD_TRN_ID", setParam[28]);` | Bind registration process ID from array index 28. Javadoc: 登録処理ＩＤ |
| 31 | EXEC | `setMap.setValue("UPD_UNYO_YMD", setParam[29]);` | Bind update business date from array index 29. Javadoc: 更新運用年月日 |
| 32 | EXEC | `setMap.setValue("UPD_TRN_ID", setParam[30]);` | Bind update process ID from array index 30. Javadoc: 更新処理ＩＤ |
| 33 | EXEC | `setMap.setValue("DEL_UNYO_YMD", setParam[31]);` | Bind deletion business date from array index 31. Javadoc: 削除運用年月日 |
| 34 | EXEC | `setMap.setValue("DEL_TRN_ID", setParam[32]);` | Bind deletion process ID from array index 32. Javadoc: 削除処理ＩＤ |
| 35 | CALL | `db_KK_T_PRG.insertByPrimaryKeys(setMap);` | Execute primary-key-based insert of the fully populated record into the `KK_T_PRG` table. Javadoc: DBアクセスを実行します (Execute DB access). |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `KK_T_PRG` | Table | Progress table — stores progress/status records for the main contract start workflow in the K-Opticom system |
| `PRG_NO` | Field | Progress number — sequential identifier for each progress record |
| `MSKM_DTL_NO` | Field | Order detail number — identifies a specific line item within a customer order |
| `SEIKY_KEI_NO` | Field | Billing contract number — the primary billing contract identifier |
| `SEIKY_WAY_NO_KOZA` | Field | Billing method number (bank account / 口座) — bank transfer payment method code |
| `SEIKY_WAY_NO_CRECARD` | Field | Billing method number (credit card / クレジットカード) — credit card payment method code |
| `SVC_KEI_NO` | Field | Service contract number — primary identifier for a service contract |
| `SVC_KEI_UCWK_NO` | Field | Service contract detail number (サービス契約内訳番号) — sub-division within a service contract |
| `SVC_KEI_KAISEN_UCWK_NO` | Field | Service contract line detail number (サービス契約回線内訳番号) — line-level subdivision within a service contract detail |
| `KKTK_SVC_KEI_NO` | Field | Equipment provision service contract number (機器提供サービス契約番号) — contract for equipment provisioning services |
| `OP_SVC_KEI_NO` | Field | Option service contract number (オプションサービス契約番号) — optional add-on service contract |
| `SEIOPSVC_KEI_NO` | Field | Billing option service contract number (請求オプションサービス契約番号) — option services that appear on the billing statement |
| `SBOP_SVC_KEI_NO` | Field | Sub-option service contract number (サブオプションサービス契約番号) — sub-options nested within option services |
| `WRIB_SVC_KEI_NO` | Field | Discount service contract number (割引サービス契約番号) — service contracts involving price discounts |
| `IDO_DIV` | Field | Change classification (異動区分) — indicates the type of status change (e.g., new registration, update, cancellation) |
| `IDO_DTM` | Field | Change date/time (異動年月日時分秒) — timestamp when the status change occurred |
| `PRG_STAT` | Field | Progress status (進捗ステータス) — current status code representing the progress state |
| `PRG_DTM` | Field | Progress date/time (進捗年月日時分秒) — timestamp when this progress was recorded |
| `PRG_MEMO` | Field | Progress memo (進捗メモ) — free-text memo field for progress notes |
| `PRG_TKJK_1` | Field | Progress special item 1 (進捗特記事項１) — additional note field 1 for special circumstances |
| `PRG_TKJK_2` | Field | Progress special item 2 (進捗特記事項２) — additional note field 2 for special circumstances |
| `ADD_DTM` | Field | Registration date/time (登録年月日時分秒) — timestamp when the record was created |
| `ADD_OPEACNT` | Field | Registration operator account (登録オペレータアカウント) — operator ID who created the record |
| `UPD_DTM` | Field | Update date/time (更新年月日時分秒) — timestamp of last record update |
| `UPD_OPEACNT` | Field | Update operator account (更新オペレータアカウント) — operator ID who last updated the record |
| `DEL_DTM` | Field | Deletion date/time (削除年月日時分秒) — timestamp of logical record deletion |
| `DEL_OPEACNT` | Field | Deletion operator account (削除オペレータアカウント) — operator ID who deleted the record |
| `MK_FLG` | Field | Invalidation flag (無効フラグ) — indicates whether the record is active (valid) or inactive (invalidated) |
| `ADD_UNYO_YMD` | Field | Registration business date (登録運用年月日) — business date of record creation |
| `ADD_TRN_ID` | Field | Registration process ID (登録処理ＩＤ) — system process ID for registration audit trail |
| `UPD_UNYO_YMD` | Field | Update business date (更新運用年月日) — business date of last update |
| `UPD_TRN_ID` | Field | Update process ID (更新処理ＩＤ) — system process ID for update audit trail |
| `DEL_UNYO_YMD` | Field | Deletion business date (削除運用年月日) — business date of logical deletion |
| `DEL_TRN_ID` | Field | Deletion process ID (削除処理ＩＤ) — system process ID for deletion audit trail |
| KK | Prefix | K-Opticom — the product/system name prefix used in table and class naming |
| T_PRG | Table suffix | Progress table (進捗) — tracks status progression of business operations |
| insertByPrimaryKeys | Method | Service Component method that performs primary-key-based SQL INSERT on the target table |
| JBSbatCommonDBInterface | Class | Framework data mapping interface used to construct key-value parameter sets for database operations |
| main contract start | Business process | The overall workflow for initiating a new customer service contract in the K-Opticom system |
