feat: 新增产品工艺管理与工序审核功能
- 新增产品工艺(product_process)及明细(product_process_item)数据模型 - 新增工序审核开关(need_audit)与审核角色(audit_role)字段 - 新增待审核签字页面与路由 - 优化 WMS/MES 接口交互,增加业务错误处理与友好提示 - 补充库存过滤逻辑,避免返回已出库 SN 数据 - 调整默认查询时间范围为近一个月,优化用户体验
This commit is contained in:
@@ -161,6 +161,40 @@ func (_u *ProcessStepUpdate) SetNillableNeedInspectorSign(v *bool) *ProcessStepU
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNeedAudit sets the "needAudit" field.
|
||||
func (_u *ProcessStepUpdate) SetNeedAudit(v bool) *ProcessStepUpdate {
|
||||
_u.mutation.SetNeedAudit(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableNeedAudit sets the "needAudit" field if the given value is not nil.
|
||||
func (_u *ProcessStepUpdate) SetNillableNeedAudit(v *bool) *ProcessStepUpdate {
|
||||
if v != nil {
|
||||
_u.SetNeedAudit(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetAuditRole sets the "auditRole" field.
|
||||
func (_u *ProcessStepUpdate) SetAuditRole(v string) *ProcessStepUpdate {
|
||||
_u.mutation.SetAuditRole(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableAuditRole sets the "auditRole" field if the given value is not nil.
|
||||
func (_u *ProcessStepUpdate) SetNillableAuditRole(v *string) *ProcessStepUpdate {
|
||||
if v != nil {
|
||||
_u.SetAuditRole(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearAuditRole clears the value of the "auditRole" field.
|
||||
func (_u *ProcessStepUpdate) ClearAuditRole() *ProcessStepUpdate {
|
||||
_u.mutation.ClearAuditRole()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetAttachment sets the "attachment" field.
|
||||
func (_u *ProcessStepUpdate) SetAttachment(v []map[string]string) *ProcessStepUpdate {
|
||||
_u.mutation.SetAttachment(v)
|
||||
@@ -237,6 +271,11 @@ func (_u *ProcessStepUpdate) check() error {
|
||||
return &ValidationError{Name: "collectType", err: fmt.Errorf(`ent: validator failed for field "ProcessStep.collectType": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.AuditRole(); ok {
|
||||
if err := processstep.AuditRoleValidator(v); err != nil {
|
||||
return &ValidationError{Name: "auditRole", err: fmt.Errorf(`ent: validator failed for field "ProcessStep.auditRole": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.Remark(); ok {
|
||||
if err := processstep.RemarkValidator(v); err != nil {
|
||||
return &ValidationError{Name: "remark", err: fmt.Errorf(`ent: validator failed for field "ProcessStep.remark": %w`, err)}
|
||||
@@ -296,6 +335,15 @@ func (_u *ProcessStepUpdate) sqlSave(ctx context.Context) (_node int, err error)
|
||||
if value, ok := _u.mutation.NeedInspectorSign(); ok {
|
||||
_spec.SetField(processstep.FieldNeedInspectorSign, field.TypeBool, value)
|
||||
}
|
||||
if value, ok := _u.mutation.NeedAudit(); ok {
|
||||
_spec.SetField(processstep.FieldNeedAudit, field.TypeBool, value)
|
||||
}
|
||||
if value, ok := _u.mutation.AuditRole(); ok {
|
||||
_spec.SetField(processstep.FieldAuditRole, field.TypeString, value)
|
||||
}
|
||||
if _u.mutation.AuditRoleCleared() {
|
||||
_spec.ClearField(processstep.FieldAuditRole, field.TypeString)
|
||||
}
|
||||
if value, ok := _u.mutation.Attachment(); ok {
|
||||
_spec.SetField(processstep.FieldAttachment, field.TypeJSON, value)
|
||||
}
|
||||
@@ -464,6 +512,40 @@ func (_u *ProcessStepUpdateOne) SetNillableNeedInspectorSign(v *bool) *ProcessSt
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNeedAudit sets the "needAudit" field.
|
||||
func (_u *ProcessStepUpdateOne) SetNeedAudit(v bool) *ProcessStepUpdateOne {
|
||||
_u.mutation.SetNeedAudit(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableNeedAudit sets the "needAudit" field if the given value is not nil.
|
||||
func (_u *ProcessStepUpdateOne) SetNillableNeedAudit(v *bool) *ProcessStepUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetNeedAudit(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetAuditRole sets the "auditRole" field.
|
||||
func (_u *ProcessStepUpdateOne) SetAuditRole(v string) *ProcessStepUpdateOne {
|
||||
_u.mutation.SetAuditRole(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableAuditRole sets the "auditRole" field if the given value is not nil.
|
||||
func (_u *ProcessStepUpdateOne) SetNillableAuditRole(v *string) *ProcessStepUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetAuditRole(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearAuditRole clears the value of the "auditRole" field.
|
||||
func (_u *ProcessStepUpdateOne) ClearAuditRole() *ProcessStepUpdateOne {
|
||||
_u.mutation.ClearAuditRole()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetAttachment sets the "attachment" field.
|
||||
func (_u *ProcessStepUpdateOne) SetAttachment(v []map[string]string) *ProcessStepUpdateOne {
|
||||
_u.mutation.SetAttachment(v)
|
||||
@@ -553,6 +635,11 @@ func (_u *ProcessStepUpdateOne) check() error {
|
||||
return &ValidationError{Name: "collectType", err: fmt.Errorf(`ent: validator failed for field "ProcessStep.collectType": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.AuditRole(); ok {
|
||||
if err := processstep.AuditRoleValidator(v); err != nil {
|
||||
return &ValidationError{Name: "auditRole", err: fmt.Errorf(`ent: validator failed for field "ProcessStep.auditRole": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.Remark(); ok {
|
||||
if err := processstep.RemarkValidator(v); err != nil {
|
||||
return &ValidationError{Name: "remark", err: fmt.Errorf(`ent: validator failed for field "ProcessStep.remark": %w`, err)}
|
||||
@@ -629,6 +716,15 @@ func (_u *ProcessStepUpdateOne) sqlSave(ctx context.Context) (_node *ProcessStep
|
||||
if value, ok := _u.mutation.NeedInspectorSign(); ok {
|
||||
_spec.SetField(processstep.FieldNeedInspectorSign, field.TypeBool, value)
|
||||
}
|
||||
if value, ok := _u.mutation.NeedAudit(); ok {
|
||||
_spec.SetField(processstep.FieldNeedAudit, field.TypeBool, value)
|
||||
}
|
||||
if value, ok := _u.mutation.AuditRole(); ok {
|
||||
_spec.SetField(processstep.FieldAuditRole, field.TypeString, value)
|
||||
}
|
||||
if _u.mutation.AuditRoleCleared() {
|
||||
_spec.ClearField(processstep.FieldAuditRole, field.TypeString)
|
||||
}
|
||||
if value, ok := _u.mutation.Attachment(); ok {
|
||||
_spec.SetField(processstep.FieldAttachment, field.TypeJSON, value)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user