From 4042c98459d2ca100c045f8524c5eeee66ab6653 Mon Sep 17 00:00:00 2001 From: louwenzhi Date: Fri, 9 Jul 2021 15:55:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dao/om/implments/WorkOrderStatus.dao.impl.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/dao/om/implments/WorkOrderStatus.dao.impl.go b/dao/om/implments/WorkOrderStatus.dao.impl.go index 9471cc0..880a823 100644 --- a/dao/om/implments/WorkOrderStatus.dao.impl.go +++ b/dao/om/implments/WorkOrderStatus.dao.impl.go @@ -5,7 +5,9 @@ package implments import ( "LAPP_GAAS_GFrame_BACKEND/grmi" meta "LAPP_GAAS_GFrame_BACKEND/meta/om" + bmodel "LAPP_GAAS_GFrame_BACKEND/models/base" model "LAPP_GAAS_GFrame_BACKEND/models/om" + "errors" "fmt" "github.com/go-xorm/xorm" "xorm.io/core" @@ -121,12 +123,16 @@ func (impl *WorkOrderStatusDAOImplement) UpdateOne(entity *model.WorkOrderStatus func (impl *WorkOrderStatusDAOImplement) UpdateStatusOne(entity *model.WorkOrderStatus) error { entity.PlantNr = impl.plantNr entity.LastUser = impl.userid - _, err := impl.session.Table(impl.meta.TableName).ID(entity.GetKey()).Update(entity) + result, err := impl.session.Table(impl.meta.TableName).Where("PlantNr = ? and  WorkOrderId =? and Status <= ?", impl.plantNr, entity.WorkOrderId, bmodel.WO_STATUS_PLANNED).Update(entity) if err != nil { return grmi.NewDataBaseError(err) } + if result == 0 { + return errors.New("订单状态大于20!") + } return nil } + /****************************************************************************** * * @Reference LAPP_GAAS_GFrame_BACKEND/dao/om/WorkOrderStatusDAO.Insert