From 50435a81915932eda06b7f1afd48f9ff1ae84f19 Mon Sep 17 00:00:00 2001
From: zhangc <zc@123>
Date: 星期四, 10 四月 2025 17:50:28 +0800
Subject: [PATCH] 1
---
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/MotionServiceImpl.java | 43 ++++++++++++++++++++++++++++++++++++-------
1 files changed, 36 insertions(+), 7 deletions(-)
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/MotionServiceImpl.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/MotionServiceImpl.java
index efef568..60ce3cf 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/MotionServiceImpl.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/MotionServiceImpl.java
@@ -5,12 +5,12 @@
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;
import com.zy.asrs.wcs.core.mapper.MotionMapper;
import com.zy.asrs.wcs.core.entity.Motion;
import com.zy.asrs.wcs.core.service.MotionService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zy.asrs.wcs.core.service.MotionStsService;
+import com.zy.asrs.wcs.rcs.service.DeviceTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -21,7 +21,7 @@
public class MotionServiceImpl extends ServiceImpl<MotionMapper, Motion> implements MotionService {
@Autowired
- private DeviceCtgService deviceCtgService;
+ private DeviceTypeService deviceTypeService;
@Autowired
private MotionStsService motionStsService;
@@ -29,7 +29,7 @@
public List<Motion> selectUnCompleteByUuidAndDeviceCtg(String uuid, DeviceCtgType deviceCtgType) {
return this.list(new LambdaQueryWrapper<Motion>()
.eq(Motion::getUuid, uuid)
- .eq(Motion::getDeviceCtg, deviceCtgService.selectByFlag(deviceCtgType.toString()).getId())
+ .eq(Motion::getDeviceCtg, deviceTypeService.selectByFlag(deviceCtgType.toString()).getId())
.lt(Motion::getMotionSts, motionStsService.selectByFlag(MotionStsType.COMPLETE.toString()).getId())
.orderByDesc(Motion::getPriority)
);
@@ -42,8 +42,29 @@
@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);
+ Motion executeMotion = this.selectOfTop1(uuid, MotionStsType.EXECUTING.val(), hostId);
+ Motion errorMotion = this.selectOfTop1(uuid, MotionStsType.ERROR.val(), hostId);
+ if(errorMotion != null) {
+ return true;
+ }
+
+ if(executeMotion != null) {
+ if (executeMotion.getSync() == 0) {
+ //妫�娴嬫槸鍚︽湁鍚屾鍔ㄤ綔
+ List<Motion> syncMotion = this.list(new LambdaQueryWrapper<Motion>()
+ .eq(Motion::getUuid, uuid)
+ .eq(Motion::getMotionSts, MotionStsType.EXECUTING.val())
+ .eq(Motion::getHostId, hostId)
+ .eq(Motion::getSync, 1));
+ if (!syncMotion.isEmpty()) {
+ return true;//瀛樺湪鍚屾鍔ㄤ綔
+ }
+ return false;//褰撳墠鍔ㄤ綔涓哄紓姝ユ搷浣�
+ }
+ return true;
+ }
+
+ return false;
}
@Override
@@ -77,12 +98,15 @@
}
@Override
- public int batchInsert(List<Motion> motionList, String uuid, Integer taskNo) {
+ public int batchInsert(List<Motion> motionList, String uuid, Integer taskNo, Long hostId) {
int i = motionList.size();
for (Motion motion : motionList) {
motion.setPriority(i);
- motion.setWrkNo(taskNo);
+ motion.setTaskNo(taskNo);
motion.setUuid(uuid);
+ if (hostId != null) {
+ motion.setHostId(hostId);
+ }
if (!this.save(motion)) {
throw new CoolException(JSON.toJSONString(motion) + "鍔ㄤ綔淇濆瓨澶辫触");
}
@@ -90,4 +114,9 @@
}
return motionList.size();
}
+
+ @Override
+ public int batchInsert(List<Motion> motionList, String uuid, Integer taskNo) {
+ return batchInsert(motionList, uuid, taskNo, null);
+ }
}
--
Gitblit v1.9.1