# Business Logic — JBSbatKKSyuKeiJudgeTran.executeKK_T_SVC_KEI_UCWK_PKINSERT() [87 LOC]

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

## 1. Role

### JBSbatKKSyuKeiJudgeTran.executeKK_T_SVC_KEI_UCWK_PKINSERT()

This method performs a **primary key-based insert** (全項目登録 — full item registration) of a service contract line item (サービス契約内訳) record into the database table `KK_T_SVC_KEI_UCWK`. It acts as a data-binding and delegation method: it accepts a flat `Object[]` array containing 79 values, maps each element to a named key-value pair in a `JBSbatCommonDBInterface` parameter map, and then delegates to `JBSbatSQLAccess.insertByPrimaryKeys()` to execute a single `INSERT` statement against the target table.

The method implements the **delegation pattern** — it contains no conditional logic, loops, or business rules of its own. Instead, it serves as a thin adapter between the caller's flat array convention and the structured parameter map expected by the batch SQL access layer. This decouples callers from the table's column layout: if the table schema changes, only this method's mapping code needs updating.

Within the larger batch processing system, this method is called by `addSvckeiUcwk()` during service contract registration and change workflows, providing the final persistence step that writes the fully assembled service line item record (including lifecycle state management fields such as trial/honkanyu/cancellation/pause dates) to the database.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["executeKK_T_SVC_KEI_UCWK_PKINSERT(params)"])

    START --> CREATE_MAP["Create JBSbatCommonDBInterface setMap"]

    CREATE_MAP --> MAP_FIELDS["Populate setMap with 79 field-value pairs from setParam[0..78]"]

    MAP_FIELDS --> MAP_KEYS["Field keys: SVC_KEI_UCWK_NO through DEL_TRN_ID"]

    MAP_KEYS --> EXEC_INSERT["db_KK_T_SVC_KEI_UCWK.insertByPrimaryKeys(setMap)"]

    EXEC_INSERT --> END_NODE(["Return / Next"])
