# Business Logic — DKW01302SFLogic.init() [73 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.DKW01302SF.DKW01302SFLogic` |
| Layer | Controller (Web view logic, extends `JCCWebBusinessLogic`) |
| Module | `DKW01302SF` (Package: `eo.web.webview.DKW01302SF`) |

## 1. Role

### DKW01302SFLogic.init()

This method performs the **initial display processing** (初期表示処理) for the **Shelf Transfer Inward Detail Screen** (棚移動入荷詳細画面, screen ID: `DKW01302`). It is the entry point that runs when a user first navigates to the shelf transfer inward detail view in the logistics management system. The method orchestrates a multi-step initialization sequence: retrieving the current screen context, fetching the service form data bean, setting up core display data (operation date, display item count, empty list containers), and then branching on the **transfer source screen** to decide whether pagination information should be cleared. If the incoming screen is not a detail screen (`DKW01405` or `DKW01406`), it clears page link info and invokes the service layer method `putServiceDKSV0105` with `isPaging = false`. Otherwise, it calls the same service method with `isPaging = true`. If the service layer returns an error flag, the method forces a redirect to the **Shelf Transfer Inward List Screen** (`DKW01301`) with an error message. On success, it configures the search command ID, initializes the row number from the data bean, applies screen display settings via `setGamen`, and sets the next screen ID to itself (`DKW01302`), effectively completing the initial display flow. This method follows the **delegate routing pattern** — it handles screen lifecycle concerns (navigation, error handling, state initialization) while delegating core data retrieval to the `putServiceDKSV0105` service method.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["init()"])
    START --> STEP1["Step1: getScreenInfo()"]
    STEP1 --> STEP2["Step2: getServiceFormBean()"]
    STEP2 --> STEP3["Step3: set UNYO_YMD to opeDate"]
    STEP3 --> STEP4["Step4: set DISP_COUNT to 0"]
    STEP4 --> STEP5["Step5: clear SHOSAI_LIST"]
    STEP5 --> STEP6["Step6: clear UPDATE_LIST"]
    STEP6 --> STEP7["Step7: errFlg = false, get screenId"]
    STEP7 --> COND1{Is transfer source
DKW01405/DKW01406?}
    COND1 -->|No| STEP8["clearPageLinkInfo(this, DKW01302)"]
    STEP8 --> STEP9["putServiceDKSV0105(..., false)"]
    STEP9 --> COND2{putService returned false?}
    COND2 -->|Yes| STEP10["errFlg = true"]
    COND2 -->|No| STEP9B["errFlg unchanged"]
    COND1 -->|Yes| STEP11["putServiceDKSV0105(..., true)"]
    STEP11 --> COND2B{putService returned false?}
    COND2B -->|Yes| STEP12["errFlg = true"]
    COND2B -->|No| STEP12B["errFlg unchanged"]
    STEP10 --> COND3{errFlg == true?}
    STEP9B --> COND3
    STEP12 --> COND3
    STEP12B --> COND3
    COND3 -->|Yes| STEP13a["setMessageInfo(EKB0320_KW)"]
    STEP13a --> STEP13b["setNextScreen(DKW01301)"]
    STEP13b --> STEP13c["setTransferPageId(DKW01301.PJP)"]
    STEP13c --> STEP13d["setScreenId(DKW01301, DKW01302)"]
    STEP13d --> RET1["Return true"]
    RET1 --> END_NODE(["END"])
    COND3 -->|No| STEP14["setSearchCommand(L_PAG_DTL)"]
    STEP14 --> STEP15["sendMessageString(ROW_NO, GET)"]
    STEP15 --> COND4{rowNo is null?}
    COND4 -->|Yes| STEP16["sendMessageString(ROW_NO, SET) to 0"]
    COND4 -->|No| STEP16B["keep existing rowNo"]
    STEP16 --> STEP17["setGamen(serviceFormBean)"]
    STEP16B --> STEP17
    STEP17 --> STEP18["setNextScreen(DKW01302, SCREEN_NAME_DKW01302)"]
    STEP18 --> RET2["Return true"]
    RET2 --> END_NODE
