- 新增产品工艺(product_process)及明细(product_process_item)数据模型 - 新增工序审核开关(need_audit)与审核角色(audit_role)字段 - 新增待审核签字页面与路由 - 优化 WMS/MES 接口交互,增加业务错误处理与友好提示 - 补充库存过滤逻辑,避免返回已出库 SN 数据 - 调整默认查询时间范围为近一个月,优化用户体验
89 lines
2.3 KiB
Go
89 lines
2.3 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package ent
|
|
|
|
import (
|
|
"bj_power_mes/ent/predicate"
|
|
"bj_power_mes/ent/productprocess"
|
|
"context"
|
|
|
|
"entgo.io/ent/dialect/sql"
|
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
|
"entgo.io/ent/schema/field"
|
|
)
|
|
|
|
// ProductProcessDelete is the builder for deleting a ProductProcess entity.
|
|
type ProductProcessDelete struct {
|
|
config
|
|
hooks []Hook
|
|
mutation *ProductProcessMutation
|
|
}
|
|
|
|
// Where appends a list predicates to the ProductProcessDelete builder.
|
|
func (_d *ProductProcessDelete) Where(ps ...predicate.ProductProcess) *ProductProcessDelete {
|
|
_d.mutation.Where(ps...)
|
|
return _d
|
|
}
|
|
|
|
// Exec executes the deletion query and returns how many vertices were deleted.
|
|
func (_d *ProductProcessDelete) 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 *ProductProcessDelete) ExecX(ctx context.Context) int {
|
|
n, err := _d.Exec(ctx)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return n
|
|
}
|
|
|
|
func (_d *ProductProcessDelete) sqlExec(ctx context.Context) (int, error) {
|
|
_spec := sqlgraph.NewDeleteSpec(productprocess.Table, sqlgraph.NewFieldSpec(productprocess.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
|
|
}
|
|
|
|
// ProductProcessDeleteOne is the builder for deleting a single ProductProcess entity.
|
|
type ProductProcessDeleteOne struct {
|
|
_d *ProductProcessDelete
|
|
}
|
|
|
|
// Where appends a list predicates to the ProductProcessDelete builder.
|
|
func (_d *ProductProcessDeleteOne) Where(ps ...predicate.ProductProcess) *ProductProcessDeleteOne {
|
|
_d._d.mutation.Where(ps...)
|
|
return _d
|
|
}
|
|
|
|
// Exec executes the deletion query.
|
|
func (_d *ProductProcessDeleteOne) Exec(ctx context.Context) error {
|
|
n, err := _d._d.Exec(ctx)
|
|
switch {
|
|
case err != nil:
|
|
return err
|
|
case n == 0:
|
|
return &NotFoundError{productprocess.Label}
|
|
default:
|
|
return nil
|
|
}
|
|
}
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
func (_d *ProductProcessDeleteOne) ExecX(ctx context.Context) {
|
|
if err := _d.Exec(ctx); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|