From f3172c8ef7dbe306e85efb40044633c612bc55b7 Mon Sep 17 00:00:00 2001 From: louwenzhi Date: Fri, 31 Dec 2021 17:27:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9D=A1=E7=A0=81=E6=89=93=E5=8D=B0=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E5=8F=8A=E5=85=B6=E5=8C=85=E8=A3=85=E5=8D=95=E6=95=B0?= =?UTF-8?q?=E9=87=8F=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../log/implments/PackOrder.service.impl.go | 24 ++-- .../implments/ReclinerReclst.service.impl.go | 119 ++++++------------ 2 files changed, 53 insertions(+), 90 deletions(-) diff --git a/services/log/implments/PackOrder.service.impl.go b/services/log/implments/PackOrder.service.impl.go index ba65563..15b436a 100644 --- a/services/log/implments/PackOrder.service.impl.go +++ b/services/log/implments/PackOrder.service.impl.go @@ -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() diff --git a/services/qm/implments/ReclinerReclst.service.impl.go b/services/qm/implments/ReclinerReclst.service.impl.go index 3c70be8..78940af 100644 --- a/services/qm/implments/ReclinerReclst.service.impl.go +++ b/services/qm/implments/ReclinerReclst.service.impl.go @@ -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 -} \ No newline at end of file +}