jiangshuai
2023-10-19 c278d736f5f9c0ab4a64540aa1a6b89984b0cd2c
controllers/product_controller.go
@@ -403,11 +403,8 @@
   db := models.NewOperationSearch().Orm.Table("wms_operation").Select("wms_operation.id,wms_operation.number,wms_operation.source_number,wms_operation.status,wms_operation.from_location_id,wms_operation.to_location_id,wms_operation.operation_date,wms_operation.contacter_id,wms_operation.contacter_name,wms_operation.company_id,wms_operation.company_name,wms_operation.comment,wms_operation_details.product_id,material.name as product_name,material.unit,wms_operation_details.amount").InnerJoins("inner join wms_operation_details on wms_operation_details.operation_id=wms_operation.id").InnerJoins("inner join material on material.id=wms_operation_details.product_id")
   if params.SourceNumber != "" {
      db = db.Where("wms_operation.source_number like ?", fmt.Sprintf("%%%v%%", params.SourceNumber))
   }
   if params.Number != "" {
      db = db.Where("wms_operation.number like ?", fmt.Sprintf("%%%v%%", params.Number))
      db = db.Where("wms_operation.number like ? or wms_operation.source_number like ? or material.name like ?", fmt.Sprintf("%%%v%%", params.Number), fmt.Sprintf("%%%v%%", params.Number), fmt.Sprintf("%%%v%%", params.Number))
   }
   db = db.Where("wms_operation.operation_type_id=?", 0)
   var (
@@ -425,7 +422,7 @@
   if params.Page*params.PageSize > 0 {
      db = db.Offset((params.Page - 1) * params.PageSize).Limit(params.PageSize)
   }
   if err := db.Find(&records).Error; err != nil {
   if err := db.Order("wms_operation.created_at desc").Find(&records).Error; err != nil {
      util.ResponseFormat(c, code.RequestError, fmt.Errorf("find count err: %v", err))
      return
   }