refactor: 重构工艺工序相关命名与数据模型
1. 全局替换"工序"为"工艺"统一术语,包括页面文案、枚举、注释
2. 重构工单与工件工艺数据模型:
- 新增工艺组合表flow_material作为备料/齐套唯一源头
- 新增工位状态表station_state支持自主停单/恢复接单
- 移除station_process派工表,改用工单工艺组合作为路线唯一源头
- 替换processCode为flowId作为工艺关联标识
- 重构工件当前进度字段为currentStationNo
3. 删除冗余的静态备份资源文件
4. 调整物料选择组件默认启用仅显示激活物料
5. 优化工单创建/编辑逻辑,新增工艺组合校验与保存
This commit is contained in:
@@ -41,29 +41,31 @@ func main() {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// 迁移结果自检:新表存在 + 旧表新列存在
|
||||
var tableExists bool
|
||||
// 迁移结果自检:新表存在 + 旧表/旧列已清理
|
||||
var flowMatExists, stationStateExists, workpieceBindExists bool
|
||||
if err := sqlDB.QueryRowContext(context.Background(),
|
||||
`SELECT EXISTS(SELECT 1 FROM information_schema.tables WHERE table_schema='public' AND table_name='workpiece_bind')`,
|
||||
).Scan(&tableExists); err != nil {
|
||||
`SELECT EXISTS(SELECT 1 FROM information_schema.tables WHERE table_schema='public' AND table_name='flow_material'),
|
||||
EXISTS(SELECT 1 FROM information_schema.tables WHERE table_schema='public' AND table_name='station_state'),
|
||||
EXISTS(SELECT 1 FROM information_schema.tables WHERE table_schema='public' AND table_name='workpiece_bind')`,
|
||||
).Scan(&flowMatExists, &stationStateExists, &workpieceBindExists); err != nil {
|
||||
fmt.Println("VERIFY_FAIL:", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
var colExists bool
|
||||
var combinationCol, stationNoCol bool
|
||||
var stationProcessLeft, processCodeLeft bool
|
||||
if err := sqlDB.QueryRowContext(context.Background(),
|
||||
`SELECT EXISTS(SELECT 1 FROM information_schema.columns WHERE table_schema='public' AND table_name='work_order_bom' AND column_name='process_code')`,
|
||||
).Scan(&colExists); err != nil {
|
||||
`SELECT EXISTS(SELECT 1 FROM information_schema.columns WHERE table_schema='public' AND table_name='work_order' AND column_name='flow_combination'),
|
||||
EXISTS(SELECT 1 FROM information_schema.columns WHERE table_schema='public' AND table_name='workpiece' AND column_name='current_station_no'),
|
||||
EXISTS(SELECT 1 FROM information_schema.tables WHERE table_schema='public' AND table_name='station_process'),
|
||||
EXISTS(SELECT 1 FROM information_schema.columns WHERE table_schema='public' AND table_name='work_order_bom' AND column_name='process_code')`,
|
||||
).Scan(&combinationCol, &stationNoCol, &stationProcessLeft, &processCodeLeft); err != nil {
|
||||
fmt.Println("VERIFY_FAIL:", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
var bindCols int
|
||||
_ = sqlDB.QueryRowContext(context.Background(),
|
||||
`SELECT COUNT(*) FROM information_schema.columns WHERE table_schema='public' AND table_name='workpiece_bind'`,
|
||||
).Scan(&bindCols)
|
||||
|
||||
fmt.Printf("MIGRATE_OK workpiece_bind_table=%v bom_item.process_code=%v workpiece_bind_cols=%d\n",
|
||||
tableExists, colExists, bindCols)
|
||||
if !tableExists || !colExists {
|
||||
fmt.Printf("MIGRATE_OK flow_material=%v station_state=%v workpiece_bind=%v work_order.flow_combination=%v workpiece.current_station_no=%v station_process_dropped=%v bom.process_code_dropped=%v\n",
|
||||
flowMatExists, stationStateExists, workpieceBindExists, combinationCol, stationNoCol, !stationProcessLeft, !processCodeLeft)
|
||||
if !flowMatExists || !stationStateExists || !workpieceBindExists || !combinationCol || !stationNoCol || stationProcessLeft || processCodeLeft {
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user