```

**Processing Summary:**

1. **Screen Context Setup:** Retrieve screen info and obtain the service form data bean.
2. **State Initialization:** Set the operation date (`UNYO_YMD`), reset display item count to zero, and clear both the detail list (`SHOSAI_LIST`) and data update list (`UPDATE_LIST`).
3. **Transfer Source Branch:** Determine whether the user arrived from a detail screen (`DKW01405` — Shelf Transfer Instruction Basic Detail, or `DKW01406` — Quantity Specification Detail). If not, clear pagination info and call the service without paging. If yes, call the service with paging enabled.
4. **Error Handling Branch:** If `putServiceDKSV0105` returns `false`, set `errFlg = true` and redirect to the list screen (`DKW01301`) with error message `EKB0320-KW`.
5. **Normal Flow Completion:** Set the search command to `L_PAG_DTL`, initialize `ROW_NO` to `"0"` if null, apply screen display settings via `setGamen`, and configure the next screen to `DKW01302` (self-reference for continued operation).

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| - | (none) | - | This method takes no parameters. It operates entirely on instance state (screen context, data beans) and the calling object (`this`). |

**Instance fields / external state read:**

| Source | Type | Business Description |
|--------|------|---------------------|
| `this` (screen context via `getScreenInfo`) | `Map` / Screen context | Holds the current screen's context data including the originating screen ID (`screenId`), which determines the branching logic. |
| `super.getServiceFormBean()` | `X31SDataBeanAccess` | The service form data bean that carries screen display data (operation date, row number, list arrays) across the request lifecycle. |

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JCCWebCommon.getScreenInfo` | JCCWebCommon | - | Retrieves screen context information (including originating screen ID) from the current request context. |
| R | `JCCWebCommon.getScreenId` | JCCWebCommon | - | Reads the originating screen ID from screen context to determine transfer source. |
| R | `JCCWebCommon.getOpeDate` | JCCWebCommon | - | Retrieves the current operation date (business date for display). |
| - | `JCCWebCommon.clearPageLinkInfo` | JCCWebCommon | - | Clears pagination/link info for screen `DKW01302` when not returning from a detail screen. |
| - | `JCCWebCommon.setMessageInfo` | JCCWebCommon | - | Sets error message `EKB0320-KW` ("Data not found" message) when service returns an error. |
| - | `JCCWebCommon.setScreenId` | JCCWebCommon | - | Sets the screen ID for redirect navigation (target: `DKW01301`, current: `DKW01302`). |
| - | `JCCWebCommon.setSearchCommand` | JCCWebCommon | - | Sets the search command ID to `L_PAG_DTL` (List Pagination Detail) for the current screen context. |
| R | `X31SDataBeanAccess.getServiceFormBean` | X31SDataBeanAccess | - | Obtains the service form data bean from the parent class for screen data management. |
| - | `X31SDataBeanAccess.sendMessageString` | X31SDataBeanAccess | - | Sets/get string values in the data bean (operation date, display count, row number). |
| - | `X31SDataBeanAccess.getDataBeanArray` | X31SDataBeanAccess | - | Retrieves typed data bean arrays (detail list, update list) for clearing. |
| - | `X31SDataBeanAccessArray.clearArray` | X31SDataBeanAccessArray | - | Clears the contents of a data bean array (SHOSAI_LIST, UPDATE_LIST). |
| - | `putServiceDKSV0105` | DKSV0105 | - | Core service method that performs data retrieval for the shelf transfer inward detail screen. Called with `isPaging = false` (direct entry) or `isPaging = true` (returning from detail screen). |
| - | `setNextScreen` | DKW01302SFLogic | - | Configures the next destination screen for navigation (`DKW01301` on error, `DKW01302` on success). |
| - | `setTransferPageId` | DKW01302SFLogic | - | Sets the full transfer page ID for redirect (`DKW01301.PJP`). |
| - | `setGamen` | DKW01302SFLogic | - | Applies screen display settings (button states, visibility, field enablement) based on the current data state. |
| - | `JDKCommonUtil.isNull` | JDKCommonUtil | - | Utility method to check if a string value is null or empty (for `rowNo` validation). |

