feat: 重构BOM架构,新增基础设置与虚拟工位管理功能

本次重构删除原有BOM物料清单表,改用工单工艺组合×工艺物料清单作为唯一用料来源;新增系统基础设置表支持WMS地址、日志保留天数等配置,新增虚拟工位作业管理后台接口与前端页签控制功能,同时优化工位号校验逻辑、事件日志自动清理与工单用料查询能力。
This commit is contained in:
SunYF
2026-09-23 11:41:28 +08:00
parent d3eda6b588
commit f274da044c
74 changed files with 3637 additions and 5586 deletions
+18 -39
View File
@@ -147,41 +147,6 @@ var (
},
},
}
// WorkOrderBomColumns holds the columns for the "work_order_bom" table.
WorkOrderBomColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "product_code", Type: field.TypeString, Size: 64, Default: ""},
{Name: "bom_name", Type: field.TypeString, Size: 64, Default: "默认"},
{Name: "material_code", Type: field.TypeString, Size: 64},
{Name: "material_name", Type: field.TypeString, Size: 128, Default: ""},
{Name: "spec", Type: field.TypeString, Size: 128, Default: ""},
{Name: "unit", Type: field.TypeString, Size: 16, Default: ""},
{Name: "manage_mode", Type: field.TypeString, Size: 10, Default: "2"},
{Name: "unit_qty", Type: field.TypeFloat64, Default: 0},
{Name: "loss_rate", Type: field.TypeFloat64, Default: 0},
{Name: "related_standard", Type: field.TypeString, Size: 255, Default: ""},
{Name: "required_qty", Type: field.TypeFloat64, Default: 0},
{Name: "serial_sns", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}},
{Name: "created_at", Type: field.TypeTime},
}
// WorkOrderBomTable holds the schema information for the "work_order_bom" table.
WorkOrderBomTable = &schema.Table{
Name: "work_order_bom",
Columns: WorkOrderBomColumns,
PrimaryKey: []*schema.Column{WorkOrderBomColumns[0]},
Indexes: []*schema.Index{
{
Name: "bomitem_product_code",
Unique: false,
Columns: []*schema.Column{WorkOrderBomColumns[1]},
},
{
Name: "bomitem_product_code_bom_name_material_code",
Unique: true,
Columns: []*schema.Column{WorkOrderBomColumns[1], WorkOrderBomColumns[2], WorkOrderBomColumns[3]},
},
},
}
// DailyPlanColumns holds the columns for the "daily_plan" table.
DailyPlanColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
@@ -721,6 +686,7 @@ var (
{Name: "is_builtin", Type: field.TypeBool, Default: false},
{Name: "has_dock", Type: field.TypeBool, Default: false},
{Name: "dock_code", Type: field.TypeString, Size: 20, Default: ""},
{Name: "visible_tabs", Type: field.TypeJSON, Nullable: true},
{Name: "created_at", Type: field.TypeTime},
}
// StationTable holds the schema information for the "station" table.
@@ -824,6 +790,19 @@ var (
},
},
}
// SysConfigColumns holds the columns for the "sys_config" table.
SysConfigColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "key", Type: field.TypeString, Unique: true, Size: 64},
{Name: "value", Type: field.TypeString, Size: 512},
{Name: "remark", Type: field.TypeString, Nullable: true, Size: 255},
}
// SysConfigTable holds the schema information for the "sys_config" table.
SysConfigTable = &schema.Table{
Name: "sys_config",
Columns: SysConfigColumns,
PrimaryKey: []*schema.Column{SysConfigColumns[0]},
}
// TorqueAuditLogColumns holds the columns for the "torque_audit_log" table.
TorqueAuditLogColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
@@ -1150,7 +1129,6 @@ var (
AlertRuleTable,
AssociationTraceTable,
AttachmentTable,
WorkOrderBomTable,
DailyPlanTable,
DockTable,
EventLogTable,
@@ -1170,6 +1148,7 @@ var (
StationStateTable,
StepCriterionTable,
StepDataTable,
SysConfigTable,
TorqueAuditLogTable,
TorqueRecordTable,
UserTable,
@@ -1194,9 +1173,6 @@ func init() {
AttachmentTable.Annotation = &entsql.Annotation{
Table: "attachment",
}
WorkOrderBomTable.Annotation = &entsql.Annotation{
Table: "work_order_bom",
}
DailyPlanTable.Annotation = &entsql.Annotation{
Table: "daily_plan",
}
@@ -1254,6 +1230,9 @@ func init() {
StepDataTable.Annotation = &entsql.Annotation{
Table: "step_data",
}
SysConfigTable.Annotation = &entsql.Annotation{
Table: "sys_config",
}
TorqueAuditLogTable.Annotation = &entsql.Annotation{
Table: "torque_audit_log",
}