diff --git a/bj_power_mes/ent/client.go b/bj_power_mes/ent/client.go index 4d41c86..10db8b9 100644 --- a/bj_power_mes/ent/client.go +++ b/bj_power_mes/ent/client.go @@ -23,14 +23,12 @@ import ( "bj_power_mes/ent/dailyplan" "bj_power_mes/ent/dock" "bj_power_mes/ent/eventlog" - "bj_power_mes/ent/flowmaterial" "bj_power_mes/ent/inspectionrecord" "bj_power_mes/ent/linepoint" "bj_power_mes/ent/lossledger" "bj_power_mes/ent/material" "bj_power_mes/ent/materialqtyreport" "bj_power_mes/ent/materialrequest" - "bj_power_mes/ent/mixproductiontemplate" "bj_power_mes/ent/permission" "bj_power_mes/ent/plcsendlog" "bj_power_mes/ent/processflow" @@ -94,8 +92,6 @@ type Client struct { Dock *DockClient // EventLog is the client for interacting with the EventLog builders. EventLog *EventLogClient - // FlowMaterial is the client for interacting with the FlowMaterial builders. - FlowMaterial *FlowMaterialClient // InspectionRecord is the client for interacting with the InspectionRecord builders. InspectionRecord *InspectionRecordClient // LinePoint is the client for interacting with the LinePoint builders. @@ -108,8 +104,6 @@ type Client struct { MaterialQtyReport *MaterialQtyReportClient // MaterialRequest is the client for interacting with the MaterialRequest builders. MaterialRequest *MaterialRequestClient - // MixProductionTemplate is the client for interacting with the MixProductionTemplate builders. - MixProductionTemplate *MixProductionTemplateClient // Permission is the client for interacting with the Permission builders. Permission *PermissionClient // PlcSendLog is the client for interacting with the PlcSendLog builders. @@ -189,14 +183,12 @@ func (c *Client) init() { c.DailyPlan = NewDailyPlanClient(c.config) c.Dock = NewDockClient(c.config) c.EventLog = NewEventLogClient(c.config) - c.FlowMaterial = NewFlowMaterialClient(c.config) c.InspectionRecord = NewInspectionRecordClient(c.config) c.LinePoint = NewLinePointClient(c.config) c.LossLedger = NewLossLedgerClient(c.config) c.Material = NewMaterialClient(c.config) c.MaterialQtyReport = NewMaterialQtyReportClient(c.config) c.MaterialRequest = NewMaterialRequestClient(c.config) - c.MixProductionTemplate = NewMixProductionTemplateClient(c.config) c.Permission = NewPermissionClient(c.config) c.PlcSendLog = NewPlcSendLogClient(c.config) c.ProcessFlow = NewProcessFlowClient(c.config) @@ -329,14 +321,12 @@ func (c *Client) Tx(ctx context.Context) (*Tx, error) { DailyPlan: NewDailyPlanClient(cfg), Dock: NewDockClient(cfg), EventLog: NewEventLogClient(cfg), - FlowMaterial: NewFlowMaterialClient(cfg), InspectionRecord: NewInspectionRecordClient(cfg), LinePoint: NewLinePointClient(cfg), LossLedger: NewLossLedgerClient(cfg), Material: NewMaterialClient(cfg), MaterialQtyReport: NewMaterialQtyReportClient(cfg), MaterialRequest: NewMaterialRequestClient(cfg), - MixProductionTemplate: NewMixProductionTemplateClient(cfg), Permission: NewPermissionClient(cfg), PlcSendLog: NewPlcSendLogClient(cfg), ProcessFlow: NewProcessFlowClient(cfg), @@ -396,14 +386,12 @@ func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) DailyPlan: NewDailyPlanClient(cfg), Dock: NewDockClient(cfg), EventLog: NewEventLogClient(cfg), - FlowMaterial: NewFlowMaterialClient(cfg), InspectionRecord: NewInspectionRecordClient(cfg), LinePoint: NewLinePointClient(cfg), LossLedger: NewLossLedgerClient(cfg), Material: NewMaterialClient(cfg), MaterialQtyReport: NewMaterialQtyReportClient(cfg), MaterialRequest: NewMaterialRequestClient(cfg), - MixProductionTemplate: NewMixProductionTemplateClient(cfg), Permission: NewPermissionClient(cfg), PlcSendLog: NewPlcSendLogClient(cfg), ProcessFlow: NewProcessFlowClient(cfg), @@ -463,15 +451,14 @@ func (c *Client) Use(hooks ...Hook) { for _, n := range []interface{ Use(...Hook) }{ c.AgvPoint, c.AgvTask, c.AgvVehicleState, c.Alert, c.AlertRule, c.AssociationTrace, c.Attachment, c.BackupRecord, c.CallPool, c.DailyPlan, - c.Dock, c.EventLog, c.FlowMaterial, c.InspectionRecord, c.LinePoint, - c.LossLedger, c.Material, c.MaterialQtyReport, c.MaterialRequest, - c.MixProductionTemplate, c.Permission, c.PlcSendLog, c.ProcessFlow, - c.ProcessStep, c.ProductBOM, c.ProductProcess, c.ProductProcessItem, - c.ProductProcessMaterial, c.Role, c.SemiFlow, c.ShortageRequest, c.Station, - c.StationShift, c.StationState, c.StepCriterion, c.StepData, c.StepSignRecord, - c.SyncFailure, c.SysConfig, c.TorqueRecord, c.TrialRecord, c.User, - c.UserStation, c.WorkOrder, c.Workpiece, c.WorkpieceBind, - c.WorkpieceLifecycleLog, c.WorkpieceProcess, + c.Dock, c.EventLog, c.InspectionRecord, c.LinePoint, c.LossLedger, c.Material, + c.MaterialQtyReport, c.MaterialRequest, c.Permission, c.PlcSendLog, + c.ProcessFlow, c.ProcessStep, c.ProductBOM, c.ProductProcess, + c.ProductProcessItem, c.ProductProcessMaterial, c.Role, c.SemiFlow, + c.ShortageRequest, c.Station, c.StationShift, c.StationState, c.StepCriterion, + c.StepData, c.StepSignRecord, c.SyncFailure, c.SysConfig, c.TorqueRecord, + c.TrialRecord, c.User, c.UserStation, c.WorkOrder, c.Workpiece, + c.WorkpieceBind, c.WorkpieceLifecycleLog, c.WorkpieceProcess, } { n.Use(hooks...) } @@ -483,15 +470,14 @@ func (c *Client) Intercept(interceptors ...Interceptor) { for _, n := range []interface{ Intercept(...Interceptor) }{ c.AgvPoint, c.AgvTask, c.AgvVehicleState, c.Alert, c.AlertRule, c.AssociationTrace, c.Attachment, c.BackupRecord, c.CallPool, c.DailyPlan, - c.Dock, c.EventLog, c.FlowMaterial, c.InspectionRecord, c.LinePoint, - c.LossLedger, c.Material, c.MaterialQtyReport, c.MaterialRequest, - c.MixProductionTemplate, c.Permission, c.PlcSendLog, c.ProcessFlow, - c.ProcessStep, c.ProductBOM, c.ProductProcess, c.ProductProcessItem, - c.ProductProcessMaterial, c.Role, c.SemiFlow, c.ShortageRequest, c.Station, - c.StationShift, c.StationState, c.StepCriterion, c.StepData, c.StepSignRecord, - c.SyncFailure, c.SysConfig, c.TorqueRecord, c.TrialRecord, c.User, - c.UserStation, c.WorkOrder, c.Workpiece, c.WorkpieceBind, - c.WorkpieceLifecycleLog, c.WorkpieceProcess, + c.Dock, c.EventLog, c.InspectionRecord, c.LinePoint, c.LossLedger, c.Material, + c.MaterialQtyReport, c.MaterialRequest, c.Permission, c.PlcSendLog, + c.ProcessFlow, c.ProcessStep, c.ProductBOM, c.ProductProcess, + c.ProductProcessItem, c.ProductProcessMaterial, c.Role, c.SemiFlow, + c.ShortageRequest, c.Station, c.StationShift, c.StationState, c.StepCriterion, + c.StepData, c.StepSignRecord, c.SyncFailure, c.SysConfig, c.TorqueRecord, + c.TrialRecord, c.User, c.UserStation, c.WorkOrder, c.Workpiece, + c.WorkpieceBind, c.WorkpieceLifecycleLog, c.WorkpieceProcess, } { n.Intercept(interceptors...) } @@ -524,8 +510,6 @@ func (c *Client) Mutate(ctx context.Context, m Mutation) (Value, error) { return c.Dock.mutate(ctx, m) case *EventLogMutation: return c.EventLog.mutate(ctx, m) - case *FlowMaterialMutation: - return c.FlowMaterial.mutate(ctx, m) case *InspectionRecordMutation: return c.InspectionRecord.mutate(ctx, m) case *LinePointMutation: @@ -538,8 +522,6 @@ func (c *Client) Mutate(ctx context.Context, m Mutation) (Value, error) { return c.MaterialQtyReport.mutate(ctx, m) case *MaterialRequestMutation: return c.MaterialRequest.mutate(ctx, m) - case *MixProductionTemplateMutation: - return c.MixProductionTemplate.mutate(ctx, m) case *PermissionMutation: return c.Permission.mutate(ctx, m) case *PlcSendLogMutation: @@ -2197,139 +2179,6 @@ func (c *EventLogClient) mutate(ctx context.Context, m *EventLogMutation) (Value } } -// FlowMaterialClient is a client for the FlowMaterial schema. -type FlowMaterialClient struct { - config -} - -// NewFlowMaterialClient returns a client for the FlowMaterial from the given config. -func NewFlowMaterialClient(c config) *FlowMaterialClient { - return &FlowMaterialClient{config: c} -} - -// Use adds a list of mutation hooks to the hooks stack. -// A call to `Use(f, g, h)` equals to `flowmaterial.Hooks(f(g(h())))`. -func (c *FlowMaterialClient) Use(hooks ...Hook) { - c.hooks.FlowMaterial = append(c.hooks.FlowMaterial, hooks...) -} - -// Intercept adds a list of query interceptors to the interceptors stack. -// A call to `Intercept(f, g, h)` equals to `flowmaterial.Intercept(f(g(h())))`. -func (c *FlowMaterialClient) Intercept(interceptors ...Interceptor) { - c.inters.FlowMaterial = append(c.inters.FlowMaterial, interceptors...) -} - -// Create returns a builder for creating a FlowMaterial entity. -func (c *FlowMaterialClient) Create() *FlowMaterialCreate { - mutation := newFlowMaterialMutation(c.config, OpCreate) - return &FlowMaterialCreate{config: c.config, hooks: c.Hooks(), mutation: mutation} -} - -// CreateBulk returns a builder for creating a bulk of FlowMaterial entities. -func (c *FlowMaterialClient) CreateBulk(builders ...*FlowMaterialCreate) *FlowMaterialCreateBulk { - return &FlowMaterialCreateBulk{config: c.config, builders: builders} -} - -// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates -// a builder and applies setFunc on it. -func (c *FlowMaterialClient) MapCreateBulk(slice any, setFunc func(*FlowMaterialCreate, int)) *FlowMaterialCreateBulk { - rv := reflect.ValueOf(slice) - if rv.Kind() != reflect.Slice { - return &FlowMaterialCreateBulk{err: fmt.Errorf("calling to FlowMaterialClient.MapCreateBulk with wrong type %T, need slice", slice)} - } - builders := make([]*FlowMaterialCreate, rv.Len()) - for i := 0; i < rv.Len(); i++ { - builders[i] = c.Create() - setFunc(builders[i], i) - } - return &FlowMaterialCreateBulk{config: c.config, builders: builders} -} - -// Update returns an update builder for FlowMaterial. -func (c *FlowMaterialClient) Update() *FlowMaterialUpdate { - mutation := newFlowMaterialMutation(c.config, OpUpdate) - return &FlowMaterialUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation} -} - -// UpdateOne returns an update builder for the given entity. -func (c *FlowMaterialClient) UpdateOne(_m *FlowMaterial) *FlowMaterialUpdateOne { - mutation := newFlowMaterialMutation(c.config, OpUpdateOne, withFlowMaterial(_m)) - return &FlowMaterialUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} -} - -// UpdateOneID returns an update builder for the given id. -func (c *FlowMaterialClient) UpdateOneID(id int) *FlowMaterialUpdateOne { - mutation := newFlowMaterialMutation(c.config, OpUpdateOne, withFlowMaterialID(id)) - return &FlowMaterialUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} -} - -// Delete returns a delete builder for FlowMaterial. -func (c *FlowMaterialClient) Delete() *FlowMaterialDelete { - mutation := newFlowMaterialMutation(c.config, OpDelete) - return &FlowMaterialDelete{config: c.config, hooks: c.Hooks(), mutation: mutation} -} - -// DeleteOne returns a builder for deleting the given entity. -func (c *FlowMaterialClient) DeleteOne(_m *FlowMaterial) *FlowMaterialDeleteOne { - return c.DeleteOneID(_m.ID) -} - -// DeleteOneID returns a builder for deleting the given entity by its id. -func (c *FlowMaterialClient) DeleteOneID(id int) *FlowMaterialDeleteOne { - builder := c.Delete().Where(flowmaterial.ID(id)) - builder.mutation.id = &id - builder.mutation.op = OpDeleteOne - return &FlowMaterialDeleteOne{builder} -} - -// Query returns a query builder for FlowMaterial. -func (c *FlowMaterialClient) Query() *FlowMaterialQuery { - return &FlowMaterialQuery{ - config: c.config, - ctx: &QueryContext{Type: TypeFlowMaterial}, - inters: c.Interceptors(), - } -} - -// Get returns a FlowMaterial entity by its id. -func (c *FlowMaterialClient) Get(ctx context.Context, id int) (*FlowMaterial, error) { - return c.Query().Where(flowmaterial.ID(id)).Only(ctx) -} - -// GetX is like Get, but panics if an error occurs. -func (c *FlowMaterialClient) GetX(ctx context.Context, id int) *FlowMaterial { - obj, err := c.Get(ctx, id) - if err != nil { - panic(err) - } - return obj -} - -// Hooks returns the client hooks. -func (c *FlowMaterialClient) Hooks() []Hook { - return c.hooks.FlowMaterial -} - -// Interceptors returns the client interceptors. -func (c *FlowMaterialClient) Interceptors() []Interceptor { - return c.inters.FlowMaterial -} - -func (c *FlowMaterialClient) mutate(ctx context.Context, m *FlowMaterialMutation) (Value, error) { - switch m.Op() { - case OpCreate: - return (&FlowMaterialCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx) - case OpUpdate: - return (&FlowMaterialUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx) - case OpUpdateOne: - return (&FlowMaterialUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx) - case OpDelete, OpDeleteOne: - return (&FlowMaterialDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx) - default: - return nil, fmt.Errorf("ent: unknown FlowMaterial mutation op: %q", m.Op()) - } -} - // InspectionRecordClient is a client for the InspectionRecord schema. type InspectionRecordClient struct { config @@ -3128,139 +2977,6 @@ func (c *MaterialRequestClient) mutate(ctx context.Context, m *MaterialRequestMu } } -// MixProductionTemplateClient is a client for the MixProductionTemplate schema. -type MixProductionTemplateClient struct { - config -} - -// NewMixProductionTemplateClient returns a client for the MixProductionTemplate from the given config. -func NewMixProductionTemplateClient(c config) *MixProductionTemplateClient { - return &MixProductionTemplateClient{config: c} -} - -// Use adds a list of mutation hooks to the hooks stack. -// A call to `Use(f, g, h)` equals to `mixproductiontemplate.Hooks(f(g(h())))`. -func (c *MixProductionTemplateClient) Use(hooks ...Hook) { - c.hooks.MixProductionTemplate = append(c.hooks.MixProductionTemplate, hooks...) -} - -// Intercept adds a list of query interceptors to the interceptors stack. -// A call to `Intercept(f, g, h)` equals to `mixproductiontemplate.Intercept(f(g(h())))`. -func (c *MixProductionTemplateClient) Intercept(interceptors ...Interceptor) { - c.inters.MixProductionTemplate = append(c.inters.MixProductionTemplate, interceptors...) -} - -// Create returns a builder for creating a MixProductionTemplate entity. -func (c *MixProductionTemplateClient) Create() *MixProductionTemplateCreate { - mutation := newMixProductionTemplateMutation(c.config, OpCreate) - return &MixProductionTemplateCreate{config: c.config, hooks: c.Hooks(), mutation: mutation} -} - -// CreateBulk returns a builder for creating a bulk of MixProductionTemplate entities. -func (c *MixProductionTemplateClient) CreateBulk(builders ...*MixProductionTemplateCreate) *MixProductionTemplateCreateBulk { - return &MixProductionTemplateCreateBulk{config: c.config, builders: builders} -} - -// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates -// a builder and applies setFunc on it. -func (c *MixProductionTemplateClient) MapCreateBulk(slice any, setFunc func(*MixProductionTemplateCreate, int)) *MixProductionTemplateCreateBulk { - rv := reflect.ValueOf(slice) - if rv.Kind() != reflect.Slice { - return &MixProductionTemplateCreateBulk{err: fmt.Errorf("calling to MixProductionTemplateClient.MapCreateBulk with wrong type %T, need slice", slice)} - } - builders := make([]*MixProductionTemplateCreate, rv.Len()) - for i := 0; i < rv.Len(); i++ { - builders[i] = c.Create() - setFunc(builders[i], i) - } - return &MixProductionTemplateCreateBulk{config: c.config, builders: builders} -} - -// Update returns an update builder for MixProductionTemplate. -func (c *MixProductionTemplateClient) Update() *MixProductionTemplateUpdate { - mutation := newMixProductionTemplateMutation(c.config, OpUpdate) - return &MixProductionTemplateUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation} -} - -// UpdateOne returns an update builder for the given entity. -func (c *MixProductionTemplateClient) UpdateOne(_m *MixProductionTemplate) *MixProductionTemplateUpdateOne { - mutation := newMixProductionTemplateMutation(c.config, OpUpdateOne, withMixProductionTemplate(_m)) - return &MixProductionTemplateUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} -} - -// UpdateOneID returns an update builder for the given id. -func (c *MixProductionTemplateClient) UpdateOneID(id int) *MixProductionTemplateUpdateOne { - mutation := newMixProductionTemplateMutation(c.config, OpUpdateOne, withMixProductionTemplateID(id)) - return &MixProductionTemplateUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} -} - -// Delete returns a delete builder for MixProductionTemplate. -func (c *MixProductionTemplateClient) Delete() *MixProductionTemplateDelete { - mutation := newMixProductionTemplateMutation(c.config, OpDelete) - return &MixProductionTemplateDelete{config: c.config, hooks: c.Hooks(), mutation: mutation} -} - -// DeleteOne returns a builder for deleting the given entity. -func (c *MixProductionTemplateClient) DeleteOne(_m *MixProductionTemplate) *MixProductionTemplateDeleteOne { - return c.DeleteOneID(_m.ID) -} - -// DeleteOneID returns a builder for deleting the given entity by its id. -func (c *MixProductionTemplateClient) DeleteOneID(id int) *MixProductionTemplateDeleteOne { - builder := c.Delete().Where(mixproductiontemplate.ID(id)) - builder.mutation.id = &id - builder.mutation.op = OpDeleteOne - return &MixProductionTemplateDeleteOne{builder} -} - -// Query returns a query builder for MixProductionTemplate. -func (c *MixProductionTemplateClient) Query() *MixProductionTemplateQuery { - return &MixProductionTemplateQuery{ - config: c.config, - ctx: &QueryContext{Type: TypeMixProductionTemplate}, - inters: c.Interceptors(), - } -} - -// Get returns a MixProductionTemplate entity by its id. -func (c *MixProductionTemplateClient) Get(ctx context.Context, id int) (*MixProductionTemplate, error) { - return c.Query().Where(mixproductiontemplate.ID(id)).Only(ctx) -} - -// GetX is like Get, but panics if an error occurs. -func (c *MixProductionTemplateClient) GetX(ctx context.Context, id int) *MixProductionTemplate { - obj, err := c.Get(ctx, id) - if err != nil { - panic(err) - } - return obj -} - -// Hooks returns the client hooks. -func (c *MixProductionTemplateClient) Hooks() []Hook { - return c.hooks.MixProductionTemplate -} - -// Interceptors returns the client interceptors. -func (c *MixProductionTemplateClient) Interceptors() []Interceptor { - return c.inters.MixProductionTemplate -} - -func (c *MixProductionTemplateClient) mutate(ctx context.Context, m *MixProductionTemplateMutation) (Value, error) { - switch m.Op() { - case OpCreate: - return (&MixProductionTemplateCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx) - case OpUpdate: - return (&MixProductionTemplateUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx) - case OpUpdateOne: - return (&MixProductionTemplateUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx) - case OpDelete, OpDeleteOne: - return (&MixProductionTemplateDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx) - default: - return nil, fmt.Errorf("ent: unknown MixProductionTemplate mutation op: %q", m.Op()) - } -} - // PermissionClient is a client for the Permission schema. type PermissionClient struct { config @@ -6989,24 +6705,24 @@ func (c *WorkpieceProcessClient) mutate(ctx context.Context, m *WorkpieceProcess type ( hooks struct { AgvPoint, AgvTask, AgvVehicleState, Alert, AlertRule, AssociationTrace, - Attachment, BackupRecord, CallPool, DailyPlan, Dock, EventLog, FlowMaterial, + Attachment, BackupRecord, CallPool, DailyPlan, Dock, EventLog, InspectionRecord, LinePoint, LossLedger, Material, MaterialQtyReport, - MaterialRequest, MixProductionTemplate, Permission, PlcSendLog, ProcessFlow, - ProcessStep, ProductBOM, ProductProcess, ProductProcessItem, - ProductProcessMaterial, Role, SemiFlow, ShortageRequest, Station, StationShift, - StationState, StepCriterion, StepData, StepSignRecord, SyncFailure, SysConfig, - TorqueRecord, TrialRecord, User, UserStation, WorkOrder, Workpiece, - WorkpieceBind, WorkpieceLifecycleLog, WorkpieceProcess []ent.Hook + MaterialRequest, Permission, PlcSendLog, ProcessFlow, ProcessStep, ProductBOM, + ProductProcess, ProductProcessItem, ProductProcessMaterial, Role, SemiFlow, + ShortageRequest, Station, StationShift, StationState, StepCriterion, StepData, + StepSignRecord, SyncFailure, SysConfig, TorqueRecord, TrialRecord, User, + UserStation, WorkOrder, Workpiece, WorkpieceBind, WorkpieceLifecycleLog, + WorkpieceProcess []ent.Hook } inters struct { AgvPoint, AgvTask, AgvVehicleState, Alert, AlertRule, AssociationTrace, - Attachment, BackupRecord, CallPool, DailyPlan, Dock, EventLog, FlowMaterial, + Attachment, BackupRecord, CallPool, DailyPlan, Dock, EventLog, InspectionRecord, LinePoint, LossLedger, Material, MaterialQtyReport, - MaterialRequest, MixProductionTemplate, Permission, PlcSendLog, ProcessFlow, - ProcessStep, ProductBOM, ProductProcess, ProductProcessItem, - ProductProcessMaterial, Role, SemiFlow, ShortageRequest, Station, StationShift, - StationState, StepCriterion, StepData, StepSignRecord, SyncFailure, SysConfig, - TorqueRecord, TrialRecord, User, UserStation, WorkOrder, Workpiece, - WorkpieceBind, WorkpieceLifecycleLog, WorkpieceProcess []ent.Interceptor + MaterialRequest, Permission, PlcSendLog, ProcessFlow, ProcessStep, ProductBOM, + ProductProcess, ProductProcessItem, ProductProcessMaterial, Role, SemiFlow, + ShortageRequest, Station, StationShift, StationState, StepCriterion, StepData, + StepSignRecord, SyncFailure, SysConfig, TorqueRecord, TrialRecord, User, + UserStation, WorkOrder, Workpiece, WorkpieceBind, WorkpieceLifecycleLog, + WorkpieceProcess []ent.Interceptor } ) diff --git a/bj_power_mes/ent/ent.go b/bj_power_mes/ent/ent.go index c435953..9272375 100644 --- a/bj_power_mes/ent/ent.go +++ b/bj_power_mes/ent/ent.go @@ -15,14 +15,12 @@ import ( "bj_power_mes/ent/dailyplan" "bj_power_mes/ent/dock" "bj_power_mes/ent/eventlog" - "bj_power_mes/ent/flowmaterial" "bj_power_mes/ent/inspectionrecord" "bj_power_mes/ent/linepoint" "bj_power_mes/ent/lossledger" "bj_power_mes/ent/material" "bj_power_mes/ent/materialqtyreport" "bj_power_mes/ent/materialrequest" - "bj_power_mes/ent/mixproductiontemplate" "bj_power_mes/ent/permission" "bj_power_mes/ent/plcsendlog" "bj_power_mes/ent/processflow" @@ -132,14 +130,12 @@ func checkColumn(t, c string) error { dailyplan.Table: dailyplan.ValidColumn, dock.Table: dock.ValidColumn, eventlog.Table: eventlog.ValidColumn, - flowmaterial.Table: flowmaterial.ValidColumn, inspectionrecord.Table: inspectionrecord.ValidColumn, linepoint.Table: linepoint.ValidColumn, lossledger.Table: lossledger.ValidColumn, material.Table: material.ValidColumn, materialqtyreport.Table: materialqtyreport.ValidColumn, materialrequest.Table: materialrequest.ValidColumn, - mixproductiontemplate.Table: mixproductiontemplate.ValidColumn, permission.Table: permission.ValidColumn, plcsendlog.Table: plcsendlog.ValidColumn, processflow.Table: processflow.ValidColumn, diff --git a/bj_power_mes/ent/flowmaterial.go b/bj_power_mes/ent/flowmaterial.go deleted file mode 100644 index 2c2a635..0000000 --- a/bj_power_mes/ent/flowmaterial.go +++ /dev/null @@ -1,196 +0,0 @@ -// 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 diff --git a/bj_power_mes/ent/flowmaterial/flowmaterial.go b/bj_power_mes/ent/flowmaterial/flowmaterial.go deleted file mode 100644 index fffa8ba..0000000 --- a/bj_power_mes/ent/flowmaterial/flowmaterial.go +++ /dev/null @@ -1,140 +0,0 @@ -// Code generated by ent, DO NOT EDIT. - -package flowmaterial - -import ( - "time" - - "entgo.io/ent/dialect/sql" -) - -const ( - // Label holds the string label denoting the flowmaterial type in the database. - Label = "flow_material" - // FieldID holds the string denoting the id field in the database. - FieldID = "id" - // FieldFlowId holds the string denoting the flowid field in the database. - FieldFlowId = "flow_id" - // 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" - // FieldSnMode holds the string denoting the snmode field in the database. - FieldSnMode = "sn_mode" - // 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" - // FieldCreatedAt holds the string denoting the createdat field in the database. - FieldCreatedAt = "created_at" - // Table holds the table name of the flowmaterial in the database. - Table = "flow_material" -) - -// Columns holds all SQL columns for flowmaterial fields. -var Columns = []string{ - FieldID, - FieldFlowId, - FieldMaterialCode, - FieldMaterialName, - FieldSpec, - FieldUnit, - FieldSnMode, - FieldUnitQty, - FieldLossRate, - 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 ( - // 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 - // DefaultSnMode holds the default value on creation for the "snMode" field. - DefaultSnMode int - // 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 - // 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 FlowMaterial 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() -} - -// ByFlowId orders the results by the flowId field. -func ByFlowId(opts ...sql.OrderTermOption) OrderOption { - return sql.OrderByField(FieldFlowId, 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() -} - -// BySnMode orders the results by the snMode field. -func BySnMode(opts ...sql.OrderTermOption) OrderOption { - return sql.OrderByField(FieldSnMode, 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() -} - -// ByCreatedAt orders the results by the createdAt field. -func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption { - return sql.OrderByField(FieldCreatedAt, opts...).ToFunc() -} diff --git a/bj_power_mes/ent/flowmaterial/where.go b/bj_power_mes/ent/flowmaterial/where.go deleted file mode 100644 index fc8d147..0000000 --- a/bj_power_mes/ent/flowmaterial/where.go +++ /dev/null @@ -1,575 +0,0 @@ -// Code generated by ent, DO NOT EDIT. - -package flowmaterial - -import ( - "bj_power_mes/ent/predicate" - "time" - - "entgo.io/ent/dialect/sql" -) - -// ID filters vertices based on their ID field. -func ID(id int) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldEQ(FieldID, id)) -} - -// IDEQ applies the EQ predicate on the ID field. -func IDEQ(id int) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldEQ(FieldID, id)) -} - -// IDNEQ applies the NEQ predicate on the ID field. -func IDNEQ(id int) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldNEQ(FieldID, id)) -} - -// IDIn applies the In predicate on the ID field. -func IDIn(ids ...int) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldIn(FieldID, ids...)) -} - -// IDNotIn applies the NotIn predicate on the ID field. -func IDNotIn(ids ...int) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldNotIn(FieldID, ids...)) -} - -// IDGT applies the GT predicate on the ID field. -func IDGT(id int) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldGT(FieldID, id)) -} - -// IDGTE applies the GTE predicate on the ID field. -func IDGTE(id int) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldGTE(FieldID, id)) -} - -// IDLT applies the LT predicate on the ID field. -func IDLT(id int) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldLT(FieldID, id)) -} - -// IDLTE applies the LTE predicate on the ID field. -func IDLTE(id int) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldLTE(FieldID, id)) -} - -// FlowId applies equality check predicate on the "flowId" field. It's identical to FlowIdEQ. -func FlowId(v int) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldEQ(FieldFlowId, v)) -} - -// MaterialCode applies equality check predicate on the "materialCode" field. It's identical to MaterialCodeEQ. -func MaterialCode(v string) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldEQ(FieldMaterialCode, v)) -} - -// MaterialName applies equality check predicate on the "materialName" field. It's identical to MaterialNameEQ. -func MaterialName(v string) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldEQ(FieldMaterialName, v)) -} - -// Spec applies equality check predicate on the "spec" field. It's identical to SpecEQ. -func Spec(v string) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldEQ(FieldSpec, v)) -} - -// Unit applies equality check predicate on the "unit" field. It's identical to UnitEQ. -func Unit(v string) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldEQ(FieldUnit, v)) -} - -// SnMode applies equality check predicate on the "snMode" field. It's identical to SnModeEQ. -func SnMode(v int) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldEQ(FieldSnMode, v)) -} - -// UnitQty applies equality check predicate on the "unitQty" field. It's identical to UnitQtyEQ. -func UnitQty(v float64) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldEQ(FieldUnitQty, v)) -} - -// LossRate applies equality check predicate on the "lossRate" field. It's identical to LossRateEQ. -func LossRate(v float64) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldEQ(FieldLossRate, v)) -} - -// CreatedAt applies equality check predicate on the "createdAt" field. It's identical to CreatedAtEQ. -func CreatedAt(v time.Time) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldEQ(FieldCreatedAt, v)) -} - -// FlowIdEQ applies the EQ predicate on the "flowId" field. -func FlowIdEQ(v int) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldEQ(FieldFlowId, v)) -} - -// FlowIdNEQ applies the NEQ predicate on the "flowId" field. -func FlowIdNEQ(v int) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldNEQ(FieldFlowId, v)) -} - -// FlowIdIn applies the In predicate on the "flowId" field. -func FlowIdIn(vs ...int) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldIn(FieldFlowId, vs...)) -} - -// FlowIdNotIn applies the NotIn predicate on the "flowId" field. -func FlowIdNotIn(vs ...int) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldNotIn(FieldFlowId, vs...)) -} - -// FlowIdGT applies the GT predicate on the "flowId" field. -func FlowIdGT(v int) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldGT(FieldFlowId, v)) -} - -// FlowIdGTE applies the GTE predicate on the "flowId" field. -func FlowIdGTE(v int) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldGTE(FieldFlowId, v)) -} - -// FlowIdLT applies the LT predicate on the "flowId" field. -func FlowIdLT(v int) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldLT(FieldFlowId, v)) -} - -// FlowIdLTE applies the LTE predicate on the "flowId" field. -func FlowIdLTE(v int) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldLTE(FieldFlowId, v)) -} - -// MaterialCodeEQ applies the EQ predicate on the "materialCode" field. -func MaterialCodeEQ(v string) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldEQ(FieldMaterialCode, v)) -} - -// MaterialCodeNEQ applies the NEQ predicate on the "materialCode" field. -func MaterialCodeNEQ(v string) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldNEQ(FieldMaterialCode, v)) -} - -// MaterialCodeIn applies the In predicate on the "materialCode" field. -func MaterialCodeIn(vs ...string) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldIn(FieldMaterialCode, vs...)) -} - -// MaterialCodeNotIn applies the NotIn predicate on the "materialCode" field. -func MaterialCodeNotIn(vs ...string) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldNotIn(FieldMaterialCode, vs...)) -} - -// MaterialCodeGT applies the GT predicate on the "materialCode" field. -func MaterialCodeGT(v string) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldGT(FieldMaterialCode, v)) -} - -// MaterialCodeGTE applies the GTE predicate on the "materialCode" field. -func MaterialCodeGTE(v string) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldGTE(FieldMaterialCode, v)) -} - -// MaterialCodeLT applies the LT predicate on the "materialCode" field. -func MaterialCodeLT(v string) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldLT(FieldMaterialCode, v)) -} - -// MaterialCodeLTE applies the LTE predicate on the "materialCode" field. -func MaterialCodeLTE(v string) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldLTE(FieldMaterialCode, v)) -} - -// MaterialCodeContains applies the Contains predicate on the "materialCode" field. -func MaterialCodeContains(v string) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldContains(FieldMaterialCode, v)) -} - -// MaterialCodeHasPrefix applies the HasPrefix predicate on the "materialCode" field. -func MaterialCodeHasPrefix(v string) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldHasPrefix(FieldMaterialCode, v)) -} - -// MaterialCodeHasSuffix applies the HasSuffix predicate on the "materialCode" field. -func MaterialCodeHasSuffix(v string) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldHasSuffix(FieldMaterialCode, v)) -} - -// MaterialCodeEqualFold applies the EqualFold predicate on the "materialCode" field. -func MaterialCodeEqualFold(v string) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldEqualFold(FieldMaterialCode, v)) -} - -// MaterialCodeContainsFold applies the ContainsFold predicate on the "materialCode" field. -func MaterialCodeContainsFold(v string) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldContainsFold(FieldMaterialCode, v)) -} - -// MaterialNameEQ applies the EQ predicate on the "materialName" field. -func MaterialNameEQ(v string) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldEQ(FieldMaterialName, v)) -} - -// MaterialNameNEQ applies the NEQ predicate on the "materialName" field. -func MaterialNameNEQ(v string) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldNEQ(FieldMaterialName, v)) -} - -// MaterialNameIn applies the In predicate on the "materialName" field. -func MaterialNameIn(vs ...string) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldIn(FieldMaterialName, vs...)) -} - -// MaterialNameNotIn applies the NotIn predicate on the "materialName" field. -func MaterialNameNotIn(vs ...string) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldNotIn(FieldMaterialName, vs...)) -} - -// MaterialNameGT applies the GT predicate on the "materialName" field. -func MaterialNameGT(v string) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldGT(FieldMaterialName, v)) -} - -// MaterialNameGTE applies the GTE predicate on the "materialName" field. -func MaterialNameGTE(v string) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldGTE(FieldMaterialName, v)) -} - -// MaterialNameLT applies the LT predicate on the "materialName" field. -func MaterialNameLT(v string) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldLT(FieldMaterialName, v)) -} - -// MaterialNameLTE applies the LTE predicate on the "materialName" field. -func MaterialNameLTE(v string) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldLTE(FieldMaterialName, v)) -} - -// MaterialNameContains applies the Contains predicate on the "materialName" field. -func MaterialNameContains(v string) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldContains(FieldMaterialName, v)) -} - -// MaterialNameHasPrefix applies the HasPrefix predicate on the "materialName" field. -func MaterialNameHasPrefix(v string) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldHasPrefix(FieldMaterialName, v)) -} - -// MaterialNameHasSuffix applies the HasSuffix predicate on the "materialName" field. -func MaterialNameHasSuffix(v string) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldHasSuffix(FieldMaterialName, v)) -} - -// MaterialNameEqualFold applies the EqualFold predicate on the "materialName" field. -func MaterialNameEqualFold(v string) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldEqualFold(FieldMaterialName, v)) -} - -// MaterialNameContainsFold applies the ContainsFold predicate on the "materialName" field. -func MaterialNameContainsFold(v string) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldContainsFold(FieldMaterialName, v)) -} - -// SpecEQ applies the EQ predicate on the "spec" field. -func SpecEQ(v string) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldEQ(FieldSpec, v)) -} - -// SpecNEQ applies the NEQ predicate on the "spec" field. -func SpecNEQ(v string) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldNEQ(FieldSpec, v)) -} - -// SpecIn applies the In predicate on the "spec" field. -func SpecIn(vs ...string) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldIn(FieldSpec, vs...)) -} - -// SpecNotIn applies the NotIn predicate on the "spec" field. -func SpecNotIn(vs ...string) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldNotIn(FieldSpec, vs...)) -} - -// SpecGT applies the GT predicate on the "spec" field. -func SpecGT(v string) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldGT(FieldSpec, v)) -} - -// SpecGTE applies the GTE predicate on the "spec" field. -func SpecGTE(v string) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldGTE(FieldSpec, v)) -} - -// SpecLT applies the LT predicate on the "spec" field. -func SpecLT(v string) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldLT(FieldSpec, v)) -} - -// SpecLTE applies the LTE predicate on the "spec" field. -func SpecLTE(v string) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldLTE(FieldSpec, v)) -} - -// SpecContains applies the Contains predicate on the "spec" field. -func SpecContains(v string) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldContains(FieldSpec, v)) -} - -// SpecHasPrefix applies the HasPrefix predicate on the "spec" field. -func SpecHasPrefix(v string) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldHasPrefix(FieldSpec, v)) -} - -// SpecHasSuffix applies the HasSuffix predicate on the "spec" field. -func SpecHasSuffix(v string) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldHasSuffix(FieldSpec, v)) -} - -// SpecEqualFold applies the EqualFold predicate on the "spec" field. -func SpecEqualFold(v string) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldEqualFold(FieldSpec, v)) -} - -// SpecContainsFold applies the ContainsFold predicate on the "spec" field. -func SpecContainsFold(v string) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldContainsFold(FieldSpec, v)) -} - -// UnitEQ applies the EQ predicate on the "unit" field. -func UnitEQ(v string) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldEQ(FieldUnit, v)) -} - -// UnitNEQ applies the NEQ predicate on the "unit" field. -func UnitNEQ(v string) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldNEQ(FieldUnit, v)) -} - -// UnitIn applies the In predicate on the "unit" field. -func UnitIn(vs ...string) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldIn(FieldUnit, vs...)) -} - -// UnitNotIn applies the NotIn predicate on the "unit" field. -func UnitNotIn(vs ...string) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldNotIn(FieldUnit, vs...)) -} - -// UnitGT applies the GT predicate on the "unit" field. -func UnitGT(v string) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldGT(FieldUnit, v)) -} - -// UnitGTE applies the GTE predicate on the "unit" field. -func UnitGTE(v string) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldGTE(FieldUnit, v)) -} - -// UnitLT applies the LT predicate on the "unit" field. -func UnitLT(v string) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldLT(FieldUnit, v)) -} - -// UnitLTE applies the LTE predicate on the "unit" field. -func UnitLTE(v string) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldLTE(FieldUnit, v)) -} - -// UnitContains applies the Contains predicate on the "unit" field. -func UnitContains(v string) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldContains(FieldUnit, v)) -} - -// UnitHasPrefix applies the HasPrefix predicate on the "unit" field. -func UnitHasPrefix(v string) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldHasPrefix(FieldUnit, v)) -} - -// UnitHasSuffix applies the HasSuffix predicate on the "unit" field. -func UnitHasSuffix(v string) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldHasSuffix(FieldUnit, v)) -} - -// UnitEqualFold applies the EqualFold predicate on the "unit" field. -func UnitEqualFold(v string) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldEqualFold(FieldUnit, v)) -} - -// UnitContainsFold applies the ContainsFold predicate on the "unit" field. -func UnitContainsFold(v string) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldContainsFold(FieldUnit, v)) -} - -// SnModeEQ applies the EQ predicate on the "snMode" field. -func SnModeEQ(v int) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldEQ(FieldSnMode, v)) -} - -// SnModeNEQ applies the NEQ predicate on the "snMode" field. -func SnModeNEQ(v int) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldNEQ(FieldSnMode, v)) -} - -// SnModeIn applies the In predicate on the "snMode" field. -func SnModeIn(vs ...int) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldIn(FieldSnMode, vs...)) -} - -// SnModeNotIn applies the NotIn predicate on the "snMode" field. -func SnModeNotIn(vs ...int) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldNotIn(FieldSnMode, vs...)) -} - -// SnModeGT applies the GT predicate on the "snMode" field. -func SnModeGT(v int) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldGT(FieldSnMode, v)) -} - -// SnModeGTE applies the GTE predicate on the "snMode" field. -func SnModeGTE(v int) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldGTE(FieldSnMode, v)) -} - -// SnModeLT applies the LT predicate on the "snMode" field. -func SnModeLT(v int) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldLT(FieldSnMode, v)) -} - -// SnModeLTE applies the LTE predicate on the "snMode" field. -func SnModeLTE(v int) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldLTE(FieldSnMode, v)) -} - -// UnitQtyEQ applies the EQ predicate on the "unitQty" field. -func UnitQtyEQ(v float64) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldEQ(FieldUnitQty, v)) -} - -// UnitQtyNEQ applies the NEQ predicate on the "unitQty" field. -func UnitQtyNEQ(v float64) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldNEQ(FieldUnitQty, v)) -} - -// UnitQtyIn applies the In predicate on the "unitQty" field. -func UnitQtyIn(vs ...float64) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldIn(FieldUnitQty, vs...)) -} - -// UnitQtyNotIn applies the NotIn predicate on the "unitQty" field. -func UnitQtyNotIn(vs ...float64) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldNotIn(FieldUnitQty, vs...)) -} - -// UnitQtyGT applies the GT predicate on the "unitQty" field. -func UnitQtyGT(v float64) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldGT(FieldUnitQty, v)) -} - -// UnitQtyGTE applies the GTE predicate on the "unitQty" field. -func UnitQtyGTE(v float64) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldGTE(FieldUnitQty, v)) -} - -// UnitQtyLT applies the LT predicate on the "unitQty" field. -func UnitQtyLT(v float64) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldLT(FieldUnitQty, v)) -} - -// UnitQtyLTE applies the LTE predicate on the "unitQty" field. -func UnitQtyLTE(v float64) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldLTE(FieldUnitQty, v)) -} - -// LossRateEQ applies the EQ predicate on the "lossRate" field. -func LossRateEQ(v float64) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldEQ(FieldLossRate, v)) -} - -// LossRateNEQ applies the NEQ predicate on the "lossRate" field. -func LossRateNEQ(v float64) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldNEQ(FieldLossRate, v)) -} - -// LossRateIn applies the In predicate on the "lossRate" field. -func LossRateIn(vs ...float64) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldIn(FieldLossRate, vs...)) -} - -// LossRateNotIn applies the NotIn predicate on the "lossRate" field. -func LossRateNotIn(vs ...float64) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldNotIn(FieldLossRate, vs...)) -} - -// LossRateGT applies the GT predicate on the "lossRate" field. -func LossRateGT(v float64) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldGT(FieldLossRate, v)) -} - -// LossRateGTE applies the GTE predicate on the "lossRate" field. -func LossRateGTE(v float64) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldGTE(FieldLossRate, v)) -} - -// LossRateLT applies the LT predicate on the "lossRate" field. -func LossRateLT(v float64) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldLT(FieldLossRate, v)) -} - -// LossRateLTE applies the LTE predicate on the "lossRate" field. -func LossRateLTE(v float64) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldLTE(FieldLossRate, v)) -} - -// CreatedAtEQ applies the EQ predicate on the "createdAt" field. -func CreatedAtEQ(v time.Time) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldEQ(FieldCreatedAt, v)) -} - -// CreatedAtNEQ applies the NEQ predicate on the "createdAt" field. -func CreatedAtNEQ(v time.Time) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldNEQ(FieldCreatedAt, v)) -} - -// CreatedAtIn applies the In predicate on the "createdAt" field. -func CreatedAtIn(vs ...time.Time) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldIn(FieldCreatedAt, vs...)) -} - -// CreatedAtNotIn applies the NotIn predicate on the "createdAt" field. -func CreatedAtNotIn(vs ...time.Time) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldNotIn(FieldCreatedAt, vs...)) -} - -// CreatedAtGT applies the GT predicate on the "createdAt" field. -func CreatedAtGT(v time.Time) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldGT(FieldCreatedAt, v)) -} - -// CreatedAtGTE applies the GTE predicate on the "createdAt" field. -func CreatedAtGTE(v time.Time) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldGTE(FieldCreatedAt, v)) -} - -// CreatedAtLT applies the LT predicate on the "createdAt" field. -func CreatedAtLT(v time.Time) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldLT(FieldCreatedAt, v)) -} - -// CreatedAtLTE applies the LTE predicate on the "createdAt" field. -func CreatedAtLTE(v time.Time) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.FieldLTE(FieldCreatedAt, v)) -} - -// And groups predicates with the AND operator between them. -func And(predicates ...predicate.FlowMaterial) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.AndPredicates(predicates...)) -} - -// Or groups predicates with the OR operator between them. -func Or(predicates ...predicate.FlowMaterial) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.OrPredicates(predicates...)) -} - -// Not applies the not operator on the given predicate. -func Not(p predicate.FlowMaterial) predicate.FlowMaterial { - return predicate.FlowMaterial(sql.NotPredicates(p)) -} diff --git a/bj_power_mes/ent/flowmaterial_create.go b/bj_power_mes/ent/flowmaterial_create.go deleted file mode 100644 index cab7e45..0000000 --- a/bj_power_mes/ent/flowmaterial_create.go +++ /dev/null @@ -1,415 +0,0 @@ -// Code generated by ent, DO NOT EDIT. - -package ent - -import ( - "bj_power_mes/ent/flowmaterial" - "context" - "errors" - "fmt" - "time" - - "entgo.io/ent/dialect/sql/sqlgraph" - "entgo.io/ent/schema/field" -) - -// FlowMaterialCreate is the builder for creating a FlowMaterial entity. -type FlowMaterialCreate struct { - config - mutation *FlowMaterialMutation - hooks []Hook -} - -// SetFlowId sets the "flowId" field. -func (_c *FlowMaterialCreate) SetFlowId(v int) *FlowMaterialCreate { - _c.mutation.SetFlowId(v) - return _c -} - -// SetMaterialCode sets the "materialCode" field. -func (_c *FlowMaterialCreate) SetMaterialCode(v string) *FlowMaterialCreate { - _c.mutation.SetMaterialCode(v) - return _c -} - -// SetMaterialName sets the "materialName" field. -func (_c *FlowMaterialCreate) SetMaterialName(v string) *FlowMaterialCreate { - _c.mutation.SetMaterialName(v) - return _c -} - -// SetNillableMaterialName sets the "materialName" field if the given value is not nil. -func (_c *FlowMaterialCreate) SetNillableMaterialName(v *string) *FlowMaterialCreate { - if v != nil { - _c.SetMaterialName(*v) - } - return _c -} - -// SetSpec sets the "spec" field. -func (_c *FlowMaterialCreate) SetSpec(v string) *FlowMaterialCreate { - _c.mutation.SetSpec(v) - return _c -} - -// SetNillableSpec sets the "spec" field if the given value is not nil. -func (_c *FlowMaterialCreate) SetNillableSpec(v *string) *FlowMaterialCreate { - if v != nil { - _c.SetSpec(*v) - } - return _c -} - -// SetUnit sets the "unit" field. -func (_c *FlowMaterialCreate) SetUnit(v string) *FlowMaterialCreate { - _c.mutation.SetUnit(v) - return _c -} - -// SetNillableUnit sets the "unit" field if the given value is not nil. -func (_c *FlowMaterialCreate) SetNillableUnit(v *string) *FlowMaterialCreate { - if v != nil { - _c.SetUnit(*v) - } - return _c -} - -// SetSnMode sets the "snMode" field. -func (_c *FlowMaterialCreate) SetSnMode(v int) *FlowMaterialCreate { - _c.mutation.SetSnMode(v) - return _c -} - -// SetNillableSnMode sets the "snMode" field if the given value is not nil. -func (_c *FlowMaterialCreate) SetNillableSnMode(v *int) *FlowMaterialCreate { - if v != nil { - _c.SetSnMode(*v) - } - return _c -} - -// SetUnitQty sets the "unitQty" field. -func (_c *FlowMaterialCreate) SetUnitQty(v float64) *FlowMaterialCreate { - _c.mutation.SetUnitQty(v) - return _c -} - -// SetNillableUnitQty sets the "unitQty" field if the given value is not nil. -func (_c *FlowMaterialCreate) SetNillableUnitQty(v *float64) *FlowMaterialCreate { - if v != nil { - _c.SetUnitQty(*v) - } - return _c -} - -// SetLossRate sets the "lossRate" field. -func (_c *FlowMaterialCreate) SetLossRate(v float64) *FlowMaterialCreate { - _c.mutation.SetLossRate(v) - return _c -} - -// SetNillableLossRate sets the "lossRate" field if the given value is not nil. -func (_c *FlowMaterialCreate) SetNillableLossRate(v *float64) *FlowMaterialCreate { - if v != nil { - _c.SetLossRate(*v) - } - return _c -} - -// SetCreatedAt sets the "createdAt" field. -func (_c *FlowMaterialCreate) SetCreatedAt(v time.Time) *FlowMaterialCreate { - _c.mutation.SetCreatedAt(v) - return _c -} - -// SetNillableCreatedAt sets the "createdAt" field if the given value is not nil. -func (_c *FlowMaterialCreate) SetNillableCreatedAt(v *time.Time) *FlowMaterialCreate { - if v != nil { - _c.SetCreatedAt(*v) - } - return _c -} - -// SetID sets the "id" field. -func (_c *FlowMaterialCreate) SetID(v int) *FlowMaterialCreate { - _c.mutation.SetID(v) - return _c -} - -// Mutation returns the FlowMaterialMutation object of the builder. -func (_c *FlowMaterialCreate) Mutation() *FlowMaterialMutation { - return _c.mutation -} - -// Save creates the FlowMaterial in the database. -func (_c *FlowMaterialCreate) Save(ctx context.Context) (*FlowMaterial, error) { - _c.defaults() - return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks) -} - -// SaveX calls Save and panics if Save returns an error. -func (_c *FlowMaterialCreate) SaveX(ctx context.Context) *FlowMaterial { - v, err := _c.Save(ctx) - if err != nil { - panic(err) - } - return v -} - -// Exec executes the query. -func (_c *FlowMaterialCreate) Exec(ctx context.Context) error { - _, err := _c.Save(ctx) - return err -} - -// ExecX is like Exec, but panics if an error occurs. -func (_c *FlowMaterialCreate) ExecX(ctx context.Context) { - if err := _c.Exec(ctx); err != nil { - panic(err) - } -} - -// defaults sets the default values of the builder before save. -func (_c *FlowMaterialCreate) defaults() { - if _, ok := _c.mutation.MaterialName(); !ok { - v := flowmaterial.DefaultMaterialName - _c.mutation.SetMaterialName(v) - } - if _, ok := _c.mutation.Spec(); !ok { - v := flowmaterial.DefaultSpec - _c.mutation.SetSpec(v) - } - if _, ok := _c.mutation.Unit(); !ok { - v := flowmaterial.DefaultUnit - _c.mutation.SetUnit(v) - } - if _, ok := _c.mutation.SnMode(); !ok { - v := flowmaterial.DefaultSnMode - _c.mutation.SetSnMode(v) - } - if _, ok := _c.mutation.UnitQty(); !ok { - v := flowmaterial.DefaultUnitQty - _c.mutation.SetUnitQty(v) - } - if _, ok := _c.mutation.LossRate(); !ok { - v := flowmaterial.DefaultLossRate - _c.mutation.SetLossRate(v) - } - if _, ok := _c.mutation.CreatedAt(); !ok { - v := flowmaterial.DefaultCreatedAt() - _c.mutation.SetCreatedAt(v) - } -} - -// check runs all checks and user-defined validators on the builder. -func (_c *FlowMaterialCreate) check() error { - if _, ok := _c.mutation.FlowId(); !ok { - return &ValidationError{Name: "flowId", err: errors.New(`ent: missing required field "FlowMaterial.flowId"`)} - } - if _, ok := _c.mutation.MaterialCode(); !ok { - return &ValidationError{Name: "materialCode", err: errors.New(`ent: missing required field "FlowMaterial.materialCode"`)} - } - if v, ok := _c.mutation.MaterialCode(); ok { - if err := flowmaterial.MaterialCodeValidator(v); err != nil { - return &ValidationError{Name: "materialCode", err: fmt.Errorf(`ent: validator failed for field "FlowMaterial.materialCode": %w`, err)} - } - } - if _, ok := _c.mutation.MaterialName(); !ok { - return &ValidationError{Name: "materialName", err: errors.New(`ent: missing required field "FlowMaterial.materialName"`)} - } - if v, ok := _c.mutation.MaterialName(); ok { - if err := flowmaterial.MaterialNameValidator(v); err != nil { - return &ValidationError{Name: "materialName", err: fmt.Errorf(`ent: validator failed for field "FlowMaterial.materialName": %w`, err)} - } - } - if _, ok := _c.mutation.Spec(); !ok { - return &ValidationError{Name: "spec", err: errors.New(`ent: missing required field "FlowMaterial.spec"`)} - } - if v, ok := _c.mutation.Spec(); ok { - if err := flowmaterial.SpecValidator(v); err != nil { - return &ValidationError{Name: "spec", err: fmt.Errorf(`ent: validator failed for field "FlowMaterial.spec": %w`, err)} - } - } - if _, ok := _c.mutation.Unit(); !ok { - return &ValidationError{Name: "unit", err: errors.New(`ent: missing required field "FlowMaterial.unit"`)} - } - if v, ok := _c.mutation.Unit(); ok { - if err := flowmaterial.UnitValidator(v); err != nil { - return &ValidationError{Name: "unit", err: fmt.Errorf(`ent: validator failed for field "FlowMaterial.unit": %w`, err)} - } - } - if _, ok := _c.mutation.SnMode(); !ok { - return &ValidationError{Name: "snMode", err: errors.New(`ent: missing required field "FlowMaterial.snMode"`)} - } - if _, ok := _c.mutation.UnitQty(); !ok { - return &ValidationError{Name: "unitQty", err: errors.New(`ent: missing required field "FlowMaterial.unitQty"`)} - } - if _, ok := _c.mutation.LossRate(); !ok { - return &ValidationError{Name: "lossRate", err: errors.New(`ent: missing required field "FlowMaterial.lossRate"`)} - } - if _, ok := _c.mutation.CreatedAt(); !ok { - return &ValidationError{Name: "createdAt", err: errors.New(`ent: missing required field "FlowMaterial.createdAt"`)} - } - if v, ok := _c.mutation.ID(); ok { - if err := flowmaterial.IDValidator(v); err != nil { - return &ValidationError{Name: "id", err: fmt.Errorf(`ent: validator failed for field "FlowMaterial.id": %w`, err)} - } - } - return nil -} - -func (_c *FlowMaterialCreate) sqlSave(ctx context.Context) (*FlowMaterial, error) { - if err := _c.check(); err != nil { - return nil, err - } - _node, _spec := _c.createSpec() - if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil { - if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{msg: err.Error(), wrap: err} - } - return nil, err - } - if _spec.ID.Value != _node.ID { - id := _spec.ID.Value.(int64) - _node.ID = int(id) - } - _c.mutation.id = &_node.ID - _c.mutation.done = true - return _node, nil -} - -func (_c *FlowMaterialCreate) createSpec() (*FlowMaterial, *sqlgraph.CreateSpec) { - var ( - _node = &FlowMaterial{config: _c.config} - _spec = sqlgraph.NewCreateSpec(flowmaterial.Table, sqlgraph.NewFieldSpec(flowmaterial.FieldID, field.TypeInt)) - ) - if id, ok := _c.mutation.ID(); ok { - _node.ID = id - _spec.ID.Value = id - } - if value, ok := _c.mutation.FlowId(); ok { - _spec.SetField(flowmaterial.FieldFlowId, field.TypeInt, value) - _node.FlowId = value - } - if value, ok := _c.mutation.MaterialCode(); ok { - _spec.SetField(flowmaterial.FieldMaterialCode, field.TypeString, value) - _node.MaterialCode = value - } - if value, ok := _c.mutation.MaterialName(); ok { - _spec.SetField(flowmaterial.FieldMaterialName, field.TypeString, value) - _node.MaterialName = value - } - if value, ok := _c.mutation.Spec(); ok { - _spec.SetField(flowmaterial.FieldSpec, field.TypeString, value) - _node.Spec = value - } - if value, ok := _c.mutation.Unit(); ok { - _spec.SetField(flowmaterial.FieldUnit, field.TypeString, value) - _node.Unit = value - } - if value, ok := _c.mutation.SnMode(); ok { - _spec.SetField(flowmaterial.FieldSnMode, field.TypeInt, value) - _node.SnMode = value - } - if value, ok := _c.mutation.UnitQty(); ok { - _spec.SetField(flowmaterial.FieldUnitQty, field.TypeFloat64, value) - _node.UnitQty = value - } - if value, ok := _c.mutation.LossRate(); ok { - _spec.SetField(flowmaterial.FieldLossRate, field.TypeFloat64, value) - _node.LossRate = value - } - if value, ok := _c.mutation.CreatedAt(); ok { - _spec.SetField(flowmaterial.FieldCreatedAt, field.TypeTime, value) - _node.CreatedAt = value - } - return _node, _spec -} - -// FlowMaterialCreateBulk is the builder for creating many FlowMaterial entities in bulk. -type FlowMaterialCreateBulk struct { - config - err error - builders []*FlowMaterialCreate -} - -// Save creates the FlowMaterial entities in the database. -func (_c *FlowMaterialCreateBulk) Save(ctx context.Context) ([]*FlowMaterial, error) { - if _c.err != nil { - return nil, _c.err - } - specs := make([]*sqlgraph.CreateSpec, len(_c.builders)) - nodes := make([]*FlowMaterial, len(_c.builders)) - mutators := make([]Mutator, len(_c.builders)) - for i := range _c.builders { - func(i int, root context.Context) { - builder := _c.builders[i] - builder.defaults() - var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { - mutation, ok := m.(*FlowMaterialMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T", m) - } - if err := builder.check(); err != nil { - return nil, err - } - builder.mutation = mutation - var err error - nodes[i], specs[i] = builder.createSpec() - if i < len(mutators)-1 { - _, err = mutators[i+1].Mutate(root, _c.builders[i+1].mutation) - } else { - spec := &sqlgraph.BatchCreateSpec{Nodes: specs} - // Invoke the actual operation on the latest mutation in the chain. - if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil { - if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{msg: err.Error(), wrap: err} - } - } - } - if err != nil { - return nil, err - } - mutation.id = &nodes[i].ID - if specs[i].ID.Value != nil && nodes[i].ID == 0 { - id := specs[i].ID.Value.(int64) - nodes[i].ID = int(id) - } - mutation.done = true - return nodes[i], nil - }) - for i := len(builder.hooks) - 1; i >= 0; i-- { - mut = builder.hooks[i](mut) - } - mutators[i] = mut - }(i, ctx) - } - if len(mutators) > 0 { - if _, err := mutators[0].Mutate(ctx, _c.builders[0].mutation); err != nil { - return nil, err - } - } - return nodes, nil -} - -// SaveX is like Save, but panics if an error occurs. -func (_c *FlowMaterialCreateBulk) SaveX(ctx context.Context) []*FlowMaterial { - v, err := _c.Save(ctx) - if err != nil { - panic(err) - } - return v -} - -// Exec executes the query. -func (_c *FlowMaterialCreateBulk) Exec(ctx context.Context) error { - _, err := _c.Save(ctx) - return err -} - -// ExecX is like Exec, but panics if an error occurs. -func (_c *FlowMaterialCreateBulk) ExecX(ctx context.Context) { - if err := _c.Exec(ctx); err != nil { - panic(err) - } -} diff --git a/bj_power_mes/ent/flowmaterial_delete.go b/bj_power_mes/ent/flowmaterial_delete.go deleted file mode 100644 index 4325186..0000000 --- a/bj_power_mes/ent/flowmaterial_delete.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by ent, DO NOT EDIT. - -package ent - -import ( - "bj_power_mes/ent/flowmaterial" - "bj_power_mes/ent/predicate" - "context" - - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" - "entgo.io/ent/schema/field" -) - -// FlowMaterialDelete is the builder for deleting a FlowMaterial entity. -type FlowMaterialDelete struct { - config - hooks []Hook - mutation *FlowMaterialMutation -} - -// Where appends a list predicates to the FlowMaterialDelete builder. -func (_d *FlowMaterialDelete) Where(ps ...predicate.FlowMaterial) *FlowMaterialDelete { - _d.mutation.Where(ps...) - return _d -} - -// Exec executes the deletion query and returns how many vertices were deleted. -func (_d *FlowMaterialDelete) Exec(ctx context.Context) (int, error) { - return withHooks(ctx, _d.sqlExec, _d.mutation, _d.hooks) -} - -// ExecX is like Exec, but panics if an error occurs. -func (_d *FlowMaterialDelete) ExecX(ctx context.Context) int { - n, err := _d.Exec(ctx) - if err != nil { - panic(err) - } - return n -} - -func (_d *FlowMaterialDelete) sqlExec(ctx context.Context) (int, error) { - _spec := sqlgraph.NewDeleteSpec(flowmaterial.Table, sqlgraph.NewFieldSpec(flowmaterial.FieldID, field.TypeInt)) - if ps := _d.mutation.predicates; len(ps) > 0 { - _spec.Predicate = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - affected, err := sqlgraph.DeleteNodes(ctx, _d.driver, _spec) - if err != nil && sqlgraph.IsConstraintError(err) { - err = &ConstraintError{msg: err.Error(), wrap: err} - } - _d.mutation.done = true - return affected, err -} - -// FlowMaterialDeleteOne is the builder for deleting a single FlowMaterial entity. -type FlowMaterialDeleteOne struct { - _d *FlowMaterialDelete -} - -// Where appends a list predicates to the FlowMaterialDelete builder. -func (_d *FlowMaterialDeleteOne) Where(ps ...predicate.FlowMaterial) *FlowMaterialDeleteOne { - _d._d.mutation.Where(ps...) - return _d -} - -// Exec executes the deletion query. -func (_d *FlowMaterialDeleteOne) Exec(ctx context.Context) error { - n, err := _d._d.Exec(ctx) - switch { - case err != nil: - return err - case n == 0: - return &NotFoundError{flowmaterial.Label} - default: - return nil - } -} - -// ExecX is like Exec, but panics if an error occurs. -func (_d *FlowMaterialDeleteOne) ExecX(ctx context.Context) { - if err := _d.Exec(ctx); err != nil { - panic(err) - } -} diff --git a/bj_power_mes/ent/flowmaterial_query.go b/bj_power_mes/ent/flowmaterial_query.go deleted file mode 100644 index b5cc1af..0000000 --- a/bj_power_mes/ent/flowmaterial_query.go +++ /dev/null @@ -1,577 +0,0 @@ -// Code generated by ent, DO NOT EDIT. - -package ent - -import ( - "bj_power_mes/ent/flowmaterial" - "bj_power_mes/ent/predicate" - "context" - "fmt" - "math" - - "entgo.io/ent" - "entgo.io/ent/dialect" - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" - "entgo.io/ent/schema/field" -) - -// FlowMaterialQuery is the builder for querying FlowMaterial entities. -type FlowMaterialQuery struct { - config - ctx *QueryContext - order []flowmaterial.OrderOption - inters []Interceptor - predicates []predicate.FlowMaterial - modifiers []func(*sql.Selector) - // intermediate query (i.e. traversal path). - sql *sql.Selector - path func(context.Context) (*sql.Selector, error) -} - -// Where adds a new predicate for the FlowMaterialQuery builder. -func (_q *FlowMaterialQuery) Where(ps ...predicate.FlowMaterial) *FlowMaterialQuery { - _q.predicates = append(_q.predicates, ps...) - return _q -} - -// Limit the number of records to be returned by this query. -func (_q *FlowMaterialQuery) Limit(limit int) *FlowMaterialQuery { - _q.ctx.Limit = &limit - return _q -} - -// Offset to start from. -func (_q *FlowMaterialQuery) Offset(offset int) *FlowMaterialQuery { - _q.ctx.Offset = &offset - return _q -} - -// Unique configures the query builder to filter duplicate records on query. -// By default, unique is set to true, and can be disabled using this method. -func (_q *FlowMaterialQuery) Unique(unique bool) *FlowMaterialQuery { - _q.ctx.Unique = &unique - return _q -} - -// Order specifies how the records should be ordered. -func (_q *FlowMaterialQuery) Order(o ...flowmaterial.OrderOption) *FlowMaterialQuery { - _q.order = append(_q.order, o...) - return _q -} - -// First returns the first FlowMaterial entity from the query. -// Returns a *NotFoundError when no FlowMaterial was found. -func (_q *FlowMaterialQuery) First(ctx context.Context) (*FlowMaterial, error) { - nodes, err := _q.Limit(1).All(setContextOp(ctx, _q.ctx, ent.OpQueryFirst)) - if err != nil { - return nil, err - } - if len(nodes) == 0 { - return nil, &NotFoundError{flowmaterial.Label} - } - return nodes[0], nil -} - -// FirstX is like First, but panics if an error occurs. -func (_q *FlowMaterialQuery) FirstX(ctx context.Context) *FlowMaterial { - node, err := _q.First(ctx) - if err != nil && !IsNotFound(err) { - panic(err) - } - return node -} - -// FirstID returns the first FlowMaterial ID from the query. -// Returns a *NotFoundError when no FlowMaterial ID was found. -func (_q *FlowMaterialQuery) FirstID(ctx context.Context) (id int, err error) { - var ids []int - if ids, err = _q.Limit(1).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryFirstID)); err != nil { - return - } - if len(ids) == 0 { - err = &NotFoundError{flowmaterial.Label} - return - } - return ids[0], nil -} - -// FirstIDX is like FirstID, but panics if an error occurs. -func (_q *FlowMaterialQuery) FirstIDX(ctx context.Context) int { - id, err := _q.FirstID(ctx) - if err != nil && !IsNotFound(err) { - panic(err) - } - return id -} - -// Only returns a single FlowMaterial entity found by the query, ensuring it only returns one. -// Returns a *NotSingularError when more than one FlowMaterial entity is found. -// Returns a *NotFoundError when no FlowMaterial entities are found. -func (_q *FlowMaterialQuery) Only(ctx context.Context) (*FlowMaterial, error) { - nodes, err := _q.Limit(2).All(setContextOp(ctx, _q.ctx, ent.OpQueryOnly)) - if err != nil { - return nil, err - } - switch len(nodes) { - case 1: - return nodes[0], nil - case 0: - return nil, &NotFoundError{flowmaterial.Label} - default: - return nil, &NotSingularError{flowmaterial.Label} - } -} - -// OnlyX is like Only, but panics if an error occurs. -func (_q *FlowMaterialQuery) OnlyX(ctx context.Context) *FlowMaterial { - node, err := _q.Only(ctx) - if err != nil { - panic(err) - } - return node -} - -// OnlyID is like Only, but returns the only FlowMaterial ID in the query. -// Returns a *NotSingularError when more than one FlowMaterial ID is found. -// Returns a *NotFoundError when no entities are found. -func (_q *FlowMaterialQuery) OnlyID(ctx context.Context) (id int, err error) { - var ids []int - if ids, err = _q.Limit(2).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryOnlyID)); err != nil { - return - } - switch len(ids) { - case 1: - id = ids[0] - case 0: - err = &NotFoundError{flowmaterial.Label} - default: - err = &NotSingularError{flowmaterial.Label} - } - return -} - -// OnlyIDX is like OnlyID, but panics if an error occurs. -func (_q *FlowMaterialQuery) OnlyIDX(ctx context.Context) int { - id, err := _q.OnlyID(ctx) - if err != nil { - panic(err) - } - return id -} - -// All executes the query and returns a list of FlowMaterials. -func (_q *FlowMaterialQuery) All(ctx context.Context) ([]*FlowMaterial, error) { - ctx = setContextOp(ctx, _q.ctx, ent.OpQueryAll) - if err := _q.prepareQuery(ctx); err != nil { - return nil, err - } - qr := querierAll[[]*FlowMaterial, *FlowMaterialQuery]() - return withInterceptors[[]*FlowMaterial](ctx, _q, qr, _q.inters) -} - -// AllX is like All, but panics if an error occurs. -func (_q *FlowMaterialQuery) AllX(ctx context.Context) []*FlowMaterial { - nodes, err := _q.All(ctx) - if err != nil { - panic(err) - } - return nodes -} - -// IDs executes the query and returns a list of FlowMaterial IDs. -func (_q *FlowMaterialQuery) IDs(ctx context.Context) (ids []int, err error) { - if _q.ctx.Unique == nil && _q.path != nil { - _q.Unique(true) - } - ctx = setContextOp(ctx, _q.ctx, ent.OpQueryIDs) - if err = _q.Select(flowmaterial.FieldID).Scan(ctx, &ids); err != nil { - return nil, err - } - return ids, nil -} - -// IDsX is like IDs, but panics if an error occurs. -func (_q *FlowMaterialQuery) IDsX(ctx context.Context) []int { - ids, err := _q.IDs(ctx) - if err != nil { - panic(err) - } - return ids -} - -// Count returns the count of the given query. -func (_q *FlowMaterialQuery) Count(ctx context.Context) (int, error) { - ctx = setContextOp(ctx, _q.ctx, ent.OpQueryCount) - if err := _q.prepareQuery(ctx); err != nil { - return 0, err - } - return withInterceptors[int](ctx, _q, querierCount[*FlowMaterialQuery](), _q.inters) -} - -// CountX is like Count, but panics if an error occurs. -func (_q *FlowMaterialQuery) CountX(ctx context.Context) int { - count, err := _q.Count(ctx) - if err != nil { - panic(err) - } - return count -} - -// Exist returns true if the query has elements in the graph. -func (_q *FlowMaterialQuery) Exist(ctx context.Context) (bool, error) { - ctx = setContextOp(ctx, _q.ctx, ent.OpQueryExist) - switch _, err := _q.FirstID(ctx); { - case IsNotFound(err): - return false, nil - case err != nil: - return false, fmt.Errorf("ent: check existence: %w", err) - default: - return true, nil - } -} - -// ExistX is like Exist, but panics if an error occurs. -func (_q *FlowMaterialQuery) ExistX(ctx context.Context) bool { - exist, err := _q.Exist(ctx) - if err != nil { - panic(err) - } - return exist -} - -// Clone returns a duplicate of the FlowMaterialQuery builder, including all associated steps. It can be -// used to prepare common query builders and use them differently after the clone is made. -func (_q *FlowMaterialQuery) Clone() *FlowMaterialQuery { - if _q == nil { - return nil - } - return &FlowMaterialQuery{ - config: _q.config, - ctx: _q.ctx.Clone(), - order: append([]flowmaterial.OrderOption{}, _q.order...), - inters: append([]Interceptor{}, _q.inters...), - predicates: append([]predicate.FlowMaterial{}, _q.predicates...), - // clone intermediate query. - sql: _q.sql.Clone(), - path: _q.path, - modifiers: append([]func(*sql.Selector){}, _q.modifiers...), - } -} - -// GroupBy is used to group vertices by one or more fields/columns. -// It is often used with aggregate functions, like: count, max, mean, min, sum. -// -// Example: -// -// var v []struct { -// FlowId int `json:"flowId,omitempty"` -// Count int `json:"count,omitempty"` -// } -// -// client.FlowMaterial.Query(). -// GroupBy(flowmaterial.FieldFlowId). -// Aggregate(ent.Count()). -// Scan(ctx, &v) -func (_q *FlowMaterialQuery) GroupBy(field string, fields ...string) *FlowMaterialGroupBy { - _q.ctx.Fields = append([]string{field}, fields...) - grbuild := &FlowMaterialGroupBy{build: _q} - grbuild.flds = &_q.ctx.Fields - grbuild.label = flowmaterial.Label - grbuild.scan = grbuild.Scan - return grbuild -} - -// Select allows the selection one or more fields/columns for the given query, -// instead of selecting all fields in the entity. -// -// Example: -// -// var v []struct { -// FlowId int `json:"flowId,omitempty"` -// } -// -// client.FlowMaterial.Query(). -// Select(flowmaterial.FieldFlowId). -// Scan(ctx, &v) -func (_q *FlowMaterialQuery) Select(fields ...string) *FlowMaterialSelect { - _q.ctx.Fields = append(_q.ctx.Fields, fields...) - sbuild := &FlowMaterialSelect{FlowMaterialQuery: _q} - sbuild.label = flowmaterial.Label - sbuild.flds, sbuild.scan = &_q.ctx.Fields, sbuild.Scan - return sbuild -} - -// Aggregate returns a FlowMaterialSelect configured with the given aggregations. -func (_q *FlowMaterialQuery) Aggregate(fns ...AggregateFunc) *FlowMaterialSelect { - return _q.Select().Aggregate(fns...) -} - -func (_q *FlowMaterialQuery) prepareQuery(ctx context.Context) error { - for _, inter := range _q.inters { - if inter == nil { - return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)") - } - if trv, ok := inter.(Traverser); ok { - if err := trv.Traverse(ctx, _q); err != nil { - return err - } - } - } - for _, f := range _q.ctx.Fields { - if !flowmaterial.ValidColumn(f) { - return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} - } - } - if _q.path != nil { - prev, err := _q.path(ctx) - if err != nil { - return err - } - _q.sql = prev - } - return nil -} - -func (_q *FlowMaterialQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*FlowMaterial, error) { - var ( - nodes = []*FlowMaterial{} - _spec = _q.querySpec() - ) - _spec.ScanValues = func(columns []string) ([]any, error) { - return (*FlowMaterial).scanValues(nil, columns) - } - _spec.Assign = func(columns []string, values []any) error { - node := &FlowMaterial{config: _q.config} - nodes = append(nodes, node) - return node.assignValues(columns, values) - } - if len(_q.modifiers) > 0 { - _spec.Modifiers = _q.modifiers - } - for i := range hooks { - hooks[i](ctx, _spec) - } - if err := sqlgraph.QueryNodes(ctx, _q.driver, _spec); err != nil { - return nil, err - } - if len(nodes) == 0 { - return nodes, nil - } - return nodes, nil -} - -func (_q *FlowMaterialQuery) sqlCount(ctx context.Context) (int, error) { - _spec := _q.querySpec() - if len(_q.modifiers) > 0 { - _spec.Modifiers = _q.modifiers - } - _spec.Node.Columns = _q.ctx.Fields - if len(_q.ctx.Fields) > 0 { - _spec.Unique = _q.ctx.Unique != nil && *_q.ctx.Unique - } - return sqlgraph.CountNodes(ctx, _q.driver, _spec) -} - -func (_q *FlowMaterialQuery) querySpec() *sqlgraph.QuerySpec { - _spec := sqlgraph.NewQuerySpec(flowmaterial.Table, flowmaterial.Columns, sqlgraph.NewFieldSpec(flowmaterial.FieldID, field.TypeInt)) - _spec.From = _q.sql - if unique := _q.ctx.Unique; unique != nil { - _spec.Unique = *unique - } else if _q.path != nil { - _spec.Unique = true - } - if fields := _q.ctx.Fields; len(fields) > 0 { - _spec.Node.Columns = make([]string, 0, len(fields)) - _spec.Node.Columns = append(_spec.Node.Columns, flowmaterial.FieldID) - for i := range fields { - if fields[i] != flowmaterial.FieldID { - _spec.Node.Columns = append(_spec.Node.Columns, fields[i]) - } - } - } - if ps := _q.predicates; len(ps) > 0 { - _spec.Predicate = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - if limit := _q.ctx.Limit; limit != nil { - _spec.Limit = *limit - } - if offset := _q.ctx.Offset; offset != nil { - _spec.Offset = *offset - } - if ps := _q.order; len(ps) > 0 { - _spec.Order = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - return _spec -} - -func (_q *FlowMaterialQuery) sqlQuery(ctx context.Context) *sql.Selector { - builder := sql.Dialect(_q.driver.Dialect()) - t1 := builder.Table(flowmaterial.Table) - columns := _q.ctx.Fields - if len(columns) == 0 { - columns = flowmaterial.Columns - } - selector := builder.Select(t1.Columns(columns...)...).From(t1) - if _q.sql != nil { - selector = _q.sql - selector.Select(selector.Columns(columns...)...) - } - if _q.ctx.Unique != nil && *_q.ctx.Unique { - selector.Distinct() - } - for _, m := range _q.modifiers { - m(selector) - } - for _, p := range _q.predicates { - p(selector) - } - for _, p := range _q.order { - p(selector) - } - if offset := _q.ctx.Offset; offset != nil { - // limit is mandatory for offset clause. We start - // with default value, and override it below if needed. - selector.Offset(*offset).Limit(math.MaxInt32) - } - if limit := _q.ctx.Limit; limit != nil { - selector.Limit(*limit) - } - return selector -} - -// ForUpdate locks the selected rows against concurrent updates, and prevent them from being -// updated, deleted or "selected ... for update" by other sessions, until the transaction is -// either committed or rolled-back. -func (_q *FlowMaterialQuery) ForUpdate(opts ...sql.LockOption) *FlowMaterialQuery { - if _q.driver.Dialect() == dialect.Postgres { - _q.Unique(false) - } - _q.modifiers = append(_q.modifiers, func(s *sql.Selector) { - s.ForUpdate(opts...) - }) - return _q -} - -// ForShare behaves similarly to ForUpdate, except that it acquires a shared mode lock -// on any rows that are read. Other sessions can read the rows, but cannot modify them -// until your transaction commits. -func (_q *FlowMaterialQuery) ForShare(opts ...sql.LockOption) *FlowMaterialQuery { - if _q.driver.Dialect() == dialect.Postgres { - _q.Unique(false) - } - _q.modifiers = append(_q.modifiers, func(s *sql.Selector) { - s.ForShare(opts...) - }) - return _q -} - -// Modify adds a query modifier for attaching custom logic to queries. -func (_q *FlowMaterialQuery) Modify(modifiers ...func(s *sql.Selector)) *FlowMaterialSelect { - _q.modifiers = append(_q.modifiers, modifiers...) - return _q.Select() -} - -// FlowMaterialGroupBy is the group-by builder for FlowMaterial entities. -type FlowMaterialGroupBy struct { - selector - build *FlowMaterialQuery -} - -// Aggregate adds the given aggregation functions to the group-by query. -func (_g *FlowMaterialGroupBy) Aggregate(fns ...AggregateFunc) *FlowMaterialGroupBy { - _g.fns = append(_g.fns, fns...) - return _g -} - -// Scan applies the selector query and scans the result into the given value. -func (_g *FlowMaterialGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) - if err := _g.build.prepareQuery(ctx); err != nil { - return err - } - return scanWithInterceptors[*FlowMaterialQuery, *FlowMaterialGroupBy](ctx, _g.build, _g, _g.build.inters, v) -} - -func (_g *FlowMaterialGroupBy) sqlScan(ctx context.Context, root *FlowMaterialQuery, v any) error { - selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(_g.fns)) - for _, fn := range _g.fns { - aggregation = append(aggregation, fn(selector)) - } - if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) - for _, f := range *_g.flds { - columns = append(columns, selector.C(f)) - } - columns = append(columns, aggregation...) - selector.Select(columns...) - } - selector.GroupBy(selector.Columns(*_g.flds...)...) - if err := selector.Err(); err != nil { - return err - } - rows := &sql.Rows{} - query, args := selector.Query() - if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { - return err - } - defer rows.Close() - return sql.ScanSlice(rows, v) -} - -// FlowMaterialSelect is the builder for selecting fields of FlowMaterial entities. -type FlowMaterialSelect struct { - *FlowMaterialQuery - selector -} - -// Aggregate adds the given aggregation functions to the selector query. -func (_s *FlowMaterialSelect) Aggregate(fns ...AggregateFunc) *FlowMaterialSelect { - _s.fns = append(_s.fns, fns...) - return _s -} - -// Scan applies the selector query and scans the result into the given value. -func (_s *FlowMaterialSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) - if err := _s.prepareQuery(ctx); err != nil { - return err - } - return scanWithInterceptors[*FlowMaterialQuery, *FlowMaterialSelect](ctx, _s.FlowMaterialQuery, _s, _s.inters, v) -} - -func (_s *FlowMaterialSelect) sqlScan(ctx context.Context, root *FlowMaterialQuery, v any) error { - selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(_s.fns)) - for _, fn := range _s.fns { - aggregation = append(aggregation, fn(selector)) - } - switch n := len(*_s.selector.flds); { - case n == 0 && len(aggregation) > 0: - selector.Select(aggregation...) - case n != 0 && len(aggregation) > 0: - selector.AppendSelect(aggregation...) - } - rows := &sql.Rows{} - query, args := selector.Query() - if err := _s.driver.Query(ctx, query, args, rows); err != nil { - return err - } - defer rows.Close() - return sql.ScanSlice(rows, v) -} - -// Modify adds a query modifier for attaching custom logic to queries. -func (_s *FlowMaterialSelect) Modify(modifiers ...func(s *sql.Selector)) *FlowMaterialSelect { - _s.modifiers = append(_s.modifiers, modifiers...) - return _s -} diff --git a/bj_power_mes/ent/flowmaterial_update.go b/bj_power_mes/ent/flowmaterial_update.go deleted file mode 100644 index e3a1183..0000000 --- a/bj_power_mes/ent/flowmaterial_update.go +++ /dev/null @@ -1,599 +0,0 @@ -// Code generated by ent, DO NOT EDIT. - -package ent - -import ( - "bj_power_mes/ent/flowmaterial" - "bj_power_mes/ent/predicate" - "context" - "errors" - "fmt" - - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" - "entgo.io/ent/schema/field" -) - -// FlowMaterialUpdate is the builder for updating FlowMaterial entities. -type FlowMaterialUpdate struct { - config - hooks []Hook - mutation *FlowMaterialMutation - modifiers []func(*sql.UpdateBuilder) -} - -// Where appends a list predicates to the FlowMaterialUpdate builder. -func (_u *FlowMaterialUpdate) Where(ps ...predicate.FlowMaterial) *FlowMaterialUpdate { - _u.mutation.Where(ps...) - return _u -} - -// SetFlowId sets the "flowId" field. -func (_u *FlowMaterialUpdate) SetFlowId(v int) *FlowMaterialUpdate { - _u.mutation.ResetFlowId() - _u.mutation.SetFlowId(v) - return _u -} - -// SetNillableFlowId sets the "flowId" field if the given value is not nil. -func (_u *FlowMaterialUpdate) SetNillableFlowId(v *int) *FlowMaterialUpdate { - if v != nil { - _u.SetFlowId(*v) - } - return _u -} - -// AddFlowId adds value to the "flowId" field. -func (_u *FlowMaterialUpdate) AddFlowId(v int) *FlowMaterialUpdate { - _u.mutation.AddFlowId(v) - return _u -} - -// SetMaterialCode sets the "materialCode" field. -func (_u *FlowMaterialUpdate) SetMaterialCode(v string) *FlowMaterialUpdate { - _u.mutation.SetMaterialCode(v) - return _u -} - -// SetNillableMaterialCode sets the "materialCode" field if the given value is not nil. -func (_u *FlowMaterialUpdate) SetNillableMaterialCode(v *string) *FlowMaterialUpdate { - if v != nil { - _u.SetMaterialCode(*v) - } - return _u -} - -// SetMaterialName sets the "materialName" field. -func (_u *FlowMaterialUpdate) SetMaterialName(v string) *FlowMaterialUpdate { - _u.mutation.SetMaterialName(v) - return _u -} - -// SetNillableMaterialName sets the "materialName" field if the given value is not nil. -func (_u *FlowMaterialUpdate) SetNillableMaterialName(v *string) *FlowMaterialUpdate { - if v != nil { - _u.SetMaterialName(*v) - } - return _u -} - -// SetSpec sets the "spec" field. -func (_u *FlowMaterialUpdate) SetSpec(v string) *FlowMaterialUpdate { - _u.mutation.SetSpec(v) - return _u -} - -// SetNillableSpec sets the "spec" field if the given value is not nil. -func (_u *FlowMaterialUpdate) SetNillableSpec(v *string) *FlowMaterialUpdate { - if v != nil { - _u.SetSpec(*v) - } - return _u -} - -// SetUnit sets the "unit" field. -func (_u *FlowMaterialUpdate) SetUnit(v string) *FlowMaterialUpdate { - _u.mutation.SetUnit(v) - return _u -} - -// SetNillableUnit sets the "unit" field if the given value is not nil. -func (_u *FlowMaterialUpdate) SetNillableUnit(v *string) *FlowMaterialUpdate { - if v != nil { - _u.SetUnit(*v) - } - return _u -} - -// SetSnMode sets the "snMode" field. -func (_u *FlowMaterialUpdate) SetSnMode(v int) *FlowMaterialUpdate { - _u.mutation.ResetSnMode() - _u.mutation.SetSnMode(v) - return _u -} - -// SetNillableSnMode sets the "snMode" field if the given value is not nil. -func (_u *FlowMaterialUpdate) SetNillableSnMode(v *int) *FlowMaterialUpdate { - if v != nil { - _u.SetSnMode(*v) - } - return _u -} - -// AddSnMode adds value to the "snMode" field. -func (_u *FlowMaterialUpdate) AddSnMode(v int) *FlowMaterialUpdate { - _u.mutation.AddSnMode(v) - return _u -} - -// SetUnitQty sets the "unitQty" field. -func (_u *FlowMaterialUpdate) SetUnitQty(v float64) *FlowMaterialUpdate { - _u.mutation.ResetUnitQty() - _u.mutation.SetUnitQty(v) - return _u -} - -// SetNillableUnitQty sets the "unitQty" field if the given value is not nil. -func (_u *FlowMaterialUpdate) SetNillableUnitQty(v *float64) *FlowMaterialUpdate { - if v != nil { - _u.SetUnitQty(*v) - } - return _u -} - -// AddUnitQty adds value to the "unitQty" field. -func (_u *FlowMaterialUpdate) AddUnitQty(v float64) *FlowMaterialUpdate { - _u.mutation.AddUnitQty(v) - return _u -} - -// SetLossRate sets the "lossRate" field. -func (_u *FlowMaterialUpdate) SetLossRate(v float64) *FlowMaterialUpdate { - _u.mutation.ResetLossRate() - _u.mutation.SetLossRate(v) - return _u -} - -// SetNillableLossRate sets the "lossRate" field if the given value is not nil. -func (_u *FlowMaterialUpdate) SetNillableLossRate(v *float64) *FlowMaterialUpdate { - if v != nil { - _u.SetLossRate(*v) - } - return _u -} - -// AddLossRate adds value to the "lossRate" field. -func (_u *FlowMaterialUpdate) AddLossRate(v float64) *FlowMaterialUpdate { - _u.mutation.AddLossRate(v) - return _u -} - -// Mutation returns the FlowMaterialMutation object of the builder. -func (_u *FlowMaterialUpdate) Mutation() *FlowMaterialMutation { - return _u.mutation -} - -// Save executes the query and returns the number of nodes affected by the update operation. -func (_u *FlowMaterialUpdate) Save(ctx context.Context) (int, error) { - return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks) -} - -// SaveX is like Save, but panics if an error occurs. -func (_u *FlowMaterialUpdate) SaveX(ctx context.Context) int { - affected, err := _u.Save(ctx) - if err != nil { - panic(err) - } - return affected -} - -// Exec executes the query. -func (_u *FlowMaterialUpdate) Exec(ctx context.Context) error { - _, err := _u.Save(ctx) - return err -} - -// ExecX is like Exec, but panics if an error occurs. -func (_u *FlowMaterialUpdate) ExecX(ctx context.Context) { - if err := _u.Exec(ctx); err != nil { - panic(err) - } -} - -// check runs all checks and user-defined validators on the builder. -func (_u *FlowMaterialUpdate) check() error { - if v, ok := _u.mutation.MaterialCode(); ok { - if err := flowmaterial.MaterialCodeValidator(v); err != nil { - return &ValidationError{Name: "materialCode", err: fmt.Errorf(`ent: validator failed for field "FlowMaterial.materialCode": %w`, err)} - } - } - if v, ok := _u.mutation.MaterialName(); ok { - if err := flowmaterial.MaterialNameValidator(v); err != nil { - return &ValidationError{Name: "materialName", err: fmt.Errorf(`ent: validator failed for field "FlowMaterial.materialName": %w`, err)} - } - } - if v, ok := _u.mutation.Spec(); ok { - if err := flowmaterial.SpecValidator(v); err != nil { - return &ValidationError{Name: "spec", err: fmt.Errorf(`ent: validator failed for field "FlowMaterial.spec": %w`, err)} - } - } - if v, ok := _u.mutation.Unit(); ok { - if err := flowmaterial.UnitValidator(v); err != nil { - return &ValidationError{Name: "unit", err: fmt.Errorf(`ent: validator failed for field "FlowMaterial.unit": %w`, err)} - } - } - return nil -} - -// Modify adds a statement modifier for attaching custom logic to the UPDATE statement. -func (_u *FlowMaterialUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *FlowMaterialUpdate { - _u.modifiers = append(_u.modifiers, modifiers...) - return _u -} - -func (_u *FlowMaterialUpdate) sqlSave(ctx context.Context) (_node int, err error) { - if err := _u.check(); err != nil { - return _node, err - } - _spec := sqlgraph.NewUpdateSpec(flowmaterial.Table, flowmaterial.Columns, sqlgraph.NewFieldSpec(flowmaterial.FieldID, field.TypeInt)) - if ps := _u.mutation.predicates; len(ps) > 0 { - _spec.Predicate = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - if value, ok := _u.mutation.FlowId(); ok { - _spec.SetField(flowmaterial.FieldFlowId, field.TypeInt, value) - } - if value, ok := _u.mutation.AddedFlowId(); ok { - _spec.AddField(flowmaterial.FieldFlowId, field.TypeInt, value) - } - if value, ok := _u.mutation.MaterialCode(); ok { - _spec.SetField(flowmaterial.FieldMaterialCode, field.TypeString, value) - } - if value, ok := _u.mutation.MaterialName(); ok { - _spec.SetField(flowmaterial.FieldMaterialName, field.TypeString, value) - } - if value, ok := _u.mutation.Spec(); ok { - _spec.SetField(flowmaterial.FieldSpec, field.TypeString, value) - } - if value, ok := _u.mutation.Unit(); ok { - _spec.SetField(flowmaterial.FieldUnit, field.TypeString, value) - } - if value, ok := _u.mutation.SnMode(); ok { - _spec.SetField(flowmaterial.FieldSnMode, field.TypeInt, value) - } - if value, ok := _u.mutation.AddedSnMode(); ok { - _spec.AddField(flowmaterial.FieldSnMode, field.TypeInt, value) - } - if value, ok := _u.mutation.UnitQty(); ok { - _spec.SetField(flowmaterial.FieldUnitQty, field.TypeFloat64, value) - } - if value, ok := _u.mutation.AddedUnitQty(); ok { - _spec.AddField(flowmaterial.FieldUnitQty, field.TypeFloat64, value) - } - if value, ok := _u.mutation.LossRate(); ok { - _spec.SetField(flowmaterial.FieldLossRate, field.TypeFloat64, value) - } - if value, ok := _u.mutation.AddedLossRate(); ok { - _spec.AddField(flowmaterial.FieldLossRate, field.TypeFloat64, value) - } - _spec.AddModifiers(_u.modifiers...) - if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil { - if _, ok := err.(*sqlgraph.NotFoundError); ok { - err = &NotFoundError{flowmaterial.Label} - } else if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{msg: err.Error(), wrap: err} - } - return 0, err - } - _u.mutation.done = true - return _node, nil -} - -// FlowMaterialUpdateOne is the builder for updating a single FlowMaterial entity. -type FlowMaterialUpdateOne struct { - config - fields []string - hooks []Hook - mutation *FlowMaterialMutation - modifiers []func(*sql.UpdateBuilder) -} - -// SetFlowId sets the "flowId" field. -func (_u *FlowMaterialUpdateOne) SetFlowId(v int) *FlowMaterialUpdateOne { - _u.mutation.ResetFlowId() - _u.mutation.SetFlowId(v) - return _u -} - -// SetNillableFlowId sets the "flowId" field if the given value is not nil. -func (_u *FlowMaterialUpdateOne) SetNillableFlowId(v *int) *FlowMaterialUpdateOne { - if v != nil { - _u.SetFlowId(*v) - } - return _u -} - -// AddFlowId adds value to the "flowId" field. -func (_u *FlowMaterialUpdateOne) AddFlowId(v int) *FlowMaterialUpdateOne { - _u.mutation.AddFlowId(v) - return _u -} - -// SetMaterialCode sets the "materialCode" field. -func (_u *FlowMaterialUpdateOne) SetMaterialCode(v string) *FlowMaterialUpdateOne { - _u.mutation.SetMaterialCode(v) - return _u -} - -// SetNillableMaterialCode sets the "materialCode" field if the given value is not nil. -func (_u *FlowMaterialUpdateOne) SetNillableMaterialCode(v *string) *FlowMaterialUpdateOne { - if v != nil { - _u.SetMaterialCode(*v) - } - return _u -} - -// SetMaterialName sets the "materialName" field. -func (_u *FlowMaterialUpdateOne) SetMaterialName(v string) *FlowMaterialUpdateOne { - _u.mutation.SetMaterialName(v) - return _u -} - -// SetNillableMaterialName sets the "materialName" field if the given value is not nil. -func (_u *FlowMaterialUpdateOne) SetNillableMaterialName(v *string) *FlowMaterialUpdateOne { - if v != nil { - _u.SetMaterialName(*v) - } - return _u -} - -// SetSpec sets the "spec" field. -func (_u *FlowMaterialUpdateOne) SetSpec(v string) *FlowMaterialUpdateOne { - _u.mutation.SetSpec(v) - return _u -} - -// SetNillableSpec sets the "spec" field if the given value is not nil. -func (_u *FlowMaterialUpdateOne) SetNillableSpec(v *string) *FlowMaterialUpdateOne { - if v != nil { - _u.SetSpec(*v) - } - return _u -} - -// SetUnit sets the "unit" field. -func (_u *FlowMaterialUpdateOne) SetUnit(v string) *FlowMaterialUpdateOne { - _u.mutation.SetUnit(v) - return _u -} - -// SetNillableUnit sets the "unit" field if the given value is not nil. -func (_u *FlowMaterialUpdateOne) SetNillableUnit(v *string) *FlowMaterialUpdateOne { - if v != nil { - _u.SetUnit(*v) - } - return _u -} - -// SetSnMode sets the "snMode" field. -func (_u *FlowMaterialUpdateOne) SetSnMode(v int) *FlowMaterialUpdateOne { - _u.mutation.ResetSnMode() - _u.mutation.SetSnMode(v) - return _u -} - -// SetNillableSnMode sets the "snMode" field if the given value is not nil. -func (_u *FlowMaterialUpdateOne) SetNillableSnMode(v *int) *FlowMaterialUpdateOne { - if v != nil { - _u.SetSnMode(*v) - } - return _u -} - -// AddSnMode adds value to the "snMode" field. -func (_u *FlowMaterialUpdateOne) AddSnMode(v int) *FlowMaterialUpdateOne { - _u.mutation.AddSnMode(v) - return _u -} - -// SetUnitQty sets the "unitQty" field. -func (_u *FlowMaterialUpdateOne) SetUnitQty(v float64) *FlowMaterialUpdateOne { - _u.mutation.ResetUnitQty() - _u.mutation.SetUnitQty(v) - return _u -} - -// SetNillableUnitQty sets the "unitQty" field if the given value is not nil. -func (_u *FlowMaterialUpdateOne) SetNillableUnitQty(v *float64) *FlowMaterialUpdateOne { - if v != nil { - _u.SetUnitQty(*v) - } - return _u -} - -// AddUnitQty adds value to the "unitQty" field. -func (_u *FlowMaterialUpdateOne) AddUnitQty(v float64) *FlowMaterialUpdateOne { - _u.mutation.AddUnitQty(v) - return _u -} - -// SetLossRate sets the "lossRate" field. -func (_u *FlowMaterialUpdateOne) SetLossRate(v float64) *FlowMaterialUpdateOne { - _u.mutation.ResetLossRate() - _u.mutation.SetLossRate(v) - return _u -} - -// SetNillableLossRate sets the "lossRate" field if the given value is not nil. -func (_u *FlowMaterialUpdateOne) SetNillableLossRate(v *float64) *FlowMaterialUpdateOne { - if v != nil { - _u.SetLossRate(*v) - } - return _u -} - -// AddLossRate adds value to the "lossRate" field. -func (_u *FlowMaterialUpdateOne) AddLossRate(v float64) *FlowMaterialUpdateOne { - _u.mutation.AddLossRate(v) - return _u -} - -// Mutation returns the FlowMaterialMutation object of the builder. -func (_u *FlowMaterialUpdateOne) Mutation() *FlowMaterialMutation { - return _u.mutation -} - -// Where appends a list predicates to the FlowMaterialUpdate builder. -func (_u *FlowMaterialUpdateOne) Where(ps ...predicate.FlowMaterial) *FlowMaterialUpdateOne { - _u.mutation.Where(ps...) - return _u -} - -// Select allows selecting one or more fields (columns) of the returned entity. -// The default is selecting all fields defined in the entity schema. -func (_u *FlowMaterialUpdateOne) Select(field string, fields ...string) *FlowMaterialUpdateOne { - _u.fields = append([]string{field}, fields...) - return _u -} - -// Save executes the query and returns the updated FlowMaterial entity. -func (_u *FlowMaterialUpdateOne) Save(ctx context.Context) (*FlowMaterial, error) { - return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks) -} - -// SaveX is like Save, but panics if an error occurs. -func (_u *FlowMaterialUpdateOne) SaveX(ctx context.Context) *FlowMaterial { - node, err := _u.Save(ctx) - if err != nil { - panic(err) - } - return node -} - -// Exec executes the query on the entity. -func (_u *FlowMaterialUpdateOne) Exec(ctx context.Context) error { - _, err := _u.Save(ctx) - return err -} - -// ExecX is like Exec, but panics if an error occurs. -func (_u *FlowMaterialUpdateOne) ExecX(ctx context.Context) { - if err := _u.Exec(ctx); err != nil { - panic(err) - } -} - -// check runs all checks and user-defined validators on the builder. -func (_u *FlowMaterialUpdateOne) check() error { - if v, ok := _u.mutation.MaterialCode(); ok { - if err := flowmaterial.MaterialCodeValidator(v); err != nil { - return &ValidationError{Name: "materialCode", err: fmt.Errorf(`ent: validator failed for field "FlowMaterial.materialCode": %w`, err)} - } - } - if v, ok := _u.mutation.MaterialName(); ok { - if err := flowmaterial.MaterialNameValidator(v); err != nil { - return &ValidationError{Name: "materialName", err: fmt.Errorf(`ent: validator failed for field "FlowMaterial.materialName": %w`, err)} - } - } - if v, ok := _u.mutation.Spec(); ok { - if err := flowmaterial.SpecValidator(v); err != nil { - return &ValidationError{Name: "spec", err: fmt.Errorf(`ent: validator failed for field "FlowMaterial.spec": %w`, err)} - } - } - if v, ok := _u.mutation.Unit(); ok { - if err := flowmaterial.UnitValidator(v); err != nil { - return &ValidationError{Name: "unit", err: fmt.Errorf(`ent: validator failed for field "FlowMaterial.unit": %w`, err)} - } - } - return nil -} - -// Modify adds a statement modifier for attaching custom logic to the UPDATE statement. -func (_u *FlowMaterialUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *FlowMaterialUpdateOne { - _u.modifiers = append(_u.modifiers, modifiers...) - return _u -} - -func (_u *FlowMaterialUpdateOne) sqlSave(ctx context.Context) (_node *FlowMaterial, err error) { - if err := _u.check(); err != nil { - return _node, err - } - _spec := sqlgraph.NewUpdateSpec(flowmaterial.Table, flowmaterial.Columns, sqlgraph.NewFieldSpec(flowmaterial.FieldID, field.TypeInt)) - id, ok := _u.mutation.ID() - if !ok { - return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "FlowMaterial.id" for update`)} - } - _spec.Node.ID.Value = id - if fields := _u.fields; len(fields) > 0 { - _spec.Node.Columns = make([]string, 0, len(fields)) - _spec.Node.Columns = append(_spec.Node.Columns, flowmaterial.FieldID) - for _, f := range fields { - if !flowmaterial.ValidColumn(f) { - return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} - } - if f != flowmaterial.FieldID { - _spec.Node.Columns = append(_spec.Node.Columns, f) - } - } - } - if ps := _u.mutation.predicates; len(ps) > 0 { - _spec.Predicate = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - if value, ok := _u.mutation.FlowId(); ok { - _spec.SetField(flowmaterial.FieldFlowId, field.TypeInt, value) - } - if value, ok := _u.mutation.AddedFlowId(); ok { - _spec.AddField(flowmaterial.FieldFlowId, field.TypeInt, value) - } - if value, ok := _u.mutation.MaterialCode(); ok { - _spec.SetField(flowmaterial.FieldMaterialCode, field.TypeString, value) - } - if value, ok := _u.mutation.MaterialName(); ok { - _spec.SetField(flowmaterial.FieldMaterialName, field.TypeString, value) - } - if value, ok := _u.mutation.Spec(); ok { - _spec.SetField(flowmaterial.FieldSpec, field.TypeString, value) - } - if value, ok := _u.mutation.Unit(); ok { - _spec.SetField(flowmaterial.FieldUnit, field.TypeString, value) - } - if value, ok := _u.mutation.SnMode(); ok { - _spec.SetField(flowmaterial.FieldSnMode, field.TypeInt, value) - } - if value, ok := _u.mutation.AddedSnMode(); ok { - _spec.AddField(flowmaterial.FieldSnMode, field.TypeInt, value) - } - if value, ok := _u.mutation.UnitQty(); ok { - _spec.SetField(flowmaterial.FieldUnitQty, field.TypeFloat64, value) - } - if value, ok := _u.mutation.AddedUnitQty(); ok { - _spec.AddField(flowmaterial.FieldUnitQty, field.TypeFloat64, value) - } - if value, ok := _u.mutation.LossRate(); ok { - _spec.SetField(flowmaterial.FieldLossRate, field.TypeFloat64, value) - } - if value, ok := _u.mutation.AddedLossRate(); ok { - _spec.AddField(flowmaterial.FieldLossRate, field.TypeFloat64, value) - } - _spec.AddModifiers(_u.modifiers...) - _node = &FlowMaterial{config: _u.config} - _spec.Assign = _node.assignValues - _spec.ScanValues = _node.scanValues - if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil { - if _, ok := err.(*sqlgraph.NotFoundError); ok { - err = &NotFoundError{flowmaterial.Label} - } else if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{msg: err.Error(), wrap: err} - } - return nil, err - } - _u.mutation.done = true - return _node, nil -} diff --git a/bj_power_mes/ent/hook/hook.go b/bj_power_mes/ent/hook/hook.go index e73779e..dcb1417 100644 --- a/bj_power_mes/ent/hook/hook.go +++ b/bj_power_mes/ent/hook/hook.go @@ -152,18 +152,6 @@ func (f EventLogFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, er return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.EventLogMutation", m) } -// The FlowMaterialFunc type is an adapter to allow the use of ordinary -// function as FlowMaterial mutator. -type FlowMaterialFunc func(context.Context, *ent.FlowMaterialMutation) (ent.Value, error) - -// Mutate calls f(ctx, m). -func (f FlowMaterialFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) { - if mv, ok := m.(*ent.FlowMaterialMutation); ok { - return f(ctx, mv) - } - return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.FlowMaterialMutation", m) -} - // The InspectionRecordFunc type is an adapter to allow the use of ordinary // function as InspectionRecord mutator. type InspectionRecordFunc func(context.Context, *ent.InspectionRecordMutation) (ent.Value, error) @@ -236,18 +224,6 @@ func (f MaterialRequestFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Va return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.MaterialRequestMutation", m) } -// The MixProductionTemplateFunc type is an adapter to allow the use of ordinary -// function as MixProductionTemplate mutator. -type MixProductionTemplateFunc func(context.Context, *ent.MixProductionTemplateMutation) (ent.Value, error) - -// Mutate calls f(ctx, m). -func (f MixProductionTemplateFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) { - if mv, ok := m.(*ent.MixProductionTemplateMutation); ok { - return f(ctx, mv) - } - return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.MixProductionTemplateMutation", m) -} - // The PermissionFunc type is an adapter to allow the use of ordinary // function as Permission mutator. type PermissionFunc func(context.Context, *ent.PermissionMutation) (ent.Value, error) diff --git a/bj_power_mes/ent/migrate/schema.go b/bj_power_mes/ent/migrate/schema.go index 7a53add..40236a9 100644 --- a/bj_power_mes/ent/migrate/schema.go +++ b/bj_power_mes/ent/migrate/schema.go @@ -451,38 +451,6 @@ var ( }, }, } - // FlowMaterialColumns holds the columns for the "flow_material" table. - FlowMaterialColumns = []*schema.Column{ - {Name: "id", Type: field.TypeInt, Increment: true}, - {Name: "flow_id", Type: field.TypeInt, Comment: "所属工艺ID"}, - {Name: "material_code", Type: field.TypeString, Size: 64, Comment: "物料编码"}, - {Name: "material_name", Type: field.TypeString, Size: 128, Default: ""}, - {Name: "spec", Type: field.TypeString, Size: 128, Default: ""}, - {Name: "unit", Type: field.TypeString, Size: 16, Default: ""}, - {Name: "sn_mode", Type: field.TypeInt, Default: 2}, - {Name: "unit_qty", Type: field.TypeFloat64, Comment: "单台用量", Default: 0}, - {Name: "loss_rate", Type: field.TypeFloat64, Comment: "损耗率%(仅展示口径,不参与备料计算——R7 2026-11-03 拍板:备料量=工单需求×单台用量,损耗走补料审批)", Default: 0}, - {Name: "created_at", Type: field.TypeTime}, - } - // FlowMaterialTable holds the schema information for the "flow_material" table. - FlowMaterialTable = &schema.Table{ - Name: "flow_material", - Comment: "FlowMaterial 工艺物料清单:一道工艺装什么料、单台用多少(备料/齐套校验的唯一源头)。", - Columns: FlowMaterialColumns, - PrimaryKey: []*schema.Column{FlowMaterialColumns[0]}, - Indexes: []*schema.Index{ - { - Name: "flowmaterial_flow_id", - Unique: false, - Columns: []*schema.Column{FlowMaterialColumns[1]}, - }, - { - Name: "flowmaterial_flow_id_material_code", - Unique: true, - Columns: []*schema.Column{FlowMaterialColumns[1], FlowMaterialColumns[2]}, - }, - }, - } // InspectionRecordColumns holds the columns for the "inspection_record" table. InspectionRecordColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, @@ -773,29 +741,6 @@ var ( }, }, } - // MixProductionTemplateColumns holds the columns for the "mix_production_template" table. - MixProductionTemplateColumns = []*schema.Column{ - {Name: "id", Type: field.TypeInt, Increment: true}, - {Name: "name", Type: field.TypeString, Size: 128, Comment: "模板名称"}, - {Name: "product_codes", Type: field.TypeString, Size: 2147483647, Comment: "可混产成品编码集合(逗号分隔)", Default: ""}, - {Name: "remark", Type: field.TypeString, Size: 255, Default: ""}, - {Name: "status", Type: field.TypeString, Size: 16, Comment: "ACTIVE/INACTIVE", Default: "ACTIVE"}, - {Name: "created_at", Type: field.TypeTime}, - } - // MixProductionTemplateTable holds the schema information for the "mix_production_template" table. - MixProductionTemplateTable = &schema.Table{ - Name: "mix_production_template", - Comment: "MixProductionTemplate 混产模板:可混线生产的成品集合。", - Columns: MixProductionTemplateColumns, - PrimaryKey: []*schema.Column{MixProductionTemplateColumns[0]}, - Indexes: []*schema.Index{ - { - Name: "mixproductiontemplate_name", - Unique: true, - Columns: []*schema.Column{MixProductionTemplateColumns[1]}, - }, - }, - } // PermissionColumns holds the columns for the "permission" table. PermissionColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, @@ -1742,14 +1687,12 @@ var ( DailyPlanTable, DockTable, EventLogTable, - FlowMaterialTable, InspectionRecordTable, LinePointTable, LossLedgersTable, MaterialsTable, MaterialQtyReportTable, MaterialRequestTable, - MixProductionTemplateTable, PermissionTable, PlcSendLogTable, ProcessFlowTable, @@ -1818,9 +1761,6 @@ func init() { EventLogTable.Annotation = &entsql.Annotation{ Table: "event_log", } - FlowMaterialTable.Annotation = &entsql.Annotation{ - Table: "flow_material", - } InspectionRecordTable.Annotation = &entsql.Annotation{ Table: "inspection_record", } @@ -1839,9 +1779,6 @@ func init() { MaterialRequestTable.Annotation = &entsql.Annotation{ Table: "material_request", } - MixProductionTemplateTable.Annotation = &entsql.Annotation{ - Table: "mix_production_template", - } PermissionTable.Annotation = &entsql.Annotation{ Table: "permission", } diff --git a/bj_power_mes/ent/mixproductiontemplate.go b/bj_power_mes/ent/mixproductiontemplate.go deleted file mode 100644 index 6f68280..0000000 --- a/bj_power_mes/ent/mixproductiontemplate.go +++ /dev/null @@ -1,150 +0,0 @@ -// Code generated by ent, DO NOT EDIT. - -package ent - -import ( - "bj_power_mes/ent/mixproductiontemplate" - "fmt" - "strings" - "time" - - "entgo.io/ent" - "entgo.io/ent/dialect/sql" -) - -// MixProductionTemplate 混产模板:可混线生产的成品集合。 -type MixProductionTemplate struct { - config `json:"-"` - // ID of the ent. - ID int `json:"id,omitempty"` - // 模板名称 - Name string `json:"name,omitempty"` - // 可混产成品编码集合(逗号分隔) - ProductCodes string `json:"productCodes,omitempty"` - // Remark holds the value of the "remark" field. - Remark string `json:"remark,omitempty"` - // ACTIVE/INACTIVE - Status string `json:"status,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 (*MixProductionTemplate) scanValues(columns []string) ([]any, error) { - values := make([]any, len(columns)) - for i := range columns { - switch columns[i] { - case mixproductiontemplate.FieldID: - values[i] = new(sql.NullInt64) - case mixproductiontemplate.FieldName, mixproductiontemplate.FieldProductCodes, mixproductiontemplate.FieldRemark, mixproductiontemplate.FieldStatus: - values[i] = new(sql.NullString) - case mixproductiontemplate.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 MixProductionTemplate fields. -func (_m *MixProductionTemplate) 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 mixproductiontemplate.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 mixproductiontemplate.FieldName: - if value, ok := values[i].(*sql.NullString); !ok { - return fmt.Errorf("unexpected type %T for field name", values[i]) - } else if value.Valid { - _m.Name = value.String - } - case mixproductiontemplate.FieldProductCodes: - if value, ok := values[i].(*sql.NullString); !ok { - return fmt.Errorf("unexpected type %T for field productCodes", values[i]) - } else if value.Valid { - _m.ProductCodes = value.String - } - case mixproductiontemplate.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 mixproductiontemplate.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 mixproductiontemplate.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 MixProductionTemplate. -// This includes values selected through modifiers, order, etc. -func (_m *MixProductionTemplate) Value(name string) (ent.Value, error) { - return _m.selectValues.Get(name) -} - -// Update returns a builder for updating this MixProductionTemplate. -// Note that you need to call MixProductionTemplate.Unwrap() before calling this method if this MixProductionTemplate -// was returned from a transaction, and the transaction was committed or rolled back. -func (_m *MixProductionTemplate) Update() *MixProductionTemplateUpdateOne { - return NewMixProductionTemplateClient(_m.config).UpdateOne(_m) -} - -// Unwrap unwraps the MixProductionTemplate 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 *MixProductionTemplate) Unwrap() *MixProductionTemplate { - _tx, ok := _m.config.driver.(*txDriver) - if !ok { - panic("ent: MixProductionTemplate is not a transactional entity") - } - _m.config.driver = _tx.drv - return _m -} - -// String implements the fmt.Stringer. -func (_m *MixProductionTemplate) String() string { - var builder strings.Builder - builder.WriteString("MixProductionTemplate(") - builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID)) - builder.WriteString("name=") - builder.WriteString(_m.Name) - builder.WriteString(", ") - builder.WriteString("productCodes=") - builder.WriteString(_m.ProductCodes) - builder.WriteString(", ") - builder.WriteString("remark=") - builder.WriteString(_m.Remark) - builder.WriteString(", ") - builder.WriteString("status=") - builder.WriteString(_m.Status) - builder.WriteString(", ") - builder.WriteString("createdAt=") - builder.WriteString(_m.CreatedAt.Format(time.ANSIC)) - builder.WriteByte(')') - return builder.String() -} - -// MixProductionTemplates is a parsable slice of MixProductionTemplate. -type MixProductionTemplates []*MixProductionTemplate diff --git a/bj_power_mes/ent/mixproductiontemplate/mixproductiontemplate.go b/bj_power_mes/ent/mixproductiontemplate/mixproductiontemplate.go deleted file mode 100644 index 62bad30..0000000 --- a/bj_power_mes/ent/mixproductiontemplate/mixproductiontemplate.go +++ /dev/null @@ -1,100 +0,0 @@ -// Code generated by ent, DO NOT EDIT. - -package mixproductiontemplate - -import ( - "time" - - "entgo.io/ent/dialect/sql" -) - -const ( - // Label holds the string label denoting the mixproductiontemplate type in the database. - Label = "mix_production_template" - // FieldID holds the string denoting the id field in the database. - FieldID = "id" - // FieldName holds the string denoting the name field in the database. - FieldName = "name" - // FieldProductCodes holds the string denoting the productcodes field in the database. - FieldProductCodes = "product_codes" - // FieldRemark holds the string denoting the remark field in the database. - FieldRemark = "remark" - // FieldStatus holds the string denoting the status field in the database. - FieldStatus = "status" - // FieldCreatedAt holds the string denoting the createdat field in the database. - FieldCreatedAt = "created_at" - // Table holds the table name of the mixproductiontemplate in the database. - Table = "mix_production_template" -) - -// Columns holds all SQL columns for mixproductiontemplate fields. -var Columns = []string{ - FieldID, - FieldName, - FieldProductCodes, - FieldRemark, - FieldStatus, - 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 ( - // NameValidator is a validator for the "name" field. It is called by the builders before save. - NameValidator func(string) error - // DefaultProductCodes holds the default value on creation for the "productCodes" field. - DefaultProductCodes string - // 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 - // DefaultStatus holds the default value on creation for the "status" field. - DefaultStatus string - // StatusValidator is a validator for the "status" field. It is called by the builders before save. - StatusValidator 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 MixProductionTemplate 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() -} - -// ByName orders the results by the name field. -func ByName(opts ...sql.OrderTermOption) OrderOption { - return sql.OrderByField(FieldName, opts...).ToFunc() -} - -// ByProductCodes orders the results by the productCodes field. -func ByProductCodes(opts ...sql.OrderTermOption) OrderOption { - return sql.OrderByField(FieldProductCodes, opts...).ToFunc() -} - -// ByRemark orders the results by the remark field. -func ByRemark(opts ...sql.OrderTermOption) OrderOption { - return sql.OrderByField(FieldRemark, opts...).ToFunc() -} - -// ByStatus orders the results by the status field. -func ByStatus(opts ...sql.OrderTermOption) OrderOption { - return sql.OrderByField(FieldStatus, opts...).ToFunc() -} - -// ByCreatedAt orders the results by the createdAt field. -func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption { - return sql.OrderByField(FieldCreatedAt, opts...).ToFunc() -} diff --git a/bj_power_mes/ent/mixproductiontemplate/where.go b/bj_power_mes/ent/mixproductiontemplate/where.go deleted file mode 100644 index ed4e589..0000000 --- a/bj_power_mes/ent/mixproductiontemplate/where.go +++ /dev/null @@ -1,395 +0,0 @@ -// Code generated by ent, DO NOT EDIT. - -package mixproductiontemplate - -import ( - "bj_power_mes/ent/predicate" - "time" - - "entgo.io/ent/dialect/sql" -) - -// ID filters vertices based on their ID field. -func ID(id int) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldEQ(FieldID, id)) -} - -// IDEQ applies the EQ predicate on the ID field. -func IDEQ(id int) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldEQ(FieldID, id)) -} - -// IDNEQ applies the NEQ predicate on the ID field. -func IDNEQ(id int) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldNEQ(FieldID, id)) -} - -// IDIn applies the In predicate on the ID field. -func IDIn(ids ...int) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldIn(FieldID, ids...)) -} - -// IDNotIn applies the NotIn predicate on the ID field. -func IDNotIn(ids ...int) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldNotIn(FieldID, ids...)) -} - -// IDGT applies the GT predicate on the ID field. -func IDGT(id int) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldGT(FieldID, id)) -} - -// IDGTE applies the GTE predicate on the ID field. -func IDGTE(id int) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldGTE(FieldID, id)) -} - -// IDLT applies the LT predicate on the ID field. -func IDLT(id int) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldLT(FieldID, id)) -} - -// IDLTE applies the LTE predicate on the ID field. -func IDLTE(id int) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldLTE(FieldID, id)) -} - -// Name applies equality check predicate on the "name" field. It's identical to NameEQ. -func Name(v string) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldEQ(FieldName, v)) -} - -// ProductCodes applies equality check predicate on the "productCodes" field. It's identical to ProductCodesEQ. -func ProductCodes(v string) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldEQ(FieldProductCodes, v)) -} - -// Remark applies equality check predicate on the "remark" field. It's identical to RemarkEQ. -func Remark(v string) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldEQ(FieldRemark, v)) -} - -// Status applies equality check predicate on the "status" field. It's identical to StatusEQ. -func Status(v string) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldEQ(FieldStatus, v)) -} - -// CreatedAt applies equality check predicate on the "createdAt" field. It's identical to CreatedAtEQ. -func CreatedAt(v time.Time) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldEQ(FieldCreatedAt, v)) -} - -// NameEQ applies the EQ predicate on the "name" field. -func NameEQ(v string) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldEQ(FieldName, v)) -} - -// NameNEQ applies the NEQ predicate on the "name" field. -func NameNEQ(v string) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldNEQ(FieldName, v)) -} - -// NameIn applies the In predicate on the "name" field. -func NameIn(vs ...string) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldIn(FieldName, vs...)) -} - -// NameNotIn applies the NotIn predicate on the "name" field. -func NameNotIn(vs ...string) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldNotIn(FieldName, vs...)) -} - -// NameGT applies the GT predicate on the "name" field. -func NameGT(v string) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldGT(FieldName, v)) -} - -// NameGTE applies the GTE predicate on the "name" field. -func NameGTE(v string) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldGTE(FieldName, v)) -} - -// NameLT applies the LT predicate on the "name" field. -func NameLT(v string) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldLT(FieldName, v)) -} - -// NameLTE applies the LTE predicate on the "name" field. -func NameLTE(v string) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldLTE(FieldName, v)) -} - -// NameContains applies the Contains predicate on the "name" field. -func NameContains(v string) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldContains(FieldName, v)) -} - -// NameHasPrefix applies the HasPrefix predicate on the "name" field. -func NameHasPrefix(v string) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldHasPrefix(FieldName, v)) -} - -// NameHasSuffix applies the HasSuffix predicate on the "name" field. -func NameHasSuffix(v string) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldHasSuffix(FieldName, v)) -} - -// NameEqualFold applies the EqualFold predicate on the "name" field. -func NameEqualFold(v string) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldEqualFold(FieldName, v)) -} - -// NameContainsFold applies the ContainsFold predicate on the "name" field. -func NameContainsFold(v string) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldContainsFold(FieldName, v)) -} - -// ProductCodesEQ applies the EQ predicate on the "productCodes" field. -func ProductCodesEQ(v string) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldEQ(FieldProductCodes, v)) -} - -// ProductCodesNEQ applies the NEQ predicate on the "productCodes" field. -func ProductCodesNEQ(v string) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldNEQ(FieldProductCodes, v)) -} - -// ProductCodesIn applies the In predicate on the "productCodes" field. -func ProductCodesIn(vs ...string) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldIn(FieldProductCodes, vs...)) -} - -// ProductCodesNotIn applies the NotIn predicate on the "productCodes" field. -func ProductCodesNotIn(vs ...string) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldNotIn(FieldProductCodes, vs...)) -} - -// ProductCodesGT applies the GT predicate on the "productCodes" field. -func ProductCodesGT(v string) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldGT(FieldProductCodes, v)) -} - -// ProductCodesGTE applies the GTE predicate on the "productCodes" field. -func ProductCodesGTE(v string) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldGTE(FieldProductCodes, v)) -} - -// ProductCodesLT applies the LT predicate on the "productCodes" field. -func ProductCodesLT(v string) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldLT(FieldProductCodes, v)) -} - -// ProductCodesLTE applies the LTE predicate on the "productCodes" field. -func ProductCodesLTE(v string) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldLTE(FieldProductCodes, v)) -} - -// ProductCodesContains applies the Contains predicate on the "productCodes" field. -func ProductCodesContains(v string) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldContains(FieldProductCodes, v)) -} - -// ProductCodesHasPrefix applies the HasPrefix predicate on the "productCodes" field. -func ProductCodesHasPrefix(v string) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldHasPrefix(FieldProductCodes, v)) -} - -// ProductCodesHasSuffix applies the HasSuffix predicate on the "productCodes" field. -func ProductCodesHasSuffix(v string) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldHasSuffix(FieldProductCodes, v)) -} - -// ProductCodesEqualFold applies the EqualFold predicate on the "productCodes" field. -func ProductCodesEqualFold(v string) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldEqualFold(FieldProductCodes, v)) -} - -// ProductCodesContainsFold applies the ContainsFold predicate on the "productCodes" field. -func ProductCodesContainsFold(v string) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldContainsFold(FieldProductCodes, v)) -} - -// RemarkEQ applies the EQ predicate on the "remark" field. -func RemarkEQ(v string) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldEQ(FieldRemark, v)) -} - -// RemarkNEQ applies the NEQ predicate on the "remark" field. -func RemarkNEQ(v string) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldNEQ(FieldRemark, v)) -} - -// RemarkIn applies the In predicate on the "remark" field. -func RemarkIn(vs ...string) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldIn(FieldRemark, vs...)) -} - -// RemarkNotIn applies the NotIn predicate on the "remark" field. -func RemarkNotIn(vs ...string) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldNotIn(FieldRemark, vs...)) -} - -// RemarkGT applies the GT predicate on the "remark" field. -func RemarkGT(v string) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldGT(FieldRemark, v)) -} - -// RemarkGTE applies the GTE predicate on the "remark" field. -func RemarkGTE(v string) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldGTE(FieldRemark, v)) -} - -// RemarkLT applies the LT predicate on the "remark" field. -func RemarkLT(v string) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldLT(FieldRemark, v)) -} - -// RemarkLTE applies the LTE predicate on the "remark" field. -func RemarkLTE(v string) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldLTE(FieldRemark, v)) -} - -// RemarkContains applies the Contains predicate on the "remark" field. -func RemarkContains(v string) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldContains(FieldRemark, v)) -} - -// RemarkHasPrefix applies the HasPrefix predicate on the "remark" field. -func RemarkHasPrefix(v string) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldHasPrefix(FieldRemark, v)) -} - -// RemarkHasSuffix applies the HasSuffix predicate on the "remark" field. -func RemarkHasSuffix(v string) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldHasSuffix(FieldRemark, v)) -} - -// RemarkEqualFold applies the EqualFold predicate on the "remark" field. -func RemarkEqualFold(v string) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldEqualFold(FieldRemark, v)) -} - -// RemarkContainsFold applies the ContainsFold predicate on the "remark" field. -func RemarkContainsFold(v string) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldContainsFold(FieldRemark, v)) -} - -// StatusEQ applies the EQ predicate on the "status" field. -func StatusEQ(v string) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldEQ(FieldStatus, v)) -} - -// StatusNEQ applies the NEQ predicate on the "status" field. -func StatusNEQ(v string) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldNEQ(FieldStatus, v)) -} - -// StatusIn applies the In predicate on the "status" field. -func StatusIn(vs ...string) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldIn(FieldStatus, vs...)) -} - -// StatusNotIn applies the NotIn predicate on the "status" field. -func StatusNotIn(vs ...string) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldNotIn(FieldStatus, vs...)) -} - -// StatusGT applies the GT predicate on the "status" field. -func StatusGT(v string) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldGT(FieldStatus, v)) -} - -// StatusGTE applies the GTE predicate on the "status" field. -func StatusGTE(v string) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldGTE(FieldStatus, v)) -} - -// StatusLT applies the LT predicate on the "status" field. -func StatusLT(v string) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldLT(FieldStatus, v)) -} - -// StatusLTE applies the LTE predicate on the "status" field. -func StatusLTE(v string) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldLTE(FieldStatus, v)) -} - -// StatusContains applies the Contains predicate on the "status" field. -func StatusContains(v string) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldContains(FieldStatus, v)) -} - -// StatusHasPrefix applies the HasPrefix predicate on the "status" field. -func StatusHasPrefix(v string) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldHasPrefix(FieldStatus, v)) -} - -// StatusHasSuffix applies the HasSuffix predicate on the "status" field. -func StatusHasSuffix(v string) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldHasSuffix(FieldStatus, v)) -} - -// StatusEqualFold applies the EqualFold predicate on the "status" field. -func StatusEqualFold(v string) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldEqualFold(FieldStatus, v)) -} - -// StatusContainsFold applies the ContainsFold predicate on the "status" field. -func StatusContainsFold(v string) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldContainsFold(FieldStatus, v)) -} - -// CreatedAtEQ applies the EQ predicate on the "createdAt" field. -func CreatedAtEQ(v time.Time) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldEQ(FieldCreatedAt, v)) -} - -// CreatedAtNEQ applies the NEQ predicate on the "createdAt" field. -func CreatedAtNEQ(v time.Time) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldNEQ(FieldCreatedAt, v)) -} - -// CreatedAtIn applies the In predicate on the "createdAt" field. -func CreatedAtIn(vs ...time.Time) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldIn(FieldCreatedAt, vs...)) -} - -// CreatedAtNotIn applies the NotIn predicate on the "createdAt" field. -func CreatedAtNotIn(vs ...time.Time) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldNotIn(FieldCreatedAt, vs...)) -} - -// CreatedAtGT applies the GT predicate on the "createdAt" field. -func CreatedAtGT(v time.Time) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldGT(FieldCreatedAt, v)) -} - -// CreatedAtGTE applies the GTE predicate on the "createdAt" field. -func CreatedAtGTE(v time.Time) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldGTE(FieldCreatedAt, v)) -} - -// CreatedAtLT applies the LT predicate on the "createdAt" field. -func CreatedAtLT(v time.Time) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldLT(FieldCreatedAt, v)) -} - -// CreatedAtLTE applies the LTE predicate on the "createdAt" field. -func CreatedAtLTE(v time.Time) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.FieldLTE(FieldCreatedAt, v)) -} - -// And groups predicates with the AND operator between them. -func And(predicates ...predicate.MixProductionTemplate) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.AndPredicates(predicates...)) -} - -// Or groups predicates with the OR operator between them. -func Or(predicates ...predicate.MixProductionTemplate) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.OrPredicates(predicates...)) -} - -// Not applies the not operator on the given predicate. -func Not(p predicate.MixProductionTemplate) predicate.MixProductionTemplate { - return predicate.MixProductionTemplate(sql.NotPredicates(p)) -} diff --git a/bj_power_mes/ent/mixproductiontemplate_create.go b/bj_power_mes/ent/mixproductiontemplate_create.go deleted file mode 100644 index 66c2d94..0000000 --- a/bj_power_mes/ent/mixproductiontemplate_create.go +++ /dev/null @@ -1,322 +0,0 @@ -// Code generated by ent, DO NOT EDIT. - -package ent - -import ( - "bj_power_mes/ent/mixproductiontemplate" - "context" - "errors" - "fmt" - "time" - - "entgo.io/ent/dialect/sql/sqlgraph" - "entgo.io/ent/schema/field" -) - -// MixProductionTemplateCreate is the builder for creating a MixProductionTemplate entity. -type MixProductionTemplateCreate struct { - config - mutation *MixProductionTemplateMutation - hooks []Hook -} - -// SetName sets the "name" field. -func (_c *MixProductionTemplateCreate) SetName(v string) *MixProductionTemplateCreate { - _c.mutation.SetName(v) - return _c -} - -// SetProductCodes sets the "productCodes" field. -func (_c *MixProductionTemplateCreate) SetProductCodes(v string) *MixProductionTemplateCreate { - _c.mutation.SetProductCodes(v) - return _c -} - -// SetNillableProductCodes sets the "productCodes" field if the given value is not nil. -func (_c *MixProductionTemplateCreate) SetNillableProductCodes(v *string) *MixProductionTemplateCreate { - if v != nil { - _c.SetProductCodes(*v) - } - return _c -} - -// SetRemark sets the "remark" field. -func (_c *MixProductionTemplateCreate) SetRemark(v string) *MixProductionTemplateCreate { - _c.mutation.SetRemark(v) - return _c -} - -// SetNillableRemark sets the "remark" field if the given value is not nil. -func (_c *MixProductionTemplateCreate) SetNillableRemark(v *string) *MixProductionTemplateCreate { - if v != nil { - _c.SetRemark(*v) - } - return _c -} - -// SetStatus sets the "status" field. -func (_c *MixProductionTemplateCreate) SetStatus(v string) *MixProductionTemplateCreate { - _c.mutation.SetStatus(v) - return _c -} - -// SetNillableStatus sets the "status" field if the given value is not nil. -func (_c *MixProductionTemplateCreate) SetNillableStatus(v *string) *MixProductionTemplateCreate { - if v != nil { - _c.SetStatus(*v) - } - return _c -} - -// SetCreatedAt sets the "createdAt" field. -func (_c *MixProductionTemplateCreate) SetCreatedAt(v time.Time) *MixProductionTemplateCreate { - _c.mutation.SetCreatedAt(v) - return _c -} - -// SetNillableCreatedAt sets the "createdAt" field if the given value is not nil. -func (_c *MixProductionTemplateCreate) SetNillableCreatedAt(v *time.Time) *MixProductionTemplateCreate { - if v != nil { - _c.SetCreatedAt(*v) - } - return _c -} - -// SetID sets the "id" field. -func (_c *MixProductionTemplateCreate) SetID(v int) *MixProductionTemplateCreate { - _c.mutation.SetID(v) - return _c -} - -// Mutation returns the MixProductionTemplateMutation object of the builder. -func (_c *MixProductionTemplateCreate) Mutation() *MixProductionTemplateMutation { - return _c.mutation -} - -// Save creates the MixProductionTemplate in the database. -func (_c *MixProductionTemplateCreate) Save(ctx context.Context) (*MixProductionTemplate, error) { - _c.defaults() - return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks) -} - -// SaveX calls Save and panics if Save returns an error. -func (_c *MixProductionTemplateCreate) SaveX(ctx context.Context) *MixProductionTemplate { - v, err := _c.Save(ctx) - if err != nil { - panic(err) - } - return v -} - -// Exec executes the query. -func (_c *MixProductionTemplateCreate) Exec(ctx context.Context) error { - _, err := _c.Save(ctx) - return err -} - -// ExecX is like Exec, but panics if an error occurs. -func (_c *MixProductionTemplateCreate) ExecX(ctx context.Context) { - if err := _c.Exec(ctx); err != nil { - panic(err) - } -} - -// defaults sets the default values of the builder before save. -func (_c *MixProductionTemplateCreate) defaults() { - if _, ok := _c.mutation.ProductCodes(); !ok { - v := mixproductiontemplate.DefaultProductCodes - _c.mutation.SetProductCodes(v) - } - if _, ok := _c.mutation.Remark(); !ok { - v := mixproductiontemplate.DefaultRemark - _c.mutation.SetRemark(v) - } - if _, ok := _c.mutation.Status(); !ok { - v := mixproductiontemplate.DefaultStatus - _c.mutation.SetStatus(v) - } - if _, ok := _c.mutation.CreatedAt(); !ok { - v := mixproductiontemplate.DefaultCreatedAt() - _c.mutation.SetCreatedAt(v) - } -} - -// check runs all checks and user-defined validators on the builder. -func (_c *MixProductionTemplateCreate) check() error { - if _, ok := _c.mutation.Name(); !ok { - return &ValidationError{Name: "name", err: errors.New(`ent: missing required field "MixProductionTemplate.name"`)} - } - if v, ok := _c.mutation.Name(); ok { - if err := mixproductiontemplate.NameValidator(v); err != nil { - return &ValidationError{Name: "name", err: fmt.Errorf(`ent: validator failed for field "MixProductionTemplate.name": %w`, err)} - } - } - if _, ok := _c.mutation.ProductCodes(); !ok { - return &ValidationError{Name: "productCodes", err: errors.New(`ent: missing required field "MixProductionTemplate.productCodes"`)} - } - if _, ok := _c.mutation.Remark(); !ok { - return &ValidationError{Name: "remark", err: errors.New(`ent: missing required field "MixProductionTemplate.remark"`)} - } - if v, ok := _c.mutation.Remark(); ok { - if err := mixproductiontemplate.RemarkValidator(v); err != nil { - return &ValidationError{Name: "remark", err: fmt.Errorf(`ent: validator failed for field "MixProductionTemplate.remark": %w`, err)} - } - } - if _, ok := _c.mutation.Status(); !ok { - return &ValidationError{Name: "status", err: errors.New(`ent: missing required field "MixProductionTemplate.status"`)} - } - if v, ok := _c.mutation.Status(); ok { - if err := mixproductiontemplate.StatusValidator(v); err != nil { - return &ValidationError{Name: "status", err: fmt.Errorf(`ent: validator failed for field "MixProductionTemplate.status": %w`, err)} - } - } - if _, ok := _c.mutation.CreatedAt(); !ok { - return &ValidationError{Name: "createdAt", err: errors.New(`ent: missing required field "MixProductionTemplate.createdAt"`)} - } - if v, ok := _c.mutation.ID(); ok { - if err := mixproductiontemplate.IDValidator(v); err != nil { - return &ValidationError{Name: "id", err: fmt.Errorf(`ent: validator failed for field "MixProductionTemplate.id": %w`, err)} - } - } - return nil -} - -func (_c *MixProductionTemplateCreate) sqlSave(ctx context.Context) (*MixProductionTemplate, error) { - if err := _c.check(); err != nil { - return nil, err - } - _node, _spec := _c.createSpec() - if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil { - if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{msg: err.Error(), wrap: err} - } - return nil, err - } - if _spec.ID.Value != _node.ID { - id := _spec.ID.Value.(int64) - _node.ID = int(id) - } - _c.mutation.id = &_node.ID - _c.mutation.done = true - return _node, nil -} - -func (_c *MixProductionTemplateCreate) createSpec() (*MixProductionTemplate, *sqlgraph.CreateSpec) { - var ( - _node = &MixProductionTemplate{config: _c.config} - _spec = sqlgraph.NewCreateSpec(mixproductiontemplate.Table, sqlgraph.NewFieldSpec(mixproductiontemplate.FieldID, field.TypeInt)) - ) - if id, ok := _c.mutation.ID(); ok { - _node.ID = id - _spec.ID.Value = id - } - if value, ok := _c.mutation.Name(); ok { - _spec.SetField(mixproductiontemplate.FieldName, field.TypeString, value) - _node.Name = value - } - if value, ok := _c.mutation.ProductCodes(); ok { - _spec.SetField(mixproductiontemplate.FieldProductCodes, field.TypeString, value) - _node.ProductCodes = value - } - if value, ok := _c.mutation.Remark(); ok { - _spec.SetField(mixproductiontemplate.FieldRemark, field.TypeString, value) - _node.Remark = value - } - if value, ok := _c.mutation.Status(); ok { - _spec.SetField(mixproductiontemplate.FieldStatus, field.TypeString, value) - _node.Status = value - } - if value, ok := _c.mutation.CreatedAt(); ok { - _spec.SetField(mixproductiontemplate.FieldCreatedAt, field.TypeTime, value) - _node.CreatedAt = value - } - return _node, _spec -} - -// MixProductionTemplateCreateBulk is the builder for creating many MixProductionTemplate entities in bulk. -type MixProductionTemplateCreateBulk struct { - config - err error - builders []*MixProductionTemplateCreate -} - -// Save creates the MixProductionTemplate entities in the database. -func (_c *MixProductionTemplateCreateBulk) Save(ctx context.Context) ([]*MixProductionTemplate, error) { - if _c.err != nil { - return nil, _c.err - } - specs := make([]*sqlgraph.CreateSpec, len(_c.builders)) - nodes := make([]*MixProductionTemplate, len(_c.builders)) - mutators := make([]Mutator, len(_c.builders)) - for i := range _c.builders { - func(i int, root context.Context) { - builder := _c.builders[i] - builder.defaults() - var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { - mutation, ok := m.(*MixProductionTemplateMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T", m) - } - if err := builder.check(); err != nil { - return nil, err - } - builder.mutation = mutation - var err error - nodes[i], specs[i] = builder.createSpec() - if i < len(mutators)-1 { - _, err = mutators[i+1].Mutate(root, _c.builders[i+1].mutation) - } else { - spec := &sqlgraph.BatchCreateSpec{Nodes: specs} - // Invoke the actual operation on the latest mutation in the chain. - if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil { - if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{msg: err.Error(), wrap: err} - } - } - } - if err != nil { - return nil, err - } - mutation.id = &nodes[i].ID - if specs[i].ID.Value != nil && nodes[i].ID == 0 { - id := specs[i].ID.Value.(int64) - nodes[i].ID = int(id) - } - mutation.done = true - return nodes[i], nil - }) - for i := len(builder.hooks) - 1; i >= 0; i-- { - mut = builder.hooks[i](mut) - } - mutators[i] = mut - }(i, ctx) - } - if len(mutators) > 0 { - if _, err := mutators[0].Mutate(ctx, _c.builders[0].mutation); err != nil { - return nil, err - } - } - return nodes, nil -} - -// SaveX is like Save, but panics if an error occurs. -func (_c *MixProductionTemplateCreateBulk) SaveX(ctx context.Context) []*MixProductionTemplate { - v, err := _c.Save(ctx) - if err != nil { - panic(err) - } - return v -} - -// Exec executes the query. -func (_c *MixProductionTemplateCreateBulk) Exec(ctx context.Context) error { - _, err := _c.Save(ctx) - return err -} - -// ExecX is like Exec, but panics if an error occurs. -func (_c *MixProductionTemplateCreateBulk) ExecX(ctx context.Context) { - if err := _c.Exec(ctx); err != nil { - panic(err) - } -} diff --git a/bj_power_mes/ent/mixproductiontemplate_delete.go b/bj_power_mes/ent/mixproductiontemplate_delete.go deleted file mode 100644 index 2bc16d7..0000000 --- a/bj_power_mes/ent/mixproductiontemplate_delete.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by ent, DO NOT EDIT. - -package ent - -import ( - "bj_power_mes/ent/mixproductiontemplate" - "bj_power_mes/ent/predicate" - "context" - - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" - "entgo.io/ent/schema/field" -) - -// MixProductionTemplateDelete is the builder for deleting a MixProductionTemplate entity. -type MixProductionTemplateDelete struct { - config - hooks []Hook - mutation *MixProductionTemplateMutation -} - -// Where appends a list predicates to the MixProductionTemplateDelete builder. -func (_d *MixProductionTemplateDelete) Where(ps ...predicate.MixProductionTemplate) *MixProductionTemplateDelete { - _d.mutation.Where(ps...) - return _d -} - -// Exec executes the deletion query and returns how many vertices were deleted. -func (_d *MixProductionTemplateDelete) Exec(ctx context.Context) (int, error) { - return withHooks(ctx, _d.sqlExec, _d.mutation, _d.hooks) -} - -// ExecX is like Exec, but panics if an error occurs. -func (_d *MixProductionTemplateDelete) ExecX(ctx context.Context) int { - n, err := _d.Exec(ctx) - if err != nil { - panic(err) - } - return n -} - -func (_d *MixProductionTemplateDelete) sqlExec(ctx context.Context) (int, error) { - _spec := sqlgraph.NewDeleteSpec(mixproductiontemplate.Table, sqlgraph.NewFieldSpec(mixproductiontemplate.FieldID, field.TypeInt)) - if ps := _d.mutation.predicates; len(ps) > 0 { - _spec.Predicate = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - affected, err := sqlgraph.DeleteNodes(ctx, _d.driver, _spec) - if err != nil && sqlgraph.IsConstraintError(err) { - err = &ConstraintError{msg: err.Error(), wrap: err} - } - _d.mutation.done = true - return affected, err -} - -// MixProductionTemplateDeleteOne is the builder for deleting a single MixProductionTemplate entity. -type MixProductionTemplateDeleteOne struct { - _d *MixProductionTemplateDelete -} - -// Where appends a list predicates to the MixProductionTemplateDelete builder. -func (_d *MixProductionTemplateDeleteOne) Where(ps ...predicate.MixProductionTemplate) *MixProductionTemplateDeleteOne { - _d._d.mutation.Where(ps...) - return _d -} - -// Exec executes the deletion query. -func (_d *MixProductionTemplateDeleteOne) Exec(ctx context.Context) error { - n, err := _d._d.Exec(ctx) - switch { - case err != nil: - return err - case n == 0: - return &NotFoundError{mixproductiontemplate.Label} - default: - return nil - } -} - -// ExecX is like Exec, but panics if an error occurs. -func (_d *MixProductionTemplateDeleteOne) ExecX(ctx context.Context) { - if err := _d.Exec(ctx); err != nil { - panic(err) - } -} diff --git a/bj_power_mes/ent/mixproductiontemplate_query.go b/bj_power_mes/ent/mixproductiontemplate_query.go deleted file mode 100644 index 3c01cd8..0000000 --- a/bj_power_mes/ent/mixproductiontemplate_query.go +++ /dev/null @@ -1,577 +0,0 @@ -// Code generated by ent, DO NOT EDIT. - -package ent - -import ( - "bj_power_mes/ent/mixproductiontemplate" - "bj_power_mes/ent/predicate" - "context" - "fmt" - "math" - - "entgo.io/ent" - "entgo.io/ent/dialect" - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" - "entgo.io/ent/schema/field" -) - -// MixProductionTemplateQuery is the builder for querying MixProductionTemplate entities. -type MixProductionTemplateQuery struct { - config - ctx *QueryContext - order []mixproductiontemplate.OrderOption - inters []Interceptor - predicates []predicate.MixProductionTemplate - modifiers []func(*sql.Selector) - // intermediate query (i.e. traversal path). - sql *sql.Selector - path func(context.Context) (*sql.Selector, error) -} - -// Where adds a new predicate for the MixProductionTemplateQuery builder. -func (_q *MixProductionTemplateQuery) Where(ps ...predicate.MixProductionTemplate) *MixProductionTemplateQuery { - _q.predicates = append(_q.predicates, ps...) - return _q -} - -// Limit the number of records to be returned by this query. -func (_q *MixProductionTemplateQuery) Limit(limit int) *MixProductionTemplateQuery { - _q.ctx.Limit = &limit - return _q -} - -// Offset to start from. -func (_q *MixProductionTemplateQuery) Offset(offset int) *MixProductionTemplateQuery { - _q.ctx.Offset = &offset - return _q -} - -// Unique configures the query builder to filter duplicate records on query. -// By default, unique is set to true, and can be disabled using this method. -func (_q *MixProductionTemplateQuery) Unique(unique bool) *MixProductionTemplateQuery { - _q.ctx.Unique = &unique - return _q -} - -// Order specifies how the records should be ordered. -func (_q *MixProductionTemplateQuery) Order(o ...mixproductiontemplate.OrderOption) *MixProductionTemplateQuery { - _q.order = append(_q.order, o...) - return _q -} - -// First returns the first MixProductionTemplate entity from the query. -// Returns a *NotFoundError when no MixProductionTemplate was found. -func (_q *MixProductionTemplateQuery) First(ctx context.Context) (*MixProductionTemplate, error) { - nodes, err := _q.Limit(1).All(setContextOp(ctx, _q.ctx, ent.OpQueryFirst)) - if err != nil { - return nil, err - } - if len(nodes) == 0 { - return nil, &NotFoundError{mixproductiontemplate.Label} - } - return nodes[0], nil -} - -// FirstX is like First, but panics if an error occurs. -func (_q *MixProductionTemplateQuery) FirstX(ctx context.Context) *MixProductionTemplate { - node, err := _q.First(ctx) - if err != nil && !IsNotFound(err) { - panic(err) - } - return node -} - -// FirstID returns the first MixProductionTemplate ID from the query. -// Returns a *NotFoundError when no MixProductionTemplate ID was found. -func (_q *MixProductionTemplateQuery) FirstID(ctx context.Context) (id int, err error) { - var ids []int - if ids, err = _q.Limit(1).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryFirstID)); err != nil { - return - } - if len(ids) == 0 { - err = &NotFoundError{mixproductiontemplate.Label} - return - } - return ids[0], nil -} - -// FirstIDX is like FirstID, but panics if an error occurs. -func (_q *MixProductionTemplateQuery) FirstIDX(ctx context.Context) int { - id, err := _q.FirstID(ctx) - if err != nil && !IsNotFound(err) { - panic(err) - } - return id -} - -// Only returns a single MixProductionTemplate entity found by the query, ensuring it only returns one. -// Returns a *NotSingularError when more than one MixProductionTemplate entity is found. -// Returns a *NotFoundError when no MixProductionTemplate entities are found. -func (_q *MixProductionTemplateQuery) Only(ctx context.Context) (*MixProductionTemplate, error) { - nodes, err := _q.Limit(2).All(setContextOp(ctx, _q.ctx, ent.OpQueryOnly)) - if err != nil { - return nil, err - } - switch len(nodes) { - case 1: - return nodes[0], nil - case 0: - return nil, &NotFoundError{mixproductiontemplate.Label} - default: - return nil, &NotSingularError{mixproductiontemplate.Label} - } -} - -// OnlyX is like Only, but panics if an error occurs. -func (_q *MixProductionTemplateQuery) OnlyX(ctx context.Context) *MixProductionTemplate { - node, err := _q.Only(ctx) - if err != nil { - panic(err) - } - return node -} - -// OnlyID is like Only, but returns the only MixProductionTemplate ID in the query. -// Returns a *NotSingularError when more than one MixProductionTemplate ID is found. -// Returns a *NotFoundError when no entities are found. -func (_q *MixProductionTemplateQuery) OnlyID(ctx context.Context) (id int, err error) { - var ids []int - if ids, err = _q.Limit(2).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryOnlyID)); err != nil { - return - } - switch len(ids) { - case 1: - id = ids[0] - case 0: - err = &NotFoundError{mixproductiontemplate.Label} - default: - err = &NotSingularError{mixproductiontemplate.Label} - } - return -} - -// OnlyIDX is like OnlyID, but panics if an error occurs. -func (_q *MixProductionTemplateQuery) OnlyIDX(ctx context.Context) int { - id, err := _q.OnlyID(ctx) - if err != nil { - panic(err) - } - return id -} - -// All executes the query and returns a list of MixProductionTemplates. -func (_q *MixProductionTemplateQuery) All(ctx context.Context) ([]*MixProductionTemplate, error) { - ctx = setContextOp(ctx, _q.ctx, ent.OpQueryAll) - if err := _q.prepareQuery(ctx); err != nil { - return nil, err - } - qr := querierAll[[]*MixProductionTemplate, *MixProductionTemplateQuery]() - return withInterceptors[[]*MixProductionTemplate](ctx, _q, qr, _q.inters) -} - -// AllX is like All, but panics if an error occurs. -func (_q *MixProductionTemplateQuery) AllX(ctx context.Context) []*MixProductionTemplate { - nodes, err := _q.All(ctx) - if err != nil { - panic(err) - } - return nodes -} - -// IDs executes the query and returns a list of MixProductionTemplate IDs. -func (_q *MixProductionTemplateQuery) IDs(ctx context.Context) (ids []int, err error) { - if _q.ctx.Unique == nil && _q.path != nil { - _q.Unique(true) - } - ctx = setContextOp(ctx, _q.ctx, ent.OpQueryIDs) - if err = _q.Select(mixproductiontemplate.FieldID).Scan(ctx, &ids); err != nil { - return nil, err - } - return ids, nil -} - -// IDsX is like IDs, but panics if an error occurs. -func (_q *MixProductionTemplateQuery) IDsX(ctx context.Context) []int { - ids, err := _q.IDs(ctx) - if err != nil { - panic(err) - } - return ids -} - -// Count returns the count of the given query. -func (_q *MixProductionTemplateQuery) Count(ctx context.Context) (int, error) { - ctx = setContextOp(ctx, _q.ctx, ent.OpQueryCount) - if err := _q.prepareQuery(ctx); err != nil { - return 0, err - } - return withInterceptors[int](ctx, _q, querierCount[*MixProductionTemplateQuery](), _q.inters) -} - -// CountX is like Count, but panics if an error occurs. -func (_q *MixProductionTemplateQuery) CountX(ctx context.Context) int { - count, err := _q.Count(ctx) - if err != nil { - panic(err) - } - return count -} - -// Exist returns true if the query has elements in the graph. -func (_q *MixProductionTemplateQuery) Exist(ctx context.Context) (bool, error) { - ctx = setContextOp(ctx, _q.ctx, ent.OpQueryExist) - switch _, err := _q.FirstID(ctx); { - case IsNotFound(err): - return false, nil - case err != nil: - return false, fmt.Errorf("ent: check existence: %w", err) - default: - return true, nil - } -} - -// ExistX is like Exist, but panics if an error occurs. -func (_q *MixProductionTemplateQuery) ExistX(ctx context.Context) bool { - exist, err := _q.Exist(ctx) - if err != nil { - panic(err) - } - return exist -} - -// Clone returns a duplicate of the MixProductionTemplateQuery builder, including all associated steps. It can be -// used to prepare common query builders and use them differently after the clone is made. -func (_q *MixProductionTemplateQuery) Clone() *MixProductionTemplateQuery { - if _q == nil { - return nil - } - return &MixProductionTemplateQuery{ - config: _q.config, - ctx: _q.ctx.Clone(), - order: append([]mixproductiontemplate.OrderOption{}, _q.order...), - inters: append([]Interceptor{}, _q.inters...), - predicates: append([]predicate.MixProductionTemplate{}, _q.predicates...), - // clone intermediate query. - sql: _q.sql.Clone(), - path: _q.path, - modifiers: append([]func(*sql.Selector){}, _q.modifiers...), - } -} - -// GroupBy is used to group vertices by one or more fields/columns. -// It is often used with aggregate functions, like: count, max, mean, min, sum. -// -// Example: -// -// var v []struct { -// Name string `json:"name,omitempty"` -// Count int `json:"count,omitempty"` -// } -// -// client.MixProductionTemplate.Query(). -// GroupBy(mixproductiontemplate.FieldName). -// Aggregate(ent.Count()). -// Scan(ctx, &v) -func (_q *MixProductionTemplateQuery) GroupBy(field string, fields ...string) *MixProductionTemplateGroupBy { - _q.ctx.Fields = append([]string{field}, fields...) - grbuild := &MixProductionTemplateGroupBy{build: _q} - grbuild.flds = &_q.ctx.Fields - grbuild.label = mixproductiontemplate.Label - grbuild.scan = grbuild.Scan - return grbuild -} - -// Select allows the selection one or more fields/columns for the given query, -// instead of selecting all fields in the entity. -// -// Example: -// -// var v []struct { -// Name string `json:"name,omitempty"` -// } -// -// client.MixProductionTemplate.Query(). -// Select(mixproductiontemplate.FieldName). -// Scan(ctx, &v) -func (_q *MixProductionTemplateQuery) Select(fields ...string) *MixProductionTemplateSelect { - _q.ctx.Fields = append(_q.ctx.Fields, fields...) - sbuild := &MixProductionTemplateSelect{MixProductionTemplateQuery: _q} - sbuild.label = mixproductiontemplate.Label - sbuild.flds, sbuild.scan = &_q.ctx.Fields, sbuild.Scan - return sbuild -} - -// Aggregate returns a MixProductionTemplateSelect configured with the given aggregations. -func (_q *MixProductionTemplateQuery) Aggregate(fns ...AggregateFunc) *MixProductionTemplateSelect { - return _q.Select().Aggregate(fns...) -} - -func (_q *MixProductionTemplateQuery) prepareQuery(ctx context.Context) error { - for _, inter := range _q.inters { - if inter == nil { - return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)") - } - if trv, ok := inter.(Traverser); ok { - if err := trv.Traverse(ctx, _q); err != nil { - return err - } - } - } - for _, f := range _q.ctx.Fields { - if !mixproductiontemplate.ValidColumn(f) { - return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} - } - } - if _q.path != nil { - prev, err := _q.path(ctx) - if err != nil { - return err - } - _q.sql = prev - } - return nil -} - -func (_q *MixProductionTemplateQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*MixProductionTemplate, error) { - var ( - nodes = []*MixProductionTemplate{} - _spec = _q.querySpec() - ) - _spec.ScanValues = func(columns []string) ([]any, error) { - return (*MixProductionTemplate).scanValues(nil, columns) - } - _spec.Assign = func(columns []string, values []any) error { - node := &MixProductionTemplate{config: _q.config} - nodes = append(nodes, node) - return node.assignValues(columns, values) - } - if len(_q.modifiers) > 0 { - _spec.Modifiers = _q.modifiers - } - for i := range hooks { - hooks[i](ctx, _spec) - } - if err := sqlgraph.QueryNodes(ctx, _q.driver, _spec); err != nil { - return nil, err - } - if len(nodes) == 0 { - return nodes, nil - } - return nodes, nil -} - -func (_q *MixProductionTemplateQuery) sqlCount(ctx context.Context) (int, error) { - _spec := _q.querySpec() - if len(_q.modifiers) > 0 { - _spec.Modifiers = _q.modifiers - } - _spec.Node.Columns = _q.ctx.Fields - if len(_q.ctx.Fields) > 0 { - _spec.Unique = _q.ctx.Unique != nil && *_q.ctx.Unique - } - return sqlgraph.CountNodes(ctx, _q.driver, _spec) -} - -func (_q *MixProductionTemplateQuery) querySpec() *sqlgraph.QuerySpec { - _spec := sqlgraph.NewQuerySpec(mixproductiontemplate.Table, mixproductiontemplate.Columns, sqlgraph.NewFieldSpec(mixproductiontemplate.FieldID, field.TypeInt)) - _spec.From = _q.sql - if unique := _q.ctx.Unique; unique != nil { - _spec.Unique = *unique - } else if _q.path != nil { - _spec.Unique = true - } - if fields := _q.ctx.Fields; len(fields) > 0 { - _spec.Node.Columns = make([]string, 0, len(fields)) - _spec.Node.Columns = append(_spec.Node.Columns, mixproductiontemplate.FieldID) - for i := range fields { - if fields[i] != mixproductiontemplate.FieldID { - _spec.Node.Columns = append(_spec.Node.Columns, fields[i]) - } - } - } - if ps := _q.predicates; len(ps) > 0 { - _spec.Predicate = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - if limit := _q.ctx.Limit; limit != nil { - _spec.Limit = *limit - } - if offset := _q.ctx.Offset; offset != nil { - _spec.Offset = *offset - } - if ps := _q.order; len(ps) > 0 { - _spec.Order = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - return _spec -} - -func (_q *MixProductionTemplateQuery) sqlQuery(ctx context.Context) *sql.Selector { - builder := sql.Dialect(_q.driver.Dialect()) - t1 := builder.Table(mixproductiontemplate.Table) - columns := _q.ctx.Fields - if len(columns) == 0 { - columns = mixproductiontemplate.Columns - } - selector := builder.Select(t1.Columns(columns...)...).From(t1) - if _q.sql != nil { - selector = _q.sql - selector.Select(selector.Columns(columns...)...) - } - if _q.ctx.Unique != nil && *_q.ctx.Unique { - selector.Distinct() - } - for _, m := range _q.modifiers { - m(selector) - } - for _, p := range _q.predicates { - p(selector) - } - for _, p := range _q.order { - p(selector) - } - if offset := _q.ctx.Offset; offset != nil { - // limit is mandatory for offset clause. We start - // with default value, and override it below if needed. - selector.Offset(*offset).Limit(math.MaxInt32) - } - if limit := _q.ctx.Limit; limit != nil { - selector.Limit(*limit) - } - return selector -} - -// ForUpdate locks the selected rows against concurrent updates, and prevent them from being -// updated, deleted or "selected ... for update" by other sessions, until the transaction is -// either committed or rolled-back. -func (_q *MixProductionTemplateQuery) ForUpdate(opts ...sql.LockOption) *MixProductionTemplateQuery { - if _q.driver.Dialect() == dialect.Postgres { - _q.Unique(false) - } - _q.modifiers = append(_q.modifiers, func(s *sql.Selector) { - s.ForUpdate(opts...) - }) - return _q -} - -// ForShare behaves similarly to ForUpdate, except that it acquires a shared mode lock -// on any rows that are read. Other sessions can read the rows, but cannot modify them -// until your transaction commits. -func (_q *MixProductionTemplateQuery) ForShare(opts ...sql.LockOption) *MixProductionTemplateQuery { - if _q.driver.Dialect() == dialect.Postgres { - _q.Unique(false) - } - _q.modifiers = append(_q.modifiers, func(s *sql.Selector) { - s.ForShare(opts...) - }) - return _q -} - -// Modify adds a query modifier for attaching custom logic to queries. -func (_q *MixProductionTemplateQuery) Modify(modifiers ...func(s *sql.Selector)) *MixProductionTemplateSelect { - _q.modifiers = append(_q.modifiers, modifiers...) - return _q.Select() -} - -// MixProductionTemplateGroupBy is the group-by builder for MixProductionTemplate entities. -type MixProductionTemplateGroupBy struct { - selector - build *MixProductionTemplateQuery -} - -// Aggregate adds the given aggregation functions to the group-by query. -func (_g *MixProductionTemplateGroupBy) Aggregate(fns ...AggregateFunc) *MixProductionTemplateGroupBy { - _g.fns = append(_g.fns, fns...) - return _g -} - -// Scan applies the selector query and scans the result into the given value. -func (_g *MixProductionTemplateGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) - if err := _g.build.prepareQuery(ctx); err != nil { - return err - } - return scanWithInterceptors[*MixProductionTemplateQuery, *MixProductionTemplateGroupBy](ctx, _g.build, _g, _g.build.inters, v) -} - -func (_g *MixProductionTemplateGroupBy) sqlScan(ctx context.Context, root *MixProductionTemplateQuery, v any) error { - selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(_g.fns)) - for _, fn := range _g.fns { - aggregation = append(aggregation, fn(selector)) - } - if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) - for _, f := range *_g.flds { - columns = append(columns, selector.C(f)) - } - columns = append(columns, aggregation...) - selector.Select(columns...) - } - selector.GroupBy(selector.Columns(*_g.flds...)...) - if err := selector.Err(); err != nil { - return err - } - rows := &sql.Rows{} - query, args := selector.Query() - if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { - return err - } - defer rows.Close() - return sql.ScanSlice(rows, v) -} - -// MixProductionTemplateSelect is the builder for selecting fields of MixProductionTemplate entities. -type MixProductionTemplateSelect struct { - *MixProductionTemplateQuery - selector -} - -// Aggregate adds the given aggregation functions to the selector query. -func (_s *MixProductionTemplateSelect) Aggregate(fns ...AggregateFunc) *MixProductionTemplateSelect { - _s.fns = append(_s.fns, fns...) - return _s -} - -// Scan applies the selector query and scans the result into the given value. -func (_s *MixProductionTemplateSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) - if err := _s.prepareQuery(ctx); err != nil { - return err - } - return scanWithInterceptors[*MixProductionTemplateQuery, *MixProductionTemplateSelect](ctx, _s.MixProductionTemplateQuery, _s, _s.inters, v) -} - -func (_s *MixProductionTemplateSelect) sqlScan(ctx context.Context, root *MixProductionTemplateQuery, v any) error { - selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(_s.fns)) - for _, fn := range _s.fns { - aggregation = append(aggregation, fn(selector)) - } - switch n := len(*_s.selector.flds); { - case n == 0 && len(aggregation) > 0: - selector.Select(aggregation...) - case n != 0 && len(aggregation) > 0: - selector.AppendSelect(aggregation...) - } - rows := &sql.Rows{} - query, args := selector.Query() - if err := _s.driver.Query(ctx, query, args, rows); err != nil { - return err - } - defer rows.Close() - return sql.ScanSlice(rows, v) -} - -// Modify adds a query modifier for attaching custom logic to queries. -func (_s *MixProductionTemplateSelect) Modify(modifiers ...func(s *sql.Selector)) *MixProductionTemplateSelect { - _s.modifiers = append(_s.modifiers, modifiers...) - return _s -} diff --git a/bj_power_mes/ent/mixproductiontemplate_update.go b/bj_power_mes/ent/mixproductiontemplate_update.go deleted file mode 100644 index 8c78f43..0000000 --- a/bj_power_mes/ent/mixproductiontemplate_update.go +++ /dev/null @@ -1,373 +0,0 @@ -// Code generated by ent, DO NOT EDIT. - -package ent - -import ( - "bj_power_mes/ent/mixproductiontemplate" - "bj_power_mes/ent/predicate" - "context" - "errors" - "fmt" - - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" - "entgo.io/ent/schema/field" -) - -// MixProductionTemplateUpdate is the builder for updating MixProductionTemplate entities. -type MixProductionTemplateUpdate struct { - config - hooks []Hook - mutation *MixProductionTemplateMutation - modifiers []func(*sql.UpdateBuilder) -} - -// Where appends a list predicates to the MixProductionTemplateUpdate builder. -func (_u *MixProductionTemplateUpdate) Where(ps ...predicate.MixProductionTemplate) *MixProductionTemplateUpdate { - _u.mutation.Where(ps...) - return _u -} - -// SetName sets the "name" field. -func (_u *MixProductionTemplateUpdate) SetName(v string) *MixProductionTemplateUpdate { - _u.mutation.SetName(v) - return _u -} - -// SetNillableName sets the "name" field if the given value is not nil. -func (_u *MixProductionTemplateUpdate) SetNillableName(v *string) *MixProductionTemplateUpdate { - if v != nil { - _u.SetName(*v) - } - return _u -} - -// SetProductCodes sets the "productCodes" field. -func (_u *MixProductionTemplateUpdate) SetProductCodes(v string) *MixProductionTemplateUpdate { - _u.mutation.SetProductCodes(v) - return _u -} - -// SetNillableProductCodes sets the "productCodes" field if the given value is not nil. -func (_u *MixProductionTemplateUpdate) SetNillableProductCodes(v *string) *MixProductionTemplateUpdate { - if v != nil { - _u.SetProductCodes(*v) - } - return _u -} - -// SetRemark sets the "remark" field. -func (_u *MixProductionTemplateUpdate) SetRemark(v string) *MixProductionTemplateUpdate { - _u.mutation.SetRemark(v) - return _u -} - -// SetNillableRemark sets the "remark" field if the given value is not nil. -func (_u *MixProductionTemplateUpdate) SetNillableRemark(v *string) *MixProductionTemplateUpdate { - if v != nil { - _u.SetRemark(*v) - } - return _u -} - -// SetStatus sets the "status" field. -func (_u *MixProductionTemplateUpdate) SetStatus(v string) *MixProductionTemplateUpdate { - _u.mutation.SetStatus(v) - return _u -} - -// SetNillableStatus sets the "status" field if the given value is not nil. -func (_u *MixProductionTemplateUpdate) SetNillableStatus(v *string) *MixProductionTemplateUpdate { - if v != nil { - _u.SetStatus(*v) - } - return _u -} - -// Mutation returns the MixProductionTemplateMutation object of the builder. -func (_u *MixProductionTemplateUpdate) Mutation() *MixProductionTemplateMutation { - return _u.mutation -} - -// Save executes the query and returns the number of nodes affected by the update operation. -func (_u *MixProductionTemplateUpdate) Save(ctx context.Context) (int, error) { - return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks) -} - -// SaveX is like Save, but panics if an error occurs. -func (_u *MixProductionTemplateUpdate) SaveX(ctx context.Context) int { - affected, err := _u.Save(ctx) - if err != nil { - panic(err) - } - return affected -} - -// Exec executes the query. -func (_u *MixProductionTemplateUpdate) Exec(ctx context.Context) error { - _, err := _u.Save(ctx) - return err -} - -// ExecX is like Exec, but panics if an error occurs. -func (_u *MixProductionTemplateUpdate) ExecX(ctx context.Context) { - if err := _u.Exec(ctx); err != nil { - panic(err) - } -} - -// check runs all checks and user-defined validators on the builder. -func (_u *MixProductionTemplateUpdate) check() error { - if v, ok := _u.mutation.Name(); ok { - if err := mixproductiontemplate.NameValidator(v); err != nil { - return &ValidationError{Name: "name", err: fmt.Errorf(`ent: validator failed for field "MixProductionTemplate.name": %w`, err)} - } - } - if v, ok := _u.mutation.Remark(); ok { - if err := mixproductiontemplate.RemarkValidator(v); err != nil { - return &ValidationError{Name: "remark", err: fmt.Errorf(`ent: validator failed for field "MixProductionTemplate.remark": %w`, err)} - } - } - if v, ok := _u.mutation.Status(); ok { - if err := mixproductiontemplate.StatusValidator(v); err != nil { - return &ValidationError{Name: "status", err: fmt.Errorf(`ent: validator failed for field "MixProductionTemplate.status": %w`, err)} - } - } - return nil -} - -// Modify adds a statement modifier for attaching custom logic to the UPDATE statement. -func (_u *MixProductionTemplateUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *MixProductionTemplateUpdate { - _u.modifiers = append(_u.modifiers, modifiers...) - return _u -} - -func (_u *MixProductionTemplateUpdate) sqlSave(ctx context.Context) (_node int, err error) { - if err := _u.check(); err != nil { - return _node, err - } - _spec := sqlgraph.NewUpdateSpec(mixproductiontemplate.Table, mixproductiontemplate.Columns, sqlgraph.NewFieldSpec(mixproductiontemplate.FieldID, field.TypeInt)) - if ps := _u.mutation.predicates; len(ps) > 0 { - _spec.Predicate = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - if value, ok := _u.mutation.Name(); ok { - _spec.SetField(mixproductiontemplate.FieldName, field.TypeString, value) - } - if value, ok := _u.mutation.ProductCodes(); ok { - _spec.SetField(mixproductiontemplate.FieldProductCodes, field.TypeString, value) - } - if value, ok := _u.mutation.Remark(); ok { - _spec.SetField(mixproductiontemplate.FieldRemark, field.TypeString, value) - } - if value, ok := _u.mutation.Status(); ok { - _spec.SetField(mixproductiontemplate.FieldStatus, field.TypeString, value) - } - _spec.AddModifiers(_u.modifiers...) - if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil { - if _, ok := err.(*sqlgraph.NotFoundError); ok { - err = &NotFoundError{mixproductiontemplate.Label} - } else if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{msg: err.Error(), wrap: err} - } - return 0, err - } - _u.mutation.done = true - return _node, nil -} - -// MixProductionTemplateUpdateOne is the builder for updating a single MixProductionTemplate entity. -type MixProductionTemplateUpdateOne struct { - config - fields []string - hooks []Hook - mutation *MixProductionTemplateMutation - modifiers []func(*sql.UpdateBuilder) -} - -// SetName sets the "name" field. -func (_u *MixProductionTemplateUpdateOne) SetName(v string) *MixProductionTemplateUpdateOne { - _u.mutation.SetName(v) - return _u -} - -// SetNillableName sets the "name" field if the given value is not nil. -func (_u *MixProductionTemplateUpdateOne) SetNillableName(v *string) *MixProductionTemplateUpdateOne { - if v != nil { - _u.SetName(*v) - } - return _u -} - -// SetProductCodes sets the "productCodes" field. -func (_u *MixProductionTemplateUpdateOne) SetProductCodes(v string) *MixProductionTemplateUpdateOne { - _u.mutation.SetProductCodes(v) - return _u -} - -// SetNillableProductCodes sets the "productCodes" field if the given value is not nil. -func (_u *MixProductionTemplateUpdateOne) SetNillableProductCodes(v *string) *MixProductionTemplateUpdateOne { - if v != nil { - _u.SetProductCodes(*v) - } - return _u -} - -// SetRemark sets the "remark" field. -func (_u *MixProductionTemplateUpdateOne) SetRemark(v string) *MixProductionTemplateUpdateOne { - _u.mutation.SetRemark(v) - return _u -} - -// SetNillableRemark sets the "remark" field if the given value is not nil. -func (_u *MixProductionTemplateUpdateOne) SetNillableRemark(v *string) *MixProductionTemplateUpdateOne { - if v != nil { - _u.SetRemark(*v) - } - return _u -} - -// SetStatus sets the "status" field. -func (_u *MixProductionTemplateUpdateOne) SetStatus(v string) *MixProductionTemplateUpdateOne { - _u.mutation.SetStatus(v) - return _u -} - -// SetNillableStatus sets the "status" field if the given value is not nil. -func (_u *MixProductionTemplateUpdateOne) SetNillableStatus(v *string) *MixProductionTemplateUpdateOne { - if v != nil { - _u.SetStatus(*v) - } - return _u -} - -// Mutation returns the MixProductionTemplateMutation object of the builder. -func (_u *MixProductionTemplateUpdateOne) Mutation() *MixProductionTemplateMutation { - return _u.mutation -} - -// Where appends a list predicates to the MixProductionTemplateUpdate builder. -func (_u *MixProductionTemplateUpdateOne) Where(ps ...predicate.MixProductionTemplate) *MixProductionTemplateUpdateOne { - _u.mutation.Where(ps...) - return _u -} - -// Select allows selecting one or more fields (columns) of the returned entity. -// The default is selecting all fields defined in the entity schema. -func (_u *MixProductionTemplateUpdateOne) Select(field string, fields ...string) *MixProductionTemplateUpdateOne { - _u.fields = append([]string{field}, fields...) - return _u -} - -// Save executes the query and returns the updated MixProductionTemplate entity. -func (_u *MixProductionTemplateUpdateOne) Save(ctx context.Context) (*MixProductionTemplate, error) { - return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks) -} - -// SaveX is like Save, but panics if an error occurs. -func (_u *MixProductionTemplateUpdateOne) SaveX(ctx context.Context) *MixProductionTemplate { - node, err := _u.Save(ctx) - if err != nil { - panic(err) - } - return node -} - -// Exec executes the query on the entity. -func (_u *MixProductionTemplateUpdateOne) Exec(ctx context.Context) error { - _, err := _u.Save(ctx) - return err -} - -// ExecX is like Exec, but panics if an error occurs. -func (_u *MixProductionTemplateUpdateOne) ExecX(ctx context.Context) { - if err := _u.Exec(ctx); err != nil { - panic(err) - } -} - -// check runs all checks and user-defined validators on the builder. -func (_u *MixProductionTemplateUpdateOne) check() error { - if v, ok := _u.mutation.Name(); ok { - if err := mixproductiontemplate.NameValidator(v); err != nil { - return &ValidationError{Name: "name", err: fmt.Errorf(`ent: validator failed for field "MixProductionTemplate.name": %w`, err)} - } - } - if v, ok := _u.mutation.Remark(); ok { - if err := mixproductiontemplate.RemarkValidator(v); err != nil { - return &ValidationError{Name: "remark", err: fmt.Errorf(`ent: validator failed for field "MixProductionTemplate.remark": %w`, err)} - } - } - if v, ok := _u.mutation.Status(); ok { - if err := mixproductiontemplate.StatusValidator(v); err != nil { - return &ValidationError{Name: "status", err: fmt.Errorf(`ent: validator failed for field "MixProductionTemplate.status": %w`, err)} - } - } - return nil -} - -// Modify adds a statement modifier for attaching custom logic to the UPDATE statement. -func (_u *MixProductionTemplateUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *MixProductionTemplateUpdateOne { - _u.modifiers = append(_u.modifiers, modifiers...) - return _u -} - -func (_u *MixProductionTemplateUpdateOne) sqlSave(ctx context.Context) (_node *MixProductionTemplate, err error) { - if err := _u.check(); err != nil { - return _node, err - } - _spec := sqlgraph.NewUpdateSpec(mixproductiontemplate.Table, mixproductiontemplate.Columns, sqlgraph.NewFieldSpec(mixproductiontemplate.FieldID, field.TypeInt)) - id, ok := _u.mutation.ID() - if !ok { - return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "MixProductionTemplate.id" for update`)} - } - _spec.Node.ID.Value = id - if fields := _u.fields; len(fields) > 0 { - _spec.Node.Columns = make([]string, 0, len(fields)) - _spec.Node.Columns = append(_spec.Node.Columns, mixproductiontemplate.FieldID) - for _, f := range fields { - if !mixproductiontemplate.ValidColumn(f) { - return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} - } - if f != mixproductiontemplate.FieldID { - _spec.Node.Columns = append(_spec.Node.Columns, f) - } - } - } - if ps := _u.mutation.predicates; len(ps) > 0 { - _spec.Predicate = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - if value, ok := _u.mutation.Name(); ok { - _spec.SetField(mixproductiontemplate.FieldName, field.TypeString, value) - } - if value, ok := _u.mutation.ProductCodes(); ok { - _spec.SetField(mixproductiontemplate.FieldProductCodes, field.TypeString, value) - } - if value, ok := _u.mutation.Remark(); ok { - _spec.SetField(mixproductiontemplate.FieldRemark, field.TypeString, value) - } - if value, ok := _u.mutation.Status(); ok { - _spec.SetField(mixproductiontemplate.FieldStatus, field.TypeString, value) - } - _spec.AddModifiers(_u.modifiers...) - _node = &MixProductionTemplate{config: _u.config} - _spec.Assign = _node.assignValues - _spec.ScanValues = _node.scanValues - if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil { - if _, ok := err.(*sqlgraph.NotFoundError); ok { - err = &NotFoundError{mixproductiontemplate.Label} - } else if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{msg: err.Error(), wrap: err} - } - return nil, err - } - _u.mutation.done = true - return _node, nil -} diff --git a/bj_power_mes/ent/mutation.go b/bj_power_mes/ent/mutation.go index de25b36..353c69b 100644 --- a/bj_power_mes/ent/mutation.go +++ b/bj_power_mes/ent/mutation.go @@ -15,14 +15,12 @@ import ( "bj_power_mes/ent/dailyplan" "bj_power_mes/ent/dock" "bj_power_mes/ent/eventlog" - "bj_power_mes/ent/flowmaterial" "bj_power_mes/ent/inspectionrecord" "bj_power_mes/ent/linepoint" "bj_power_mes/ent/lossledger" "bj_power_mes/ent/material" "bj_power_mes/ent/materialqtyreport" "bj_power_mes/ent/materialrequest" - "bj_power_mes/ent/mixproductiontemplate" "bj_power_mes/ent/permission" "bj_power_mes/ent/plcsendlog" "bj_power_mes/ent/predicate" @@ -84,14 +82,12 @@ const ( TypeDailyPlan = "DailyPlan" TypeDock = "Dock" TypeEventLog = "EventLog" - TypeFlowMaterial = "FlowMaterial" TypeInspectionRecord = "InspectionRecord" TypeLinePoint = "LinePoint" TypeLossLedger = "LossLedger" TypeMaterial = "Material" TypeMaterialQtyReport = "MaterialQtyReport" TypeMaterialRequest = "MaterialRequest" - TypeMixProductionTemplate = "MixProductionTemplate" TypePermission = "Permission" TypePlcSendLog = "PlcSendLog" TypeProcessFlow = "ProcessFlow" @@ -11736,905 +11732,6 @@ func (m *EventLogMutation) ResetEdge(name string) error { return fmt.Errorf("unknown EventLog edge %s", name) } -// FlowMaterialMutation represents an operation that mutates the FlowMaterial nodes in the graph. -type FlowMaterialMutation struct { - config - op Op - typ string - id *int - flowId *int - addflowId *int - materialCode *string - materialName *string - spec *string - unit *string - snMode *int - addsnMode *int - unitQty *float64 - addunitQty *float64 - lossRate *float64 - addlossRate *float64 - createdAt *time.Time - clearedFields map[string]struct{} - done bool - oldValue func(context.Context) (*FlowMaterial, error) - predicates []predicate.FlowMaterial -} - -var _ ent.Mutation = (*FlowMaterialMutation)(nil) - -// flowmaterialOption allows management of the mutation configuration using functional options. -type flowmaterialOption func(*FlowMaterialMutation) - -// newFlowMaterialMutation creates new mutation for the FlowMaterial entity. -func newFlowMaterialMutation(c config, op Op, opts ...flowmaterialOption) *FlowMaterialMutation { - m := &FlowMaterialMutation{ - config: c, - op: op, - typ: TypeFlowMaterial, - clearedFields: make(map[string]struct{}), - } - for _, opt := range opts { - opt(m) - } - return m -} - -// withFlowMaterialID sets the ID field of the mutation. -func withFlowMaterialID(id int) flowmaterialOption { - return func(m *FlowMaterialMutation) { - var ( - err error - once sync.Once - value *FlowMaterial - ) - m.oldValue = func(ctx context.Context) (*FlowMaterial, error) { - once.Do(func() { - if m.done { - err = errors.New("querying old values post mutation is not allowed") - } else { - value, err = m.Client().FlowMaterial.Get(ctx, id) - } - }) - return value, err - } - m.id = &id - } -} - -// withFlowMaterial sets the old FlowMaterial of the mutation. -func withFlowMaterial(node *FlowMaterial) flowmaterialOption { - return func(m *FlowMaterialMutation) { - m.oldValue = func(context.Context) (*FlowMaterial, error) { - return node, nil - } - m.id = &node.ID - } -} - -// Client returns a new `ent.Client` from the mutation. If the mutation was -// executed in a transaction (ent.Tx), a transactional client is returned. -func (m FlowMaterialMutation) Client() *Client { - client := &Client{config: m.config} - client.init() - return client -} - -// Tx returns an `ent.Tx` for mutations that were executed in transactions; -// it returns an error otherwise. -func (m FlowMaterialMutation) Tx() (*Tx, error) { - if _, ok := m.driver.(*txDriver); !ok { - return nil, errors.New("ent: mutation is not running in a transaction") - } - tx := &Tx{config: m.config} - tx.init() - return tx, nil -} - -// SetID sets the value of the id field. Note that this -// operation is only accepted on creation of FlowMaterial entities. -func (m *FlowMaterialMutation) SetID(id int) { - m.id = &id -} - -// ID returns the ID value in the mutation. Note that the ID is only available -// if it was provided to the builder or after it was returned from the database. -func (m *FlowMaterialMutation) ID() (id int, exists bool) { - if m.id == nil { - return - } - return *m.id, true -} - -// IDs queries the database and returns the entity ids that match the mutation's predicate. -// That means, if the mutation is applied within a transaction with an isolation level such -// as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated -// or updated by the mutation. -func (m *FlowMaterialMutation) IDs(ctx context.Context) ([]int, error) { - switch { - case m.op.Is(OpUpdateOne | OpDeleteOne): - id, exists := m.ID() - if exists { - return []int{id}, nil - } - fallthrough - case m.op.Is(OpUpdate | OpDelete): - return m.Client().FlowMaterial.Query().Where(m.predicates...).IDs(ctx) - default: - return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op) - } -} - -// SetFlowId sets the "flowId" field. -func (m *FlowMaterialMutation) SetFlowId(i int) { - m.flowId = &i - m.addflowId = nil -} - -// FlowId returns the value of the "flowId" field in the mutation. -func (m *FlowMaterialMutation) FlowId() (r int, exists bool) { - v := m.flowId - if v == nil { - return - } - return *v, true -} - -// OldFlowId returns the old "flowId" field's value of the FlowMaterial entity. -// If the FlowMaterial object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *FlowMaterialMutation) OldFlowId(ctx context.Context) (v int, err error) { - if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldFlowId is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, errors.New("OldFlowId requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldFlowId: %w", err) - } - return oldValue.FlowId, nil -} - -// AddFlowId adds i to the "flowId" field. -func (m *FlowMaterialMutation) AddFlowId(i int) { - if m.addflowId != nil { - *m.addflowId += i - } else { - m.addflowId = &i - } -} - -// AddedFlowId returns the value that was added to the "flowId" field in this mutation. -func (m *FlowMaterialMutation) AddedFlowId() (r int, exists bool) { - v := m.addflowId - if v == nil { - return - } - return *v, true -} - -// ResetFlowId resets all changes to the "flowId" field. -func (m *FlowMaterialMutation) ResetFlowId() { - m.flowId = nil - m.addflowId = nil -} - -// SetMaterialCode sets the "materialCode" field. -func (m *FlowMaterialMutation) SetMaterialCode(s string) { - m.materialCode = &s -} - -// MaterialCode returns the value of the "materialCode" field in the mutation. -func (m *FlowMaterialMutation) MaterialCode() (r string, exists bool) { - v := m.materialCode - if v == nil { - return - } - return *v, true -} - -// OldMaterialCode returns the old "materialCode" field's value of the FlowMaterial entity. -// If the FlowMaterial object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *FlowMaterialMutation) OldMaterialCode(ctx context.Context) (v string, err error) { - if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldMaterialCode is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, errors.New("OldMaterialCode requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldMaterialCode: %w", err) - } - return oldValue.MaterialCode, nil -} - -// ResetMaterialCode resets all changes to the "materialCode" field. -func (m *FlowMaterialMutation) ResetMaterialCode() { - m.materialCode = nil -} - -// SetMaterialName sets the "materialName" field. -func (m *FlowMaterialMutation) SetMaterialName(s string) { - m.materialName = &s -} - -// MaterialName returns the value of the "materialName" field in the mutation. -func (m *FlowMaterialMutation) MaterialName() (r string, exists bool) { - v := m.materialName - if v == nil { - return - } - return *v, true -} - -// OldMaterialName returns the old "materialName" field's value of the FlowMaterial entity. -// If the FlowMaterial object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *FlowMaterialMutation) OldMaterialName(ctx context.Context) (v string, err error) { - if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldMaterialName is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, errors.New("OldMaterialName requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldMaterialName: %w", err) - } - return oldValue.MaterialName, nil -} - -// ResetMaterialName resets all changes to the "materialName" field. -func (m *FlowMaterialMutation) ResetMaterialName() { - m.materialName = nil -} - -// SetSpec sets the "spec" field. -func (m *FlowMaterialMutation) SetSpec(s string) { - m.spec = &s -} - -// Spec returns the value of the "spec" field in the mutation. -func (m *FlowMaterialMutation) Spec() (r string, exists bool) { - v := m.spec - if v == nil { - return - } - return *v, true -} - -// OldSpec returns the old "spec" field's value of the FlowMaterial entity. -// If the FlowMaterial object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *FlowMaterialMutation) OldSpec(ctx context.Context) (v string, err error) { - if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldSpec is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, errors.New("OldSpec requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldSpec: %w", err) - } - return oldValue.Spec, nil -} - -// ResetSpec resets all changes to the "spec" field. -func (m *FlowMaterialMutation) ResetSpec() { - m.spec = nil -} - -// SetUnit sets the "unit" field. -func (m *FlowMaterialMutation) SetUnit(s string) { - m.unit = &s -} - -// Unit returns the value of the "unit" field in the mutation. -func (m *FlowMaterialMutation) Unit() (r string, exists bool) { - v := m.unit - if v == nil { - return - } - return *v, true -} - -// OldUnit returns the old "unit" field's value of the FlowMaterial entity. -// If the FlowMaterial object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *FlowMaterialMutation) OldUnit(ctx context.Context) (v string, err error) { - if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldUnit is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, errors.New("OldUnit requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldUnit: %w", err) - } - return oldValue.Unit, nil -} - -// ResetUnit resets all changes to the "unit" field. -func (m *FlowMaterialMutation) ResetUnit() { - m.unit = nil -} - -// SetSnMode sets the "snMode" field. -func (m *FlowMaterialMutation) SetSnMode(i int) { - m.snMode = &i - m.addsnMode = nil -} - -// SnMode returns the value of the "snMode" field in the mutation. -func (m *FlowMaterialMutation) SnMode() (r int, exists bool) { - v := m.snMode - if v == nil { - return - } - return *v, true -} - -// OldSnMode returns the old "snMode" field's value of the FlowMaterial entity. -// If the FlowMaterial object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *FlowMaterialMutation) OldSnMode(ctx context.Context) (v int, err error) { - if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldSnMode is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, errors.New("OldSnMode requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldSnMode: %w", err) - } - return oldValue.SnMode, nil -} - -// AddSnMode adds i to the "snMode" field. -func (m *FlowMaterialMutation) AddSnMode(i int) { - if m.addsnMode != nil { - *m.addsnMode += i - } else { - m.addsnMode = &i - } -} - -// AddedSnMode returns the value that was added to the "snMode" field in this mutation. -func (m *FlowMaterialMutation) AddedSnMode() (r int, exists bool) { - v := m.addsnMode - if v == nil { - return - } - return *v, true -} - -// ResetSnMode resets all changes to the "snMode" field. -func (m *FlowMaterialMutation) ResetSnMode() { - m.snMode = nil - m.addsnMode = nil -} - -// SetUnitQty sets the "unitQty" field. -func (m *FlowMaterialMutation) SetUnitQty(f float64) { - m.unitQty = &f - m.addunitQty = nil -} - -// UnitQty returns the value of the "unitQty" field in the mutation. -func (m *FlowMaterialMutation) UnitQty() (r float64, exists bool) { - v := m.unitQty - if v == nil { - return - } - return *v, true -} - -// OldUnitQty returns the old "unitQty" field's value of the FlowMaterial entity. -// If the FlowMaterial object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *FlowMaterialMutation) OldUnitQty(ctx context.Context) (v float64, err error) { - if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldUnitQty is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, errors.New("OldUnitQty requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldUnitQty: %w", err) - } - return oldValue.UnitQty, nil -} - -// AddUnitQty adds f to the "unitQty" field. -func (m *FlowMaterialMutation) AddUnitQty(f float64) { - if m.addunitQty != nil { - *m.addunitQty += f - } else { - m.addunitQty = &f - } -} - -// AddedUnitQty returns the value that was added to the "unitQty" field in this mutation. -func (m *FlowMaterialMutation) AddedUnitQty() (r float64, exists bool) { - v := m.addunitQty - if v == nil { - return - } - return *v, true -} - -// ResetUnitQty resets all changes to the "unitQty" field. -func (m *FlowMaterialMutation) ResetUnitQty() { - m.unitQty = nil - m.addunitQty = nil -} - -// SetLossRate sets the "lossRate" field. -func (m *FlowMaterialMutation) SetLossRate(f float64) { - m.lossRate = &f - m.addlossRate = nil -} - -// LossRate returns the value of the "lossRate" field in the mutation. -func (m *FlowMaterialMutation) LossRate() (r float64, exists bool) { - v := m.lossRate - if v == nil { - return - } - return *v, true -} - -// OldLossRate returns the old "lossRate" field's value of the FlowMaterial entity. -// If the FlowMaterial object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *FlowMaterialMutation) OldLossRate(ctx context.Context) (v float64, err error) { - if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldLossRate is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, errors.New("OldLossRate requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldLossRate: %w", err) - } - return oldValue.LossRate, nil -} - -// AddLossRate adds f to the "lossRate" field. -func (m *FlowMaterialMutation) AddLossRate(f float64) { - if m.addlossRate != nil { - *m.addlossRate += f - } else { - m.addlossRate = &f - } -} - -// AddedLossRate returns the value that was added to the "lossRate" field in this mutation. -func (m *FlowMaterialMutation) AddedLossRate() (r float64, exists bool) { - v := m.addlossRate - if v == nil { - return - } - return *v, true -} - -// ResetLossRate resets all changes to the "lossRate" field. -func (m *FlowMaterialMutation) ResetLossRate() { - m.lossRate = nil - m.addlossRate = nil -} - -// SetCreatedAt sets the "createdAt" field. -func (m *FlowMaterialMutation) SetCreatedAt(t time.Time) { - m.createdAt = &t -} - -// CreatedAt returns the value of the "createdAt" field in the mutation. -func (m *FlowMaterialMutation) CreatedAt() (r time.Time, exists bool) { - v := m.createdAt - if v == nil { - return - } - return *v, true -} - -// OldCreatedAt returns the old "createdAt" field's value of the FlowMaterial entity. -// If the FlowMaterial object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *FlowMaterialMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error) { - if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldCreatedAt is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, errors.New("OldCreatedAt requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldCreatedAt: %w", err) - } - return oldValue.CreatedAt, nil -} - -// ResetCreatedAt resets all changes to the "createdAt" field. -func (m *FlowMaterialMutation) ResetCreatedAt() { - m.createdAt = nil -} - -// Where appends a list predicates to the FlowMaterialMutation builder. -func (m *FlowMaterialMutation) Where(ps ...predicate.FlowMaterial) { - m.predicates = append(m.predicates, ps...) -} - -// WhereP appends storage-level predicates to the FlowMaterialMutation builder. Using this method, -// users can use type-assertion to append predicates that do not depend on any generated package. -func (m *FlowMaterialMutation) WhereP(ps ...func(*sql.Selector)) { - p := make([]predicate.FlowMaterial, len(ps)) - for i := range ps { - p[i] = ps[i] - } - m.Where(p...) -} - -// Op returns the operation name. -func (m *FlowMaterialMutation) Op() Op { - return m.op -} - -// SetOp allows setting the mutation operation. -func (m *FlowMaterialMutation) SetOp(op Op) { - m.op = op -} - -// Type returns the node type of this mutation (FlowMaterial). -func (m *FlowMaterialMutation) Type() string { - return m.typ -} - -// Fields returns all fields that were changed during this mutation. Note that in -// order to get all numeric fields that were incremented/decremented, call -// AddedFields(). -func (m *FlowMaterialMutation) Fields() []string { - fields := make([]string, 0, 9) - if m.flowId != nil { - fields = append(fields, flowmaterial.FieldFlowId) - } - if m.materialCode != nil { - fields = append(fields, flowmaterial.FieldMaterialCode) - } - if m.materialName != nil { - fields = append(fields, flowmaterial.FieldMaterialName) - } - if m.spec != nil { - fields = append(fields, flowmaterial.FieldSpec) - } - if m.unit != nil { - fields = append(fields, flowmaterial.FieldUnit) - } - if m.snMode != nil { - fields = append(fields, flowmaterial.FieldSnMode) - } - if m.unitQty != nil { - fields = append(fields, flowmaterial.FieldUnitQty) - } - if m.lossRate != nil { - fields = append(fields, flowmaterial.FieldLossRate) - } - if m.createdAt != nil { - fields = append(fields, flowmaterial.FieldCreatedAt) - } - return fields -} - -// Field returns the value of a field with the given name. The second boolean -// return value indicates that this field was not set, or was not defined in the -// schema. -func (m *FlowMaterialMutation) Field(name string) (ent.Value, bool) { - switch name { - case flowmaterial.FieldFlowId: - return m.FlowId() - case flowmaterial.FieldMaterialCode: - return m.MaterialCode() - case flowmaterial.FieldMaterialName: - return m.MaterialName() - case flowmaterial.FieldSpec: - return m.Spec() - case flowmaterial.FieldUnit: - return m.Unit() - case flowmaterial.FieldSnMode: - return m.SnMode() - case flowmaterial.FieldUnitQty: - return m.UnitQty() - case flowmaterial.FieldLossRate: - return m.LossRate() - case flowmaterial.FieldCreatedAt: - return m.CreatedAt() - } - return nil, false -} - -// OldField returns the old value of the field from the database. An error is -// returned if the mutation operation is not UpdateOne, or the query to the -// database failed. -func (m *FlowMaterialMutation) OldField(ctx context.Context, name string) (ent.Value, error) { - switch name { - case flowmaterial.FieldFlowId: - return m.OldFlowId(ctx) - case flowmaterial.FieldMaterialCode: - return m.OldMaterialCode(ctx) - case flowmaterial.FieldMaterialName: - return m.OldMaterialName(ctx) - case flowmaterial.FieldSpec: - return m.OldSpec(ctx) - case flowmaterial.FieldUnit: - return m.OldUnit(ctx) - case flowmaterial.FieldSnMode: - return m.OldSnMode(ctx) - case flowmaterial.FieldUnitQty: - return m.OldUnitQty(ctx) - case flowmaterial.FieldLossRate: - return m.OldLossRate(ctx) - case flowmaterial.FieldCreatedAt: - return m.OldCreatedAt(ctx) - } - return nil, fmt.Errorf("unknown FlowMaterial field %s", name) -} - -// SetField sets the value of a field with the given name. It returns an error if -// the field is not defined in the schema, or if the type mismatched the field -// type. -func (m *FlowMaterialMutation) SetField(name string, value ent.Value) error { - switch name { - case flowmaterial.FieldFlowId: - v, ok := value.(int) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetFlowId(v) - return nil - case flowmaterial.FieldMaterialCode: - v, ok := value.(string) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetMaterialCode(v) - return nil - case flowmaterial.FieldMaterialName: - v, ok := value.(string) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetMaterialName(v) - return nil - case flowmaterial.FieldSpec: - v, ok := value.(string) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetSpec(v) - return nil - case flowmaterial.FieldUnit: - v, ok := value.(string) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetUnit(v) - return nil - case flowmaterial.FieldSnMode: - v, ok := value.(int) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetSnMode(v) - return nil - case flowmaterial.FieldUnitQty: - v, ok := value.(float64) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetUnitQty(v) - return nil - case flowmaterial.FieldLossRate: - v, ok := value.(float64) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetLossRate(v) - return nil - case flowmaterial.FieldCreatedAt: - v, ok := value.(time.Time) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetCreatedAt(v) - return nil - } - return fmt.Errorf("unknown FlowMaterial field %s", name) -} - -// AddedFields returns all numeric fields that were incremented/decremented during -// this mutation. -func (m *FlowMaterialMutation) AddedFields() []string { - var fields []string - if m.addflowId != nil { - fields = append(fields, flowmaterial.FieldFlowId) - } - if m.addsnMode != nil { - fields = append(fields, flowmaterial.FieldSnMode) - } - if m.addunitQty != nil { - fields = append(fields, flowmaterial.FieldUnitQty) - } - if m.addlossRate != nil { - fields = append(fields, flowmaterial.FieldLossRate) - } - return fields -} - -// AddedField returns the numeric value that was incremented/decremented on a field -// with the given name. The second boolean return value indicates that this field -// was not set, or was not defined in the schema. -func (m *FlowMaterialMutation) AddedField(name string) (ent.Value, bool) { - switch name { - case flowmaterial.FieldFlowId: - return m.AddedFlowId() - case flowmaterial.FieldSnMode: - return m.AddedSnMode() - case flowmaterial.FieldUnitQty: - return m.AddedUnitQty() - case flowmaterial.FieldLossRate: - return m.AddedLossRate() - } - return nil, false -} - -// AddField adds the value to the field with the given name. It returns an error if -// the field is not defined in the schema, or if the type mismatched the field -// type. -func (m *FlowMaterialMutation) AddField(name string, value ent.Value) error { - switch name { - case flowmaterial.FieldFlowId: - v, ok := value.(int) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.AddFlowId(v) - return nil - case flowmaterial.FieldSnMode: - v, ok := value.(int) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.AddSnMode(v) - return nil - case flowmaterial.FieldUnitQty: - v, ok := value.(float64) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.AddUnitQty(v) - return nil - case flowmaterial.FieldLossRate: - v, ok := value.(float64) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.AddLossRate(v) - return nil - } - return fmt.Errorf("unknown FlowMaterial numeric field %s", name) -} - -// ClearedFields returns all nullable fields that were cleared during this -// mutation. -func (m *FlowMaterialMutation) ClearedFields() []string { - return nil -} - -// FieldCleared returns a boolean indicating if a field with the given name was -// cleared in this mutation. -func (m *FlowMaterialMutation) FieldCleared(name string) bool { - _, ok := m.clearedFields[name] - return ok -} - -// ClearField clears the value of the field with the given name. It returns an -// error if the field is not defined in the schema. -func (m *FlowMaterialMutation) ClearField(name string) error { - return fmt.Errorf("unknown FlowMaterial nullable field %s", name) -} - -// ResetField resets all changes in the mutation for the field with the given name. -// It returns an error if the field is not defined in the schema. -func (m *FlowMaterialMutation) ResetField(name string) error { - switch name { - case flowmaterial.FieldFlowId: - m.ResetFlowId() - return nil - case flowmaterial.FieldMaterialCode: - m.ResetMaterialCode() - return nil - case flowmaterial.FieldMaterialName: - m.ResetMaterialName() - return nil - case flowmaterial.FieldSpec: - m.ResetSpec() - return nil - case flowmaterial.FieldUnit: - m.ResetUnit() - return nil - case flowmaterial.FieldSnMode: - m.ResetSnMode() - return nil - case flowmaterial.FieldUnitQty: - m.ResetUnitQty() - return nil - case flowmaterial.FieldLossRate: - m.ResetLossRate() - return nil - case flowmaterial.FieldCreatedAt: - m.ResetCreatedAt() - return nil - } - return fmt.Errorf("unknown FlowMaterial field %s", name) -} - -// AddedEdges returns all edge names that were set/added in this mutation. -func (m *FlowMaterialMutation) AddedEdges() []string { - edges := make([]string, 0, 0) - return edges -} - -// AddedIDs returns all IDs (to other nodes) that were added for the given edge -// name in this mutation. -func (m *FlowMaterialMutation) AddedIDs(name string) []ent.Value { - return nil -} - -// RemovedEdges returns all edge names that were removed in this mutation. -func (m *FlowMaterialMutation) RemovedEdges() []string { - edges := make([]string, 0, 0) - return edges -} - -// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with -// the given name in this mutation. -func (m *FlowMaterialMutation) RemovedIDs(name string) []ent.Value { - return nil -} - -// ClearedEdges returns all edge names that were cleared in this mutation. -func (m *FlowMaterialMutation) ClearedEdges() []string { - edges := make([]string, 0, 0) - return edges -} - -// EdgeCleared returns a boolean which indicates if the edge with the given name -// was cleared in this mutation. -func (m *FlowMaterialMutation) EdgeCleared(name string) bool { - return false -} - -// ClearEdge clears the value of the edge with the given name. It returns an error -// if that edge is not defined in the schema. -func (m *FlowMaterialMutation) ClearEdge(name string) error { - return fmt.Errorf("unknown FlowMaterial unique edge %s", name) -} - -// ResetEdge resets all changes to the edge with the given name in this mutation. -// It returns an error if the edge is not defined in the schema. -func (m *FlowMaterialMutation) ResetEdge(name string) error { - return fmt.Errorf("unknown FlowMaterial edge %s", name) -} - // InspectionRecordMutation represents an operation that mutates the InspectionRecord nodes in the graph. type InspectionRecordMutation struct { config @@ -21815,554 +20912,6 @@ func (m *MaterialRequestMutation) ResetEdge(name string) error { return fmt.Errorf("unknown MaterialRequest edge %s", name) } -// MixProductionTemplateMutation represents an operation that mutates the MixProductionTemplate nodes in the graph. -type MixProductionTemplateMutation struct { - config - op Op - typ string - id *int - name *string - productCodes *string - remark *string - status *string - createdAt *time.Time - clearedFields map[string]struct{} - done bool - oldValue func(context.Context) (*MixProductionTemplate, error) - predicates []predicate.MixProductionTemplate -} - -var _ ent.Mutation = (*MixProductionTemplateMutation)(nil) - -// mixproductiontemplateOption allows management of the mutation configuration using functional options. -type mixproductiontemplateOption func(*MixProductionTemplateMutation) - -// newMixProductionTemplateMutation creates new mutation for the MixProductionTemplate entity. -func newMixProductionTemplateMutation(c config, op Op, opts ...mixproductiontemplateOption) *MixProductionTemplateMutation { - m := &MixProductionTemplateMutation{ - config: c, - op: op, - typ: TypeMixProductionTemplate, - clearedFields: make(map[string]struct{}), - } - for _, opt := range opts { - opt(m) - } - return m -} - -// withMixProductionTemplateID sets the ID field of the mutation. -func withMixProductionTemplateID(id int) mixproductiontemplateOption { - return func(m *MixProductionTemplateMutation) { - var ( - err error - once sync.Once - value *MixProductionTemplate - ) - m.oldValue = func(ctx context.Context) (*MixProductionTemplate, error) { - once.Do(func() { - if m.done { - err = errors.New("querying old values post mutation is not allowed") - } else { - value, err = m.Client().MixProductionTemplate.Get(ctx, id) - } - }) - return value, err - } - m.id = &id - } -} - -// withMixProductionTemplate sets the old MixProductionTemplate of the mutation. -func withMixProductionTemplate(node *MixProductionTemplate) mixproductiontemplateOption { - return func(m *MixProductionTemplateMutation) { - m.oldValue = func(context.Context) (*MixProductionTemplate, error) { - return node, nil - } - m.id = &node.ID - } -} - -// Client returns a new `ent.Client` from the mutation. If the mutation was -// executed in a transaction (ent.Tx), a transactional client is returned. -func (m MixProductionTemplateMutation) Client() *Client { - client := &Client{config: m.config} - client.init() - return client -} - -// Tx returns an `ent.Tx` for mutations that were executed in transactions; -// it returns an error otherwise. -func (m MixProductionTemplateMutation) Tx() (*Tx, error) { - if _, ok := m.driver.(*txDriver); !ok { - return nil, errors.New("ent: mutation is not running in a transaction") - } - tx := &Tx{config: m.config} - tx.init() - return tx, nil -} - -// SetID sets the value of the id field. Note that this -// operation is only accepted on creation of MixProductionTemplate entities. -func (m *MixProductionTemplateMutation) SetID(id int) { - m.id = &id -} - -// ID returns the ID value in the mutation. Note that the ID is only available -// if it was provided to the builder or after it was returned from the database. -func (m *MixProductionTemplateMutation) ID() (id int, exists bool) { - if m.id == nil { - return - } - return *m.id, true -} - -// IDs queries the database and returns the entity ids that match the mutation's predicate. -// That means, if the mutation is applied within a transaction with an isolation level such -// as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated -// or updated by the mutation. -func (m *MixProductionTemplateMutation) IDs(ctx context.Context) ([]int, error) { - switch { - case m.op.Is(OpUpdateOne | OpDeleteOne): - id, exists := m.ID() - if exists { - return []int{id}, nil - } - fallthrough - case m.op.Is(OpUpdate | OpDelete): - return m.Client().MixProductionTemplate.Query().Where(m.predicates...).IDs(ctx) - default: - return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op) - } -} - -// SetName sets the "name" field. -func (m *MixProductionTemplateMutation) SetName(s string) { - m.name = &s -} - -// Name returns the value of the "name" field in the mutation. -func (m *MixProductionTemplateMutation) Name() (r string, exists bool) { - v := m.name - if v == nil { - return - } - return *v, true -} - -// OldName returns the old "name" field's value of the MixProductionTemplate entity. -// If the MixProductionTemplate object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *MixProductionTemplateMutation) OldName(ctx context.Context) (v string, err error) { - if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldName is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, errors.New("OldName requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldName: %w", err) - } - return oldValue.Name, nil -} - -// ResetName resets all changes to the "name" field. -func (m *MixProductionTemplateMutation) ResetName() { - m.name = nil -} - -// SetProductCodes sets the "productCodes" field. -func (m *MixProductionTemplateMutation) SetProductCodes(s string) { - m.productCodes = &s -} - -// ProductCodes returns the value of the "productCodes" field in the mutation. -func (m *MixProductionTemplateMutation) ProductCodes() (r string, exists bool) { - v := m.productCodes - if v == nil { - return - } - return *v, true -} - -// OldProductCodes returns the old "productCodes" field's value of the MixProductionTemplate entity. -// If the MixProductionTemplate object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *MixProductionTemplateMutation) OldProductCodes(ctx context.Context) (v string, err error) { - if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldProductCodes is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, errors.New("OldProductCodes requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldProductCodes: %w", err) - } - return oldValue.ProductCodes, nil -} - -// ResetProductCodes resets all changes to the "productCodes" field. -func (m *MixProductionTemplateMutation) ResetProductCodes() { - m.productCodes = nil -} - -// SetRemark sets the "remark" field. -func (m *MixProductionTemplateMutation) SetRemark(s string) { - m.remark = &s -} - -// Remark returns the value of the "remark" field in the mutation. -func (m *MixProductionTemplateMutation) Remark() (r string, exists bool) { - v := m.remark - if v == nil { - return - } - return *v, true -} - -// OldRemark returns the old "remark" field's value of the MixProductionTemplate entity. -// If the MixProductionTemplate object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *MixProductionTemplateMutation) OldRemark(ctx context.Context) (v string, err error) { - if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldRemark is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, errors.New("OldRemark requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldRemark: %w", err) - } - return oldValue.Remark, nil -} - -// ResetRemark resets all changes to the "remark" field. -func (m *MixProductionTemplateMutation) ResetRemark() { - m.remark = nil -} - -// SetStatus sets the "status" field. -func (m *MixProductionTemplateMutation) SetStatus(s string) { - m.status = &s -} - -// Status returns the value of the "status" field in the mutation. -func (m *MixProductionTemplateMutation) Status() (r string, exists bool) { - v := m.status - if v == nil { - return - } - return *v, true -} - -// OldStatus returns the old "status" field's value of the MixProductionTemplate entity. -// If the MixProductionTemplate object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *MixProductionTemplateMutation) OldStatus(ctx context.Context) (v string, err error) { - if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldStatus is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, errors.New("OldStatus requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldStatus: %w", err) - } - return oldValue.Status, nil -} - -// ResetStatus resets all changes to the "status" field. -func (m *MixProductionTemplateMutation) ResetStatus() { - m.status = nil -} - -// SetCreatedAt sets the "createdAt" field. -func (m *MixProductionTemplateMutation) SetCreatedAt(t time.Time) { - m.createdAt = &t -} - -// CreatedAt returns the value of the "createdAt" field in the mutation. -func (m *MixProductionTemplateMutation) CreatedAt() (r time.Time, exists bool) { - v := m.createdAt - if v == nil { - return - } - return *v, true -} - -// OldCreatedAt returns the old "createdAt" field's value of the MixProductionTemplate entity. -// If the MixProductionTemplate object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *MixProductionTemplateMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error) { - if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldCreatedAt is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, errors.New("OldCreatedAt requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldCreatedAt: %w", err) - } - return oldValue.CreatedAt, nil -} - -// ResetCreatedAt resets all changes to the "createdAt" field. -func (m *MixProductionTemplateMutation) ResetCreatedAt() { - m.createdAt = nil -} - -// Where appends a list predicates to the MixProductionTemplateMutation builder. -func (m *MixProductionTemplateMutation) Where(ps ...predicate.MixProductionTemplate) { - m.predicates = append(m.predicates, ps...) -} - -// WhereP appends storage-level predicates to the MixProductionTemplateMutation builder. Using this method, -// users can use type-assertion to append predicates that do not depend on any generated package. -func (m *MixProductionTemplateMutation) WhereP(ps ...func(*sql.Selector)) { - p := make([]predicate.MixProductionTemplate, len(ps)) - for i := range ps { - p[i] = ps[i] - } - m.Where(p...) -} - -// Op returns the operation name. -func (m *MixProductionTemplateMutation) Op() Op { - return m.op -} - -// SetOp allows setting the mutation operation. -func (m *MixProductionTemplateMutation) SetOp(op Op) { - m.op = op -} - -// Type returns the node type of this mutation (MixProductionTemplate). -func (m *MixProductionTemplateMutation) Type() string { - return m.typ -} - -// Fields returns all fields that were changed during this mutation. Note that in -// order to get all numeric fields that were incremented/decremented, call -// AddedFields(). -func (m *MixProductionTemplateMutation) Fields() []string { - fields := make([]string, 0, 5) - if m.name != nil { - fields = append(fields, mixproductiontemplate.FieldName) - } - if m.productCodes != nil { - fields = append(fields, mixproductiontemplate.FieldProductCodes) - } - if m.remark != nil { - fields = append(fields, mixproductiontemplate.FieldRemark) - } - if m.status != nil { - fields = append(fields, mixproductiontemplate.FieldStatus) - } - if m.createdAt != nil { - fields = append(fields, mixproductiontemplate.FieldCreatedAt) - } - return fields -} - -// Field returns the value of a field with the given name. The second boolean -// return value indicates that this field was not set, or was not defined in the -// schema. -func (m *MixProductionTemplateMutation) Field(name string) (ent.Value, bool) { - switch name { - case mixproductiontemplate.FieldName: - return m.Name() - case mixproductiontemplate.FieldProductCodes: - return m.ProductCodes() - case mixproductiontemplate.FieldRemark: - return m.Remark() - case mixproductiontemplate.FieldStatus: - return m.Status() - case mixproductiontemplate.FieldCreatedAt: - return m.CreatedAt() - } - return nil, false -} - -// OldField returns the old value of the field from the database. An error is -// returned if the mutation operation is not UpdateOne, or the query to the -// database failed. -func (m *MixProductionTemplateMutation) OldField(ctx context.Context, name string) (ent.Value, error) { - switch name { - case mixproductiontemplate.FieldName: - return m.OldName(ctx) - case mixproductiontemplate.FieldProductCodes: - return m.OldProductCodes(ctx) - case mixproductiontemplate.FieldRemark: - return m.OldRemark(ctx) - case mixproductiontemplate.FieldStatus: - return m.OldStatus(ctx) - case mixproductiontemplate.FieldCreatedAt: - return m.OldCreatedAt(ctx) - } - return nil, fmt.Errorf("unknown MixProductionTemplate field %s", name) -} - -// SetField sets the value of a field with the given name. It returns an error if -// the field is not defined in the schema, or if the type mismatched the field -// type. -func (m *MixProductionTemplateMutation) SetField(name string, value ent.Value) error { - switch name { - case mixproductiontemplate.FieldName: - v, ok := value.(string) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetName(v) - return nil - case mixproductiontemplate.FieldProductCodes: - v, ok := value.(string) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetProductCodes(v) - return nil - case mixproductiontemplate.FieldRemark: - v, ok := value.(string) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetRemark(v) - return nil - case mixproductiontemplate.FieldStatus: - v, ok := value.(string) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetStatus(v) - return nil - case mixproductiontemplate.FieldCreatedAt: - v, ok := value.(time.Time) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetCreatedAt(v) - return nil - } - return fmt.Errorf("unknown MixProductionTemplate field %s", name) -} - -// AddedFields returns all numeric fields that were incremented/decremented during -// this mutation. -func (m *MixProductionTemplateMutation) AddedFields() []string { - return nil -} - -// AddedField returns the numeric value that was incremented/decremented on a field -// with the given name. The second boolean return value indicates that this field -// was not set, or was not defined in the schema. -func (m *MixProductionTemplateMutation) AddedField(name string) (ent.Value, bool) { - return nil, false -} - -// AddField adds the value to the field with the given name. It returns an error if -// the field is not defined in the schema, or if the type mismatched the field -// type. -func (m *MixProductionTemplateMutation) AddField(name string, value ent.Value) error { - switch name { - } - return fmt.Errorf("unknown MixProductionTemplate numeric field %s", name) -} - -// ClearedFields returns all nullable fields that were cleared during this -// mutation. -func (m *MixProductionTemplateMutation) ClearedFields() []string { - return nil -} - -// FieldCleared returns a boolean indicating if a field with the given name was -// cleared in this mutation. -func (m *MixProductionTemplateMutation) FieldCleared(name string) bool { - _, ok := m.clearedFields[name] - return ok -} - -// ClearField clears the value of the field with the given name. It returns an -// error if the field is not defined in the schema. -func (m *MixProductionTemplateMutation) ClearField(name string) error { - return fmt.Errorf("unknown MixProductionTemplate nullable field %s", name) -} - -// ResetField resets all changes in the mutation for the field with the given name. -// It returns an error if the field is not defined in the schema. -func (m *MixProductionTemplateMutation) ResetField(name string) error { - switch name { - case mixproductiontemplate.FieldName: - m.ResetName() - return nil - case mixproductiontemplate.FieldProductCodes: - m.ResetProductCodes() - return nil - case mixproductiontemplate.FieldRemark: - m.ResetRemark() - return nil - case mixproductiontemplate.FieldStatus: - m.ResetStatus() - return nil - case mixproductiontemplate.FieldCreatedAt: - m.ResetCreatedAt() - return nil - } - return fmt.Errorf("unknown MixProductionTemplate field %s", name) -} - -// AddedEdges returns all edge names that were set/added in this mutation. -func (m *MixProductionTemplateMutation) AddedEdges() []string { - edges := make([]string, 0, 0) - return edges -} - -// AddedIDs returns all IDs (to other nodes) that were added for the given edge -// name in this mutation. -func (m *MixProductionTemplateMutation) AddedIDs(name string) []ent.Value { - return nil -} - -// RemovedEdges returns all edge names that were removed in this mutation. -func (m *MixProductionTemplateMutation) RemovedEdges() []string { - edges := make([]string, 0, 0) - return edges -} - -// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with -// the given name in this mutation. -func (m *MixProductionTemplateMutation) RemovedIDs(name string) []ent.Value { - return nil -} - -// ClearedEdges returns all edge names that were cleared in this mutation. -func (m *MixProductionTemplateMutation) ClearedEdges() []string { - edges := make([]string, 0, 0) - return edges -} - -// EdgeCleared returns a boolean which indicates if the edge with the given name -// was cleared in this mutation. -func (m *MixProductionTemplateMutation) EdgeCleared(name string) bool { - return false -} - -// ClearEdge clears the value of the edge with the given name. It returns an error -// if that edge is not defined in the schema. -func (m *MixProductionTemplateMutation) ClearEdge(name string) error { - return fmt.Errorf("unknown MixProductionTemplate unique edge %s", name) -} - -// ResetEdge resets all changes to the edge with the given name in this mutation. -// It returns an error if the edge is not defined in the schema. -func (m *MixProductionTemplateMutation) ResetEdge(name string) error { - return fmt.Errorf("unknown MixProductionTemplate edge %s", name) -} - // PermissionMutation represents an operation that mutates the Permission nodes in the graph. type PermissionMutation struct { config diff --git a/bj_power_mes/ent/predicate/predicate.go b/bj_power_mes/ent/predicate/predicate.go index 188a734..622dd87 100644 --- a/bj_power_mes/ent/predicate/predicate.go +++ b/bj_power_mes/ent/predicate/predicate.go @@ -42,9 +42,6 @@ type Dock func(*sql.Selector) // EventLog is the predicate function for eventlog builders. type EventLog func(*sql.Selector) -// FlowMaterial is the predicate function for flowmaterial builders. -type FlowMaterial func(*sql.Selector) - // InspectionRecord is the predicate function for inspectionrecord builders. type InspectionRecord func(*sql.Selector) @@ -63,9 +60,6 @@ type MaterialQtyReport func(*sql.Selector) // MaterialRequest is the predicate function for materialrequest builders. type MaterialRequest func(*sql.Selector) -// MixProductionTemplate is the predicate function for mixproductiontemplate builders. -type MixProductionTemplate func(*sql.Selector) - // Permission is the predicate function for permission builders. type Permission func(*sql.Selector) diff --git a/bj_power_mes/ent/runtime.go b/bj_power_mes/ent/runtime.go index 878fb6d..417e95f 100644 --- a/bj_power_mes/ent/runtime.go +++ b/bj_power_mes/ent/runtime.go @@ -15,14 +15,12 @@ import ( "bj_power_mes/ent/dailyplan" "bj_power_mes/ent/dock" "bj_power_mes/ent/eventlog" - "bj_power_mes/ent/flowmaterial" "bj_power_mes/ent/inspectionrecord" "bj_power_mes/ent/linepoint" "bj_power_mes/ent/lossledger" "bj_power_mes/ent/material" "bj_power_mes/ent/materialqtyreport" "bj_power_mes/ent/materialrequest" - "bj_power_mes/ent/mixproductiontemplate" "bj_power_mes/ent/permission" "bj_power_mes/ent/plcsendlog" "bj_power_mes/ent/processflow" @@ -731,50 +729,6 @@ func init() { eventlogDescID := eventlogFields[0].Descriptor() // eventlog.IDValidator is a validator for the "id" field. It is called by the builders before save. eventlog.IDValidator = eventlogDescID.Validators[0].(func(int) error) - flowmaterialFields := schema.FlowMaterial{}.Fields() - _ = flowmaterialFields - // flowmaterialDescMaterialCode is the schema descriptor for materialCode field. - flowmaterialDescMaterialCode := flowmaterialFields[2].Descriptor() - // flowmaterial.MaterialCodeValidator is a validator for the "materialCode" field. It is called by the builders before save. - flowmaterial.MaterialCodeValidator = flowmaterialDescMaterialCode.Validators[0].(func(string) error) - // flowmaterialDescMaterialName is the schema descriptor for materialName field. - flowmaterialDescMaterialName := flowmaterialFields[3].Descriptor() - // flowmaterial.DefaultMaterialName holds the default value on creation for the materialName field. - flowmaterial.DefaultMaterialName = flowmaterialDescMaterialName.Default.(string) - // flowmaterial.MaterialNameValidator is a validator for the "materialName" field. It is called by the builders before save. - flowmaterial.MaterialNameValidator = flowmaterialDescMaterialName.Validators[0].(func(string) error) - // flowmaterialDescSpec is the schema descriptor for spec field. - flowmaterialDescSpec := flowmaterialFields[4].Descriptor() - // flowmaterial.DefaultSpec holds the default value on creation for the spec field. - flowmaterial.DefaultSpec = flowmaterialDescSpec.Default.(string) - // flowmaterial.SpecValidator is a validator for the "spec" field. It is called by the builders before save. - flowmaterial.SpecValidator = flowmaterialDescSpec.Validators[0].(func(string) error) - // flowmaterialDescUnit is the schema descriptor for unit field. - flowmaterialDescUnit := flowmaterialFields[5].Descriptor() - // flowmaterial.DefaultUnit holds the default value on creation for the unit field. - flowmaterial.DefaultUnit = flowmaterialDescUnit.Default.(string) - // flowmaterial.UnitValidator is a validator for the "unit" field. It is called by the builders before save. - flowmaterial.UnitValidator = flowmaterialDescUnit.Validators[0].(func(string) error) - // flowmaterialDescSnMode is the schema descriptor for snMode field. - flowmaterialDescSnMode := flowmaterialFields[6].Descriptor() - // flowmaterial.DefaultSnMode holds the default value on creation for the snMode field. - flowmaterial.DefaultSnMode = flowmaterialDescSnMode.Default.(int) - // flowmaterialDescUnitQty is the schema descriptor for unitQty field. - flowmaterialDescUnitQty := flowmaterialFields[7].Descriptor() - // flowmaterial.DefaultUnitQty holds the default value on creation for the unitQty field. - flowmaterial.DefaultUnitQty = flowmaterialDescUnitQty.Default.(float64) - // flowmaterialDescLossRate is the schema descriptor for lossRate field. - flowmaterialDescLossRate := flowmaterialFields[8].Descriptor() - // flowmaterial.DefaultLossRate holds the default value on creation for the lossRate field. - flowmaterial.DefaultLossRate = flowmaterialDescLossRate.Default.(float64) - // flowmaterialDescCreatedAt is the schema descriptor for createdAt field. - flowmaterialDescCreatedAt := flowmaterialFields[9].Descriptor() - // flowmaterial.DefaultCreatedAt holds the default value on creation for the createdAt field. - flowmaterial.DefaultCreatedAt = flowmaterialDescCreatedAt.Default.(func() time.Time) - // flowmaterialDescID is the schema descriptor for id field. - flowmaterialDescID := flowmaterialFields[0].Descriptor() - // flowmaterial.IDValidator is a validator for the "id" field. It is called by the builders before save. - flowmaterial.IDValidator = flowmaterialDescID.Validators[0].(func(int) error) inspectionrecordFields := schema.InspectionRecord{}.Fields() _ = inspectionrecordFields // inspectionrecordDescCategory is the schema descriptor for category field. @@ -1347,36 +1301,6 @@ func init() { materialrequestDescID := materialrequestFields[0].Descriptor() // materialrequest.IDValidator is a validator for the "id" field. It is called by the builders before save. materialrequest.IDValidator = materialrequestDescID.Validators[0].(func(int) error) - mixproductiontemplateFields := schema.MixProductionTemplate{}.Fields() - _ = mixproductiontemplateFields - // mixproductiontemplateDescName is the schema descriptor for name field. - mixproductiontemplateDescName := mixproductiontemplateFields[1].Descriptor() - // mixproductiontemplate.NameValidator is a validator for the "name" field. It is called by the builders before save. - mixproductiontemplate.NameValidator = mixproductiontemplateDescName.Validators[0].(func(string) error) - // mixproductiontemplateDescProductCodes is the schema descriptor for productCodes field. - mixproductiontemplateDescProductCodes := mixproductiontemplateFields[2].Descriptor() - // mixproductiontemplate.DefaultProductCodes holds the default value on creation for the productCodes field. - mixproductiontemplate.DefaultProductCodes = mixproductiontemplateDescProductCodes.Default.(string) - // mixproductiontemplateDescRemark is the schema descriptor for remark field. - mixproductiontemplateDescRemark := mixproductiontemplateFields[3].Descriptor() - // mixproductiontemplate.DefaultRemark holds the default value on creation for the remark field. - mixproductiontemplate.DefaultRemark = mixproductiontemplateDescRemark.Default.(string) - // mixproductiontemplate.RemarkValidator is a validator for the "remark" field. It is called by the builders before save. - mixproductiontemplate.RemarkValidator = mixproductiontemplateDescRemark.Validators[0].(func(string) error) - // mixproductiontemplateDescStatus is the schema descriptor for status field. - mixproductiontemplateDescStatus := mixproductiontemplateFields[4].Descriptor() - // mixproductiontemplate.DefaultStatus holds the default value on creation for the status field. - mixproductiontemplate.DefaultStatus = mixproductiontemplateDescStatus.Default.(string) - // mixproductiontemplate.StatusValidator is a validator for the "status" field. It is called by the builders before save. - mixproductiontemplate.StatusValidator = mixproductiontemplateDescStatus.Validators[0].(func(string) error) - // mixproductiontemplateDescCreatedAt is the schema descriptor for createdAt field. - mixproductiontemplateDescCreatedAt := mixproductiontemplateFields[5].Descriptor() - // mixproductiontemplate.DefaultCreatedAt holds the default value on creation for the createdAt field. - mixproductiontemplate.DefaultCreatedAt = mixproductiontemplateDescCreatedAt.Default.(func() time.Time) - // mixproductiontemplateDescID is the schema descriptor for id field. - mixproductiontemplateDescID := mixproductiontemplateFields[0].Descriptor() - // mixproductiontemplate.IDValidator is a validator for the "id" field. It is called by the builders before save. - mixproductiontemplate.IDValidator = mixproductiontemplateDescID.Validators[0].(func(int) error) permissionFields := schema.Permission{}.Fields() _ = permissionFields // permissionDescCode is the schema descriptor for code field. diff --git a/bj_power_mes/ent/tx.go b/bj_power_mes/ent/tx.go index 4146de2..8b23a41 100644 --- a/bj_power_mes/ent/tx.go +++ b/bj_power_mes/ent/tx.go @@ -36,8 +36,6 @@ type Tx struct { Dock *DockClient // EventLog is the client for interacting with the EventLog builders. EventLog *EventLogClient - // FlowMaterial is the client for interacting with the FlowMaterial builders. - FlowMaterial *FlowMaterialClient // InspectionRecord is the client for interacting with the InspectionRecord builders. InspectionRecord *InspectionRecordClient // LinePoint is the client for interacting with the LinePoint builders. @@ -50,8 +48,6 @@ type Tx struct { MaterialQtyReport *MaterialQtyReportClient // MaterialRequest is the client for interacting with the MaterialRequest builders. MaterialRequest *MaterialRequestClient - // MixProductionTemplate is the client for interacting with the MixProductionTemplate builders. - MixProductionTemplate *MixProductionTemplateClient // Permission is the client for interacting with the Permission builders. Permission *PermissionClient // PlcSendLog is the client for interacting with the PlcSendLog builders. @@ -251,14 +247,12 @@ func (tx *Tx) init() { tx.DailyPlan = NewDailyPlanClient(tx.config) tx.Dock = NewDockClient(tx.config) tx.EventLog = NewEventLogClient(tx.config) - tx.FlowMaterial = NewFlowMaterialClient(tx.config) tx.InspectionRecord = NewInspectionRecordClient(tx.config) tx.LinePoint = NewLinePointClient(tx.config) tx.LossLedger = NewLossLedgerClient(tx.config) tx.Material = NewMaterialClient(tx.config) tx.MaterialQtyReport = NewMaterialQtyReportClient(tx.config) tx.MaterialRequest = NewMaterialRequestClient(tx.config) - tx.MixProductionTemplate = NewMixProductionTemplateClient(tx.config) tx.Permission = NewPermissionClient(tx.config) tx.PlcSendLog = NewPlcSendLogClient(tx.config) tx.ProcessFlow = NewProcessFlowClient(tx.config) diff --git a/bj_power_mes/frontend/src/board/boardMock.js b/bj_power_mes/frontend/src/board/boardMock.js index fa320d2..cf83270 100644 --- a/bj_power_mes/frontend/src/board/boardMock.js +++ b/bj_power_mes/frontend/src/board/boardMock.js @@ -5,7 +5,7 @@ * 口径:报喜不报忧,不造报警;虚拟工位、多工单、追溯、点位态与原看板完全一致。 */ -/** 工序名(12 序装配线) */ +/** 工艺名(12 序装配线) */ const PROCESS_NAMES = [ '上料扫码', '外壳组装', @@ -120,7 +120,7 @@ function buildDemoAgv() { ] } -/** 演示事件流(已完成工序实绩,负面结果不进大屏) */ +/** 演示事件流(已完成工艺实绩,负面结果不进大屏) */ function buildDemoEvents() { const now2 = new Date() return Array.from({ length: 8 }, (_, i) => { @@ -134,7 +134,7 @@ function buildDemoEvents() { }) } -/** 生成一个工件的完整追溯时间线(演示态全部工序 OK) */ +/** 生成一个工件的完整追溯时间线(演示态全部工艺 OK) */ function buildTraceItem(index, doneMinutesAgo) { const now = new Date() const onlineAt = new Date(now.getTime() - (3 + index) * 3_600_000 - 12 * 60_000) @@ -198,7 +198,7 @@ export function getDemoData() { buildTraceItem(3, 55), ] - // 当前工单 12 道工序横道图:工期 -10 ~ +16 天,每序约 2.17 天 + // 当前工单 12 道工艺横道图:工期 -10 ~ +16 天,每序约 2.17 天 const stepDurationHours = ((planEnd.getTime() - planStart.getTime()) / 12) / 36e5 const progressSteps = PROCESS_NAMES.map((name, i) => { const seqStart = new Date(planStart.getTime() + i * stepDurationHours * 36e5) @@ -233,7 +233,7 @@ export function getDemoData() { progress: Math.round((doneQty / totalQty) * 100), processDone: 7, processTotal: 12, - currentProcess: '工序 8 · 面板固定', + currentProcess: '工艺 8 · 面板固定', status: '生产中', traceStepCount: 2016, traceable: true, @@ -316,7 +316,7 @@ export function getDemoData() { progress: Math.round((860 / 3200) * 100), processDone: 4, processTotal: 12, - currentProcess: '工序 5 · 计量模块装配', + currentProcess: '工艺 5 · 计量模块装配', status: '生产中', traceStepCount: 2016, traceable: true, @@ -335,7 +335,7 @@ export function getDemoData() { progress: Math.round((120 / 1800) * 100), processDone: 2, processTotal: 12, - currentProcess: '工序 3 · 主板焊接', + currentProcess: '工艺 3 · 主板焊接', status: '生产中', traceStepCount: 2016, traceable: true, diff --git a/bj_power_mes/frontend/src/board/components/BoardKpi.vue b/bj_power_mes/frontend/src/board/components/BoardKpi.vue index 4b2bb77..78689a1 100644 --- a/bj_power_mes/frontend/src/board/components/BoardKpi.vue +++ b/bj_power_mes/frontend/src/board/components/BoardKpi.vue @@ -38,7 +38,7 @@ const allCells = computed(() => { sub: '相邻完工间隔均值', color: '#fbbf24', }, - { key: 'pass', label: '一次通过', value: p.passCount ?? 0, unit: '件', sub: '全工序一次合格', color: '#34d399' }, + { key: 'pass', label: '一次通过', value: p.passCount ?? 0, unit: '件', sub: '全工艺一次合格', color: '#34d399' }, { key: 'online', label: '设备在线', value: p.deviceTotal > 0 ? `${p.deviceOnline}/${p.deviceTotal}` : '—', @@ -48,7 +48,7 @@ const allCells = computed(() => { }, // 客户诉求3:顶部「库位利用率」已删除(与仓储概览 BoardWarehouse 重复),仅保留底部仓储概览那一份。 // 2026-11-10 新增可选指标:在「基础设置 → 看板顶部指标」里勾选后才显示 - { key: 'yield', label: '良率', value: Number(p.qualifiedRate ?? 0).toFixed(1), unit: '%', sub: '全工序一次合格 / 总完工', color: '#34d399' }, + { key: 'yield', label: '良率', value: Number(p.qualifiedRate ?? 0).toFixed(1), unit: '%', sub: '全工艺一次合格 / 总完工', color: '#34d399' }, { key: 'onlineRate', label: '设备在线率', value: p.deviceTotal > 0 ? Math.round((p.deviceOnline / p.deviceTotal) * 100) : '—', diff --git a/bj_power_mes/frontend/src/board/components/BoardManage.vue b/bj_power_mes/frontend/src/board/components/BoardManage.vue index 6e290ed..f23fadf 100644 --- a/bj_power_mes/frontend/src/board/components/BoardManage.vue +++ b/bj_power_mes/frontend/src/board/components/BoardManage.vue @@ -36,7 +36,7 @@