```

The method follows a **linear, sequential processing pattern** with no conditional branches:

1. **Map creation**: Instantiate `JBSbatCommonDBInterface` as an in-memory parameter container.
2. **Field mapping (L923–L992)**: Set 79 key-value pairs by calling `setMap.setValue(<fieldKey>, setParam[N])` for N = 0 through 78. Each `setParam` index corresponds to a specific database column as defined in the Javadoc.
3. **DB insert (L995)**: Call `db_KK_T_SVC_KEI_UCWK.insertByPrimaryKeys(setMap)` to perform a primary-key-based INSERT into the `KK_T_SVC_KEI_UCWK` table.
4. **Return (L997)**: Method returns void — the calling method handles any `Exception` thrown by the DB layer.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `setParam` | `Object[]` | A flat array of 79 values representing all columns of the `KK_T_SVC_KEI_UCWK` table in a single row. Index 0 is the service contract detail number; indices 1–78 cover temporal fields (dates, timestamps), status flags, lifecycle management fields (trial, full subscription, cancellation, pause), audit fields (registration/update/delete operator and timestamps), and operational metadata. The array is populated by the caller (`addSvckeiUcwk`) with data gathered from upstream business logic such as order processing and screening. |

**External state:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `db_KK_T_SVC_KEI_UCWK` | `JBSbatSQLAccess` | Batch SQL access handler initialized with the `KK_T_SVC_KEI_UCWK` table name. Responsible for executing primary-key-based INSERT operations. |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| C | `insertByPrimaryKeys` | - | `KK_T_SVC_KEI_UCWK` | Primary-key-based INSERT — writes the full service contract line item record to the database |
| - | `JBSbatCommonDBInterface.setValue` | - | - | Sets a key-value pair on the parameter map for each of the 79 fields |

The single terminal database operation is a **Create (C)** operation via `insertByPrimaryKeys`, which performs an INSERT using the primary key fields of `KK_T_SVC_KEI_UCWK` to determine uniqueness.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Batch: `addSvckeiUcwk()` | `JBSbatKKSyuKeiJudgeTran.addSvckeiUcwk()` -> `JBSbatKKSyuKeiJudgeTran.executeKK_T_SVC_KEI_UCWK_PKINSERT(Object[])` | `insertByPrimaryKeys [C] KK_T_SVC_KEI_UCWK` |

The method is called exclusively by `addSvckeiUcwk()`, another private method within the same class. Both methods work together: `addSvckeiUcwk` assembles the service contract line item data and delegates persistence to `executeKK_T_SVC_KEI_UCWK_PKINSERT`.

## 6. Per-Branch Detail Blocks

Since this method contains no conditional branches, it is a single linear block.

**Block 1** — [METHOD BODY] `(L919)`

> Create a parameter map from the flat input array and execute a primary-key-based database insert. This block contains no control flow — it simply maps 79 input indices to named fields and delegates to the SQL access layer.

| # | Type | Code |
|---|------|------|
| 1 | SET | `JBSbatCommonDBInterface setMap = new JBSbatCommonDBInterface();` // 値設定のマップを作ります (Create map for value settings) |
| 2 | SET | `setMap.setValue("SVC_KEI_UCWK_NO", setParam[0]);` // サービス契約内訳番号 |
| 3 | SET | `setMap.setValue("GENE_ADD_DTM", setParam[1]);` // 世代登録年月日時分秒 |
| 4 | SET | `setMap.setValue("SVC_KEI_UCWK_STAT", setParam[2]);` // サービス契約内訳ステータス |
| 5 | SET | `setMap.setValue("SVC_KEI_NO", setParam[3]);` // サービス契約番号 |
| 6 | SET | `setMap.setValue("MSKM_DTL_NO", setParam[4]);` // 申込明細番号 |
| 7 | SET | `setMap.setValue("PCRS_CD", setParam[5]);` // 料金コースコード |
| 8 | SET | `setMap.setValue("PPLAN_CD", setParam[6]);` // 料金プランコード |
| 9 | SET | `setMap.setValue("TK_HOSHIKI_KEI_NO", setParam[7]);` // 提供方式契約番号 |
| 10 | SET | `setMap.setValue("PAYWAY_KEIZOKU_FLG", setParam[8]);` // 支払い方法継続フラグ |
| 11 | SET | `setMap.setValue("WEB_OP_ADD_FAIL_FLG", setParam[9]);` // WEBオプション追加不可フラグ |
| 12 | SET | `setMap.setValue("WORK_RRK_BIKO", setParam[10]);` // 業務連絡備考 |
| 13 | SET | `setMap.setValue("SVC_USE_STA_KIBO_YMD", setParam[11]);` // サービス利用開始希望年月日 |
| 14 | SET | `setMap.setValue("SVC_UEST_KBTMZ_CD", setParam[12]);` // サービス利用開始希望時間帯コード |
| 15 | SET | `setMap.setValue("SVC_UEST_KBTM_CD", setParam[13]);` // サービス利用開始希望時間コード |
| 16 | SET | `setMap.setValue("RSV_TSTA_KIBO_YMD", setParam[14]);` // 予約適用開始希望年月日 |
| 17 | SET | `setMap.setValue("SKEKKA_SEND_CD", setParam[15]);` // 審査結果送信コード |
| 18 | SET | `setMap.setValue("SVC_KEI_UCWK_KZKWRK_REQYMD", setParam[16]);` // サービス契約内訳後続業務依頼年月日 |
| 19 | SET | `setMap.setValue("SHOSA_YMD", setParam[17]);` // 照査年月日 |
| 20 | SET | `setMap.setValue("SHOSA_CL_YMD", setParam[18]);` // 照査取消年月日 |
| 21 | SET | `setMap.setValue("FTRIAL_KANYU_YMD", setParam[19]);` // 試用加入年月日 |
| 22 | SET | `setMap.setValue("FTRIAL_PRD_ENDYMD", setParam[20]);` // 試用期間終了年月日 |
| 23 | SET | `setMap.setValue("HONKANYU_YMD", setParam[21]);` // 本加入年月日 |
| 24 | SET | `setMap.setValue("HONKANYU_IKO_KIGEN_YMD", setParam[22]);` // 本加入移行期限年月日 |
| 25 | SET | `setMap.setValue("KEI_CNC_YMD", setParam[23]);` // 契約締結年月日 |
| 26 | SET | `setMap.setValue("RSV_APLY_YMD", setParam[24]);` // 予約適用年月日 |
| 27 | SET | `setMap.setValue("RSV_CL_YMD", setParam[25]);` // 予約取消年月日 |
| 28 | SET | `setMap.setValue("RSV_APLY_CD", setParam[26]);` // 予約適用コード |
| 29 | SET | `setMap.setValue("PLAN_STAYMD", setParam[27]);` // プラン開始年月日 |
| 30 | SET | `setMap.setValue("PLAN_ENDYMD", setParam[28]);` // プラン終了年月日 |
| 31 | SET | `setMap.setValue("PLAN_CHRG_STAYMD", setParam[29]);` // プラン課金開始年月日 |
| 32 | SET | `setMap.setValue("PLAN_CHRG_ENDYMD", setParam[30]);` // プラン課金終了年月日 |
| 33 | SET | `setMap.setValue("PLAN_END_SBT_CD", setParam[31]);` // プラン終了種別コード |
| 34 | SET | `setMap.setValue("SVC_CANCEL_YMD", setParam[32]);` // サービスキャンセル年月日 |
| 35 | SET | `setMap.setValue("SVC_CANCEL_RSN_CD", setParam[33]);` // サービスキャンセル理由コード |
| 36 | SET | `setMap.setValue("SVC_STA_YMD", setParam[34]);` // サービス開始年月日 |
| 37 | SET | `setMap.setValue("SVC_CHRG_STAYMD", setParam[35]);` // サービス課金開始年月日 |
| 38 | SET | `setMap.setValue("SVC_STP_YMD", setParam[36]);` // サービス停止年月日 |
| 39 | SET | `setMap.setValue("SVC_STP_RSN_CD", setParam[37]);` // サービス停止理由コード |
| 40 | SET | `setMap.setValue("SVC_STP_RLS_YMD", setParam[38]);` // サービス停止解除年月日 |
| 41 | SET | `setMap.setValue("SVC_STP_RLS_RSN_CD", setParam[39]);` // サービス停止解除理由コード |
| 42 | SET | `setMap.setValue("PAUSE_STP_CD", setParam[40]);` // 休止中断コード |
| 43 | SET | `setMap.setValue("SVC_PAUSE_YMD", setParam[41]);` // サービス休止年月日 |
| 44 | SET | `setMap.setValue("SVC_PAUSE_RSN_CD", setParam[42]);` // サービス休止理由コード |
| 45 | SET | `setMap.setValue("SVC_PAUSE_RSN_MEMO", setParam[43]);` // サービス休止理由メモ |
| 46 | SET | `setMap.setValue("SVC_PAUSE_RLS_YMD", setParam[44]);` // サービス休止解除年月日 |
| 47 | SET | `setMap.setValue("SVC_PAUSE_RLS_RSN_CD", setParam[45]);` // サービス休止解除理由コード |
| 48 | SET | `setMap.setValue("SVC_PAUSE_RLS_RSN_MEMO", setParam[46]);` // サービス休止解除理由メモ |
| 49 | SET | `setMap.setValue("SVC_ENDYMD", setParam[47]);` // サービス終了年月日 |
| 50 | SET | `setMap.setValue("SVC_CHRG_ENDYMD", setParam[48]);` // サービス課金終了年月日 |
| 51 | SET | `setMap.setValue("SVC_DSL_KISAN_YMD", setParam[49]);` // サービス解約起算年月日 |
| 52 | SET | `setMap.setValue("SVC_DSL_YMD", setParam[50]);` // サービス解約年月日 |
| 53 | SET | `setMap.setValue("SVC_DLRE_CD", setParam[51]);` // サービス解約理由コード |
| 54 | SET | `setMap.setValue("SVC_DLRE_MEMO", setParam[52]);` // サービス解約理由メモ |
| 55 | SET | `setMap.setValue("SVC_DSL_TTDKI_FIN_FLG", setParam[53]);` // サービス解約手続完了フラグ |
| 56 | SET | `setMap.setValue("KAIHK_YMD", setParam[54]);` // 回復年月日 |
| 57 | SET | `setMap.setValue("SVC_CANCEL_CL_YMD", setParam[55]);` // サービスキャンセル取消年月日 |
| 58 | SET | `setMap.setValue("SVC_DSL_CL_YMD", setParam[56]);` // サービス解約取消年月日 |
| 59 | SET | `setMap.setValue("SVKEIUW_HKHASYMD", setParam[57]);` // サービス契約内訳引継発生年月日 |
| 60 | SET | `setMap.setValue("CHRG_STA_YMD_HOSEI_UM", setParam[58]);` // 課金開始年月日補正有無 |
| 61 | SET | `setMap.setValue("SVC_PAUSE_CHRG_STA_YMD", setParam[59]);` // サービス休止課金開始年月日 |
| 62 | SET | `setMap.setValue("PNLTY_HASSEI_CD", setParam[60]);` // 違約金発生コード |
| 63 | SET | `setMap.setValue("IDO_DIV", setParam[61]);` // 異動区分 |
| 64 | SET | `setMap.setValue("SHOSA_DSL_FIN_CD", setParam[62]);` // 照査解約完了コード |
| 65 | SET | `setMap.setValue("SVCTK_BUT_DEL_TRN_JSSI_DTM", setParam[63]);` // サービス提供物消去処理実施年月日時分秒 |
| 66 | SET | `setMap.setValue("KEIZK_MT_SVC_KEI_UCWK_NO", setParam[64]);` // 継続元サービス契約内訳番号 |
| 67 | SET | `setMap.setValue("KEIZK_AF_KEI_CHGECHU_FLG", setParam[65]);` // 継続後契約変更手続中フラグ |
| 68 | SET | `setMap.setValue("ADD_DTM", setParam[66]);` // 登録年月日時分秒 |
| 69 | SET | `setMap.setValue("ADD_OPEACNT", setParam[67]);` // 登録オペレータアカウント |
| 70 | SET | `setMap.setValue("UPD_DTM", setParam[68]);` // 更新年月日時分秒 |
| 71 | SET | `setMap.setValue("UPD_OPEACNT", setParam[69]);` // 更新オペレータアカウント |
| 72 | SET | `setMap.setValue("DEL_DTM", setParam[70]);` // 削除年月日時分秒 |
| 73 | SET | `setMap.setValue("DEL_OPEACNT", setParam[71]);` // 削除オペレータアカウント |
| 74 | SET | `setMap.setValue("MK_FLG", setParam[72]);` // 無効フラグ |
| 75 | SET | `setMap.setValue("ADD_UNYO_YMD", setParam[73]);` // 登録運用年月日 |
| 76 | SET | `setMap.setValue("ADD_TRN_ID", setParam[74]);` // 登録処理ID |
| 77 | SET | `setMap.setValue("UPD_UNYO_YMD", setParam[75]);` // 更新運用年月日 |
| 78 | SET | `setMap.setValue("UPD_TRN_ID", setParam[76]);` // 更新処理ID |
| 79 | SET | `setMap.setValue("DEL_UNYO_YMD", setParam[77]);` // 削除運用年月日 |
| 80 | SET | `setMap.setValue("DEL_TRN_ID", setParam[78]);` // 削除処理ID |
| 81 | CALL | `db_KK_T_SVC_KEI_UCWK.insertByPrimaryKeys(setMap);` // DBアクセスを実行します (Execute DB access) |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `svc_kei_ucwk_no` | Field | Service contract detail number — unique identifier for a service contract line item |
| `gene_add_dtm` | Field | Generation registration datetime — timestamp of when this record version was registered |
| `svc_kei_ucwk_stat` | Field | Service contract detail status — current processing state of the line item |
| `svc_kei_no` | Field | Service contract number — parent service contract identifier |
| `mskm_dtl_no` | Field | Order detail number — identifier for the order line item |
| `pcrs_cd` | Field | Pricing course code — classifies the service pricing tier |
| `pplan_cd` | Field | Pricing plan code — specific pricing plan identifier |
| `tk_hosikiki_ikei_no` | Field | Delivery method contract number — identifier for the service delivery method |
| `payway_keizoku_flg` | Field | Payment method continuity flag — indicates whether the previous payment method continues |
| `web_op_add_fail_flg` | Field | Web option addition failure flag — indicates whether a web option addition failed |
| `work_rrk_biko` | Field | Business communication memo — internal notes for operations staff |
| `svc_use_sta_kibo_ymd` | Field | Service usage start desired date — customer's requested service start date |
| `svc_uest_kbtmz_cd` | Field | Service start desired time slot code — preferred time slot for service activation |
| `svc_uest_kbtm_cd` | Field | Service start desired time code — preferred time of day for service activation |
| `rsv_tsta_kibo_ymd` | Field | Reservation application start desired date |
| `skekka_send_cd` | Field | Screening result transmission code — code for screening outcome |
| `svc_kei_ucwk_kzkwrk_reqymd` | Field | Service contract detail follow-up work request date |
| `shosa_ymd` | Field | Screening date — date of information verification |
| `shosa_cl_ymd` | Field | Screening cancellation date |
| `ftrial_kanyu_ymd` | Field | Trial subscription date — when the customer's trial period begins |
| `ftrial_prd_endymd` | Field | Trial period end date |
| `honkanyu_ymd` | Field | Full subscription date — when the customer's trial converts to a paid subscription |
| `honkanyu_iko_kigen_ymd` | Field | Full subscription migration deadline |
| `kei_cnc_ymd` | Field | Contract closing date — the date the contract was formally concluded |
| `rsv_aply_ymd` | Field | Reservation application date |
| `rsv_cl_ymd` | Field | Reservation cancellation date |
| `rsv_aply_cd` | Field | Reservation application code |
| `plan_staymd` | Field | Plan start date |
| `plan_endymd` | Field | Plan end date |
| `plan_chrg_staymd` | Field | Plan billing start date |
| `plan_chrg_endymd` | Field | Plan billing end date |
| `plan_end_sbt_cd` | Field | Plan end type code — indicates how/why the plan ended |
| `svc_cancel_ymd` | Field | Service cancellation date |
| `svc_cancel_rsn_cd` | Field | Service cancellation reason code |
| `svc_sta_ymd` | Field | Service start date — actual service commencement date |
| `svc_chrg_staymd` | Field | Service billing start date |
| `svc_stp_ymd` | Field | Service suspension date |
| `svc_stp_rsn_cd` | Field | Service suspension reason code |
| `svc_stp_rls_ymd` | Field | Service suspension release date |
| `svc_stp_rls_rsn_cd` | Field | Service suspension release reason code |
| `pause_stp_cd` | Field | Pause/stop code |
| `svc_pause_ymd` | Field | Service pause date |
| `svc_pause_rsn_cd` | Field | Service pause reason code |
| `svc_pause_rsn_memo` | Field | Service pause reason memo |
| `svc_pause_rls_ymd` | Field | Service pause release date |
| `svc_pause_rls_rsn_cd` | Field | Service pause release reason code |
| `svc_pause_rls_rsn_memo` | Field | Service pause release reason memo |
| `svc_endymd` | Field | Service end date |
| `svc_chrg_endymd` | Field | Service billing end date |
| `svc_dsl_kisan_ymd` | Field | Service contract termination calculation date |
| `svc_dsl_ymd` | Field | Service contract termination date |
| `svc_dlre_cd` | Field | Service termination reason code |
| `svc_dlre_memo` | Field | Service termination reason memo |
| `svc_dsl_ttdei_fin_flg` | Field | Service termination procedure completion flag |
| `ka ihk_ymd` | Field | Recovery date — date of service recovery/restoration |
| `svc_cancel_cl_ymd` | Field | Service cancellation reversal date |
| `svc_dsl_cl_ymd` | Field | Service contract termination reversal date |
| `svkeiuw_hkhasyd` | Field | Service contract detail handover occurrence date |
| `chrg_sta_ymd_hosei_um` | Field | Billing start date correction existence flag |
| `svc_pause_chrg_sta_ymd` | Field | Service pause billing start date |
| `pnlty_hassei_cd` | Field | Penalty occurrence code |
| `ido_div` | Field | Movement/transfer classification — how the record moved (add, update, etc.) |
| `shosa_dsl_fin_cd` | Field | Screening termination completion code |
| `svctk_but_del_trn_jssi_dtm` | Field | Service deliverable deletion processing datetime |
| `keizk_mt_svc_kei_ucwk_no` | Field | Continuation source service contract detail number |
| `keizk_af_kei_chgechu_flg` | Field | Post-continuation contract change processing in-progress flag |
| `add_dtm` | Field | Registration datetime |
| `add_opeacnt` | Field | Registration operator account |
| `upd_dtm` | Field | Update datetime |
| `upd_opeacnt` | Field | Update operator account |
| `del_dtm` | Field | Deletion datetime |
| `del_opeacnt` | Field | Deletion operator account |
| `mk_flg` | Field | Validity flag (marked as inactive) |
| `add_unyo_ymd` | Field | Registration operational date |
| `add_trn_id` | Field | Registration transaction ID |
| `upd_unyo_ymd` | Field | Update operational date |
| `upd_trn_id` | Field | Update transaction ID |
| `del_unyo_ymd` | Field | Deletion operational date |
| `del_trn_id` | Field | Deletion transaction ID |
| `KK_T_SVC_KEI_UCWK` | DB Table | Service contract line item table — stores the primary data for a service contract detail/line item including all lifecycle dates, status flags, and audit metadata |
| `JBSbatCommonDBInterface` | Class | Batch parameter container — key-value store used to pass field values to SQL access methods |
| `JBSbatSQLAccess` | Class | Batch SQL access handler — executes parameterized SQL (insert, select, update, delete) against target tables |
| PK insert | Process | Primary-key-based insert — writes a complete record to the table using the primary key fields for uniqueness determination |
