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/HomeMapper.java |   79 ++++++++++++++++++++++++++++-----------
 1 files changed, 57 insertions(+), 22 deletions(-)

diff --git a/springboot-vue3/src/main/java/com/example/springboot/mapper/HomeMapper.java b/springboot-vue3/src/main/java/com/example/springboot/mapper/HomeMapper.java
index 018e422..4395cc7 100644
--- a/springboot-vue3/src/main/java/com/example/springboot/mapper/HomeMapper.java
+++ b/springboot-vue3/src/main/java/com/example/springboot/mapper/HomeMapper.java
@@ -23,7 +23,12 @@
   @Select("select cage,round(100-(21-sum(if(state>0,1,state)))/21*100) as cell,21-sum(if(state>0,1,state)) as state from (select cage,cell,max(state) as state from storage_cage group by cage,cell) as cages group by cage")
   List<StorageCage> selectAll();
 
-  @Select("Select cage,sum(case when number=0 or number is null then 1 else 0 end) as cell,100-sum(case when number=0 or number is null then 1 else 0 end)/count(id)*100 as width from storage_cage group by cage")
+  // @Select("Select cage,sum(case when number=0 or number is null then 1 else 0 end) as cell,100-sum(case when number=0 or number is null then 1 else 0 end)/count(id)*100 as width from storage_cage group by cage")
+  // List<StorageCage> selectAlls();
+  // 鏌ヨ姣忎釜绗煎瓙鐨勪娇鐢ㄦ儏鍐�
+  // @Select("Select a.cage,sum(case when a.number=0 or a.number is null then 1 else 0 end)-b.cells as cell,100+b.cells-sum(case when a.number=0 or a.number is null then 1 else 0 end)/count(a.id)*100 as width from storage_cage a left join (select `cage_numbers`.`cage` AS `cages`,count(`a`.`shelf_rack`) AS `cells` from ((select 1 AS `cage` union all select 2 AS `2` union all select 3 AS `3` union all select 4 AS `4`) `cage_numbers` left join `out_task` `a` on((((case when (`a`.`shelf_rack` between 1 and 40) then 1 when (`a`.`shelf_rack` between 41 and 80) then 2 when (`a`.`shelf_rack` between 81 and 120) then 3 when (`a`.`shelf_rack` between 121 and 160) then 4 else NULL end) = `cage_numbers`.`cage`) and (`a`.`task_state` = 0)))) group by `cage_numbers`.`cage` order by `cage_numbers`.`cage`) as b on a.cage=b.cages group by a.cage;")
+  // List<StorageCage> selectAlls();
+  @Select("Select a.cage, GREATEST(sum(case when  a.number is null and disabled=0 then 1 else 0 end),0) as cell,LEAST(100-sum(case when  a.number is null and disabled=0 then 1 else 0 end)/count(a.id)*100,100) as width from storage_cage a left join (select `cage_numbers`.`cage` AS `cages`,count(`a`.`shelf_rack`) AS `cells` from ((select 1 AS `cage` union all select 2 AS `2` union all select 3 AS `3` union all select 4 AS `4`) `cage_numbers` left join `out_task` `a` on((((case when (`a`.`shelf_rack` between 1 and 40) then 1 when (`a`.`shelf_rack` between 41 and 80) then 2 when (`a`.`shelf_rack` between 81 and 120) then 3 when (`a`.`shelf_rack` between 121 and 160) then 4 else NULL end) = `cage_numbers`.`cage`) and (`a`.`task_state` = 0)))) group by `cage_numbers`.`cage` order by `cage_numbers`.`cage`) as b on a.cage=b.cages group by a.cage;")
   List<StorageCage> selectAlls();
 
   // 鏌ヨ10-6绗煎唴灞傛牸瀛愮姸鎬�
@@ -235,11 +240,11 @@
   Short SelectOutingQueueCount(String frameNo);
 
   // 鏌ヨ鐞嗙墖绗煎唴淇℃伅
