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