zhangqian
2024-07-05 a9ad4cabc4d303532fbd743538f7480c0eef5a69
service/warehouse_month_forms.go
@@ -25,7 +25,8 @@
}
func (slf *WarehouseMonthFormsService) BuildSearch(params request.GetMonthStats) (search *models.WarehouseMonthStatsSearch) {
   search = models.NewWarehouseMonthStatsSearch().SetKeyword(params.Keyword).SetDate(params.Date)
   search = models.NewWarehouseMonthStatsSearch().
      SetKeyword(params.Keyword).SetDate(params.Date).SetWarehouseId(params.WarehouseID)
   if params.Preload {
      search = search.SetPreload(true)
   }
@@ -161,7 +162,7 @@
   return
}
func GetCurrentWarehouseStats(date string, warehouseId int, productIds []string) (statRecords []*models.WarehouseMonthStats, err error) {
func GetCurrentWarehouseStats(date string, warehouseId int, productIds []string, realTime bool) (statRecords []*models.WarehouseMonthStats, err error) {
   //本月期初数量/上月结余数量
   groupSumList, err := models.NewLocationProductAmountSearch().SetProductIds(productIds).GroupSum("product_id", "amount")
   productIds = make([]string, 0, len(groupSumList))
@@ -177,6 +178,10 @@
   //按配置取开始时间和结束时间
   beginTime, endTime, err := NewSystemConfigService().GetInventoryCutOffTime()
   if realTime {
      beginTime = endTime
      endTime = time.Now()
   }
   if err != nil {
      logx.Errorf("MonthStats GetCurrentStats get GetInventoryCutOffTime err:%v", err)
      return