product_record.go 1.7 KB
package domain

import "time"

const (
	RecordTypeReceiveMaterial  = 1 // 领料
	RecordTypeReturnMaterial   = 2 // 退料
	RecordTypeWeigh            = 4 // 称重
	RecordTypeSecondLevelWeigh = 8 // 二级品称重
)

const (
	ProductRecordNotApprove = 1 // 未审核
	ProductRecordApproved   = 2 // 已审核
)

// 生产记录
type ProductRecord struct {
	// 生产记录ID
	ProductRecordId int `json:"productRecordId,omitempty"`
	// 企业id
	CompanyId int `json:"companyId,omitempty"`
	// 组织ID
	OrgId int `json:"orgId,omitempty"`
	// 生产记录类型:1:领料 2:退料  4:称重 8:二级品称重
	ProductRecordType int `json:"productRecordType,omitempty"`
	// 生产工人
	ProductWorker *User `json:"productWorker,omitempty"`
	// 工作位置
	WorkStation *WorkStation `json:"workStation,omitempty"`
	// 创建时间
	CreatedAt time.Time `json:"createdAt,omitempty"`
	// 更新时间
	UpdatedAt time.Time `json:"updatedAt,omitempty"`
	// 删除时间
	DeletedAt time.Time `json:"deletedAt,omitempty"`
	// 生产记录信息
	ProductRecordInfo *ProductRecordInfo `json:"productRecordInfo,omitempty"`
	// 扩展数据
	Ext *Ext `json:"ext,omitempty"`
}

type ProductRecordRepository interface {
	Save(productRecord *ProductRecord) (*ProductRecord, error)
	Remove(productRecord *ProductRecord) (*ProductRecord, error)
	FindOne(queryOptions map[string]interface{}) (*ProductRecord, error)
	Find(queryOptions map[string]interface{}) (int64, []*ProductRecord, error)
}

func (productRecord *ProductRecord) Identify() interface{} {
	if productRecord.ProductRecordId == 0 {
		return nil
	}
	return productRecord.ProductRecordId
}

func (productRecord *ProductRecord) Update(data map[string]interface{}) error {
	return nil
}