-  @Select("select * from storage_cage")
+  @Select("select *,b.customer from storage_cage a left join flowcard b on a.flowcard=b.flowcard")
   List<StorageCage> SelectStorageCageInfo();
 
   // 鍒犻櫎鏍煎瓙鍐呯幓鐠冧俊鎭�
-  @Update("update storage_cage set films=null,width=4300,glasswidth=null,glassheight=null,glasswidthmm=null,glassheightmm=null,thickness=null,glasstype=null,number=null,glass_id=null,flowcard=null,mateid=null where cell=#{cell}")
+  @Update("update storage_cage set films=null,width=4300,glasswidth=null,glassheight=null,glasswidthmm=null,glassheightmm=null,thickness=null,glasstype=null,number=null,glass_id=null,flowcard=null,mateid=null,tier=null where cell=#{cell}")
   void DeleteStroageCageByCell(Integer cell);
 
   // 淇敼鏍煎瓙鐜荤拑鏁伴噺
@@ -247,7 +252,7 @@
   void updateStroageCageByCell(Integer cell, Integer num);
 
   // 璁$畻鏍煎瓙鍐呭墿浣欏搴�
-  @Update("update storage_cage set width=4300-if(glasswidth is null,0,glasswidth+300)*number where cell=#{cell}")
+  @Update("update storage_cage set width=4300-if(glasswidth is null,0,glasswidth)*number-(number*300)+300 where cell=#{cell}")
   void UpdateStroageCageWidthByCell(Integer cell);
 
   // 鏍规嵁浠诲姟绫诲瀷鑾峰彇浠诲姟
@@ -261,26 +266,29 @@
   // 鏍规嵁鏍煎瓙鏌ヨ鐜荤拑淇℃伅
   @Select("select * from storage_cage where cell=#{cell}")
   StorageCage SelectStorageByCell(String cell);
+  //鏍规嵁鐜荤拑绫诲瀷鏌ヨ鐜荤拑淇℃伅
+  @Select("select a.shelf_rack as cage,a.load_rack as cell,b.mateid,b.width as glasswidth,b.height as glassheight,b.thickness,b.films,a.tier from storage_task a left join glassinfo b on a.glasstype=b.glasstype where a.id=#{id} limit 1")
+  StorageCage SelectStorageByCellGlass(Integer id);
 
   // 鎵嬪姩瀹屾垚浠诲姟
-  @Select("update storage_task set task_state=1 where id=#{id}")
+  @Select("update storage_task set task_state=#{state} where id=#{id}")
   void FinishTask(Integer id, int state);
   //浜哄伐鍖归厤娴嬮噺鏌ヨ
-  @Select("select gi.* from glassinfo gi inner join flowcard fc on gi.flowcard=fc.flowcard where fc.state!=2 and fc.orderstate=1 and position(#{width} in gi.width) and position(#{height} in gi.height) and position(#{thickness} in gi.thickness) and position(#{films} in gi.films) group by gi.id")
-  List<GlassInfo> SelectGlassInfo(String width, String height, String thickness, String films);
+  @Select("select gi.* from glassinfo gi inner join flowcard fc on gi.flowcard=fc.flowcard where fc.state!=2 and fc.orderstate=1 and position(#{width} in gi.width) and position(#{height} in gi.height) and position(#{thickness} in gi.thickness) and position(#{films} in gi.films) and position(#{tier} in gi.tier) group by gi.id")
+  List<GlassInfo> SelectGlassInfo(String width, String height, String thickness, String films,String tier);
   // @Select("select b.* from flowcard a left join glassinfo b on a.flowcard=b.flowcard INNER JOIN measuresetting c where a.orderstate=1 and a.state!=2 and b.width BETWEEN  #{width} - c.errorwidth AND #{width} + c.errorwidth and b.height BETWEEN  #{height} - c.errorheight AND #{height} + c.errorheight and b.films=#{films} and b.thickness=#{thickness}")
   // List<GlassInfo> SelectGlassInfo(String width, String height, String thickness, String films);
 
 
