1. 全局替换"工序"为"工艺"统一术语,包括页面文案、枚举、注释
2. 重构工单与工件工艺数据模型:
- 新增工艺组合表flow_material作为备料/齐套唯一源头
- 新增工位状态表station_state支持自主停单/恢复接单
- 移除station_process派工表,改用工单工艺组合作为路线唯一源头
- 替换processCode为flowId作为工艺关联标识
- 重构工件当前进度字段为currentStationNo
3. 删除冗余的静态备份资源文件
4. 调整物料选择组件默认启用仅显示激活物料
5. 优化工单创建/编辑逻辑,新增工艺组合校验与保存
197 lines
6.6 KiB
Go
197 lines
6.6 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 is the model entity for the FlowMaterial schema.
|
|
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"`
|
|
// ManageMode holds the value of the "manageMode" field.
|
|
ManageMode string `json:"manageMode,omitempty"`
|
|
// 单台用量
|
|
UnitQty float64 `json:"unitQty,omitempty"`
|
|
// 损耗率%
|
|
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:
|
|
values[i] = new(sql.NullInt64)
|
|
case flowmaterial.FieldMaterialCode, flowmaterial.FieldMaterialName, flowmaterial.FieldSpec, flowmaterial.FieldUnit, flowmaterial.FieldManageMode:
|
|
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.FieldManageMode:
|
|
if value, ok := values[i].(*sql.NullString); !ok {
|
|
return fmt.Errorf("unexpected type %T for field manageMode", values[i])
|
|
} else if value.Valid {
|
|
_m.ManageMode = value.String
|
|
}
|
|
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("manageMode=")
|
|
builder.WriteString(_m.ManageMode)
|
|
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
|