feat: 大屏多订单改为同屏并列展示,物料申请新增跨工位借料来源并移除工单完成日期
This commit is contained in:
@@ -4,6 +4,7 @@ package ent
|
||||
|
||||
import (
|
||||
"bj_power_mes/ent/materialrequest"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -53,6 +54,8 @@ type MaterialRequest struct {
|
||||
OutboundNo string `json:"outboundNo,omitempty"`
|
||||
// 驳回理由(仓库拒发时必填)
|
||||
RejectReason string `json:"rejectReason,omitempty"`
|
||||
// 跨工位借料来源 stationNo→借用量;空=本工位自取
|
||||
BorrowFrom map[string]int `json:"borrowFrom,omitempty"`
|
||||
// Operator holds the value of the "operator" field.
|
||||
Operator string `json:"operator,omitempty"`
|
||||
// CreatedAt holds the value of the "createdAt" field.
|
||||
@@ -67,6 +70,8 @@ func (*MaterialRequest) scanValues(columns []string) ([]any, error) {
|
||||
values := make([]any, len(columns))
|
||||
for i := range columns {
|
||||
switch columns[i] {
|
||||
case materialrequest.FieldBorrowFrom:
|
||||
values[i] = new([]byte)
|
||||
case materialrequest.FieldNeedAgv, materialrequest.FieldCrossDay:
|
||||
values[i] = new(sql.NullBool)
|
||||
case materialrequest.FieldReqQty, materialrequest.FieldSentQty, materialrequest.FieldReturnedQty:
|
||||
@@ -206,6 +211,14 @@ func (_m *MaterialRequest) assignValues(columns []string, values []any) error {
|
||||
} else if value.Valid {
|
||||
_m.RejectReason = value.String
|
||||
}
|
||||
case materialrequest.FieldBorrowFrom:
|
||||
if value, ok := values[i].(*[]byte); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field borrowFrom", values[i])
|
||||
} else if value != nil && len(*value) > 0 {
|
||||
if err := json.Unmarshal(*value, &_m.BorrowFrom); err != nil {
|
||||
return fmt.Errorf("unmarshal field borrowFrom: %w", err)
|
||||
}
|
||||
}
|
||||
case materialrequest.FieldOperator:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field operator", values[i])
|
||||
@@ -315,6 +328,9 @@ func (_m *MaterialRequest) String() string {
|
||||
builder.WriteString("rejectReason=")
|
||||
builder.WriteString(_m.RejectReason)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("borrowFrom=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.BorrowFrom))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("operator=")
|
||||
builder.WriteString(_m.Operator)
|
||||
builder.WriteString(", ")
|
||||
|
||||
@@ -49,6 +49,8 @@ const (
|
||||
FieldOutboundNo = "outbound_no"
|
||||
// FieldRejectReason holds the string denoting the rejectreason field in the database.
|
||||
FieldRejectReason = "reject_reason"
|
||||
// FieldBorrowFrom holds the string denoting the borrowfrom field in the database.
|
||||
FieldBorrowFrom = "borrow_from"
|
||||
// FieldOperator holds the string denoting the operator field in the database.
|
||||
FieldOperator = "operator"
|
||||
// FieldCreatedAt holds the string denoting the createdat field in the database.
|
||||
@@ -80,6 +82,7 @@ var Columns = []string{
|
||||
FieldCrossDay,
|
||||
FieldOutboundNo,
|
||||
FieldRejectReason,
|
||||
FieldBorrowFrom,
|
||||
FieldOperator,
|
||||
FieldCreatedAt,
|
||||
FieldUpdatedAt,
|
||||
|
||||
@@ -1094,6 +1094,16 @@ func RejectReasonContainsFold(v string) predicate.MaterialRequest {
|
||||
return predicate.MaterialRequest(sql.FieldContainsFold(FieldRejectReason, v))
|
||||
}
|
||||
|
||||
// BorrowFromIsNil applies the IsNil predicate on the "borrowFrom" field.
|
||||
func BorrowFromIsNil() predicate.MaterialRequest {
|
||||
return predicate.MaterialRequest(sql.FieldIsNull(FieldBorrowFrom))
|
||||
}
|
||||
|
||||
// BorrowFromNotNil applies the NotNil predicate on the "borrowFrom" field.
|
||||
func BorrowFromNotNil() predicate.MaterialRequest {
|
||||
return predicate.MaterialRequest(sql.FieldNotNull(FieldBorrowFrom))
|
||||
}
|
||||
|
||||
// OperatorEQ applies the EQ predicate on the "operator" field.
|
||||
func OperatorEQ(v string) predicate.MaterialRequest {
|
||||
return predicate.MaterialRequest(sql.FieldEQ(FieldOperator, v))
|
||||
|
||||
@@ -256,6 +256,12 @@ func (_c *MaterialRequestCreate) SetNillableRejectReason(v *string) *MaterialReq
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetBorrowFrom sets the "borrowFrom" field.
|
||||
func (_c *MaterialRequestCreate) SetBorrowFrom(v map[string]int) *MaterialRequestCreate {
|
||||
_c.mutation.SetBorrowFrom(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetOperator sets the "operator" field.
|
||||
func (_c *MaterialRequestCreate) SetOperator(v string) *MaterialRequestCreate {
|
||||
_c.mutation.SetOperator(v)
|
||||
@@ -648,6 +654,10 @@ func (_c *MaterialRequestCreate) createSpec() (*MaterialRequest, *sqlgraph.Creat
|
||||
_spec.SetField(materialrequest.FieldRejectReason, field.TypeString, value)
|
||||
_node.RejectReason = value
|
||||
}
|
||||
if value, ok := _c.mutation.BorrowFrom(); ok {
|
||||
_spec.SetField(materialrequest.FieldBorrowFrom, field.TypeJSON, value)
|
||||
_node.BorrowFrom = value
|
||||
}
|
||||
if value, ok := _c.mutation.Operator(); ok {
|
||||
_spec.SetField(materialrequest.FieldOperator, field.TypeString, value)
|
||||
_node.Operator = value
|
||||
|
||||
@@ -316,6 +316,18 @@ func (_u *MaterialRequestUpdate) SetNillableRejectReason(v *string) *MaterialReq
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetBorrowFrom sets the "borrowFrom" field.
|
||||
func (_u *MaterialRequestUpdate) SetBorrowFrom(v map[string]int) *MaterialRequestUpdate {
|
||||
_u.mutation.SetBorrowFrom(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearBorrowFrom clears the value of the "borrowFrom" field.
|
||||
func (_u *MaterialRequestUpdate) ClearBorrowFrom() *MaterialRequestUpdate {
|
||||
_u.mutation.ClearBorrowFrom()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetOperator sets the "operator" field.
|
||||
func (_u *MaterialRequestUpdate) SetOperator(v string) *MaterialRequestUpdate {
|
||||
_u.mutation.SetOperator(v)
|
||||
@@ -535,6 +547,12 @@ func (_u *MaterialRequestUpdate) sqlSave(ctx context.Context) (_node int, err er
|
||||
if value, ok := _u.mutation.RejectReason(); ok {
|
||||
_spec.SetField(materialrequest.FieldRejectReason, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.BorrowFrom(); ok {
|
||||
_spec.SetField(materialrequest.FieldBorrowFrom, field.TypeJSON, value)
|
||||
}
|
||||
if _u.mutation.BorrowFromCleared() {
|
||||
_spec.ClearField(materialrequest.FieldBorrowFrom, field.TypeJSON)
|
||||
}
|
||||
if value, ok := _u.mutation.Operator(); ok {
|
||||
_spec.SetField(materialrequest.FieldOperator, field.TypeString, value)
|
||||
}
|
||||
@@ -853,6 +871,18 @@ func (_u *MaterialRequestUpdateOne) SetNillableRejectReason(v *string) *Material
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetBorrowFrom sets the "borrowFrom" field.
|
||||
func (_u *MaterialRequestUpdateOne) SetBorrowFrom(v map[string]int) *MaterialRequestUpdateOne {
|
||||
_u.mutation.SetBorrowFrom(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearBorrowFrom clears the value of the "borrowFrom" field.
|
||||
func (_u *MaterialRequestUpdateOne) ClearBorrowFrom() *MaterialRequestUpdateOne {
|
||||
_u.mutation.ClearBorrowFrom()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetOperator sets the "operator" field.
|
||||
func (_u *MaterialRequestUpdateOne) SetOperator(v string) *MaterialRequestUpdateOne {
|
||||
_u.mutation.SetOperator(v)
|
||||
@@ -1102,6 +1132,12 @@ func (_u *MaterialRequestUpdateOne) sqlSave(ctx context.Context) (_node *Materia
|
||||
if value, ok := _u.mutation.RejectReason(); ok {
|
||||
_spec.SetField(materialrequest.FieldRejectReason, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.BorrowFrom(); ok {
|
||||
_spec.SetField(materialrequest.FieldBorrowFrom, field.TypeJSON, value)
|
||||
}
|
||||
if _u.mutation.BorrowFromCleared() {
|
||||
_spec.ClearField(materialrequest.FieldBorrowFrom, field.TypeJSON)
|
||||
}
|
||||
if value, ok := _u.mutation.Operator(); ok {
|
||||
_spec.SetField(materialrequest.FieldOperator, field.TypeString, value)
|
||||
}
|
||||
|
||||
@@ -614,6 +614,7 @@ var (
|
||||
{Name: "cross_day", Type: field.TypeBool, Comment: "跨日标记:叫料池行含非今日排产(工位预警+仓库可驳回异常)", Default: false},
|
||||
{Name: "outbound_no", Type: field.TypeString, Size: 255, Comment: "WMS 出库单号(完成备料回写,多个逗号分隔)", Default: ""},
|
||||
{Name: "reject_reason", Type: field.TypeString, Size: 128, Comment: "驳回理由(仓库拒发时必填)", Default: ""},
|
||||
{Name: "borrow_from", Type: field.TypeJSON, Nullable: true, Comment: "跨工位借料来源 stationNo→借用量;空=本工位自取", SchemaType: map[string]string{"postgres": "jsonb"}},
|
||||
{Name: "operator", Type: field.TypeString, Size: 64, Default: ""},
|
||||
{Name: "created_at", Type: field.TypeTime},
|
||||
{Name: "updated_at", Type: field.TypeTime, Nullable: true},
|
||||
@@ -1175,7 +1176,6 @@ var (
|
||||
{Name: "project_no", Type: field.TypeString, Size: 64, Comment: "工程编号(已废弃,保留防历史数据迁移)", Default: ""},
|
||||
{Name: "product_serial", Type: field.TypeString, Size: 64, Comment: "产品序号(工单内每台产品的序号)", Default: ""},
|
||||
{Name: "created_by", Type: field.TypeString, Size: 64, Comment: "创建人", Default: ""},
|
||||
{Name: "due_date", Type: field.TypeTime, Nullable: true, Comment: "完成日期(必填)"},
|
||||
{Name: "flow_combination", Type: field.TypeJSON, Nullable: true, Comment: "工艺组合 [{flowId,stationNo}] 按工位号升序", SchemaType: map[string]string{"postgres": "jsonb"}},
|
||||
{Name: "product_process_id", Type: field.TypeInt, Comment: "来源产品工艺ID(0=无来源)", Default: 0},
|
||||
{Name: "status", Type: field.TypeString, Size: 20, Default: "CREATED"},
|
||||
@@ -1202,7 +1202,7 @@ var (
|
||||
{
|
||||
Name: "workorder_status",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{WorkOrderColumns[16]},
|
||||
Columns: []*schema.Column{WorkOrderColumns[15]},
|
||||
},
|
||||
{
|
||||
Name: "workorder_product_type_id",
|
||||
|
||||
@@ -15871,6 +15871,7 @@ type MaterialRequestMutation struct {
|
||||
crossDay *bool
|
||||
outboundNo *string
|
||||
rejectReason *string
|
||||
borrowFrom *map[string]int
|
||||
operator *string
|
||||
createdAt *time.Time
|
||||
updatedAt *time.Time
|
||||
@@ -16732,6 +16733,55 @@ func (m *MaterialRequestMutation) ResetRejectReason() {
|
||||
m.rejectReason = nil
|
||||
}
|
||||
|
||||
// SetBorrowFrom sets the "borrowFrom" field.
|
||||
func (m *MaterialRequestMutation) SetBorrowFrom(value map[string]int) {
|
||||
m.borrowFrom = &value
|
||||
}
|
||||
|
||||
// BorrowFrom returns the value of the "borrowFrom" field in the mutation.
|
||||
func (m *MaterialRequestMutation) BorrowFrom() (r map[string]int, exists bool) {
|
||||
v := m.borrowFrom
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldBorrowFrom returns the old "borrowFrom" field's value of the MaterialRequest entity.
|
||||
// If the MaterialRequest 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 *MaterialRequestMutation) OldBorrowFrom(ctx context.Context) (v map[string]int, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldBorrowFrom is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, errors.New("OldBorrowFrom requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
return v, fmt.Errorf("querying old value for OldBorrowFrom: %w", err)
|
||||
}
|
||||
return oldValue.BorrowFrom, nil
|
||||
}
|
||||
|
||||
// ClearBorrowFrom clears the value of the "borrowFrom" field.
|
||||
func (m *MaterialRequestMutation) ClearBorrowFrom() {
|
||||
m.borrowFrom = nil
|
||||
m.clearedFields[materialrequest.FieldBorrowFrom] = struct{}{}
|
||||
}
|
||||
|
||||
// BorrowFromCleared returns if the "borrowFrom" field was cleared in this mutation.
|
||||
func (m *MaterialRequestMutation) BorrowFromCleared() bool {
|
||||
_, ok := m.clearedFields[materialrequest.FieldBorrowFrom]
|
||||
return ok
|
||||
}
|
||||
|
||||
// ResetBorrowFrom resets all changes to the "borrowFrom" field.
|
||||
func (m *MaterialRequestMutation) ResetBorrowFrom() {
|
||||
m.borrowFrom = nil
|
||||
delete(m.clearedFields, materialrequest.FieldBorrowFrom)
|
||||
}
|
||||
|
||||
// SetOperator sets the "operator" field.
|
||||
func (m *MaterialRequestMutation) SetOperator(s string) {
|
||||
m.operator = &s
|
||||
@@ -16887,7 +16937,7 @@ func (m *MaterialRequestMutation) Type() string {
|
||||
// order to get all numeric fields that were incremented/decremented, call
|
||||
// AddedFields().
|
||||
func (m *MaterialRequestMutation) Fields() []string {
|
||||
fields := make([]string, 0, 21)
|
||||
fields := make([]string, 0, 22)
|
||||
if m.requestNo != nil {
|
||||
fields = append(fields, materialrequest.FieldRequestNo)
|
||||
}
|
||||
@@ -16942,6 +16992,9 @@ func (m *MaterialRequestMutation) Fields() []string {
|
||||
if m.rejectReason != nil {
|
||||
fields = append(fields, materialrequest.FieldRejectReason)
|
||||
}
|
||||
if m.borrowFrom != nil {
|
||||
fields = append(fields, materialrequest.FieldBorrowFrom)
|
||||
}
|
||||
if m.operator != nil {
|
||||
fields = append(fields, materialrequest.FieldOperator)
|
||||
}
|
||||
@@ -16995,6 +17048,8 @@ func (m *MaterialRequestMutation) Field(name string) (ent.Value, bool) {
|
||||
return m.OutboundNo()
|
||||
case materialrequest.FieldRejectReason:
|
||||
return m.RejectReason()
|
||||
case materialrequest.FieldBorrowFrom:
|
||||
return m.BorrowFrom()
|
||||
case materialrequest.FieldOperator:
|
||||
return m.Operator()
|
||||
case materialrequest.FieldCreatedAt:
|
||||
@@ -17046,6 +17101,8 @@ func (m *MaterialRequestMutation) OldField(ctx context.Context, name string) (en
|
||||
return m.OldOutboundNo(ctx)
|
||||
case materialrequest.FieldRejectReason:
|
||||
return m.OldRejectReason(ctx)
|
||||
case materialrequest.FieldBorrowFrom:
|
||||
return m.OldBorrowFrom(ctx)
|
||||
case materialrequest.FieldOperator:
|
||||
return m.OldOperator(ctx)
|
||||
case materialrequest.FieldCreatedAt:
|
||||
@@ -17187,6 +17244,13 @@ func (m *MaterialRequestMutation) SetField(name string, value ent.Value) error {
|
||||
}
|
||||
m.SetRejectReason(v)
|
||||
return nil
|
||||
case materialrequest.FieldBorrowFrom:
|
||||
v, ok := value.(map[string]int)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.SetBorrowFrom(v)
|
||||
return nil
|
||||
case materialrequest.FieldOperator:
|
||||
v, ok := value.(string)
|
||||
if !ok {
|
||||
@@ -17301,6 +17365,9 @@ func (m *MaterialRequestMutation) AddField(name string, value ent.Value) error {
|
||||
// mutation.
|
||||
func (m *MaterialRequestMutation) ClearedFields() []string {
|
||||
var fields []string
|
||||
if m.FieldCleared(materialrequest.FieldBorrowFrom) {
|
||||
fields = append(fields, materialrequest.FieldBorrowFrom)
|
||||
}
|
||||
if m.FieldCleared(materialrequest.FieldUpdatedAt) {
|
||||
fields = append(fields, materialrequest.FieldUpdatedAt)
|
||||
}
|
||||
@@ -17318,6 +17385,9 @@ func (m *MaterialRequestMutation) FieldCleared(name string) bool {
|
||||
// error if the field is not defined in the schema.
|
||||
func (m *MaterialRequestMutation) ClearField(name string) error {
|
||||
switch name {
|
||||
case materialrequest.FieldBorrowFrom:
|
||||
m.ClearBorrowFrom()
|
||||
return nil
|
||||
case materialrequest.FieldUpdatedAt:
|
||||
m.ClearUpdatedAt()
|
||||
return nil
|
||||
@@ -17383,6 +17453,9 @@ func (m *MaterialRequestMutation) ResetField(name string) error {
|
||||
case materialrequest.FieldRejectReason:
|
||||
m.ResetRejectReason()
|
||||
return nil
|
||||
case materialrequest.FieldBorrowFrom:
|
||||
m.ResetBorrowFrom()
|
||||
return nil
|
||||
case materialrequest.FieldOperator:
|
||||
m.ResetOperator()
|
||||
return nil
|
||||
@@ -31564,7 +31637,6 @@ type WorkOrderMutation struct {
|
||||
projectNo *string
|
||||
productSerial *string
|
||||
createdBy *string
|
||||
dueDate *time.Time
|
||||
flowCombination *[]map[string]int
|
||||
appendflowCombination []map[string]int
|
||||
productProcessId *int
|
||||
@@ -32199,55 +32271,6 @@ func (m *WorkOrderMutation) ResetCreatedBy() {
|
||||
m.createdBy = nil
|
||||
}
|
||||
|
||||
// SetDueDate sets the "dueDate" field.
|
||||
func (m *WorkOrderMutation) SetDueDate(t time.Time) {
|
||||
m.dueDate = &t
|
||||
}
|
||||
|
||||
// DueDate returns the value of the "dueDate" field in the mutation.
|
||||
func (m *WorkOrderMutation) DueDate() (r time.Time, exists bool) {
|
||||
v := m.dueDate
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldDueDate returns the old "dueDate" field's value of the WorkOrder entity.
|
||||
// If the WorkOrder 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 *WorkOrderMutation) OldDueDate(ctx context.Context) (v *time.Time, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldDueDate is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, errors.New("OldDueDate requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
return v, fmt.Errorf("querying old value for OldDueDate: %w", err)
|
||||
}
|
||||
return oldValue.DueDate, nil
|
||||
}
|
||||
|
||||
// ClearDueDate clears the value of the "dueDate" field.
|
||||
func (m *WorkOrderMutation) ClearDueDate() {
|
||||
m.dueDate = nil
|
||||
m.clearedFields[workorder.FieldDueDate] = struct{}{}
|
||||
}
|
||||
|
||||
// DueDateCleared returns if the "dueDate" field was cleared in this mutation.
|
||||
func (m *WorkOrderMutation) DueDateCleared() bool {
|
||||
_, ok := m.clearedFields[workorder.FieldDueDate]
|
||||
return ok
|
||||
}
|
||||
|
||||
// ResetDueDate resets all changes to the "dueDate" field.
|
||||
func (m *WorkOrderMutation) ResetDueDate() {
|
||||
m.dueDate = nil
|
||||
delete(m.clearedFields, workorder.FieldDueDate)
|
||||
}
|
||||
|
||||
// SetFlowCombination sets the "flowCombination" field.
|
||||
func (m *WorkOrderMutation) SetFlowCombination(value []map[string]int) {
|
||||
m.flowCombination = &value
|
||||
@@ -32769,7 +32792,7 @@ func (m *WorkOrderMutation) Type() string {
|
||||
// order to get all numeric fields that were incremented/decremented, call
|
||||
// AddedFields().
|
||||
func (m *WorkOrderMutation) Fields() []string {
|
||||
fields := make([]string, 0, 23)
|
||||
fields := make([]string, 0, 22)
|
||||
if m.workOrderNo != nil {
|
||||
fields = append(fields, workorder.FieldWorkOrderNo)
|
||||
}
|
||||
@@ -32806,9 +32829,6 @@ func (m *WorkOrderMutation) Fields() []string {
|
||||
if m.createdBy != nil {
|
||||
fields = append(fields, workorder.FieldCreatedBy)
|
||||
}
|
||||
if m.dueDate != nil {
|
||||
fields = append(fields, workorder.FieldDueDate)
|
||||
}
|
||||
if m.flowCombination != nil {
|
||||
fields = append(fields, workorder.FieldFlowCombination)
|
||||
}
|
||||
@@ -32871,8 +32891,6 @@ func (m *WorkOrderMutation) Field(name string) (ent.Value, bool) {
|
||||
return m.ProductSerial()
|
||||
case workorder.FieldCreatedBy:
|
||||
return m.CreatedBy()
|
||||
case workorder.FieldDueDate:
|
||||
return m.DueDate()
|
||||
case workorder.FieldFlowCombination:
|
||||
return m.FlowCombination()
|
||||
case workorder.FieldProductProcessId:
|
||||
@@ -32926,8 +32944,6 @@ func (m *WorkOrderMutation) OldField(ctx context.Context, name string) (ent.Valu
|
||||
return m.OldProductSerial(ctx)
|
||||
case workorder.FieldCreatedBy:
|
||||
return m.OldCreatedBy(ctx)
|
||||
case workorder.FieldDueDate:
|
||||
return m.OldDueDate(ctx)
|
||||
case workorder.FieldFlowCombination:
|
||||
return m.OldFlowCombination(ctx)
|
||||
case workorder.FieldProductProcessId:
|
||||
@@ -33041,13 +33057,6 @@ func (m *WorkOrderMutation) SetField(name string, value ent.Value) error {
|
||||
}
|
||||
m.SetCreatedBy(v)
|
||||
return nil
|
||||
case workorder.FieldDueDate:
|
||||
v, ok := value.(time.Time)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.SetDueDate(v)
|
||||
return nil
|
||||
case workorder.FieldFlowCombination:
|
||||
v, ok := value.([]map[string]int)
|
||||
if !ok {
|
||||
@@ -33211,9 +33220,6 @@ func (m *WorkOrderMutation) AddField(name string, value ent.Value) error {
|
||||
// mutation.
|
||||
func (m *WorkOrderMutation) ClearedFields() []string {
|
||||
var fields []string
|
||||
if m.FieldCleared(workorder.FieldDueDate) {
|
||||
fields = append(fields, workorder.FieldDueDate)
|
||||
}
|
||||
if m.FieldCleared(workorder.FieldFlowCombination) {
|
||||
fields = append(fields, workorder.FieldFlowCombination)
|
||||
}
|
||||
@@ -33249,9 +33255,6 @@ func (m *WorkOrderMutation) FieldCleared(name string) bool {
|
||||
// error if the field is not defined in the schema.
|
||||
func (m *WorkOrderMutation) ClearField(name string) error {
|
||||
switch name {
|
||||
case workorder.FieldDueDate:
|
||||
m.ClearDueDate()
|
||||
return nil
|
||||
case workorder.FieldFlowCombination:
|
||||
m.ClearFlowCombination()
|
||||
return nil
|
||||
@@ -33317,9 +33320,6 @@ func (m *WorkOrderMutation) ResetField(name string) error {
|
||||
case workorder.FieldCreatedBy:
|
||||
m.ResetCreatedBy()
|
||||
return nil
|
||||
case workorder.FieldDueDate:
|
||||
m.ResetDueDate()
|
||||
return nil
|
||||
case workorder.FieldFlowCombination:
|
||||
m.ResetFlowCombination()
|
||||
return nil
|
||||
|
||||
@@ -1090,17 +1090,17 @@ func init() {
|
||||
// materialrequest.RejectReasonValidator is a validator for the "rejectReason" field. It is called by the builders before save.
|
||||
materialrequest.RejectReasonValidator = materialrequestDescRejectReason.Validators[0].(func(string) error)
|
||||
// materialrequestDescOperator is the schema descriptor for operator field.
|
||||
materialrequestDescOperator := materialrequestFields[19].Descriptor()
|
||||
materialrequestDescOperator := materialrequestFields[20].Descriptor()
|
||||
// materialrequest.DefaultOperator holds the default value on creation for the operator field.
|
||||
materialrequest.DefaultOperator = materialrequestDescOperator.Default.(string)
|
||||
// materialrequest.OperatorValidator is a validator for the "operator" field. It is called by the builders before save.
|
||||
materialrequest.OperatorValidator = materialrequestDescOperator.Validators[0].(func(string) error)
|
||||
// materialrequestDescCreatedAt is the schema descriptor for createdAt field.
|
||||
materialrequestDescCreatedAt := materialrequestFields[20].Descriptor()
|
||||
materialrequestDescCreatedAt := materialrequestFields[21].Descriptor()
|
||||
// materialrequest.DefaultCreatedAt holds the default value on creation for the createdAt field.
|
||||
materialrequest.DefaultCreatedAt = materialrequestDescCreatedAt.Default.(func() time.Time)
|
||||
// materialrequestDescUpdatedAt is the schema descriptor for updatedAt field.
|
||||
materialrequestDescUpdatedAt := materialrequestFields[21].Descriptor()
|
||||
materialrequestDescUpdatedAt := materialrequestFields[22].Descriptor()
|
||||
// materialrequest.DefaultUpdatedAt holds the default value on creation for the updatedAt field.
|
||||
materialrequest.DefaultUpdatedAt = materialrequestDescUpdatedAt.Default.(func() time.Time)
|
||||
// materialrequest.UpdateDefaultUpdatedAt holds the default value on update for the updatedAt field.
|
||||
@@ -1860,21 +1860,21 @@ func init() {
|
||||
// workorder.CreatedByValidator is a validator for the "createdBy" field. It is called by the builders before save.
|
||||
workorder.CreatedByValidator = workorderDescCreatedBy.Validators[0].(func(string) error)
|
||||
// workorderDescProductProcessId is the schema descriptor for productProcessId field.
|
||||
workorderDescProductProcessId := workorderFields[15].Descriptor()
|
||||
workorderDescProductProcessId := workorderFields[14].Descriptor()
|
||||
// workorder.DefaultProductProcessId holds the default value on creation for the productProcessId field.
|
||||
workorder.DefaultProductProcessId = workorderDescProductProcessId.Default.(int)
|
||||
// workorderDescStatus is the schema descriptor for status field.
|
||||
workorderDescStatus := workorderFields[16].Descriptor()
|
||||
workorderDescStatus := workorderFields[15].Descriptor()
|
||||
// workorder.DefaultStatus holds the default value on creation for the status field.
|
||||
workorder.DefaultStatus = workorderDescStatus.Default.(string)
|
||||
// workorder.StatusValidator is a validator for the "status" field. It is called by the builders before save.
|
||||
workorder.StatusValidator = workorderDescStatus.Validators[0].(func(string) error)
|
||||
// workorderDescCreatedAt is the schema descriptor for createdAt field.
|
||||
workorderDescCreatedAt := workorderFields[22].Descriptor()
|
||||
workorderDescCreatedAt := workorderFields[21].Descriptor()
|
||||
// workorder.DefaultCreatedAt holds the default value on creation for the createdAt field.
|
||||
workorder.DefaultCreatedAt = workorderDescCreatedAt.Default.(func() time.Time)
|
||||
// workorderDescUpdatedAt is the schema descriptor for updatedAt field.
|
||||
workorderDescUpdatedAt := workorderFields[23].Descriptor()
|
||||
workorderDescUpdatedAt := workorderFields[22].Descriptor()
|
||||
// workorder.DefaultUpdatedAt holds the default value on creation for the updatedAt field.
|
||||
workorder.DefaultUpdatedAt = workorderDescUpdatedAt.Default.(func() time.Time)
|
||||
// workorder.UpdateDefaultUpdatedAt holds the default value on update for the updatedAt field.
|
||||
|
||||
@@ -42,8 +42,6 @@ type WorkOrder struct {
|
||||
ProductSerial string `json:"productSerial,omitempty"`
|
||||
// 创建人
|
||||
CreatedBy string `json:"createdBy,omitempty"`
|
||||
// 完成日期(必填)
|
||||
DueDate *time.Time `json:"dueDate,omitempty"`
|
||||
// 工艺组合 [{flowId,stationNo}] 按工位号升序
|
||||
FlowCombination []map[string]int `json:"flowCombination,omitempty"`
|
||||
// 来源产品工艺ID(0=无来源)
|
||||
@@ -78,7 +76,7 @@ func (*WorkOrder) scanValues(columns []string) ([]any, error) {
|
||||
values[i] = new(sql.NullInt64)
|
||||
case workorder.FieldWorkOrderNo, workorder.FieldProductCode, workorder.FieldProductName, workorder.FieldContractNo, workorder.FieldOwnershipType, workorder.FieldProjectNo, workorder.FieldProductSerial, workorder.FieldCreatedBy, workorder.FieldStatus:
|
||||
values[i] = new(sql.NullString)
|
||||
case workorder.FieldDueDate, workorder.FieldPlanStart, workorder.FieldPlanEnd, workorder.FieldCompletedAt, workorder.FieldActualStart, workorder.FieldCreatedAt, workorder.FieldUpdatedAt:
|
||||
case workorder.FieldPlanStart, workorder.FieldPlanEnd, workorder.FieldCompletedAt, workorder.FieldActualStart, workorder.FieldCreatedAt, workorder.FieldUpdatedAt:
|
||||
values[i] = new(sql.NullTime)
|
||||
default:
|
||||
values[i] = new(sql.UnknownType)
|
||||
@@ -173,13 +171,6 @@ func (_m *WorkOrder) assignValues(columns []string, values []any) error {
|
||||
} else if value.Valid {
|
||||
_m.CreatedBy = value.String
|
||||
}
|
||||
case workorder.FieldDueDate:
|
||||
if value, ok := values[i].(*sql.NullTime); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field dueDate", values[i])
|
||||
} else if value.Valid {
|
||||
_m.DueDate = new(time.Time)
|
||||
*_m.DueDate = value.Time
|
||||
}
|
||||
case workorder.FieldFlowCombination:
|
||||
if value, ok := values[i].(*[]byte); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field flowCombination", values[i])
|
||||
@@ -321,11 +312,6 @@ func (_m *WorkOrder) String() string {
|
||||
builder.WriteString("createdBy=")
|
||||
builder.WriteString(_m.CreatedBy)
|
||||
builder.WriteString(", ")
|
||||
if v := _m.DueDate; v != nil {
|
||||
builder.WriteString("dueDate=")
|
||||
builder.WriteString(v.Format(time.ANSIC))
|
||||
}
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("flowCombination=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.FlowCombination))
|
||||
builder.WriteString(", ")
|
||||
|
||||
@@ -114,11 +114,6 @@ func CreatedBy(v string) predicate.WorkOrder {
|
||||
return predicate.WorkOrder(sql.FieldEQ(FieldCreatedBy, v))
|
||||
}
|
||||
|
||||
// DueDate applies equality check predicate on the "dueDate" field. It's identical to DueDateEQ.
|
||||
func DueDate(v time.Time) predicate.WorkOrder {
|
||||
return predicate.WorkOrder(sql.FieldEQ(FieldDueDate, v))
|
||||
}
|
||||
|
||||
// ProductProcessId applies equality check predicate on the "productProcessId" field. It's identical to ProductProcessIdEQ.
|
||||
func ProductProcessId(v int) predicate.WorkOrder {
|
||||
return predicate.WorkOrder(sql.FieldEQ(FieldProductProcessId, v))
|
||||
@@ -839,56 +834,6 @@ func CreatedByContainsFold(v string) predicate.WorkOrder {
|
||||
return predicate.WorkOrder(sql.FieldContainsFold(FieldCreatedBy, v))
|
||||
}
|
||||
|
||||
// DueDateEQ applies the EQ predicate on the "dueDate" field.
|
||||
func DueDateEQ(v time.Time) predicate.WorkOrder {
|
||||
return predicate.WorkOrder(sql.FieldEQ(FieldDueDate, v))
|
||||
}
|
||||
|
||||
// DueDateNEQ applies the NEQ predicate on the "dueDate" field.
|
||||
func DueDateNEQ(v time.Time) predicate.WorkOrder {
|
||||
return predicate.WorkOrder(sql.FieldNEQ(FieldDueDate, v))
|
||||
}
|
||||
|
||||
// DueDateIn applies the In predicate on the "dueDate" field.
|
||||
func DueDateIn(vs ...time.Time) predicate.WorkOrder {
|
||||
return predicate.WorkOrder(sql.FieldIn(FieldDueDate, vs...))
|
||||
}
|
||||
|
||||
// DueDateNotIn applies the NotIn predicate on the "dueDate" field.
|
||||
func DueDateNotIn(vs ...time.Time) predicate.WorkOrder {
|
||||
return predicate.WorkOrder(sql.FieldNotIn(FieldDueDate, vs...))
|
||||
}
|
||||
|
||||
// DueDateGT applies the GT predicate on the "dueDate" field.
|
||||
func DueDateGT(v time.Time) predicate.WorkOrder {
|
||||
return predicate.WorkOrder(sql.FieldGT(FieldDueDate, v))
|
||||
}
|
||||
|
||||
// DueDateGTE applies the GTE predicate on the "dueDate" field.
|
||||
func DueDateGTE(v time.Time) predicate.WorkOrder {
|
||||
return predicate.WorkOrder(sql.FieldGTE(FieldDueDate, v))
|
||||
}
|
||||
|
||||
// DueDateLT applies the LT predicate on the "dueDate" field.
|
||||
func DueDateLT(v time.Time) predicate.WorkOrder {
|
||||
return predicate.WorkOrder(sql.FieldLT(FieldDueDate, v))
|
||||
}
|
||||
|
||||
// DueDateLTE applies the LTE predicate on the "dueDate" field.
|
||||
func DueDateLTE(v time.Time) predicate.WorkOrder {
|
||||
return predicate.WorkOrder(sql.FieldLTE(FieldDueDate, v))
|
||||
}
|
||||
|
||||
// DueDateIsNil applies the IsNil predicate on the "dueDate" field.
|
||||
func DueDateIsNil() predicate.WorkOrder {
|
||||
return predicate.WorkOrder(sql.FieldIsNull(FieldDueDate))
|
||||
}
|
||||
|
||||
// DueDateNotNil applies the NotNil predicate on the "dueDate" field.
|
||||
func DueDateNotNil() predicate.WorkOrder {
|
||||
return predicate.WorkOrder(sql.FieldNotNull(FieldDueDate))
|
||||
}
|
||||
|
||||
// FlowCombinationIsNil applies the IsNil predicate on the "flowCombination" field.
|
||||
func FlowCombinationIsNil() predicate.WorkOrder {
|
||||
return predicate.WorkOrder(sql.FieldIsNull(FieldFlowCombination))
|
||||
|
||||
@@ -37,8 +37,6 @@ const (
|
||||
FieldProductSerial = "product_serial"
|
||||
// FieldCreatedBy holds the string denoting the createdby field in the database.
|
||||
FieldCreatedBy = "created_by"
|
||||
// FieldDueDate holds the string denoting the duedate field in the database.
|
||||
FieldDueDate = "due_date"
|
||||
// FieldFlowCombination holds the string denoting the flowcombination field in the database.
|
||||
FieldFlowCombination = "flow_combination"
|
||||
// FieldProductProcessId holds the string denoting the productprocessid field in the database.
|
||||
@@ -78,7 +76,6 @@ var Columns = []string{
|
||||
FieldProjectNo,
|
||||
FieldProductSerial,
|
||||
FieldCreatedBy,
|
||||
FieldDueDate,
|
||||
FieldFlowCombination,
|
||||
FieldProductProcessId,
|
||||
FieldStatus,
|
||||
@@ -222,11 +219,6 @@ func ByCreatedBy(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldCreatedBy, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByDueDate orders the results by the dueDate field.
|
||||
func ByDueDate(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldDueDate, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByProductProcessId orders the results by the productProcessId field.
|
||||
func ByProductProcessId(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldProductProcessId, opts...).ToFunc()
|
||||
|
||||
@@ -172,20 +172,6 @@ func (_c *WorkOrderCreate) SetNillableCreatedBy(v *string) *WorkOrderCreate {
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetDueDate sets the "dueDate" field.
|
||||
func (_c *WorkOrderCreate) SetDueDate(v time.Time) *WorkOrderCreate {
|
||||
_c.mutation.SetDueDate(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetNillableDueDate sets the "dueDate" field if the given value is not nil.
|
||||
func (_c *WorkOrderCreate) SetNillableDueDate(v *time.Time) *WorkOrderCreate {
|
||||
if v != nil {
|
||||
_c.SetDueDate(*v)
|
||||
}
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetFlowCombination sets the "flowCombination" field.
|
||||
func (_c *WorkOrderCreate) SetFlowCombination(v []map[string]int) *WorkOrderCreate {
|
||||
_c.mutation.SetFlowCombination(v)
|
||||
@@ -586,10 +572,6 @@ func (_c *WorkOrderCreate) createSpec() (*WorkOrder, *sqlgraph.CreateSpec) {
|
||||
_spec.SetField(workorder.FieldCreatedBy, field.TypeString, value)
|
||||
_node.CreatedBy = value
|
||||
}
|
||||
if value, ok := _c.mutation.DueDate(); ok {
|
||||
_spec.SetField(workorder.FieldDueDate, field.TypeTime, value)
|
||||
_node.DueDate = &value
|
||||
}
|
||||
if value, ok := _c.mutation.FlowCombination(); ok {
|
||||
_spec.SetField(workorder.FieldFlowCombination, field.TypeJSON, value)
|
||||
_node.FlowCombination = value
|
||||
|
||||
@@ -226,26 +226,6 @@ func (_u *WorkOrderUpdate) SetNillableCreatedBy(v *string) *WorkOrderUpdate {
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetDueDate sets the "dueDate" field.
|
||||
func (_u *WorkOrderUpdate) SetDueDate(v time.Time) *WorkOrderUpdate {
|
||||
_u.mutation.SetDueDate(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableDueDate sets the "dueDate" field if the given value is not nil.
|
||||
func (_u *WorkOrderUpdate) SetNillableDueDate(v *time.Time) *WorkOrderUpdate {
|
||||
if v != nil {
|
||||
_u.SetDueDate(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearDueDate clears the value of the "dueDate" field.
|
||||
func (_u *WorkOrderUpdate) ClearDueDate() *WorkOrderUpdate {
|
||||
_u.mutation.ClearDueDate()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetFlowCombination sets the "flowCombination" field.
|
||||
func (_u *WorkOrderUpdate) SetFlowCombination(v []map[string]int) *WorkOrderUpdate {
|
||||
_u.mutation.SetFlowCombination(v)
|
||||
@@ -560,12 +540,6 @@ func (_u *WorkOrderUpdate) sqlSave(ctx context.Context) (_node int, err error) {
|
||||
if value, ok := _u.mutation.CreatedBy(); ok {
|
||||
_spec.SetField(workorder.FieldCreatedBy, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.DueDate(); ok {
|
||||
_spec.SetField(workorder.FieldDueDate, field.TypeTime, value)
|
||||
}
|
||||
if _u.mutation.DueDateCleared() {
|
||||
_spec.ClearField(workorder.FieldDueDate, field.TypeTime)
|
||||
}
|
||||
if value, ok := _u.mutation.FlowCombination(); ok {
|
||||
_spec.SetField(workorder.FieldFlowCombination, field.TypeJSON, value)
|
||||
}
|
||||
@@ -840,26 +814,6 @@ func (_u *WorkOrderUpdateOne) SetNillableCreatedBy(v *string) *WorkOrderUpdateOn
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetDueDate sets the "dueDate" field.
|
||||
func (_u *WorkOrderUpdateOne) SetDueDate(v time.Time) *WorkOrderUpdateOne {
|
||||
_u.mutation.SetDueDate(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableDueDate sets the "dueDate" field if the given value is not nil.
|
||||
func (_u *WorkOrderUpdateOne) SetNillableDueDate(v *time.Time) *WorkOrderUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetDueDate(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearDueDate clears the value of the "dueDate" field.
|
||||
func (_u *WorkOrderUpdateOne) ClearDueDate() *WorkOrderUpdateOne {
|
||||
_u.mutation.ClearDueDate()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetFlowCombination sets the "flowCombination" field.
|
||||
func (_u *WorkOrderUpdateOne) SetFlowCombination(v []map[string]int) *WorkOrderUpdateOne {
|
||||
_u.mutation.SetFlowCombination(v)
|
||||
@@ -1204,12 +1158,6 @@ func (_u *WorkOrderUpdateOne) sqlSave(ctx context.Context) (_node *WorkOrder, er
|
||||
if value, ok := _u.mutation.CreatedBy(); ok {
|
||||
_spec.SetField(workorder.FieldCreatedBy, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.DueDate(); ok {
|
||||
_spec.SetField(workorder.FieldDueDate, field.TypeTime, value)
|
||||
}
|
||||
if _u.mutation.DueDateCleared() {
|
||||
_spec.ClearField(workorder.FieldDueDate, field.TypeTime)
|
||||
}
|
||||
if value, ok := _u.mutation.FlowCombination(); ok {
|
||||
_spec.SetField(workorder.FieldFlowCombination, field.TypeJSON, value)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user