Browse Source

BOM

去掉IN方法
feature_INbOM
娄文智 3 years ago
parent
commit
8ec62b6bd0
4 changed files with 16 additions and 11 deletions
  1. +1
    -1
      dao/base/implments/Article.dao.impl.go
  2. +1
    -1
      dao/me/BomLst.dao.go
  3. +12
    -3
      dao/me/implments/BomLst.dao.impl.go
  4. +2
    -6
      services/ap/implments/CustDemandVerHead.service.impl.go

+ 1
- 1
dao/base/implments/Article.dao.impl.go View File

@ -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)


+ 1
- 1
dao/me/BomLst.dao.go View File

@ -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)
}
/******************************************************************************


+ 12
- 3
dao/me/implments/BomLst.dao.impl.go View File

@ -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)


+ 2
- 6
services/ap/implments/CustDemandVerHead.service.impl.go View File

@ -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("原材料不存在!")
}


Loading…
Cancel
Save