refactor: 重构工艺工序相关命名与数据模型
1. 全局替换"工序"为"工艺"统一术语,包括页面文案、枚举、注释
2. 重构工单与工件工艺数据模型:
- 新增工艺组合表flow_material作为备料/齐套唯一源头
- 新增工位状态表station_state支持自主停单/恢复接单
- 移除station_process派工表,改用工单工艺组合作为路线唯一源头
- 替换processCode为flowId作为工艺关联标识
- 重构工件当前进度字段为currentStationNo
3. 删除冗余的静态备份资源文件
4. 调整物料选择组件默认启用仅显示激活物料
5. 优化工单创建/编辑逻辑,新增工艺组合校验与保存
This commit is contained in:
@@ -157,7 +157,6 @@ var (
|
||||
{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: "process_code", Type: field.TypeInt, Default: 0},
|
||||
{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: ""},
|
||||
@@ -289,6 +288,37 @@ var (
|
||||
},
|
||||
},
|
||||
}
|
||||
// FlowMaterialColumns holds the columns for the "flow_material" table.
|
||||
FlowMaterialColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||||
{Name: "flow_id", Type: field.TypeInt},
|
||||
{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: "created_at", Type: field.TypeTime},
|
||||
}
|
||||
// FlowMaterialTable holds the schema information for the "flow_material" table.
|
||||
FlowMaterialTable = &schema.Table{
|
||||
Name: "flow_material",
|
||||
Columns: FlowMaterialColumns,
|
||||
PrimaryKey: []*schema.Column{FlowMaterialColumns[0]},
|
||||
Indexes: []*schema.Index{
|
||||
{
|
||||
Name: "flowmaterial_flow_id",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{FlowMaterialColumns[1]},
|
||||
},
|
||||
{
|
||||
Name: "flowmaterial_flow_id_material_code",
|
||||
Unique: true,
|
||||
Columns: []*schema.Column{FlowMaterialColumns[1], FlowMaterialColumns[2]},
|
||||
},
|
||||
},
|
||||
}
|
||||
// InspectionRecordColumns holds the columns for the "inspection_record" table.
|
||||
InspectionRecordColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||||
@@ -434,7 +464,7 @@ var (
|
||||
{Name: "status", Type: field.TypeString, Size: 20, Default: "PENDING"},
|
||||
{Name: "target_dock", Type: field.TypeString, Size: 20, Default: ""},
|
||||
{Name: "station_no", Type: field.TypeInt, Default: 0},
|
||||
{Name: "process_code", Type: field.TypeInt, Default: 0},
|
||||
{Name: "flow_id", Type: field.TypeInt, Default: 0},
|
||||
{Name: "sent_qty", Type: field.TypeFloat64, Default: 0},
|
||||
{Name: "received_qty", Type: field.TypeFloat64, Default: 0},
|
||||
{Name: "received_at", Type: field.TypeInt64, Default: 0},
|
||||
@@ -705,41 +735,27 @@ var (
|
||||
},
|
||||
},
|
||||
}
|
||||
// StationProcessColumns holds the columns for the "station_process" table.
|
||||
StationProcessColumns = []*schema.Column{
|
||||
// StationStateColumns holds the columns for the "station_state" table.
|
||||
StationStateColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||||
{Name: "station_no", Type: field.TypeInt},
|
||||
{Name: "process_code", Type: field.TypeInt},
|
||||
{Name: "effect_date", Type: field.TypeString, Size: 10, Default: ""},
|
||||
{Name: "shift", Type: field.TypeString, Size: 20, Default: ""},
|
||||
{Name: "date", Type: field.TypeString, Size: 10},
|
||||
{Name: "paused", Type: field.TypeBool, Default: false},
|
||||
{Name: "reason", Type: field.TypeString, Size: 255, Default: ""},
|
||||
{Name: "operator", Type: field.TypeString, Size: 64, Default: ""},
|
||||
{Name: "created_at", Type: field.TypeTime},
|
||||
{Name: "updated_at", Type: field.TypeTime, Nullable: true},
|
||||
}
|
||||
// StationProcessTable holds the schema information for the "station_process" table.
|
||||
StationProcessTable = &schema.Table{
|
||||
Name: "station_process",
|
||||
Columns: StationProcessColumns,
|
||||
PrimaryKey: []*schema.Column{StationProcessColumns[0]},
|
||||
// StationStateTable holds the schema information for the "station_state" table.
|
||||
StationStateTable = &schema.Table{
|
||||
Name: "station_state",
|
||||
Columns: StationStateColumns,
|
||||
PrimaryKey: []*schema.Column{StationStateColumns[0]},
|
||||
Indexes: []*schema.Index{
|
||||
{
|
||||
Name: "stationprocess_station_no",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{StationProcessColumns[1]},
|
||||
},
|
||||
{
|
||||
Name: "stationprocess_effect_date",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{StationProcessColumns[3]},
|
||||
},
|
||||
{
|
||||
Name: "stationprocess_station_no_effect_date",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{StationProcessColumns[1], StationProcessColumns[3]},
|
||||
},
|
||||
{
|
||||
Name: "stationprocess_station_no_effect_date_shift",
|
||||
Name: "stationstate_station_no_date",
|
||||
Unique: true,
|
||||
Columns: []*schema.Column{StationProcessColumns[1], StationProcessColumns[3], StationProcessColumns[4]},
|
||||
Columns: []*schema.Column{StationStateColumns[1], StationStateColumns[2]},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -959,6 +975,7 @@ var (
|
||||
{Name: "product_serial", Type: field.TypeString, Size: 64, Default: ""},
|
||||
{Name: "created_by", Type: field.TypeString, Size: 64, Default: ""},
|
||||
{Name: "due_date", Type: field.TypeTime, Nullable: true},
|
||||
{Name: "flow_combination", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}},
|
||||
{Name: "status", Type: field.TypeString, Size: 20, Default: "CREATED"},
|
||||
{Name: "plan_start", Type: field.TypeTime, Nullable: true},
|
||||
{Name: "plan_end", Type: field.TypeTime, Nullable: true},
|
||||
@@ -981,7 +998,7 @@ var (
|
||||
{
|
||||
Name: "workorder_status",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{WorkOrderColumns[13]},
|
||||
Columns: []*schema.Column{WorkOrderColumns[14]},
|
||||
},
|
||||
{
|
||||
Name: "workorder_product_type_id",
|
||||
@@ -996,7 +1013,7 @@ var (
|
||||
{Name: "sn", Type: field.TypeString, Unique: true, Size: 64},
|
||||
{Name: "order_no", Type: field.TypeString, Size: 64, Default: ""},
|
||||
{Name: "work_order_id", Type: field.TypeInt, Nullable: true},
|
||||
{Name: "current_process", Type: field.TypeInt, Nullable: true},
|
||||
{Name: "current_station_no", Type: field.TypeInt, Nullable: true},
|
||||
{Name: "status", Type: field.TypeString, Size: 20, Default: "ONLINE"},
|
||||
{Name: "online_at", Type: field.TypeTime, Nullable: true},
|
||||
{Name: "done_at", Type: field.TypeTime, Nullable: true},
|
||||
@@ -1031,7 +1048,7 @@ var (
|
||||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||||
{Name: "sn", Type: field.TypeString, Size: 64},
|
||||
{Name: "order_no", Type: field.TypeString, Size: 64, Default: ""},
|
||||
{Name: "process_code", Type: field.TypeInt},
|
||||
{Name: "flow_id", Type: field.TypeInt},
|
||||
{Name: "station_no", Type: field.TypeString, Size: 32, Default: ""},
|
||||
{Name: "material_code", Type: field.TypeString, Size: 64},
|
||||
{Name: "material_name", Type: field.TypeString, Size: 128, Default: ""},
|
||||
@@ -1055,7 +1072,7 @@ var (
|
||||
Columns: []*schema.Column{WorkpieceBindColumns[1]},
|
||||
},
|
||||
{
|
||||
Name: "workpiecebind_sn_process_code",
|
||||
Name: "workpiecebind_sn_flow_id",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{WorkpieceBindColumns[1], WorkpieceBindColumns[3]},
|
||||
},
|
||||
@@ -1080,7 +1097,7 @@ var (
|
||||
WorkpieceProcessColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||||
{Name: "sn", Type: field.TypeString, Size: 64},
|
||||
{Name: "process_code", Type: field.TypeInt},
|
||||
{Name: "flow_id", Type: field.TypeInt},
|
||||
{Name: "station_no", Type: field.TypeString, Size: 32, Default: ""},
|
||||
{Name: "order_no", Type: field.TypeString, Size: 64, Default: ""},
|
||||
{Name: "process_name", Type: field.TypeString, Size: 64, Default: ""},
|
||||
@@ -1105,10 +1122,15 @@ var (
|
||||
Columns: []*schema.Column{WorkpieceProcessColumns[1]},
|
||||
},
|
||||
{
|
||||
Name: "workpieceprocess_sn_process_code",
|
||||
Name: "workpieceprocess_sn_flow_id",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{WorkpieceProcessColumns[1], WorkpieceProcessColumns[2]},
|
||||
},
|
||||
{
|
||||
Name: "workpieceprocess_sn_station_no",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{WorkpieceProcessColumns[1], WorkpieceProcessColumns[3]},
|
||||
},
|
||||
{
|
||||
Name: "workpieceprocess_order_no",
|
||||
Unique: false,
|
||||
@@ -1131,6 +1153,7 @@ var (
|
||||
DailyPlanTable,
|
||||
DockTable,
|
||||
EventLogTable,
|
||||
FlowMaterialTable,
|
||||
InspectionRecordTable,
|
||||
LinePointTable,
|
||||
MaterialQtyReportTable,
|
||||
@@ -1143,7 +1166,7 @@ var (
|
||||
RoleTable,
|
||||
SemiFlowTable,
|
||||
StationTable,
|
||||
StationProcessTable,
|
||||
StationStateTable,
|
||||
StepCriterionTable,
|
||||
StepDataTable,
|
||||
TorqueAuditLogTable,
|
||||
@@ -1182,6 +1205,9 @@ func init() {
|
||||
EventLogTable.Annotation = &entsql.Annotation{
|
||||
Table: "event_log",
|
||||
}
|
||||
FlowMaterialTable.Annotation = &entsql.Annotation{
|
||||
Table: "flow_material",
|
||||
}
|
||||
InspectionRecordTable.Annotation = &entsql.Annotation{
|
||||
Table: "inspection_record",
|
||||
}
|
||||
@@ -1218,8 +1244,8 @@ func init() {
|
||||
StationTable.Annotation = &entsql.Annotation{
|
||||
Table: "station",
|
||||
}
|
||||
StationProcessTable.Annotation = &entsql.Annotation{
|
||||
Table: "station_process",
|
||||
StationStateTable.Annotation = &entsql.Annotation{
|
||||
Table: "station_state",
|
||||
}
|
||||
StepCriterionTable.Annotation = &entsql.Annotation{
|
||||
Table: "step_criterion",
|
||||
|
||||
Reference in New Issue
Block a user