From 28ded8102d83cf74bc232d1cdfc89b7f22c41952 Mon Sep 17 00:00:00 2001
From: wu <731351411@qq.com>
Date: 星期二, 03 十二月 2024 09:09:31 +0800
Subject: [PATCH] 增加点击防抖事件 增加笼子使用详情的计算优化。 增加数据推送时的报错处理 测量台交互逻辑增加 参数界面增加翻转加减速度

---
 springboot-vue3/src/main/java/com/example/springboot/mapper/AlbaniaMapper.java |   86 +++++++++++++++++++++++++++++++++---------
 1 files changed, 67 insertions(+), 19 deletions(-)

diff --git a/springboot-vue3/src/main/java/com/example/springboot/mapper/AlbaniaMapper.java b/springboot-vue3/src/main/java/com/example/springboot/mapper/AlbaniaMapper.java
index 0a746cf..1d443c0 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/mapper/AlbaniaMapper.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/mapper/AlbaniaMapper.java
@@ -1,4 +1,6 @@
 package com.example.springboot.mapper;
+import java.util.List;
+
 import org.apache.ibatis.annotations.Delete;
 import org.apache.ibatis.annotations.Insert;
 import org.apache.ibatis.annotations.Mapper;
@@ -7,15 +9,16 @@
 import org.springframework.stereotype.Repository;
 import com.example.springboot.entity.GlassInfo;
 import com.example.springboot.entity.StorageCage;
