| | |
| | | CreateBackorder constvar.WhetherType `json:"createBackorder" gorm:"column:create_backorder"` //创建欠单 |
| | | ReturnOperationTypeID int `json:"returnOperationTypeID" gorm:"column:return_job_type_id"` //退货类型ID |
| | | ReturnOperationType string `json:"returnOperationType" gorm:"-"` //退货类型名称 |
| | | ReadyCount int `json:"readyCount" gorm:"-"` //就绪数量 |
| | | FinishCount int `json:"finishCount" gorm:"-"` //完成数量 |
| | | } |
| | | |
| | | OperationTypeSearch struct { |
| | |
| | | Keyword string |
| | | Orm *gorm.DB |
| | | Preload bool |
| | | } |
| | | |
| | | OperationTypeByStatus struct { |
| | | Id int `gorm:"column:id"` |
| | | Status constvar.OperationStatus `gorm:"column:status"` |
| | | Count int `gorm:"column:count"` |
| | | } |
| | | ) |
| | | |
| | |
| | | |
| | | return records, nil |
| | | } |
| | | |
| | | func (slf *OperationTypeSearch) ListByStatusAndCount(idList []int) ([]*OperationTypeByStatus, error) { |
| | | var ( |
| | | records = make([]*OperationTypeByStatus, 0) |
| | | db = slf.Orm |
| | | ) |
| | | db = db.Table("wms_job_type").Select("wms_job_type.id,wms_operation.status,count(wms_operation.id) as count").InnerJoins("inner join wms_operation on wms_operation.operation_type_id=wms_job_type.id").Group("wms_job_type.id,wms_operation.status") |
| | | if len(idList) > 0 { |
| | | db = db.Where("wms_job_type.id IN ?", idList) |
| | | } |
| | | |
| | | if err := db.Find(&records).Error; err != nil { |
| | | return records, fmt.Errorf("func ListByStatusAndCount err: %v, ", err) |
| | | } |
| | | |
| | | return records, nil |
| | | } |