From 08b41a8f630f0e18d0a5482cba3434c0821584b5 Mon Sep 17 00:00:00 2001 From: wangjia <809946525@qq.com> Date: Tue, 23 Jun 2026 23:33:38 +0800 Subject: [PATCH] =?UTF-8?q?feat(client):=20=E5=85=A5=E5=BA=93=E5=8D=95?= =?UTF-8?q?=E4=BB=B7=E5=85=81=E8=AE=B8=E7=95=99=E7=A9=BA/0=EF=BC=88?= =?UTF-8?q?=E5=BE=85=E5=AE=9A=E4=BB=B7=EF=BC=89=EF=BC=8C=E7=A7=BB=E9=99=A4?= =?UTF-8?q?=20>0=20=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 删除新建入库商品明细单价的「不能为空 + >0」校验,留空或填 0 视为「待定价」 - 待定价明细经审核后在入库单详情「确认进价」补填真实进价 - 清理未使用的 productCode 局部变量与 _productCodeOf 辅助方法 Co-Authored-By: Claude Opus 4.8 --- .../screens/stock_in/stock_in_form_screen.dart | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/client/lib/screens/stock_in/stock_in_form_screen.dart b/client/lib/screens/stock_in/stock_in_form_screen.dart index d49192e..7ec7c5b 100644 --- a/client/lib/screens/stock_in/stock_in_form_screen.dart +++ b/client/lib/screens/stock_in/stock_in_form_screen.dart @@ -868,11 +868,8 @@ class _StockInFormScreenState extends ConsumerState { FilteringTextInputFormatter.allow(RegExp(r'^\d+\.?\d{0,2}')) ], onChanged: (_) => setState(() {}), - validator: (v) { - if (v == null || v.isEmpty) return '不能为空'; - if ((double.tryParse(v) ?? 0) <= 0) return '>0'; - return null; - }, + // 单价允许为空或 0:表示「待定价」,入库审核后可在单据详情「确认进价」补填真实进价 + validator: (_) => null, ); } @@ -976,15 +973,6 @@ class _StockInFormScreenState extends ConsumerState { ); } - String _productCodeOf(_ItemRow item) => - ref - .read(productNameListProvider) - .valueOrNull - ?.where((o) => o.id == item.selectedNameId) - .firstOrNull - ?.code ?? - ''; - // ── 桌面表格:表头行 ────────────────────────────────────────────────────── Widget _buildItemTableHeader() { Widget th(String s) => Padding( @@ -1019,7 +1007,6 @@ class _StockInFormScreenState extends ConsumerState { final qty = double.tryParse(item.qtyCtrl.text) ?? 0; final price = double.tryParse(item.priceCtrl.text) ?? 0; final amount = qty * price; - final productCode = _productCodeOf(item); Widget tc(String s, {Color? color, FontWeight? weight}) => Padding( padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 12), @@ -1166,7 +1153,6 @@ class _StockInFormScreenState extends ConsumerState { final qty = double.tryParse(item.qtyCtrl.text) ?? 0; final price = double.tryParse(item.priceCtrl.text) ?? 0; final amount = qty * price; - final productCode = _productCodeOf(item); return MobileListCard( title: Text('商品 ${index + 1}'),