初始化

This commit is contained in:
SunYF
2026-08-28 14:07:22 +08:00
parent a185247ab1
commit b34325a16f
971 changed files with 291 additions and 220360 deletions
-202
View File
@@ -1,202 +0,0 @@
// Code generated by ent, DO NOT EDIT.
package ent
import (
"bj_power_wms/ent/inspectionrecord"
"fmt"
"strings"
"entgo.io/ent"
"entgo.io/ent/dialect/sql"
)
// InspectionRecord is the model entity for the InspectionRecord schema.
type InspectionRecord struct {
config `json:"-"`
// ID of the ent.
ID int `json:"id,omitempty"`
// BATCH/SN
TargetType string `json:"target_type,omitempty"`
// 批次号或 SN
TargetID string `json:"target_id,omitempty"`
// 物料编码
MaterialCode string `json:"material_code,omitempty"`
// 来料检/过程检/成品检
InspectionType string `json:"inspection_type,omitempty"`
// 未检/合格/不合格
Status string `json:"status,omitempty"`
// 实测值(部分检验项)
ResultValue string `json:"result_value,omitempty"`
// 检验人
Inspector string `json:"inspector,omitempty"`
// 备注
Remark string `json:"remark,omitempty"`
// CreatedAt holds the value of the "created_at" field.
CreatedAt int64 `json:"created_at,omitempty"`
// UpdatedAt holds the value of the "updated_at" field.
UpdatedAt int64 `json:"updated_at,omitempty"`
selectValues sql.SelectValues
}
// scanValues returns the types for scanning values from sql.Rows.
func (*InspectionRecord) scanValues(columns []string) ([]any, error) {
values := make([]any, len(columns))
for i := range columns {
switch columns[i] {
case inspectionrecord.FieldID, inspectionrecord.FieldCreatedAt, inspectionrecord.FieldUpdatedAt:
values[i] = new(sql.NullInt64)
case inspectionrecord.FieldTargetType, inspectionrecord.FieldTargetID, inspectionrecord.FieldMaterialCode, inspectionrecord.FieldInspectionType, inspectionrecord.FieldStatus, inspectionrecord.FieldResultValue, inspectionrecord.FieldInspector, inspectionrecord.FieldRemark:
values[i] = new(sql.NullString)
default:
values[i] = new(sql.UnknownType)
}
}
return values, nil
}
// assignValues assigns the values that were returned from sql.Rows (after scanning)
// to the InspectionRecord fields.
func (_m *InspectionRecord) 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 inspectionrecord.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 inspectionrecord.FieldTargetType:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field target_type", values[i])
} else if value.Valid {
_m.TargetType = value.String
}
case inspectionrecord.FieldTargetID:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field target_id", values[i])
} else if value.Valid {
_m.TargetID = value.String
}
case inspectionrecord.FieldMaterialCode:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field material_code", values[i])
} else if value.Valid {
_m.MaterialCode = value.String
}
case inspectionrecord.FieldInspectionType:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field inspection_type", values[i])
} else if value.Valid {
_m.InspectionType = value.String
}
case inspectionrecord.FieldStatus:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field status", values[i])
} else if value.Valid {
_m.Status = value.String
}
case inspectionrecord.FieldResultValue:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field result_value", values[i])
} else if value.Valid {
_m.ResultValue = value.String
}
case inspectionrecord.FieldInspector:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field inspector", values[i])
} else if value.Valid {
_m.Inspector = value.String
}
case inspectionrecord.FieldRemark:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field remark", values[i])
} else if value.Valid {
_m.Remark = value.String
}
case inspectionrecord.FieldCreatedAt:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field created_at", values[i])
} else if value.Valid {
_m.CreatedAt = value.Int64
}
case inspectionrecord.FieldUpdatedAt:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field updated_at", values[i])
} else if value.Valid {
_m.UpdatedAt = value.Int64
}
default:
_m.selectValues.Set(columns[i], values[i])
}
}
return nil
}
// Value returns the ent.Value that was dynamically selected and assigned to the InspectionRecord.
// This includes values selected through modifiers, order, etc.
func (_m *InspectionRecord) Value(name string) (ent.Value, error) {
return _m.selectValues.Get(name)
}
// Update returns a builder for updating this InspectionRecord.
// Note that you need to call InspectionRecord.Unwrap() before calling this method if this InspectionRecord
// was returned from a transaction, and the transaction was committed or rolled back.
func (_m *InspectionRecord) Update() *InspectionRecordUpdateOne {
return NewInspectionRecordClient(_m.config).UpdateOne(_m)
}
// Unwrap unwraps the InspectionRecord 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 *InspectionRecord) Unwrap() *InspectionRecord {
_tx, ok := _m.config.driver.(*txDriver)
if !ok {
panic("ent: InspectionRecord is not a transactional entity")
}
_m.config.driver = _tx.drv
return _m
}
// String implements the fmt.Stringer.
func (_m *InspectionRecord) String() string {
var builder strings.Builder
builder.WriteString("InspectionRecord(")
builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID))
builder.WriteString("target_type=")
builder.WriteString(_m.TargetType)
builder.WriteString(", ")
builder.WriteString("target_id=")
builder.WriteString(_m.TargetID)
builder.WriteString(", ")
builder.WriteString("material_code=")
builder.WriteString(_m.MaterialCode)
builder.WriteString(", ")
builder.WriteString("inspection_type=")
builder.WriteString(_m.InspectionType)
builder.WriteString(", ")
builder.WriteString("status=")
builder.WriteString(_m.Status)
builder.WriteString(", ")
builder.WriteString("result_value=")
builder.WriteString(_m.ResultValue)
builder.WriteString(", ")
builder.WriteString("inspector=")
builder.WriteString(_m.Inspector)
builder.WriteString(", ")
builder.WriteString("remark=")
builder.WriteString(_m.Remark)
builder.WriteString(", ")
builder.WriteString("created_at=")
builder.WriteString(fmt.Sprintf("%v", _m.CreatedAt))
builder.WriteString(", ")
builder.WriteString("updated_at=")
builder.WriteString(fmt.Sprintf("%v", _m.UpdatedAt))
builder.WriteByte(')')
return builder.String()
}
// InspectionRecords is a parsable slice of InspectionRecord.
type InspectionRecords []*InspectionRecord