From a0125ef3d6ce35be7b6dc4919c4192dba4a7329a Mon Sep 17 00:00:00 2001
From: jiangshuai <291802688@qq.com>
Date: 星期四, 16 十一月 2023 14:33:51 +0800
Subject: [PATCH] 报废数量bug

---
 models/operation_type.go |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/models/operation_type.go b/models/operation_type.go
index 4c5f86a..ed03f46 100644
--- a/models/operation_type.go
+++ b/models/operation_type.go
@@ -135,6 +135,10 @@
 		db = db.Where("warehouse_id = ?", slf.WarehouseId)
 	}
 
+	if int(slf.BaseOperationType) != 0 {
+		db = db.Where("base_operation_type = ?", slf.BaseOperationType)
+	}
+
 	return db
 }
 
@@ -291,7 +295,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