From fd35c0ee025e8f5471acd4075af33b9f59f4d817 Mon Sep 17 00:00:00 2001
From: wangfei <3597712270@qq.com>
Date: 星期四, 05 十二月 2024 13:39:11 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10105/r/YiWuProject

---
 hangzhoumesParent/common/servicebase/src/main/java/com/mes/temperingglass/service/impl/TemperingGlassInfoServiceImpl.java |   63 ++++++++++++++++++-------------
 1 files changed, 37 insertions(+), 26 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 d06778e..6be3bd5 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,7 +2,6 @@
 
 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;
@@ -30,13 +29,14 @@
     public List<TemperingGlassInfo> selectWaitingGlass() {
         //鑾峰彇绛夊緟杩涚倝涓殑鐜荤拑淇℃伅
         QueryWrapper<TemperingGlassInfo> wrapper = new QueryWrapper<>();
-        wrapper.select("Top 1 *").eq("state",1);
+        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);
+            //return temperingMapper.selectList(glassinfo);
+            return temperingMapper.selectByEngineerIdAndLayoutId(glass.getEngineerId(),glass.getTemperingLayoutId());
         }else {
             return null;
         }
@@ -45,11 +45,13 @@
     @Override
     public List<TemperingGlassInfo> selectIntoGlass(TemperingGlassInfo temperingGlassInfo) {
         //鑾峰彇杩涚倝涓殑鐜荤拑淇℃伅
-        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);
+//        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
@@ -60,13 +62,9 @@
         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 temperingMapper.selectByEngineerIdAndLayoutId(glass.getEngineerId(),glass.getTemperingLayoutId());
         }
-            return  null;
+        return  null;
     }
 
     @Override
@@ -80,24 +78,22 @@
         if (glassinfo == null) {
             return null;  // 鐩存帴杩斿洖null锛岃〃绀烘病鏈夋壘鍒扮鍚堟潯浠剁殑璁板綍
         }
-        QueryWrapper<TemperingGlassInfo> wrapper = new QueryWrapper<>();
-        wrapper.eq("tempering_layout_id",glassinfo.getTemperingLayoutId())
-                .eq("engineer_id",glassinfo.getEngineerId());
+        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,engineer_id")
+        wrapper.select("tempering_layout_id,engineer_id,max(id) as id")
                 .eq("state",2)
-                .orderByAsc("tempering_layout_id");
+                .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");
@@ -106,14 +102,29 @@
 
     @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) {
+        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