feat: 解耦管理类型与SN管理方式,新增sn_mode字段实现全链路SN管理标准化
本次重构将原manage_mode字段拆分为独立的分类维度(manage_mode)和SN管理维度(sn_mode),实现全链路(MES/WMS/工位终端)的SN管理行为统一依据: 1. 新增sn_mode字段,定义1=序列号件、2=批次件、0=未选择,替代原manage_mode的SN判断逻辑 2. 移除冗余的manage_mode字段在多个实体中的使用,统一使用sn_mode决定业务行为 3. 新增工位接驳台配置,服务端固定接驳台,前端不可修改,确保AGV送达准确性 4. 优化检验记录导出,新增装配物料绑定明细,满足客户追溯需求 5. 修正前端提示文本,统一使用序列号件/批次件表述,与后端逻辑对齐
This commit is contained in:
@@ -147,20 +147,27 @@ func (_u *WorkpieceBindUpdate) SetNillableUnit(v *string) *WorkpieceBindUpdate {
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetManageMode sets the "manageMode" field.
|
||||
func (_u *WorkpieceBindUpdate) SetManageMode(v string) *WorkpieceBindUpdate {
|
||||
_u.mutation.SetManageMode(v)
|
||||
// SetSnMode sets the "snMode" field.
|
||||
func (_u *WorkpieceBindUpdate) SetSnMode(v int) *WorkpieceBindUpdate {
|
||||
_u.mutation.ResetSnMode()
|
||||
_u.mutation.SetSnMode(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableManageMode sets the "manageMode" field if the given value is not nil.
|
||||
func (_u *WorkpieceBindUpdate) SetNillableManageMode(v *string) *WorkpieceBindUpdate {
|
||||
// SetNillableSnMode sets the "snMode" field if the given value is not nil.
|
||||
func (_u *WorkpieceBindUpdate) SetNillableSnMode(v *int) *WorkpieceBindUpdate {
|
||||
if v != nil {
|
||||
_u.SetManageMode(*v)
|
||||
_u.SetSnMode(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddSnMode adds value to the "snMode" field.
|
||||
func (_u *WorkpieceBindUpdate) AddSnMode(v int) *WorkpieceBindUpdate {
|
||||
_u.mutation.AddSnMode(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetBindValue sets the "bindValue" field.
|
||||
func (_u *WorkpieceBindUpdate) SetBindValue(v string) *WorkpieceBindUpdate {
|
||||
_u.mutation.SetBindValue(v)
|
||||
@@ -272,11 +279,6 @@ func (_u *WorkpieceBindUpdate) check() error {
|
||||
return &ValidationError{Name: "unit", err: fmt.Errorf(`ent: validator failed for field "WorkpieceBind.unit": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.ManageMode(); ok {
|
||||
if err := workpiecebind.ManageModeValidator(v); err != nil {
|
||||
return &ValidationError{Name: "manageMode", err: fmt.Errorf(`ent: validator failed for field "WorkpieceBind.manageMode": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.BindValue(); ok {
|
||||
if err := workpiecebind.BindValueValidator(v); err != nil {
|
||||
return &ValidationError{Name: "bindValue", err: fmt.Errorf(`ent: validator failed for field "WorkpieceBind.bindValue": %w`, err)}
|
||||
@@ -340,8 +342,11 @@ func (_u *WorkpieceBindUpdate) sqlSave(ctx context.Context) (_node int, err erro
|
||||
if value, ok := _u.mutation.Unit(); ok {
|
||||
_spec.SetField(workpiecebind.FieldUnit, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.ManageMode(); ok {
|
||||
_spec.SetField(workpiecebind.FieldManageMode, field.TypeString, value)
|
||||
if value, ok := _u.mutation.SnMode(); ok {
|
||||
_spec.SetField(workpiecebind.FieldSnMode, field.TypeInt, value)
|
||||
}
|
||||
if value, ok := _u.mutation.AddedSnMode(); ok {
|
||||
_spec.AddField(workpiecebind.FieldSnMode, field.TypeInt, value)
|
||||
}
|
||||
if value, ok := _u.mutation.BindValue(); ok {
|
||||
_spec.SetField(workpiecebind.FieldBindValue, field.TypeString, value)
|
||||
@@ -493,20 +498,27 @@ func (_u *WorkpieceBindUpdateOne) SetNillableUnit(v *string) *WorkpieceBindUpdat
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetManageMode sets the "manageMode" field.
|
||||
func (_u *WorkpieceBindUpdateOne) SetManageMode(v string) *WorkpieceBindUpdateOne {
|
||||
_u.mutation.SetManageMode(v)
|
||||
// SetSnMode sets the "snMode" field.
|
||||
func (_u *WorkpieceBindUpdateOne) SetSnMode(v int) *WorkpieceBindUpdateOne {
|
||||
_u.mutation.ResetSnMode()
|
||||
_u.mutation.SetSnMode(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableManageMode sets the "manageMode" field if the given value is not nil.
|
||||
func (_u *WorkpieceBindUpdateOne) SetNillableManageMode(v *string) *WorkpieceBindUpdateOne {
|
||||
// SetNillableSnMode sets the "snMode" field if the given value is not nil.
|
||||
func (_u *WorkpieceBindUpdateOne) SetNillableSnMode(v *int) *WorkpieceBindUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetManageMode(*v)
|
||||
_u.SetSnMode(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddSnMode adds value to the "snMode" field.
|
||||
func (_u *WorkpieceBindUpdateOne) AddSnMode(v int) *WorkpieceBindUpdateOne {
|
||||
_u.mutation.AddSnMode(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetBindValue sets the "bindValue" field.
|
||||
func (_u *WorkpieceBindUpdateOne) SetBindValue(v string) *WorkpieceBindUpdateOne {
|
||||
_u.mutation.SetBindValue(v)
|
||||
@@ -631,11 +643,6 @@ func (_u *WorkpieceBindUpdateOne) check() error {
|
||||
return &ValidationError{Name: "unit", err: fmt.Errorf(`ent: validator failed for field "WorkpieceBind.unit": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.ManageMode(); ok {
|
||||
if err := workpiecebind.ManageModeValidator(v); err != nil {
|
||||
return &ValidationError{Name: "manageMode", err: fmt.Errorf(`ent: validator failed for field "WorkpieceBind.manageMode": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.BindValue(); ok {
|
||||
if err := workpiecebind.BindValueValidator(v); err != nil {
|
||||
return &ValidationError{Name: "bindValue", err: fmt.Errorf(`ent: validator failed for field "WorkpieceBind.bindValue": %w`, err)}
|
||||
@@ -716,8 +723,11 @@ func (_u *WorkpieceBindUpdateOne) sqlSave(ctx context.Context) (_node *Workpiece
|
||||
if value, ok := _u.mutation.Unit(); ok {
|
||||
_spec.SetField(workpiecebind.FieldUnit, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.ManageMode(); ok {
|
||||
_spec.SetField(workpiecebind.FieldManageMode, field.TypeString, value)
|
||||
if value, ok := _u.mutation.SnMode(); ok {
|
||||
_spec.SetField(workpiecebind.FieldSnMode, field.TypeInt, value)
|
||||
}
|
||||
if value, ok := _u.mutation.AddedSnMode(); ok {
|
||||
_spec.AddField(workpiecebind.FieldSnMode, field.TypeInt, value)
|
||||
}
|
||||
if value, ok := _u.mutation.BindValue(); ok {
|
||||
_spec.SetField(workpiecebind.FieldBindValue, field.TypeString, value)
|
||||
|
||||
Reference in New Issue
Block a user