feat: 新增工件生命周期状态流水表及工单状态流转逻辑
新增工件生命周期状态流水表,记录所有工件状态变更动作,替代原半成品质检计数源 调整工单状态流转,将「下发工单」与「开始执行」合并为「下发并开工」,自动启用关联排产 新增工件物理位置字段,区分业务位置与实际物理工位,解决工位对账滞后问题 统一物料类别处理,避免 WMS 同步时覆盖合法值或错误设置为 0 移除已废弃的返修状态,更新相关显示与逻辑
This commit is contained in:
@@ -1097,8 +1097,9 @@ var (
|
||||
{Name: "sn", Type: field.TypeString, Unique: true, Size: 64, Comment: "工件唯一SN"},
|
||||
{Name: "order_no", Type: field.TypeString, Size: 64, Comment: "所属工单", Default: ""},
|
||||
{Name: "work_order_id", Type: field.TypeInt, Nullable: true, Comment: "工单ID"},
|
||||
{Name: "current_station_no", Type: field.TypeInt, Nullable: true, Comment: "最后完成报工的工位号(0=未报任何工艺;下一道=工艺组合中工位号更大的下一条)"},
|
||||
{Name: "status", Type: field.TypeString, Size: 20, Default: "ONLINE"},
|
||||
{Name: "current_station_no", Type: field.TypeInt, Nullable: true, Comment: "业务位置:最后完成报工的工位号(0=未报任何工艺;下一道=工艺组合中工位号更大的下一条)"},
|
||||
{Name: "at_station_no", Type: field.TypeInt, Nullable: true, Comment: "物理位置:工件当前实际所在工位号(0=未在工位;建档/到达即写,完工/入库清空)"},
|
||||
{Name: "status", Type: field.TypeString, Size: 20, Default: "NEW"},
|
||||
{Name: "online_at", Type: field.TypeTime, Nullable: true, Comment: "进线时间"},
|
||||
{Name: "done_at", Type: field.TypeTime, Nullable: true, Comment: "完工时间"},
|
||||
{Name: "created_at", Type: field.TypeTime},
|
||||
@@ -1124,7 +1125,7 @@ var (
|
||||
{
|
||||
Name: "workpiece_status",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{WorkpieceColumns[5]},
|
||||
Columns: []*schema.Column{WorkpieceColumns[6]},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -1179,6 +1180,45 @@ var (
|
||||
},
|
||||
},
|
||||
}
|
||||
// WorkpieceLifecycleLogColumns holds the columns for the "workpiece_lifecycle_log" table.
|
||||
WorkpieceLifecycleLogColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||||
{Name: "sn", Type: field.TypeString, Size: 64, Comment: "工件SN"},
|
||||
{Name: "work_order_no", Type: field.TypeString, Size: 64, Comment: "所属工单", Default: ""},
|
||||
{Name: "action", Type: field.TypeString, Size: 20, Comment: "状态动作:NEW/ONLINE/REPORT/SEMI_IN/SEMI_OUT/DONE/SCRAPPED"},
|
||||
{Name: "from_status", Type: field.TypeString, Size: 20, Comment: "变更前状态", Default: ""},
|
||||
{Name: "to_status", Type: field.TypeString, Size: 20, Comment: "变更后状态", Default: ""},
|
||||
{Name: "station_no", Type: field.TypeInt, Nullable: true, Comment: "关联工位号"},
|
||||
{Name: "flow_seq", Type: field.TypeInt, Nullable: true, Comment: "工艺序号(工序顺序)"},
|
||||
{Name: "operator", Type: field.TypeString, Size: 64, Comment: "操作人", Default: ""},
|
||||
{Name: "source", Type: field.TypeString, Size: 32, Comment: "来源:workstation/mes/admin/reconcile", Default: ""},
|
||||
{Name: "remark", Type: field.TypeString, Size: 255, Comment: "备注", Default: ""},
|
||||
{Name: "created_at", Type: field.TypeTime},
|
||||
}
|
||||
// WorkpieceLifecycleLogTable holds the schema information for the "workpiece_lifecycle_log" table.
|
||||
WorkpieceLifecycleLogTable = &schema.Table{
|
||||
Name: "workpiece_lifecycle_log",
|
||||
Comment: "工件生命周期状态流水:NEW/ONLINE/REPORT/SEMI_IN/SEMI_OUT/DONE/SCRAPPED,所有状态变更点同事务写",
|
||||
Columns: WorkpieceLifecycleLogColumns,
|
||||
PrimaryKey: []*schema.Column{WorkpieceLifecycleLogColumns[0]},
|
||||
Indexes: []*schema.Index{
|
||||
{
|
||||
Name: "workpiecelifecyclelog_sn_created_at",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{WorkpieceLifecycleLogColumns[1], WorkpieceLifecycleLogColumns[11]},
|
||||
},
|
||||
{
|
||||
Name: "workpiecelifecyclelog_work_order_no_created_at",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{WorkpieceLifecycleLogColumns[2], WorkpieceLifecycleLogColumns[11]},
|
||||
},
|
||||
{
|
||||
Name: "workpiecelifecyclelog_action_created_at",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{WorkpieceLifecycleLogColumns[3], WorkpieceLifecycleLogColumns[11]},
|
||||
},
|
||||
},
|
||||
}
|
||||
// WorkpieceProcessColumns holds the columns for the "workpiece_process" table.
|
||||
WorkpieceProcessColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||||
@@ -1266,6 +1306,7 @@ var (
|
||||
WorkOrderTable,
|
||||
WorkpieceTable,
|
||||
WorkpieceBindTable,
|
||||
WorkpieceLifecycleLogTable,
|
||||
WorkpieceProcessTable,
|
||||
}
|
||||
)
|
||||
@@ -1370,6 +1411,9 @@ func init() {
|
||||
WorkpieceBindTable.Annotation = &entsql.Annotation{
|
||||
Table: "workpiece_bind",
|
||||
}
|
||||
WorkpieceLifecycleLogTable.Annotation = &entsql.Annotation{
|
||||
Table: "workpiece_lifecycle_log",
|
||||
}
|
||||
WorkpieceProcessTable.Annotation = &entsql.Annotation{
|
||||
Table: "workpiece_process",
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user