feat(production): 修改订单加工位置不一致问题

-创建订单时解除所有占用
-修改数据库位置唯一约束
-严格按照订单起始位置分配
-订单启动时重新初始化位置
This commit is contained in:
lidg
2026-11-09 15:04:11 +08:00
parent 0ed952f917
commit 47627b07f0
13 changed files with 511 additions and 102 deletions
+1 -5
View File
@@ -56,10 +56,6 @@ create table if not exists workpieces (
updated_at timestamp not null default now()
);
create unique index if not exists ux_workpieces_tray_position
on workpieces(tray_id, tray_pos)
where tray_id is not null and tray_pos > 0;
create table if not exists tray_slots (
id bigserial primary key,
tray_id bigint not null references trays(id) on delete cascade,
@@ -119,7 +115,7 @@ create table if not exists schema_version (
);
insert into schema_version (id, version, description)
values (1, 10, 'Support reverse flip production checkpoints')
values (1, 11, 'Allow historical workpieces to reuse tray positions')
on conflict (id) do update
set version = excluded.version,
description = excluded.description,