## 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: `setSearchCommand` [-], `setSearchCommand` [-], `setSearchCommand` [-], `setSearchCommand` [-], `setNextScreen` [-], `setGamen` [-], `sendMessageString` [-], `sendMessageString` [-], `isNull` [-], `isNull` [-], `isNull` [-], `isNull` [-], `isNull` [-], `sendMessageString` [-], `sendMessageString` [-], `setSearchCommand` [-], `setScreenId` [-], `setScreenId` [-], `setScreenId` [-], `setScreenId` [-]

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Caller: `DKW01302SFLogic.complete()` | `complete()` -> `init()` | `setSearchCommand [SET] L_PAG_DTL`, `setGamen [SET] display settings`, `setNextScreen [SET] DKW01302`, `sendMessageString [SET] ROW_NO`, `putServiceDKSV0105 [R] detail data` |

**Notes:** The caller `DKW01302SFLogic.complete()` is a method within the same logic class. This indicates `init()` is called from within the same screen's processing flow (likely after some other processing in the complete/submit flow), rather than from a direct screen entry point. The method itself does not trigger any direct database CRUD — it delegates data access to `putServiceDKSV0105` and focuses on screen state management and navigation.

## 6. Per-Branch Detail Blocks

**Block 1** — [SET] `getScreenInfo()` (L95)

> Retrieve screen context information and set it into the service form bean.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `JCCWebCommon.getScreenInfo(this)` // Retrieve screen context and set into service form bean |

**Block 2** — [SET] `getServiceFormBean()` (L98)

> Obtain the service form data bean from the parent class.

| # | Type | Code |
|---|------|------|
| 1 | SET | `serviceFormBean = super.getServiceFormBean()` // Obtain X31SDataBeanAccess for screen data |

**Block 3** — [SET] Operation date (L101–102)

> Set the operation date (業務日付) into the data bean.

| # | Type | Code |
|---|------|------|
| 1 | SET | `serviceFormBean.sendMessageString(UNYO_YMD, DATABEAN_SET_VALUE, JCCWebCommon.getOpeDate(this, null))` // Set operation date. [-> UNYO_YMD = "業務日付"] |

**Block 4** — [SET] Display item count (L105)

> Initialize the display item count to zero.

| # | Type | Code |
|---|------|------|
| 1 | SET | `serviceFormBean.sendMessageString(DISP_COUNT, DATABEAN_SET_VALUE, "0")` // Initialize list display count. [-> DISP_COUNT = "一覧表示件数"] |

**Block 5** — [EXEC] Clear list arrays (L107–108)

> Clear both the detail list and the data update list containers.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `serviceFormBean.getDataBeanArray(SHOSAI_LIST).clearArray()` // Clear detail list. [-> SHOSAI_LIST = "棚移動入荷詳細一覧照会明細リスト"] |
| 2 | EXEC | `serviceFormBean.getDataBeanArray(UPDATE_LIST).clearArray()` // Clear update list. [-> UPDATE_LIST = "データ更新リスト"] |

**Block 6** — [SET] Initialize error flag and get screen ID (L110–111)

> Prepare error flag and read the originating screen ID for branching.

| # | Type | Code |
|---|------|------|
| 1 | SET | `errFlg = false` // Initialize error flag |
| 2 | SET | `screenId = JCCWebCommon.getScreenId(this)` // Get originating screen ID |

**Block 7** — [IF] Transfer source screen check (L113–114)

> **Condition:** Transfer source is NOT `DKW01405` (棚移動指示基本詳細) AND NOT `DKW01406` (数量指定詳細).
> If the user did NOT arrive from a detail screen, clear pagination info and call service without paging.

| # | Type | Code |
|---|------|------|
| 1 | SET | `condition = !(SCREEN_ID_DKW01405.equals(screenId) || SCREEN_ID_DKW01406.equals(screenId))` // Check if transfer source is not a detail screen |

**Block 7.1** — [ELSE branch] Not from detail screen (L115–120)

