|
|
@ -246,10 +246,9 @@ func (impl *DefectRecordServiceImplement) Insert(user *models.Usertab, entities |
|
|
|
if err != nil { |
|
|
|
return grmi.NewBusinessError("序列订单查询错误!") |
|
|
|
} |
|
|
|
if OrderInfo != nil { |
|
|
|
if OrderInfo != nil && OrderInfo.Status == common.CHECK_STATUS_CLOSED{ |
|
|
|
return grmi.NewBusinessError("该序列订单已经检测!") |
|
|
|
} |
|
|
|
|
|
|
|
orderId := entities.SerialorderId |
|
|
|
|
|
|
|
bdal := basedal.NewLabelParserHeadDAO(session, user.Pid, user.Userid) |
|
|
@ -273,15 +272,37 @@ func (impl *DefectRecordServiceImplement) Insert(user *models.Usertab, entities |
|
|
|
artID := codeInfos["artId"] |
|
|
|
|
|
|
|
if count <= 0 { |
|
|
|
/*******无提交记录,即为正常订单********/ |
|
|
|
entities.Status = common.CHECK_STATUS_CLOSED |
|
|
|
entities.IsPack = 0 |
|
|
|
entities.ArtId = artID |
|
|
|
err = sdao.InsertOne(&entities) |
|
|
|
if err != nil { |
|
|
|
return grmi.NewBusinessError("提交记录失败!") |
|
|
|
//判断是否是修复
|
|
|
|
if OrderInfo.Status == common.CHECK_STATUS_RUNNING{ |
|
|
|
//判断是否修复
|
|
|
|
recordDAO := dal.NewDefectRecordDAO(session, user.Pid, user.Userid) |
|
|
|
records, err := recordDAO.Select([]grmi.Predicate{meta.DefectRecord_SerialOrderId.NewPredicate(grmi.Equal, orderId),meta.DefectRecord_Status.NewPredicate(grmi.LessThen, common.ORDER_STATUS_CLOSED)}, nil) |
|
|
|
if err != nil { |
|
|
|
return err |
|
|
|
} |
|
|
|
if records != nil && len(records) > 0 { |
|
|
|
return grmi.NewBusinessError("该序列工单返工未完成!") |
|
|
|
} |
|
|
|
//更新状态
|
|
|
|
entities.Status = common.CHECK_STATUS_CLOSED |
|
|
|
entities.IsPack = 0 |
|
|
|
entities.ArtId = artID |
|
|
|
err = sdao.UpdateOne(&entities) |
|
|
|
if err != nil { |
|
|
|
return grmi.NewBusinessError("更新记录失败!") |
|
|
|
} |
|
|
|
return nil |
|
|
|
}else { |
|
|
|
/*******无提交记录,即为正常订单********/ |
|
|
|
entities.Status = common.CHECK_STATUS_CLOSED |
|
|
|
entities.IsPack = 0 |
|
|
|
entities.ArtId = artID |
|
|
|
err = sdao.InsertOne(&entities) |
|
|
|
if err != nil { |
|
|
|
return grmi.NewBusinessError("提交记录失败!") |
|
|
|
} |
|
|
|
return nil |
|
|
|
} |
|
|
|
return nil |
|
|
|
} |
|
|
|
|
|
|
|
dao := dal.NewDefectRecordDAO(session, user.Pid, user.Userid) |
|
|
@ -511,16 +532,16 @@ func (impl *DefectRecordServiceImplement) Rework(user *models.Usertab, recNr int |
|
|
|
return grmi.NewBusinessError("状态错误!") |
|
|
|
} |
|
|
|
|
|
|
|
sdao := dal.NewSerialOrderRutingDAO(session, user.Pid, user.Userid) |
|
|
|
OrderInfo, err := sdao.SelectOne(record.SerialOrderId) |
|
|
|
if err != nil { |
|
|
|
return grmi.NewBusinessError("序列订单查询错误!") |
|
|
|
} |
|
|
|
OrderInfo.Status = common.CHECK_STATUS_CLOSED |
|
|
|
err = sdao.UpdateOne(OrderInfo) |
|
|
|
if err != nil { |
|
|
|
return grmi.NewBusinessError("序列订单查询错误!") |
|
|
|
} |
|
|
|
//sdao := dal.NewSerialOrderRutingDAO(session, user.Pid, user.Userid)
|
|
|
|
//OrderInfo, err := sdao.SelectOne(record.SerialOrderId)
|
|
|
|
//if err != nil {
|
|
|
|
// return grmi.NewBusinessError("序列订单查询错误!")
|
|
|
|
//}
|
|
|
|
//OrderInfo.Status = common.CHECK_STATUS_CLOSED
|
|
|
|
//err = sdao.UpdateOne(OrderInfo)
|
|
|
|
//if err != nil {
|
|
|
|
// return grmi.NewBusinessError("序列订单查询错误!")
|
|
|
|
//}
|
|
|
|
record.Status = strconv.Itoa(common.ORDER_STATUS_CLOSED) |
|
|
|
record.InspectTime = grmi.DateTime(time.Now()) |
|
|
|
record.Inspector = user.Userid |
|
|
|