# Eo / Web / Webview / Dkw01302sf

## Overview

The `eo.web.webview.DKW01302SF` package implements the **Shelf Move Receipt Details Screen** (棚移動入荷詳細画面) within the logistics management system. When items are moved between warehouse locations (shelf moves), this screen allows operators to view, confirm, and finalize the receipt details for each line item in a move lot. It supports a multi-step workflow: initial display of the receipt list, optional viewing of related basic info and quantity specification details, a two-phase confirmation-and-finalization process (confirm → fix), and CSV export of move results.

## Key Classes and Interfaces

### DKW01302SFLogic — Business Logic

[source/koptWebB/src/eo/web/webview/DKW01302SF/DKW01302SFLogic.java](source/koptWebB/src/eo/web/webview/DKW01302SF/DKW01302SFLogic.java)

This is the central controller for the module. It extends `JCCWebBusinessLogic` and orchestrates screen initialization, data retrieval, pagination, confirm/fix processing, and CSV export.

**Screen initialization — `init()`**
- Retrieves screen info and sets the operation date.
- If the calling screen is DKW01405 (Shelf Move Basic Info Detail) or DKW01406 (Quantity Specification Detail), it skips pagination reset and performs a direct query. Otherwise, it clears pagination and calls the `DKSV0105` service to load the receipt detail list.
- If no data is returned, it forces a redirect back to the basic info list screen (DKW01301) with error `EKB0320`.
- Sets up screen display via `setGamen()` and navigation via `setNextScreen()`.

**Data display — `showBaseInfo()` and `showCountDetail()`**
- These methods pass data to and receive data from related screens. `showBaseInfo()` navigates to DKW01405, passing the shelf move lot number. `showCountDetail()` navigates to DKW01406 (Quantity Specification), passing the reserved equipment delivery number and a move type code of "2".

**Confirm creation — `confirmCreate()`**
- Called when the user clicks the confirmation button.
- Extracts the paging key (reserved equipment delivery number) from the selected row, then calls `DKSV0106` with function code 2 (check mode) to validate the data.
- If validation succeeds, it re-queries the list via `DKSV0105` and navigates to DKW01303 (Confirmation Screen). Displays message `EKB0370`.

**Fix processing — `fix()`**
- Called when the user clicks the finalization button on the confirmation screen.
- Calls `DKSV0106` with function code 1 (commit mode) to actually update the database.
- If successful, re-queries the list, resets pagination, and navigates to DKW01304 (Completion Screen). Displays message `EKB0380`.

**Pagination — `pagingDtl()`, `pagingFix()`, `pagingFin()`**
- All delegate to `pagingCommon()`, which clears the detail list, calls `DKSV0105` with the appropriate screen ID, and re-renders the display. Each variant sets the pagination command mode to `L_PAG_DTL`, `L_PAG_FIX`, or `L_PAG_FIN` respectively.

**CSV export — `outputCsv()`**
- Retrieves the shelf move lot number, calls `DKSV0093` to query CSV export data, then builds a CSV file with header records (type `7G`), detail records (type `7H`), and a trailer record (type `7I`).
- File naming convention: `eo_tana4_{lotNo}_{timestamp}.csv`.
- Sets the generated file as a temp download via `JCCWebCommon.setTempDownloadFile()`.

**Screen display setup — `setGamen()`**
- Constructs consolidated "move source name" and "move destination name" by preferring warehouse name > worksite name > office name.
- Calls `setList()` to process each detail row (alternating row colors, product name truncation, etc.).
- Sets button enabled/disabled flags based on move status code and specified method code:
  - If status is "005" (completed), the confirm button is disabled.
  - If the specified method code is "2" (serial number specification), the quantity detail button is disabled.

**Service delegation**
The logic class calls three backend services through the `invokeService()` framework method:

| Service | Purpose |
|---------|---------|
| `DKSV0105` | Query shelf move basic info and receipt detail list (used by `init`, `pagingCommon`, `confirmCreate`, `fix`) |
| `DKSV0106` | Update/confirm shelf move receipt (used by `confirmCreate` in check mode, `fix` in commit mode) |
| `DKSV0093` | Query shelf move result data for CSV export (used by `outputCsv`) |

### DKW01302SFBean — View Data Bean

