From 56a14dcaa7162f93c20dc9e15e4aab4bcdc719c5 Mon Sep 17 00:00:00 2001 From: louwenzhi Date: Tue, 25 May 2021 10:45:17 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BC=BA=E9=99=B7=E9=87=87=E9=9B=86=E4=BF=9D?= =?UTF-8?q?=E5=AD=98=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- models/qm/DefectRecord.model.go | 2 +- services/qm/implments/DefectRecord.service.impl.go | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/models/qm/DefectRecord.model.go b/models/qm/DefectRecord.model.go index 687de61..1207886 100644 --- a/models/qm/DefectRecord.model.go +++ b/models/qm/DefectRecord.model.go @@ -66,7 +66,7 @@ type DefectRecord struct { LastModify grmi.DateTime `xorm:"datetime 'LastModify' not null updated" json:"QM_DefectRecord-LastModify"` LastUser string `xorm:"nvarchar(20) 'LastUser' not null" json:"QM_DefectRecord-LastUser"` CreateTime grmi.DateTime `xorm:"datetime 'CreateTime' not null created" json:"QM_DefectRecord-CreateTime"` - ArtId string `xorm:"-" json:"QM_DefectRecord-ArtId"` + OrderId string `xorm:"-" json:"QM_DefectRecord-OrderId"` } /****************************************************************************** diff --git a/services/qm/implments/DefectRecord.service.impl.go b/services/qm/implments/DefectRecord.service.impl.go index 18c9738..88148b2 100644 --- a/services/qm/implments/DefectRecord.service.impl.go +++ b/services/qm/implments/DefectRecord.service.impl.go @@ -12,6 +12,7 @@ import ( "LAPP_GAAS_GFrame_BACKEND/web/models" "fmt" "strconv" + "strings" "time" ) @@ -248,8 +249,12 @@ func (impl *DefectRecordServiceImplement) Insert(user *models.Usertab, entities defer session.Close() dao := dal.NewDefectRecordDAO(session, user.Pid, user.Userid) - artID := (*entities)[0].ArtId - + orderId := (*entities)[0].OrderId + orderIds := strings.Split(orderId,"GAAS") + if len(orderIds) < 2{ + return grmi.NewBusinessError("序列订单错误!") + } + artID := orderIds[0] records, err := dao.Select([]grmi.Predicate{meta.DefectRecord_SerialOrderId.NewPredicate(grmi.Equal, artID)}, nil) if err != nil { return err @@ -301,12 +306,12 @@ func (impl *DefectRecordServiceImplement) Insert(user *models.Usertab, entities if area == nil { return grmi.NewBusinessError(fmt.Sprintf("没有找到缺陷原因:%s#%d!", entity.ViewId, entity.AreaId)) } - artView, err := articleViewDAO.SelectOne(entity.ArtId, entity.ViewId) + artView, err := articleViewDAO.SelectOne(artID, entity.ViewId) if err != nil { return err } if artView == nil { - return grmi.NewBusinessError(fmt.Sprintf("没有找到Article(%s)和视图(%s)的关联!", entity.ArtId, entity.ViewId)) + return grmi.NewBusinessError(fmt.Sprintf("没有找到Article(%s)和视图(%s)的关联!", artID, entity.ViewId)) } viewGroup, err := viewGroupDAO.SelectOne(entity.ViewId, entity.DefectGrpId) if err != nil {