feat(client): 入库单价允许留空/0(待定价),移除 >0 校验
- 删除新建入库商品明细单价的「不能为空 + >0」校验,留空或填 0 视为「待定价」 - 待定价明细经审核后在入库单详情「确认进价」补填真实进价 - 清理未使用的 productCode 局部变量与 _productCodeOf 辅助方法 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -868,11 +868,8 @@ class _StockInFormScreenState extends ConsumerState<StockInFormScreen> {
|
||||
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<StockInFormScreen> {
|
||||
);
|
||||
}
|
||||
|
||||
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<StockInFormScreen> {
|
||||
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<StockInFormScreen> {
|
||||
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}'),
|
||||
|
||||
Reference in New Issue
Block a user