[source/koptWebB/src/eo/web/webview/DKW01302SF/DKW01302SFBean.java](source/koptWebB/src/eo/web/webview/DKW01302SF/DKW01302SFBean.java)

The main view data bean that manages the screen state. It extends `X33VViewBaseBean` and implements `X33VListedBeanInterface`, `X31CBaseBean`, and `Serializable`.

**Key fields:**
- Simple scalar fields: `disp_count_value`, `paging_key_value`, `disp_shelf_move_lot_no_value`, `key_shelf_move_lot_no_value`, `unyo_ymd_value`, `row_no_value`, `b_cnt_dtl_dsbl_flg_value`, `b_cnfrm_create_dsbl_flg_value`, `ybkiki_haiso_rslt_cd_value`, `ybkiki_haiso_rslt_memo_value`
- Four typed-list fields that hold arrays of detail beans:

| Field | Element type | Purpose |
|-------|-------------|---------|
| `kihon_list_list` | `DKW01302SF02DBean` | Shelf move basic info list |
| `shosai_list_list` | `DKW01302SF01DBean` | Shelf move receipt detail list |
| `csv_list_list` | `DKW01302SF04DBean` | Shelf move result info for CSV |
| `update_list_list` | `DKW01302SF03DBean` | Data update list |

**Key methods:**
- `addListDataInstance(String key)` — Creates new entries in the appropriate typed-list when the framework requests more rows.
- `removeElementFromListData(String key, int index)` — Removes a specific row from a typed-list.
- `clearListDataInstance(String key)` — Clears all entries from a typed-list.
- `listKoumokuIds(String key)` — Returns the list of field IDs for a given typed-list type, delegating to the sub-bean's static `listKoumokuIds()` method.
- `storeModelData()` — Routes data storage to the appropriate field/sub-bean based on the key path (e.g., "棚移動入荷詳細一覧照会明細リスト/3/shohin_nm_value").
- `getModelData()` / `loadModelData()` — Retrieves data by key path from the appropriate field or sub-bean.

### DKW01302SF01DBean — Receipt Detail Data Bean

[source/koptWebB/src/eo/web/webview/DKW01302SF/DKW01302SF01DBean.java](source/koptWebB/src/eo/web/webview/DKW01302SF/DKW01302SF01DBean.java)

Represents a single row in the receipt detail list displayed on the main screen. Each instance holds data for one move line, including:

- **Type/label fields:** `l_choice_*` (type selection), `l_no_*` (row number)
- **Model code fields:** `l_tkkiki_mdl_cd_*` (home appliance model code), `l_tkkiki_sethin_mdl_cd_*` (set product model code), `l_huzokuhin_mdl_cd_*` (accessory model code)
- **Name fields:** Corresponding `l_*_nm_*` fields for human-readable model names
- **Product info:** `l_shohin_nm_*` (product name), `l_shohin_nm_disp_*` (product name for tooltip)
- **Serial number fields:** `l_kiki_seizo_no_*`, `l_tkkiki_sethin_seizo_no_*`, `l_seizo_no_*`
- **Move reason fields:** `l_ari_mv_rsn_*` (move reason with target equipment), `l_nasi_mv_rsn_*` (move reason without target equipment), `l_mv_rsn_*`
- **Quantity fields:** `l_sji_cnt_*` (instruction count), `l_mv_target_*` (move target flag), `l_mv_cnt_*` (move count)
- **Remarks fields:** `l_ari_biko_*` (remarks with equipment), `l_nasi_biko_*` (remarks without equipment), `l_biko_*`, `l_biko_disp_*`
- **Delivery fields:** `l_ybkiki_haiso_no_*` (reserved equipment delivery number), `l_mv_stat_*` (move status), `l_shitei_way_cd_*` (specified method code), `l_color_*` (row coloring)

Each property follows a consistent 4-field pattern: `{field}_update`, `{field}_value`, `{field}_enabled`, `{field}_state`.

### DKW01302SF02DBean — Basic Info Data Bean

[source/koptWebB/src/eo/web/webview/DKW01302SF/DKW01302SF02DBean.java](source/koptWebB/src/eo/web/webview/DKW01302SF/DKW01302SF02DBean.java)

Represents a single row in the shelf move basic info list. Holds location hierarchy names (warehouse > worksite > office) for both move source and move destination, along with:

