From b9b44b51b201e2f5a9a1f3665c7fb76b5690f9af Mon Sep 17 00:00:00 2001
From: wu <731351411@qq.com>
Date: 星期一, 23 十二月 2024 16:13:08 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
hangzhoumesParent/common/servicebase/src/main/java/com/mes/temperingglass/service/impl/TemperingGlassInfoServiceImpl.java | 93 +++++++++++++++++++++++++++++++++++-----------
1 files changed, 70 insertions(+), 23 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 f8bd3e4..06dc5bb 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.LambdaUpdateWrapper;
import com.mes.temperingglass.entity.TemperingGlassInfo;
import com.mes.temperingglass.mapper.TemperingGlassInfoMapper;
import com.mes.temperingglass.service.TemperingGlassInfoService;
@@ -9,6 +10,7 @@
import org.springframework.stereotype.Service;
import com.github.yulichang.base.MPJBaseServiceImpl;
+import javax.annotation.Resource;
import java.util.List;
/**
@@ -22,35 +24,54 @@
@Service
@DS("salve_hangzhoumes")
public class TemperingGlassInfoServiceImpl extends MPJBaseServiceImpl<TemperingGlassInfoMapper, TemperingGlassInfo> implements TemperingGlassInfoService {
- @Autowired
+ @Resource
TemperingGlassInfoMapper temperingMapper;
@Override
public List<TemperingGlassInfo> selectWaitingGlass() {
//鑾峰彇绛夊緟杩涚倝涓殑鐜荤拑淇℃伅
QueryWrapper<TemperingGlassInfo> wrapper = new QueryWrapper<>();
- //wrapper.eq("state",1);
- wrapper.in("state",1,0,-1);
- return temperingMapper.selectList(wrapper);
+ wrapper.select("Top 1 *").in("state", 1, 0).orderByDesc("id");
+
+ TemperingGlassInfo glass = temperingMapper.selectOne(wrapper);
+ if (glass != null) {
+ this.update(new LambdaUpdateWrapper<TemperingGlassInfo>().set(TemperingGlassInfo::getState, 2).in(TemperingGlassInfo::getState, 0, 1)
+ .and(e -> e.ne(TemperingGlassInfo::getEngineerId, glass.getEngineerId())
+ .or(e1 -> e1.eq(TemperingGlassInfo::getEngineerId, glass.getEngineerId())
+ .ne(TemperingGlassInfo::getTemperingLayoutId, glass.getTemperingLayoutId()))));
+ QueryWrapper<TemperingGlassInfo> glassinfo = new QueryWrapper<>();
+ glassinfo.eq("engineer_id", glass.getEngineerId())
+ .eq("tempering_layout_id", glass.getTemperingLayoutId());
+ //return temperingMapper.selectList(glassinfo);
+ return temperingMapper.selectByEngineerIdAndLayoutId(glass.getEngineerId(), glass.getTemperingLayoutId());
+ } 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)
- .orderByAsc("tempering_layout_id","tempering_feed_sequence");
- return temperingMapper.selectList(wrapper);
+// QueryWrapper<TemperingGlassInfo> wrapper = new QueryWrapper<>();
+// wrapper.eq("tempering_layout_id", temperingGlassInfo.getTemperingLayoutId())
+// .eq("engineer_id", temperingGlassInfo.getEngineerId())
+// .orderByAsc("tempering_layout_id","tempering_feed_sequence");
+// return temperingMapper.selectList(wrapper);
+ return temperingMapper.selectByEngineerIdAndLayoutId(temperingGlassInfo.getEngineerId(), temperingGlassInfo.getTemperingLayoutId());
+
}
@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) {
+ return temperingMapper.selectByEngineerIdAndLayoutId(glass.getEngineerId(), glass.getTemperingLayoutId());
+ }
+ return null;
}
@Override
@@ -58,32 +79,58 @@
//鑾峰彇杩囨棆杞彴鏈�澶х殑閽㈠寲鐗堝浘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);
+ TemperingGlassInfo glassinfo = temperingMapper.selectOne(wapper);
if (glassinfo == null) {
return null; // 鐩存帴杩斿洖null锛岃〃绀烘病鏈夋壘鍒扮鍚堟潯浠剁殑璁板綍
}
- QueryWrapper<TemperingGlassInfo> wrapper = new QueryWrapper<>();
- wrapper.eq("tempering_layout_id",glassinfo.getTemperingLayoutId());
+ return temperingMapper.selectByEngineerIdAndLayoutId(glassinfo.getEngineerId(), glassinfo.getTemperingLayoutId());
- return temperingMapper.selectList(wrapper);
}
@Override
public List<TemperingGlassInfo> selectLayoutId() {
QueryWrapper<TemperingGlassInfo> wrapper = new QueryWrapper<>();
- wrapper.select("distinct tempering_layout_id")
- .eq("state",2)
- .orderByAsc("tempering_layout_id");
+ wrapper.select("tempering_layout_id,engineer_id,max(id) as id")
+ .eq("state", 2)
+ .groupBy("tempering_layout_id,engineer_id")
+ .orderByAsc("id");
return temperingMapper.selectList(wrapper);
}
@Override
- public List<TemperingGlassInfo> selectTaskType() {
+ public List<TemperingGlassInfo> selectTaskType() {
QueryWrapper<TemperingGlassInfo> wrapper = new QueryWrapper<>();
wrapper.select("state")
.groupBy("state");
return temperingMapper.selectList(wrapper);
}
+
+ @Override
+ public Integer updateTemperingState(TemperingGlassInfo temperingGlassInfo) {
+ if (temperingMapper.updateTemperingGlassInfo(temperingGlassInfo) > 0) {
+ return 200;
+ } else {
+ return 100;
+ }
+ }
+
+ @Override
+ public List<TemperingGlassInfo> selectGlassInfoById(Integer id) {
+ List<TemperingGlassInfo> result = null;
+ QueryWrapper<TemperingGlassInfo> wrapper = new QueryWrapper<>();
+ wrapper.select("Top 1 *").in("state", 1, 0).eq("tempering_layout_id", id);
+ TemperingGlassInfo glass = temperingMapper.selectOne(wrapper);
+ if (glass != null) {
+ QueryWrapper<TemperingGlassInfo> glassinfo = new QueryWrapper<>();
+ glassinfo.eq("engineer_id", glass.getEngineerId())
+ .eq("tempering_layout_id", id)
+ .orderByDesc("tempering_layout_id")
+ .orderByAsc("tempering_feed_sequence");
+ return temperingMapper.selectList(glassinfo);
+// result= temperingMapper.selectByEngineerIdAndLayoutId(glass.getEngineerId(),glass.getTemperingLayoutId());
+ }
+ return result;
+ }
}
--
Gitblit v1.8.0