feat: 移除工艺物料与混产模板实体、新增产线清线与 PLC 监控实时推送、看板双屏增强
- 移除实体:MES 删除 FlowMaterial(工艺物料)与 MixProductionTemplate(混产模板)全套(schema/ent 生成码/handler/logic),清理关联路由与种子 - 新增功能:产线清线(line_clearance handler + logic)、PLC 监控 WebSocket 实时推送(ws/plc_monitor_hub + handler) - 看板增强:新增管理屏与 KPI 组件(BoardManage/BoardKpi),调整演示屏 Mock 与各看板面板 - MES 完善:PLC 匹配/扭矩扫描/签收、工艺卡 PDF 与工单、AGV 链路、叫料/备料/在制品/短料预测等逻辑与前端调整 - 工位终端:删除离线面板 OfflinePanel,调整主界面/物料面板与 api/store/handler/路由 - WMS:AGV 托盘、物料与 MES 客户端调整及前端帮助/基础数据/叫料/托盘页 - 文档:更新产线API/客户问题/案例/部署手册/问题记录
This commit is contained in:
@@ -12,7 +12,7 @@ import (
|
||||
|
||||
// CallPool 叫料池(B5 定稿 2026-10-13):工位级物料行四数账,一行 = 一个工位 + 一个物料。
|
||||
//
|
||||
// 池子来源 = 启用状态(CONFIRMED)的日排产 × 工单工艺组合(flow_combination) × 工艺物料清单(flow_material),
|
||||
// 池子来源 = 启用状态(CONFIRMED)的日排产 × 工单来源产品工艺的工艺分账(product_process_material),
|
||||
// 按 工位+物料 聚合;需求量 = Σ 该工位排产量 × 单台用量(R7 2026-11-03 拍板:不预放折损率,
|
||||
// 损耗走补料审批 shortage),逐排产行向上取整后求和。
|
||||
//
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
package schema
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/entsql"
|
||||
"entgo.io/ent/schema"
|
||||
"entgo.io/ent/schema/field"
|
||||
"entgo.io/ent/schema/index"
|
||||
)
|
||||
|
||||
// FlowMaterial 工艺物料清单:一道工艺装什么料、单台用多少(备料/齐套校验的唯一源头)。
|
||||
// 约束:物料必须属于产品物料清单子集(写入时校验)。
|
||||
type FlowMaterial struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
func (FlowMaterial) Annotations() []schema.Annotation {
|
||||
return []schema.Annotation{entsql.Annotation{Table: "flow_material"}, entsql.WithComments(true), schema.Comment("FlowMaterial 工艺物料清单:一道工艺装什么料、单台用多少(备料/齐套校验的唯一源头)。")}
|
||||
}
|
||||
|
||||
func (FlowMaterial) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.Int("id").Positive(),
|
||||
field.Int("flowId").Comment("所属工艺ID"),
|
||||
field.String("materialCode").MaxLen(64).Comment("物料编码"),
|
||||
field.String("materialName").Default("").MaxLen(128),
|
||||
field.String("spec").Default("").MaxLen(128),
|
||||
field.String("unit").Default("").MaxLen(16),
|
||||
// 是否逐件SN管理(冗余自物料档案 sn_mode,绑定/备料行为唯一依据):1 序列号=是(录SN) / 2 序列号=否
|
||||
field.Int("snMode").Default(2),
|
||||
field.Float("unitQty").Default(0).Comment("单台用量"),
|
||||
field.Float("lossRate").Default(0).Comment("损耗率%(仅展示口径,不参与备料计算——R7 2026-11-03 拍板:备料量=工单需求×单台用量,损耗走补料审批)"),
|
||||
field.Time("createdAt").Default(time.Now).Immutable(),
|
||||
}
|
||||
}
|
||||
|
||||
func (FlowMaterial) Indexes() []ent.Index {
|
||||
return []ent.Index{
|
||||
index.Fields("flowId"),
|
||||
index.Fields("flowId", "materialCode").Unique(),
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
package schema
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/entsql"
|
||||
"entgo.io/ent/schema"
|
||||
"entgo.io/ent/schema/field"
|
||||
"entgo.io/ent/schema/index"
|
||||
)
|
||||
|
||||
// MixProductionTemplate 混产模板(2026-11-13 拍板):
|
||||
// 「生成工位模板」的原始需求是快捷操作 + 支持多工单(多成品)混产,不是换线工具。
|
||||
// 模板圈定「哪几个成品可以在同一套工位绑定下混线生产」;同模板内产品切换靠扫码防错,
|
||||
// 不强制停机清线;引入模板外的新产品才触发清线门禁(在制品/余料/托盘/AGV 在途)。
|
||||
// 工位绑定的是【基础工艺(工序)】,不是成品;成品只在本模板里作为可混产集合出现。
|
||||
type MixProductionTemplate struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
func (MixProductionTemplate) Annotations() []schema.Annotation {
|
||||
return []schema.Annotation{
|
||||
entsql.Annotation{Table: "mix_production_template"}, entsql.WithComments(true),
|
||||
schema.Comment("MixProductionTemplate 混产模板:可混线生产的成品集合。"),
|
||||
}
|
||||
}
|
||||
|
||||
func (MixProductionTemplate) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.Int("id").Positive(),
|
||||
field.String("name").MaxLen(128).Comment("模板名称"),
|
||||
field.Text("productCodes").Default("").Comment("可混产成品编码集合(逗号分隔)"),
|
||||
field.String("remark").Default("").MaxLen(255),
|
||||
field.String("status").Default("ACTIVE").MaxLen(16).Comment("ACTIVE/INACTIVE"),
|
||||
field.Time("createdAt").Default(time.Now).Immutable(),
|
||||
}
|
||||
}
|
||||
|
||||
func (MixProductionTemplate) Indexes() []ent.Index {
|
||||
return []ent.Index{index.Fields("name").Unique()}
|
||||
}
|
||||
@@ -12,9 +12,9 @@ import (
|
||||
|
||||
// ProductBOM 成品 BOM 总账(2026-11-13 拍板「总分制」):
|
||||
// 挂在【成品】下,一台成品需要哪些物料、各用多少,只在这里维护一次。
|
||||
// 彻底废除旧的「分总公用」思路——flow_material 不再是可被多个成品随意借用的公共清单,
|
||||
// 彻底废除旧的「分总公用」思路——物料口径按产品隔离(2026-11-18 工艺物料清单已删除),
|
||||
// 而是由「产品工艺」把本表物料分配到各工序后生成的执行口径(见 ProductProcessMaterial)。
|
||||
// 总账不直接参与备料计算;下游 10+ 消费方仍读 flow_material,避免一次改全链路。
|
||||
// 总账不直接参与备料计算;下游 10+ 消费方读工艺分账,避免一次改全链路。
|
||||
type ProductBOM struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ func (Workpiece) Fields() []ent.Field {
|
||||
field.Time("updatedAt").Default(time.Now).UpdateDefault(time.Now).Optional().Nillable(),
|
||||
// 拧紧不合格「待人工处置」标记(B6 最小闭环,2026-10-13):非工件六态,仅标记位。
|
||||
// NG 写入后置 true;返工重拧合格不自动清(不在此处清零),必须质检/班组长确认放行(DisposeTorqueNg)才清。
|
||||
// 置位期间阻断该件后续报工(ReportProcess)与下线完工(DoneWorkpiece)。
|
||||
// 置位期间阻断该件后续报工(ReportProcess)。
|
||||
field.Bool("torque_ng_pending").Default(false).Comment("拧紧扭矩不合格待人工处置标记"),
|
||||
field.Time("torque_ng_at").Optional().Nillable().Comment("拧紧不合格标记时间"),
|
||||
field.String("torque_ng_by").Optional().Nillable().MaxLen(64).Comment("拧紧不合格标记操作人"),
|
||||
|
||||
Reference in New Issue
Block a user