> Clear page link info and invoke service without paging.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `JCCWebCommon.clearPageLinkInfo(this, SCREEN_ID_DKW01302)` // Initialize pagination info. [-> SCREEN_ID_DKW01302 = "DKW01302"] |
| 2 | CALL | `result = putServiceDKSV0105(serviceFormBean, SCREEN_ID_DKW01302, false)` // Call service with isPaging=false |

**Block 7.1.1** — [IF] Service call failure (L117–119)

> If the service call returns `false`, set error flag.

| # | Type | Code |
|---|------|------|
| 1 | IF | `!putServiceDKSV0105(...) == false` (i.e., service returned false) |
| 2 | SET | `errFlg = true` // Set error flag for redirect |

**Block 7.2** — [IF branch] From detail screen (L122–127)

> **Condition:** Transfer source IS `DKW01405` OR `DKW01406`.
> Call service with paging enabled.

| # | Type | Code |
|---|------|------|
| 1 | SET | `condition = SCREEN_ID_DKW01405.equals(screenId) || SCREEN_ID_DKW01406.equals(screenId)` // [-> SCREEN_ID_DKW01405 = "DKW01405", SCREEN_ID_DKW01406 = "DKW01406"] |

**Block 7.2.1** — [THEN] Call service with paging (L125–127)

| # | Type | Code |
|---|------|------|
| 1 | CALL | `result = putServiceDKSV0105(serviceFormBean, SCREEN_ID_DKW01302, true)` // Call service with isPaging=true |

**Block 7.2.2** — [IF] Service call failure (L126–127)

> If the service call returns `false`, set error flag.

| # | Type | Code |
|---|------|------|
| 1 | IF | `!putServiceDKSV0105(...) == false` (i.e., service returned false) |
| 2 | SET | `errFlg = true` // Set error flag for redirect |

**Block 8** — [IF] Error handling branch (L131–141)

> **Condition:** `errFlg == true` — data was not found or an error occurred during service call. Force redirect to list screen.

| # | Type | Code |
|---|------|------|
| 1 | IF | `errFlg == true` // Data was not found |
| 2 | CALL | `JCCWebCommon.setMessageInfo(this, EKB0320_KW)` // Set error message. [-> EKB0320_KW = "EKB0320-KW"] |
| 3 | CALL | `setNextScreen(SCREEN_ID_DKW01301, BLANK)` // Set next screen to list. [-> SCREEN_ID_DKW01301 = "DKW01301", BLANK = ""] |
| 4 | CALL | `setTransferPageId(SCREEN_ID_DKW01301 + PJP)` // Set redirect page ID. [-> PJP = ".PJP"] |
| 5 | CALL | `JCCWebCommon.setScreenId(this, SCREEN_ID_DKW01301, SCREEN_ID_DKW01302)` // Set screen ID for navigation context |
| 6 | RETURN | `return true` // Return true to trigger redirect |

**Block 9** — [SET] Search command setup (L144)

> Set the search command ID to `L_PAG_DTL` for the current screen.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `JCCWebCommon.setSearchCommand(this, L_PAG_DTL)` // Set search command. [-> L_PAG_DTL = "L_PAG_DTL"] |

**Block 10** — [SET] Row number initialization (L147–151)

> Get the current row number from the data bean, default to "0" if null or empty.

| # | Type | Code |
|---|------|------|
| 1 | SET | `rowNo = serviceFormBean.sendMessageString(ROW_NO, DATABEAN_GET_VALUE)` // Get current row number from bean |
| 2 | IF | `JDKCommonUtil.isNull(rowNo)` // Check if rowNo is null or empty |

**Block 10.1** — [IF branch] Row number is null (L149–151)

> Default row number to "0".

| # | Type | Code |
|---|------|------|
| 1 | SET | `serviceFormBean.sendMessageString(ROW_NO, DATABEAN_SET_VALUE, "0")` // Default row number. [-> ROW_NO = "行番号"] |

**Block 11** — [EXEC] Screen display settings (L154)

> Apply screen display settings (button states, field enablement, visibility).

| # | Type | Code |
|---|------|------|
| 1 | CALL | `setGamen(serviceFormBean)` // Apply screen display settings based on data state |

