Files
bj_power/bj_power_mes/ent/flowmaterial.go
T
SunYF 46fcb59079 feat: 退料闭环定稿(损耗台账/备料清单/退料AGV自动派车/剩余量参考)+ 工位托盘守卫
- MES 新增损耗台账 loss_ledger,差异确认损耗接口 ConfirmReceiveLoss(按工单归集)
- 备料清单 preparation:MES 按 日计划×工单×工位×物料 实时计算,WMS 只读展示 PreparationList
- 退料闭环:N5 工位托盘守卫(未完成禁止退料)、退料 AGV 自动派车(JBT21 空位判定 + 托盘回收链路)、退料参考剩余量接口(应剩余=实备-已耗-已退-已损)
- 新增 AGV 车辆状态表 agv_vehicle_state 及查询
- 整合接驳台/叫料池/库存锁既有闭环,清理 sql 目录注释生成脚本与 catalog,更新文档
2026-11-04 19:06:03 +08:00

197 lines
6.8 KiB
Go

// Code generated by ent, DO NOT EDIT.
package ent
import (
"bj_power_mes/ent/flowmaterial"
"fmt"
"strings"
"time"
"entgo.io/ent"
"entgo.io/ent/dialect/sql"
)
// FlowMaterial 工艺物料清单:一道工艺装什么料、单台用多少(备料/齐套校验的唯一源头)。
type FlowMaterial struct {
config `json:"-"`
// ID of the ent.
ID int `json:"id,omitempty"`
// 所属工艺ID
FlowId int `json:"flowId,omitempty"`
// 物料编码
MaterialCode string `json:"materialCode,omitempty"`
// MaterialName holds the value of the "materialName" field.
MaterialName string `json:"materialName,omitempty"`
// Spec holds the value of the "spec" field.
Spec string `json:"spec,omitempty"`
// Unit holds the value of the "unit" field.
Unit string `json:"unit,omitempty"`
// SnMode holds the value of the "snMode" field.
SnMode int `json:"snMode,omitempty"`
// 单台用量
UnitQty float64 `json:"unitQty,omitempty"`
// 损耗率%(仅展示口径,不参与备料计算——R7 2026-11-03 拍板:备料量=工单需求×单台用量,损耗走补料审批)
LossRate float64 `json:"lossRate,omitempty"`
// CreatedAt holds the value of the "createdAt" field.
CreatedAt time.Time `json:"createdAt,omitempty"`
selectValues sql.SelectValues
}
// scanValues returns the types for scanning values from sql.Rows.
func (*FlowMaterial) scanValues(columns []string) ([]any, error) {
values := make([]any, len(columns))
for i := range columns {
switch columns[i] {
case flowmaterial.FieldUnitQty, flowmaterial.FieldLossRate:
values[i] = new(sql.NullFloat64)
case flowmaterial.FieldID, flowmaterial.FieldFlowId, flowmaterial.FieldSnMode:
values[i] = new(sql.NullInt64)
case flowmaterial.FieldMaterialCode, flowmaterial.FieldMaterialName, flowmaterial.FieldSpec, flowmaterial.FieldUnit:
values[i] = new(sql.NullString)
case flowmaterial.FieldCreatedAt:
values[i] = new(sql.NullTime)
default:
values[i] = new(sql.UnknownType)
}
}
return values, nil
}
// assignValues assigns the values that were returned from sql.Rows (after scanning)
// to the FlowMaterial fields.
func (_m *FlowMaterial) assignValues(columns []string, values []any) error {
if m, n := len(values), len(columns); m < n {
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
}
for i := range columns {
switch columns[i] {
case flowmaterial.FieldID:
value, ok := values[i].(*sql.NullInt64)
if !ok {
return fmt.Errorf("unexpected type %T for field id", value)
}
_m.ID = int(value.Int64)
case flowmaterial.FieldFlowId:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field flowId", values[i])
} else if value.Valid {
_m.FlowId = int(value.Int64)
}
case flowmaterial.FieldMaterialCode:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field materialCode", values[i])
} else if value.Valid {
_m.MaterialCode = value.String
}
case flowmaterial.FieldMaterialName:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field materialName", values[i])
} else if value.Valid {
_m.MaterialName = value.String
}
case flowmaterial.FieldSpec:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field spec", values[i])
} else if value.Valid {
_m.Spec = value.String
}
case flowmaterial.FieldUnit:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field unit", values[i])
} else if value.Valid {
_m.Unit = value.String
}
case flowmaterial.FieldSnMode:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field snMode", values[i])
} else if value.Valid {
_m.SnMode = int(value.Int64)
}
case flowmaterial.FieldUnitQty:
if value, ok := values[i].(*sql.NullFloat64); !ok {
return fmt.Errorf("unexpected type %T for field unitQty", values[i])
} else if value.Valid {
_m.UnitQty = value.Float64
}
case flowmaterial.FieldLossRate:
if value, ok := values[i].(*sql.NullFloat64); !ok {
return fmt.Errorf("unexpected type %T for field lossRate", values[i])
} else if value.Valid {
_m.LossRate = value.Float64
}
case flowmaterial.FieldCreatedAt:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field createdAt", values[i])
} else if value.Valid {
_m.CreatedAt = value.Time
}
default:
_m.selectValues.Set(columns[i], values[i])
}
}
return nil
}
// Value returns the ent.Value that was dynamically selected and assigned to the FlowMaterial.
// This includes values selected through modifiers, order, etc.
func (_m *FlowMaterial) Value(name string) (ent.Value, error) {
return _m.selectValues.Get(name)
}
// Update returns a builder for updating this FlowMaterial.
// Note that you need to call FlowMaterial.Unwrap() before calling this method if this FlowMaterial
// was returned from a transaction, and the transaction was committed or rolled back.
func (_m *FlowMaterial) Update() *FlowMaterialUpdateOne {
return NewFlowMaterialClient(_m.config).UpdateOne(_m)
}
// Unwrap unwraps the FlowMaterial entity that was returned from a transaction after it was closed,
// so that all future queries will be executed through the driver which created the transaction.
func (_m *FlowMaterial) Unwrap() *FlowMaterial {
_tx, ok := _m.config.driver.(*txDriver)
if !ok {
panic("ent: FlowMaterial is not a transactional entity")
}
_m.config.driver = _tx.drv
return _m
}
// String implements the fmt.Stringer.
func (_m *FlowMaterial) String() string {
var builder strings.Builder
builder.WriteString("FlowMaterial(")
builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID))
builder.WriteString("flowId=")
builder.WriteString(fmt.Sprintf("%v", _m.FlowId))
builder.WriteString(", ")
builder.WriteString("materialCode=")
builder.WriteString(_m.MaterialCode)
builder.WriteString(", ")
builder.WriteString("materialName=")
builder.WriteString(_m.MaterialName)
builder.WriteString(", ")
builder.WriteString("spec=")
builder.WriteString(_m.Spec)
builder.WriteString(", ")
builder.WriteString("unit=")
builder.WriteString(_m.Unit)
builder.WriteString(", ")
builder.WriteString("snMode=")
builder.WriteString(fmt.Sprintf("%v", _m.SnMode))
builder.WriteString(", ")
builder.WriteString("unitQty=")
builder.WriteString(fmt.Sprintf("%v", _m.UnitQty))
builder.WriteString(", ")
builder.WriteString("lossRate=")
builder.WriteString(fmt.Sprintf("%v", _m.LossRate))
builder.WriteString(", ")
builder.WriteString("createdAt=")
builder.WriteString(_m.CreatedAt.Format(time.ANSIC))
builder.WriteByte(')')
return builder.String()
}
// FlowMaterials is a parsable slice of FlowMaterial.
type FlowMaterials []*FlowMaterial