From a1db751382a1a5a3ee5c21ad7cd4931cf7d159cf Mon Sep 17 00:00:00 2001
From: ZengTao <2773468879@qq.com>
Date: 星期五, 02 八月 2024 14:03:15 +0800
Subject: [PATCH] 计算目标格子条件添加工程id,防止不同工程的版图混乱
---
hangzhoumesParent/common/servicebase/src/main/java/com/mes/temperingglass/service/impl/TemperingGlassInfoServiceImpl.java | 56 +++++++++++++++++++++++++++++++++++++++++++-------------
1 files changed, 43 insertions(+), 13 deletions(-)
diff --git a/hangzhoumesParent/common/servicebase/src/main/java/com/mes/temperingglass/service/impl/TemperingGlassInfoServiceImpl.java b/hangzhoumesParent/common/servicebase/src/main/java/com/mes/temperingglass/service/impl/TemperingGlassInfoServiceImpl.java
index 806ee21..9944d58 100644
--- a/hangzhoumesParent/common/servicebase/src/main/java/com/mes/temperingglass/service/impl/TemperingGlassInfoServiceImpl.java
+++ b/hangzhoumesParent/common/servicebase/src/main/java/com/mes/temperingglass/service/impl/TemperingGlassInfoServiceImpl.java
@@ -2,6 +2,7 @@
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.mes.temperingglass.entity.TemperingGlassInfo;
import com.mes.temperingglass.mapper.TemperingGlassInfoMapper;
import com.mes.temperingglass.service.TemperingGlassInfoService;
@@ -29,17 +30,24 @@
public List<TemperingGlassInfo> selectWaitingGlass() {
//鑾峰彇绛夊緟杩涚倝涓殑鐜荤拑淇℃伅
QueryWrapper<TemperingGlassInfo> wrapper = new QueryWrapper<>();
- //wrapper.eq("state",1);
- wrapper.in("state",1,0);
- return temperingMapper.selectList(wrapper);
+ wrapper.select("Top 1 *").in("state",1,0);
+ TemperingGlassInfo glass=temperingMapper.selectOne(wrapper);
+ if(glass!=null) {
+ QueryWrapper<TemperingGlassInfo> glassinfo = new QueryWrapper<>();
+ glassinfo.eq("engineer_id", glass.getEngineerId())
+ .eq("tempering_layout_id", glass.getTemperingLayoutId());
+ return temperingMapper.selectList(glassinfo);
+ }else {
+ return null;
+ }
}
@Override
- public List<TemperingGlassInfo> selectIntoGlass(int layoutId) {
+ public List<TemperingGlassInfo> selectIntoGlass(TemperingGlassInfo temperingGlassInfo) {
//鑾峰彇杩涚倝涓殑鐜荤拑淇℃伅
QueryWrapper<TemperingGlassInfo> wrapper = new QueryWrapper<>();
- wrapper.eq("state",2)
- .eq("tempering_layout_id", layoutId)
+ wrapper.eq("tempering_layout_id", temperingGlassInfo.getTemperingLayoutId())
+ .eq("engineer_id", temperingGlassInfo.getEngineerId())
.orderByAsc("tempering_layout_id","tempering_feed_sequence");
return temperingMapper.selectList(wrapper);
}
@@ -47,10 +55,18 @@
@Override
public List<TemperingGlassInfo> selectOutGlass() {
//鑾峰彇鍑虹倝涓殑鐜荤拑淇℃伅
- QueryWrapper<TemperingGlassInfo> wapper = new QueryWrapper<>();
- wapper.eq("state", 3)
- .orderByAsc("tempering_layout_id","tempering_feed_sequence");
- return temperingMapper.selectList(wapper);
+ QueryWrapper<TemperingGlassInfo> wrap = new QueryWrapper<>();
+ wrap.select("Top 1 *").eq("state",3);
+ TemperingGlassInfo glass=temperingMapper.selectOne(wrap);
+ //鏍规嵁宸ョ▼鍙峰拰鐗堝浘鑾峰彇鏁版嵁
+ if(glass != null) {
+ QueryWrapper<TemperingGlassInfo> wapper = new QueryWrapper<>();
+ wapper.eq("engineer_id", glass.getEngineerId())
+ .eq("tempering_layout_id", glass.getTemperingLayoutId())
+ .orderByAsc("tempering_layout_id", "tempering_feed_sequence");
+ return temperingMapper.selectList(wapper);
+ }
+ return null;
}
@Override
@@ -58,14 +74,15 @@
//鑾峰彇杩囨棆杞彴鏈�澶х殑閽㈠寲鐗堝浘id
QueryWrapper<TemperingGlassInfo> wapper = new QueryWrapper<>();
wapper.select("Top 1 *").eq("state", 4)
- .orderByDesc("tempering_layout_id");
+ .orderByDesc("tempering_layout_id,engineer_id");
//鏍规嵁鏈�澶х殑鐗堝浘id鏄剧ず閽㈠寲鍚庣殑鐗堝浘淇℃伅
TemperingGlassInfo glassinfo= temperingMapper.selectOne(wapper);
if (glassinfo == null) {
return null; // 鐩存帴杩斿洖null锛岃〃绀烘病鏈夋壘鍒扮鍚堟潯浠剁殑璁板綍
}
QueryWrapper<TemperingGlassInfo> wrapper = new QueryWrapper<>();
- wrapper.eq("tempering_layout_id",glassinfo.getTemperingLayoutId());
+ wrapper.eq("tempering_layout_id",glassinfo.getTemperingLayoutId())
+ .eq("engineer_id",glassinfo.getEngineerId());
return temperingMapper.selectList(wrapper);
}
@@ -73,7 +90,7 @@
@Override
public List<TemperingGlassInfo> selectLayoutId() {
QueryWrapper<TemperingGlassInfo> wrapper = new QueryWrapper<>();
- wrapper.select("distinct tempering_layout_id")
+ wrapper.select("distinct tempering_layout_id,engineer_id")
.eq("state",2)
.orderByAsc("tempering_layout_id");
return temperingMapper.selectList(wrapper);
@@ -86,4 +103,17 @@
.groupBy("state");
return temperingMapper.selectList(wrapper);
}
+
+ @Override
+ public Integer updateTemperingState(TemperingGlassInfo temperingGlassInfo) {
+ UpdateWrapper<TemperingGlassInfo> wrapper = new UpdateWrapper<>();
+ wrapper.eq("glass_id",temperingGlassInfo.getGlassId())
+ .lt("state",5)
+ .set("state", temperingGlassInfo.getState());;
+ if (temperingMapper.update(null,wrapper) > 0) {
+ return 200;
+ }else {
+ return 100;
+ }
+ }
}
--
Gitblit v1.8.0