Compare commits

...

7 Commits

Author SHA1 Message Date
wangjia 5861b9210c chore: release client-v1.0.80
Deploy Client / build-client-web (push) Successful in 43s
Deploy Client / build-windows (push) Successful in 1m56s
Deploy Client / build-macos (push) Successful in 2m11s
Deploy Client / build-android (push) Successful in 1m29s
Deploy Client / build-ios (push) Successful in 2m47s
Deploy Client / release-deploy-client (push) Successful in 1m49s
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-24 18:02:32 +08:00
wangjia a678c3806e chore: release client-v1.0.79
Deploy Client / build-client-web (push) Successful in 44s
Deploy Client / build-macos (push) Successful in 2m29s
Deploy Client / build-android (push) Successful in 1m23s
Deploy Client / build-ios (push) Successful in 2m59s
Deploy Client / build-windows (push) Successful in 1m52s
Deploy Client / release-deploy-client (push) Successful in 2m40s
入库/出库单搜索框升级:搜索后关键词转为框内 chip 标签 + 一键清除(✕),仅保留单个搜索词;新增 SearchChip 组件 + provider currentKeyword getter 进屏同步。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YZ4DskSRKsSiheQonFtQvx
2026-06-24 12:08:55 +08:00
wangjia 5ff41cc505 chore: release server-v1.0.81
Deploy Server / release-deploy-server (push) Successful in 1m54s
修复入库单/出库单按商品名搜不到历史导入单:搜索酒名条件由 COALESCE(被占位名劫持) 改为 p.name OR it.product_name 任一命中,并加回归测试。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YZ4DskSRKsSiheQonFtQvx
2026-06-24 11:56:21 +08:00
wangjia 33b0f6c30c chore: release client-v1.0.78
Deploy Client / build-windows (push) Successful in 1m52s
Deploy Client / build-client-web (push) Successful in 41s
Deploy Client / build-macos (push) Successful in 2m36s
Deploy Client / build-android (push) Successful in 1m16s
Deploy Client / build-ios (push) Successful in 3m0s
Deploy Client / release-deploy-client (push) Successful in 3m11s
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YZ4DskSRKsSiheQonFtQvx
2026-06-24 01:26:39 +08:00
wangjia 6f25972277 chore: release server-v1.0.80
Deploy Server / release-deploy-server (push) Successful in 1m57s
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YZ4DskSRKsSiheQonFtQvx
2026-06-24 01:25:51 +08:00
wangjia a06c1c0709 fix(deploy): setup_ssh 给私钥补结尾换行,修复阿里 ed25519 部署 key "invalid format"
Forgejo 存 secret 时会去掉结尾换行,而 OpenSSH 格式私钥(如阿里 ed25519
部署 key)缺结尾换行会被 openssh 判为 "invalid format" 拒绝加载,退化成
无密钥 → Permission denied,导致迁移期 Deploy → Ali 影子轨每次都失败
(因 continue-on-error 不阻塞 EC2、流水线仍显示成功,故未被察觉)。
EC2 那把是 RSA/PEM 对结尾换行宽容,未暴露此问题。

