From 313617ceb05dd5194d2091c717a25cbf33ef39b9 Mon Sep 17 00:00:00 2001 From: zhangqian <zhangqian@123.com> Date: 星期五, 24 十一月 2023 14:39:25 +0800 Subject: [PATCH] 新增history加入索引 --- controllers/operation.go | 5 +++++ models/move_history.go | 2 +- controllers/report_forms_controller.go | 1 + 3 files changed, 7 insertions(+), 1 deletions(-) diff --git a/controllers/operation.go b/controllers/operation.go index 143c959..c0b34f4 100644 --- a/controllers/operation.go +++ b/controllers/operation.go @@ -29,6 +29,7 @@ "wms/proto/purchase_wms" "wms/proto/supplier" "wms/request" + "wms/service" "wms/utils/http" "wms/utils/upload" ) @@ -716,6 +717,7 @@ OperationTypeId: operation.OperationTypeId, OperationTypeName: operation.OperationTypeName, OperationId: operation.Id, + ProductId: v.ProductId, ProductName: v.Product.Name, Amount: v.Amount, Unit: v.Product.Unit, @@ -731,6 +733,9 @@ if err := db.Model(&models.MoveHistory{}).Create(&histories).Error; err != nil { return err } + for _, history := range histories { + service.AddNewHistoryReportRecord(history.Id) + } return nil } diff --git a/controllers/report_forms_controller.go b/controllers/report_forms_controller.go index 2489b45..7c57613 100644 --- a/controllers/report_forms_controller.go +++ b/controllers/report_forms_controller.go @@ -260,6 +260,7 @@ } if len(ids) == 0 { util.ResponseFormatList(c, code.Success, result, 0) + return } } diff --git a/models/move_history.go b/models/move_history.go index ffc1b61..ff02764 100644 --- a/models/move_history.go +++ b/models/move_history.go @@ -18,7 +18,7 @@ OperationTypeId int `json:"operationTypeId" gorm:"type:int;not null;comment:浣滀笟绫诲瀷id"` //浣滀笟绫诲瀷id OperationTypeName string `json:"operationTypeName" gorm:"type:varchar(127);not null;comment:浣滀笟绫诲瀷鍚嶇О"` //浣滀笟绫诲瀷鍚嶇О OperationId int `json:"operationRecordId" gorm:"type:int;not null;comment:鎿嶄綔id"` //鎿嶄綔id - ProductId int `json:"productId" gorm:"type:int;not null;comment:浜у搧id"` //浜у搧id + ProductId string `json:"productId" gorm:"type:varchar(255);not null;comment:浜у搧id"` //浜у搧id ProductName string `json:"productName" gorm:"type:varchar(255);not null;comment:浜у搧鍚嶇О"` //浜у搧鍚嶇О Amount decimal.Decimal `json:"amount" gorm:"type:decimal(20,2);not null;comment:鏁伴噺"` //鏁伴噺 Unit string `json:"unit" gorm:"type:char(10);not null;comment:鍗曚綅"` //鍗曚綅 -- Gitblit v1.8.0