zhangqian
2024-06-15 3bea96f2c557927065217c49f5f3ea50509c5924
controllers/location_product_amount.go
@@ -113,6 +113,32 @@
      }
      records[k].BaseOperationType = constvar.BaseOperationTypeAdjust
   }
   productIds = make([]string, 0)
   for _, record := range records {
      productIds = append(productIds, record.ProductId)
   }
   products, err := models.NewMaterialSearch().SetIDs(productIds).FindNotTotal()
   if err != nil {
      util.ResponseFormat(c, code.RequestError, "查询产品失败")
      return
   }
   productMap := models.MaterialMap(products)
   for k, v := range records {
      product := productMap[v.ProductId]
      if product == nil {
         continue
      }
      moreUnit := product.MoreUnit
      if moreUnit != nil && *moreUnit {
         records[k].AmountMoreUnits = service.CreateMoreUnit(v.Amount, product.MoreUnitList)
      }
   }
   util.ResponseFormatListWithPage(c, code.Success, records, int(total), params.Page, params.PageSize)
}