改 printf '%s' → printf '%s\n' 始终补一个结尾换行;对已含换行的 PEM 无害。
已本机端到端复现并验证:去掉结尾换行的 key 经修复后 deploy-server.sh
阿里分支跑通,阿里二进制已与 EC2 一致(sha 7e77ec46)、jiu.service 保持 stopped。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YZ4DskSRKsSiheQonFtQvx
2026-06-24 01:23:13 +08:00
wangjia 052a541084 chore: release client-v1.0.77
Deploy Client / build-client-web (push) Successful in 42s
Deploy Client / build-windows (push) Successful in 1m57s
Deploy Client / build-macos (push) Successful in 2m51s
Deploy Client / build-android (push) Successful in 1m32s
Deploy Client / build-ios (push) Successful in 3m42s
Deploy Client / release-deploy-client (push) Successful in 3m10s
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YZ4DskSRKsSiheQonFtQvx
2026-06-24 00:33:22 +08:00
13 changed files with 292 additions and 54 deletions
+27
View File
@@ -5,6 +5,33 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [1.0.80] - 2026-06-24
### 新功能
- 出库单详情新增「售价」与「利润」列,利润 = 售价 − 成本,一眼看清每笔出库的盈亏。
### 改进
- 出库 / 入库单详情改为全屏展示,内容更大更清晰,左上角返回箭头关闭。
- 出库单详情自动带出商品的生产日期与批次号(明细未单独填写时回退商品资料),去掉冗余的「数量」列。
## [1.0.79] - 2026-06-24
### 改进
- 入库单 / 出库单搜索框升级:搜索后关键词以标签形式显示在搜索框内,带一键清除(✕)按钮,输入框自动清空便于继续输入;当前仅支持单个搜索词。
## [1.0.78] - 2026-06-24
### 改进
- 维护性发布:发布与部署流程修复,应用功能无变更。
## [1.0.77] - 2026-06-24
### 新功能
- 入库 / 出库列表的搜索框支持按「酒名(商品名)」搜索(支持汉字、全拼、首字母),输入时带防抖限流,输入更顺畅。
### 改进
- 入库录入单价允许留空或填 0(待定价):不再强制单价大于 0,便于先入库、后用「确认进价」补填真实进价。
## [1.0.76] - 2026-06-23
### 新功能
+10
View File
@@ -5,6 +5,16 @@
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [1.0.81] - 2026-06-24
### 修复
- 入库单 / 出库单按商品名搜索:历史导入的单据现在也能按商品名搜到(此前明细统一挂占位商品,搜索被占位名顶替,只能搜到新建单据)。
## [1.0.80] - 2026-06-24
### 改进
- 运维(不影响线上功能):修复迁移期 CI 影子部署链路——部署私钥写入时补齐结尾换行,解决阿里机 ed25519 部署密钥被判「invalid format」导致 Deploy → Ali 步骤每次失败的问题。
## [1.0.79] - 2026-06-24
### 改进
+5 -3
View File
@@ -53,16 +53,18 @@ func (h *StockInHandler) List(c *gin.Context) {
if kw := strings.TrimSpace(c.Query("keyword")); kw != "" {
like := "%" + kw + "%"
// keyword 同时命中:单号 / 往来单位 / 酒名(含全拼+首字母,反查含该酒明细的单据)。
// 酒名优先取 product 主数据、回退快照列;拼音只在 products 上(快照无拼音列)。
// 酒名product 主数据名 OR 明细快照名」任一命中——不能用 COALESCE 二选一:历史导入单的
// 明细 product_id 统一指向占位商品「历史导入占位」(p.name 非空),COALESCE 会被占位名劫持,
// 永远取不到真实快照 product_name,导致导入单按真实酒名搜不到。拼音只在 products 上(快照无拼音列)。
query = query.Where(
"order_no LIKE ?"+
" OR partner_id IN (SELECT id FROM partners WHERE shop_id = ? AND name LIKE ?)"+
" OR id IN (SELECT it.order_id FROM stock_in_items it"+
" LEFT JOIN products p ON p.id = it.product_id AND p.shop_id = it.shop_id"+
" WHERE it.shop_id = ? AND it.deleted_at IS NULL"+
" AND (COALESCE(NULLIF(p.name,''), it.product_name) LIKE ?"+
" AND (p.name LIKE ? OR it.product_name LIKE ?"+
" OR p.name_pinyin LIKE ? OR p.name_initials LIKE ?))",
like, shopID, like, shopID, like, like, like,
like, shopID, like, shopID, like, like, like, like,
)
}
+44 -1
View File
@@ -263,7 +263,7 @@ func TestStockInHandler_TotalAmount(t *testing.T) {
"warehouse_id": warehouse.ID,
"order_date": time.Now().Format(time.RFC3339),
"items": []map[string]interface{}{
{"product_id": product1.ID, "quantity": 10.0, "unit_price": 5.0}, // 50
{"product_id": product1.ID, "quantity": 10.0, "unit_price": 5.0}, // 50
{"product_id": product2.ID, "quantity": 3.0, "unit_price": 20.0}, // 60
},
})
@@ -487,6 +487,49 @@ func TestStockInHandler_List_FilterByProductName(t *testing.T) {
assert.Equal(t, float64(2), parseResponse(w)["total"].(float64))
}
// 回归:历史导入单的明细 product_id 统一指向占位商品「历史导入占位」(p.name 非空),
// 真实酒名只在快照列 product_name。修复前搜索用 COALESCE(NULLIF(p.name,”), product_name)
// 被占位名劫持,导入单按真实酒名搜不到;修复后「p.name OR product_name」任一命中。
func TestStockInHandler_List_FilterByImportedSnapshotName(t *testing.T) {
db := testutil.SetupTestDB()
shop := testutil.CreateTestShop(db, "SI012B")
user := testutil.CreateTestUser(db, shop.ID, "admin", "pass", "admin")
warehouse := testutil.CreateTestWarehouse(db, shop.ID, "Warehouse")
token := getAuthToken(user.ID, shop.ID, "admin")
r := setupProtectedRouter(db)
// 占位商品:名「历史导入占位」,编码 HIST-PLACEHOLDER(模拟 import-history
placeholder := &model.Product{
TenantBase: model.TenantBase{ShopID: shop.ID},
Name: "历史导入占位",
Code: "HIST-PLACEHOLDER",
}
require.NoError(t, db.Create(placeholder).Error)
// 导入单:明细 product_id 指向占位商品,真实酒名「飞天茅台」仅在快照 product_name
order := &model.StockInOrder{
TenantBase: model.TenantBase{ShopID: shop.ID},
OrderNo: "RK-IMPORT-001",
WarehouseID: warehouse.ID,
OperatorID: user.ID,
Status: "approved",
OrderDate: model.Date{Time: time.Now()},
}
require.NoError(t, db.Create(order).Error)
require.NoError(t, db.Create(&model.StockInItem{
OrderID: order.ID,
ShopID: shop.ID,
ProductID: placeholder.ID,
ProductCode: "ZXZ000010",
ProductName: "飞天茅台",
Quantity: 5.0,
}).Error)
// 按真实酒名搜 → 命中导入单(修复前为 0)
w := makeRequest(r, "GET", "/api/v1/stock-in/orders?keyword=茅台", token, nil)
assert.Equal(t, float64(1), parseResponse(w)["total"].(float64))
}
func TestStockInHandler_List_FilterByProductPinyin(t *testing.T) {
db := testutil.SetupTestDB()
shop := testutil.CreateTestShop(db, "SI013")
+5 -3
View File
@@ -46,16 +46,18 @@ func (h *StockOutHandler) List(c *gin.Context) {
if kw := strings.TrimSpace(c.Query("keyword")); kw != "" {
like := "%" + kw + "%"
// keyword 同时命中:单号 / 往来单位 / 酒名(含全拼+首字母,反查含该酒明细的单据)。
// 酒名优先取 product 主数据、回退快照列;拼音只在 products 上(快照无拼音列)。
// 酒名product 主数据名 OR 明细快照名」任一命中——不能用 COALESCE 二选一:历史导入单的
// 明细 product_id 统一指向占位商品「历史导入占位」(p.name 非空),COALESCE 会被占位名劫持,
// 永远取不到真实快照 product_name,导致导入单按真实酒名搜不到。拼音只在 products 上(快照无拼音列)。
query = query.Where(
"order_no LIKE ?"+
" OR partner_id IN (SELECT id FROM partners WHERE shop_id = ? AND name LIKE ?)"+
" OR id IN (SELECT it.order_id FROM stock_out_items it"+
" LEFT JOIN products p ON p.id = it.product_id AND p.shop_id = it.shop_id"+
" WHERE it.shop_id = ? AND it.deleted_at IS NULL"+
" AND (COALESCE(NULLIF(p.name,''), it.product_name) LIKE ?"+
" AND (p.name LIKE ? OR it.product_name LIKE ?"+
" OR p.name_pinyin LIKE ? OR p.name_initials LIKE ?))",
like, shopID, like, shopID, like, like, like,
like, shopID, like, shopID, like, like, like, like,
)
}
// 按商品编码反查单据:精确匹配,走 idx_so_items_shop_code(shop_id, product_code) 索引
@@ -248,6 +248,46 @@ func TestStockOutHandler_List_FilterByProductName(t *testing.T) {
assert.Equal(t, float64(2), parseResponse(w)["total"].(float64))
}
// 回归:历史导入出库单的明细 product_id 指向占位商品「历史导入占位」,真实酒名只在快照列。
// 修复前 COALESCE 被占位名劫持搜不到,修复后「p.name OR product_name」任一命中。
func TestStockOutHandler_List_FilterByImportedSnapshotName(t *testing.T) {
db := testutil.SetupTestDB()
shop := testutil.CreateTestShop(db, "SO012B")
user := testutil.CreateTestUser(db, shop.ID, "admin", "pass", "admin")
warehouse := testutil.CreateTestWarehouse(db, shop.ID, "Warehouse")
token := getAuthToken(user.ID, shop.ID, "admin")
r := setupProtectedRouter(db)
placeholder := &model.Product{
TenantBase: model.TenantBase{ShopID: shop.ID},
Name: "历史导入占位",
Code: "HIST-PLACEHOLDER",
}
require.NoError(t, db.Create(placeholder).Error)
order := &model.StockOutOrder{
TenantBase: model.TenantBase{ShopID: shop.ID},
OrderNo: "CK-IMPORT-001",
WarehouseID: warehouse.ID,
OperatorID: user.ID,
Status: "approved",
OrderDate: model.Date{Time: time.Now()},
}
require.NoError(t, db.Create(order).Error)
require.NoError(t, db.Create(&model.StockOutItem{
OrderID: order.ID,
ShopID: shop.ID,
ProductID: placeholder.ID,
ProductCode: "ZXZ000010",
ProductName: "飞天茅台",
Quantity: 5.0,
}).Error)
// 按真实酒名搜 → 命中导入单(修复前为 0)
w := makeRequest(r, "GET", "/api/v1/stock-out/orders?keyword=茅台", token, nil)
assert.Equal(t, float64(1), parseResponse(w)["total"].(float64))
}
func TestStockOutHandler_Reject(t *testing.T) {
db := testutil.SetupTestDB()
shop := testutil.CreateTestShop(db, "SO004")
+3 -2
View File
@@ -61,8 +61,9 @@ class StockOutItem {
productSeries: lineOrProduct('series', 'series'),
productSpec: lineOrProduct('spec', 'spec'),
productUnit: (json['product'] as Map<String, dynamic>?)?['unit'] as String?,
batchNo: json['batch_no'] as String?,
productionDate: json['production_date'] as String?,
// 批次号/生产日期:优先明细行快照,回退 product 关联(App 新建单据快照列常为空)
batchNo: lineOrProduct('batch_no', 'batch_no'),
productionDate: lineOrProduct('production_date', 'production_date'),
);
}
}
@@ -69,6 +69,8 @@ class StockInListNotifier extends AsyncNotifier<PageResult<StockInOrder>> {
/// 当前服务端状态过滤值(供页面进入时对齐标签/下拉,避免重复拉取)
String get currentStatus => _status;
String get currentKeyword => _keyword;
void setStatus(String status) {
_status = status;
_page = 1;
@@ -71,6 +71,8 @@ class StockOutListNotifier extends AsyncNotifier<PageResult<StockOutOrder>> {
/// 当前服务端状态过滤值(供页面进入时对齐标签/下拉,避免重复拉取)
String get currentStatus => _status;
String get currentKeyword => _keyword;
void setStatus(String status) {
_status = status;
_page = 1;
@@ -17,6 +17,7 @@ import '../../widgets/multi_select_dropdown.dart' show ColDef, ColumnToggleButto
import '../../core/storage/column_prefs.dart';
import '../../widgets/page_scaffold.dart';
import '../../widgets/status_badge.dart';
import '../../widgets/search_chip.dart';
import '../../core/utils/export_util.dart';
import '../../providers/inventory_provider.dart';
import '../../providers/tab_state_provider.dart';
@@ -44,6 +45,7 @@ class _StockInListScreenState extends ConsumerState<StockInListScreen> {
Set<String> _filterSupplier = {};
Set<String>? _hiddenCols; // null = 尚未载入本地存档(回退到 minWidth 首次默认)
final _searchCtrl = TextEditingController();
String _appliedKw = ''; // 已生效的搜索词(框内 chip 标签展示)
static const _screenId = 'stock_in_list';
@@ -72,6 +74,10 @@ class _StockInListScreenState extends ConsumerState<StockInListScreen> {
final want = tab == 1 ? 'pending,draft' : _statusFilter;
final notifier = ref.read(stockInListProvider.notifier);
if (notifier.currentStatus != want) notifier.setStatus(want);
// 同步已生效的搜索词到框内 chip(provider 持久化,切走再回来不丢)
if (notifier.currentKeyword != _appliedKw) {
setState(() => _appliedKw = notifier.currentKeyword);
}
});
}
@@ -81,8 +87,19 @@ class _StockInListScreenState extends ConsumerState<StockInListScreen> {
super.dispose();
}
void _triggerSearch() =>
ref.read(stockInListProvider.notifier).setKeyword(_searchCtrl.text.trim());
void _triggerSearch() {
final kw = _searchCtrl.text.trim();
ref.read(stockInListProvider.notifier).setKeyword(kw);
// 仅支持单个搜索词:生效后输入框清空,搜索词转为框内 chip 标签
setState(() => _appliedKw = kw);
if (kw.isNotEmpty) _searchCtrl.clear();
}
void _clearSearch() {
_searchCtrl.clear();
setState(() => _appliedKw = '');
ref.read(stockInListProvider.notifier).setKeyword('');
}
String? get _startDate => _dateRange != null
? '${_dateRange!.start.year}-${_dateRange!.start.month.toString().padLeft(2, '0')}-${_dateRange!.start.day.toString().padLeft(2, '0')}'
@@ -363,12 +380,29 @@ class _StockInListScreenState extends ConsumerState<StockInListScreen> {
)
: null;
final hasKw = _appliedKw.isNotEmpty;
final searchField = TextField(
controller: _searchCtrl,
decoration: InputDecoration(
hintText: '单号/往来单位/酒名,回车搜索',
prefixIcon: const Icon(Icons.search, size: 16),
hintText: hasKw ? '继续输入新关键词…' : '单号/往来单位/酒名,回车搜索',
hintStyle: const TextStyle(fontSize: 12),
// 搜索图标 +(已生效时)框内 chip 标签,仅一个词;✕ 删除即清除搜索。
// 用 prefixIcon 而非 prefix:后者仅在聚焦/有文字时才显示,搜索后输入框为空会被隐藏。
prefixIconConstraints:
const BoxConstraints(minWidth: 0, minHeight: 0),
prefixIcon: Padding(
padding: const EdgeInsets.only(left: 8, right: 6),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
const Icon(Icons.search, size: 16),
if (hasKw) ...[
const SizedBox(width: 6),
SearchChip(label: _appliedKw, onDeleted: _clearSearch),
],
],
),
),
suffixIcon: IconButton(
icon: const Icon(Icons.search, size: 16),
tooltip: '搜索',
@@ -1010,24 +1044,21 @@ class _StockInDetailDialogState extends ConsumerState<_StockInDetailDialog> {
@override
Widget build(BuildContext context) {
return Dialog(
child: Container(
width: context.dialogWidth(720),
constraints: const BoxConstraints(maxHeight: 600),
return Dialog.fullscreen(
child: SafeArea(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 14),
decoration: const BoxDecoration(
color: AppTheme.primary,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(12),
topRight: Radius.circular(12),
),
),
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 8),
decoration: const BoxDecoration(color: AppTheme.primary),
child: Row(
children: [
IconButton(
icon: const Icon(Icons.arrow_back, color: Colors.white),
tooltip: '返回',
onPressed: () => Navigator.of(context).pop(),
),
const Text('入库单详情',
style: TextStyle(
fontSize: 16,
@@ -1040,10 +1071,6 @@ class _StockInDetailDialogState extends ConsumerState<_StockInDetailDialog> {
tooltip: '打印',
onPressed: () => safePrint(context, () => printStockInOrder(_loadedOrder!)),
),
IconButton(
icon: const Icon(Icons.close, color: Colors.white),
onPressed: () => Navigator.of(context).pop(),
),
],
),
),
@@ -15,6 +15,7 @@ import '../../widgets/multi_select_dropdown.dart' show ColDef, ColumnToggleButto
import '../../core/storage/column_prefs.dart';
import '../../widgets/page_scaffold.dart';
import '../../widgets/status_badge.dart';
import '../../widgets/search_chip.dart';
import '../../core/utils/export_util.dart';
import '../../core/utils/print_util.dart';
import '../../providers/inventory_provider.dart';
@@ -43,6 +44,7 @@ class _StockOutListScreenState extends ConsumerState<StockOutListScreen> {
Set<String>? _hiddenCols; // null = 尚未载入本地存档(回退到 minWidth 首次默认)
final _searchCtrl = TextEditingController();
final _codeSearchCtrl = TextEditingController();
String _appliedKw = ''; // 已生效的搜索词(框内 chip 标签展示)
static const _screenId = 'stock_out_list';
@@ -59,6 +61,10 @@ class _StockOutListScreenState extends ConsumerState<StockOutListScreen> {
final want = tab == 1 ? 'pending,draft' : _statusFilter;
final notifier = ref.read(stockOutListProvider.notifier);
if (notifier.currentStatus != want) notifier.setStatus(want);
// 同步已生效的搜索词到框内 chip(provider 持久化,切走再回来不丢)
if (notifier.currentKeyword != _appliedKw) {
setState(() => _appliedKw = notifier.currentKeyword);
}
});
}
@@ -82,9 +88,19 @@ class _StockOutListScreenState extends ConsumerState<StockOutListScreen> {
super.dispose();
}
void _triggerSearch() => ref
.read(stockOutListProvider.notifier)
.setKeyword(_searchCtrl.text.trim());
void _triggerSearch() {
final kw = _searchCtrl.text.trim();
ref.read(stockOutListProvider.notifier).setKeyword(kw);
// 仅支持单个搜索词:生效后输入框清空,搜索词转为框内 chip 标签
setState(() => _appliedKw = kw);
if (kw.isNotEmpty) _searchCtrl.clear();
}
void _clearSearch() {
_searchCtrl.clear();
setState(() => _appliedKw = '');
ref.read(stockOutListProvider.notifier).setKeyword('');
}
void _triggerCodeSearch() => ref
.read(stockOutListProvider.notifier)
@@ -375,12 +391,29 @@ class _StockOutListScreenState extends ConsumerState<StockOutListScreen> {
)
: null;
final hasKw = _appliedKw.isNotEmpty;
final searchField = TextField(
controller: _searchCtrl,
decoration: InputDecoration(
hintText: '单号/往来单位/酒名,回车搜索',
prefixIcon: const Icon(Icons.search, size: 16),
hintText: hasKw ? '继续输入新关键词…' : '单号/往来单位/酒名,回车搜索',
hintStyle: const TextStyle(fontSize: 12),
// 搜索图标 +(已生效时)框内 chip 标签,仅一个词;✕ 删除即清除搜索。
// 用 prefixIcon 而非 prefix:后者仅在聚焦/有文字时才显示,搜索后输入框为空会被隐藏。
prefixIconConstraints:
const BoxConstraints(minWidth: 0, minHeight: 0),
prefixIcon: Padding(
padding: const EdgeInsets.only(left: 8, right: 6),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
const Icon(Icons.search, size: 16),
if (hasKw) ...[
const SizedBox(width: 6),
SearchChip(label: _appliedKw, onDeleted: _clearSearch),
],
],
),
),
suffixIcon: IconButton(
icon: const Icon(Icons.search, size: 16),
tooltip: '搜索',
@@ -924,24 +957,21 @@ class _StockOutDetailDialogState extends ConsumerState<_StockOutDetailDialog> {
@override
Widget build(BuildContext context) {
return Dialog(
child: Container(
width: context.dialogWidth(720),
constraints: const BoxConstraints(maxHeight: 600),
return Dialog.fullscreen(
child: SafeArea(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 14),
decoration: const BoxDecoration(
color: AppTheme.primary,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(12),
topRight: Radius.circular(12),
),
),
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 8),
decoration: const BoxDecoration(color: AppTheme.primary),
child: Row(
children: [
IconButton(
icon: const Icon(Icons.arrow_back, color: Colors.white),
tooltip: '返回',
onPressed: () => Navigator.of(context).pop(),
),
const Text('出库单详情',
style: TextStyle(
fontSize: 16,
@@ -954,10 +984,6 @@ class _StockOutDetailDialogState extends ConsumerState<_StockOutDetailDialog> {
tooltip: '打印',
onPressed: () => safePrint(context, () => printStockOutOrder(_loadedOrder!)),
),
IconButton(
icon: const Icon(Icons.close, color: Colors.white),
onPressed: () => Navigator.of(context).pop(),
),
],
),
),
@@ -1040,7 +1066,7 @@ class _StockOutDetailDialogState extends ConsumerState<_StockOutDetailDialog> {
children: [
TableRow(
decoration: const BoxDecoration(color: Color(0xFFF0F4FF)),
children: ['序号', '商品编码', '名称', '系列', '规格', '生产日期', '批次号', '数量', '', '金额']
children: ['序号', '商品编码', '名称', '系列', '规格', '生产日期', '批次号', '成本价', '', '利润']
.map((h) => Padding(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 10),
child: Text(h,
@@ -1069,9 +1095,9 @@ class _StockOutDetailDialogState extends ConsumerState<_StockOutDetailDialog> {
: (item.productionDate ?? '-')),
_TableCell(
(item.batchNo?.isNotEmpty ?? false) ? item.batchNo! : '-'),
_TableCell(item.quantity.toStringAsFixed(3)),
_TableCell('¥${item.unitPrice.toStringAsFixed(2)}'),
_TableCell('¥${item.totalPrice.toStringAsFixed(2)}'),
_TableCell('¥${item.salePrice.toStringAsFixed(2)}'),
_TableCell('¥${(item.salePrice - item.unitPrice).toStringAsFixed(2)}'),
],
);
}),
+52
View File
@@ -0,0 +1,52 @@
import 'package:flutter/material.dart';
/// 搜索框内嵌的「已生效搜索词」标签:紧凑圆角 chip + ✕ 删除按钮。
///
/// 用于列表屏搜索框 [InputDecoration.prefix],仅展示单个搜索词;
/// 点 ✕ 触发 [onDeleted] 清除搜索。
class SearchChip extends StatelessWidget {
const SearchChip({super.key, required this.label, required this.onDeleted});
final String label;
final VoidCallback onDeleted;
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final bg = theme.colorScheme.primary.withValues(alpha: 0.12);
final fg = theme.colorScheme.primary;
return Container(
padding: const EdgeInsets.only(left: 8, right: 2, top: 2, bottom: 2),
decoration: BoxDecoration(
color: bg,
borderRadius: BorderRadius.circular(12),
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 120),
child: Text(
label,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 12,
color: fg,
fontWeight: FontWeight.w500,
),
),
),
InkResponse(
onTap: onDeleted,
radius: 14,
child: Padding(
padding: const EdgeInsets.all(2),
child: Icon(Icons.close, size: 14, color: fg),
),
),
],
),
);
}
}
+5 -1
View File
@@ -114,7 +114,11 @@ setup_ssh() {
local host="${DEPLOY_HOST:-$EC2_HOST}"
local key="${DEPLOY_SSH_KEY:-$EC2_SSH_KEY}"
mkdir -p ~/.ssh
printf '%s' "${key}" > ~/.ssh/ec2_deploy.pem
# `printf '%s\n'` 末尾补一个换行:Forgejo 存 secret 会去掉结尾换行,而
# OpenSSH 格式私钥(-----BEGIN OPENSSH PRIVATE KEY-----,如阿里 ed25519 部署 key
# 缺结尾换行会被判为 "invalid format" 而拒绝加载,退化成无密钥 → Permission denied。
# 多补的换行对已含结尾换行的 PEM(如 EC2 key)无害。
printf '%s\n' "${key}" > ~/.ssh/ec2_deploy.pem
chmod 600 ~/.ssh/ec2_deploy.pem
ssh-keyscan -H "${host}" >> ~/.ssh/known_hosts 2>/dev/null
SSH="ssh -i ~/.ssh/ec2_deploy.pem -o StrictHostKeyChecking=no"