From 73b6baf6af3d88cdcb0e2df7932a9bd96b0b85c5 Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期一, 01 七月 2024 22:32:34 +0800
Subject: [PATCH] 月度统计出入库按类型汇总报表定时任务和手动跑任务接口
---
models/operation_type.go | 39 ++++++++++++++++++++++++++++++++-------
1 files changed, 32 insertions(+), 7 deletions(-)
diff --git a/models/operation_type.go b/models/operation_type.go
index 26842f7..25af9ff 100644
--- a/models/operation_type.go
+++ b/models/operation_type.go
@@ -36,16 +36,18 @@
ReturnOperationType string `json:"returnOperationType" gorm:"-"` //閫�璐х被鍨嬪悕绉�
ReadyCount int `json:"readyCount" gorm:"-"` //灏辩华鏁伴噺
FinishCount int `json:"finishCount" gorm:"-"` //瀹屾垚鏁伴噺
+ CancelCount int `json:"cancelCount" gorm:"-"` //鍙栨秷1鏁伴噺
}
OperationTypeSearch struct {
OperationType
- Order string
- PageNum int
- PageSize int
- Keyword string
- Orm *gorm.DB
- Preload bool
+ Order string
+ PageNum int
+ PageSize int
+ Keyword string
+ Orm *gorm.DB
+ Preload bool
+ WarehouseIds []int
}
OperationTypeByStatus struct {
@@ -103,6 +105,16 @@
return slf
}
+func (slf *OperationTypeSearch) SetWarehouseId(warehouseId int) *OperationTypeSearch {
+ slf.WarehouseId = warehouseId
+ return slf
+}
+
+func (slf *OperationTypeSearch) SetWarehouseIds(warehouseIds []int) *OperationTypeSearch {
+ slf.WarehouseIds = warehouseIds
+ return slf
+}
+
func (slf *OperationTypeSearch) build() *gorm.DB {
var db = slf.Orm.Model(&OperationType{})
@@ -124,6 +136,18 @@
if slf.Preload {
db = db.Preload("Company").Preload("Warehouse").Preload("DefaultLocationSrc").Preload("DefaultLocationDest")
+ }
+
+ if slf.WarehouseId > 0 {
+ db = db.Where("warehouse_id = ?", slf.WarehouseId)
+ }
+
+ if len(slf.WarehouseIds) > 0 {
+ db = db.Where("warehouse_id in ?", slf.WarehouseIds)
+ }
+
+ if int(slf.BaseOperationType) != 0 {
+ db = db.Where("base_operation_type = ?", slf.BaseOperationType)
}
return db
@@ -282,7 +306,8 @@
records = make([]*OperationTypeByStatus, 0)
db = slf.Orm
)
- db = db.Table("wms_job_type").Select("wms_job_type.id,wms_operation.status,count(wms_operation.id) as count").InnerJoins("inner join wms_operation on wms_operation.operation_type_id=wms_job_type.id").Group("wms_job_type.id,wms_operation.status")
+ db = db.Table("wms_job_type").Select("wms_job_type.id,wms_operation.status,count(wms_operation.id) as count").InnerJoins("inner join wms_operation on wms_operation.operation_type_id=wms_job_type.id").Where("wms_operation.deleted_at is null").
+ Group("wms_job_type.id,wms_operation.status")
if len(idList) > 0 {
db = db.Where("wms_job_type.id IN ?", idList)
}
--
Gitblit v1.8.0