From 628aa6a42e587e9f337e213f87f922fc2ab2af02 Mon Sep 17 00:00:00 2001
From: huang <1532065656@qq.com>
Date: 星期二, 02 十二月 2025 17:00:39 +0800
Subject: [PATCH] 修改卧转立扫码到卧转立任务流转,卧转立判断玻璃超时时间
---
mes-processes/mes-plcSend/src/main/java/com/mes/device/service/impl/GlassInfoServiceImpl.java | 50 +++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 49 insertions(+), 1 deletions(-)
diff --git a/mes-processes/mes-plcSend/src/main/java/com/mes/device/service/impl/GlassInfoServiceImpl.java b/mes-processes/mes-plcSend/src/main/java/com/mes/device/service/impl/GlassInfoServiceImpl.java
index 2e81b91..5546da4 100644
--- a/mes-processes/mes-plcSend/src/main/java/com/mes/device/service/impl/GlassInfoServiceImpl.java
+++ b/mes-processes/mes-plcSend/src/main/java/com/mes/device/service/impl/GlassInfoServiceImpl.java
@@ -1,12 +1,14 @@
package com.mes.device.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mes.device.entity.GlassInfo;
import com.mes.device.mapper.DeviceGlassInfoMapper;
import com.mes.device.service.GlassInfoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
import java.util.Collections;
import java.util.Date;
@@ -100,8 +102,35 @@
GlassInfo existing = baseMapper.selectByGlassId(glassInfo.getGlassId());
if (existing != null) {
glassInfo.setId(existing.getId());
+ // 淇濈暀鍘熷鍒涘缓淇℃伅
+ if (glassInfo.getCreatedTime() == null) {
+ glassInfo.setCreatedTime(existing.getCreatedTime());
+ }
+ if (glassInfo.getCreatedBy() == null) {
+ glassInfo.setCreatedBy(existing.getCreatedBy());
+ }
+ // 鏇存柊涓哄綋鍓嶆椂闂�
+ if (glassInfo.getUpdatedTime() == null) {
+ glassInfo.setUpdatedTime(new Date());
+ }
+ if (glassInfo.getUpdatedBy() == null) {
+ glassInfo.setUpdatedBy("system");
+ }
return updateById(glassInfo);
} else {
+ Date now = new Date();
+ if (glassInfo.getCreatedTime() == null) {
+ glassInfo.setCreatedTime(now);
+ }
+ if (glassInfo.getUpdatedTime() == null) {
+ glassInfo.setUpdatedTime(now);
+ }
+ if (glassInfo.getCreatedBy() == null) {
+ glassInfo.setCreatedBy("system");
+ }
+ if (glassInfo.getUpdatedBy() == null) {
+ glassInfo.setUpdatedBy("system");
+ }
return save(glassInfo);
}
} catch (Exception e) {
@@ -136,7 +165,7 @@
Date timeThreshold = new Date(System.currentTimeMillis() - minutes * 60 * 1000L);
LambdaQueryWrapper<GlassInfo> wrapper = new LambdaQueryWrapper<>();
- wrapper.eq(GlassInfo::getStatus, GlassInfo.Status.ACTIVE)
+ wrapper.eq(GlassInfo::getStatus, GlassInfo.Status.PENDING)
.ge(GlassInfo::getCreatedTime, timeThreshold)
.orderByDesc(GlassInfo::getCreatedTime)
.last("LIMIT " + limit);
@@ -160,5 +189,24 @@
return Collections.emptyList();
}
}
+
+ @Override
+ public boolean updateGlassStatus(List<String> glassIds, String status) {
+ if (CollectionUtils.isEmpty(glassIds) || status == null) {
+ return true;
+ }
+ try {
+ LambdaUpdateWrapper<GlassInfo> wrapper = new LambdaUpdateWrapper<>();
+ wrapper.in(GlassInfo::getGlassId, glassIds);
+ GlassInfo update = new GlassInfo();
+ update.setStatus(status);
+ update.setUpdatedTime(new Date());
+ update.setUpdatedBy("system");
+ return this.update(update, wrapper);
+ } catch (Exception e) {
+ log.error("鎵归噺鏇存柊鐜荤拑鐘舵�佸け璐�, glassIds={}, status={}", glassIds, status, e);
+ return false;
+ }
+ }
}
--
Gitblit v1.8.0