-  @Update("update storage_cage set glasstype=#{glassInfo.glasstype},mateid=#{glassInfo.mateid},glass_id=#{glassInfo.glassid},flowcard=#{glassInfo.flowcard},glasswidth=#{glassInfo.width},glassheight=#{glassInfo.height},thickness=#{glassInfo.thickness},films=#{glassInfo.films},number=0 where cell=#{cell}")
+  @Update("update storage_cage set glasstype=#{glassInfo.glasstype},mateid=#{glassInfo.mateid},glass_id=#{glassInfo.glassid},flowcard=#{glassInfo.flowcard},glasswidth=#{glassInfo.width},glassheight=#{glassInfo.height},thickness=#{glassInfo.thickness},films=#{glassInfo.films},number=0,tier=#{glassInfo.tier} where cell=#{cell}")
   void StorageCageAddGlass(String cell, GlassInfo glassInfo);
 
-  @Select("select * from flowcard where state!=2")
+  @Select("select id,flowcard,Customer,totaltier,line,state,method,starttime,orderstate from flowcard where state!=2")
   List<Flowcard> SelectOrderTask();
 
   // @Select("select gi.*,sum(sc.number) as cageno from glassinfo gi left join storage_cage sc on gi.glasstype=sc.glasstype where gi.flowcard=#{flowcard} group by gi.id order by gi.mateid,gi.tier")
   // List<GlassInfo> SelectOrderView(String flowcard);
-  @Select("select gi.id, gi.glasstype, gi.mateid, gi.glassid, gi.tier, gi.films, gi.width, gi.height, gi.thickness, gi.number, gi.finishnumber, gi.sumtier, gi.measurenumber,sum(sc.number) as cageno,IFNULL(c.orderstate,0) as orderstate from  glassinfo gi left join storage_cage sc on gi.glasstype=sc.glasstype left join flowcard c on gi.flowcard=c.flowcard where gi.flowcard=#{flowcard} group by gi.id order by gi.mateid,gi.tier")
+  @Select("select gi.id,gi.customer, gi.glasstype, gi.mateid, gi.glassid, gi.tier, gi.films, gi.width, gi.height, gi.thickness, gi.number, gi.finishnumber, gi.sumtier, gi.measurenumber,sum(sc.number) as cageno,IFNULL(c.orderstate,0) as orderstate from  glassinfo gi left join storage_cage sc on gi.glasstype=sc.glasstype left join flowcard c on gi.flowcard=c.flowcard where gi.flowcard=#{flowcard} group by gi.id,orderstate order by gi.mateid,gi.tier")
   List<GlassInfo> SelectOrderView(String flowcard);
 
 
@@ -304,34 +312,48 @@
   // int deleteGlassinfo(String flowcard);
   @Update("Update  flowcard set state=2, flowcard=CONCAT('宸插垹闄�', #{flowcard}),orderstate=0  where flowcard=#{flowcard}")
   int deleteFlowcard(String flowcard);
+  //鏌ヨ褰撳墠绗煎瓙鏄惁杩樻湁璇ヨ鍗曠殑鐜荤拑
 
+  @Select("select count(*) from storage_cage where flowcard=#{flowcard}")
+  int selectflowcardCage(String flowcard);
+  //淇敼鍑虹墖闃熷垪鐘舵��
+  @Update("Update out_task set task_state=#{state} where id=#{id}")
+  int UpdateOutTask(Integer id, Integer state);
+  //鍒犻櫎鍑虹墖闃熷垪
+  @Delete("DELETE from out_task  where id=#{id}")
+  int DeleteOutTask(Integer id);
   @Update("Update  glassinfo set flowcard=CONCAT('宸插垹闄�', #{flowcard}) where flowcard=#{flowcard}")
   int deleteGlassinfo(String flowcard);
