Files
bj_power/bj_power_wms/ent/produciblesnapshot_delete.go
SunYF 1cc93795ce feat(mes): 添加定时同步可生产数量到WMS及BOM项相关标准字段
- 在main.go中添加定时任务每10分钟同步可生产数量到WMS系统
- 为BomItem实体添加relatedStandard字段及相关CRUD方法
- 为InspectionRecord实体添加reportNo、materialCode、materialName等字段
- 更新ent schema确保新字段的验证和默认值设置
- 添加必要的数据库迁移和字段映射逻辑
2026-09-17 12:49:07 +08:00

89 lines
2.4 KiB
Go

// Code generated by ent, DO NOT EDIT.
package ent
import (
"bj_power_wms/ent/predicate"
"bj_power_wms/ent/produciblesnapshot"
"context"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"entgo.io/ent/schema/field"
)
// ProducibleSnapshotDelete is the builder for deleting a ProducibleSnapshot entity.
type ProducibleSnapshotDelete struct {
config
hooks []Hook
mutation *ProducibleSnapshotMutation
}
// Where appends a list predicates to the ProducibleSnapshotDelete builder.
func (_d *ProducibleSnapshotDelete) Where(ps ...predicate.ProducibleSnapshot) *ProducibleSnapshotDelete {
_d.mutation.Where(ps...)
return _d
}
// Exec executes the deletion query and returns how many vertices were deleted.
func (_d *ProducibleSnapshotDelete) 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 *ProducibleSnapshotDelete) ExecX(ctx context.Context) int {
n, err := _d.Exec(ctx)
if err != nil {
panic(err)
}
return n
}
func (_d *ProducibleSnapshotDelete) sqlExec(ctx context.Context) (int, error) {
_spec := sqlgraph.NewDeleteSpec(produciblesnapshot.Table, sqlgraph.NewFieldSpec(produciblesnapshot.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
}
// ProducibleSnapshotDeleteOne is the builder for deleting a single ProducibleSnapshot entity.
type ProducibleSnapshotDeleteOne struct {
_d *ProducibleSnapshotDelete
}
// Where appends a list predicates to the ProducibleSnapshotDelete builder.
func (_d *ProducibleSnapshotDeleteOne) Where(ps ...predicate.ProducibleSnapshot) *ProducibleSnapshotDeleteOne {
_d._d.mutation.Where(ps...)
return _d
}
// Exec executes the deletion query.
func (_d *ProducibleSnapshotDeleteOne) Exec(ctx context.Context) error {
n, err := _d._d.Exec(ctx)
switch {
case err != nil:
return err
case n == 0:
return &NotFoundError{produciblesnapshot.Label}
default:
return nil
}
}
// ExecX is like Exec, but panics if an error occurs.
func (_d *ProducibleSnapshotDeleteOne) ExecX(ctx context.Context) {
if err := _d.Exec(ctx); err != nil {
panic(err)
}
}