- `sji_ymd_*` — instruction date
- `mv_tnt_user_id_*`, `mv_tnt_user_nm_*` — user ID and name
- `rrks_telno_*`, `rrks_fax_*` — contact phone and fax
- `bkm_*` — department name
- `mv_mt_*` / `mv_sk_*` — move source/destination name, shelf name, warehouse/worksite/office names
- `shka_sk_*` — shipping destination
- `shitei_way_nm_*`, `mv_stat_cd_*`, `shitei_way_cd_*` — specified method name, move status code, specified method code

### DKW01302SF03DBean — Update Detail Data Bean

[source/koptWebB/src/eo/web/webview/DKW01302SF/DKW01302SF03DBean.java](source/koptWebB/src/eo/web/webview/DKW01302SF/DKW01302SF03DBean.java)

A compact data bean for the "data update list" with only four fields:

| Field | Description |
|-------|-------------|
| `ybkiki_haiso_no_*` | Reserved equipment delivery number |
| `upd_dtm_*` | Update timestamp |
| `ybkiki_haiso_ucwk_no_*` | Reserved equipment delivery internal detail number |
| `ucwk_upd_dtm_*` | Internal detail update timestamp |

Implements `loadModelData()` and `storeModelData()` with string-key dispatching for Japanese field names.

### DKW01302SF04DBean — CSV Export Data Bean

[source/koptWebB/src/eo/web/webview/DKW01302SF/DKW01302SF04DBean.java](source/koptWebB/src/eo/web/webview/DKW01302SF/DKW01302SF04DBean.java)

Represents a single row in the CSV export result list. Contains move source/destination codes (warehouse, worksite, office, shelf), model codes, serial numbers, goods status code, instruction count, move count, specified method, and move type.

### DKW01302SFChecker — GUI Validation

[source/koptWebB/src/eo/web/webview/DKW01302SF/DKW01302SFChecker.java](source/koptWebB/src/eo/web/webview/DKW01302SF/DKW01302SFChecker.java)

Implements `X31SGuiCheckBase`. Currently a placeholder — the `checkMethod()` always returns `true` without performing any validation. No GUI-level field checks are defined for this screen.

### DKW01302SFConst — Constants

[source/koptWebB/src/eo/web/webview/DKW01302SF/DKW01302SFConst.java](source/koptWebB/src/eo/web/webview/DKW01302SF/DKW01302SFConst.java)

Holds screen-level string constants used as lookup keys for the data bean system. Key constants include:

| Constant | Value (Japanese) |
|----------|-------------------|
| `DISP_COUNT` | 一覧表示件数 (list display count) |
| `PAGING_KEY` | ページンギキー (pagination key) |
| `DISP_SHELF_MOVE_LOT_NO` | 棚移動ロット番号 (shelf move lot number) |
| `KEY_SHELF_MOVE_LOT_NO` | _KEY_棚移動ロット番号 (internal key) |
| `KIHON_LIST` | 棚移動基本情報一覧照会明細リスト |
| `SHOSAI_LIST` | 棚移動入荷詳細一覧照会明細リスト |
| `CSV_LIST` | 棚移動結果情報一覧照会明細CSV用リスト |
| `UPDATE_LIST` | データ更新リスト |
| `UNYO_YMD` | 運用日付 (operation date) |
| `ROW_NO` | 行番号 (row number) |

## How It Works

### The Multi-Step Workflow