-
+  //浜哄伐鍖归厤淇敼涓�鏉�
   @Update("update queue set glassid=concat(#{flowcard},'-',#{tier}),flowcard=#{flowcard},glasswidth=#{width},glassheight=#{height},glasstype=#{glasstype},thickness=#{thickness},mateid=#{mateid},state=1 where state<=0")
   void UpdateQueue(String flowcard, double width, double height, Integer glasstype, Double thickness, Integer tier,int mateid);
   //浜哄伐鍖归厤鏂板涓�鏉�
-  @Insert("INSERT INTO queue (flowcard,glassid,glasswidth,glassheight,glasstype,thickness,mateid,state) VALUES (#{flowcard},concat(#{flowcard},'-',#{tier}),#{width},#{height},#{glasstype},#{thickness},#{mateid},1)")
+  @Insert("INSERT INTO queue (flowcard,glassid,glasswidth,glassheight,glasstype,thickness,mateid,state,time) VALUES (#{flowcard},concat(#{flowcard},'-',#{tier}),#{width},#{height},#{glasstype},#{thickness},#{mateid},1,NOW())")
   int AddQueue(String flowcard, double width, double height, Integer glasstype, Double thickness, Integer tier,int mateid); 
+  //鍒ゆ柇娴嬮噺琛ㄦ槸鍚︽湁鍙洿鏀圭殑鏁版嵁
+  @Select("select count(*) from queue where state<1")
+  int SelectQueue();
   @Update("update glassinfo set finishnumber=ifnull(finishnumber,0)+1 where flowcard=#{flowcard} and mateid=#{mateid} and tier=#{geTier}")
   void AddGlassNo(String flowcard, Integer mateid, Integer geTier);
+  @Update("update glassinfo set finishnumber=ifnull(finishnumber,0)-1 where glasstype=#{glasstype}")
+  void OutGlassNo(Integer glasstype);
 
   // 娣诲姞鍑虹墖闃熷垪
-  @Insert("INSERT INTO glassinfo (`flowcard`, `glasstype`, `mateid`, `glassid`, `tier`, `films`, `width`, `height`, `thickness`, `number`, `finishnumber`, `sumtier`, `measurenumber`)"
+  @Insert("INSERT INTO glassinfo (`flowcard`, `glasstype`, `mateid`, `glassid`, `tier`, `films`, `width`, `height`, `thickness`, `number`, `finishnumber`, `sumtier`, `measurenumber`,Customer)"
       +
-      " VALUES (#{flowcard}, #{glasstype}, #{mateid}, #{glassid}, #{tier}, #{films}, #{width}, #{height}, #{thickness}, #{number}, 0, #{sumtier}, 0)")
+      " VALUES (#{flowcard}, #{glasstype}, #{mateid}, #{glassid}, #{tier}, #{films}, CASE WHEN #{width} > #{height} THEN #{width} ELSE #{height} END, CASE WHEN #{height} > #{width} THEN #{width} ELSE #{height} END, #{thickness}, #{number}, 0, #{sumtier}, 0, #{Customer})")
   void AddGlassinfo(String flowcard, Integer glasstype, Integer mateid, String glassid, Integer tier, String films,
-      Double width, Double height, Double thickness, Integer number, Integer sumtier);
+      Double width, Double height, Double thickness, Integer number, Integer sumtier,String Customer);
 
   // 鏈�澶х幓鐠冪被鍨�
   @Select("select max(glasstype)+1 from glassinfo")
   Integer SelectMaxType();
     // 鏈�澶х幓鐠冪被鍨�
-    @Select("select glasstype from glassinfo where CONCAT(width,'_',height,'_',thickness,'_',films,'_',flowcard)=#{key} limit 1")
+    @Select("select glasstype from glassinfo where CONCAT(width,'_',height,'_',thickness,'_',films,'_',flowcard,'_',mateid)=#{key} limit 1")
     Integer SelectMaxTypes(String key);
 
     //鏌ヨ鎵�鏈夌幓鐠冭啘绯诲拰鍘氬害
