From 51b006cb8b5ad318e0386113ee4ff1cd8847c56c Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@163.com> Date: 星期三, 27 三月 2024 08:42:30 +0800 Subject: [PATCH] Merge branch 'Four-Way-Rack' of http://47.97.1.152:5880/r/zy-asrs-master into Four-Way-Rack --- zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/service/impl/MotionServiceImpl.java | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 43 insertions(+), 0 deletions(-) diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/service/impl/MotionServiceImpl.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/service/impl/MotionServiceImpl.java index 57df7a0..5a492a1 100644 --- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/service/impl/MotionServiceImpl.java +++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/service/impl/MotionServiceImpl.java @@ -1,6 +1,7 @@ package com.zy.asrs.wcs.rcs.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.zy.asrs.framework.exception.CoolException; import com.zy.asrs.wcs.core.model.enums.DeviceCtgType; import com.zy.asrs.wcs.core.model.enums.MotionStsType; import com.zy.asrs.wcs.core.service.DeviceCtgService; @@ -12,6 +13,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.Date; import java.util.List; @Service("motionService") @@ -31,4 +33,45 @@ .orderByDesc(Motion::getPriority) ); } + + @Override + public Motion selectOfTop1(String uuid, Long motionSts, Long hostId) { + return this.baseMapper.selectOfTop1(uuid, motionSts, hostId); + } + + @Override + public Boolean hasRunningMotion(String uuid, Long hostId) { + return null != this.selectOfTop1(uuid, MotionStsType.EXECUTING.val(), hostId) + || null != this.selectOfTop1(uuid, MotionStsType.ERROR.val(), hostId); + } + + @Override + public List<Motion> selectBySts(Long motionSts) { + return this.list(new LambdaQueryWrapper<Motion>() + .eq(Motion::getMotionSts, motionSts) + .orderByDesc(Motion::getPriority)); + } + + @Override + public Boolean theNextBeWaiting(String uuid, Motion motion) { + Motion next = null; + if (null == motion) { + next = this.baseMapper.selectOfTop1(uuid, MotionStsType.INIT.val(), motion.getHostId()); + } else { + next = this.selectOfNext(uuid, motion); + } + if (null != next) { + next.setMotionSts(MotionStsType.WAITING.val()); + next.setUpdateTime(new Date()); + if (!this.updateById(next)) { + throw new CoolException(uuid + " - [" + (motion == null ? 0 : (motion.getPriority() - 1)) + "] 鍔ㄤ綔鏇存柊鐘舵�佸け璐�"); + } + } + return Boolean.TRUE; + } + + @Override + public Motion selectOfNext(String uuid, Motion motion) { + return this.baseMapper.selectOfNext(uuid, motion.getPriority(), motion.getHostId()); + } } -- Gitblit v1.9.1