```mermaid
flowchart TD
    subgraph Screens
        DKW01301["DKW01301<br/>Shelf Move Basic Info List"]
        DKW01302["DKW01302<br/>Shelf Move Receipt Details<br/>(this module)"]
        DKW01303["DKW01303<br/>Confirmation Screen"]
        DKW01304["DKW01304<br/>Completion Screen"]
        DKW01405["DKW01405<br/>Shelf Move Basic Info Detail"]
        DKW01406["DKW01406<br/>Quantity Specification Detail"]
    end

    subgraph ModuleClasses
        Logic["DKW01302SFLogic<br/>Business Logic"]
        Bean["DKW01302SFBean<br/>View Data Bean"]
        DBean01["DKW01302SF01DBean<br/>Detail Line Data Bean"]
        DBean02["DKW01302SF02DBean<br/>Edit Form Data Bean"]
        DBean03["DKW01302SF03DBean<br/>Receipt Detail Bean"]
        DBean04["DKW01302SF04DBean<br/>Fix Result Bean"]
        Checker["DKW01302SFChecker<br/>GUI Validation"]
        Const["DKW01302SFConst<br/>Constants"]
    end

    subgraph BackendServices
        DKSV0105["DKSV0105<br/>Query Service<br/>(detail list display)"]
        DKSV0106["DKSV0106<br/>Update Service<br/>confirm & fix"]
        DKSV0093["DKSV0093<br/>Query Service<br/>CSV export"]
    end

    DKW01302 -- "init" --> DKW01301
    DKW01301 -- "navigate to" --> DKW01302
    DKW01302 -- "showBaseInfo" --> DKW01405
    DKW01302 -- "showCountDetail" --> DKW01406
    DKW01302 -- "confirmCreate" --> DKW01303
    DKW01303 -- "returnDetail" --> DKW01302
    DKW01303 -- "fix" --> DKW01304
    DKW01304 -- "complete" --> DKW01302
    DKW01302 -- "pagingDtl / pagingFix / pagingFin" --> DKW01302

    Logic --> Bean
    Logic --> DBean01
    Logic --> DBean02
    Logic --> DBean03
    Logic --> DBean04
    Checker --> Logic
    Const -.-> Logic

    Logic -- "invokeService" --> DKSV0105
    Logic -- "invokeService" --> DKSV0106
    Logic -- "invokeService" --> DKSV0093
```

### Typical Operation: User Confirms and Finalizes a Receipt

1. **User arrives** at the receipt detail screen (DKW01302) from the basic info list (DKW01301).
2. **`init()`** is called:
   - Screen info is retrieved, the operation date is set, and any incoming pagination info is cleared.
   - `putServiceDKSV0105()` builds a parameter map, invokes the `DKSV0105` service (function code 1), and receives the shelf move detail list.
   - `setGamen()` processes each detail row: computes consolidated move source/destination names, assigns alternating row colors, truncates product names to 20 chars, sets the correct serial number based on the "specified method" code, and determines if the instruction count matches the move count (for the move target checkbox).
   - Button states are set: if status is "005" (completed), the confirm button is disabled; if the specified method is "2" (serial number specification), the quantity detail button is disabled.
3. **User reviews** the detail list, optionally clicking to see basic info details (DKW01405) or quantity specification (DKW01406) by passing data via the screen context.
4. **User clicks confirm:** `confirmCreate()` is invoked:
   - Extracts the paging key (reserved equipment delivery number) from the selected row.
   - Calls `DKSV0106` with function code 2 (check/verify mode). The service validates the data without committing.
   - If validation passes, the list is re-queried via `DKSV0105` and the user is redirected to the confirmation screen (DKW01303).
5. **On the confirmation screen**, the user clicks the finalization (fix) button:
   - `fix()` calls `DKSV0106` with function code 1 (commit mode), which actually updates the database.
   - The list is re-queried, pagination is cleared, and the user is redirected to the completion screen (DKW01304) with a success message.
6. **User clicks complete:** `complete()` calls `init()` again, restarting the screen at its initial state.

### CSV Export Flow

When the user requests CSV export:
1. `outputCsv()` clears the CSV list and calls `putServiceDKSV0093()` to query result data.
2. `buildFile()` iterates over all CSV rows, generating header records (type `7G`) and data records (type `7H`). For "quantity specification" mode, it groups records by reserved equipment delivery number, inserting header records only when the delivery number changes. For "serial number specification" mode, it outputs a header record for every row.
3. `buildTrailerRecord()` appends a trailer record (type `7I`) with the total row count.
4. The file is encoded in WIN31J (Shift_JIS) and set as a temporary download file.

## Data Model

The data model is built around four typed-list structures managed by `DKW01302SFBean`:

