zhangqian
2024-07-02 9d296a1c658c19c6faa51dfef31d025e59a480cb
models/operation_details.go
@@ -4,6 +4,7 @@
   "fmt"
   "github.com/shopspring/decimal"
   "gorm.io/gorm"
   "wms/constvar"
   "wms/pkg/mysqlx"
)
@@ -11,9 +12,10 @@
   // OperationDetails 操作明细表
   OperationDetails struct {
      WmsModel
      Id          int    `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"`
      OperationID int    `json:"operationId" gorm:"index;type:int;not null;comment:操作记录id"` //操作id
      ProductId   string `json:"productId" gorm:"type:varchar(191);not null;comment:产品id"`  //产品id
      Id                int                        `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"`
      OperationID       int                        `json:"operationId" gorm:"index;type:int;not null;comment:操作记录id"`     //操作id
      BaseOperationType constvar.BaseOperationType `json:"baseOperationType" gorm:"type:tinyint;not null;comment:基础作业类型"` //基础作业类型
      ProductId         string                     `json:"productId" gorm:"type:varchar(191);not null;comment:产品id"`      //产品id
      //ProductName string          `json:"productName" gorm:"type:varchar(255);not null;comment:产品名称"` //产品名称
      Amount decimal.Decimal `json:"amount" gorm:"type:decimal(20,2);not null;comment:数量"` //数量
      //Unit        string          `json:"unit" gorm:"type:varchar(31);comment:单位"`                    //单位
@@ -106,6 +108,11 @@
   return slf
}
func (slf *OperationDetailsSearch) SetBaseOperationType(baseOperationType constvar.BaseOperationType) *OperationDetailsSearch {
   slf.BaseOperationType = baseOperationType
   return slf
}
func (slf *OperationDetailsSearch) build() *gorm.DB {
   var db = slf.Orm.Model(&OperationDetails{})
@@ -139,6 +146,10 @@
      db = db.Select(slf.Fields)
   }
   if slf.BaseOperationType != 0 {
      db = db.Where("base_operation_type = ?", slf.BaseOperationType)
   }
   return db
}