zhangqian
2023-10-09 81cda4f09d4c0fff6edd087d1c49d05cb6eaab38
model/production_progress.go
@@ -12,9 +12,10 @@
      ID               int    `gorm:"primarykey"`
      WorkOrderID      string `gorm:"index;type:varchar(191);not null;comment:工单ID" json:"workOrderID"`
      OrderID          string `gorm:"index;type:varchar(191);not null;comment:订单ID" json:"orderID"`
      ProcedureID      string `gorm:"uniqueIndex:idx_product_procedure;type:varchar(191);comment:工序ID" json:"procedureId"`
      ProcedureID      string `gorm:"type:varchar(191);comment:工序ID" json:"procedureId"`
      DeviceID         string `gorm:"type:varchar(191);not null;comment:设备ID" json:"deviceId"`
      FinishedQuantity int64  `gorm:"type:int;not null;comment:完成数量" json:"finishedQuantity"`
      Channel          int32  `gorm:"type:int;comment:工作通道" json:"channel"` //通道
      TotalQuantity    int64  `gorm:"type:int;not null;comment:总量" json:"totalQuantity"`
   }
@@ -73,6 +74,11 @@
   return slf
}
func (slf *ProductionProgressSearch) SetChannel(channel int32) *ProductionProgressSearch {
   slf.Channel = channel
   return slf
}
func (slf *ProductionProgressSearch) build() *gorm.DB {
   var db = slf.Orm.Model(&ProductionProgress{})
@@ -100,6 +106,10 @@
      db = db.Where("device_id = ?", slf.DeviceID)
   }
   if slf.Channel != 0 {
      db = db.Where("channel = ?", slf.Channel)
   }
   return db
}