**Block 12** — [SET] Next screen configuration (L157)

> Set the next screen to the current screen (`DKW01302` — 棚移動入荷詳細).

| # | Type | Code |
|---|------|------|
| 1 | CALL | `setNextScreen(SCREEN_ID_DKW01302, SCREEN_NAME_DKW01302)` // Set next screen for continued operation. [-> SCREEN_NAME_DKW01302 = "棚移動入荷詳細"] |
| 2 | RETURN | `return true` // Return true indicating successful processing |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `UNYO_YMD` | Field | Operation date — the business date used for display, typically today's date in the system. Japanese: 業務日付 |
| `DISP_COUNT` | Field | Display item count — the number of items shown on the current page of the list. Japanese: 一覧表示件数 |
| `ROW_NO` | Field | Row number — the index of the selected row in the list, used for maintaining selection state across page transitions. Japanese: 行番号 |
| `SHOSAI_LIST` | Field | Detail list — the data bean array holding shelf transfer inward detail records for display. Japanese: 棚移動入荷詳細一覧照会明細リスト |
| `UPDATE_LIST` | Field | Data update list — the data bean array holding records that have been modified on the screen. Japanese: データ更新リスト |
| `L_PAG_DTL` | Field | List Pagination Detail — the search command ID used for the detail screen's list pagination. Used as the VARB (variable) for search command routing. |
| `EKB0320_KW` | Constant | Error message code — "Data not found" message displayed when no data is available. Value: `"EKB0320-KW"` |
| `DKW01301` | Screen ID | Shelf Transfer Inward List Screen — the list view showing all shelf transfer inward records. Japanese: 棚移動入荷一覧照会 |
| `DKW01302` | Screen ID | Shelf Transfer Inward Detail Screen — the detail view this method initializes. Japanese: 棚移動入荷詳細 |
| `DKW01405` | Screen ID | Shelf Transfer Instruction Basic Detail Screen — the source screen when returning from basic detail. Japanese: 棚移動指示基本詳細 |
| `DKW01406` | Screen ID | Quantity Specification Detail Screen — the source screen when returning from quantity specification. Japanese: 数量指定詳細 |
| `putServiceDKSV0105` | Method | Core service method that retrieves shelf transfer inward detail data. The `isPaging` boolean parameter controls whether pagination is enabled (`true`) or disabled (`false`). |
| `setGamen` | Method | Screen display settings method — controls visibility, enablement, and button states on the screen based on data availability. Japanese: 画面の表示設定 |
| `errFlg` | Field | Error flag — a boolean that indicates whether the service call succeeded (`false`) or failed (`true`), triggering error redirect. |
| `BLANK` | Constant | Empty string constant used for next screen display name when redirecting. Value: `""` |
| `PJP` | Constant | Page extension suffix appended to screen IDs for redirect. Value: `".PJP"` |
| `X31SDataBeanAccess` | Class | X31 framework data bean access utility — provides typed get/set operations for screen data beans (sendMessageString, getDataBeanArray). |
| `X31CWebConst.DATABEAN_SET_VALUE` | Constant | Flag indicating a set operation on the data bean. |
| `X31CWebConst.DATABEAN_GET_VALUE` | Constant | Flag indicating a get operation on the data bean. |
| JCCWebCommon | Class | Web common utility class providing screen context operations (getScreenInfo, getScreenId, setScreenId, setSearchCommand, setMessageInfo, clearPageLinkInfo, getOpeDate). |
| JDKCommonUtil.isNull | Method | Null/empty string check utility. Returns `true` if the string is null or empty. |
| 棚移動 (Tanai Douri) | Business term | Shelf Transfer — a logistics operation where inventory is moved from one storage shelf/location to another within a warehouse. |
| 入荷 (Nyuka) | Business term | Inward/Receipt — the process of receiving goods into the warehouse system. |
| 初期表示処理 | Business term | Initial display processing — the screen initialization sequence that runs when a screen is first loaded. |
| 棚移動入荷詳細 | Business term | Shelf Transfer Inward Detail — the screen that displays detailed information about a shelf transfer inward operation. |
