Files
FT363-INTERFACE/docs/superpowers/plans/2026-07-21-interface-wms-field-expansion.md

81 lines
5.2 KiB
Markdown

# Interface and WMS Field Expansion Implementation Plan
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
**Goal:** Persist and display the requested delivery, completion, and sales-shipment fields across FT363-INTERFACE and FT363-WMS.
**Architecture:** Extend the existing port DTOs and service-to-domain mappings in FT363-INTERFACE, add nullable SQL Server columns and MyBatis mappings, then extend the existing WMS domain/query/table definitions. `requiredTm` reuses the existing `require_time` column for backward compatibility.
**Tech Stack:** Java 8, Spring Boot 2.5, MyBatis XML, SQL Server, Thymeleaf, Bootstrap Table, JUnit.
## Global Constraints
- Preserve unrelated dirty-worktree changes.
- New database columns are nullable and migrations are idempotent.
- Keep existing endpoint response codes and transaction boundaries unchanged.
- Use exact API property names: `requiredTm`, `isExpedited`, `effectiveDate`, `expirationDate`, `oaProductShipNum`.
### Task 1: Add failing contract and mapping tests
**Files:**
- Create: `FT363-INTERFACE/ruoyi-admin/src/test/java/com/ruoyi/web/port/FieldExpansionContractTest.java`
**Interfaces:**
- Consumes the three request DTOs and their detail DTO.
- Produces executable assertions for JSON binding and mapping source expectations.
- [ ] **Step 1: Write failing tests** for JSON binding of all five exact names and for the new persistence properties.
- [ ] **Step 2: Run `mvn -pl ruoyi-admin -Dtest=FieldExpansionContractTest test`** and confirm failure because the properties do not yet exist.
### Task 2: Extend FT363-INTERFACE DTOs and persistence mapping
**Files:**
- Modify: `ruoyi-admin/src/main/java/com/ruoyi/web/port/domain/DeliveryApplicationMsg.java`
- Modify: `ruoyi-admin/src/main/java/com/ruoyi/web/port/domain/CompletionRecordDetailMsg.java`
- Modify: `ruoyi-admin/src/main/java/com/ruoyi/web/port/domain/GoodsSaleSendMsg.java`
- Modify: `ruoyi-admin/src/main/java/com/ruoyi/project/out/outStock/domain/OutStockout.java`
- Modify: `ruoyi-admin/src/main/java/com/ruoyi/project/in/stockindetail/domain/StockinDetail.java`
- Modify: `ruoyi-admin/src/main/java/com/ruoyi/project/out/outStockDetail/domain/OutStockoutDetail.java`
- Modify: `ruoyi-admin/src/main/resources/mapper/out/OutStockoutMapper.xml`
- Modify: `ruoyi-admin/src/main/resources/mapper/in/StockinDetailMapper.xml`
- Modify: `ruoyi-admin/src/main/resources/mapper/out/OutStockoutDetailMapper.xml`
- Modify: `ruoyi-admin/src/main/java/com/ruoyi/web/port/service/impl/PortServiceImpl.java`
- [ ] **Step 1:** Add DTO getters/setters using exact JSON names, retaining `requireTime` compatibility through an alias or equivalent setter.
- [ ] **Step 2:** Add nullable persistence properties and MyBatis result/select/insert mappings for `is_expedited`, `effective_date`, `expiration_date`, and `oa_product_ship_num`; map `requiredTm` to `requireTime`.
- [ ] **Step 3:** Map values in the three existing service methods without changing transaction or response behavior.
- [ ] **Step 4:** Run the focused contract tests and confirm they pass.
### Task 3: Add idempotent SQL migration scripts
**Files:**
- Create: `FT363-INTERFACE/sql/20260721_add_mes_field_expansion.sql`
- Create: `FT363-WMS/sql/20260721_add_mes_field_expansion.sql`
- [ ] **Step 1:** Add `COL_LENGTH` guarded `ALTER TABLE` statements for `out_stockout.is_expedited`, `in_stockin_detail.effective_date`, `in_stockin_detail.expiration_date`, and `out_stockout_detail.oa_product_ship_num`.
- [ ] **Step 2:** Verify each statement is valid SQL Server syntax and can run repeatedly without attempting a duplicate column.
### Task 4: Display fields in FT363-WMS
**Files:**
- Modify: `ruoyi-admin/src/main/java/com/ruoyi/project/out/outStock/domain/OutStockout.java`
- Modify: `ruoyi-admin/src/main/resources/mapper/out/OutStockoutMapper.xml`
- Modify: `ruoyi-admin/src/main/resources/templates/out/stockout.html`
- Modify: `ruoyi-admin/src/main/java/com/ruoyi/project/in/stockindetail/domain/StockinDetail.java`
- Modify: `ruoyi-admin/src/main/resources/mapper/in/StockinDetailMapper.xml`
- Modify: `ruoyi-admin/src/main/resources/templates/in/stockin/stockinManage.html`
- Modify: `ruoyi-admin/src/main/java/com/ruoyi/project/out/outStockDetail/domain/OutStockoutDetail.java`
- Modify: `ruoyi-admin/src/main/resources/mapper/out/OutStockoutDetailMapper.xml`
- Modify: `ruoyi-admin/src/main/resources/templates/out/stockout.html`
- [ ] **Step 1:** Add the new result/select mappings and domain getters/setters in WMS.
- [ ] **Step 2:** Add visible Bootstrap Table columns with Chinese labels and a `0`/`1` formatter for expedited status.
- [ ] **Step 3:** Run static field/column checks and compile WMS.
### Task 5: Full verification
- [ ] **Step 1:** Run `mvn -pl ruoyi-admin -DskipTests compile` in FT363-INTERFACE.
- [ ] **Step 2:** Run focused and existing tests that do not require unavailable external databases.
- [ ] **Step 3:** Run `mvn -pl ruoyi-admin -DskipTests compile` in FT363-WMS.
- [ ] **Step 4:** Review `git diff` and `git status` in both repositories to ensure only scoped files changed.