diff --git a/services/qm/implments/DefectRecord.service.impl.go b/services/qm/implments/DefectRecord.service.impl.go index ebf7131..9844ba2 100644 --- a/services/qm/implments/DefectRecord.service.impl.go +++ b/services/qm/implments/DefectRecord.service.impl.go @@ -11,6 +11,7 @@ import ( "LAPP_ACURA_MOM_BACKEND/global" "LAPP_ACURA_MOM_BACKEND/grmi" baseMeta "LAPP_ACURA_MOM_BACKEND/meta/base" + omMeta "LAPP_ACURA_MOM_BACKEND/meta/om" meta "LAPP_ACURA_MOM_BACKEND/meta/qm" common "LAPP_ACURA_MOM_BACKEND/models/base" omModel "LAPP_ACURA_MOM_BACKEND/models/om" @@ -248,6 +249,7 @@ func (impl *DefectRecordServiceImplement) Insert(user *global.User, entities mod workLineDao := baseDal.NewWorkLineDAO(session, user.PlantNr, user.UserId) sdao := dal.NewSerialOrderRutingDAO(session, user.PlantNr, user.UserId) serialOrderPoDao := omdal.NewSerialOrderPOLstDAO(session, user.PlantNr, user.UserId) + inspectionItemDao := omdal.NewSerialOrderInspectionItemDAO(session, user.PlantNr, user.UserId) orderId := entities.SerialorderId //获取物料id @@ -308,6 +310,24 @@ func (impl *DefectRecordServiceImplement) Insert(user *global.User, entities mod break } } + inspectionItemLi, err := inspectionItemDao.Select([]grmi.Predicate{ + omMeta.SerialOrderInspectionItem_SerialOrderId.NewPredicate(grmi.Equal, orderId), + }, []grmi.Field{omMeta.SerialOrderInspectionItem_Pos}) + if err != nil { + return grmi.NewBusinessError("err:" + err.Error()) + } + inspectionMap := make(map[string]string) + for _, v := range inspectionItemLi { + key := v.InspectionItemId + val := v.InspectResult + inspectionMap[key] = val + } + for _, inspectResult := range inspectionMap { + if inspectResult != common.QualityCheck_STATUS_OK { + opResult = true + break + } + } if opResult && count <= 0 { return grmi.NewBusinessError("前序工序未完成!,请打点缺陷!") }