feat: 核心业务实体扩充(混产模板/产品BOM/试制记录)、WMS 库存检验增强与前端通用能力

- MES 新增实体:混产模板、产品BOM、产品工艺物料、试制记录(schema + ent 生成码 + logic/handler/前端页)
- WMS 实体增强:检验记录、库存、半成品重构;新增序列号库存与短缺代报
- AGV 与产能:AGV 手动点位与链路、物料守卫、短缺预测、原因字典
- 前端通用能力:新增下一步引导组件 NextStepBar,统一帮助文档/布局/请求拦截与操作列
- 工位终端:界面与各 handler 调整(api/store/绑定/PLC/拧紧/上报等)
- 配置与文档:更新 mes-api.yaml、WMS README 及案例/产线API/问题记录/项目说明/流程说明
This commit is contained in:
SunYF
2026-11-15 12:17:39 +08:00
parent 7e8066ab66
commit 1e92b2a596
221 changed files with 26421 additions and 2230 deletions
+118 -2
View File
@@ -621,7 +621,7 @@ var (
{Name: "spec", Type: field.TypeString, Size: 128, Comment: "规格型号", Default: ""},
{Name: "unit", Type: field.TypeString, Size: 32, Comment: "计量单位", Default: ""},
{Name: "description", Type: field.TypeString, Size: 255, Comment: "说明", Default: ""},
{Name: "item_type", Type: field.TypeInt, Comment: "物料类别 1原材料/3成品(半成品不是物料类别,「其他」已移除)", Default: 1},
{Name: "item_type", Type: field.TypeInt, Comment: "物料类别 1原材料/3成品(在制品不是物料类别,「其他」已移除)", Default: 1},
{Name: "manage_mode", Type: field.TypeInt, Comment: "类型 1结构件/2电气件/3其他(仅分类,不决定SN行为)", Default: 1},
{Name: "sn_mode", Type: field.TypeInt, Comment: "是否逐件SN管理 0未选择(必填)/1序列号=是(录SN)/2序列号=否(不录SN)", Default: 0},
{Name: "template_code", Type: field.TypeString, Size: 64, Comment: "模板编码", Default: ""},
@@ -773,6 +773,29 @@ var (
},
},
}
// MixProductionTemplateColumns holds the columns for the "mix_production_template" table.
MixProductionTemplateColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "name", Type: field.TypeString, Size: 128, Comment: "模板名称"},
{Name: "product_codes", Type: field.TypeString, Size: 2147483647, Comment: "可混产成品编码集合(逗号分隔)", Default: ""},
{Name: "remark", Type: field.TypeString, Size: 255, Default: ""},
{Name: "status", Type: field.TypeString, Size: 16, Comment: "ACTIVE/INACTIVE", Default: "ACTIVE"},
{Name: "created_at", Type: field.TypeTime},
}
// MixProductionTemplateTable holds the schema information for the "mix_production_template" table.
MixProductionTemplateTable = &schema.Table{
Name: "mix_production_template",
Comment: "MixProductionTemplate 混产模板:可混线生产的成品集合。",
Columns: MixProductionTemplateColumns,
PrimaryKey: []*schema.Column{MixProductionTemplateColumns[0]},
Indexes: []*schema.Index{
{
Name: "mixproductiontemplate_name",
Unique: true,
Columns: []*schema.Column{MixProductionTemplateColumns[1]},
},
},
}
// PermissionColumns holds the columns for the "permission" table.
PermissionColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
@@ -894,6 +917,38 @@ var (
},
},
}
// ProductBomColumns holds the columns for the "product_bom" table.
ProductBomColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "product_code", Type: field.TypeString, Size: 64, Comment: "成品编码(成品档案 code,即图号唯一码)"},
{Name: "material_code", Type: field.TypeString, Size: 64, Comment: "物料编码"},
{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: "unit_qty", Type: field.TypeFloat64, Comment: "单台用量(总账量,必须等于各工序分账量之和)", Default: 0},
{Name: "loss_rate", Type: field.TypeFloat64, Comment: "损耗率%(展示口径,不参与备料计算)", Default: 0},
{Name: "remark", Type: field.TypeString, Size: 255, Default: ""},
{Name: "created_at", Type: field.TypeTime},
}
// ProductBomTable holds the schema information for the "product_bom" table.
ProductBomTable = &schema.Table{
Name: "product_bom",
Comment: "ProductBOM 成品BOM总账:某成品整机需要的物料及单台用量(总分制的总账)。",
Columns: ProductBomColumns,
PrimaryKey: []*schema.Column{ProductBomColumns[0]},
Indexes: []*schema.Index{
{
Name: "productbom_product_code",
Unique: false,
Columns: []*schema.Column{ProductBomColumns[1]},
},
{
Name: "productbom_product_code_material_code",
Unique: true,
Columns: []*schema.Column{ProductBomColumns[1], ProductBomColumns[2]},
},
},
}
// ProductProcessColumns holds the columns for the "product_process" table.
ProductProcessColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
@@ -945,6 +1000,37 @@ var (
},
},
}
// ProductProcessMaterialColumns holds the columns for the "product_process_material" table.
ProductProcessMaterialColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "product_process_id", Type: field.TypeInt, Comment: "所属产品工艺ID(不是 flowId!分账按产品隔离)"},
{Name: "seq", Type: field.TypeInt, Comment: "工序顺序,与 product_process_item.seq 对齐", Default: 0},
{Name: "flow_id", Type: field.TypeInt, Comment: "分配到的基础工艺(工序)ID"},
{Name: "material_code", Type: field.TypeString, Size: 64, Comment: "物料编码(必须存在于该成品总账)"},
{Name: "material_name", Type: field.TypeString, Size: 128, Default: ""},
{Name: "unit", Type: field.TypeString, Size: 16, Default: ""},
{Name: "unit_qty", Type: field.TypeFloat64, Comment: "该工序分配到的单台用量", Default: 0},
{Name: "created_at", Type: field.TypeTime},
}
// ProductProcessMaterialTable holds the schema information for the "product_process_material" table.
ProductProcessMaterialTable = &schema.Table{
Name: "product_process_material",
Comment: "ProductProcessMaterial 分账:产品工艺把成品BOM总账物料分配到各工序。",
Columns: ProductProcessMaterialColumns,
PrimaryKey: []*schema.Column{ProductProcessMaterialColumns[0]},
Indexes: []*schema.Index{
{
Name: "productprocessmaterial_product_process_id",
Unique: false,
Columns: []*schema.Column{ProductProcessMaterialColumns[1]},
},
{
Name: "productprocessmaterial_product_process_id_flow_id_material_code",
Unique: true,
Columns: []*schema.Column{ProductProcessMaterialColumns[1], ProductProcessMaterialColumns[3], ProductProcessMaterialColumns[4]},
},
},
}
// RoleColumns holds the columns for the "role" table.
RoleColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
@@ -984,7 +1070,7 @@ var (
// SemiFlowTable holds the schema information for the "semi_flow" table.
SemiFlowTable = &schema.Table{
Name: "semi_flow",
Comment: "SemiFlow 半成品流转记录:进度快照(完成至工位N),调用 WMS /api/internal/semi/*",
Comment: "SemiFlow 在制品流转记录:进度快照(完成至工位N),调用 WMS /api/internal/semi/*",
Columns: SemiFlowColumns,
PrimaryKey: []*schema.Column{SemiFlowColumns[0]},
Indexes: []*schema.Index{
@@ -1328,6 +1414,23 @@ var (
},
},
}
// TrialRecordsColumns holds the columns for the "trial_records" table.
TrialRecordsColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "sn", Type: field.TypeString, Size: 64},
{Name: "material_code", Type: field.TypeString, Size: 64, Default: ""},
{Name: "order_no", Type: field.TypeString, Size: 64, Default: ""},
{Name: "result", Type: field.TypeString, Size: 16},
{Name: "reason", Type: field.TypeString, Size: 512, Default: ""},
{Name: "operator", Type: field.TypeString, Size: 64, Default: ""},
{Name: "created_at", Type: field.TypeTime},
}
// TrialRecordsTable holds the schema information for the "trial_records" table.
TrialRecordsTable = &schema.Table{
Name: "trial_records",
Columns: TrialRecordsColumns,
PrimaryKey: []*schema.Column{TrialRecordsColumns[0]},
}
// UserColumns holds the columns for the "user" table.
UserColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
@@ -1646,12 +1749,15 @@ var (
MaterialsTable,
MaterialQtyReportTable,
MaterialRequestTable,
MixProductionTemplateTable,
PermissionTable,
PlcSendLogTable,
ProcessFlowTable,
ProcessStepTable,
ProductBomTable,
ProductProcessTable,
ProductProcessItemTable,
ProductProcessMaterialTable,
RoleTable,
SemiFlowTable,
ShortageRequestsTable,
@@ -1664,6 +1770,7 @@ var (
SyncFailureTable,
SysConfigTable,
TorqueRecordTable,
TrialRecordsTable,
UserTable,
UserStationTable,
WorkOrderTable,
@@ -1732,6 +1839,9 @@ func init() {
MaterialRequestTable.Annotation = &entsql.Annotation{
Table: "material_request",
}
MixProductionTemplateTable.Annotation = &entsql.Annotation{
Table: "mix_production_template",
}
PermissionTable.Annotation = &entsql.Annotation{
Table: "permission",
}
@@ -1744,12 +1854,18 @@ func init() {
ProcessStepTable.Annotation = &entsql.Annotation{
Table: "process_step",
}
ProductBomTable.Annotation = &entsql.Annotation{
Table: "product_bom",
}
ProductProcessTable.Annotation = &entsql.Annotation{
Table: "product_process",
}
ProductProcessItemTable.Annotation = &entsql.Annotation{
Table: "product_process_item",
}
ProductProcessMaterialTable.Annotation = &entsql.Annotation{
Table: "product_process_material",
}
RoleTable.Annotation = &entsql.Annotation{
Table: "role",
}