Browse Source

Merge pull request '条码打印更新及其包装单数量错误' (#448) from feature_barcode into develop

Reviewed-on: http://101.201.121.115:3000/leo/LAPP_GAAS_GFrame_BACKEND/pulls/448
Reviewed-by: zhangxin <xin.zhang@le-it.com.cn>
feature_barcode
zhangxin 3 years ago
parent
commit
b0435c66ff
2 changed files with 53 additions and 90 deletions
  1. +13
    -11
      services/log/implments/PackOrder.service.impl.go
  2. +40
    -79
      services/qm/implments/ReclinerReclst.service.impl.go

+ 13
- 11
services/log/implments/PackOrder.service.impl.go View File

@ -1306,16 +1306,7 @@ func (self *PackOrderServiceImplement) CheckPackOrderItem(user *models.Usertab,
packsession.Rollback()
return "", grmi.NewBusinessError("更新包装项失败!")
}
//2.判断是否满足关包
dataInfo, err := dao.Select([]grmi.Predicate{
meta.PackOrderItemlst_PlantNr.NewPredicate(grmi.Equal, user.Pid),
meta.PackOrderItemlst_PackOrderId.NewPredicate(grmi.Equal, packOrderId),
meta.PackOrderItemlst_Status.NewPredicate(grmi.LessThen, bmodel.PACK_STATUS_RUNNING),
}, nil)
if err != nil {
packsession.Rollback()
return "", grmi.NewBusinessError("更新包装项失败!")
}
pdao := dal.NewPackOrderDAO(packsession, user.Pid, user.Userid)
pack, err := pdao.SelectOne(packOrderId)
if err != nil {
@ -1328,12 +1319,22 @@ func (self *PackOrderServiceImplement) CheckPackOrderItem(user *models.Usertab,
}
pack.PlantNr = user.Pid
pack.PackOrderId = packOrderId
pack.ActQty = (pack.ActQty + 1)
pack.ActQty += 1
err = pdao.UpdateOne(pack)
if err != nil {
packsession.Rollback()
return "", grmi.NewBusinessError("更新包装单状态失败!")
}
//2.判断是否满足关包
dataInfo, err := dao.Select([]grmi.Predicate{
meta.PackOrderItemlst_PlantNr.NewPredicate(grmi.Equal, user.Pid),
meta.PackOrderItemlst_PackOrderId.NewPredicate(grmi.Equal, packOrderId),
meta.PackOrderItemlst_Status.NewPredicate(grmi.LessThen, bmodel.PACK_STATUS_RUNNING),
}, nil)
if err != nil {
packsession.Rollback()
return "", grmi.NewBusinessError("更新包装项失败!")
}
isClose := false
if len(dataInfo) == 0 {
isClose = true
@ -1342,6 +1343,7 @@ func (self *PackOrderServiceImplement) CheckPackOrderItem(user *models.Usertab,
pack.PackOrderId = packOrderId
pack.Status = bmodel.PACK_STATUS_CLOSED
pack.CloseTime = grmi.DateTime(time.Now())
pack.ActQty = pack.PlanQty
err = pdao.UpdateOne(pack)
if err != nil {
packsession.Rollback()


+ 40
- 79
services/qm/implments/ReclinerReclst.service.impl.go View File

@ -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
}
}

Loading…
Cancel
Save