+import com.example.springboot.entity.StorageTask;
 
 @Mapper
 @Repository
 public interface AlbaniaMapper  {
     //鍒ゆ柇绗煎唴鏄惁鏈夊悎閫傜殑绫诲瀷绌烘牸
-    @Select("select id from storage_cage where glasstype=#{glasstype} and width>=#{width}+#{widths} and state=0 and disabled=0 order by id limit 1")
+    @Select("select id from storage_cage where glasstype=#{glasstype} and width>=#{width}+#{widths}  and disabled=0 order by id limit 1")
     StorageCage SelectCage(int glasstype,Double width,int widths);
     //鍒ゆ柇绗煎唴娌℃湁鐜荤拑鐨勭┖鏍�
-    @Select("select id from storage_cage where number=0 and cage>#{cage} and cage<#{cage2} and disabled=0 order by id limit 1")
+    @Select("select id from storage_cage where (number is null) and cage>#{cage} and cage<#{cage2} and disabled=0 order by id limit 1")
     StorageCage SelectNewCell(int cage,int cage2);
     //澧炲姞鐜荤拑鏁�
     @Update("update storage_cage set number=number+1,width=width-glasswidth where id=#{id}")
@@ -26,40 +29,85 @@
     //澧炲姞浠诲姟璁板綍
     @Insert("INSERT INTO `albania`.`storage_task`(`task_type`, `task_state`, `shelf_rack`, `load_rack`,start_time,glass_id,glasstype,flowcard,mateid,tier) VALUES (#{tasktype},#{taskstate},#{shelfrack},#{loadrack},now(),#{glassid},#{glasstype},#{flowcard},#{mateid},#{tier});")
     void Inserttask(int tasktype, int taskstate, int shelfrack, int loadrack, String glassid, int glasstype,String flowcard,int mateid,int tier);
+    //澧炲姞浠e彂浠诲姟璁板綍
+    @Insert("INSERT INTO `albania`.`out_task`(`task_type`, `task_state`, `shelf_rack`, `load_rack`,start_time,glass_id,glasstype,flowcard,mateid,tier) VALUES (#{tasktype},#{taskstate},#{shelfrack},#{loadrack},now(),#{glassid},#{glasstype},#{flowcard},#{mateid},#{tier});")
+    void InsertOutTask(int tasktype, int taskstate, int shelfrack, int loadrack, String glassid, int glasstype,String flowcard,int mateid,int tier);
     //鏂板涓�鏉$瀛愭暟鎹�
-    @Update("UPDATE `albania`.`storage_cage` SET `glass_id` =#{glassid}, `width` =width-#{glasswidth}, `glasswidth` =#{glasswidth}, `glassheight` =#{glassheight}, `glasswidthmm` =#{glasswidthmm}, `glassheightmm` = #{glassheightmm},  `state` = #{state}, `glasstype` = #{glasstype}, `number` = #{number} WHERE `id` =#{id};")
-    void AddCage(int id,String glassid,Double glasswidth,Double glassheight,Double glasswidthmm,Double glassheightmm,int state,String glasstype,int number);
+    @Update("UPDATE `albania`.`storage_cage` SET `glass_id` =#{glassid}, `width` =width-#{glasswidth}, `glasswidth` =#{glasswidth}, `glassheight` =#{glassheight}, `glasswidthmm` =#{glasswidth}, `glassheightmm` = #{glassheight},  `state` = #{state}, `glasstype` = #{glasstype}, `number` = #{number},thickness=#{thickness},films=#{films},flowcard=#{flowcard},mateid=#{mateid},tier=#{tier}  WHERE `id` =#{id};")
+    void AddCage(int id,String glassid,Double glasswidth,Double glassheight,int state,int glasstype,int number,Double thickness,String films,String flowcard,int mateid,int tier);
     //鑾峰彇杩涚墖鏁版嵁
     @Select("select glassid,flowcard,glasswidth as width,glassheight as height,glasswidthmm,glassheightmm,glasstype,thickness  from queue where state=1 limit 1")
     GlassInfo SelectGlass();
-    //涓�鍙风嚎鏌ヨ浠诲姟
-    @Select("select * from v_cagerelease1 where mateid not in(select mateid from v_cagerelease1 where surplus=0 group by mateid);")
-    GlassInfo SelectOutGlass1();
-    //浜屽彿绾挎煡璇换鍔�
-    @Select("select * from v_cagerelease2 where mateid not in(select mateid from v_cagerelease2 where surplus=0 group by mateid)LIMIT 1;")
-    GlassInfo SelectOutGlass2();
+   
+    //寰呭嚭鐗囦换鍔℃煡璇�
+    @Select("select * from out_task where task_state=0 order by id asc;")
+    List<StorageTask> SelectOutTask();
     //娴佺▼鍗′换鍔℃煡璇�
-    @Select("select G.flowcard,G.glasstype,G.number,G.mateid,G.tier,G.starttime,G.finishnumber,IF((G.number-G.finishnumber-ku.KuCount)<0,G.number,ku.KuCount) as 'surplus',G.totaltier as id from (select Gfd.flowcard,Ggf.glasstype,Ggf.number,Ggf.mateid,Ggf.tier,Ggf.finishnumber,Gfd.starttime,Gfd.totaltier  from flowcard as Gfd LEFT JOIN glassinfo as Ggf on Gfd.flowcard=Ggf.flowcard where Gfd.state=1 and Gfd.line=#{line}) as G left join (select glasstype,sum(number) AS KuCount from storage_cage where flowcard is not null group by glasstype) as ku on G.glasstype=ku.glasstype where G.mateid not in(select mateid from v_cagerelease1 where surplus=0 group by mateid)order by `g`.`starttime`,`g`.`mateid`,`g`.`finishnumber`,`g`.`tier`LIMIT 1;")
+    @Select("select  G.flowcard,G.glasstype,G.number,G.mateid,G.tier,G.starttime,G.finishnumber,IF((G.number-G.finishnumber-ku.KuCount)<0,G.number,IFNULL(ku.KuCount,0)) as 'surplus',G.totaltier as id,G.width,G.glassid from (select Gfd.flowcard,Ggf.glasstype,Ggf.number,Ggf.mateid,Ggf.tier,Ggf.finishnumber,Gfd.starttime,Gfd.totaltier,Ggf.width,Ggf.glassid  from flowcard as Gfd LEFT JOIN glassinfo as Ggf on Gfd.flowcard=Ggf.flowcard where Gfd.state=1 and Gfd.line=1) as G left join (select glasstype,sum(number) AS KuCount from storage_cage where glasstype is not null and disabled=0 group by glasstype) as ku on G.glasstype=ku.glasstype where G.mateid not in(select mateid from v_cagerelease1 where surplus=0 group by mateid) HAVING surplus>0  order by `g`.`starttime`,`g`.`mateid`,`g`.`finishnumber`,`g`.`tier`LIMIT 1;")
     GlassInfo SelectOutGlass(int line);
+    // @Select("select SQL_NO_CACHE G.flowcard,G.glasstype,G.number,G.mateid,G.tier,G.starttime,G.finishnumber,IF((G.number-G.finishnumber-ku.KuCount)<0,G.number,ku.KuCount) as 'surplus',G.totaltier as id,G.width,G.glassid from (select Gfd.flowcard,Ggf.glasstype,Ggf.number,Ggf.mateid,Ggf.tier,Ggf.finishnumber,Gfd.starttime,Gfd.totaltier,Ggf.width,Ggf.glassid  from flowcard as Gfd LEFT JOIN glassinfo as Ggf on Gfd.flowcard=Ggf.flowcard where Gfd.state=1 and Gfd.line=#{line}) as G left join (select glasstype,sum(number) AS KuCount from storage_cage where flowcard is not null group by glasstype) as ku on G.glasstype=ku.glasstype where G.mateid not in(select mateid from v_cagerelease1 where surplus=0 group by mateid)  HAVING surplus>0 order by `g`.`starttime`,`g`.`mateid`,`g`.`finishnumber`,`g`.`tier`LIMIT 1;")
+    // GlassInfo SelectOutGlass(int line);
     //鑾峰彇璇ョ被鍨嬪湪搴撳瓨鐨勪綅缃�
     @Select("select * from storage_cage where glasstype=#{glasstype} and number>0 limit 1")
     StorageCage SelectCageGlass(int glasstype);
     //鍙戦�佸嚭鐗囧悗澧炲姞宸插彂鏁伴噺
-    @Update("update glassinfo set finishnumber=finishnumber+1 where flowcard=#{flowcard} and mateid=#{mateid} and tier=#{tier};")
+    @Update("update glassinfo set finishnumber=ifnull(finishnumber,0)+1 where flowcard=#{flowcard} and mateid=#{mateid} and tier=#{tier};")
     void AddFinishNumber(String flowcard,int mateid,int tier);
     //鑾峰彇褰撳墠浠诲姟鐨刬d
-    @Select("select id from storage_task where task_state=0 and glass_id=#{glassid} LIMIT 1")
+    @Select("select id from storage_task where task_state=0 and glass_id=#{glassid} ORDER BY id desc LIMIT 1")
     GlassInfo SelectTaskId(String glassid);
+    //鑾峰彇褰撳墠鏈畬鎴愪换鍔$殑鏁伴噺
+    @Select("select count(*) from storage_task where task_state=0")
+    int SelectTaskcount();
+    //鑾峰彇褰撳墠鏈畬鎴愪换鍔$殑鏁伴噺
+    @Select("select count(*) from out_task where task_state=0")
+    int SelectOutTaskCount();
     //鍒犻櫎娴嬮噺琛ㄧ殑淇℃伅
     @Delete("delete from queue where glassid=#{glassid}")
     int DeleteQueue(String glassid);
     //鍒ゆ柇鏄惁鏄洿鍑烘ā寮�
-    @Select("select method from flowcard where state=1 and line=#{line} ORDER BY starttime LIMIT 1;")
+    @Select("select method,flowcard from flowcard where state=1 and line=#{line} ORDER BY starttime LIMIT 1;")
     GlassInfo SelectMethod(int line);
     //鐩村嚭妯″紡浠诲姟鏌ヨ
-    @Select("select b.flowcard,b.glasstype,b.mateid,a.totaltier as id from flowcard a  left join glassinfo b on a.flowcard=b.flowcard where a.line=#{line}")
-    GlassInfo SelectOutGlass2(int line);
-
-
-
+    @Select("select  b.flowcard,b.glassid,b.glasstype,b.mateid,b.width,b.tier,a.totaltier as id,IFNULL(c.number,0)as number from flowcard a  left join glassinfo b on a.flowcard=b.flowcard left join(select sum(number)as number,glasstype from storage_cage GROUP BY glasstype)c on b.glasstype=c.glasstype where  a.state=1 and c.number>0  ORDER BY b.mateid,b.tier asc limit 1")
+    GlassInfo SelectOutGlass2();
+    //鏌ヨ鐩撮�氭ā寮忎笅鏈�鍚庝竴鍧�
+    @Select("select IFNULL(b.tier, 0) from flowcard a  left join glassinfo b on a.flowcard=b.flowcard left join(select sum(number)as number,glasstype from storage_cage GROUP BY glasstype)c on b.glasstype=c.glasstype where a.line=#{line} and c.number>0 ORDER BY b.tier desc LIMIT 1")
+    int SelectOutGlassend(int line);
+    //澧炲姞绗煎瓙琛ㄥ楂�
+    @Select("update storage_cage a set a.glasswidth=#{width},a.glassheight=#{height} where id=#{id} ")
+    void UpdateStorage(double width,double height,int id);
+    //鏇存敼闃熷垪琛ㄧ姸鎬�
+    @Update("update queue set state=2 where glassid=#{glassid};")
+    void UpdateQueueState(String glassid);
+     //鏇存敼闃熷垪琛ㄧ姸鎬�
+     @Select("select*from glassinfo  where glasstype=#{glasstype} limit 1;")
+     GlassInfo SelectGlassinfo(Integer glasstype);
+    //鏌ヨ绾厤鐗囨ā寮忓彲鍑洪厤鐗噄d
+    @Select("select gls.flowcard,gls.mateid,gls.tier,gls.glasstype,kc.number from glassinfo as gls left join (select glasstype,sum(number) as number from storage_cage where number>0 and disabled=0 GROUP BY glasstype)as kc on gls.glasstype=kc.glasstype where gls.flowcard=#{flowcard} and kc.number>0 GROUP BY gls.flowcard, gls.mateid, gls.tier, gls.glasstype, kc.number,mateid  order by gls.mateid;")
+    List<GlassInfo> SelectOutGlass3(String flowcard);
+    //鍒ゆ柇姝ら厤鐗噄d鏄惁鏈夎冻澶熺殑鐜荤拑
+    @Select("SELECT  CASE WHEN storage.number >= required.number THEN '瓒冲' ELSE '涓嶈冻' END AS status FROM (SELECT a.glasstype, COUNT(a.glasstype) AS number FROM glassinfo a WHERE a.flowcard =#{flowcard} AND a.mateid =#{mateid} GROUP BY a.glasstype) AS required LEFT JOIN (SELECT a.glasstype, SUM(a.number) AS number FROM storage_cage a WHERE a.number > 0 and disabled=0 GROUP BY a.glasstype) AS storage ON required.glasstype = storage.glasstype;")
+    List<String> SelectOutGlass4(String flowcard,int mateid);
+    //鏌ヨ姝ら厤鐗噄d闇�瑕佺殑鐜荤拑绫诲瀷
+    @Select("select glasstype,width,sumtier from glassinfo where flowcard=#{flowcard} and mateid=#{mateid}")
+    List<GlassInfo> SelectOutGlass5(String flowcard,int mateid);
+    //鍒ゆ柇姝ょ粍鐜荤拑鏄惁鑳戒竴娆′笂杞�
+    @Select("select sum(width)+(sumtier-1)*300 as width,mateid from glassinfo where flowcard=#{flowcard} and mateid=#{mateid} GROUP BY mateid,sumtier")
+    GlassInfo SelectOutGlass6(String flowcard,int mateid);
+    //鏌ヨ姝ら厤鐗噄d鎵�闇�鐨勭被鍨�
+    @Select("select * from glassinfo where flowcard=#{flowcard} and mateid=#{mateid}")
+    List<GlassInfo> SelectOutGlass7(String flowcard,int mateid);
+    //鏌ヨ姝ら厤鐗噄d鏄惁鏈夊彲鍑虹墖鏁伴噺
+    @Select("SELECT  CASE WHEN number >finishnumber THEN '瓒冲' ELSE '涓嶈冻' END AS status FROM  glassinfo a WHERE a.flowcard =#{flowcard} AND a.mateid =#{mateid}")
+    List<String> SelectOutGlass8(String flowcard,int mateid);
+    //鏌ヨ鐜荤拑淇℃伅
+    @Select("select * from glassinfo where glasstype=#{glasstype} limit 1")
+    GlassInfo SelectGlassInfo(int glasstype);
+    //瀹屾垚鍑虹墖闃熷垪鐨勪换鍔�
+    @Update("update out_task set task_state=1 where id=#{id};")
+    void UpdateOutTask(int id);
+    //鍒ゆ柇姝ゆ牸瀛愭槸鍚﹀湪鍑虹墖闃熷垪鏈夋暟鎹�
+    @Select("select count(*) from out_task where shelf_rack=#{cell} and (task_state=0 or task_state=2)")
+    int SelectOutTasksum(int cell);
 }

--
Gitblit v1.8.0