feat: 新增工序签字功能,移除移料指令模块

新增操作工/检验员工序签字功能,支持工艺步骤配置签字要求;删除移料指令相关代码,将移料页签重命名为产线点位(上料/下料);新增成品入库功能及相关权限;优化备料单状态、质量状态逻辑,新增批次序号字段;修复AGV取消后备料单回退状态问题。
This commit is contained in:
SunYF
2026-10-05 20:15:38 +08:00
parent c33acab9c8
commit f1cf57e9b2
181 changed files with 9785 additions and 9699 deletions
+23 -1
View File
@@ -44,6 +44,10 @@ type InspectionRecord struct {
InspectQty int `json:"inspectQty,omitempty"`
// 合格数量(≤检验数量)
PassQty int `json:"passQty,omitempty"`
// 第几批(批次件来料检验必填≥1,0=未填)
BatchSeq int `json:"batchSeq,omitempty"`
// 共几件(批次件来料检验必填≥1,0=未填)
BatchTotal int `json:"batchTotal,omitempty"`
// 不合格数量(=检验数量-合格数量)
RejectQty int `json:"rejectQty,omitempty"`
// 检测说明(检验项目/方法)
@@ -74,7 +78,7 @@ func (*InspectionRecord) scanValues(columns []string) ([]any, error) {
values := make([]any, len(columns))
for i := range columns {
switch columns[i] {
case inspectionrecord.FieldID, inspectionrecord.FieldInspectQty, inspectionrecord.FieldPassQty, inspectionrecord.FieldRejectQty, inspectionrecord.FieldCreatedAt, inspectionrecord.FieldUpdatedAt:
case inspectionrecord.FieldID, inspectionrecord.FieldInspectQty, inspectionrecord.FieldPassQty, inspectionrecord.FieldBatchSeq, inspectionrecord.FieldBatchTotal, inspectionrecord.FieldRejectQty, inspectionrecord.FieldCreatedAt, inspectionrecord.FieldUpdatedAt:
values[i] = new(sql.NullInt64)
case inspectionrecord.FieldTargetType, inspectionrecord.FieldTargetID, inspectionrecord.FieldMaterialCode, inspectionrecord.FieldMaterialName, inspectionrecord.FieldOwnershipType, inspectionrecord.FieldOwnershipNo, inspectionrecord.FieldProductWorkNo, inspectionrecord.FieldRelatedStandard, inspectionrecord.FieldManufacturer, inspectionrecord.FieldInspectionType, inspectionrecord.FieldStatus, inspectionrecord.FieldResultValue, inspectionrecord.FieldCheckDesc, inspectionrecord.FieldInspector, inspectionrecord.FieldInspectionNo, inspectionrecord.FieldReportNo, inspectionrecord.FieldDisposalType, inspectionrecord.FieldDisposalRemark, inspectionrecord.FieldReturnTrackingNo, inspectionrecord.FieldRemark:
values[i] = new(sql.NullString)
@@ -183,6 +187,18 @@ func (_m *InspectionRecord) assignValues(columns []string, values []any) error {
} else if value.Valid {
_m.PassQty = int(value.Int64)
}
case inspectionrecord.FieldBatchSeq:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field batch_seq", values[i])
} else if value.Valid {
_m.BatchSeq = int(value.Int64)
}
case inspectionrecord.FieldBatchTotal:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field batch_total", values[i])
} else if value.Valid {
_m.BatchTotal = int(value.Int64)
}
case inspectionrecord.FieldRejectQty:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field reject_qty", values[i])
@@ -327,6 +343,12 @@ func (_m *InspectionRecord) String() string {
builder.WriteString("pass_qty=")
builder.WriteString(fmt.Sprintf("%v", _m.PassQty))
builder.WriteString(", ")
builder.WriteString("batch_seq=")
builder.WriteString(fmt.Sprintf("%v", _m.BatchSeq))
builder.WriteString(", ")
builder.WriteString("batch_total=")
builder.WriteString(fmt.Sprintf("%v", _m.BatchTotal))
builder.WriteString(", ")
builder.WriteString("reject_qty=")
builder.WriteString(fmt.Sprintf("%v", _m.RejectQty))
builder.WriteString(", ")
@@ -39,6 +39,10 @@ const (
FieldInspectQty = "inspect_qty"
// FieldPassQty holds the string denoting the pass_qty field in the database.
FieldPassQty = "pass_qty"
// FieldBatchSeq holds the string denoting the batch_seq field in the database.
FieldBatchSeq = "batch_seq"
// FieldBatchTotal holds the string denoting the batch_total field in the database.
FieldBatchTotal = "batch_total"
// FieldRejectQty holds the string denoting the reject_qty field in the database.
FieldRejectQty = "reject_qty"
// FieldCheckDesc holds the string denoting the check_desc field in the database.
@@ -82,6 +86,8 @@ var Columns = []string{
FieldResultValue,
FieldInspectQty,
FieldPassQty,
FieldBatchSeq,
FieldBatchTotal,
FieldRejectQty,
FieldCheckDesc,
FieldInspector,
@@ -114,6 +120,10 @@ var (
DefaultInspectQty int
// DefaultPassQty holds the default value on creation for the "pass_qty" field.
DefaultPassQty int
// DefaultBatchSeq holds the default value on creation for the "batch_seq" field.
DefaultBatchSeq int
// DefaultBatchTotal holds the default value on creation for the "batch_total" field.
DefaultBatchTotal int
// DefaultRejectQty holds the default value on creation for the "reject_qty" field.
DefaultRejectQty int
// DefaultDisposalType holds the default value on creation for the "disposal_type" field.
@@ -202,6 +212,16 @@ func ByPassQty(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldPassQty, opts...).ToFunc()
}
// ByBatchSeq orders the results by the batch_seq field.
func ByBatchSeq(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldBatchSeq, opts...).ToFunc()
}
// ByBatchTotal orders the results by the batch_total field.
func ByBatchTotal(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldBatchTotal, opts...).ToFunc()
}
// ByRejectQty orders the results by the reject_qty field.
func ByRejectQty(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldRejectQty, opts...).ToFunc()
@@ -123,6 +123,16 @@ func PassQty(v int) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldEQ(FieldPassQty, v))
}
// BatchSeq applies equality check predicate on the "batch_seq" field. It's identical to BatchSeqEQ.
func BatchSeq(v int) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldEQ(FieldBatchSeq, v))
}
// BatchTotal applies equality check predicate on the "batch_total" field. It's identical to BatchTotalEQ.
func BatchTotal(v int) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldEQ(FieldBatchTotal, v))
}
// RejectQty applies equality check predicate on the "reject_qty" field. It's identical to RejectQtyEQ.
func RejectQty(v int) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldEQ(FieldRejectQty, v))
@@ -1108,6 +1118,86 @@ func PassQtyLTE(v int) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldLTE(FieldPassQty, v))
}
// BatchSeqEQ applies the EQ predicate on the "batch_seq" field.
func BatchSeqEQ(v int) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldEQ(FieldBatchSeq, v))
}
// BatchSeqNEQ applies the NEQ predicate on the "batch_seq" field.
func BatchSeqNEQ(v int) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldNEQ(FieldBatchSeq, v))
}
// BatchSeqIn applies the In predicate on the "batch_seq" field.
func BatchSeqIn(vs ...int) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldIn(FieldBatchSeq, vs...))
}
// BatchSeqNotIn applies the NotIn predicate on the "batch_seq" field.
func BatchSeqNotIn(vs ...int) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldNotIn(FieldBatchSeq, vs...))
}
// BatchSeqGT applies the GT predicate on the "batch_seq" field.
func BatchSeqGT(v int) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldGT(FieldBatchSeq, v))
}
// BatchSeqGTE applies the GTE predicate on the "batch_seq" field.
func BatchSeqGTE(v int) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldGTE(FieldBatchSeq, v))
}
// BatchSeqLT applies the LT predicate on the "batch_seq" field.
func BatchSeqLT(v int) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldLT(FieldBatchSeq, v))
}
// BatchSeqLTE applies the LTE predicate on the "batch_seq" field.
func BatchSeqLTE(v int) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldLTE(FieldBatchSeq, v))
}
// BatchTotalEQ applies the EQ predicate on the "batch_total" field.
func BatchTotalEQ(v int) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldEQ(FieldBatchTotal, v))
}
// BatchTotalNEQ applies the NEQ predicate on the "batch_total" field.
func BatchTotalNEQ(v int) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldNEQ(FieldBatchTotal, v))
}
// BatchTotalIn applies the In predicate on the "batch_total" field.
func BatchTotalIn(vs ...int) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldIn(FieldBatchTotal, vs...))
}
// BatchTotalNotIn applies the NotIn predicate on the "batch_total" field.
func BatchTotalNotIn(vs ...int) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldNotIn(FieldBatchTotal, vs...))
}
// BatchTotalGT applies the GT predicate on the "batch_total" field.
func BatchTotalGT(v int) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldGT(FieldBatchTotal, v))
}
// BatchTotalGTE applies the GTE predicate on the "batch_total" field.
func BatchTotalGTE(v int) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldGTE(FieldBatchTotal, v))
}
// BatchTotalLT applies the LT predicate on the "batch_total" field.
func BatchTotalLT(v int) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldLT(FieldBatchTotal, v))
}
// BatchTotalLTE applies the LTE predicate on the "batch_total" field.
func BatchTotalLTE(v int) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldLTE(FieldBatchTotal, v))
}
// RejectQtyEQ applies the EQ predicate on the "reject_qty" field.
func RejectQtyEQ(v int) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldEQ(FieldRejectQty, v))
+170
View File
@@ -193,6 +193,34 @@ func (_c *InspectionRecordCreate) SetNillablePassQty(v *int) *InspectionRecordCr
return _c
}
// SetBatchSeq sets the "batch_seq" field.
func (_c *InspectionRecordCreate) SetBatchSeq(v int) *InspectionRecordCreate {
_c.mutation.SetBatchSeq(v)
return _c
}
// SetNillableBatchSeq sets the "batch_seq" field if the given value is not nil.
func (_c *InspectionRecordCreate) SetNillableBatchSeq(v *int) *InspectionRecordCreate {
if v != nil {
_c.SetBatchSeq(*v)
}
return _c
}
// SetBatchTotal sets the "batch_total" field.
func (_c *InspectionRecordCreate) SetBatchTotal(v int) *InspectionRecordCreate {
_c.mutation.SetBatchTotal(v)
return _c
}
// SetNillableBatchTotal sets the "batch_total" field if the given value is not nil.
func (_c *InspectionRecordCreate) SetNillableBatchTotal(v *int) *InspectionRecordCreate {
if v != nil {
_c.SetBatchTotal(*v)
}
return _c
}
// SetRejectQty sets the "reject_qty" field.
func (_c *InspectionRecordCreate) SetRejectQty(v int) *InspectionRecordCreate {
_c.mutation.SetRejectQty(v)
@@ -398,6 +426,14 @@ func (_c *InspectionRecordCreate) defaults() {
v := inspectionrecord.DefaultPassQty
_c.mutation.SetPassQty(v)
}
if _, ok := _c.mutation.BatchSeq(); !ok {
v := inspectionrecord.DefaultBatchSeq
_c.mutation.SetBatchSeq(v)
}
if _, ok := _c.mutation.BatchTotal(); !ok {
v := inspectionrecord.DefaultBatchTotal
_c.mutation.SetBatchTotal(v)
}
if _, ok := _c.mutation.RejectQty(); !ok {
v := inspectionrecord.DefaultRejectQty
_c.mutation.SetRejectQty(v)
@@ -439,6 +475,12 @@ func (_c *InspectionRecordCreate) check() error {
if _, ok := _c.mutation.PassQty(); !ok {
return &ValidationError{Name: "pass_qty", err: errors.New(`ent: missing required field "InspectionRecord.pass_qty"`)}
}
if _, ok := _c.mutation.BatchSeq(); !ok {
return &ValidationError{Name: "batch_seq", err: errors.New(`ent: missing required field "InspectionRecord.batch_seq"`)}
}
if _, ok := _c.mutation.BatchTotal(); !ok {
return &ValidationError{Name: "batch_total", err: errors.New(`ent: missing required field "InspectionRecord.batch_total"`)}
}
if _, ok := _c.mutation.RejectQty(); !ok {
return &ValidationError{Name: "reject_qty", err: errors.New(`ent: missing required field "InspectionRecord.reject_qty"`)}
}
@@ -534,6 +576,14 @@ func (_c *InspectionRecordCreate) createSpec() (*InspectionRecord, *sqlgraph.Cre
_spec.SetField(inspectionrecord.FieldPassQty, field.TypeInt, value)
_node.PassQty = value
}
if value, ok := _c.mutation.BatchSeq(); ok {
_spec.SetField(inspectionrecord.FieldBatchSeq, field.TypeInt, value)
_node.BatchSeq = value
}
if value, ok := _c.mutation.BatchTotal(); ok {
_spec.SetField(inspectionrecord.FieldBatchTotal, field.TypeInt, value)
_node.BatchTotal = value
}
if value, ok := _c.mutation.RejectQty(); ok {
_spec.SetField(inspectionrecord.FieldRejectQty, field.TypeInt, value)
_node.RejectQty = value
@@ -852,6 +902,42 @@ func (u *InspectionRecordUpsert) AddPassQty(v int) *InspectionRecordUpsert {
return u
}
// SetBatchSeq sets the "batch_seq" field.
func (u *InspectionRecordUpsert) SetBatchSeq(v int) *InspectionRecordUpsert {
u.Set(inspectionrecord.FieldBatchSeq, v)
return u
}
// UpdateBatchSeq sets the "batch_seq" field to the value that was provided on create.
func (u *InspectionRecordUpsert) UpdateBatchSeq() *InspectionRecordUpsert {
u.SetExcluded(inspectionrecord.FieldBatchSeq)
return u
}
// AddBatchSeq adds v to the "batch_seq" field.
func (u *InspectionRecordUpsert) AddBatchSeq(v int) *InspectionRecordUpsert {
u.Add(inspectionrecord.FieldBatchSeq, v)
return u
}
// SetBatchTotal sets the "batch_total" field.
func (u *InspectionRecordUpsert) SetBatchTotal(v int) *InspectionRecordUpsert {
u.Set(inspectionrecord.FieldBatchTotal, v)
return u
}
// UpdateBatchTotal sets the "batch_total" field to the value that was provided on create.
func (u *InspectionRecordUpsert) UpdateBatchTotal() *InspectionRecordUpsert {
u.SetExcluded(inspectionrecord.FieldBatchTotal)
return u
}
// AddBatchTotal adds v to the "batch_total" field.
func (u *InspectionRecordUpsert) AddBatchTotal(v int) *InspectionRecordUpsert {
u.Add(inspectionrecord.FieldBatchTotal, v)
return u
}
// SetRejectQty sets the "reject_qty" field.
func (u *InspectionRecordUpsert) SetRejectQty(v int) *InspectionRecordUpsert {
u.Set(inspectionrecord.FieldRejectQty, v)
@@ -1343,6 +1429,48 @@ func (u *InspectionRecordUpsertOne) UpdatePassQty() *InspectionRecordUpsertOne {
})
}
// SetBatchSeq sets the "batch_seq" field.
func (u *InspectionRecordUpsertOne) SetBatchSeq(v int) *InspectionRecordUpsertOne {
return u.Update(func(s *InspectionRecordUpsert) {
s.SetBatchSeq(v)
})
}
// AddBatchSeq adds v to the "batch_seq" field.
func (u *InspectionRecordUpsertOne) AddBatchSeq(v int) *InspectionRecordUpsertOne {
return u.Update(func(s *InspectionRecordUpsert) {
s.AddBatchSeq(v)
})
}
// UpdateBatchSeq sets the "batch_seq" field to the value that was provided on create.
func (u *InspectionRecordUpsertOne) UpdateBatchSeq() *InspectionRecordUpsertOne {
return u.Update(func(s *InspectionRecordUpsert) {
s.UpdateBatchSeq()
})
}
// SetBatchTotal sets the "batch_total" field.
func (u *InspectionRecordUpsertOne) SetBatchTotal(v int) *InspectionRecordUpsertOne {
return u.Update(func(s *InspectionRecordUpsert) {
s.SetBatchTotal(v)
})
}
// AddBatchTotal adds v to the "batch_total" field.
func (u *InspectionRecordUpsertOne) AddBatchTotal(v int) *InspectionRecordUpsertOne {
return u.Update(func(s *InspectionRecordUpsert) {
s.AddBatchTotal(v)
})
}
// UpdateBatchTotal sets the "batch_total" field to the value that was provided on create.
func (u *InspectionRecordUpsertOne) UpdateBatchTotal() *InspectionRecordUpsertOne {
return u.Update(func(s *InspectionRecordUpsert) {
s.UpdateBatchTotal()
})
}
// SetRejectQty sets the "reject_qty" field.
func (u *InspectionRecordUpsertOne) SetRejectQty(v int) *InspectionRecordUpsertOne {
return u.Update(func(s *InspectionRecordUpsert) {
@@ -2030,6 +2158,48 @@ func (u *InspectionRecordUpsertBulk) UpdatePassQty() *InspectionRecordUpsertBulk
})
}
// SetBatchSeq sets the "batch_seq" field.
func (u *InspectionRecordUpsertBulk) SetBatchSeq(v int) *InspectionRecordUpsertBulk {
return u.Update(func(s *InspectionRecordUpsert) {
s.SetBatchSeq(v)
})
}
// AddBatchSeq adds v to the "batch_seq" field.
func (u *InspectionRecordUpsertBulk) AddBatchSeq(v int) *InspectionRecordUpsertBulk {
return u.Update(func(s *InspectionRecordUpsert) {
s.AddBatchSeq(v)
})
}
// UpdateBatchSeq sets the "batch_seq" field to the value that was provided on create.
func (u *InspectionRecordUpsertBulk) UpdateBatchSeq() *InspectionRecordUpsertBulk {
return u.Update(func(s *InspectionRecordUpsert) {
s.UpdateBatchSeq()
})
}
// SetBatchTotal sets the "batch_total" field.
func (u *InspectionRecordUpsertBulk) SetBatchTotal(v int) *InspectionRecordUpsertBulk {
return u.Update(func(s *InspectionRecordUpsert) {
s.SetBatchTotal(v)
})
}
// AddBatchTotal adds v to the "batch_total" field.
func (u *InspectionRecordUpsertBulk) AddBatchTotal(v int) *InspectionRecordUpsertBulk {
return u.Update(func(s *InspectionRecordUpsert) {
s.AddBatchTotal(v)
})
}
// UpdateBatchTotal sets the "batch_total" field to the value that was provided on create.
func (u *InspectionRecordUpsertBulk) UpdateBatchTotal() *InspectionRecordUpsertBulk {
return u.Update(func(s *InspectionRecordUpsert) {
s.UpdateBatchTotal()
})
}
// SetRejectQty sets the "reject_qty" field.
func (u *InspectionRecordUpsertBulk) SetRejectQty(v int) *InspectionRecordUpsertBulk {
return u.Update(func(s *InspectionRecordUpsert) {
+108
View File
@@ -279,6 +279,48 @@ func (_u *InspectionRecordUpdate) AddPassQty(v int) *InspectionRecordUpdate {
return _u
}
// SetBatchSeq sets the "batch_seq" field.
func (_u *InspectionRecordUpdate) SetBatchSeq(v int) *InspectionRecordUpdate {
_u.mutation.ResetBatchSeq()
_u.mutation.SetBatchSeq(v)
return _u
}
// SetNillableBatchSeq sets the "batch_seq" field if the given value is not nil.
func (_u *InspectionRecordUpdate) SetNillableBatchSeq(v *int) *InspectionRecordUpdate {
if v != nil {
_u.SetBatchSeq(*v)
}
return _u
}
// AddBatchSeq adds value to the "batch_seq" field.
func (_u *InspectionRecordUpdate) AddBatchSeq(v int) *InspectionRecordUpdate {
_u.mutation.AddBatchSeq(v)
return _u
}
// SetBatchTotal sets the "batch_total" field.
func (_u *InspectionRecordUpdate) SetBatchTotal(v int) *InspectionRecordUpdate {
_u.mutation.ResetBatchTotal()
_u.mutation.SetBatchTotal(v)
return _u
}
// SetNillableBatchTotal sets the "batch_total" field if the given value is not nil.
func (_u *InspectionRecordUpdate) SetNillableBatchTotal(v *int) *InspectionRecordUpdate {
if v != nil {
_u.SetBatchTotal(*v)
}
return _u
}
// AddBatchTotal adds value to the "batch_total" field.
func (_u *InspectionRecordUpdate) AddBatchTotal(v int) *InspectionRecordUpdate {
_u.mutation.AddBatchTotal(v)
return _u
}
// SetRejectQty sets the "reject_qty" field.
func (_u *InspectionRecordUpdate) SetRejectQty(v int) *InspectionRecordUpdate {
_u.mutation.ResetRejectQty()
@@ -606,6 +648,18 @@ func (_u *InspectionRecordUpdate) sqlSave(ctx context.Context) (_node int, err e
if value, ok := _u.mutation.AddedPassQty(); ok {
_spec.AddField(inspectionrecord.FieldPassQty, field.TypeInt, value)
}
if value, ok := _u.mutation.BatchSeq(); ok {
_spec.SetField(inspectionrecord.FieldBatchSeq, field.TypeInt, value)
}
if value, ok := _u.mutation.AddedBatchSeq(); ok {
_spec.AddField(inspectionrecord.FieldBatchSeq, field.TypeInt, value)
}
if value, ok := _u.mutation.BatchTotal(); ok {
_spec.SetField(inspectionrecord.FieldBatchTotal, field.TypeInt, value)
}
if value, ok := _u.mutation.AddedBatchTotal(); ok {
_spec.AddField(inspectionrecord.FieldBatchTotal, field.TypeInt, value)
}
if value, ok := _u.mutation.RejectQty(); ok {
_spec.SetField(inspectionrecord.FieldRejectQty, field.TypeInt, value)
}
@@ -941,6 +995,48 @@ func (_u *InspectionRecordUpdateOne) AddPassQty(v int) *InspectionRecordUpdateOn
return _u
}
// SetBatchSeq sets the "batch_seq" field.
func (_u *InspectionRecordUpdateOne) SetBatchSeq(v int) *InspectionRecordUpdateOne {
_u.mutation.ResetBatchSeq()
_u.mutation.SetBatchSeq(v)
return _u
}
// SetNillableBatchSeq sets the "batch_seq" field if the given value is not nil.
func (_u *InspectionRecordUpdateOne) SetNillableBatchSeq(v *int) *InspectionRecordUpdateOne {
if v != nil {
_u.SetBatchSeq(*v)
}
return _u
}
// AddBatchSeq adds value to the "batch_seq" field.
func (_u *InspectionRecordUpdateOne) AddBatchSeq(v int) *InspectionRecordUpdateOne {
_u.mutation.AddBatchSeq(v)
return _u
}
// SetBatchTotal sets the "batch_total" field.
func (_u *InspectionRecordUpdateOne) SetBatchTotal(v int) *InspectionRecordUpdateOne {
_u.mutation.ResetBatchTotal()
_u.mutation.SetBatchTotal(v)
return _u
}
// SetNillableBatchTotal sets the "batch_total" field if the given value is not nil.
func (_u *InspectionRecordUpdateOne) SetNillableBatchTotal(v *int) *InspectionRecordUpdateOne {
if v != nil {
_u.SetBatchTotal(*v)
}
return _u
}
// AddBatchTotal adds value to the "batch_total" field.
func (_u *InspectionRecordUpdateOne) AddBatchTotal(v int) *InspectionRecordUpdateOne {
_u.mutation.AddBatchTotal(v)
return _u
}
// SetRejectQty sets the "reject_qty" field.
func (_u *InspectionRecordUpdateOne) SetRejectQty(v int) *InspectionRecordUpdateOne {
_u.mutation.ResetRejectQty()
@@ -1298,6 +1394,18 @@ func (_u *InspectionRecordUpdateOne) sqlSave(ctx context.Context) (_node *Inspec
if value, ok := _u.mutation.AddedPassQty(); ok {
_spec.AddField(inspectionrecord.FieldPassQty, field.TypeInt, value)
}
if value, ok := _u.mutation.BatchSeq(); ok {
_spec.SetField(inspectionrecord.FieldBatchSeq, field.TypeInt, value)
}
if value, ok := _u.mutation.AddedBatchSeq(); ok {
_spec.AddField(inspectionrecord.FieldBatchSeq, field.TypeInt, value)
}
if value, ok := _u.mutation.BatchTotal(); ok {
_spec.SetField(inspectionrecord.FieldBatchTotal, field.TypeInt, value)
}
if value, ok := _u.mutation.AddedBatchTotal(); ok {
_spec.AddField(inspectionrecord.FieldBatchTotal, field.TypeInt, value)
}
if value, ok := _u.mutation.RejectQty(); ok {
_spec.SetField(inspectionrecord.FieldRejectQty, field.TypeInt, value)
}
+2
View File
@@ -231,6 +231,8 @@ var (
{Name: "result_value", Type: field.TypeString, Nullable: true},
{Name: "inspect_qty", Type: field.TypeInt, Default: 0},
{Name: "pass_qty", Type: field.TypeInt, Default: 0},
{Name: "batch_seq", Type: field.TypeInt, Default: 0},
{Name: "batch_total", Type: field.TypeInt, Default: 0},
{Name: "reject_qty", Type: field.TypeInt, Default: 0},
{Name: "check_desc", Type: field.TypeString, Nullable: true},
{Name: "inspector", Type: field.TypeString, Nullable: true},
+175 -1
View File
@@ -5999,6 +5999,10 @@ type InspectionRecordMutation struct {
addinspect_qty *int
pass_qty *int
addpass_qty *int
batch_seq *int
addbatch_seq *int
batch_total *int
addbatch_total *int
reject_qty *int
addreject_qty *int
check_desc *string
@@ -6752,6 +6756,118 @@ func (m *InspectionRecordMutation) ResetPassQty() {
m.addpass_qty = nil
}
// SetBatchSeq sets the "batch_seq" field.
func (m *InspectionRecordMutation) SetBatchSeq(i int) {
m.batch_seq = &i
m.addbatch_seq = nil
}
// BatchSeq returns the value of the "batch_seq" field in the mutation.
func (m *InspectionRecordMutation) BatchSeq() (r int, exists bool) {
v := m.batch_seq
if v == nil {
return
}
return *v, true
}
// OldBatchSeq returns the old "batch_seq" field's value of the InspectionRecord entity.
// If the InspectionRecord 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 *InspectionRecordMutation) OldBatchSeq(ctx context.Context) (v int, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldBatchSeq is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldBatchSeq requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldBatchSeq: %w", err)
}
return oldValue.BatchSeq, nil
}
// AddBatchSeq adds i to the "batch_seq" field.
func (m *InspectionRecordMutation) AddBatchSeq(i int) {
if m.addbatch_seq != nil {
*m.addbatch_seq += i
} else {
m.addbatch_seq = &i
}
}
// AddedBatchSeq returns the value that was added to the "batch_seq" field in this mutation.
func (m *InspectionRecordMutation) AddedBatchSeq() (r int, exists bool) {
v := m.addbatch_seq
if v == nil {
return
}
return *v, true
}
// ResetBatchSeq resets all changes to the "batch_seq" field.
func (m *InspectionRecordMutation) ResetBatchSeq() {
m.batch_seq = nil
m.addbatch_seq = nil
}
// SetBatchTotal sets the "batch_total" field.
func (m *InspectionRecordMutation) SetBatchTotal(i int) {
m.batch_total = &i
m.addbatch_total = nil
}
// BatchTotal returns the value of the "batch_total" field in the mutation.
func (m *InspectionRecordMutation) BatchTotal() (r int, exists bool) {
v := m.batch_total
if v == nil {
return
}
return *v, true
}
// OldBatchTotal returns the old "batch_total" field's value of the InspectionRecord entity.
// If the InspectionRecord 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 *InspectionRecordMutation) OldBatchTotal(ctx context.Context) (v int, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldBatchTotal is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldBatchTotal requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldBatchTotal: %w", err)
}
return oldValue.BatchTotal, nil
}
// AddBatchTotal adds i to the "batch_total" field.
func (m *InspectionRecordMutation) AddBatchTotal(i int) {
if m.addbatch_total != nil {
*m.addbatch_total += i
} else {
m.addbatch_total = &i
}
}
// AddedBatchTotal returns the value that was added to the "batch_total" field in this mutation.
func (m *InspectionRecordMutation) AddedBatchTotal() (r int, exists bool) {
v := m.addbatch_total
if v == nil {
return
}
return *v, true
}
// ResetBatchTotal resets all changes to the "batch_total" field.
func (m *InspectionRecordMutation) ResetBatchTotal() {
m.batch_total = nil
m.addbatch_total = nil
}
// SetRejectQty sets the "reject_qty" field.
func (m *InspectionRecordMutation) SetRejectQty(i int) {
m.reject_qty = &i
@@ -7333,7 +7449,7 @@ func (m *InspectionRecordMutation) Type() string {
// order to get all numeric fields that were incremented/decremented, call
// AddedFields().
func (m *InspectionRecordMutation) Fields() []string {
fields := make([]string, 0, 25)
fields := make([]string, 0, 27)
if m.target_type != nil {
fields = append(fields, inspectionrecord.FieldTargetType)
}
@@ -7376,6 +7492,12 @@ func (m *InspectionRecordMutation) Fields() []string {
if m.pass_qty != nil {
fields = append(fields, inspectionrecord.FieldPassQty)
}
if m.batch_seq != nil {
fields = append(fields, inspectionrecord.FieldBatchSeq)
}
if m.batch_total != nil {
fields = append(fields, inspectionrecord.FieldBatchTotal)
}
if m.reject_qty != nil {
fields = append(fields, inspectionrecord.FieldRejectQty)
}
@@ -7445,6 +7567,10 @@ func (m *InspectionRecordMutation) Field(name string) (ent.Value, bool) {
return m.InspectQty()
case inspectionrecord.FieldPassQty:
return m.PassQty()
case inspectionrecord.FieldBatchSeq:
return m.BatchSeq()
case inspectionrecord.FieldBatchTotal:
return m.BatchTotal()
case inspectionrecord.FieldRejectQty:
return m.RejectQty()
case inspectionrecord.FieldCheckDesc:
@@ -7504,6 +7630,10 @@ func (m *InspectionRecordMutation) OldField(ctx context.Context, name string) (e
return m.OldInspectQty(ctx)
case inspectionrecord.FieldPassQty:
return m.OldPassQty(ctx)
case inspectionrecord.FieldBatchSeq:
return m.OldBatchSeq(ctx)
case inspectionrecord.FieldBatchTotal:
return m.OldBatchTotal(ctx)
case inspectionrecord.FieldRejectQty:
return m.OldRejectQty(ctx)
case inspectionrecord.FieldCheckDesc:
@@ -7633,6 +7763,20 @@ func (m *InspectionRecordMutation) SetField(name string, value ent.Value) error
}
m.SetPassQty(v)
return nil
case inspectionrecord.FieldBatchSeq:
v, ok := value.(int)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetBatchSeq(v)
return nil
case inspectionrecord.FieldBatchTotal:
v, ok := value.(int)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetBatchTotal(v)
return nil
case inspectionrecord.FieldRejectQty:
v, ok := value.(int)
if !ok {
@@ -7724,6 +7868,12 @@ func (m *InspectionRecordMutation) AddedFields() []string {
if m.addpass_qty != nil {
fields = append(fields, inspectionrecord.FieldPassQty)
}
if m.addbatch_seq != nil {
fields = append(fields, inspectionrecord.FieldBatchSeq)
}
if m.addbatch_total != nil {
fields = append(fields, inspectionrecord.FieldBatchTotal)
}
if m.addreject_qty != nil {
fields = append(fields, inspectionrecord.FieldRejectQty)
}
@@ -7745,6 +7895,10 @@ func (m *InspectionRecordMutation) AddedField(name string) (ent.Value, bool) {
return m.AddedInspectQty()
case inspectionrecord.FieldPassQty:
return m.AddedPassQty()
case inspectionrecord.FieldBatchSeq:
return m.AddedBatchSeq()
case inspectionrecord.FieldBatchTotal:
return m.AddedBatchTotal()
case inspectionrecord.FieldRejectQty:
return m.AddedRejectQty()
case inspectionrecord.FieldCreatedAt:
@@ -7774,6 +7928,20 @@ func (m *InspectionRecordMutation) AddField(name string, value ent.Value) error
}
m.AddPassQty(v)
return nil
case inspectionrecord.FieldBatchSeq:
v, ok := value.(int)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.AddBatchSeq(v)
return nil
case inspectionrecord.FieldBatchTotal:
v, ok := value.(int)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.AddBatchTotal(v)
return nil
case inspectionrecord.FieldRejectQty:
v, ok := value.(int)
if !ok {
@@ -7951,6 +8119,12 @@ func (m *InspectionRecordMutation) ResetField(name string) error {
case inspectionrecord.FieldPassQty:
m.ResetPassQty()
return nil
case inspectionrecord.FieldBatchSeq:
m.ResetBatchSeq()
return nil
case inspectionrecord.FieldBatchTotal:
m.ResetBatchTotal()
return nil
case inspectionrecord.FieldRejectQty:
m.ResetRejectQty()
return nil
+12 -4
View File
@@ -205,20 +205,28 @@ func init() {
inspectionrecordDescPassQty := inspectionrecordFields[13].Descriptor()
// inspectionrecord.DefaultPassQty holds the default value on creation for the pass_qty field.
inspectionrecord.DefaultPassQty = inspectionrecordDescPassQty.Default.(int)
// inspectionrecordDescBatchSeq is the schema descriptor for batch_seq field.
inspectionrecordDescBatchSeq := inspectionrecordFields[14].Descriptor()
// inspectionrecord.DefaultBatchSeq holds the default value on creation for the batch_seq field.
inspectionrecord.DefaultBatchSeq = inspectionrecordDescBatchSeq.Default.(int)
// inspectionrecordDescBatchTotal is the schema descriptor for batch_total field.
inspectionrecordDescBatchTotal := inspectionrecordFields[15].Descriptor()
// inspectionrecord.DefaultBatchTotal holds the default value on creation for the batch_total field.
inspectionrecord.DefaultBatchTotal = inspectionrecordDescBatchTotal.Default.(int)
// inspectionrecordDescRejectQty is the schema descriptor for reject_qty field.
inspectionrecordDescRejectQty := inspectionrecordFields[14].Descriptor()
inspectionrecordDescRejectQty := inspectionrecordFields[16].Descriptor()
// inspectionrecord.DefaultRejectQty holds the default value on creation for the reject_qty field.
inspectionrecord.DefaultRejectQty = inspectionrecordDescRejectQty.Default.(int)
// inspectionrecordDescDisposalType is the schema descriptor for disposal_type field.
inspectionrecordDescDisposalType := inspectionrecordFields[19].Descriptor()
inspectionrecordDescDisposalType := inspectionrecordFields[21].Descriptor()
// inspectionrecord.DefaultDisposalType holds the default value on creation for the disposal_type field.
inspectionrecord.DefaultDisposalType = inspectionrecordDescDisposalType.Default.(string)
// inspectionrecordDescCreatedAt is the schema descriptor for created_at field.
inspectionrecordDescCreatedAt := inspectionrecordFields[23].Descriptor()
inspectionrecordDescCreatedAt := inspectionrecordFields[25].Descriptor()
// inspectionrecord.DefaultCreatedAt holds the default value on creation for the created_at field.
inspectionrecord.DefaultCreatedAt = inspectionrecordDescCreatedAt.Default.(func() int64)
// inspectionrecordDescUpdatedAt is the schema descriptor for updated_at field.
inspectionrecordDescUpdatedAt := inspectionrecordFields[24].Descriptor()
inspectionrecordDescUpdatedAt := inspectionrecordFields[26].Descriptor()
// inspectionrecord.DefaultUpdatedAt holds the default value on creation for the updated_at field.
inspectionrecord.DefaultUpdatedAt = inspectionrecordDescUpdatedAt.Default.(func() int64)
inventoryFields := schema.Inventory{}.Fields()