From 1c8f39c41f903d3c07e8efc8dc49ef7014b45b8e Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期二, 02 七月 2024 18:27:01 +0800
Subject: [PATCH] 未选出入库类型的业务操作在仓库月度报表里归为其他

---
 service/input_history_search.go |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/service/input_history_search.go b/service/input_history_search.go
index e81a10d..c2d96bb 100644
--- a/service/input_history_search.go
+++ b/service/input_history_search.go
@@ -97,11 +97,16 @@
 func SearchHistoryReport(keyword string, operationType constvar.BaseOperationType, page, pageSize int) (recordIds []int, total uint64, err error) {
 	var ids []string
 	from := (page - 1) * pageSize
-	t, err := parseDateString(keyword)
-	if err != nil && t.IsZero() {
-		ids, total, err = blevex.ComplexSearch(HistoryReportIndexName, keyword, map[string]interface{}{"baseOperationType": operationType}, from, pageSize)
+	t, err := time.ParseInLocation("20060102", keyword, time.Local)
+	//t, err := parseDateString(keyword)
+	m := make(map[string]interface{})
+	if operationType > 0 {
+		m["baseOperationType"] = operationType
+	}
+	if err != nil || t.IsZero() {
+		ids, total, err = blevex.ComplexSearch(HistoryReportIndexName, keyword, m, from, pageSize)
 	} else {
-		ids, total, err = blevex.TimeSearch(HistoryReportIndexName, t, map[string]interface{}{"baseOperationType": operationType}, from, pageSize)
+		ids, total, err = blevex.TimeSearch(HistoryReportIndexName, t, m, from, pageSize)
 	}
 
 	if err != nil {

--
Gitblit v1.8.0