[FEAT] 新增生產工單實際產量欄位與 UI 規範

- 新增 database/migrations/tenant 實際產量與耗損原因
- ProductionOrder API 狀態推進與實際產量計算
- 完工入庫新增實際產出數量原生數字輸入框 (step=1)
- Create.tsx 補上前端資料驗證與狀態保護
- 建立並更新 UI 數字輸入框設計規範
This commit is contained in:
2026-03-10 15:32:52 +08:00
parent adf13410ba
commit 6ca0bafd60
8 changed files with 325 additions and 129 deletions

View File

@@ -781,7 +781,38 @@ import { SearchableSelect } from "@/Components/ui/searchable-select";
- **Select / SearchableSelect**: 必須確保 Trigger 按鈕高度為 `h-9`
- **禁止使用**: 除非有特殊設計需求,否則避免使用 `h-10` (40px) 或其他非標準高度。
## 11.6 日期顯示規範 (Date Display)
## 11.6 數字輸入框規範 (Numeric Inputs)
當需求為輸入**整數**數量(例如:實際產出數量、標準產出量)時,**嚴禁自行開發組合 `Plus` (+) 與 `Minus` (-) 按鈕的複合元件**。
**必須使用原生 HTML5 數字輸入與屬性**
1. 使用 `<Input type="number" />` 確保預設渲染瀏覽器原生的上下調整小箭頭 (Spinner)。
2. 針對整數需求,固定加上 `step="1"` 屬性。
3. 視需求加上 `min``max` 控制上下限。
這樣既能保持與現有「新增配方」等模組的「標準產出量」欄位行為高度一致,亦能維持畫面的極簡風格。
```tsx
// ✅ 正確:依賴原生行為
<Input
type="number"
step="1"
min="0"
max={outputQuantity}
value={actualOutputQuantity}
onChange={(e) => setActualOutputQuantity(e.target.value)}
className="h-9 w-24 text-center"
/>
// ❌ 錯誤:過度設計、浪費空間與破壞一致性
<div className="flex">
<Button><Minus /></Button>
<Input type="number" />
<Button><Plus /></Button>
</div>
```
## 11.7 日期顯示規範 (Date Display)
前端顯示日期時**禁止直接顯示原始 ISO 字串**(如 `2024-03-06T08:30:00.000000Z`),必須使用 `resources/js/lib/date.ts` 提供的工具函式。