From a8c1dd008f9a096cb01774f17a8bceda5aafed88 Mon Sep 17 00:00:00 2001
From: zhoushihao <zsh19950802@163.com>
Date: 星期三, 26 二月 2025 15:04:49 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
hangzhoumesParent/common/servicebase/src/main/java/com/mes/temperingglass/service/impl/TemperingGlassInfoServiceImpl.java | 129 ++++++++++++++++++++++++++++++++++--------
1 files changed, 104 insertions(+), 25 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..4ead605 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,13 +2,18 @@
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.github.yulichang.base.MPJBaseServiceImpl;
+import com.github.yulichang.query.MPJQueryWrapper;
+import com.mes.glassinfo.entity.GlassInfo;
+import com.mes.glassinfo.mapper.GlassInfoMapper;
import com.mes.temperingglass.entity.TemperingGlassInfo;
import com.mes.temperingglass.mapper.TemperingGlassInfoMapper;
import com.mes.temperingglass.service.TemperingGlassInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
-import com.github.yulichang.base.MPJBaseServiceImpl;
+import javax.annotation.Resource;
import java.util.List;
/**
@@ -20,37 +25,58 @@
* @since 2024-04-07
*/
@Service
-@DS("salve_hangzhoumes")
+@DS("salve_northGlassMes")
public class TemperingGlassInfoServiceImpl extends MPJBaseServiceImpl<TemperingGlassInfoMapper, TemperingGlassInfo> implements TemperingGlassInfoService {
- @Autowired
+ @Resource
TemperingGlassInfoMapper temperingMapper;
+ @Autowired
+ private GlassInfoMapper glassInfoMapper;
@Override
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).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 +84,85 @@
//鑾峰彇杩囨棆杞彴鏈�澶х殑閽㈠寲鐗堝浘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;
+ }
+
+ @Override
+ public GlassInfo selectTempering(GlassInfo glassInfo) {
+
+ QueryWrapper<GlassInfo> wrapper = new QueryWrapper<>();
+ wrapper.select("max(tempering_layout_id)as id")
+ .eq("engineer_id", glassInfo.getEngineerId());
+
+ return glassInfoMapper.selectOne(wrapper);
+ }
+
+ @Override
+ public List<GlassInfo> selectTemperingGlass(GlassInfo glassInfo) {
+ List<GlassInfo> glassInfos = null;
+ glassInfos = glassInfoMapper.selectJoinList(GlassInfo.class, new MPJQueryWrapper<GlassInfo>()
+ .select("IFNULL(b.status, 0) AS status,engineer_id,tempering_layout_id,width,height,tempering_feed_sequence,x_coordinate,y_coordinate,angle,t.glass_id,t.flow_card_id")
+ .leftJoin("(SELECT glass_id, MAX(status) AS status FROM damage GROUP BY glass_id) b\n" +
+ "ON t.glass_id = b.glass_id")
+ .eq("engineer_id", glassInfo.getEngineerId())
+ .eq("tempering_layout_id", glassInfo.getTemperingLayoutId()));
+ return glassInfos;
+// QueryWrapper<GlassInfo> wrapper = new QueryWrapper<>();
+// wrapper.eq("engineer_id", glassInfo.getEngineerId())
+// .eq("tempering_layout_id", glassInfo.getTemperingLayoutId())
+// .select("engineer_id,tempering_layout_id,width,height,tempering_feed_sequence,x_coordinate,y_coordinate,angle,glass_id");
+// return glassInfoMapper.selectList(wrapper);
+ }
}
--
Gitblit v1.8.0