|
|
@ -3,19 +3,18 @@ |
|
|
|
package implments |
|
|
|
|
|
|
|
import ( |
|
|
|
dal "LAPP_GAAS_GFrame_BACKEND/dao/qm" |
|
|
|
baseDal "LAPP_GAAS_GFrame_BACKEND/dao/base" |
|
|
|
omDal "LAPP_GAAS_GFrame_BACKEND/dao/om" |
|
|
|
dal "LAPP_GAAS_GFrame_BACKEND/dao/qm" |
|
|
|
"LAPP_GAAS_GFrame_BACKEND/db" |
|
|
|
"LAPP_GAAS_GFrame_BACKEND/grmi" |
|
|
|
meta "LAPP_GAAS_GFrame_BACKEND/meta/qm" |
|
|
|
bmeta "LAPP_GAAS_GFrame_BACKEND/meta/base" |
|
|
|
model "LAPP_GAAS_GFrame_BACKEND/models/qm" |
|
|
|
meta "LAPP_GAAS_GFrame_BACKEND/meta/qm" |
|
|
|
bmodel "LAPP_GAAS_GFrame_BACKEND/models/base" |
|
|
|
model "LAPP_GAAS_GFrame_BACKEND/models/qm" |
|
|
|
"LAPP_GAAS_GFrame_BACKEND/utils" |
|
|
|
"LAPP_GAAS_GFrame_BACKEND/web/models" |
|
|
|
"fmt" |
|
|
|
"strings" |
|
|
|
) |
|
|
|
|
|
|
|
/****************************************************************************** |
|
|
@ -111,35 +110,29 @@ func (impl *ReclinerReclstServiceImplement) InsertOne(user *models.Usertab, enti |
|
|
|
if record != nil { |
|
|
|
return grmi.NewBusinessError("已经存在相同主键的记录!") |
|
|
|
} |
|
|
|
bDao := baseDal.NewLabelParserHeadDAO(session, user.Pid, user.Userid) |
|
|
|
result, err := bDao.SelectOne("Barcode") |
|
|
|
seriDao := omDal.NewSerialOrderDAO(session, user.Pid, user.Userid) |
|
|
|
seriInfo, err := seriDao.SelectBySerialOrder(entity.SerialOrderId) |
|
|
|
if err != nil { |
|
|
|
return err |
|
|
|
} |
|
|
|
orderId := entity.SerialOrderId |
|
|
|
var artId string |
|
|
|
if utils.ValueIsEmpty(result.Split) { |
|
|
|
lstdao := baseDal.NewLabelParserDetailLstDAO(session, user.Pid, 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] |
|
|
|
if seriInfo == nil { |
|
|
|
return grmi.NewBusinessError("不存在指定记录!") |
|
|
|
} |
|
|
|
//查询物料主数据表
|
|
|
|
artDao := baseDal.NewArticleDAO(session, user.Pid, user.Userid) |
|
|
|
artInfo, err := artDao.SelectOne(seriInfo.ArtId) |
|
|
|
if err != nil { |
|
|
|
return err |
|
|
|
} |
|
|
|
entity.ArtId = artId |
|
|
|
if artInfo == nil { |
|
|
|
return grmi.NewBusinessError("客户订单号没有维护!") |
|
|
|
} |
|
|
|
orderId := entity.SerialOrderId |
|
|
|
|
|
|
|
entity.ArtId = seriInfo.ArtId |
|
|
|
entity.RecType = model.QM_REC_TYPE |
|
|
|
entity.Status = "N" |
|
|
|
if len(orderId) < 27{ |
|
|
|
if len(orderId) < 27 { |
|
|
|
return grmi.NewBusinessError("序列订单长度错误!") |
|
|
|
} |
|
|
|
entity.ReclinerNr = orderId[0:19] + "R" + orderId[20:27] |
|
|
@ -174,36 +167,21 @@ func (impl *ReclinerReclstServiceImplement) InsertSeriOne(user *models.Usertab, |
|
|
|
if seriInfo.PlanResourceId != "G-Frame Assy" { |
|
|
|
return grmi.NewBusinessError("该产线不是装配线!") |
|
|
|
} |
|
|
|
bDao := baseDal.NewLabelParserHeadDAO(session, user.Pid, user.Userid) |
|
|
|
result, err := bDao.SelectOne("Barcode") |
|
|
|
//查询物料主数据表
|
|
|
|
artDao := baseDal.NewArticleDAO(session, user.Pid, user.Userid) |
|
|
|
artInfo, err := artDao.SelectOne(seriInfo.ArtId) |
|
|
|
if err != nil { |
|
|
|
return err |
|
|
|
} |
|
|
|
orderId := entity.SerialOrderId |
|
|
|
var artId string |
|
|
|
if utils.ValueIsEmpty(result.Split) { |
|
|
|
lstdao := baseDal.NewLabelParserDetailLstDAO(session, user.Pid, 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] |
|
|
|
if artInfo == nil { |
|
|
|
return grmi.NewBusinessError("客户订单号没有维护!") |
|
|
|
} |
|
|
|
entity.ArtId = artId |
|
|
|
entity.ArtId = seriInfo.ArtId |
|
|
|
entity.Line = seriInfo.PlanResourceId |
|
|
|
entity.RecType = model.QM_SERI_TYPE |
|
|
|
entity.Status = "N" |
|
|
|
if len(orderId) < 27{ |
|
|
|
orderId := entity.SerialOrderId |
|
|
|
if len(orderId) < 27 { |
|
|
|
return grmi.NewBusinessError("序列订单长度错误!") |
|
|
|
} |
|
|
|
entity.ReclinerNr = orderId[0:19] + "R" + orderId[20:27] |
|
|
@ -237,37 +215,23 @@ func (impl *ReclinerReclstServiceImplement) SelectSeriOne(user *models.Usertab, |
|
|
|
if seriInfo.PlanResourceId != "G-Frame Assy" { |
|
|
|
return nil, grmi.NewBusinessError("该产线不是装配线!") |
|
|
|
} |
|
|
|
bDao := baseDal.NewLabelParserHeadDAO(session, user.Pid, user.Userid) |
|
|
|
result, err := bDao.SelectOne("Barcode") |
|
|
|
//查询物料主数据表
|
|
|
|
artDao := baseDal.NewArticleDAO(session, user.Pid, user.Userid) |
|
|
|
artInfo, err := artDao.SelectOne(seriInfo.ArtId) |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
entity := new(model.ReclinerReclst) |
|
|
|
var artId string |
|
|
|
if utils.ValueIsEmpty(result.Split) { |
|
|
|
lstdao := baseDal.NewLabelParserDetailLstDAO(session, user.Pid, user.Userid) |
|
|
|
list, err := lstdao.Select([]grmi.Predicate{ |
|
|
|
bmeta.LabelParserDetailLst_ParserId.NewPredicate(grmi.Equal, "Barcode"), |
|
|
|
}, nil) |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
result.Valst = list |
|
|
|
if len(orderId) < result.Length { |
|
|
|
return nil, grmi.NewBusinessError("序列订单错误!") |
|
|
|
} |
|
|
|
codeInfos := bmodel.ParseBarcode(orderId, result.Valst) |
|
|
|
artId = codeInfos["artId"] |
|
|
|
} else { |
|
|
|
artIds := strings.Split(orderId, result.Split) |
|
|
|
artId = artIds[0] |
|
|
|
if artInfo == nil { |
|
|
|
return nil, grmi.NewBusinessError("客户订单号没有维护!") |
|
|
|
} |
|
|
|
entity := new(model.ReclinerReclst) |
|
|
|
|
|
|
|
entity.PlantNr = user.Pid |
|
|
|
entity.ArtId = artId |
|
|
|
entity.ArtId = seriInfo.ArtId |
|
|
|
entity.SerialOrderId = orderId |
|
|
|
entity.Line = seriInfo.PlanResourceId |
|
|
|
entity.RecType = model.QM_SERI_TYPE |
|
|
|
if len(orderId) < 27{ |
|
|
|
if len(orderId) < 27 { |
|
|
|
return nil, grmi.NewBusinessError("序列订单长度错误!") |
|
|
|
} |
|
|
|
entity.ReclinerNr = orderId[0:19] + "R" + orderId[20:27] |
|
|
@ -365,7 +329,7 @@ func (impl *ReclinerReclstServiceImplement) AddPrinterInfo(user *models.Usertab, |
|
|
|
} else if detail.VariableName == "$CUSTID$" { |
|
|
|
detail.VariableValue = artInfo.AlternativeArtId |
|
|
|
} else if detail.VariableName == "$ORDERID$" { |
|
|
|
detail.VariableValue = entity.SerialOrderId |
|
|
|
detail.VariableValue = entity.ReclinerNr |
|
|
|
} |
|
|
|
err = detailDao.InsertOne(detail) |
|
|
|
if err != nil { |
|
|
@ -377,7 +341,6 @@ func (impl *ReclinerReclstServiceImplement) AddPrinterInfo(user *models.Usertab, |
|
|
|
return nil |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/****************************************************************************** |
|
|
|
* |
|
|
|
* @Reference LAPP_GAAS_GFrame_BACKEND/services/qm/ReclinerReclstService.CreatePackOrderPrintInfo |
|
|
@ -467,7 +430,7 @@ func (impl *ReclinerReclstServiceImplement) CreateRecPrintInfo(entity model.Recl |
|
|
|
} else if detail.VariableName == "$CUSTID$" { |
|
|
|
detail.VariableValue = artInfo.AlternativeArtId |
|
|
|
} else if detail.VariableName == "$ORDERID$" { |
|
|
|
detail.VariableValue = entity.SerialOrderId |
|
|
|
detail.VariableValue = entity.ReclinerNr |
|
|
|
} |
|
|
|
err = detailDao.InsertOne(detail) |
|
|
|
if err != nil { |
|
|
@ -679,8 +642,6 @@ func (impl *ReclinerReclstServiceImplement) Update(user *models.Usertab, entitie |
|
|
|
return nil |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/****************************************************************************** |
|
|
|
* |
|
|
|
* @Reference LAPP_GAAS_GFrame_BACKEND/services/log/PackOrderService.SelectUnPrint |
|
|
@ -717,4 +678,4 @@ func (impl *ReclinerReclstServiceImplement) UpdateUnPrint(recIds []int) error { |
|
|
|
return err |
|
|
|
} |
|
|
|
return nil |
|
|
|
} |
|
|
|
} |