From f72fb9ca31fbf27b4abbc0156e60ea162f58df81 Mon Sep 17 00:00:00 2001 From: dsmzx <dsmzx@123.com> Date: 星期四, 13 六月 2024 15:30:50 +0800 Subject: [PATCH] 出入库调拨产品明细增加备注字段(同步产品的备注字段) --- controllers/operation.go | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-) diff --git a/controllers/operation.go b/controllers/operation.go index 4a74aec..d519e04 100644 --- a/controllers/operation.go +++ b/controllers/operation.go @@ -92,6 +92,25 @@ return } + var productIds []string + for _, v := range params.Details { + productIds = append(productIds, v.ProductId) + } + products, err := models.NewMaterialSearch().SetIDs(productIds).FindNotTotal() + if err != nil { + logx.Errorf("MonthStats get products err:%v", err) + return + } + productMap := models.MaterialMap(products) + for key, value := range productMap { + for i := 0; i < len(params.Details); i++ { + if key == params.Details[i].ProductId { + params.Details[i].Note = value.Note + break + } + } + } + if err := models.NewOperationSearch().Create(¶ms); err != nil { logx.Errorf("Operation create err: %v", err) util.ResponseFormat(c, code.SaveFail, "娣诲姞澶辫触锛�"+err.Error()) -- Gitblit v1.8.0