Files
bj_power/bj_power_mes/ent/productbom/productbom.go
T
SunYF 6b98b21dd4 重构排产/叫料配送/时钟/终端事件驱动,清理 SHIPPED 废弃状态
时钟与 JWT:验签按「谁签发谁的时间为准」,向签发方取 /api/server-time,
对端地址由既有 BaseURL 自动推导;不再要求现场人工 w32tm 对时。

排产 C 方案:工单状态不再回写排产,排产只表示启用开关;启用排产是唯一
开工开关,未启用不允许建档上件;完工/取消后工单进度从工单派生、叫料池
按工单状态重算;逐日手改后合计为准;日期筛选默认空=全部日期。

叫料配送 B 方案:新增 DELIVERED 待签收态,货真到工位才从 PREPARED 转
DELIVERED、工人签收再转 DONE;PREPARED 在途不可签收/退库;叫料队列一屏
显示 PENDING+PREPARED、支持批量完成备料;配送链改按工位凑车,一张配送单
=一个托盘=一个工位,只在配送单页新建,未派车可删可改;新建弹窗直列有货
工位;派车硬门禁要求接驳台传感器检测到托盘;删除改为事务内复核状态、
带 PENDING 条件删单头,防止并发派车时误删。

装配记账:新增已装量 installedQty 与追溯绑定 traceBind,落实「总账=分账
之和」;追溯件绑定/撤销回补、非序列号件报工按单台用量自动扣已装;报工前
按工位×物料核对累计已签收 ≥ 已消耗,不够拦下。

工件与工位终端:建档/重上线增加上料位可达性校验与 PLC 送件、半截补齐防
重复扣库;终端去轮询改事件驱动(报警/工件到位/点位/停单即时推送),铃铛
只挂消息类预警、与待办角标分家;刷新保留拧紧录入;跨服务连线失败不再
误报成数据库故障;新增 BJ_POWER_DEV=1 单进程调试模式(不起守护/托盘)。

告警:新增处置字段 resolved_at/resolved_by,红点=待处置数,确认关闭才消。

清理:删除 migrate 中 SHIPPED→DELIVERED 兼容补丁;场景1测试断言改为
现行 PREPARED / DELIVERED;同步更新案例.md、现场对时操作卡.md 与 ent 生成代码。
2026-11-26 17:18:58 +08:00

155 lines
5.7 KiB
Go

// Code generated by ent, DO NOT EDIT.
package productbom
import (
"time"
"entgo.io/ent/dialect/sql"
)
const (
// Label holds the string label denoting the productbom type in the database.
Label = "product_bom"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldProductCode holds the string denoting the productcode field in the database.
FieldProductCode = "product_code"
// FieldMaterialCode holds the string denoting the materialcode field in the database.
FieldMaterialCode = "material_code"
// FieldMaterialName holds the string denoting the materialname field in the database.
FieldMaterialName = "material_name"
// FieldSpec holds the string denoting the spec field in the database.
FieldSpec = "spec"
// FieldUnit holds the string denoting the unit field in the database.
FieldUnit = "unit"
// FieldUnitQty holds the string denoting the unitqty field in the database.
FieldUnitQty = "unit_qty"
// FieldLossRate holds the string denoting the lossrate field in the database.
FieldLossRate = "loss_rate"
// FieldTraceBind holds the string denoting the tracebind field in the database.
FieldTraceBind = "trace_bind"
// FieldRemark holds the string denoting the remark field in the database.
FieldRemark = "remark"
// FieldCreatedAt holds the string denoting the createdat field in the database.
FieldCreatedAt = "created_at"
// Table holds the table name of the productbom in the database.
Table = "product_bom"
)
// Columns holds all SQL columns for productbom fields.
var Columns = []string{
FieldID,
FieldProductCode,
FieldMaterialCode,
FieldMaterialName,
FieldSpec,
FieldUnit,
FieldUnitQty,
FieldLossRate,
FieldTraceBind,
FieldRemark,
FieldCreatedAt,
}
// ValidColumn reports if the column name is valid (part of the table columns).
func ValidColumn(column string) bool {
for i := range Columns {
if column == Columns[i] {
return true
}
}
return false
}
var (
// ProductCodeValidator is a validator for the "productCode" field. It is called by the builders before save.
ProductCodeValidator func(string) error
// MaterialCodeValidator is a validator for the "materialCode" field. It is called by the builders before save.
MaterialCodeValidator func(string) error
// DefaultMaterialName holds the default value on creation for the "materialName" field.
DefaultMaterialName string
// MaterialNameValidator is a validator for the "materialName" field. It is called by the builders before save.
MaterialNameValidator func(string) error
// DefaultSpec holds the default value on creation for the "spec" field.
DefaultSpec string
// SpecValidator is a validator for the "spec" field. It is called by the builders before save.
SpecValidator func(string) error
// DefaultUnit holds the default value on creation for the "unit" field.
DefaultUnit string
// UnitValidator is a validator for the "unit" field. It is called by the builders before save.
UnitValidator func(string) error
// DefaultUnitQty holds the default value on creation for the "unitQty" field.
DefaultUnitQty float64
// DefaultLossRate holds the default value on creation for the "lossRate" field.
DefaultLossRate float64
// DefaultTraceBind holds the default value on creation for the "traceBind" field.
DefaultTraceBind bool
// DefaultRemark holds the default value on creation for the "remark" field.
DefaultRemark string
// RemarkValidator is a validator for the "remark" field. It is called by the builders before save.
RemarkValidator func(string) error
// DefaultCreatedAt holds the default value on creation for the "createdAt" field.
DefaultCreatedAt func() time.Time
// IDValidator is a validator for the "id" field. It is called by the builders before save.
IDValidator func(int) error
)
// OrderOption defines the ordering options for the ProductBOM queries.
type OrderOption func(*sql.Selector)
// ByID orders the results by the id field.
func ByID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldID, opts...).ToFunc()
}
// ByProductCode orders the results by the productCode field.
func ByProductCode(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldProductCode, opts...).ToFunc()
}
// ByMaterialCode orders the results by the materialCode field.
func ByMaterialCode(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldMaterialCode, opts...).ToFunc()
}
// ByMaterialName orders the results by the materialName field.
func ByMaterialName(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldMaterialName, opts...).ToFunc()
}
// BySpec orders the results by the spec field.
func BySpec(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldSpec, opts...).ToFunc()
}
// ByUnit orders the results by the unit field.
func ByUnit(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldUnit, opts...).ToFunc()
}
// ByUnitQty orders the results by the unitQty field.
func ByUnitQty(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldUnitQty, opts...).ToFunc()
}
// ByLossRate orders the results by the lossRate field.
func ByLossRate(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldLossRate, opts...).ToFunc()
}
// ByTraceBind orders the results by the traceBind field.
func ByTraceBind(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldTraceBind, opts...).ToFunc()
}
// ByRemark orders the results by the remark field.
func ByRemark(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldRemark, opts...).ToFunc()
}
// ByCreatedAt orders the results by the createdAt field.
func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
}