```
DKW01302SFBean
├── kihon_list_list → List<DKW01302SF02DBean>
│   └── Each row: move date, user info, source/destination names & codes, shelf names, shipping destination, move status, specified method
├── shosai_list_list → List<DKW01302SF01DBean>
│   └── Each row: type selector, row number, model codes (home/set/accessory), model names, product name, serial numbers, move reason, instruction/move counts, move target flag, remarks, delivery number, move status
├── csv_list_list → List<DKW01302SF04DBean>
│   └── Each row: move number, instruction date, source/destination codes (warehouse/worksite/office/shelf), model codes, serial numbers, goods status, instruction count, specified method, move type
└── update_list_list → List<DKW01302SF03DBean>
    └── Each row: delivery number, update timestamp, internal detail number, internal detail update timestamp
```

Each typed-list entry exposes `value`, `state`, `enabled`/`enable`, and `update` properties through the `X33VDataTypeBeanInterface` contract.

## Dependencies and Integration

### Internal Dependencies

The module depends on the following packages:

| Package | Usage |
|---------|-------|
| `eo.common.constant` | Message codes (`JPCOnlineMessageConstant`), model constant codes (`JPCModelConstant`), string constants (`JDKStrConst`) |
| `eo.common.util` | String utilities (`JDKCommonUtil.join`, `isNull`) |
| `eo.web.webview.JCCWebBusinessLogic` | Base class for all web business logic controllers |
| `eo.web.webview.CommonInfoCF` | Common screen info management (`CommonInfoCFConst`) |
| `eo.web.webview.common` | Shared web utilities (`JCCWebCommon`, `JDKWebCommon`, `JDKScreenConst`, `JZMWebConst`) |
| `eo.web.webview.mapping` | Database mappers: `DKSV0105_DKSV0105OPDBMapper`, `DKSV0106_DKSV0106OPDBMapper`, `DKSV0093_DKSV0093OPDBMapper` |
| `eo.web.webview.DKW01405SF`, `DKW01406SF` | Related screens for basic info detail and quantity specification (navigation targets) |
| `eo.ejb.common`, `eo.ejb.cbs.mainproc`, `eo.ejb.common.edit` | Backend EJB services used by the mappers |
| `eo.web.webview.FUW00162SF`, `SCW00101SF`, `CNW00901SF`, `CNW01001SF`, `KKW00127SF`, `KKW05001SF`, `KKA17101SF`, `KKA17401SF`, `KKW12701SF` | Other web view modules (cross-module references via XML configs) |

### XML Configuration Links

| XML Config | Classes Referenced |
|------------|-------------------|
| `WEBGAMEN_DKW013020PJP.xml` | `DKW01302SFBean`, `DKW01302SFLogic` |
| `WEBGAMEN_DKW013030PJP.xml` | `DKW01302SFBean`, `DKW01302SFLogic` |
| `WEBGAMEN_DKW013040PJP.xml` | `DKW01302SFBean`, `DKW01302SFLogic` |
| `x31business_logic_DKW01302SF.xml` | `DKW01302SFLogic` |

## Notes for Developers

- **Screen IDs follow a convention**: DKW01301 = basic info list, DKW01302 = receipt details (this module), DKW01303 = confirmation, DKW01304 = completion. The `DKW01405` and `DKW01406` screens are external navigation targets for viewing related detail data.
- **Function codes for `DKSV0106`**: Code 1 is commit (finalization), code 2 is check (validation). The same service method is reused with different function codes — see `confirmCreate()` vs `fix()`.
- **Status "005"** indicates a completed move. When this status is detected, the confirm button is disabled to prevent duplicate processing.
- **Specified method code "2"** means "serial number specification" (each unit is individually tracked by serial number). In this mode, the instruction count and move count are both hardcoded to 1, and the quantity detail button is disabled.
- **The `DKW01302SFChecker` class is a no-op**. All validation is handled through the service layer (`DKSV0106`) rather than at the GUI field level. This may change in future versions.
- **CSV export uses WIN31J encoding** (Windows Shift_JIS). The `dqot()` method wraps all CSV fields in double quotes for proper CSV formatting.
- **Row coloring** uses alternating "odd"/"even" CSS classes set via `l_color_*` properties on each `DKW01302SF01DBean` entry.
- **Navigation between screens** is handled through the common info bean (`CommonInfoCFConst.NEXT_SCREEN_ID` / `NEXT_SCREEN_NAME`). Always call `setNextScreen()` before returning.
- **Pagination keys** are preserved when navigating back from confirmation screens. The `transBack` parameter in `pagingCommon()` and `putServiceDKSV0105()` controls whether pagination info is reset or preserved.
