From 933d18d5d5486743fd4ef0bae77c2ef24c39362a Mon Sep 17 00:00:00 2001
From: wu <731351411@qq.com>
Date: 星期二, 05 九月 2023 16:57:11 +0800
Subject: [PATCH] 提交

---
 springboot-vue3/src/main/java/com/example/springboot/mapper/SpianMapper.java         |   47 +++++++++
 springboot-vue3/src/main/java/com/example/springboot/controller/SpianController.java |   96 +++++++++++++++++++
 springboot-vue3/src/main/java/com/example/springboot/entity/StorageCage.java         |  104 ++++++++++++++++++++
 springboot-vue3/src/main/java/com/example/springboot/service/SpianService.java       |   21 ++++
 4 files changed, 268 insertions(+), 0 deletions(-)

diff --git a/springboot-vue3/src/main/java/com/example/springboot/controller/SpianController.java b/springboot-vue3/src/main/java/com/example/springboot/controller/SpianController.java
new file mode 100644
index 0000000..4b1da37
--- /dev/null
+++ b/springboot-vue3/src/main/java/com/example/springboot/controller/SpianController.java
@@ -0,0 +1,96 @@
+package com.example.springboot.controller;
+
+import com.example.springboot.common.Result;
+import com.example.springboot.entity.StorageCage;
+import com.example.springboot.mapper.SpianMapper;
+import com.example.springboot.service.SpianService;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+import java.util.HashMap;
+import java.util.Map;
+@RestController
+@RequestMapping("/spian")
+
+ 
+public class SpianController {
+    
+    @Autowired
+    SpianMapper spianMapper;
+    
+    
+    @Autowired
+    SpianService spianservice;
+    //鍑虹墖浠诲姟
+@GetMapping("/all2")
+    public Result selectdd(String orderid){
+
+         StorageCage cageout=spianMapper.selectOut(orderid);
+         //鍒ゆ柇鐜荤拑鍙洿鎺ュ嚭鐗囨椂
+         //鐜荤拑鍐呭鐗�
+         
+         int cage =cageout.getCage();
+         int cell =cageout.getCell();
+         int tier =cageout.getTier();
+         double width=cageout.getWidth();
+         if(tier==2){
+                return Result.success("鎵ц鍑虹墖");  
+         }
+         else{  
+           int state= spianMapper.selectGlassState(cage,cell);
+            //鍒ゆ柇鍐呯墖鏄惁闇�瑕佽皟鎷�
+            if(state==0){
+             return Result.success("鐘舵�佷负0,鐩存帴鍑虹墖");  
+             }else{
+              //鐜荤拑闇�瑕佽皟鎷ㄦ椂
+               
+               return Result.success("鐘舵�佷负1,闇�瑕佽璋冩嫧");  
+             }
+        }
+    
+}
+
+   @GetMapping("/all")
+   //杩涚墖浠诲姟,浼犺鍗昳d
+   //鎸夎鍗曚紭鍏堣繘鐗�
+    public Result selectAll(String orderid){
+        //return spianMapper.selectAll(); 
+        int cage1;
+        //String orderid="A001";
+        //鑾峰彇璁㈠崟鐩稿叧搴︽渶楂樼殑绗煎瓙鎺掑簭
+        List<StorageCage> storageCage=spianMapper.selectAll(orderid);
+        for (StorageCage storageCage2 : storageCage) {
+            //淇濆瓨璁㈠崟浼樺厛椤哄簭绗煎瓙鍙�
+            cage1=storageCage2.getCage();
+            //鍒ゆ柇璇ョ瀛愬彿鐩搁偦鏈�澶х殑绌烘牸鏁�
+            int cages=spianMapper.selectCage(cage1);
+            //鍒ゆ柇閫変腑绗煎瓙鏄惁鏈夌┖鏍�
+            StorageCage cages1=spianMapper.selectCage1(cage1);
+            if(cages>1 &&cages1.getTier()!=null){
+                return Result.success(cages1);
+            }
+            
+             
+        }         
+        return Result.success("0");      
+      
+    }
+    
+
+    @PostMapping("/save")
+    public Result save(@RequestBody StorageCage spian){
+        spianservice.Save(spian);
+        return Result.success();
+    }
+
+
+
+
+
+}   
diff --git a/springboot-vue3/src/main/java/com/example/springboot/entity/StorageCage.java b/springboot-vue3/src/main/java/com/example/springboot/entity/StorageCage.java
new file mode 100644
index 0000000..4a05577
--- /dev/null
+++ b/springboot-vue3/src/main/java/com/example/springboot/entity/StorageCage.java
@@ -0,0 +1,104 @@
+package com.example.springboot.entity;
+
+public class StorageCage {
+    private Integer id;
+    private String glassId;
+    private Integer cage;
+    private Integer cell;
+    private Double width;
+    private Double glasswidth;
+    private Double glassheight;
+    private String state;
+    private Integer tier;  
+    private String orderId;
+
+    public Integer id() {
+        return id;
+    }
+    public void setId(Integer id) {
+        this.id = id;
+    }
+    public Integer getId() {
+        return id;
+    }
+
+    public String getGlassId() {
+        return glassId;
+    }
+
+    public void setGlassId(String glassId) {
+        this.glassId = glassId;
+    }
+     public String getOrderId() {
+        return orderId;
+    }
+
+    public void setOrderId(String orderId) {
+        this.orderId = orderId;
+    }
+    
+    public Integer getCage() {
+        return cage;
+    }
+
+    public void setGage(Integer cage) {
+        this.cage = cage;
+    }
+
+    public void setCell(Integer cell) {
+        this.cell = cell;
+    }
+
+    public Integer getCell() {
+        return cell;
+    }
+
+    
+
+    // public String getHeighth() {
+    //     return height;
+    // }
+
+    // public void setHeight(String height) {
+    //     this.height = height;
+    // }
+
+    public Double getWidth() {
+        return width;
+    }
+
+    public void setWidth(Double width) {
+        this.width = width;
+    }
+
+     public String getState() {
+        return state;
+    }
+
+    public void setState(String state) {
+        this.state = state;
+    }
+
+      public Integer getTier() {
+        return tier;
+    }
+
+    public void setTier(Integer tier) {
+        this.tier = tier;
+    }
+     public Double getGlassWidth() {
+        return glasswidth;
+    }
+
+    public void setGlassWidth(Double glasswidth) {
+        this.glasswidth = glasswidth;
+    }
+    public Double getGlassHeight() {
+        return glassheight;
+    }
+  
+    public void setGlassHeight(Double glassheight) {
+        this.glassheight = glassheight;
+    }
+  
+}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/mapper/SpianMapper.java b/springboot-vue3/src/main/java/com/example/springboot/mapper/SpianMapper.java
new file mode 100644
index 0000000..1f08e10
--- /dev/null
+++ b/springboot-vue3/src/main/java/com/example/springboot/mapper/SpianMapper.java
@@ -0,0 +1,47 @@
+package com.example.springboot.mapper;
+import org.apache.ibatis.annotations.*;
+
+import com.example.springboot.common.Result;
+import com.example.springboot.entity.StorageCage;
+import com.example.springboot.entity.StorageTask;
+import com.example.springboot.entity.StorageCage;
+
+import java.util.List;
+
+@Mapper
+
+public interface SpianMapper {
+    //鍒ゆ柇鐩搁偦绗煎瓙鏄惁鏈夌┖鏍�  
+    @Select("select COUNT(if(a.state1=0,cell,null))as cell from (select *,max(state)as state1 from storage_cage a  GROUP BY cage,cell)as a where (a.cage=#{cage1}-1 or a.cage=#{cage1}+1)and if(#{cage1}<6,a.cage>0 and a.cage<6,a.cage>5) GROUP BY cage ORDER BY cell desc LIMIT 1")
+     int selectCage(int  cage1);
+     
+     //@Select("(select*from storage_cage as a  where a.state=0 and cage%2=0 ORDER BY id LIMIT 1)union (select a.* from storage_cage a inner join  (select cage,if(shu2=1,shu3,shu5) as gezi from ( select  cage, count(case when state1=1 and state2=0 then cell else null end)as shu1,  count(case when state1=0 then cell else null end) as shu2, min(case when state1=1 and state2=0 then cell else null end) as shu3, min(case when state1=0 then cell else null end) as shu4, min(case when state1=0 or state2=0 then cell else null end) as shu5 from  (select *,max(state) as state1,min(state) as state2 from storage_cage group by cage,cell) as a where  cage%2!=0  GROUP BY cage HAVING shu2>1 or (shu2=1 and shu1>0)  ) as sss limit 1)as b on a.cage=b.cage and a.cell=b.gezi and a.state=0 order by tier limit 1) ORDER BY id LIMIT 1;")
+    //鑾峰彇璁㈠崟鍙锋帓搴忕殑绌鸿鍗曠瀛�
+     @Select("select cage,COUNT(if(order_id=#{glassid},order_id,null))as orderid from storage_cage where (order_id=#{glassid} or ''='') GROUP BY cage ORDER BY orderid desc; ")
+     List<StorageCage> selectAll(String glassid);
+
+     //鍒ゆ柇璇ョ瀛愭槸鍚︽湁鍚堥�傚搴︾┖鏍�
+     @Select("select COUNT(*),cage,cell,tier from storage_cage where cage=#{cage1} and state=0 and width>=1500 ORDER BY cell,tier")
+     StorageCage selectCage1(int  cage1);
+
+    //@Update("update longzi set glass_id = #{glass_id}, width = #{width}, state = #{state} where cell = #{cell}")
+    @Update("update longzi set glass_id =123, width =1600, state =1 where cell =24")
+     void  update();
+    
+    @Insert("insert into storage_task(task_type,task_state,shelf_rack,load_rack)values(#{storage_task},#{task_state},#{shelf_rack},#{load_rack})")
+     void insert(StorageTask storageTask);
+    
+    //鍑虹墖浠诲姟鏌ヨ
+    @Select("select cage,cell,tier from storage_cage as a where a.order_id=#{orderId} and state=1 order by cage desc,tier desc,cell desc LIMIT 1")
+     StorageCage selectOut(String  orderId);
+    //鍒ゆ柇鍑虹墖涓�1鏃讹紝鏄惁鍙洿鎺ュ嚭鐗�
+    @Select("select state from storage_cage where cage=#{cage} and cell=#{cell} and tier=2;")
+     int selectGlassState(int  cage,int cell);
+     //鍒ゆ柇
+     @Select("select cage,cell,max(state)as shu from storage_cage where width>=#{width} and cage>#{cage1} and cage<#{cage2} GROUP BY cage,cell HAVING shu=0;")
+     int selectGlassCage(double width,int cage1,int cage2);
+     
+    // @Insert("insert into user(name, date, address, user_no) values (#{name}, #{date}, #{address}, #{userNo})")
+    // void insert (Spian spian);
+    
+}
diff --git a/springboot-vue3/src/main/java/com/example/springboot/service/SpianService.java b/springboot-vue3/src/main/java/com/example/springboot/service/SpianService.java
new file mode 100644
index 0000000..4498c05
--- /dev/null
+++ b/springboot-vue3/src/main/java/com/example/springboot/service/SpianService.java
@@ -0,0 +1,21 @@
+package com.example.springboot.service;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.example.springboot.entity.StorageCage;
+import com.example.springboot.mapper.SpianMapper;
+
+@Service
+public class SpianService {
+    @Autowired
+    private SpianMapper spianMapper;
+    public void Save(StorageCage spian){
+        if(spian.getId()==null){
+            spianMapper.update();
+        }else{
+            spianMapper.update();
+        }
+    }
+    
+}

--
Gitblit v1.8.0