Browse Source

返修打印

pull/102/head
娄文智 3 years ago
parent
commit
1e8bd97b43
1 changed files with 22 additions and 24 deletions
  1. +22
    -24
      services/qm/implments/ReclinerReclst.service.impl.go

+ 22
- 24
services/qm/implments/ReclinerReclst.service.impl.go View File

@ -4,9 +4,9 @@ package implments
import (
baseDal "LAPP_ACURA_MOM_BACKEND/dao/base"
meDal "LAPP_ACURA_MOM_BACKEND/dao/me"
omDal "LAPP_ACURA_MOM_BACKEND/dao/om"
dal "LAPP_ACURA_MOM_BACKEND/dao/qm"
meDal "LAPP_ACURA_MOM_BACKEND/dao/me"
"LAPP_ACURA_MOM_BACKEND/db"
"LAPP_ACURA_MOM_BACKEND/global"
"LAPP_ACURA_MOM_BACKEND/grmi"
@ -16,8 +16,6 @@ import (
model "LAPP_ACURA_MOM_BACKEND/models/qm"
"LAPP_ACURA_MOM_BACKEND/utils"
"time"
"strings"
)
/******************************************************************************
@ -113,32 +111,32 @@ func (impl *ReclinerReclstServiceImplement) InsertOne(user *global.User, entity
if record != nil {
return grmi.NewBusinessError("已经存在相同主键的记录!")
}
bDao := baseDal.NewLabelParserHeadDAO(session, user.PlantNr, user.UserId)
result, err := bDao.SelectOne("Barcode")
seriDao := omDal.NewSerialOrderDAO(session, user.PlantNr, user.UserId)
seriInfo, err := seriDao.SelectBySerialOrder(entity.SerialOrderId)
if err != nil {
return err
}
if seriInfo == nil {
return grmi.NewBusinessError("不存在指定记录!")
}
//查询物料主数据表
artDao := baseDal.NewArticleDAO(session, user.PlantNr, user.UserId)
artInfo, err := artDao.SelectOne(seriInfo.ArtId)
if err != nil {
return err
}
if artInfo == nil {
return grmi.NewBusinessError("客户订单号没有维护!")
}
orderId := entity.SerialOrderId
var artId string
if utils.ValueIsEmpty(result.Split) {
lstdao := baseDal.NewLabelParserDetailLstDAO(session, user.PlantNr, user.UserId)
list, err := lstdao.Select([]grmi.Predicate{
bmeta.LabelParserDetailLst_ParserId.NewPredicate(grmi.Equal, "Barcode"),
}, nil)
if err != nil {
return err
}
result.Valst = list
if len(orderId) < result.Length {
return grmi.NewBusinessError("序列订单错误!")
}
codeInfos := bmodel.ParseBarcode(orderId, result.Valst)
artId = codeInfos["artId"]
} else {
artIds := strings.Split(orderId, result.Split)
artId = artIds[0]
entity.ArtId = seriInfo.ArtId
entity.RecType = model.QM_REC_TYPE
entity.Status = "N"
if len(orderId) < 27 {
return grmi.NewBusinessError("序列订单长度错误!")
}
entity.ArtId = artId
entity.ReclinerNr = orderId[0:19] + "R" + orderId[20:27]
err = dao.InsertOne(entity)
if err != nil {
return err


Loading…
Cancel
Save