Ubuntu
|
de14fb01f0
|
feat: 供应商系统 2026-11 阶段成果(分公司模板/真还原预览、商品远程搜索、主系统联调、加工幂等修复)
CI / server typecheck + tests (push) Canceled after 0s
CI / web typecheck + tests + miniprogram syntax (push) Canceled after 0s
CI / eslint (观察项,C7 骨架) (push) Canceled after 0s
CI / npm audit (critical 硬拦) (push) Canceled after 0s
- 分公司类型模板:超管配置隐藏路由/菜单 + 中文文案覆盖,仅对挂类型的分公司生效(后端 service/routes、前端 Provider/守卫/配置页)
- 超管模板 iframe 真还原预览:28 个业务页注册、白名单点选编辑、空/示例数据 fixture、白名单漂移检测工具
- 商品/SKU 下拉远程搜索:服务端关键词搜索 + 前端 useRemoteOptionSearch/SearchableSelect 接入(订单/采购/商品等页)
- 主系统联调:子系统主动解绑主系统授权(幂等重试/本地兜底)、追加修改 price_amend 视图代理与 amend-price 转发
- 修复:仓内加工重复建单幂等(已完成需求单 guard、order 任务一商品一单 guard)
- 修复:出入库记录只取前 100 条 → 服务端分页 + 真实总数
- 其它:库存/订单若干修复、分公司管理响应式布局、i18n 文案、设计文档与回归测试
|
2026-11-07 20:10:48 +08:00 |
|
Ubuntu
|
5c9c2b96f6
|
feat(库存抵扣): 按库存单位记录单位不一致抵扣
CI / server typecheck + tests (push) Canceled after 0s
CI / web typecheck + tests + miniprogram syntax (push) Canceled after 0s
CI / eslint (观察项,C7 骨架) (push) Canceled after 0s
CI / npm audit (critical 硬拦) (push) Canceled after 0s
新增 stock_cover_stock_qty/unit;单位不一致按库存可用量全额抵扣并按库存单位预留;停用自动计划变更与重试。
|
2026-11-03 17:14:18 +08:00 |
|
Ubuntu
|
bb5918d518
|
fix(加工原料): 补齐原料待验独立入库标记与回链
CI / server typecheck + tests (push) Canceled after 0s
CI / web typecheck + tests + miniprogram syntax (push) Canceled after 0s
CI / eslint (观察项,C7 骨架) (push) Canceled after 0s
CI / npm audit (critical 硬拦) (push) Canceled after 0s
镜像自采完成时标记 independent_inbound 并回写 inspection_id;历史数据迁移补齐,入库列表可见。
|
2026-11-03 14:55:37 +08:00 |
|
Ubuntu
|
39569df290
|
refactor(仓内加工): 对齐主系统批次口径
CI / server typecheck + tests (push) Canceled after 0s
CI / web typecheck + tests + miniprogram syntax (push) Canceled after 0s
CI / eslint (观察项,C7 骨架) (push) Canceled after 0s
CI / npm audit (critical 硬拦) (push) Canceled after 0s
移除独立原料采购面板,原料回到自采单行;迁移文件统一为主系统命名;录单行内补原材料按钮。
|
2026-11-03 14:18:58 +08:00 |
|
Ubuntu
|
4386c92873
|
feat(仓内加工): 采购页加工原料面板与完整链路修正
CI / server typecheck + tests (push) Canceled after 0s
CI / web typecheck + tests + miniprogram syntax (push) Canceled after 0s
CI / eslint (观察项,C7 骨架) (push) Canceled after 0s
CI / npm audit (critical 硬拦) (push) Canceled after 0s
补列表/改量/提交接口与面板;补齐 BOM 原料待验可见性与复用测试;真实链路已跑通。
|
2026-11-03 14:05:46 +08:00 |
|
Ubuntu
|
cf0d6192f2
|
fix(仓内加工): 补齐原料采购表 RLS,避免 API 拒绝启动
CI / server typecheck + tests (push) Canceled after 0s
CI / web typecheck + tests + miniprogram syntax (push) Canceled after 0s
CI / eslint (观察项,C7 骨架) (push) Canceled after 0s
CI / npm audit (critical 硬拦) (push) Canceled after 0s
|
2026-11-03 14:00:09 +08:00 |
|
Ubuntu
|
844a576252
|
feat(仓内加工): 移植 BOM、原料采购、完工分配与加工页面
CI / server typecheck + tests (push) Canceled after 0s
CI / web typecheck + tests + miniprogram syntax (push) Canceled after 0s
CI / eslint (观察项,C7 骨架) (push) Canceled after 0s
CI / npm audit (critical 硬拦) (push) Canceled after 0s
适配供应商系统:商品 BOM、按加工单自动原料采购、成品免入库回写、加工分配预览/人工分配、订单 BOM 弹窗。
|
2026-11-03 13:49:38 +08:00 |
|
Ubuntu
|
c4fa89a92a
|
feat(订单实收): 持久化实收数量/单位并接入各履约环节
CI / server typecheck + tests (push) Canceled after 0s
CI / web typecheck + tests + miniprogram syntax (push) Canceled after 0s
CI / eslint (观察项,C7 骨架) (push) Canceled after 0s
CI / npm audit (critical 硬拦) (push) Canceled after 0s
移植配送系统 68555db7:demand_* 留档、received_* 单一字段、stage 防倒序;下单/采购/验收/分拣/配送/完结/管理员修正接入,订单详情优先读持久实收。
|
2026-11-03 12:58:35 +08:00 |
|
Ubuntu
|
c36054a39e
|
feat(分拣): 显式结算方式与主系统计划同步状态
CI / server typecheck + tests (push) Canceled after 0s
CI / web typecheck + tests + miniprogram syntax (push) Canceled after 0s
CI / eslint (观察项,C7 骨架) (push) Canceled after 0s
CI / npm audit (critical 硬拦) (push) Canceled after 0s
分拣支持按重量/按数量结算(数量模式要求订单单位=库存单位);出库按结算方式取量;订单详情展示主系统计划同步状态并支持重试。
|
2026-11-03 10:42:51 +08:00 |
|
Ubuntu
|
75de81cd64
|
fix(主系统计划): 对齐主系统 order_item_id 与 request_id 契约
CI / server typecheck + tests (push) Canceled after 0s
CI / web typecheck + tests + miniprogram syntax (push) Canceled after 0s
CI / eslint (观察项,C7 骨架) (push) Canceled after 0s
CI / npm audit (critical 硬拦) (push) Canceled after 0s
主系统接口要求主系统订单行 UUID;从导入台账 payload.mainOrderItemId 读取并写入 outbox;request_id 归一化为主系统允许字符集。
|
2026-11-03 10:15:36 +08:00 |
|
Ubuntu
|
b18e0c3f0a
|
feat(主系统计划): 分拣实重扣库与备货计划同步
CI / server typecheck + tests (push) Canceled after 0s
CI / web typecheck + tests + miniprogram syntax (push) Canceled after 0s
CI / eslint (观察项,C7 骨架) (push) Canceled after 0s
CI / npm audit (critical 硬拦) (push) Canceled after 0s
供应商侧:按 SKU 库存单位称重出库;订单单位不一致时分拣后更新本地计划/实收并写 outbox,主系统接口开关默认关可重试。
|
2026-11-02 17:43:40 +08:00 |
|
Ubuntu
|
8aee4f9016
|
feat(库存): 支持真实删除已用完库存批次
CI / server typecheck + tests (push) Canceled after 0s
CI / web typecheck + tests + miniprogram syntax (push) Canceled after 0s
CI / eslint (观察项,C7 骨架) (push) Canceled after 0s
CI / npm audit (critical 硬拦) (push) Canceled after 0s
方案A:available<=0 且无活动抵扣/未出库分拣引用时物理删除;流水/报告保留,关联单据 inventory_id 置空;新增真实删除入口与审计。
|
2026-11-02 15:44:42 +08:00 |
|
Ubuntu
|
b8bbf21599
|
feat(客户商城): 下单客户账号与小程序商城二期
正常客户开户/停用/重置;order_customer 三重闸;mall-panel 商品、地址、下单;价格/客户由服务端推导;菜单与账户入口修复。
|
2026-10-28 21:06:36 +08:00 |
|
Ubuntu
|
94de4e60de
|
feat(商城管理): 客户商品库后台一期
新增 /customers/mall 卡片管理、Excel 导入、上下架/描述/收藏/移出;复用客户销售价接口;修复共享报价单并发改价、i18n、迁移空 schema、并发计数。
|
2026-10-28 20:23:43 +08:00 |
|
Ubuntu
|
521e1ae13d
|
feat(main-system): 消费 preparations.quantity_changed 同步订单计划数量
CI / server typecheck + tests (push) Canceled after 0s
CI / web typecheck + tests + miniprogram syntax (push) Canceled after 0s
CI / eslint (观察项,C7 骨架) (push) Canceled after 0s
CI / npm audit (critical 硬拦) (push) Canceled after 0s
- webhook 消费:event_id+prep_id 幂等、revision 防乱序,业务失败 200 靠对账兜底
- 未出库:订单数量/金额/分拣 required_qty/库存抵扣差额/已分配备货/自采/结算同步
- 已出库/备货完成竞态/共享行缺订单行 id:不覆盖,落冲突台账 + 站内通知
- 定时对账兜底:mainSystemReturnFollow + 事件消费者 quantity_sync
- 迁移两张台账表;新增 13 条单测
|
2026-10-28 10:37:52 +08:00 |
|
Ubuntu
|
ce55c8648a
|
feat(成本排行): 二期客户销售价编辑与安全护栏
CI / server typecheck + tests (push) Canceled after 0s
CI / web typecheck + tests + miniprogram syntax (push) Canceled after 0s
CI / eslint (观察项,C7 骨架) (push) Canceled after 0s
CI / npm audit (critical 硬拦) (push) Canceled after 0s
按供应商报价单/客户商品库结构落地:迁移价格字段与手工标记;报价单/商品库改价、指定报价单与共享单409、同值不改、0/null拒绝、superadmin操作分公司、自动加成/完成回写/报价单编辑/订单改成本不覆盖人工价;录单取价新增客户商品库档;成本排行铅笔编辑。未部署。
|
2026-10-27 18:49:02 +08:00 |
|
Ubuntu
|
05b81348c4
|
feat(配送/分拣): 早期任务、全状态发车与库存抵扣闭环
CI / server typecheck + tests (push) Canceled after 0s
CI / web typecheck + tests + miniprogram syntax (push) Canceled after 0s
CI / eslint (观察项,C7 骨架) (push) Canceled after 0s
CI / npm audit (critical 硬拦) (push) Canceled after 0s
- 下单即建分拣/配送,待取货/散客/独立进货守卫
- 30/40/45 直接发车/分拣,入库与分拣二选一
- 分拣完成补上游、清理 pending 验收,直接配送补分拣
- 库存抵扣/计划/实收 FIFO,软扣部分扣减,并发出库串行
- 结束配送不被库存不足/待入库残留阻断
- 待验收并发唯一索引(含 name-only),finalize 共享连接修复
- 售后自动绑定订单明细、客户取货/采购并发修复
- 仓库表格自适应、弹窗滚动锁闪烁修复
|
2026-10-26 16:42:53 +08:00 |
|
雨天
|
482c7c1e89
|
feat(小程序): 新增仓库管理内嵌面板与授权
CI / server typecheck + tests (push) Canceled after 0s
CI / web typecheck + tests + miniprogram syntax (push) Canceled after 0s
CI / eslint (观察项,C7 骨架) (push) Canceled after 0s
CI / npm audit (critical 硬拦) (push) Canceled after 0s
首页 Tab 内嵌仓库管理面板:批次/可用/成本价/报告/入库时间
默认仅看可用,顶部统计库存批次、可用总量、可用货值
批量上传按 Web 流程:上传→识别→候选→人工确认,编辑可直传
新增权限码 warehouse_manage,默认赋予仓管,不映射 Web 菜单
6 条移动端薄路由,全部复用 Web 同一批 service
修复首页未转发 onReachBottom 导致内嵌列表只有第 1 页
修复录单员获授权后点仓库管理回弹(漏传 permissions)
|
2026-10-25 13:47:33 +08:00 |
|
Ubuntu
|
83eb8f9c12
|
fix: 库存抵扣成本/商品成本排行收口 + 主系统事件定向消费 + 关闭主数据不卡流程
CI / server typecheck + tests (push) Canceled after 0s
CI / web typecheck + tests + miniprogram syntax (push) Canceled after 0s
CI / eslint (观察项,C7 骨架) (push) Canceled after 0s
CI / npm audit (critical 硬拦) (push) Canceled after 0s
- 库存抵扣成本按目标抵扣量幂等更新,作废/退货清 cover_qty;多批次展示按加权均价;商品成本排行纳入库存抵扣成本并改标签为“成本”
- 主系统事件:allocated 定向 order_code、returned 等批量状态核对、clamped/全量兜底下调频、失败不计 applied
- 订单完成:零价闸门排除已退货行;供应商系统关闭“主数据不卡流程”入口与执行接口
- 迁移 20261080/20261081;补充相关契约/回归测试
|
2026-10-24 18:24:05 +08:00 |
|
Ubuntu
|
372214c453
|
feat(主系统事件): 按定稿答复调整——每个 supplier_code 各拉一遍+游标/去重按(分公司,供应商)、首轮不传 since 并做初态全量对账、cursor 400 重置、批量重推建议≤100/批
CI / server typecheck + tests (push) Canceled after 0s
CI / web typecheck + tests + miniprogram syntax (push) Canceled after 0s
CI / eslint (观察项,C7 骨架) (push) Canceled after 0s
CI / npm audit (critical 硬拦) (push) Canceled after 0s
|
2026-10-24 13:51:10 +08:00 |
|
Ubuntu
|
0f25a92fec
|
feat(主系统对接): 接入 5 项配合——事件补账消费(游标+去重)、备货 cursor/order_code 定向拉取、批量状态、批量撤报告;接收端确认已在生产;全量拉取降为30分钟
CI / server typecheck + tests (push) Canceled after 0s
CI / web typecheck + tests + miniprogram syntax (push) Canceled after 0s
CI / eslint (观察项,C7 骨架) (push) Canceled after 0s
CI / npm audit (critical 硬拦) (push) Canceled after 0s
|
2026-10-24 13:47:05 +08:00 |
|
Ubuntu
|
6ebfa93016
|
perf(对账): 查询超时护栏(SET+RESET) + 每轮90s预算 + 自愈补录增量窗口(最近3天/50单) + 配套索引;附需主系统配合清单(M1-M5)
CI / server typecheck + tests (push) Canceled after 0s
CI / web typecheck + tests + miniprogram syntax (push) Canceled after 0s
CI / eslint (观察项,C7 骨架) (push) Canceled after 0s
CI / npm audit (critical 硬拦) (push) Canceled after 0s
|
2026-10-24 13:19:58 +08:00 |
|
Ubuntu
|
13efb78141
|
fix(报告推送): 补核查影响——分拣/出库来源也入队(否则报告最多晚 24h)、僵尸任务收口告警、队列表分公司隔离 RLS + 按分公司处理
CI / server typecheck + tests (push) Canceled after 0s
CI / web typecheck + tests + miniprogram syntax (push) Canceled after 0s
CI / eslint (观察项,C7 骨架) (push) Canceled after 0s
CI / npm audit (critical 硬拦) (push) Canceled after 0s
|
2026-10-24 13:05:30 +08:00 |
|
Ubuntu
|
d0206ff395
|
perf(报告推送): 全量轮询改事件驱动队列(变化点入队+按库存行/订单号精确推送)+ 补 6 类高频索引;全量扫描降为每日兜底
CI / server typecheck + tests (push) Canceled after 0s
CI / web typecheck + tests + miniprogram syntax (push) Canceled after 0s
CI / eslint (观察项,C7 骨架) (push) Canceled after 0s
CI / npm audit (critical 硬拦) (push) Canceled after 0s
|
2026-10-24 12:45:49 +08:00 |
|
Ubuntu
|
b62a123a83
|
feat(独立加工): 后端 P0——多行原料 + 多行成品回仓(processing_in) + 损耗自动差额可覆盖 + 成品成本默认均分可设置 + 报告继承(批次只复制关联/检验复制引用) + 请求号幂等;真库跑通
CI / server typecheck + tests (push) Canceled after 0s
CI / web typecheck + tests + miniprogram syntax (push) Canceled after 0s
CI / eslint (观察项,C7 骨架) (push) Canceled after 0s
CI / npm audit (critical 硬拦) (push) Canceled after 0s
|
2026-10-23 15:30:29 +08:00 |
|
Ubuntu
|
2ba17f9280
|
fix(本地库权限): 补齐 legacy_public schema/序列对 canteen_app_rls 的授权
CI / server typecheck + tests (push) Canceled after 0s
CI / web typecheck + tests + miniprogram syntax (push) Canceled after 0s
CI / eslint (观察项,C7 骨架) (push) Canceled after 0s
CI / npm audit (critical 硬拦) (push) Canceled after 0s
本地新建商品分类报错(线上正常):
[product_catalog] permission denied for sequence product_catalog_id_seq
根因:
- 通用数据网关 /api/data/query 写业务表时按 RLS 主防线 SET LOCAL ROLE canteen_app_rls;
- 租户表 id 默认值仍引用 legacy_public 的序列(如 tenant_br002.product_catalog.id
DEFAULT nextval('legacy_public.product_catalog_id_seq'));
- 本地开发库 legacy_public 的 schema USAGE 与 4 个序列(product_catalog_id_seq /
customer_skus_id_seq / allocation_tasks_id_seq / sku_suppliers_id_seq)都没有授给
canteen_app_rls(历史迁移只授过 tenant_% / public 的序列);
- 生产库此前已有人工授权(ACL 含 canteen_app_rls、schema USAGE=true),所以线上正常、仅本地报错。
修复:新增幂等迁移 20261073,给 legacy_public schema USAGE + 该 schema 下全部序列
USAGE, SELECT 给 canteen_app_rls(只追加权限,无数据变更;对生产是 no-op)。
本地验证:
- canteen_app_rls SET LOCAL ROLE 后 nextval('legacy_public.product_catalog_id_seq') 成功;
- 数据网关真实 insert product_catalog 分类成功(返回 id=122、branch_code=BR002),
并用同一网关 delete 清理(product_catalog/categories 均无残留)。
未部署;生产下次发布时该幂等迁移会自动应用(无副作用)。
|
2026-10-22 17:19:24 +08:00 |
|
Ubuntu
|
191a8c53ba
|
fix(库存): 撤销误加的删除守卫触发器(quantity>available 不等于活订单预留,会导致批次永远删不掉);孤儿依赖已用官方 cleanup 清理
CI / server typecheck + tests (push) Canceled after 0s
CI / web typecheck + tests + miniprogram syntax (push) Canceled after 0s
CI / eslint (观察项,C7 骨架) (push) Canceled after 0s
CI / npm audit (critical 硬拦) (push) Canceled after 0s
|
2026-10-20 21:43:47 +08:00 |
|
Ubuntu
|
403ba2bf4e
|
feat(库存): 删除批次前置保护——被订单占用的批次直接拒绝并给出可读原因(替代撞履约唯一来源约束的报错)
CI / server typecheck + tests (push) Canceled after 0s
CI / web typecheck + tests + miniprogram syntax (push) Canceled after 0s
CI / eslint (观察项,C7 骨架) (push) Canceled after 0s
CI / npm audit (critical 硬拦) (push) Canceled after 0s
|
2026-10-20 21:37:00 +08:00 |
|
Ubuntu
|
8c2f9e33e7
|
fix(迁移): 20261070 改为逐租户 schema 建索引(orders 在租户 schema,原写法 42P01)
CI / server typecheck + tests (push) Canceled after 0s
CI / web typecheck + tests + miniprogram syntax (push) Canceled after 0s
CI / eslint (观察项,C7 骨架) (push) Canceled after 0s
CI / npm audit (critical 硬拦) (push) Canceled after 0s
|
2026-10-20 21:17:28 +08:00 |
|
Ubuntu
|
a20debbd73
|
feat(迁移): 同一原单只允许一张未完结补送单(orders 部分唯一索引)——从数据库层防重复建单
CI / server typecheck + tests (push) Canceled after 0s
CI / web typecheck + tests + miniprogram syntax (push) Canceled after 0s
CI / eslint (观察项,C7 骨架) (push) Canceled after 0s
CI / npm audit (critical 硬拦) (push) Canceled after 0s
|
2026-10-20 21:17:20 +08:00 |
|
Ubuntu
|
e284cbad04
|
feat(退回补送): 台账记录补送单指向(保留原单追溯)+ 回写优先取补送单并重置回写状态——补送完成即可按原 prep 重新回写主系统
CI / server typecheck + tests (push) Canceled after 0s
CI / web typecheck + tests + miniprogram syntax (push) Canceled after 0s
CI / eslint (观察项,C7 骨架) (push) Canceled after 0s
CI / npm audit (critical 硬拦) (push) Canceled after 0s
|
2026-10-20 15:49:40 +08:00 |
|
Ubuntu
|
75e77ba67c
|
feat(退回补送): 原单按实供量折减——order_items.returned_qty 累加 + orders 金额/重量按 (quantity-returned_qty) 重算(统计/结算自动按净供货,避免与补送单双计)
CI / server typecheck + tests (push) Canceled after 0s
CI / web typecheck + tests + miniprogram syntax (push) Canceled after 0s
CI / eslint (观察项,C7 骨架) (push) Canceled after 0s
CI / npm audit (critical 硬拦) (push) Canceled after 0s
|
2026-10-20 15:42:08 +08:00 |
|
Ubuntu
|
239c1c3bc0
|
feat(迁移): 主系统退回/补送数据层——orders.source+linked_order_code、after_sale_returns 退回处置列与幂等唯一索引(纯附加)
CI / server typecheck + tests (push) Canceled after 0s
CI / web typecheck + tests + miniprogram syntax (push) Canceled after 0s
CI / eslint (观察项,C7 骨架) (push) Canceled after 0s
CI / npm audit (critical 硬拦) (push) Canceled after 0s
|
2026-10-20 15:35:38 +08:00 |
|
Ubuntu
|
13d3645cfb
|
feat(产地): 批次级产地迁移(inventory.origin + quality_reports.origin)
CI / server typecheck + tests (push) Canceled after 0s
CI / web typecheck + tests + miniprogram syntax (push) Canceled after 0s
CI / eslint (观察项,C7 骨架) (push) Canceled after 0s
CI / npm audit (critical 硬拦) (push) Canceled after 0s
核查结论:仓库管理「修改可用库存 → 批次属性」写的是 inventory 行;「商品档案」区写 skus(含 origin)。
批次报告在 quality_reports。故批次级产地加在 inventory,批次报告携带 quality_reports.origin;
skus.origin 保留为默认值。已在本地库执行(inventory/quality_reports/skus 三处 origin 均存在)。
|
2026-10-20 10:44:42 +08:00 |
|
Ubuntu
|
9922d20240
|
feat(报价单): 批量建单返回失败清单(b) + Idempotency-Key 幂等去重(c)(红队 #4)
CI / server typecheck + tests (push) Canceled after 0s
CI / web typecheck + tests + miniprogram syntax (push) Canceled after 0s
CI / eslint (观察项,C7 骨架) (push) Canceled after 0s
CI / npm audit (critical 硬拦) (push) Canceled after 0s
|
2026-10-19 18:01:13 +08:00 |
|
Ubuntu
|
375a32b6d8
|
feat(报价单+权限): 一客户一单(新建按客户拆分/编辑追加建新单/老数据脚本)+ 角色权限改管理员维护 + 散客改为客户下拉项 + 竞价状态与软删收尾
CI / server typecheck + tests (push) Canceled after 0s
CI / web typecheck + tests + miniprogram syntax (push) Canceled after 0s
CI / eslint (观察项,C7 骨架) (push) Canceled after 0s
CI / npm audit (critical 硬拦) (push) Canceled after 0s
|
2026-10-19 17:33:55 +08:00 |
|
雨天
|
c8eefca8de
|
修迁移20261053: U+0130 折 i 不依赖 lower()
CI / server typecheck + tests (push) Canceled after 0s
CI / web typecheck + tests + miniprogram syntax (push) Canceled after 0s
CI / eslint (观察项,C7 骨架) (push) Canceled after 0s
CI / npm audit (critical 硬拦) (push) Canceled after 0s
本地迁移实跑报 P0001「U+0130 未折成 i(实际 İ箱12瓶)」。
根因:该迁移假设 PG lower(\x27İ\x27)=\x27i\x27,但这一行为随数据库 ctype 变化 ——
本机 Windows/libc(Chinese_China.936)下 lower(\x27İ\x27) 原样返回 \x27İ\x27。
修法:norm_spec 内显式 translate(..., chr(304) || chr(775), \x27i\x27),
İ 与 i+U+0307 都收敛为单个 i;与原 UTF-8 locale 下的行为等价,
对已应用该迁移的环境是 no-op。并补组合点 U+0307 守卫。
本地已验证:20261053–20261064 全部应用成功。
|
2026-10-19 17:16:29 +08:00 |
|
Ubuntu
|
5fa2bbfd55
|
fix(audit-20261019): T1-T9 审计修复、存储归属与审计日志列宽
CI / server typecheck + tests (push) Canceled after 0s
CI / web typecheck + tests + miniprogram syntax (push) Canceled after 0s
CI / eslint (观察项,C7 骨架) (push) Canceled after 0s
CI / npm audit (critical 硬拦) (push) Canceled after 0s
- T1 资金/库存/报价/自采 P1(BIZ-1/2/3/4/10/13/14)
- T2 主系统反向事件墓碑/改派/孤儿处理(BIZ-6/8/9)
- T3 选分公司 ticket、trust proxy、角色权限收口(SEC-2/3/4)
- T4 缺列/RLS/tenant 名单/FK/迁移执行器(DATA-1..8)
- T5 401 登出/分页/映射口径/blob/ZIP 中文名(FE-1..4/BIZ-15)
- T6 测试脚本目标守卫/config fail-fast/容器配置(OPS-2..8)
- T7 前后端测试与 lint 门禁清零
- T8 应付卡片按关联订单日(口径 A)
- T9 存储对象全链路归属校验、敏感列禁写、审计 target_id 超长修复
|
2026-10-19 16:16:51 +08:00 |
|
Ubuntu
|
0f5f992f9c
|
fix(报价单): 补 quote_price_proposals.applied 列(逐行审批进度)
CI / server typecheck + tests (push) Canceled after 0s
CI / web typecheck + tests + miniprogram syntax (push) Canceled after 0s
CI / eslint (观察项,C7 骨架) (push) Canceled after 0s
CI / npm audit (critical 硬拦) (push) Canceled after 0s
本地报 column "applied" does not exist:逐行通过/驳回用 applied 存 approved_codes/rejected_codes,
但租户表没有该列。迁移:tenant_template + 所有 tenant_% schema 加 applied JSONB(可重放)。
|
2026-10-19 14:30:39 +08:00 |
|
Ubuntu
|
71fde6de39
|
feat(报价单): 报价同步(成本价同步/改价审核/双向价格传递)+ 待报价软删除
合并 feat/quote-price-sync 的报价单与竞价台账改动,补齐类型(includeDeleted/deletedAt)与缺失文件
(mainSystem/api/quotePriceProposals.ts、迁移 20261058)。
|
2026-10-18 22:22:23 +08:00 |
|
Ubuntu
|
5cfd722630
|
feat(客户): 绑定建客户用主系统分公司真名;已有客户时订单导入不再新建
- main_supplier_bindings 新增 main_branch_name(迁移 20261021)
- 绑定推送/回读接受 main_branch_name / branch_name,建客户直接用真名(缺省仍兜底)
- 重新绑定把停用(40)客户恢复启用(10)
- 测试钉住:ensureImportCustomer 先查后插 + ON CONFLICT DO NOTHING(已有客户不重复建)
|
2026-10-18 21:03:49 +08:00 |
|
Ubuntu
|
ca9e0ab3cc
|
refactor(报价单): 彻底删除内部待审改价,改价一律发申请由配送商审核
用户裁定(2026-10-18):两个系统只能交流数据、不能直接修改对方数据;自己只能改自己的。
- 删除「待审改价」:service / 4 个路由 / 面板 / 相关测试;新增迁移 drop 该租户表(含 legacy_public)
- 编辑生效单:立即落本系统 + 自动发「配送商销售价确认」申请(quoteSheetEditService)
- 报价单生效/提交/审批:不再 triggerQuoteCostSync 直推对方成本价,改为发提议由对方审核
- 删除定时重试直推任务(runQuoteCostSyncReconcile)
|
2026-10-18 20:46:14 +08:00 |
|
Ubuntu
|
3e4bc35b26
|
feat(报价单): 双向价格传递/改价审核/SKU 映射/成本同步推送(供应商侧)
- 报价单生效自动推销售价 → 配送成本价(台账+重试+rearm,映射优先)
- 编辑生效单改价走内部审核(quote_sheet_change_requests)
- 双向价格传递:A 提交配送商审核 / B 拉回并反查映射后写价、D3 回执
- SKU 映射:D4 字典推送、D5 完整拉取(截断不删)、只读本地副本
- 迁移登记 tenant_business_tables(三张租户表数组互相补齐,避免顺序敏感)
|
2026-10-18 20:10:58 +08:00 |
|
Ubuntu
|
d68cdaf7ff
|
feat(主系统对接): 导入失败留痕 + 首次告警 + 恢复销账(后续不再"无声收不到")
CI / server typecheck + tests (push) Canceled after 0s
CI / web typecheck + tests + miniprogram syntax (push) Canceled after 0s
CI / eslint (观察项,C7 骨架) (push) Canceled after 0s
CI / npm audit (critical 硬拦) (push) Canceled after 0s
开发者 2026-10-17:「后续不能出现这种无法接收到的情况」。
事故链(本地真机):主系统 22:48 派单并推 preparations.allocated(SUP37831443),
我方因"台账指向的本系统订单已不存在"返回 500,主系统重试 3 次后放弃;
旧实现只打日志、界面/通知零痕迹,直到人工查主系统投递记录才发现。
三层保证:
① 自愈(上一提交 ef81c7c):陈旧占坑/台账指针自动清理并重建;
② 可见+告警(本次):失败落 public.main_system_import_failures
(键 = 分公司×配送日×主系统分公司×主系统订单,attempts 累加不刷屏),
首次失败站内通知 admin/super_admin(6 小时内去重),新增只读接口
GET /api/integration/main-system/import-failures 供界面/排障查看;
下一次导入成功自动销账(resolved_at)。
③ 兜底重试:定时对账每 10 分钟一次(已存在);生产需补 client secret 才可用(已在文档标注)。
新增迁移 20261057;trackDayOutcome() 挂在建单/追加两条返回路径上,异常一律吞掉(告警不许反过来把导入搞挂)。
验证:
· 服务侧真库冒烟:首次失败 attempts=1/isFirst=true → 再次 attempts=2;open 可查;clear 后 open=0
· 迁移 upsert 语义(同键累加、单行)真库事务内验证通过
· 单测 mainSystemImportFailureLedger 6 条;mainSystem 子集 30 文件 / 473 用例全过
· 设计门禁:8 通过 / 1 已知红 check-ai-cost / verify-facts 因本地缺 tenant_br003 红(均基线)
|
2026-10-17 23:06:47 +08:00 |
|
Ubuntu
|
83825fa2df
|
fix(主系统同步单): 修「标着库存抵扣但抵扣为 0」的卡行 + 放开「同步行可删」(删单仍禁)
CI / server typecheck + tests (push) Canceled after 0s
CI / web typecheck + tests + miniprogram syntax (push) Canceled after 0s
CI / eslint (观察项,C7 骨架) (push) Canceled after 0s
CI / npm audit (critical 硬拦) (push) Canceled after 0s
开发者 2026-10-17 报障:「订单管理,从配送系统同步过来的订单商品行可以删除,同步过来的商品无法处理」。
生产只读排查(BR005 / ORD_API_20261017_BR005_0001):香蕉 500 斤这一行
supplier_code='STOCK_COVER'、stock_cover_qty=0、履约行 inventory_cover_qty=0,
既没有采购单也没有备货单 ⇒ 既不走库存抵扣也不进采购/备货 ⇒ 验收/分拣拿不到货。
全生产扫一遍只有这 1 行(br005 1 行,其余租户 0 行)。
A)卡行修复
· 迁移 20261056:三条边界**同时**成立才把 supplier_code 改回 'UNASSIGNED'
(① stock_cover_qty≤0 ② 履约行也没有手动抵扣量 ③ 未退货)——只纠正标记、不删行、
不误伤"真抵扣"和"手动选择抵扣商品"的行;遍历所有 tenant_* + tenant_template,幂等。
· 增量自愈:inventoryStockCoverService.normalizeStockCoverSupplierFlags(),在整单抵扣收尾
(补完 FIFO 批次计划之后)调用;失败只记日志、不影响本次抵扣结果。
B)同步行可删(口径变更,开发者 2026-10-17 授权,覆盖 2026-10-10 的"禁删")
· 服务层不再对主系统单抛 409 main_system_item_locked;
· 删除时**同一事务**把该行行级台账(main_system_order_import_items,按 our_order_item_id 反查)
置 disposition='cancelled' ⇒ needsAppendToOrder 不再追加、台账 upsert 的处置是粘性的
⇒ 下一轮对账/主系统 webhook 追加不会把它塞回来;
· markPrepDisposition 增加可选 client,保证处置与删除同事务提交(失败只记日志,巡检兜底);
· 界面:主系统行也出现删除按钮(复用既有 title 文案,无新增文案);
· **删单仍然禁止**(orderDeleteService.assertNotMainSystemOrder 未动),缺货按钮保留。
验证:
· 本地真库(事务内造 3 行 + ROLLBACK):假标记行 STOCK_COVER/0 → UNASSIGNED;
STOCK_COVER/500 与"履约行 manual cover 500"两行保持 STOCK_COVER(不误伤)
· cd server && npx tsc --noEmit → 0 错;npm run typecheck(web)→ 0 错
· 新增用例:stockCoverSupplierFlagRepair 5 条、mainSystemItemDeletable 9 条,全过;
相关后端子集 35 文件 / 536 用例通过(independentInbound 有 1 条既有失败,与基线同)
· 前端 order 相关 42 文件 / 245 用例全过
· 设计门禁:8 通过 / 1 已知红 check-ai-cost / verify-facts 因本地缺 tenant_br003 红(均基线)
|
2026-10-17 16:51:09 +08:00 |
|
Ubuntu
|
fe10859f4d
|
feat(竞价报价): 接主系统「待报价」推送并回传单价(我方只报价、不定标)
CI / server typecheck + tests (push) Canceled after 0s
CI / web typecheck + tests + miniprogram syntax (push) Canceled after 0s
CI / eslint (观察项,C7 骨架) (push) Canceled after 0s
CI / npm audit (critical 硬拦) (push) Canceled after 0s
开发者 2026-10-17 裁决:我方不做本地竞价管理(菜单已摘除),只做两件事 ——
收到主系统 bid.opened 后显示本轮要报什么、把单价报回去;中标后沿用既有「分配 → 建单」。
主系统契约(对方 docs/design/20261017-bid-opened-push.md):
· `bid.opened` 推送(单对象、无 data[]、同一套 X-Signature)
· `GET /api/supplier/bids`:列表兜底(对方 webhook 只重试 2 次)
· `GET /api/supplier/bids/:round_id`:单轮详情(明细 + 我的报价 + 我的中标)
· `POST /api/supplier/bids/:round_id/quotes`:提交报价(批量 upsert,只有我的视角)
我方实现:
· 迁移 20261055:public.main_system_bid_invitations / _invitation_items,
幂等键 (branch_code, round_id, supplier_code)、明细 (invitation_id, sku_code)
· webhook 新增 bid.opened 分支(就地 return,绝不落进 preparations.allocated 建单兜底);
验签逻辑一字未改;落库前按该分公司生效绑定校验并规范化 supplier_code
· 主系统调用走既有分层:services/mainSystem/{config,endpoints,http,token}.ts + api/bids.ts;
401 强制刷新 token 只重试一次;403 判语义拒绝不重试
· 业务层:mainSystemBidInbox(整轮对齐/唯一派生口径 deriveLocalStatus)、
mainSystemBidQuotes(列表/同步/刷新/提交 + 错误码中文映射)
· 页面侧 4 个 REST:GET 清单 / POST sync / GET :roundId / POST :roundId/quotes
(挂 workflow 模块,权限沿用 order_manage|order_edit|order_entry)
· Web「待报价」页 + 菜单(orders-bid-invitations)+ 三语文案;复用既有 bids 命名空间
口径与边界(设计文 docs/design/20261017-主系统竞价待报价与报价提交.md):
· 事实源在主系统,我方两张表是镜像:刷新/提交成功一律「整轮先清空再写」
· 失败绝不改本地报价(不能让用户以为报上了);只写 sync_error 留痕
· 退化响应守卫:对方 2xx 但载荷不可识别 ⇒ 失败且不落库(否则会清空我方已报价与中标)
· 终态不可回退:closed / awarded / cancelled 收到迟到 bid.opened 不得改回 open
· item_count 只认去重后的实际明细行数(避免"列表 3 件、点开 2 件")
· 多绑定同一轮:页面每行带 supplierCode 精确定位;不带且命中多行 ⇒ 409 不猜
· 单价:只收 number 或纯数字字符串,>0、≤4 位小数、≤99999999.9999
验证(真实输出见交付说明):
· server/tests/mainSystemBidQuote.test.ts 28 用例、mainSystemBidQuoteBoundary.test.ts 91 用例、
mainSystemBidQuoteDb.integration.test.ts 真库 11 用例(BID_DB_TEST=1 才跑)全过
· Web:BidInvitationsPage.render 7 用例 + 菜单契约/menuLayout 共 86 用例全过;
npm run typecheck 0 错;cd server && npx tsc --noEmit 0 错
(注意:根 tsconfig include 只有 src,后端必须单独 typecheck)
· 全量后端套件与基线 14d7afe 逐文件比对:失败集合完全一致(30 文件 / 38 用例,均既有失败)
· 本地真环境:伪造签名 401;真实签名连推两次只落 1 行 + 去重后 2 条明细;
未绑定编码 ⇒ ignored 不落库;详情对不存在轮次 404 且台账自动 cancelled
· 独立复核(verifier)B1–B9/B11/B13 全 pass;红队(adversary)未发现误建单/跨租户/资金精度类高危,
两条中危(多绑定错供应商、2xx 畸形响应清空本地)已修并被用例钉住
· 设计门禁:8 通过 / 1 已知红 check-ai-cost / verify-facts 因本地缺 tenant_br003 红(均基线)
|
2026-10-17 12:39:39 +08:00 |
|
Ubuntu
|
9a17028412
|
fix(数据): 迁移补齐「散客录单/独立进货」哨兵客户(生产缺 ⇒ 录单选客户下拉里看不到)
CI / server typecheck + tests (push) Canceled after 0s
CI / web typecheck + tests + miniprogram syntax (push) Canceled after 0s
CI / eslint (观察项,C7 骨架) (push) Canceled after 0s
CI / npm audit (critical 硬拦) (push) Canceled after 0s
## 根因
录单页「选择客户」下拉里的「散客录单」「独立进货」**不是前端写死的选项**,而是各租户
`customers` 表里的两行哨兵客户(`customer_code='__RETAIL__' / '__INDEPENDENT_INBOUND__'`)。
开发库有 ⇒ 下拉可见;生产库缺 ⇒ 下拉看不到(开发者线上报障「散客录单这个选择没有」)。
前端全树搜 `__RETAIL__` 只有订单列表在判断已有订单,没有任何硬编码选项 ⇒ 确认是数据缺行。
## 迁移 `20261054_ensure_sentinel_customers.sql`
- 遍历所有 `tenant_*` schema:**按 schema 设置租户上下文**(FORCE RLS,必须先 `set_config('app.branch_code', …)`,
否则 INSERT 被 `ExecWithCheckOptions` 拒),幂等补齐两条哨兵客户(已存在则不动、不覆盖人工改过的显示名)。
- `tenant_template`:同样尝试补齐,但模板 schema 没有分公司语义(branch_code 为 NULL 会被 RLS 拒)⇒
**兜底不阻断**并 RAISE NOTICE/WARNING,避免整条迁移失败。
## 已验证
本地 `npm --prefix server run migrate` → `Applied 20261054…`;
`tenant_br001/br002` 两行哨兵齐备;模板表在本机受 RLS 限制未写入(迁移已显式告警)。
## 仍待办(开发者已指出)
**后续创建新公司时也要自动带上这两行** —— 模板行受 RLS 限制写不进,需在"建租户流程"里补齐
(下一步查建租户/克隆模板的代码后补)。
|
2026-10-17 09:48:32 +08:00 |
|
Ubuntu
|
fed3ee96fa
|
fix(规格): 修红队打穿的 3 个真缺陷 + 我打红的 13 个既有测试 + 归一化第三批码点
CI / server typecheck + tests (push) Canceled after 0s
CI / web typecheck + tests + miniprogram syntax (push) Canceled after 0s
CI / eslint (观察项,C7 骨架) (push) Canceled after 0s
CI / npm audit (critical 硬拦) (push) Canceled after 0s
独立红队子代理推翻了我上一轮「已完成」的自述,逐条复现后确认属实,本提交全部修复。
## HIGH ①:P4 验收路径实际是死的(路由漏字段)
`/inspection/submit` 与小程序 `/mobile/inspection/.../complete` 都是**逐字段枚举** body,唯独没有 `spec`
⇒ 服务层 `NULLIF(TRIM($12),'')` 恒拿 NULL ⇒ Web/小程序验收建的批次 `inventory.spec` 永远是 NULL。
我上一轮只测了服务层 INSERT 就写「已实测」,是验证方法错误。两条路由现已补 `spec: req.body?.spec`。
## HIGH ②:实扣取错订单行的规格(真扣错批次)
`fifoDeductInventory` 第一条取批次 SQL 按「订单+SKU」取规格且 `LIMIT 1` 无 ORDER BY,按行取规格只是兜底
⇒ 同单同 SKU 两行规格不同时(行1 1箱12瓶 / 行2 1箱24瓶),行2 实扣会拿到行1 的规格、扣错批次。
改为:有 `pickItemId` 时**先走行级**路径;兜底的「订单+SKU」表达式也给 `pickItemId` 让路(COALESCE 按行取)+ 加 ORDER BY。
真跑验证:行1 ⇒ 实扣 ZZ_B12,行2 ⇒ 实扣 ZZ_B24(修复前行2 会扣 ZZ_B12)。
## MEDIUM-HIGH ③:「匹配不到 ⇒ 与改前纯 FIFO 一致」曾经不成立
三段 CASE 把「规格未知」排到「明确不匹配」之前 ⇒ 一个都不命中时会插队、偏离改前 FIFO。
改为**两档**(0 命中 / 1 其余)⇒ 无命中时所有行同级 ⇒ 直接退化为纯 FIFO。
⚠️ 我第一次用窗口函数 `MIN() OVER ()` 修,真跑发现 PG **不允许 `FOR UPDATE` 与窗口函数同用**
(抛 `FOR UPDATE is not allowed with window functions`)⇒ 等于把分拣出库/发车扣库打挂,已改掉并加断言禁止。
验证:无规格 / 无匹配(1箱48瓶) 两种输入顺序完全相同(纯 FIFO:BLEGACY→B24→B12→B12B);1箱12瓶 命中批置顶。
## 踩坑 ④:我打红了 13 个既有测试(改共享服务没跑它的既有测试)
`stockCoverBatchQuery.test.ts` 12 个(P2c 新增 SQL 让假匹配器抛「未预期的 SQL」)+ `stockCoverBatchPlan.test.ts` 1 个
(FIFO 字面量守卫)。已补 mock 规则并把守卫改成更强的两段断言(无规格时唯一实现产物逐字等于改前 FIFO;
两处 loader 必须都调它;不许再把字面量写回)。
现状:stockCoverBatchQuery 17 / stockCoverBatchPlan 12 / inventoryBatchSpecSelection 12 全绿;
出库扣库相关 9 个文件 98 通过。
## 归一化第三批:迁移 20261053
JS `\s` 还含 U+1680 / U+2000–200A / U+2028 / U+2029 / U+202F / U+205F,其中 **U+2007(Excel 数字对齐空格)**
与 U+202F 实测会让「录单认得出、实扣认不出」⇒ 静默退 FIFO。新迁移把这 19 个码点折成空格并逐条守卫;
JS 侧把 U+0130 显式折 `i`(PG `lower('İ')='i'`,JS `toLowerCase()` 是 i+U+0307)。
## 另外修正我自己提交的一处类型错误
`new Map<string, string, Array<...>>` 多写一个类型参数(`tsc` 报 `Expected 2 type arguments, but got 3`)——
上轮「server tsc 干净」是在该编辑之前跑的、之后没复跑就提交了。现已修正:`npx tsc --noEmit` 仅剩既有
`src/prompts/defaults.ts(465)` 一处红(他人面,非本次);web `tsc --noEmit` 0 错。
## 证据与已知红(均已用 stash / 对照证明与本次无关)
- 契约测试 ⑫ 新增:验收路由必须透传 spec + 实扣必须按该行自己的规格
- 既有红:`bidInventoryCover`(5s 超时)、`completedPickingEditable`(`保存修改` 在 HEAD 亦为 0 处)、
web `PickingManagement.outboundPhotoPreview` 3 例 + `SystemConfig.allowZeroCost` 2 例 + `skuCostThirdBucket` 1 例
- 门禁快档 8 通过 / `check-ai-cost` 既有红(不许调绿)
|
2026-10-16 19:48:43 +08:00 |
|
Ubuntu
|
5dfacb794b
|
feat(验收/规格): 验收路径落批次规格 + 修 SQL 与 JS 归一不等价(方案丙 P4 · 第二轮对抗)
CI / server typecheck + tests (push) Canceled after 0s
CI / web typecheck + tests + miniprogram syntax (push) Canceled after 0s
CI / eslint (观察项,C7 骨架) (push) Canceled after 0s
CI / npm audit (critical 硬拦) (push) Canceled after 0s
## P4:验收路径补「本批货的规格」
- server:`InspectionComplianceInput.spec` → `INSERT INTO inventory` 增列 `spec`,
取值 `NULLIF(TRIM($12), '')`、超 60 字截断(列宽 VARCHAR(60))
- web:验收两处提交带 `spec`(`specInput.trim() || undefined`)+ 类型与转发
- 空则不写:**不回填、不凭 SKU 档案反推**(那是造数据,方案丙 §10 决策 1)
## 第二轮对抗实测:3 处 SQL 与 JS 归一不等价(都会静默退 FIFO ⇒ 扣错批次)
| # | 输入 | 改前 SQL | 改前 JS |
|---|---|---|---|
| ① | `1箱X12瓶`(全角乘号) | `1箱x12瓶` | `1箱*12瓶` |
| ② | `1箱␣12瓶`(NBSP U+00A0,Excel/Word 粘贴常见) | NBSP 残留 | 吃掉 |
| ③ | `1箱\uFEFF12瓶`(零宽 BOM) | BOM 残留 | 吃掉 |
根因:① 折半角排到乘号统一**之后**,全角 `X` 折出的 ASCII `x` 再也轮不到 `x→*`;
②③ PG 的 `\s`(`[[:space:]]`)**不含** NBSP/BOM,JS 的 `\s` 含。
修法(`migrations/20261052_norm_spec_fullwidth.sql`):折半角统一折**小写 ASCII** 且排在乘号统一**之前**;
去空白前先把 NBSP/全角空格/BOM 折成普通空格。迁移内 **10 条守卫**(含 3 条反向守卫:
`1kg ≠ 1000g`、`1箱12瓶 ≠ 1箱24瓶`、纯空白→NULL),任一条失败即中断迁移。
## 端到端实测(本地库真实链路:planFifoBatchesForCoveredItems → deductInventoryForOrderDeparture)
| 订单行规格 | 计划批次 | 实扣批次 | 结论 |
|---|---|---|---|
| `1箱12瓶` | ZZ_B12 | **ZZ_B12** | 按客户要求的规格 |
| 空 | ZZ_BLEGACY | ZZ_BLEGACY | 纯 FIFO,与改前一致 |
| `1箱48瓶`(无匹配) | ZZ_BLEGACY | ZZ_BLEGACY | 兜底 FIFO,不阻断 |
| `1箱12瓶`(全角数字) | ZZ_B12 | **ZZ_B12** | 归一化生效 |
| `1箱<NBSP>12瓶` | ZZ_B12 | **ZZ_B12** | 改前会退 FIFO,现已修 |
扣库余额自洽:ZZ_B12 50→47、ZZ_BLEGACY 50→48、ZZ_B24/ZZ_B12B 不动。
## 证据
- 测试:`cd server && npx vitest run tests/inventoryBatchSpecSelection.test.ts` → **9 通过**(6→9,新增 ⑨)
- 类型:web `tsc --noEmit` 0 错;server 仅既有 `src/prompts/defaults.ts(465)` 1 处红(他人面,非本次)
- 门禁:`bash tools/design-consistency/run-all.sh --verify` → 8 通过 / `check-ai-cost` 既有红(不许调绿)/
`verify-facts` 既有红(断言查 `tenant_br003.suppliers`,本地只建了 br001/br002,与本改动无关,
且本次未碰 `tools/` 与其余文档)
|
2026-10-16 19:08:01 +08:00 |
|
Ubuntu
|
230edd9c58
|
feat(抵扣): 批次级规格 + 抵扣按客户要求的规格选批次(方案丙 P1+P2a/P2b,B 核心)
CI / server typecheck + tests (push) Canceled after 0s
CI / web typecheck + tests + miniprogram syntax (push) Canceled after 0s
CI / eslint (观察项,C7 骨架) (push) Canceled after 0s
CI / npm audit (critical 硬拦) (push) Canceled after 0s
开发者「开工 晚点我来验收」。本次落地「批次规格」这条数据链 + **真实出库/扣库**按规格选批次。
P1a 迁移 `20261051_inventory_batch_spec.sql`:各 schema 加 `inventory.spec VARCHAR(60)` +
`public.norm_spec(text)`(IMMUTABLE,**全系统唯一一份 SQL 归一实现**,与前端 normalizeSpecForMatch
同口径:去空白/小写/乘号 ×✕✖x→*/全角括号斜杠折半角/空串→NULL)+ **不做存量回填**(回填假设在
混过规格的 SKU 上最不可靠=造数据)+ 响亮守卫。已跑并实测:三 schema 列就位、函数口径正确。
P1b 批次规格写入(库存/独立入库):`StockImportRowInput.spec` → INSERT 列 + `$10`;
`ON CONFLICT` 用 `spec = COALESCE(NULLIF(TRIM(EXCLUDED.spec),''), inventory.spec)`
—— 同一批次累加时**不会把已有规格抹掉**;`BatchInboundRowInput.spec` 透传;前端提交行带
`spec: line.spec.trim() || undefined`(识别值或人工值,空则不传 ⇒ NULL)。
P2a 共用排序 `inventoryBatchSelection.batchSelectionOrderBy()`:
命中(0) → 无比对依据(1) → 不匹配(2),**末尾仍是 `created_at ASC, expiry_date ASC NULLS FIRST`**;
订单没规格时**逐字等于改前**(纯 FIFO,零行为变化)。
P2b 接入**真实出库/扣库**(inventoryOutboundService 两条取批次路径):
- 分拣行路径 `LEFT JOIN order_items oi ON oi.id = pi.order_item_id` 用 `oi.spec`;
- 无 pickItemId 时按「订单+SKU」子查询取规格(`orderCode` 已有,无需改调用方);
- SELECT 带上 `inv.spec` 便于提示/追溯;**旧 ORDER BY 写法已全部替换**(契约测试禁止残留)。
真实数据验证(本地库,事务内 + ROLLBACK,零残留):同 SKU 造 A=1箱24瓶(先入库, 2.00)与
B=1箱12瓶(后入库, 2.50)⇒ 订单写 `1箱12瓶` 选 **B**、写 `1箱24瓶` 选 **A**、**没写规格与改前
逐字一致(A→B)**、写 `1箱48瓶`(无匹配)退化为 FIFO 且不阻断。
未动(按设计):FIFO 兜底顺序、FOR UPDATE、"库存不足先部分扣减再抛错"、softInventory 不硬拦、
预留(reservation 仍按 SKU)、批次表以外任何结构。
**未完成(下一步,见设计文档 §11)**:P2c 抵扣建议/门槛/计划三处(stockCoverBatchQueryService、
stockCoverBatchPlanService、inventoryStockCoverService)接入同一排序 —— 不接会出现"建议按规格、
实扣按 FIFO"的口径漂移;P3 两处提示;P4 验收路径落 spec。
证据:迁移已跑 + 实测列/函数;`server/tests/inventoryBatchSpecSelection.test.ts` **6 通过**;
真实数据排序验证如上;`tsc` 前端 exit 0、后端本次面零错误;设计门禁 8 通过/1 红/1 未执行 与基线一致;
设计文档新增 §11 实施进度。生产未部署(等命令)。
|
2026-10-16 18:37:35 +08:00 |
|