From e7bc8bbe2fd47b348090552665233731d98fbaec Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期四, 04 七月 2024 23:08:39 +0800
Subject: [PATCH] fix
---
controllers/report_forms_controller.go | 2 +-
task/warehouse_month_stats.go | 2 +-
service/warehouse_month_forms.go | 6 +++++-
3 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/controllers/report_forms_controller.go b/controllers/report_forms_controller.go
index ed57a90..c14fd94 100644
--- a/controllers/report_forms_controller.go
+++ b/controllers/report_forms_controller.go
@@ -481,7 +481,7 @@
for _, item := range result {
productIds = append(productIds, item.ProductId)
}
- statsRecords, err := service.GetCurrentWarehouseStats(params.Date, params.WarehouseID, productIds)
+ statsRecords, err := service.GetCurrentWarehouseStats(params.Date, params.WarehouseID, productIds, true)
if err != nil {
util.ResponseFormat(c, code.InternalError, "鍐呴儴閿欒")
return
diff --git a/service/warehouse_month_forms.go b/service/warehouse_month_forms.go
index 19402ca..9af8677 100644
--- a/service/warehouse_month_forms.go
+++ b/service/warehouse_month_forms.go
@@ -162,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))
@@ -178,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
diff --git a/task/warehouse_month_stats.go b/task/warehouse_month_stats.go
index 34dfedf..9f4ad7d 100644
--- a/task/warehouse_month_stats.go
+++ b/task/warehouse_month_stats.go
@@ -51,7 +51,7 @@
oldRecordsMap := models.WarehouseMonthStatsMap(oldRecords)
//鏈湀鏈熷垵鏁伴噺/涓婃湀缁撲綑鏁伴噺
- statsRecords, err := service.GetCurrentWarehouseStats(date, warehouseId, nil)
+ statsRecords, err := service.GetCurrentWarehouseStats(date, warehouseId, nil, false)
if err != nil {
continue
}
--
Gitblit v1.8.0