From 8ec62b6bd0b12c6812824fc766c7f1f33a1705b7 Mon Sep 17 00:00:00 2001 From: louwenzhi Date: Sun, 26 Dec 2021 13:43:47 +0800 Subject: [PATCH] =?UTF-8?q?BOM=20=E5=8E=BB=E6=8E=89IN=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dao/base/implments/Article.dao.impl.go | 2 +- dao/me/BomLst.dao.go | 2 +- dao/me/implments/BomLst.dao.impl.go | 15 ++++++++++++--- .../implments/CustDemandVerHead.service.impl.go | 8 ++------ 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/dao/base/implments/Article.dao.impl.go b/dao/base/implments/Article.dao.impl.go index 33993f5..9d7e666 100644 --- a/dao/base/implments/Article.dao.impl.go +++ b/dao/base/implments/Article.dao.impl.go @@ -359,7 +359,7 @@ func (impl *ArticleDAOImplement) SelectArtData(artId string, opotionId string) ( } if opotionId != "" { - session = session.And("ArtSpec1 = ?", opotionId) + session = session.And("ArtSpec4 = ?", opotionId) } data := make([]model.Article, 0, 10) diff --git a/dao/me/BomLst.dao.go b/dao/me/BomLst.dao.go index 08593e6..03892e9 100644 --- a/dao/me/BomLst.dao.go +++ b/dao/me/BomLst.dao.go @@ -239,7 +239,7 @@ type BomLstDAO interface { * @Date : 2021-08-09 14:13:50 * ******************************************************************************/ - SelectData(artIds []string) ([]model.BomLst, error) + SelectData(artId string, opotionId string) ([]model.BomLst, error) } /****************************************************************************** diff --git a/dao/me/implments/BomLst.dao.impl.go b/dao/me/implments/BomLst.dao.impl.go index 7a660a7..8cc4f9e 100644 --- a/dao/me/implments/BomLst.dao.impl.go +++ b/dao/me/implments/BomLst.dao.impl.go @@ -7,6 +7,7 @@ import ( "github.com/go-xorm/xorm" "leit.com/LAPP_CHEERSSON_BACKEND/grmi" meta "leit.com/LAPP_CHEERSSON_BACKEND/meta/me" + baseModel "leit.com/LAPP_CHEERSSON_BACKEND/models/base" model "leit.com/LAPP_CHEERSSON_BACKEND/models/me" "xorm.io/core" ) @@ -303,12 +304,20 @@ func (impl *BomLstDAOImplement) UpdateWhere(predicates []grmi.Predicate, entity /****************************************************************************** * - * @Reference LAPP_ACURA_MOM_BACKEND/dao/me/BomLstDAO.SelectData + * @Reference leit.com/LAPP_CHEERSSON_BACKEND/dao/base/ArticleDAO.SelectArtData * ******************************************************************************/ -func (impl *BomLstDAOImplement) SelectData(artIds []string) ([]model.BomLst, error) { +func (impl *BomLstDAOImplement) SelectData(artId string, opotionId string) ([]model.BomLst, error) { - session := impl.session.Table(impl.meta.TableName).Where("plantNr = ?",impl.plantNr).In("CmatNr",artIds) + session := impl.session.Table(impl.meta.TableName).Select("Me_BomLst.*").Join("INNER","Article","Article.PlantNr = Me_Bomlst.PlantNr and Article.ArtId = Me_Bomlst.CmatNr").Where("Me_Bomlst.PlantNr = ? AND Article.ArtTypeId = ?", impl.plantNr, baseModel.ART_TYPE_MATERIALS) + + if artId != "" { + session = session.And("Article.ArtId = ?", artId) + } + + if opotionId != "" { + session = session.And("Article.ArtSpec4 = ?", opotionId) + } data := make([]model.BomLst, 0, 10) err := session.Find(&data) diff --git a/services/ap/implments/CustDemandVerHead.service.impl.go b/services/ap/implments/CustDemandVerHead.service.impl.go index 261da09..62daba5 100644 --- a/services/ap/implments/CustDemandVerHead.service.impl.go +++ b/services/ap/implments/CustDemandVerHead.service.impl.go @@ -14,7 +14,6 @@ import ( "leit.com/LAPP_CHEERSSON_BACKEND/global" "leit.com/LAPP_CHEERSSON_BACKEND/grmi" meta "leit.com/LAPP_CHEERSSON_BACKEND/meta/ap" - meMeta "leit.com/LAPP_CHEERSSON_BACKEND/meta/me" model "leit.com/LAPP_CHEERSSON_BACKEND/models/ap" baseModel "leit.com/LAPP_CHEERSSON_BACKEND/models/base" commonModel "leit.com/LAPP_CHEERSSON_BACKEND/models/common" @@ -2069,6 +2068,7 @@ func (impl *CustDemandVerHeadServiceImplement) CompareVersionInfoByArtcle(user * engine := db.Eloquent.Master() session := engine.NewSession() defer session.Close() + engine.ShowSQL(true) detailDao := dal.NewCustDemandVerDetailDAO(session, user.PlantNr, user.UserId) dataInfo := new(commonModel.CustomerDeviationDetailItemBomLst) @@ -2083,11 +2083,7 @@ func (impl *CustDemandVerHeadServiceImplement) CompareVersionInfoByArtcle(user * if len(artInfo) == 0 { return nil, grmi.NewBusinessError("物料信息不存在!") } - var artData []interface{} - for _, v := range artInfo { - artData = append(artData, v.ArtId) - } - bomlst, err := meDao.Select([]grmi.Predicate{meMeta.BomLst_CmatNr.NewPredicate(grmi.Include, artData...)}, nil) + bomlst, err := meDao.SelectData(artcle, optionId) if len(bomlst) == 0 { return nil, grmi.NewBusinessError("原材料不存在!") }