-  @Select("select films,thickness from glassinfo GROUP BY films,thickness")
+  @Select("select films,thickness from flowcard a left join glassinfo b on a.flowcard=b.flowcard where orderstate=1 GROUP BY films,thickness")
   List<GlassInfo> SelectMeasure();
   @Select("select*from measuresetting")
   MeasureSetting SelectMeasureSetting();
@@ -348,15 +370,15 @@
   List<Map> Selecttiersum();
 
   // 鏌ヨ绗煎唴鐜荤拑淇℃伅
-  @Select("select * from storage_cage where cage=#{cage} order by id desc")
+  @Select("select DISTINCT * from storage_cage where cage=#{cage} order by id desc")
   List<StorageCage> SelectStorageCageByCage(Integer cage);
 
   // 娣诲姞鍑虹墖闃熷垪
-  @Insert("INSERT INTO flowcard(`flowcard`, `totaltier`, `number`, `line`, `state`, `method`, `starttime`) "
-                    +" select #{flowcard}, 0, #{number}, 0, 0, 0, now() where 0=( select count(*) from flowcard where flowcard=#{flowcard});")
-  void InsertFlowcard(String flowcard, Integer number);
+  @Insert("INSERT INTO flowcard(`flowcard`, `totaltier`, `number`, `line`, `state`, `method`, `starttime`,Customer) "
+                    +" select #{flowcard}, 0, #{number}, 0, 0, 0, now(),#{Customer} where 0=( select count(*) from flowcard where flowcard=#{flowcard});")
+  void InsertFlowcard(String flowcard, Integer number,String Customer);
 
-    @Delete("DELETE FROM queue WHERE id = (SELECT id FROM ( SELECT id FROM queue WHERE glassid = #{glassId} ORDER BY time ASC LIMIT 1) AS temp);")
+    @Delete("DELETE FROM queue WHERE id = (SELECT id FROM ( SELECT id FROM queue WHERE state = 2 ORDER BY time ASC LIMIT 1) AS temp);")
     void DeletequeueByGlassid(String glassId);
 
     @Select("select count(*) from flowcard where line=#{line} and state=1 and flowcard!=#{flowcard}")
@@ -364,4 +386,17 @@
   //淇敼娴嬮噺璁惧畾鑶滅郴鍜屽帤搴�
     @Update("UPDATE measuresetting SET `films` = #{films}, `thickness` = #{thickness} WHERE `id` = 1;")
     int SaveMeasure(String films, Integer thickness);
+    //鏌ヨ鍑虹墖闃熷垪鏁版嵁
+    @Select("SELECT a.id,a.flowcard,customer,a.mateid,a.tier,b.films,b.thickness,b.width,b.height,a.task_state as state,shelf_rack as cell FROM `out_task` a left join glassinfo b on a.glasstype=b.glasstype where task_state!=1 ORDER BY task_state")
+    List<Map>SelectOutTask();
+     //鏌ヨ鍑虹墖璁板綍鏁版嵁
+     @Select(" select DISTINCT a.id,a.flowcard,customer,a.mateid,a.tier,b.films,b.thickness,b.width,b.height,a.task_state as state,a.shelf_rack as cell from storage_task a left join glassinfo b on a.glasstype=b.glasstype where task_type=1 ORDER BY a.id desc LIMIT 6;")
+     List<Map>SelectOutLog();
+     //鏌ヨ鎵爜鏁版嵁
+     @Select("select*from glassinfo a where a.flowcard=#{flowcard} and a.mateid=#{mateid} and a.tier=#{tier} LIMIT 1")
+     GlassInfo SelectCodeGlass(String flowcard,Integer mateid,Integer tier);
+     //鏌ヨ鍑虹墖闃熷垪鐨勭幓鐠冧俊鎭�
+     @Select("select shelf_rack from out_task where id=#{id}")
+     int SelectOutTaskId(Integer id);
+     
 }

--
Gitblit v1.8.0